orbitchat 2.9.1 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/assets/{_baseUniq-BPMphbq5-CmoQerP6.js → _baseUniq-BPMphbq5-CPjfCsrD.js} +1 -1
  2. package/dist/assets/{api-FdNd9lEW.js → api-BjZW-Eka.js} +1 -1
  3. package/dist/assets/{arc-D9rhTKV0-B5jtjSgL.js → arc-D9rhTKV0-DYz8o6uc.js} +1 -1
  4. package/dist/assets/{architectureDiagram-VXUJARFQ-BiqZtsDe-Cfz2CqoK.js → architectureDiagram-VXUJARFQ-BiqZtsDe-PQNQsxA5.js} +1 -1
  5. package/dist/assets/{blockDiagram-VD42YOAC-zcRIdFTD-HLuQkjMh.js → blockDiagram-VD42YOAC-zcRIdFTD-DjqpPrHK.js} +1 -1
  6. package/dist/assets/{c4Diagram-YG6GDRKO-DYXNcDX4-pgzzzS-m.js → c4Diagram-YG6GDRKO-DYXNcDX4-l2nks34z.js} +1 -1
  7. package/dist/assets/channel-CUIutAfm-pI9TF54v.js +1 -0
  8. package/dist/assets/{chunk-4BX2VUAB-DAh9ktmY-BMqsOb4D.js → chunk-4BX2VUAB-DAh9ktmY-KWGt6_9H.js} +1 -1
  9. package/dist/assets/{chunk-55IACEB6-Cza7pcpr-CKUJ42yb.js → chunk-55IACEB6-Cza7pcpr-B6XoRNM7.js} +1 -1
  10. package/dist/assets/{chunk-B4BG7PRW-BTUSpeKy-DmqvvQD8.js → chunk-B4BG7PRW-BTUSpeKy-DQE1LIBz.js} +1 -1
  11. package/dist/assets/{chunk-DI55MBZ5-DKt4WII7-CWnrnH5O.js → chunk-DI55MBZ5-DKt4WII7-BLntGzxd.js} +1 -1
  12. package/dist/assets/{chunk-FMBD7UC4-DdcCR8w3-C_bSL6VW.js → chunk-FMBD7UC4-DdcCR8w3-D-bfFKsw.js} +1 -1
  13. package/dist/assets/{chunk-QN33PNHL-v6AkzOl1-BUg0lGrM.js → chunk-QN33PNHL-v6AkzOl1-BWs-tIow.js} +1 -1
  14. package/dist/assets/{chunk-QZHKN3VN-DVJOrqBZ-C_lvzJWB.js → chunk-QZHKN3VN-DVJOrqBZ-CQn3XpCN.js} +1 -1
  15. package/dist/assets/{chunk-TZMSLE5B-G2jJHqli-DZBxwK9m.js → chunk-TZMSLE5B-G2jJHqli-CumqsxEs.js} +1 -1
  16. package/dist/assets/{classDiagram-2ON5EDUG-CxmgTanh-CrvwueYy.js → classDiagram-2ON5EDUG-CxmgTanh-K5CqCJ46.js} +1 -1
  17. package/dist/assets/{classDiagram-v2-WZHVMYZB-CxmgTanh-CrvwueYy.js → classDiagram-v2-WZHVMYZB-CxmgTanh-K5CqCJ46.js} +1 -1
  18. package/dist/assets/clone-CsNB4mMi-BFfekQWu.js +1 -0
  19. package/dist/assets/{cose-bilkent-S5V4N54A-BRr2Y6dg-CQFKGWM3.js → cose-bilkent-S5V4N54A-BRr2Y6dg-BLK_nh3w.js} +1 -1
  20. package/dist/assets/{dagre-6UL2VRFP-DX8gNHmJ-CixEb2yy.js → dagre-6UL2VRFP-DX8gNHmJ-B7b_LYv7.js} +1 -1
  21. package/dist/assets/{diagram-PSM6KHXK-DNX818To-vH-oMigw.js → diagram-PSM6KHXK-DNX818To-D0ZFUpMu.js} +1 -1
  22. package/dist/assets/{diagram-QEK2KX5R-BDO6hKtm-B109ByVS.js → diagram-QEK2KX5R-BDO6hKtm-Dr2Me9_V.js} +1 -1
  23. package/dist/assets/{diagram-S2PKOQOG-IEqaDwzi-BRHi8-EX.js → diagram-S2PKOQOG-IEqaDwzi-DAshyIbn.js} +1 -1
  24. package/dist/assets/{erDiagram-Q2GNP2WA-DbLpN8Jp-Bs0Sf7As.js → erDiagram-Q2GNP2WA-DbLpN8Jp-BZ_v88L3.js} +1 -1
  25. package/dist/assets/{flowDiagram-NV44I4VS-pJlHae8Y-DifGWDqr.js → flowDiagram-NV44I4VS-pJlHae8Y-Ev71T-8E.js} +1 -1
  26. package/dist/assets/{ganttDiagram-JELNMOA3-J0Tkq5TR-CzwkzRjB.js → ganttDiagram-JELNMOA3-J0Tkq5TR-BjsMGwL5.js} +1 -1
  27. package/dist/assets/{gitGraphDiagram-NY62KEGX-DgYonpsZ-Ck9sEXvB.js → gitGraphDiagram-NY62KEGX-DgYonpsZ-CoJwCAaB.js} +1 -1
  28. package/dist/assets/{graph-BpcfrHXY-CLTlV2IP.js → graph-BpcfrHXY-CQbhxCN2.js} +1 -1
  29. package/dist/assets/{index-BTQ79OPa.js → index-ChuCI18h.js} +6 -6
  30. package/dist/assets/{index-DvNpGWs7-CSqlydkk.js → index-DvNpGWs7-CaxGVeNk.js} +1 -1
  31. package/dist/assets/{index-BPng8BUQ.css → index-NUUlYSI-.css} +1 -1
  32. package/dist/assets/{infoDiagram-WHAUD3N6-C3JLOAnb-MFqHXhs9.js → infoDiagram-WHAUD3N6-C3JLOAnb-DLC9Ky2f.js} +1 -1
  33. package/dist/assets/{journeyDiagram-XKPGCS4Q-CfjB2Qdf-eAKcN11v.js → journeyDiagram-XKPGCS4Q-CfjB2Qdf-BACGbkJF.js} +1 -1
  34. package/dist/assets/{kanban-definition-3W4ZIXB7-CrW8yVmd-B4tOzBLu.js → kanban-definition-3W4ZIXB7-CrW8yVmd-BnwY45Lx.js} +1 -1
  35. package/dist/assets/{layout-bsfAhWjc-DJ5MzEZA.js → layout-bsfAhWjc-DEuHffo5.js} +1 -1
  36. package/dist/assets/{min-C2aDz5ZK-DJ5s6JEK.js → min-C2aDz5ZK-_oBiM5es.js} +1 -1
  37. package/dist/assets/{mindmap-definition-VGOIOE7T-Dj37RkY_-DyeS1Pwn.js → mindmap-definition-VGOIOE7T-Dj37RkY_-PyW77bMN.js} +1 -1
  38. package/dist/assets/{pieDiagram-ADFJNKIX-BiQvDx8I-BVlu4DP6.js → pieDiagram-ADFJNKIX-BiQvDx8I-CIbkMrvT.js} +1 -1
  39. package/dist/assets/{quadrantDiagram-AYHSOK5B-D4b-YFzI-20vwDb_g.js → quadrantDiagram-AYHSOK5B-D4b-YFzI-_SGAkshM.js} +1 -1
  40. package/dist/assets/{requirementDiagram-UZGBJVZJ-km07nlVd-BHhJviAO.js → requirementDiagram-UZGBJVZJ-km07nlVd-CFFR6F1J.js} +1 -1
  41. package/dist/assets/{sankeyDiagram-TZEHDZUN-LfuSRRbf-BtP8n9t9.js → sankeyDiagram-TZEHDZUN-LfuSRRbf-9onzvkvi.js} +1 -1
  42. package/dist/assets/{sequenceDiagram-WL72ISMW-CQ4J-0_7-VooKtF0A.js → sequenceDiagram-WL72ISMW-CQ4J-0_7-ZRF7L80_.js} +1 -1
  43. package/dist/assets/{stateDiagram-FKZM4ZOC-JtogJwt6-D7AvQ8nY.js → stateDiagram-FKZM4ZOC-JtogJwt6-BCLNECzQ.js} +1 -1
  44. package/dist/assets/{stateDiagram-v2-4FDKWEC3-DuQ7UaeU-inxlx8mu.js → stateDiagram-v2-4FDKWEC3-DuQ7UaeU-DngwO9wu.js} +1 -1
  45. package/dist/assets/{timeline-definition-IT6M3QCI-Cs3NnF2M-D8q8kkZf.js → timeline-definition-IT6M3QCI-Cs3NnF2M-DypRUg2c.js} +1 -1
  46. package/dist/assets/{treemap-KMMF4GRG-CkW25-tn-D5d0NzyZ.js → treemap-KMMF4GRG-CkW25-tn-B949m5oF.js} +1 -1
  47. package/dist/assets/{xychartDiagram-PRI3JC2R-JzAaXa5z-B80gGLiB.js → xychartDiagram-PRI3JC2R-JzAaXa5z-ConZzQ2w.js} +1 -1
  48. package/dist/index.html +2 -2
  49. package/package.json +1 -1
  50. package/dist/assets/channel-CUIutAfm-DmibZJh4.js +0 -1
  51. package/dist/assets/clone-CsNB4mMi-CUPyr0Dy.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-DX8gNHmJ-CixEb2yy.js","assets/graph-BpcfrHXY-CLTlV2IP.js","assets/_baseUniq-BPMphbq5-CmoQerP6.js","assets/layout-bsfAhWjc-DJ5MzEZA.js","assets/min-C2aDz5ZK-DJ5s6JEK.js","assets/clone-CsNB4mMi-CUPyr0Dy.js","assets/cose-bilkent-S5V4N54A-BRr2Y6dg-CQFKGWM3.js","assets/cytoscape.esm-CjI2IsL8-Da6dFVsf.js","assets/c4Diagram-YG6GDRKO-DYXNcDX4-pgzzzS-m.js","assets/chunk-TZMSLE5B-G2jJHqli-DZBxwK9m.js","assets/flowDiagram-NV44I4VS-pJlHae8Y-DifGWDqr.js","assets/chunk-FMBD7UC4-DdcCR8w3-C_bSL6VW.js","assets/chunk-55IACEB6-Cza7pcpr-CKUJ42yb.js","assets/chunk-QN33PNHL-v6AkzOl1-BUg0lGrM.js","assets/channel-CUIutAfm-DmibZJh4.js","assets/erDiagram-Q2GNP2WA-DbLpN8Jp-Bs0Sf7As.js","assets/gitGraphDiagram-NY62KEGX-DgYonpsZ-Ck9sEXvB.js","assets/chunk-4BX2VUAB-DAh9ktmY-BMqsOb4D.js","assets/chunk-QZHKN3VN-DVJOrqBZ-C_lvzJWB.js","assets/treemap-KMMF4GRG-CkW25-tn-D5d0NzyZ.js","assets/infoDiagram-WHAUD3N6-C3JLOAnb-MFqHXhs9.js","assets/pieDiagram-ADFJNKIX-BiQvDx8I-BVlu4DP6.js","assets/arc-D9rhTKV0-B5jtjSgL.js","assets/requirementDiagram-UZGBJVZJ-km07nlVd-BHhJviAO.js","assets/sequenceDiagram-WL72ISMW-CQ4J-0_7-VooKtF0A.js","assets/classDiagram-2ON5EDUG-CxmgTanh-CrvwueYy.js","assets/chunk-B4BG7PRW-BTUSpeKy-DmqvvQD8.js","assets/classDiagram-v2-WZHVMYZB-CxmgTanh-CrvwueYy.js","assets/stateDiagram-FKZM4ZOC-JtogJwt6-D7AvQ8nY.js","assets/chunk-DI55MBZ5-DKt4WII7-CWnrnH5O.js","assets/stateDiagram-v2-4FDKWEC3-DuQ7UaeU-inxlx8mu.js","assets/journeyDiagram-XKPGCS4Q-CfjB2Qdf-eAKcN11v.js","assets/timeline-definition-IT6M3QCI-Cs3NnF2M-D8q8kkZf.js","assets/mindmap-definition-VGOIOE7T-Dj37RkY_-DyeS1Pwn.js","assets/kanban-definition-3W4ZIXB7-CrW8yVmd-B4tOzBLu.js","assets/diagram-S2PKOQOG-IEqaDwzi-BRHi8-EX.js","assets/diagram-QEK2KX5R-BDO6hKtm-B109ByVS.js","assets/blockDiagram-VD42YOAC-zcRIdFTD-HLuQkjMh.js","assets/architectureDiagram-VXUJARFQ-BiqZtsDe-Cfz2CqoK.js","assets/diagram-PSM6KHXK-DNX818To-vH-oMigw.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-DX8gNHmJ-B7b_LYv7.js","assets/graph-BpcfrHXY-CQbhxCN2.js","assets/_baseUniq-BPMphbq5-CPjfCsrD.js","assets/layout-bsfAhWjc-DEuHffo5.js","assets/min-C2aDz5ZK-_oBiM5es.js","assets/clone-CsNB4mMi-BFfekQWu.js","assets/cose-bilkent-S5V4N54A-BRr2Y6dg-BLK_nh3w.js","assets/cytoscape.esm-CjI2IsL8-Da6dFVsf.js","assets/c4Diagram-YG6GDRKO-DYXNcDX4-l2nks34z.js","assets/chunk-TZMSLE5B-G2jJHqli-CumqsxEs.js","assets/flowDiagram-NV44I4VS-pJlHae8Y-Ev71T-8E.js","assets/chunk-FMBD7UC4-DdcCR8w3-D-bfFKsw.js","assets/chunk-55IACEB6-Cza7pcpr-B6XoRNM7.js","assets/chunk-QN33PNHL-v6AkzOl1-BWs-tIow.js","assets/channel-CUIutAfm-pI9TF54v.js","assets/erDiagram-Q2GNP2WA-DbLpN8Jp-BZ_v88L3.js","assets/gitGraphDiagram-NY62KEGX-DgYonpsZ-CoJwCAaB.js","assets/chunk-4BX2VUAB-DAh9ktmY-KWGt6_9H.js","assets/chunk-QZHKN3VN-DVJOrqBZ-CQn3XpCN.js","assets/treemap-KMMF4GRG-CkW25-tn-B949m5oF.js","assets/infoDiagram-WHAUD3N6-C3JLOAnb-DLC9Ky2f.js","assets/pieDiagram-ADFJNKIX-BiQvDx8I-CIbkMrvT.js","assets/arc-D9rhTKV0-DYz8o6uc.js","assets/requirementDiagram-UZGBJVZJ-km07nlVd-CFFR6F1J.js","assets/sequenceDiagram-WL72ISMW-CQ4J-0_7-ZRF7L80_.js","assets/classDiagram-2ON5EDUG-CxmgTanh-K5CqCJ46.js","assets/chunk-B4BG7PRW-BTUSpeKy-DQE1LIBz.js","assets/classDiagram-v2-WZHVMYZB-CxmgTanh-K5CqCJ46.js","assets/stateDiagram-FKZM4ZOC-JtogJwt6-BCLNECzQ.js","assets/chunk-DI55MBZ5-DKt4WII7-BLntGzxd.js","assets/stateDiagram-v2-4FDKWEC3-DuQ7UaeU-DngwO9wu.js","assets/journeyDiagram-XKPGCS4Q-CfjB2Qdf-BACGbkJF.js","assets/timeline-definition-IT6M3QCI-Cs3NnF2M-DypRUg2c.js","assets/mindmap-definition-VGOIOE7T-Dj37RkY_-PyW77bMN.js","assets/kanban-definition-3W4ZIXB7-CrW8yVmd-BnwY45Lx.js","assets/diagram-S2PKOQOG-IEqaDwzi-DAshyIbn.js","assets/diagram-QEK2KX5R-BDO6hKtm-Dr2Me9_V.js","assets/blockDiagram-VD42YOAC-zcRIdFTD-DjqpPrHK.js","assets/architectureDiagram-VXUJARFQ-BiqZtsDe-PQNQsxA5.js","assets/diagram-PSM6KHXK-DNX818To-D0ZFUpMu.js"])))=>i.map(i=>d[i]);
2
2
  var ase=Object.defineProperty;var sse=(e,t,r)=>t in e?ase(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var pA=(e,t,r)=>sse(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))n(A);new MutationObserver(A=>{for(const i of A)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(A){const i={};return A.integrity&&(i.integrity=A.integrity),A.referrerPolicy&&(i.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?i.credentials="include":A.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(A){if(A.ep)return;A.ep=!0;const i=r(A);fetch(A.href,i)}})();function ose(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var GV={exports:{}},Rf={},RV={exports:{}},Mt={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -847,8 +847,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
847
847
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const n=e.x,A=e.y,i=Math.abs(n-r.x),a=e.width/2;let s=r.x<t.x?a-i:a+i;const o=e.height/2,l=Math.abs(t.y-r.y),c=Math.abs(t.x-r.x);if(Math.abs(A-t.y)*a>Math.abs(n-t.x)*o){let u=r.y<t.y?t.y-o-A:A-o-t.y;s=c*u/l;const g={x:r.x<t.x?r.x+s:r.x-c+s,y:r.y<t.y?r.y+l-u:r.y-l+u};return s===0&&(g.x=t.x,g.y=t.y),c===0&&(g.x=t.x),l===0&&(g.y=t.y),ge.debug(`abc89 top/bottom calc, Q ${l}, q ${u}, R ${c}, r ${s}`,g),g}else{r.x<t.x?s=t.x-a-n:s=n-a-t.x;let u=l*s/c,g=r.x<t.x?r.x+c-s:r.x-c+s,d=r.y<t.y?r.y+u:r.y-u;return ge.debug(`sides calc abc89, Q ${l}, q ${u}, R ${c}, r ${s}`,{_x:g,_y:d}),s===0&&(g=t.x,d=t.y),c===0&&(g=t.x),l===0&&(d=t.y),{x:g,y:d}}},"intersection"),GO=F((e,t)=>{ge.warn("abc88 cutPathAtIntersect",e,t);let r=[],n=e[0],A=!1;return e.forEach(i=>{if(ge.info("abc88 checking point",i,t),!Kje(t,i)&&!A){const a=Vje(t,n,i);ge.debug("abc88 inside",i,n,a),ge.debug("abc88 intersection",a,t);let s=!1;r.forEach(o=>{s=s||o.x===a.x&&o.y===a.y}),r.some(o=>o.x===a.x&&o.y===a.y)?ge.warn("abc88 no intersect",a,r):r.push(a),A=!0}else ge.warn("abc88 outside",i,n),n=i,A||r.push(i)}),ge.debug("returning points",r),r},"cutPathAtIntersect");function Rte(e){const t=[],r=[];for(let n=1;n<e.length-1;n++){const A=e[n-1],i=e[n],a=e[n+1];(A.x===i.x&&i.y===a.y&&Math.abs(i.x-a.x)>5&&Math.abs(i.y-A.y)>5||A.y===i.y&&i.x===a.x&&Math.abs(i.x-A.x)>5&&Math.abs(i.y-a.y)>5)&&(t.push(i),r.push(n))}return{cornerPoints:t,cornerPointPositions:r}}F(Rte,"extractCornerPoints");var RO=F(function(e,t,r){const n=t.x-e.x,A=t.y-e.y,i=Math.sqrt(n*n+A*A),a=r/i;return{x:t.x-a*n,y:t.y-a*A}},"findAdjacentPoint"),Xje=F(function(e){const{cornerPointPositions:t}=Rte(e),r=[];for(let n=0;n<e.length;n++)if(t.includes(n)){const A=e[n-1],i=e[n+1],a=e[n],s=RO(A,a,5),o=RO(i,a,5),l=o.x-s.x,c=o.y-s.y;r.push(s);const u=Math.sqrt(2)*2;let g={x:a.x,y:a.y};if(Math.abs(i.x-A.x)>10&&Math.abs(i.y-A.y)>=10){ge.debug("Corner point fixing",Math.abs(i.x-A.x),Math.abs(i.y-A.y));const d=5;a.x===s.x?g={x:l<0?s.x-d+u:s.x+d-u,y:c<0?s.y-u:s.y+u}:g={x:l<0?s.x-u:s.x+u,y:c<0?s.y-d+u:s.y+d-u}}else ge.debug("Corner point skipping fixing",Math.abs(i.x-A.x),Math.abs(i.y-A.y));r.push(g,o)}else r.push(e[n]);return r},"fixCorners"),Zje=F((e,t,r)=>{const n=e-t-r,A=2,i=2,a=A+i,s=Math.floor(n/a),o=Array(s).fill(`${A} ${i}`).join(" ");return`0 ${t} ${o} ${r}`},"generateDashArray"),qje=F(function(e,t,r,n,A,i,a,s=!1){var o;const{handDrawnSeed:l}=Ot();let c=t.points,u=!1;const g=A;var d=i;const h=[];for(const v in t.cssCompiledStyles)h$(v)||h.push(t.cssCompiledStyles[v]);ge.debug("UIO intersect check",t.points,d.x,g.x),d.intersect&&g.intersect&&!s&&(c=c.slice(1,t.points.length-1),c.unshift(g.intersect(c[0])),ge.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],d,d.intersect(c[c.length-1])),c.push(d.intersect(c[c.length-1])));const B=btoa(JSON.stringify(c));t.toCluster&&(ge.info("to cluster abc88",r.get(t.toCluster)),c=GO(t.points,r.get(t.toCluster).node),u=!0),t.fromCluster&&(ge.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(c,null,2)),c=GO(c.reverse(),r.get(t.fromCluster).node).reverse(),u=!0);let f=c.filter(v=>!Number.isNaN(v.y));f=Xje(f);let w=Ud;switch(w=Rl,t.curve){case"linear":w=Rl;break;case"basis":w=Ud;break;case"cardinal":w=Cq;break;case"bumpX":w=GU;break;case"bumpY":w=RU;break;case"catmullRom":w=Mq;break;case"monotoneX":w=JU;break;case"monotoneY":w=OU;break;case"natural":w=WU;break;case"step":w=PU;break;case"stepAfter":w=VU;break;case"stepBefore":w=KU;break;default:w=Ud}const{x:p,y:m}=XUe(t),C=vU().x(p).y(m).curve(w);let E;switch(t.thickness){case"normal":E="edge-thickness-normal";break;case"thick":E="edge-thickness-thick";break;case"invisible":E="edge-thickness-invisible";break;default:E="edge-thickness-normal"}switch(t.pattern){case"solid":E+=" edge-pattern-solid";break;case"dotted":E+=" edge-pattern-dotted";break;case"dashed":E+=" edge-pattern-dashed";break;default:E+=" edge-pattern-solid"}let I,Q=t.curve==="rounded"?jte(zte(f,t),5):C(f);const N=Array.isArray(t.style)?t.style:[t.style];let k=N.find(v=>v==null?void 0:v.startsWith("stroke:")),x=!1;if(t.look==="handDrawn"){const v=Je.svg(e);Object.assign([],f);const L=v.path(Q,{roughness:.3,seed:l});E+=" transition",I=Ut(L).select("path").attr("id",t.id).attr("class"," "+E+(t.classes?" "+t.classes:"")).attr("style",N?N.reduce((R,O)=>R+";"+O,""):"");let J=I.attr("d");I.attr("d",J),e.node().appendChild(I.node())}else{const v=h.join(";"),L=N?N.reduce((G,X)=>G+X+";",""):"";let J="";t.animate&&(J=" edge-animation-fast"),t.animation&&(J=" edge-animation-"+t.animation);const R=(v?v+";"+L+";":L)+";"+(N?N.reduce((G,X)=>G+";"+X,""):"");I=e.append("path").attr("d",Q).attr("id",t.id).attr("class"," "+E+(t.classes?" "+t.classes:"")+(J??"")).attr("style",R),k=(o=R.match(/stroke:([^;]+)/))==null?void 0:o[1],x=t.animate===!0||!!t.animation||v.includes("animation");const O=I.node(),U=typeof O.getTotalLength=="function"?O.getTotalLength():0,P=$J[t.arrowTypeStart]||0,re=$J[t.arrowTypeEnd]||0;if(t.look==="neo"&&!x){const G=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?Zje(U,P,re):`0 ${P} ${U-P-re} ${re}`}; stroke-dashoffset: 0;`;I.attr("style",G+I.attr("style"))}}I.attr("data-edge",!0),I.attr("data-et","edge"),I.attr("data-id",t.id),I.attr("data-points",B),t.showPoints&&f.forEach(v=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",v.x).attr("cy",v.y)});let D="";(Ot().flowchart.arrowMarkerAbsolute||Ot().state.arrowMarkerAbsolute)&&(D=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,D=D.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),ge.info("arrowTypeStart",t.arrowTypeStart),ge.info("arrowTypeEnd",t.arrowTypeEnd),Jje(I,t,D,a,n,k);const z=Math.floor(c.length/2),H=c[z];zi.isLabelCoordinateInPath(H,I.attr("d"))||(u=!0);let T={};return u&&(T.updatedPath=c),T.originalPath=t.points,T},"insertEdge");function jte(e,t){if(e.length<2)return"";let r="";const n=e.length,A=1e-5;for(let i=0;i<n;i++){const a=e[i],s=e[i-1],o=e[i+1];if(i===0)r+=`M${a.x},${a.y}`;else if(i===n-1)r+=`L${a.x},${a.y}`;else{const l=a.x-s.x,c=a.y-s.y,u=o.x-a.x,g=o.y-a.y,d=Math.hypot(l,c),h=Math.hypot(u,g);if(d<A||h<A){r+=`L${a.x},${a.y}`;continue}const B=l/d,f=c/d,w=u/h,p=g/h,m=B*w+f*p,C=Math.max(-1,Math.min(1,m)),E=Math.acos(C);if(E<A||Math.abs(Math.PI-E)<A){r+=`L${a.x},${a.y}`;continue}const I=Math.min(t/Math.sin(E/2),d/2,h/2),Q=a.x-B*I,N=a.y-f*I,k=a.x+w*I,x=a.y+p*I;r+=`L${Q},${N}`,r+=`Q${a.x},${a.y} ${k},${x}`}}return r}F(jte,"generateRoundedPath");function _x(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const r=t.x-e.x,n=t.y-e.y;return{angle:Math.atan2(n,r),deltaX:r,deltaY:n}}F(_x,"calculateDeltaAndAngle");function zte(e,t){const r=e.map(A=>({...A}));if(e.length>=2&&Ln[t.arrowTypeStart]){const A=Ln[t.arrowTypeStart],i=e[0],a=e[1],{angle:s}=_x(i,a),o=A*Math.cos(s),l=A*Math.sin(s);r[0].x=i.x+o,r[0].y=i.y+l}const n=e.length;if(n>=2&&Ln[t.arrowTypeEnd]){const A=Ln[t.arrowTypeEnd],i=e[n-1],a=e[n-2],{angle:s}=_x(a,i),o=A*Math.cos(s),l=A*Math.sin(s);r[n-1].x=i.x-o,r[n-1].y=i.y-l}return r}F(zte,"applyMarkerOffsetsToPoints");var _je=F((e,t,r,n)=>{t.forEach(A=>{hze[A](e,r,n)})},"insertMarkers"),$je=F((e,t,r)=>{ge.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),eze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),tze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),rze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),nze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Aze=F((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),ize=F((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),aze=F((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),sze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),oze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),lze=F((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),n.append("path").attr("d","M9,0 L9,18");const A=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");A.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),A.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),cze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),uze=F((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),n.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const A=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");A.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),A.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),gze=F((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
848
848
  L20,10
849
849
  M20,10
850
- L0,20`)},"requirement_arrow"),dze=F((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),hze={extension:$je,composition:eze,aggregation:tze,dependency:rze,lollipop:nze,point:Aze,circle:ize,cross:aze,barb:sze,only_one:oze,zero_or_one:lze,one_or_more:cze,zero_or_more:uze,requirement_arrow:gze,requirement_contains:dze},Bze=_je,pze={common:Wu,getConfig:Pn,insertCluster:Qje,insertEdge:qje,insertEdgeLabel:Wje,insertMarkers:Bze,insertNode:Gte,interpolateToCurve:s2,labelHelper:nt,log:ge,positionEdgeLabel:Pje},Ih={},Tte=F(e=>{for(const t of e)Ih[t.name]=t},"registerLayoutLoaders"),wze=F(()=>{Tte([{name:"dagre",loader:F(async()=>await kt(()=>import("./dagre-6UL2VRFP-DX8gNHmJ-CixEb2yy.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:F(async()=>await kt(()=>import("./cose-bilkent-S5V4N54A-BRr2Y6dg-CQFKGWM3.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");wze();var wet=F(async(e,t)=>{if(!(e.layoutAlgorithm in Ih))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=Ih[e.layoutAlgorithm];return(await r.loader()).render(e,t,pze,{algorithm:r.algorithm})},"render"),fet=F((e="",{fallback:t="dagre"}={})=>{if(e in Ih)return e;if(t in Ih)return ge.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Lte="comm",Hte="rule",Jte="decl",fze="@import",mze="@namespace",Eze="@keyframes",Ize="@layer",Ote=Math.abs,Y2=String.fromCharCode;function Wte(e){return e.trim()}function f0(e,t,r){return e.replace(t,r)}function yze(e,t,r){return e.indexOf(t,r)}function su(e,t){return e.charCodeAt(t)|0}function bu(e,t,r){return e.slice(t,r)}function ca(e){return e.length}function Cze(e){return e.length}function Yp(e,t){return t.push(e),e}var qm=1,xu=1,Pte=0,Ei=0,$r=0,qu="";function N2(e,t,r,n,A,i,a,s){return{value:e,root:t,parent:r,type:n,props:A,children:i,line:qm,column:xu,length:a,return:"",siblings:s}}function Qze(){return $r}function Mze(){return $r=Ei>0?su(qu,--Ei):0,xu--,$r===10&&(xu=1,qm--),$r}function Pi(){return $r=Ei<Pte?su(qu,Ei++):0,xu++,$r===10&&(xu=1,qm++),$r}function ao(){return su(qu,Ei)}function m0(){return Ei}function _m(e,t){return bu(qu,e,t)}function yh(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Fze(e){return qm=xu=1,Pte=ca(qu=e),Ei=0,[]}function Yze(e){return qu="",e}function hN(e){return Wte(_m(Ei-1,$x(e===91?e+2:e===40?e+1:e)))}function Nze(e){for(;($r=ao())&&$r<33;)Pi();return yh(e)>2||yh($r)>3?"":" "}function bze(e,t){for(;--t&&Pi()&&!($r<48||$r>102||$r>57&&$r<65||$r>70&&$r<97););return _m(e,m0()+(t<6&&ao()==32&&Pi()==32))}function $x(e){for(;Pi();)switch($r){case e:return Ei;case 34:case 39:e!==34&&e!==39&&$x($r);break;case 40:e===41&&$x(e);break;case 92:Pi();break}return Ei}function xze(e,t){for(;Pi()&&e+$r!==57&&!(e+$r===84&&ao()===47););return"/*"+_m(t,Ei-1)+"*"+Y2(e===47?e:Pi())}function Dze(e){for(;!yh(ao());)Pi();return _m(e,Ei)}function kze(e){return Yze(E0("",null,null,null,[""],e=Fze(e),0,[0],e))}function E0(e,t,r,n,A,i,a,s,o){for(var l=0,c=0,u=a,g=0,d=0,h=0,B=1,f=1,w=1,p=0,m="",C=A,E=i,I=n,Q=m;f;)switch(h=p,p=Pi()){case 40:if(h!=108&&su(Q,u-1)==58){yze(Q+=f0(hN(p),"&","&\f"),"&\f",Ote(l?s[l-1]:0))!=-1&&(w=-1);break}case 34:case 39:case 91:Q+=hN(p);break;case 9:case 10:case 13:case 32:Q+=Nze(h);break;case 92:Q+=bze(m0()-1,7);continue;case 47:switch(ao()){case 42:case 47:Yp(Sze(xze(Pi(),m0()),t,r,o),o),(yh(h||1)==5||yh(ao()||1)==5)&&ca(Q)&&bu(Q,-1,void 0)!==" "&&(Q+=" ");break;default:Q+="/"}break;case 123*B:s[l++]=ca(Q)*w;case 125*B:case 59:case 0:switch(p){case 0:case 125:f=0;case 59+c:w==-1&&(Q=f0(Q,/\f/g,"")),d>0&&(ca(Q)-u||B===0&&h===47)&&Yp(d>32?zO(Q+";",n,r,u-1,o):zO(f0(Q," ","")+";",n,r,u-2,o),o);break;case 59:Q+=";";default:if(Yp(I=jO(Q,t,r,l,c,A,s,m,C=[],E=[],u,i),i),p===123)if(c===0)E0(Q,t,I,I,C,i,u,s,E);else{switch(g){case 99:if(su(Q,3)===110)break;case 108:if(su(Q,2)===97)break;default:c=0;case 100:case 109:case 115:}c?E0(e,I,I,n&&Yp(jO(e,I,I,0,0,A,s,m,A,C=[],u,E),E),A,E,u,s,n?C:E):E0(Q,I,I,I,[""],E,0,s,E)}}l=c=d=0,B=w=1,m=Q="",u=a;break;case 58:u=1+ca(Q),d=h;default:if(B<1){if(p==123)--B;else if(p==125&&B++==0&&Mze()==125)continue}switch(Q+=Y2(p),p*B){case 38:w=c>0?1:(Q+="\f",-1);break;case 44:s[l++]=(ca(Q)-1)*w,w=1;break;case 64:ao()===45&&(Q+=hN(Pi())),g=ao(),c=u=ca(m=Q+=Dze(m0())),p++;break;case 45:h===45&&ca(Q)==2&&(B=0)}}return i}function jO(e,t,r,n,A,i,a,s,o,l,c,u){for(var g=A-1,d=A===0?i:[""],h=Cze(d),B=0,f=0,w=0;B<n;++B)for(var p=0,m=bu(e,g+1,g=Ote(f=a[B])),C=e;p<h;++p)(C=Wte(f>0?d[p]+" "+m:f0(m,/&\f/g,d[p])))&&(o[w++]=C);return N2(e,t,r,A===0?Hte:s,o,l,c,u)}function Sze(e,t,r,n){return N2(e,t,r,Lte,Y2(Qze()),bu(e,2,-2),0,n)}function zO(e,t,r,n,A){return N2(e,t,r,Jte,bu(e,0,n),bu(e,n+1,-1),n,A)}function eD(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Uze(e,t,r,n){switch(e.type){case Ize:if(e.children.length)break;case fze:case mze:case Jte:return e.return=e.return||e.value;case Lte:return"";case Eze:return e.return=e.value+"{"+eD(e.children,n)+"}";case Hte:if(!ca(e.value=e.props.join(",")))return""}return ca(r=eD(e.children,n))?e.return=e.value+"{"+r+"}":""}var vze=f$(Object.keys,Object),Gze=Object.prototype,Rze=Gze.hasOwnProperty;function jze(e){if(!Lm(e))return vze(e);var t=[];for(var r in Object(e))Rze.call(e,r)&&r!="constructor"&&t.push(r);return t}var tD=oc(xa,"DataView"),rD=oc(xa,"Promise"),nD=oc(xa,"Set"),AD=oc(xa,"WeakMap"),TO="[object Map]",zze="[object Object]",LO="[object Promise]",HO="[object Set]",JO="[object WeakMap]",OO="[object DataView]",Tze=sc(tD),Lze=sc(mh),Hze=sc(rD),Jze=sc(nD),Oze=sc(AD),el=Vu;(tD&&el(new tD(new ArrayBuffer(1)))!=OO||mh&&el(new mh)!=TO||rD&&el(rD.resolve())!=LO||nD&&el(new nD)!=HO||AD&&el(new AD)!=JO)&&(el=function(e){var t=Vu(e),r=t==zze?e.constructor:void 0,n=r?sc(r):"";if(n)switch(n){case Tze:return OO;case Lze:return TO;case Hze:return LO;case Jze:return HO;case Oze:return JO}return t});var Wze="[object Map]",Pze="[object Set]",Kze=Object.prototype,Vze=Kze.hasOwnProperty;function WO(e){if(e==null)return!0;if(Hm(e)&&(Lw(e)||typeof e=="string"||typeof e.splice=="function"||i2(e)||a2(e)||Tw(e)))return!e.length;var t=el(e);if(t==Wze||t==Pze)return!e.size;if(Lm(e))return!jze(e).length;for(var r in e)if(Vze.call(e,r))return!1;return!0}var Kte="c4",Xze=F(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Zze=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-DYXNcDX4-pgzzzS-m.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:Kte,diagram:e}},"loader"),qze={id:Kte,detector:Xze,loader:Zze},_ze=qze,Vte="flowchart",$ze=F((e,t)=>{var r,n;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),eTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-pJlHae8Y-DifGWDqr.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Vte,diagram:e}},"loader"),tTe={id:Vte,detector:$ze,loader:eTe},rTe=tTe,Xte="flowchart-v2",nTe=F((e,t)=>{var r,n,A;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((A=t==null?void 0:t.flowchart)==null?void 0:A.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),ATe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-pJlHae8Y-DifGWDqr.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Xte,diagram:e}},"loader"),iTe={id:Xte,detector:nTe,loader:ATe},aTe=iTe,Zte="er",sTe=F(e=>/^\s*erDiagram/.test(e),"detector"),oTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-DbLpN8Jp-Bs0Sf7As.js");return{diagram:t}},__vite__mapDeps([15,12,13,14]));return{id:Zte,diagram:e}},"loader"),lTe={id:Zte,detector:sTe,loader:oTe},cTe=lTe,qte="gitGraph",uTe=F(e=>/^\s*gitGraph/.test(e),"detector"),gTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-DgYonpsZ-Ck9sEXvB.js");return{diagram:t}},__vite__mapDeps([16,17,18,19,4,2]));return{id:qte,diagram:e}},"loader"),dTe={id:qte,detector:uTe,loader:gTe},hTe=dTe,_te="gantt",BTe=F(e=>/^\s*gantt/.test(e),"detector"),pTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-J0Tkq5TR-CzwkzRjB.js");return{diagram:t}},[]);return{id:_te,diagram:e}},"loader"),wTe={id:_te,detector:BTe,loader:pTe},fTe=wTe,$te="info",mTe=F(e=>/^\s*info/.test(e),"detector"),ETe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./infoDiagram-WHAUD3N6-C3JLOAnb-MFqHXhs9.js");return{diagram:t}},__vite__mapDeps([20,19,4,2]));return{id:$te,diagram:e}},"loader"),ITe={id:$te,detector:mTe,loader:ETe},ere="pie",yTe=F(e=>/^\s*pie/.test(e),"detector"),CTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-BiQvDx8I-BVlu4DP6.js");return{diagram:t}},__vite__mapDeps([21,17,19,4,2,22]));return{id:ere,diagram:e}},"loader"),QTe={id:ere,detector:yTe,loader:CTe},tre="quadrantChart",MTe=F(e=>/^\s*quadrantChart/.test(e),"detector"),FTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-D4b-YFzI-20vwDb_g.js");return{diagram:t}},[]);return{id:tre,diagram:e}},"loader"),YTe={id:tre,detector:MTe,loader:FTe},NTe=YTe,rre="xychart",bTe=F(e=>/^\s*xychart(-beta)?/.test(e),"detector"),xTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-JzAaXa5z-B80gGLiB.js");return{diagram:t}},[]);return{id:rre,diagram:e}},"loader"),DTe={id:rre,detector:bTe,loader:xTe},kTe=DTe,nre="requirement",STe=F(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),UTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-km07nlVd-BHhJviAO.js");return{diagram:t}},__vite__mapDeps([23,12,13]));return{id:nre,diagram:e}},"loader"),vTe={id:nre,detector:STe,loader:UTe},GTe=vTe,Are="sequence",RTe=F(e=>/^\s*sequenceDiagram/.test(e),"detector"),jTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-CQ4J-0_7-VooKtF0A.js");return{diagram:t}},__vite__mapDeps([24,9,18]));return{id:Are,diagram:e}},"loader"),zTe={id:Are,detector:RTe,loader:jTe},TTe=zTe,ire="class",LTe=F((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),HTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-CxmgTanh-CrvwueYy.js");return{diagram:t}},__vite__mapDeps([25,26,11,12,13]));return{id:ire,diagram:e}},"loader"),JTe={id:ire,detector:LTe,loader:HTe},OTe=JTe,are="classDiagram",WTe=F((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),PTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-CxmgTanh-CrvwueYy.js");return{diagram:t}},__vite__mapDeps([27,26,11,12,13]));return{id:are,diagram:e}},"loader"),KTe={id:are,detector:WTe,loader:PTe},VTe=KTe,sre="state",XTe=F((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),ZTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-JtogJwt6-D7AvQ8nY.js");return{diagram:t}},__vite__mapDeps([28,29,12,13,1,2,3,4]));return{id:sre,diagram:e}},"loader"),qTe={id:sre,detector:XTe,loader:ZTe},_Te=qTe,ore="stateDiagram",$Te=F((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),eLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-DuQ7UaeU-inxlx8mu.js");return{diagram:t}},__vite__mapDeps([30,29,12,13]));return{id:ore,diagram:e}},"loader"),tLe={id:ore,detector:$Te,loader:eLe},rLe=tLe,lre="journey",nLe=F(e=>/^\s*journey/.test(e),"detector"),ALe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-CfjB2Qdf-eAKcN11v.js");return{diagram:t}},__vite__mapDeps([31,9,11,22]));return{id:lre,diagram:e}},"loader"),iLe={id:lre,detector:nLe,loader:ALe},aLe=iLe,sLe=F((e,t,r)=>{ge.debug(`rendering svg for syntax error
851
- `);const n=LSe(t),A=n.append("g");n.attr("viewBox","0 0 2412 512"),nZ(n,100,512,!0),A.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),A.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),A.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),A.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),A.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),A.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),A.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),A.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),cre={draw:sLe},oLe=cre,lLe={db:{},renderer:cre,parser:{parse:F(()=>{},"parse")}},cLe=lLe,ure="flowchart-elk",uLe=F((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),gLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-pJlHae8Y-DifGWDqr.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:ure,diagram:e}},"loader"),dLe={id:ure,detector:uLe,loader:gLe},hLe=dLe,gre="timeline",BLe=F(e=>/^\s*timeline/.test(e),"detector"),pLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-Cs3NnF2M-D8q8kkZf.js");return{diagram:t}},__vite__mapDeps([32,22]));return{id:gre,diagram:e}},"loader"),wLe={id:gre,detector:BLe,loader:pLe},fLe=wLe,dre="mindmap",mLe=F(e=>/^\s*mindmap/.test(e),"detector"),ELe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-Dj37RkY_-DyeS1Pwn.js");return{diagram:t}},__vite__mapDeps([33,12,13]));return{id:dre,diagram:e}},"loader"),ILe={id:dre,detector:mLe,loader:ELe},yLe=ILe,hre="kanban",CLe=F(e=>/^\s*kanban/.test(e),"detector"),QLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-CrW8yVmd-B4tOzBLu.js");return{diagram:t}},__vite__mapDeps([34,11]));return{id:hre,diagram:e}},"loader"),MLe={id:hre,detector:CLe,loader:QLe},FLe=MLe,Bre="sankey",YLe=F(e=>/^\s*sankey(-beta)?/.test(e),"detector"),NLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-LfuSRRbf-BtP8n9t9.js");return{diagram:t}},[]);return{id:Bre,diagram:e}},"loader"),bLe={id:Bre,detector:YLe,loader:NLe},xLe=bLe,pre="packet",DLe=F(e=>/^\s*packet(-beta)?/.test(e),"detector"),kLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-IEqaDwzi-BRHi8-EX.js");return{diagram:t}},__vite__mapDeps([35,17,19,4,2]));return{id:pre,diagram:e}},"loader"),SLe={id:pre,detector:DLe,loader:kLe},wre="radar",ULe=F(e=>/^\s*radar-beta/.test(e),"detector"),vLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-BDO6hKtm-B109ByVS.js");return{diagram:t}},__vite__mapDeps([36,17,19,4,2]));return{id:wre,diagram:e}},"loader"),GLe={id:wre,detector:ULe,loader:vLe},fre="block",RLe=F(e=>/^\s*block(-beta)?/.test(e),"detector"),jLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-zcRIdFTD-HLuQkjMh.js");return{diagram:t}},__vite__mapDeps([37,11,5,1,2,14]));return{id:fre,diagram:e}},"loader"),zLe={id:fre,detector:RLe,loader:jLe},TLe=zLe,mre="architecture",LLe=F(e=>/^\s*architecture/.test(e),"detector"),HLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-BiqZtsDe-Cfz2CqoK.js");return{diagram:t}},__vite__mapDeps([38,17,19,4,2,7]));return{id:mre,diagram:e}},"loader"),JLe={id:mre,detector:LLe,loader:HLe},OLe=JLe,Ere="treemap",WLe=F(e=>/^\s*treemap/.test(e),"detector"),PLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-DNX818To-vH-oMigw.js");return{diagram:t}},__vite__mapDeps([39,13,17,19,4,2]));return{id:Ere,diagram:e}},"loader"),KLe={id:Ere,detector:WLe,loader:PLe},PO=!1,$m=F(()=>{PO||(PO=!0,hw("error",cLe,e=>e.toLowerCase().trim()==="error"),hw("---",{db:{clear:F(()=>{},"clear")},styles:{},renderer:{draw:F(()=>{},"draw")},parser:{parse:F(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:F(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),ix(hLe,yLe,OLe),ix(_ze,FLe,VTe,OTe,cTe,fTe,ITe,QTe,GTe,TTe,aTe,rTe,fLe,hTe,rLe,_Te,aLe,NTe,xLe,SLe,kTe,TLe,GLe,KLe))},"addDiagrams"),VLe=F(async()=>{ge.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(Sl).map(async([t,{detector:r,loader:n}])=>{if(n)try{lx(t)}catch{try{const{diagram:A,id:i}=await n();hw(i,A,r)}catch(A){throw ge.error(`Failed to load external diagram with key ${t}. Removing from detectors.`),delete Sl[t],A}}}))).filter(t=>t.status==="rejected");if(e.length>0){ge.error(`Failed to load ${e.length} external diagrams`);for(const t of e)ge.error(t);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),XLe="graphics-document document";function Ire(e,t){e.attr("role",XLe),t!==""&&e.attr("aria-roledescription",t)}F(Ire,"setA11yDiagramInfo");function yre(e,t,r,n){if(e.insert!==void 0){if(r){const A=`chart-desc-${n}`;e.attr("aria-describedby",A),e.insert("desc",":first-child").attr("id",A).text(r)}if(t){const A=`chart-title-${n}`;e.attr("aria-labelledby",A),e.insert("title",":first-child").attr("id",A).text(t)}}}F(yre,"addSVGa11yTitleDescription");var Np,iD=(Np=class{constructor(e,t,r,n,A){this.type=e,this.text=t,this.db=r,this.parser=n,this.renderer=A}static async fromText(e,t={}){var r,n;const A=Pn(),i=$S(e,A);e=KGe(e)+`
850
+ L0,20`)},"requirement_arrow"),dze=F((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),hze={extension:$je,composition:eze,aggregation:tze,dependency:rze,lollipop:nze,point:Aze,circle:ize,cross:aze,barb:sze,only_one:oze,zero_or_one:lze,one_or_more:cze,zero_or_more:uze,requirement_arrow:gze,requirement_contains:dze},Bze=_je,pze={common:Wu,getConfig:Pn,insertCluster:Qje,insertEdge:qje,insertEdgeLabel:Wje,insertMarkers:Bze,insertNode:Gte,interpolateToCurve:s2,labelHelper:nt,log:ge,positionEdgeLabel:Pje},Ih={},Tte=F(e=>{for(const t of e)Ih[t.name]=t},"registerLayoutLoaders"),wze=F(()=>{Tte([{name:"dagre",loader:F(async()=>await kt(()=>import("./dagre-6UL2VRFP-DX8gNHmJ-B7b_LYv7.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:F(async()=>await kt(()=>import("./cose-bilkent-S5V4N54A-BRr2Y6dg-BLK_nh3w.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");wze();var wet=F(async(e,t)=>{if(!(e.layoutAlgorithm in Ih))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const r=Ih[e.layoutAlgorithm];return(await r.loader()).render(e,t,pze,{algorithm:r.algorithm})},"render"),fet=F((e="",{fallback:t="dagre"}={})=>{if(e in Ih)return e;if(t in Ih)return ge.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),Lte="comm",Hte="rule",Jte="decl",fze="@import",mze="@namespace",Eze="@keyframes",Ize="@layer",Ote=Math.abs,Y2=String.fromCharCode;function Wte(e){return e.trim()}function f0(e,t,r){return e.replace(t,r)}function yze(e,t,r){return e.indexOf(t,r)}function su(e,t){return e.charCodeAt(t)|0}function bu(e,t,r){return e.slice(t,r)}function ca(e){return e.length}function Cze(e){return e.length}function Yp(e,t){return t.push(e),e}var qm=1,xu=1,Pte=0,Ei=0,$r=0,qu="";function N2(e,t,r,n,A,i,a,s){return{value:e,root:t,parent:r,type:n,props:A,children:i,line:qm,column:xu,length:a,return:"",siblings:s}}function Qze(){return $r}function Mze(){return $r=Ei>0?su(qu,--Ei):0,xu--,$r===10&&(xu=1,qm--),$r}function Pi(){return $r=Ei<Pte?su(qu,Ei++):0,xu++,$r===10&&(xu=1,qm++),$r}function ao(){return su(qu,Ei)}function m0(){return Ei}function _m(e,t){return bu(qu,e,t)}function yh(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Fze(e){return qm=xu=1,Pte=ca(qu=e),Ei=0,[]}function Yze(e){return qu="",e}function hN(e){return Wte(_m(Ei-1,$x(e===91?e+2:e===40?e+1:e)))}function Nze(e){for(;($r=ao())&&$r<33;)Pi();return yh(e)>2||yh($r)>3?"":" "}function bze(e,t){for(;--t&&Pi()&&!($r<48||$r>102||$r>57&&$r<65||$r>70&&$r<97););return _m(e,m0()+(t<6&&ao()==32&&Pi()==32))}function $x(e){for(;Pi();)switch($r){case e:return Ei;case 34:case 39:e!==34&&e!==39&&$x($r);break;case 40:e===41&&$x(e);break;case 92:Pi();break}return Ei}function xze(e,t){for(;Pi()&&e+$r!==57&&!(e+$r===84&&ao()===47););return"/*"+_m(t,Ei-1)+"*"+Y2(e===47?e:Pi())}function Dze(e){for(;!yh(ao());)Pi();return _m(e,Ei)}function kze(e){return Yze(E0("",null,null,null,[""],e=Fze(e),0,[0],e))}function E0(e,t,r,n,A,i,a,s,o){for(var l=0,c=0,u=a,g=0,d=0,h=0,B=1,f=1,w=1,p=0,m="",C=A,E=i,I=n,Q=m;f;)switch(h=p,p=Pi()){case 40:if(h!=108&&su(Q,u-1)==58){yze(Q+=f0(hN(p),"&","&\f"),"&\f",Ote(l?s[l-1]:0))!=-1&&(w=-1);break}case 34:case 39:case 91:Q+=hN(p);break;case 9:case 10:case 13:case 32:Q+=Nze(h);break;case 92:Q+=bze(m0()-1,7);continue;case 47:switch(ao()){case 42:case 47:Yp(Sze(xze(Pi(),m0()),t,r,o),o),(yh(h||1)==5||yh(ao()||1)==5)&&ca(Q)&&bu(Q,-1,void 0)!==" "&&(Q+=" ");break;default:Q+="/"}break;case 123*B:s[l++]=ca(Q)*w;case 125*B:case 59:case 0:switch(p){case 0:case 125:f=0;case 59+c:w==-1&&(Q=f0(Q,/\f/g,"")),d>0&&(ca(Q)-u||B===0&&h===47)&&Yp(d>32?zO(Q+";",n,r,u-1,o):zO(f0(Q," ","")+";",n,r,u-2,o),o);break;case 59:Q+=";";default:if(Yp(I=jO(Q,t,r,l,c,A,s,m,C=[],E=[],u,i),i),p===123)if(c===0)E0(Q,t,I,I,C,i,u,s,E);else{switch(g){case 99:if(su(Q,3)===110)break;case 108:if(su(Q,2)===97)break;default:c=0;case 100:case 109:case 115:}c?E0(e,I,I,n&&Yp(jO(e,I,I,0,0,A,s,m,A,C=[],u,E),E),A,E,u,s,n?C:E):E0(Q,I,I,I,[""],E,0,s,E)}}l=c=d=0,B=w=1,m=Q="",u=a;break;case 58:u=1+ca(Q),d=h;default:if(B<1){if(p==123)--B;else if(p==125&&B++==0&&Mze()==125)continue}switch(Q+=Y2(p),p*B){case 38:w=c>0?1:(Q+="\f",-1);break;case 44:s[l++]=(ca(Q)-1)*w,w=1;break;case 64:ao()===45&&(Q+=hN(Pi())),g=ao(),c=u=ca(m=Q+=Dze(m0())),p++;break;case 45:h===45&&ca(Q)==2&&(B=0)}}return i}function jO(e,t,r,n,A,i,a,s,o,l,c,u){for(var g=A-1,d=A===0?i:[""],h=Cze(d),B=0,f=0,w=0;B<n;++B)for(var p=0,m=bu(e,g+1,g=Ote(f=a[B])),C=e;p<h;++p)(C=Wte(f>0?d[p]+" "+m:f0(m,/&\f/g,d[p])))&&(o[w++]=C);return N2(e,t,r,A===0?Hte:s,o,l,c,u)}function Sze(e,t,r,n){return N2(e,t,r,Lte,Y2(Qze()),bu(e,2,-2),0,n)}function zO(e,t,r,n,A){return N2(e,t,r,Jte,bu(e,0,n),bu(e,n+1,-1),n,A)}function eD(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Uze(e,t,r,n){switch(e.type){case Ize:if(e.children.length)break;case fze:case mze:case Jte:return e.return=e.return||e.value;case Lte:return"";case Eze:return e.return=e.value+"{"+eD(e.children,n)+"}";case Hte:if(!ca(e.value=e.props.join(",")))return""}return ca(r=eD(e.children,n))?e.return=e.value+"{"+r+"}":""}var vze=f$(Object.keys,Object),Gze=Object.prototype,Rze=Gze.hasOwnProperty;function jze(e){if(!Lm(e))return vze(e);var t=[];for(var r in Object(e))Rze.call(e,r)&&r!="constructor"&&t.push(r);return t}var tD=oc(xa,"DataView"),rD=oc(xa,"Promise"),nD=oc(xa,"Set"),AD=oc(xa,"WeakMap"),TO="[object Map]",zze="[object Object]",LO="[object Promise]",HO="[object Set]",JO="[object WeakMap]",OO="[object DataView]",Tze=sc(tD),Lze=sc(mh),Hze=sc(rD),Jze=sc(nD),Oze=sc(AD),el=Vu;(tD&&el(new tD(new ArrayBuffer(1)))!=OO||mh&&el(new mh)!=TO||rD&&el(rD.resolve())!=LO||nD&&el(new nD)!=HO||AD&&el(new AD)!=JO)&&(el=function(e){var t=Vu(e),r=t==zze?e.constructor:void 0,n=r?sc(r):"";if(n)switch(n){case Tze:return OO;case Lze:return TO;case Hze:return LO;case Jze:return HO;case Oze:return JO}return t});var Wze="[object Map]",Pze="[object Set]",Kze=Object.prototype,Vze=Kze.hasOwnProperty;function WO(e){if(e==null)return!0;if(Hm(e)&&(Lw(e)||typeof e=="string"||typeof e.splice=="function"||i2(e)||a2(e)||Tw(e)))return!e.length;var t=el(e);if(t==Wze||t==Pze)return!e.size;if(Lm(e))return!jze(e).length;for(var r in e)if(Vze.call(e,r))return!1;return!0}var Kte="c4",Xze=F(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Zze=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-DYXNcDX4-l2nks34z.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:Kte,diagram:e}},"loader"),qze={id:Kte,detector:Xze,loader:Zze},_ze=qze,Vte="flowchart",$ze=F((e,t)=>{var r,n;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-wrapper"||((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),eTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-pJlHae8Y-Ev71T-8E.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Vte,diagram:e}},"loader"),tTe={id:Vte,detector:$ze,loader:eTe},rTe=tTe,Xte="flowchart-v2",nTe=F((e,t)=>{var r,n,A;return((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="dagre-d3"?!1:(((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((A=t==null?void 0:t.flowchart)==null?void 0:A.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),ATe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-pJlHae8Y-Ev71T-8E.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Xte,diagram:e}},"loader"),iTe={id:Xte,detector:nTe,loader:ATe},aTe=iTe,Zte="er",sTe=F(e=>/^\s*erDiagram/.test(e),"detector"),oTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-DbLpN8Jp-BZ_v88L3.js");return{diagram:t}},__vite__mapDeps([15,12,13,14]));return{id:Zte,diagram:e}},"loader"),lTe={id:Zte,detector:sTe,loader:oTe},cTe=lTe,qte="gitGraph",uTe=F(e=>/^\s*gitGraph/.test(e),"detector"),gTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-DgYonpsZ-CoJwCAaB.js");return{diagram:t}},__vite__mapDeps([16,17,18,19,4,2]));return{id:qte,diagram:e}},"loader"),dTe={id:qte,detector:uTe,loader:gTe},hTe=dTe,_te="gantt",BTe=F(e=>/^\s*gantt/.test(e),"detector"),pTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-J0Tkq5TR-BjsMGwL5.js");return{diagram:t}},[]);return{id:_te,diagram:e}},"loader"),wTe={id:_te,detector:BTe,loader:pTe},fTe=wTe,$te="info",mTe=F(e=>/^\s*info/.test(e),"detector"),ETe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./infoDiagram-WHAUD3N6-C3JLOAnb-DLC9Ky2f.js");return{diagram:t}},__vite__mapDeps([20,19,4,2]));return{id:$te,diagram:e}},"loader"),ITe={id:$te,detector:mTe,loader:ETe},ere="pie",yTe=F(e=>/^\s*pie/.test(e),"detector"),CTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-BiQvDx8I-CIbkMrvT.js");return{diagram:t}},__vite__mapDeps([21,17,19,4,2,22]));return{id:ere,diagram:e}},"loader"),QTe={id:ere,detector:yTe,loader:CTe},tre="quadrantChart",MTe=F(e=>/^\s*quadrantChart/.test(e),"detector"),FTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-D4b-YFzI-_SGAkshM.js");return{diagram:t}},[]);return{id:tre,diagram:e}},"loader"),YTe={id:tre,detector:MTe,loader:FTe},NTe=YTe,rre="xychart",bTe=F(e=>/^\s*xychart(-beta)?/.test(e),"detector"),xTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-JzAaXa5z-ConZzQ2w.js");return{diagram:t}},[]);return{id:rre,diagram:e}},"loader"),DTe={id:rre,detector:bTe,loader:xTe},kTe=DTe,nre="requirement",STe=F(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),UTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-km07nlVd-CFFR6F1J.js");return{diagram:t}},__vite__mapDeps([23,12,13]));return{id:nre,diagram:e}},"loader"),vTe={id:nre,detector:STe,loader:UTe},GTe=vTe,Are="sequence",RTe=F(e=>/^\s*sequenceDiagram/.test(e),"detector"),jTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-CQ4J-0_7-ZRF7L80_.js");return{diagram:t}},__vite__mapDeps([24,9,18]));return{id:Are,diagram:e}},"loader"),zTe={id:Are,detector:RTe,loader:jTe},TTe=zTe,ire="class",LTe=F((e,t)=>{var r;return((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),HTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-CxmgTanh-K5CqCJ46.js");return{diagram:t}},__vite__mapDeps([25,26,11,12,13]));return{id:ire,diagram:e}},"loader"),JTe={id:ire,detector:LTe,loader:HTe},OTe=JTe,are="classDiagram",WTe=F((e,t)=>{var r;return/^\s*classDiagram/.test(e)&&((r=t==null?void 0:t.class)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),PTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-CxmgTanh-K5CqCJ46.js");return{diagram:t}},__vite__mapDeps([27,26,11,12,13]));return{id:are,diagram:e}},"loader"),KTe={id:are,detector:WTe,loader:PTe},VTe=KTe,sre="state",XTe=F((e,t)=>{var r;return((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),ZTe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-JtogJwt6-BCLNECzQ.js");return{diagram:t}},__vite__mapDeps([28,29,12,13,1,2,3,4]));return{id:sre,diagram:e}},"loader"),qTe={id:sre,detector:XTe,loader:ZTe},_Te=qTe,ore="stateDiagram",$Te=F((e,t)=>{var r;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((r=t==null?void 0:t.state)==null?void 0:r.defaultRenderer)==="dagre-wrapper")},"detector"),eLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-DuQ7UaeU-DngwO9wu.js");return{diagram:t}},__vite__mapDeps([30,29,12,13]));return{id:ore,diagram:e}},"loader"),tLe={id:ore,detector:$Te,loader:eLe},rLe=tLe,lre="journey",nLe=F(e=>/^\s*journey/.test(e),"detector"),ALe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-CfjB2Qdf-BACGbkJF.js");return{diagram:t}},__vite__mapDeps([31,9,11,22]));return{id:lre,diagram:e}},"loader"),iLe={id:lre,detector:nLe,loader:ALe},aLe=iLe,sLe=F((e,t,r)=>{ge.debug(`rendering svg for syntax error
851
+ `);const n=LSe(t),A=n.append("g");n.attr("viewBox","0 0 2412 512"),nZ(n,100,512,!0),A.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),A.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),A.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),A.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),A.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),A.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),A.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),A.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),cre={draw:sLe},oLe=cre,lLe={db:{},renderer:cre,parser:{parse:F(()=>{},"parse")}},cLe=lLe,ure="flowchart-elk",uLe=F((e,t={})=>{var r;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),gLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-pJlHae8Y-Ev71T-8E.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:ure,diagram:e}},"loader"),dLe={id:ure,detector:uLe,loader:gLe},hLe=dLe,gre="timeline",BLe=F(e=>/^\s*timeline/.test(e),"detector"),pLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-Cs3NnF2M-DypRUg2c.js");return{diagram:t}},__vite__mapDeps([32,22]));return{id:gre,diagram:e}},"loader"),wLe={id:gre,detector:BLe,loader:pLe},fLe=wLe,dre="mindmap",mLe=F(e=>/^\s*mindmap/.test(e),"detector"),ELe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-Dj37RkY_-PyW77bMN.js");return{diagram:t}},__vite__mapDeps([33,12,13]));return{id:dre,diagram:e}},"loader"),ILe={id:dre,detector:mLe,loader:ELe},yLe=ILe,hre="kanban",CLe=F(e=>/^\s*kanban/.test(e),"detector"),QLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-CrW8yVmd-BnwY45Lx.js");return{diagram:t}},__vite__mapDeps([34,11]));return{id:hre,diagram:e}},"loader"),MLe={id:hre,detector:CLe,loader:QLe},FLe=MLe,Bre="sankey",YLe=F(e=>/^\s*sankey(-beta)?/.test(e),"detector"),NLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-LfuSRRbf-9onzvkvi.js");return{diagram:t}},[]);return{id:Bre,diagram:e}},"loader"),bLe={id:Bre,detector:YLe,loader:NLe},xLe=bLe,pre="packet",DLe=F(e=>/^\s*packet(-beta)?/.test(e),"detector"),kLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-IEqaDwzi-DAshyIbn.js");return{diagram:t}},__vite__mapDeps([35,17,19,4,2]));return{id:pre,diagram:e}},"loader"),SLe={id:pre,detector:DLe,loader:kLe},wre="radar",ULe=F(e=>/^\s*radar-beta/.test(e),"detector"),vLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-BDO6hKtm-Dr2Me9_V.js");return{diagram:t}},__vite__mapDeps([36,17,19,4,2]));return{id:wre,diagram:e}},"loader"),GLe={id:wre,detector:ULe,loader:vLe},fre="block",RLe=F(e=>/^\s*block(-beta)?/.test(e),"detector"),jLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-zcRIdFTD-DjqpPrHK.js");return{diagram:t}},__vite__mapDeps([37,11,5,1,2,14]));return{id:fre,diagram:e}},"loader"),zLe={id:fre,detector:RLe,loader:jLe},TLe=zLe,mre="architecture",LLe=F(e=>/^\s*architecture/.test(e),"detector"),HLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-BiqZtsDe-PQNQsxA5.js");return{diagram:t}},__vite__mapDeps([38,17,19,4,2,7]));return{id:mre,diagram:e}},"loader"),JLe={id:mre,detector:LLe,loader:HLe},OLe=JLe,Ere="treemap",WLe=F(e=>/^\s*treemap/.test(e),"detector"),PLe=F(async()=>{const{diagram:e}=await kt(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-DNX818To-D0ZFUpMu.js");return{diagram:t}},__vite__mapDeps([39,13,17,19,4,2]));return{id:Ere,diagram:e}},"loader"),KLe={id:Ere,detector:WLe,loader:PLe},PO=!1,$m=F(()=>{PO||(PO=!0,hw("error",cLe,e=>e.toLowerCase().trim()==="error"),hw("---",{db:{clear:F(()=>{},"clear")},styles:{},renderer:{draw:F(()=>{},"draw")},parser:{parse:F(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:F(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),ix(hLe,yLe,OLe),ix(_ze,FLe,VTe,OTe,cTe,fTe,ITe,QTe,GTe,TTe,aTe,rTe,fLe,hTe,rLe,_Te,aLe,NTe,xLe,SLe,kTe,TLe,GLe,KLe))},"addDiagrams"),VLe=F(async()=>{ge.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(Sl).map(async([t,{detector:r,loader:n}])=>{if(n)try{lx(t)}catch{try{const{diagram:A,id:i}=await n();hw(i,A,r)}catch(A){throw ge.error(`Failed to load external diagram with key ${t}. Removing from detectors.`),delete Sl[t],A}}}))).filter(t=>t.status==="rejected");if(e.length>0){ge.error(`Failed to load ${e.length} external diagrams`);for(const t of e)ge.error(t);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),XLe="graphics-document document";function Ire(e,t){e.attr("role",XLe),t!==""&&e.attr("aria-roledescription",t)}F(Ire,"setA11yDiagramInfo");function yre(e,t,r,n){if(e.insert!==void 0){if(r){const A=`chart-desc-${n}`;e.attr("aria-describedby",A),e.insert("desc",":first-child").attr("id",A).text(r)}if(t){const A=`chart-title-${n}`;e.attr("aria-labelledby",A),e.insert("title",":first-child").attr("id",A).text(t)}}}F(yre,"addSVGa11yTitleDescription");var Np,iD=(Np=class{constructor(e,t,r,n,A){this.type=e,this.text=t,this.db=r,this.parser=n,this.renderer=A}static async fromText(e,t={}){var r,n;const A=Pn(),i=$S(e,A);e=KGe(e)+`
852
852
  `;try{lx(i)}catch{const c=_Fe(i);if(!c)throw new WX(`Diagram ${i} not found.`);const{id:u,diagram:g}=await c();hw(u,g)}const{db:a,parser:s,renderer:o,init:l}=lx(i);return s.parser&&(s.parser.yy=a),(r=a.clear)==null||r.call(a),l==null||l(A),t.title&&((n=a.setDiagramTitle)==null||n.call(a,t.title)),await s.parse(e),new Np(i,e,a,s,o)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},F(Np,"Diagram"),Np),KO=[],ZLe=F(()=>{KO.forEach(e=>{e()}),KO=[]},"attachFunctions"),qLe=F(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Cre(e){const t=e.match(OX);if(!t)return{text:e,metadata:{}};let r=VUe(t[1],{schema:KUe})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};const n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:e.slice(t[0].length),metadata:n}}F(Cre,"extractFrontMatter");var _Le=F(e=>e.replace(/\r\n?/g,`
853
853
  `).replace(/<(\w+)([^>]*)>/g,(t,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),$Le=F(e=>{const{text:t,metadata:r}=Cre(e),{displayMode:n,title:A,config:i={}}=r;return n&&(i.gantt||(i.gantt={}),i.gantt.displayMode=n),{title:A,config:i,text:t}},"processFrontmatter"),e1e=F(e=>{const t=zi.detectInit(e)??{},r=zi.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:n})=>n==="wrap"):(r==null?void 0:r.type)==="wrap"&&(t.wrap=!0),{text:UGe(e),directive:t}},"processDirectives");function b2(e){const t=_Le(e),r=$Le(t),n=e1e(r.text),A=g2(r.config,n.directive);return e=qLe(n.text),{code:e,title:r.title,config:A}}F(b2,"preprocessDiagram");function Qre(e){const t=new TextEncoder().encode(e),r=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(r)}F(Qre,"toBase64");var t1e=5e4,r1e="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",n1e="sandbox",A1e="loose",i1e="http://www.w3.org/2000/svg",a1e="http://www.w3.org/1999/xlink",s1e="http://www.w3.org/1999/xhtml",o1e="100%",l1e="100%",c1e="border:0;margin:0;",u1e="margin:0",g1e="allow-top-navigation-by-user-activation allow-popups",d1e='The "iframe" tag is not supported by your browser.',h1e=["foreignobject"],B1e=["dominant-baseline"];function x2(e){const t=b2(e);return gw(),hYe(t.config??{}),t}F(x2,"processAndSetConfigs");async function Mre(e,t){$m();try{const{code:r,config:n}=x2(e);return{diagramType:(await Yre(r)).type,config:n}}catch(r){if(t!=null&&t.suppressErrors)return!1;throw r}}F(Mre,"parse");var VO=F((e,t,r=[])=>`
854
854
  .${e} ${t} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),p1e=F((e,t=new Map)=>{var r;let n="";if(e.themeCSS!==void 0&&(n+=`
@@ -947,7 +947,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
947
947
  from { transform: rotate(0deg); }
948
948
  to { transform: rotate(360deg); }
949
949
  }
950
- `})]}),s.title&&$.jsx("h4",{style:{textAlign:"center",marginBottom:s.description?"4px":"12px",marginTop:0,color:T,fontWeight:600,background:"transparent"},children:s.title}),s.description&&$.jsx("p",{style:{textAlign:"center",marginTop:0,marginBottom:"12px",color:R,fontSize:"0.9rem"},children:s.description}),$.jsxs(uOe,{width:"100%",height:p,children:[s.type==="bar"&&$.jsxs($qe,{data:s.data,margin:Fe,barCategoryGap:"20%",children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>$.jsx(VD,{name:oe.name,dataKey:oe.key,fill:oe.color,stackId:oe.stackId,yAxisId:oe.yAxisId,radius:[4,4,0,0]},oe.key))]}),s.type==="line"&&$.jsxs(qqe,{data:s.data,margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>$.jsx(OD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,strokeWidth:oe.strokeWidth,dot:oe.dot},oe.key))]}),s.type==="area"&&$.jsxs(B_e,{data:s.data,margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>$.jsx(WD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,fill:oe.color,fillOpacity:oe.opacity,stackId:oe.stackId},oe.key))]}),s.type==="composed"&&$.jsxs(w_e,{data:s.data,margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>{switch(oe.type){case"line":return $.jsx(OD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,strokeWidth:oe.strokeWidth,dot:oe.dot},oe.key);case"area":return $.jsx(WD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,fill:oe.color,fillOpacity:oe.opacity,stackId:oe.stackId},oe.key);case"scatter":return $.jsx(ZD,{name:oe.name,dataKey:oe.key,fill:oe.color,yAxisId:oe.yAxisId},oe.key);default:return $.jsx(VD,{name:oe.name,dataKey:oe.key,fill:oe.color,stackId:oe.stackId,yAxisId:oe.yAxisId,radius:[4,4,0,0]},oe.key)}})]}),s.type==="pie"&&$.jsxs(u_e,{children:[$.jsx(nae,{data:s.data,dataKey:((n=s.dataKeys)==null?void 0:n[0])||"value",nameKey:s.xKey||"name",cx:"50%",cy:"50%",outerRadius:p/3,label:{fill:T},children:s.data.map((oe,it)=>$.jsx(cg,{fill:w[it%w.length]},`cell-${it}`))}),$.jsx(Cc,{contentStyle:Ee,itemStyle:de,formatter:Ue}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"})]}),s.type==="scatter"&&$.jsxs(d_e,{margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"x",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{dataKey:((A=s.dataKeys)==null?void 0:A[0])||"y",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,$.jsx(ZD,{name:"Data",data:s.data,fill:w[0]})]})]})]})};let Qc=null;const M_e=async()=>{if(typeof window>"u")throw new Error("abcjs requires a browser environment");if(Qc)return Qc;try{const e=await kt(()=>import("./index-DvNpGWs7-CSqlydkk.js"),[]).then(r=>r.i),t=e.default||e;if(!t)throw new Error("abcjs module is empty");if(typeof t.renderAbc!="function")throw new Error(`renderAbc is not a function. Available methods: ${Object.keys(t).join(", ")}`);return Qc=t,Qc}catch(e){if(typeof window<"u"&&window.ABCJS)return Qc=window.ABCJS,Qc;const t=e instanceof Error?e.message:"Failed to load abcjs";throw new Error(`Failed to load abcjs: ${t}`)}},F_e=e=>{const t=e.trim();return/^[XMTLK]:/m.test(t)||/^X:\d+/m.test(t)},Y_e=e=>{const t=e.trim();if(!t.includes("X:")||!/^K:/m.test(t))return!0;const r=t.split(`
950
+ `})]}),s.title&&$.jsx("h4",{style:{textAlign:"center",marginBottom:s.description?"4px":"12px",marginTop:0,color:T,fontWeight:600,background:"transparent"},children:s.title}),s.description&&$.jsx("p",{style:{textAlign:"center",marginTop:0,marginBottom:"12px",color:R,fontSize:"0.9rem"},children:s.description}),$.jsxs(uOe,{width:"100%",height:p,children:[s.type==="bar"&&$.jsxs($qe,{data:s.data,margin:Fe,barCategoryGap:"20%",children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>$.jsx(VD,{name:oe.name,dataKey:oe.key,fill:oe.color,stackId:oe.stackId,yAxisId:oe.yAxisId,radius:[4,4,0,0]},oe.key))]}),s.type==="line"&&$.jsxs(qqe,{data:s.data,margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>$.jsx(OD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,strokeWidth:oe.strokeWidth,dot:oe.dot},oe.key))]}),s.type==="area"&&$.jsxs(B_e,{data:s.data,margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>$.jsx(WD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,fill:oe.color,fillOpacity:oe.opacity,stackId:oe.stackId},oe.key))]}),s.type==="composed"&&$.jsxs(w_e,{data:s.data,margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"name",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{yAxisId:"left",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),C&&$.jsx(sa,{yAxisId:"right",orientation:"right",width:80,tickFormatter:xe,...O,children:Ha(D,"right")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,m.map(oe=>{switch(oe.type){case"line":return $.jsx(OD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,strokeWidth:oe.strokeWidth,dot:oe.dot},oe.key);case"area":return $.jsx(WD,{name:oe.name,type:"monotone",dataKey:oe.key,stroke:oe.color,yAxisId:oe.yAxisId,fill:oe.color,fillOpacity:oe.opacity,stackId:oe.stackId},oe.key);case"scatter":return $.jsx(ZD,{name:oe.name,dataKey:oe.key,fill:oe.color,yAxisId:oe.yAxisId},oe.key);default:return $.jsx(VD,{name:oe.name,dataKey:oe.key,fill:oe.color,stackId:oe.stackId,yAxisId:oe.yAxisId,radius:[4,4,0,0]},oe.key)}})]}),s.type==="pie"&&$.jsxs(u_e,{children:[$.jsx(nae,{data:s.data,dataKey:((n=s.dataKeys)==null?void 0:n[0])||"value",nameKey:s.xKey||"name",cx:"50%",cy:"50%",outerRadius:p/3,label:{fill:T},children:s.data.map((oe,it)=>$.jsx(cg,{fill:w[it%w.length]},`cell-${it}`))}),$.jsx(Cc,{contentStyle:Ee,itemStyle:de,formatter:Ue}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"})]}),s.type==="scatter"&&$.jsxs(d_e,{margin:Fe,children:[I&&$.jsx(bc,{strokeDasharray:"3 3",stroke:H}),$.jsx(xc,{dataKey:s.xKey||"x",label:dt,...O,...pe,tickFormatter:ue}),$.jsx(sa,{dataKey:((A=s.dataKeys)==null?void 0:A[0])||"y",width:80,tickFormatter:xe,...O,children:Ha(x,"left")}),$.jsx(Cc,{contentStyle:Ee,labelStyle:Ae,itemStyle:de,formatter:Ue,labelFormatter:Me,cursor:be}),E&&$.jsx(rl,{wrapperStyle:ct,iconSize:10,iconType:"square"}),Q,$.jsx(ZD,{name:"Data",data:s.data,fill:w[0]})]})]})]})};let Qc=null;const M_e=async()=>{if(typeof window>"u")throw new Error("abcjs requires a browser environment");if(Qc)return Qc;try{const e=await kt(()=>import("./index-DvNpGWs7-CaxGVeNk.js"),[]).then(r=>r.i),t=e.default||e;if(!t)throw new Error("abcjs module is empty");if(typeof t.renderAbc!="function")throw new Error(`renderAbc is not a function. Available methods: ${Object.keys(t).join(", ")}`);return Qc=t,Qc}catch(e){if(typeof window<"u"&&window.ABCJS)return Qc=window.ABCJS,Qc;const t=e instanceof Error?e.message:"Failed to load abcjs";throw new Error(`Failed to load abcjs: ${t}`)}},F_e=e=>{const t=e.trim();return/^[XMTLK]:/m.test(t)||/^X:\d+/m.test(t)},Y_e=e=>{const t=e.trim();if(!t.includes("X:")||!/^K:/m.test(t))return!0;const r=t.split(`
951
951
  `),n=r[r.length-1].trim();return!!(n.match(/^[A-Z]:?\s*$/)&&n.length<3||n.endsWith("|")&&!n.endsWith("|]")&&!n.endsWith("||")&&n.replace(/\|/g,"").trim().length<2)},N_e=({code:e})=>{const t=y.useRef(null),[r,n]=y.useState(null),[A,i]=y.useState(!0),[a,s]=y.useState(!1),[o,l]=y.useState(!1),[c,u]=y.useState(!1),g=y.useRef(""),d=y.useRef(0),h=y.useRef(null);return y.useEffect(()=>{const B=e.trim();if(!B){i(!1),l(!1),s(!1);return}const f=Date.now(),w=f-d.current,p=e!==g.current;g.current=e,d.current=f;const m=Y_e(B),C=p&&w<500&&w>0,E=m||C;if(m){s(!0),i(!0),n(null);return}F_e(e)?(l(!0),n(null),E&&s(!0)):(l(!1),E?(s(!0),n(null)):(n("Unable to detect ABC notation. Expected ABC notation starting with headers like X:, T:, M:, L:, or K:"),i(!1),s(!1)))},[e]),y.useEffect(()=>!o||!e.trim()?void 0:(a&&(h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{s(!1)},400)),(async()=>{try{i(!0);let B=0;const f=10;for(;!t.current&&B<f;)await new Promise(p=>setTimeout(p,50)),B++;if(!t.current)throw new Error("Container element not found after waiting");const w=await M_e();t.current.innerHTML="",w.renderAbc(t.current,e,{responsive:"resize",staffwidth:740,paddingleft:0,paddingright:0,paddingtop:15,paddingbottom:15,scale:1}),n(null),i(!1)}catch(B){const f=B instanceof Error?B.message:"Failed to render ABC notation";n(f),i(!1)}})(),()=>{h.current&&clearTimeout(h.current)}),[e,o,a]),r?$.jsxs("div",{className:"graph-error",children:[$.jsxs("div",{className:"graph-error-header",children:[$.jsx("div",{className:"graph-error-icon",children:"⚠️"}),$.jsxs("div",{className:"graph-error-content",children:[$.jsx("div",{className:"graph-error-title",children:"ABC Notation Rendering Error"}),$.jsx("div",{className:"graph-error-message",children:r})]})]}),$.jsxs("button",{className:"graph-error-toggle",onClick:()=>u(!c),type:"button",children:[c?"Hide":"Show"," Details"]}),c&&$.jsxs("details",{className:"graph-error-details",open:!0,children:[$.jsx("summary",{style:{cursor:"pointer",marginBottom:"8px",fontWeight:500},children:"ABC Notation Code"}),$.jsx("pre",{style:{marginTop:"8px",fontSize:"0.8em",opacity:.8,padding:"8px",background:"rgba(0, 0, 0, 0.05)",borderRadius:"4px",overflow:"auto",maxHeight:"200px"},children:$.jsx("code",{children:e})})]})]}):(A||a)&&!o?$.jsx("div",{className:"graph-container music-container abc-container",children:$.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"30px 20px",color:"var(--md-text-secondary, #6b7280)",minHeight:"120px"},children:[$.jsx("svg",{style:{animation:"spin 1s linear infinite",marginBottom:"10px",width:"28px",height:"28px"},viewBox:"0 0 24 24",fill:"none",children:$.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2",strokeDasharray:"32",strokeLinecap:"round"})}),$.jsx("span",{style:{fontWeight:500,fontSize:"14px"},children:a?"Receiving music notation...":"Loading music notation..."}),$.jsx("style",{children:`
952
952
  @keyframes spin {
953
953
  from { transform: rotate(0deg); }
@@ -992,9 +992,9 @@ ${fce}`,j_e=()=>{if(typeof document>"u"||document.getElementById(QV))return;cons
992
992
  { "name": "REST API", "apiKey": "rest", "apiUrl": "http://localhost:3000" }
993
993
  ]`;try{const n=JSON.parse(t);if(Array.isArray(n))for(const A of n){const i=e(A);if(i)return i}}catch{}return null}function J_e(){return typeof window<"u"&&T_e(window.ORBIT_CHAT_CONFIG)}function bt(e,t,r="string"){var o;const n=e==="showGitHubStats"||e==="githubOwner"||e==="githubRepo",A=J_e();if(!n){if(A){const l=(o=window.ORBIT_CHAT_CONFIG)==null?void 0:o[e];return l??t}if(typeof window<"u")switch(e){case"apiUrl":if(window.CHATBOT_API_URL)return window.CHATBOT_API_URL;break;case"defaultKey":if(window.CHATBOT_API_KEY)return window.CHATBOT_API_KEY;break}}const i=L_e[e],s=i?z_e[i]:void 0;if(s!=null&&s!==""){if(r==="boolean")return s==="true";if(r==="number"||r==="numberOrNull"){const l=parseInt(s,10);if(!isNaN(l))return r==="numberOrNull"&&l===0?null:l}else return s}return t}function Vg(e,t){if(e===void 0||e==="")return t===0?null:t;const r=parseInt(e,10);return isNaN(r)||r<0?t===0?null:t:r===0?null:r}function GN(e,t){if(e===void 0||e==="")return t;const r=parseInt(e,10);return isNaN(r)||r<0?t:r}function qae(e){if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const r=t.toLowerCase();return r==="false"||r==="0"||r==="off"||r==="disabled"?null:t}const Di={apiUrl:bt("apiUrl",ql,"string"),defaultKey:bt("defaultKey","default-key","string"),applicationName:bt("applicationName","ORBIT Chat","string"),defaultInputPlaceholder:bt("defaultInputPlaceholder","Message ORBIT...","string"),useLocalApi:bt("useLocalApi",!1,"boolean"),localApiPath:bt("localApiPath",void 0,"string"),consoleDebug:bt("consoleDebug",!1,"boolean"),enableUploadButton:bt("enableUploadButton",!1,"boolean"),enableAudioOutput:bt("enableAudioOutput",!1,"boolean"),enableFeedbackButtons:bt("enableFeedbackButtons",!1,"boolean"),enableConversationThreads:bt("enableConversationThreads",!0,"boolean"),enableApiMiddleware:bt("enableApiMiddleware",!1,"boolean"),showGitHubStats:bt("showGitHubStats",!0,"boolean"),outOfServiceMessage:(()=>{const e=bt("outOfServiceMessage","","string");return qae(e)})(),githubOwner:bt("githubOwner","schmitech","string"),githubRepo:bt("githubRepo","orbit","string"),maxFilesPerConversation:(()=>{const e=bt("maxFilesPerConversation","5","string");return GN(e,5)})(),maxFileSizeMB:(()=>{const e=bt("maxFileSizeMB","50","string");return GN(e,50)})(),maxTotalFiles:(()=>{const e=bt("maxTotalFiles","100","string");return Vg(e,100)})(),maxConversations:(()=>{const e=bt("maxConversations","10","string");return Vg(e,10)})(),maxMessagesPerConversation:(()=>{const e=bt("maxMessagesPerConversation","1000","string");return Vg(e,1e3)})(),maxMessagesPerThread:(()=>{const e=bt("maxMessagesPerThread","1000","string");return Vg(e,1e3)})(),maxTotalMessages:(()=>{const e=bt("maxTotalMessages","10000","string");return Vg(e,1e4)})(),maxMessageLength:(()=>{const e=bt("maxMessageLength","1000","string");return GN(e,1e3)})()};function Or(){return bt("apiUrl",ql,"string")}function ua(e){const t=e==null?void 0:e.trim();return t&&t.length>0?t:Or()}function mo(){return bt("defaultKey","default-key","string")}function _ae(){return bt("applicationName","ORBIT Chat","string")}function $ae(){return bt("defaultInputPlaceholder","Message ORBIT...","string")}function O_e(){return bt("useLocalApi",!1,"boolean")}function W_e(){return bt("localApiPath",void 0,"string")}function P_e(){return bt("enableUploadButton",!1,"boolean")}function K_e(){return bt("enableAudioOutput",!1,"boolean")}function V_e(){return bt("enableFeedbackButtons",!1,"boolean")}function X_e(){return bt("enableConversationThreads",!0,"boolean")}function sr(){return bt("enableApiMiddleware",!1,"boolean")}function qv(){var r;if(!sr())return null;const e=(r=mo())==null?void 0:r.trim();if(e&&e!=="default-key")return e;const t=H_e();return t||(e&&e.length>0?e:null)}function Z_e(){return Di.showGitHubStats}function q_e(){return Di.githubOwner}function __e(){return Di.githubRepo}function $_e(){const e=bt("outOfServiceMessage","","string");return qae(e)}function e$e({audio:e,audioFormat:t="mp3",autoPlay:r=!1,maxSizeMB:n=10}){const A=y.useRef(null),[i,a]=y.useState(!1),[s,o]=y.useState(0),[l,c]=y.useState(0),[u,g]=y.useState(!0),[d,h]=y.useState(null),[B,f]=y.useState(null);y.useEffect(()=>{if(!e)return;let k=null,x=!0;return(async()=>{try{g(!0),h(null),f(null);const H=e.length*3/4/(1024*1024);if(H>n)throw new Error(`Audio file too large (${H.toFixed(1)}MB > ${n}MB limit)`);if(H>2&&(f(`Large audio file (${H.toFixed(1)}MB) - may take time to load`),Be("[AudioPlayer] Large audio file detected",{sizeMB:H.toFixed(2)})),!/^[A-Za-z0-9+/=]+$/.test(e.replace(/\s/g,"")))throw new Error("Invalid base64 audio data");const T=atob(e),v=new Uint8Array(T.length);for(let R=0;R<T.length;R++)v[R]=T.charCodeAt(R);const L=t==="mp3"?"audio/mpeg":t==="wav"?"audio/wav":t==="ogg"?"audio/ogg":t==="opus"?"audio/opus":t==="webm"?"audio/webm":`audio/${t}`,J=new Blob([v],{type:L});if(k=URL.createObjectURL(J),!x||!A.current){k&&URL.revokeObjectURL(k);return}A.current.src=k,g(!1),Be("[AudioPlayer] Audio loaded successfully",{format:t,mimeType:L,size:J.size}),r&&A.current&&A.current.play().catch(R=>{Ru("[AudioPlayer] Auto-play failed:",R)})}catch{x&&(h("Failed to load audio"),g(!1))}})(),()=>{x=!1,k&&URL.revokeObjectURL(k)}},[e,t,r,n]);const w=()=>{A.current&&o(A.current.duration)},p=()=>{A.current&&c(A.current.currentTime)},m=()=>a(!0),C=()=>a(!1),E=()=>{a(!1),c(0)},I=()=>{A.current&&(i?A.current.pause():A.current.play().catch(k=>{h("Playback failed")}))},Q=k=>{if(!A.current)return;const x=parseFloat(k.target.value);A.current.currentTime=x,c(x)},N=k=>{if(!isFinite(k))return"0:00";const x=Math.floor(k/60),D=Math.floor(k%60);return`${x}:${D.toString().padStart(2,"0")}`};return d?b.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-700 dark:bg-red-900/20 dark:text-red-400",children:[b.jsx($0,{className:"h-4 w-4"}),b.jsx("span",{children:d})]}):b.jsxs("div",{className:"mt-3 flex flex-col gap-1",children:[B&&b.jsxs("div",{className:"text-xs text-amber-600 dark:text-amber-400 px-1",children:["⚠️ ",B]}),b.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-gray-300 bg-white px-3 py-2 dark:border-[#4a4b54] dark:bg-[#343541]",children:[b.jsx("audio",{ref:A,onLoadedMetadata:w,onTimeUpdate:p,onPlay:m,onPause:C,onEnded:E}),b.jsx("button",{onClick:I,disabled:u,className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 disabled:opacity-50 dark:bg-[#4a4b54] dark:hover:bg-[#565869]",title:i?"Pause":"Play",children:u?b.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}):i?b.jsx($le,{className:"h-4 w-4 text-gray-700 dark:text-[#ececf1]"}):b.jsx(tce,{className:"h-4 w-4 text-gray-700 dark:text-[#ececf1]"})}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:N(l)}),b.jsx("input",{type:"range",min:"0",max:s||0,value:l,onChange:Q,disabled:u||!s,className:"flex-1 cursor-pointer accent-gray-600 dark:accent-[#bfc2cd]",style:{background:s?`linear-gradient(to right, rgb(75 85 99) 0%, rgb(75 85 99) ${l/s*100}%, rgb(229 231 235) ${l/s*100}%, rgb(229 231 235) 100%)`:"rgb(229 231 235)"}}),b.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:N(s)})]}),b.jsx($0,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"})]})]})}const t$e=["#","*","`","[","]","(",")","{","}","|","<",">"],ese=e=>t$e.some(t=>e.includes(t));function tse(e){if(!e||e.length<1e3)return!1;const t=/^[A-Za-z0-9+/=]+$/,r=e.replace(/\s+/g,"");if(r.length>1e4&&t.test(r)){const n=/\b(the|and|for|are|but|not|you|all|can|function|const|let|var|class|return|import|export|async|await|if|else|while|true|false|null|undefined|http|https|www|error|data|response|request|api|json|xml|html|css|js|py|java|cpp|def|print|console|log)\b/i.test(e),A=ese(e),i=/[.,;:!?'"()-]/.test(e);if(!n&&!A&&!i)return!0}return!!(r.length>5e4&&t.test(r)&&e.replace(/[A-Za-z0-9+/=\s]/g,"").length<10)}function Td(e){if(!e)return e;if(tse(e))return"";const t=/([A-Za-z0-9+/=]{10000,})/g;return e.replace(t,n=>{const A=n.replace(/\s+/g,"");if(A.length>1e4&&/^[A-Za-z0-9+/=]+$/.test(A)){const i=/\b(function|const|let|var|class|return|import|export|if|else|while|for|true|false|null|def|print)\b/i.test(n),a=ese(n),s=/[.,;:!?'"()-]/.test(n);if(!i&&!a&&!s)return""}return n})}function nk(e,t=5e4){return!e||e.length<=t?e:tse(e)?"":e.substring(0,t)+`
994
994
 
995
- ... (content truncated due to length)`}const lt={maxFilesPerConversation:Di.maxFilesPerConversation,maxFileSizeMB:Di.maxFileSizeMB,maxTotalFiles:Di.maxTotalFiles,maxConversations:Di.maxConversations,maxMessagesPerConversation:Di.maxMessagesPerConversation,maxMessagesPerThread:Di.maxMessagesPerThread,maxTotalMessages:Di.maxTotalMessages,maxMessageLength:Di.maxMessageLength},r$e=[];function n$e({message:e,onRegenerate:t,onStartThread:r,onSendThreadMessage:n,threadMessages:A,sessionId:i,isThreadSendDisabled:a}){var ke,Ze;const[s,o]=y.useState(!1),[l,c]=y.useState(null),[u,g]=y.useState(""),[d,h]=y.useState(!1),[B,f]=y.useState(!1),w=y.useRef(((ke=e.threadInfo)==null?void 0:ke.thread_id)||null),p=y.useRef(null),m=y.useRef(null),C=y.useRef(""),E=e.role==="assistant",I=A??r$e,Q=I.filter(ue=>ue.role==="assistant").length,N=I.filter(ue=>!(ue.role==="assistant"&&ue.isStreaming)).length,k=I.some(ue=>ue.isStreaming),x="en-US",D=X_e(),z=lt.maxMessageLength,H=lt.maxMessagesPerThread,T=H!==null&&N>=H,v=T&&H!==null?`This thread reached the ${H} message limit. Start a new conversation for more follow-ups.`:null,{theme:L,isDark:J}=em(),R=L.mode==="dark"?"dark":L.mode==="light"?"light":"",O=J?"dark":"light",U=y.useMemo(()=>["message-markdown w-full min-w-0","prose prose-slate dark:prose-invert max-w-none",R].filter(Boolean).join(" "),[R]),P=y.useMemo(()=>["message-markdown w-full min-w-0","prose prose-invert max-w-none",R].filter(Boolean).join(" "),[R]),re=E?U:P,G=`${U} text-sm leading-6`,X=`${P} text-sm leading-6`;y.useEffect(()=>{var ue,Me;!w.current&&((ue=e.threadInfo)!=null&&ue.thread_id)&&h(!0),w.current=((Me=e.threadInfo)==null?void 0:Me.thread_id)||null},[(Ze=e.threadInfo)==null?void 0:Ze.thread_id]),y.useEffect(()=>{e.threadInfo||(g(""),h(!1),f(!1))},[e.threadInfo]),y.useEffect(()=>{Q>0&&h(!0)},[Q]),y.useEffect(()=>{if(!d||I.length===0)return;const ue=I[I.length-1],Me=(ue==null?void 0:ue.content)||"",$e=Me!==C.current;((ue==null?void 0:ue.isStreaming)||$e)&&requestAnimationFrame(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)}),C.current=Me},[d,I]);const ie=y.useMemo(()=>{const ue=e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp),Me=ue.toLocaleDateString(x,{weekday:"short"}),$e=ue.toLocaleDateString(x,{month:"short"}),pt=ue.getDate().toString().padStart(2,"0"),_t=ue.getFullYear(),fr=ue.toLocaleTimeString(x,{hour:"2-digit",minute:"2-digit",hour12:!0});return`${Me}, ${$e} ${pt}, ${_t} ${fr}`},[e.timestamp,x]),ae=E?"bg-gradient-to-br from-blue-100 to-blue-200 text-blue-900 dark:from-[#1f2a36] dark:to-[#1a2230] dark:text-[#c5d7ff]":"bg-gradient-to-br from-emerald-100 to-emerald-200 text-emerald-900 dark:from-[#0f1f17] dark:to-[#0b1712] dark:text-[#c7f5df]",le=`message-bubble min-w-0 break-words leading-relaxed ${E?"border border-blue-100/80 bg-transparent text-[#0f172a] shadow-[0_15px_35px_-20px_rgba(15,23,42,0.25)] dark:border-[#1f2a36] dark:bg-transparent dark:text-[#e5edff]":"border border-emerald-100 bg-transparent text-[#1c3226] shadow-[0_12px_30px_-18px_rgba(15,52,33,0.25)] dark:border-[#1a2b21] dark:bg-transparent dark:text-[#dffbea]"} rounded-2xl px-4 py-3`,Qe=E?"border-blue-100 bg-white/80 dark:border-[#1f2a36] dark:bg-white/5":"border-emerald-100 bg-white/80 dark:border-[#1a2b21] dark:bg-white/5",q=async()=>{try{await navigator.clipboard.writeText(e.content),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},pe=ue=>{c(l===ue?null:ue)},Ee=y.useCallback(ue=>(ue instanceof Date?ue:new Date(ue)).toLocaleTimeString(x,{hour:"2-digit",minute:"2-digit"}),[x]),Ae=async()=>{if(!n||!e.threadInfo||T)return;const ue=u.trim();if(ue){f(!0);try{await n(e.threadInfo.thread_id,e.id,ue),g(""),setTimeout(()=>{p.current&&p.current.focus()},100)}catch{setTimeout(()=>{p.current&&p.current.focus()},100)}finally{f(!1)}}},de=ue=>{ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),Ae())},be=!e.threadInfo||!n||a||k||B||T;y.useEffect(()=>{if(!d||be)return;const ue=p.current;if(!ue)return;const Me=requestAnimationFrame(()=>{ue.focus();const $e=ue.value.length;ue.setSelectionRange($e,$e)});return()=>cancelAnimationFrame(Me)},[d,be,B]),y.useEffect(()=>{if(p.current){const Me=p.current;Me.style.height="auto";const $e=Me.scrollHeight;Me.style.height=`${Math.min($e,120)}px`,Me.style.overflowY=$e>120?"auto":"hidden"}},[u]);const Ue=y.useMemo(()=>e.isStreaming&&(!e.content||e.content==="…")?b.jsx("div",{className:re,children:b.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[b.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"0ms"}}),b.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"150ms"}}),b.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"300ms"}})]})}):b.jsx(Uf,{content:nk(Td(e.content||"")),className:re,syntaxTheme:O}),[re,e.content,e.isStreaming,O]),xe=y.useMemo(()=>[...I].sort((Me,$e)=>{const pt=Me.timestamp instanceof Date?Me.timestamp.getTime():new Date(Me.timestamp).getTime(),_t=$e.timestamp instanceof Date?$e.timestamp.getTime():new Date($e.timestamp).getTime();return pt-_t}).map(Me=>{const $e=Me.role==="assistant",pt=$e?G:X,_t=Me.isStreaming&&(!Me.content||Me.content==="…")?b.jsx("div",{className:pt,children:b.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[b.jsx("span",{className:"inline-block h-2 w-2 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"0ms"}}),b.jsx("span",{className:"inline-block h-2 w-2 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"150ms"}}),b.jsx("span",{className:"inline-block h-2 w-2 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"300ms"}})]})}):b.jsx(Uf,{content:nk(Td(Me.content||"")),className:pt,syntaxTheme:O});return b.jsxs("div",{className:"flex items-start gap-3",children:[b.jsx("div",{className:`mt-0.5 flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full ${$e?"bg-blue-100 text-blue-700 dark:bg-[#1f2a36] dark:text-[#c5d7ff]":"bg-emerald-100 text-emerald-700 dark:bg-[#1f2a36] dark:text-[#9ef0d5]"}`,children:$e?b.jsx(lR,{className:"h-3.5 w-3.5"}):b.jsx(cR,{className:"h-3.5 w-3.5"})}),b.jsxs("div",{className:"flex-1 min-w-0 rounded-2xl border border-white/70 bg-white/90 px-4 py-3 text-sm shadow-sm dark:border-white/5 dark:bg-white/5 backdrop-blur overflow-hidden",children:[b.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] font-semibold uppercase tracking-wide text-blue-900/70 dark:text-[#c5d7ff]",children:[b.jsx("span",{children:$e?"Assistant":"You"}),b.jsx("span",{children:Ee(Me.timestamp)})]}),b.jsx("div",{className:"thread-markdown-wrapper overflow-x-auto",children:_t})]})]},Me.id)}),[Ee,O,G,I,X]);return b.jsxs("div",{className:"group flex items-start gap-3 px-1 animate-fadeIn min-w-0 sm:px-0",children:[b.jsx("div",{className:`flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full self-start -mt-2 ml-1 shadow-sm ring-2 ring-white/50 dark:ring-white/10 sm:-mt-3 sm:ml-2 ${ae}`,children:E?b.jsx(lR,{className:"h-5 w-5"}):b.jsx(cR,{className:"h-5 w-5"})}),b.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[b.jsxs("div",{className:"flex flex-col gap-1.5 mb-1",children:[b.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-gray-700 dark:text-[#ececf1]",children:E?"Assistant":"You"}),b.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:ie})]}),b.jsxs("div",{className:le,children:[Ue,e.attachments&&e.attachments.length>0&&b.jsx("div",{className:"mt-3 space-y-2",children:e.attachments.map(ue=>b.jsxs("div",{className:`flex items-center gap-3 rounded-xl border p-3 ${Qe}`,children:[b.jsx(Jle,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("p",{className:"truncate text-sm font-medium text-[#353740] dark:text-[#ececf1]",children:ue.filename}),b.jsxs("p",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:[(ue.file_size/1024).toFixed(1)," KB"]})]})]},ue.file_id))}),e.audio&&E&&!e.isStreaming&&b.jsx(e$e,{audio:e.audio,audioFormat:e.audioFormat,autoPlay:!1})]}),E&&!e.isStreaming&&b.jsxs("div",{className:"flex items-center gap-1 md:gap-2 text-xs text-gray-500 transition-opacity dark:text-[#bfc2cd] sm:opacity-0 sm:group-hover:opacity-100",children:[b.jsxs("button",{onClick:q,className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a]",title:"Copy message",children:[b.jsx(Tle,{className:"h-4 w-4"}),b.jsx("span",{className:"hidden sm:inline",children:"Copy"})]}),t&&b.jsxs("button",{onClick:()=>t(e.id),className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a]",title:"Regenerate response",children:[b.jsx(Ace,{className:"h-4 w-4"}),b.jsx("span",{className:"hidden sm:inline",children:"Retry"})]}),D&&r&&e.supportsThreading&&!e.threadInfo&&i&&b.jsxs("button",{onClick:()=>r(e.id,i),className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a]",title:"Start thread for follow-up questions",children:[b.jsx(_0,{className:"h-4 w-4"}),b.jsx("span",{className:"hidden sm:inline",children:"Start Thread"})]}),V_e()&&b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("button",{onClick:()=>pe("up"),className:`rounded p-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a] ${l==="up"?"text-[#353740] dark:text-[#ececf1]":""}`,title:"Good response",children:b.jsx(lce,{className:"h-4 w-4"})}),b.jsx("button",{onClick:()=>pe("down"),className:`rounded p-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a] ${l==="down"?"text-[#353740] dark:text-[#ececf1]":""}`,title:"Poor response",children:b.jsx(oce,{className:"h-4 w-4"})})]}),s&&b.jsx("span",{children:"Copied"})]}),D&&e.threadInfo&&b.jsxs("div",{className:"thread-panel mt-4 rounded-xl border border-blue-100/80 bg-blue-50/70 p-3 sm:p-4 text-sm shadow-sm ring-1 ring-blue-100/60 dark:border-[#1f2a36] dark:bg-[#0f1821] dark:ring-[#1f2a36]",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm font-semibold text-blue-900 dark:text-[#c5d7ff]",children:[b.jsxs("div",{className:"inline-flex items-center gap-2 uppercase tracking-wide text-xs sm:text-sm",children:[b.jsx(_0,{className:"h-3.5 w-3.5"}),b.jsxs("span",{children:["Thread",Q>0?` (${Q})`:""]})]}),b.jsx("button",{onClick:()=>h(ue=>!ue),className:"inline-flex items-center gap-1.5 sm:gap-2 rounded-full border border-blue-200/80 px-2.5 sm:px-3 py-1.5 text-xs uppercase tracking-wide text-blue-900 transition hover:bg-white/70 dark:border-[#233449] dark:text-[#c5d7ff] dark:hover:bg-white/10",children:d?b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"hidden sm:inline",children:"Hide"}),b.jsx(zle,{className:"h-4 w-4 sm:h-3 sm:w-3"})]}):b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"hidden sm:inline",children:"Show"}),b.jsx(_6,{className:"h-4 w-4 sm:h-3 sm:w-3"})]})})]}),d&&b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:m,className:"mt-3 space-y-3 max-h-96 overflow-y-auto scroll-smooth",style:{scrollBehavior:"auto"},children:xe}),v&&b.jsx("div",{className:"mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-[#2f2410] dark:text-amber-100",children:v}),b.jsx("div",{className:"mt-3 rounded-xl border border-white/80 bg-white/95 p-3 shadow-sm dark:border-white/10 dark:bg-white/10",children:b.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3",children:[b.jsx("textarea",{ref:p,className:"flex-1 w-full sm:w-auto min-w-0 resize-none rounded-lg border border-gray-200 bg-gray-50 px-3 py-2.5 text-base sm:text-sm text-[#353740] placeholder-gray-500 outline-none transition focus:border-gray-400 focus:ring-1 focus:ring-gray-300 disabled:opacity-60 dark:border-[#3c3f4a] dark:bg-[#2d2f39] dark:text-[#ececf1] dark:placeholder-[#8e8ea0] dark:focus:border-[#8e8ea0] dark:focus:ring-[#8e8ea0]",placeholder:Q>0?"Reply in thread...":"Ask a follow-up...",value:u,onChange:ue=>g(ue.target.value),onKeyDown:de,disabled:be,rows:1,maxLength:z,style:{minHeight:"44px",maxHeight:"120px",outline:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none",appearance:"none"}}),b.jsxs("div",{className:"flex items-center justify-between sm:justify-end gap-2",children:[u.length>0&&b.jsx("div",{className:"text-xs text-gray-500 dark:text-[#bfc2cd] whitespace-nowrap",children:b.jsxs("span",{className:u.length>=z?"text-red-600 font-semibold":"",children:[u.length,"/",z]})}),b.jsx("button",{type:"button",onClick:Ae,disabled:be||u.trim().length===0,className:`flex h-11 w-11 sm:h-9 sm:w-9 items-center justify-center rounded-full transition active:scale-95 ${u.trim().length>0&&!be?"bg-[#10a37f] text-white hover:bg-[#0f8f6f]":"bg-gray-200 text-gray-400 dark:bg-[#2f313a] dark:text-[#6b6f7a]"} disabled:cursor-not-allowed`,title:"Send thread message",children:B?b.jsx(tu,{className:"h-5 w-5 sm:h-4 sm:w-4 animate-spin"}):b.jsx(q6,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]})]})})]})]})]})]})}function A$e(e=800,t=100,r="sine"){try{if(typeof window>"u"){Be("[SoundEffects] Window is not available for audio playback");return}const n=window.AudioContext??window.webkitAudioContext;if(!n){Be("[SoundEffects] AudioContext not supported in this browser");return}const A=new n,i=A.createOscillator(),a=A.createGain();i.connect(a),a.connect(A.destination),i.frequency.value=e,i.type=r,a.gain.setValueAtTime(.3,A.currentTime),a.gain.exponentialRampToValueAtTime(.01,A.currentTime+t/1e3),i.start(A.currentTime),i.stop(A.currentTime+t/1e3)}catch{}}const i$e={messageSent:{frequency:600,duration:80,type:"sine"},messageReceived:{frequency:800,duration:100,type:"sine"},success:{frequency:1e3,duration:150,type:"sine"},error:{frequency:400,duration:200,type:"square"},notification:{frequency:700,duration:120,type:"sine"}};function hd(e,t){if(!t)return;const r=i$e[e];if(r)try{A$e(r.frequency,r.duration,r.type),Be(`[SoundEffects] Playing ${e} sound effect`)}catch{}}function a$e({messages:e,onRegenerate:t,onStartThread:r,onSendThreadMessage:n,sessionId:A,isLoading:i}){const a=y.useRef(null),s=y.useRef(null),o=y.useRef(e.length),l=y.useRef(""),c=y.useRef(i),u=y.useRef(!0),{settings:g}=tm(),{topLevelMessages:d,threadLookup:h}=y.useMemo(()=>{const w=new Map,p=[];return e.forEach(m=>{if(m.isThreadMessage&&m.parentMessageId){const C=w.get(m.parentMessageId)||[];w.set(m.parentMessageId,[...C,m]);return}p.push(m)}),{topLevelMessages:p,threadLookup:w}},[e]),B=()=>{if(!s.current)return;const{scrollTop:w,scrollHeight:p,clientHeight:m}=s.current,E=p-w-m<200;u.current=E},f=y.useCallback(()=>{requestAnimationFrame(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)})},[]);return y.useEffect(()=>{const w=e.length,p=o.current,m=w>p,C=e[e.length-1],E=(C==null?void 0:C.content)||"",I=E!==l.current,Q=(C==null?void 0:C.isStreaming)??!1;m||Q&&I?(f(),u.current=!0):u.current&&I&&f(),o.current=w,l.current=E},[e,f]),y.useEffect(()=>{i&&(f(),u.current=!0)},[i,f]),y.useEffect(()=>{if(c.current&&!i){const w=e[e.length-1];(w==null?void 0:w.role)==="assistant"&&w.content&&hd("messageReceived",g.soundEnabled)}c.current=i},[i,e,g.soundEnabled]),d.length===0?b.jsx("div",{className:"flex-1 flex items-center justify-center px-4 sm:px-6",children:b.jsxs("div",{className:"text-center text-lg text-gray-500 dark:text-[#bfc2cd]",children:[b.jsx("p",{className:"text-xl",children:"Your messages will appear here."}),b.jsx("p",{className:"mt-1 text-lg",children:"Start the conversation by sending a prompt below."})]})}):b.jsx("div",{ref:s,className:"message-list flex-1 overflow-y-auto py-6",onScroll:B,children:b.jsxs("div",{className:"space-y-6 px-3 sm:px-4",children:[d.map(w=>b.jsx(n$e,{message:w,onRegenerate:t,onStartThread:r,onSendThreadMessage:n,threadMessages:h.get(w.id),sessionId:A,isThreadSendDisabled:i},w.id)),b.jsx("div",{ref:a,className:"h-8"})]})})}const s$e=2e3;function o$e(e,t){const[r,n]=y.useState(!1),[A,i]=y.useState(null),a=y.useRef(null),s=y.useRef(""),o=y.useRef(!1),l=y.useRef(null),c=y.useCallback(()=>{if(!s.current)return;const w=s.current;s.current="",e(" "+w)},[e]),u=typeof window<"u"&&("webkitSpeechRecognition"in window||"SpeechRecognition"in window),g=y.useCallback(()=>{!t||o.current||(o.current=!0,t())},[t]),d=y.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),h=y.useCallback(()=>{d(),l.current=setTimeout(()=>{a.current?a.current.stop():g()},s$e)},[d,g]),B=y.useCallback(()=>{if(!u){i("Speech recognition is not supported in this browser. Please try Chrome, Edge, or Safari.");return}if(!r)try{o.current=!1;const w=window.SpeechRecognition||window.webkitSpeechRecognition,p=new w;p.continuous=!0,p.interimResults=!0,p.lang=navigator.language||"en-US",p.maxAlternatives=1,p.onstart=()=>{n(!0),i(null),Be("Speech recognition started"),h()},p.onresult=m=>{let C="",E="";for(let I=m.resultIndex;I<m.results.length;I++){const Q=m.results[I][0].transcript;m.results[I].isFinal?C+=Q:E+=Q}E&&(s.current=E),C&&(s.current="",e(" "+C)),h()},p.onend=()=>{d(),c(),n(!1),a.current=null,Be("Speech recognition ended"),g()},p.onerror=m=>{switch(d(),Ru("Speech recognition error:",m.error),n(!1),a.current=null,s.current="",g(),m.error){case"no-speech":i("No speech detected. Please try again.");break;case"audio-capture":i("Microphone access denied. Please allow microphone access and try again.");break;case"not-allowed":i("Microphone access not allowed. Please enable microphone permissions.");break;case"network":i("Network error occurred. Please check your connection.");break;default:i(`Speech recognition error: ${m.error}`)}},p.start(),a.current=p}catch{i("Failed to start speech recognition. Please try again."),n(!1)}},[u,e,r,c,g,h,d]),f=y.useCallback(()=>{if(a.current){const w=a.current;w.onend=null,w.onerror=null,w.onresult=null,w.onstart=null;try{w.stop()}catch{}a.current=null}d(),c(),n(!1),i(null),g()},[d,c,g]);return{isListening:r,isSupported:u,startListening:B,stopListening:f,error:A}}const l$e="2.9.1",c$e={"@schmitech/chatbot-api":"^2.1.5"},rse={version:l$e,dependencies:c$e},nse=rse.version,MV=rse.dependencies["@schmitech/chatbot-api"];async function Ak(){try{return(await kt(()=>import("./api-FdNd9lEW.js"),[])).version||MV}catch{return MV}}async function Ase(){const e=await Ak();return{appVersion:nse,apiVersion:e,isLocalApi:!1}}let Ja=null;function Xg(){let e=null,t=null;const r=(A,i,a,s)=>{e=a||null,t=s||null},n=()=>{if(!t)throw new Error("Adapter name is required when middleware is enabled");return{async*streamChat(A,i,a,s,o,l,c,u,g,d,h){var w,p;const B={messages:[{role:"user",content:A}],stream:i!==!1};a&&a.length>0&&(B.file_ids=a),s&&(B.thread_id=s),o&&(B.audio_input=o),l&&(B.audio_format=l),c&&(B.language=c),u!==void 0&&(B.return_audio=u),g&&(B.tts_voice=g),d&&(B.source_language=d),h&&(B.target_language=h);const f=await fetch("/api/v1/chat",{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t,...e?{"X-Session-ID":e}:{}},body:JSON.stringify(B)});if(!f.ok)throw new Error(`API request failed: ${f.status} ${f.statusText}`);if((w=f.headers.get("content-type"))!=null&&w.includes("text/event-stream")){const m=(p=f.body)==null?void 0:p.getReader(),C=new TextDecoder;let E="";if(!m)throw new Error("Response body is not readable");for(;;){const{done:I,value:Q}=await m.read();if(I)break;E+=C.decode(Q,{stream:!0});const N=E.split(`
995
+ ... (content truncated due to length)`}const lt={maxFilesPerConversation:Di.maxFilesPerConversation,maxFileSizeMB:Di.maxFileSizeMB,maxTotalFiles:Di.maxTotalFiles,maxConversations:Di.maxConversations,maxMessagesPerConversation:Di.maxMessagesPerConversation,maxMessagesPerThread:Di.maxMessagesPerThread,maxTotalMessages:Di.maxTotalMessages,maxMessageLength:Di.maxMessageLength},r$e=[];function n$e({message:e,onRegenerate:t,onStartThread:r,onSendThreadMessage:n,threadMessages:A,sessionId:i,isThreadSendDisabled:a}){var ke,Ze;const[s,o]=y.useState(!1),[l,c]=y.useState(null),[u,g]=y.useState(""),[d,h]=y.useState(!1),[B,f]=y.useState(!1),w=y.useRef(((ke=e.threadInfo)==null?void 0:ke.thread_id)||null),p=y.useRef(null),m=y.useRef(null),C=y.useRef(""),E=e.role==="assistant",I=A??r$e,Q=I.filter(ue=>ue.role==="assistant").length,N=I.filter(ue=>!(ue.role==="assistant"&&ue.isStreaming)).length,k=I.some(ue=>ue.isStreaming),x="en-US",D=X_e(),z=lt.maxMessageLength,H=lt.maxMessagesPerThread,T=H!==null&&N>=H,v=T&&H!==null?`This thread reached the ${H} message limit. Start a new conversation for more follow-ups.`:null,{theme:L,isDark:J}=em(),R=L.mode==="dark"?"dark":L.mode==="light"?"light":"",O=J?"dark":"light",U=y.useMemo(()=>["message-markdown w-full min-w-0","prose prose-slate dark:prose-invert max-w-none",R].filter(Boolean).join(" "),[R]),P=y.useMemo(()=>["message-markdown w-full min-w-0","prose prose-invert max-w-none",R].filter(Boolean).join(" "),[R]),re=E?U:P,G=`${U} text-sm leading-6`,X=`${P} text-sm leading-6`;y.useEffect(()=>{var ue,Me;!w.current&&((ue=e.threadInfo)!=null&&ue.thread_id)&&h(!0),w.current=((Me=e.threadInfo)==null?void 0:Me.thread_id)||null},[(Ze=e.threadInfo)==null?void 0:Ze.thread_id]),y.useEffect(()=>{e.threadInfo||(g(""),h(!1),f(!1))},[e.threadInfo]),y.useEffect(()=>{Q>0&&h(!0)},[Q]),y.useEffect(()=>{if(!d||I.length===0)return;const ue=I[I.length-1],Me=(ue==null?void 0:ue.content)||"",$e=Me!==C.current;((ue==null?void 0:ue.isStreaming)||$e)&&requestAnimationFrame(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)}),C.current=Me},[d,I]);const ie=y.useMemo(()=>{const ue=e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp),Me=ue.toLocaleDateString(x,{weekday:"short"}),$e=ue.toLocaleDateString(x,{month:"short"}),pt=ue.getDate().toString().padStart(2,"0"),_t=ue.getFullYear(),fr=ue.toLocaleTimeString(x,{hour:"2-digit",minute:"2-digit",hour12:!0});return`${Me}, ${$e} ${pt}, ${_t} ${fr}`},[e.timestamp,x]),ae=E?"bg-gradient-to-br from-blue-100 to-blue-200 text-blue-900 dark:from-[#1f2a36] dark:to-[#1a2230] dark:text-[#c5d7ff]":"bg-gradient-to-br from-emerald-100 to-emerald-200 text-emerald-900 dark:from-[#0f1f17] dark:to-[#0b1712] dark:text-[#c7f5df]",le=`message-bubble min-w-0 break-words leading-relaxed ${E?"border border-blue-100/80 bg-transparent text-[#0f172a] shadow-[0_15px_35px_-20px_rgba(15,23,42,0.25)] dark:border-[#1f2a36] dark:bg-transparent dark:text-[#e5edff]":"border border-emerald-100 bg-transparent text-[#1c3226] shadow-[0_12px_30px_-18px_rgba(15,52,33,0.25)] dark:border-[#1a2b21] dark:bg-transparent dark:text-[#dffbea]"} rounded-2xl px-4 py-3`,Qe=E?"border-blue-100 bg-white/80 dark:border-[#1f2a36] dark:bg-white/5":"border-emerald-100 bg-white/80 dark:border-[#1a2b21] dark:bg-white/5",q=async()=>{try{await navigator.clipboard.writeText(e.content),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},pe=ue=>{c(l===ue?null:ue)},Ee=y.useCallback(ue=>(ue instanceof Date?ue:new Date(ue)).toLocaleTimeString(x,{hour:"2-digit",minute:"2-digit"}),[x]),Ae=async()=>{if(!n||!e.threadInfo||T)return;const ue=u.trim();if(ue){f(!0);try{await n(e.threadInfo.thread_id,e.id,ue),g(""),setTimeout(()=>{p.current&&p.current.focus()},100)}catch{setTimeout(()=>{p.current&&p.current.focus()},100)}finally{f(!1)}}},de=ue=>{ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),Ae())},be=!e.threadInfo||!n||a||k||B||T;y.useEffect(()=>{if(!d||be)return;const ue=p.current;if(!ue)return;const Me=requestAnimationFrame(()=>{ue.focus();const $e=ue.value.length;ue.setSelectionRange($e,$e)});return()=>cancelAnimationFrame(Me)},[d,be,B]),y.useEffect(()=>{if(p.current){const Me=p.current;Me.style.height="auto";const $e=Me.scrollHeight;Me.style.height=`${Math.min($e,120)}px`,Me.style.overflowY=$e>120?"auto":"hidden"}},[u]);const Ue=y.useMemo(()=>e.isStreaming&&(!e.content||e.content==="…")?b.jsx("div",{className:re,children:b.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[b.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"0ms"}}),b.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"150ms"}}),b.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"300ms"}})]})}):b.jsx(Uf,{content:nk(Td(e.content||"")),className:re,syntaxTheme:O}),[re,e.content,e.isStreaming,O]),xe=y.useMemo(()=>[...I].sort((Me,$e)=>{const pt=Me.timestamp instanceof Date?Me.timestamp.getTime():new Date(Me.timestamp).getTime(),_t=$e.timestamp instanceof Date?$e.timestamp.getTime():new Date($e.timestamp).getTime();return pt-_t}).map(Me=>{const $e=Me.role==="assistant",pt=$e?G:X,_t=Me.isStreaming&&(!Me.content||Me.content==="…")?b.jsx("div",{className:pt,children:b.jsxs("div",{className:"flex items-center gap-1.5 py-1",children:[b.jsx("span",{className:"inline-block h-2 w-2 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"0ms"}}),b.jsx("span",{className:"inline-block h-2 w-2 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"150ms"}}),b.jsx("span",{className:"inline-block h-2 w-2 animate-bounce rounded-full bg-gray-400 dark:bg-[#bfc2cd]",style:{animationDelay:"300ms"}})]})}):b.jsx(Uf,{content:nk(Td(Me.content||"")),className:pt,syntaxTheme:O});return b.jsxs("div",{className:"flex items-start gap-3",children:[b.jsx("div",{className:`mt-0.5 flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full ${$e?"bg-blue-100 text-blue-700 dark:bg-[#1f2a36] dark:text-[#c5d7ff]":"bg-emerald-100 text-emerald-700 dark:bg-[#1f2a36] dark:text-[#9ef0d5]"}`,children:$e?b.jsx(lR,{className:"h-3.5 w-3.5"}):b.jsx(cR,{className:"h-3.5 w-3.5"})}),b.jsxs("div",{className:"flex-1 min-w-0 rounded-2xl border border-white/70 bg-white/90 px-4 py-3 text-sm shadow-sm dark:border-white/5 dark:bg-white/5 backdrop-blur overflow-hidden",children:[b.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] font-semibold uppercase tracking-wide text-blue-900/70 dark:text-[#c5d7ff]",children:[b.jsx("span",{children:$e?"Assistant":"You"}),b.jsx("span",{children:Ee(Me.timestamp)})]}),b.jsx("div",{className:"thread-markdown-wrapper overflow-x-auto",children:_t})]})]},Me.id)}),[Ee,O,G,I,X]);return b.jsxs("div",{className:"group flex items-start gap-3 px-1 animate-fadeIn min-w-0 sm:px-0",children:[b.jsx("div",{className:`flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full self-start -mt-2 ml-1 shadow-sm ring-2 ring-white/50 dark:ring-white/10 sm:-mt-3 sm:ml-2 ${ae}`,children:E?b.jsx(lR,{className:"h-5 w-5"}):b.jsx(cR,{className:"h-5 w-5"})}),b.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[b.jsxs("div",{className:"flex flex-col gap-1.5 mb-1",children:[b.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-gray-700 dark:text-[#ececf1]",children:E?"Assistant":"You"}),b.jsx("span",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:ie})]}),b.jsxs("div",{className:le,children:[Ue,e.attachments&&e.attachments.length>0&&b.jsx("div",{className:"mt-3 space-y-2",children:e.attachments.map(ue=>b.jsxs("div",{className:`flex items-center gap-3 rounded-xl border p-3 ${Qe}`,children:[b.jsx(Jle,{className:"h-4 w-4 text-gray-500 dark:text-[#bfc2cd]"}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("p",{className:"truncate text-sm font-medium text-[#353740] dark:text-[#ececf1]",children:ue.filename}),b.jsxs("p",{className:"text-xs text-gray-500 dark:text-[#bfc2cd]",children:[(ue.file_size/1024).toFixed(1)," KB"]})]})]},ue.file_id))}),e.audio&&E&&!e.isStreaming&&b.jsx(e$e,{audio:e.audio,audioFormat:e.audioFormat,autoPlay:!1})]}),E&&!e.isStreaming&&b.jsxs("div",{className:"flex items-center gap-1 md:gap-2 text-xs text-gray-500 transition-opacity dark:text-[#bfc2cd]",children:[b.jsxs("button",{onClick:q,className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a]",title:"Copy message",children:[b.jsx(Tle,{className:"h-4 w-4"}),b.jsx("span",{className:"hidden sm:inline",children:"Copy"})]}),t&&b.jsxs("button",{onClick:()=>t(e.id),className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a]",title:"Regenerate response",children:[b.jsx(Ace,{className:"h-4 w-4"}),b.jsx("span",{className:"hidden sm:inline",children:"Retry"})]}),D&&r&&e.supportsThreading&&!e.threadInfo&&i&&b.jsxs("button",{onClick:()=>r(e.id,i),className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a]",title:"Start thread for follow-up questions",children:[b.jsx(_0,{className:"h-4 w-4"}),b.jsx("span",{className:"hidden sm:inline",children:"Start Thread"})]}),V_e()&&b.jsxs("div",{className:"flex items-center gap-1",children:[b.jsx("button",{onClick:()=>pe("up"),className:`rounded p-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a] ${l==="up"?"text-[#353740] dark:text-[#ececf1]":""}`,title:"Good response",children:b.jsx(lce,{className:"h-4 w-4"})}),b.jsx("button",{onClick:()=>pe("down"),className:`rounded p-1 hover:bg-gray-200 dark:hover:bg-[#3c3f4a] ${l==="down"?"text-[#353740] dark:text-[#ececf1]":""}`,title:"Poor response",children:b.jsx(oce,{className:"h-4 w-4"})})]}),s&&b.jsx("span",{children:"Copied"})]}),D&&e.threadInfo&&b.jsxs("div",{className:"thread-panel mt-4 rounded-xl border border-blue-100/80 bg-blue-50/70 p-3 sm:p-4 text-sm shadow-sm ring-1 ring-blue-100/60 dark:border-[#1f2a36] dark:bg-[#0f1821] dark:ring-[#1f2a36]",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm font-semibold text-blue-900 dark:text-[#c5d7ff]",children:[b.jsxs("div",{className:"inline-flex items-center gap-2 uppercase tracking-wide text-xs sm:text-sm",children:[b.jsx(_0,{className:"h-3.5 w-3.5"}),b.jsxs("span",{children:["Thread",Q>0?` (${Q})`:""]})]}),b.jsx("button",{onClick:()=>h(ue=>!ue),className:"inline-flex items-center gap-1.5 sm:gap-2 rounded-full border border-blue-200/80 px-2.5 sm:px-3 py-1.5 text-xs uppercase tracking-wide text-blue-900 transition hover:bg-white/70 dark:border-[#233449] dark:text-[#c5d7ff] dark:hover:bg-white/10",children:d?b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"hidden sm:inline",children:"Hide"}),b.jsx(zle,{className:"h-4 w-4 sm:h-3 sm:w-3"})]}):b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"hidden sm:inline",children:"Show"}),b.jsx(_6,{className:"h-4 w-4 sm:h-3 sm:w-3"})]})})]}),d&&b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:m,className:"mt-3 space-y-3 max-h-96 overflow-y-auto scroll-smooth",style:{scrollBehavior:"auto"},children:xe}),v&&b.jsx("div",{className:"mt-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-[#2f2410] dark:text-amber-100",children:v}),b.jsx("div",{className:"mt-3 rounded-xl border border-white/80 bg-white/95 p-3 shadow-sm dark:border-white/10 dark:bg-white/10",children:b.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3",children:[b.jsx("textarea",{ref:p,className:"flex-1 w-full sm:w-auto min-w-0 resize-none rounded-lg border border-gray-200 bg-gray-50 px-3 py-2.5 text-base sm:text-sm text-[#353740] placeholder-gray-500 outline-none transition focus:border-gray-400 focus:ring-1 focus:ring-gray-300 disabled:opacity-60 dark:border-[#3c3f4a] dark:bg-[#2d2f39] dark:text-[#ececf1] dark:placeholder-[#8e8ea0] dark:focus:border-[#8e8ea0] dark:focus:ring-[#8e8ea0]",placeholder:Q>0?"Reply in thread...":"Ask a follow-up...",value:u,onChange:ue=>g(ue.target.value),onKeyDown:de,disabled:be,rows:1,maxLength:z,style:{minHeight:"44px",maxHeight:"120px",outline:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none",appearance:"none"}}),b.jsxs("div",{className:"flex items-center justify-between sm:justify-end gap-2",children:[u.length>0&&b.jsx("div",{className:"text-xs text-gray-500 dark:text-[#bfc2cd] whitespace-nowrap",children:b.jsxs("span",{className:u.length>=z?"text-red-600 font-semibold":"",children:[u.length,"/",z]})}),b.jsx("button",{type:"button",onClick:Ae,disabled:be||u.trim().length===0,className:`flex h-11 w-11 sm:h-9 sm:w-9 items-center justify-center rounded-full transition active:scale-95 ${u.trim().length>0&&!be?"bg-[#10a37f] text-white hover:bg-[#0f8f6f]":"bg-gray-200 text-gray-400 dark:bg-[#2f313a] dark:text-[#6b6f7a]"} disabled:cursor-not-allowed`,title:"Send thread message",children:B?b.jsx(tu,{className:"h-5 w-5 sm:h-4 sm:w-4 animate-spin"}):b.jsx(q6,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]})]})})]})]})]})]})}function A$e(e=800,t=100,r="sine"){try{if(typeof window>"u"){Be("[SoundEffects] Window is not available for audio playback");return}const n=window.AudioContext??window.webkitAudioContext;if(!n){Be("[SoundEffects] AudioContext not supported in this browser");return}const A=new n,i=A.createOscillator(),a=A.createGain();i.connect(a),a.connect(A.destination),i.frequency.value=e,i.type=r,a.gain.setValueAtTime(.3,A.currentTime),a.gain.exponentialRampToValueAtTime(.01,A.currentTime+t/1e3),i.start(A.currentTime),i.stop(A.currentTime+t/1e3)}catch{}}const i$e={messageSent:{frequency:600,duration:80,type:"sine"},messageReceived:{frequency:800,duration:100,type:"sine"},success:{frequency:1e3,duration:150,type:"sine"},error:{frequency:400,duration:200,type:"square"},notification:{frequency:700,duration:120,type:"sine"}};function hd(e,t){if(!t)return;const r=i$e[e];if(r)try{A$e(r.frequency,r.duration,r.type),Be(`[SoundEffects] Playing ${e} sound effect`)}catch{}}function a$e({messages:e,onRegenerate:t,onStartThread:r,onSendThreadMessage:n,sessionId:A,isLoading:i}){const a=y.useRef(null),s=y.useRef(null),o=y.useRef(e.length),l=y.useRef(""),c=y.useRef(i),u=y.useRef(!0),{settings:g}=tm(),{topLevelMessages:d,threadLookup:h}=y.useMemo(()=>{const w=new Map,p=[];return e.forEach(m=>{if(m.isThreadMessage&&m.parentMessageId){const C=w.get(m.parentMessageId)||[];w.set(m.parentMessageId,[...C,m]);return}p.push(m)}),{topLevelMessages:p,threadLookup:w}},[e]),B=()=>{if(!s.current)return;const{scrollTop:w,scrollHeight:p,clientHeight:m}=s.current,E=p-w-m<200;u.current=E},f=y.useCallback(()=>{requestAnimationFrame(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)})},[]);return y.useEffect(()=>{const w=e.length,p=o.current,m=w>p,C=e[e.length-1],E=(C==null?void 0:C.content)||"",I=E!==l.current,Q=(C==null?void 0:C.isStreaming)??!1;m||Q&&I?(f(),u.current=!0):u.current&&I&&f(),o.current=w,l.current=E},[e,f]),y.useEffect(()=>{i&&(f(),u.current=!0)},[i,f]),y.useEffect(()=>{if(c.current&&!i){const w=e[e.length-1];(w==null?void 0:w.role)==="assistant"&&w.content&&hd("messageReceived",g.soundEnabled)}c.current=i},[i,e,g.soundEnabled]),d.length===0?b.jsx("div",{className:"flex-1 flex items-center justify-center px-4 sm:px-6",children:b.jsxs("div",{className:"text-center text-lg text-gray-500 dark:text-[#bfc2cd]",children:[b.jsx("p",{className:"text-xl",children:"Your messages will appear here."}),b.jsx("p",{className:"mt-1 text-lg",children:"Start the conversation by sending a prompt below."})]})}):b.jsx("div",{ref:s,className:"message-list flex-1 overflow-y-auto py-6",onScroll:B,children:b.jsxs("div",{className:"space-y-6 px-3 sm:px-4",children:[d.map(w=>b.jsx(n$e,{message:w,onRegenerate:t,onStartThread:r,onSendThreadMessage:n,threadMessages:h.get(w.id),sessionId:A,isThreadSendDisabled:i},w.id)),b.jsx("div",{ref:a,className:"h-8"})]})})}const s$e=2e3;function o$e(e,t){const[r,n]=y.useState(!1),[A,i]=y.useState(null),a=y.useRef(null),s=y.useRef(""),o=y.useRef(!1),l=y.useRef(null),c=y.useCallback(()=>{if(!s.current)return;const w=s.current;s.current="",e(" "+w)},[e]),u=typeof window<"u"&&("webkitSpeechRecognition"in window||"SpeechRecognition"in window),g=y.useCallback(()=>{!t||o.current||(o.current=!0,t())},[t]),d=y.useCallback(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),h=y.useCallback(()=>{d(),l.current=setTimeout(()=>{a.current?a.current.stop():g()},s$e)},[d,g]),B=y.useCallback(()=>{if(!u){i("Speech recognition is not supported in this browser. Please try Chrome, Edge, or Safari.");return}if(!r)try{o.current=!1;const w=window.SpeechRecognition||window.webkitSpeechRecognition,p=new w;p.continuous=!0,p.interimResults=!0,p.lang=navigator.language||"en-US",p.maxAlternatives=1,p.onstart=()=>{n(!0),i(null),Be("Speech recognition started"),h()},p.onresult=m=>{let C="",E="";for(let I=m.resultIndex;I<m.results.length;I++){const Q=m.results[I][0].transcript;m.results[I].isFinal?C+=Q:E+=Q}E&&(s.current=E),C&&(s.current="",e(" "+C)),h()},p.onend=()=>{d(),c(),n(!1),a.current=null,Be("Speech recognition ended"),g()},p.onerror=m=>{switch(d(),Ru("Speech recognition error:",m.error),n(!1),a.current=null,s.current="",g(),m.error){case"no-speech":i("No speech detected. Please try again.");break;case"audio-capture":i("Microphone access denied. Please allow microphone access and try again.");break;case"not-allowed":i("Microphone access not allowed. Please enable microphone permissions.");break;case"network":i("Network error occurred. Please check your connection.");break;default:i(`Speech recognition error: ${m.error}`)}},p.start(),a.current=p}catch{i("Failed to start speech recognition. Please try again."),n(!1)}},[u,e,r,c,g,h,d]),f=y.useCallback(()=>{if(a.current){const w=a.current;w.onend=null,w.onerror=null,w.onresult=null,w.onstart=null;try{w.stop()}catch{}a.current=null}d(),c(),n(!1),i(null),g()},[d,c,g]);return{isListening:r,isSupported:u,startListening:B,stopListening:f,error:A}}const l$e="2.9.2",c$e={"@schmitech/chatbot-api":"^2.1.5"},rse={version:l$e,dependencies:c$e},nse=rse.version,MV=rse.dependencies["@schmitech/chatbot-api"];async function Ak(){try{return(await kt(()=>import("./api-BjZW-Eka.js"),[])).version||MV}catch{return MV}}async function Ase(){const e=await Ak();return{appVersion:nse,apiVersion:e,isLocalApi:!1}}let Ja=null;function Xg(){let e=null,t=null;const r=(A,i,a,s)=>{e=a||null,t=s||null},n=()=>{if(!t)throw new Error("Adapter name is required when middleware is enabled");return{async*streamChat(A,i,a,s,o,l,c,u,g,d,h){var w,p;const B={messages:[{role:"user",content:A}],stream:i!==!1};a&&a.length>0&&(B.file_ids=a),s&&(B.thread_id=s),o&&(B.audio_input=o),l&&(B.audio_format=l),c&&(B.language=c),u!==void 0&&(B.return_audio=u),g&&(B.tts_voice=g),d&&(B.source_language=d),h&&(B.target_language=h);const f=await fetch("/api/v1/chat",{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t,...e?{"X-Session-ID":e}:{}},body:JSON.stringify(B)});if(!f.ok)throw new Error(`API request failed: ${f.status} ${f.statusText}`);if((w=f.headers.get("content-type"))!=null&&w.includes("text/event-stream")){const m=(p=f.body)==null?void 0:p.getReader(),C=new TextDecoder;let E="";if(!m)throw new Error("Response body is not readable");for(;;){const{done:I,value:Q}=await m.read();if(I)break;E+=C.decode(Q,{stream:!0});const N=E.split(`
996
996
  `);E=N.pop()||"";for(const k of N)if(k.startsWith("data: "))try{const x=JSON.parse(k.substring(6));if(x.request_id&&!x.response&&!x.done){yield{text:"",done:!1,request_id:x.request_id};continue}yield{text:x.text||x.content||x.message||x.response||"",done:x.done||!1,audio:x.audio,audioFormat:x.audio_format||x.audioFormat,audio_chunk:x.audio_chunk,chunk_index:x.chunk_index,threading:x.threading}}catch{}}if(E.trim()){const I=E.split(`
997
- `);for(const Q of I)if(Q.startsWith("data: "))try{const N=JSON.parse(Q.substring(6));if(N.request_id&&!N.response&&!N.done){yield{text:"",done:!1,request_id:N.request_id};continue}yield{text:N.text||N.content||N.message||N.response||"",done:N.done||!1,audio:N.audio,audioFormat:N.audio_format||N.audioFormat,audio_chunk:N.audio_chunk,chunk_index:N.chunk_index,threading:N.threading}}catch{}}}else{const m=await f.json();yield{text:m.message||m.response||"",done:!0}}},async createThread(A,i){const a=await fetch("/api/threads",{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t,"X-Session-ID":i},body:JSON.stringify({message_id:A,session_id:i})});if(!a.ok)throw new Error(`Failed to create thread: ${a.statusText}`);return a.json()},async getThreadInfo(A){const i=await fetch(`/api/threads/${A}`,{headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to get thread info: ${i.statusText}`);return i.json()},async deleteThread(A){const i=await fetch(`/api/threads/${A}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to delete thread: ${i.statusText}`);return i.json()},async clearConversationHistory(A){const i=await fetch(`/api/admin/chat-history/${A||e}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to clear history: ${i.statusText}`);return i.json()},async getConversationHistory(A,i){const a=A||e;if(!a)throw new Error("No session ID available for conversation history");const s=typeof i=="number"&&Number.isFinite(i)&&i>0?`?limit=${Math.floor(i)}`:"",o=await fetch(`/api/admin/chat-history/${a}${s}`,{headers:{"X-Adapter-Name":t}});if(!o.ok)throw new Error(`Failed to load history: ${o.statusText}`);return o.json()},async deleteConversationWithFiles(A,i){const a=A||e,s=i&&i.length>0?`?file_ids=${i.join(",")}`:"",o=await fetch(`/api/admin/conversations/${a}${s}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!o.ok)throw new Error(`Failed to delete conversation: ${o.statusText}`);return o.json()},getSessionId:()=>e,async uploadFile(A){const i=new FormData;i.append("file",A);const a=await fetch("/api/files/upload",{method:"POST",headers:{"X-Adapter-Name":t},body:i});if(!a.ok)throw new Error(`Failed to upload file: ${a.statusText}`);return a.json()},async listFiles(){const A=await fetch("/api/files",{headers:{"X-Adapter-Name":t}});if(!A.ok)throw new Error(`Failed to list files: ${A.statusText}`);const i=await A.json();return Array.isArray(i)?i:i.files||[]},async getFileInfo(A){const i=await fetch(`/api/files/${A}`,{headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to get file info: ${i.statusText}`);return i.json()},async queryFile(A,i,a){const s=await fetch(`/api/files/${A}/query`,{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t},body:JSON.stringify({query:i,max_results:a})});if(!s.ok)throw new Error(`Failed to query file: ${s.statusText}`);return s.json()},async deleteFile(A){const i=await fetch(`/api/files/${A}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to delete file: ${i.statusText}`);return i.json()},async validateApiKey(){const A=await fetch(`/api/admin/api-keys/${t}/status`,{headers:{"X-Adapter-Name":t}});if(!A.ok)throw new Error(`Failed to validate API key: ${A.statusText}`);return A.json()},async getAdapterInfo(){const a=await(async s=>await fetch(s,{headers:{"X-Adapter-Name":t}}))("/api/admin/adapters/info");if(!a.ok){const s=await a.text();throw new Error(`Failed to get adapter info: ${a.status} ${a.statusText} - ${s}`)}return a.json()},async stopChat(A,i){const a=await fetch("/api/v1/chat/stop",{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t},body:JSON.stringify({session_id:A,request_id:i})});return a.ok?(await a.json()).status==="cancelled":(console.warn(`[MiddlewareApi] stopChat failed: ${a.status} ${a.statusText}`),!1)}}};return{configureApi:r,streamChat:async function*(A,i,a,s,o,l,c,u,g,d,h){yield*n().streamChat(A,i,a,s,o,l,c,u,g,d,h)},stopChat:async(A,i)=>n().stopChat(A,i),ApiClient:class{constructor(i){pA(this,"client");t=i.adapterName||null,e=i.sessionId||null,this.client=n()}async*streamChat(...i){yield*this.client.streamChat(...i)}get createThread(){var i;return(i=this.client.createThread)==null?void 0:i.bind(this.client)}get getThreadInfo(){var i;return(i=this.client.getThreadInfo)==null?void 0:i.bind(this.client)}get deleteThread(){var i;return(i=this.client.deleteThread)==null?void 0:i.bind(this.client)}get clearConversationHistory(){var i;return(i=this.client.clearConversationHistory)==null?void 0:i.bind(this.client)}get getConversationHistory(){var i;return(i=this.client.getConversationHistory)==null?void 0:i.bind(this.client)}get deleteConversationWithFiles(){var i;return(i=this.client.deleteConversationWithFiles)==null?void 0:i.bind(this.client)}get getSessionId(){var i;return(i=this.client.getSessionId)==null?void 0:i.bind(this.client)}get uploadFile(){var i;return(i=this.client.uploadFile)==null?void 0:i.bind(this.client)}get listFiles(){var i;return(i=this.client.listFiles)==null?void 0:i.bind(this.client)}get getFileInfo(){var i;return(i=this.client.getFileInfo)==null?void 0:i.bind(this.client)}get queryFile(){var i;return(i=this.client.queryFile)==null?void 0:i.bind(this.client)}get deleteFile(){var i;return(i=this.client.deleteFile)==null?void 0:i.bind(this.client)}get validateApiKey(){var i;return(i=this.client.validateApiKey)==null?void 0:i.bind(this.client)}get getAdapterInfo(){var i;return(i=this.client.getAdapterInfo)==null?void 0:i.bind(this.client)}get stopChat(){var i;return(i=this.client.stopChat)==null?void 0:i.bind(this.client)}}}}async function u$e(e){return e==="@local-node-api/api.mjs"?kt(()=>import("./api-BHF9IxKN.js"),[]):import(e)}async function g$e(){if(Ja)return Ja;const e=O_e(),t=W_e(),r=sr();try{if(e){let n;t?t.startsWith("/")?n=t.startsWith("/src/")?`.${t.substring(4)}${t.endsWith(".mjs")?"":"/api.mjs"}`:"../../../node-api/dist/api.mjs":t.startsWith("../")||t.startsWith("./")?n=t.endsWith(".mjs")?t:`${t}/api.mjs`:n=`./${t}${t.endsWith(".mjs")?"":"/api.mjs"}`:n="../../../node-api/dist/api.mjs",Be(`🔧 Loading local API from: ${n}`);const A=await u$e(n);r?(Be("🔐 API Middleware enabled - routing through proxy"),Ja=Xg()):Ja={configureApi:A.configureApi,streamChat:A.streamChat,ApiClient:A.ApiClient},Be("✅ Local API loaded successfully")}else{Be("📦 Loading npm package API");const n=await kt(()=>import("./api-FdNd9lEW.js"),[]),A=async function*(s,o,l,c,u,g,d,h,B,f,w){yield*n.streamChat(s,o,l,c,u,g,d,h,B,f,w)};class i{constructor(o){pA(this,"client");if(r&&o.adapterName){const l=Xg();this.client=new l.ApiClient(o)}else this.client=new n.ApiClient(o)}async*streamChat(o,l,c,u,g,d,h,B,f,w,p){yield*this.client.streamChat(o,l,c,u,g,d,h,B,f,w,p)}get createThread(){var o;return(o=this.client.createThread)==null?void 0:o.bind(this.client)}get getThreadInfo(){var o;return(o=this.client.getThreadInfo)==null?void 0:o.bind(this.client)}get deleteThread(){var o;return(o=this.client.deleteThread)==null?void 0:o.bind(this.client)}get clearConversationHistory(){var o;return(o=this.client.clearConversationHistory)==null?void 0:o.bind(this.client)}get getConversationHistory(){var o;return(o=this.client.getConversationHistory)==null?void 0:o.bind(this.client)}get deleteConversationWithFiles(){var o;return(o=this.client.deleteConversationWithFiles)==null?void 0:o.bind(this.client)}get getSessionId(){var o;return(o=this.client.getSessionId)==null?void 0:o.bind(this.client)}get uploadFile(){var o;return(o=this.client.uploadFile)==null?void 0:o.bind(this.client)}get listFiles(){var o;return(o=this.client.listFiles)==null?void 0:o.bind(this.client)}get getFileInfo(){var o;return(o=this.client.getFileInfo)==null?void 0:o.bind(this.client)}get queryFile(){var o;return(o=this.client.queryFile)==null?void 0:o.bind(this.client)}get deleteFile(){var o;return(o=this.client.deleteFile)==null?void 0:o.bind(this.client)}get validateApiKey(){var o;return(o=this.client.validateApiKey)==null?void 0:o.bind(this.client)}get getAdapterInfo(){var o;return(o=this.client.getAdapterInfo)==null?void 0:o.bind(this.client)}}r?(Be("🔐 API Middleware enabled - routing through proxy"),Ja=Xg()):Ja={configureApi:n.configureApi,streamChat:A,ApiClient:i};const a=await Ak();Be(`✅ NPM package API loaded successfully (v${a})`)}}catch(n){if(e)try{const A=await kt(()=>import("./api-FdNd9lEW.js"),[]),i=async function*(o,l,c,u,g,d,h,B,f,w,p){yield*A.streamChat(o,l,c,u,g,d,h,B,f,w,p)};class a{constructor(l){pA(this,"client");if(r&&l.adapterName){const c=Xg();this.client=new c.ApiClient(l)}else this.client=new A.ApiClient(l)}async*streamChat(l,c,u,g,d,h,B,f,w,p,m){yield*this.client.streamChat(l,c,u,g,d,h,B,f,w,p,m)}get createThread(){var l;return(l=this.client.createThread)==null?void 0:l.bind(this.client)}get getThreadInfo(){var l;return(l=this.client.getThreadInfo)==null?void 0:l.bind(this.client)}get deleteThread(){var l;return(l=this.client.deleteThread)==null?void 0:l.bind(this.client)}get clearConversationHistory(){var l;return(l=this.client.clearConversationHistory)==null?void 0:l.bind(this.client)}get getConversationHistory(){var l;return(l=this.client.getConversationHistory)==null?void 0:l.bind(this.client)}get deleteConversationWithFiles(){var l;return(l=this.client.deleteConversationWithFiles)==null?void 0:l.bind(this.client)}get getSessionId(){var l;return(l=this.client.getSessionId)==null?void 0:l.bind(this.client)}get uploadFile(){var l;return(l=this.client.uploadFile)==null?void 0:l.bind(this.client)}get listFiles(){var l;return(l=this.client.listFiles)==null?void 0:l.bind(this.client)}get getFileInfo(){var l;return(l=this.client.getFileInfo)==null?void 0:l.bind(this.client)}get queryFile(){var l;return(l=this.client.queryFile)==null?void 0:l.bind(this.client)}get deleteFile(){var l;return(l=this.client.deleteFile)==null?void 0:l.bind(this.client)}get validateApiKey(){var l;return(l=this.client.validateApiKey)==null?void 0:l.bind(this.client)}get getAdapterInfo(){var l;return(l=this.client.getAdapterInfo)==null?void 0:l.bind(this.client)}}r?(Be("🔐 API Middleware enabled - routing through proxy"),Ja=Xg()):Ja={configureApi:A.configureApi,streamChat:i,ApiClient:a};const s=await Ak();Be(`✅ Fallback to NPM package successful (v${s})`)}catch{throw new Error("Failed to load both local and npm API packages")}else throw n}return Ja}async function qr(){return await g$e()}const Jp=mo(),d$e=()=>{try{if(typeof window>"u"||!window.localStorage)return null;const e=window.localStorage.getItem("chat-api-url");return e&&e===ql?(window.localStorage.removeItem("chat-api-url"),null):e}catch{return null}},Zg=e=>{const t=e==null?void 0:e.trim();if(t)return t;const r=d$e();return r&&r!==ql?r:Or()},Op=()=>typeof window>"u"?null:window.CHATBOT_API_KEY||null;class Gh{static async uploadFile(t,r,n,A,i){try{const a=lt.maxFileSizeMB*1024*1024;if(t.size>a)throw new Error(`File size exceeds maximum limit of ${lt.maxFileSizeMB}MB`);if(!(["application/pdf","text/plain","text/markdown","text/csv","application/json","text/html","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","application/vnd.ms-excel.sheet.macroEnabled.12","text/x-python","text/x-python-script","text/x-java-source","text/x-java","text/x-sql","text/javascript","application/javascript","text/typescript","application/typescript","text/x-c++src","text/x-csrc","text/x-c","text/x-go","text/x-rust","text/x-ruby","text/x-php","text/x-shellscript","text/x-sh","text/yaml","text/x-yaml","text/xml","application/xml","text/css","text/x-scss","text/x-sass","text/x-less","image/png","image/jpeg","image/tiff","audio/wav","audio/mpeg","audio/mp3","audio/mp4","audio/ogg","audio/flac","audio/webm","audio/x-m4a","audio/aac","text/vtt"].includes(t.type)||/\.(pdf|txt|md|csv|json|html|docx|pptx|xlsx|py|java|sql|js|mjs|ts|tsx|cpp|cxx|cc|c|h|hpp|go|rs|rb|php|sh|bash|zsh|yaml|yml|xml|css|scss|sass|less|png|jpe?g|tiff?|wav|mp3|mp4|ogg|flac|webm|m4a|aac|vtt)$/i.test(t.name)||(t.type==="application/x-zip-compressed"||t.type==="application/zip")&&/\.xlsx$/i.test(t.name)))throw new Error(`File type not supported: ${t.type||"unknown"}`);r&&r({filename:t.name,progress:0,status:"uploading"});const l=await qr(),c=Zg(A),u=sr();let g=null,d=null;if(u){if(d=i||(typeof window<"u"?localStorage.getItem("chat-adapter-name"):null),!d)throw new Error("Adapter not configured. Please select an adapter from the dropdown.");Be(`🔑 Using adapter: ${d}`)}else{if(g=n||localStorage.getItem("chat-api-key")||Op()||Jp,!g||g==="your-api-key-here")throw new Error(`API key not configured or invalid. Please:
997
+ `);for(const Q of I)if(Q.startsWith("data: "))try{const N=JSON.parse(Q.substring(6));if(N.request_id&&!N.response&&!N.done){yield{text:"",done:!1,request_id:N.request_id};continue}yield{text:N.text||N.content||N.message||N.response||"",done:N.done||!1,audio:N.audio,audioFormat:N.audio_format||N.audioFormat,audio_chunk:N.audio_chunk,chunk_index:N.chunk_index,threading:N.threading}}catch{}}}else{const m=await f.json();yield{text:m.message||m.response||"",done:!0}}},async createThread(A,i){const a=await fetch("/api/threads",{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t,"X-Session-ID":i},body:JSON.stringify({message_id:A,session_id:i})});if(!a.ok)throw new Error(`Failed to create thread: ${a.statusText}`);return a.json()},async getThreadInfo(A){const i=await fetch(`/api/threads/${A}`,{headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to get thread info: ${i.statusText}`);return i.json()},async deleteThread(A){const i=await fetch(`/api/threads/${A}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to delete thread: ${i.statusText}`);return i.json()},async clearConversationHistory(A){const i=await fetch(`/api/admin/chat-history/${A||e}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to clear history: ${i.statusText}`);return i.json()},async getConversationHistory(A,i){const a=A||e;if(!a)throw new Error("No session ID available for conversation history");const s=typeof i=="number"&&Number.isFinite(i)&&i>0?`?limit=${Math.floor(i)}`:"",o=await fetch(`/api/admin/chat-history/${a}${s}`,{headers:{"X-Adapter-Name":t}});if(!o.ok)throw new Error(`Failed to load history: ${o.statusText}`);return o.json()},async deleteConversationWithFiles(A,i){const a=A||e,s=i&&i.length>0?`?file_ids=${i.join(",")}`:"",o=await fetch(`/api/admin/conversations/${a}${s}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!o.ok)throw new Error(`Failed to delete conversation: ${o.statusText}`);return o.json()},getSessionId:()=>e,async uploadFile(A){const i=new FormData;i.append("file",A);const a=await fetch("/api/files/upload",{method:"POST",headers:{"X-Adapter-Name":t},body:i});if(!a.ok)throw new Error(`Failed to upload file: ${a.statusText}`);return a.json()},async listFiles(){const A=await fetch("/api/files",{headers:{"X-Adapter-Name":t}});if(!A.ok)throw new Error(`Failed to list files: ${A.statusText}`);const i=await A.json();return Array.isArray(i)?i:i.files||[]},async getFileInfo(A){const i=await fetch(`/api/files/${A}`,{headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to get file info: ${i.statusText}`);return i.json()},async queryFile(A,i,a){const s=await fetch(`/api/files/${A}/query`,{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t},body:JSON.stringify({query:i,max_results:a})});if(!s.ok)throw new Error(`Failed to query file: ${s.statusText}`);return s.json()},async deleteFile(A){const i=await fetch(`/api/files/${A}`,{method:"DELETE",headers:{"X-Adapter-Name":t}});if(!i.ok)throw new Error(`Failed to delete file: ${i.statusText}`);return i.json()},async validateApiKey(){const A=await fetch(`/api/admin/api-keys/${t}/status`,{headers:{"X-Adapter-Name":t}});if(!A.ok)throw new Error(`Failed to validate API key: ${A.statusText}`);return A.json()},async getAdapterInfo(){const a=await(async s=>await fetch(s,{headers:{"X-Adapter-Name":t}}))("/api/admin/adapters/info");if(!a.ok){const s=await a.text();throw new Error(`Failed to get adapter info: ${a.status} ${a.statusText} - ${s}`)}return a.json()},async stopChat(A,i){const a=await fetch("/api/v1/chat/stop",{method:"POST",headers:{"Content-Type":"application/json","X-Adapter-Name":t},body:JSON.stringify({session_id:A,request_id:i})});return a.ok?(await a.json()).status==="cancelled":(console.warn(`[MiddlewareApi] stopChat failed: ${a.status} ${a.statusText}`),!1)}}};return{configureApi:r,streamChat:async function*(A,i,a,s,o,l,c,u,g,d,h){yield*n().streamChat(A,i,a,s,o,l,c,u,g,d,h)},stopChat:async(A,i)=>n().stopChat(A,i),ApiClient:class{constructor(i){pA(this,"client");t=i.adapterName||null,e=i.sessionId||null,this.client=n()}async*streamChat(...i){yield*this.client.streamChat(...i)}get createThread(){var i;return(i=this.client.createThread)==null?void 0:i.bind(this.client)}get getThreadInfo(){var i;return(i=this.client.getThreadInfo)==null?void 0:i.bind(this.client)}get deleteThread(){var i;return(i=this.client.deleteThread)==null?void 0:i.bind(this.client)}get clearConversationHistory(){var i;return(i=this.client.clearConversationHistory)==null?void 0:i.bind(this.client)}get getConversationHistory(){var i;return(i=this.client.getConversationHistory)==null?void 0:i.bind(this.client)}get deleteConversationWithFiles(){var i;return(i=this.client.deleteConversationWithFiles)==null?void 0:i.bind(this.client)}get getSessionId(){var i;return(i=this.client.getSessionId)==null?void 0:i.bind(this.client)}get uploadFile(){var i;return(i=this.client.uploadFile)==null?void 0:i.bind(this.client)}get listFiles(){var i;return(i=this.client.listFiles)==null?void 0:i.bind(this.client)}get getFileInfo(){var i;return(i=this.client.getFileInfo)==null?void 0:i.bind(this.client)}get queryFile(){var i;return(i=this.client.queryFile)==null?void 0:i.bind(this.client)}get deleteFile(){var i;return(i=this.client.deleteFile)==null?void 0:i.bind(this.client)}get validateApiKey(){var i;return(i=this.client.validateApiKey)==null?void 0:i.bind(this.client)}get getAdapterInfo(){var i;return(i=this.client.getAdapterInfo)==null?void 0:i.bind(this.client)}get stopChat(){var i;return(i=this.client.stopChat)==null?void 0:i.bind(this.client)}}}}async function u$e(e){return e==="@local-node-api/api.mjs"?kt(()=>import("./api-BHF9IxKN.js"),[]):import(e)}async function g$e(){if(Ja)return Ja;const e=O_e(),t=W_e(),r=sr();try{if(e){let n;t?t.startsWith("/")?n=t.startsWith("/src/")?`.${t.substring(4)}${t.endsWith(".mjs")?"":"/api.mjs"}`:"../../../node-api/dist/api.mjs":t.startsWith("../")||t.startsWith("./")?n=t.endsWith(".mjs")?t:`${t}/api.mjs`:n=`./${t}${t.endsWith(".mjs")?"":"/api.mjs"}`:n="../../../node-api/dist/api.mjs",Be(`🔧 Loading local API from: ${n}`);const A=await u$e(n);r?(Be("🔐 API Middleware enabled - routing through proxy"),Ja=Xg()):Ja={configureApi:A.configureApi,streamChat:A.streamChat,ApiClient:A.ApiClient},Be("✅ Local API loaded successfully")}else{Be("📦 Loading npm package API");const n=await kt(()=>import("./api-BjZW-Eka.js"),[]),A=async function*(s,o,l,c,u,g,d,h,B,f,w){yield*n.streamChat(s,o,l,c,u,g,d,h,B,f,w)};class i{constructor(o){pA(this,"client");if(r&&o.adapterName){const l=Xg();this.client=new l.ApiClient(o)}else this.client=new n.ApiClient(o)}async*streamChat(o,l,c,u,g,d,h,B,f,w,p){yield*this.client.streamChat(o,l,c,u,g,d,h,B,f,w,p)}get createThread(){var o;return(o=this.client.createThread)==null?void 0:o.bind(this.client)}get getThreadInfo(){var o;return(o=this.client.getThreadInfo)==null?void 0:o.bind(this.client)}get deleteThread(){var o;return(o=this.client.deleteThread)==null?void 0:o.bind(this.client)}get clearConversationHistory(){var o;return(o=this.client.clearConversationHistory)==null?void 0:o.bind(this.client)}get getConversationHistory(){var o;return(o=this.client.getConversationHistory)==null?void 0:o.bind(this.client)}get deleteConversationWithFiles(){var o;return(o=this.client.deleteConversationWithFiles)==null?void 0:o.bind(this.client)}get getSessionId(){var o;return(o=this.client.getSessionId)==null?void 0:o.bind(this.client)}get uploadFile(){var o;return(o=this.client.uploadFile)==null?void 0:o.bind(this.client)}get listFiles(){var o;return(o=this.client.listFiles)==null?void 0:o.bind(this.client)}get getFileInfo(){var o;return(o=this.client.getFileInfo)==null?void 0:o.bind(this.client)}get queryFile(){var o;return(o=this.client.queryFile)==null?void 0:o.bind(this.client)}get deleteFile(){var o;return(o=this.client.deleteFile)==null?void 0:o.bind(this.client)}get validateApiKey(){var o;return(o=this.client.validateApiKey)==null?void 0:o.bind(this.client)}get getAdapterInfo(){var o;return(o=this.client.getAdapterInfo)==null?void 0:o.bind(this.client)}}r?(Be("🔐 API Middleware enabled - routing through proxy"),Ja=Xg()):Ja={configureApi:n.configureApi,streamChat:A,ApiClient:i};const a=await Ak();Be(`✅ NPM package API loaded successfully (v${a})`)}}catch(n){if(e)try{const A=await kt(()=>import("./api-BjZW-Eka.js"),[]),i=async function*(o,l,c,u,g,d,h,B,f,w,p){yield*A.streamChat(o,l,c,u,g,d,h,B,f,w,p)};class a{constructor(l){pA(this,"client");if(r&&l.adapterName){const c=Xg();this.client=new c.ApiClient(l)}else this.client=new A.ApiClient(l)}async*streamChat(l,c,u,g,d,h,B,f,w,p,m){yield*this.client.streamChat(l,c,u,g,d,h,B,f,w,p,m)}get createThread(){var l;return(l=this.client.createThread)==null?void 0:l.bind(this.client)}get getThreadInfo(){var l;return(l=this.client.getThreadInfo)==null?void 0:l.bind(this.client)}get deleteThread(){var l;return(l=this.client.deleteThread)==null?void 0:l.bind(this.client)}get clearConversationHistory(){var l;return(l=this.client.clearConversationHistory)==null?void 0:l.bind(this.client)}get getConversationHistory(){var l;return(l=this.client.getConversationHistory)==null?void 0:l.bind(this.client)}get deleteConversationWithFiles(){var l;return(l=this.client.deleteConversationWithFiles)==null?void 0:l.bind(this.client)}get getSessionId(){var l;return(l=this.client.getSessionId)==null?void 0:l.bind(this.client)}get uploadFile(){var l;return(l=this.client.uploadFile)==null?void 0:l.bind(this.client)}get listFiles(){var l;return(l=this.client.listFiles)==null?void 0:l.bind(this.client)}get getFileInfo(){var l;return(l=this.client.getFileInfo)==null?void 0:l.bind(this.client)}get queryFile(){var l;return(l=this.client.queryFile)==null?void 0:l.bind(this.client)}get deleteFile(){var l;return(l=this.client.deleteFile)==null?void 0:l.bind(this.client)}get validateApiKey(){var l;return(l=this.client.validateApiKey)==null?void 0:l.bind(this.client)}get getAdapterInfo(){var l;return(l=this.client.getAdapterInfo)==null?void 0:l.bind(this.client)}}r?(Be("🔐 API Middleware enabled - routing through proxy"),Ja=Xg()):Ja={configureApi:A.configureApi,streamChat:i,ApiClient:a};const s=await Ak();Be(`✅ Fallback to NPM package successful (v${s})`)}catch{throw new Error("Failed to load both local and npm API packages")}else throw n}return Ja}async function qr(){return await g$e()}const Jp=mo(),d$e=()=>{try{if(typeof window>"u"||!window.localStorage)return null;const e=window.localStorage.getItem("chat-api-url");return e&&e===ql?(window.localStorage.removeItem("chat-api-url"),null):e}catch{return null}},Zg=e=>{const t=e==null?void 0:e.trim();if(t)return t;const r=d$e();return r&&r!==ql?r:Or()},Op=()=>typeof window>"u"?null:window.CHATBOT_API_KEY||null;class Gh{static async uploadFile(t,r,n,A,i){try{const a=lt.maxFileSizeMB*1024*1024;if(t.size>a)throw new Error(`File size exceeds maximum limit of ${lt.maxFileSizeMB}MB`);if(!(["application/pdf","text/plain","text/markdown","text/csv","application/json","text/html","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","application/vnd.ms-excel.sheet.macroEnabled.12","text/x-python","text/x-python-script","text/x-java-source","text/x-java","text/x-sql","text/javascript","application/javascript","text/typescript","application/typescript","text/x-c++src","text/x-csrc","text/x-c","text/x-go","text/x-rust","text/x-ruby","text/x-php","text/x-shellscript","text/x-sh","text/yaml","text/x-yaml","text/xml","application/xml","text/css","text/x-scss","text/x-sass","text/x-less","image/png","image/jpeg","image/tiff","audio/wav","audio/mpeg","audio/mp3","audio/mp4","audio/ogg","audio/flac","audio/webm","audio/x-m4a","audio/aac","text/vtt"].includes(t.type)||/\.(pdf|txt|md|csv|json|html|docx|pptx|xlsx|py|java|sql|js|mjs|ts|tsx|cpp|cxx|cc|c|h|hpp|go|rs|rb|php|sh|bash|zsh|yaml|yml|xml|css|scss|sass|less|png|jpe?g|tiff?|wav|mp3|mp4|ogg|flac|webm|m4a|aac|vtt)$/i.test(t.name)||(t.type==="application/x-zip-compressed"||t.type==="application/zip")&&/\.xlsx$/i.test(t.name)))throw new Error(`File type not supported: ${t.type||"unknown"}`);r&&r({filename:t.name,progress:0,status:"uploading"});const l=await qr(),c=Zg(A),u=sr();let g=null,d=null;if(u){if(d=i||(typeof window<"u"?localStorage.getItem("chat-adapter-name"):null),!d)throw new Error("Adapter not configured. Please select an adapter from the dropdown.");Be(`🔑 Using adapter: ${d}`)}else{if(g=n||localStorage.getItem("chat-api-key")||Op()||Jp,!g||g==="your-api-key-here")throw new Error(`API key not configured or invalid. Please:
998
998
  1. Open Settings (⚙️ icon) in the top-right corner
999
999
  2. Enter a valid API key
1000
1000
  3. To create an API key: POST to /admin/api-keys with admin credentials