@bigmistqke/workpad 0.18.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +18 -9
  2. package/bin/workpad.ts +412 -58
  3. package/dist/bin/workpad.js +336 -46
  4. package/dist/client/runtime.js +141 -18
  5. package/dist/plugins/badge/README.md +59 -10
  6. package/dist/plugins/badge/index.js +130 -8
  7. package/dist/plugins/badge/public/style.css +132 -12
  8. package/dist/plugins/chat/README.md +7 -3
  9. package/dist/plugins/chat/index.js +8 -1
  10. package/dist/plugins/chat/public/client.js +2 -2
  11. package/dist/plugins/chat/public/style.css +10 -0
  12. package/dist/plugins/claude/README.md +13 -5
  13. package/dist/plugins/claude/channel.js +47 -6
  14. package/dist/plugins/claude/doctor.js +43 -47
  15. package/dist/plugins/claude/index.js +24 -8
  16. package/dist/plugins/claude/session.js +46 -1
  17. package/dist/plugins/comments/README.md +2 -1
  18. package/dist/plugins/comments/index.js +2 -0
  19. package/dist/plugins/comments/public/client.js +6 -5
  20. package/dist/plugins/comments/public/style.css +9 -0
  21. package/dist/plugins/form/README.md +1 -1
  22. package/dist/plugins/index.js +3 -1
  23. package/dist/plugins/opencode/channel.js +43 -7
  24. package/dist/plugins/opencode/index.js +2 -0
  25. package/dist/plugins/progress/README.md +41 -0
  26. package/dist/plugins/progress/index.js +117 -0
  27. package/dist/plugins/progress/public/client.js +1 -0
  28. package/dist/plugins/progress/public/style.css +85 -0
  29. package/dist/plugins/progress/state.js +210 -0
  30. package/dist/solid/index.js +3 -1
  31. package/dist/src/agents.js +13 -4
  32. package/dist/src/anchors.js +25 -1
  33. package/dist/src/build.js +1 -1
  34. package/dist/src/client/page/base.css +48 -2
  35. package/dist/src/client/page/main.js +58 -30
  36. package/dist/src/document.js +6 -4
  37. package/dist/src/events.js +22 -11
  38. package/dist/src/help.js +59 -12
  39. package/dist/src/hub.js +69 -3
  40. package/dist/src/listen.js +36 -4
  41. package/dist/src/listeners.js +14 -4
  42. package/dist/src/loader.js +7 -2
  43. package/dist/src/migrate.js +1 -1
  44. package/dist/src/pages/board.js +9 -4
  45. package/dist/src/pages/index.js +2 -4
  46. package/dist/src/pages/markdown.js +50 -19
  47. package/dist/src/pages/render.js +17 -1
  48. package/dist/src/server.js +94 -18
  49. package/dist/src/set.js +99 -0
  50. package/dist/src/state.js +2 -1
  51. package/dist/src/status.js +57 -9
  52. package/dist/src/turns.js +41 -0
  53. package/package.json +11 -1
  54. package/plugins/README.md +3 -1
  55. package/plugins/badge/README.md +59 -10
  56. package/plugins/badge/index.ts +141 -8
  57. package/plugins/badge/public/style.css +132 -12
  58. package/plugins/chat/README.md +7 -3
  59. package/plugins/chat/client.tsx +20 -3
  60. package/plugins/chat/index.ts +10 -1
  61. package/plugins/chat/public/style.css +10 -0
  62. package/plugins/claude/README.md +13 -5
  63. package/plugins/claude/channel.ts +45 -7
  64. package/plugins/claude/doctor.ts +58 -39
  65. package/plugins/claude/index.ts +30 -8
  66. package/plugins/claude/session.ts +32 -0
  67. package/plugins/comments/README.md +2 -1
  68. package/plugins/comments/client.ts +19 -0
  69. package/plugins/comments/index.ts +7 -1
  70. package/plugins/comments/public/style.css +9 -0
  71. package/plugins/form/README.md +1 -1
  72. package/plugins/index.ts +2 -0
  73. package/plugins/opencode/channel.ts +44 -8
  74. package/plugins/opencode/index.ts +4 -0
  75. package/plugins/progress/README.md +41 -0
  76. package/plugins/progress/client.ts +172 -0
  77. package/plugins/progress/index.ts +166 -0
  78. package/plugins/progress/public/style.css +85 -0
  79. package/plugins/progress/state.ts +278 -0
  80. package/skills/workpad/SKILL.md +149 -18
  81. package/solid/index.tsx +6 -2
  82. package/src/agents.ts +24 -2
  83. package/src/anchors.ts +32 -0
  84. package/src/build.ts +1 -1
  85. package/src/client/delivery.ts +49 -0
  86. package/src/client/forms.ts +18 -11
  87. package/src/client/page/base.css +48 -2
  88. package/src/client/page/waiting.ts +45 -25
  89. package/src/client/read.ts +9 -5
  90. package/src/client/runtime.ts +7 -3
  91. package/src/client/toast.ts +27 -3
  92. package/src/define.ts +120 -9
  93. package/src/document.ts +19 -5
  94. package/src/events.ts +47 -6
  95. package/src/help.ts +58 -11
  96. package/src/hub.ts +80 -2
  97. package/src/listen.ts +47 -4
  98. package/src/listeners.ts +22 -1
  99. package/src/loader.ts +14 -4
  100. package/src/migrate.ts +1 -1
  101. package/src/pages/board.ts +12 -3
  102. package/src/pages/index.ts +8 -10
  103. package/src/pages/markdown.ts +59 -12
  104. package/src/pages/render.ts +20 -2
  105. package/src/server.ts +127 -19
  106. package/src/set.ts +118 -0
  107. package/src/state.ts +3 -0
  108. package/src/status.ts +115 -14
  109. package/src/turns.ts +56 -0
@@ -19,7 +19,7 @@ its answers are events of that type, and a link to it is
19
19
  chat. A form on the page can't have a `/` in its name.
20
20
 
21
21
  To rework a message (an option more, a typo), edit it in place:
22
- `workpad edit <its id> --data '{"text":"…"}'`. It updates in the reader's
22
+ `workpad edit <its id> --text-file -` with the new text on standard input. It updates in the reader's
23
23
  tab, marked new until they've seen it, and a form in it that keeps its name
24
24
  keeps its answers.
25
25
 
@@ -41,10 +41,14 @@ message `#message:<its event id>`; a folded form's chat opens for it.
41
41
 
42
42
  A message is a `chat:message` event, `{ "chat": "<name>", "text": "…" }`,
43
43
  never an answer: under a form it never makes a choice (only the reader can,
44
- with a message of yours marked `answer`, below). Answer in the same chat:
44
+ with a message of yours marked `answer`, below). Answer in the same chat, the
45
+ text from standard input (a quoted heredoc: no shell quoting in the markdown)
46
+ or a file (`--text-file reply.md`):
45
47
 
46
48
  ```sh
47
- workpad append --page <file> --type chat:message --data '{"chat":"<name>","text":"your answer"}'
49
+ workpad append --page <file> --type chat:message --data '{"chat":"<name>"}' --text-file - <<'EOF'
50
+ your answer, in markdown
51
+ EOF
48
52
  ```
49
53
 
50
54
  Two more fields, both optional:
@@ -40,12 +40,18 @@ const chat = {
40
40
  };
41
41
  /** The chat at the bottom of every page (see `end`): for what is about none of its questions. */
42
42
  const PAGE_CHAT = "page";
43
+ /**
44
+ * Whether a page's text could name a chat (or a form, whose chat it is) `name`: a `name=` or `id=`
45
+ * of it, or `#name`. Without one it names none, and the page needs no parse to say so: most pages,
46
+ * whose status asks this for every page.
47
+ */
48
+ const mayName = (body, name) => new RegExp(`(?:\\bname|\\bid)\\s*=\\s*["']?${name}(?![\\w-])|#${name}(?![\\w-])`).test(body);
43
49
  function chatPlugin({ page: pageChat = true } = {}) {
44
50
  return definePlugin({
45
51
  name: "chat",
46
52
  end(page) {
47
53
  if (!pageChat || page.id.startsWith("-/")) return null;
48
- if (page.frontmatter.plugins?.chat === false || chatNames(page.body).includes("page")) return null;
54
+ if (page.frontmatter.plugins?.chat === false || mayName(page.body, "page") && chatNames(page.body).includes("page")) return null;
49
55
  return `:::chat{name=${PAGE_CHAT}}\nQuestions or remarks about this page:\n:::`;
50
56
  },
51
57
  public: builtinPublic("chat"),
@@ -62,6 +68,7 @@ function chatPlugin({ page: pageChat = true } = {}) {
62
68
  events: { "chat:message": {
63
69
  handOut: true,
64
70
  forReader: true,
71
+ requires: ["chat", "text"],
65
72
  description: "a message in a chat: `{ chat, text }`, and `replaces` or `replyTo` (see below)"
66
73
  } },
67
74
  commands: { prune: {
@@ -1,3 +1,3 @@
1
- var e=class extends Error{constructor(e){let t=Error,n=t.stackTraceLimit;n!==void 0&&(t.stackTraceLimit=0),super(),n!==void 0&&(t.stackTraceLimit=n),this.source=e}},t=class extends Error{constructor(e,t){try{var n=String(t instanceof Error?t.message:t)}catch{}super(n,{cause:t}),this.source=e}};function n(e){return e instanceof t?e.cause:e}var r=class extends Error{constructor(){super(``)}},i=class extends Error{constructor(){super(``)}};const a=4096,o=1<<22,s=1<<21,c=16384,l=1<<23,u={},d={},f=Symbol(`refresh`),p=Set;function m(e){let t=e.pe;for(;t;)t.R|=32,m(t),t=t.Ge}function h(e){e.l&=-33,gt(e)}let g;function _(e){try{e()}catch(e){g||=[e],M()}}function v(e){let t=g;if(g=void 0,t&&!e)throw t[0]}function y(e,t=!1,n){let r=e.R;if(r&64)return;t&&(n||e.T===null||e.T.me===null&&e.T.Le===null||y(e,!1,!0),e.R=r|64,e.X&&(St(e),(e.m&1&&e.T?.Re!=null||r&2048||F.length)&&M()));let i=n?e.T.me:e.pe;for(n?e.T.me=null:e.pe=null;i;){let e=i;e.l&=-33,at(e,A),pt(e),i.Me=i,y(i,!0),i=i.Ge}if(n||(e.be=0),t&&!n&&!(r&32)&&e._parent!==null&&!(e._parent.R&64)){let t=e.Me,n=e.Ge;t===null?e._parent.pe=n:t.Ge=n,n!==null&&(n.Me=t),e.Me=null}if(ee(e,n),t&&e.ze){let t=e.ze;e.ze=void 0,_(t)}}function b(e,t){let n=e.pe;t.Me=null,t.Ge=n,n!==null&&(n.Me=t),e.pe=t}function ee(e,t){let n=t?e.T.Le:e.ke;if(n){if(t?e.T.Le=null:e.ke=null,Array.isArray(n))for(let e=n.length-1;e>=0;e--)_(n[e]);else _(n)}}function te(e,t){let n=e;for(;n.l&4&&n._parent;)n=n._parent;if(n.id!=null)return ie(n.id,t?n.be++:n.be);throw Error()}function ne(e){return te(e,!0)}function re(e,t,n){return e?.id??(t?n?.id:n?.id==null?void 0:ne(n))}function ie(e,t){let n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):``)+n}function x(){return V}function ae(e,t=V){return t&&(t.ke?Array.isArray(t.ke)?t.ke.push(e):t.ke=[t.ke,e]:t.ke=e),e}function oe(e=!0){y(this,e),g&&!I.Y&&v()}function se(e){let t=V,n=e?.transparent??!1,r={id:re(e,n,t),l:n?4:0,R:0,Qe:!0,Ke:t?.Qe?t.Ke:t,pe:null,Ge:null,Me:null,ke:null,A:t?.A||d,be:0,T:null,_parent:t,dispose:oe};return t&&b(t,r),r}function ce(e,t){let n=se(t);return K(n,()=>e(oe.bind(n,!0)))}let le=null,S=null,ue=null,de=null,fe=null;function pe(e,t,n,r,i){le=e,S=t,ue=n,de=r,fe=i}const C=[];function me(e,t=null){let n={ln:[],rn:[[],[]],fn:[],eo:null,_parent:t,P:e,Pe:null,tt:0,nt:!1,nn:null,Ue:!1,un:!1,I:null};return e||C.push(n),n}let w=null;function he(e){w=e}let T=null,E=null;function ge(e,t){if(I.Y&&!t||T!==null)return k(e);E===null?E=O(e):ve(O(e),E),M()}function D(e){return e.T.Re=O(e.T.Re)}function _e(e){return e=O(e),C.indexOf(e)===-1?null:e}function O(e){for(;e.eo!==null;)e=e.eo;return e}function k(e){let t=T;t===null?T=e===null?me(!1):O(e):e!==null&&ve(O(e),t),I.Y||M()}function ve(e,t){e=O(e),t=O(t),e===t||e.P||t.P||(e.eo=t,t.tt+=e.tt,t.nt||=e.nt,P(t.ln,e.ln),P(t.rn[0],e.rn[0]),P(t.rn[1],e.rn[1]),P(t.fn,e.fn),e.I!==null&&P(t.I??=[],e.I),C.splice(C.indexOf(e),1))}function ye(e){let t=be;be??=e;let n=e.tt!==0||Se(e.ln,e)||!1;return be=t,n}let be=null;function xe(e,t){let n=e.T?.se;if(n===void 0)return!0;for(let e of n){let n=e.T?.Re;if(n==null||O(n)===t)return!0}return!1}function Se(e,t,n=!1){for(let r=0;r<e.length;r++){let i=e[r];if(!(!(i.m&1)||i.R&64||i.l&8192||i.T.Re!==null&&D(i)!==t||n&&!xe(i,t))){if(i.i===1){if(Ce(i,be??t))return!0}else for(let e=i.o;e!==null;e=e.t){let n=e.u;if((n.i===1&&n.m&1||n.R&2048||n.l&16384&&n.m===1)&&(e.Ne===n.de||n.T?.U!=null)&&!(n.R&64)&&Ce(n,be??t))return!0}}}return!1}function Ce(e,t){return!(e.R&32&&we(e,t))&&!ue?.(e)}function we(e,t){let n=e;for(;n?.R&32;)n=n._parent;return n?.l&256&&n.T?.Re!=null&&D(n)===O(t)}const Te=[];function Ee(e){Te.push(e)}const De=[];function Oe(e){at(e,A),e.R&=-4,De.push(e)}function ke(e,t){e.l|=256,Ae(e,t)}function Ae(e,t){let n=W(e);n.Re!==t&&(n.Re=t,t.ln.push(e))}function je(e,t){for(let n=e.pe;n!==null;n=n.Ge)n.T?.Re?.P||(n.X!==void 0&&(n.l&256||ke(n,t),n.l|=1048576),je(n,t))}function Me(e,t,n){for(let r=e.pe;r!==null;r=r.Ge)(r.l&2304)==256&&D(r)!==t&&n(r),Me(r,t,n)}function Ne(e){e.T.Re=null,e.l&=-257}const A={et:Array(2e3).fill(void 0),p:!1,Fe:0,Et:0};let j=0,Pe=!1,Fe=!1,Ie=!1,Le=0;function M(){Fe?Ve():Pe||(Pe=!0,!Le&&!I.Y&&queueMicrotask(et))}const Re=Symbol.for(`solid-js/root-error-hook`),ze=`[REACTIVITY_HALTED]`;function Be(e){if(Fe)return;Fe=!0,v(!0);let t=ze,n=e!==void 0&&globalThis.reportError;n||e===void 0?console.error(t):console.error(t,e),n&&n(e)}function Ve(){Ie||(Ie=!0,console.error(ze))}var N=class e{rn=[[],[]];Y=!1;flush(){if(!this.Y){this.Y=!0,ln(),w=null,E=null;try{vt(),ct(A,e._e),this.settle(),j++,Pe=A.Et>=A.Fe||F.length!==0,this.run(1),this.run(2)}finally{this.Y=!1,E=null}}}settle(){let e=T;T=null;let t=e!==null&&!e.P?O(e):null;if(t!==null){let e=F.length;for(let n=0;n<e;n++){let e=F[n];if(!(e.l&2304)&&(e.T===null||e.T.Re===null||!e.T.Re.P)){if(e.ue===u&&e.m&4&&e.i!==1)continue;if(e.ue!==u&&!(e.m&5)&&e.T?.me==null&&e.T?.Le==null&&gn(e,e.le,e.ue)){e.ue=u,e.l&=-129;continue}ke(e,t)}e.l&128&&je(e,t)}F.length=0,De.splice(0)}else{$e();for(let e=0;e<Te.length;e++){let t=Te[e];t.T?.U==null&&!t.Ae&&ft(t)}}Te.length&&=0;let n=this.rn;this.rn=[[],[]];for(let e=C.length-1;e>=0;e--){let t=C[e];ye(t)||(C.splice(e,1),Ue(t),e=C.length)}let r=t&&_e(t),i=r!==null;for(let e=0;e<2;e++)i&&P(r.rn[e],n[e]),this.rn[e]=i||this.rn[e].length?[].concat(i?[]:n[e],this.rn[e]):n[e];if(De.length!==0){let e=De.splice(0).sort((e,t)=>e.he-t.he);for(let t=0;t<e.length;t++)e[t].R&64||H(e[t])}de?.()}run(e){let t=this.rn[e-1];t.length&&(this.rn[e-1]=[],tt(t,e))}enqueue(e,t,n=w){e&&(n?.P?n:this).rn[e-1].push(t),M()}notify(e,t,n,r){return le?.(e,n&t,r)?!0:t&1?(n&1&&w===null&&k(null),!0):!1}};function He(e){let t;for(let n=0;n<e.fn.length;n++){let r=e.fn[n],i=r.T?.U?.source;if(!(r.R&64||r.m&2&&(r.i||!(r.l&8388608))&&i!==r&&(i?.m??2)&2)&&r.R&2048){t||=r.i||i===r||r.l&256,e.P||(r.R&=-2049),r.Ae=!1;for(let e=r.pe;e!==null;e=e.Ge)e.i&&(e.Ae=!1);L(r)}}return e.fn.length=0,t}function Ue(e){let t=He(e);for(let t=0;t<e.ln.length;t++){let n=e.ln[t];n.T.Re!==null&&D(n)===e&&(n.T.Re=null,Qe(n))}T===e&&(T=null),t?I.rn[1].push(()=>We(e)):We(e)}function We(e){for(let t=0;t<2;t++)P(I.rn[t],e.rn[t]),e.rn[t]=[]}function P(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}const F=[];function Ge(e,t){e.R&2048||(e.R|=2048,t.fn.push(e))}function Ke(e){F.push(e),I.Y||rn()}let qe=0;function Je(){qe++}function Ye(e){e.we=qe;let t=!!(e.l&512)&&e.T?.De!==void 0;for(let n=e.o;n!==null;n=n.t){let e=n.u;e.R&4&&n.Ne===e.de&&n!==e._&&(e.R|=a),t&&e.l&8?e.R|=256:L(e)}}function Xe(e){e.Ae=!0,I.enqueue(e.i,e.W??=N.q.bind(null,e))}function Ze(e){return e.ue!==u&&(e.le=e.ue,e.ue=u)}function Qe(e){let t=e;if(!t.X){e.l&=-385,Ze(e);return}let n=e.ue===u&&!!(t.m&1),r=e.l&s;if(!n&&t.T&&(t.T.Te=null),e.l=n?e.l&-1048833|1024:e.l&-3147137,r){let n=e.ue;e.ue=u,e.ie=j+1,Lt(t,2,n)}else Ze(e)&&(t.m&=-5,t.T!=null&&(t.T.Ve=!1,t.T.je=u),e.i&&e.i!==3&&Xe(e));t.Ie=!1,t.R&=-1025,t.T?.U??ft(t),t.m&1||(t.m&=-5),n||t.T==null||t.T.me===null&&t.T.Le===null||N.Ce(t,!1,!0)}function $e(){for(let e=0;e<F.length;e++){let t=F[e];t.l&2304||Qe(t)}F.length=0}const I=new N;function et(e){if(e){Le++;try{return e()}finally{try{et()}finally{Le--}}}if(!I.Y&&!Fe){for(;Pe;)I.flush();v()}}function tt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function L(e){A.Fe>e.he&&(A.Fe=e.he),rt(e,A)}function nt(e,t){let n=(e._parent?.Qe?e._parent.Ke?.he:e._parent?.he)??-1;n>=e.he&&(e.he=n+1);let r=e.he,i=t.et[r];if(i===void 0)t.et[r]=e;else{let t=i.We;t.ve=e,e.We=t,i.We=e}r>t.Et&&(t.Et=r)}function rt(e,t){let n=e.R;n&12||(n&1?e.R=n&-4|10:(e.R=n|8,t.p&&st(e)),n&16||nt(e,t))}function it(e,t){let n=e.R;n&28||(e.R=n|16,nt(e,t))}function at(e,t){let n=e.R;if(!(n&24))return;e.R=n&-25;let r=e.he;if(e.We===e)t.et[r]=void 0;else{let n=e.ve,i=t.et[r],a=n??i;e===i?t.et[r]=n:e.We.ve=n,a.We=e.We}e.We=e,e.ve=void 0}function ot(e){if(!e.p){e.p=!0;for(let t=0;t<=e.Et;t++)for(let n=e.et[t];n!==void 0;n=n.ve)n.R&8&&st(n)}}function st(e,t=2){let n=e.R;if(!((n&3)>=t)){e.R=n&-4|t;for(let t=e.o;t!==null;t=t.t)st(t.u,1)}}function ct(e,t){for(e.p=!1,e.Fe=0;e.Fe<=e.Et;e.Fe++){let n=e.et[e.Fe];for(;n!==void 0;)n.R&8?t(n):lt(n,e),n=e.et[e.Fe]}e.Et=0}function lt(e,t){at(e,t);let n=e.he;for(let t=e.C;t;t=t.G){let e=t.S;e.X&&e.he>=n&&(n=e.he+1)}if(e.he!==n){e.he=n;for(let n=e.o;n!==null;n=n.t)it(n.u,t)}}let ut;function dt(e){let t=e.S,n=e.G,r=e.t,i=e.en;if(r===null?t.Ze=i:r.en=i,i!==null)i.t=r;else if(t.o=r,r===null){t.l&4096?ut(t):t.T?.Ye&&_(t.T.Ye);let e=t;e.X&&e.l&32&&!(e.R&32)&&!(e.m&1)&&(mt?mt.push(e):gt(e))}return n}function ft(e){let t=e._,n=t===null?e.C:t.G;if(n!==null){do n=dt(n);while(n!==null);t===null?e.C=null:t.G=null}}function pt(e){e.C&&(e._=null,ft(e))}let mt=null;const ht=e=>mt=e;function gt(e){at(e,A),pt(e),y(e,!0)}const _t=new p;function vt(){if(_t.size!==0){for(let e of _t)!e.o&&e.l&32&&!(e.m&1)&&!(e.R&96)&&gt(e);_t.clear()}}function yt(e,t){let n=t._;if(n!==null&&n.S===e)return;let r=null,i=t.R&4;if(i&&(r=n===null?t.C:n.G,r!==null&&r.S===e)){r.Ne=t.de,t._=r;return}let a=e.Ze;if(a!==null&&a.u===t&&(!i||a.Ne===t.de))return;let o=t._=e.Ze={S:e,u:t,G:r,en:a,t:null,Ne:t.de};n===null?t.C=o:n.G=o,a===null?e.o=o:a.t=o,Je()}function bt(e,t){return!e.T?.se?.has(t)&&((W(e).se??=new p).add(t),!0)}function xt(e,t){let n=e.T?.se;return n?.delete(t)?(n.size||(e.T.se=void 0),!0):!1}function St(e){e.T!==null&&(e.T.Ee=null)}function Ct(e){e.T!==null&&(e.T.se=void 0)}function wt(e,t){for(let n=e.C;n;n=n.G){let e=n.S;if(e===t||e.T?.se?.has(t))return!0}return!1}function Tt(e,t){W(e).fe=!0,t.source&&bt(e,t.source),e.m&2||R(e,t.source,t)}function R(t,n,r){if(!n){t.T!==null&&(t.T.U=null);return}let i=r instanceof e&&r.source===n?r:t.T?.U;W(t).U=i instanceof e&&i.source===n?i:new e(n)}function Et(e,t){for(let n=e.o;n!==null;n=n.t)t(n.u,n)}function Dt(e,t){let n=new p,r=e=>{let i=n.has(e);t(e,i)!==!1&&!i&&(n.add(e),Et(e,r))};Et(e,r)}function Ot(e){e.X&&e.l&32&&!e.o&&!(e.R&32)&&!(e.m&1)&&(e.R&8?e.R|=o:gt(e))}function kt(e){let t;if(Dt(e,(e,n)=>{!n&&!e.o&&e.l&32&&(t??=[]).push(e)}),t)for(let e of t)Ot(e)}function At(e,n,r){return!(e.l&256||r&&e.R&16384&&I.Y&&!e.rr)||w?!1:(Ct(e),e.T&&(e.T.fe=!1),(e.m&=6)&2||R(e),e.ue=n instanceof t?n:new t(e,n),e.l|=2097280,z(e),M(),!0)}function jt(e,t){let n=!1;Dt(e,(e,r)=>{!r&&e.T?.U===t&&(L(e),n=!0)}),n&&M()}function z(e,t=e){xt(e,t);let n=!1,r;if(Dt(e,(i,a)=>{if(a||t!==e&&wt(i,t)||!xt(i,t))return!1;i.ie=j;let o=i.T?.se?.values().next().value,s=i.m&2;o?s||R(i,o):(i.m&=-2,s||R(i),i.l&256&&k(D(i)),i.T?.fe&&(L(i),n=!0),i.T!==null&&(i.T.fe=!1),!i.o&&i.l&32&&(r??=[]).push(i))}),r)for(let e of r)Ot(e);n&&M()}function Mt(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function Nt(e){let t=e.T?.Se;t!=null&&(e.T.Se=null,t())}function Pt(t,n,r,i){let a=!1,o=!1;if(typeof n==`object`&&n&&$t(()=>{a=n[Symbol.asyncIterator],o=!a&&Mt(n)}),!o&&!a)return t.T!==null&&(t.T.Ee=null),t.Ie=!1,n;W(t).Ee=n,t.T.ce=2147483647,t.T.se=void 0;let s,c=r=>{if(t.T?.Ee!==n)return;let a=r instanceof e;a&&t.Ie?(St(t),Tt(t,r),t.ie=j):((a||!At(t,r))&&(Lt(t,a?1:2,r),a||y(t,!1,!0)),a&&z(t),t.ie=j,a||kt(t),i?.(r,a))},l=(e,i)=>{if(t.T?.Ee!==n||t.R&2)return;let a=t.m&4;if(It(t),r){try{r(e)}catch(e){c(e);return}t.l&256||(t.T.Te=null,t.l&=-1025),a&&It(t,!0)}else G(t,()=>e);t.ue===u&&(t.Ie=!1,ft(t)),z(t),M(),et(),i?.()},d=()=>t.l&32&&!t.o&&!(t.m&1)?(gt(t),!0):!1,f=(e,r)=>{let i=e[Symbol.asyncIterator](),a=!1,o=!1,u=!r,f=()=>{if(!o){o=!0;try{let e=i.return?.();Mt(e)&&e.then(void 0,()=>{})}catch{}}};ae(f,r),W(t).Se=f;let p=()=>{try{d()||m()}catch(e){c(e)}},m=()=>{let e,r,f=!1,h=!1,g=!0,_=i.next();if((Mt(_)?_:{then:e=>void e(_)}).then(r=>{if(g&&u)e=r,f=!0,r.done&&(o=!0);else if(t.T?.Ee!==n)return;else r.done?(o=!0,a?(M(),et()):l(void 0),d()):(a=!0,l(r.value,p))},e=>{g&&u?(r=e,h=!0):t.T?.Ee===n&&(o=!0,c(e),d())}),g=!1,h){if(o=!0,c(r),u)throw r;return!0}return f&&!e.done?(s=e.value,a=!0,m()):f&&e.done},h=m();return u=!1,a||h},p=null,m=(e,t)=>{let n=!1;if(typeof e==`object`&&e&&$t(()=>{n=e[Symbol.asyncIterator]}),!n)return!1;s=void 0;let r=f(e,t);return t||(p=r),!0};if(o){let e=!1,r=!1,i,a=!0;if(n.then(r=>{if(a)s=r,e=!0;else{try{if(t.T?.Ee===n&&!(t.R&64)&&m(r,t))return;l(r)}catch(e){c(e)}d()}},e=>{a?(i=e,r=!0):(c(e),d())}),a=!1,r)throw c(i),i;e?m(s)||(t.Ie=!1):p=!1}if(a&&m(n),p!==null){if(!p){if(t.Ie)return t.le;throw new e(V)}t.Ie=!1}return s}function Ft(e,t=!1){e.T?.se&&Ct(e),e.T?.fe&&(e.T.fe=!1),e.m=t?0:e.m&4,e.T?.U&&R(e);let n=Jt(e);n&&n.call(e)}function It(e,t=!1){let n=e.T?.se;n&&(n.delete(e),n.size)?(e.T.fe=!1,t&&(e.m=1),R(e,n.values().next().value)):Ft(e,t)}function Lt(n,r,i){r===2&&!(i instanceof t)&&!(i instanceof e)&&(i=new t(n,i));let a=r===1&&i instanceof e&&i.source;a?(n.m&2&&(n.T.Te=n.T.U),bt(n,a)):Ct(n),n.m=r|(r===2?n.m&12?8:0:r===1&&n.m&8?4:n.m&4),a?R(n,a,i):W(n).U=i;let o=Jt(n);o?o.call(n):Rt(n,r,i)}function Rt(t,n,r){let i=n===1&&r instanceof e&&r.source;Et(t,(e,a)=>{e.ie=j,e.l&16384||n===1&&a.Ne!==e.de?(n!==1&&xt(e,t),L(e),M()):i&&e.T?.se?.has(i)?w===null&&(e.l&2304)==256&&I.Y&&!S?.(e,i.ie===j)&&k(D(e)):(i||n!==1&&(e.T?.U!==r||e.T?.se))&&(Ke(e),n===1&&(e.l&2304)==256&&!e.i&&k(D(e)),Lt(e,n,r),e.rr?.st(n,r))})}N._e=e=>{e.i===3?(at(e,A),e.Ae=!0,I.enqueue(2,e.Z)):e.R&32&&!(e.R&65536)?Oe(e):H(e)},N.Ce=y;let B=!1,V=null;function H(t,n=!1){Je();let r=t.i,i,c=t.l&s;if(!n){if(at(t,A),t.T!==null&&(t.T.Ee=null,Nt(t)),t.l&256){let e=D(t);e.P||t.l&524288||(t.l&8421376?e!==T&&!(t.m&4||t.l&1048576)&&(t.ue!==u&&Ye(t),t.ue=u,t.l&=-257):ge(e,S?.(t,t.m&4)))}if(r===3||t.l&128){let e=mt;ht(i=[]),y(t),ht(e)}else(t.pe!==null||t.ke!==null)&&Wt(t);t.l&2097152&&(t.ue=u,t.l^=s)}let l=t.m&4,d=t.m&2&&t.T?.U,f=!!(t.m&1)&&t.T?.se,p=t.T?.se?.has(t),m=!1,h=!!(t.R&8192)&&!(t.m&1&&t.T!==null&&!t.T.Ve),g=V;V=t,t._=null,t.de++;let _=t.R&o;t.R=4|t.R&8224,t.ie=j;let v=t.ue===u?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,b=t.he,ee=!1,te=!1,ne=B;B=!0;try{if(t.l&64)v=t.X(v),t.T!==null&&(t.T.Ee=null),t.Ie=!1;else{let e=t.T?.Ee,n=t.X(v),r=typeof n==`object`&&!!n,i=t.T?.Ee!==e;v=i||!r?n:Pt(t,n),!i&&!r&&(t.T!==null&&(t.T.Ee=null),t.Ie=!1)}(t.m!==0||t.T!==null)&&Ft(t,n)}catch(n){let r=n instanceof e;if(r&&t.Ie)Tt(t,n);else if((r||!(m=At(t,n,!0)))&&(r&&(W(t).fe=!0),Lt(t,r?1:2,n),r&&p&&!t.T?.Ee&&z(t)),(r||m)&&f)for(let e of f)e!==t&&!(t.T?.se?.has(e)&&(e.m&1||wt(t,e)))&&z(t,e)}finally{if(B=ne,ee=!!(t.R&a),te=!!(t.R&128),t.R=t.R&936032|(n?t.R&256:0),V=g,i)for(let e of i)Ot(e);t.T!==null&&(t.T.Ve=h&&!!(t.m&1))}if(t.R&64){pt(t),St(t);return}let re=!!t.T?.U||m;if(!re){let e=t.ue===u,i=e?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,a=e&&l&&!r||!!t.T?.Te||!!c||!gn(t,i,v);if(r&&a&&!(t.R&262144&&!t.Ae&&Object.is(t.ge,v))&&e&&(t.Ae=!t.T?.U,n||I.enqueue(r,t.W??=N.q.bind(null,t),null)),!re){if(a)(n?!((T!==null||E!==null)&&(te||Ut(g)?.R&128)):r&&t.ue===u)?t.le=v:(t.ue=v,d&&(t.T.Te=d),n&&(ke(t,T??E),t.m|=4,S?.(t,T))),t.o!==null&&Ye(t);else if(t.he!=b)for(let e=t.o;e!==null;e=e.t)it(e.u,A)}if(!a&&!t.T?.U&&(d&&jt(t,d),f))for(let e of f)e!==t&&z(t,e);p&&!(t.m&5)&&z(t)}if(n&&te&&t.m&1){let e=T??E;e&&!e.P&&(r&&S?.(t)===2||ke(t,e))}!t.T?.U&&t.ue===u&&!(r&&t.Ae)&&(n||r===3?ft(t):Ee(t)),(t.ue!==u||t.T!==null&&(t.T.me!==null||t.T.Le!==null)||t.m&5&&(!n||t.m&1))&&(t.l|=128,Ke(t)),ee&&(L(t),M()),_&&Ot(t)}function zt(e){if(!(e.R&68)){if(e.R&1)for(let t=e.C;t;t=t.G){let n=t.S;if(n.X&&zt(n),e.R&2)break}(e.R&2||e.T?.U&&e.ie<j&&!e.T?.Ee)&&H(e),e.R&=937336}}function U(e,t){let n=t?.transparent??!1,r=typeof t==`object`&&!!t&&`loadingValue`in t,i={id:re(t,n,V),l:(n?4:0)|!!t?.ownedWrite|(!V||t?.lazy?32:0)|(t?.sync?64:0)|(t?.ae?2:0)|(t?.xe??0),ye:t?.equals??Qt,ke:null,A:V?.A??d,be:0,X:e,le:r?t.loadingValue:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:V,Ge:null,Me:null,pe:null,R:t?.lazy?512:0,m:r?0:4,ie:j,ue:u,we:-1,Ie:r,T:null};return t?.unobserved&&(W(i).Ye=t.unobserved),Xt(i,t),i}function W(e){return e.T??={Ee:null,Se:null,U:void 0,fe:void 0,se:void 0,Ye:void 0,De:void 0,me:null,Le:null,Re:null,Ve:!1,je:u,Be:-1,ce:0,P:u,I:0,Te:null}}function Bt(e,t){e.R|=128,(t.m&4||e.i!==1)&&ge(D(t),!e.i&&e.m&4||S?.(e))}function Vt(e,t){if(!(!(e.l&1<<23)||t.l&1024)){let n=D(t);if(!(n===T||Ht(e,n)))return Ge(e,n),!0}return Bt(e,t),!1}function Ht(e,t){return(e.m&4||e.l&1048576)&&e.l&256&&D(e)===t}function Ut(e){return e!==null&&e.Qe?e.Ke:e}function Wt(e){m(e);let t=W(e);t.Le=e.ke,t.me=e.pe,e.ke=null,e.pe=null,e.be=0}function Gt(e,t,n,r,i){let a=i?.transparent??!1,o={id:re(i,a,V),l:r<<23|(a?4:0)|!!i?.ownedWrite|(i?.sync?64:0)|(i?.xe??0),ye:!1,ke:null,A:V?.A??d,be:0,X:e,le:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:V,Ge:null,Me:null,pe:null,R:512,m:4,ie:j,ue:u,we:-1,Ie:!1,Ae:!1,ge:void 0,qe:t,Je:n,ze:void 0,i:r,T:null};return i?.unobserved&&(W(o).Ye=i.unobserved),Xt(o,Yt),o}let Kt=null;function qt(e){Kt=e}function Jt(e){return e.i?Kt:null}const Yt={lazy:!0};function Xt(e,t){e.We=e;let n=V?.Qe?V.Ke:V;V&&b(V,e),n&&(e.he=n.he+1),!t?.lazy&&H(e,!0)}function Zt(e,t){let n={ye:t?.equals??Qt,l:+!!t?.ownedWrite|(t?.ae?2:0),le:e,o:null,Ze:null,ie:j,ue:u,we:-1,T:null};return t?.unobserved&&(W(n).Ye=t.unobserved),n}function Qt(e,t){return e===t}function $t(e,t){let n=B;B=!1;try{return e()}finally{B=n}}function en(e,t){if(e.R&512)e.R&=-513,H(e,!0);else if(e.R&64&&e.l&32){let t=e._parent;if(t!==null){if(t.R&64){e.l&=-33;return}e.R&32||b(t,e)}H(e,!0)}}function tn(e,t){return!t||e.ue===u||t.l&16}let nn=!1;function rn(){nn=!0}function an(e){return I.Y||e.ue===u||e.l&4194304?u:e.l&256?e.T.Be===j?e.T.je:u:e.le}function on(e){let t=e.T;t.Be!==j&&(t.je=e.ue,t.Be=j,nn=!0)}const sn=[];function cn(e){return e.R|=a,!0}function ln(){if(nn=!1,sn.length!==0){for(let e of sn)e.l&=-4194305;sn.length=0}}function un(e,t){e.he>=A.Fe?(st(t),ot(A),zt(e)):t.l&65536&&zt(e);let n=e.he;n>=t.he&&e._parent!==t&&(t.he=n+1)}function dn(e){let t=V;t?.Qe&&(t=t.Ke);let n=e,r=e;if(typeof n.X==`function`&&en(e),!n.X&&e.T?.De===void 0&&(!nn||e.ue===u)&&!(e.l&2048))return t&&(B&&yt(e,t),e.l&256&&!(t.l&16)&&Vt(t,e))||!t||e.ue===u||t.l&16||e.ue===e.le&&Object.is(e.ue,e.le)?e.le:(mn(t),e.ue);let i=!1;if(t&&(B&&(yt(e,t),r.X&&un(r,t)),e.l&256&&!(e.l&2048)&&!(t.l&16)&&(r.m&4?Bt(t,e):i=Vt(t,e))),r.m&1&&!i){if(t){if(!(t.l&16)||r.m&4)throw!B&&e!==t&&yt(e,t),r.T?.U}else if(r.m&4)throw r.T?.U}if(r.X&&r.m&2){if(B&&r.ie<j)return H(r),dn(e);throw!i&&e.l&2097152&&pn(e,t),r.T?.U}(i||!t)&&fn(e);let a=pn(e,i?null:t);return!t&&typeof n.X==`function`&&e.l&32&&!(r.m&1)&&!e.o&&(_t.add(e),M()),a}function fn(e){if(e.T?.Te)throw e.T.Te}function pn(t,n){if(t.ue!==u&&t.m&4&&(!n||n.l&16))throw new e(null);let r=n&&nn?an(t):u;if(r!==u)return cn(n),r;if(tn(t,n))return t.le;if(mn(n,t),t.l&2097152)throw t.ue;return t.ue}function mn(e,t){t?.m&4||(e.R|=16384)}function hn(e){I.Y||e.l&4194304||(e.l|=4194304,sn.push(e))}function gn(t,n,r){if(t.ye===Qt)return n===r;try{return t.ye&&t.ye(n,r)}catch(n){if(!(n instanceof e))return Lt(t,2,n),!0}}function G(e,t){let n=e.ue===u?e.le:e.ue;if(typeof t==`function`&&(t=t(n)),e.l&256&&k(D(e)),!(e.m&4||e.T?.Te||!gn(e,n,t)))return t;let r=e.ue!==u;return r?e.l&256&&!I.Y&&on(e):Ke(e),e.ue=t,V!==null&&hn(e),e.X!==void 0&&(e.ie=j),r&&e.we===qe||(Ye(e),M()),t}function _n(e,t){let n=e.l&256&&!(e.R&1024)&&D(e)!==T;if(n&&typeof t==`function`){let n=t(e.le);t=()=>n}return e.m&2&&(e.T.Te=e.T.U,Lt(e,0)),t=G(e,t),e.l&=-2097153,n?(e.R=e.R&-2|2,rt(e,A),M()):e.ue!==u&&(e.R|=1024),t}function K(e,t){let n=V,r=B;V=e,B=!1;try{return t()}finally{V=n,B=r}}function vn(e,t=!0){try{return e()}finally{}}function yn(e,t=x()){let n;if(t&&(n=t.A[e.id]),n===void 0&&(n=e.defaultValue),n===void 0)throw new i;return n}function bn(e,t,n=x()){if(!n)throw new r;n.A={...n.A,[e.id]:t===void 0?e.defaultValue:t}}function xn(e,t,n,r){let i=Gt(e,t,n,r?.user?2:1,r);H(i,!0),r?.defer?Ze(i):i.ue===u&&(i.T?.Re?.P||i.i===2||r?.schedule?I.enqueue(i.i,wn.bind(null,i),i.T?.Re):wn(i,0))}function Sn(){let e=this.m,t=this.T?.U;if(e&2){if(I.notify(this,1,0),this.i===2){this.m&2&&Xe(this);return}Cn(this,n(t))}else this.i===1&&I.notify(this,3,e,t)}function Cn(e,t,n){if(!I.notify(e,2,2))throw Be(t),t}function wn(e,r){if(!e.Ae||e.R&64||r&&fe?.(e))return;if(e.m&2&&e.i===2){let t=n(e.T?.U);e.ge=e.le,e.Ae=!1;try{e.Je?e.Je(t,()=>{let t=e.ze;e.ze=void 0,t?.()}):console.error(t)}catch(t){Cn(e,t)}return}let i=e.T?.U==null,a=e.ze;e.ze=void 0;try{a?.(),e.ze=e.qe(e.le,e.ge)}catch(n){W(e).U=new t(e,n),e.m|=2,Cn(e,n)}finally{e.ge=e.le,e.Ae=!1,i&&ft(e)}}N.q=wn;function Tn(e,t){let n=!1,r,i=()=>{if(!a.Ae||a.R&64||fe?.(a))return;let e=qe;n=!1;try{a.Ae=!1,H(a)}finally{}for(let t=a.C;t!==null;t=t.G){let o=t.S;if(o.ue!==u&&!(o.l&2048)&&(o.ue!==o.le||!Object.is(o.ue,o.le))){if(o.l&256)n||(n=!0,D(o).rn[1].push(r||=()=>{n&&(a.Ae=!0,i())}));else if(o.we<=e||o.X){L(a),M();break}}}},a=U(()=>{let t=a.ze;a.ze=void 0,t?.();let n=vn(e);a.ze=n},{...t,lazy:!0});a.ze=void 0,a.l=a.l&-33|16,a.Ae=!0,a.i=3,a.Z=i,L(a),M()}qt(Sn);const En=/* @__PURE__ */ new WeakSet;function Dn(e){for(let t=e;t;t=t._parent){let e=t[Re];if(e!==void 0)return e}}function On(e){let t=[];for(let n=e;n;n=n._parent){let e=n._name;typeof e==`string`&&e.length&&t.push(e)}return t.length?t.reverse():void 0}function kn(e,t,n){if(e!==null&&(typeof e==`object`||typeof e==`function`)){if(En.has(e))return;En.add(e)}let r=Dn(t);if(r===void 0)return;let i={},a=On(t),o=On(n)??a;o!==void 0&&(i.ownerPath=o),a!==void 0&&(i.boundaryPath=a);try{r(e,i)}catch(e){console.error(e)}}const An=Symbol(0);function q(e){let t=dn.bind(null,e);return t[f]=e,t}function jn(e,t){if(typeof e==`function`){let n=U(e,t);return n.l&=-33,[q(n),_n.bind(null,n)]}let n=Zt(e,t);return[q(n),G.bind(null,n)]}function Mn(e,t){return q(U(e,t))}function Nn(e,t,n){xn(e,t.effect||t,t.error,{user:!0,...n})}function Pn(e,t,n){xn(e,t,void 0,n)}function Fn(e){let t=x();t&&!(t.l&16)?Tn(()=>$t(e),void 0):I.enqueue(2,function t(){if(A.Et>=A.Fe)return I.enqueue(2,t);e()})}function In(e,t,n){let r=typeof n?.keyed==`function`?n.keyed:void 0,i=t.length>1,a=t,o={H:se(),it:0,st:e,ot:[],ft:a,ht:[],ln:[],Xe:r,ct:r||n?.keyed===!1?[]:void 0,lt:i&&n?.keyed!==!1?[]:void 0,ut:n?.keyed===!1,L:n?.fallback},s=U(Un.bind(o),void 0);return s.l&=-33,q(s)}const Ln={ownedWrite:!0};function Rn(e,t,n,r){let i=e.ot,a=e.it-1,o=[],s=[],c=[],l=256,u=r,d=r,f=!1;for(;u<=a&&d<=n-1;){let e=i[u],r=t[d];if(e===r){f||=(c.push(u,d,0),!0),c[c.length-1]++,u++,d++;continue}f=!1;let p=-1,m=Math.min(32-o.length,a-u,l);for(let e=1;e<=m;e++)if(i[u+e]===r){p=e;break}l-=p===-1?m:p;let h=-1;m=Math.min(32-s.length,n-1-d,l);for(let n=1;n<=m;n++)if(t[d+n]===e){h=n;break}if(l-=h===-1?m:h,p!==-1&&(h===-1||p<=h))for(;p-->0;)o.push(u++);else if(h!==-1)for(;h-->0;)s.push(d++);else{if(l<=0||o.length===32||s.length===32)return!1;o.push(u++),s.push(d++)}}for(;u<=a;u++){if(o.length===32)return!1;o.push(u)}for(;d<=n-1;d++){if(s.length===32)return!1;s.push(d)}return zn(e,t,n,o,s,c)}function zn(e,t,n,r,i,a){let o=e.ot,s,c,l;if(i.length!==0)for(l=Array(r.length),c=0;c<i.length;c++){let e=-1;for(s=0;s<r.length;s++)if(!l[s]&&o[r[s]]===t[i[c]]){e=s;break}if(e===-1)return!1;l[e]=!0,i[c]=i[c]<<6|e}if(r.length!==0||i.length!==0){let e=/* @__PURE__ */ new Set;for(s=0;s<r.length;s++)e.add(o[r[s]]);for(c=0;c<i.length;c++)e.add(t[i[c]>>6]);for(let t=0;t<a.length;t+=3){let n=a[t];for(let r=0,i=a[t+2];r<i;r++)if(e.has(o[n+r]))return!1}}let u=e.ht,d=e.ln,f=u.slice(0,n),p=d.slice(0,n);for(let e=0;e<a.length;e+=3){let t=a[e],n=a[e+1];if(t!==n)for(let r=0;r<a[e+2];r++)f[n+r]=u[t+r],p[n+r]=d[t+r]}for(c=0;c<i.length;c++){let e=i[c]>>6,t=r[i[c]&63];f[e]=u[t],p[e]=d[t]}for(e.ht=f,e.ln=p,e.it=n,e.ot=t.slice(0),s=0;s<r.length;s++)l!==void 0&&l[s]||d[r[s]].dispose();return!0}function Bn(e,t,n,r,i,a,o,s,c){let l=e.Xe,u=e.ot,d=e.ln,f=[],p=n;for(let m=n;m<=i;p++,m++){let i=l?l(t[m]):t[m];for(;p<=r&&(l?l(u[p]):u[p])!==i;)f.push(d[p++]);if(p>r)return o.fill(void 0),null;a[m]=e.ht[p],o[m-n]=d[p],s&&(s[m-n]=e.ct[p]),c&&(c[m-n]=e.lt[p])}for(;p<=r;p++)f.push(d[p]);return f}function Vn(e,t,n,r,i,a,o,s,c){let l=e.ln,u=e.ct,d=e.lt,f=e.it,p=n-f,m,h;if(p>0)for(l.length=n,u&&(u.length=n),d&&(d.length=n),m=f-1,h=n-1;m>i;m--,h--)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);else if(p<0){for(m=i+1,h=a+1;m<f;m++,h++)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);l.length=n,u&&(u.length=n),d&&(d.length=n)}for(h=r;h<=a;h++)l[h]=o[h-r],u&&Hn(u[h]=s[h-r],t[h]),d&&G(d[h]=c[h-r],h);for(h=a+1;h<n;h++)u&&Hn(u[h],t[h]),d&&p!==0&&G(d[h],h)}const Hn=(e,t)=>e.le===t&&e.ue===u||G(e,t);function Un(){this.H.Ke=x();let e=this.st()||[];e[An],e=e;let t=e.length;return K(this.H,()=>{let n,r,i,a,o,s=this.ct?this.ut?()=>(a[i]=Zt(e[r],Ln),this.ft(q(a[i]),r)):()=>(a[i]=Zt(e[r],Ln),o&&(o[i]=Zt(r,Ln)),this.ft(q(a[i]),o?q(o[i]):void 0)):this.lt?()=>{let t=e[r];return o[i]=Zt(r,Ln),this.ft(t,q(o[i]))}:()=>{let t=e[r];return this.ft(t)};if(t===0)this.it!==0&&(this.H.dispose(!1),this.ln=[],this.ot=[],this.ht=[],this.it=0,this.ct&&=[],this.lt&&=[]),this.L&&!this.ht.length&&(this.ln[0]?.dispose(),this.ht[0]=K(this.ln[0]=se(),this.L));else if(this.it===0){let c=Array(t),l=Array(t);a=this.ct&&Array(t),o=this.lt&&Array(t);try{for(r=0;r<t;r++)i=r,c[r]=K(l[r]=se(),s)}catch(e){for(n=0;n<=r;n++)l[n]?.dispose();throw e}this.ln[0]&&this.ln[0].dispose(),this.ht=c,this.ln=l,a&&(this.ct=a),o&&(this.lt=o),this.ot=e.slice(0),this.it=t}else{let c,l,u,d,f,p,m,h,g;for(c=0,l=Math.min(this.it,t);c<l&&(this.ot[c]===e[c]||this.ct&&Wn(this.Xe,this.ot[c],e[c]));c++)this.ct&&Hn(this.ct[c],e[c]);for(l=this.it-1,u=t-1;l>=c&&u>=c&&(this.ot[l]===e[u]||this.ct&&Wn(this.Xe,this.ot[l],e[u]));l--,u--);if(c===t&&this.it===t){this.ot=e.slice(0);return}if(t<=this.it&&l-c>64&&this.ct===void 0&&this.lt===void 0){let n=c+(u-c>>1),r=e[n],i=Math.min(l,n+32),a=Math.max(c,n-32);for(;a<=i&&this.ot[a]!==r;)a++;if(a<=i&&Rn(this,e,t,c))return}let _=t-this.it,v=u-c+1,y=Array(t),b=Array(v);a=this.ct?Array(v):void 0,o=this.lt?Array(v):void 0;let ee=_<0?Bn(this,e,c,l,u,y,b,a,o):null;if(ee!==null)ee.length!==0&&(h=ee);else{for(p=/* @__PURE__ */ new Map,m=Array(v),r=u;r>=c;r--)d=e[r],f=this.Xe?this.Xe(d):d,n=p.get(f),m[r-c]=n===void 0?-1:n,p.set(f,r);for(n=c;n<=l;n++)d=this.ot[n],f=this.Xe?this.Xe(d):d,r=p.get(f),r!==void 0&&r!==-1?(y[r]=this.ht[n],b[r-c]=this.ln[n],a&&(a[r-c]=this.ct[n]),o&&(o[r-c]=this.lt[n]),r=m[r-c],p.set(f,r)):(h??=[]).push(this.ln[n]);try{for(r=c;r<=u;r++)b[r-c]===void 0&&((g??=[]).push(b[r-c]=se()),i=r-c,y[r]=K(b[r-c],s))}catch(e){if(g)for(n=0;n<g.length;n++)g[n].dispose();throw e}}for(n=0;n<c;n++)y[n]=this.ht[n];for(r=u+1;r<t;r++)y[r]=this.ht[r-_];if(Vn(this,e,t,c,l,u,b,a,o),this.ht=y,this.it=t,this.ot=e.slice(0),h)for(n=0;n<h.length;n++)h[n].dispose()}}),this.ht}function Wn(e,t,n){return!e||e(t)===e(n)}function Gn(e,t){if(typeof e==`function`&&!e.length){if(t?.doNotUnwrap)return e;do e=e();while(typeof e==`function`&&!e.length)}if(!t?.skipNonRendered||e!=null&&e!==!0&&e!==!1&&e!==``){if(Array.isArray(e)){let n=[];return Kn(e,n,t)?()=>{let e=[];return Kn(n,e,{...t,doNotUnwrap:!1}),e}:n}return e}}function Kn(t,n=[],r){let i=null,a=!1;for(let o=0;o<t.length;o++)try{let e=t[o];if(typeof e==`function`&&!e.length){if(r?.doNotUnwrap){n.push(e),a=!0;continue}do e=e();while(typeof e==`function`&&!e.length)}Array.isArray(e)?a=Kn(e,n,r)||a:r?.skipNonRendered&&(e==null||e===!0||e===!1||e===``)||n.push(e)}catch(t){if(!(t instanceof e))throw t;i=t}if(i)throw i;return a}const qn=Symbol(``),Jn=Symbol(``),J=/* @__PURE__ */ new Set,Yn=e=>e.A[qn],Xn=e=>!!e&&(e.i===2&&e.L||Xn(e._parent)),Y=e=>e.i===2||!e.D||e.h||Xn(e._parent);function X(e,t,n=t){e.F.set(t,n),J.add(e)}function Zn(e,t,r,i=t){if(e.i===2){r??=t.T?.U,i=r?.source??t,i.R&64&&(i=t);let a=n(r);G(e.U,a),kn(a,e.H,i)}else e.D=!1;X(e,t,i),e.h&&Qn(e),e.L||$n(e)}function Qn(e){e.D=!1,e.P=e.B;let t=e.j;!e.P&&t.l&256&&D(t)!==T&&Ne(t)}function $n(e){e.j!==null&&!(e.j.R&96)&&(L(e.j),M())}function er(e,t,n){if(t===0){if(J.size)for(let t=Yn(e);t;t=t._parent)!(t.F.get(e)?.m&(t.i|1))&&t.F.delete(e)&&!sr(t,0)&&t.L&&$n(t);return!1}for(let r=Yn(e);r;r=r._parent)if(!(r.i&t))r.L&&r.i>t&&X(r,e);else{if(Y(r))return Zn(r,e,n),!r.h||2;X(r,e)}return!1}function tr(e){for(let t=Yn(e);t;t=t._parent)if(t.i&1&&Y(t))return t.h}function nr(e,t){for(let t=Yn(e);t;t=t._parent)if(t.L)return t;let n,r=e.o;if(t||e.l&16384)for(t||=/* @__PURE__ */ new Set,n=e.i!=1;r&&(n=t.size==t.add(r.u).size||nr(r.u,t));)r=r.t;return n}function rr(e){let t=nr(e);return t!==void 0&&((t.M??=/* @__PURE__ */ new Set).add(e),!0)}function ir(e){if(e.M!==null){for(let t of e.M){let e=t.i;I.enqueue(e===3?2:e,e===3?t.Z:t.W??=N.q.bind(null,t))}e.M=null}}function ar(e,t,n){if(!(n.m&3||t.m&2)){for(let n=Yn(t);n&&n!==e;n=n._parent)if(n.i&1&&Y(n))return!(n.j.l&256)}return!1}function or(e,t,n){for(let r=e.C,i;r;r=r.G)if((i=r.S)===t||(n||=/* @__PURE__ */ new Set).size<n.add(i).size&&or(i,t,n))return 1}function sr(e,t){let n=e.i|1;for(let[r,i]of e.F){if(!((r.R|i.R)&64)){if((r.m&n||i.m&n&&or(r,i))&&!(n&2&&ar(e,r,i))||n&2&&i.l&2097152||r.l&32768&&r.R&8){if(t===0)break;continue}if((i!==e.K||e.h)&&(i.l&2304)==256){if(!t||!e.D)continue;k(D(i))}}e.F.delete(r)}return e.F.size}function cr(){for(let e of J){let t=e.j.R;if(t&64){J.delete(e);continue}if(t&32)continue;if(!e.D){for(let[t]of e.F)for(let n of t.m&1?t.T?.se||[]:[t])if(!(n.l&256))for(let r=n.C;r;r=r.G){let i=r.S;i.l&256&&(n===t||!D(i).tt)&&X(e,i)}}sr(e);let n=e.j;e.i&1&&!e.D&&n.l&256&&[...e.F].every(([,e])=>!(e.m&1)&&e.l&256&&D(e)===D(n))&&(e.F.clear(),e.D=!0),e.h=!1,e.F.size===0&&(J.delete(e),e.L&&$n(e))}}function lr(e){if(!e.D){e.L&&e.P===null&&e.B===null&&w!==null&&(e.B=w,Qn(e),$n(e));return}e.h=!0,e.j.l&=-8388609;let t=w;t===null&&I.Y&&x().l&32768&&(k(null),t=N.J(T)),e.B=t,J.add(e);let n=e.F.size;Me(e.H,T,t=>X(e,t));for(let[t]of e.F)if(e.F.size!==n||t.m&1&&!(t.R&64)){for(let t=e._parent;t!==null;t=t._parent)if(t.i&1)for(let[n]of e.F)t.F.delete(n);Qn(e),$n(e);return}}function ur(t,n,r,i){let a=se(),o={i:t,_parent:Yn(a)??null,H:a,K:null,j:null,F:/* @__PURE__ */ new Map,D:t===2,h:!1,B:null,P:null,L:!1,M:null,v:null,$:!1,ee:!1,U:t===2?Zt(void 0,fr):null,ne:r,re:null};if(t===1&&a.A[Jn],x()&&ae(()=>{J.delete(o)}),i){let t=!1;K(a,()=>U(()=>{try{i()}catch(t){if(!(t instanceof e)){if(!I.notify(x(),2,2,t))throw Be(t),t;return}}t?lr(o):t=!0})).l|=c}a.A={...a.A,[qn]:o};let s=K(a,()=>{let e=U(n);return U(()=>Gn(dn(e)))});o.K=s;let u=U(()=>{let n=x();if(!o.h&&!(n.l&256)&&(n.l|=l),o.$&&(yt(s,n),o.$)){if(o.ee){o.L=!0;return}return dr(o)}let r=s.m&3;if(r!==0){if(yt(s,n),r&t){if(Y(o))return Zn(o,s,void 0),dr(o);X(o,s)}throw s.T.U}if(Y(o)&&(o.F.size!==0&&n.m&4&&!(n.l&256)||sr(o,!0)!==0))return dr(o);let i;try{i=dn(s)}catch(n){if(n instanceof e?t===1:t===2){if(Y(o))return Zn(o,s,n),dr(o);X(o,s)}throw n}if(Y(o)&&o.F.size!==0)return dr(o);o.D=!0,o.L=!1;let a=o.re,c=()=>{!o.L&&o.re===a&&(a.m&2&&M(),h(a),o.re=null)};return a!==null&&(o.j.le===a.le?I.enqueue(1,c):c()),ir(o),i},{ae:!0});return u.l|=c,s.l|=l,o.j=u,q(u)}function dr(e){let t=x();e.P!==null&&(he(e.P),t.R|=131072,e.P=null),e.L=!0,e.re===null&&(e.re=K(t._parent,()=>U(()=>e.ne(e),{id:t.id,lazy:1})));let n=w,r=t.R,i=dn(e.re);return he(n),t.R^=(t.R^r)&163840,i}const fr={ownedWrite:!0,ae:!0};function pr(e,t,n){return ur(1,e,()=>t(),n?.on)}pe(er,(e,t)=>!t&&(e.m&4?er(e,1):tr(e)),nr,cr,rr);function mr(e,t){let n=Symbol(t&&t.name||``);function r(e){return ce(()=>(bn(r,e.value),gr(()=>e.children)))}return r.id=n,r.defaultValue=e,r}function hr(e){return yn(e)}function gr(e){let t=Mn(e,{lazy:!0}),n=Mn(()=>Gn(t()),{lazy:!0,sync:!0});return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}const _r={hydrating:!1,registry:void 0,done:!1},vr=(...e)=>Mn(...e),yr=(...e)=>jn(...e),br=(...e)=>ce(...e),xr=(...e)=>Pn(...e),Sr=(...e)=>Nn(...e),Cr=(e,t,n)=>pr(e,t,n);function wr(e,t,n,r){return $t(()=>e(t||{}))}function Tr(e){let t=`fallback`in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed},n=x(),r,i=()=>K(n,()=>In(()=>e.each,e.children,t));return _r.hydrating&&(r=i()),()=>(r??=i())()}function Er(e){let t=`on`in e?{on:()=>e.on}:void 0;return Cr(()=>e.children,()=>e.fallback,t)}const Dr=_r,Z=/*#__PURE__*/ Symbol(`slot`),Or=/*#__PURE__*/ Symbol(`host`),kr={transparent:!0,sync:!0};function Ar(e,t,n){let r=n?{sync:!0,...n,transparent:!n.scope}:kr;xr(e,t,r)}function jr(e,t,n,r){let i=e.moveBefore&&e.isConnected&&document.activeElement;i===document.body&&(i=null);let a=r||e,o=(t,n)=>{i&&t.isConnected&&t.contains(i)?e.moveBefore(t,n):e.insertBefore(t,n),(r||t[Z])&&(t[Z]=a)};if(!t.length){for(let e of n)o(e,r);return}let s=t=>{if(!t)return!1;let n=t[Z];return t.parentNode===e&&(!n||n===a)},c=n.length,l=t.length,u=c,d=0,f=0,p=t[l-1],m=s(p)?p.nextSibling:r||null,h=null,g,_;for(;d<l||f<u;)if(t[d]===n[f])d++,f++;else{for(;l>d&&u>f&&t[l-1]===n[u-1];)l--,u--;if(l===d){let e=u;for(;e<c&&!s(n[e]);)e++;let t=e<c?n[e]:m;for(;f<u;)o(n[f++],t)}else if(u===f)for(;d<l;){let e=t[d++];h&&h.has(e)||!s(e)||e.remove()}else if((g=t[d])===n[u-1]&&n[f]===t[l-1]&&g.parentNode===e&&(!(_=g[Z])||_===a))do if(o(t[--l],g),f++,d>=l-1||f>=u)break;while(t[d]===n[u-1]&&n[f]===t[l-1]);else{if(!s(t[d])){d++;continue}if(!h){h=/* @__PURE__ */ new Map;let e=f;for(;e<u;)h.set(n[e],e++)}let c=h.get(t[d]);if(c!=null){if(f<c&&c<u){let s=d,p=1,m;for(;++s<l&&s<u&&(m=h.get(t[s]))!=null&&m===c+p;)p++;if(p>c-f){let e=t[d];for(;f<c;)o(n[f++],e)}else{let s=n[f++],c=t[d++];i&&e.contains(i)?o(s,c):e.replaceChild(s,c),(r||s[Z])&&(s[Z]=a)}}else d++}else t[d++].remove()}}}const Mr=`_$SOLID_EVENT_OWNER`,Nr={},Pr=/* @__PURE__ */ new Set,Fr=/* @__PURE__ */ new Map;function Ir(e,t,n,r={}){let i;Br(t);try{br(a=>{i=a,r.onError&&(x()[Re]=r.onError);let o=e();t===document?Ar(()=>Gn(o),()=>{}):Q(t,()=>o,t.firstChild?null:void 0,n,{...r.insertOptions,schedule:!0})},{id:r.renderId}),et()}catch(e){throw i&&i(),Vr(t),e}return()=>{i(),Vr(t),t.textContent=``}}function Lr(e,t,n){let r=document.createElement(`template`);r.innerHTML=e;let i=r.content.firstChild;return n===2?i.firstChild:i}function Rr(e,t){let n;return t===1?r=>document.importNode(n||=Lr(e,r,t),!0):r=>(n||=Lr(e,r,t)).cloneNode(!0)}function zr(e){for(let t of e)Pr.has(t)||(Pr.add(t),Fr.forEach((e,n)=>Wr(t,n,e)))}function Br(e){let t=Hr(e,e);t&&(t.roots=(t.roots||0)+1)}function Vr(e){let t=Fr.get(e);t&&(t.roots>1?t.roots--:delete t.roots),Ur(e,e)}function Hr(e,t=e){if(!e||!t)return;let n=Fr.get(e);return n||Fr.set(e,n={owners:/* @__PURE__ */ new Map,handlers:/* @__PURE__ */ new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),Pr.forEach(t=>Wr(t,e,n)),n}function Ur(e,t=e){let n=Fr.get(e);if(!n)return;let r=n.owners.get(t);r>1?n.owners.set(t,r-1):n.owners.delete(t),n.owners.size||(n.handlers.forEach((t,n)=>e.removeEventListener(n,t)),Fr.delete(e))}function Wr(e,t,n){if(n.handlers.has(e))return;let r=e=>$r(e,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}const Gr=e=>e._$host||e.parentNode||e.host;function Kr(e,t){let n=e,r=0;for(;n;){if(t.owners.has(n))return{owner:n,distance:r};r++,n=Gr(n)}}function qr(e,t,n){if(Zr(e))return;let r=t===`multiple`&&e.localName===`select`;if(n==null||n===!1)e.removeAttribute(t);else if(e.setAttribute(t,n===!0?``:n),r&&!e._$multiple){let t=e.options;for(let e=0;e<t.length;e++)t[e].defaultSelected&&(t[e].selected=!0)}r&&(e._$multiple=!0)}function Jr(e,t){Array.isArray(e)?e.flat(1/0).forEach(e=>e&&e(t)):e(t)}function Yr(e,t){let n=$t(e);K(null,()=>Jr(n,t))}const Xr={scope:!0};function Q(e,t,n,r,i){let a=n!==void 0,o=i&&i.host;if(a&&!r&&(r=[]),typeof t!=`function`&&(t=ti(t,r,a,!0),typeof t!=`function`)){ei(e,t,r,n),o&&ni(t,o);return}if(a&&r.length===0){let t=document.createTextNode(``);e.insertBefore(t,n),r=[t]}let s=r,c=!1;Ar(()=>{let r=ti(t(),s,a,!0),l=c;return c=!0,typeof r==`function`?(Ar(()=>ti(r,s,a),t=>{s=ei(e,t,s,n),o&&ni(s,o)},l&&!(i&&i.schedule)?{...i,schedule:!0}:i),Nr):r},t=>{t!==Nr&&(s=ei(e,t,s,n),o&&ni(s,o))},t.$s?i?{...i,scope:!0}:Xr:i)}function Zr(e){return!Dr.hydrating||Dr.isClaiming&&!Dr.isClaiming()?!1:!e||e.isConnected?!0:Qr!==null&&Qr.claimed(e)}let Qr=null;function $r(e,t,n){let r=e[Mr],i;if(r){if(r===!0||r===t||!t.contains(r))return;i=r}let a=n.owners.size===1&&n.owners.has(t)?t:Kr(e.target,n)?.owner;if(!a||a===i)return;e[Mr]=a;let o=i||e.target,s=`_$$`+e.type,c=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),l=()=>{let t=o[s];if(t&&!o.disabled){let n=o[`${s}Data`];if(n===void 0?typeof t==`function`?t.call(o,e):t.handleEvent(e):t.call(o,n,e),e.cancelBubble)return}return o.host&&typeof o.host!=`string`&&!o.host._$host&&o.contains(e.target)&&c(o.host),!0},u=()=>o===a||o.parentNode===a,d=()=>{for(;o&&l()&&!u();)o=Gr(o)};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return o||a}}),i)i===e.target&&(o=Gr(i)),o&&o!==a&&d();else if(e.composedPath){let t=e.composedPath();if(t.length){c(t[0]);for(let e=0;e<t.length&&(o=t[e],l());e++){if(o._$host){o=o._$host,d();break}if(u())break}}else d()}else d();delete e.target,delete e.currentTarget}function ei(e,t,n,r){if(t===n)return t;let i=typeof t,a=r!==void 0;if(i===`string`||i===`number`){let r=typeof n;r===`string`||r===`number`?e.firstChild.data=t:ri(e,n)?e.textContent=t:(ii(e,n),e.insertBefore(document.createTextNode(t),e.firstChild))}else if(t===void 0)ai(e,n,r);else if(t.nodeType)Array.isArray(n)?ai(e,n,a?r:null,t):n!=null&&n.nodeType?n.parentNode===e?e.replaceChild(t,n):e.appendChild(t):n!=null&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t),(r||t[Z])&&(t[Z]=r||e);else if(Array.isArray(t)){let i=Array.isArray(n);for(let e=0,r=t.length;e<r;e++){let r=t[e],a=typeof r;if(a===`string`||a===`number`){let a=i?n[e]:void 0;a&&a.nodeType===3?(a.data!==``+r&&(a.data=r),t[e]=a):t[e]=document.createTextNode(r)}}t.length===0?ai(e,n,r):i?jr(e,n,t,r):(n!=null&&ai(e,n),jr(e,[],t))}return t}function ti(e,t,n,r){return e=Gn(e,{skipNonRendered:!0,doNotUnwrap:r}),r&&typeof e==`function`||n&&!Array.isArray(e)&&(e=[e??``]),e}function ni(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)ni(e[n],t);else e&&e.nodeType&&e[Or]!==t&&(e[Or]=t,Object.defineProperty(e,"_$host",{get:t,configurable:!0}))}function ri(e,t){if(t==null)return!0;if(Array.isArray(t))return t.length?e.firstChild===t[0]&&e.lastChild===t[t.length-1]:e.firstChild===null;if(t===``)return e.firstChild===null;if(t.nodeType)return e.firstChild===t&&e.lastChild===t;let n=e.firstChild;return n!==null&&n.nodeType===3&&e.lastChild===n}function ii(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];r.parentNode===e&&r.remove()}else if(t.nodeType)t.parentNode===e&&t.remove();else{let t=e.firstChild;t&&t.nodeType===3&&t.remove()}}function ai(e,t,n,r){if(n===void 0)return ri(e,t)?e.textContent=``:ii(e,t);if(t.length){let i=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(r!==o){let t=o[Z],s=o.parentNode===e&&(!t||t===(n||e));r&&!i&&!a?s?e.replaceChild(r,o):e.insertBefore(r,n):s&&o.remove()}else i=!0}}else r&&e.insertBefore(r,n);r&&(n||r[Z])&&(r[Z]=n||e)}const oi=mr(),si=()=>hr(oi);function ci(e){return(t,n,r)=>Ir(()=>{let t=e=>{let[t,n]=yr({v:e()});return Fn(()=>e.on(e=>n({v:e}))),()=>t().v},i=t(r.events),a=t(r.theme),o=t(r.listeners),s=t(r.forms),c=t(r.unread),l={page:r.page,events:i,last:e=>i().findLast(t=>t.type===e),append:r.append,theme:a,listeners:o,forms:s,unread:c,markdown:r.markdown,message:r.message,toast:r.toast};return wr(oi,{value:l,get children(){return wr(e,n)}})},t)}const li=[`border-bottom-width`,`border-left-width`,`border-right-width`,`border-top-width`,`box-sizing`,`font-family`,`font-size`,`font-style`,`font-weight`,`letter-spacing`,`line-height`,`padding-bottom`,`padding-left`,`padding-right`,`padding-top`,`tab-size`,`text-indent`,`text-rendering`,`text-transform`,`width`,`word-break`],ui={"min-height":`0`,"max-height":`none`,"min-width":`0`,"max-width":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`};function di(e){let t=getComputedStyle(e),n={};for(let e of li)n[e]=t.getPropertyValue(e);return n[`box-sizing`]?{style:n,padding:parseFloat(n[`padding-bottom`])+parseFloat(n[`padding-top`]),border:parseFloat(n[`border-bottom-width`])+parseFloat(n[`border-top-width`])}:null}let $=null;function fi(e,t,n,r){$||($=document.createElement(`textarea`),$.setAttribute(`tabindex`,`-1`),$.setAttribute(`aria-hidden`,`true`)),$.isConnected||document.body.append($);for(let[t,n]of Object.entries(e.style))$.style.setProperty(t,n);for(let[e,t]of Object.entries(ui))$.style.setProperty(e,t,`important`);let i=e.style[`box-sizing`]===`border-box`,a=t=>i?t+e.padding+e.border:t;$.value=t;let o=i?$.scrollHeight+e.border:$.scrollHeight-e.padding;$.value=`x`;let s=$.scrollHeight-e.padding,c=a(s*r);return{height:Math.min(c,Math.max(a(s*n),o)),full:o>=c}}function pi(e={}){let t,n=0,r=()=>{if(!t)return;let r=di(t);if(!r)return;let{height:i,full:a}=fi(r,t.value||t.placeholder||`x`,e.minRows??1,e.maxRows??1/0);t.style.setProperty(`overflow-y`,a?`auto`:`hidden`,`important`),i!==n&&(n=i,t.style.setProperty(`height`,`${i}px`,`important`))};return Fn(()=>{let e=t;if(!e)return;r(),e.addEventListener(`input`,r);let n=new ResizeObserver(()=>r());return n.observe(e),()=>{e.removeEventListener(`input`,r),n.disconnect()}}),e=>{t=e}}var mi=/* @__PURE__ */ Rr(`<div class=wp-chat><div class=wp-chat-new><textarea rows=1></textarea><button type=button>`),hi=/* @__PURE__ */ Rr(`<div class=wp-chat-message><span class=wp-chat-who>`),gi=/* @__PURE__ */ Rr(`<div class=wp-chat-bubble data-md>`),_i=/* @__PURE__ */ Rr(`<div class=wp-chat-bubble>`);const vi=`chat:message`;function yi(e,t){let n=new Set(t);return Object.entries(e.data).filter(([e,t])=>!n.has(e)&&typeof t==`string`&&t.trim()).map(([,e])=>String(e).trim()).join(`
1
+ var e=class extends Error{constructor(e){let t=Error,n=t.stackTraceLimit;n!==void 0&&(t.stackTraceLimit=0),super(),n!==void 0&&(t.stackTraceLimit=n),this.source=e}},t=class extends Error{constructor(e,t){try{var n=String(t instanceof Error?t.message:t)}catch{}super(n,{cause:t}),this.source=e}};function n(e){return e instanceof t?e.cause:e}var r=class extends Error{constructor(){super(``)}},i=class extends Error{constructor(){super(``)}};const a=4096,o=1<<22,s=1<<21,c=16384,l=1<<23,u={},d={},f=Symbol(`refresh`),p=Set;function m(e){let t=e.pe;for(;t;)t.R|=32,m(t),t=t.Ge}function h(e){e.l&=-33,_t(e)}let g;function _(e){try{e()}catch(e){g||=[e],j()}}function v(e){let t=g;if(g=void 0,t&&!e)throw t[0]}function y(e,t=!1,n){let r=e.R;if(r&64)return;t&&(n||e.T===null||e.T.me===null&&e.T.Le===null||y(e,!1,!0),e.R=r|64,e.X&&(Ct(e),(e.m&1&&e.T?.Re!=null||r&2048||P.length)&&j()));let i=n?e.T.me:e.pe;for(n?e.T.me=null:e.pe=null;i;){let e=i;e.l&=-33,ot(e,k),mt(e),i.Me=i,y(i,!0),i=i.Ge}if(n||(e.be=0),t&&!n&&!(r&32)&&e._parent!==null&&!(e._parent.R&64)){let t=e.Me,n=e.Ge;t===null?e._parent.pe=n:t.Ge=n,n!==null&&(n.Me=t),e.Me=null}if(ee(e,n),t&&e.ze){let t=e.ze;e.ze=void 0,_(t)}}function b(e,t){let n=e.pe;t.Me=null,t.Ge=n,n!==null&&(n.Me=t),e.pe=t}function ee(e,t){let n=t?e.T.Le:e.ke;if(n){if(t?e.T.Le=null:e.ke=null,Array.isArray(n))for(let e=n.length-1;e>=0;e--)_(n[e]);else _(n)}}function te(e,t){let n=e;for(;n.l&4&&n._parent;)n=n._parent;if(n.id!=null)return ie(n.id,t?n.be++:n.be);throw Error()}function ne(e){return te(e,!0)}function re(e,t,n){return e?.id??(t?n?.id:n?.id==null?void 0:ne(n))}function ie(e,t){let n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):``)+n}function x(){return B}function ae(e,t=B){return t&&(t.ke?Array.isArray(t.ke)?t.ke.push(e):t.ke=[t.ke,e]:t.ke=e),e}function oe(e=!0){y(this,e),g&&!F.Y&&v()}function se(e){let t=B,n=e?.transparent??!1,r={id:re(e,n,t),l:n?4:0,R:0,Qe:!0,Ke:t?.Qe?t.Ke:t,pe:null,Ge:null,Me:null,ke:null,A:t?.A||d,be:0,T:null,_parent:t,dispose:oe};return t&&b(t,r),r}function ce(e,t){let n=se(t);return G(n,()=>e(oe.bind(n,!0)))}let le=null,ue=null,de=null,fe=null,pe=null;function me(e,t,n,r,i){le=e,ue=t,de=n,fe=r,pe=i}const S=[];function he(e,t=null){let n={ln:[],rn:[[],[]],fn:[],eo:null,_parent:t,P:e,Pe:null,tt:0,nt:!1,nn:null,Ue:!1,un:!1,I:null};return e||S.push(n),n}let C=null;function ge(e){C=e}let w=null,T=null;function _e(e,t){if(F.Y&&!t||w!==null)return O(e);T===null?T=D(e):ye(D(e),T),j()}function E(e){return e.T.Re=D(e.T.Re)}function ve(e){return e=D(e),S.indexOf(e)===-1?null:e}function D(e){for(;e.eo!==null;)e=e.eo;return e}function O(e){let t=w;t===null?w=e===null?he(!1):D(e):e!==null&&ye(D(e),t),F.Y||j()}function ye(e,t){e=D(e),t=D(t),e===t||e.P||t.P||(e.eo=t,t.tt+=e.tt,t.nt||=e.nt,N(t.ln,e.ln),N(t.rn[0],e.rn[0]),N(t.rn[1],e.rn[1]),N(t.fn,e.fn),e.I!==null&&N(t.I??=[],e.I),S.splice(S.indexOf(e),1))}function be(e){let t=xe;xe??=e;let n=e.tt!==0||Ce(e.ln,e)||!1;return xe=t,n}let xe=null;function Se(e,t){let n=e.T?.se;if(n===void 0)return!0;for(let e of n){let n=e.T?.Re;if(n==null||D(n)===t)return!0}return!1}function Ce(e,t,n=!1){for(let r=0;r<e.length;r++){let i=e[r];if(!(!(i.m&1)||i.R&64||i.l&8192||i.T.Re!==null&&E(i)!==t||n&&!Se(i,t))){if(i.i===1){if(we(i,xe??t))return!0}else for(let e=i.o;e!==null;e=e.t){let n=e.u;if((n.i===1&&n.m&1||n.R&2048||n.l&16384&&n.m===1)&&(e.Ne===n.de||n.T?.U!=null)&&!(n.R&64)&&we(n,xe??t))return!0}}}return!1}function we(e,t){return!(e.R&32&&Te(e,t))&&!de?.(e)}function Te(e,t){let n=e;for(;n?.R&32;)n=n._parent;return n?.l&256&&n.T?.Re!=null&&E(n)===D(t)}const Ee=[];function De(e){Ee.push(e)}const Oe=[];function ke(e){ot(e,k),e.R&=-4,Oe.push(e)}function Ae(e,t){e.l|=256,je(e,t)}function je(e,t){let n=U(e);n.Re!==t&&(n.Re=t,t.ln.push(e))}function Me(e,t){for(let n=e.pe;n!==null;n=n.Ge)n.T?.Re?.P||(n.X!==void 0&&(n.l&256||Ae(n,t),n.l|=1048576),Me(n,t))}function Ne(e,t,n){for(let r=e.pe;r!==null;r=r.Ge)(r.l&2304)==256&&E(r)!==t&&n(r),Ne(r,t,n)}function Pe(e){e.T.Re=null,e.l&=-257}const k={et:Array(2e3).fill(void 0),p:!1,Fe:0,Et:0};let A=0,Fe=!1,Ie=!1,Le=!1,Re=0;function j(){Ie?He():Fe||(Fe=!0,!Re&&!F.Y&&queueMicrotask(tt))}const ze=Symbol.for(`solid-js/root-error-hook`),Be=`[REACTIVITY_HALTED]`;function Ve(e){if(Ie)return;Ie=!0,v(!0);let t=Be,n=e!==void 0&&globalThis.reportError;n||e===void 0?console.error(t):console.error(t,e),n&&n(e)}function He(){Le||(Le=!0,console.error(Be))}var M=class e{rn=[[],[]];Y=!1;flush(){if(!this.Y){this.Y=!0,un(),C=null,T=null;try{yt(),lt(k,e._e),this.settle(),A++,Fe=k.Et>=k.Fe||P.length!==0,this.run(1),this.run(2)}finally{this.Y=!1,T=null}}}settle(){let e=w;w=null;let t=e!==null&&!e.P?D(e):null;if(t!==null){let e=P.length;for(let n=0;n<e;n++){let e=P[n];if(!(e.l&2304)&&(e.T===null||e.T.Re===null||!e.T.Re.P)){if(e.ue===u&&e.m&4&&e.i!==1)continue;if(e.ue!==u&&!(e.m&5)&&e.T?.me==null&&e.T?.Le==null&&_n(e,e.le,e.ue)){e.ue=u,e.l&=-129;continue}Ae(e,t)}e.l&128&&Me(e,t)}P.length=0,Oe.splice(0)}else{et();for(let e=0;e<Ee.length;e++){let t=Ee[e];t.T?.U==null&&!t.Ae&&pt(t)}}Ee.length&&=0;let n=this.rn;this.rn=[[],[]];for(let e=S.length-1;e>=0;e--){let t=S[e];be(t)||(S.splice(e,1),We(t),e=S.length)}let r=t&&ve(t),i=r!==null;for(let e=0;e<2;e++)i&&N(r.rn[e],n[e]),this.rn[e]=i||this.rn[e].length?[].concat(i?[]:n[e],this.rn[e]):n[e];if(Oe.length!==0){let e=Oe.splice(0).sort((e,t)=>e.he-t.he);for(let t=0;t<e.length;t++)e[t].R&64||V(e[t])}fe?.()}run(e){let t=this.rn[e-1];t.length&&(this.rn[e-1]=[],nt(t,e))}enqueue(e,t,n=C){e&&(n?.P?n:this).rn[e-1].push(t),j()}notify(e,t,n,r){return le?.(e,n&t,r)?!0:t&1?(n&1&&C===null&&O(null),!0):!1}};function Ue(e){let t;for(let n=0;n<e.fn.length;n++){let r=e.fn[n],i=r.T?.U?.source;if(!(r.R&64||r.m&2&&(r.i||!(r.l&8388608))&&i!==r&&(i?.m??2)&2)&&r.R&2048){t||=r.i||i===r||r.l&256,e.P||(r.R&=-2049),r.Ae=!1;for(let e=r.pe;e!==null;e=e.Ge)e.i&&(e.Ae=!1);I(r)}}return e.fn.length=0,t}function We(e){let t=Ue(e);for(let t=0;t<e.ln.length;t++){let n=e.ln[t];n.T.Re!==null&&E(n)===e&&(n.T.Re=null,$e(n))}w===e&&(w=null),t?F.rn[1].push(()=>Ge(e)):Ge(e)}function Ge(e){for(let t=0;t<2;t++)N(F.rn[t],e.rn[t]),e.rn[t]=[]}function N(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}const P=[];function Ke(e,t){e.R&2048||(e.R|=2048,t.fn.push(e))}function qe(e){P.push(e),F.Y||an()}let Je=0;function Ye(){Je++}function Xe(e){e.we=Je;let t=!!(e.l&512)&&e.T?.De!==void 0;for(let n=e.o;n!==null;n=n.t){let e=n.u;e.R&4&&n.Ne===e.de&&n!==e._&&(e.R|=a),t&&e.l&8?e.R|=256:I(e)}}function Ze(e){e.Ae=!0,F.enqueue(e.i,e.W??=M.q.bind(null,e))}function Qe(e){return e.ue!==u&&(e.le=e.ue,e.ue=u)}function $e(e){let t=e;if(!t.X){e.l&=-385,Qe(e);return}let n=e.ue===u&&!!(t.m&1),r=e.l&s;if(!n&&t.T&&(t.T.Te=null),e.l=n?e.l&-1048833|1024:e.l&-3147137,r){let n=e.ue;e.ue=u,e.ie=A+1,Rt(t,2,n)}else Qe(e)&&(t.m&=-5,t.T!=null&&(t.T.Ve=!1,t.T.je=u),e.i&&e.i!==3&&Ze(e));t.Ie=!1,t.R&=-1025,t.T?.U??pt(t),t.m&1||(t.m&=-5),n||t.T==null||t.T.me===null&&t.T.Le===null||M.Ce(t,!1,!0)}function et(){for(let e=0;e<P.length;e++){let t=P[e];t.l&2304||$e(t)}P.length=0}const F=new M;function tt(e){if(e){Re++;try{return e()}finally{try{tt()}finally{Re--}}}if(!F.Y&&!Ie){for(;Fe;)F.flush();v()}}function nt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function I(e){k.Fe>e.he&&(k.Fe=e.he),it(e,k)}function rt(e,t){let n=(e._parent?.Qe?e._parent.Ke?.he:e._parent?.he)??-1;n>=e.he&&(e.he=n+1);let r=e.he,i=t.et[r];if(i===void 0)t.et[r]=e;else{let t=i.We;t.ve=e,e.We=t,i.We=e}r>t.Et&&(t.Et=r)}function it(e,t){let n=e.R;n&12||(n&1?e.R=n&-4|10:(e.R=n|8,t.p&&ct(e)),n&16||rt(e,t))}function at(e,t){let n=e.R;n&28||(e.R=n|16,rt(e,t))}function ot(e,t){let n=e.R;if(!(n&24))return;e.R=n&-25;let r=e.he;if(e.We===e)t.et[r]=void 0;else{let n=e.ve,i=t.et[r],a=n??i;e===i?t.et[r]=n:e.We.ve=n,a.We=e.We}e.We=e,e.ve=void 0}function st(e){if(!e.p){e.p=!0;for(let t=0;t<=e.Et;t++)for(let n=e.et[t];n!==void 0;n=n.ve)n.R&8&&ct(n)}}function ct(e,t=2){let n=e.R;if(!((n&3)>=t)){e.R=n&-4|t;for(let t=e.o;t!==null;t=t.t)ct(t.u,1)}}function lt(e,t){for(e.p=!1,e.Fe=0;e.Fe<=e.Et;e.Fe++){let n=e.et[e.Fe];for(;n!==void 0;)n.R&8?t(n):ut(n,e),n=e.et[e.Fe]}e.Et=0}function ut(e,t){ot(e,t);let n=e.he;for(let t=e.C;t;t=t.G){let e=t.S;e.X&&e.he>=n&&(n=e.he+1)}if(e.he!==n){e.he=n;for(let n=e.o;n!==null;n=n.t)at(n.u,t)}}let dt;function ft(e){let t=e.S,n=e.G,r=e.t,i=e.en;if(r===null?t.Ze=i:r.en=i,i!==null)i.t=r;else if(t.o=r,r===null){t.l&4096?dt(t):t.T?.Ye&&_(t.T.Ye);let e=t;e.X&&e.l&32&&!(e.R&32)&&!(e.m&1)&&(ht?ht.push(e):_t(e))}return n}function pt(e){let t=e._,n=t===null?e.C:t.G;if(n!==null){do n=ft(n);while(n!==null);t===null?e.C=null:t.G=null}}function mt(e){e.C&&(e._=null,pt(e))}let ht=null;const gt=e=>ht=e;function _t(e){ot(e,k),mt(e),y(e,!0)}const vt=new p;function yt(){if(vt.size!==0){for(let e of vt)!e.o&&e.l&32&&!(e.m&1)&&!(e.R&96)&&_t(e);vt.clear()}}function bt(e,t){let n=t._;if(n!==null&&n.S===e)return;let r=null,i=t.R&4;if(i&&(r=n===null?t.C:n.G,r!==null&&r.S===e)){r.Ne=t.de,t._=r;return}let a=e.Ze;if(a!==null&&a.u===t&&(!i||a.Ne===t.de))return;let o=t._=e.Ze={S:e,u:t,G:r,en:a,t:null,Ne:t.de};n===null?t.C=o:n.G=o,a===null?e.o=o:a.t=o,Ye()}function xt(e,t){return!e.T?.se?.has(t)&&((U(e).se??=new p).add(t),!0)}function St(e,t){let n=e.T?.se;return n?.delete(t)?(n.size||(e.T.se=void 0),!0):!1}function Ct(e){e.T!==null&&(e.T.Ee=null)}function wt(e){e.T!==null&&(e.T.se=void 0)}function Tt(e,t){for(let n=e.C;n;n=n.G){let e=n.S;if(e===t||e.T?.se?.has(t))return!0}return!1}function Et(e,t){U(e).fe=!0,t.source&&xt(e,t.source),e.m&2||L(e,t.source,t)}function L(t,n,r){if(!n){t.T!==null&&(t.T.U=null);return}let i=r instanceof e&&r.source===n?r:t.T?.U;U(t).U=i instanceof e&&i.source===n?i:new e(n)}function Dt(e,t){for(let n=e.o;n!==null;n=n.t)t(n.u,n)}function Ot(e,t){let n=new p,r=e=>{let i=n.has(e);t(e,i)!==!1&&!i&&(n.add(e),Dt(e,r))};Dt(e,r)}function kt(e){e.X&&e.l&32&&!e.o&&!(e.R&32)&&!(e.m&1)&&(e.R&8?e.R|=o:_t(e))}function At(e){let t;if(Ot(e,(e,n)=>{!n&&!e.o&&e.l&32&&(t??=[]).push(e)}),t)for(let e of t)kt(e)}function jt(e,n,r){return!(e.l&256||r&&e.R&16384&&F.Y&&!e.rr)||C?!1:(wt(e),e.T&&(e.T.fe=!1),(e.m&=6)&2||L(e),e.ue=n instanceof t?n:new t(e,n),e.l|=2097280,R(e),j(),!0)}function Mt(e,t){let n=!1;Ot(e,(e,r)=>{!r&&e.T?.U===t&&(I(e),n=!0)}),n&&j()}function R(e,t=e){St(e,t);let n=!1,r;if(Ot(e,(i,a)=>{if(a||t!==e&&Tt(i,t)||!St(i,t))return!1;i.ie=A;let o=i.T?.se?.values().next().value,s=i.m&2;o?s||L(i,o):(i.m&=-2,s||L(i),i.l&256&&O(E(i)),i.T?.fe&&(I(i),n=!0),i.T!==null&&(i.T.fe=!1),!i.o&&i.l&32&&(r??=[]).push(i))}),r)for(let e of r)kt(e);n&&j()}function Nt(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function Pt(e){let t=e.T?.Se;t!=null&&(e.T.Se=null,t())}function Ft(t,n,r,i){let a=!1,o=!1;if(typeof n==`object`&&n&&en(()=>{a=n[Symbol.asyncIterator],o=!a&&Nt(n)}),!o&&!a)return t.T!==null&&(t.T.Ee=null),t.Ie=!1,n;U(t).Ee=n,t.T.ce=2147483647,t.T.se=void 0;let s,c=r=>{if(t.T?.Ee!==n)return;let a=r instanceof e;a&&t.Ie?(Ct(t),Et(t,r),t.ie=A):((a||!jt(t,r))&&(Rt(t,a?1:2,r),a||y(t,!1,!0)),a&&R(t),t.ie=A,a||At(t),i?.(r,a))},l=(e,i)=>{if(t.T?.Ee!==n||t.R&2)return;let a=t.m&4;if(Lt(t),r){try{r(e)}catch(e){c(e);return}t.l&256||(t.T.Te=null,t.l&=-1025),a&&Lt(t,!0)}else W(t,()=>e);t.ue===u&&(t.Ie=!1,pt(t)),R(t),j(),tt(),i?.()},d=()=>t.l&32&&!t.o&&!(t.m&1)?(_t(t),!0):!1,f=(e,r)=>{let i=e[Symbol.asyncIterator](),a=!1,o=!1,u=!r,f=()=>{if(!o){o=!0;try{let e=i.return?.();Nt(e)&&e.then(void 0,()=>{})}catch{}}};ae(f,r),U(t).Se=f;let p=()=>{try{d()||m()}catch(e){c(e)}},m=()=>{let e,r,f=!1,h=!1,g=!0,_=i.next();if((Nt(_)?_:{then:e=>void e(_)}).then(r=>{if(g&&u)e=r,f=!0,r.done&&(o=!0);else if(t.T?.Ee!==n)return;else r.done?(o=!0,a?(j(),tt()):l(void 0),d()):(a=!0,l(r.value,p))},e=>{g&&u?(r=e,h=!0):t.T?.Ee===n&&(o=!0,c(e),d())}),g=!1,h){if(o=!0,c(r),u)throw r;return!0}return f&&!e.done?(s=e.value,a=!0,m()):f&&e.done},h=m();return u=!1,a||h},p=null,m=(e,t)=>{let n=!1;if(typeof e==`object`&&e&&en(()=>{n=e[Symbol.asyncIterator]}),!n)return!1;s=void 0;let r=f(e,t);return t||(p=r),!0};if(o){let e=!1,r=!1,i,a=!0;if(n.then(r=>{if(a)s=r,e=!0;else{try{if(t.T?.Ee===n&&!(t.R&64)&&m(r,t))return;l(r)}catch(e){c(e)}d()}},e=>{a?(i=e,r=!0):(c(e),d())}),a=!1,r)throw c(i),i;e?m(s)||(t.Ie=!1):p=!1}if(a&&m(n),p!==null){if(!p){if(t.Ie)return t.le;throw new e(B)}t.Ie=!1}return s}function It(e,t=!1){e.T?.se&&wt(e),e.T?.fe&&(e.T.fe=!1),e.m=t?0:e.m&4,e.T?.U&&L(e);let n=Yt(e);n&&n.call(e)}function Lt(e,t=!1){let n=e.T?.se;n&&(n.delete(e),n.size)?(e.T.fe=!1,t&&(e.m=1),L(e,n.values().next().value)):It(e,t)}function Rt(n,r,i){r===2&&!(i instanceof t)&&!(i instanceof e)&&(i=new t(n,i));let a=r===1&&i instanceof e&&i.source;a?(n.m&2&&(n.T.Te=n.T.U),xt(n,a)):wt(n),n.m=r|(r===2?n.m&12?8:0:r===1&&n.m&8?4:n.m&4),a?L(n,a,i):U(n).U=i;let o=Yt(n);o?o.call(n):zt(n,r,i)}function zt(t,n,r){let i=n===1&&r instanceof e&&r.source;Dt(t,(e,a)=>{e.ie=A,e.l&16384||n===1&&a.Ne!==e.de?(n!==1&&St(e,t),I(e),j()):i&&e.T?.se?.has(i)?C===null&&(e.l&2304)==256&&F.Y&&!ue?.(e,i.ie===A)&&O(E(e)):(i||n!==1&&(e.T?.U!==r||e.T?.se))&&(qe(e),n===1&&(e.l&2304)==256&&!e.i&&O(E(e)),Rt(e,n,r),e.rr?.st(n,r))})}M._e=e=>{e.i===3?(ot(e,k),e.Ae=!0,F.enqueue(2,e.Z)):e.R&32&&!(e.R&65536)?ke(e):V(e)},M.Ce=y;let z=!1,B=null;function V(t,n=!1){Ye();let r=t.i,i,c=t.l&s;if(!n){if(ot(t,k),t.T!==null&&(t.T.Ee=null,Pt(t)),t.l&256){let e=E(t);e.P||t.l&524288||(t.l&8421376?e!==w&&!(t.m&4||t.l&1048576)&&(t.ue!==u&&Xe(t),t.ue=u,t.l&=-257):_e(e,ue?.(t,t.m&4)))}if(r===3||t.l&128){let e=ht;gt(i=[]),y(t),gt(e)}else(t.pe!==null||t.ke!==null)&&Gt(t);t.l&2097152&&(t.ue=u,t.l^=s)}let l=t.m&4,d=t.m&2&&t.T?.U,f=!!(t.m&1)&&t.T?.se,p=t.T?.se?.has(t),m=!1,h=!!(t.R&8192)&&!(t.m&1&&t.T!==null&&!t.T.Ve),g=B;B=t,t._=null,t.de++;let _=t.R&o;t.R=4|t.R&8224,t.ie=A;let v=t.ue===u?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,b=t.he,ee=!1,te=!1,ne=z;z=!0;try{if(t.l&64)v=t.X(v),t.T!==null&&(t.T.Ee=null),t.Ie=!1;else{let e=t.T?.Ee,n=t.X(v),r=typeof n==`object`&&!!n,i=t.T?.Ee!==e;v=i||!r?n:Ft(t,n),!i&&!r&&(t.T!==null&&(t.T.Ee=null),t.Ie=!1)}(t.m!==0||t.T!==null)&&It(t,n)}catch(n){let r=n instanceof e;if(r&&t.Ie)Et(t,n);else if((r||!(m=jt(t,n,!0)))&&(r&&(U(t).fe=!0),Rt(t,r?1:2,n),r&&p&&!t.T?.Ee&&R(t)),(r||m)&&f)for(let e of f)e!==t&&!(t.T?.se?.has(e)&&(e.m&1||Tt(t,e)))&&R(t,e)}finally{if(z=ne,ee=!!(t.R&a),te=!!(t.R&128),t.R=t.R&936032|(n?t.R&256:0),B=g,i)for(let e of i)kt(e);t.T!==null&&(t.T.Ve=h&&!!(t.m&1))}if(t.R&64){mt(t),Ct(t);return}let re=!!t.T?.U||m;if(!re){let e=t.ue===u,i=e?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,a=e&&l&&!r||!!t.T?.Te||!!c||!_n(t,i,v);if(r&&a&&!(t.R&262144&&!t.Ae&&Object.is(t.ge,v))&&e&&(t.Ae=!t.T?.U,n||F.enqueue(r,t.W??=M.q.bind(null,t),null)),!re){if(a)(n?!((w!==null||T!==null)&&(te||Wt(g)?.R&128)):r&&t.ue===u)?t.le=v:(t.ue=v,d&&(t.T.Te=d),n&&(Ae(t,w??T),t.m|=4,ue?.(t,w))),t.o!==null&&Xe(t);else if(t.he!=b)for(let e=t.o;e!==null;e=e.t)at(e.u,k)}if(!a&&!t.T?.U&&(d&&Mt(t,d),f))for(let e of f)e!==t&&R(t,e);p&&!(t.m&5)&&R(t)}if(n&&te&&t.m&1){let e=w??T;e&&!e.P&&(r&&ue?.(t)===2||Ae(t,e))}!t.T?.U&&t.ue===u&&!(r&&t.Ae)&&(n||r===3?pt(t):De(t)),(t.ue!==u||t.T!==null&&(t.T.me!==null||t.T.Le!==null)||t.m&5&&(!n||t.m&1))&&(t.l|=128,qe(t)),ee&&(I(t),j()),_&&kt(t)}function Bt(e){if(!(e.R&68)){if(e.R&1)for(let t=e.C;t;t=t.G){let n=t.S;if(n.X&&Bt(n),e.R&2)break}(e.R&2||e.T?.U&&e.ie<A&&!e.T?.Ee)&&V(e),e.R&=937336}}function H(e,t){let n=t?.transparent??!1,r=typeof t==`object`&&!!t&&`loadingValue`in t,i={id:re(t,n,B),l:(n?4:0)|!!t?.ownedWrite|(!B||t?.lazy?32:0)|(t?.sync?64:0)|(t?.ae?2:0)|(t?.xe??0),ye:t?.equals??$t,ke:null,A:B?.A??d,be:0,X:e,le:r?t.loadingValue:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:B,Ge:null,Me:null,pe:null,R:t?.lazy?512:0,m:r?0:4,ie:A,ue:u,we:-1,Ie:r,T:null};return t?.unobserved&&(U(i).Ye=t.unobserved),Zt(i,t),i}function U(e){return e.T??={Ee:null,Se:null,U:void 0,fe:void 0,se:void 0,Ye:void 0,De:void 0,me:null,Le:null,Re:null,Ve:!1,je:u,Be:-1,ce:0,P:u,I:0,Te:null}}function Vt(e,t){e.R|=128,(t.m&4||e.i!==1)&&_e(E(t),!e.i&&e.m&4||ue?.(e))}function Ht(e,t){if(!(!(e.l&1<<23)||t.l&1024)){let n=E(t);if(!(n===w||Ut(e,n)))return Ke(e,n),!0}return Vt(e,t),!1}function Ut(e,t){return(e.m&4||e.l&1048576)&&e.l&256&&E(e)===t}function Wt(e){return e!==null&&e.Qe?e.Ke:e}function Gt(e){m(e);let t=U(e);t.Le=e.ke,t.me=e.pe,e.ke=null,e.pe=null,e.be=0}function Kt(e,t,n,r,i){let a=i?.transparent??!1,o={id:re(i,a,B),l:r<<23|(a?4:0)|!!i?.ownedWrite|(i?.sync?64:0)|(i?.xe??0),ye:!1,ke:null,A:B?.A??d,be:0,X:e,le:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:B,Ge:null,Me:null,pe:null,R:512,m:4,ie:A,ue:u,we:-1,Ie:!1,Ae:!1,ge:void 0,qe:t,Je:n,ze:void 0,i:r,T:null};return i?.unobserved&&(U(o).Ye=i.unobserved),Zt(o,Xt),o}let qt=null;function Jt(e){qt=e}function Yt(e){return e.i?qt:null}const Xt={lazy:!0};function Zt(e,t){e.We=e;let n=B?.Qe?B.Ke:B;B&&b(B,e),n&&(e.he=n.he+1),!t?.lazy&&V(e,!0)}function Qt(e,t){let n={ye:t?.equals??$t,l:+!!t?.ownedWrite|(t?.ae?2:0),le:e,o:null,Ze:null,ie:A,ue:u,we:-1,T:null};return t?.unobserved&&(U(n).Ye=t.unobserved),n}function $t(e,t){return e===t}function en(e,t){let n=z;z=!1;try{return e()}finally{z=n}}function tn(e,t){if(e.R&512)e.R&=-513,V(e,!0);else if(e.R&64&&e.l&32){let t=e._parent;if(t!==null){if(t.R&64){e.l&=-33;return}e.R&32||b(t,e)}V(e,!0)}}function nn(e,t){return!t||e.ue===u||t.l&16}let rn=!1;function an(){rn=!0}function on(e){return F.Y||e.ue===u||e.l&4194304?u:e.l&256?e.T.Be===A?e.T.je:u:e.le}function sn(e){let t=e.T;t.Be!==A&&(t.je=e.ue,t.Be=A,rn=!0)}const cn=[];function ln(e){return e.R|=a,!0}function un(){if(rn=!1,cn.length!==0){for(let e of cn)e.l&=-4194305;cn.length=0}}function dn(e,t){e.he>=k.Fe?(ct(t),st(k),Bt(e)):t.l&65536&&Bt(e);let n=e.he;n>=t.he&&e._parent!==t&&(t.he=n+1)}function fn(e){let t=B;t?.Qe&&(t=t.Ke);let n=e,r=e;if(typeof n.X==`function`&&tn(e),!n.X&&e.T?.De===void 0&&(!rn||e.ue===u)&&!(e.l&2048))return t&&(z&&bt(e,t),e.l&256&&!(t.l&16)&&Ht(t,e))||!t||e.ue===u||t.l&16||e.ue===e.le&&Object.is(e.ue,e.le)?e.le:(hn(t),e.ue);let i=!1;if(t&&(z&&(bt(e,t),r.X&&dn(r,t)),e.l&256&&!(e.l&2048)&&!(t.l&16)&&(r.m&4?Vt(t,e):i=Ht(t,e))),r.m&1&&!i){if(t){if(!(t.l&16)||r.m&4)throw!z&&e!==t&&bt(e,t),r.T?.U}else if(r.m&4)throw r.T?.U}if(r.X&&r.m&2){if(z&&r.ie<A)return V(r),fn(e);throw!i&&e.l&2097152&&mn(e,t),r.T?.U}(i||!t)&&pn(e);let a=mn(e,i?null:t);return!t&&typeof n.X==`function`&&e.l&32&&!(r.m&1)&&!e.o&&(vt.add(e),j()),a}function pn(e){if(e.T?.Te)throw e.T.Te}function mn(t,n){if(t.ue!==u&&t.m&4&&(!n||n.l&16))throw new e(null);let r=n&&rn?on(t):u;if(r!==u)return ln(n),r;if(nn(t,n))return t.le;if(hn(n,t),t.l&2097152)throw t.ue;return t.ue}function hn(e,t){t?.m&4||(e.R|=16384)}function gn(e){F.Y||e.l&4194304||(e.l|=4194304,cn.push(e))}function _n(t,n,r){if(t.ye===$t)return n===r;try{return t.ye&&t.ye(n,r)}catch(n){if(!(n instanceof e))return Rt(t,2,n),!0}}function W(e,t){let n=e.ue===u?e.le:e.ue;if(typeof t==`function`&&(t=t(n)),e.l&256&&O(E(e)),!(e.m&4||e.T?.Te||!_n(e,n,t)))return t;let r=e.ue!==u;return r?e.l&256&&!F.Y&&sn(e):qe(e),e.ue=t,B!==null&&gn(e),e.X!==void 0&&(e.ie=A),r&&e.we===Je||(Xe(e),j()),t}function vn(e,t){let n=e.l&256&&!(e.R&1024)&&E(e)!==w;if(n&&typeof t==`function`){let n=t(e.le);t=()=>n}return e.m&2&&(e.T.Te=e.T.U,Rt(e,0)),t=W(e,t),e.l&=-2097153,n?(e.R=e.R&-2|2,it(e,k),j()):e.ue!==u&&(e.R|=1024),t}function G(e,t){let n=B,r=z;B=e,z=!1;try{return t()}finally{B=n,z=r}}function yn(e,t=!0){try{return e()}finally{}}function bn(e,t=x()){let n;if(t&&(n=t.A[e.id]),n===void 0&&(n=e.defaultValue),n===void 0)throw new i;return n}function xn(e,t,n=x()){if(!n)throw new r;n.A={...n.A,[e.id]:t===void 0?e.defaultValue:t}}function Sn(e,t,n,r){let i=Kt(e,t,n,r?.user?2:1,r);V(i,!0),r?.defer?Qe(i):i.ue===u&&(i.T?.Re?.P||i.i===2||r?.schedule?F.enqueue(i.i,Tn.bind(null,i),i.T?.Re):Tn(i,0))}function Cn(){let e=this.m,t=this.T?.U;if(e&2){if(F.notify(this,1,0),this.i===2){this.m&2&&Ze(this);return}wn(this,n(t))}else this.i===1&&F.notify(this,3,e,t)}function wn(e,t,n){if(!F.notify(e,2,2))throw Ve(t),t}function Tn(e,r){if(!e.Ae||e.R&64||r&&pe?.(e))return;if(e.m&2&&e.i===2){let t=n(e.T?.U);e.ge=e.le,e.Ae=!1;try{e.Je?e.Je(t,()=>{let t=e.ze;e.ze=void 0,t?.()}):console.error(t)}catch(t){wn(e,t)}return}let i=e.T?.U==null,a=e.ze;e.ze=void 0;try{a?.(),e.ze=e.qe(e.le,e.ge)}catch(n){U(e).U=new t(e,n),e.m|=2,wn(e,n)}finally{e.ge=e.le,e.Ae=!1,i&&pt(e)}}M.q=Tn;function En(e,t){let n=!1,r,i=()=>{if(!a.Ae||a.R&64||pe?.(a))return;let e=Je;n=!1;try{a.Ae=!1,V(a)}finally{}for(let t=a.C;t!==null;t=t.G){let o=t.S;if(o.ue!==u&&!(o.l&2048)&&(o.ue!==o.le||!Object.is(o.ue,o.le))){if(o.l&256)n||(n=!0,E(o).rn[1].push(r||=()=>{n&&(a.Ae=!0,i())}));else if(o.we<=e||o.X){I(a),j();break}}}},a=H(()=>{let t=a.ze;a.ze=void 0,t?.();let n=yn(e);a.ze=n},{...t,lazy:!0});a.ze=void 0,a.l=a.l&-33|16,a.Ae=!0,a.i=3,a.Z=i,I(a),j()}Jt(Cn);const Dn=/* @__PURE__ */ new WeakSet;function On(e){for(let t=e;t;t=t._parent){let e=t[ze];if(e!==void 0)return e}}function kn(e){let t=[];for(let n=e;n;n=n._parent){let e=n._name;typeof e==`string`&&e.length&&t.push(e)}return t.length?t.reverse():void 0}function An(e,t,n){if(e!==null&&(typeof e==`object`||typeof e==`function`)){if(Dn.has(e))return;Dn.add(e)}let r=On(t);if(r===void 0)return;let i={},a=kn(t),o=kn(n)??a;o!==void 0&&(i.ownerPath=o),a!==void 0&&(i.boundaryPath=a);try{r(e,i)}catch(e){console.error(e)}}const jn=Symbol(0);function K(e){let t=fn.bind(null,e);return t[f]=e,t}function Mn(e,t){if(typeof e==`function`){let n=H(e,t);return n.l&=-33,[K(n),vn.bind(null,n)]}let n=Qt(e,t);return[K(n),W.bind(null,n)]}function Nn(e,t){return K(H(e,t))}function Pn(e,t,n){Sn(e,t.effect||t,t.error,{user:!0,...n})}function Fn(e,t,n){Sn(e,t,void 0,n)}function In(e){let t=x();t&&!(t.l&16)?En(()=>en(e),void 0):F.enqueue(2,function t(){if(k.Et>=k.Fe)return F.enqueue(2,t);e()})}function Ln(e,t,n){let r=typeof n?.keyed==`function`?n.keyed:void 0,i=t.length>1,a=t,o={H:se(),it:0,st:e,ot:[],ft:a,ht:[],ln:[],Xe:r,ct:r||n?.keyed===!1?[]:void 0,lt:i&&n?.keyed!==!1?[]:void 0,ut:n?.keyed===!1,L:n?.fallback},s=H(Wn.bind(o),void 0);return s.l&=-33,K(s)}const Rn={ownedWrite:!0};function zn(e,t,n,r){let i=e.ot,a=e.it-1,o=[],s=[],c=[],l=256,u=r,d=r,f=!1;for(;u<=a&&d<=n-1;){let e=i[u],r=t[d];if(e===r){f||=(c.push(u,d,0),!0),c[c.length-1]++,u++,d++;continue}f=!1;let p=-1,m=Math.min(32-o.length,a-u,l);for(let e=1;e<=m;e++)if(i[u+e]===r){p=e;break}l-=p===-1?m:p;let h=-1;m=Math.min(32-s.length,n-1-d,l);for(let n=1;n<=m;n++)if(t[d+n]===e){h=n;break}if(l-=h===-1?m:h,p!==-1&&(h===-1||p<=h))for(;p-->0;)o.push(u++);else if(h!==-1)for(;h-->0;)s.push(d++);else{if(l<=0||o.length===32||s.length===32)return!1;o.push(u++),s.push(d++)}}for(;u<=a;u++){if(o.length===32)return!1;o.push(u)}for(;d<=n-1;d++){if(s.length===32)return!1;s.push(d)}return Bn(e,t,n,o,s,c)}function Bn(e,t,n,r,i,a){let o=e.ot,s,c,l;if(i.length!==0)for(l=Array(r.length),c=0;c<i.length;c++){let e=-1;for(s=0;s<r.length;s++)if(!l[s]&&o[r[s]]===t[i[c]]){e=s;break}if(e===-1)return!1;l[e]=!0,i[c]=i[c]<<6|e}if(r.length!==0||i.length!==0){let e=/* @__PURE__ */ new Set;for(s=0;s<r.length;s++)e.add(o[r[s]]);for(c=0;c<i.length;c++)e.add(t[i[c]>>6]);for(let t=0;t<a.length;t+=3){let n=a[t];for(let r=0,i=a[t+2];r<i;r++)if(e.has(o[n+r]))return!1}}let u=e.ht,d=e.ln,f=u.slice(0,n),p=d.slice(0,n);for(let e=0;e<a.length;e+=3){let t=a[e],n=a[e+1];if(t!==n)for(let r=0;r<a[e+2];r++)f[n+r]=u[t+r],p[n+r]=d[t+r]}for(c=0;c<i.length;c++){let e=i[c]>>6,t=r[i[c]&63];f[e]=u[t],p[e]=d[t]}for(e.ht=f,e.ln=p,e.it=n,e.ot=t.slice(0),s=0;s<r.length;s++)l!==void 0&&l[s]||d[r[s]].dispose();return!0}function Vn(e,t,n,r,i,a,o,s,c){let l=e.Xe,u=e.ot,d=e.ln,f=[],p=n;for(let m=n;m<=i;p++,m++){let i=l?l(t[m]):t[m];for(;p<=r&&(l?l(u[p]):u[p])!==i;)f.push(d[p++]);if(p>r)return o.fill(void 0),null;a[m]=e.ht[p],o[m-n]=d[p],s&&(s[m-n]=e.ct[p]),c&&(c[m-n]=e.lt[p])}for(;p<=r;p++)f.push(d[p]);return f}function Hn(e,t,n,r,i,a,o,s,c){let l=e.ln,u=e.ct,d=e.lt,f=e.it,p=n-f,m,h;if(p>0)for(l.length=n,u&&(u.length=n),d&&(d.length=n),m=f-1,h=n-1;m>i;m--,h--)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);else if(p<0){for(m=i+1,h=a+1;m<f;m++,h++)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);l.length=n,u&&(u.length=n),d&&(d.length=n)}for(h=r;h<=a;h++)l[h]=o[h-r],u&&Un(u[h]=s[h-r],t[h]),d&&W(d[h]=c[h-r],h);for(h=a+1;h<n;h++)u&&Un(u[h],t[h]),d&&p!==0&&W(d[h],h)}const Un=(e,t)=>e.le===t&&e.ue===u||W(e,t);function Wn(){this.H.Ke=x();let e=this.st()||[];e[jn],e=e;let t=e.length;return G(this.H,()=>{let n,r,i,a,o,s=this.ct?this.ut?()=>(a[i]=Qt(e[r],Rn),this.ft(K(a[i]),r)):()=>(a[i]=Qt(e[r],Rn),o&&(o[i]=Qt(r,Rn)),this.ft(K(a[i]),o?K(o[i]):void 0)):this.lt?()=>{let t=e[r];return o[i]=Qt(r,Rn),this.ft(t,K(o[i]))}:()=>{let t=e[r];return this.ft(t)};if(t===0)this.it!==0&&(this.H.dispose(!1),this.ln=[],this.ot=[],this.ht=[],this.it=0,this.ct&&=[],this.lt&&=[]),this.L&&!this.ht.length&&(this.ln[0]?.dispose(),this.ht[0]=G(this.ln[0]=se(),this.L));else if(this.it===0){let c=Array(t),l=Array(t);a=this.ct&&Array(t),o=this.lt&&Array(t);try{for(r=0;r<t;r++)i=r,c[r]=G(l[r]=se(),s)}catch(e){for(n=0;n<=r;n++)l[n]?.dispose();throw e}this.ln[0]&&this.ln[0].dispose(),this.ht=c,this.ln=l,a&&(this.ct=a),o&&(this.lt=o),this.ot=e.slice(0),this.it=t}else{let c,l,u,d,f,p,m,h,g;for(c=0,l=Math.min(this.it,t);c<l&&(this.ot[c]===e[c]||this.ct&&Gn(this.Xe,this.ot[c],e[c]));c++)this.ct&&Un(this.ct[c],e[c]);for(l=this.it-1,u=t-1;l>=c&&u>=c&&(this.ot[l]===e[u]||this.ct&&Gn(this.Xe,this.ot[l],e[u]));l--,u--);if(c===t&&this.it===t){this.ot=e.slice(0);return}if(t<=this.it&&l-c>64&&this.ct===void 0&&this.lt===void 0){let n=c+(u-c>>1),r=e[n],i=Math.min(l,n+32),a=Math.max(c,n-32);for(;a<=i&&this.ot[a]!==r;)a++;if(a<=i&&zn(this,e,t,c))return}let _=t-this.it,v=u-c+1,y=Array(t),b=Array(v);a=this.ct?Array(v):void 0,o=this.lt?Array(v):void 0;let ee=_<0?Vn(this,e,c,l,u,y,b,a,o):null;if(ee!==null)ee.length!==0&&(h=ee);else{for(p=/* @__PURE__ */ new Map,m=Array(v),r=u;r>=c;r--)d=e[r],f=this.Xe?this.Xe(d):d,n=p.get(f),m[r-c]=n===void 0?-1:n,p.set(f,r);for(n=c;n<=l;n++)d=this.ot[n],f=this.Xe?this.Xe(d):d,r=p.get(f),r!==void 0&&r!==-1?(y[r]=this.ht[n],b[r-c]=this.ln[n],a&&(a[r-c]=this.ct[n]),o&&(o[r-c]=this.lt[n]),r=m[r-c],p.set(f,r)):(h??=[]).push(this.ln[n]);try{for(r=c;r<=u;r++)b[r-c]===void 0&&((g??=[]).push(b[r-c]=se()),i=r-c,y[r]=G(b[r-c],s))}catch(e){if(g)for(n=0;n<g.length;n++)g[n].dispose();throw e}}for(n=0;n<c;n++)y[n]=this.ht[n];for(r=u+1;r<t;r++)y[r]=this.ht[r-_];if(Hn(this,e,t,c,l,u,b,a,o),this.ht=y,this.it=t,this.ot=e.slice(0),h)for(n=0;n<h.length;n++)h[n].dispose()}}),this.ht}function Gn(e,t,n){return!e||e(t)===e(n)}function Kn(e,t){if(typeof e==`function`&&!e.length){if(t?.doNotUnwrap)return e;do e=e();while(typeof e==`function`&&!e.length)}if(!t?.skipNonRendered||e!=null&&e!==!0&&e!==!1&&e!==``){if(Array.isArray(e)){let n=[];return qn(e,n,t)?()=>{let e=[];return qn(n,e,{...t,doNotUnwrap:!1}),e}:n}return e}}function qn(t,n=[],r){let i=null,a=!1;for(let o=0;o<t.length;o++)try{let e=t[o];if(typeof e==`function`&&!e.length){if(r?.doNotUnwrap){n.push(e),a=!0;continue}do e=e();while(typeof e==`function`&&!e.length)}Array.isArray(e)?a=qn(e,n,r)||a:r?.skipNonRendered&&(e==null||e===!0||e===!1||e===``)||n.push(e)}catch(t){if(!(t instanceof e))throw t;i=t}if(i)throw i;return a}const Jn=Symbol(``),Yn=Symbol(``),q=/* @__PURE__ */ new Set,Xn=e=>e.A[Jn],Zn=e=>!!e&&(e.i===2&&e.L||Zn(e._parent)),Qn=e=>e.i===2||!e.D||e.h||Zn(e._parent);function J(e,t,n=t){e.F.set(t,n),q.add(e)}function $n(e,t,r,i=t){if(e.i===2){r??=t.T?.U,i=r?.source??t,i.R&64&&(i=t);let a=n(r);W(e.U,a),An(a,e.H,i)}else e.D=!1;J(e,t,i),e.h&&er(e),e.L||tr(e)}function er(e){e.D=!1,e.P=e.B;let t=e.j;!e.P&&t.l&256&&E(t)!==w&&Pe(t)}function tr(e){e.j!==null&&!(e.j.R&96)&&(I(e.j),j())}function nr(e,t,n){if(t===0){if(q.size)for(let t=Xn(e);t;t=t._parent)!(t.F.get(e)?.m&(t.i|1))&&t.F.delete(e)&&!lr(t,0)&&t.L&&tr(t);return!1}for(let r=Xn(e);r;r=r._parent)if(!(r.i&t))r.L&&r.i>t&&J(r,e);else{if(Qn(r))return $n(r,e,n),!r.h||2;J(r,e)}return!1}function rr(e){for(let t=Xn(e);t;t=t._parent)if(t.i&1&&Qn(t))return t.h}function ir(e,t){for(let t=Xn(e);t;t=t._parent)if(t.L)return t;let n,r=e.o;if(t||e.l&16384)for(t||=/* @__PURE__ */ new Set,n=e.i!=1;r&&(n=t.size==t.add(r.u).size||ir(r.u,t));)r=r.t;return n}function ar(e){let t=ir(e);return t!==void 0&&((t.M??=/* @__PURE__ */ new Set).add(e),!0)}function or(e){if(e.M!==null){for(let t of e.M){let e=t.i;F.enqueue(e===3?2:e,e===3?t.Z:t.W??=M.q.bind(null,t))}e.M=null}}function sr(e,t,n){if(!(n.m&3||t.m&2)){for(let n=Xn(t);n&&n!==e;n=n._parent)if(n.i&1&&Qn(n))return!(n.j.l&256)}return!1}function cr(e,t,n){for(let r=e.C,i;r;r=r.G)if((i=r.S)===t||(n||=/* @__PURE__ */ new Set).size<n.add(i).size&&cr(i,t,n))return 1}function lr(e,t){let n=e.i|1;for(let[r,i]of e.F){if(!((r.R|i.R)&64)){if((r.m&n||i.m&n&&cr(r,i))&&!(n&2&&sr(e,r,i))||n&2&&i.l&2097152||r.l&32768&&r.R&8){if(t===0)break;continue}if((i!==e.K||e.h)&&(i.l&2304)==256){if(!t||!e.D)continue;O(E(i))}}e.F.delete(r)}return e.F.size}function ur(){for(let e of q){let t=e.j.R;if(t&64){q.delete(e);continue}if(t&32)continue;if(!e.D){for(let[t]of e.F)for(let n of t.m&1?t.T?.se||[]:[t])if(!(n.l&256))for(let r=n.C;r;r=r.G){let i=r.S;i.l&256&&(n===t||!E(i).tt)&&J(e,i)}}lr(e);let n=e.j;e.i&1&&!e.D&&n.l&256&&[...e.F].every(([,e])=>!(e.m&1)&&e.l&256&&E(e)===E(n))&&(e.F.clear(),e.D=!0),e.h=!1,e.F.size===0&&(q.delete(e),e.L&&tr(e))}}function dr(e){if(!e.D){e.L&&e.P===null&&e.B===null&&C!==null&&(e.B=C,er(e),tr(e));return}e.h=!0,e.j.l&=-8388609;let t=C;t===null&&F.Y&&x().l&32768&&(O(null),t=M.J(w)),e.B=t,q.add(e);let n=e.F.size;Ne(e.H,w,t=>J(e,t));for(let[t]of e.F)if(e.F.size!==n||t.m&1&&!(t.R&64)){for(let t=e._parent;t!==null;t=t._parent)if(t.i&1)for(let[n]of e.F)t.F.delete(n);er(e),tr(e);return}}function fr(t,n,r,i){let a=se(),o={i:t,_parent:Xn(a)??null,H:a,K:null,j:null,F:/* @__PURE__ */ new Map,D:t===2,h:!1,B:null,P:null,L:!1,M:null,v:null,$:!1,ee:!1,U:t===2?Qt(void 0,mr):null,ne:r,re:null};if(t===1&&a.A[Yn],x()&&ae(()=>{q.delete(o)}),i){let t=!1;G(a,()=>H(()=>{try{i()}catch(t){if(!(t instanceof e)){if(!F.notify(x(),2,2,t))throw Ve(t),t;return}}t?dr(o):t=!0})).l|=c}a.A={...a.A,[Jn]:o};let s=G(a,()=>{let e=H(n);return H(()=>Kn(fn(e)))});o.K=s;let u=H(()=>{let n=x();if(!o.h&&!(n.l&256)&&(n.l|=l),o.$&&(bt(s,n),o.$)){if(o.ee){o.L=!0;return}return pr(o)}let r=s.m&3;if(r!==0){if(bt(s,n),r&t){if(Qn(o))return $n(o,s,void 0),pr(o);J(o,s)}throw s.T.U}if(Qn(o)&&(o.F.size!==0&&n.m&4&&!(n.l&256)||lr(o,!0)!==0))return pr(o);let i;try{i=fn(s)}catch(n){if(n instanceof e?t===1:t===2){if(Qn(o))return $n(o,s,n),pr(o);J(o,s)}throw n}if(Qn(o)&&o.F.size!==0)return pr(o);o.D=!0,o.L=!1;let a=o.re,c=()=>{!o.L&&o.re===a&&(a.m&2&&j(),h(a),o.re=null)};return a!==null&&(o.j.le===a.le?F.enqueue(1,c):c()),or(o),i},{ae:!0});return u.l|=c,s.l|=l,o.j=u,K(u)}function pr(e){let t=x();e.P!==null&&(ge(e.P),t.R|=131072,e.P=null),e.L=!0,e.re===null&&(e.re=G(t._parent,()=>H(()=>e.ne(e),{id:t.id,lazy:1})));let n=C,r=t.R,i=fn(e.re);return ge(n),t.R^=(t.R^r)&163840,i}const mr={ownedWrite:!0,ae:!0};function hr(e,t,n){return fr(1,e,()=>t(),n?.on)}me(nr,(e,t)=>!t&&(e.m&4?nr(e,1):rr(e)),ir,ur,ar);function gr(e,t){let n=Symbol(t&&t.name||``);function r(e){return ce(()=>(xn(r,e.value),vr(()=>e.children)))}return r.id=n,r.defaultValue=e,r}function _r(e){return bn(e)}function vr(e){let t=Nn(e,{lazy:!0}),n=Nn(()=>Kn(t()),{lazy:!0,sync:!0});return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}const yr={hydrating:!1,registry:void 0,done:!1},br=(...e)=>Nn(...e),xr=(...e)=>Mn(...e),Sr=(...e)=>ce(...e),Cr=(...e)=>Fn(...e),wr=(...e)=>Pn(...e),Tr=(e,t,n)=>hr(e,t,n);function Er(e,t,n,r){return en(()=>e(t||{}))}const Dr=e=>{throw`Stale read from <${e}>.`};function Or(e){let t=`fallback`in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed},n=x(),r,i=()=>G(n,()=>Ln(()=>e.each,e.children,t));return yr.hydrating&&(r=i()),()=>(r??=i())()}function kr(e){let t=e.keyed,n=Nn(()=>e.when,void 0),r=t?n:Nn(n,{equals:(e,t)=>!e==!t,sync:!0});return Nn(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?en(t?()=>a(i):()=>a(()=>(r()||Dr(`Show`),n())),!1):a}return e.fallback},{sync:!0})}function Ar(e){let t=`on`in e?{on:()=>e.on}:void 0;return Tr(()=>e.children,()=>e.fallback,t)}const jr=yr,Y=/*#__PURE__*/ Symbol(`slot`),Mr=/*#__PURE__*/ Symbol(`host`),Nr={transparent:!0,sync:!0};function X(e,t,n){let r=n?{sync:!0,...n,transparent:!n.scope}:Nr;Cr(e,t,r)}function Pr(e,t,n,r){let i=e.moveBefore&&e.isConnected&&document.activeElement;i===document.body&&(i=null);let a=r||e,o=(t,n)=>{i&&t.isConnected&&t.contains(i)?e.moveBefore(t,n):e.insertBefore(t,n),(r||t[Y])&&(t[Y]=a)};if(!t.length){for(let e of n)o(e,r);return}let s=t=>{if(!t)return!1;let n=t[Y];return t.parentNode===e&&(!n||n===a)},c=n.length,l=t.length,u=c,d=0,f=0,p=t[l-1],m=s(p)?p.nextSibling:r||null,h=null,g,_;for(;d<l||f<u;)if(t[d]===n[f])d++,f++;else{for(;l>d&&u>f&&t[l-1]===n[u-1];)l--,u--;if(l===d){let e=u;for(;e<c&&!s(n[e]);)e++;let t=e<c?n[e]:m;for(;f<u;)o(n[f++],t)}else if(u===f)for(;d<l;){let e=t[d++];h&&h.has(e)||!s(e)||e.remove()}else if((g=t[d])===n[u-1]&&n[f]===t[l-1]&&g.parentNode===e&&(!(_=g[Y])||_===a))do if(o(t[--l],g),f++,d>=l-1||f>=u)break;while(t[d]===n[u-1]&&n[f]===t[l-1]);else{if(!s(t[d])){d++;continue}if(!h){h=/* @__PURE__ */ new Map;let e=f;for(;e<u;)h.set(n[e],e++)}let c=h.get(t[d]);if(c!=null){if(f<c&&c<u){let s=d,p=1,m;for(;++s<l&&s<u&&(m=h.get(t[s]))!=null&&m===c+p;)p++;if(p>c-f){let e=t[d];for(;f<c;)o(n[f++],e)}else{let s=n[f++],c=t[d++];i&&e.contains(i)?o(s,c):e.replaceChild(s,c),(r||s[Y])&&(s[Y]=a)}}else d++}else t[d++].remove()}}}const Fr=`_$SOLID_EVENT_OWNER`,Ir={},Lr=/* @__PURE__ */ new Set,Rr=/* @__PURE__ */ new Map;function zr(e,t,n,r={}){let i;Ur(t);try{Sr(a=>{i=a,r.onError&&(x()[ze]=r.onError);let o=e();t===document?X(()=>Kn(o),()=>{}):Q(t,()=>o,t.firstChild?null:void 0,n,{...r.insertOptions,schedule:!0})},{id:r.renderId}),tt()}catch(e){throw i&&i(),Wr(t),e}return()=>{i(),Wr(t),t.textContent=``}}function Br(e,t,n){let r=document.createElement(`template`);r.innerHTML=e;let i=r.content.firstChild;return n===2?i.firstChild:i}function Vr(e,t){let n;return t===1?r=>document.importNode(n||=Br(e,r,t),!0):r=>(n||=Br(e,r,t)).cloneNode(!0)}function Hr(e){for(let t of e)Lr.has(t)||(Lr.add(t),Rr.forEach((e,n)=>qr(t,n,e)))}function Ur(e){let t=Gr(e,e);t&&(t.roots=(t.roots||0)+1)}function Wr(e){let t=Rr.get(e);t&&(t.roots>1?t.roots--:delete t.roots),Kr(e,e)}function Gr(e,t=e){if(!e||!t)return;let n=Rr.get(e);return n||Rr.set(e,n={owners:/* @__PURE__ */ new Map,handlers:/* @__PURE__ */ new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),Lr.forEach(t=>qr(t,e,n)),n}function Kr(e,t=e){let n=Rr.get(e);if(!n)return;let r=n.owners.get(t);r>1?n.owners.set(t,r-1):n.owners.delete(t),n.owners.size||(n.handlers.forEach((t,n)=>e.removeEventListener(n,t)),Rr.delete(e))}function qr(e,t,n){if(n.handlers.has(e))return;let r=e=>ti(e,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}const Jr=e=>e._$host||e.parentNode||e.host;function Yr(e,t){let n=e,r=0;for(;n;){if(t.owners.has(n))return{owner:n,distance:r};r++,n=Jr(n)}}function Z(e,t,n){if($r(e))return;let r=t===`multiple`&&e.localName===`select`;if(n==null||n===!1)e.removeAttribute(t);else if(e.setAttribute(t,n===!0?``:n),r&&!e._$multiple){let t=e.options;for(let e=0;e<t.length;e++)t[e].defaultSelected&&(t[e].selected=!0)}r&&(e._$multiple=!0)}function Xr(e,t){Array.isArray(e)?e.flat(1/0).forEach(e=>e&&e(t)):e(t)}function Zr(e,t){let n=en(e);G(null,()=>Xr(n,t))}const Qr={scope:!0};function Q(e,t,n,r,i){let a=n!==void 0,o=i&&i.host;if(a&&!r&&(r=[]),typeof t!=`function`&&(t=ri(t,r,a,!0),typeof t!=`function`)){ni(e,t,r,n),o&&ii(t,o);return}if(a&&r.length===0){let t=document.createTextNode(``);e.insertBefore(t,n),r=[t]}let s=r,c=!1;X(()=>{let r=ri(t(),s,a,!0),l=c;return c=!0,typeof r==`function`?(X(()=>ri(r,s,a),t=>{s=ni(e,t,s,n),o&&ii(s,o)},l&&!(i&&i.schedule)?{...i,schedule:!0}:i),Ir):r},t=>{t!==Ir&&(s=ni(e,t,s,n),o&&ii(s,o))},t.$s?i?{...i,scope:!0}:Qr:i)}function $r(e){return!jr.hydrating||jr.isClaiming&&!jr.isClaiming()?!1:!e||e.isConnected?!0:ei!==null&&ei.claimed(e)}let ei=null;function ti(e,t,n){let r=e[Fr],i;if(r){if(r===!0||r===t||!t.contains(r))return;i=r}let a=n.owners.size===1&&n.owners.has(t)?t:Yr(e.target,n)?.owner;if(!a||a===i)return;e[Fr]=a;let o=i||e.target,s=`_$$`+e.type,c=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),l=()=>{let t=o[s];if(t&&!o.disabled){let n=o[`${s}Data`];if(n===void 0?typeof t==`function`?t.call(o,e):t.handleEvent(e):t.call(o,n,e),e.cancelBubble)return}return o.host&&typeof o.host!=`string`&&!o.host._$host&&o.contains(e.target)&&c(o.host),!0},u=()=>o===a||o.parentNode===a,d=()=>{for(;o&&l()&&!u();)o=Jr(o)};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return o||a}}),i)i===e.target&&(o=Jr(i)),o&&o!==a&&d();else if(e.composedPath){let t=e.composedPath();if(t.length){c(t[0]);for(let e=0;e<t.length&&(o=t[e],l());e++){if(o._$host){o=o._$host,d();break}if(u())break}}else d()}else d();delete e.target,delete e.currentTarget}function ni(e,t,n,r){if(t===n)return t;let i=typeof t,a=r!==void 0;if(i===`string`||i===`number`){let r=typeof n;r===`string`||r===`number`?e.firstChild.data=t:ai(e,n)?e.textContent=t:(oi(e,n),e.insertBefore(document.createTextNode(t),e.firstChild))}else if(t===void 0)si(e,n,r);else if(t.nodeType)Array.isArray(n)?si(e,n,a?r:null,t):n!=null&&n.nodeType?n.parentNode===e?e.replaceChild(t,n):e.appendChild(t):n!=null&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t),(r||t[Y])&&(t[Y]=r||e);else if(Array.isArray(t)){let i=Array.isArray(n);for(let e=0,r=t.length;e<r;e++){let r=t[e],a=typeof r;if(a===`string`||a===`number`){let a=i?n[e]:void 0;a&&a.nodeType===3?(a.data!==``+r&&(a.data=r),t[e]=a):t[e]=document.createTextNode(r)}}t.length===0?si(e,n,r):i?Pr(e,n,t,r):(n!=null&&si(e,n),Pr(e,[],t))}return t}function ri(e,t,n,r){return e=Kn(e,{skipNonRendered:!0,doNotUnwrap:r}),r&&typeof e==`function`||n&&!Array.isArray(e)&&(e=[e??``]),e}function ii(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)ii(e[n],t);else e&&e.nodeType&&e[Mr]!==t&&(e[Mr]=t,Object.defineProperty(e,"_$host",{get:t,configurable:!0}))}function ai(e,t){if(t==null)return!0;if(Array.isArray(t))return t.length?e.firstChild===t[0]&&e.lastChild===t[t.length-1]:e.firstChild===null;if(t===``)return e.firstChild===null;if(t.nodeType)return e.firstChild===t&&e.lastChild===t;let n=e.firstChild;return n!==null&&n.nodeType===3&&e.lastChild===n}function oi(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];r.parentNode===e&&r.remove()}else if(t.nodeType)t.parentNode===e&&t.remove();else{let t=e.firstChild;t&&t.nodeType===3&&t.remove()}}function si(e,t,n,r){if(n===void 0)return ai(e,t)?e.textContent=``:oi(e,t);if(t.length){let i=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(r!==o){let t=o[Y],s=o.parentNode===e&&(!t||t===(n||e));r&&!i&&!a?s?e.replaceChild(r,o):e.insertBefore(r,n):s&&o.remove()}else i=!0}}else r&&e.insertBefore(r,n);r&&(n||r[Y])&&(r[Y]=n||e)}const ci=gr(),li=()=>_r(ci);function ui(e){return(t,n,r)=>zr(()=>{let t=e=>{let[t,n]=xr({v:e()});return In(()=>e.on(e=>n({v:e}))),()=>t().v},i=t(r.events),a=t(r.theme),o=t(r.listeners),s=t(r.forms),c=t(r.unread),l=t(r.delivery),u={page:r.page,events:i,last:e=>i().findLast(t=>t.type===e),append:r.append,theme:a,listeners:o,forms:s,unread:c,delivery:l,markdown:r.markdown,message:r.message,toast:r.toast};return Er(ci,{value:u,get children(){return Er(e,n)}})},t)}const di=[`border-bottom-width`,`border-left-width`,`border-right-width`,`border-top-width`,`box-sizing`,`font-family`,`font-size`,`font-style`,`font-weight`,`letter-spacing`,`line-height`,`padding-bottom`,`padding-left`,`padding-right`,`padding-top`,`tab-size`,`text-indent`,`text-rendering`,`text-transform`,`width`,`word-break`],fi={"min-height":`0`,"max-height":`none`,"min-width":`0`,"max-width":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`};function pi(e){let t=getComputedStyle(e),n={};for(let e of di)n[e]=t.getPropertyValue(e);return n[`box-sizing`]?{style:n,padding:parseFloat(n[`padding-bottom`])+parseFloat(n[`padding-top`]),border:parseFloat(n[`border-bottom-width`])+parseFloat(n[`border-top-width`])}:null}let $=null;function mi(e,t,n,r){$||($=document.createElement(`textarea`),$.setAttribute(`tabindex`,`-1`),$.setAttribute(`aria-hidden`,`true`)),$.isConnected||document.body.append($);for(let[t,n]of Object.entries(e.style))$.style.setProperty(t,n);for(let[e,t]of Object.entries(fi))$.style.setProperty(e,t,`important`);let i=e.style[`box-sizing`]===`border-box`,a=t=>i?t+e.padding+e.border:t;$.value=t;let o=i?$.scrollHeight+e.border:$.scrollHeight-e.padding;$.value=`x`;let s=$.scrollHeight-e.padding,c=a(s*r);return{height:Math.min(c,Math.max(a(s*n),o)),full:o>=c}}function hi(e={}){let t,n=0,r=()=>{if(!t)return;let r=pi(t);if(!r)return;let{height:i,full:a}=mi(r,t.value||t.placeholder||`x`,e.minRows??1,e.maxRows??1/0);t.style.setProperty(`overflow-y`,a?`auto`:`hidden`,`important`),i!==n&&(n=i,t.style.setProperty(`height`,`${i}px`,`important`))};return In(()=>{let e=t;if(!e)return;r(),e.addEventListener(`input`,r);let n=new ResizeObserver(()=>r());return n.observe(e),()=>{e.removeEventListener(`input`,r),n.disconnect()}}),e=>{t=e}}var gi=/* @__PURE__ */ Vr(`<div class=wp-chat><div class=wp-chat-new><textarea rows=1></textarea><button type=button>`),_i=/* @__PURE__ */ Vr(`<div class=wp-chat-message><span class=wp-chat-who></span><!><!>`),vi=/* @__PURE__ */ Vr(`<span class=wp-chat-delivery role=status>`),yi=/* @__PURE__ */ Vr(`<div class=wp-chat-bubble data-md>`),bi=/* @__PURE__ */ Vr(`<div class=wp-chat-bubble>`);const xi=`chat:message`;function Si(e,t){let n=new Set(t);return Object.entries(e.data).filter(([e,t])=>!n.has(e)&&typeof t==`string`&&t.trim()).map(([,e])=>String(e).trim()).join(`
2
2
 
3
- `)}function bi(e){let t=si(),n=vr(()=>{let n=t.events(),r=n.filter(t=>t.type===vi&&t.data.chat===e.chat),i=new Set(r.map(e=>e.data.replaces).filter(Boolean).map(String)),a=[];for(let t of r){if(i.has(t.id))continue;let r=e.form&&t.data.replyTo?n.find(n=>n.id===t.data.replyTo&&n.type===e.form):void 0,o=r?yi(r,e.choices):``;r&&o&&!a.some(e=>e.id===r.id)&&a.push({id:r.id,from:`you`,text:o}),a.push({id:t.id,from:t.from===`cli`?`agent`:`you`,text:String(t.data.text??``),sending:!!t.sending,event:t.from===`cli`?t:void 0})}return a}),r,i=`wp-chat-draft:${location.pathname}|${e.chat}`,a=e=>{try{e.trim()?localStorage.setItem(i,e):localStorage.removeItem(i)}catch{}},o=e=>{e.addEventListener(`input`,()=>a(e.value));try{let t=localStorage.getItem(i);t&&!e.value&&(e.value=t,queueMicrotask(()=>e.dispatchEvent(new Event(`input`))))}catch{}},s=async()=>{let n=r?.value.trim();if(!n)return;let i=e=>{r.value=e,r.dispatchEvent(new Event(`input`))};i(``);try{await t.append(vi,{chat:e.chat,text:n})}catch(e){console.error(e),r.value.trim()||i(n),t.toast(`Couldn't send the message`,{kind:`alert`,name:`chat-failed`,details:`It's back in the box: send it again.`})}};var c=mi(),l=c.firstChild,u=l.firstChild,d=u.nextSibling;return Q(c,wr(Tr,{get each(){return n()},keyed:e=>e.id,children:e=>(()=>{var t=hi(),n=t.firstChild;return Q(n,()=>e().from),Q(t,wr(xi,{get text(){return e().text},get event(){return e().event}}),null),Ar(()=>({e:e().sending?void 0:`message:${e().id}`,t:e().from,a:e().sending?``:void 0,o:e().from===`agent`?e().id:void 0}),({e,t:n,a:r,o:i},a)=>{e!==a?.e&&qr(t,`id`,e),n!==a?.t&&qr(t,`data-from`,n),r!==a?.a&&qr(t,`data-sending`,r),i!==a?.o&&qr(t,`data-wp-message`,i)}),t})()}),l),u._$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),s())},Yr(()=>[e=>r=e,pi({maxRows:10}),o],u),d._$$click=s,Q(d,()=>e.form?`Ask`:`Send`),Ar(()=>({e:e.form?``:void 0,t:e.form?`Ask about this question (doesn't choose anything)`:`Write a message`}),({e,t},n)=>{e!==n?.e&&qr(c,`data-under-form`,e),t!==n?.t&&qr(u,`placeholder`,t)}),c}function xi(e){let t=si(),n=vr(()=>e.event?t.message(e.event):t.markdown(e.text)),r,i;return Sr(()=>e.text,e=>{i!==void 0&&e!==i&&r?.dispatchEvent(new CustomEvent(`wp-changed`,{bubbles:!0})),i=e}),wr(Er,{get fallback(){var t=_i();return Q(t,()=>e.text),t},get children(){var e=gi();return Yr(()=>e=>r=e,e),Ar(()=>n(),t=>{e.innerHTML=t}),e}})}var Si=ci(bi);zr([`keydown`,`click`]);export{Si as default};
3
+ `)}function Ci(e){let t=li(),n=br(()=>{let n=t.events(),r=n.filter(t=>t.type===xi&&t.data.chat===e.chat),i=new Set(r.map(e=>e.data.replaces).filter(Boolean).map(String)),a=[];for(let t of r){if(i.has(t.id))continue;let r=e.form&&t.data.replyTo?n.find(n=>n.id===t.data.replyTo&&n.type===e.form):void 0,o=r?Si(r,e.choices):``;r&&o&&!a.some(e=>e.id===r.id)&&a.push({id:r.id,from:`you`,text:o}),a.push({id:t.id,from:t.from===`cli`?`agent`:`you`,text:String(t.data.text??``),sending:!!t.sending,event:t.from===`cli`?t:void 0})}let o=t.delivery(),s=a.findLastIndex(e=>e.from===`agent`),c=a.findLastIndex(e=>e.from===`you`&&!e.sending);return a.map((e,t)=>{let n=e.from===`you`&&!e.sending?o.get(e.id):void 0;return n&&(n.state===`late`||t===c&&t>s)?{...e,delivery:n}:e})}),r,i=`wp-chat-draft:${location.pathname}|${e.chat}`,a=e=>{try{e.trim()?localStorage.setItem(i,e):localStorage.removeItem(i)}catch{}},o=e=>{e.addEventListener(`input`,()=>a(e.value));try{let t=localStorage.getItem(i);t&&!e.value&&(e.value=t,queueMicrotask(()=>e.dispatchEvent(new Event(`input`))))}catch{}},s=async()=>{let n=r?.value.trim();if(!n)return;let i=e=>{r.value=e,r.dispatchEvent(new Event(`input`))};i(``);try{await t.append(xi,{chat:e.chat,text:n})}catch(e){console.error(e),r.value.trim()||i(n),t.toast(`Couldn't send the message`,{kind:`alert`,name:`chat-failed`,details:`It's back in the box: send it again.`})}};var c=gi(),l=c.firstChild,u=l.firstChild,d=u.nextSibling;return Q(c,Er(Or,{get each(){return n()},keyed:e=>e.id,children:e=>(()=>{var t=_i(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling;return Q(n,()=>e().from),Q(t,Er(wi,{get text(){return e().text},get event(){return e().event}}),r),Q(t,Er(kr,{get when(){return e().delivery},children:e=>(()=>{var t=vi();return Q(t,()=>e().text),X(()=>e().state,e=>{Z(t,`data-wp-delivery`,e)}),t})()}),i),X(()=>({e:e().sending?void 0:`message:${e().id}`,t:e().from,a:e().sending?``:void 0,o:e().from===`agent`?e().id:void 0}),({e,t:n,a:r,o:i},a)=>{e!==a?.e&&Z(t,`id`,e),n!==a?.t&&Z(t,`data-from`,n),r!==a?.a&&Z(t,`data-sending`,r),i!==a?.o&&Z(t,`data-wp-message`,i)}),t})()}),l),u._$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),s())},Zr(()=>[e=>r=e,hi({maxRows:10}),o],u),d._$$click=s,Q(d,()=>e.form?`Ask`:`Send`),X(()=>({e:e.form?``:void 0,t:e.form?`Ask about this question (doesn't choose anything)`:`Write a message`}),({e,t},n)=>{e!==n?.e&&Z(c,`data-under-form`,e),t!==n?.t&&Z(u,`placeholder`,t)}),c}function wi(e){let t=li(),n=br(()=>e.event?t.message(e.event):t.markdown(e.text)),r,i;return wr(()=>e.text,e=>{i!==void 0&&e!==i&&r?.dispatchEvent(new CustomEvent(`wp-changed`,{bubbles:!0})),i=e}),Er(Ar,{get fallback(){var t=bi();return Q(t,()=>e.text),t},get children(){var e=yi();return Zr(()=>e=>r=e,e),X(()=>n(),t=>{e.innerHTML=t}),e}})}var Ti=ui(Ci);Hr([`keydown`,`click`]);export{Ti as default};
@@ -69,6 +69,16 @@
69
69
  .wp-chat-message[data-from='agent'] .wp-chat-who {
70
70
  color: var(--accent);
71
71
  }
72
+ /* where the reader's message went (api.delivery), quietly under it; not received for long: the warning colour */
73
+ .wp-chat-delivery {
74
+ padding: 0 var(--space-xs);
75
+ font: var(--ui-tiny)/1.3 var(--sans);
76
+ color: var(--muted);
77
+ }
78
+ .wp-chat-delivery[data-wp-delivery='late'] {
79
+ color: var(--warn);
80
+ font-weight: var(--weight-strong);
81
+ }
72
82
  .wp-chat-bubble {
73
83
  max-width: 100%;
74
84
  min-width: 0;
@@ -97,11 +97,19 @@ command answers; the server approved and disabled in no settings file
97
97
  (`.claude/settings.json`, `settings.local.json`, `~/.claude/settings.json`,
98
98
  the project in `~/.claude.json`, and in a git worktree without its own
99
99
  `settings.local.json`, the main checkout's, where Claude Code writes an Esc
100
- on "New MCP server found"); the session started with the flag above, in
101
- the project's folder; the server up at the project's version; a channel
102
- for this session; and its ping confirmed. `/mcp` doesn't list a disabled
103
- server at all, so this is where to look. It changes nothing, and exits 1
104
- when something is to fix.
100
+ on "New MCP server found"); the session started with the flag above; the
101
+ server up at the project's version; a channel for this session; and its
102
+ ping confirmed. `/mcp` doesn't list a disabled server at all, so this is
103
+ where to look. It changes nothing, and exits 1 when something is to fix.
104
+
105
+ `.mcp.json` and the settings are read where Claude Code runs, which need
106
+ not be the pages' project: a wrapper can start a session in one folder (a
107
+ git worktree) with the pages of another. That folder is
108
+ `CLAUDE_PROJECT_DIR` when set, else the one the session's claude process
109
+ runs in, else the project's. When it differs, the doctor names both
110
+ (`pages: …; Claude's project: …`), and its fixes point at Claude's:
111
+ `workpad claude install --claude-dir <folder>` writes `.mcp.json` and the
112
+ hooks there.
105
113
 
106
114
  ## The turn-end check
107
115
 
@@ -1,5 +1,5 @@
1
- import { channelSince } from "../../src/status.js";
2
- import { ANSWERS_NOTE, answerLine, identity, pong } from "../../src/agents.js";
1
+ import { channelSince, takesUnfollowed } from "../../src/status.js";
2
+ import { ANSWERS_NOTE, answerLine, identity, pong, unfollowedLine } from "../../src/agents.js";
3
3
  import { read } from "../../src/events.js";
4
4
  import { claudeProcess, recordedSession } from "./session.js";
5
5
  import fs from "node:fs";
@@ -19,9 +19,12 @@ async function channel(ctx) {
19
19
  const claude = claudeProcess();
20
20
  const started = process.env.CLAUDE_CODE_SESSION_ID || null;
21
21
  let session = null;
22
+ const selves = /* @__PURE__ */ new Set();
22
23
  /** The conversation now, and a line in the log when it changed after start (a resume). */
23
24
  const current = () => {
24
- const now = identity(recordedSession(ctx.dataDir, claude) ?? started);
25
+ const raw = recordedSession(ctx.dataDir, claude) ?? started;
26
+ const now = identity(raw);
27
+ for (const id of [raw, now]) if (id) selves.add(id);
25
28
  if (now !== session) {
26
29
  if (!now) problem("no CLAUDE_CODE_SESSION_ID: no pages to follow");
27
30
  else if (now !== started || session) problem("following another session than at start", {
@@ -59,15 +62,51 @@ async function channel(ctx) {
59
62
  });
60
63
  };
61
64
  const followed = /* @__PURE__ */ new Set();
65
+ let followedFor = null;
66
+ let unfollowed = null;
67
+ const takeUnfollowed = (session) => {
68
+ const wanted = takesUnfollowed(read(ctx.eventsFile).events, session);
69
+ if (unfollowed && (!wanted || unfollowed.session !== session)) {
70
+ unfollowed.stop.abort();
71
+ unfollowed = null;
72
+ }
73
+ if (!wanted || unfollowed) return;
74
+ unfollowed = {
75
+ session,
76
+ stop: new AbortController()
77
+ };
78
+ ctx.unfollowed((e, again, from) => notify(unfollowedLine(e, again, from), {
79
+ page: e.page,
80
+ id: e.id,
81
+ type: e.type,
82
+ ...from && { project: from.project }
83
+ }), {
84
+ agent: session,
85
+ signal: unfollowed.stop.signal
86
+ }).catch((err) => problem("taking the unfollowed pages failed", String(err)));
87
+ };
62
88
  const follow = async () => {
63
89
  const session = current();
64
90
  hold(session);
65
91
  if (!confirmed || !session) return;
92
+ takeUnfollowed(session);
93
+ if (followedFor?.session !== session) {
94
+ followedFor?.stop.abort();
95
+ followed.clear();
96
+ followedFor = {
97
+ session,
98
+ stop: new AbortController()
99
+ };
100
+ }
101
+ const { signal } = followedFor.stop;
66
102
  const pages = (await ctx.status()).filter((p) => p.subscribers.includes(session)).map((p) => p.page);
67
103
  for (const page of pages) {
68
- if (followed.has(page)) continue;
104
+ if (followed.has(page) || signal.aborted) continue;
69
105
  followed.add(page);
70
- await ctx.listen(page, { agent: session });
106
+ await ctx.listen(page, {
107
+ agent: session,
108
+ signal
109
+ });
71
110
  const push = (e, again) => notify(answerLine(e, again), {
72
111
  page: e.page,
73
112
  id: e.id,
@@ -79,7 +118,9 @@ async function channel(ctx) {
79
118
  exact: true
80
119
  }, push, {
81
120
  agent: session,
82
- skipReceivedBefore: since
121
+ aliases: selves,
122
+ skipReceivedBefore: since,
123
+ signal
83
124
  }).catch((err) => problem("handing out failed", {
84
125
  page,
85
126
  err: String(err)
@@ -1,4 +1,4 @@
1
- import { claudePid, claudeProcess, recordedSession } from "./session.js";
1
+ import { claudeFolder, claudePid, claudeProcess, real, recordedSession } from "./session.js";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import os from "node:os";
@@ -134,46 +134,42 @@ function approvals(dir, home = os.homedir()) {
134
134
  });
135
135
  return lines;
136
136
  }
137
- /** The claude process's command line and folder. */
138
- function claudeLaunch(pid) {
137
+ /** The claude process's command line. */
138
+ function claudeArgs(pid) {
139
139
  const ps = spawnSync("ps", [
140
140
  "-o",
141
141
  "args=",
142
142
  "-p",
143
143
  String(pid)
144
144
  ], { encoding: "utf8" });
145
- const lsof = spawnSync("lsof", [
146
- "-a",
147
- "-p",
148
- String(pid),
149
- "-d",
150
- "cwd",
151
- "-Fn"
152
- ], { encoding: "utf8" });
153
- const cwd = lsof.status === 0 ? lsof.stdout.split("\n").find((l) => l.startsWith("n"))?.slice(1) ?? null : null;
154
- return {
155
- args: ps.status === 0 ? ps.stdout.trim() : null,
156
- cwd
157
- };
145
+ return ps.status === 0 ? ps.stdout.trim() : null;
158
146
  }
159
- /** The workpad version a project pins (its package.json), and the one installed there, when it has them. */
160
- function pinned(dir) {
161
- const pkg = readJson(path.join(dir, "package.json"))?.value;
162
- return {
163
- pin: pkg?.dependencies?.["@bigmistqke/workpad"] ?? pkg?.devDependencies?.["@bigmistqke/workpad"] ?? null,
164
- installed: readJson(path.join(dir, "node_modules", "@bigmistqke", "workpad", "package.json"))?.value?.version ?? null
165
- };
166
- }
167
- async function doctor(ctx) {
168
- const dir = ctx.project.dir;
147
+ /**
148
+ * The checks of what Claude Code reads where it runs (`claude`, see claudeFolder): which folder
149
+ * that is, beside the pages' project (`pages`), when the two differ; the channel in its .mcp.json,
150
+ * and that its command answers, started there as Claude Code starts it; and the server approved and
151
+ * disabled nowhere in its settings. Each fix points at the folder it is for.
152
+ */
153
+ async function channelChecks(pages, claude, home = os.homedir()) {
154
+ const dir = claude.dir;
155
+ const apart = real(pages) !== dir;
169
156
  const lines = [];
157
+ if (apart) lines.push({
158
+ mark: "skip",
159
+ text: `pages: ${pages}; Claude's project: ${dir} (${claude.from ?? "no Claude Code session found"}). The channel and its approval are read from Claude's`
160
+ });
161
+ else if (claude.from) lines.push({
162
+ mark: "ok",
163
+ text: `Claude Code runs in the project's folder (${dir})`
164
+ });
165
+ const install = apart ? `workpad claude install --claude-dir ${dir}` : "workpad claude install";
170
166
  const mcpFile = path.join(dir, ".mcp.json");
171
167
  const mcp = readJson(mcpFile);
172
168
  const entry = mcp?.value?.mcpServers?.[SERVER];
173
169
  if (!mcp) lines.push({
174
170
  mark: "fail",
175
171
  text: `no ${mcpFile}`,
176
- fix: "workpad claude install"
172
+ fix: install
177
173
  });
178
174
  else if (mcp.value === void 0) lines.push({
179
175
  mark: "fail",
@@ -183,12 +179,12 @@ async function doctor(ctx) {
183
179
  else if (!entry?.command) lines.push({
184
180
  mark: "fail",
185
181
  text: `${mcpFile} has no "${SERVER}" server`,
186
- fix: "workpad claude install"
182
+ fix: install
187
183
  });
188
184
  else {
189
185
  const env = {
190
186
  ...process.env,
191
- CLAUDE_PROJECT_DIR: process.env.CLAUDE_PROJECT_DIR ?? dir,
187
+ CLAUDE_PROJECT_DIR: dir,
192
188
  ...entry.env ?? {}
193
189
  };
194
190
  const why = await probe(expand(entry.command, env), (entry.args ?? []).map((a) => expand(a, env)), dir, env);
@@ -196,21 +192,34 @@ async function doctor(ctx) {
196
192
  lines.push(why ? {
197
193
  mark: "fail",
198
194
  text: `the channel's command in ${mcpFile} doesn't answer: ${why}`,
199
- fix: `run it by hand to see why: ${shown}`
195
+ fix: `run it by hand in ${dir} to see why: ${shown}`
200
196
  } : {
201
197
  mark: "ok",
202
198
  text: `${mcpFile} has the channel, and its command answers (${shown})`
203
199
  });
204
200
  }
205
- lines.push(...approvals(dir));
201
+ lines.push(...approvals(dir, home));
202
+ return lines;
203
+ }
204
+ /** The workpad version a project pins (its package.json), and the one installed there, when it has them. */
205
+ function pinned(dir) {
206
+ const pkg = readJson(path.join(dir, "package.json"))?.value;
207
+ return {
208
+ pin: pkg?.dependencies?.["@bigmistqke/workpad"] ?? pkg?.devDependencies?.["@bigmistqke/workpad"] ?? null,
209
+ installed: readJson(path.join(dir, "node_modules", "@bigmistqke", "workpad", "package.json"))?.value?.version ?? null
210
+ };
211
+ }
212
+ async function doctor(ctx) {
213
+ const dir = ctx.project.dir;
214
+ const lines = await channelChecks(dir, claudeFolder(dir));
206
215
  const pid = claudePid();
207
216
  const envSession = process.env.CLAUDE_CODE_SESSION_ID || null;
208
217
  if (!pid) lines.push({
209
218
  mark: "skip",
210
- text: envSession ? "couldn't find the claude process (is ps permitted here?): its launch flag and folder are not checked" : "not run from a Claude Code session: its launch and channel are not checked"
219
+ text: envSession ? "couldn't find the claude process (is ps permitted here?): its launch flag is not checked" : "not run from a Claude Code session: its launch and channel are not checked"
211
220
  });
212
221
  else {
213
- const { args, cwd } = claudeLaunch(pid);
222
+ const args = claudeArgs(pid);
214
223
  if (args == null) lines.push({
215
224
  mark: "skip",
216
225
  text: `couldn't read the command line of claude (pid ${pid})`
@@ -224,19 +233,6 @@ async function doctor(ctx) {
224
233
  text: `the session was started without ${FLAG} server:${SERVER}: Claude Code drops what the channel sends`,
225
234
  fix: `restart it with: claude ${FLAG} server:${SERVER} (a resume or a restore keeps no flag it wasn't given)`
226
235
  });
227
- if (cwd == null) lines.push({
228
- mark: "skip",
229
- text: `couldn't read the folder claude (pid ${pid}) runs in`
230
- });
231
- else if (path.resolve(cwd) === dir) lines.push({
232
- mark: "ok",
233
- text: `the session runs in the project's folder`
234
- });
235
- else lines.push({
236
- mark: "fail",
237
- text: `the session runs in ${cwd}, not the project's folder: it doesn't see ${mcpFile}`,
238
- fix: `start claude in ${dir}`
239
- });
240
236
  }
241
237
  let stuckWhy = null;
242
238
  const server = await ctx.running().catch((err) => (stuckWhy = err.message, null));
@@ -313,4 +309,4 @@ async function doctor(ctx) {
313
309
  console.log(failed ? `\n${failed} to fix.` : "\nThe channel has what it needs.");
314
310
  if (failed) process.exitCode = 1;
315
311
  }
316
- export { approvals, doctor, expand, mainCheckout };
312
+ export { approvals, channelChecks, doctor, expand, mainCheckout };