@saluzi/saluzi-edu 0.1.124 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/cli.js +70 -70
  2. package/dist/oms-transition.js +2 -1
  3. package/dist/rcs-web/assets/Dashboard-DaTU02_D.js +2 -0
  4. package/dist/rcs-web/assets/SessionDetail-B9rqUaDO.js +51 -0
  5. package/{packages/remote-control-server/web/dist/assets/arc-BTNZPYFM.js → dist/rcs-web/assets/arc-DmgdWIlf.js} +1 -1
  6. package/{packages/remote-control-server/web/dist/assets/architectureDiagram-3BPJPVTR-CnqyIP5y.js → dist/rcs-web/assets/architectureDiagram-3BPJPVTR-DS9ZLEGd.js} +1 -1
  7. package/dist/rcs-web/assets/{blockDiagram-GPEHLZMM-GCIy3aBf.js → blockDiagram-GPEHLZMM-CEpINxWA.js} +1 -1
  8. package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-BsVilhXv.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-B61spn_c.js} +1 -1
  9. package/dist/rcs-web/assets/channel-BV97V8Sa.js +1 -0
  10. package/dist/rcs-web/assets/{chunk-2J33WTMH-Dqs2lEGy.js → chunk-2J33WTMH-3Sos_YG1.js} +1 -1
  11. package/dist/rcs-web/assets/{chunk-4BX2VUAB-Dl9L5DQL.js → chunk-4BX2VUAB-C5yUkGky.js} +1 -1
  12. package/dist/rcs-web/assets/{chunk-55IACEB6-DncKFsi_.js → chunk-55IACEB6-CodXkzoD.js} +1 -1
  13. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-RKe_DEcs.js → dist/rcs-web/assets/chunk-727SXJPM-DN3UsPBJ.js} +1 -1
  14. package/dist/rcs-web/assets/{chunk-AQP2D5EJ-BCyuqQrM.js → chunk-AQP2D5EJ-Bwbwzt31.js} +1 -1
  15. package/dist/rcs-web/assets/{chunk-FMBD7UC4-B1m5l4On.js → chunk-FMBD7UC4-DdZGGyPp.js} +1 -1
  16. package/dist/rcs-web/assets/{chunk-ND2GUHAM-BAvKP0be.js → chunk-ND2GUHAM-gHeg7axd.js} +1 -1
  17. package/dist/rcs-web/assets/{chunk-QZHKN3VN-C_Q5XkzZ.js → chunk-QZHKN3VN-BFDxTJxi.js} +1 -1
  18. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-i5w4Lep9.js +1 -0
  19. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-i5w4Lep9.js +1 -0
  20. package/dist/rcs-web/assets/{code-block-IT6T5CEO-1SPhTv6c.js → code-block-IT6T5CEO-C-s596_W.js} +1 -1
  21. package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-PdEQ9Iu6.js → cose-bilkent-S5V4N54A-C_KMwbf7.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-B6kNmegj.js → dist/rcs-web/assets/dagre-BM42HDAG-BQ1E50QU.js} +1 -1
  23. package/dist/rcs-web/assets/{diagram-2AECGRRQ-CAUgoY5S.js → diagram-2AECGRRQ-CU2nW4TH.js} +1 -1
  24. package/dist/rcs-web/assets/{diagram-5GNKFQAL-dXStENI4.js → diagram-5GNKFQAL-CpT3Gpmm.js} +1 -1
  25. package/dist/rcs-web/assets/{diagram-KO2AKTUF-DCO8NQgX.js → diagram-KO2AKTUF-CNFA0Vuv.js} +1 -1
  26. package/{packages/remote-control-server/web/dist/assets/diagram-LMA3HP47-ClG9hFiH.js → dist/rcs-web/assets/diagram-LMA3HP47-Cx4zSMpY.js} +1 -1
  27. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-DHEst8Zc.js → dist/rcs-web/assets/diagram-OG6HWLK6-BWC_jCla.js} +1 -1
  28. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-C0bZwwsA.js → erDiagram-TEJ5UH35-CSuUBiRO.js} +1 -1
  29. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-BQrXFaC6.js → flowDiagram-I6XJVG4X-BWPEqpf0.js} +1 -1
  30. package/dist/rcs-web/assets/{ganttDiagram-6RSMTGT7-BPnjXEOO.js → ganttDiagram-6RSMTGT7-2jfQeqRo.js} +1 -1
  31. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-VVmKe1m5.js → gitGraphDiagram-PVQCEYII-BstRXOH0.js} +1 -1
  32. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-ACjQxjQr.js → infoDiagram-5YYISTIA-fpyXvcBU.js} +1 -1
  33. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-lRnVh4bK.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-CKIBVciX.js} +1 -1
  34. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-C-Oc-GFW.js → journeyDiagram-JHISSGLW-mEQGXLWs.js} +1 -1
  35. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-DboauQuo.js → kanban-definition-UN3LZRKU-Dm6-lRPV.js} +1 -1
  36. package/dist/rcs-web/assets/{linear-JqB05PUl.js → linear-CY5phZrT.js} +1 -1
  37. package/dist/rcs-web/assets/main-D30vgPOL.css +1 -0
  38. package/dist/rcs-web/assets/main-cMKCMXV5.js +283 -0
  39. package/dist/rcs-web/assets/{mermaid-VLURNSYL-DNkiWsfz.js → mermaid-VLURNSYL-DRG_-dmJ.js} +4 -4
  40. package/dist/rcs-web/assets/{mermaid.core-BdtPv3Wu.js → mermaid.core-CZ0TEVpY.js} +5 -5
  41. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-B9ytGhLu.js → mindmap-definition-RKZ34NQL-DMMAfq_q.js} +1 -1
  42. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-ByDl5ukC.js → pieDiagram-4H26LBE5-CclLma08.js} +1 -1
  43. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-PKIz3lZd.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-Dy4sNmSO.js} +1 -1
  44. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-Bsum8Uxh.js → requirementDiagram-4Y6WPE33-DUhDkjra.js} +1 -1
  45. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-saMN_GPA.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DtOF0AAY.js} +1 -1
  46. package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-BzU50wSK.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-BhZhk-4v.js} +1 -1
  47. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-DgW_RZY5.js → stateDiagram-AJRCARHV-D5E7Xqns.js} +1 -1
  48. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-BOSM0Nxs.js → stateDiagram-v2-BHNVJYJU-BLNSVAaL.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-BgyfpoH0.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-8945PuXp.js} +1 -1
  50. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-oLLONkeW.js → vennDiagram-CIIHVFJN-BoIJSTO-.js} +1 -1
  51. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-CNLnT65T.js → wardleyDiagram-YWT4CUSO-coKPhznt.js} +1 -1
  52. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-oHMQeB7H.js → xychartDiagram-2RQKCTM6-DK2cmVtY.js} +1 -1
  53. package/dist/rcs-web/index.html +2 -2
  54. package/package.json +3 -2
  55. package/packages/remote-control-server/src/__tests__/middleware.test.ts +37 -0
  56. package/packages/remote-control-server/src/__tests__/routes.test.ts +5 -2
  57. package/packages/remote-control-server/src/__tests__/services.test.ts +4 -2
  58. package/packages/remote-control-server/src/__tests__/transport-normalize.test.ts +79 -0
  59. package/packages/remote-control-server/src/__tests__/ws-handler.test.ts +80 -0
  60. package/packages/remote-control-server/src/auth/middleware.ts +11 -2
  61. package/packages/remote-control-server/src/routes/web/control.ts +9 -0
  62. package/packages/remote-control-server/src/services/session.ts +2 -0
  63. package/packages/remote-control-server/src/services/transport.ts +33 -0
  64. package/packages/remote-control-server/src/transport/ws-handler.ts +46 -1
  65. package/packages/remote-control-server/src/types/api.ts +1 -0
  66. package/packages/remote-control-server/web/dist/assets/Dashboard-DaTU02_D.js +2 -0
  67. package/packages/remote-control-server/web/dist/assets/SessionDetail-B9rqUaDO.js +51 -0
  68. package/{dist/rcs-web/assets/arc-BTNZPYFM.js → packages/remote-control-server/web/dist/assets/arc-DmgdWIlf.js} +1 -1
  69. package/{dist/rcs-web/assets/architectureDiagram-3BPJPVTR-CnqyIP5y.js → packages/remote-control-server/web/dist/assets/architectureDiagram-3BPJPVTR-DS9ZLEGd.js} +1 -1
  70. package/packages/remote-control-server/web/dist/assets/{blockDiagram-GPEHLZMM-GCIy3aBf.js → blockDiagram-GPEHLZMM-CEpINxWA.js} +1 -1
  71. package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-BsVilhXv.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-B61spn_c.js} +1 -1
  72. package/packages/remote-control-server/web/dist/assets/channel-BV97V8Sa.js +1 -0
  73. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Dqs2lEGy.js → chunk-2J33WTMH-3Sos_YG1.js} +1 -1
  74. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-Dl9L5DQL.js → chunk-4BX2VUAB-C5yUkGky.js} +1 -1
  75. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-DncKFsi_.js → chunk-55IACEB6-CodXkzoD.js} +1 -1
  76. package/{dist/rcs-web/assets/chunk-727SXJPM-RKe_DEcs.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-DN3UsPBJ.js} +1 -1
  77. package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-BCyuqQrM.js → chunk-AQP2D5EJ-Bwbwzt31.js} +1 -1
  78. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-B1m5l4On.js → chunk-FMBD7UC4-DdZGGyPp.js} +1 -1
  79. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-BAvKP0be.js → chunk-ND2GUHAM-gHeg7axd.js} +1 -1
  80. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-C_Q5XkzZ.js → chunk-QZHKN3VN-BFDxTJxi.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-i5w4Lep9.js +1 -0
  82. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-i5w4Lep9.js +1 -0
  83. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-1SPhTv6c.js → code-block-IT6T5CEO-C-s596_W.js} +1 -1
  84. package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-PdEQ9Iu6.js → cose-bilkent-S5V4N54A-C_KMwbf7.js} +1 -1
  85. package/{dist/rcs-web/assets/dagre-BM42HDAG-B6kNmegj.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-BQ1E50QU.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-CAUgoY5S.js → diagram-2AECGRRQ-CU2nW4TH.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-dXStENI4.js → diagram-5GNKFQAL-CpT3Gpmm.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-DCO8NQgX.js → diagram-KO2AKTUF-CNFA0Vuv.js} +1 -1
  89. package/{dist/rcs-web/assets/diagram-LMA3HP47-ClG9hFiH.js → packages/remote-control-server/web/dist/assets/diagram-LMA3HP47-Cx4zSMpY.js} +1 -1
  90. package/{dist/rcs-web/assets/diagram-OG6HWLK6-DHEst8Zc.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-BWC_jCla.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-C0bZwwsA.js → erDiagram-TEJ5UH35-CSuUBiRO.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-BQrXFaC6.js → flowDiagram-I6XJVG4X-BWPEqpf0.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{ganttDiagram-6RSMTGT7-BPnjXEOO.js → ganttDiagram-6RSMTGT7-2jfQeqRo.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-VVmKe1m5.js → gitGraphDiagram-PVQCEYII-BstRXOH0.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-ACjQxjQr.js → infoDiagram-5YYISTIA-fpyXvcBU.js} +1 -1
  96. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-lRnVh4bK.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-CKIBVciX.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-C-Oc-GFW.js → journeyDiagram-JHISSGLW-mEQGXLWs.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-DboauQuo.js → kanban-definition-UN3LZRKU-Dm6-lRPV.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{linear-JqB05PUl.js → linear-CY5phZrT.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/main-D30vgPOL.css +1 -0
  101. package/packages/remote-control-server/web/dist/assets/main-cMKCMXV5.js +283 -0
  102. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-DNkiWsfz.js → mermaid-VLURNSYL-DRG_-dmJ.js} +4 -4
  103. package/packages/remote-control-server/web/dist/assets/{mermaid.core-BdtPv3Wu.js → mermaid.core-CZ0TEVpY.js} +5 -5
  104. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-B9ytGhLu.js → mindmap-definition-RKZ34NQL-DMMAfq_q.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-ByDl5ukC.js → pieDiagram-4H26LBE5-CclLma08.js} +1 -1
  106. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-PKIz3lZd.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-Dy4sNmSO.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-Bsum8Uxh.js → requirementDiagram-4Y6WPE33-DUhDkjra.js} +1 -1
  108. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-saMN_GPA.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DtOF0AAY.js} +1 -1
  109. package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-BzU50wSK.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-BhZhk-4v.js} +1 -1
  110. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-DgW_RZY5.js → stateDiagram-AJRCARHV-D5E7Xqns.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-BOSM0Nxs.js → stateDiagram-v2-BHNVJYJU-BLNSVAaL.js} +1 -1
  112. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-BgyfpoH0.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-8945PuXp.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-oLLONkeW.js → vennDiagram-CIIHVFJN-BoIJSTO-.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-CNLnT65T.js → wardleyDiagram-YWT4CUSO-coKPhznt.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-oHMQeB7H.js → xychartDiagram-2RQKCTM6-DK2cmVtY.js} +1 -1
  116. package/packages/remote-control-server/web/dist/index.html +2 -2
  117. package/dist/rcs-web/assets/Dashboard-Dd71UuMq.js +0 -2
  118. package/dist/rcs-web/assets/SessionDetail-CNp5XofE.js +0 -41
  119. package/dist/rcs-web/assets/channel-CTEvuc50.js +0 -1
  120. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-D_WzQsaY.js +0 -1
  121. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-D_WzQsaY.js +0 -1
  122. package/dist/rcs-web/assets/main-Bs_2vm3e.js +0 -283
  123. package/dist/rcs-web/assets/main-un7elYXE.css +0 -1
  124. package/packages/remote-control-server/web/dist/assets/Dashboard-Dd71UuMq.js +0 -2
  125. package/packages/remote-control-server/web/dist/assets/SessionDetail-CNp5XofE.js +0 -41
  126. package/packages/remote-control-server/web/dist/assets/channel-CTEvuc50.js +0 -1
  127. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-D_WzQsaY.js +0 -1
  128. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-D_WzQsaY.js +0 -1
  129. package/packages/remote-control-server/web/dist/assets/main-Bs_2vm3e.js +0 -283
  130. package/packages/remote-control-server/web/dist/assets/main-un7elYXE.css +0 -1
@@ -1,283 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-DNkiWsfz.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-Dd71UuMq.js","assets/qr-C0jP9HcD.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-CNp5XofE.js"])))=>i.map(i=>d[i]);
2
- var tc=Object.defineProperty;var nc=(e,t,n)=>t in e?tc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>nc(e,typeof t!="symbol"?t+"":t,n);import{e as m,a as rt,j as d,R as Vr,r as Ms,b as rc,c as Gr,d as oc}from"./vendor-DE_-CLIE.js";import{_ as on}from"./shiki-mEP5vQQu.js";import{Q as sc}from"./qr-C0jP9HcD.js";import{m as ac}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Ps(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ps(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Os(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ps(e))&&(r&&(r+=" "),r+=t);return r}const ic=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},lc=(e,t)=>({classGroupId:e,validator:t}),Ds=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),En="-",Lo=[],cc="arbitrary..",dc=e=>{const t=fc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return uc(a);const i=a.split(En),h=i[0]===""&&i.length>1?1:0;return Ls(i,h,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const h=r[a],f=n[a];return h?f?ic(f,h):h:f||Lo}return n[a]||Lo}}},Ls=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const f=Ls(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(En):e.slice(t).join(En),h=a.length;for(let f=0;f<h;f++){const c=a[f];if(c.validator(i))return c.classGroupId}},uc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?cc+r:void 0})(),fc=e=>{const{theme:t,classGroups:n}=e;return hc(n,t)},hc=(e,t)=>{const n=Ds();for(const r in e){const o=e[r];Kr(o,n,r,t)}return n},Kr=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];mc(a,t,n,r)}},mc=(e,t,n,r)=>{if(typeof e=="string"){pc(e,t,n);return}if(typeof e=="function"){gc(e,t,n,r);return}xc(e,t,n,r)},pc=(e,t,n)=>{const r=e===""?t:$s(t,e);r.classGroupId=n},gc=(e,t,n,r)=>{if(vc(e)){Kr(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(lc(n,e))},xc=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[i,h]=o[a];Kr(h,$s(t,i),n,r)}},$s=(e,t)=>{let n=e;const r=t.split(En),o=r.length;for(let s=0;s<o;s++){const a=r[s];let i=n.nextPart.get(a);i||(i=Ds(),n.nextPart.set(a,i)),n=i}return n},vc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,yc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},jr="!",$o=":",bc=[],Fo=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),wc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,i=0,h=0,f;const c=o.length;for(let v=0;v<c;v++){const w=o[v];if(a===0&&i===0){if(w===$o){s.push(o.slice(h,v)),h=v+1;continue}if(w==="/"){f=v;continue}}w==="["?a++:w==="]"?a--:w==="("?i++:w===")"&&i--}const l=s.length===0?o:o.slice(h);let u=l,p=!1;l.endsWith(jr)?(u=l.slice(0,-1),p=!0):l.startsWith(jr)&&(u=l.slice(1),p=!0);const g=f&&f>h?f-h:void 0;return Fo(s,p,u,g)};if(t){const o=t+$o,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Fo(bc,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Cc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",h=t.has(a);i||h?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},Sc=e=>({cache:yc(e.cacheSize),parseClassName:wc(e),sortModifiers:Cc(e),postfixLookupClassGroupIds:kc(e),...dc(e)}),kc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},_c=/\s+/,Ec=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],h=e.trim().split(_c);let f="";for(let c=h.length-1;c>=0;c-=1){const l=h[c],{isExternal:u,modifiers:p,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:w}=n(l);if(u){f=l+(f.length>0?" "+f:f);continue}let b=!!w,A;if(b){const N=v.substring(0,w);A=r(N);const x=A&&a[A]?r(v):void 0;x&&x!==A&&(A=x,b=!1)}else A=r(v);if(!A){if(!b){f=l+(f.length>0?" "+f:f);continue}if(A=r(v),!A){f=l+(f.length>0?" "+f:f);continue}b=!1}const R=p.length===0?"":p.length===1?p[0]:s(p).join(":"),S=g?R+jr:R,L=S+A;if(i.indexOf(L)>-1)continue;i.push(L);const k=o(A,b);for(let N=0;N<k.length;++N){const x=k[N];i.push(S+x)}f=l+(f.length>0?" "+f:f)}return f},Nc=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Fs(n))&&(o&&(o+=" "),o+=r);return o},Fs=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Fs(e[r]))&&(n&&(n+=" "),n+=t);return n},jc=(e,...t)=>{let n,r,o,s;const a=h=>{const f=t.reduce((c,l)=>l(c),e());return n=Sc(f),r=n.cache.get,o=n.cache.set,s=i,i(h)},i=h=>{const f=r(h);if(f)return f;const c=Ec(h,n);return o(h,c),c};return s=a,(...h)=>s(Nc(...h))},Ac=[],ve=e=>{const t=n=>n[e]||Ac;return t.isThemeGetter=!0,t},Us=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Tc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ic=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Oc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nt=e=>Rc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),Fe=e=>!!e&&Number.isInteger(Number(e)),lr=e=>e.endsWith("%")&&se(e.slice(0,-1)),Ge=e=>Tc.test(e),Bs=()=>!0,Dc=e=>Ic.test(e)&&!Mc.test(e),qr=()=>!1,Lc=e=>Pc.test(e),$c=e=>Oc.test(e),Fc=e=>!Y(e)&&!Q(e),Uc=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),zc=e=>dt(e,Vs,qr),Y=e=>Us.test(e),xt=e=>dt(e,Gs,Dc),Uo=e=>dt(e,Yc,se),Bc=e=>dt(e,qs,Bs),Wc=e=>dt(e,Ks,qr),zo=e=>dt(e,Ws,qr),Hc=e=>dt(e,Hs,$c),vn=e=>dt(e,Ys,Lc),Q=e=>zs.test(e),qt=e=>_t(e,Gs),Vc=e=>_t(e,Ks),Bo=e=>_t(e,Ws),Gc=e=>_t(e,Vs),Kc=e=>_t(e,Hs),yn=e=>_t(e,Ys,!0),qc=e=>_t(e,qs,!0),dt=(e,t,n)=>{const r=Us.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},_t=(e,t,n=!1)=>{const r=zs.exec(e);return r?r[1]?t(r[1]):n:!1},Ws=e=>e==="position"||e==="percentage",Hs=e=>e==="image"||e==="url",Vs=e=>e==="length"||e==="size"||e==="bg-size",Gs=e=>e==="length",Yc=e=>e==="number",Ks=e=>e==="family-name",qs=e=>e==="number"||e==="weight",Ys=e=>e==="shadow",Xc=()=>{const e=ve("color"),t=ve("font"),n=ve("text"),r=ve("font-weight"),o=ve("tracking"),s=ve("leading"),a=ve("breakpoint"),i=ve("container"),h=ve("spacing"),f=ve("radius"),c=ve("shadow"),l=ve("inset-shadow"),u=ve("text-shadow"),p=ve("drop-shadow"),g=ve("blur"),v=ve("perspective"),w=ve("aspect"),b=ve("ease"),A=ve("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...S(),Q,Y],k=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],x=()=>[Q,Y,h],y=()=>[nt,"full","auto",...x()],j=()=>[Fe,"none","subgrid",Q,Y],P=()=>["auto",{span:["full",Fe,Q,Y]},Fe,Q,Y],O=()=>[Fe,"auto",Q,Y],F=()=>["auto","min","max","fr",Q,Y],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...x()],C=()=>[nt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],D=()=>[nt,"screen","full","dvw","lvw","svw","min","max","fit",...x()],_=()=>[nt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],I=()=>[e,Q,Y],W=()=>[...S(),Bo,zo,{position:[Q,Y]}],T=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",Gc,zc,{size:[Q,Y]}],z=()=>[lr,qt,xt],$=()=>["","none","full",f,Q,Y],V=()=>["",se,qt,xt],G=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[se,lr,Bo,zo],ne=()=>["","none",g,Q,Y],ae=()=>["none",se,Q,Y],de=()=>["none",se,Q,Y],me=()=>[se,Q,Y],H=()=>[nt,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ge],breakpoint:[Ge],color:[Bs],container:[Ge],"drop-shadow":[Ge],ease:["in","out","in-out"],font:[Fc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ge],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ge],shadow:[Ge],spacing:["px",se],text:[Ge],"text-shadow":[Ge],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nt,Y,Q,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,Y]}],"container-named":[Uc],columns:[{columns:[se,Y,Q,i]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{"inset-s":y(),start:y()}],end:[{"inset-e":y(),end:y()}],"inset-bs":[{"inset-bs":y()}],"inset-be":[{"inset-be":y()}],top:[{top:y()}],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[Fe,"auto",Q,Y]}],basis:[{basis:[nt,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[se,nt,"auto","initial","none",Y]}],grow:[{grow:["",se,Q,Y]}],shrink:[{shrink:["",se,Q,Y]}],order:[{order:[Fe,"first","last","none",Q,Y]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",..._()]}],"min-block-size":[{"min-block":["auto",..._()]}],"max-block-size":[{"max-block":["none",..._()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,qt,xt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,qc,Bc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lr,Y]}],"font-family":[{font:[Vc,Wc,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Q,Y]}],"line-clamp":[{"line-clamp":[se,"none",Q,Uo]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,Y]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,Y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[se,"from-font","auto",Q,xt]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[se,"auto",Q,Y]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[Fe,Q,Y]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,Y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:T()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fe,Q,Y],radial:["",Q,Y],conic:[Fe,Q,Y]},Kc,Hc]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[se,Q,Y]}],"outline-w":[{outline:["",se,qt,xt]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",c,yn,vn]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,yn,vn]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[se,xt]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",u,yn,vn]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[se,Q,Y]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[se]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Q,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[se]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:T()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,Y]}],filter:[{filter:["","none",Q,Y]}],blur:[{blur:ne()}],brightness:[{brightness:[se,Q,Y]}],contrast:[{contrast:[se,Q,Y]}],"drop-shadow":[{"drop-shadow":["","none",p,yn,vn]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",se,Q,Y]}],"hue-rotate":[{"hue-rotate":[se,Q,Y]}],invert:[{invert:["",se,Q,Y]}],saturate:[{saturate:[se,Q,Y]}],sepia:[{sepia:["",se,Q,Y]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,Y]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[se,Q,Y]}],"backdrop-contrast":[{"backdrop-contrast":[se,Q,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":["",se,Q,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[se,Q,Y]}],"backdrop-invert":[{"backdrop-invert":["",se,Q,Y]}],"backdrop-opacity":[{"backdrop-opacity":[se,Q,Y]}],"backdrop-saturate":[{"backdrop-saturate":[se,Q,Y]}],"backdrop-sepia":[{"backdrop-sepia":["",se,Q,Y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,Y]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[se,"initial",Q,Y]}],ease:[{ease:["linear","initial",b,Q,Y]}],delay:[{delay:[se,Q,Y]}],animate:[{animate:["none",A,Q,Y]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,Y]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Q,Y,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:H()}],"translate-x":[{"translate-x":H()}],"translate-y":[{"translate-y":H()}],"translate-z":[{"translate-z":H()}],"translate-none":["translate-none"],zoom:[{zoom:[Fe,Q,Y]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,Y]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,Y]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[se,qt,xt,Uo]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Qc=jc(Xc);function Z(...e){return Qc(Os(e))}function Zc(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Qv(e){return e?new Date(e*1e3).toLocaleString():""}function Zv(e){return e==="archived"||e==="inactive"}function Jv(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function Jc(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function ed(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),Jc(t)}/**
3
- * @license lucide-react v0.555.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const td=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Wo=e=>{const t=nd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Xs=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),rd=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
8
- * @license lucide-react v0.555.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */var od={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
13
- * @license lucide-react v0.555.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const sd=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...i},h)=>m.createElement("svg",{ref:h,...od,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Xs("lucide",o),...!s&&!rd(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,c])=>m.createElement(f,c)),...Array.isArray(s)?s:[s]]));/**
18
- * @license lucide-react v0.555.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const re=(e,t)=>{const n=m.forwardRef(({className:r,...o},s)=>m.createElement(sd,{ref:s,iconNode:t,className:Xs(`lucide-${td(Wo(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Wo(e),n};/**
23
- * @license lucide-react v0.555.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const ad=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],id=re("arrow-down",ad);/**
28
- * @license lucide-react v0.555.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const ld=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],cd=re("brain",ld);/**
33
- * @license lucide-react v0.555.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const dd=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wt=re("check",dd);/**
38
- * @license lucide-react v0.555.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const ud=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sn=re("chevron-down",ud);/**
43
- * @license lucide-react v0.555.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */const fd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],hd=re("chevron-left",fd);/**
48
- * @license lucide-react v0.555.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const md=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Qs=re("chevron-up",md);/**
53
- * @license lucide-react v0.555.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */const pd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],gd=re("circle-check",pd);/**
58
- * @license lucide-react v0.555.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const xd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],vd=re("circle",xd);/**
63
- * @license lucide-react v0.555.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const yd=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],bd=re("copy",yd);/**
68
- * @license lucide-react v0.555.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const wd=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Zs=re("eye-off",wd);/**
73
- * @license lucide-react v0.555.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const Cd=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Js=re("eye",Cd);/**
78
- * @license lucide-react v0.555.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const Sd=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zt=re("file-text",Sd);/**
83
- * @license lucide-react v0.555.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const kd=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Yr=re("folder-open",kd);/**
88
- * @license lucide-react v0.555.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const _d=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ed=re("image",_d);/**
93
- * @license lucide-react v0.555.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const Nd=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],jd=re("key-round",Nd);/**
98
- * @license lucide-react v0.555.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const Ad=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Rd=re("layout-grid",Ad);/**
103
- * @license lucide-react v0.555.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const Td=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ea=re("loader-circle",Td);/**
108
- * @license lucide-react v0.555.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const Id=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Md=re("message-square",Id);/**
113
- * @license lucide-react v0.555.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const Pd=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Od=re("monitor",Pd);/**
118
- * @license lucide-react v0.555.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const Dd=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ta=re("moon",Dd);/**
123
- * @license lucide-react v0.555.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const Ld=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],$d=re("panel-left-close",Ld);/**
128
- * @license lucide-react v0.555.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const Fd=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Ud=re("panel-left",Fd);/**
133
- * @license lucide-react v0.555.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const zd=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Bd=re("paperclip",zd);/**
138
- * @license lucide-react v0.555.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const Wd=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Hd=re("pencil",Wd);/**
143
- * @license lucide-react v0.555.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const Vd=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zn=re("plus",Vd);/**
148
- * @license lucide-react v0.555.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const Gd=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],Kd=re("scan",Gd);/**
153
- * @license lucide-react v0.555.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const qd=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yd=re("search",qd);/**
158
- * @license lucide-react v0.555.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const Xd=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Qd=re("send",Xd);/**
163
- * @license lucide-react v0.555.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const Zd=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Jd=re("server",Zd);/**
168
- * @license lucide-react v0.555.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const eu=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Xr=re("shield-alert",eu);/**
173
- * @license lucide-react v0.555.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const tu=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ho=re("shield-check",tu);/**
178
- * @license lucide-react v0.555.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const nu=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],ru=re("shield",nu);/**
183
- * @license lucide-react v0.555.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const ou=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],su=re("slash",ou);/**
188
- * @license lucide-react v0.555.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const au=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],iu=re("smartphone",au);/**
193
- * @license lucide-react v0.555.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const lu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],cu=re("square",lu);/**
198
- * @license lucide-react v0.555.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const du=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],na=re("sun",du);/**
203
- * @license lucide-react v0.555.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const uu=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],Qr=re("table",uu);/**
208
- * @license lucide-react v0.555.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const fu=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ra=re("trash-2",fu);/**
213
- * @license lucide-react v0.555.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const hu=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],mu=re("user-plus",hu);/**
218
- * @license lucide-react v0.555.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const pu=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],oa=re("user",pu);/**
223
- * @license lucide-react v0.555.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const gu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],an=re("x",gu),sa=m.createContext(void 0),aa="theme";function Vo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Go(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(aa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Ko(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function ia(){const e=m.useContext(sa);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function xu({children:e,defaultTheme:t="system"}){const[n,r]=m.useState(()=>Go()||t),[o,s]=m.useState(()=>{const h=Go()||t;return h==="system"?Vo():h}),a=m.useCallback(h=>{r(h);try{localStorage.setItem(aa,h)}catch{}},[]);m.useEffect(()=>{const h=n==="system"?Vo():n;s(h),Ko(h)},[n]),m.useEffect(()=>{if(n!=="system")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),f=c=>{const l=c.matches?"dark":"light";s(l),Ko(l)};return h.addEventListener("change",f),()=>h.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:o,setTheme:a};return rt.createElement(sa.Provider,{value:i},e)}function qo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function We(...e){return t=>{let n=!1;const r=e.map(o=>{const s=qo(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():qo(e[o],null)}}}}function pe(...e){return m.useCallback(We(...e),e)}var vu=Symbol.for("react.lazy"),Nn=Vr[" use ".trim().toString()];function yu(e){return typeof e=="object"&&e!==null&&"then"in e}function la(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vu&&"_payload"in e&&yu(e._payload)}function ca(e){const t=wu(e),n=m.forwardRef((r,o)=>{let{children:s,...a}=r;la(s)&&typeof Nn=="function"&&(s=Nn(s._payload));const i=m.Children.toArray(s),h=i.find(Su);if(h){const f=h.props.children,c=i.map(l=>l===h?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:l);return d.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,c):null})}return d.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var bu=ca("Slot");function wu(e){const t=m.forwardRef((n,r)=>{let{children:o,...s}=n;if(la(o)&&typeof Nn=="function"&&(o=Nn(o._payload)),m.isValidElement(o)){const a=_u(o),i=ku(s,o.props);return o.type!==m.Fragment&&(i.ref=r?We(r,a):a),m.cloneElement(o,i)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cu=Symbol("radix.slottable");function Su(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cu}function ku(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const h=s(...i);return o(...i),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function _u(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Yo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Xo=Os,Eu=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Xo(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(f=>{const c=n==null?void 0:n[f],l=s==null?void 0:s[f];if(c===null)return null;const u=Yo(c)||Yo(l);return o[f][u]}),i=n&&Object.entries(n).reduce((f,c)=>{let[l,u]=c;return u===void 0||(f[l]=u),f},{}),h=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,c)=>{let{class:l,className:u,...p}=c;return Object.entries(p).every(g=>{let[v,w]=g;return Array.isArray(w)?w.includes({...s,...i}[v]):{...s,...i}[v]===w})?[...f,l,u]:f},[]);return Xo(e,a,h,n==null?void 0:n.class,n==null?void 0:n.className)},Nu=Eu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Et({className:e,variant:t,size:n,asChild:r=!1,...o}){const s=r?bu:"button";return d.jsx(s,{"data-slot":"button",className:Z(Nu({variant:t,size:n,className:e})),...o})}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function ju(e,t){const n=m.createContext(t),r=s=>{const{children:a,...i}=s,h=m.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:h,children:a})};r.displayName=e+"Provider";function o(s){const a=m.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Qe(e,t=[]){let n=[];function r(s,a){const i=m.createContext(a),h=n.length;n=[...n,a];const f=l=>{var b;const{scope:u,children:p,...g}=l,v=((b=u==null?void 0:u[e])==null?void 0:b[h])||i,w=m.useMemo(()=>g,Object.values(g));return d.jsx(v.Provider,{value:w,children:p})};f.displayName=s+"Provider";function c(l,u){var v;const p=((v=u==null?void 0:u[e])==null?void 0:v[h])||i,g=m.useContext(p);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${l}\` must be used within \`${s}\``)}return[f,c]}const o=()=>{const s=n.map(a=>m.createContext(a));return function(i){const h=(i==null?void 0:i[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...i,[e]:h}}),[i,h])}};return o.scopeName=e,[r,Au(o,...t)]}function Au(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((i,{useScope:h,scopeName:f})=>{const l=h(s)[`__scope${f}`];return{...i,...l}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ke=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Ru=Vr[" useInsertionEffect ".trim().toString()]||Ke;function at({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=Tu({defaultProp:t,onChange:n}),i=e!==void 0,h=i?e:o;{const c=m.useRef(e!==void 0);m.useEffect(()=>{const l=c.current;l!==i&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=i},[i,r])}const f=m.useCallback(c=>{var l;if(i){const u=Iu(c)?c(e):c;u!==e&&((l=a.current)==null||l.call(a,u))}else s(c)},[i,e,s,a]);return[h,f]}function Tu({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),s=m.useRef(t);return Ru(()=>{s.current=t},[t]),m.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Iu(e){return typeof e=="function"}function Dt(e){const t=Mu(e),n=m.forwardRef((r,o)=>{const{children:s,...a}=r,i=m.Children.toArray(s),h=i.find(Ou);if(h){const f=h.props.children,c=i.map(l=>l===h?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:l);return d.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,c):null})}return d.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Mu(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const a=Lu(o),i=Du(s,o.props);return o.type!==m.Fragment&&(i.ref=r?We(r,a):a),m.cloneElement(o,i)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var da=Symbol("radix.slottable");function Pu(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=da,t}function Ou(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===da}function Du(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const h=s(...i);return o(...i),h}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Lu(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $u=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ue=$u.reduce((e,t)=>{const n=Dt(`Primitive.${t}`),r=m.forwardRef((o,s)=>{const{asChild:a,...i}=o,h=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(h,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ua(e,t){e&&Ms.flushSync(()=>e.dispatchEvent(t))}function fa(e){const t=e+"CollectionProvider",[n,r]=Qe(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:b}=v,A=rt.useRef(null),R=rt.useRef(new Map).current;return d.jsx(o,{scope:w,itemMap:R,collectionRef:A,children:b})};a.displayName=t;const i=e+"CollectionSlot",h=Dt(i),f=rt.forwardRef((v,w)=>{const{scope:b,children:A}=v,R=s(i,b),S=pe(w,R.collectionRef);return d.jsx(h,{ref:S,children:A})});f.displayName=i;const c=e+"CollectionItemSlot",l="data-radix-collection-item",u=Dt(c),p=rt.forwardRef((v,w)=>{const{scope:b,children:A,...R}=v,S=rt.useRef(null),L=pe(w,S),k=s(c,b);return rt.useEffect(()=>(k.itemMap.set(S,{ref:S,...R}),()=>void k.itemMap.delete(S))),d.jsx(u,{[l]:"",ref:L,children:A})});p.displayName=c;function g(v){const w=s(e+"CollectionConsumer",v);return rt.useCallback(()=>{const A=w.collectionRef.current;if(!A)return[];const R=Array.from(A.querySelectorAll(`[${l}]`));return Array.from(w.itemMap.values()).sort((k,N)=>R.indexOf(k.ref.current)-R.indexOf(N.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:f,ItemSlot:p},g,r]}var Fu=m.createContext(void 0);function ha(e){const t=m.useContext(Fu);return e||t||"ltr"}function qe(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Uu(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var zu="DismissableLayer",Ar="dismissableLayer.update",Bu="dismissableLayer.pointerDownOutside",Wu="dismissableLayer.focusOutside",Qo,ma=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ln=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...h}=e,f=m.useContext(ma),[c,l]=m.useState(null),u=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=m.useState({}),g=pe(t,N=>l(N)),v=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(w),A=c?v.indexOf(c):-1,R=f.layersWithOutsidePointerEventsDisabled.size>0,S=A>=b,L=Gu(N=>{const x=N.target,y=[...f.branches].some(j=>j.contains(x));!S||y||(o==null||o(N),a==null||a(N),N.defaultPrevented||i==null||i())},u),k=Ku(N=>{const x=N.target;[...f.branches].some(j=>j.contains(x))||(s==null||s(N),a==null||a(N),N.defaultPrevented||i==null||i())},u);return Uu(N=>{A===f.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&i&&(N.preventDefault(),i()))},u),m.useEffect(()=>{if(c)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Qo=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(c)),f.layers.add(c),Zo(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=Qo)}},[c,u,n,f]),m.useEffect(()=>()=>{c&&(f.layers.delete(c),f.layersWithOutsidePointerEventsDisabled.delete(c),Zo())},[c,f]),m.useEffect(()=>{const N=()=>p({});return document.addEventListener(Ar,N),()=>document.removeEventListener(Ar,N)},[]),d.jsx(ue.div,{...h,ref:g,style:{pointerEvents:R?S?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,k.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,L.onPointerDownCapture)})});ln.displayName=zu;var Hu="DismissableLayerBranch",Vu=m.forwardRef((e,t)=>{const n=m.useContext(ma),r=m.useRef(null),o=pe(t,r);return m.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(ue.div,{...e,ref:o})});Vu.displayName=Hu;function Gu(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const s=i=>{if(i.target&&!r.current){let h=function(){pa(Bu,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=h,t.addEventListener("click",o.current,{once:!0})):h()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ku(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),r=m.useRef(!1);return m.useEffect(()=>{const o=s=>{s.target&&!r.current&&pa(Wu,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Zo(){const e=new CustomEvent(Ar);document.dispatchEvent(e)}function pa(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ua(o,s):o.dispatchEvent(s)}var cr=0;function Zr(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Jo()),document.body.insertAdjacentElement("beforeend",e[1]??Jo()),cr++,()=>{cr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),cr--}},[])}function Jo(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dr="focusScope.autoFocusOnMount",ur="focusScope.autoFocusOnUnmount",es={bubbles:!1,cancelable:!0},qu="FocusScope",Bn=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[i,h]=m.useState(null),f=qe(o),c=qe(s),l=m.useRef(null),u=pe(t,v=>h(v)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(R){if(p.paused||!i)return;const S=R.target;i.contains(S)?l.current=S:ot(l.current,{select:!0})},w=function(R){if(p.paused||!i)return;const S=R.relatedTarget;S!==null&&(i.contains(S)||ot(l.current,{select:!0}))},b=function(R){if(document.activeElement===document.body)for(const L of R)L.removedNodes.length>0&&ot(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const A=new MutationObserver(b);return i&&A.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),A.disconnect()}}},[r,i,p.paused]),m.useEffect(()=>{if(i){ns.add(p);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(dr,es);i.addEventListener(dr,f),i.dispatchEvent(b),b.defaultPrevented||(Yu(ef(ga(i)),{select:!0}),document.activeElement===v&&ot(i))}return()=>{i.removeEventListener(dr,f),setTimeout(()=>{const b=new CustomEvent(ur,es);i.addEventListener(ur,c),i.dispatchEvent(b),b.defaultPrevented||ot(v??document.body,{select:!0}),i.removeEventListener(ur,c),ns.remove(p)},0)}}},[i,f,c,p]);const g=m.useCallback(v=>{if(!n&&!r||p.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(w&&b){const A=v.currentTarget,[R,S]=Xu(A);R&&S?!v.shiftKey&&b===S?(v.preventDefault(),n&&ot(R,{select:!0})):v.shiftKey&&b===R&&(v.preventDefault(),n&&ot(S,{select:!0})):b===A&&v.preventDefault()}},[n,r,p.paused]);return d.jsx(ue.div,{tabIndex:-1,...a,ref:u,onKeyDown:g})});Bn.displayName=qu;function Yu(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ot(r,{select:t}),document.activeElement!==n)return}function Xu(e){const t=ga(e),n=ts(t,e),r=ts(t.reverse(),e);return[n,r]}function ga(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ts(e,t){for(const n of e)if(!Qu(n,{upTo:t}))return n}function Qu(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Zu(e){return e instanceof HTMLInputElement&&"select"in e}function ot(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Zu(e)&&t&&e.select()}}var ns=Ju();function Ju(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=rs(e,t),e.unshift(t)},remove(t){var n;e=rs(e,t),(n=e[0])==null||n.resume()}}}function rs(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ef(e){return e.filter(t=>t.tagName!=="A")}var tf=Vr[" useId ".trim().toString()]||(()=>{}),nf=0;function Ce(e){const[t,n]=m.useState(tf());return Ke(()=>{n(r=>r??String(nf++))},[e]),e||(t?`radix-${t}`:"")}const rf=["top","right","bottom","left"],it=Math.min,Ne=Math.max,jn=Math.round,bn=Math.floor,Be=e=>({x:e,y:e}),of={left:"right",right:"left",bottom:"top",top:"bottom"};function Rr(e,t,n){return Ne(e,it(t,n))}function Ye(e,t){return typeof e=="function"?e(t):e}function Xe(e){return e.split("-")[0]}function Bt(e){return e.split("-")[1]}function Jr(e){return e==="x"?"y":"x"}function eo(e){return e==="y"?"height":"width"}function ze(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function to(e){return Jr(ze(e))}function sf(e,t,n){n===void 0&&(n=!1);const r=Bt(e),o=to(e),s=eo(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=An(a)),[a,An(a)]}function af(e){const t=An(e);return[Tr(e),t,Tr(t)]}function Tr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const os=["left","right"],ss=["right","left"],lf=["top","bottom"],cf=["bottom","top"];function df(e,t,n){switch(e){case"top":case"bottom":return n?t?ss:os:t?os:ss;case"left":case"right":return t?lf:cf;default:return[]}}function uf(e,t,n,r){const o=Bt(e);let s=df(Xe(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(Tr)))),s}function An(e){const t=Xe(e);return of[t]+e.slice(t.length)}function ff(e){return{top:0,right:0,bottom:0,left:0,...e}}function xa(e){return typeof e!="number"?ff(e):{top:e,right:e,bottom:e,left:e}}function Rn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function as(e,t,n){let{reference:r,floating:o}=e;const s=ze(t),a=to(t),i=eo(a),h=Xe(t),f=s==="y",c=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,u=r[i]/2-o[i]/2;let p;switch(h){case"top":p={x:c,y:r.y-o.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:l};break;case"left":p={x:r.x-o.width,y:l};break;default:p={x:r.x,y:r.y}}switch(Bt(t)){case"start":p[a]-=u*(n&&f?-1:1);break;case"end":p[a]+=u*(n&&f?-1:1);break}return p}async function hf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:i,strategy:h}=e,{boundary:f="clippingAncestors",rootBoundary:c="viewport",elementContext:l="floating",altBoundary:u=!1,padding:p=0}=Ye(t,e),g=xa(p),w=i[u?l==="floating"?"reference":"floating":l],b=Rn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:c,strategy:h})),A=l==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),S=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},L=Rn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:A,offsetParent:R,strategy:h}):A);return{top:(b.top-L.top+g.top)/S.y,bottom:(L.bottom-b.bottom+g.bottom)/S.y,left:(b.left-L.left+g.left)/S.x,right:(L.right-b.right+g.right)/S.x}}const mf=50,pf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:hf},h=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:l}=as(f,r,h),u=r,p=0;const g={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:b,fn:A}=w,{x:R,y:S,data:L,reset:k}=await A({x:c,y:l,initialPlacement:r,placement:u,strategy:o,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});c=R??c,l=S??l,g[b]={...g[b],...L},k&&p<mf&&(p++,typeof k=="object"&&(k.placement&&(u=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:c,y:l}=as(f,u,h)),v=-1)}return{x:c,y:l,placement:u,strategy:o,middlewareData:g}},gf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:h}=t,{element:f,padding:c=0}=Ye(e,t)||{};if(f==null)return{};const l=xa(c),u={x:n,y:r},p=to(o),g=eo(p),v=await a.getDimensions(f),w=p==="y",b=w?"top":"left",A=w?"bottom":"right",R=w?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-u[p]-s.floating[g],L=u[p]-s.reference[p],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let N=k?k[R]:0;(!N||!await(a.isElement==null?void 0:a.isElement(k)))&&(N=i.floating[R]||s.floating[g]);const x=S/2-L/2,y=N/2-v[g]/2-1,j=it(l[b],y),P=it(l[A],y),O=j,F=N-v[g]-P,M=N/2-v[g]/2+x,U=Rr(O,M,F),E=!h.arrow&&Bt(o)!=null&&M!==U&&s.reference[g]/2-(M<O?j:P)-v[g]/2<0,C=E?M<O?M-O:M-F:0;return{[p]:u[p]+C,data:{[p]:U,centerOffset:M-U-C,...E&&{alignmentOffset:C}},reset:E}}}),xf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:h,elements:f}=t,{mainAxis:c=!0,crossAxis:l=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...w}=Ye(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Xe(o),A=ze(i),R=Xe(i)===i,S=await(h.isRTL==null?void 0:h.isRTL(f.floating)),L=u||(R||!v?[An(i)]:af(i)),k=g!=="none";!u&&k&&L.push(...uf(i,v,g,S));const N=[i,...L],x=await h.detectOverflow(t,w),y=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(c&&y.push(x[b]),l){const M=sf(o,a,S);y.push(x[M[0]],x[M[1]])}if(j=[...j,{placement:o,overflows:y}],!y.every(M=>M<=0)){var P,O;const M=(((P=s.flip)==null?void 0:P.index)||0)+1,U=N[M];if(U&&(!(l==="alignment"?A!==ze(U):!1)||j.every(D=>ze(D.placement)===A?D.overflows[0]>0:!0)))return{data:{index:M,overflows:j},reset:{placement:U}};let E=(O=j.filter(C=>C.overflows[0]<=0).sort((C,D)=>C.overflows[1]-D.overflows[1])[0])==null?void 0:O.placement;if(!E)switch(p){case"bestFit":{var F;const C=(F=j.filter(D=>{if(k){const _=ze(D.placement);return _===A||_==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(_=>_>0).reduce((_,I)=>_+I,0)]).sort((D,_)=>D[1]-_[1])[0])==null?void 0:F[0];C&&(E=C);break}case"initialPlacement":E=i;break}if(o!==E)return{reset:{placement:E}}}return{}}}};function is(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ls(e){return rf.some(t=>e[t]>=0)}const vf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Ye(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),i=is(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ls(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),i=is(a,n.floating);return{data:{escapedOffsets:i,escaped:ls(i)}}}default:return{}}}}},va=new Set(["left","top"]);async function yf(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=Xe(n),i=Bt(n),h=ze(n)==="y",f=va.has(a)?-1:1,c=s&&h?-1:1,l=Ye(t,e);let{mainAxis:u,crossAxis:p,alignmentAxis:g}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return i&&typeof g=="number"&&(p=i==="end"?g*-1:g),h?{x:p*c,y:u*f}:{x:u*f,y:p*c}}const bf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,h=await yf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:s+h.y,data:{...h,placement:a}}}}},wf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:h={fn:b=>{let{x:A,y:R}=b;return{x:A,y:R}}},...f}=Ye(e,t),c={x:n,y:r},l=await s.detectOverflow(t,f),u=ze(Xe(o)),p=Jr(u);let g=c[p],v=c[u];if(a){const b=p==="y"?"top":"left",A=p==="y"?"bottom":"right",R=g+l[b],S=g-l[A];g=Rr(R,g,S)}if(i){const b=u==="y"?"top":"left",A=u==="y"?"bottom":"right",R=v+l[b],S=v-l[A];v=Rr(R,v,S)}const w=h.fn({...t,[p]:g,[u]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:a,[u]:i}}}}}},Cf=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:h=!0,crossAxis:f=!0}=Ye(e,t),c={x:n,y:r},l=ze(o),u=Jr(l);let p=c[u],g=c[l];const v=Ye(i,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(h){const R=u==="y"?"height":"width",S=s.reference[u]-s.floating[R]+w.mainAxis,L=s.reference[u]+s.reference[R]-w.mainAxis;p<S?p=S:p>L&&(p=L)}if(f){var b,A;const R=u==="y"?"width":"height",S=va.has(Xe(o)),L=s.reference[l]-s.floating[R]+(S&&((b=a.offset)==null?void 0:b[l])||0)+(S?0:w.crossAxis),k=s.reference[l]+s.reference[R]+(S?0:((A=a.offset)==null?void 0:A[l])||0)-(S?w.crossAxis:0);g<L?g=L:g>k&&(g=k)}return{[u]:p,[l]:g}}}},Sf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:h=()=>{},...f}=Ye(e,t),c=await a.detectOverflow(t,f),l=Xe(o),u=Bt(o),p=ze(o)==="y",{width:g,height:v}=s.floating;let w,b;l==="top"||l==="bottom"?(w=l,b=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=l,w=u==="end"?"top":"bottom");const A=v-c.top-c.bottom,R=g-c.left-c.right,S=it(v-c[w],A),L=it(g-c[b],R),k=!t.middlewareData.shift;let N=S,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=A),k&&!u){const j=Ne(c.left,0),P=Ne(c.right,0),O=Ne(c.top,0),F=Ne(c.bottom,0);p?x=g-2*(j!==0||P!==0?j+P:Ne(c.left,c.right)):N=v-2*(O!==0||F!==0?O+F:Ne(c.top,c.bottom))}await h({...t,availableWidth:x,availableHeight:N});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Wn(){return typeof window<"u"}function Wt(e){return ya(e)?(e.nodeName||"").toLowerCase():"#document"}function je(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function He(e){var t;return(t=(ya(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ya(e){return Wn()?e instanceof Node||e instanceof je(e).Node:!1}function Oe(e){return Wn()?e instanceof Element||e instanceof je(e).Element:!1}function Ze(e){return Wn()?e instanceof HTMLElement||e instanceof je(e).HTMLElement:!1}function cs(e){return!Wn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof je(e).ShadowRoot}function cn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=De(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function kf(e){return/^(table|td|th)$/.test(Wt(e))}function Hn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const _f=/transform|translate|scale|rotate|perspective|filter/,Ef=/paint|layout|strict|content/,vt=e=>!!e&&e!=="none";let fr;function no(e){const t=Oe(e)?De(e):e;return vt(t.transform)||vt(t.translate)||vt(t.scale)||vt(t.rotate)||vt(t.perspective)||!ro()&&(vt(t.backdropFilter)||vt(t.filter))||_f.test(t.willChange||"")||Ef.test(t.contain||"")}function Nf(e){let t=lt(e);for(;Ze(t)&&!Lt(t);){if(no(t))return t;if(Hn(t))return null;t=lt(t)}return null}function ro(){return fr==null&&(fr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fr}function Lt(e){return/^(html|body|#document)$/.test(Wt(e))}function De(e){return je(e).getComputedStyle(e)}function Vn(e){return Oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(Wt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cs(e)&&e.host||He(e);return cs(t)?t.host:t}function ba(e){const t=lt(e);return Lt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ze(t)&&cn(t)?t:ba(t)}function Jt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ba(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=je(o);if(s){const i=Ir(a);return t.concat(a,a.visualViewport||[],cn(o)?o:[],i&&n?Jt(i):[])}else return t.concat(o,Jt(o,[],n))}function Ir(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wa(e){const t=De(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=jn(n)!==s||jn(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function oo(e){return Oe(e)?e:e.contextElement}function Pt(e){const t=oo(e);if(!Ze(t))return Be(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=wa(t);let a=(s?jn(n.width):n.width)/r,i=(s?jn(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const jf=Be(0);function Ca(e){const t=je(e);return!ro()||!t.visualViewport?jf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Af(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==je(e)?!1:t}function Ct(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=oo(e);let a=Be(1);t&&(r?Oe(r)&&(a=Pt(r)):a=Pt(e));const i=Af(s,n,r)?Ca(s):Be(0);let h=(o.left+i.x)/a.x,f=(o.top+i.y)/a.y,c=o.width/a.x,l=o.height/a.y;if(s){const u=je(s),p=r&&Oe(r)?je(r):r;let g=u,v=Ir(g);for(;v&&r&&p!==g;){const w=Pt(v),b=v.getBoundingClientRect(),A=De(v),R=b.left+(v.clientLeft+parseFloat(A.paddingLeft))*w.x,S=b.top+(v.clientTop+parseFloat(A.paddingTop))*w.y;h*=w.x,f*=w.y,c*=w.x,l*=w.y,h+=R,f+=S,g=je(v),v=Ir(g)}}return Rn({width:c,height:l,x:h,y:f})}function Gn(e,t){const n=Vn(e).scrollLeft;return t?t.left+n:Ct(He(e)).left+n}function Sa(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Gn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Rf(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=He(r),i=t?Hn(t.floating):!1;if(r===a||i&&s)return n;let h={scrollLeft:0,scrollTop:0},f=Be(1);const c=Be(0),l=Ze(r);if((l||!l&&!s)&&((Wt(r)!=="body"||cn(a))&&(h=Vn(r)),l)){const p=Ct(r);f=Pt(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const u=a&&!l&&!s?Sa(a,h):Be(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-h.scrollLeft*f.x+c.x+u.x,y:n.y*f.y-h.scrollTop*f.y+c.y+u.y}}function Tf(e){return Array.from(e.getClientRects())}function If(e){const t=He(e),n=Vn(e),r=e.ownerDocument.body,o=Ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Gn(e);const i=-n.scrollTop;return De(r).direction==="rtl"&&(a+=Ne(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}const ds=25;function Mf(e,t){const n=je(e),r=He(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,h=0;if(o){s=o.width,a=o.height;const c=ro();(!c||c&&t==="fixed")&&(i=o.offsetLeft,h=o.offsetTop)}const f=Gn(r);if(f<=0){const c=r.ownerDocument,l=c.body,u=getComputedStyle(l),p=c.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(r.clientWidth-l.clientWidth-p);g<=ds&&(s-=g)}else f<=ds&&(s+=f);return{width:s,height:a,x:i,y:h}}function Pf(e,t){const n=Ct(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ze(e)?Pt(e):Be(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,h=o*s.x,f=r*s.y;return{width:a,height:i,x:h,y:f}}function us(e,t,n){let r;if(t==="viewport")r=Mf(e,n);else if(t==="document")r=If(He(e));else if(Oe(t))r=Pf(t,n);else{const o=Ca(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Rn(r)}function ka(e,t){const n=lt(e);return n===t||!Oe(n)||Lt(n)?!1:De(n).position==="fixed"||ka(n,t)}function Of(e,t){const n=t.get(e);if(n)return n;let r=Jt(e,[],!1).filter(i=>Oe(i)&&Wt(i)!=="body"),o=null;const s=De(e).position==="fixed";let a=s?lt(e):e;for(;Oe(a)&&!Lt(a);){const i=De(a),h=no(a);!h&&i.position==="fixed"&&(o=null),(s?!h&&!o:!h&&i.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||cn(a)&&!h&&ka(e,a))?r=r.filter(c=>c!==a):o=i,a=lt(a)}return t.set(e,r),r}function Df(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Hn(t)?[]:Of(t,this._c):[].concat(n),r],i=us(t,a[0],o);let h=i.top,f=i.right,c=i.bottom,l=i.left;for(let u=1;u<a.length;u++){const p=us(t,a[u],o);h=Ne(p.top,h),f=it(p.right,f),c=it(p.bottom,c),l=Ne(p.left,l)}return{width:f-l,height:c-h,x:l,y:h}}function Lf(e){const{width:t,height:n}=wa(e);return{width:t,height:n}}function $f(e,t,n){const r=Ze(t),o=He(t),s=n==="fixed",a=Ct(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const h=Be(0);function f(){h.x=Gn(o)}if(r||!r&&!s)if((Wt(t)!=="body"||cn(o))&&(i=Vn(t)),r){const p=Ct(t,!0,s,t);h.x=p.x+t.clientLeft,h.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const c=o&&!r&&!s?Sa(o,i):Be(0),l=a.left+i.scrollLeft-h.x-c.x,u=a.top+i.scrollTop-h.y-c.y;return{x:l,y:u,width:a.width,height:a.height}}function hr(e){return De(e).position==="static"}function fs(e,t){if(!Ze(e)||De(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return He(e)===n&&(n=n.ownerDocument.body),n}function _a(e,t){const n=je(e);if(Hn(e))return n;if(!Ze(e)){let o=lt(e);for(;o&&!Lt(o);){if(Oe(o)&&!hr(o))return o;o=lt(o)}return n}let r=fs(e,t);for(;r&&kf(r)&&hr(r);)r=fs(r,t);return r&&Lt(r)&&hr(r)&&!no(r)?n:r||Nf(e)||n}const Ff=async function(e){const t=this.getOffsetParent||_a,n=this.getDimensions,r=await n(e.floating);return{reference:$f(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uf(e){return De(e).direction==="rtl"}const zf={convertOffsetParentRelativeRectToViewportRelativeRect:Rf,getDocumentElement:He,getClippingRect:Df,getOffsetParent:_a,getElementRects:Ff,getClientRects:Tf,getDimensions:Lf,getScale:Pt,isElement:Oe,isRTL:Uf};function Ea(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bf(e,t){let n=null,r;const o=He(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,h){i===void 0&&(i=!1),h===void 0&&(h=1),s();const f=e.getBoundingClientRect(),{left:c,top:l,width:u,height:p}=f;if(i||t(),!u||!p)return;const g=bn(l),v=bn(o.clientWidth-(c+u)),w=bn(o.clientHeight-(l+p)),b=bn(c),R={rootMargin:-g+"px "+-v+"px "+-w+"px "+-b+"px",threshold:Ne(0,it(1,h))||1};let S=!0;function L(k){const N=k[0].intersectionRatio;if(N!==h){if(!S)return a();N?a(!1,N):r=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!Ea(f,e.getBoundingClientRect())&&a(),S=!1}try{n=new IntersectionObserver(L,{...R,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,R)}n.observe(e)}return a(!0),s}function Wf(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,f=oo(e),c=o||s?[...f?Jt(f):[],...t?Jt(t):[]]:[];c.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const l=f&&i?Bf(f,n):null;let u=-1,p=null;a&&(p=new ResizeObserver(b=>{let[A]=b;A&&A.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var R;(R=p)==null||R.observe(t)})),n()}),f&&!h&&p.observe(f),t&&p.observe(t));let g,v=h?Ct(e):null;h&&w();function w(){const b=Ct(e);v&&!Ea(v,b)&&n(),v=b,g=requestAnimationFrame(w)}return n(),()=>{var b;c.forEach(A=>{o&&A.removeEventListener("scroll",n),s&&A.removeEventListener("resize",n)}),l==null||l(),(b=p)==null||b.disconnect(),p=null,h&&cancelAnimationFrame(g)}}const Hf=bf,Vf=wf,Gf=xf,Kf=Sf,qf=vf,hs=gf,Yf=Cf,Xf=(e,t,n)=>{const r=new Map,o={platform:zf,...n},s={...o.platform,_c:r};return pf(e,t,{...o,platform:s})};var Qf=typeof document<"u",Zf=function(){},kn=Qf?m.useLayoutEffect:Zf;function Tn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Tn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Tn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Na(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ms(e,t){const n=Na(e);return Math.round(t*n)/n}function mr(e){const t=m.useRef(e);return kn(()=>{t.current=e}),t}function Jf(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:h,open:f}=e,[c,l]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,p]=m.useState(r);Tn(u,r)||p(r);const[g,v]=m.useState(null),[w,b]=m.useState(null),A=m.useCallback(D=>{D!==k.current&&(k.current=D,v(D))},[]),R=m.useCallback(D=>{D!==N.current&&(N.current=D,b(D))},[]),S=s||g,L=a||w,k=m.useRef(null),N=m.useRef(null),x=m.useRef(c),y=h!=null,j=mr(h),P=mr(o),O=mr(f),F=m.useCallback(()=>{if(!k.current||!N.current)return;const D={placement:t,strategy:n,middleware:u};P.current&&(D.platform=P.current),Xf(k.current,N.current,D).then(_=>{const I={..._,isPositioned:O.current!==!1};M.current&&!Tn(x.current,I)&&(x.current=I,Ms.flushSync(()=>{l(I)}))})},[u,t,n,P,O]);kn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,l(D=>({...D,isPositioned:!1})))},[f]);const M=m.useRef(!1);kn(()=>(M.current=!0,()=>{M.current=!1}),[]),kn(()=>{if(S&&(k.current=S),L&&(N.current=L),S&&L){if(j.current)return j.current(S,L,F);F()}},[S,L,F,j,y]);const U=m.useMemo(()=>({reference:k,floating:N,setReference:A,setFloating:R}),[A,R]),E=m.useMemo(()=>({reference:S,floating:L}),[S,L]),C=m.useMemo(()=>{const D={position:n,left:0,top:0};if(!E.floating)return D;const _=ms(E.floating,c.x),I=ms(E.floating,c.y);return i?{...D,transform:"translate("+_+"px, "+I+"px)",...Na(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:I}},[n,i,E.floating,c.x,c.y]);return m.useMemo(()=>({...c,update:F,refs:U,elements:E,floatingStyles:C}),[c,F,U,E,C])}const eh=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?hs({element:r.current,padding:o}).fn(n):{}:r?hs({element:r,padding:o}).fn(n):{}}}},th=(e,t)=>{const n=Hf(e);return{name:n.name,fn:n.fn,options:[e,t]}},nh=(e,t)=>{const n=Vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},rh=(e,t)=>({fn:Yf(e).fn,options:[e,t]}),oh=(e,t)=>{const n=Gf(e);return{name:n.name,fn:n.fn,options:[e,t]}},sh=(e,t)=>{const n=Kf(e);return{name:n.name,fn:n.fn,options:[e,t]}},ah=(e,t)=>{const n=qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},ih=(e,t)=>{const n=eh(e);return{name:n.name,fn:n.fn,options:[e,t]}};var lh="Arrow",ja=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return d.jsx(ue.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});ja.displayName=lh;var ch=ja;function dh(e){const[t,n]=m.useState(void 0);return Ke(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,i;if("borderBoxSize"in s){const h=s.borderBoxSize,f=Array.isArray(h)?h[0]:h;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var so="Popper",[Aa,Ht]=Qe(so),[uh,Ra]=Aa(so),Ta=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return d.jsx(uh,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ta.displayName=so;var Ia="PopperAnchor",Ma=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Ra(Ia,n),a=m.useRef(null),i=pe(t,a),h=m.useRef(null);return m.useEffect(()=>{const f=h.current;h.current=(r==null?void 0:r.current)||a.current,f!==h.current&&s.onAnchorChange(h.current)}),r?null:d.jsx(ue.div,{...o,ref:i})});Ma.displayName=Ia;var ao="PopperContent",[fh,hh]=Aa(ao),Pa=m.forwardRef((e,t)=>{var G,X,K,ne,ae,de;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:h=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:l="partial",hideWhenDetached:u=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=e,w=Ra(ao,n),[b,A]=m.useState(null),R=pe(t,me=>A(me)),[S,L]=m.useState(null),k=dh(S),N=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=r+(s!=="center"?"-"+s:""),j=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},P=Array.isArray(f)?f:[f],O=P.length>0,F={padding:j,boundary:P.filter(ph),altBoundary:O},{refs:M,floatingStyles:U,placement:E,isPositioned:C,middlewareData:D}=Jf({strategy:"fixed",placement:y,whileElementsMounted:(...me)=>Wf(...me,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[th({mainAxis:o+x,alignmentAxis:a}),h&&nh({mainAxis:!0,crossAxis:!1,limiter:l==="partial"?rh():void 0,...F}),h&&oh({...F}),sh({...F,apply:({elements:me,rects:H,availableWidth:q,availableHeight:J})=>{const{width:te,height:ie}=H.reference,oe=me.floating.style;oe.setProperty("--radix-popper-available-width",`${q}px`),oe.setProperty("--radix-popper-available-height",`${J}px`),oe.setProperty("--radix-popper-anchor-width",`${te}px`),oe.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),S&&ih({element:S,padding:i}),gh({arrowWidth:N,arrowHeight:x}),u&&ah({strategy:"referenceHidden",...F})]}),[_,I]=La(E),W=qe(g);Ke(()=>{C&&(W==null||W())},[C,W]);const T=(G=D.arrow)==null?void 0:G.x,B=(X=D.arrow)==null?void 0:X.y,z=((K=D.arrow)==null?void 0:K.centerOffset)!==0,[$,V]=m.useState();return Ke(()=>{b&&V(window.getComputedStyle(b).zIndex)},[b]),d.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:C?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[(ne=D.transformOrigin)==null?void 0:ne.x,(ae=D.transformOrigin)==null?void 0:ae.y].join(" "),...((de=D.hide)==null?void 0:de.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(fh,{scope:n,placedSide:_,onArrowChange:L,arrowX:T,arrowY:B,shouldHideArrow:z,children:d.jsx(ue.div,{"data-side":_,"data-align":I,...v,ref:R,style:{...v.style,animation:C?void 0:"none"}})})})});Pa.displayName=ao;var Oa="PopperArrow",mh={top:"bottom",right:"left",bottom:"top",left:"right"},Da=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=hh(Oa,r),a=mh[s.placedSide];return d.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:d.jsx(ch,{...o,ref:n,style:{...o.style,display:"block"}})})});Da.displayName=Oa;function ph(e){return e!==null}var gh=e=>({name:"transformOrigin",options:e,fn(t){var w,b,A;const{placement:n,rects:r,middlewareData:o}=t,a=((w=o.arrow)==null?void 0:w.centerOffset)!==0,i=a?0:e.arrowWidth,h=a?0:e.arrowHeight,[f,c]=La(n),l={start:"0%",center:"50%",end:"100%"}[c],u=(((b=o.arrow)==null?void 0:b.x)??0)+i/2,p=(((A=o.arrow)==null?void 0:A.y)??0)+h/2;let g="",v="";return f==="bottom"?(g=a?l:`${u}px`,v=`${-h}px`):f==="top"?(g=a?l:`${u}px`,v=`${r.floating.height+h}px`):f==="right"?(g=`${-h}px`,v=a?l:`${p}px`):f==="left"&&(g=`${r.floating.width+h}px`,v=a?l:`${p}px`),{data:{x:g,y:v}}}});function La(e){const[t,n="center"]=e.split("-");return[t,n]}var io=Ta,Kn=Ma,lo=Pa,co=Da,xh="Portal",dn=m.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,s]=m.useState(!1);Ke(()=>s(!0),[]);const a=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?rc.createPortal(d.jsx(ue.div,{...r,ref:t}),a):null});dn.displayName=xh;function vh(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Ae=e=>{const{present:t,children:n}=e,r=yh(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=pe(r.ref,bh(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:s}):null};Ae.displayName="Presence";function yh(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),s=m.useRef("none"),a=e?"mounted":"unmounted",[i,h]=vh(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=wn(r.current);s.current=i==="mounted"?f:"none"},[i]),Ke(()=>{const f=r.current,c=o.current;if(c!==e){const u=s.current,p=wn(f);e?h("MOUNT"):p==="none"||(f==null?void 0:f.display)==="none"?h("UNMOUNT"):h(c&&u!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,h]),Ke(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,l=p=>{const v=wn(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(h("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},u=p=>{p.target===t&&(s.current=wn(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function wn(e){return(e==null?void 0:e.animationName)||"none"}function bh(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pr="rovingFocusGroup.onEntryFocus",wh={bubbles:!1,cancelable:!0},un="RovingFocusGroup",[Mr,$a,Ch]=fa(un),[Sh,Fa]=Qe(un,[Ch]),[kh,_h]=Sh(un),Ua=m.forwardRef((e,t)=>d.jsx(Mr.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Mr.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Eh,{...e,ref:t})})}));Ua.displayName=un;var Eh=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:h,onEntryFocus:f,preventScrollOnEntryFocus:c=!1,...l}=e,u=m.useRef(null),p=pe(t,u),g=ha(s),[v,w]=at({prop:a,defaultProp:i??null,onChange:h,caller:un}),[b,A]=m.useState(!1),R=qe(f),S=$a(n),L=m.useRef(!1),[k,N]=m.useState(0);return m.useEffect(()=>{const x=u.current;if(x)return x.addEventListener(pr,R),()=>x.removeEventListener(pr,R)},[R]),d.jsx(kh,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(x=>w(x),[w]),onItemShiftTab:m.useCallback(()=>A(!0),[]),onFocusableItemAdd:m.useCallback(()=>N(x=>x+1),[]),onFocusableItemRemove:m.useCallback(()=>N(x=>x-1),[]),children:d.jsx(ue.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...l,ref:p,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{L.current=!0}),onFocus:ee(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const j=new CustomEvent(pr,wh);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const P=S().filter(E=>E.focusable),O=P.find(E=>E.active),F=P.find(E=>E.id===v),U=[O,F,...P].filter(Boolean).map(E=>E.ref.current);Wa(U,c)}}L.current=!1}),onBlur:ee(e.onBlur,()=>A(!1))})})}),za="RovingFocusGroupItem",Ba=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...i}=e,h=Ce(),f=s||h,c=_h(za,n),l=c.currentTabStopId===f,u=$a(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:v}=c;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),d.jsx(Mr.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:d.jsx(ue.span,{tabIndex:l?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:ee(e.onMouseDown,w=>{r?c.onItemFocus(f):w.preventDefault()}),onFocus:ee(e.onFocus,()=>c.onItemFocus(f)),onKeyDown:ee(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){c.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const b=Ah(w,c.orientation,c.dir);if(b!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=u().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")R.reverse();else if(b==="prev"||b==="next"){b==="prev"&&R.reverse();const S=R.indexOf(w.currentTarget);R=c.loop?Rh(R,S+1):R.slice(S+1)}setTimeout(()=>Wa(R))}}),children:typeof a=="function"?a({isCurrentTabStop:l,hasTabStop:v!=null}):a})})});Ba.displayName=za;var Nh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function jh(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ah(e,t,n){const r=jh(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Nh[r]}function Wa(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Rh(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Th=Ua,Ih=Ba,Mh=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Rt=new WeakMap,Cn=new WeakMap,Sn={},gr=0,Ha=function(e){return e&&(e.host||Ha(e.parentNode))},Ph=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ha(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Oh=function(e,t,n,r){var o=Ph(t,Array.isArray(e)?e:[e]);Sn[n]||(Sn[n]=new WeakMap);var s=Sn[n],a=[],i=new Set,h=new Set(o),f=function(l){!l||i.has(l)||(i.add(l),f(l.parentNode))};o.forEach(f);var c=function(l){!l||h.has(l)||Array.prototype.forEach.call(l.children,function(u){if(i.has(u))c(u);else try{var p=u.getAttribute(r),g=p!==null&&p!=="false",v=(Rt.get(u)||0)+1,w=(s.get(u)||0)+1;Rt.set(u,v),s.set(u,w),a.push(u),v===1&&g&&Cn.set(u,!0),w===1&&u.setAttribute(n,"true"),g||u.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",u,b)}})};return c(t),i.clear(),gr++,function(){a.forEach(function(l){var u=Rt.get(l)-1,p=s.get(l)-1;Rt.set(l,u),s.set(l,p),u||(Cn.has(l)||l.removeAttribute(r),Cn.delete(l)),p||l.removeAttribute(n)}),gr--,gr||(Rt=new WeakMap,Rt=new WeakMap,Cn=new WeakMap,Sn={})}},uo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Mh(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Oh(r,o,n,"aria-hidden")):function(){return null}},Pr=["Enter"," "],Dh=["ArrowDown","PageUp","Home"],Va=["ArrowUp","PageDown","End"],Lh=[...Dh,...Va],$h={ltr:[...Pr,"ArrowRight"],rtl:[...Pr,"ArrowLeft"]},Fh={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fn="Menu",[en,Uh,zh]=fa(fn),[Nt,Ga]=Qe(fn,[zh,Ht,Fa]),qn=Ht(),Ka=Fa(),[Bh,jt]=Nt(fn),[Wh,hn]=Nt(fn),qa=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,i=qn(t),[h,f]=m.useState(null),c=m.useRef(!1),l=qe(s),u=ha(o);return m.useEffect(()=>{const p=()=>{c.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),d.jsx(io,{...i,children:d.jsx(Bh,{scope:t,open:n,onOpenChange:l,content:h,onContentChange:f,children:d.jsx(Wh,{scope:t,onClose:m.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:c,dir:u,modal:a,children:r})})})};qa.displayName=fn;var Hh="MenuAnchor",fo=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=qn(n);return d.jsx(Kn,{...o,...r,ref:t})});fo.displayName=Hh;var ho="MenuPortal",[Vh,Ya]=Nt(ho,{forceMount:void 0}),Xa=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=jt(ho,t);return d.jsx(Vh,{scope:t,forceMount:n,children:d.jsx(Ae,{present:n||s.open,children:d.jsx(dn,{asChild:!0,container:o,children:r})})})};Xa.displayName=ho;var Te="MenuContent",[Gh,mo]=Nt(Te),Qa=m.forwardRef((e,t)=>{const n=Ya(Te,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=jt(Te,e.__scopeMenu),a=hn(Te,e.__scopeMenu);return d.jsx(en.Provider,{scope:e.__scopeMenu,children:d.jsx(Ae,{present:r||s.open,children:d.jsx(en.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(Kh,{...o,ref:t}):d.jsx(qh,{...o,ref:t})})})})}),Kh=m.forwardRef((e,t)=>{const n=jt(Te,e.__scopeMenu),r=m.useRef(null),o=pe(t,r);return m.useEffect(()=>{const s=r.current;if(s)return uo(s)},[]),d.jsx(po,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),qh=m.forwardRef((e,t)=>{const n=jt(Te,e.__scopeMenu);return d.jsx(po,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Yh=Dt("MenuContent.ScrollLock"),po=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:h,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:p,disableOutsideScroll:g,...v}=e,w=jt(Te,n),b=hn(Te,n),A=qn(n),R=Ka(n),S=Uh(n),[L,k]=m.useState(null),N=m.useRef(null),x=pe(t,N,w.onContentChange),y=m.useRef(0),j=m.useRef(""),P=m.useRef(0),O=m.useRef(null),F=m.useRef("right"),M=m.useRef(0),U=g?Gr:m.Fragment,E=g?{as:Yh,allowPinchZoom:!0}:void 0,C=_=>{var G,X;const I=j.current+_,W=S().filter(K=>!K.disabled),T=document.activeElement,B=(G=W.find(K=>K.ref.current===T))==null?void 0:G.textValue,z=W.map(K=>K.textValue),$=im(z,I,B),V=(X=W.find(K=>K.textValue===$))==null?void 0:X.ref.current;(function K(ne){j.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>K(""),1e3))})(I),V&&setTimeout(()=>V.focus())};m.useEffect(()=>()=>window.clearTimeout(y.current),[]),Zr();const D=m.useCallback(_=>{var W,T;return F.current===((W=O.current)==null?void 0:W.side)&&cm(_,(T=O.current)==null?void 0:T.area)},[]);return d.jsx(Gh,{scope:n,searchRef:j,onItemEnter:m.useCallback(_=>{D(_)&&_.preventDefault()},[D]),onItemLeave:m.useCallback(_=>{var I;D(_)||((I=N.current)==null||I.focus(),k(null))},[D]),onTriggerLeave:m.useCallback(_=>{D(_)&&_.preventDefault()},[D]),pointerGraceTimerRef:P,onPointerGraceIntentChange:m.useCallback(_=>{O.current=_},[]),children:d.jsx(U,{...E,children:d.jsx(Bn,{asChild:!0,trapped:o,onMountAutoFocus:ee(s,_=>{var I;_.preventDefault(),(I=N.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(ln,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:p,children:d.jsx(Th,{asChild:!0,...R,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:k,onEntryFocus:ee(h,_=>{b.isUsingKeyboardRef.current||_.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(lo,{role:"menu","aria-orientation":"vertical","data-state":hi(w.open),"data-radix-menu-content":"",dir:b.dir,...A,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:ee(v.onKeyDown,_=>{const W=_.target.closest("[data-radix-menu-content]")===_.currentTarget,T=_.ctrlKey||_.altKey||_.metaKey,B=_.key.length===1;W&&(_.key==="Tab"&&_.preventDefault(),!T&&B&&C(_.key));const z=N.current;if(_.target!==z||!Lh.includes(_.key))return;_.preventDefault();const V=S().filter(G=>!G.disabled).map(G=>G.ref.current);Va.includes(_.key)&&V.reverse(),sm(V)}),onBlur:ee(e.onBlur,_=>{_.currentTarget.contains(_.target)||(window.clearTimeout(y.current),j.current="")}),onPointerMove:ee(e.onPointerMove,tn(_=>{const I=_.target,W=M.current!==_.clientX;if(_.currentTarget.contains(I)&&W){const T=_.clientX>M.current?"right":"left";F.current=T,M.current=_.clientX}}))})})})})})})});Qa.displayName=Te;var Xh="MenuGroup",go=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(ue.div,{role:"group",...r,ref:t})});go.displayName=Xh;var Qh="MenuLabel",Za=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(ue.div,{...r,ref:t})});Za.displayName=Qh;var In="MenuItem",ps="menu.itemSelect",Yn=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=m.useRef(null),a=hn(In,e.__scopeMenu),i=mo(In,e.__scopeMenu),h=pe(t,s),f=m.useRef(!1),c=()=>{const l=s.current;if(!n&&l){const u=new CustomEvent(ps,{bubbles:!0,cancelable:!0});l.addEventListener(ps,p=>r==null?void 0:r(p),{once:!0}),ua(l,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(Ja,{...o,ref:h,disabled:n,onClick:ee(e.onClick,c),onPointerDown:l=>{var u;(u=e.onPointerDown)==null||u.call(e,l),f.current=!0},onPointerUp:ee(e.onPointerUp,l=>{var u;f.current||(u=l.currentTarget)==null||u.click()}),onKeyDown:ee(e.onKeyDown,l=>{const u=i.searchRef.current!=="";n||u&&l.key===" "||Pr.includes(l.key)&&(l.currentTarget.click(),l.preventDefault())})})});Yn.displayName=In;var Ja=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=mo(In,n),i=Ka(n),h=m.useRef(null),f=pe(t,h),[c,l]=m.useState(!1),[u,p]=m.useState("");return m.useEffect(()=>{const g=h.current;g&&p((g.textContent??"").trim())},[s.children]),d.jsx(en.ItemSlot,{scope:n,disabled:r,textValue:o??u,children:d.jsx(Ih,{asChild:!0,...i,focusable:!r,children:d.jsx(ue.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:ee(e.onPointerMove,tn(g=>{r?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ee(e.onPointerLeave,tn(g=>a.onItemLeave(g))),onFocus:ee(e.onFocus,()=>l(!0)),onBlur:ee(e.onBlur,()=>l(!1))})})})}),Zh="MenuCheckboxItem",ei=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return d.jsx(si,{scope:e.__scopeMenu,checked:n,children:d.jsx(Yn,{role:"menuitemcheckbox","aria-checked":Mn(n)?"mixed":n,...o,ref:t,"data-state":vo(n),onSelect:ee(o.onSelect,()=>r==null?void 0:r(Mn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ei.displayName=Zh;var ti="MenuRadioGroup",[Jh,em]=Nt(ti,{value:void 0,onValueChange:()=>{}}),ni=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=qe(r);return d.jsx(Jh,{scope:e.__scopeMenu,value:n,onValueChange:s,children:d.jsx(go,{...o,ref:t})})});ni.displayName=ti;var ri="MenuRadioItem",oi=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=em(ri,e.__scopeMenu),s=n===o.value;return d.jsx(si,{scope:e.__scopeMenu,checked:s,children:d.jsx(Yn,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":vo(s),onSelect:ee(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});oi.displayName=ri;var xo="MenuItemIndicator",[si,tm]=Nt(xo,{checked:!1}),ai=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=tm(xo,n);return d.jsx(Ae,{present:r||Mn(s.checked)||s.checked===!0,children:d.jsx(ue.span,{...o,ref:t,"data-state":vo(s.checked)})})});ai.displayName=xo;var nm="MenuSeparator",ii=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(ue.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ii.displayName=nm;var rm="MenuArrow",li=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=qn(n);return d.jsx(co,{...o,...r,ref:t})});li.displayName=rm;var om="MenuSub",[ey,ci]=Nt(om),Xt="MenuSubTrigger",di=m.forwardRef((e,t)=>{const n=jt(Xt,e.__scopeMenu),r=hn(Xt,e.__scopeMenu),o=ci(Xt,e.__scopeMenu),s=mo(Xt,e.__scopeMenu),a=m.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:h}=s,f={__scopeMenu:e.__scopeMenu},c=m.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return m.useEffect(()=>c,[c]),m.useEffect(()=>{const l=i.current;return()=>{window.clearTimeout(l),h(null)}},[i,h]),d.jsx(fo,{asChild:!0,...f,children:d.jsx(Ja,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":hi(n.open),...e,ref:We(t,o.onTriggerChange),onClick:l=>{var u;(u=e.onClick)==null||u.call(e,l),!(e.disabled||l.defaultPrevented)&&(l.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ee(e.onPointerMove,tn(l=>{s.onItemEnter(l),!l.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:ee(e.onPointerLeave,tn(l=>{var p,g;c();const u=(p=n.content)==null?void 0:p.getBoundingClientRect();if(u){const v=(g=n.content)==null?void 0:g.dataset.side,w=v==="right",b=w?-5:5,A=u[w?"left":"right"],R=u[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:l.clientX+b,y:l.clientY},{x:A,y:u.top},{x:R,y:u.top},{x:R,y:u.bottom},{x:A,y:u.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(l),l.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ee(e.onKeyDown,l=>{var p;const u=s.searchRef.current!=="";e.disabled||u&&l.key===" "||$h[r.dir].includes(l.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),l.preventDefault())})})})});di.displayName=Xt;var ui="MenuSubContent",fi=m.forwardRef((e,t)=>{const n=Ya(Te,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=jt(Te,e.__scopeMenu),a=hn(Te,e.__scopeMenu),i=ci(ui,e.__scopeMenu),h=m.useRef(null),f=pe(t,h);return d.jsx(en.Provider,{scope:e.__scopeMenu,children:d.jsx(Ae,{present:r||s.open,children:d.jsx(en.Slot,{scope:e.__scopeMenu,children:d.jsx(po,{id:i.contentId,"aria-labelledby":i.triggerId,...o,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var l;a.isUsingKeyboardRef.current&&((l=h.current)==null||l.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:ee(e.onFocusOutside,c=>{c.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ee(e.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ee(e.onKeyDown,c=>{var p;const l=c.currentTarget.contains(c.target),u=Fh[a.dir].includes(c.key);l&&u&&(s.onOpenChange(!1),(p=i.trigger)==null||p.focus(),c.preventDefault())})})})})})});fi.displayName=ui;function hi(e){return e?"open":"closed"}function Mn(e){return e==="indeterminate"}function vo(e){return Mn(e)?"indeterminate":e?"checked":"unchecked"}function sm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function am(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function im(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=am(e,Math.max(s,0));o.length===1&&(a=a.filter(f=>f!==n));const h=a.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return h!==n?h:void 0}function lm(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],h=t[a],f=i.x,c=i.y,l=h.x,u=h.y;c>r!=u>r&&n<(l-f)*(r-c)/(u-c)+f&&(o=!o)}return o}function cm(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return lm(n,t)}function tn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var dm=qa,um=fo,fm=Xa,hm=Qa,mm=go,pm=Za,gm=Yn,xm=ei,vm=ni,ym=oi,bm=ai,wm=ii,Cm=li,Sm=di,km=fi,Xn="DropdownMenu",[_m]=Qe(Xn,[Ga]),Se=Ga(),[Em,mi]=_m(Xn),pi=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,h=Se(t),f=m.useRef(null),[c,l]=at({prop:o,defaultProp:s??!1,onChange:a,caller:Xn});return d.jsx(Em,{scope:t,triggerId:Ce(),triggerRef:f,contentId:Ce(),open:c,onOpenChange:l,onOpenToggle:m.useCallback(()=>l(u=>!u),[l]),modal:i,children:d.jsx(dm,{...h,open:c,onOpenChange:l,dir:r,modal:i,children:n})})};pi.displayName=Xn;var gi="DropdownMenuTrigger",xi=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=mi(gi,n),a=Se(n);return d.jsx(um,{asChild:!0,...a,children:d.jsx(ue.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:We(t,s.triggerRef),onPointerDown:ee(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:ee(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});xi.displayName=gi;var Nm="DropdownMenuPortal",vi=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Se(t);return d.jsx(fm,{...r,...n})};vi.displayName=Nm;var yi="DropdownMenuContent",bi=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=mi(yi,n),s=Se(n),a=m.useRef(!1);return d.jsx(hm,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:ee(e.onCloseAutoFocus,i=>{var h;a.current||(h=o.triggerRef.current)==null||h.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ee(e.onInteractOutside,i=>{const h=i.detail.originalEvent,f=h.button===0&&h.ctrlKey===!0,c=h.button===2||f;(!o.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});bi.displayName=yi;var jm="DropdownMenuGroup",Am=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(mm,{...o,...r,ref:t})});Am.displayName=jm;var Rm="DropdownMenuLabel",Tm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(pm,{...o,...r,ref:t})});Tm.displayName=Rm;var Im="DropdownMenuItem",wi=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(gm,{...o,...r,ref:t})});wi.displayName=Im;var Mm="DropdownMenuCheckboxItem",Pm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(xm,{...o,...r,ref:t})});Pm.displayName=Mm;var Om="DropdownMenuRadioGroup",Dm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(vm,{...o,...r,ref:t})});Dm.displayName=Om;var Lm="DropdownMenuRadioItem",$m=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(ym,{...o,...r,ref:t})});$m.displayName=Lm;var Fm="DropdownMenuItemIndicator",Um=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(bm,{...o,...r,ref:t})});Um.displayName=Fm;var zm="DropdownMenuSeparator",Bm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(wm,{...o,...r,ref:t})});Bm.displayName=zm;var Wm="DropdownMenuArrow",Hm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(Cm,{...o,...r,ref:t})});Hm.displayName=Wm;var Vm="DropdownMenuSubTrigger",Gm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(Sm,{...o,...r,ref:t})});Gm.displayName=Vm;var Km="DropdownMenuSubContent",qm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Se(n);return d.jsx(km,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});qm.displayName=Km;var Ym=pi,Xm=xi,Qm=vi,Zm=bi,Jm=wi;function ep({...e}){return d.jsx(Ym,{"data-slot":"dropdown-menu",...e})}function tp({...e}){return d.jsx(Xm,{"data-slot":"dropdown-menu-trigger",...e})}function np({className:e,sideOffset:t=4,...n}){return d.jsx(Qm,{children:d.jsx(Zm,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function rp({className:e,inset:t,variant:n="default",...r}){return d.jsx(Jm,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Z("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}const op=[{value:"light",label:"Light",icon:d.jsx(na,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(ta,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(Od,{className:"h-4 w-4"})}];function sp(){const{theme:e,setTheme:t,resolvedTheme:n}=ia();return d.jsxs(ep,{children:[d.jsx(tp,{asChild:!0,children:d.jsxs(Et,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?d.jsx(ta,{className:"h-4 w-4"}):d.jsx(na,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(np,{align:"end",children:op.map(r=>d.jsxs(rp,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,d.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}function ap({onIdentityClick:e,onTokenClick:t,activeTokenLabel:n,sessionTitle:r,onBack:o}){return d.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[r?d.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(hd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:r}),d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:"ACP"})]}):d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:d.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),d.jsx("span",{className:"hidden sm:inline",children:"Remote Control"})]}),d.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!r&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:"Dashboard",children:[d.jsx(Rd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),d.jsx(sp,{}),d.jsxs("button",{onClick:t,className:Z("flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm transition-colors",n?"bg-brand/10 text-text-primary hover:bg-brand-light hover:text-white":"text-text-primary font-bold hover:bg-brand-light hover:text-white"),title:"Token Manager",children:[d.jsx(jd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline max-w-24 truncate font-bold",children:n||"No Token"})]}),d.jsxs("button",{onClick:e,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary font-bold hover:bg-brand-light hover:text-white transition-colors",title:"Identity & QR",children:[d.jsx(mu,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline font-bold",children:"Identity"})]})]})]})})}function ty({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return d.jsx("span",{className:Z("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}let $t=class ce{constructor(t,n,r,o,s){this._legacyCanvasSize=ce.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||s?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||s||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let a=!1;if(t.hidden&&(t.hidden=!1,a=!0),document.body.contains(t)||(document.body.appendChild(t),a=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),s=this.$overlay.style,s.position="absolute",s.display="none",s.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let i=window.getComputedStyle(t);i.display==="none"&&(t.style.setProperty("display","block","important"),a=!0),i.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=ce.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await ce.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,s)=>({id:o.deviceId,label:o.label||(s===0?"Default Camera":`Camera ${s+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),ce._stopVideoStream(r))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),ce._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),ce._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:n}=await this._getCameraStream();!this._active||this._paused?ce._stopVideoStream(t):(this._setVideoMirror(n),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(ce._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,s=!1,a=!1){let i,h=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(i=n.scanRegion,r=n.qrEngine,o=n.canvas,s=n.disallowCanvasResizing||!1,a=n.alsoTryWithoutScanRegion||!1,h=!0):console.warn(n||r||o||s||a?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let f,c;[r,f]=await Promise.all([r||ce.createQrEngine(),ce._loadImage(t)]),[o,c]=ce._drawToCanvas(f,i,o,s);let l;if(r instanceof Worker){let u=r;n||ce._postWorkerMessageSync(u,"inversionMode","both"),l=await new Promise((p,g)=>{let v,w,b,A=-1;w=S=>{S.data.id===A&&(u.removeEventListener("message",w),u.removeEventListener("error",b),clearTimeout(v),S.data.data!==null?p({data:S.data.data,cornerPoints:ce._convertPoints(S.data.cornerPoints,i)}):g(ce.NO_QR_CODE_FOUND))},b=S=>{u.removeEventListener("message",w),u.removeEventListener("error",b),clearTimeout(v),g("Scanner error: "+(S?S.message||S:"Unknown Error"))},u.addEventListener("message",w),u.addEventListener("error",b),v=setTimeout(()=>b("timeout"),1e4);let R=c.getImageData(0,0,o.width,o.height);A=ce._postWorkerMessageSync(u,"decode",R,[R.data.buffer])})}else l=await Promise.race([new Promise((u,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[u]=await r.detect(o);if(!u)throw ce.NO_QR_CODE_FOUND;return{data:u.rawValue,cornerPoints:ce._convertPoints(u.cornerPoints,i)}}catch(p){if(u=p.message||p,/not implemented|service unavailable/.test(u))return ce._disableBarcodeDetector=!0,ce.scanImage(t,{scanRegion:i,canvas:o,disallowCanvasResizing:s,alsoTryWithoutScanRegion:a});throw`Scanner error: ${u}`}})()]);return h?l:l.data}catch(f){if(!i||!a)throw f;let c=await ce.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:s});return h?c:c.data}finally{n||ce._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){ce._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){ce._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>on(()=>import("./qr-scanner-worker.min-D85Z9gVD.js"),[]).then(r=>r.createWorker()),!(!ce._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,s=t.offsetHeight,a=t.offsetLeft,i=t.offsetTop,h=window.getComputedStyle(t),f=h.objectFit,c=n/r,l=o/s;switch(f){case"none":var u=n,p=r;break;case"fill":u=o,p=s;break;default:(f==="cover"?c>l:c<l)?(p=s,u=p*c):(u=o,p=u/c),f==="scale-down"&&(u=Math.min(u,n),p=Math.min(p,r))}var[g,v]=h.objectPosition.split(" ").map((b,A)=>{const R=parseFloat(b);return b.endsWith("%")?(A?s-p:o-u)*R/100:R});h=this._scanRegion.width||n,l=this._scanRegion.height||r,f=this._scanRegion.x||0;var w=this._scanRegion.y||0;c=this.$overlay.style,c.width=`${h/n*u}px`,c.height=`${l/r*p}px`,c.top=`${i+v+w/r*p}px`,r=/scaleX\(-1\)/.test(t.style.transform),c.left=`${a+(r?o-g-u:g)+(r?n-f-h:f)/n*u}px`,c.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,s=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let a of t)a.x=a.x*s+r,a.y=a.y*n+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await ce.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!ce._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=ce.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:s})=>`${o},${s}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==ce.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let s=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),a=this._getFacingMode(s)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:s,facingMode:a}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let n of t.getTracks())n.stop(),t.removeTrack(n)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,n,r,o=!1){r=r||document.createElement("canvas");let s=n&&n.x?n.x:0,a=n&&n.y?n.y:0,i=n&&n.width?n.width:t.videoWidth||t.width,h=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:i,n=n&&n.downScaledHeight?n.downScaledHeight:h,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,s,a,i,h,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await ce._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await ce._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=s=>{t.removeEventListener("load",o),t.removeEventListener("error",o),s instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return ce._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let s=ce._workerMessageId++;return t.postMessage({id:s,type:n,data:r},o),s}};$t.DEFAULT_CANVAS_SIZE=400;$t.NO_QR_CODE_FOUND="No QR code found";$t._disableBarcodeDetector=!1;$t._workerMessageId=0;const ip="";function yo(){let e=localStorage.getItem("rcs_uuid");return e||(e=ed(),localStorage.setItem("rcs_uuid",e)),e}function Or(e){localStorage.setItem("rcs_uuid",e)}let Pn=null;function lp(e){Pn=e}function ny(){return Pn}const Ci="rcs_worker_token_",Si="rcs_worker_tokens";function Qn(){try{const e=localStorage.getItem(Si);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>n&&typeof n=="object"&&typeof n.envId=="string"&&typeof n.token=="string"):[]}catch{return[]}}function ki(e){try{localStorage.setItem(Si,JSON.stringify(e))}catch{}}function Dr(e){var n;return e?((n=Qn().find(r=>r.envId===e))==null?void 0:n.token)??null:null}function cp(e,t,n){const r=Qn(),o=r.findIndex(s=>s.envId===e);o>=0?r[o]={...r[o],token:t,label:n??r[o].label}:r.push({envId:e,token:t,label:n}),ki(r)}function dp(e){const t=Qn().filter(n=>n.envId!==e);ki(t)}function Qt(){return Qn()}const Lr=new Map;function ry(e,t){t?Lr.set(e,t):Lr.delete(e)}function up(e){const t=Lr.get(e);if(t){const n=Dr(t);if(n)return n}try{return localStorage.getItem(Ci+e)}catch{return null}}function oy(e,t){try{localStorage.setItem(Ci+e,t)}catch{}}class fp extends Error{constructor(n,r,o){super(n);le(this,"type");le(this,"status");this.name="ApiError",this.type=r,this.status=o}}async function Ie(e,t,n){const r={"Content-Type":"application/json"};Pn&&(r.Authorization=`Bearer ${Pn}`);const o=t.match(/^\/web\/sessions\/([^/]+)/);if(o){const l=o[1],u=up(l);u&&(r["X-Worker-Token"]=u)}const s=yo(),a=t.includes("?")?"&":"?",i=`${ip}${t}${a}uuid=${encodeURIComponent(s)}`,h={method:e,headers:r};n!==void 0&&(h.body=JSON.stringify(n));const f=await fetch(i,h),c=await f.json();if(!f.ok){const l=c.error||{type:"unknown",message:f.statusText};throw new fp(l.message||l.type,l.type||"unknown",f.status)}return c}function hp(e){return Ie("POST","/web/bind",{sessionId:e})}function sy(){return Ie("GET","/web/sessions/all")}function ay(e){return Ie("GET",`/web/sessions/${e}`)}function iy(e){return Ie("GET",`/web/sessions/${e}/history`)}function mp(){return Ie("GET","/web/environments")}function pp(e,t){return Ie("POST",`/web/environments/${e}/test-worker-token`,{token:t})}function gp(){return Ie("GET","/web/server-info")}function ly(e,t){return Ie("POST",`/web/sessions/${e}/events`,t)}function cy(e,t){return Ie("POST",`/web/sessions/${e}/control`,t)}function dy(e){return Ie("POST",`/web/sessions/${e}/interrupt`)}function uy(e){return Ie("DELETE",`/web/sessions/${e}`)}function fy(e){return Ie("POST","/web/sessions",e)}var Zn="Dialog",[_i]=Qe(Zn),[xp,Le]=_i(Zn),Ei=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,i=m.useRef(null),h=m.useRef(null),[f,c]=at({prop:r,defaultProp:o??!1,onChange:s,caller:Zn});return d.jsx(xp,{scope:t,triggerRef:i,contentRef:h,contentId:Ce(),titleId:Ce(),descriptionId:Ce(),open:f,onOpenChange:c,onOpenToggle:m.useCallback(()=>c(l=>!l),[c]),modal:a,children:n})};Ei.displayName=Zn;var Ni="DialogTrigger",vp=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Le(Ni,n),s=pe(t,o.triggerRef);return d.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Co(o.open),...r,ref:s,onClick:ee(e.onClick,o.onOpenToggle)})});vp.displayName=Ni;var bo="DialogPortal",[yp,ji]=_i(bo,{forceMount:void 0}),Ai=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Le(bo,t);return d.jsx(yp,{scope:t,forceMount:n,children:m.Children.map(r,a=>d.jsx(Ae,{present:n||s.open,children:d.jsx(dn,{asChild:!0,container:o,children:a})}))})};Ai.displayName=bo;var On="DialogOverlay",Ri=m.forwardRef((e,t)=>{const n=ji(On,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Le(On,e.__scopeDialog);return s.modal?d.jsx(Ae,{present:r||s.open,children:d.jsx(wp,{...o,ref:t})}):null});Ri.displayName=On;var bp=Dt("DialogOverlay.RemoveScroll"),wp=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Le(On,n);return d.jsx(Gr,{as:bp,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(ue.div,{"data-state":Co(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),St="DialogContent",Ti=m.forwardRef((e,t)=>{const n=ji(St,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Le(St,e.__scopeDialog);return d.jsx(Ae,{present:r||s.open,children:s.modal?d.jsx(Cp,{...o,ref:t}):d.jsx(Sp,{...o,ref:t})})});Ti.displayName=St;var Cp=m.forwardRef((e,t)=>{const n=Le(St,e.__scopeDialog),r=m.useRef(null),o=pe(t,n.contentRef,r);return m.useEffect(()=>{const s=r.current;if(s)return uo(s)},[]),d.jsx(Ii,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault())})}),Sp=m.forwardRef((e,t)=>{const n=Le(St,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return d.jsx(Ii,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var h,f;(h=e.onInteractOutside)==null||h.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Ii=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,i=Le(St,n),h=m.useRef(null),f=pe(t,h);return Zr(),d.jsxs(d.Fragment,{children:[d.jsx(Bn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:d.jsx(ln,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Co(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(kp,{titleId:i.titleId}),d.jsx(Ep,{contentRef:h,descriptionId:i.descriptionId})]})]})}),wo="DialogTitle",Mi=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Le(wo,n);return d.jsx(ue.h2,{id:o.titleId,...r,ref:t})});Mi.displayName=wo;var Pi="DialogDescription",Oi=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Le(Pi,n);return d.jsx(ue.p,{id:o.descriptionId,...r,ref:t})});Oi.displayName=Pi;var Di="DialogClose",Li=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Le(Di,n);return d.jsx(ue.button,{type:"button",...r,ref:t,onClick:ee(e.onClick,()=>o.onOpenChange(!1))})});Li.displayName=Di;function Co(e){return e?"open":"closed"}var $i="DialogTitleWarning",[hy,Fi]=ju($i,{contentName:St,titleName:wo,docsSlug:"dialog"}),kp=({titleId:e})=>{const t=Fi($i),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
228
-
229
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
230
-
231
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_p="DialogDescriptionWarning",Ep=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Fi(_p).contentName}}.`;return m.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Ui=Ei,zi=Ai,Bi=Ri,Wi=Ti,Np=Mi,jp=Oi,Ap=Li;function Hi({...e}){return d.jsx(Ui,{"data-slot":"dialog",...e})}function Rp({...e}){return d.jsx(zi,{"data-slot":"dialog-portal",...e})}function Tp({className:e,...t}){return d.jsx(Bi,{"data-slot":"dialog-overlay",className:Z("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Vi({className:e,children:t,showCloseButton:n=!0,...r}){return d.jsxs(Rp,{"data-slot":"dialog-portal",children:[d.jsx(Tp,{}),d.jsxs(Wi,{"data-slot":"dialog-content",className:Z("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,n&&d.jsxs(Ap,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[d.jsx(an,{}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Gi({className:e,...t}){return d.jsx("div",{"data-slot":"dialog-header",className:Z("flex flex-col gap-2 text-center sm:text-left",e),...t})}function my({className:e,...t}){return d.jsx("div",{"data-slot":"dialog-footer",className:Z("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Ki({className:e,...t}){return d.jsx(Np,{"data-slot":"dialog-title",className:Z("text-lg leading-none font-semibold",e),...t})}function Ip({className:e,...t}){return d.jsx(jp,{"data-slot":"dialog-description",className:Z("text-muted-foreground text-sm",e),...t})}function Mp(e){if(e<60)return`${e}s`;const t=Math.floor(e/60);if(t<60)return`${t}m ${e%60}s`;const n=Math.floor(t/60);return n<24?`${n}h ${t%60}m`:`${Math.floor(n/24)}d ${n%24}h`}function Pp({open:e,onClose:t}){const[n,r]=m.useState(!1),[o,s]=m.useState(!1),[a,i]=m.useState(!1),[h,f]=m.useState(null),[c,l]=m.useState(""),u=m.useRef(null),p=m.useRef(null),g=m.useRef(null),v=yo(),{resolvedTheme:w}=ia(),b=w==="dark"?{dark:"#ECE9E0",light:"#1C1B18"}:{dark:"#141413",light:"#FDFCF8"};if(m.useEffect(()=>{e&&(l(""),gp().then(N=>f(N)).catch(N=>l(N instanceof Error?N.message:"Failed to load server info")))},[e]),m.useEffect(()=>{if(!e||!a)return;const N=requestAnimationFrame(()=>{if(!u.current)return;const x=`${window.location.origin}/code?uuid=${encodeURIComponent(v)}`;sc.toCanvas(u.current,x,{width:200,margin:1,color:b}).catch(y=>{console.error("QR generation failed:",y)})});return()=>cancelAnimationFrame(N)},[e,a,v,w,b]),m.useEffect(()=>{!e&&g.current&&(g.current.stop(),g.current.destroy(),g.current=null,s(!1))},[e]),!e)return null;const A=async()=>{await navigator.clipboard.writeText(v),r(!0),setTimeout(()=>r(!1),2e3)},R=async()=>{if(p.current){s(!0);try{const N=new $t(p.current,x=>{L(x.data)},{returnDetailedScanResult:!0});g.current=N,await N.start()}catch(N){console.error("Camera error:",N),s(!1)}}},S=()=>{g.current&&(g.current.stop(),g.current.destroy(),g.current=null),s(!1)},L=N=>{try{const x=JSON.parse(N);if(x.url&&x.token){S(),t(),sessionStorage.setItem("acp_connection",JSON.stringify({url:x.url,token:x.token})),window.location.href="/code/?acp=1";return}}catch{}try{const y=new URL(N).searchParams.get("uuid");if(y){Or(y),S(),t();return}}catch{}if(N.length>=32){Or(N),S(),t();return}},k=()=>{const N=document.createElement("input");N.type="file",N.accept="image/*",N.onchange=async x=>{var j;const y=(j=x.target.files)==null?void 0:j[0];if(y)try{const P=await $t.scanImage(y,{returnDetailedScanResult:!0});L(P.data)}catch{alert("No QR code found in image")}},N.click()};return d.jsx(Hi,{open:e,onOpenChange:N=>{N||t()},children:d.jsxs(Vi,{className:"max-w-sm rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[d.jsx(Gi,{children:d.jsx(Ki,{className:"font-display text-lg font-semibold text-text-primary",children:"Identity & Server"})}),d.jsxs("div",{className:"space-y-5",children:[d.jsxs("section",{className:"rounded-lg border border-border bg-surface-2 p-3",children:[d.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-text-secondary",children:[d.jsx(Jd,{className:"h-4 w-4"}),"Server"]}),c?d.jsx("p",{className:"text-xs text-status-error",children:c}):h?d.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsx("dt",{children:"Version"}),d.jsx("dd",{className:"font-mono text-text-primary",children:h.version})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("dt",{children:"Uptime"}),d.jsx("dd",{className:"font-mono text-text-primary",children:Mp(h.uptime_seconds)})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("dt",{children:"Workers"}),d.jsxs("dd",{className:"font-mono text-text-primary",children:[h.workers_active," active / ",h.workers_total]})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("dt",{children:"Your sessions"}),d.jsxs("dd",{className:"font-mono text-text-primary",children:[h.sessions_active," active / ",h.sessions_owned," owned"]})]})]}):d.jsx("p",{className:"text-xs text-text-muted",children:"Loading…"})]}),d.jsxs("section",{children:[d.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-text-secondary",children:[d.jsx(oa,{className:"h-4 w-4"}),"Your Identity"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("code",{className:"flex-1 truncate rounded-lg bg-surface-2 px-3 py-2 font-mono text-xs text-text-primary",children:v}),d.jsx("button",{onClick:A,className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:n?"Copied!":"Copy"})]}),d.jsx("p",{className:"mt-2 text-xs text-text-muted",children:"此 UUID 标识你创建的会话归属。分享它可授予他人访问你创建的会话。"})]}),d.jsxs("section",{className:"border-t border-border pt-4",children:[d.jsxs("button",{onClick:()=>i(!a),className:"flex w-full items-center justify-between text-sm font-medium text-text-secondary hover:text-text-primary transition-colors",children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx(iu,{className:"h-4 w-4"}),"Device Sync"]}),d.jsx("span",{className:"text-xs text-text-muted",children:a?"▾":"▸"})]}),a&&d.jsxs("div",{className:"mt-4 space-y-4",children:[!o&&d.jsxs("div",{children:[d.jsx("label",{className:"mb-2 block text-xs text-text-secondary",children:"Scan on another device"}),d.jsx("div",{className:"flex justify-center",children:d.jsx("canvas",{ref:u})})]}),o&&d.jsxs("div",{children:[d.jsx("label",{className:"mb-2 block text-xs text-text-secondary",children:"Camera scanner"}),d.jsx("div",{className:"relative overflow-hidden rounded-lg",children:d.jsx("video",{ref:p,className:"w-full"})}),d.jsx("button",{onClick:S,className:"mt-2 w-full rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Stop scanning"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("button",{onClick:o?S:R,className:Z("flex flex-1 items-center justify-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",o?"border-status-error/30 text-status-error hover:bg-status-error/10":"border-border text-text-secondary hover:bg-surface-2"),children:[d.jsx(Kd,{className:"h-4 w-4"}),o?"Stop":"Scan"]}),d.jsx("button",{onClick:k,className:"flex flex-1 items-center justify-center gap-2 rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Upload"})]})]})]})]})]})})}const So="rcs_worker_tokens",gs="rcs_worker_token_",xs="rcs_worker_tokens_migrated";function Op(){let e=Qt();if(typeof window>"u")return e;try{if(localStorage.getItem(xs))return e}catch{return e}try{for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(!n||!n.startsWith(gs))continue;const r=n.slice(gs.length);if(!r)continue;const o=localStorage.getItem(n);if(!o)continue;const s=`__legacy_${r}`;e.some(a=>a.envId===s)||(e=[...e,{envId:s,token:o,label:`Migrated (session ${r.slice(0,8)})`}])}localStorage.setItem(So,JSON.stringify(e)),localStorage.setItem(xs,"1")}catch{}return e}function py(e){const t=Qt();let n=!1;const r=t.map(o=>{if(!o.envId.startsWith("__legacy_"))return o;const s=o.envId.slice(9),a=e.find(h=>h.id===s),i=a==null?void 0:a.environment_id;return i?t.some(h=>h!==o&&h.envId===i)?(n=!0,null):(n=!0,{...o,envId:i}):o}).filter(o=>o!==null);if(n){try{localStorage.setItem(So,JSON.stringify(r))}catch{}window.dispatchEvent(new Event("rcs_worker_tokens_changed"))}}function Dp(){const[e,t]=m.useState(()=>Op()),n=m.useCallback(()=>{t(Qt())},[]);m.useEffect(()=>{const i=()=>t(Qt());return window.addEventListener("rcs_worker_tokens_changed",i),window.addEventListener("storage",i),()=>{window.removeEventListener("rcs_worker_tokens_changed",i),window.removeEventListener("storage",i)}},[]);const r=m.useCallback(i=>Dr(i),[]),o=m.useCallback((i,h,f)=>{cp(i,h,f),n()},[n]),s=m.useCallback(i=>{dp(i),n()},[n]),a=m.useCallback(async i=>{const h=Dr(i);if(!h)return"unknown";try{const f=await pp(i,h),c=Qt().map(l=>l.envId===i?{...l,verifiedAt:f.valid?Date.now():l.verifiedAt}:l);try{localStorage.setItem(So,JSON.stringify(c))}catch{}return n(),f.valid?"valid":"invalid"}catch{return"unknown"}},[n]);return{entries:e,getForEnv:r,add:o,remove:s,verify:a,refresh:n}}function Lp({open:e,onClose:t,tokens:n,activeTokenId:r,onSetActive:o,onAdd:s,onRemove:a,onUpdate:i}){const[h,f]=m.useState("api_keys");return d.jsx(Hi,{open:e,onOpenChange:c=>{c||t()},children:d.jsxs(Vi,{className:"max-w-md rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[d.jsxs(Gi,{children:[d.jsx(Ki,{className:"font-display text-lg font-semibold text-text-primary",children:"Token Manager"}),d.jsx(Ip,{className:"text-sm text-text-muted",children:"Manage API tokens and per-environment worker tokens for RCS authentication."})]}),d.jsxs("div",{className:"flex border-b border-border",children:[d.jsx("button",{onClick:()=>f("api_keys"),className:`flex-1 px-3 py-2 text-sm font-medium transition-colors ${h==="api_keys"?"border-b-2 border-brand text-text-primary":"text-text-muted hover:text-text-secondary"}`,children:"API Keys"}),d.jsx("button",{onClick:()=>f("worker_tokens"),className:`flex-1 px-3 py-2 text-sm font-medium transition-colors ${h==="worker_tokens"?"border-b-2 border-brand text-text-primary":"text-text-muted hover:text-text-secondary"}`,children:"Worker Tokens"})]}),h==="api_keys"?d.jsx($p,{tokens:n,activeTokenId:r,onSetActive:o,onAdd:s,onRemove:a,onUpdate:i,onClose:t}):d.jsx(Fp,{})]})})}function $p({tokens:e,activeTokenId:t,onSetActive:n,onAdd:r,onRemove:o,onUpdate:s,onClose:a}){const[i,h]=m.useState(""),[f,c]=m.useState(""),[l,u]=m.useState(""),[p,g]=m.useState(null),[v,w]=m.useState(""),[b,A]=m.useState(null),[R,S]=m.useState(null),L=(j,P)=>{navigator.clipboard.writeText(P).then(()=>{S(j),setTimeout(()=>S(null),1500)})},k=()=>{const j=r(i,f);if(j){u(j);return}h(""),c(""),u("")},N=j=>{g(j.id),w(j.label)},x=j=>{s(j,v.trim()||"Unnamed"),g(null)},y=j=>{n(j),a()};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[e.map(j=>d.jsx("div",{className:"group flex items-center gap-1",children:p===j.id?d.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-lg bg-surface-2 px-3 py-1.5",children:[d.jsx("input",{value:v,onChange:P=>w(P.target.value),onKeyDown:P=>{P.key==="Enter"&&x(j.id),P.key==="Escape"&&g(null)},className:"flex-1 rounded border border-border bg-surface-1 px-2 py-1 text-sm text-text-primary focus:border-brand focus:outline-none",autoFocus:!0}),d.jsx("button",{onClick:()=>x(j.id),className:"text-brand hover:opacity-70 transition-opacity",children:d.jsx(wt,{className:"h-4 w-4"})}),d.jsx("button",{onClick:()=>g(null),className:"text-text-muted hover:text-text-primary transition-colors",children:d.jsx(an,{className:"h-4 w-4"})})]}):d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:()=>y(j.id),className:`flex flex-1 items-center justify-between rounded-lg px-3 py-2 text-sm transition-colors ${t===j.id?"bg-brand/10 text-brand":"text-text-secondary hover:bg-surface-2"}`,children:[d.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[d.jsx("span",{className:"font-medium truncate w-full",children:j.label}),d.jsx("span",{className:"text-xs text-text-muted font-mono",children:b===j.id?j.token:`${j.token.slice(0,6)}${"•".repeat(6)}`})]}),t===j.id&&d.jsx(wt,{className:"h-4 w-4 flex-shrink-0"})]}),d.jsx("button",{onClick:()=>A(b===j.id?null:j.id),className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-text-primary transition-all",title:"Toggle token visibility",children:b===j.id?d.jsx(Zs,{className:"h-3.5 w-3.5"}):d.jsx(Js,{className:"h-3.5 w-3.5"})}),d.jsx("button",{onClick:()=>L(j.id,j.token),className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-text-primary transition-all",title:"Copy token",children:R===j.id?d.jsx(wt,{className:"h-3.5 w-3.5 text-status-active"}):d.jsx(bd,{className:"h-3.5 w-3.5"})}),d.jsx("button",{onClick:()=>N(j),className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-text-primary transition-all",title:"Edit label",children:d.jsx(Hd,{className:"h-3.5 w-3.5"})}),d.jsx("button",{onClick:()=>o(j.id),className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-status-error transition-all",title:"Delete token",children:d.jsx(ra,{className:"h-3.5 w-3.5"})})]})},j.id)),e.length===0&&d.jsx("div",{className:"py-4 text-center text-sm text-text-muted",children:"No tokens saved yet. Add one below."})]}),d.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[d.jsx("div",{className:"text-sm font-medium text-text-secondary",children:"Add Token"}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("input",{type:"text",value:i,onChange:j=>{h(j.target.value),u("")},placeholder:"API Token",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none font-mono",onKeyDown:j=>{j.key==="Enter"&&k()}}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:f,onChange:j=>c(j.target.value),placeholder:"Label (optional)",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:j=>{j.key==="Enter"&&k()}}),d.jsx("button",{onClick:k,disabled:!i.trim(),className:"rounded-lg bg-brand px-3 py-2 text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:d.jsx(zn,{className:"h-4 w-4"})})]})]}),l&&d.jsx("div",{className:"text-xs text-status-error",children:l})]})]})}function Fp(){const{entries:e,add:t,remove:n,verify:r,refresh:o}=Dp(),[s,a]=m.useState([]),[i,h]=m.useState(""),[f,c]=m.useState(""),[l,u]=m.useState(""),[p,g]=m.useState(""),[v,w]=m.useState(new Set),[b,A]=m.useState({});m.useEffect(()=>{mp().then(N=>a(N||[])).catch(N=>console.error("Failed to load environments:",N))},[]);const R=N=>{if(N.startsWith("__legacy_"))return`Legacy session ${N.slice(9).slice(0,8)}`;const x=s.find(y=>y.id===N);return(x==null?void 0:x.machine_name)||N},S=()=>{const N=f.trim();if(!N){g("Token is required");return}if(!i){g("Select an environment");return}t(i,N,l.trim()||void 0),c(""),u(""),g("")},L=async N=>{A(y=>({...y,[N]:"pending"}));const x=await r(N);A(y=>({...y,[N]:x})),o()},k=N=>{w(x=>{const y=new Set(x);return y.has(N)?y.delete(N):y.add(N),y})};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[e.map(N=>{const x=b[N.envId];return d.jsxs("div",{className:"group flex items-center gap-1 rounded-lg px-2 py-2 text-sm text-text-secondary hover:bg-surface-2",children:[d.jsxs("div",{className:"flex flex-1 flex-col items-start min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 w-full",children:[d.jsx("span",{className:"font-medium truncate",children:R(N.envId)}),N.label&&d.jsxs("span",{className:"text-xs text-text-muted truncate",children:["· ",N.label]}),x==="valid"&&d.jsx(Ho,{className:"h-3.5 w-3.5 text-status-active flex-shrink-0"}),x==="invalid"&&d.jsx(Xr,{className:"h-3.5 w-3.5 text-status-error flex-shrink-0"})]}),d.jsx("span",{className:"text-xs text-text-muted font-mono",children:v.has(N.envId)?N.token:`${N.token.slice(0,6)}${"•".repeat(6)}`})]}),d.jsx("button",{onClick:()=>k(N.envId),className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-text-primary transition-all",title:"Toggle token visibility",children:v.has(N.envId)?d.jsx(Zs,{className:"h-3.5 w-3.5"}):d.jsx(Js,{className:"h-3.5 w-3.5"})}),d.jsx("button",{onClick:()=>L(N.envId),disabled:x==="pending",className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-brand transition-all disabled:opacity-50",title:"Test token",children:d.jsx(Ho,{className:"h-3.5 w-3.5"})}),d.jsx("button",{onClick:()=>n(N.envId),className:"rounded p-1 text-text-muted opacity-0 group-hover:opacity-100 hover:text-status-error transition-all",title:"Delete worker token",children:d.jsx(ra,{className:"h-3.5 w-3.5"})})]},N.envId)}),e.length===0&&d.jsx("div",{className:"py-4 text-center text-sm text-text-muted",children:"No worker tokens saved. Add one for an environment below."})]}),d.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[d.jsx("div",{className:"text-sm font-medium text-text-secondary",children:"Add Worker Token"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("select",{value:i,onChange:N=>h(N.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[d.jsx("option",{value:"",children:"-- Select environment --"}),s.map(N=>d.jsxs("option",{value:N.id,children:[N.machine_name||N.id,N.has_worker_token?" (protected)":" (open)"]},N.id))]}),d.jsx("input",{type:"password",value:f,onChange:N=>{c(N.target.value),g("")},placeholder:"RCS_WORKER_TOKENS value",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none font-mono",onKeyDown:N=>{N.key==="Enter"&&S()}}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:l,onChange:N=>u(N.target.value),placeholder:"Label (optional)",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:N=>{N.key==="Enter"&&S()}}),d.jsx("button",{onClick:S,disabled:!f.trim()||!i,className:"rounded-lg bg-brand px-3 py-2 text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:d.jsx(zn,{className:"h-4 w-4"})})]})]}),p&&d.jsx("div",{className:"text-xs text-status-error",children:p}),d.jsx("p",{className:"text-xs text-text-muted",children:"Worker tokens are stored per-environment and applied automatically to all sessions in that environment."})]})]})}function Up(e){const t=new TextEncoder().encode(e);let n="";for(const o of t)n+=String.fromCharCode(o);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class qi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const st=class st{constructor(t){le(this,"ws",null);le(this,"settings");le(this,"connectionState","disconnected");le(this,"sessionId",null);le(this,"_agentCapabilities",null);le(this,"_promptCapabilities",null);le(this,"_modelState",null);le(this,"_availableCommands",[]);le(this,"onModelChanged",new Set);le(this,"onModelStateChanged",new Set);le(this,"onAvailableCommandsChanged",null);le(this,"onSessionLoaded",null);le(this,"onSessionSwitching",null);le(this,"onConnectionStateChange",new Set);le(this,"onSessionUpdate",null);le(this,"onSessionCreated",null);le(this,"onPromptComplete",null);le(this,"onPermissionRequest",null);le(this,"onBrowserToolCall",null);le(this,"onErrorMessage",null);le(this,"pendingSessionList",null);le(this,"pendingSessionLoad",null);le(this,"pendingSessionResume",null);le(this,"pendingSessionTarget",null);le(this,"connectResolve",null);le(this,"connectReject",null);le(this,"heartbeatInterval",null);le(this,"heartbeatTimeout",null);le(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.resume)!==null}get supportsSessionList(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[Up(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=o=>{if(this.ws===r)try{const s=JSON.parse(o.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},r.onerror=()=>{var o;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(o=this.connectReject)==null||o.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=o=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",o.code,o.reason),this.connectReject){const s=o.reason||`Connection closed (code: ${o.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,o,s,a,i,h,f,c,l,u;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const p=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(p)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(p)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(p)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(p)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",p),(o=this.onErrorMessage)==null||o.call(this,p));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);break;case"session_update":const g=(h=t.payload.update)==null?void 0:h.sessionUpdate;console.log("[ACPClient] session_update type:",g,"payload:",t.payload),g==="available_commands_update"&&(this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(f=this.onAvailableCommandsChanged)==null||f.call(this,this._availableCommands)),(c=this.onSessionUpdate)==null||c.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(l=this.onPromptComplete)==null||l.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(u=this.onPermissionRequest)==null||u.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const v of this.onModelChanged)v(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=st.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},st.PONG_TIMEOUT_MS)},st.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const o=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:o};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(o),this.pendingSessionList=null,r(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:o};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:o};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new qi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]);const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};le(st,"HEARTBEAT_INTERVAL_MS",3e4),le(st,"PONG_TIMEOUT_MS",1e4),le(st,"MAX_MISSED_PONGS",2);let $r=st;function zp(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Yi(e,t){return new Promise((function(n,r){let o;return Bp(e).then((function(s){try{return o=s,n(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const Bp=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:o}})=>{const s=new DataView(o);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const h=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let c;switch(s.getUint16(f)){case 18761:c=!0;break;case 19789:c=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,c)!==42)return n("TIFF header contains invalid version");const l=s.getUint32(f+4,c),u=f+l+2+12*s.getUint16(f+l,c);for(let p=f+l+2;p<u;p+=12)if(s.getUint16(p,c)==274){if(s.getUint16(p+2,c)!==3)return n("Orientation data type is invalid");if(s.getUint32(p+4,c)!==1)return n("Orientation data count is invalid");s.setUint16(p+8,1,c);break}return t(o.slice(a,a+2+h))}a+=2+h}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Dn={},Wp={get exports(){return Dn},set exports(e){Dn=e}};(function(e){var t,n,r={};Wp.exports=r,r.parse=function(o,s){for(var a=r.bin.readUshort,i=r.bin.readUint,h=0,f={},c=new Uint8Array(o),l=c.length-4;i(c,l)!=101010256;)l--;h=l,h+=4;var u=a(c,h+=4);a(c,h+=2);var p=i(c,h+=2),g=i(c,h+=4);h+=4,h=g;for(var v=0;v<u;v++){i(c,h),h+=4,h+=4,h+=4,i(c,h+=4),p=i(c,h+=4);var w=i(c,h+=4),b=a(c,h+=4),A=a(c,h+2),R=a(c,h+4);h+=6;var S=i(c,h+=8);h+=4,h+=b+A+R,r._readLocal(c,S,f,p,w,s)}return f},r._readLocal=function(o,s,a,i,h,f){var c=r.bin.readUshort,l=r.bin.readUint;l(o,s),c(o,s+=4),c(o,s+=2);var u=c(o,s+=2);l(o,s+=2),l(o,s+=4),s+=4;var p=c(o,s+=8),g=c(o,s+=2);s+=2;var v=r.bin.readUTF8(o,s,p);if(s+=p,s+=g,f)a[v]={size:h,csize:i};else{var w=new Uint8Array(o.buffer,s);if(u==0)a[v]=new Uint8Array(w.buffer.slice(s,s+i));else{if(u!=8)throw"unknown compression method: "+u;var b=new Uint8Array(h);r.inflateRaw(w,b),a[v]=b}}},r.inflateRaw=function(o,s){return r.F.inflate(o,s)},r.inflate=function(o,s){return o[0],o[1],r.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),s)},r.deflate=function(o,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*o.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(o,i,a,s.level);var h=r.adler(o,0,o.length);return i[a+0]=h>>>24&255,i[a+1]=h>>>16&255,i[a+2]=h>>>8&255,i[a+3]=h>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(o,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*o.length)),i=r.F.deflateRaw(o,a,i,s.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(o,s){s==null&&(s=!1);var a=0,i=r.bin.writeUint,h=r.bin.writeUshort,f={};for(var c in o){var l=!r._noNeed(c)&&!s,u=o[c],p=r.crc.crc(u,0,u.length);f[c]={cpr:l,usize:u.length,crc:p,file:l?r.deflateRaw(u):u}}for(var c in f)a+=f[c].file.length+30+46+2*r.bin.sizeUTF8(c);a+=22;var g=new Uint8Array(a),v=0,w=[];for(var c in f){var b=f[c];w.push(v),v=r._writeHeader(g,v,c,b,0)}var A=0,R=v;for(var c in f)b=f[c],w.push(v),v=r._writeHeader(g,v,c,b,1,w[A++]);var S=v-R;return i(g,v,101010256),v+=4,h(g,v+=4,A),h(g,v+=2,A),i(g,v+=2,S),i(g,v+=4,R),v+=4,v+=2,g.buffer},r._noNeed=function(o){var s=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},r._writeHeader=function(o,s,a,i,h,f){var c=r.bin.writeUint,l=r.bin.writeUshort,u=i.file;return c(o,s,h==0?67324752:33639248),s+=4,h==1&&(s+=2),l(o,s,20),l(o,s+=2,0),l(o,s+=2,i.cpr?8:0),c(o,s+=2,0),c(o,s+=4,i.crc),c(o,s+=4,u.length),c(o,s+=4,i.usize),l(o,s+=4,r.bin.sizeUTF8(a)),l(o,s+=2,0),s+=2,h==1&&(s+=2,s+=2,c(o,s+=6,f),s+=4),s+=r.bin.writeUTF8(o,s,a),h==0&&(o.set(u,s),s+=u.length),s},r.crc={table:(function(){for(var o=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;o[s]=a}return o})(),update:function(o,s,a,i){for(var h=0;h<i;h++)o=r.crc.table[255&(o^s[a+h])]^o>>>8;return o},crc:function(o,s,a){return 4294967295^r.crc.update(4294967295,o,s,a)}},r.adler=function(o,s,a){for(var i=1,h=0,f=s,c=s+a;f<c;){for(var l=Math.min(f+5552,c);f<l;)h+=i+=o[f++];i%=65521,h%=65521}return h<<16|i},r.bin={readUshort:function(o,s){return o[s]|o[s+1]<<8},writeUshort:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255},readUint:function(o,s){return 16777216*o[s+3]+(o[s+2]<<16|o[s+1]<<8|o[s])},writeUint:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255,o[s+2]=a>>16&255,o[s+3]=a>>24&255},readASCII:function(o,s,a){for(var i="",h=0;h<a;h++)i+=String.fromCharCode(o[s+h]);return i},writeASCII:function(o,s,a){for(var i=0;i<a.length;i++)o[s+i]=a.charCodeAt(i)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,s,a){for(var i,h="",f=0;f<a;f++)h+="%"+r.bin.pad(o[s+f].toString(16));try{i=decodeURIComponent(h)}catch{return r.bin.readASCII(o,s,a)}return i},writeUTF8:function(o,s,a){for(var i=a.length,h=0,f=0;f<i;f++){var c=a.charCodeAt(f);if((4294967168&c)==0)o[s+h]=c,h++;else if((4294965248&c)==0)o[s+h]=192|c>>6,o[s+h+1]=128|c>>0&63,h+=2;else if((4294901760&c)==0)o[s+h]=224|c>>12,o[s+h+1]=128|c>>6&63,o[s+h+2]=128|c>>0&63,h+=3;else{if((4292870144&c)!=0)throw"e";o[s+h]=240|c>>18,o[s+h+1]=128|c>>12&63,o[s+h+2]=128|c>>6&63,o[s+h+3]=128|c>>0&63,h+=4}}return h},sizeUTF8:function(o){for(var s=o.length,a=0,i=0;i<s;i++){var h=o.charCodeAt(i);if((4294967168&h)==0)a++;else if((4294965248&h)==0)a+=2;else if((4294901760&h)==0)a+=3;else{if((4292870144&h)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(o,s,a,i){var h=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=r.F.U,c=r.F._goodIndex;r.F._hash;var l=r.F._putsE,u=0,p=a<<3,g=0,v=o.length;if(i==0){for(;u<v;)l(s,p,u+(P=Math.min(65535,v-u))==v?1:0),p=r.F._copyExact(o,u,P,s,p+8),u+=P;return p>>>3}var w=f.lits,b=f.strt,A=f.prev,R=0,S=0,L=0,k=0,N=0,x=0;for(v>2&&(b[x=r.F._hash(o,0)]=0),u=0;u<v;u++){if(N=x,u+1<v-2){x=r.F._hash(o,u+1);var y=u+1&32767;A[y]=b[x],b[x]=y}if(g<=u){(R>14e3||S>26697)&&v-u>100&&(g<u&&(w[R]=u-g,R+=2,g=u),p=r.F._writeBlock(u==v-1||g==v?1:0,w,R,k,o,L,u-L,s,p),R=S=k=0,L=u);var j=0;u<v-2&&(j=r.F._bestMatch(o,u,A,N,Math.min(h[2],v-u),h[3]));var P=j>>>16,O=65535&j;if(j!=0){O=65535&j;var F=c(P=j>>>16,f.of0);f.lhst[257+F]++;var M=c(O,f.df0);f.dhst[M]++,k+=f.exb[F]+f.dxb[M],w[R]=P<<23|u-g,w[R+1]=O<<16|F<<8|M,R+=2,g=u+P}else f.lhst[o[u]]++;S++}}for(L==u&&o.length!=0||(g<u&&(w[R]=u-g,R+=2,g=u),p=r.F._writeBlock(1,w,R,k,o,L,u-L,s,p),R=0,S=0,R=S=k=0,L=u);(7&p)!=0;)p++;return p>>>3},r.F._bestMatch=function(o,s,a,i,h,f){var c=32767&s,l=a[c],u=c-l+32768&32767;if(l==c||i!=r.F._hash(o,s-u))return 0;for(var p=0,g=0,v=Math.min(32767,s);u<=v&&--f!=0&&l!=c;){if(p==0||o[s+p]==o[s+p-u]){var w=r.F._howLong(o,s,u);if(w>p){if(g=u,(p=w)>=h)break;u+2<w&&(w=u+2);for(var b=0,A=0;A<w-2;A++){var R=s-u+A+32768&32767,S=R-a[R]+32768&32767;S>b&&(b=S,l=R)}}}u+=(c=l)-(l=a[c])+32768&32767}return p<<16|g},r.F._howLong=function(o,s,a){if(o[s]!=o[s-a]||o[s+1]!=o[s+1-a]||o[s+2]!=o[s+2-a])return 0;var i=s,h=Math.min(o.length,s+258);for(s+=3;s<h&&o[s]==o[s-a];)s++;return s-i},r.F._hash=function(o,s){return(o[s]<<8|o[s+1])+(o[s+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(o,s,a,i,h,f,c,l,u){var p,g,v,w,b,A,R,S,L,k=r.F.U,N=r.F._putsF,x=r.F._putsE;k.lhst[256]++,g=(p=r.F.getTrees())[0],v=p[1],w=p[2],b=p[3],A=p[4],R=p[5],S=p[6],L=p[7];var y=32+((u+3&7)==0?0:8-(u+3&7))+(c<<3),j=i+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),P=i+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);P+=14+3*R+r.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=y<j&&y<P?0:j<P?1:2;if(N(l,u,o),N(l,u+1,F),u+=3,F==0){for(;(7&u)!=0;)u++;u=r.F._copyExact(h,f,c,l,u)}else{var M,U;if(F==1&&(M=k.fltree,U=k.fdtree),F==2){r.F.makeCodes(k.ltree,g),r.F.revCodes(k.ltree,g),r.F.makeCodes(k.dtree,v),r.F.revCodes(k.dtree,v),r.F.makeCodes(k.itree,w),r.F.revCodes(k.itree,w),M=k.ltree,U=k.dtree,x(l,u,b-257),x(l,u+=5,A-1),x(l,u+=5,R-4),u+=4;for(var E=0;E<R;E++)x(l,u+3*E,k.itree[1+(k.ordr[E]<<1)]);u+=3*R,u=r.F._codeTiny(S,k.itree,l,u),u=r.F._codeTiny(L,k.itree,l,u)}for(var C=f,D=0;D<a;D+=2){for(var _=s[D],I=_>>>23,W=C+(8388607&_);C<W;)u=r.F._writeLit(h[C++],M,l,u);if(I!=0){var T=s[D+1],B=T>>16,z=T>>8&255,$=255&T;x(l,u=r.F._writeLit(257+z,M,l,u),I-k.of0[z]),u+=k.exb[z],N(l,u=r.F._writeLit($,U,l,u),B-k.df0[$]),u+=k.dxb[$],C+=I}}u=r.F._writeLit(256,M,l,u)}return u},r.F._copyExact=function(o,s,a,i,h){var f=h>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(o.buffer,s,a),f),h+(a+4<<3)},r.F.getTrees=function(){for(var o=r.F.U,s=r.F._hufTree(o.lhst,o.ltree,15),a=r.F._hufTree(o.dhst,o.dtree,15),i=[],h=r.F._lenCodes(o.ltree,i),f=[],c=r.F._lenCodes(o.dtree,f),l=0;l<i.length;l+=2)o.ihst[i[l]]++;for(l=0;l<f.length;l+=2)o.ihst[f[l]]++;for(var u=r.F._hufTree(o.ihst,o.itree,7),p=19;p>4&&o.itree[1+(o.ordr[p-1]<<1)]==0;)p--;return[s,a,u,h,c,p,i,f]},r.F.getSecond=function(o){for(var s=[],a=0;a<o.length;a+=2)s.push(o[a+1]);return s},r.F.nonZero=function(o){for(var s="",a=0;a<o.length;a+=2)o[a+1]!=0&&(s+=(a>>1)+",");return s},r.F.contSize=function(o,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*o[1+(i<<1)];return a},r.F._codeTiny=function(o,s,a,i){for(var h=0;h<o.length;h+=2){var f=o[h],c=o[h+1];i=r.F._writeLit(f,s,a,i);var l=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,c,l),i+=l)}return i},r.F._lenCodes=function(o,s){for(var a=o.length;a!=2&&o[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var h=o[i+1],f=i+3<a?o[i+3]:-1,c=i+5<a?o[i+5]:-1,l=i==0?-1:o[i-1];if(h==0&&f==h&&c==h){for(var u=i+5;u+2<a&&o[u+2]==h;)u+=2;(p=Math.min(u+1-i>>>1,138))<11?s.push(17,p-3):s.push(18,p-11),i+=2*p-2}else if(h==l&&f==h&&c==h){for(u=i+5;u+2<a&&o[u+2]==h;)u+=2;var p=Math.min(u+1-i>>>1,6);s.push(16,p-3),i+=2*p-2}else s.push(h,0)}return a>>>1},r.F._hufTree=function(o,s,a){var i=[],h=o.length,f=s.length,c=0;for(c=0;c<f;c+=2)s[c]=0,s[c+1]=0;for(c=0;c<h;c++)o[c]!=0&&i.push({lit:c,f:o[c]});var l=i.length,u=i.slice(0);if(l==0)return 0;if(l==1){var p=i[0].lit;return u=p==0?1:0,s[1+(p<<1)]=1,s[1+(u<<1)]=1,1}i.sort((function(S,L){return S.f-L.f}));var g=i[0],v=i[1],w=0,b=1,A=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=l-1;)g=w!=b&&(A==l||i[w].f<i[A].f)?i[w++]:i[A++],v=w!=b&&(A==l||i[w].f<i[A].f)?i[w++]:i[A++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var R=r.F.setDepth(i[b-1],0);for(R>a&&(r.F.restrictDepth(u,a,R),R=a),c=0;c<l;c++)s[1+(u[c].lit<<1)]=u[c].d;return R},r.F.setDepth=function(o,s){return o.lit!=-1?(o.d=s,s):Math.max(r.F.setDepth(o.l,s+1),r.F.setDepth(o.r,s+1))},r.F.restrictDepth=function(o,s,a){var i=0,h=1<<a-s,f=0;for(o.sort((function(l,u){return u.d==l.d?l.f-u.f:u.d-l.d})),i=0;i<o.length&&o[i].d>s;i++){var c=o[i].d;o[i].d=s,f+=h-(1<<a-c)}for(f>>>=a-s;f>0;)(c=o[i].d)<s?(o[i].d++,f-=1<<s-c-1):i++;for(;i>=0;i--)o[i].d==s&&f<0&&(o[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(o,s){var a=0;return s[16|a]<=o&&(a|=16),s[8|a]<=o&&(a|=8),s[4|a]<=o&&(a|=4),s[2|a]<=o&&(a|=2),s[1|a]<=o&&(a|=1),a},r.F._writeLit=function(o,s,a,i){return r.F._putsF(a,i,s[o<<1]),i+s[1+(o<<1)]},r.F.inflate=function(o,s){var a=Uint8Array;if(o[0]==3&&o[1]==0)return s||new a(0);var i=r.F,h=i._bitsF,f=i._bitsE,c=i._decodeTiny,l=i.makeCodes,u=i.codes2map,p=i._get17,g=i.U,v=s==null;v&&(s=new a(o.length>>>2<<3));for(var w,b,A=0,R=0,S=0,L=0,k=0,N=0,x=0,y=0,j=0;A==0;)if(A=h(o,j,1),R=h(o,j+1,2),j+=3,R!=0){if(v&&(s=r.F._check(s,y+(1<<17))),R==1&&(w=g.flmap,b=g.fdmap,N=511,x=31),R==2){S=f(o,j,5)+257,L=f(o,j+5,5)+1,k=f(o,j+10,4)+4,j+=14;for(var P=0;P<38;P+=2)g.itree[P]=0,g.itree[P+1]=0;var O=1;for(P=0;P<k;P++){var F=f(o,j+3*P,3);g.itree[1+(g.ordr[P]<<1)]=F,F>O&&(O=F)}j+=3*k,l(g.itree,O),u(g.itree,O,g.imap),w=g.lmap,b=g.dmap,j=c(g.imap,(1<<O)-1,S+L,o,j,g.ttree);var M=i._copyOut(g.ttree,0,S,g.ltree);N=(1<<M)-1;var U=i._copyOut(g.ttree,S,L,g.dtree);x=(1<<U)-1,l(g.ltree,M),u(g.ltree,M,w),l(g.dtree,U),u(g.dtree,U,b)}for(;;){var E=w[p(o,j)&N];j+=15&E;var C=E>>>4;if(!(C>>>8))s[y++]=C;else{if(C==256)break;var D=y+C-254;if(C>264){var _=g.ldef[C-257];D=y+(_>>>3)+f(o,j,7&_),j+=7&_}var I=b[p(o,j)&x];j+=15&I;var W=I>>>4,T=g.ddef[W],B=(T>>>4)+h(o,j,15&T);for(j+=15&T,v&&(s=r.F._check(s,y+(1<<17)));y<D;)s[y]=s[y++-B],s[y]=s[y++-B],s[y]=s[y++-B],s[y]=s[y++-B];y=D}}}else{(7&j)!=0&&(j+=8-(7&j));var z=4+(j>>>3),$=o[z-4]|o[z-3]<<8;v&&(s=r.F._check(s,y+$)),s.set(new a(o.buffer,o.byteOffset+z,$),y),j=z+$<<3,y+=$}return s.length==y?s:s.slice(0,y)},r.F._check=function(o,s){var a=o.length;if(s<=a)return o;var i=new Uint8Array(Math.max(a<<1,s));return i.set(o,0),i},r.F._decodeTiny=function(o,s,a,i,h,f){for(var c=r.F._bitsE,l=r.F._get17,u=0;u<a;){var p=o[l(i,h)&s];h+=15&p;var g=p>>>4;if(g<=15)f[u]=g,u++;else{var v=0,w=0;g==16?(w=3+c(i,h,2),h+=2,v=f[u-1]):g==17?(w=3+c(i,h,3),h+=3):g==18&&(w=11+c(i,h,7),h+=7);for(var b=u+w;u<b;)f[u]=v,u++}}return h},r.F._copyOut=function(o,s,a,i){for(var h=0,f=0,c=i.length>>>1;f<a;){var l=o[f+s];i[f<<1]=0,i[1+(f<<1)]=l,l>h&&(h=l),f++}for(;f<c;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return h},r.F.makeCodes=function(o,s){for(var a,i,h,f,c=r.F.U,l=o.length,u=c.bl_count,p=0;p<=s;p++)u[p]=0;for(p=1;p<l;p+=2)u[o[p]]++;var g=c.next_code;for(a=0,u[0]=0,i=1;i<=s;i++)a=a+u[i-1]<<1,g[i]=a;for(h=0;h<l;h+=2)(f=o[h+1])!=0&&(o[h]=g[f],g[f]++)},r.F.codes2map=function(o,s,a){for(var i=o.length,h=r.F.U.rev15,f=0;f<i;f+=2)if(o[f+1]!=0)for(var c=f>>1,l=o[f+1],u=c<<4|l,p=s-l,g=o[f]<<p,v=g+(1<<p);g!=v;)a[h[g]>>>15-s]=u,g++},r.F.revCodes=function(o,s){for(var a=r.F.U.rev15,i=15-s,h=0;h<o.length;h+=2){var f=o[h]<<s-o[h+1];o[h]=a[f]>>>i}},r.F._putsE=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8},r.F._putsF=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8,o[i+2]|=a>>>16},r.F._bitsE=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},r.F._bitsF=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},r.F._get17=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)},r.F._get25=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16|o[3+(s>>>3)]<<24)>>>(7&s)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=r.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,o.rev15[s]=(a>>>16|a<<16)>>>17}function i(h,f,c){for(;f--!=0;)h.push(0,c)}for(s=0;s<32;s++)o.ldef[s]=o.of0[s]<<3|o.exb[s],o.ddef[s]=o.df0[s]<<4|o.dxb[s];i(o.fltree,144,8),i(o.fltree,112,9),i(o.fltree,24,7),i(o.fltree,8,8),r.F.makeCodes(o.fltree,9),r.F.codes2map(o.fltree,9,o.flmap),r.F.revCodes(o.fltree,9),i(o.fdtree,32,5),r.F.makeCodes(o.fdtree,5),r.F.codes2map(o.fdtree,5,o.fdmap),r.F.revCodes(o.fdtree,5),i(o.itree,19,0),i(o.ltree,286,0),i(o.dtree,30,0),i(o.ttree,320,0)})()})();var Hp=zp({__proto__:null,default:Dn},[Dn]);const Pe=(function(){var e={nextZero(c,l){for(;c[l]!=0;)l++;return l},readUshort:(c,l)=>c[l]<<8|c[l+1],writeUshort(c,l,u){c[l]=u>>8&255,c[l+1]=255&u},readUint:(c,l)=>16777216*c[l]+(c[l+1]<<16|c[l+2]<<8|c[l+3]),writeUint(c,l,u){c[l]=u>>24&255,c[l+1]=u>>16&255,c[l+2]=u>>8&255,c[l+3]=255&u},readASCII(c,l,u){let p="";for(let g=0;g<u;g++)p+=String.fromCharCode(c[l+g]);return p},writeASCII(c,l,u){for(let p=0;p<u.length;p++)c[l+p]=u.charCodeAt(p)},readBytes(c,l,u){const p=[];for(let g=0;g<u;g++)p.push(c[l+g]);return p},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,l,u){let p,g="";for(let v=0;v<u;v++)g+=`%${e.pad(c[l+v].toString(16))}`;try{p=decodeURIComponent(g)}catch{return e.readASCII(c,l,u)}return p}};function t(c,l,u,p){const g=l*u,v=s(p),w=Math.ceil(l*v/8),b=new Uint8Array(4*g),A=new Uint32Array(b.buffer),{ctype:R}=p,{depth:S}=p,L=e.readUshort;if(R==6){const _=g<<2;if(S==8)for(var k=0;k<_;k+=4)b[k]=c[k],b[k+1]=c[k+1],b[k+2]=c[k+2],b[k+3]=c[k+3];if(S==16)for(k=0;k<_;k++)b[k]=c[k<<1]}else if(R==2){const _=p.tabs.tRNS;if(_==null){if(S==8)for(k=0;k<g;k++){var N=3*k;A[k]=255<<24|c[N+2]<<16|c[N+1]<<8|c[N]}if(S==16)for(k=0;k<g;k++)N=6*k,A[k]=255<<24|c[N+4]<<16|c[N+2]<<8|c[N]}else{var x=_[0];const I=_[1],W=_[2];if(S==8)for(k=0;k<g;k++){var y=k<<2;N=3*k,A[k]=255<<24|c[N+2]<<16|c[N+1]<<8|c[N],c[N]==x&&c[N+1]==I&&c[N+2]==W&&(b[y+3]=0)}if(S==16)for(k=0;k<g;k++)y=k<<2,N=6*k,A[k]=255<<24|c[N+4]<<16|c[N+2]<<8|c[N],L(c,N)==x&&L(c,N+2)==I&&L(c,N+4)==W&&(b[y+3]=0)}}else if(R==3){const _=p.tabs.PLTE,I=p.tabs.tRNS,W=I?I.length:0;if(S==1)for(var j=0;j<u;j++){var P=j*w,O=j*l;for(k=0;k<l;k++){y=O+k<<2;var F=3*(M=c[P+(k>>3)]>>7-((7&k)<<0)&1);b[y]=_[F],b[y+1]=_[F+1],b[y+2]=_[F+2],b[y+3]=M<W?I[M]:255}}if(S==2)for(j=0;j<u;j++)for(P=j*w,O=j*l,k=0;k<l;k++)y=O+k<<2,F=3*(M=c[P+(k>>2)]>>6-((3&k)<<1)&3),b[y]=_[F],b[y+1]=_[F+1],b[y+2]=_[F+2],b[y+3]=M<W?I[M]:255;if(S==4)for(j=0;j<u;j++)for(P=j*w,O=j*l,k=0;k<l;k++)y=O+k<<2,F=3*(M=c[P+(k>>1)]>>4-((1&k)<<2)&15),b[y]=_[F],b[y+1]=_[F+1],b[y+2]=_[F+2],b[y+3]=M<W?I[M]:255;if(S==8)for(k=0;k<g;k++){var M;y=k<<2,F=3*(M=c[k]),b[y]=_[F],b[y+1]=_[F+1],b[y+2]=_[F+2],b[y+3]=M<W?I[M]:255}}else if(R==4){if(S==8)for(k=0;k<g;k++){y=k<<2;var U=c[E=k<<1];b[y]=U,b[y+1]=U,b[y+2]=U,b[y+3]=c[E+1]}if(S==16)for(k=0;k<g;k++){var E;y=k<<2,U=c[E=k<<2],b[y]=U,b[y+1]=U,b[y+2]=U,b[y+3]=c[E+2]}}else if(R==0)for(x=p.tabs.tRNS?p.tabs.tRNS:-1,j=0;j<u;j++){const _=j*w,I=j*l;if(S==1)for(var C=0;C<l;C++){var D=(U=255*(c[_+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;A[I+C]=D<<24|U<<16|U<<8|U}else if(S==2)for(C=0;C<l;C++)D=(U=85*(c[_+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,A[I+C]=D<<24|U<<16|U<<8|U;else if(S==4)for(C=0;C<l;C++)D=(U=17*(c[_+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,A[I+C]=D<<24|U<<16|U<<8|U;else if(S==8)for(C=0;C<l;C++)D=(U=c[_+C])==x?0:255,A[I+C]=D<<24|U<<16|U<<8|U;else if(S==16)for(C=0;C<l;C++)U=c[_+(C<<1)],D=L(c,_+(C<<1))==x?0:255,A[I+C]=D<<24|U<<16|U<<8|U}return b}function n(c,l,u,p){const g=s(c),v=Math.ceil(u*g/8),w=new Uint8Array((v+1+c.interlace)*p);return l=c.tabs.CgBI?o(l,w):r(l,w),c.interlace==0?l=a(l,c,0,u,p):c.interlace==1&&(l=(function(A,R){const S=R.width,L=R.height,k=s(R),N=k>>3,x=Math.ceil(S*k/8),y=new Uint8Array(L*x);let j=0;const P=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],M=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const C=F[U],D=M[U];let _=0,I=0,W=P[U];for(;W<L;)W+=C,I++;let T=O[U];for(;T<S;)T+=D,_++;const B=Math.ceil(_*k/8);a(A,R,j,_,I);let z=0,$=P[U];for(;$<L;){let V=O[U],G=j+z*B<<3;for(;V<S;){var E;if(k==1&&(E=(E=A[G>>3])>>7-(7&G)&1,y[$*x+(V>>3)]|=E<<7-((7&V)<<0)),k==2&&(E=(E=A[G>>3])>>6-(7&G)&3,y[$*x+(V>>2)]|=E<<6-((3&V)<<1)),k==4&&(E=(E=A[G>>3])>>4-(7&G)&15,y[$*x+(V>>1)]|=E<<4-((1&V)<<2)),k>=8){const X=$*x+V*N;for(let K=0;K<N;K++)y[X+K]=A[(G>>3)+K]}G+=k,V+=D}z++,$+=C}_*I!=0&&(j+=I*(1+B)),U+=1}return y})(l,c)),l}function r(c,l){return o(new Uint8Array(c.buffer,2,c.length-6),l)}var o=(function(){const c={H:{}};return c.H.N=function(l,u){const p=Uint8Array;let g,v,w=0,b=0,A=0,R=0,S=0,L=0,k=0,N=0,x=0;if(l[0]==3&&l[1]==0)return u||new p(0);const y=c.H,j=y.b,P=y.e,O=y.R,F=y.n,M=y.A,U=y.Z,E=y.m,C=u==null;for(C&&(u=new p(l.length>>>2<<5));w==0;)if(w=j(l,x,1),b=j(l,x+1,2),x+=3,b!=0){if(C&&(u=c.H.W(u,N+(1<<17))),b==1&&(g=E.J,v=E.h,L=511,k=31),b==2){A=P(l,x,5)+257,R=P(l,x+5,5)+1,S=P(l,x+10,4)+4,x+=14;let _=1;for(var D=0;D<38;D+=2)E.Q[D]=0,E.Q[D+1]=0;for(D=0;D<S;D++){const T=P(l,x+3*D,3);E.Q[1+(E.X[D]<<1)]=T,T>_&&(_=T)}x+=3*S,F(E.Q,_),M(E.Q,_,E.u),g=E.w,v=E.d,x=O(E.u,(1<<_)-1,A+R,l,x,E.v);const I=y.V(E.v,0,A,E.C);L=(1<<I)-1;const W=y.V(E.v,A,R,E.D);k=(1<<W)-1,F(E.C,I),M(E.C,I,g),F(E.D,W),M(E.D,W,v)}for(;;){const _=g[U(l,x)&L];x+=15&_;const I=_>>>4;if(!(I>>>8))u[N++]=I;else{if(I==256)break;{let W=N+I-254;if(I>264){const V=E.q[I-257];W=N+(V>>>3)+P(l,x,7&V),x+=7&V}const T=v[U(l,x)&k];x+=15&T;const B=T>>>4,z=E.c[B],$=(z>>>4)+j(l,x,15&z);for(x+=15&z;N<W;)u[N]=u[N++-$],u[N]=u[N++-$],u[N]=u[N++-$],u[N]=u[N++-$];N=W}}}}else{(7&x)!=0&&(x+=8-(7&x));const _=4+(x>>>3),I=l[_-4]|l[_-3]<<8;C&&(u=c.H.W(u,N+I)),u.set(new p(l.buffer,l.byteOffset+_,I),N),x=_+I<<3,N+=I}return u.length==N?u:u.slice(0,N)},c.H.W=function(l,u){const p=l.length;if(u<=p)return l;const g=new Uint8Array(p<<1);return g.set(l,0),g},c.H.R=function(l,u,p,g,v,w){const b=c.H.e,A=c.H.Z;let R=0;for(;R<p;){const S=l[A(g,v)&u];v+=15&S;const L=S>>>4;if(L<=15)w[R]=L,R++;else{let k=0,N=0;L==16?(N=3+b(g,v,2),v+=2,k=w[R-1]):L==17?(N=3+b(g,v,3),v+=3):L==18&&(N=11+b(g,v,7),v+=7);const x=R+N;for(;R<x;)w[R]=k,R++}}return v},c.H.V=function(l,u,p,g){let v=0,w=0;const b=g.length>>>1;for(;w<p;){const A=l[w+u];g[w<<1]=0,g[1+(w<<1)]=A,A>v&&(v=A),w++}for(;w<b;)g[w<<1]=0,g[1+(w<<1)]=0,w++;return v},c.H.n=function(l,u){const p=c.H.m,g=l.length;let v,w,b,A;const R=p.j;for(var S=0;S<=u;S++)R[S]=0;for(S=1;S<g;S+=2)R[l[S]]++;const L=p.K;for(v=0,R[0]=0,w=1;w<=u;w++)v=v+R[w-1]<<1,L[w]=v;for(b=0;b<g;b+=2)A=l[b+1],A!=0&&(l[b]=L[A],L[A]++)},c.H.A=function(l,u,p){const g=l.length,v=c.H.m.r;for(let w=0;w<g;w+=2)if(l[w+1]!=0){const b=w>>1,A=l[w+1],R=b<<4|A,S=u-A;let L=l[w]<<S;const k=L+(1<<S);for(;L!=k;)p[v[L]>>>15-u]=R,L++}},c.H.l=function(l,u){const p=c.H.m.r,g=15-u;for(let v=0;v<l.length;v+=2){const w=l[v]<<u-l[v+1];l[v]=p[w]>>>g}},c.H.M=function(l,u,p){p<<=7&u;const g=u>>>3;l[g]|=p,l[g+1]|=p>>>8},c.H.I=function(l,u,p){p<<=7&u;const g=u>>>3;l[g]|=p,l[g+1]|=p>>>8,l[g+2]|=p>>>16},c.H.e=function(l,u,p){return(l[u>>>3]|l[1+(u>>>3)]<<8)>>>(7&u)&(1<<p)-1},c.H.b=function(l,u,p){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)&(1<<p)-1},c.H.Z=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)},c.H.i=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16|l[3+(u>>>3)]<<24)>>>(7&u)},c.H.m=(function(){const l=Uint16Array,u=Uint32Array;return{K:new l(16),j:new l(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new l(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new l(512),_:[],h:new l(32),$:[],w:new l(32768),C:[],v:[],d:new l(32768),D:[],u:new l(512),Q:[],r:new l(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new l(65536),g:new l(32768)}})(),(function(){const l=c.H.m;for(var u=0;u<32768;u++){let g=u;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,l.r[u]=(g>>>16|g<<16)>>>17}function p(g,v,w){for(;v--!=0;)g.push(0,w)}for(u=0;u<32;u++)l.q[u]=l.S[u]<<3|l.T[u],l.c[u]=l.p[u]<<4|l.z[u];p(l._,144,8),p(l._,112,9),p(l._,24,7),p(l._,8,8),c.H.n(l._,9),c.H.A(l._,9,l.J),c.H.l(l._,9),p(l.$,32,5),c.H.n(l.$,5),c.H.A(l.$,5,l.h),c.H.l(l.$,5),p(l.Q,19,0),p(l.C,286,0),p(l.D,30,0),p(l.v,320,0)})(),c.H.N})();function s(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function a(c,l,u,p,g){let v=s(l);const w=Math.ceil(p*v/8);let b,A;v=Math.ceil(v/8);let R=c[u],S=0;if(R>1&&(c[u]=[0,0,1][R-2]),R==3)for(S=v;S<w;S++)c[S+1]=c[S+1]+(c[S+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=u+L*w,A=b+L+1,R=c[A-1],S=0,R==0)for(;S<w;S++)c[b+S]=c[A+S];else if(R==1){for(;S<v;S++)c[b+S]=c[A+S];for(;S<w;S++)c[b+S]=c[A+S]+c[b+S-v]}else if(R==2)for(;S<w;S++)c[b+S]=c[A+S]+c[b+S-w];else if(R==3){for(;S<v;S++)c[b+S]=c[A+S]+(c[b+S-w]>>>1);for(;S<w;S++)c[b+S]=c[A+S]+(c[b+S-w]+c[b+S-v]>>>1)}else{for(;S<v;S++)c[b+S]=c[A+S]+i(0,c[b+S-w],0);for(;S<w;S++)c[b+S]=c[A+S]+i(c[b+S-v],c[b+S-w],c[b+S-v-w])}return c}function i(c,l,u){const p=c+l-u,g=p-c,v=p-l,w=p-u;return g*g<=v*v&&g*g<=w*w?c:v*v<=w*w?l:u}function h(c,l,u){u.width=e.readUint(c,l),l+=4,u.height=e.readUint(c,l),l+=4,u.depth=c[l],l++,u.ctype=c[l],l++,u.compress=c[l],l++,u.filter=c[l],l++,u.interlace=c[l],l++}function f(c,l,u,p,g,v,w,b,A){const R=Math.min(l,g),S=Math.min(u,v);let L=0,k=0;for(let U=0;U<S;U++)for(let E=0;E<R;E++)if(w>=0&&b>=0?(L=U*l+E<<2,k=(b+U)*g+w+E<<2):(L=(-b+U)*l-w+E<<2,k=U*g+E<<2),A==0)p[k]=c[L],p[k+1]=c[L+1],p[k+2]=c[L+2],p[k+3]=c[L+3];else if(A==1){var N=c[L+3]*.00392156862745098,x=c[L]*N,y=c[L+1]*N,j=c[L+2]*N,P=p[k+3]*(1/255),O=p[k]*P,F=p[k+1]*P,M=p[k+2]*P;const C=1-N,D=N+P*C,_=D==0?0:1/D;p[k+3]=255*D,p[k+0]=(x+O*C)*_,p[k+1]=(y+F*C)*_,p[k+2]=(j+M*C)*_}else if(A==2)N=c[L+3],x=c[L],y=c[L+1],j=c[L+2],P=p[k+3],O=p[k],F=p[k+1],M=p[k+2],N==P&&x==O&&y==F&&j==M?(p[k]=0,p[k+1]=0,p[k+2]=0,p[k+3]=0):(p[k]=x,p[k+1]=y,p[k+2]=j,p[k+3]=N);else if(A==3){if(N=c[L+3],x=c[L],y=c[L+1],j=c[L+2],P=p[k+3],O=p[k],F=p[k+1],M=p[k+2],N==P&&x==O&&y==F&&j==M)continue;if(N<220&&P>20)return!1}return!0}return{decode:function(l){const u=new Uint8Array(l);let p=8;const g=e,v=g.readUshort,w=g.readUint,b={tabs:{},frames:[]},A=new Uint8Array(u.length);let R,S=0,L=0;const k=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(u[N]!=k[N])throw"The input is not a PNG file!";for(;p<u.length;){const U=g.readUint(u,p);p+=4;const E=g.readASCII(u,p,4);if(p+=4,E=="IHDR")h(u,p,b);else if(E=="iCCP"){for(var x=p;u[x]!=0;)x++;g.readASCII(u,p,x-p),u[x+1];const C=u.slice(x+2,p+U);let D=null;try{D=r(C)}catch{D=o(C)}b.tabs[E]=D}else if(E=="CgBI")b.tabs[E]=u.slice(p,p+4);else if(E=="IDAT"){for(N=0;N<U;N++)A[S+N]=u[p+N];S+=U}else if(E=="acTL")b.tabs[E]={num_frames:w(u,p),num_plays:w(u,p+4)},R=new Uint8Array(u.length);else if(E=="fcTL"){L!=0&&((M=b.frames[b.frames.length-1]).data=n(b,R.slice(0,L),M.rect.width,M.rect.height),L=0);const C={x:w(u,p+12),y:w(u,p+16),width:w(u,p+4),height:w(u,p+8)};let D=v(u,p+22);D=v(u,p+20)/(D==0?100:D);const _={rect:C,delay:Math.round(1e3*D),dispose:u[p+24],blend:u[p+25]};b.frames.push(_)}else if(E=="fdAT"){for(N=0;N<U-4;N++)R[L+N]=u[p+N+4];L+=U-4}else if(E=="pHYs")b.tabs[E]=[g.readUint(u,p),g.readUint(u,p+4),u[p+8]];else if(E=="cHRM")for(b.tabs[E]=[],N=0;N<8;N++)b.tabs[E].push(g.readUint(u,p+4*N));else if(E=="tEXt"||E=="zTXt"){b.tabs[E]==null&&(b.tabs[E]={});var y=g.nextZero(u,p),j=g.readASCII(u,p,y-p),P=p+U-y-1;if(E=="tEXt")F=g.readASCII(u,y+1,P);else{var O=r(u.slice(y+2,y+2+P));F=g.readUTF8(O,0,O.length)}b.tabs[E][j]=F}else if(E=="iTXt"){b.tabs[E]==null&&(b.tabs[E]={}),y=0,x=p,y=g.nextZero(u,x),j=g.readASCII(u,x,y-x);const C=u[x=y+1];var F;u[x+1],x+=2,y=g.nextZero(u,x),g.readASCII(u,x,y-x),x=y+1,y=g.nextZero(u,x),g.readUTF8(u,x,y-x),P=U-((x=y+1)-p),C==0?F=g.readUTF8(u,x,P):(O=r(u.slice(x,x+P)),F=g.readUTF8(O,0,O.length)),b.tabs[E][j]=F}else if(E=="PLTE")b.tabs[E]=g.readBytes(u,p,U);else if(E=="hIST"){const C=b.tabs.PLTE.length/3;for(b.tabs[E]=[],N=0;N<C;N++)b.tabs[E].push(v(u,p+2*N))}else if(E=="tRNS")b.ctype==3?b.tabs[E]=g.readBytes(u,p,U):b.ctype==0?b.tabs[E]=v(u,p):b.ctype==2&&(b.tabs[E]=[v(u,p),v(u,p+2),v(u,p+4)]);else if(E=="gAMA")b.tabs[E]=g.readUint(u,p)/1e5;else if(E=="sRGB")b.tabs[E]=u[p];else if(E=="bKGD")b.ctype==0||b.ctype==4?b.tabs[E]=[v(u,p)]:b.ctype==2||b.ctype==6?b.tabs[E]=[v(u,p),v(u,p+2),v(u,p+4)]:b.ctype==3&&(b.tabs[E]=u[p]);else if(E=="IEND")break;p+=U,g.readUint(u,p),p+=4}var M;return L!=0&&((M=b.frames[b.frames.length-1]).data=n(b,R.slice(0,L),M.rect.width,M.rect.height)),b.data=n(b,A,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(l){const u=l.width,p=l.height;if(l.tabs.acTL==null)return[t(l.data,u,p,l).buffer];const g=[];l.frames[0].data==null&&(l.frames[0].data=l.data);const v=u*p*4,w=new Uint8Array(v),b=new Uint8Array(v),A=new Uint8Array(v);for(let S=0;S<l.frames.length;S++){const L=l.frames[S],k=L.rect.x,N=L.rect.y,x=L.rect.width,y=L.rect.height,j=t(L.data,x,y,l);if(S!=0)for(var R=0;R<v;R++)A[R]=w[R];if(L.blend==0?f(j,x,y,w,u,p,k,N,0):L.blend==1&&f(j,x,y,w,u,p,k,N,1),g.push(w.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,w,u,p,k,N,0);else if(L.dispose==2)for(R=0;R<v;R++)w[R]=A[R]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Pe,{_bin:t}=Pe,n=Pe._paeth;var r={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let j=y;for(let P=0;P<8;P++)1&j?j=3988292384^j>>>1:j>>>=1;x[y]=j}return x})(),update(x,y,j,P){for(let O=0;O<P;O++)x=r.table[255&(x^y[j+O])]^x>>>8;return x},crc:(x,y,j)=>4294967295^r.update(4294967295,x,y,j)};function o(x,y,j,P){y[j]+=x[0]*P>>4,y[j+1]+=x[1]*P>>4,y[j+2]+=x[2]*P>>4,y[j+3]+=x[3]*P>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const j=x[0]-y[0],P=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return j*j+P*P+O*O+F*F}function i(x,y,j,P,O,F,M){M==null&&(M=1);const U=P.length,E=[];for(var C=0;C<U;C++){const $=P[C];E.push([$>>>0&255,$>>>8&255,$>>>16&255,$>>>24&255])}for(C=0;C<U;C++){let $=4294967295;for(var D=0,_=0;_<U;_++){var I=a(E[C],E[_]);_!=C&&I<$&&($=I,D=_)}}const W=new Uint32Array(O.buffer),T=new Int16Array(y*j*4),B=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<B.length;C++)B[C]=255*((B[C]+.5)/16-.5);for(let $=0;$<j;$++)for(let V=0;V<y;V++){var z;C=4*($*y+V),M!=2?z=[s(x[C]+T[C]),s(x[C+1]+T[C+1]),s(x[C+2]+T[C+2]),s(x[C+3]+T[C+3])]:(I=B[4*(3&$)+(3&V)],z=[s(x[C]+I),s(x[C+1]+I),s(x[C+2]+I),s(x[C+3]+I)]),D=0;let G=16777215;for(_=0;_<U;_++){const ne=a(z,E[_]);ne<G&&(G=ne,D=_)}const X=E[D],K=[z[0]-X[0],z[1]-X[1],z[2]-X[2],z[3]-X[3]];M==1&&(V!=y-1&&o(K,T,C+4,7),$!=j-1&&(V!=0&&o(K,T,C+4*y-4,3),o(K,T,C+4*y,5),V!=y-1&&o(K,T,C+4*y+4,1))),F[C>>2]=D,W[C>>2]=P[D]}}function h(x,y,j,P,O){O==null&&(O={});const{crc:F}=r,M=t.writeUint,U=t.writeUshort,E=t.writeASCII;let C=8;const D=x.frames.length>1;let _,I=!1,W=33+(D?20:0);if(O.sRGB!=null&&(W+=13),O.pHYs!=null&&(W+=21),O.iCCP!=null&&(_=pako.deflate(O.iCCP),W+=21+_.length+4),x.ctype==3){for(var T=x.plte.length,B=0;B<T;B++)x.plte[B]>>>24!=255&&(I=!0);W+=8+3*T+4+(I?8+1*T+4:0)}for(var z=0;z<x.frames.length;z++)D&&(W+=38),W+=(X=x.frames[z]).cimg.length+12,z!=0&&(W+=4);W+=12;const $=new Uint8Array(W),V=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)$[B]=V[B];if(M($,C,13),C+=4,E($,C,"IHDR"),C+=4,M($,C,y),C+=4,M($,C,j),C+=4,$[C]=x.depth,C++,$[C]=x.ctype,C++,$[C]=0,C++,$[C]=0,C++,$[C]=0,C++,M($,C,F($,C-17,17)),C+=4,O.sRGB!=null&&(M($,C,1),C+=4,E($,C,"sRGB"),C+=4,$[C]=O.sRGB,C++,M($,C,F($,C-5,5)),C+=4),O.iCCP!=null){const K=13+_.length;M($,C,K),C+=4,E($,C,"iCCP"),C+=4,E($,C,"ICC profile"),C+=11,C+=2,$.set(_,C),C+=_.length,M($,C,F($,C-(K+4),K+4)),C+=4}if(O.pHYs!=null&&(M($,C,9),C+=4,E($,C,"pHYs"),C+=4,M($,C,O.pHYs[0]),C+=4,M($,C,O.pHYs[1]),C+=4,$[C]=O.pHYs[2],C++,M($,C,F($,C-13,13)),C+=4),D&&(M($,C,8),C+=4,E($,C,"acTL"),C+=4,M($,C,x.frames.length),C+=4,M($,C,O.loop!=null?O.loop:0),C+=4,M($,C,F($,C-12,12)),C+=4),x.ctype==3){for(M($,C,3*(T=x.plte.length)),C+=4,E($,C,"PLTE"),C+=4,B=0;B<T;B++){const K=3*B,ne=x.plte[B],ae=255&ne,de=ne>>>8&255,me=ne>>>16&255;$[C+K+0]=ae,$[C+K+1]=de,$[C+K+2]=me}if(C+=3*T,M($,C,F($,C-3*T-4,3*T+4)),C+=4,I){for(M($,C,T),C+=4,E($,C,"tRNS"),C+=4,B=0;B<T;B++)$[C+B]=x.plte[B]>>>24&255;C+=T,M($,C,F($,C-T-4,T+4)),C+=4}}let G=0;for(z=0;z<x.frames.length;z++){var X=x.frames[z];D&&(M($,C,26),C+=4,E($,C,"fcTL"),C+=4,M($,C,G++),C+=4,M($,C,X.rect.width),C+=4,M($,C,X.rect.height),C+=4,M($,C,X.rect.x),C+=4,M($,C,X.rect.y),C+=4,U($,C,P[z]),C+=2,U($,C,1e3),C+=2,$[C]=X.dispose,C++,$[C]=X.blend,C++,M($,C,F($,C-30,30)),C+=4);const K=X.cimg;M($,C,(T=K.length)+(z==0?0:4)),C+=4;const ne=C;E($,C,z==0?"IDAT":"fdAT"),C+=4,z!=0&&(M($,C,G++),C+=4),$.set(K,C),C+=T,M($,C,F($,ne,C-ne)),C+=4}return M($,C,0),C+=4,E($,C,"IEND"),C+=4,M($,C,F($,C-4,4)),C+=4,$.buffer}function f(x,y,j){for(let P=0;P<x.frames.length;P++){const O=x.frames[P];O.rect.width;const F=O.rect.height,M=new Uint8Array(F*O.bpl+F);O.cimg=p(O.img,F,O.bpp,O.bpl,M,y,j)}}function c(x,y,j,P,O){const F=O[0],M=O[1],U=O[2],E=O[3],C=O[4],D=O[5];let _=6,I=8,W=255;for(var T=0;T<x.length;T++){const J=new Uint8Array(x[T]);for(var B=J.length,z=0;z<B;z+=4)W&=J[z+3]}const $=W!=255,V=(function(te,ie,oe,he,ge,_e){const xe=[];for(var fe=0;fe<te.length;fe++){const we=new Uint8Array(te[fe]),Me=new Uint32Array(we.buffer);var Ee;let Re=0,Ve=0,$e=ie,mt=oe,ar=he?1:0;if(fe!=0){const Jl=_e||he||fe==1||xe[fe-2].dispose!=0?1:2;let ir=0,Oo=1e9;for(let Gt=0;Gt<Jl;Gt++){var Je=new Uint8Array(te[fe-1-Gt]);const ec=new Uint32Array(te[fe-1-Gt]);let et=ie,tt=oe,At=-1,Kt=-1;for(let pt=0;pt<oe;pt++)for(let gt=0;gt<ie;gt++)Me[be=pt*ie+gt]!=ec[be]&&(gt<et&&(et=gt),gt>At&&(At=gt),pt<tt&&(tt=pt),pt>Kt&&(Kt=pt));At==-1&&(et=tt=At=Kt=0),ge&&((1&et)==1&&et--,(1&tt)==1&&tt--);const Do=(At-et+1)*(Kt-tt+1);Do<Oo&&(Oo=Do,ir=Gt,Re=et,Ve=tt,$e=At-et+1,mt=Kt-tt+1)}Je=new Uint8Array(te[fe-1-ir]),ir==1&&(xe[fe-1].dispose=2),Ee=new Uint8Array($e*mt*4),e(Je,ie,oe,Ee,$e,mt,-Re,-Ve,0),ar=e(we,ie,oe,Ee,$e,mt,-Re,-Ve,3)?1:0,ar==1?u(we,ie,oe,Ee,{x:Re,y:Ve,width:$e,height:mt}):e(we,ie,oe,Ee,$e,mt,-Re,-Ve,0)}else Ee=we.slice(0);xe.push({rect:{x:Re,y:Ve,width:$e,height:mt},img:Ee,blend:ar,dispose:0})}if(he)for(fe=0;fe<xe.length;fe++){if((ht=xe[fe]).blend==1)continue;const we=ht.rect,Me=xe[fe-1].rect,Re=Math.min(we.x,Me.x),Ve=Math.min(we.y,Me.y),$e={x:Re,y:Ve,width:Math.max(we.x+we.width,Me.x+Me.width)-Re,height:Math.max(we.y+we.height,Me.y+Me.height)-Ve};xe[fe-1].dispose=1,fe-1!=0&&l(te,ie,oe,xe,fe-1,$e,ge),l(te,ie,oe,xe,fe,$e,ge)}let xn=0;if(te.length!=1)for(var be=0;be<xe.length;be++){var ht;xn+=(ht=xe[be]).rect.width*ht.rect.height}return xe})(x,y,j,F,M,U),G={},X=[],K=[];if(P!=0){const J=[];for(z=0;z<V.length;z++)J.push(V[z].img.buffer);const te=(function(ge){let _e=0;for(var xe=0;xe<ge.length;xe++)_e+=ge[xe].byteLength;const fe=new Uint8Array(_e);let Ee=0;for(xe=0;xe<ge.length;xe++){const Je=new Uint8Array(ge[xe]),xn=Je.length;for(let be=0;be<xn;be+=4){let ht=Je[be],we=Je[be+1],Me=Je[be+2];const Re=Je[be+3];Re==0&&(ht=we=Me=0),fe[Ee+be]=ht,fe[Ee+be+1]=we,fe[Ee+be+2]=Me,fe[Ee+be+3]=Re}Ee+=xn}return fe.buffer})(J),ie=v(te,P);for(z=0;z<ie.plte.length;z++)X.push(ie.plte[z].est.rgba);let oe=0;for(z=0;z<V.length;z++){const he=(ae=V[z]).img.length;var ne=new Uint8Array(ie.inds.buffer,oe>>2,he>>2);K.push(ne);const ge=new Uint8Array(ie.abuf,oe,he);D&&i(ae.img,ae.rect.width,ae.rect.height,X,ge,ne),ae.img.set(ge),oe+=he}}else for(T=0;T<V.length;T++){var ae=V[T];const J=new Uint32Array(ae.img.buffer);var de=ae.rect.width;for(B=J.length,ne=new Uint8Array(B),K.push(ne),z=0;z<B;z++){const te=J[z];if(z!=0&&te==J[z-1])ne[z]=ne[z-1];else if(z>de&&te==J[z-de])ne[z]=ne[z-de];else{let ie=G[te];if(ie==null&&(G[te]=ie=X.length,X.push(te),X.length>=300))break;ne[z]=ie}}}const me=X.length;for(me<=256&&C==0&&(I=me<=2?1:me<=4?2:me<=16?4:8,I=Math.max(I,E)),T=0;T<V.length;T++){(ae=V[T]).rect.x,ae.rect.y,de=ae.rect.width;const J=ae.rect.height;let te=ae.img;new Uint32Array(te.buffer);let ie=4*de,oe=4;if(me<=256&&C==0){ie=Math.ceil(I*de/8);var H=new Uint8Array(ie*J);const he=K[T];for(let ge=0;ge<J;ge++){z=ge*ie;const _e=ge*de;if(I==8)for(var q=0;q<de;q++)H[z+q]=he[_e+q];else if(I==4)for(q=0;q<de;q++)H[z+(q>>1)]|=he[_e+q]<<4-4*(1&q);else if(I==2)for(q=0;q<de;q++)H[z+(q>>2)]|=he[_e+q]<<6-2*(3&q);else if(I==1)for(q=0;q<de;q++)H[z+(q>>3)]|=he[_e+q]<<7-1*(7&q)}te=H,_=3,oe=1}else if($==0&&V.length==1){H=new Uint8Array(de*J*3);const he=de*J;for(z=0;z<he;z++){const ge=3*z,_e=4*z;H[ge]=te[_e],H[ge+1]=te[_e+1],H[ge+2]=te[_e+2]}te=H,_=2,oe=3,ie=3*de}ae.img=te,ae.bpl=ie,ae.bpp=oe}return{ctype:_,depth:I,plte:X,frames:V}}function l(x,y,j,P,O,F,M){const U=Uint8Array,E=Uint32Array,C=new U(x[O-1]),D=new E(x[O-1]),_=O+1<x.length?new U(x[O+1]):null,I=new U(x[O]),W=new E(I.buffer);let T=y,B=j,z=-1,$=-1;for(let G=0;G<F.height;G++)for(let X=0;X<F.width;X++){const K=F.x+X,ne=F.y+G,ae=ne*y+K,de=W[ae];de==0||P[O-1].dispose==0&&D[ae]==de&&(_==null||_[4*ae+3]!=0)||(K<T&&(T=K),K>z&&(z=K),ne<B&&(B=ne),ne>$&&($=ne))}z==-1&&(T=B=z=$=0),M&&((1&T)==1&&T--,(1&B)==1&&B--),F={x:T,y:B,width:z-T+1,height:$-B+1};const V=P[O];V.rect=F,V.blend=1,V.img=new Uint8Array(F.width*F.height*4),P[O-1].dispose==0?(e(C,y,j,V.img,F.width,F.height,-F.x,-F.y,0),u(I,y,j,V.img,F)):e(I,y,j,V.img,F.width,F.height,-F.x,-F.y,0)}function u(x,y,j,P,O){e(x,y,j,P,O.width,O.height,-O.x,-O.y,2)}function p(x,y,j,P,O,F,M){const U=[];let E,C=[0,1,2,3,4];F!=-1?C=[F]:(y*P>5e5||j==1)&&(C=[0]),M&&(E={level:0});const D=Hp;for(var _=0;_<C.length;_++){for(let T=0;T<y;T++)g(O,x,T,P,j,C[_]);U.push(D.deflate(O,E))}let I,W=1e9;for(_=0;_<U.length;_++)U[_].length<W&&(I=_,W=U[_].length);return U[I]}function g(x,y,j,P,O,F){const M=j*P;let U=M+j;if(x[U]=F,U++,F==0)if(P<500)for(var E=0;E<P;E++)x[U+E]=y[M+E];else x.set(new Uint8Array(y.buffer,M,P),U);else if(F==1){for(E=0;E<O;E++)x[U+E]=y[M+E];for(E=O;E<P;E++)x[U+E]=y[M+E]-y[M+E-O]+256&255}else if(j==0){for(E=0;E<O;E++)x[U+E]=y[M+E];if(F==2)for(E=O;E<P;E++)x[U+E]=y[M+E];if(F==3)for(E=O;E<P;E++)x[U+E]=y[M+E]-(y[M+E-O]>>1)+256&255;if(F==4)for(E=O;E<P;E++)x[U+E]=y[M+E]-n(y[M+E-O],0,0)+256&255}else{if(F==2)for(E=0;E<P;E++)x[U+E]=y[M+E]+256-y[M+E-P]&255;if(F==3){for(E=0;E<O;E++)x[U+E]=y[M+E]+256-(y[M+E-P]>>1)&255;for(E=O;E<P;E++)x[U+E]=y[M+E]+256-(y[M+E-P]+y[M+E-O]>>1)&255}if(F==4){for(E=0;E<O;E++)x[U+E]=y[M+E]+256-n(0,y[M+E-P],0)&255;for(E=O;E<P;E++)x[U+E]=y[M+E]+256-n(y[M+E-O],y[M+E-P],y[M+E-O-P])&255}}}function v(x,y){const j=new Uint8Array(x),P=j.slice(0),O=new Uint32Array(P.buffer),F=w(P,y),M=F[0],U=F[1],E=j.length,C=new Uint8Array(E>>2);let D;if(j.length<2e7)for(var _=0;_<E;_+=4)D=b(M,I=j[_]*(1/255),W=j[_+1]*(1/255),T=j[_+2]*(1/255),B=j[_+3]*(1/255)),C[_>>2]=D.ind,O[_>>2]=D.est.rgba;else for(_=0;_<E;_+=4){var I=j[_]*.00392156862745098,W=j[_+1]*(1/255),T=j[_+2]*(1/255),B=j[_+3]*(1/255);for(D=M;D.left;)D=A(D.est,I,W,T,B)<=0?D.left:D.right;C[_>>2]=D.ind,O[_>>2]=D.est.rgba}return{abuf:P.buffer,inds:C,plte:U}}function w(x,y,j){j==null&&(j=1e-4);const P=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let U=0,E=0;for(var M=0;M<F.length;M++)F[M].est.L>U&&(U=F[M].est.L,E=M);if(U<j)break;const C=F[E],D=R(x,P,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=D||C.i1<=D){C.est.L=0;continue}const _={i0:C.i0,i1:D,bst:null,est:null,tdst:0,left:null,right:null};_.bst=L(x,_.i0,_.i1),_.est=k(_.bst);const I={i0:D,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(I.bst={R:[],m:[],N:C.bst.N-_.bst.N},M=0;M<16;M++)I.bst.R[M]=C.bst.R[M]-_.bst.R[M];for(M=0;M<4;M++)I.bst.m[M]=C.bst.m[M]-_.bst.m[M];I.est=k(I.bst),C.left=_,C.right=I,F[E]=_,F.push(I)}for(F.sort(((U,E)=>E.bst.N-U.bst.N)),M=0;M<F.length;M++)F[M].ind=M;return[O,F]}function b(x,y,j,P,O){if(x.left==null)return x.tdst=(function(_,I,W,T,B){const z=I-_[0],$=W-_[1],V=T-_[2],G=B-_[3];return z*z+$*$+V*V+G*G})(x.est.q,y,j,P,O),x;const F=A(x.est,y,j,P,O);let M=x.left,U=x.right;F>0&&(M=x.right,U=x.left);const E=b(M,y,j,P,O);if(E.tdst<=F*F)return E;const C=b(U,y,j,P,O);return C.tdst<E.tdst?C:E}function A(x,y,j,P,O){const{e:F}=x;return F[0]*y+F[1]*j+F[2]*P+F[3]*O-x.eMq}function R(x,y,j,P,O,F){for(P-=4;j<P;){for(;S(x,j,O)<=F;)j+=4;for(;S(x,P,O)>F;)P-=4;if(j>=P)break;const M=y[j>>2];y[j>>2]=y[P>>2],y[P>>2]=M,j+=4,P-=4}for(;S(x,j,O)>F;)j-=4;return j+4}function S(x,y,j){return x[y]*j[0]+x[y+1]*j[1]+x[y+2]*j[2]+x[y+3]*j[3]}function L(x,y,j){const P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=j-y>>2;for(let M=y;M<j;M+=4){const U=x[M]*.00392156862745098,E=x[M+1]*(1/255),C=x[M+2]*(1/255),D=x[M+3]*(1/255);O[0]+=U,O[1]+=E,O[2]+=C,O[3]+=D,P[0]+=U*U,P[1]+=U*E,P[2]+=U*C,P[3]+=U*D,P[5]+=E*E,P[6]+=E*C,P[7]+=E*D,P[10]+=C*C,P[11]+=C*D,P[15]+=D*D}return P[4]=P[1],P[8]=P[2],P[9]=P[6],P[12]=P[3],P[13]=P[7],P[14]=P[11],{R:P,m:O,N:F}}function k(x){const{R:y}=x,{m:j}=x,{N:P}=x,O=j[0],F=j[1],M=j[2],U=j[3],E=P==0?0:1/P,C=[y[0]-O*O*E,y[1]-O*F*E,y[2]-O*M*E,y[3]-O*U*E,y[4]-F*O*E,y[5]-F*F*E,y[6]-F*M*E,y[7]-F*U*E,y[8]-M*O*E,y[9]-M*F*E,y[10]-M*M*E,y[11]-M*U*E,y[12]-U*O*E,y[13]-U*F*E,y[14]-U*M*E,y[15]-U*U*E],D=C,_=N;let I=[Math.random(),Math.random(),Math.random(),Math.random()],W=0,T=0;if(P!=0)for(let z=0;z<16&&(I=_.multVec(D,I),T=Math.sqrt(_.dot(I,I)),I=_.sml(1/T,I),!(z!=0&&Math.abs(T-W)<1e-9));z++)W=T;const B=[O*E,F*E,M*E,U*E];return{Cov:C,q:B,e:I,L:W,eMq255:_.dot(_.sml(255,B),I),eMq:_.dot(I,B),rgba:(Math.round(255*B[3])<<24|Math.round(255*B[2])<<16|Math.round(255*B[1])<<8|Math.round(255*B[0])<<0)>>>0}}var N={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Pe.encode=function(y,j,P,O,F,M,U){O==null&&(O=0),U==null&&(U=!1);const E=c(y,j,P,O,[!1,!1,!1,0,U,!1]);return f(E,-1),h(E,j,P,F,M)},Pe.encodeLL=function(y,j,P,O,F,M,U,E){const C={ctype:0+(O==1?0:2)+(F==0?0:4),depth:M,frames:[]},D=(O+F)*M,_=D*j;for(let I=0;I<y.length;I++)C.frames.push({rect:{x:0,y:0,width:j,height:P},img:new Uint8Array(y[I]),blend:0,dispose:1,bpp:Math.ceil(D/8),bpl:Math.ceil(_/8)});return f(C,0,!0),h(C,j,P,U,E)},Pe.encode.compress=c,Pe.encode.dither=i,Pe.quantize=v,Pe.quantize.getKDtree=w,Pe.quantize.getNearest=b})();const Xi={toArrayBuffer(e,t){const n=e.width,r=e.height,o=n<<2,s=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,h=i*r,f=122+h,c=new ArrayBuffer(f),l=new DataView(c),u=1<<20;let p,g,v,w,b=u,A=0,R=0,S=0;function L(x){l.setUint16(R,x,!0),R+=2}function k(x){l.setUint32(R,x,!0),R+=4}function N(x){R+=x}L(19778),k(f),N(4),k(122),k(108),k(n),k(-r>>>0),L(1),L(32),k(3),k(h),k(2835),k(2835),N(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;A<r&&b>0;){for(w=122+A*i,p=0;p<o;)b--,g=a[S++],v=g>>>24,l.setUint32(w+p,g<<8|v),p+=4;A++}S<a.length?(b=u,setTimeout(x,Xi._dly)):t(c)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var ke={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Vp={[ke.CHROME]:16384,[ke.FIREFOX]:11180,[ke.DESKTOP_SAFARI]:16384,[ke.IE]:8192,[ke.IOS]:4096,[ke.ETC]:8192};const ko=typeof window<"u",Qi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Ln=ko&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Gp=(ko||Qi)&&(Ln&&Ln.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Zi=(ko||Qi)&&(Ln&&Ln.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function _o(e,t,n=Date.now()){return new Promise((r=>{const o=e.split(","),s=o[0].match(/:(.*?);/)[1],a=globalThis.atob(o[1]);let i=a.length;const h=new Uint8Array(i);for(;i--;)h[i]=a.charCodeAt(i);const f=new Blob([h],{type:s});f.name=t,f.lastModified=n,r(f)}))}function Ji(e){return new Promise(((t,n)=>{const r=new Zi;r.onload=()=>t(r.result),r.onerror=o=>n(o),r.readAsDataURL(e)}))}function el(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=o=>n(o),r.src=e}))}function yt(){if(yt.cachedResult!==void 0)return yt.cachedResult;let e=ke.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=ke.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=ke.IOS:/Safari/i.test(t)?e=ke.DESKTOP_SAFARI:/Firefox/i.test(t)?e=ke.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=ke.IE),yt.cachedResult=e,yt.cachedResult}function tl(e,t){const n=yt(),r=Vp[n];let o=e,s=t,a=o*s;const i=o>s?s/o:o/s;for(;a>r*r;){const h=(r+o)/2,f=(r+s)/2;h<f?(s=f,o=f*i):(s=h*i,o=h),a=o*s}return{width:o,height:s}}function Jn(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function nl(e,t){const{width:n,height:r}=tl(e.width,e.height),[o,s]=Jn(n,r);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,o.width,o.height)),s.drawImage(e,0,0,o.width,o.height),o}function _n(){return _n.cachedResult!==void 0||(_n.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),_n.cachedResult}function $n(e,t={}){return new Promise((function(n,r){let o,s;var a=function(){try{return s=nl(o,t.fileType||e.type),n([o,s])}catch(h){return r(h)}},i=function(h){try{var f=function(c){try{throw c}catch(l){return r(l)}};try{let c;return Ji(e).then((function(l){try{return c=l,el(c).then((function(u){try{return o=u,(function(){try{return a()}catch(p){return r(p)}})()}catch(p){return f(p)}}),f)}catch(u){return f(u)}}),f)}catch(c){f(c)}}catch(c){return r(c)}};try{if(_n()||[ke.DESKTOP_SAFARI,ke.MOBILE_SAFARI].includes(yt()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(h){try{return o=h,a()}catch{return i()}}),i)}catch{i()}}))}function Fn(e,t,n,r,o=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,c,l;return f=e.getContext("2d"),{data:c}=f.getImageData(0,0,e.width,e.height),l=Pe.encode([c.buffer],e.width,e.height,4096*o),i=new Blob([l],{type:t}),i.name=n,i.lastModified=r,h.call(this)}{let f=function(){return h.call(this)};if(t==="image/bmp")return new Promise((c=>Xi.toBlob(e,c))).then((function(c){try{return i=c,i.name=n,i.lastModified=r,f.call(this)}catch(l){return a(l)}}).bind(this),a);{let c=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then((function(l){try{return i=l,i.name=n,i.lastModified=r,c.call(this)}catch(u){return a(u)}}).bind(this),a);{let l;return l=e.toDataURL(t,o),_o(l,n,r).then((function(u){try{return i=u,c.call(this)}catch(p){return a(p)}}).bind(this),a)}}}function h(){return s(i)}}))}function Ue(e){e.width=0,e.height=0}function Mt(){return new Promise((function(e,t){let n,r,o,s;return Mt.cachedResult!==void 0?e(Mt.cachedResult):_o("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,$n(n).then((function(i){try{return r=i[1],Fn(r,n.type,n.name,n.lastModified).then((function(h){try{return o=h,Ue(r),$n(o).then((function(f){try{return s=f[0],Mt.cachedResult=s.width===1&&s.height===2,e(Mt.cachedResult)}catch(c){return t(c)}}),t)}catch(f){return t(f)}}),t)}catch(h){return t(h)}}),t)}catch(i){return t(i)}}),t)}))}function rl(e){return new Promise(((t,n)=>{const r=new Zi;r.onload=o=>{const s=new DataView(o.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const h=s.getUint16(i,!1);if(i+=2,h==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const c=s.getUint16(i,f);i+=2;for(let l=0;l<c;l++)if(s.getUint16(i+12*l,f)==274)return t(s.getUint16(i+12*l+8,f))}else{if((65280&h)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},r.onerror=o=>n(o),r.readAsArrayBuffer(e)}))}function ol(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:o}=t;let s,a=e;return isFinite(o)&&(n>o||r>o)&&([a,s]=Jn(n,r),n>r?(a.width=o,a.height=r/n*o):(a.width=n/r*o,a.height=o),s.drawImage(e,0,0,a.width,a.height),Ue(e)),a}function sl(e,t){const{width:n}=e,{height:r}=e,[o,s]=Jn(n,r);switch(t>4&&t<9?(o.width=r,o.height=n):(o.width=n,o.height=r),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,r);break;case 4:s.transform(1,0,0,-1,0,r);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,r,0);break;case 7:s.transform(0,-1,-1,0,r,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,r),Ue(e),o}function vs(e,t,n=0){return new Promise((function(r,o){let s,a,i,h,f,c,l,u,p,g,v,w,b,A,R,S,L,k,N,x;function y(P=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=P,t.onProgress(Math.min(s,100))}function j(P){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(P,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),$n(e,t).then((function(P){try{return[,h]=P,y(),f=ol(h,t),y(),new Promise((function(O,F){var M;if(!(M=t.exifOrientation))return rl(e).then((function(E){try{return M=E,U.call(this)}catch(C){return F(C)}}).bind(this),F);function U(){return O(M)}return U.call(this)})).then((function(O){try{return c=O,y(),Mt().then((function(F){try{return l=F?f:sl(f,c),y(),u=t.initialQuality||1,p=t.fileType||e.type,Fn(l,p,e.name,e.lastModified,u).then((function(M){try{{let E=function(){if(a--&&(R>i||R>b)){let D,_;return D=x?.95*N.width:N.width,_=x?.95*N.height:N.height,[L,k]=Jn(D,_),k.drawImage(N,0,0,D,_),u*=p==="image/png"?.85:.95,Fn(L,p,e.name,e.lastModified,u).then((function(I){try{return S=I,Ue(N),N=L,R=S.size,j(Math.min(99,Math.floor((A-R)/(A-i)*100))),E}catch(W){return o(W)}}),o)}return[1]},C=function(){return Ue(N),Ue(L),Ue(f),Ue(l),Ue(h),j(100),r(S)};if(g=M,y(),v=g.size>i,w=g.size>e.size,!v&&!w)return j(100),r(g);var U;return b=e.size,A=g.size,R=A,N=l,x=!t.alwaysKeepResolution&&v,(U=(function(D){for(;D;){if(D.then)return void D.then(U,o);try{if(D.pop){if(D.length)return D.pop()?C.call(this):D;D=E}else D=D.call(this)}catch(_){return o(_)}}}).bind(this))(E)}}catch(E){return o(E)}}).bind(this),o)}catch(M){return o(M)}}).bind(this),o)}catch(F){return o(F)}}).bind(this),o)}catch(O){return o(O)}}).bind(this),o)}))}const Kp=`
232
- let scriptImported = false
233
- self.addEventListener('message', async (e) => {
234
- const { file, id, imageCompressionLibUrl, options } = e.data
235
- options.onProgress = (progress) => self.postMessage({ progress, id })
236
- try {
237
- if (!scriptImported) {
238
- // console.log('[worker] importScripts', imageCompressionLibUrl)
239
- self.importScripts(imageCompressionLibUrl)
240
- scriptImported = true
241
- }
242
- // console.log('[worker] self', self)
243
- const compressedFile = await imageCompression(file, options)
244
- self.postMessage({ file: compressedFile, id })
245
- } catch (e) {
246
- // console.error('[worker] error', e)
247
- self.postMessage({ error: e.message + '\\n' + e.stack, id })
248
- }
249
- })
250
- `;let xr;function qp(e,t){return new Promise(((n,r)=>{xr||(xr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Kp));const o=new Worker(xr);o.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)o.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void o.terminate();n(a.data.file),o.terminate()}else t.onProgress(a.data.progress)})),o.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ye(e,t){return new Promise((function(n,r){let o,s,a,i,h,f;if(o={...t},a=0,{onProgress:i}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,h=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=p=>{a=p,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Gp))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!h||typeof Worker!="function"||f)return vs(e,o).then((function(p){try{return s=p,u.call(this)}catch(g){return r(g)}}).bind(this),r);var c=(function(){try{return u.call(this)}catch(p){return r(p)}}).bind(this),l=function(p){try{return vs(e,o).then((function(g){try{return s=g,c()}catch(v){return r(v)}}),r)}catch(g){return r(g)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",qp(e,o).then((function(p){try{return s=p,c()}catch{return l()}}),l)}catch{l()}function u(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(s=Yi(e,s))}catch{}return n(s)}}))}ye.getDataUrlFromFile=Ji,ye.getFilefromDataUrl=_o,ye.loadImage=el,ye.drawImageInCanvas=nl,ye.drawFileInCanvas=$n,ye.canvasToFile=Fn,ye.getExifOrientation=rl,ye.handleMaxWidthOrHeight=ol,ye.followExifOrientation=sl,ye.cleanupCanvasMemory=Ue,ye.isAutoOrientationInBrowser=Mt,ye.approximateBelowMaximumCanvasSizeOfBrowser=tl,ye.copyExifWithoutOrientation=Yi,ye.getBrowserName=yt,ye.version="2.0.2";var Yp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ut=Yp.reduce((e,t)=>{const n=ca(`Primitive.${t}`),r=m.forwardRef((o,s)=>{const{asChild:a,...i}=o,h=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(h,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Xp=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Qp="VisuallyHidden",al=m.forwardRef((e,t)=>d.jsx(ue.span,{...e,ref:t,style:{...Xp,...e.style}}));al.displayName=Qp;var Zp=al,[er]=Qe("Tooltip",[Ht]),tr=Ht(),il="TooltipProvider",Jp=700,Fr="tooltip.open",[eg,Eo]=er(il),ll=e=>{const{__scopeTooltip:t,delayDuration:n=Jp,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,a=m.useRef(!0),i=m.useRef(!1),h=m.useRef(0);return m.useEffect(()=>{const f=h.current;return()=>window.clearTimeout(f)},[]),d.jsx(eg,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(h.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:m.useCallback(f=>{i.current=f},[]),disableHoverableContent:o,children:s})};ll.displayName=il;var nn="Tooltip",[tg,mn]=er(nn),cl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,h=Eo(nn,e.__scopeTooltip),f=tr(t),[c,l]=m.useState(null),u=Ce(),p=m.useRef(0),g=a??h.disableHoverableContent,v=i??h.delayDuration,w=m.useRef(!1),[b,A]=at({prop:r,defaultProp:o??!1,onChange:N=>{N?(h.onOpen(),document.dispatchEvent(new CustomEvent(Fr))):h.onClose(),s==null||s(N)},caller:nn}),R=m.useMemo(()=>b?w.current?"delayed-open":"instant-open":"closed",[b]),S=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,A(!0)},[A]),L=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,A(!1)},[A]),k=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,A(!0),p.current=0},v)},[v,A]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),d.jsx(io,{...f,children:d.jsx(tg,{scope:t,contentId:u,open:b,stateAttribute:R,trigger:c,onTriggerChange:l,onTriggerEnter:m.useCallback(()=>{h.isOpenDelayedRef.current?k():S()},[h.isOpenDelayedRef,k,S]),onTriggerLeave:m.useCallback(()=>{g?L():(window.clearTimeout(p.current),p.current=0)},[L,g]),onOpen:S,onClose:L,disableHoverableContent:g,children:n})})};cl.displayName=nn;var Ur="TooltipTrigger",dl=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=mn(Ur,n),s=Eo(Ur,n),a=tr(n),i=m.useRef(null),h=pe(t,i,o.onTriggerChange),f=m.useRef(!1),c=m.useRef(!1),l=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",l),[l]),d.jsx(Kn,{asChild:!0,...a,children:d.jsx(ue.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:h,onPointerMove:ee(e.onPointerMove,u=>{u.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:ee(e.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:ee(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",l,{once:!0})}),onFocus:ee(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:ee(e.onBlur,o.onClose),onClick:ee(e.onClick,o.onClose)})})});dl.displayName=Ur;var No="TooltipPortal",[ng,rg]=er(No,{forceMount:void 0}),ul=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=mn(No,t);return d.jsx(ng,{scope:t,forceMount:n,children:d.jsx(Ae,{present:n||s.open,children:d.jsx(dn,{asChild:!0,container:o,children:r})})})};ul.displayName=No;var Ft="TooltipContent",fl=m.forwardRef((e,t)=>{const n=rg(Ft,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,a=mn(Ft,e.__scopeTooltip);return d.jsx(Ae,{present:r||a.open,children:a.disableHoverableContent?d.jsx(hl,{side:o,...s,ref:t}):d.jsx(og,{side:o,...s,ref:t})})}),og=m.forwardRef((e,t)=>{const n=mn(Ft,e.__scopeTooltip),r=Eo(Ft,e.__scopeTooltip),o=m.useRef(null),s=pe(t,o),[a,i]=m.useState(null),{trigger:h,onClose:f}=n,c=o.current,{onPointerInTransitChange:l}=r,u=m.useCallback(()=>{i(null),l(!1)},[l]),p=m.useCallback((g,v)=>{const w=g.currentTarget,b={x:g.clientX,y:g.clientY},A=lg(b,w.getBoundingClientRect()),R=cg(b,A),S=dg(v.getBoundingClientRect()),L=fg([...R,...S]);i(L),l(!0)},[l]);return m.useEffect(()=>()=>u(),[u]),m.useEffect(()=>{if(h&&c){const g=w=>p(w,c),v=w=>p(w,h);return h.addEventListener("pointerleave",g),c.addEventListener("pointerleave",v),()=>{h.removeEventListener("pointerleave",g),c.removeEventListener("pointerleave",v)}}},[h,c,p,u]),m.useEffect(()=>{if(a){const g=v=>{const w=v.target,b={x:v.clientX,y:v.clientY},A=(h==null?void 0:h.contains(w))||(c==null?void 0:c.contains(w)),R=!ug(b,a);A?u():R&&(u(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[h,c,a,f,u]),d.jsx(hl,{...e,ref:s})}),[sg,ag]=er(nn,{isInside:!1}),ig=Pu("TooltipContent"),hl=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,h=mn(Ft,n),f=tr(n),{onClose:c}=h;return m.useEffect(()=>(document.addEventListener(Fr,c),()=>document.removeEventListener(Fr,c)),[c]),m.useEffect(()=>{if(h.trigger){const l=u=>{const p=u.target;p!=null&&p.contains(h.trigger)&&c()};return window.addEventListener("scroll",l,{capture:!0}),()=>window.removeEventListener("scroll",l,{capture:!0})}},[h.trigger,c]),d.jsx(ln,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l=>l.preventDefault(),onDismiss:c,children:d.jsxs(lo,{"data-state":h.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(ig,{children:r}),d.jsx(sg,{scope:n,isInside:!0,children:d.jsx(Zp,{id:h.contentId,role:"tooltip",children:o||r})})]})})});fl.displayName=Ft;var ml="TooltipArrow",pl=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=tr(n);return ag(ml,n).isInside?null:d.jsx(co,{...o,...r,ref:t})});pl.displayName=ml;function lg(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function cg(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function dg(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function ug(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],h=t[a],f=i.x,c=i.y,l=h.x,u=h.y;c>r!=u>r&&n<(l-f)*(r-c)/(u-c)+f&&(o=!o)}return o}function fg(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),hg(t)}function hg(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var mg=ll,pg=cl,gg=dl,xg=ul,vg=fl,yg=pl;function bg({delayDuration:e=0,...t}){return d.jsx(mg,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function wg({...e}){return d.jsx(bg,{children:d.jsx(pg,{"data-slot":"tooltip",...e})})}function Cg({...e}){return d.jsx(gg,{"data-slot":"tooltip-trigger",...e})}function Sg({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(xg,{children:d.jsxs(vg,{"data-slot":"tooltip-content",sideOffset:t,className:Z("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,d.jsx(yg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const kg=m.lazy(()=>on(()=>import("./mermaid-VLURNSYL-DNkiWsfz.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));m.createContext(null);const jo=m.memo(({className:e,children:t,...n})=>d.jsx(m.Suspense,{fallback:d.jsx("div",{className:Z("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(kg,{className:Z("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);jo.displayName="MessageResponse";var nr="Collapsible",[_g]=Qe(nr),[Eg,Ao]=_g(nr),gl=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...i}=e,[h,f]=at({prop:r,defaultProp:o??!1,onChange:a,caller:nr});return d.jsx(Eg,{scope:n,disabled:s,contentId:Ce(),open:h,onOpenToggle:m.useCallback(()=>f(c=>!c),[f]),children:d.jsx(ue.div,{"data-state":To(h),"data-disabled":s?"":void 0,...i,ref:t})})});gl.displayName=nr;var xl="CollapsibleTrigger",vl=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ao(xl,n);return d.jsx(ue.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":To(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ee(e.onClick,o.onOpenToggle)})});vl.displayName=xl;var Ro="CollapsibleContent",yl=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ao(Ro,e.__scopeCollapsible);return d.jsx(Ae,{present:n||o.open,children:({present:s})=>d.jsx(Ng,{...r,ref:t,present:s})})});yl.displayName=Ro;var Ng=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=Ao(Ro,n),[i,h]=m.useState(r),f=m.useRef(null),c=pe(t,f),l=m.useRef(0),u=l.current,p=m.useRef(0),g=p.current,v=a.open||i,w=m.useRef(v),b=m.useRef(void 0);return m.useEffect(()=>{const A=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(A)},[]),Ke(()=>{const A=f.current;if(A){b.current=b.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const R=A.getBoundingClientRect();l.current=R.height,p.current=R.width,w.current||(A.style.transitionDuration=b.current.transitionDuration,A.style.animationName=b.current.animationName),h(r)}},[a.open,r]),d.jsx(ue.div,{"data-state":To(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:c,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&o})});function To(e){return e?"open":"closed"}var jg=gl;function Ag({...e}){return d.jsx(jg,{"data-slot":"collapsible",...e})}function Rg({...e}){return d.jsx(vl,{"data-slot":"collapsible-trigger",...e})}function Tg({...e}){return d.jsx(yl,{"data-slot":"collapsible-content",...e})}const Ig=({children:e,as:t="p",className:n,duration:r=2})=>{const o=ac.create(t);return d.jsx(o,{animate:{opacity:[.5,1,.5]},className:Z("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},Mg=m.memo(Ig),bl=m.createContext(null),Pg=()=>{const e=m.useContext(bl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Og=1e3,Dg=1e3,wl=m.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:o,duration:s,children:a,...i})=>{const[h,f]=at({prop:n,defaultProp:r,onChange:o}),[c,l]=at({prop:s,defaultProp:void 0}),[u,p]=m.useState(!1),[g,v]=m.useState(null);m.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(l(Math.ceil((Date.now()-g)/Dg)),v(null))},[t,g,l]);const w=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;m.useEffect(()=>{if(!w&&r&&!t&&h&&!u){const A=setTimeout(()=>{f(!1),p(!0)},Og);return()=>clearTimeout(A)}},[t,h,r,f,u,w]);const b=A=>{f(A)};return d.jsx(bl.Provider,{value:{isStreaming:t,isOpen:h??!1,setIsOpen:f,duration:c},children:d.jsx(Ag,{className:Z("not-prose mb-4",e),onOpenChange:b,open:h,...i,children:a})})}),Lg=(e,t)=>e||t===0?d.jsx(Mg,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),Cl=m.memo(({className:e,children:t,getThinkingMessage:n=Lg,...r})=>{const{isStreaming:o,isOpen:s,duration:a}=Pg();return d.jsx(Rg,{className:Z("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??d.jsxs(d.Fragment,{children:[d.jsx(cd,{className:"size-4"}),n(o,a),d.jsx(sn,{className:Z("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),Sl=m.memo(({className:e,children:t,...n})=>d.jsx(Tg,{className:Z("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));wl.displayName="Reasoning";Cl.displayName="ReasoningTrigger";Sl.displayName="ReasoningContent";const vr=200;function $g({entry:e}){const[t,n]=m.useState(!1),[r,o]=m.useState(!1),s=m.useRef(null),a=m.useCallback(()=>{const i=s.current;i&&o(i.scrollHeight>vr+4)},[]);return m.useEffect(()=>{a()},[a,e.content]),d.jsx("div",{className:"flex justify-end",children:d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,h)=>d.jsx(Ug,{image:i},h))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,h)=>d.jsx(zg,{attachment:i},h))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:s,className:Z("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&r&&`max-h-[${vr}px]`),style:!t&&r?{maxHeight:`${vr}px`}:void 0,children:Zc(e.content)}),!t&&r&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:"展开"}),d.jsx(sn,{className:"h-3 w-3"})]})})]})]})})}function Fg({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,r)=>{if(n.type==="thought"){const o=r===e.chunks.length-1,s=t&&o;return d.jsxs(wl,{isStreaming:s,children:[d.jsx(Cl,{}),d.jsx(Sl,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(jo,{children:n.text})},r)})]})]})}function Ug({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function zg({attachment:e}){const[t,n]=m.useState(!1),r=(()=>{switch(e.kind){case"text":return d.jsx(Zt,{className:"h-4 w-4"});case"table":return d.jsx(Qr,{className:"h-4 w-4"});case"directory":return d.jsx(Yr,{className:"h-4 w-4"});default:return d.jsx(Zt,{className:"h-4 w-4"})}})(),o=e.size!=null?Bg(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:Z("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[r,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[o&&d.jsx("span",{children:o}),o&&s!=null&&d.jsx("span",{children:" · "}),s!=null&&d.jsxs("span",{children:[s," 个文件"]})]})]}),a&&d.jsx(sn,{className:Z("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Bg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Wg(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Hg(e){switch(e){case"allow_once":case"allow_always":return d.jsx(wt,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx(an,{className:"size-4"});default:return null}}function Vg({requestId:e,options:t,onRespond:n,className:r}){const o=s=>{n(e,s.optionId,s.kind)};return d.jsxs("div",{className:Z("p-3 border-t border-warning-border/30 bg-warning-bg/50",r),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(Xr,{className:"size-4 text-warning-text"}),d.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>d.jsxs(Et,{variant:Wg(s.kind),size:"sm",onClick:()=>o(s),className:"gap-1.5",children:[Hg(s.kind),s.name]},s.optionId))})]})}function kl({entries:e,onPermissionRespond:t}){const[n,r]=m.useState(!1);if(e.length===0)return null;if(e.length===1)return d.jsx("div",{className:"pl-10",children:d.jsx(ys,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const o=Gg(e);return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>r(!n),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted",n&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs text-brand font-bold font-display",children:o})]}),n&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>d.jsx(ys,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function ys({tool:e,compact:t,onPermissionRespond:n}){const[r,o]=m.useState(!t),s=(()=>{switch(e.status){case"running":return d.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return d.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return d.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return d.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=e.status!=="running"&&e.status!=="waiting_for_confirmation"&&(e.rawOutput||e.content);return d.jsxs("div",{className:Z("px-3 py-2",t&&"py-1.5"),children:[d.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>o(!r),children:[s,d.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&d.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&d.jsx("div",{className:"mt-1.5 ml-4",children:d.jsx(Vg,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),r&&d.jsxs("div",{className:"mt-1.5 ml-4 space-y-1.5",children:[e.rawInput&&Object.keys(e.rawInput).length>0&&d.jsx("div",{children:d.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:zr(JSON.stringify(e.rawInput,null,2),2e3)})}),a&&d.jsx("div",{children:d.jsx("pre",{className:Z("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:qg(e)})})]})]})}function Gg(e){const t=new Map;for(const r of e){const o=Kg(r.toolCall.title);t.set(o,(t.get(o)||0)+1)}const n=[];for(const[r,o]of t)n.push(o===1?r:`${o} 次${r}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function Kg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function qg(e){if(e.content&&e.content.length>0){const t=e.content.filter(n=>n.type==="content").filter(n=>n.content.type==="text"&&"text"in n.content).map(n=>n.content.text);if(t.length>0)return zr(t.join(`
251
- `),2e3)}return e.rawOutput&&Object.keys(e.rawOutput).length>0?zr(JSON.stringify(e.rawOutput,null,2),2e3):""}function zr(e,t){return e.length>t?e.slice(0,t)+"...":e}function Yg({entry:e}){const[t,n]=m.useState(!1),{entries:r}=e;if(r.length===0)return null;const o=r.filter(i=>i.status==="completed").length,s=r.length,a=s>0?Math.round(o/s*100):0;return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[o,"/",s]}),d.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:d.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&d.jsx("div",{className:Z("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:r.map((i,h)=>d.jsx(Xg,{entry:i},h))})]})})}function Xg({entry:e}){return d.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[d.jsx("span",{className:"flex-shrink-0 mt-0.5",children:d.jsx(Qg,{status:e.status})}),d.jsx("span",{className:Z("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),d.jsx(Zg,{priority:e.priority})]})}function Qg({status:e}){switch(e){case"completed":return d.jsx(gd,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return d.jsx(ea,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return d.jsx(vd,{className:"h-3.5 w-3.5 text-text-muted"})}}function Zg({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return d.jsx("span",{className:Z("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Jg({entry:e}){const t=e.variant==="error";return d.jsxs("div",{className:"w-full",children:[d.jsx("div",{className:Z("border-t-2",t?"border-status-error":"border-border")}),d.jsxs("div",{className:"pt-3",children:[d.jsx("h3",{className:Z("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&d.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),d.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:d.jsx(jo,{children:e.outputText})}),d.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
252
- * Copyright (c) StackBlitz. All rights reserved.
253
- * Licensed under the MIT License. See License.txt in the project root for license information.
254
- *--------------------------------------------------------------------------------------------*/const ex={damping:.7,stiffness:.05,mass:1.25},tx=70,nx=1e3/60,rx=350;let rr=!1;var Rs;(Rs=globalThis.document)==null||Rs.addEventListener("mousedown",()=>{rr=!0});var Ts;(Ts=globalThis.document)==null||Ts.addEventListener("mouseup",()=>{rr=!1});var Is;(Is=globalThis.document)==null||Is.addEventListener("click",()=>{rr=!1});const ox=(e={})=>{const[t,n]=m.useState(!1),[r,o]=m.useState(e.initial!==!1),[s,a]=m.useState(!1),i=m.useRef(null);i.current=e;const h=m.useCallback(()=>{var S;if(!rr)return!1;const A=window.getSelection();if(!A||!A.rangeCount)return!1;const R=A.getRangeAt(0);return R.commonAncestorContainer.contains(w.current)||((S=w.current)==null?void 0:S.contains(R.commonAncestorContainer))},[]),f=m.useCallback(A=>{l.isAtBottom=A,o(A)},[]),c=m.useCallback(A=>{l.escapedFromLock=A,n(A)},[]),l=m.useMemo(()=>{let A;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var R;return((R=w.current)==null?void 0:R.scrollTop)??0},set scrollTop(R){if(w.current){const{scrollBehavior:S}=getComputedStyle(w.current);S!=="auto"&&(w.current.style.scrollBehavior="auto"),w.current.scrollTop=R,l.ignoreScrollToTop=w.current.scrollTop,S!=="auto"&&(w.current.style.scrollBehavior=S)}},get targetScrollTop(){return!w.current||!b.current?0:w.current.scrollHeight-1-w.current.clientHeight},get calculatedTargetScrollTop(){if(!w.current||!b.current)return 0;const{targetScrollTop:R}=this;if(!e.targetScrollTop)return R;if((A==null?void 0:A.targetScrollTop)===R)return A.calculatedScrollTop;const S=Math.max(Math.min(e.targetScrollTop(R,{scrollElement:w.current,contentElement:b.current}),R),0);return A={targetScrollTop:R,calculatedScrollTop:S},requestAnimationFrame(()=>{A=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=tx}}},[]),u=m.useCallback((A={})=>{var y;typeof A=="string"&&(A={animation:A}),A.preserveScrollPosition||f(!0);const R=Date.now()+(Number(A.wait)||0),S=br(i.current,A.animation),{ignoreEscapes:L=!1}=A;let k,N=l.calculatedTargetScrollTop;A.duration instanceof Promise?A.duration.finally(()=>{k=Date.now()}):k=R+(A.duration??0);const x=async()=>{const j=new Promise(requestAnimationFrame).then(()=>{var M;if(!l.isAtBottom)return l.animation=void 0,!1;const{scrollTop:P}=l,O=performance.now(),F=(O-(l.lastTick??O))/nx;if(l.animation||(l.animation={behavior:S,promise:j,ignoreEscapes:L}),l.animation.behavior===S&&(l.lastTick=O),h()||R>Date.now())return x();if(P<Math.min(N,l.calculatedTargetScrollTop)){if(((M=l.animation)==null?void 0:M.behavior)===S){if(S==="instant")return l.scrollTop=l.calculatedTargetScrollTop,x();l.velocity=(S.damping*l.velocity+S.stiffness*l.scrollDifference)/S.mass,l.accumulated+=l.velocity*F,l.scrollTop+=l.accumulated,l.scrollTop!==P&&(l.accumulated=0)}return x()}return k>Date.now()?(N=l.calculatedTargetScrollTop,x()):(l.animation=void 0,l.scrollTop<l.calculatedTargetScrollTop?u({animation:br(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,k-Date.now())||void 0}):l.isAtBottom)});return j.then(P=>(requestAnimationFrame(()=>{l.animation||(l.lastTick=void 0,l.velocity=0)}),P))};return A.wait!==!0&&(l.animation=void 0),((y=l.animation)==null?void 0:y.behavior)===S?l.animation.promise:x()},[f,h,l]),p=m.useCallback(()=>{c(!0),f(!1)},[c,f]),g=m.useCallback(({target:A})=>{if(A!==w.current)return;const{scrollTop:R,ignoreScrollToTop:S}=l;let{lastScrollTop:L=R}=l;l.lastScrollTop=R,l.ignoreScrollToTop=void 0,S&&S>R&&(L=S),a(l.isNearBottom),setTimeout(()=>{var x;if(l.resizeDifference||R===S)return;if(h()){c(!0),f(!1);return}const k=R>L,N=R<L;if((x=l.animation)!=null&&x.ignoreEscapes){l.scrollTop=L;return}N&&(c(!0),f(!1)),k&&c(!1),!l.escapedFromLock&&l.isNearBottom&&f(!0)},1)},[c,f,h,l]),v=m.useCallback(({target:A,deltaY:R})=>{var L;let S=A;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===w.current&&R<0&&w.current.scrollHeight>w.current.clientHeight&&!((L=l.animation)!=null&&L.ignoreEscapes)&&(c(!0),f(!1))},[c,f,l]),w=bs(A=>{var R,S;(R=w.current)==null||R.removeEventListener("scroll",g),(S=w.current)==null||S.removeEventListener("wheel",v),A==null||A.addEventListener("scroll",g,{passive:!0}),A==null||A.addEventListener("wheel",v,{passive:!0})},[]),b=bs(A=>{var S,L;if((S=l.resizeObserver)==null||S.disconnect(),!A)return;let R;l.resizeObserver=new ResizeObserver(([k])=>{const{height:N}=k.contentRect,x=N-(R??N);if(l.resizeDifference=x,l.scrollTop>l.targetScrollTop&&(l.scrollTop=l.targetScrollTop),a(l.isNearBottom),x>=0){const y=br(i.current,R?i.current.resize:i.current.initial);u({animation:y,wait:!0,preserveScrollPosition:!0,duration:y==="instant"?void 0:rx})}else l.isNearBottom&&(c(!1),f(!0));R=N,requestAnimationFrame(()=>{setTimeout(()=>{l.resizeDifference===x&&(l.resizeDifference=0)},1)})}),(L=l.resizeObserver)==null||L.observe(A)},[]);return{contentRef:b,scrollRef:w,scrollToBottom:u,stopScroll:p,isAtBottom:r||s,isNearBottom:s,escapedFromLock:t,state:l}};function bs(e,t){const n=m.useCallback(r=>(n.current=r,e(r)),t);return n}const yr=new Map;function br(...e){const t={...ex};let n=!1;for(const o of e){if(o==="instant"){n=!0;continue}typeof o=="object"&&(n=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const r=JSON.stringify(t);return yr.has(r)||yr.set(r,Object.freeze(t)),n?"instant":yr.get(r)}/*!---------------------------------------------------------------------------------------------
255
- * Copyright (c) StackBlitz. All rights reserved.
256
- * Licensed under the MIT License. See License.txt in the project root for license information.
257
- *--------------------------------------------------------------------------------------------*/const _l=m.createContext(null),sx=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Un({instance:e,children:t,resize:n,initial:r,mass:o,damping:s,stiffness:a,targetScrollTop:i,contextRef:h,...f}){const c=m.useRef(null),l=m.useCallback((L,k)=>{const N=(S==null?void 0:S.targetScrollTop)??i;return(N==null?void 0:N(L,k))??L},[i]),u=ox({mass:o,damping:s,stiffness:a,resize:n,initial:r,targetScrollTop:l}),{scrollRef:p,contentRef:g,scrollToBottom:v,stopScroll:w,isAtBottom:b,escapedFromLock:A,state:R}=e??u,S=m.useMemo(()=>({scrollToBottom:v,stopScroll:w,scrollRef:p,isAtBottom:b,escapedFromLock:A,contentRef:g,state:R,get targetScrollTop(){return c.current},set targetScrollTop(L){c.current=L}}),[v,b,g,p,w,A,R]);return m.useImperativeHandle(h,()=>S,[S]),sx(()=>{p.current&&getComputedStyle(p.current).overflow==="visible"&&(p.current.style.overflow="auto")},[]),m.createElement(_l.Provider,{value:S},m.createElement("div",{...f},typeof t=="function"?t(S):t))}(function(e){function t({children:n,scrollClassName:r,...o}){const s=Io();return m.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},m.createElement("div",{...o,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Un||(Un={}));function Io(){const e=m.useContext(_l);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const ax=({className:e,...t})=>d.jsx(Un,{className:Z("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),ix=({className:e,...t})=>d.jsx(Un.Content,{className:Z("mx-auto flex max-w-3xl flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),lx=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:r,children:o,...s})=>d.jsx("div",{className:Z("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:o??d.jsxs(d.Fragment,{children:[r&&d.jsx("div",{className:"text-text-muted",children:r}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),cx=({className:e,...t})=>{const{scrollToBottom:n}=Io(),r=m.useCallback(()=>{n()},[n]);return d.jsx(Et,{className:Z("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(id,{className:"size-4"})})},dx="data-last-user-message",ux=({className:e,...t})=>{const n=m.useCallback(()=>{const r=document.querySelector(`[${dx}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(Et,{className:Z("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(oa,{className:"size-4"})})},fx=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Io();return r?null:d.jsxs("div",{className:Z("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(ux,{}),d.jsx(cx,{})]})};function hx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r="开始对话",emptyDescription:o="输入消息开始聊天"}){var h;const s=gx(e),a=e.length>0,i=t&&e.length>0&&((h=e[e.length-1])==null?void 0:h.type)==="user_message";return d.jsx(ax,{className:"flex-1",children:d.jsxs(ix,{children:[a?d.jsxs(d.Fragment,{children:[s.map((f,c)=>f.type==="single"?d.jsx("div",{className:Z(mx(e,c)),children:d.jsx(px,{entry:f.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`):d.jsx("div",{className:"-mt-2",children:d.jsx(kl,{entries:f.entries,onPermissionRespond:n})},`group-${c}`)),i&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx("div",{className:"flex items-center gap-1 pt-2",children:d.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{})]})})]})]}):d.jsx(lx,{title:r,description:o}),d.jsx(fx,{hasUserMessages:e.some(f=>f.type==="user_message")})]})})}function mx(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const r=e[t+1];return(r==null?void 0:r.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function px({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return d.jsx($g,{entry:e});case"assistant_message":return d.jsx(Fg,{entry:e,isStreaming:t});case"tool_call":return d.jsx(kl,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(Yg,{entry:e});case"command_output":return d.jsx(Jg,{entry:e});default:return null}}function gx(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const o of e)o.type==="tool_call"?n.push(o):(r(),t.push({type:"single",entry:o}));return r(),t}function xx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function vx({commands:e,filter:t,onSelect:n,onClose:r,className:o}){const s=m.useRef(null),[a,i]=m.useState(0),h=m.useMemo(()=>t?e.filter(f=>xx(t,f.name)):e,[e,t]);return m.useEffect(()=>{i(0)},[t]),m.useEffect(()=>{const f=c=>{s.current&&!s.current.contains(c.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),m.useEffect(()=>{const f=c=>{if(h.length!==0){if(c.key==="ArrowDown")c.preventDefault(),i(l=>(l+1)%h.length);else if(c.key==="ArrowUp")c.preventDefault(),i(l=>(l-1+h.length)%h.length);else if(c.key==="Enter"&&!c.shiftKey){c.preventDefault();const l=h[a];l&&n(l)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[h,a,n]),m.useEffect(()=>{const f=s.current;if(!f)return;const c=f.querySelector("[data-active='true']");c==null||c.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:s,className:Z("rounded-xl border border-border bg-surface-2 shadow-lg",o),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:h.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):h.map((f,c)=>{var l;return d.jsxs("button",{type:"button","data-active":c===a,onClick:()=>n(f),onMouseEnter:()=>i(c),className:Z("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",c===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((l=f.input)==null?void 0:l.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function bt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const yx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},bx=500*1024,El=2*1024*1024,wr=200,ws=5*1024*1024,wx=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),Cx=new Set([".csv",".tsv",".xlsx",".xls"]);function rn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Nl(e){if(e.type.startsWith("text/"))return!0;const t=rn(e.name);return wx.has(t)}function Br(e){const t=rn(e.name);return Cx.has(t)}function Sx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:o="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,className:h}){const f=s??a??!1,[c,l]=m.useState(""),[u,p]=m.useState([]),[g,v]=m.useState([]),[w,b]=m.useState(!1),[A,R]=m.useState(""),[S,L]=m.useState(!1),[k,N]=m.useState(!1),[x,y]=m.useState(!1),j=m.useRef(null),P=m.useRef(null),O=m.useRef(null),F=m.useRef(null),M=m.useRef(null),U=m.useRef(null),E=m.useRef(null);m.useEffect(()=>{bt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:f,commandsCount:(i==null?void 0:i.length)??0})},[f,i]),m.useEffect(()=>{if(!k)return;const H=q=>{var oe,he;const J=q.target,te=(oe=U.current)==null?void 0:oe.contains(J),ie=(he=E.current)==null?void 0:he.contains(J);!te&&!ie&&N(!1)};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[k]);const C=m.useCallback(H=>{const q=(H??c).trim(),J=u.length>0||g.length>0;!q&&!J||r||x||(e({text:q,images:u.length>0?u:void 0,attachments:g.length>0?g:void 0}),l(""),p([]),v([]),b(!1),R(""),j.current&&(j.current.style.height="auto"))},[c,u,g,r,x,e]),D=m.useCallback(H=>{if(w){if(H.key==="Escape"){H.preventDefault(),b(!1);return}if(H.key==="ArrowUp"||H.key==="ArrowDown"||H.key==="Enter"){H.preventDefault();return}if(H.key==="Tab"){H.preventDefault(),b(!1);return}}H.key==="Enter"&&!H.shiftKey&&!H.nativeEvent.isComposing&&(H.preventDefault(),t?n==null||n():C())},[C,t,n,w]),_=m.useCallback(H=>{const q=H.target.value;l(q),q.startsWith("/")&&i&&i.length>0?(b(!0),R(q.slice(1).split(/\s/)[0]||"")):w&&(b(!1),R(""));const J=H.target;J.style.height="auto",J.style.height=Math.min(J.scrollHeight,200)+"px"},[i,w]),I=m.useCallback(async H=>{if(bt("[ChatInput] paste event",{canAttach:f,files:H.clipboardData.files.length,types:H.clipboardData.types}),!f)return;const q=Array.from(H.clipboardData.files).filter(J=>J.type.startsWith("image/"));if(bt("[ChatInput] paste image files",{count:q.length,types:q.map(J=>J.type)}),q.length!==0){H.preventDefault(),y(!0);try{const J=await Cr(q);p(te=>[...te,...J])}finally{y(!1)}}},[f]),W=m.useCallback(async()=>{if(!P.current)return;const H=P.current.files;if(!(!H||H.length===0)){y(!0);try{const q=await Cr(Array.from(H));p(J=>[...J,...q])}finally{P.current.value="",y(!1)}}},[]),T=m.useCallback(async()=>{if(!O.current)return;const H=O.current.files;if(!(!H||H.length===0)){y(!0);try{const q=await Cs(Array.from(H));v(J=>[...J,...q])}finally{O.current.value="",y(!1)}}},[]),B=m.useCallback(async()=>{if(!F.current)return;const H=F.current.files;if(!(!H||H.length===0)){y(!0);try{const q=await Ss(Array.from(H));v(J=>[...J,...q])}finally{F.current.value="",y(!1)}}},[]),z=m.useCallback(async()=>{if(!M.current)return;const H=M.current.files;if(!(!H||H.length===0)){y(!0);try{const q=await _x(Array.from(H));q&&v(J=>[...J,q])}finally{M.current.value="",y(!1)}}},[]),$=m.useCallback(H=>{p(q=>q.filter((J,te)=>te!==H))},[]),V=m.useCallback(H=>{v(q=>q.filter((J,te)=>te!==H))},[]),G=m.useCallback(H=>{var J,te;b(!1),R("");const q=`/${H.name}`;(J=H.input)!=null&&J.hint?(l(`${q} `),(te=j.current)==null||te.focus()):C(q)},[C]),X=m.useCallback(H=>{f&&Array.from(H.dataTransfer.types).includes("Files")&&(H.preventDefault(),H.dataTransfer.dropEffect="copy",S||L(!0))},[f,S]),K=m.useCallback(H=>{const q=H.relatedTarget;(!q||!H.currentTarget.contains(q))&&L(!1)},[]),ne=m.useCallback(async H=>{if(!f)return;const q=Array.from(H.dataTransfer.files);if(q.length!==0){H.preventDefault(),L(!1),y(!0);try{const J=q.filter(oe=>oe.type.startsWith("image/")),te=q.filter(oe=>!oe.type.startsWith("image/")&&Br(oe)),ie=q.filter(oe=>!oe.type.startsWith("image/")&&!Br(oe)&&Nl(oe));if(J.length>0){const oe=await Cr(J);p(he=>[...he,...oe])}if(te.length>0){const oe=await Ss(te);v(he=>[...he,...oe])}if(ie.length>0){const oe=await Cs(ie);v(he=>[...he,...oe])}}finally{y(!1)}}},[f]),ae=m.useCallback(()=>{var H;w?(b(!1),R("")):(c.startsWith("/")||l("/"+c),b(!0),R(c.startsWith("/")&&c.slice(1).split(/\s/)[0]||""),(H=j.current)==null||H.focus())},[w,c]),de=u.length+g.length,me=(c.trim()||de>0)&&!r&&!x;return d.jsxs("div",{className:Z("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",h),children:[d.jsxs("div",{className:"relative",children:[w&&i&&i.length>0&&d.jsx(vx,{commands:i,filter:A,onSelect:G,onClose:()=>{b(!1),R("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),k&&f&&d.jsxs("div",{ref:U,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var H;N(!1),(H=P.current)==null||H.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Ed,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"图片"})]}),d.jsxs("button",{type:"button",onClick:()=>{var H;N(!1),(H=O.current)==null||H.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Zt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"文本文件"})]}),d.jsxs("button",{type:"button",onClick:()=>{var H;N(!1),(H=F.current)==null||H.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Qr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"表格文件"})]}),d.jsxs("button",{type:"button",onClick:()=>{var H;N(!1),(H=M.current)==null||H.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Yr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"目录"})]})]}),d.jsxs("div",{onDragOver:X,onDragLeave:K,onDrop:ne,className:Z("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",S&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[u.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:u.map((H,q)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${H.mimeType};base64,${H.data}`,alt:`Attached image ${q+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>$(q),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${q+1}`,children:"×"})]},q))}),g.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:g.map((H,q)=>d.jsx(kx,{attachment:H,onRemove:()=>V(q)},q))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[f&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:E,type:"button",onClick:()=>N(H=>!H),disabled:r||x,className:Z("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",k?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(Bd,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:P,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:W}),d.jsx("input",{ref:O,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:T}),d.jsx("input",{ref:F,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:B}),d.jsx("input",{ref:M,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:z})]}),i&&i.length>0&&d.jsx("button",{type:"button",onClick:ae,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",w?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:r,title:"命令列表",children:d.jsx(su,{className:"h-4 w-4"})}),d.jsx("textarea",{ref:j,value:c,onChange:_,onKeyDown:D,onPaste:I,placeholder:x?"处理文件中…":o,disabled:r,rows:1,className:Z("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>C(),disabled:!t&&!me,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":me?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(cu,{className:"h-3.5 w-3.5",fill:"currentColor"}):x?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(Qd,{className:"h-4 w-4"})})]})]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsx("span",{className:"text-[11px] text-text-muted font-display",children:"Enter 发送,Shift+Enter 换行"})})]})}function kx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Zt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(Qr,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(Yr,{className:"h-3.5 w-3.5"});default:return d.jsx(Zt,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?Ot(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&d.jsx("span",{className:"text-text-muted text-[10px]",children:r}),o!=null&&d.jsxs("span",{className:"text-text-muted text-[10px]",children:[o," 文件"]}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx(an,{className:"h-3 w-3"})})]})}function Ot(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Cr(e){const t=[];for(const n of e)try{let r=n,o=n.type;n.size>2*1024*1024&&(r=await ye(n,yx),o="image/jpeg");const s=await Ex(r);t.push({mimeType:o,data:s})}catch(r){console.error("Failed to process image:",r)}return t}async function Cs(e){const t=[];for(const n of e)try{if(n.size>El){console.warn(`Skipping ${n.name}: too large (${Ot(n.size)})`);continue}n.size>bx&&console.warn(`File ${n.name} is large (${Ot(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Ss(e){const t=[];for(const n of e)try{const r=rn(n.name);if(r===".csv"||r===".tsv"){const o=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const o=await n.arrayBuffer(),s=await jl(o);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function jl(e){const t=await on(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const o of n.SheetNames){const s=n.Sheets[o];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?r.push(`## Sheet: ${o}
258
-
259
- ${a}`):r.push(a)}return r.join(`
260
-
261
- `)}async function _x(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>El));t.length>wr&&console.warn(`Directory has ${t.length} files, truncating to ${wr}`);const n=t.slice(0,wr);let r=0;for(const u of n)r+=u.size;r>ws&&console.warn(`Directory total size ${Ot(r)} exceeds limit, some files may be truncated`);const o=n[0].webkitRelativePath,s=o&&o.split("/")[0]||"目录",a=[],i=[];let h=0;const f=[...n].sort((u,p)=>{const g=u.webkitRelativePath||u.name,v=p.webkitRelativePath||p.name;return g.localeCompare(v)});for(const u of f){const p=u.webkitRelativePath||u.name;if(a.push(p),Nl(u)||Br(u))if(h+u.size<=ws)try{let g;if(rn(u.name)===".xlsx"||rn(u.name)===".xls"){const v=await u.arrayBuffer();g=await jl(v)}else g=await u.text();i.push(`
262
- ### ${p}
263
- \`\`\`
264
- ${g}
265
- \`\`\``),h+=u.size}catch{i.push(`
266
- ### ${p}
267
- (读取失败)`)}else i.push(`
268
- ### ${p}
269
- (文件过大,已跳过)`);else u.type.startsWith("image/")?i.push(`
270
- ### ${p}
271
- (图片文件,${Ot(u.size)})`):i.push(`
272
- ### ${p}
273
- (二进制文件,${Ot(u.size)})`)}const c=a.join(`
274
- `),l=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",c,"```","","## 文件内容",...i].join(`
275
- `);return{kind:"directory",name:s,size:r,textContent:l,files:a}}async function Ex(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const o=r.result,s=o.indexOf(",");t(s>=0?o.slice(s+1):o)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function Nx({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:Z("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(r=>d.jsx(jx,{request:r,onRespond:t},r.requestId))})})}function jx({request:e,onRespond:t}){return d.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[d.jsx(Xr,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[d.jsx(wt,{className:"h-3.5 w-3.5"}),"允许"]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[d.jsx(an,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}var or="Popover",[Al]=Qe(or,[Ht]),pn=Ht(),[Ax,ft]=Al(or),Rl=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!1}=e,i=pn(t),h=m.useRef(null),[f,c]=m.useState(!1),[l,u]=at({prop:r,defaultProp:o??!1,onChange:s,caller:or});return d.jsx(io,{...i,children:d.jsx(Ax,{scope:t,contentId:Ce(),triggerRef:h,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(p=>!p),[u]),hasCustomAnchor:f,onCustomAnchorAdd:m.useCallback(()=>c(!0),[]),onCustomAnchorRemove:m.useCallback(()=>c(!1),[]),modal:a,children:n})})};Rl.displayName=or;var Tl="PopoverAnchor",Rx=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ft(Tl,n),s=pn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=o;return m.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(Kn,{...s,...r,ref:t})});Rx.displayName=Tl;var Il="PopoverTrigger",Ml=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ft(Il,n),s=pn(n),a=pe(t,o.triggerRef),i=d.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":$l(o.open),...r,ref:a,onClick:ee(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:d.jsx(Kn,{asChild:!0,...s,children:i})});Ml.displayName=Il;var Mo="PopoverPortal",[Tx,Ix]=Al(Mo,{forceMount:void 0}),Pl=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=ft(Mo,t);return d.jsx(Tx,{scope:t,forceMount:n,children:d.jsx(Ae,{present:n||s.open,children:d.jsx(dn,{asChild:!0,container:o,children:r})})})};Pl.displayName=Mo;var Ut="PopoverContent",Ol=m.forwardRef((e,t)=>{const n=Ix(Ut,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=ft(Ut,e.__scopePopover);return d.jsx(Ae,{present:r||s.open,children:s.modal?d.jsx(Px,{...o,ref:t}):d.jsx(Ox,{...o,ref:t})})});Ol.displayName=Ut;var Mx=Dt("PopoverContent.RemoveScroll"),Px=m.forwardRef((e,t)=>{const n=ft(Ut,e.__scopePopover),r=m.useRef(null),o=pe(t,r),s=m.useRef(!1);return m.useEffect(()=>{const a=r.current;if(a)return uo(a)},[]),d.jsx(Gr,{as:Mx,allowPinchZoom:!0,children:d.jsx(Dl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,h=i.button===0&&i.ctrlKey===!0,f=i.button===2||h;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ee(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ox=m.forwardRef((e,t)=>{const n=ft(Ut,e.__scopePopover),r=m.useRef(!1),o=m.useRef(!1);return d.jsx(Dl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var h,f;(h=e.onInteractOutside)==null||h.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Dl=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:c,...l}=e,u=ft(Ut,n),p=pn(n);return Zr(),d.jsx(Bn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:d.jsx(ln,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:i,onPointerDownOutside:h,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(lo,{"data-state":$l(u.open),role:"dialog",id:u.contentId,...p,...l,ref:t,style:{...l.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Ll="PopoverClose",Dx=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=ft(Ll,n);return d.jsx(ue.button,{type:"button",...r,ref:t,onClick:ee(e.onClick,()=>o.onOpenChange(!1))})});Dx.displayName=Ll;var Lx="PopoverArrow",$x=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=pn(n);return d.jsx(co,{...o,...r,ref:t})});$x.displayName=Lx;function $l(e){return e?"open":"closed"}var Fx=Rl,Ux=Ml,zx=Pl,Bx=Ol;function Fl({...e}){return d.jsx(Fx,{"data-slot":"popover",...e})}function Ul({...e}){return d.jsx(Ux,{"data-slot":"popover-trigger",...e})}function zl({className:e,align:t="center",sideOffset:n=4,...r}){return d.jsx(zx,{children:d.jsx(Bx,{"data-slot":"popover-content",align:t,sideOffset:n,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var ks=1,Wx=.9,Hx=.8,Vx=.17,Sr=.1,kr=.999,Gx=.9999,Kx=.99,qx=/[\\\/_+.#"@\[\(\{&]/,Yx=/[\\\/_+.#"@\[\(\{&]/g,Xx=/[\s-]/,Bl=/[\s-]/g;function Wr(e,t,n,r,o,s,a){if(s===t.length)return o===e.length?ks:Kx;var i=`${o},${s}`;if(a[i]!==void 0)return a[i];for(var h=r.charAt(s),f=n.indexOf(h,o),c=0,l,u,p,g;f>=0;)l=Wr(e,t,n,r,f+1,s+1,a),l>c&&(f===o?l*=ks:qx.test(e.charAt(f-1))?(l*=Hx,p=e.slice(o,f-1).match(Yx),p&&o>0&&(l*=Math.pow(kr,p.length))):Xx.test(e.charAt(f-1))?(l*=Wx,g=e.slice(o,f-1).match(Bl),g&&o>0&&(l*=Math.pow(kr,g.length))):(l*=Vx,o>0&&(l*=Math.pow(kr,f-o))),e.charAt(f)!==t.charAt(s)&&(l*=Gx)),(l<Sr&&n.charAt(f-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(f-1)!==r.charAt(s))&&(u=Wr(e,t,n,r,f+1,s+2,a),u*Sr>l&&(l=u*Sr)),l>c&&(c=l),f=n.indexOf(h,f+1);return a[i]=c,c}function _s(e){return e.toLowerCase().replace(Bl," ")}function Qx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Wr(e,t,_s(e),_s(t),0,0,{})}var Yt='[cmdk-group=""]',_r='[cmdk-group-items=""]',Zx='[cmdk-group-heading=""]',Wl='[cmdk-item=""]',Es=`${Wl}:not([aria-disabled="true"])`,Hr="cmdk-item-select",Tt="data-value",Jx=(e,t,n)=>Qx(e,t,n),Hl=m.createContext(void 0),gn=()=>m.useContext(Hl),Vl=m.createContext(void 0),Po=()=>m.useContext(Vl),Gl=m.createContext(void 0),Kl=m.forwardRef((e,t)=>{let n=It(()=>{var T,B;return{search:"",value:(B=(T=e.value)!=null?T:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=It(()=>new Set),o=It(()=>new Map),s=It(()=>new Map),a=It(()=>new Set),i=ql(e),{label:h,children:f,value:c,onValueChange:l,filter:u,shouldFilter:p,loop:g,disablePointerSelection:v=!1,vimBindings:w=!0,...b}=e,A=Ce(),R=Ce(),S=Ce(),L=m.useRef(null),k=dv();kt(()=>{if(c!==void 0){let T=c.trim();n.current.value=T,N.emit()}},[c]),kt(()=>{k(6,F)},[]);let N=m.useMemo(()=>({subscribe:T=>(a.current.add(T),()=>a.current.delete(T)),snapshot:()=>n.current,setState:(T,B,z)=>{var $,V,G,X;if(!Object.is(n.current[T],B)){if(n.current[T]=B,T==="search")O(),j(),k(1,P);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(S);K?K.focus():($=document.getElementById(A))==null||$.focus()}if(k(7,()=>{var K;n.current.selectedItemId=(K=M())==null?void 0:K.id,N.emit()}),z||k(5,F),((V=i.current)==null?void 0:V.value)!==void 0){let K=B??"";(X=(G=i.current).onValueChange)==null||X.call(G,K);return}}N.emit()}},emit:()=>{a.current.forEach(T=>T())}}),[]),x=m.useMemo(()=>({value:(T,B,z)=>{var $;B!==(($=s.current.get(T))==null?void 0:$.value)&&(s.current.set(T,{value:B,keywords:z}),n.current.filtered.items.set(T,y(B,z)),k(2,()=>{j(),N.emit()}))},item:(T,B)=>(r.current.add(T),B&&(o.current.has(B)?o.current.get(B).add(T):o.current.set(B,new Set([T]))),k(3,()=>{O(),j(),n.current.value||P(),N.emit()}),()=>{s.current.delete(T),r.current.delete(T),n.current.filtered.items.delete(T);let z=M();k(4,()=>{O(),(z==null?void 0:z.getAttribute("id"))===T&&P(),N.emit()})}),group:T=>(o.current.has(T)||o.current.set(T,new Set),()=>{s.current.delete(T),o.current.delete(T)}),filter:()=>i.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:A,inputId:S,labelId:R,listInnerRef:L}),[]);function y(T,B){var z,$;let V=($=(z=i.current)==null?void 0:z.filter)!=null?$:Jx;return T?V(T,n.current.search,B):0}function j(){if(!n.current.search||i.current.shouldFilter===!1)return;let T=n.current.filtered.items,B=[];n.current.filtered.groups.forEach($=>{let V=o.current.get($),G=0;V.forEach(X=>{let K=T.get(X);G=Math.max(K,G)}),B.push([$,G])});let z=L.current;U().sort(($,V)=>{var G,X;let K=$.getAttribute("id"),ne=V.getAttribute("id");return((G=T.get(ne))!=null?G:0)-((X=T.get(K))!=null?X:0)}).forEach($=>{let V=$.closest(_r);V?V.appendChild($.parentElement===V?$:$.closest(`${_r} > *`)):z.appendChild($.parentElement===z?$:$.closest(`${_r} > *`))}),B.sort(($,V)=>V[1]-$[1]).forEach($=>{var V;let G=(V=L.current)==null?void 0:V.querySelector(`${Yt}[${Tt}="${encodeURIComponent($[0])}"]`);G==null||G.parentElement.appendChild(G)})}function P(){let T=U().find(z=>z.getAttribute("aria-disabled")!=="true"),B=T==null?void 0:T.getAttribute(Tt);N.setState("value",B||void 0)}function O(){var T,B,z,$;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let V=0;for(let G of r.current){let X=(B=(T=s.current.get(G))==null?void 0:T.value)!=null?B:"",K=($=(z=s.current.get(G))==null?void 0:z.keywords)!=null?$:[],ne=y(X,K);n.current.filtered.items.set(G,ne),ne>0&&V++}for(let[G,X]of o.current)for(let K of X)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=V}function F(){var T,B,z;let $=M();$&&(((T=$.parentElement)==null?void 0:T.firstChild)===$&&((z=(B=$.closest(Yt))==null?void 0:B.querySelector(Zx))==null||z.scrollIntoView({block:"nearest"})),$.scrollIntoView({block:"nearest"}))}function M(){var T;return(T=L.current)==null?void 0:T.querySelector(`${Wl}[aria-selected="true"]`)}function U(){var T;return Array.from(((T=L.current)==null?void 0:T.querySelectorAll(Es))||[])}function E(T){let B=U()[T];B&&N.setState("value",B.getAttribute(Tt))}function C(T){var B;let z=M(),$=U(),V=$.findIndex(X=>X===z),G=$[V+T];(B=i.current)!=null&&B.loop&&(G=V+T<0?$[$.length-1]:V+T===$.length?$[0]:$[V+T]),G&&N.setState("value",G.getAttribute(Tt))}function D(T){let B=M(),z=B==null?void 0:B.closest(Yt),$;for(;z&&!$;)z=T>0?lv(z,Yt):cv(z,Yt),$=z==null?void 0:z.querySelector(Es);$?N.setState("value",$.getAttribute(Tt)):C(T)}let _=()=>E(U().length-1),I=T=>{T.preventDefault(),T.metaKey?_():T.altKey?D(1):C(1)},W=T=>{T.preventDefault(),T.metaKey?E(0):T.altKey?D(-1):C(-1)};return m.createElement(ut.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:T=>{var B;(B=b.onKeyDown)==null||B.call(b,T);let z=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||z))switch(T.key){case"n":case"j":{w&&T.ctrlKey&&I(T);break}case"ArrowDown":{I(T);break}case"p":case"k":{w&&T.ctrlKey&&W(T);break}case"ArrowUp":{W(T);break}case"Home":{T.preventDefault(),E(0);break}case"End":{T.preventDefault(),_();break}case"Enter":{T.preventDefault();let $=M();if($){let V=new Event(Hr);$.dispatchEvent(V)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:fv},h),sr(e,T=>m.createElement(Vl.Provider,{value:N},m.createElement(Hl.Provider,{value:x},T))))}),ev=m.forwardRef((e,t)=>{var n,r;let o=Ce(),s=m.useRef(null),a=m.useContext(Gl),i=gn(),h=ql(e),f=(r=(n=h.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;kt(()=>{if(!f)return i.item(o,a==null?void 0:a.id)},[f]);let c=Yl(o,s,[e.value,e.children,s],e.keywords),l=Po(),u=ct(k=>k.value&&k.value===c.current),p=ct(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(o)>0:!0);m.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(Hr,g),()=>k.removeEventListener(Hr,g)},[p,e.onSelect,e.disabled]);function g(){var k,N;v(),(N=(k=h.current).onSelect)==null||N.call(k,c.current)}function v(){l.setState("value",c.current,!0)}if(!p)return null;let{disabled:w,value:b,onSelect:A,forceMount:R,keywords:S,...L}=e;return m.createElement(ut.div,{ref:We(s,t),...L,id:o,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!u,"data-disabled":!!w,"data-selected":!!u,onPointerMove:w||i.getDisablePointerSelection()?void 0:v,onClick:w?void 0:g},e.children)}),tv=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...s}=e,a=Ce(),i=m.useRef(null),h=m.useRef(null),f=Ce(),c=gn(),l=ct(p=>o||c.filter()===!1?!0:p.search?p.filtered.groups.has(a):!0);kt(()=>c.group(a),[]),Yl(a,i,[e.value,e.heading,h]);let u=m.useMemo(()=>({id:a,forceMount:o}),[o]);return m.createElement(ut.div,{ref:We(i,t),...s,"cmdk-group":"",role:"presentation",hidden:l?void 0:!0},n&&m.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),sr(e,p=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},m.createElement(Gl.Provider,{value:u},p))))}),nv=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=m.useRef(null),s=ct(a=>!a.search);return!n&&!s?null:m.createElement(ut.div,{ref:We(o,t),...r,"cmdk-separator":"",role:"separator"})}),rv=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,s=Po(),a=ct(f=>f.search),i=ct(f=>f.selectedItemId),h=gn();return m.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),m.createElement(ut.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":i,id:h.inputId,type:"text",value:o?e.value:a,onChange:f=>{o||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),ov=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,s=m.useRef(null),a=m.useRef(null),i=ct(f=>f.selectedItemId),h=gn();return m.useEffect(()=>{if(a.current&&s.current){let f=a.current,c=s.current,l,u=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let p=f.offsetHeight;c.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(l),u.unobserve(f)}}},[]),m.createElement(ut.div,{ref:We(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:h.listId},sr(e,f=>m.createElement("div",{ref:We(a,h.listInnerRef),"cmdk-list-sizer":""},f)))}),sv=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:a,...i}=e;return m.createElement(Ui,{open:n,onOpenChange:r},m.createElement(zi,{container:a},m.createElement(Bi,{"cmdk-overlay":"",className:o}),m.createElement(Wi,{"aria-label":e.label,"cmdk-dialog":"",className:s},m.createElement(Kl,{ref:t,...i}))))}),av=m.forwardRef((e,t)=>ct(n=>n.filtered.count===0)?m.createElement(ut.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),iv=m.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...s}=e;return m.createElement(ut.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},sr(e,a=>m.createElement("div",{"aria-hidden":!0},a)))}),Vt=Object.assign(Kl,{List:ov,Item:ev,Input:rv,Group:tv,Separator:nv,Dialog:sv,Empty:av,Loading:iv});function lv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function cv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ql(e){let t=m.useRef(e);return kt(()=>{t.current=e}),t}var kt=typeof window>"u"?m.useEffect:m.useLayoutEffect;function It(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function ct(e){let t=Po(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function Yl(e,t,n,r=[]){let o=m.useRef(),s=gn();return kt(()=>{var a;let i=(()=>{var f;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(f=c.current.textContent)==null?void 0:f.trim():o.current}})(),h=r.map(f=>f.trim());s.value(e,i,h),(a=t.current)==null||a.setAttribute(Tt,i),o.current=i}),o}var dv=()=>{let[e,t]=m.useState(),n=It(()=>new Map);return kt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function uv(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function sr({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(uv(t),{ref:t.ref},n(t.props.children)):n(t)}var fv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function hv({className:e,...t}){return d.jsx(Vt,{"data-slot":"command",className:Z("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function mv({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(Yd,{className:"size-4 shrink-0 opacity-50"}),d.jsx(Vt.Input,{"data-slot":"command-input",className:Z("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function pv({className:e,...t}){return d.jsx(Vt.List,{"data-slot":"command-list",className:Z("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function gv({...e}){return d.jsx(Vt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function xv({className:e,...t}){return d.jsx(Vt.Group,{"data-slot":"command-group",className:Z("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function vv({className:e,...t}){return d.jsx(Vt.Item,{"data-slot":"command-item",className:Z("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Ns(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0;for(let s=0;s<r.length&&o<n.length;s++)r[s]===n[o]&&o++;return o===n.length}function yv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:o=!1}){const[s,a]=m.useState(""),[i,h]=m.useState(o?"__none__":void 0),f=m.useMemo(()=>s?e.filter(c=>Ns(s,c.name)||Ns(s,c.modelId)):e,[e,s]);return d.jsxs(hv,{shouldFilter:!1,value:i,onValueChange:h,children:[r&&d.jsx(mv,{placeholder:"Select a model…",value:s,onValueChange:a}),d.jsxs(pv,{children:[d.jsx(gv,{children:"No models found."}),d.jsx(xv,{children:f.map(c=>d.jsxs(vv,{value:c.modelId,onSelect:()=>n(c),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:c.name}),c.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),d.jsx(wt,{className:Z("h-4 w-4 shrink-0",t===c.modelId?"opacity-100":"opacity-0")})]},c.modelId))})]})]})}function Xl(e){const[t,n]=m.useState(e.modelState),[r,o]=m.useState(!1);m.useEffect(()=>{const f=l=>{if(n(l),l&&l.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==l.currentModelId&&l.availableModels.some(p=>p.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},c=l=>{n(u=>u?{...u,currentModelId:l}:null),o(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(c),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(c)}},[e]);const s=m.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=m.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),h=m.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");o(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(c){throw o(!1),c}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:h,isLoading:r}}function bv({client:e,onModelSelect:t}){const[n,r]=m.useState(!1),{supportsModelSelection:o,availableModels:s,currentModel:a,setModel:i,isLoading:h}=Xl(e),f=o&&s.length>0,c=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,l=async u=>{try{await i(u.modelId),t==null||t(u.modelId),r(!1)}catch(p){console.error("[ModelSelector] Failed to set model:",p)}};return d.jsxs(Fl,{open:n,onOpenChange:f?r:void 0,children:[d.jsx(Ul,{asChild:!0,children:d.jsxs(Et,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||h,children:[h?d.jsx(ea,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(Qs,{className:"h-3 w-3"}):d.jsx(sn,{className:"h-3 w-3"})]})}),d.jsx(zl,{className:"w-72 p-0",align:"end",children:d.jsx(yv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:l,showSearch:!c,isMobile:c})})]})}function wv(e){const[t,n]=m.useState(e.availableCommands);m.useEffect(()=>{const o=s=>{n(s)};return e.setAvailableCommandsChangedHandler(o),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=m.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}const Cv=new Set(["clear","new","help","status","model","copy"]),Sv=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"},{name:"files",desc:"列出上下文中的文件"}];function kv(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function _v(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Ev(e){var r;const t=[];t.push("**本地命令**(Web UI 直接执行)"),t.push("");const n=[{name:"clear",desc:"清空当前对话"},{name:"new",desc:"新建会话"},{name:"help",desc:"显示此帮助信息"},{name:"status",desc:"显示会话状态"},{name:"model [id]",desc:"查看或切换模型"},{name:"copy",desc:"复制最后一条助手消息"}];for(const o of n)t.push(`- \`/${o.name}\` — ${o.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const o of Sv)t.push(`- \`/${o.name}\` — ${o.desc}`);if(e.length>0)for(const o of e){const s=(r=o.input)!=null&&r.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${s}\` — ${o.description}`)}return t.join(`
276
- `)}function Nv(e){var n,r,o;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((r=e.currentModel)==null?void 0:r.modelId)??"未设置"}`),(o=e.currentModel)!=null&&o.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
277
- `)}function jv(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const r of e){const o=r.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${r.modelId}\` — ${r.name}${o}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
278
- `)}async function Av(e,t){var l;if(!e.startsWith("/"))return{handled:!1};const[n,...r]=e.slice(1).split(/\s+/),o=r.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!Cv.has(s))return{handled:!1};if(s==="clear")return{handled:!0,clearEntries:!0};if(s==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(s==="help")a=Ev(t.availableCommands);else if(s==="status")a=Nv({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(o)try{await t.setModel(o),a=`已请求切换到模型: \`${o}\``}catch(u){a=`切换模型失败: ${u instanceof Error?u.message:String(u)}`,i=!0}else a=jv(t.availableModels,t.currentModel);else if(s==="copy"){const u=[...t.entries].reverse().find(g=>g.type==="assistant_message"),p=((l=u==null?void 0:u.chunks)==null?void 0:l.map(g=>g.text).join(`
279
- `))??"";try{await navigator.clipboard.writeText(p),a=p?`已复制 ${p.length} 字符到剪贴板`:"没有可复制的助手消息"}catch{a="复制失败:剪贴板不可用",i=!0}}const h=Date.now(),f={type:"user_message",id:`user-${h}`,content:e},c={type:"command_output",id:`cmd-${h}`,commandName:s,inputText:e,title:kv(s),subtitle:_v(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:c}}const Rv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Tv(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),o=n.match(/^data:([^;,]+)/),s=o?o[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let h=0;h<a.length;h++)i[h]=a.charCodeAt(h);return new Blob([i],{type:s})}const Er=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"dontAsk",label:"不询问",description:"不弹出询问,自动拒绝"},{value:"auto",label:"自动判断",description:"AI 自动判断是否批准"}];function Iv({mode:e,onModeChange:t}){const[n,r]=m.useState(!1),o=Er.find(s=>s.value===e)??Er[0];return d.jsxs(Fl,{open:n,onOpenChange:r,children:[d.jsx(Ul,{asChild:!0,children:d.jsxs(Et,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(ru,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:o.label}),n?d.jsx(Qs,{className:"h-3 w-3"}):d.jsx(sn,{className:"h-3 w-3"})]})}),d.jsx(zl,{className:"w-64 p-1",align:"start",children:Er.map(s=>d.jsxs("button",{type:"button",onClick:()=>{t(s.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&d.jsx(wt,{className:"h-3.5 w-3.5 text-brand"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),d.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function js(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Nr(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function Mv({client:e,agentId:t}){const[n,r]=m.useState([]),[o,s]=m.useState(!1),[a,i]=m.useState(!1),[h,f]=m.useState(null),c=m.useRef(null),l=m.useRef(n);l.current=n;const[u,p]=m.useState(null),g=m.useRef(null),[v,w]=m.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[b,A]=m.useState(!1),{commands:R}=wv(e),{availableModels:S,currentModel:L,setModel:k}=Xl(e);m.useEffect(()=>{c.current=h},[h]);const N=m.useCallback(()=>{r([]),s(!1),i(!1)},[]),x=t?`acp_last_session_${t}`:null,y=m.useCallback((D,_)=>{if(((_==null?void 0:_.resetEntries)??!0)&&(r([]),s(!1)),f(D),i(!0),A(e.supportsImages),x)try{localStorage.setItem(x,D)}catch{}console.log("[ChatInterface] Active session:",D,"supportsImages:",e.supportsImages)},[e,x]),j=m.useCallback(D=>{c.current&&D.sessionId!==c.current||(console.log("[ChatInterface] Permission request:",D),r(_=>{const I=Nr(_,D.toolCall.toolCallId);if(I>=0)return _.map((W,T)=>T!==I||W.type!=="tool_call"||W.toolCall.status!=="running"?W:{type:"tool_call",toolCall:{...W.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const W={type:"tool_call",toolCall:{id:D.toolCall.toolCallId,title:D.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options},isStandalonePermission:!0}};return[..._,W]}}))},[]),P=m.useCallback((D,_)=>{if(!(c.current&&D!==c.current))if(_.sessionUpdate==="agent_message_chunk"){const I=_.content.type==="text"&&_.content.text?_.content.text:"";if(!I)return;r(W=>{const T=W[W.length-1];if((T==null?void 0:T.type)==="assistant_message"){const z=T.chunks[T.chunks.length-1];return(z==null?void 0:z.type)==="message"?[...W.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"message",text:z.text+I}]}]:[...W.slice(0,-1),{...T,chunks:[...T.chunks,{type:"message",text:I}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:I}]};return[...W,B]})}else if(_.sessionUpdate==="agent_thought_chunk"){const I=_.content.type==="text"&&_.content.text?_.content.text:"";if(!I)return;r(W=>{const T=W[W.length-1];if((T==null?void 0:T.type)==="assistant_message"){const z=T.chunks[T.chunks.length-1];return(z==null?void 0:z.type)==="thought"?[...W.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"thought",text:z.text+I}]}]:[...W.slice(0,-1),{...T,chunks:[...T.chunks,{type:"thought",text:I}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:I}]};return[...W,B]})}else if(_.sessionUpdate==="user_message_chunk"){const I=_.content.type==="text"&&_.content.text?_.content.text:"";if(!I)return;r(W=>{const T=W[W.length-1];if((T==null?void 0:T.type)==="user_message")return[...W.slice(0,-1),{...T,content:T.content+I}];const B={type:"user_message",id:`user-${Date.now()}`,content:I};return[...W,B]})}else if(_.sessionUpdate==="tool_call"){const I={id:_.toolCallId,title:_.title,status:js(_.status),content:_.content,rawInput:_.rawInput,rawOutput:_.rawOutput};r(W=>{const T=Nr(W,_.toolCallId);if(T>=0)return W.map((z,$)=>$!==T||z.type!=="tool_call"?z:{type:"tool_call",toolCall:{...z.toolCall,...I}});const B={type:"tool_call",toolCall:I};return[...W,B]})}else _.sessionUpdate==="tool_call_update"?r(I=>{const W=Nr(I,_.toolCallId);if(W<0){console.warn(`[ChatInterface] Tool call not found for update: ${_.toolCallId}`);const T={type:"tool_call",toolCall:{id:_.toolCallId,title:_.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...I,T]}return I.map((T,B)=>{if(B!==W||T.type!=="tool_call")return T;const z=_.status?js(_.status):T.toolCall.status,$=_.content?[...T.toolCall.content||[],..._.content]:T.toolCall.content;return{type:"tool_call",toolCall:{...T.toolCall,status:z,..._.title&&{title:_.title},content:$,..._.rawInput&&{rawInput:_.rawInput},..._.rawOutput&&{rawOutput:_.rawOutput}}}})}):_.sessionUpdate==="plan"&&r(I=>{if(_.entries.length===0)return I.filter(B=>B.type!=="plan");const W=I.reduce((B,z,$)=>z.type==="plan"?$:B,-1);if(W>=0)return I.map((B,z)=>z===W?{...B,entries:_.entries}:B);const T={type:"plan",id:`plan-${Date.now()}`,entries:_.entries};return[...I,T]})},[]);m.useEffect(()=>{e.setSessionCreatedHandler(_=>{console.log("[ChatInterface] Session created:",_),y(_)}),e.setSessionLoadedHandler(_=>{console.log("[ChatInterface] Session loaded/resumed:",_),y(_,{resetEntries:!1})}),e.setSessionSwitchingHandler(_=>{console.log("[ChatInterface] Switching to session:",_),f(_),N()}),e.setSessionUpdateHandler((_,I)=>{P(_,I)}),e.setPromptCompleteHandler(_=>{console.log("[ChatInterface] Prompt complete:",_),s(!1)}),e.setPermissionRequestHandler(j),e.setErrorMessageHandler(_=>{console.error("[ChatInterface] Agent error:",_),p(_),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>p(null),5e3)});const D=x?localStorage.getItem(x):null;return D&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",D),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:D}):await e.resumeSession({sessionId:D})}catch(I){console.warn("[ChatInterface] Failed to restore session, creating new one:",I),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[y,e,j,P,N]);const O=m.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),o&&e.cancel(),N(),f(null),e.createSession(void 0,v)},[e,o,N,v]),F=()=>{console.log("[ChatInterface] Cancel requested"),r(D=>D.map(_=>_.type!=="tool_call"||!(_.toolCall.status==="running"||_.toolCall.status==="waiting_for_confirmation")?_:(console.log("[ChatInterface] Marking tool call as canceled:",_.toolCall.id),{type:"tool_call",toolCall:{..._.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},M=m.useCallback((D,_,I)=>{console.log("[ChatInterface] Permission response:",{requestId:D,optionId:_,optionKind:I}),e.respondToPermission(D,_);const W=I==="reject_once"||I==="reject_always"||_===null;r(T=>T.map(B=>{var $;if(B.type!=="tool_call"||(($=B.toolCall.permissionRequest)==null?void 0:$.requestId)!==D)return B;let z;return W?z="rejected":B.toolCall.isStandalonePermission?z="complete":z="running",{type:"tool_call",toolCall:{...B.toolCall,status:z,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),U=n.filter(D=>D.type==="tool_call"&&D.toolCall.status==="waiting_for_confirmation"&&!!D.toolCall.permissionRequest).map(D=>({requestId:D.toolCall.permissionRequest.requestId,toolName:D.toolCall.title,toolInput:D.toolCall.rawInput||{},description:D.toolCall.title,options:D.toolCall.permissionRequest.options})),E=m.useCallback((D,_)=>{const I=U.find(B=>B.requestId===D);let W=null,T=null;if(I!=null&&I.options&&I.options.length>0)if(_){const B=I.options.find(z=>z.kind==="allow_once")??I.options.find(z=>z.kind==="allow_always");B&&(W=B.optionId,T=B.kind)}else{const B=I.options.find(z=>z.kind==="reject_once")??I.options.find(z=>z.kind==="reject_always");B&&(W=B.optionId,T=B.kind)}W||(T=_?"allow_once":"reject_once"),M(D,W,T)},[M,U]),C=m.useCallback(async D=>{var V;const _=D.text.trim(),I=D.images||[],W=D.attachments||[];if(!_&&I.length===0&&W.length===0||o||!a)return;if(_.startsWith("/")&&I.length===0){bt("[ChatInterface] slash command input",{text:_});const G=await Av(_,{sessionId:h,availableCommands:R,availableModels:S,currentModel:L,supportsImages:b,entries:l.current,setModel:k,onNewSession:O}).catch(()=>null);if(G){if(bt("[ChatInterface] local command handled",G),"clearEntries"in G&&G.clearEntries){r([]);return}if("newSession"in G&&G.newSession){O();return}if("userEntry"in G){r(X=>[...X,G.userEntry,G.cmdEntry]);return}}bt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:_})}bt("[ChatInterface] forwarding to agent",{text:_,hasImages:I.length>0,sessionReady:a,isLoading:o});const T=[];_&&T.push({type:"text",text:_});const B=[];for(const G of I)try{const X=`data:${G.mimeType};base64,${G.data}`;let K;X.startsWith("data:")?K=Tv(X):K=await(await fetch(X)).blob();let ne=K,ae=G.mimeType;if(K.size>2*1024*1024){const H=new File([K],"image.jpg",{type:K.type});ne=await ye(H,Rv),ae="image/jpeg"}const de=await new Promise((H,q)=>{const J=new FileReader;J.onloadend=()=>{const te=J.result,ie=te.indexOf(",");H(ie>=0?te.slice(ie+1):te)},J.onerror=()=>{var te;return q(new Error("FileReader error: "+((te=J.error)==null?void 0:te.message)))},J.readAsDataURL(ne)}),me={type:"image",mimeType:ae,data:de};T.push(me),B.push({mimeType:ae,data:de})}catch(X){console.error("[ChatInterface] Failed to process image:",X)}const z=[];for(const G of W)try{if(G.textContent){let X;if(G.kind==="directory"){const K=((V=G.files)==null?void 0:V.length)??0;X=`📁 目录: ${G.name} (${K} 个文件)
280
- ${G.textContent}`}else{const K=G.size!=null?` (${Pv(G.size)})`:"";X=`📎 ${G.name}${K}
281
- \`\`\`
282
- ${G.textContent}
283
- \`\`\``}T.push({type:"text",text:X}),z.push(G)}}catch(X){console.error("[ChatInterface] Failed to process attachment:",X)}if(T.length===0)return;const $={type:"user_message",id:`user-${Date.now()}`,content:_,images:B.length>0?B:void 0,attachments:z.length>0?z:void 0};r(G=>[...G,$]),s(!0);try{await e.sendPrompt(T)}catch(G){console.error("[ChatInterface] Failed to send prompt:",G),s(!1)}},[o,a,e,R,S,L,b,h,k,O]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(hx,{entries:n,isLoading:o&&!a?!1:o,onPermissionRespond:(D,_,I)=>{M(D,_,I)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),d.jsx(Nx,{requests:U,onRespond:E}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>p(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Iv,{mode:v,onModeChange:D=>{w(D),localStorage.setItem("acp_permission_mode",D)}}),d.jsx(bv,{client:e})]}),n.length>0&&d.jsxs(wg,{children:[d.jsx(Cg,{asChild:!0,children:d.jsxs(Et,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:O,children:[d.jsx(zn,{className:"h-3 w-3"}),"新会话"]})}),d.jsx(Sg,{children:"New Thread"})]})]}),d.jsx(Sx,{onSubmit:C,isLoading:o,onInterrupt:F,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:b,commands:R.length>0?R:void 0})]})]})}function Pv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ov({client:e,agentId:t}){const[n,r]=m.useState(!1),o=m.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:Z("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),d.jsxs("div",{className:Z("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:d.jsx(zn,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(Ud,{className:"h-4 w-4"}):d.jsx($d,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Dv,{client:e,onSelectSession:o})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx(Mv,{client:e,agentId:t})})]})}function Dv({client:e,onSelectSession:t}){const[n,r]=m.useState([]),[o,s]=m.useState(!0),[a,i]=m.useState(null),h=m.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const l=await e.listSessions();r(l.sessions)}catch(l){console.warn("[SidebarSessionList] Failed to load:",l)}finally{s(!1)}},[e]);m.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&h()},[e,h]),m.useEffect(()=>{const l=u=>{u==="connected"&&setTimeout(h,200)};return e.setConnectionStateHandler(l),()=>e.removeConnectionStateHandler(l)},[e,h]),m.useEffect(()=>{const l=setInterval(h,1e4);return()=>clearInterval(l)},[h]);const f=m.useMemo(()=>[...n].sort((l,u)=>{const p=l.updatedAt?new Date(l.updatedAt).getTime():0;return(u.updatedAt?new Date(u.updatedAt).getTime():0)-p}),[n]);if(o&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const c=Lv(f);return d.jsx("nav",{className:"py-1","aria-label":"历史会话",children:c.map((l,u)=>d.jsxs("div",{children:[u>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:l.label})}),l.sessions.map(p=>d.jsxs("button",{type:"button",onClick:()=>{i(p.sessionId),t(p)},className:Z("w-full flex items-center gap-2.5 px-4 py-2 text-left transition-colors rounded-none",p.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),title:p.title||p.sessionId,children:[d.jsx(Md,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),d.jsx("span",{className:"text-[13px] font-display truncate leading-snug",children:p.title&&p.title.trim()?p.title:"新会话"})]},p.sessionId))]},l.label))})}function Lv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),o=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?o[0].sessions.push(s):a>=r?o[1].sessions.push(s):o[2].sessions.push(s)}return o.filter(s=>s.sessions.length>0)}function $v({url:e,token:t,onBack:n}){const[r,o]=m.useState(null),[s,a]=m.useState("disconnected"),[i,h]=m.useState(null),f=m.useRef(null);return m.useEffect(()=>{const c=new $r({proxyUrl:e,token:t});return c.setConnectionStateHandler((l,u)=>{a(l),h(u||null)}),f.current=c,o(c),c.connect().catch(l=>{l instanceof qi||(h(l.message),a("error"))}),()=>{c.disconnect(),f.current=null,o(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!r&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),r&&s==="connected"&&d.jsx(Ov,{client:r})]})}const Ql="rcs_tokens",Zl="rcs_active_token",zt="__default__";function Fv(){return`tk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Uv(e){if(e.some(n=>n.id===zt))return e;let t=null;try{t=localStorage.getItem("rcs_uuid")}catch{}return t?[{id:zt,token:t,label:"Default"},...e]:e}function As(){let e=[];try{const t=localStorage.getItem(Ql);if(t){const n=JSON.parse(t);Array.isArray(n)&&(e=n)}}catch{}return Uv(e)}function zv(e){var n;try{const r=localStorage.getItem(Zl);if(r&&e.some(o=>o.id===r))return r}catch{}const t=e.find(r=>r.id===zt);return t?t.id:((n=e[0])==null?void 0:n.id)??zt}function Bv(){const[e,t]=m.useState(As),[n,r]=m.useState(()=>zv(As())),o=m.useCallback(u=>{t(u);try{localStorage.setItem(Ql,JSON.stringify(u))}catch{}},[]),s=m.useCallback(u=>{r(u);try{localStorage.setItem(Zl,u),location.reload()}catch{}},[]),a=m.useCallback((u,p)=>{const g=u.trim();if(!g)return"Token is required";const v={id:Fv(),token:g,label:p.trim()||g.slice(0,8)},w=[...e,v];return o(w),null},[e,o]),i=m.useCallback(u=>{if(u===zt)return;const p=e.filter(g=>g.id!==u);o(p),n===u&&s(zt)},[e,o,n,s]),h=m.useCallback((u,p)=>{const g=e.map(v=>v.id===u?{...v,label:p}:v);o(g)},[e,o]),f=e.find(u=>u.id===n)??e[0]??null,c=(f==null?void 0:f.label)??"Default",l=(f==null?void 0:f.token)??null;return{tokens:e,activeTokenId:n,activeToken:f,activeLabel:c,activeTokenValue:l,setActiveTokenId:s,addToken:a,removeToken:i,updateToken:h}}const Wv=m.lazy(()=>on(()=>import("./Dashboard-Dd71UuMq.js"),__vite__mapDeps([3,2,1,4,5])).then(e=>({default:e.Dashboard}))),Hv=m.lazy(()=>on(()=>import("./SessionDetail-CNp5XofE.js"),__vite__mapDeps([6,2,1,4,5])).then(e=>({default:e.SessionDetail})));function Vv(){const[e,t]=m.useState(null),[n,r]=m.useState(!1),[o,s]=m.useState(!1),[a,i]=m.useState(null),{tokens:h,activeTokenId:f,activeLabel:c,activeTokenValue:l,setActiveTokenId:u,addToken:p,removeToken:g,updateToken:v}=Bv();m.useEffect(()=>{lp(l)},[l]);const w=m.useCallback(S=>{u(S)},[u]),b=m.useCallback(()=>{yo();const S=window.location.pathname,L=new URLSearchParams(window.location.search),k=L.get("uuid");if(k){Or(k);const j=new URL(window.location.href);j.searchParams.delete("uuid"),window.history.replaceState(null,"",j)}if(L.get("acp")==="1"){const j=sessionStorage.getItem("acp_connection");if(j)try{const P=JSON.parse(j);if(P.url&&P.token){i({url:P.url,token:P.token}),sessionStorage.removeItem("acp_connection");const O=new URL(window.location.href);O.searchParams.delete("acp"),window.history.replaceState(null,"",O);return}}catch{sessionStorage.removeItem("acp_connection")}}const x=L.get("sid");if(x){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${x}`),t(x),hp(x).catch(P=>{console.warn("Failed to bind session:",P)});return}const y=S.match(/^\/code\/([^/]+)/);y&&y[1]?t(y[1]):t(null)},[]);m.useEffect(()=>(b(),window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)),[b]);const A=m.useCallback(S=>{window.history.pushState(null,"",`/code/${S}`),t(S)},[]),R=m.useCallback(()=>{window.history.pushState(null,"","/code/"),t(null),i(null)},[]);return d.jsx(xu,{defaultTheme:"system",children:d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[d.jsx(ap,{onIdentityClick:()=>r(!0),onTokenClick:()=>s(!0),activeTokenLabel:e?void 0:c,sessionTitle:e||(a?"ACP":void 0),onBack:e||a?R:void 0}),d.jsx(m.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:a?d.jsx($v,{url:a.url,token:a.token,onBack:R}):e?d.jsx(Hv,{sessionId:e},e):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Wv,{onNavigateSession:A})})}),d.jsx(Pp,{open:n,onClose:()=>r(!1)}),d.jsx(Lp,{open:o,onClose:()=>s(!1),tokens:h,activeTokenId:f,onSetActive:w,onAdd:p,onRemove:g,onUpdate:v})]})})}oc.createRoot(document.getElementById("root")).render(d.jsx(m.StrictMode,{children:d.jsx(Vv,{})}));export{$r as A,ed as B,Sx as C,Hi as D,ny as E,yo as F,up as G,Dr as H,Zv as I,py as J,ry as K,ea as L,oy as M,cp as N,Jv as O,Av as P,Qc as Q,ty as S,bg as T,Ov as a,fp as b,hx as c,wt as d,Vi as e,my as f,Gi as g,Ki as h,qi as i,ra as j,hp as k,fy as l,uy as m,sy as n,mp as o,ay as p,iy as q,dy as r,cy as s,ly as t,Os as u,Z as v,re as w,bt as x,Zc as y,Qv as z};