@rubytech/create-maxy-code 0.1.586 → 0.1.588

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 (90) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +10 -0
  3. package/payload/server/public/activity.html +2 -2
  4. package/payload/server/public/agents.html +2 -2
  5. package/payload/server/public/assets/{AdminLoginScreens-C9-USB3F.js → AdminLoginScreens-DoYIIvBQ.js} +1 -1
  6. package/payload/server/public/assets/AdminLoginScreens-DoYIIvBQ.js.br +0 -0
  7. package/payload/server/public/assets/AdminLoginScreens-DoYIIvBQ.js.gz +0 -0
  8. package/payload/server/public/assets/AdminShell-CzHB95sB.js +3 -0
  9. package/payload/server/public/assets/AdminShell-CzHB95sB.js.br +0 -0
  10. package/payload/server/public/assets/AdminShell-CzHB95sB.js.gz +0 -0
  11. package/payload/server/public/assets/{activity-qTF3J92s.js → activity-jvITtNuy.js} +1 -1
  12. package/payload/server/public/assets/activity-jvITtNuy.js.br +0 -0
  13. package/payload/server/public/assets/activity-jvITtNuy.js.gz +0 -0
  14. package/payload/server/public/assets/{admin-PBRDZ8OG.js → admin-Ck4GDj6I.js} +1 -1
  15. package/payload/server/public/assets/admin-Ck4GDj6I.js.br +0 -0
  16. package/payload/server/public/assets/admin-Ck4GDj6I.js.gz +0 -0
  17. package/payload/server/public/assets/{agents-DNSBvEgj.js → agents-K62OTVqY.js} +1 -1
  18. package/payload/server/public/assets/agents-K62OTVqY.js.br +0 -0
  19. package/payload/server/public/assets/agents-K62OTVqY.js.gz +0 -0
  20. package/payload/server/public/assets/{browser-D68qFX85.js → browser-D44lWNJu.js} +1 -1
  21. package/payload/server/public/assets/browser-D44lWNJu.js.br +0 -0
  22. package/payload/server/public/assets/browser-D44lWNJu.js.gz +0 -0
  23. package/payload/server/public/assets/{calendar-DiyBcrbJ.js → calendar-BeP0MSFX.js} +1 -1
  24. package/payload/server/public/assets/calendar-BeP0MSFX.js.br +0 -0
  25. package/payload/server/public/assets/calendar-BeP0MSFX.js.gz +0 -0
  26. package/payload/server/public/assets/{chat-BgmAjdkp.js → chat-CeDpcouO.js} +1 -1
  27. package/payload/server/public/assets/chat-CeDpcouO.js.br +0 -0
  28. package/payload/server/public/assets/chat-CeDpcouO.js.gz +0 -0
  29. package/payload/server/public/assets/{graph-fZwMrLTq.js → graph-DvB6wgt_.js} +1 -1
  30. package/payload/server/public/assets/graph-DvB6wgt_.js.br +0 -0
  31. package/payload/server/public/assets/graph-DvB6wgt_.js.gz +0 -0
  32. package/payload/server/public/assets/{operator-BuRF6qBf.js → operator-N1tnD0Of.js} +1 -1
  33. package/payload/server/public/assets/operator-N1tnD0Of.js.br +0 -0
  34. package/payload/server/public/assets/operator-N1tnD0Of.js.gz +0 -0
  35. package/payload/server/public/assets/{page-C4NwxoSJ.js → page-CGTC6xi4.js} +1 -1
  36. package/payload/server/public/assets/page-CGTC6xi4.js.br +0 -0
  37. package/payload/server/public/assets/page-CGTC6xi4.js.gz +0 -0
  38. package/payload/server/public/assets/{public-CBrcZ2Sz.js → public-CpkYl4eK.js} +1 -1
  39. package/payload/server/public/assets/public-CpkYl4eK.js.br +0 -0
  40. package/payload/server/public/assets/public-CpkYl4eK.js.gz +0 -0
  41. package/payload/server/public/assets/{routines-Cf1PwvDn.js → routines-Db2sVPdc.js} +1 -1
  42. package/payload/server/public/assets/routines-Db2sVPdc.js.br +0 -0
  43. package/payload/server/public/assets/routines-Db2sVPdc.js.gz +0 -0
  44. package/payload/server/public/assets/{skills-5s3kkr0j.js → skills-DBIFhggq.js} +1 -1
  45. package/payload/server/public/assets/skills-DBIFhggq.js.br +0 -0
  46. package/payload/server/public/assets/skills-DBIFhggq.js.gz +0 -0
  47. package/payload/server/public/assets/{tasks-DBRSqw5m.js → tasks-DUFbl-N-.js} +1 -1
  48. package/payload/server/public/assets/tasks-DUFbl-N-.js.br +0 -0
  49. package/payload/server/public/assets/tasks-DUFbl-N-.js.gz +0 -0
  50. package/payload/server/public/browser.html +2 -2
  51. package/payload/server/public/calendar.html +2 -2
  52. package/payload/server/public/chat.html +3 -3
  53. package/payload/server/public/graph.html +2 -2
  54. package/payload/server/public/index.html +3 -3
  55. package/payload/server/public/operator.html +5 -5
  56. package/payload/server/public/public.html +3 -3
  57. package/payload/server/public/routines.html +2 -2
  58. package/payload/server/public/skills.html +2 -2
  59. package/payload/server/public/tasks.html +2 -2
  60. package/payload/server/public/assets/AdminLoginScreens-C9-USB3F.js.br +0 -0
  61. package/payload/server/public/assets/AdminLoginScreens-C9-USB3F.js.gz +0 -0
  62. package/payload/server/public/assets/AdminShell-BtWb0_Gm.js +0 -3
  63. package/payload/server/public/assets/AdminShell-BtWb0_Gm.js.br +0 -0
  64. package/payload/server/public/assets/AdminShell-BtWb0_Gm.js.gz +0 -0
  65. package/payload/server/public/assets/activity-qTF3J92s.js.br +0 -0
  66. package/payload/server/public/assets/activity-qTF3J92s.js.gz +0 -0
  67. package/payload/server/public/assets/admin-PBRDZ8OG.js.br +0 -0
  68. package/payload/server/public/assets/admin-PBRDZ8OG.js.gz +0 -0
  69. package/payload/server/public/assets/agents-DNSBvEgj.js.br +0 -0
  70. package/payload/server/public/assets/agents-DNSBvEgj.js.gz +0 -0
  71. package/payload/server/public/assets/browser-D68qFX85.js.br +0 -0
  72. package/payload/server/public/assets/browser-D68qFX85.js.gz +0 -0
  73. package/payload/server/public/assets/calendar-DiyBcrbJ.js.br +0 -0
  74. package/payload/server/public/assets/calendar-DiyBcrbJ.js.gz +0 -0
  75. package/payload/server/public/assets/chat-BgmAjdkp.js.br +0 -1
  76. package/payload/server/public/assets/chat-BgmAjdkp.js.gz +0 -0
  77. package/payload/server/public/assets/graph-fZwMrLTq.js.br +0 -0
  78. package/payload/server/public/assets/graph-fZwMrLTq.js.gz +0 -0
  79. package/payload/server/public/assets/operator-BuRF6qBf.js.br +0 -0
  80. package/payload/server/public/assets/operator-BuRF6qBf.js.gz +0 -0
  81. package/payload/server/public/assets/page-C4NwxoSJ.js.br +0 -0
  82. package/payload/server/public/assets/page-C4NwxoSJ.js.gz +0 -0
  83. package/payload/server/public/assets/public-CBrcZ2Sz.js.br +0 -0
  84. package/payload/server/public/assets/public-CBrcZ2Sz.js.gz +0 -0
  85. package/payload/server/public/assets/routines-Cf1PwvDn.js.br +0 -0
  86. package/payload/server/public/assets/routines-Cf1PwvDn.js.gz +0 -0
  87. package/payload/server/public/assets/skills-5s3kkr0j.js.br +0 -0
  88. package/payload/server/public/assets/skills-5s3kkr0j.js.gz +0 -0
  89. package/payload/server/public/assets/tasks-DBRSqw5m.js.br +0 -0
  90. package/payload/server/public/assets/tasks-DBRSqw5m.js.gz +0 -0
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DA-Gezeo.js","assets/preload-helper-eAV8hweq.js","assets/dist-DjYA4E4S.js","assets/chunk-BycB0eMI.js","assets/chunk-U2HBQHQK-DcqGPXEy.js","assets/src-BvINb2fL.js","assets/chunk-5PVQY5BW-C0bRnMKQ.js","assets/chunk-ICPOFSXX-BP8A8zb1.js","assets/_baseFor-BApe6Tla.js","assets/isEmpty-DY_Xp9Na.js","assets/chunk-336JU56O-ChGDYu_S.js","assets/chunk-5FUZZQ4R-B3s1YuQa.js","assets/chunk-X2U36JSP-DtRi7n5Z.js","assets/chunk-ZZ45TVLE-teET41Yh.js","assets/rough.esm-ec8xsRC7.js","assets/chunk-ENJZ2VHE-BdPfdZYB.js","assets/line-K8229GLG.js","assets/path-DY2qBuPM.js","assets/array-eiH4WfvY.js","assets/chunk-BSJP7CBP-0xBlnKJN.js","assets/chunk-426QAEUC-DLLi1nAr.js","assets/chunk-XPW4576I-DmuDCcY3.js"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t,t as n}from"./chunk-BycB0eMI.js";import{i as r,t as i}from"./jsx-runtime-BmNepPEn.js";import{$ as a,A as o,I as s,L as c,M as l,N as u,O as d,V as f,Z as p,_ as m,a as h,j as g,k as _,nt as v,q as y,v as b,y as x}from"./useMediaQuery-B469O83-.js";import{C as S,D as C,E as w,O as T,S as E,T as D,_ as O,a as ee,b as te,c as ne,d as re,g as k,h as ie,i as ae,k as oe,l as se,m as ce,n as le,o as ue,p as de,r as fe,s as pe,t as me,u as he,v as A,w as ge,y as _e}from"./useVoiceRecorder-Bb-51cJv.js";import{A as ve,D as ye,E as be,O as xe,S as Se,T as Ce,b as we,c as Te,d as Ee,l as j,n as De,o as Oe,r as ke,s as Ae,t as je,u as Me,w as Ne,y as Pe}from"./AdminShell-BtWb0_Gm.js";import{t as Fe}from"./chevron-left-0tVo23Dh.js";import{t as Ie}from"./copy-C87QIN_o.js";import{t as Le}from"./file-text-rWowl9RN.js";import{t as Re}from"./play-DgP7vl0r.js";import{t as ze}from"./rotate-ccw-Dnn7gbPh.js";import{t as Be}from"./wrench-Ck4phkdB.js";import{t as Ve}from"./preload-helper-eAV8hweq.js";import{t as He}from"./useCopyFeedback-DfNAu8hQ.js";var Ue=p(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),We=p(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ge=p(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Ke=p(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),qe=p(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Je=p(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ye=p(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]);function Xe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
2
+ import{o as e,r as t,t as n}from"./chunk-BycB0eMI.js";import{i as r,t as i}from"./jsx-runtime-BmNepPEn.js";import{$ as a,A as o,I as s,L as c,M as l,N as u,O as d,V as f,Z as p,_ as m,a as h,j as g,k as _,nt as v,q as y,v as b,y as x}from"./useMediaQuery-B469O83-.js";import{C as S,D as C,E as w,O as T,S as E,T as D,_ as O,a as ee,b as te,c as ne,d as re,g as k,h as ie,i as ae,k as oe,l as se,m as ce,n as le,o as ue,p as de,r as fe,s as pe,t as me,u as he,v as A,w as ge,y as _e}from"./useVoiceRecorder-Bb-51cJv.js";import{A as ve,D as ye,E as be,O as xe,S as Se,T as Ce,b as we,c as Te,d as Ee,l as j,n as De,o as Oe,r as ke,s as Ae,t as je,u as Me,w as Ne,y as Pe}from"./AdminShell-CzHB95sB.js";import{t as Fe}from"./chevron-left-0tVo23Dh.js";import{t as Ie}from"./copy-C87QIN_o.js";import{t as Le}from"./file-text-rWowl9RN.js";import{t as Re}from"./play-DgP7vl0r.js";import{t as ze}from"./rotate-ccw-Dnn7gbPh.js";import{t as Be}from"./wrench-Ck4phkdB.js";import{t as Ve}from"./preload-helper-eAV8hweq.js";import{t as He}from"./useCopyFeedback-DfNAu8hQ.js";var Ue=p(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),We=p(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ge=p(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Ke=p(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),qe=p(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Je=p(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ye=p(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]);function Xe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
3
3
  `,r-1)+1,a=e.indexOf(`
4
4
  `,r),o=a===-1?e.length:a;if(r!==o)return null;let s=e.slice(i,o),c=s.match(/^(\s*)(\d+)\.[ \t]*$/);if(c){let t=c[1];return{value:e.slice(0,i)+t+e.slice(o),caret:i+t.length}}let l=s.match(/^(\s*)(\d+)\.[ \t]/);if(l){let t=`\n${l[1]}${parseInt(l[2],10)+1}. `;return{value:e.slice(0,r)+t+e.slice(r),caret:r+t.length}}return null}function Ze(e,t){let n=[];for(let r of e){if(r.kind!==`file`)continue;let e=r.getAsFile();if(e)if(e.name===``||e.name===`image.png`){let r=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([e],`pasted-image-${t}.${r}`,{type:e.type}))}else n.push(e)}return n}var Qe=new Set([`audio/ogg`,`audio/opus`,`audio/webm`,`audio/mp4`,`audio/x-m4a`,`audio/mpeg`,`audio/wav`,`video/mp4`]);function $e(e){return e.split(`;`)[0].trim().toLowerCase()}function et(e){return Qe.has($e(e))}function M(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var tt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rt={};function it(e,t){return((t||rt).jsx?nt:tt).test(e)}var N=/[ \t\n\f\r]/g;function at(e){return typeof e==`object`?e.type===`text`?ot(e.value):!1:ot(e)}function ot(e){return e.replace(N,``)===``}var P=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};P.prototype.normal={},P.prototype.property={},P.prototype.space=void 0;function st(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new P(n,r,t)}function ct(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var lt=t({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>V,commaSeparated:()=>B,number:()=>R,overloadedBoolean:()=>dt,spaceSeparated:()=>z}),ut=0,I=ft(),L=ft(),dt=ft(),R=ft(),z=ft(),B=ft(),V=ft();function ft(){return 2**++ut}var pt=Object.keys(lt),mt=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),ht(this,`space`,r),typeof n==`number`)for(;++i<pt.length;){let e=pt[i];ht(this,pt[i],(n&lt[e])===lt[e])}}};mt.prototype.defined=!0;function ht(e,t,n){n&&(e[t]=n)}function gt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new mt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ct(r)]=r,n[ct(a.attribute)]=r}return new P(t,n,e.space)}var _t=gt({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:z,ariaCurrent:null,ariaDescribedBy:z,ariaDetails:null,ariaDisabled:L,ariaDropEffect:z,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:z,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:z,ariaLevel:R,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:z,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:z,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:L,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function vt(e,t){return t in e?e[t]:t}function yt(e,t){return vt(e,t.toLowerCase())}var bt=gt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:B,acceptCharset:z,accessKey:z,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:z,autoFocus:I,autoPlay:I,blocking:z,capture:null,charSet:null,checked:I,cite:null,className:z,cols:R,colSpan:null,content:null,contentEditable:L,controls:I,controlsList:z,coords:R|B,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:dt,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:z,height:R,hidden:dt,high:R,href:null,hrefLang:null,htmlFor:z,httpEquiv:z,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:z,itemRef:z,itemScope:I,itemType:z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:I,optimum:R,pattern:null,ping:z,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:z,required:I,reversed:I,rows:R,rowSpan:R,sandbox:z,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:L,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:z,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:R,security:null,unselectable:null},space:`html`,transform:yt}),xt=gt({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:V,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:z,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:B,g2:B,glyphName:B,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:V,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:z,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:V,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:V,rev:V,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:V,requiredFeatures:V,requiredFonts:V,requiredFormats:V,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:V,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:V,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:V,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:vt}),St=gt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Ct=gt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:yt}),wt=gt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Tt={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Et=/[A-Z]/g,Dt=/-[a-z]/g,Ot=/^data[-\w.:]+$/i;function kt(e,t){let n=ct(t),r=t,i=F;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Dt,jt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Dt.test(e)){let n=e.replace(Et,At);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=mt}return new i(r,t)}function At(e){return`-`+e.toLowerCase()}function jt(e){return e.charAt(1).toUpperCase()}var Mt=st([_t,bt,St,Ct,wt],`html`),Nt=st([_t,xt,St,Ct,wt],`svg`);function Pt(e){return e.join(` `).trim()}var Ft=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
5
5
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),H=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Ft());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),It=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Lt=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(H()),r=It();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Rt=Bt(`end`),zt=Bt(`start`);function Bt(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Vt(e){let t=zt(e),n=Rt(e);if(t&&n)return{start:t,end:n}}function Ht(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Wt(e.position):`start`in e||`end`in e?Wt(e):`line`in e||`column`in e?Ut(e):``}function Ut(e){return Gt(e&&e.line)+`:`+Gt(e&&e.column)}function Wt(e){return Ut(e&&e.start)+`-`+Ut(e&&e.end)}function Gt(e){return e&&typeof e==`number`?e:1}var U=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ht(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};U.prototype.file=``,U.prototype.name=``,U.prototype.reason=``,U.prototype.message=``,U.prototype.stack=``,U.prototype.column=void 0,U.prototype.line=void 0,U.prototype.ancestors=void 0,U.prototype.cause=void 0,U.prototype.fatal=void 0,U.prototype.place=void 0,U.prototype.ruleId=void 0,U.prototype.source=void 0;var Kt=e(Lt(),1),qt={}.hasOwnProperty,Jt=new Map,Yt=/[A-Z]/g,Xt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Zt=new Set([`td`,`th`]),Qt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function $t(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=dn(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=un(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Nt:Mt,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=en(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function en(e,t,n){if(t.type===`element`)return tn(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return nn(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return an(e,t,n);if(t.type===`mdxjsEsm`)return rn(e,t);if(t.type===`root`)return on(e,t,n);if(t.type===`text`)return sn(e,t)}function tn(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Nt,e.schema=i),e.ancestors.push(t);let a=_n(e,t.tagName,!1),o=fn(e,t),s=mn(e,t);return Xt.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!at(e):!0})),cn(e,o,a,t),ln(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function nn(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}vn(e,t.position)}function rn(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vn(e,t.position)}function an(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Nt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:_n(e,t.name,!0),o=pn(e,t),s=mn(e,t);return cn(e,o,a,t),ln(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function on(e,t,n){let r={};return ln(r,mn(e,t)),e.create(t,e.Fragment,r,n)}function sn(e,t){return t.value}function cn(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ln(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function un(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function dn(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=zt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function fn(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&qt.call(t.properties,i)){let a=hn(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Zt.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function pn(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vn(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else vn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function mn(e,t){let n=[],r=-1,i=e.passKeys?new Map:Jt;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=en(e,a,o);s!==void 0&&n.push(s)}return n}function hn(e,t,n){let r=kt(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?M(n):Pt(n)),r.property===`style`){let t=typeof n==`object`?n:gn(e,String(n));return e.stylePropertyNameCase===`css`&&(t=yn(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Tt[r.property]||r.property:r.attribute,n]}}function gn(e,t){try{return(0,Kt.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new U("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Qt+`#cannot-parse-style-attribute`,r}}function _n(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=it(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=it(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return qt.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vn(e)}function vn(e,t){let n=new U("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Qt+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function yn(e){let t={},n;for(n in e)qt.call(e,n)&&(t[bn(n)]=e[n]);return t}function bn(e){let t=e.replace(Yt,xn);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function xn(e){return`-`+e.toLowerCase()}var Sn={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Cn={};function wn(e,t){let n=t||Cn;return Tn(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Tn(e,t,n){if(Dn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return En(e.children,t,n)}return Array.isArray(e)?En(e,t,n):``}function En(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Tn(e[i],t,n);return r.join(``)}function Dn(e){return!!(e&&typeof e==`object`)}var On=document.createElement(`i`);function kn(e){let t=`&`+e+`;`;On.innerHTML=t;let n=On.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function W(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function An(e,t){return e.length>0?(W(e,e.length,0,t),e):t}var jn={}.hasOwnProperty;function Mn(e){let t={},n=-1;for(;++n<e.length;)Nn(t,e[n]);return t}function Nn(e,t){let n;for(n in t){let r=(jn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){jn.call(r,a)||(r[a]=[]);let e=i[a];Pn(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Pn(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);W(e,0,0,r)}function Fn(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function In(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=Wn(/[A-Za-z]/),K=Wn(/[\dA-Za-z]/),Ln=Wn(/[#-'*+\--9=?A-Z^-~]/);function Rn(e){return e!==null&&(e<32||e===127)}var zn=Wn(/\d/),Bn=Wn(/[\dA-Fa-f]/),Vn=Wn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var Hn=Wn(/\p{P}|\p{S}/u),Un=Wn(/\s/);function Wn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Gn(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&K(e.charCodeAt(n+1))&&K(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Kn={tokenize:qn};function qn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Jn={tokenize:Xn},Yn={tokenize:Zn};function Xn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return W(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Yn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;W(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Zn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Qn(e){if(e===null||J(e)||Un(e))return 1;if(Hn(e))return 2}function $n(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var er={name:`attention`,resolveAll:tr,tokenize:nr};function tr(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};rr(d,-c),rr(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=An(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=An(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=An(l,$n(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=An(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=An(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,W(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function nr(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Qn(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function rr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ir={name:`autolink`,tokenize:ar};function ar(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return G(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||K(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||K(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Rn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ln(t)?(e.consume(t),l):n(t)}function u(e){return K(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||K(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var or={partial:!0,tokenize:sr};function sr(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||q(e)?t(e):n(e)}}var cr={continuation:{tokenize:ur},exit:dr,name:`blockQuote`,tokenize:lr};function lr(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ur(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(cr,t,n)(r)}}function dr(e){e.exit(`blockQuote`)}var fr={name:`characterEscape`,tokenize:pr};function pr(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Vn(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var mr={name:`characterReference`,tokenize:hr};function hr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=K,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Bn,u):(e.enter(`characterReferenceValue`),a=7,o=zn,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===K&&!kn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var gr={partial:!0,tokenize:yr},_r={concrete:!0,name:`codeFenced`,tokenize:vr};function vr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(gr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(gr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function yr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var br={name:`codeIndented`,tokenize:Sr},xr={partial:!0,tokenize:Cr};function Sr(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):q(t)?e.attempt(xr,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Cr(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):q(e)?i(e):n(e)}}var wr={name:`codeText`,previous:Er,resolve:Tr,tokenize:Dr};function Tr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Er(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Dr(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Or=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&kr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),kr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),kr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);kr(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);kr(this.left,t.reverse())}}};function kr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ar(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Or(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,jr(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return W(e,0,1/0,u.slice(0)),!l}function jr(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Mr={resolve:Pr,tokenize:Fr},Nr={partial:!0,tokenize:Ir};function Pr(e){return Ar(e),e}function Fr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):q(t)?e.check(Nr,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Ir(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Lr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Rn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Rn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Rr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function zr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Br(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Vr={name:`definition`,tokenize:Ur},Hr={partial:!0,tokenize:Wr};function Ur(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Rr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?Br(e,l)(t):l(t)}function l(t){return Lr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Hr,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Wr(e,t,n){return r;function r(t){return J(t)?Br(e,i)(t):n(t)}function i(t){return zr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Gr={name:`hardBreakEscape`,tokenize:Kr};function Kr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var qr={name:`headingAtx`,resolve:Jr,tokenize:Yr};function Jr(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},W(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Yr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Xr=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Zr=[`pre`,`script`,`style`,`textarea`],Qr={concrete:!0,name:`htmlFlow`,resolveTo:ti,tokenize:ni},$r={partial:!0,tokenize:ii},ei={partial:!0,tokenize:ri};function ti(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ni(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:oe):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:oe):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:oe):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Zr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Xr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),re):t===60&&i===1?(e.consume(t),k):t===62&&i===4?(e.consume(t),se):t===63&&i===3?(e.consume(t),oe):t===93&&i===5?(e.consume(t),ae):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check($r,ce,ee)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(ei,te,ce)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||q(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function re(t){return t===45?(e.consume(t),oe):O(t)}function k(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return Zr.includes(n)?(e.consume(t),se):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),oe):O(t)}function oe(t){return t===62?(e.consume(t),se):t===45&&i===2?(e.consume(t),oe):O(t)}function se(t){return t===null||q(t)?(e.exit(`htmlFlowData`),ce(t)):(e.consume(t),se)}function ce(n){return e.exit(`htmlFlow`),t(n)}}function ri(e,t,n){let r=this;return i;function i(t){return q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ii(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(or,t,n)}}var ai={name:`htmlText`,tokenize:oi};function oi(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,k(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?re(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,k(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?re(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?re(t):q(t)?(o=v,k(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,k(t)):(e.consume(t),y)}function b(e){return e===62?re(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,k(t)):Y(t)?(e.consume(t),C):re(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),re):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,k(t)):Y(t)?(e.consume(t),T):re(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,k(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):q(t)?(o=O,k(t)):Y(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):q(t)?(o=ee,k(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||J(e)?T(e):n(e)}function re(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function k(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return Y(t)?X(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}var si={name:`labelEnd`,resolveAll:di,resolveTo:fi,tokenize:pi},ci={tokenize:mi},li={tokenize:hi},ui={tokenize:gi};function di(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&W(e,0,e.length,n),e}function fi(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=An(s,e.slice(a+1,a+r+3)),s=An(s,[[`enter`,u,t]]),s=An(s,$n(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=An(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=An(s,e.slice(o+1)),s=An(s,[[`exit`,c,t]]),W(e,a,e.length,s),e}function pi(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(In(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ci,u,o?u:d)(t):t===91?e.attempt(li,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ui,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function mi(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?Br(e,a)(t):a(t)}function a(t){return t===41?u(t):Lr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?Br(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?zr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?Br(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function hi(e,t,n){let r=this;return i;function i(t){return Rr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function gi(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var _i={name:`labelStartImage`,resolveAll:si.resolveAll,tokenize:vi};function vi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var yi={name:`labelStartLink`,resolveAll:si.resolveAll,tokenize:bi};function bi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var xi={name:`lineEnding`,tokenize:Si};function Si(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var Ci={name:`thematicBreak`,tokenize:wi};function wi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:Oi},exit:Ai,name:`list`,tokenize:Di},Ti={partial:!0,tokenize:ji},Ei={partial:!0,tokenize:ki};function Di(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:zn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Ci,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return zn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(or,r.interrupt?n:u,e.attempt(Ti,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(or,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ei,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ki(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Ai(e){e.exit(this.containerState.type)}function ji(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Mi={name:`setextUnderline`,resolveTo:Ni,tokenize:Pi};function Ni(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Pi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Fi={tokenize:Ii};function Ii(e){let t=this,n=e.attempt(or,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Mr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Li={resolveAll:Vi()},Ri=Bi(`string`),zi=Bi(`text`);function Bi(e){return{resolveAll:Vi(e===`text`?Hi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Vi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Hi(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ui=t({attentionMarkers:()=>Zi,contentInitial:()=>Gi,disable:()=>Qi,document:()=>Wi,flow:()=>qi,flowInitial:()=>Ki,insideSpan:()=>Xi,string:()=>Ji,text:()=>Yi}),Wi={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:cr},Gi={91:Vr},Ki={[-2]:br,[-1]:br,32:br},qi={35:qr,42:Ci,45:[Mi,Ci],60:Qr,61:Mi,95:Ci,96:_r,126:_r},Ji={38:mr,92:fr},Yi={[-5]:xi,[-4]:xi,[-3]:xi,33:_i,38:mr,42:er,60:[ir,ai],91:yi,92:[Gr,fr],93:si,95:er,96:wr},Xi={null:[er,Li]},Zi={null:[42,95]},Qi={null:[]};function $i(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=An(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=$n(a,l.events,l),l.events):[]}function f(e,t){return ta(p(e),t)}function p(e){return ea(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&W(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ea(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function ta(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BmNepPEn.js";import"./useMediaQuery-B469O83-.js";import"./useVoiceRecorder-Bb-51cJv.js";import{O as i}from"./AdminShell-BtWb0_Gm.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-C4NwxoSJ.js";import"./useCopyFeedback-DfNAu8hQ.js";var d=n(),f=e(t(),1),p=r();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&sessionStorage.setItem(s,e)}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BmNepPEn.js";import"./useMediaQuery-B469O83-.js";import"./useVoiceRecorder-Bb-51cJv.js";import{O as i}from"./AdminShell-CzHB95sB.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-CGTC6xi4.js";import"./useCopyFeedback-DfNAu8hQ.js";var d=n(),f=e(t(),1),p=r();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&sessionStorage.setItem(s,e)}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
@@ -1,2 +1,2 @@
1
- import{o as e,t}from"./chunk-BycB0eMI.js";import{i as n,n as r,t as i}from"./jsx-runtime-BmNepPEn.js";import{F as a,G as o,L as s,M as c,O as l,V as u,Y as d,Z as f,_ as p,it as m,j as h,k as g,m as _,p as v,v as y}from"./useMediaQuery-B469O83-.js";import{A as b,m as x,t as S}from"./AdminShell-BtWb0_Gm.js";import{t as C}from"./clock-D2cZ0sge.js";import{t as w}from"./triangle-alert-el772yUQ.js";import{t as ee}from"./wrench-Ck4phkdB.js";import{r as T}from"./file-download-B7zwa78w.js";var te=f(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),ne=f(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),E=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),D=r(),O=e(n(),1),k=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function A(e,t){if(e===`*`)return{kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1};let n=e.match(/^(\*|\d+-\d+)\/(\d+)$/);if(n){let e=Number(n[2]);if(e<1)return null;if(n[1]===`*`)return{kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:e};let[r,i]=n[1].split(`-`).map(Number);return r>t||i>t||r>i?null:{kind:`step`,value:0,rangeStart:r,rangeEnd:i,step:e}}let r=e.match(/^(\d+)-(\d+)$/);if(r){let e=Number(r[1]),n=Number(r[2]);return e>t||n>t||e>n?null:{kind:`step`,value:0,rangeStart:e,rangeEnd:n,step:1}}if(/^\d+$/.test(e)){let n=Number(e);return n>t?null:{kind:`fixed`,value:n,rangeStart:null,rangeEnd:null,step:1}}return null}function j(e){return String(e).padStart(2,`0`)}function M(e){if(e===`*`)return null;let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);return e>7||n>7||e>n?`invalid`:`${k[e%7]} to ${k[n%7]}`}let n=e.split(`,`);return n.length>0&&n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?n.map(e=>k[Number(e)%7]).join(`, `):`invalid`}function N(e){let t=e.trim().split(/\s+/);if(t.length!==5)return e;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i)||i!==`*`&&(Number(i)<1||Number(i)>31))return e;let s=A(n,59),c=A(r,23);if(!s||!c)return e;let l=M(o);if(l===`invalid`||s.kind===`step`&&s.rangeStart!==null||(s.kind===`any`&&(s={kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:1}),c.kind===`step`&&c.step===1&&c.rangeStart===null&&(c={kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1}),i!==`*`&&!(s.kind===`fixed`&&c.kind===`fixed`&&o===`*`))||s.kind===`step`&&c.kind===`step`&&c.step>1)return e;let u=l?`, ${l}`:``,d=e=>e.rangeStart+Math.floor((e.rangeEnd-e.rangeStart)/e.step)*e.step;if(s.kind===`step`){let e=s.step===1?`Every minute`:`Every ${s.step} minutes`;return c.kind===`any`?`${e}${u}`:c.kind===`fixed`?`${e}, ${j(c.value)}:00 to ${j(c.value)}:59${u}`:`${e}, ${j(c.rangeStart)}:00 to ${j(d(c))}:00${u}`}if(c.kind===`step`){let e=j(s.value),t=s.value===0?``:` at :${e}`;return c.rangeStart===null?`Every ${c.step} hours${t}${u}`:c.step===1?`Hourly, ${j(c.rangeStart)}:${e} to ${j(c.rangeEnd)}:${e}${u}`:`Every ${c.step} hours, ${j(c.rangeStart)}:${e} to ${j(d(c))}:${e}${u}`}if(c.kind===`any`)return`${s.value===0?`Every hour`:`Every hour at :${j(s.value)}`}${u}`;let f=`${j(c.value)}:${j(s.value)}`;return i===`*`?l?`${l} at ${f}`:`Daily at ${f}`:`Monthly on day ${Number(i)} at ${f}`}var P={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function F(e){let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);if(e>7||n>7||e>n)return null;let r=[];for(let t=e;t<=n;t+=1)r.push(t%7);return[...new Set(r)].sort((e,t)=>e-t)}let n=e.split(`,`);return n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?[...new Set(n.map(e=>Number(e)%7))].sort((e,t)=>e-t):null}function I(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i))return null;let s=A(n,59),c=A(r,23);if(!s||!c||s.kind===`step`&&s.rangeStart!==null)return null;let l=`every`,u=[],d=1;if(i!==`*`){if(o!==`*`)return null;let e=Number(i);if(e<1||e>31||s.kind!==`fixed`||c.kind!==`fixed`)return null;l=`dayOfMonth`,d=e}else if(o!==`*`){let e=F(o);if(e===null)return null;l=`weekdays`,u=e}let f={dayMode:l,weekdays:u,dayOfMonth:d};if(s.kind===`any`||s.kind===`step`){if(c.kind===`step`&&c.step>1)return null;let e=s.kind===`any`?1:s.step,t=c.kind===`any`?null:c.kind===`fixed`?{start:c.value,end:c.value}:{start:c.rangeStart,end:c.rangeEnd};return{...P,...f,timeMode:`everyMinutes`,minute:0,interval:e,window:t}}return c.kind===`fixed`?{...P,...f,timeMode:`at`,minute:s.value,hour:c.value}:c.kind===`any`?{...P,...f,timeMode:`everyHours`,minute:s.value,interval:1,window:null}:{...P,...f,timeMode:`everyHours`,minute:s.value,interval:c.step,window:c.rangeStart===null?null:{start:c.rangeStart,end:c.rangeEnd}}}function L(e){return e.dayMode===`dayOfMonth`?[String(e.dayOfMonth),`*`]:e.dayMode===`weekdays`&&e.weekdays.length>0?[`*`,[...e.weekdays].sort((e,t)=>e-t).join(`,`)]:[`*`,`*`]}function R(e){let[t,n]=L(e);if(e.timeMode===`everyMinutes`){let r=e.window===null?`*`:e.window.start===e.window.end?String(e.window.start):`${e.window.start}-${e.window.end}`;return`*/${e.interval} ${r} ${t} * ${n}`}if(e.timeMode===`everyHours`){let r=e.window===null?e.interval===1?`*`:`*/${e.interval}`:e.interval===1?`${e.window.start}-${e.window.end}`:`${e.window.start}-${e.window.end}/${e.interval}`;return`${e.minute} ${r} ${t} * ${n}`}return`${e.minute} ${e.hour} ${t} * ${n}`}var z={scheduled:`live`,suspended:`stood-down`,due:`inert`,cancelled:`inert`,completed:`inert`};function re(e){return e==null||!Object.hasOwn(z,e)?`unknown`:z[e]}var B={scheduled:{control:`suspend`,note:null},suspended:{control:`resume`,note:null},due:{control:`none`,note:`This one-time routine has already been dispatched. It will not run again.`},cancelled:{control:`none`,note:`This routine was cancelled and cannot be restarted. Delete it, or create a new one.`},completed:{control:`none`,note:`This routine has finished and will not run again.`}},ie={control:`none`,note:`This routine's status is not one this dashboard recognises, so no start or stop is offered.`};function ae(e){return e==null||!Object.hasOwn(B,e)?ie:B[e]}var V={finished:`live`,gated:`live`,started:`in-flight`,accepted:`in-flight`,open:`in-flight`,failed:`error`,"no-destination":`warning`};function oe(e){return e==null||!Object.hasOwn(V,e)?`unknown`:V[e]}function H(e){return e===`gated`?`skipped: no work`:e??`unknown`}var U=i(),se=[{value:1,label:`Mon`},{value:2,label:`Tue`},{value:3,label:`Wed`},{value:4,label:`Thu`},{value:5,label:`Fri`},{value:6,label:`Sat`},{value:0,label:`Sun`}],W=Array.from({length:24},(e,t)=>t),G=e=>String(e).padStart(2,`0`),K={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function ce({recurrence:e,onChange:t,disabled:n}){let r=e?I(e):K,[i,a]=(0,O.useState)(r??K),[o]=(0,O.useState)(e!=null&&r==null),[s,c]=(0,O.useState)(e??``);if((0,O.useEffect)(()=>{fetch(`/api/_client-error`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:`event`,source:`routines`,op:`schedule-editor`,mode:o?`raw`:`builder`}),keepalive:!0}).catch(()=>{})},[o]),o)return(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Schedule (advanced)`}),(0,U.jsx)(`input`,{type:`text`,className:`routine-raw-cron`,value:s,disabled:n,onChange:e=>{c(e.target.value),t(e.target.value)},"aria-label":`Cron expression`}),(0,U.jsx)(`span`,{className:`routine-raw-note`,children:`This routine uses an advanced schedule, edited as a raw cron expression.`})]});let l=e=>{a(e),t(R(e))},u=e=>{let t=e!==`at`&&i.dayMode===`dayOfMonth`?`every`:i.dayMode;l({...i,timeMode:e,dayMode:t})},d=e=>{let t=e===`weekdays`&&i.weekdays.length===0?[1]:i.weekdays;l({...i,dayMode:e,weekdays:t})},f=e=>{let[t,n]=e.split(`:`);l({...i,hour:Number(t)||0,minute:Number(n)||0})},p=e=>{let t=i.weekdays.includes(e);if(t&&i.weekdays.length===1)return;let n=t?i.weekdays.filter(t=>t!==e):[...i.weekdays,e];l({...i,weekdays:n})},m=e=>l({...i,window:e?{start:0,end:23}:null}),h=(e,t)=>{let n={...i.window??{start:0,end:23},[e]:Number(t)};n.start>n.end&&(e===`start`?n.end=n.start:n.start=n.end),l({...i,window:n})},g=(e,t,n)=>Math.min(n,Math.max(t,Number(e)||t));return(0,U.jsxs)(`div`,{className:`routine-sched`,children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`How often`}),(0,U.jsxs)(`select`,{"aria-label":`How often`,value:i.timeMode,disabled:n,onChange:e=>u(e.target.value),children:[(0,U.jsx)(`option`,{value:`at`,children:`At a time of day`}),(0,U.jsx)(`option`,{value:`everyMinutes`,children:`Every few minutes`}),(0,U.jsx)(`option`,{value:`everyHours`,children:`Every few hours`})]})]}),i.timeMode===`at`&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Time of day`}),(0,U.jsx)(`input`,{type:`time`,"aria-label":`Time of day`,value:`${G(i.hour)}:${G(i.minute)}`,disabled:n,onChange:e=>f(e.target.value)})]}),i.timeMode===`everyMinutes`&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Minutes between runs`}),(0,U.jsx)(`input`,{type:`number`,min:1,max:59,"aria-label":`Minutes between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,59)})})]}),i.timeMode===`everyHours`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Hours between runs`}),(0,U.jsx)(`input`,{type:`number`,min:1,max:23,"aria-label":`Hours between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,23)})})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Minute of the hour`}),(0,U.jsx)(`input`,{type:`number`,min:0,max:59,"aria-label":`Minute of the hour`,value:i.minute,disabled:n,onChange:e=>l({...i,minute:g(e.target.value,0,59)})})]})]}),i.timeMode!==`at`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`cal-modal-field routine-sched-check`,children:[(0,U.jsx)(`input`,{type:`checkbox`,"aria-label":`Only between certain hours`,checked:i.window!==null,disabled:n,onChange:e=>m(e.target.checked)}),(0,U.jsx)(`span`,{children:`Only between certain hours`})]}),i.window!==null&&(0,U.jsxs)(`div`,{className:`routine-sched-row`,children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`From hour`}),(0,U.jsx)(`select`,{"aria-label":`From hour`,value:i.window.start,disabled:n,onChange:e=>h(`start`,e.target.value),children:W.map(e=>(0,U.jsxs)(`option`,{value:e,children:[G(e),`:00`]},e))})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`To hour`}),(0,U.jsx)(`select`,{"aria-label":`To hour`,value:i.window.end,disabled:n,onChange:e=>h(`end`,e.target.value),children:W.map(e=>(0,U.jsxs)(`option`,{value:e,children:[G(e),`:00`]},e))})]})]})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Which days`}),(0,U.jsxs)(`select`,{"aria-label":`Which days`,value:i.dayMode,disabled:n,onChange:e=>d(e.target.value),children:[(0,U.jsx)(`option`,{value:`every`,children:`Every day`}),(0,U.jsx)(`option`,{value:`weekdays`,children:`Specific days`}),i.timeMode===`at`&&(0,U.jsx)(`option`,{value:`dayOfMonth`,children:`A day of the month`})]})]}),i.dayMode===`weekdays`&&(0,U.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Days`}),(0,U.jsx)(`div`,{className:`routine-weekdays`,children:se.map(e=>(0,U.jsx)(`button`,{type:`button`,className:`routine-weekday${i.weekdays.includes(e.value)?` routine-weekday-on`:``}`,"aria-pressed":i.weekdays.includes(e.value),disabled:n,onClick:()=>p(e.value),children:e.label},e.value))})]}),i.dayMode===`dayOfMonth`&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Day of month`}),(0,U.jsx)(`select`,{"aria-label":`Day of month`,value:i.dayOfMonth,disabled:n,onChange:e=>l({...i,dayOfMonth:Number(e.target.value)||1}),children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]})]})}function q(e){let t=e.trim().replace(/[\s\-().]/g,``).replace(/^\+/,``);return/^\d{11,15}$/.test(t)?`+${t.slice(0,2)} ${t.slice(2,6)} ${t.slice(6)}`:e}function le(e){if(e.name)return`${e.name} · ${e.label}`;let t=e.channel===`whatsapp`?q(e.destination):e.destination;return`${e.label} · ${t}`}function ue({eventStatus:e}){let t=re(e);return(0,U.jsx)(`span`,{className:`routine-status-dot is-${t}`,"data-state":t,"aria-hidden":`true`})}function de(e){return e.agentChannel==null?e.actionPlugin==null?`trigger`:`deterministic`:e.gateTool==null?`agent-every-fire`:`checked-agent`}var fe={"checked-agent":`checks first, model only when there is work`,"agent-every-fire":`model every fire`,deterministic:`runs a tool, no model`,trigger:null};function pe(e){return e.agentChannel&&e.agentDestination&&e.agentPrompt?`model`:e.actionPlugin&&e.actionTool?`tool`:`none`}function me(e){let t=e.filter(e=>e.eventStatus===`scheduled`&&e.recurrence!=null),n={live:t.length,model:0,tool:0,none:0};for(let e of t)n[pe(e)]++;return n}function he(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}let n=t?.checks;return Array.isArray(n)?n.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return typeof t.type==`string`?[{kind:t.type,target:J(t.type,t)}]:[]}):[]}function J(e,t){let n=e=>typeof t[e]==`string`?t[e]:null;if(e===`mail`){let e=n(`mailbox`);if(e===null)return null;let t=n(`folder`);return t?`${e}/${t}`:e}return e===`d1`?n(`database`):e===`whatsapp`?n(`scope`):e===`calendar`?n(`connector`):null}function ge(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(t-n,0);return r<6e4?`${Math.round(r/1e3)}s ago`:r<36e5?`${Math.round(r/6e4)}m ago`:`${Math.round(r/36e5)}h ago`}function _e(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?p(new Date(n).toISOString(),t):e}function ve(e){return e?e.split(`
1
+ import{o as e,t}from"./chunk-BycB0eMI.js";import{i as n,n as r,t as i}from"./jsx-runtime-BmNepPEn.js";import{F as a,G as o,L as s,M as c,O as l,V as u,Y as d,Z as f,_ as p,it as m,j as h,k as g,m as _,p as v,v as y}from"./useMediaQuery-B469O83-.js";import{A as b,m as x,t as S}from"./AdminShell-CzHB95sB.js";import{t as C}from"./clock-D2cZ0sge.js";import{t as w}from"./triangle-alert-el772yUQ.js";import{t as ee}from"./wrench-Ck4phkdB.js";import{r as T}from"./file-download-B7zwa78w.js";var te=f(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),ne=f(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),E=f(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),D=r(),O=e(n(),1),k=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function A(e,t){if(e===`*`)return{kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1};let n=e.match(/^(\*|\d+-\d+)\/(\d+)$/);if(n){let e=Number(n[2]);if(e<1)return null;if(n[1]===`*`)return{kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:e};let[r,i]=n[1].split(`-`).map(Number);return r>t||i>t||r>i?null:{kind:`step`,value:0,rangeStart:r,rangeEnd:i,step:e}}let r=e.match(/^(\d+)-(\d+)$/);if(r){let e=Number(r[1]),n=Number(r[2]);return e>t||n>t||e>n?null:{kind:`step`,value:0,rangeStart:e,rangeEnd:n,step:1}}if(/^\d+$/.test(e)){let n=Number(e);return n>t?null:{kind:`fixed`,value:n,rangeStart:null,rangeEnd:null,step:1}}return null}function j(e){return String(e).padStart(2,`0`)}function M(e){if(e===`*`)return null;let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);return e>7||n>7||e>n?`invalid`:`${k[e%7]} to ${k[n%7]}`}let n=e.split(`,`);return n.length>0&&n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?n.map(e=>k[Number(e)%7]).join(`, `):`invalid`}function N(e){let t=e.trim().split(/\s+/);if(t.length!==5)return e;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i)||i!==`*`&&(Number(i)<1||Number(i)>31))return e;let s=A(n,59),c=A(r,23);if(!s||!c)return e;let l=M(o);if(l===`invalid`||s.kind===`step`&&s.rangeStart!==null||(s.kind===`any`&&(s={kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:1}),c.kind===`step`&&c.step===1&&c.rangeStart===null&&(c={kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1}),i!==`*`&&!(s.kind===`fixed`&&c.kind===`fixed`&&o===`*`))||s.kind===`step`&&c.kind===`step`&&c.step>1)return e;let u=l?`, ${l}`:``,d=e=>e.rangeStart+Math.floor((e.rangeEnd-e.rangeStart)/e.step)*e.step;if(s.kind===`step`){let e=s.step===1?`Every minute`:`Every ${s.step} minutes`;return c.kind===`any`?`${e}${u}`:c.kind===`fixed`?`${e}, ${j(c.value)}:00 to ${j(c.value)}:59${u}`:`${e}, ${j(c.rangeStart)}:00 to ${j(d(c))}:00${u}`}if(c.kind===`step`){let e=j(s.value),t=s.value===0?``:` at :${e}`;return c.rangeStart===null?`Every ${c.step} hours${t}${u}`:c.step===1?`Hourly, ${j(c.rangeStart)}:${e} to ${j(c.rangeEnd)}:${e}${u}`:`Every ${c.step} hours, ${j(c.rangeStart)}:${e} to ${j(d(c))}:${e}${u}`}if(c.kind===`any`)return`${s.value===0?`Every hour`:`Every hour at :${j(s.value)}`}${u}`;let f=`${j(c.value)}:${j(s.value)}`;return i===`*`?l?`${l} at ${f}`:`Daily at ${f}`:`Monthly on day ${Number(i)} at ${f}`}var P={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function F(e){let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);if(e>7||n>7||e>n)return null;let r=[];for(let t=e;t<=n;t+=1)r.push(t%7);return[...new Set(r)].sort((e,t)=>e-t)}let n=e.split(`,`);return n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?[...new Set(n.map(e=>Number(e)%7))].sort((e,t)=>e-t):null}function I(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i))return null;let s=A(n,59),c=A(r,23);if(!s||!c||s.kind===`step`&&s.rangeStart!==null)return null;let l=`every`,u=[],d=1;if(i!==`*`){if(o!==`*`)return null;let e=Number(i);if(e<1||e>31||s.kind!==`fixed`||c.kind!==`fixed`)return null;l=`dayOfMonth`,d=e}else if(o!==`*`){let e=F(o);if(e===null)return null;l=`weekdays`,u=e}let f={dayMode:l,weekdays:u,dayOfMonth:d};if(s.kind===`any`||s.kind===`step`){if(c.kind===`step`&&c.step>1)return null;let e=s.kind===`any`?1:s.step,t=c.kind===`any`?null:c.kind===`fixed`?{start:c.value,end:c.value}:{start:c.rangeStart,end:c.rangeEnd};return{...P,...f,timeMode:`everyMinutes`,minute:0,interval:e,window:t}}return c.kind===`fixed`?{...P,...f,timeMode:`at`,minute:s.value,hour:c.value}:c.kind===`any`?{...P,...f,timeMode:`everyHours`,minute:s.value,interval:1,window:null}:{...P,...f,timeMode:`everyHours`,minute:s.value,interval:c.step,window:c.rangeStart===null?null:{start:c.rangeStart,end:c.rangeEnd}}}function L(e){return e.dayMode===`dayOfMonth`?[String(e.dayOfMonth),`*`]:e.dayMode===`weekdays`&&e.weekdays.length>0?[`*`,[...e.weekdays].sort((e,t)=>e-t).join(`,`)]:[`*`,`*`]}function R(e){let[t,n]=L(e);if(e.timeMode===`everyMinutes`){let r=e.window===null?`*`:e.window.start===e.window.end?String(e.window.start):`${e.window.start}-${e.window.end}`;return`*/${e.interval} ${r} ${t} * ${n}`}if(e.timeMode===`everyHours`){let r=e.window===null?e.interval===1?`*`:`*/${e.interval}`:e.interval===1?`${e.window.start}-${e.window.end}`:`${e.window.start}-${e.window.end}/${e.interval}`;return`${e.minute} ${r} ${t} * ${n}`}return`${e.minute} ${e.hour} ${t} * ${n}`}var z={scheduled:`live`,suspended:`stood-down`,due:`inert`,cancelled:`inert`,completed:`inert`};function re(e){return e==null||!Object.hasOwn(z,e)?`unknown`:z[e]}var B={scheduled:{control:`suspend`,note:null},suspended:{control:`resume`,note:null},due:{control:`none`,note:`This one-time routine has already been dispatched. It will not run again.`},cancelled:{control:`none`,note:`This routine was cancelled and cannot be restarted. Delete it, or create a new one.`},completed:{control:`none`,note:`This routine has finished and will not run again.`}},ie={control:`none`,note:`This routine's status is not one this dashboard recognises, so no start or stop is offered.`};function ae(e){return e==null||!Object.hasOwn(B,e)?ie:B[e]}var V={finished:`live`,gated:`live`,started:`in-flight`,accepted:`in-flight`,open:`in-flight`,failed:`error`,"no-destination":`warning`};function oe(e){return e==null||!Object.hasOwn(V,e)?`unknown`:V[e]}function H(e){return e===`gated`?`skipped: no work`:e??`unknown`}var U=i(),se=[{value:1,label:`Mon`},{value:2,label:`Tue`},{value:3,label:`Wed`},{value:4,label:`Thu`},{value:5,label:`Fri`},{value:6,label:`Sat`},{value:0,label:`Sun`}],W=Array.from({length:24},(e,t)=>t),G=e=>String(e).padStart(2,`0`),K={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function ce({recurrence:e,onChange:t,disabled:n}){let r=e?I(e):K,[i,a]=(0,O.useState)(r??K),[o]=(0,O.useState)(e!=null&&r==null),[s,c]=(0,O.useState)(e??``);if((0,O.useEffect)(()=>{fetch(`/api/_client-error`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:`event`,source:`routines`,op:`schedule-editor`,mode:o?`raw`:`builder`}),keepalive:!0}).catch(()=>{})},[o]),o)return(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Schedule (advanced)`}),(0,U.jsx)(`input`,{type:`text`,className:`routine-raw-cron`,value:s,disabled:n,onChange:e=>{c(e.target.value),t(e.target.value)},"aria-label":`Cron expression`}),(0,U.jsx)(`span`,{className:`routine-raw-note`,children:`This routine uses an advanced schedule, edited as a raw cron expression.`})]});let l=e=>{a(e),t(R(e))},u=e=>{let t=e!==`at`&&i.dayMode===`dayOfMonth`?`every`:i.dayMode;l({...i,timeMode:e,dayMode:t})},d=e=>{let t=e===`weekdays`&&i.weekdays.length===0?[1]:i.weekdays;l({...i,dayMode:e,weekdays:t})},f=e=>{let[t,n]=e.split(`:`);l({...i,hour:Number(t)||0,minute:Number(n)||0})},p=e=>{let t=i.weekdays.includes(e);if(t&&i.weekdays.length===1)return;let n=t?i.weekdays.filter(t=>t!==e):[...i.weekdays,e];l({...i,weekdays:n})},m=e=>l({...i,window:e?{start:0,end:23}:null}),h=(e,t)=>{let n={...i.window??{start:0,end:23},[e]:Number(t)};n.start>n.end&&(e===`start`?n.end=n.start:n.start=n.end),l({...i,window:n})},g=(e,t,n)=>Math.min(n,Math.max(t,Number(e)||t));return(0,U.jsxs)(`div`,{className:`routine-sched`,children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`How often`}),(0,U.jsxs)(`select`,{"aria-label":`How often`,value:i.timeMode,disabled:n,onChange:e=>u(e.target.value),children:[(0,U.jsx)(`option`,{value:`at`,children:`At a time of day`}),(0,U.jsx)(`option`,{value:`everyMinutes`,children:`Every few minutes`}),(0,U.jsx)(`option`,{value:`everyHours`,children:`Every few hours`})]})]}),i.timeMode===`at`&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Time of day`}),(0,U.jsx)(`input`,{type:`time`,"aria-label":`Time of day`,value:`${G(i.hour)}:${G(i.minute)}`,disabled:n,onChange:e=>f(e.target.value)})]}),i.timeMode===`everyMinutes`&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Minutes between runs`}),(0,U.jsx)(`input`,{type:`number`,min:1,max:59,"aria-label":`Minutes between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,59)})})]}),i.timeMode===`everyHours`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Hours between runs`}),(0,U.jsx)(`input`,{type:`number`,min:1,max:23,"aria-label":`Hours between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,23)})})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Minute of the hour`}),(0,U.jsx)(`input`,{type:`number`,min:0,max:59,"aria-label":`Minute of the hour`,value:i.minute,disabled:n,onChange:e=>l({...i,minute:g(e.target.value,0,59)})})]})]}),i.timeMode!==`at`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`cal-modal-field routine-sched-check`,children:[(0,U.jsx)(`input`,{type:`checkbox`,"aria-label":`Only between certain hours`,checked:i.window!==null,disabled:n,onChange:e=>m(e.target.checked)}),(0,U.jsx)(`span`,{children:`Only between certain hours`})]}),i.window!==null&&(0,U.jsxs)(`div`,{className:`routine-sched-row`,children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`From hour`}),(0,U.jsx)(`select`,{"aria-label":`From hour`,value:i.window.start,disabled:n,onChange:e=>h(`start`,e.target.value),children:W.map(e=>(0,U.jsxs)(`option`,{value:e,children:[G(e),`:00`]},e))})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`To hour`}),(0,U.jsx)(`select`,{"aria-label":`To hour`,value:i.window.end,disabled:n,onChange:e=>h(`end`,e.target.value),children:W.map(e=>(0,U.jsxs)(`option`,{value:e,children:[G(e),`:00`]},e))})]})]})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Which days`}),(0,U.jsxs)(`select`,{"aria-label":`Which days`,value:i.dayMode,disabled:n,onChange:e=>d(e.target.value),children:[(0,U.jsx)(`option`,{value:`every`,children:`Every day`}),(0,U.jsx)(`option`,{value:`weekdays`,children:`Specific days`}),i.timeMode===`at`&&(0,U.jsx)(`option`,{value:`dayOfMonth`,children:`A day of the month`})]})]}),i.dayMode===`weekdays`&&(0,U.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Days`}),(0,U.jsx)(`div`,{className:`routine-weekdays`,children:se.map(e=>(0,U.jsx)(`button`,{type:`button`,className:`routine-weekday${i.weekdays.includes(e.value)?` routine-weekday-on`:``}`,"aria-pressed":i.weekdays.includes(e.value),disabled:n,onClick:()=>p(e.value),children:e.label},e.value))})]}),i.dayMode===`dayOfMonth`&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Day of month`}),(0,U.jsx)(`select`,{"aria-label":`Day of month`,value:i.dayOfMonth,disabled:n,onChange:e=>l({...i,dayOfMonth:Number(e.target.value)||1}),children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]})]})}function q(e){let t=e.trim().replace(/[\s\-().]/g,``).replace(/^\+/,``);return/^\d{11,15}$/.test(t)?`+${t.slice(0,2)} ${t.slice(2,6)} ${t.slice(6)}`:e}function le(e){if(e.name)return`${e.name} · ${e.label}`;let t=e.channel===`whatsapp`?q(e.destination):e.destination;return`${e.label} · ${t}`}function ue({eventStatus:e}){let t=re(e);return(0,U.jsx)(`span`,{className:`routine-status-dot is-${t}`,"data-state":t,"aria-hidden":`true`})}function de(e){return e.agentChannel==null?e.actionPlugin==null?`trigger`:`deterministic`:e.gateTool==null?`agent-every-fire`:`checked-agent`}var fe={"checked-agent":`checks first, model only when there is work`,"agent-every-fire":`model every fire`,deterministic:`runs a tool, no model`,trigger:null};function pe(e){return e.agentChannel&&e.agentDestination&&e.agentPrompt?`model`:e.actionPlugin&&e.actionTool?`tool`:`none`}function me(e){let t=e.filter(e=>e.eventStatus===`scheduled`&&e.recurrence!=null),n={live:t.length,model:0,tool:0,none:0};for(let e of t)n[pe(e)]++;return n}function he(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}let n=t?.checks;return Array.isArray(n)?n.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return typeof t.type==`string`?[{kind:t.type,target:J(t.type,t)}]:[]}):[]}function J(e,t){let n=e=>typeof t[e]==`string`?t[e]:null;if(e===`mail`){let e=n(`mailbox`);if(e===null)return null;let t=n(`folder`);return t?`${e}/${t}`:e}return e===`d1`?n(`database`):e===`whatsapp`?n(`scope`):e===`calendar`?n(`connector`):null}function ge(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(t-n,0);return r<6e4?`${Math.round(r/1e3)}s ago`:r<36e5?`${Math.round(r/6e4)}m ago`:`${Math.round(r/36e5)}h ago`}function _e(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?p(new Date(n).toISOString(),t):e}function ve(e){return e?e.split(`
2
2
  `).filter(e=>e.trim()!==``).reverse():[]}function Y({routine:e,adminFetch:t,onClose:n,onSaved:r,onDeleted:i,onViewRuns:a}){let{zone:o}=y(),[l,d]=(0,O.useState)(!1),[f,p]=(0,O.useState)(!1),[m,g]=(0,O.useState)(null),[b,S]=(0,O.useState)(e),[w,T]=(0,O.useState)(!1),D=b.agentChannel!=null,k=de(b),A=he(b.gateArgs),j=ge(b.gateLastCommitAt,Date.now()),M=ae(b.eventStatus),P=M.control===`resume`,[F,I]=(0,O.useState)(!1),[L,R]=(0,O.useState)(e.agentPrompt??``),[z,re]=(0,O.useState)(e.name??``),[B,ie]=(0,O.useState)(e.description??``),[V,oe]=(0,O.useState)(e.recurrence),[H,se]=(0,O.useState)(e.agentChannel??``),[W,G]=(0,O.useState)(e.agentDestination??``),[K,q]=(0,O.useState)(null),[pe,me]=(0,O.useState)(null),J=D||b.actionPlugin==null,Y=ve(b.notes);(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!f&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,n]),(0,O.useEffect)(()=>{if(!l||!J||K!==null)return;let e=!1;return t(`/api/admin/dispatch-destinations`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return await e.json()}).then(t=>{e||q(t.destinations)}).catch(t=>{e||(q([]),me(t instanceof Error?t.message:`Could not load destinations`))}),()=>{e=!0}},[l,J,K,t]);let X=(K??[]).filter(e=>e.channel===H),Z=H.length>0&&W.length>0,ye=z.trim().length===0&&(b.name??``).length>0||H.length>0&&W.length===0||Z&&L.trim().length===0,be=(0,O.useCallback)(()=>{let e={},t=H.length>0&&W.length>0,n=z.trim();n!==(b.name??``)&&(e.name=n),(D||t)&&L!==(b.agentPrompt??``)&&(e.agentPrompt=L);let r=B.trim().length>0?B:null;return r!==(b.description??null)&&(e.description=r),V!=null&&V!==(b.recurrence??null)&&(e.recurrence=V),t&&(H!==(b.agentChannel??``)||W!==(b.agentDestination??``))?(e.agentChannel=H,e.agentDestination=W):!t&&H===``&&(b.agentChannel??``)!==``&&(e.agentChannel=null,e.agentDestination=null),e},[D,z,L,B,V,H,W,b]),Q=(0,O.useCallback)(async()=>{let n=be();if(Object.keys(n).length===0){d(!1);return}p(!0),g(null);try{let i=await t(`/api/admin/routines/${encodeURIComponent(e.eventId)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();S(a.routine),re(a.routine.name??``),R(a.routine.agentPrompt??``),ie(a.routine.description??``),oe(a.routine.recurrence),se(a.routine.agentChannel??``),G(a.routine.agentDestination??``),r(a.routine),d(!1)}catch(e){g(e instanceof Error?e.message:`Save failed`)}finally{p(!1)}},[t,be,e.eventId,r]),xe=(0,O.useCallback)(async()=>{if(f)return;if(!F){T(!1),I(!0);return}let n=P?`resume`:`suspend`;p(!0),g(null);try{let i=await t(`/api/admin/routines/${encodeURIComponent(e.eventId)}/${n}`,{method:`POST`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();S(a.routine),r(a.routine),I(!1)}catch(e){g(e instanceof Error?e.message:`${n} failed`),I(!1)}finally{p(!1)}},[t,f,F,P,e.eventId,r]),Se=(0,O.useCallback)(async()=>{if(!f){if(!w){I(!1),T(!0);return}p(!0),g(null);try{let n=await t(`/api/admin/routines/${encodeURIComponent(e.eventId)}`,{method:`DELETE`});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}i(e.eventId)}catch(e){g(e instanceof Error?e.message:`Delete failed`),T(!1)}finally{p(!1)}}},[t,f,w,e.eventId,i]);return(0,U.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{f||n()},children:(0,U.jsxs)(`div`,{className:`cal-modal ${!l||D||Z?`cal-modal-wide`:`cal-modal-dispatch`}`,role:`dialog`,"aria-modal":`true`,"aria-label":l?`Edit routine`:`Routine detail`,onClick:e=>e.stopPropagation(),children:[(0,U.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,U.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,U.jsx)(x,{size:13}),` Routine`]}),(0,U.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:n,"aria-label":`Close`,autoFocus:!0,disabled:f,children:(0,U.jsx)(h,{size:16})})]}),!l&&(0,U.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,U.jsx)(`div`,{className:`cal-modal-title`,children:b.name??`Untitled routine`}),(0,U.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,U.jsx)(C,{size:14}),(0,U.jsx)(`span`,{children:b.recurrence?N(b.recurrence):`One-time`})]}),(0,U.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,U.jsx)(ue,{eventStatus:b.eventStatus}),(0,U.jsxs)(`span`,{children:[`Status: `,b.eventStatus??`unknown`]})]}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Next run: `,_e(b.nextRun,o)]})}),(0,U.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,U.jsx)(E,{size:14}),(0,U.jsxs)(`span`,{children:[`Last run: `,_e(b.lastTriggered,o),b.lastDispatchResult?` (${b.lastDispatchResult})`:``]})]}),b.description&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsx)(`span`,{children:`Description`})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,children:(0,U.jsx)(`span`,{children:b.description})})]}),fe[k]&&(0,U.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`routine-mode`,children:[(0,U.jsx)(x,{size:14}),(0,U.jsxs)(`span`,{children:[fe[k],k===`agent-every-fire`&&b.gateWaived?`: ${b.gateWaived}`:``]})]}),b.gateClassified===!1&&b.gateTool==null&&(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`gate-unclassified`,children:(0,U.jsx)(`span`,{children:`No check is set and no reason is recorded, so every fire spends a model turn.`})}),D?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,U.jsx)(_,{channel:b.agentChannel,size:14}),(0,U.jsxs)(`span`,{children:[v[b.agentChannel]??b.agentChannel,` to `,b.agentDestination??`—`]})]}),b.gateTool!=null&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsx)(`span`,{children:`Checks before the agent runs`})}),(0,U.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,U.jsx)(ee,{size:14}),(0,U.jsxs)(`span`,{children:[b.gatePlugin,`.`,b.gateTool]})]}),A.map((e,t)=>(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`gate-check`,children:(0,U.jsxs)(`span`,{children:[e.kind,e.target?` · ${e.target}`:``]})},t)),b.lastTriggered!=null&&(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`gate-commit-age`,children:(0,U.jsx)(`span`,{children:j===null?`This gate has never committed, so it reports work on every fire.`:`Checks last committed ${j} (${_e(b.gateLastCommitAt,o)})`})})]}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsx)(`span`,{children:`Instruction sent to the agent`})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,children:(0,U.jsx)(`span`,{children:b.agentPrompt??`No instruction sent to the agent.`})})]}):b.actionPlugin?(0,U.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,U.jsx)(ee,{size:14}),(0,U.jsxs)(`span`,{children:[b.actionPlugin,`.`,b.actionTool,b.actionArgs?` ${b.actionArgs}`:``]})]}):(0,U.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,U.jsx)(C,{size:14}),(0,U.jsx)(`span`,{children:`Scheduled trigger (no dispatch)`})]}),Y.length===0?(0,U.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,U.jsx)(E,{size:14}),(0,U.jsx)(`span`,{children:`No history recorded.`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,U.jsx)(E,{size:14}),(0,U.jsxs)(`span`,{children:[`History (`,Y.length,` `,Y.length===1?`entry`:`entries`,`)`]})]}),(0,U.jsx)(`div`,{className:`routine-history`,children:Y.map((e,t)=>(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:e},t))})]})]}),l&&(0,U.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Name`}),(0,U.jsx)(`input`,{type:`text`,value:z,onChange:e=>re(e.target.value),disabled:f,maxLength:200,placeholder:`The routine's title, shown on the card`})]}),J&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Send to`}),(0,U.jsxs)(`div`,{className:`cal-modal-field-inline`,children:[(0,U.jsxs)(`select`,{value:H,disabled:f,onChange:e=>{se(e.target.value),G(``)},children:[(0,U.jsx)(`option`,{value:``,children:`None (no dispatch)`}),(0,U.jsx)(`option`,{value:`whatsapp`,children:`WhatsApp`}),(0,U.jsx)(`option`,{value:`telegram`,children:`Telegram`})]}),H!==``&&(0,U.jsx)(_,{channel:H,size:16})]})]}),H!==``&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Destination`}),(0,U.jsxs)(`select`,{value:W,disabled:f||K===null,onChange:e=>G(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:K===null?`Loading destinations`:X.length===0?`No registered destinations`:`Choose a destination`}),W!==``&&!X.some(e=>e.destination===W)&&(0,U.jsxs)(`option`,{value:W,children:[W,` (not in the current list)`]}),X.map(e=>(0,U.jsx)(`option`,{value:e.destination,children:le(e)},e.destination))]})]}),pe&&(0,U.jsxs)(`div`,{className:`cal-modal-error`,children:[`Could not load destinations: `,pe]})]}),(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Description`}),(0,U.jsx)(`input`,{type:`text`,value:B,onChange:e=>ie(e.target.value),disabled:f,placeholder:`One line: what this routine is for`})]}),(D||Z)&&(0,U.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,U.jsx)(`span`,{children:`Instruction sent to the agent`}),(0,U.jsx)(`textarea`,{className:`cal-modal-textarea`,value:L,onChange:e=>R(e.target.value),disabled:f,rows:16,placeholder:`What should the agent do when this routine fires?`})]}),(0,U.jsx)(ce,{recurrence:b.recurrence,onChange:oe,disabled:f})]}),m&&(0,U.jsx)(`div`,{className:`cal-modal-error`,children:m}),(0,U.jsxs)(`div`,{className:`cal-modal-actions`,children:[!l&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{T(!1),I(!1),d(!0)},disabled:f,children:[(0,U.jsx)(s,{size:14}),` Edit`]}),(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>a(b),disabled:f,children:[(0,U.jsx)(E,{size:14}),` Runs`]}),M.control===`none`?(0,U.jsx)(`span`,{className:`cal-modal-confirm-text`,children:M.note}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:xe,disabled:f,children:[f&&F?(0,U.jsx)(u,{size:14,className:`spin`}):P?(0,U.jsx)(ne,{size:14}):(0,U.jsx)(te,{size:14}),F?P?`Confirm resume`:`Confirm suspend`:P?`Resume`:`Suspend`]}),F&&(0,U.jsx)(`span`,{className:`cal-modal-confirm-text`,children:P?`This routine will run at its next scheduled time. It will not run for the times it missed.`:`This routine stops running until you resume it. Nothing is deleted.`})]}),(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:Se,disabled:f,children:[f&&w?(0,U.jsx)(u,{size:14,className:`spin`}):(0,U.jsx)(c,{size:14}),w?`Confirm delete`:`Delete`]})]}),l&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:Q,disabled:f||ye,children:[f?(0,U.jsx)(u,{size:14,className:`spin`}):null,` Save`]}),(0,U.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{d(!1),g(null)},disabled:f,children:`Cancel`})]})]})]})})}function X(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?p(new Date(n).toISOString(),t):e}function Z(e){return e===null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`}function ye({run:e,routineName:t,onClose:n}){let{zone:r}=y();return(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,U.jsx)(`div`,{className:`cal-modal-overlay`,onClick:n,children:(0,U.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Run detail`,onClick:e=>e.stopPropagation(),children:[(0,U.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,U.jsx)(`span`,{className:`cal-modal-kind`,children:`Run`}),(0,U.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:n,"aria-label":`Close`,autoFocus:!0,children:(0,U.jsx)(h,{size:16})})]}),(0,U.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,U.jsx)(`div`,{className:`cal-modal-title`,children:t??`Untitled routine`}),e.outputExcerpt!==null&&(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,"data-testid":`run-output`,children:(0,U.jsx)(`span`,{children:e.outputExcerpt})}),e.outputExcerpt===null&&e.status===`finished`&&(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`run-output-none`,children:(0,U.jsx)(`span`,{children:`This run finished without sending anything.`})}),(0,U.jsx)(`div`,{className:`cal-modal-row`,children:(0,U.jsx)(`span`,{children:H(e.status)})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Due: `,X(e.scheduledFor,r)]})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Started: `,X(e.startedAt,r)]})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Dispatch ended: `,X(e.endedAt,r),` (`,Z(e.ranMs),`)`]})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Output seen: `,X(e.finishedAt,r)]})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Sent to: `,e.target,` · `,e.mode,` · `,e.kind]})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Transport: `,e.dispatchResult??`—`,e.httpStatus===null?``:` (HTTP ${e.httpStatus})`]})}),e.error&&(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,children:(0,U.jsx)(`span`,{children:e.error})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Conversation: `,e.sessionKey??`—`,e.transcriptOffset===null?``:` at byte ${e.transcriptOffset}`]})}),!e.bounded&&e.status!==`gated`&&(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsx)(`span`,{children:`This run shares its conversation with other traffic, so what it produced cannot be separated out. Its status stays at whatever the dispatch reported.`})}),(0,U.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,U.jsxs)(`span`,{children:[`Run `,e.runId]})})]})]})})}function be({status:e}){let t=oe(e);return(0,U.jsx)(`span`,{className:`routine-status-dot is-${t}`,"data-state":t,"aria-hidden":`true`})}var Q=500;function xe(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?p(new Date(n).toISOString(),t):e}function Se(e){return e===null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`}var Ce={channel:`a channel`,destination:`a destination`,prompt:`an instruction`};function we(e){if(e===`no-dispatch-configured`)return`This routine has no dispatch set up, so there was nothing to do.`;if(e===`no-action-plugin`)return`The tool action names no plugin, so nothing ran.`;if(e===`no-action-tool`)return`The tool action names no tool, so nothing ran.`;let t=e.startsWith(`no-`)?e.slice(3).split(`+`):[];if(t.length>0&&t.every(e=>e in Ce)){let e=t.map(e=>Ce[e]);return`This routine has no ${(e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`).replace(/^an? /,``)} set, so nothing was sent.`}return e}function Te(e){return e.status===`no-destination`?e.error?we(e.error):`Nothing was dispatched, and no reason was recorded.`:e.status===`failed`?e.error??e.dispatchResult??`The dispatch failed.`:e.status===`open`?`Opened and never closed. The dispatch did not report back.`:null}function Ee(e){let t=e.indexOf(`:`);return t<=0?{channel:null,destination:e}:{channel:e.slice(0,t),destination:e.slice(t+1)}}function De(e){return e.outputExcerpt===null?e.status===`finished`?`Finished and sent nothing.`:null:e.outputExcerpt}function Oe({routine:e,adminFetch:t,cacheKey:n,from:r=`card`,onBack:i}){let{zone:s}=y(),[c,l]=(0,O.useState)([]),[f,p]=(0,O.useState)(!0),[m,h]=(0,O.useState)(null),[g,b]=(0,O.useState)(null),x=(0,O.useRef)(0),S=(0,O.useCallback)(()=>{let n=!1,i=++x.current,a=()=>n||i!==x.current;return p(!0),h(null),t(`/api/admin/routines/${encodeURIComponent(e.eventId)}/runs?limit=${Q}&from=${r}`).then(async e=>{if(a())return;if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();a()||l(Array.isArray(t.runs)?t.runs:[])}).catch(e=>{a()||(h(e instanceof Error?e.message:`Failed to load`),l([]))}).finally(()=>{a()||p(!1)}),()=>{n=!0}},[t,e.eventId,r]);(0,O.useEffect)(()=>S(),[S]);let C=(0,O.useCallback)(()=>{T(n,e.eventId)},[n,e.eventId]);return(0,U.jsxs)(`div`,{className:`cal-page`,children:[(0,U.jsx)(`header`,{className:`cal-header`,children:(0,U.jsxs)(`div`,{className:`cal-nav`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:i,children:[(0,U.jsx)(d,{size:14}),` Routines`]}),(0,U.jsx)(`span`,{className:`cal-range-label runs-title`,"data-testid":`runs-title`,title:e.name??`Untitled routine`,children:e.name??`Untitled routine`}),(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,"data-testid":`runs-refresh`,onClick:S,disabled:f,title:`Refresh runs`,"aria-label":`Refresh runs`,children:[f?(0,U.jsx)(u,{size:14,className:`spin`}):(0,U.jsx)(a,{size:14}),` Refresh`]}),c.length>0&&(0,U.jsx)(`div`,{className:`routine-bulk-actions`,children:(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:C,children:[(0,U.jsx)(o,{size:14}),` Download all runs`]})})]})}),(0,U.jsxs)(`div`,{className:`cal-body`,children:[m&&(0,U.jsxs)(`div`,{className:`cal-error`,children:[`Could not load runs: `,m]}),!m&&!f&&c.length===0&&(0,U.jsxs)(`div`,{className:`cal-empty`,"data-testid":`runs-empty`,children:[(0,U.jsx)(`p`,{children:`Nothing to show for this routine.`}),(0,U.jsx)(`p`,{children:`That means one of three things, and this page cannot tell them apart: it has never run, it ran but no record was written, or every run it did have is older than the 30 days records are kept for.`}),(0,U.jsxs)(`p`,{children:[`For a repeating routine, the server log settles the middle one: a`,(0,U.jsx)(`code`,{children:` fires-without-records `}),` count above zero names a routine that fired and left no record. It does not distinguish the other two, and it does not cover a one-time routine.`]})]}),c.length>=Q&&(0,U.jsxs)(`div`,{className:`cal-modal-confirm-text`,"data-testid":`runs-capped`,children:[`Showing the most recent `,Q,` runs. There may be more; the download has everything still on record.`]}),(0,U.jsx)(`div`,{className:`routine-list`,children:c.map(e=>{let t=Te(e),n=De(e),{channel:r,destination:i}=Ee(e.target);return(0,U.jsxs)(`button`,{type:`button`,className:`admin-card admin-card--padded routine-card`,"data-testid":`run-row-${e.runId}`,onClick:()=>b(e),children:[(0,U.jsxs)(`span`,{className:`admin-card-title routine-card-title run-card-title`,children:[(0,U.jsx)(be,{status:e.status}),` `,H(e.status)]}),(0,U.jsx)(`span`,{className:`routine-card-sched`,children:Se(e.ranMs)}),(0,U.jsx)(`span`,{className:`routine-card-target`,children:r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(_,{channel:r,size:13}),` `,v[r]??r,` to `,r===`whatsapp`?q(i):i]}):i}),(0,U.jsxs)(`span`,{className:`routine-card-meta`,children:[`Due `,xe(e.scheduledFor,s)]}),n&&(0,U.jsx)(`span`,{className:`routine-card-meta run-card-output`,children:n}),t&&(0,U.jsx)(`span`,{className:`routine-card-meta run-card-detail`,children:t})]},e.runId)})})]}),g&&(0,U.jsx)(ye,{run:g,routineName:e.name,onClose:()=>b(null)})]})}t(((e,t)=>{t.exports={}}))();function ke(e){return e.agentChannel&&e.agentDestination&&e.agentPrompt?!0:!!(e.actionPlugin&&e.actionTool)}function Ae(e){if(e.agentChannel||e.agentDestination||e.agentPrompt){let t=[];return e.agentChannel||t.push(`channel`),e.agentDestination||t.push(`destination`),e.agentPrompt||t.push(`prompt`),`no-${t.join(`+`)}`}return e.actionPlugin||e.actionTool?e.actionTool?`no-action-plugin`:`no-action-tool`:`no-dispatch-configured`}var $=`maxy-admin-session-key`;function je(e){return e?N(e):`One-time`}function Me(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?p(new Date(n).toISOString(),t):e}function Ne(){let[e,t]=(0,O.useState)(null),[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(void 0),[o,s]=(0,O.useState)(null),[c,u]=(0,O.useState)(void 0),[d,f]=(0,O.useState)(null),[p,m]=(0,O.useState)(null);(0,O.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem($)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&a(e.businessName),e.sessionId!==void 0&&s(e.sessionId??null),m(e.role??null),u(e.userName===void 0?null:e.userName),f(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let h=(0,O.useCallback)(()=>{try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},[]),[_,v]=(0,O.useState)(!1),y=(0,O.useCallback)(async()=>{v(!0);try{let e=await b();if(e){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`}return e}finally{v(!1)}},[]);return n?e?(0,U.jsx)(g,{cacheKey:e,surface:`routines`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=routines`);try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},children:(0,U.jsx)(S,{cacheKey:e,businessName:i,sessionId:o,onLogout:h,onDisconnect:y,disconnecting:_,userName:c,userAvatar:d,role:p,children:(0,U.jsx)(Pe,{cacheKey:e})})}):(0,U.jsx)(`div`,{className:`cal-page`,children:(0,U.jsxs)(`div`,{className:`cal-empty`,children:[(0,U.jsx)(`p`,{children:`You are not signed in.`}),(0,U.jsxs)(`p`,{children:[`Open the `,(0,U.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,U.jsx)(l,{surface:`gate`})}function Pe({cacheKey:e}){let{zone:t}=y(),{adminFetch:n,cacheKey:r,sessionRefetchNonce:i}=m({initialCacheKey:e,surface:`routines`}),[o,s]=(0,O.useState)([]),[c,d]=(0,O.useState)(null),[f,p]=(0,O.useState)(!1),[h,g]=(0,O.useState)(!1),[b,S]=(0,O.useState)(null),[T,E]=(0,O.useState)(null),[D,k]=(0,O.useState)(null),A=(0,O.useCallback)(()=>{let e=!1;return p(!0),S(null),n(`/api/admin/routines`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();s(Array.isArray(n.routines)?n.routines:[]),d(typeof n.workflowRuns24h==`number`?n.workflowRuns24h:null)}).catch(t=>{e||(S(t instanceof Error?t.message:`Failed to load`),s([]),d(null))}).finally(()=>{e||(p(!1),g(!0))}),()=>{e=!0}},[n]);(0,O.useEffect)(()=>A(),[A,i]);let j=(0,O.useCallback)(e=>{s(t=>t.map(t=>t.eventId===e.eventId?e:t)),E(e)},[]),M=(0,O.useCallback)(e=>{s(t=>t.filter(t=>t.eventId!==e)),E(null)},[]),[N,P]=(0,O.useState)(!1),[F,I]=(0,O.useState)(null),L=o.filter(e=>e.eventStatus===`scheduled`).length,R=o.filter(e=>e.suspendedInBulk).length,z=(0,O.useCallback)(async e=>{P(!0),I(null);try{let t=await n(`/api/admin/routines/${e}`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}let r=await t.json(),i=r.refused?.length??0;I(e===`suspend-all`?`Suspended ${r.suspended??0}. Nothing runs on its own until you resume it.`:`Resumed ${r.restored??0}${i>0?`. ${i} could not be resumed and stayed suspended`:``}. Routines you suspended one at a time are still suspended.`),A()}catch(e){I(e instanceof Error?e.message:`Failed`)}finally{P(!1)}},[n,A]);return h?D?(0,U.jsx)(Oe,{routine:D,adminFetch:n,cacheKey:r,from:`modal`,onBack:()=>k(null)}):(0,U.jsxs)(`div`,{className:`cal-page`,children:[(0,U.jsx)(`header`,{className:`cal-header`,children:(0,U.jsxs)(`div`,{className:`cal-nav`,children:[(0,U.jsxs)(`span`,{className:`cal-range-label`,children:[(0,U.jsx)(x,{size:16}),` Routines`]}),(0,U.jsxs)(`div`,{className:`routine-bulk-actions`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,"data-testid":`routines-refresh`,onClick:A,disabled:f,title:`Refresh routines`,"aria-label":`Refresh routines`,children:[f?(0,U.jsx)(u,{size:14,className:`spin`}):(0,U.jsx)(a,{size:14}),` Refresh`]}),(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>z(`suspend-all`),disabled:N||L===0,children:[(0,U.jsx)(te,{size:14}),` Suspend all (`,L,`)`]}),(0,U.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>z(`resume-all`),disabled:N||R===0,children:[(0,U.jsx)(ne,{size:14}),` Resume all (`,R,`)`]})]})]})}),(0,U.jsxs)(`div`,{className:`cal-body`,children:[!b&&(()=>{let e=me(o);return(0,U.jsxs)(`div`,{className:`routine-rail-strip`,"data-testid":`routine-rail-strip`,children:[`Live recurring: `,e.live,` · `,e.model,` model · `,e.tool,` tool · `,e.none,` no dispatch`,` · `,`Workflow runs (24h): `,c===null?`—`:c]})})(),F&&(0,U.jsx)(`div`,{className:`cal-modal-confirm-text`,children:F}),b&&(0,U.jsxs)(`div`,{className:`cal-error`,children:[`Could not load routines: `,b]}),!b&&!f&&o.length===0&&(0,U.jsx)(`div`,{className:`cal-empty`,children:(0,U.jsx)(`p`,{children:`No routines yet.`})}),(0,U.jsx)(`div`,{className:`routine-list`,children:o.map(e=>(0,U.jsxs)(`div`,{role:`button`,tabIndex:0,className:`admin-card admin-card--padded routine-card`,"data-testid":`routine-card-${e.eventId}`,onClick:()=>E(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),E(e))},children:[(0,U.jsx)(`span`,{className:`admin-card-title routine-card-title`,title:e.name??`Untitled routine`,children:e.name??`Untitled routine`}),(0,U.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,U.jsx)(C,{size:13}),` `,je(e.recurrence)]}),e.description&&(0,U.jsx)(`span`,{className:`routine-card-desc`,children:e.description}),(()=>{let t=e.eventStatus===`scheduled`&&!ke(e)?Ae(e):null;return t===null?(0,U.jsx)(`span`,{className:`routine-card-target`,children:e.agentChannel?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(_,{channel:e.agentChannel,size:13}),` `,v[e.agentChannel]??e.agentChannel,` to `,e.agentDestination??`—`]}):e.actionPlugin?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ee,{size:13}),` `,e.actionPlugin,`.`,e.actionTool]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(C,{size:13}),` Scheduled trigger`]})}):(0,U.jsxs)(`span`,{className:`routine-card-target routine-card-target--gap`,children:[(0,U.jsx)(w,{size:13}),` `,we(t)]})})(),(()=>{let t=[],n=fe[de(e)];return n&&t.push(n),e.runs24h>0&&t.push(`24h: ${e.runs24h} ${e.runs24h===1?`fire`:`fires`}, ${e.gated24h} skipped`),t.length===0?null:(0,U.jsx)(`span`,{className:`routine-card-gate`,"data-testid":`routine-gate-${e.eventId}`,children:t.join(` · `)})})(),(0,U.jsxs)(`span`,{className:`routine-card-meta`,children:[(0,U.jsx)(ue,{eventStatus:e.eventStatus}),`Next: `,Me(e.nextRun,t),` · `,e.eventStatus??`unknown`]})]},e.eventId))})]}),T&&(0,U.jsx)(Y,{routine:T,adminFetch:n,onClose:()=>E(null),onSaved:j,onDeleted:M,onViewRuns:e=>{E(null),k(e)}})]}):(0,U.jsx)(l,{surface:`gate`})}(0,D.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(Ne,{}));
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BmNepPEn.js";import{M as i,O as a,U as o,V as s,it as c,j as l,k as u}from"./useMediaQuery-B469O83-.js";import{A as d,h as f,t as p}from"./AdminShell-BtWb0_Gm.js";import{t as m}from"./file-text-rWowl9RN.js";var h=n(),g=e(t(),1),_=r();function v({summary:e,adminFetch:t,onClose:n,onDeleted:r}){let[a,c]=(0,g.useState)(null),[u,d]=(0,g.useState)(!0),[p,h]=(0,g.useState)(null),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let n=!1;return d(!0),h(null),t(`/api/admin/skills/${encodeURIComponent(e.plugin)}/${encodeURIComponent(e.skill)}`).then(async e=>{if(!n){if(!e.ok)throw Error(`HTTP ${e.status}`);c((await e.json()).skill)}}).catch(e=>{n||h(e instanceof Error?e.message:`Failed to load`)}).finally(()=>{n||d(!1)}),()=>{n=!0}},[t,e.plugin,e.skill]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!b&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,n]);let S=(0,g.useCallback)(async()=>{x(!0),h(null);try{let n=await t(`/api/admin/skills/${encodeURIComponent(e.plugin)}/${encodeURIComponent(e.skill)}`,{method:`DELETE`,headers:{"content-type":`application/json`}});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}r(e)}catch(e){h(e instanceof Error?e.message:`Delete failed`),x(!1),y(!1)}},[t,e,r]);return(0,_.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{b||n()},children:(0,_.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Skill detail`,onClick:e=>e.stopPropagation(),children:[(0,_.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,_.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,_.jsx)(f,{size:13}),` Skill`]}),(0,_.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:n,"aria-label":`Close`,autoFocus:!0,disabled:b,children:(0,_.jsx)(l,{size:16})})]}),(0,_.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,_.jsx)(`div`,{className:`cal-modal-title`,children:e.skill}),(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(m,{size:14}),(0,_.jsx)(`span`,{children:e.plugin})]}),u&&(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(s,{size:14,className:`spin`}),(0,_.jsx)(`span`,{children:`Loading…`})]}),a&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,_.jsx)(`span`,{children:a.frontmatter.description||`No description.`})}),a.frontmatter.publicEmbed&&(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(o,{size:14}),(0,_.jsx)(`span`,{children:`Public embed`})]}),(0,_.jsx)(`pre`,{className:`skill-body`,children:a.body.trim()||`No body content.`}),a.references.length>0&&(0,_.jsxs)(`div`,{className:`skill-refs`,children:[(0,_.jsx)(`span`,{className:`skill-refs-label`,children:`References`}),a.references.map(e=>(0,_.jsxs)(`span`,{className:`skill-ref`,children:[(0,_.jsx)(m,{size:13}),` `,e]},e))]})]})]}),p&&(0,_.jsx)(`div`,{className:`cal-modal-error`,children:p}),(0,_.jsxs)(`div`,{className:`cal-modal-actions`,children:[!v&&(0,_.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>y(!0),disabled:b||u,children:[(0,_.jsx)(i,{size:14}),` Delete`]}),v&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this skill?`}),(0,_.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:S,disabled:b,children:[b?(0,_.jsx)(s,{size:14,className:`spin`}):(0,_.jsx)(i,{size:14}),` Delete`]}),(0,_.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>y(!1),disabled:b,children:`Cancel`})]})]})]})})}var y=`maxy-admin-session-key`;function b(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(!1),[i,o]=(0,g.useState)(void 0),[s,c]=(0,g.useState)(null),[l,f]=(0,g.useState)(void 0),[m,h]=(0,g.useState)(null),[v,b]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(y)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),b(e.role??null),f(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let S=(0,g.useCallback)(()=>{try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`},[]),[C,w]=(0,g.useState)(!1),T=(0,g.useCallback)(async()=>{w(!0);try{let e=await d();if(e){try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return n?e?(0,_.jsx)(u,{cacheKey:e,surface:`skills`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=skills`);try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`},children:(0,_.jsx)(p,{cacheKey:e,businessName:i,sessionId:s,onLogout:S,onDisconnect:T,disconnecting:C,userName:l,userAvatar:m,role:v,children:(0,_.jsx)(x,{cacheKey:e})})}):(0,_.jsx)(`div`,{className:`cal-page`,children:(0,_.jsxs)(`div`,{className:`cal-empty`,children:[(0,_.jsx)(`p`,{children:`You are not signed in.`}),(0,_.jsxs)(`p`,{children:[`Open the `,(0,_.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,_.jsx)(a,{surface:`gate`})}function x({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:n}=c({initialCacheKey:e,surface:`skills`}),[r,i]=(0,g.useState)([]),[o,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(!1),[p,h]=(0,g.useState)(null),[y,b]=(0,g.useState)(null),x=(0,g.useCallback)(()=>{let e=!1;return l(!0),h(null),t(`/api/admin/skills`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();i(Array.isArray(n.skills)?n.skills:[])}).catch(t=>{e||(h(t instanceof Error?t.message:`Failed to load`),i([]))}).finally(()=>{e||(l(!1),d(!0))}),()=>{e=!0}},[t]);(0,g.useEffect)(()=>x(),[x,n]);let S=(0,g.useCallback)(e=>{i(t=>t.filter(t=>!(t.plugin===e.plugin&&t.skill===e.skill))),b(null),x()},[x]);return u?(0,_.jsxs)(`div`,{className:`cal-page`,children:[(0,_.jsx)(`header`,{className:`cal-header`,children:(0,_.jsxs)(`div`,{className:`cal-nav`,children:[(0,_.jsxs)(`span`,{className:`cal-range-label`,children:[(0,_.jsx)(f,{size:16}),` Skills`]}),o&&(0,_.jsx)(s,{size:16,className:`spin`})]})}),(0,_.jsxs)(`div`,{className:`cal-body`,children:[p&&(0,_.jsxs)(`div`,{className:`cal-error`,children:[`Could not load skills: `,p]}),!p&&!o&&r.length===0&&(0,_.jsx)(`div`,{className:`cal-empty`,children:(0,_.jsx)(`p`,{children:`No skills yet. Ask in chat to create one.`})}),r.length>0&&(0,_.jsx)(`div`,{className:`routine-list`,children:r.map(e=>(0,_.jsxs)(`button`,{type:`button`,className:`admin-card admin-card--padded routine-card`,onClick:()=>b(e),children:[(0,_.jsx)(`span`,{className:`admin-card-title routine-card-title`,children:e.skill}),(0,_.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,_.jsx)(m,{size:13}),` `,e.plugin]}),(0,_.jsx)(`span`,{className:`skill-card-desc`,children:e.description||`No description.`}),(0,_.jsx)(`span`,{className:`routine-card-meta`,children:e.refCount===0?`No references`:`${e.refCount} reference${e.refCount===1?``:`s`}`})]},`${e.plugin}/${e.skill}`))})]}),y&&(0,_.jsx)(v,{summary:y,adminFetch:t,onClose:()=>b(null),onDeleted:S})]}):(0,_.jsx)(a,{surface:`gate`})}(0,h.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(b,{}));
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BmNepPEn.js";import{M as i,O as a,U as o,V as s,it as c,j as l,k as u}from"./useMediaQuery-B469O83-.js";import{A as d,h as f,t as p}from"./AdminShell-CzHB95sB.js";import{t as m}from"./file-text-rWowl9RN.js";var h=n(),g=e(t(),1),_=r();function v({summary:e,adminFetch:t,onClose:n,onDeleted:r}){let[a,c]=(0,g.useState)(null),[u,d]=(0,g.useState)(!0),[p,h]=(0,g.useState)(null),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let n=!1;return d(!0),h(null),t(`/api/admin/skills/${encodeURIComponent(e.plugin)}/${encodeURIComponent(e.skill)}`).then(async e=>{if(!n){if(!e.ok)throw Error(`HTTP ${e.status}`);c((await e.json()).skill)}}).catch(e=>{n||h(e instanceof Error?e.message:`Failed to load`)}).finally(()=>{n||d(!1)}),()=>{n=!0}},[t,e.plugin,e.skill]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!b&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,n]);let S=(0,g.useCallback)(async()=>{x(!0),h(null);try{let n=await t(`/api/admin/skills/${encodeURIComponent(e.plugin)}/${encodeURIComponent(e.skill)}`,{method:`DELETE`,headers:{"content-type":`application/json`}});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}r(e)}catch(e){h(e instanceof Error?e.message:`Delete failed`),x(!1),y(!1)}},[t,e,r]);return(0,_.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{b||n()},children:(0,_.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Skill detail`,onClick:e=>e.stopPropagation(),children:[(0,_.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,_.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,_.jsx)(f,{size:13}),` Skill`]}),(0,_.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:n,"aria-label":`Close`,autoFocus:!0,disabled:b,children:(0,_.jsx)(l,{size:16})})]}),(0,_.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,_.jsx)(`div`,{className:`cal-modal-title`,children:e.skill}),(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(m,{size:14}),(0,_.jsx)(`span`,{children:e.plugin})]}),u&&(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(s,{size:14,className:`spin`}),(0,_.jsx)(`span`,{children:`Loading…`})]}),a&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,_.jsx)(`span`,{children:a.frontmatter.description||`No description.`})}),a.frontmatter.publicEmbed&&(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(o,{size:14}),(0,_.jsx)(`span`,{children:`Public embed`})]}),(0,_.jsx)(`pre`,{className:`skill-body`,children:a.body.trim()||`No body content.`}),a.references.length>0&&(0,_.jsxs)(`div`,{className:`skill-refs`,children:[(0,_.jsx)(`span`,{className:`skill-refs-label`,children:`References`}),a.references.map(e=>(0,_.jsxs)(`span`,{className:`skill-ref`,children:[(0,_.jsx)(m,{size:13}),` `,e]},e))]})]})]}),p&&(0,_.jsx)(`div`,{className:`cal-modal-error`,children:p}),(0,_.jsxs)(`div`,{className:`cal-modal-actions`,children:[!v&&(0,_.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>y(!0),disabled:b||u,children:[(0,_.jsx)(i,{size:14}),` Delete`]}),v&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this skill?`}),(0,_.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:S,disabled:b,children:[b?(0,_.jsx)(s,{size:14,className:`spin`}):(0,_.jsx)(i,{size:14}),` Delete`]}),(0,_.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>y(!1),disabled:b,children:`Cancel`})]})]})]})})}var y=`maxy-admin-session-key`;function b(){let[e,t]=(0,g.useState)(null),[n,r]=(0,g.useState)(!1),[i,o]=(0,g.useState)(void 0),[s,c]=(0,g.useState)(null),[l,f]=(0,g.useState)(void 0),[m,h]=(0,g.useState)(null),[v,b]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(y)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),b(e.role??null),f(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let S=(0,g.useCallback)(()=>{try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`},[]),[C,w]=(0,g.useState)(!1),T=(0,g.useCallback)(async()=>{w(!0);try{let e=await d();if(e){try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return n?e?(0,_.jsx)(u,{cacheKey:e,surface:`skills`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=skills`);try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`},children:(0,_.jsx)(p,{cacheKey:e,businessName:i,sessionId:s,onLogout:S,onDisconnect:T,disconnecting:C,userName:l,userAvatar:m,role:v,children:(0,_.jsx)(x,{cacheKey:e})})}):(0,_.jsx)(`div`,{className:`cal-page`,children:(0,_.jsxs)(`div`,{className:`cal-empty`,children:[(0,_.jsx)(`p`,{children:`You are not signed in.`}),(0,_.jsxs)(`p`,{children:[`Open the `,(0,_.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,_.jsx)(a,{surface:`gate`})}function x({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:n}=c({initialCacheKey:e,surface:`skills`}),[r,i]=(0,g.useState)([]),[o,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(!1),[p,h]=(0,g.useState)(null),[y,b]=(0,g.useState)(null),x=(0,g.useCallback)(()=>{let e=!1;return l(!0),h(null),t(`/api/admin/skills`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();i(Array.isArray(n.skills)?n.skills:[])}).catch(t=>{e||(h(t instanceof Error?t.message:`Failed to load`),i([]))}).finally(()=>{e||(l(!1),d(!0))}),()=>{e=!0}},[t]);(0,g.useEffect)(()=>x(),[x,n]);let S=(0,g.useCallback)(e=>{i(t=>t.filter(t=>!(t.plugin===e.plugin&&t.skill===e.skill))),b(null),x()},[x]);return u?(0,_.jsxs)(`div`,{className:`cal-page`,children:[(0,_.jsx)(`header`,{className:`cal-header`,children:(0,_.jsxs)(`div`,{className:`cal-nav`,children:[(0,_.jsxs)(`span`,{className:`cal-range-label`,children:[(0,_.jsx)(f,{size:16}),` Skills`]}),o&&(0,_.jsx)(s,{size:16,className:`spin`})]})}),(0,_.jsxs)(`div`,{className:`cal-body`,children:[p&&(0,_.jsxs)(`div`,{className:`cal-error`,children:[`Could not load skills: `,p]}),!p&&!o&&r.length===0&&(0,_.jsx)(`div`,{className:`cal-empty`,children:(0,_.jsx)(`p`,{children:`No skills yet. Ask in chat to create one.`})}),r.length>0&&(0,_.jsx)(`div`,{className:`routine-list`,children:r.map(e=>(0,_.jsxs)(`button`,{type:`button`,className:`admin-card admin-card--padded routine-card`,onClick:()=>b(e),children:[(0,_.jsx)(`span`,{className:`admin-card-title routine-card-title`,children:e.skill}),(0,_.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,_.jsx)(m,{size:13}),` `,e.plugin]}),(0,_.jsx)(`span`,{className:`skill-card-desc`,children:e.description||`No description.`}),(0,_.jsx)(`span`,{className:`routine-card-meta`,children:e.refCount===0?`No references`:`${e.refCount} reference${e.refCount===1?``:`s`}`})]},`${e.plugin}/${e.skill}`))})]}),y&&(0,_.jsx)(v,{summary:y,adminFetch:t,onClose:()=>b(null),onDeleted:S})]}):(0,_.jsx)(a,{surface:`gate`})}(0,h.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(b,{}));
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BmNepPEn.js";import{L as i,M as a,N as o,O as s,it as c,j as l,k as u,o as d,q as f}from"./useMediaQuery-B469O83-.js";import{A as p,a as m,f as h,n as ee,t as g,v as _}from"./AdminShell-BtWb0_Gm.js";import{t as v}from"./play-DgP7vl0r.js";import{t as y}from"./rotate-ccw-Dnn7gbPh.js";var b=n(),x=e(t(),1);function te(e=3e4){let[t,n]=(0,x.useState)(()=>Date.now());return(0,x.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ne(e,t){let n=new Map,r=(e,t,r)=>{let i=n.get(e)??{openCount:0,totalSeconds:0};i.totalSeconds+=t,r&&(i.openCount+=1),n.set(e,i)};for(let t of e)t.clientName&&r(t.clientName,t.secondsLogged,!0);for(let e of t)e.clientName&&r(e.clientName,e.secondsLogged,!1);let i=[...n.entries()].map(([e,t])=>({name:e,openCount:t.openCount,totalSeconds:t.totalSeconds}));return i.sort((e,t)=>t.openCount-e.openCount||e.name.localeCompare(t.name)),S(e,i),i}function S(e,t){let n=t.reduce((e,t)=>e+t.openCount,0),r=e.filter(e=>!e.clientName).length,i=n+r===e.length;return i||console.warn(`[tasks-clients] reconcile-mismatch assigned=${n} unassigned=${r} openTotal=${e.length}`),i}var C=`__unassigned__`;function w(e,t){return e===`__unassigned__`?`Unassigned`:t||e.slice(0,8)}function T(e){return e===null||e===``?C:e}function re(e,t){let n=new Map,r=(e,t)=>{let r=T(e.assigneeUserId),i=n.get(r)??{name:null,openCount:0,totalCount:0};i.name===null&&e.assigneeName&&(i.name=e.assigneeName),i.totalCount+=1,t&&(i.openCount+=1),n.set(r,i)};for(let t of e)r(t,!0);for(let e of t)r(e,!1);let i=[...n.entries()].map(([e,t])=>({userId:e,label:w(e,t.name),openCount:t.openCount,totalCount:t.totalCount}));return i.sort((e,t)=>t.openCount-e.openCount||e.label.localeCompare(t.label)),i}function E(e,t){return t===null?!0:T(e.assigneeUserId)===t}var D=r();function O(e){let t=e.name??e.userId.slice(0,8);return e.kind===`owner`?`${t} (owner)`:t}var k=`maxy-admin-session-key`;function A(e){let t=[];return e.clientName&&t.push(e.clientName),e.propertyAddress&&t.push(e.propertyAddress),e.fee!=null&&t.push(`£${e.fee}`),t.join(` · `)}function j(e){if(!e)return``;let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=new Date(t);return`${n.getUTCDate()} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][n.getUTCMonth()]} ${n.getUTCFullYear()}`}function M(e){return e.assigneeName?e.assigneeName:e.assigneeUserId?e.assigneeUserId.slice(0,8):`Unassigned`}function N(e,t){return[t,j(e.createdAt),M(e)].filter(Boolean).join(` · `)}function ie(e,t){if(e.running&&e.runningStartedAt){let n=Date.parse(e.runningStartedAt);if(Number.isFinite(n))return e.secondsLogged+Math.max(0,(t-n)/1e3)}return e.secondsLogged}function ae(e){let t=[`Task: ${e.title}\nTask id: ${e.taskId}`],n=e.description.trim();n.length>0&&t.push(n);let r=e.notes.trim();return r.length>0&&t.push(`Notes:\n${r}`),t.join(`
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BmNepPEn.js";import{L as i,M as a,N as o,O as s,it as c,j as l,k as u,o as d,q as f}from"./useMediaQuery-B469O83-.js";import{A as p,a as m,f as h,n as ee,t as g,v as _}from"./AdminShell-CzHB95sB.js";import{t as v}from"./play-DgP7vl0r.js";import{t as y}from"./rotate-ccw-Dnn7gbPh.js";var b=n(),x=e(t(),1);function te(e=3e4){let[t,n]=(0,x.useState)(()=>Date.now());return(0,x.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ne(e,t){let n=new Map,r=(e,t,r)=>{let i=n.get(e)??{openCount:0,totalSeconds:0};i.totalSeconds+=t,r&&(i.openCount+=1),n.set(e,i)};for(let t of e)t.clientName&&r(t.clientName,t.secondsLogged,!0);for(let e of t)e.clientName&&r(e.clientName,e.secondsLogged,!1);let i=[...n.entries()].map(([e,t])=>({name:e,openCount:t.openCount,totalSeconds:t.totalSeconds}));return i.sort((e,t)=>t.openCount-e.openCount||e.name.localeCompare(t.name)),S(e,i),i}function S(e,t){let n=t.reduce((e,t)=>e+t.openCount,0),r=e.filter(e=>!e.clientName).length,i=n+r===e.length;return i||console.warn(`[tasks-clients] reconcile-mismatch assigned=${n} unassigned=${r} openTotal=${e.length}`),i}var C=`__unassigned__`;function w(e,t){return e===`__unassigned__`?`Unassigned`:t||e.slice(0,8)}function T(e){return e===null||e===``?C:e}function re(e,t){let n=new Map,r=(e,t)=>{let r=T(e.assigneeUserId),i=n.get(r)??{name:null,openCount:0,totalCount:0};i.name===null&&e.assigneeName&&(i.name=e.assigneeName),i.totalCount+=1,t&&(i.openCount+=1),n.set(r,i)};for(let t of e)r(t,!0);for(let e of t)r(e,!1);let i=[...n.entries()].map(([e,t])=>({userId:e,label:w(e,t.name),openCount:t.openCount,totalCount:t.totalCount}));return i.sort((e,t)=>t.openCount-e.openCount||e.label.localeCompare(t.label)),i}function E(e,t){return t===null?!0:T(e.assigneeUserId)===t}var D=r();function O(e){let t=e.name??e.userId.slice(0,8);return e.kind===`owner`?`${t} (owner)`:t}var k=`maxy-admin-session-key`;function A(e){let t=[];return e.clientName&&t.push(e.clientName),e.propertyAddress&&t.push(e.propertyAddress),e.fee!=null&&t.push(`£${e.fee}`),t.join(` · `)}function j(e){if(!e)return``;let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=new Date(t);return`${n.getUTCDate()} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][n.getUTCMonth()]} ${n.getUTCFullYear()}`}function M(e){return e.assigneeName?e.assigneeName:e.assigneeUserId?e.assigneeUserId.slice(0,8):`Unassigned`}function N(e,t){return[t,j(e.createdAt),M(e)].filter(Boolean).join(` · `)}function ie(e,t){if(e.running&&e.runningStartedAt){let n=Date.parse(e.runningStartedAt);if(Number.isFinite(n))return e.secondsLogged+Math.max(0,(t-n)/1e3)}return e.secondsLogged}function ae(e){let t=[`Task: ${e.title}\nTask id: ${e.taskId}`],n=e.description.trim();n.length>0&&t.push(n);let r=e.notes.trim();return r.length>0&&t.push(`Notes:\n${r}`),t.join(`
2
2
 
3
3
  `).slice(0,2e3)}function oe({clients:e,onSelect:t}){return(0,D.jsxs)(`section`,{className:`admin-card tasks-card`,children:[(0,D.jsxs)(`div`,{className:`tasks-card-head`,children:[(0,D.jsx)(`span`,{className:`tasks-card-title`,children:`Clients`}),(0,D.jsxs)(`span`,{className:`tasks-card-count`,children:[e.length,` total`]})]}),e.length===0&&(0,D.jsx)(`div`,{className:`tasks-empty`,children:`No clients yet.`}),e.map(e=>(0,D.jsx)(`button`,{className:`tasks-row tasks-client-row`,onClick:()=>t(e.name),children:(0,D.jsxs)(`div`,{className:`tasks-row-main`,children:[(0,D.jsx)(`div`,{className:`tasks-row-name`,children:e.name}),(0,D.jsxs)(`div`,{className:`tasks-row-sub`,children:[e.openCount,` open · `,d(e.totalSeconds),` logged`]})]})},e.name))]})}function se({task:e,roster:t,busy:n,onAssign:r,onClose:i}){return(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,D.jsx)(`div`,{className:`tasks-detail-backdrop`,onClick:i,children:(0,D.jsxs)(`div`,{className:`tasks-detail`,role:`dialog`,"aria-modal":`true`,"aria-label":`Task detail`,onClick:e=>e.stopPropagation(),children:[(0,D.jsxs)(`div`,{className:`tasks-detail-head`,children:[(0,D.jsx)(`h2`,{className:`tasks-detail-title`,children:e?e.name:`Task no longer available`}),(0,D.jsx)(`button`,{className:`tasks-detail-close`,"aria-label":`Close`,onClick:i,children:(0,D.jsx)(l,{size:16})})]}),e===null?(0,D.jsx)(`p`,{className:`tasks-detail-gone`,children:`This task is no longer in the list. It may have been completed, cancelled or removed. Close this and reload to see the current list.`}):(0,D.jsxs)(`dl`,{className:`tasks-detail-fields`,children:[(0,D.jsx)(`dt`,{children:`Status`}),(0,D.jsx)(`dd`,{children:e.status}),(0,D.jsx)(`dt`,{children:`Logged`}),(0,D.jsx)(`dd`,{children:d(e.secondsLogged)}),(0,D.jsx)(`dt`,{children:`Created`}),(0,D.jsx)(`dd`,{children:j(e.createdAt)||`Not recorded`}),(0,D.jsx)(`dt`,{children:`Assignee`}),(0,D.jsx)(`dd`,{children:e.taskId===null?M(e):(0,D.jsxs)(`select`,{className:`tasks-assign-select`,"aria-label":`Assignee`,disabled:n,value:e.assigneeUserId??``,onChange:t=>r(e.taskId,t.target.value===``?null:t.target.value),children:[(0,D.jsx)(`option`,{value:``,children:`Unassigned`}),e.assigneeUserId&&!t.some(t=>t.userId===e.assigneeUserId)&&(0,D.jsxs)(`option`,{value:e.assigneeUserId,children:[M(e),` (not in roster)`]}),t.map(e=>(0,D.jsx)(`option`,{value:e.userId,children:O(e)},e.userId))]})}),e.clientName&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Client`}),(0,D.jsx)(`dd`,{children:e.clientName})]}),e.propertyAddress&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Property`}),(0,D.jsx)(`dd`,{children:e.propertyAddress})]}),e.fee!=null&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`dt`,{children:`Fee`}),(0,D.jsxs)(`dd`,{children:[`£`,e.fee]})]})]})]})})}function P({adminFetch:e}){let[t,n]=(0,x.useState)({open:[],completed:[]}),[r,c]=(0,x.useState)(!1),[u,p]=(0,x.useState)(!1),g=(0,x.useRef)(!1),b=(0,x.useRef)(``),S=te(1e3),[C,w]=(0,x.useState)(`open`),[T,O]=(0,x.useState)(null),[k,j]=(0,x.useState)(null),[M,P]=(0,x.useState)(null),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)(null),[ce,z]=(0,x.useState)(null),[B,V]=(0,x.useState)(null),H=(0,x.useRef)(new Map),U=(0,x.useRef)(new Set),[le,ue]=(0,x.useState)(new Set),W=(0,x.useMemo)(()=>{if(L!==null)return[...t.open,...t.completed].find(e=>e.rowKey===L)??null},[t,L]),G=(0,x.useMemo)(()=>B===null?null:[...t.open,...t.completed].find(e=>e.rowKey===B)??null,[t,B]);(0,x.useEffect)(()=>{L!==null&&W===null&&console.error(`[tasks-ui] op=detail-failed rowKey=${L} reason=not-in-list`)},[L,W]);let K=(0,x.useMemo)(()=>ne(t.open,t.completed),[t]),q=(0,x.useMemo)(()=>T===null?{open:t.open,completed:t.completed}:{open:t.open.filter(e=>e.clientName===T),completed:t.completed.filter(e=>e.clientName===T)},[t,T]),J=(0,x.useMemo)(()=>re(q.open,q.completed),[q]),de=(0,x.useCallback)(e=>{O(e),w(`open`)},[]);(0,x.useEffect)(()=>{T&&!K.some(e=>e.name===T)&&O(null)},[K,T]),(0,x.useEffect)(()=>{k&&!J.some(e=>e.userId===k)&&j(null)},[J,k]),(0,x.useEffect)(()=>{z(null),V(null)},[C,T,k]);let Y=t.open.filter(e=>e.running||(T===null||e.clientName===T)&&E(e,k)),X=(T?t.completed.filter(e=>e.clientName===T):t.completed).filter(e=>E(e,k)),[fe,pe]=(0,x.useState)([]),Z=(0,x.useCallback)(async()=>{let t=await e(`/api/admin/tasks-list`);t.ok&&n(await t.json()),c(!0)},[e]);(0,x.useEffect)(()=>{Z()},[Z]),(0,x.useEffect)(()=>{(async()=>{let t=await e(`/api/admin/admin-users-list`);if(t.ok){let e=await t.json();e.ok&&Array.isArray(e.users)&&pe(e.users)}})()},[e]);let Q=(0,x.useCallback)(async(t,n,r)=>{if(g.current)return!1;g.current=!0,p(!0);try{return await e(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({taskId:n,...r})}),await Z(),!0}finally{g.current=!1,p(!1)}},[e,Z]),me=(0,x.useCallback)(async e=>{await Q(`/api/admin/task-complete`,e)},[Q]),he=(0,x.useCallback)(async e=>{await Q(`/api/admin/task-delete`,e,{confirmed:!0})},[Q]),ge=(0,x.useCallback)((e,t)=>{let n=String(Math.round(e.secondsLogged/60));b.current=n,P(t),I(n)},[]),$=(0,x.useCallback)(()=>{P(null),I(``)},[]),_e=(0,x.useCallback)(async e=>{let t=F.trim(),n=Number(t);if(!(t===``||!Number.isInteger(n)||n<0)){if(t===b.current){$();return}P(null),I(``),await Q(`/api/admin/task-time-adjust`,e,{newSeconds:n*60})}},[F,Q,$]),ve=(0,x.useCallback)(e=>{Q(`/api/admin/task-time-adjust`,e,{newSeconds:0})},[Q]),ye=(0,x.useCallback)((e,t)=>{Q(`/api/admin/task-assign`,e,{assigneeUserId:t})},[Q]),be=(0,x.useCallback)(async t=>{if(!U.current.has(t)){U.current.add(t),ue(new Set(U.current));try{let n=await e(`/api/admin/task-session-open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({taskId:t})});if(!n.ok){console.error(`[admin-ui] task-session op=open-failed taskId=${t} status=${n.status}`);return}let{sessionId:r,title:i,description:a,notes:o}=await n.json();if(r!==null){let e=`/chat?session=${r}`;window.location.assign(e);return}let s=ae({title:i,taskId:t,description:a??``,notes:o??``}),c=await e(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:i,initialMessage:s})}),l=await c.json().catch(()=>({})),u=ee(c.ok,c.status,l),d=l.sessionId??null;if(u.kind!==`navigate`){console.error(`[admin-ui] task-session op=spawn-failed taskId=${t} reason=${u.reason}`);return}if(d!==null){let n=await e(`/api/admin/task-session-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({taskId:t,sessionId:d})});n.ok&&(await n.json().catch(()=>({}))).linked}else console.error(`[admin-ui] task-session op=link-skipped taskId=${t} reason=no-landed-session-id`);window.location.assign(u.url)}catch(e){console.error(`[admin-ui] task-session op=failed taskId=${t} error=${e instanceof Error?e.message:String(e)}`)}finally{U.current.delete(t),ue(new Set(U.current))}}},[e]);if(!r)return(0,D.jsx)(s,{surface:`gate`});let xe=e=>e.taskId!==null&&M===e.taskId,Se=e=>(0,D.jsxs)(`div`,{className:`tasks-edit`,children:[(0,D.jsx)(`input`,{className:`tasks-edit-input`,type:`number`,min:0,step:1,"aria-label":`Logged minutes`,value:F,onChange:e=>I(e.target.value)}),(0,D.jsx)(`span`,{className:`tasks-edit-unit`,children:`min`}),(0,D.jsxs)(`button`,{className:`admin-btn-cta tasks-btn-action`,disabled:u,onClick:()=>void _e(e),children:[(0,D.jsx)(f,{size:14}),` Save`]}),(0,D.jsxs)(`button`,{className:`tasks-btn-secondary tasks-btn-action`,onClick:$,children:[(0,D.jsx)(l,{size:14}),` Cancel`]})]}),Ce=(e,t)=>[{key:`edit-time`,label:`Edit logged time for task: ${e.name}`,menuLabel:`Edit time`,title:e.running?`Stop the timer before editing time`:`Set the logged time for this task`,icon:(0,D.jsx)(i,{size:12}),disabled:u||e.running,onClick:()=>ge(e,t)},{key:`reset-time`,label:`Reset logged time for task: ${e.name}`,menuLabel:`Reset logged time to 0:00`,title:e.running?`Stop the timer before resetting time`:`Set the logged time back to zero`,icon:(0,D.jsx)(y,{size:12}),disabled:u||e.running,onClick:()=>ve(t)},{key:`session`,label:`Open session for task: ${e.name}`,menuLabel:`Session`,title:e.sessionId?`Resume this task’s session`:`Start a session for this task`,icon:(0,D.jsx)(_,{size:12}),disabled:le.has(t),onClick:()=>{be(t)}},{key:`delete`,label:`Delete task: ${e.name}`,menuLabel:`Delete`,title:e.running?`Stop the timer before deleting`:`Delete this task and its time records`,icon:(0,D.jsx)(a,{size:12}),danger:!0,disabled:u||e.running,onClick:()=>V(e.rowKey)}];return(0,D.jsxs)(`div`,{className:`ui-page ui-page--full tasks-body`,children:[L!==null&&(0,D.jsx)(se,{task:W??null,roster:fe,busy:u,onAssign:ye,onClose:()=>R(null)}),(0,D.jsx)(m,{target:G?{name:G.name,secondsLogged:G.secondsLogged}:null,anchorEl:B?H.current.get(B)??null:null,onCancel:()=>V(null),onConfirm:()=>{let e=G;V(null),e?.taskId&&he(e.taskId)}},B??`none`),(0,D.jsxs)(`div`,{className:`tasks-tabs`,children:[(0,D.jsxs)(`button`,{className:`admin-chip ${C===`open`?`is-active`:``}`,onClick:()=>w(`open`),children:[`Open `,(0,D.jsx)(`span`,{className:`tasks-tab-badge`,children:t.open.length})]}),(0,D.jsxs)(`button`,{className:`admin-chip ${C===`completed`?`is-active`:``}`,onClick:()=>w(`completed`),children:[`Completed `,(0,D.jsx)(`span`,{className:`tasks-tab-badge`,children:t.completed.length})]}),(0,D.jsxs)(`button`,{className:`admin-chip ${C===`clients`?`is-active`:``}`,onClick:()=>w(`clients`),children:[`Clients `,(0,D.jsx)(`span`,{className:`tasks-tab-badge`,children:K.length})]})]}),C===`clients`?(0,D.jsx)(oe,{clients:K,onSelect:de}):(0,D.jsxs)(D.Fragment,{children:[T&&(0,D.jsxs)(`div`,{className:`tasks-filter-banner`,children:[(0,D.jsxs)(`span`,{children:[`Showing `,T]}),(0,D.jsx)(`button`,{className:`tasks-filter-clear`,onClick:()=>O(null),children:`Clear`})]}),J.length>0&&(0,D.jsxs)(`div`,{className:`tasks-assignee-bar`,children:[(0,D.jsxs)(`button`,{className:`admin-chip ${k===null?`is-active`:``}`,"aria-pressed":k===null,onClick:()=>j(null),children:[`All `,(0,D.jsx)(`span`,{className:`tasks-assignee-count`,children:q.open.length})]}),J.map(e=>(0,D.jsxs)(`button`,{className:`admin-chip ${k===e.userId?`is-active`:``}`,"aria-pressed":k===e.userId,"aria-label":`Assignee ${e.label}`,title:e.userId===`__unassigned__`?`Tasks with no assigned admin`:`AdminUser ${e.userId}`,onClick:()=>j(k===e.userId?null:e.userId),children:[e.label,` `,(0,D.jsx)(`span`,{className:`tasks-assignee-count`,children:e.openCount})]},e.userId))]}),C===`open`?(0,D.jsxs)(`section`,{className:`admin-card tasks-card`,children:[(0,D.jsxs)(`div`,{className:`tasks-card-head`,children:[(0,D.jsx)(`span`,{className:`tasks-card-title`,children:`Open tasks`}),(0,D.jsxs)(`span`,{className:`tasks-card-count`,children:[Y.length,` to do`]})]}),Y.length===0&&(0,D.jsx)(`div`,{className:`tasks-empty`,children:`No open tasks.`}),Y.map(e=>(0,D.jsxs)(`div`,{className:`tasks-row`,ref:t=>{t?H.current.set(e.rowKey,t):H.current.delete(e.rowKey)},children:[(0,D.jsx)(`button`,{className:`tasks-row-open`,"aria-label":`Open task detail: ${e.name}`,onClick:()=>R(e.rowKey),children:(0,D.jsxs)(`div`,{className:`tasks-row-main`,children:[(0,D.jsx)(`div`,{className:`tasks-row-name`,children:e.name}),(0,D.jsx)(`div`,{className:`tasks-row-sub`,children:N(e,A(e))})]})}),(0,D.jsx)(`div`,{className:`tasks-row-elapsed ${e.running?`tasks-row-elapsed-running`:``}`,children:d(ie(e,S))}),(0,D.jsx)(`div`,{className:`tasks-row-controls`,children:e.taskId!==null&&ce===e.taskId?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`tasks-confirm-label`,children:`Complete?`}),(0,D.jsxs)(`button`,{className:`admin-btn-cta tasks-btn-action`,disabled:u,onClick:()=>{z(null),me(e.taskId)},children:[(0,D.jsx)(f,{size:14}),` Confirm complete`]}),(0,D.jsxs)(`button`,{className:`tasks-btn-secondary tasks-btn-action`,onClick:()=>z(null),children:[(0,D.jsx)(l,{size:14}),` Keep open`]})]}):e.taskId===null?(0,D.jsx)(`span`,{className:`tasks-row-broken`,title:`This task has no id, so it cannot be started, edited or completed. Repair it by running platform/scripts/backfill-task-ids.sh on this install.`,children:`Needs repair`}):xe(e)?Se(e.taskId):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(h,{actions:Ce(e,e.taskId),disabled:!1,label:`Task actions`}),(0,D.jsx)(`button`,{className:`tasks-btn-secondary tasks-btn-action tasks-btn-icon`,"aria-label":`Complete task: ${e.name}`,disabled:u||e.running,title:e.running?`Stop the timer before completing`:`Complete task`,onClick:()=>z(e.taskId),children:(0,D.jsx)(f,{size:14})}),e.running?(0,D.jsxs)(`button`,{className:`admin-btn-danger tasks-btn-action`,disabled:u,title:`Stop the timer`,onClick:()=>void Q(`/api/admin/task-timer-stop`,e.taskId),children:[(0,D.jsx)(o,{size:14}),` Stop`]}):(0,D.jsxs)(`button`,{className:`admin-btn-cta tasks-btn-action`,disabled:u,title:`Start the timer`,onClick:()=>void Q(`/api/admin/task-timer-start`,e.taskId),children:[(0,D.jsx)(v,{size:14}),` Start`]})]})})]},e.rowKey))]}):(0,D.jsxs)(`section`,{className:`admin-card tasks-card`,children:[(0,D.jsxs)(`div`,{className:`tasks-card-head`,children:[(0,D.jsx)(`span`,{className:`tasks-card-title`,children:`Completed`}),(0,D.jsxs)(`span`,{className:`tasks-card-count`,children:[X.length,` done`]})]}),X.length===0&&(0,D.jsx)(`div`,{className:`tasks-empty`,children:`Nothing completed yet.`}),X.map(e=>(0,D.jsxs)(`div`,{className:`tasks-row tasks-row-done`,ref:t=>{t?H.current.set(e.rowKey,t):H.current.delete(e.rowKey)},children:[(0,D.jsx)(`button`,{className:`tasks-row-open`,"aria-label":`Open task detail: ${e.name}`,onClick:()=>R(e.rowKey),children:(0,D.jsxs)(`div`,{className:`tasks-row-main`,children:[(0,D.jsx)(`div`,{className:`tasks-row-name`,children:e.name}),(0,D.jsx)(`div`,{className:`tasks-row-sub`,children:N(e,A(e))})]})}),(0,D.jsx)(`div`,{className:`tasks-row-elapsed`,children:d(e.secondsLogged)}),(0,D.jsx)(`div`,{className:`tasks-row-controls`,children:e.taskId===null?(0,D.jsx)(`span`,{className:`tasks-row-broken`,title:`This task has no id, so its logged time cannot be edited. Repair it by running platform/scripts/backfill-task-ids.sh on this install.`,children:`Needs repair`}):xe(e)?Se(e.taskId):(0,D.jsx)(h,{actions:Ce(e,e.taskId),disabled:!1,label:`Task actions`})})]},e.rowKey))]})]})]})}function F({cacheKey:e}){let{adminFetch:t}=c({initialCacheKey:e,surface:`tasks`});return(0,D.jsx)(P,{adminFetch:t})}function I(){let[e,t]=(0,x.useState)(null),[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(void 0),[o,c]=(0,x.useState)(null),[l,d]=(0,x.useState)(null),[f,m]=(0,x.useState)(null),[h,ee]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(k)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(k)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&a(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),d(e.role??null),m(e.userName===void 0?null:e.userName),ee(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let _=(0,x.useCallback)(()=>{try{sessionStorage.removeItem(k)}catch{}window.location.href=`/`},[]),[v,y]=(0,x.useState)(!1),b=(0,x.useCallback)(async()=>{y(!0);try{let e=await p();if(e){try{sessionStorage.removeItem(k)}catch{}window.location.href=`/`}return e}finally{y(!1)}},[]);return n?e?(0,D.jsx)(u,{cacheKey:e,surface:`tasks`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=tasks`);try{sessionStorage.removeItem(k)}catch{}window.location.href=`/`},children:(0,D.jsx)(g,{cacheKey:e,businessName:i,sessionId:o,onLogout:_,onDisconnect:b,disconnecting:v,userName:f,userAvatar:h,role:l,children:(0,D.jsx)(F,{cacheKey:e})})}):(0,D.jsx)(`div`,{className:`tasks-page`,children:(0,D.jsxs)(`div`,{className:`tasks-empty`,children:[(0,D.jsx)(`p`,{children:`You are not signed in.`}),(0,D.jsxs)(`p`,{children:[`Open the `,(0,D.jsx)(`a`,{href:`/`,className:`tasks-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,D.jsx)(s,{surface:`gate`})}(0,b.createRoot)(document.getElementById(`root`)).render((0,D.jsx)(I,{}));
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Browser — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/browser-D68qFX85.js"></script>
8
+ <script type="module" crossorigin src="/assets/browser-D44lWNJu.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-CzHB95sB.js">
13
13
  <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-rMaiYjNu.css">
14
14
  <link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
15
15
  <link rel="stylesheet" href="/brand-defaults.css">
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Calendar — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/calendar-DiyBcrbJ.js"></script>
8
+ <script type="module" crossorigin src="/assets/calendar-BeP0MSFX.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-CzHB95sB.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-0tVo23Dh.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/clock-D2cZ0sge.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/file-text-rWowl9RN.js">
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Chat — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/chat-BgmAjdkp.js"></script>
8
+ <script type="module" crossorigin src="/assets/chat-CeDpcouO.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-CzHB95sB.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-eAV8hweq.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/copy-C87QIN_o.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/play-DgP7vl0r.js">
@@ -19,7 +19,7 @@
19
19
  <link rel="modulepreload" crossorigin href="/assets/file-text-rWowl9RN.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-Dnn7gbPh.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/wrench-Ck4phkdB.js">
22
- <link rel="modulepreload" crossorigin href="/assets/page-C4NwxoSJ.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/page-CGTC6xi4.js">
23
23
  <link rel="stylesheet" crossorigin href="/assets/jsx-runtime-rMaiYjNu.css">
24
24
  <link rel="stylesheet" crossorigin href="/assets/useMediaQuery-DXAuc8G-.css">
25
25
  <link rel="stylesheet" href="/brand-defaults.css">
@@ -5,12 +5,12 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Graph — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/graph-fZwMrLTq.js"></script>
8
+ <script type="module" crossorigin src="/assets/graph-DvB6wgt_.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-BycB0eMI.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BmNepPEn.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/useMediaQuery-B469O83-.js">
12
12
  <link rel="modulepreload" crossorigin href="/assets/graph-labels-kneGnsHB.js">
13
- <link rel="modulepreload" crossorigin href="/assets/AdminShell-BtWb0_Gm.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/AdminShell-CzHB95sB.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-DfNAu8hQ.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-0tVo23Dh.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/copy-C87QIN_o.js">