dreamcontext 0.13.1 → 0.14.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 (120) hide show
  1. package/README.md +11 -1
  2. package/dist/dashboard/assets/{BrainCanvas3D-f5Y6PT-1.js → BrainCanvas3D-C-h9U9EK.js} +1 -1
  3. package/dist/dashboard/assets/{_baseUniq-Ta62vsP4.js → _baseUniq-hRFfhv_G.js} +1 -1
  4. package/dist/dashboard/assets/{ar-SA-G6X2FPQ2-jzxJ_ECp.js → ar-SA-G6X2FPQ2-Cis_DI6P.js} +1 -1
  5. package/dist/dashboard/assets/{arc-D-o-9UoH.js → arc-ERWvxQSK.js} +1 -1
  6. package/dist/dashboard/assets/{architectureDiagram-Q4EWVU46-DiKlGJXZ.js → architectureDiagram-Q4EWVU46-CdgUfjJH.js} +1 -1
  7. package/dist/dashboard/assets/{az-AZ-76LH7QW2-BL9xCgsH.js → az-AZ-76LH7QW2-CC4uvTQT.js} +1 -1
  8. package/dist/dashboard/assets/{bg-BG-XCXSNQG7-Ry_R9evo.js → bg-BG-XCXSNQG7-Ca6L7tUZ.js} +1 -1
  9. package/dist/dashboard/assets/{blockDiagram-DXYQGD6D-RsaId3-k.js → blockDiagram-DXYQGD6D-BAQ8qHGf.js} +1 -1
  10. package/dist/dashboard/assets/{bn-BD-2XOGV67Q-CUgI7mYR.js → bn-BD-2XOGV67Q-CwNv7rEZ.js} +1 -1
  11. package/dist/dashboard/assets/{c4Diagram-AHTNJAMY-DPghs0tx.js → c4Diagram-AHTNJAMY-Da0jvbfK.js} +1 -1
  12. package/dist/dashboard/assets/{ca-ES-6MX7JW3Y-BRaiYGc1.js → ca-ES-6MX7JW3Y-DZXDt6-o.js} +1 -1
  13. package/dist/dashboard/assets/channel-CE9W9r0T.js +1 -0
  14. package/dist/dashboard/assets/{chunk-4BX2VUAB-O7GB9cgM.js → chunk-4BX2VUAB-BHgdcref.js} +1 -1
  15. package/dist/dashboard/assets/{chunk-4TB4RGXK-BQOhV1JT.js → chunk-4TB4RGXK-BerOzdCv.js} +1 -1
  16. package/dist/dashboard/assets/{chunk-55IACEB6-DhAIH--W.js → chunk-55IACEB6-Dgx42FSM.js} +1 -1
  17. package/dist/dashboard/assets/{chunk-EDXVE4YY-Chs7mD-k.js → chunk-EDXVE4YY---gI75vB.js} +1 -1
  18. package/dist/dashboard/assets/{chunk-FMBD7UC4-BowamHD9.js → chunk-FMBD7UC4-BmeR0j4E.js} +1 -1
  19. package/dist/dashboard/assets/{chunk-OYMX7WX6-D8UJr8j4.js → chunk-OYMX7WX6-BBjuXiyl.js} +1 -1
  20. package/dist/dashboard/assets/{chunk-QZHKN3VN-BOqj47Nb.js → chunk-QZHKN3VN-xG7-j2u_.js} +1 -1
  21. package/dist/dashboard/assets/{chunk-YZCP3GAM-UDOQPnhm.js → chunk-YZCP3GAM-_UYdHqDn.js} +1 -1
  22. package/dist/dashboard/assets/classDiagram-6PBFFD2Q-c4kMgPz0.js +1 -0
  23. package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-c4kMgPz0.js +1 -0
  24. package/dist/dashboard/assets/clone-B94vjtQj.js +1 -0
  25. package/dist/dashboard/assets/{cose-bilkent-S5V4N54A-D-2ct0N_.js → cose-bilkent-S5V4N54A-Cwey9c1r.js} +1 -1
  26. package/dist/dashboard/assets/{cs-CZ-2BRQDIVT-y64ojEgs.js → cs-CZ-2BRQDIVT-BEvgQeFv.js} +1 -1
  27. package/dist/dashboard/assets/{da-DK-5WZEPLOC-CuGITxZe.js → da-DK-5WZEPLOC-BRZQbTQM.js} +1 -1
  28. package/dist/dashboard/assets/{dagre-KV5264BT-Cl90-nVJ.js → dagre-KV5264BT-DZNKiVjW.js} +1 -1
  29. package/dist/dashboard/assets/{de-DE-XR44H4JA-C4yUFwSz.js → de-DE-XR44H4JA-DO1pW95m.js} +1 -1
  30. package/dist/dashboard/assets/{diagram-5BDNPKRD-CifW537A.js → diagram-5BDNPKRD-M6a8mmLP.js} +1 -1
  31. package/dist/dashboard/assets/{diagram-G4DWMVQ6-JF8e4CmK.js → diagram-G4DWMVQ6-cds4vRT7.js} +1 -1
  32. package/dist/dashboard/assets/{diagram-MMDJMWI5-CYpfsP8h.js → diagram-MMDJMWI5-CRSl3XwD.js} +1 -1
  33. package/dist/dashboard/assets/{diagram-TYMM5635-b9Z_ORTT.js → diagram-TYMM5635-C41sMFwW.js} +1 -1
  34. package/dist/dashboard/assets/{el-GR-BZB4AONW-CgIyu6Mx.js → el-GR-BZB4AONW-CgkZVAqU.js} +1 -1
  35. package/dist/dashboard/assets/{erDiagram-SMLLAGMA-HTrqyUnO.js → erDiagram-SMLLAGMA-Ds6rT6PJ.js} +1 -1
  36. package/dist/dashboard/assets/{es-ES-U4NZUMDT-g-shI88D.js → es-ES-U4NZUMDT-DFjkJwOT.js} +1 -1
  37. package/dist/dashboard/assets/{eu-ES-A7QVB2H4-DRfvnooC.js → eu-ES-A7QVB2H4-Bl10J4eS.js} +1 -1
  38. package/dist/dashboard/assets/{fa-IR-HGAKTJCU-KqJ-bb8r.js → fa-IR-HGAKTJCU-GsRJryZJ.js} +1 -1
  39. package/dist/dashboard/assets/{fi-FI-Z5N7JZ37-Ccm3nZmM.js → fi-FI-Z5N7JZ37-a8x6cx1E.js} +1 -1
  40. package/dist/dashboard/assets/{flowDiagram-DWJPFMVM-B27j9wPy.js → flowDiagram-DWJPFMVM-DvWNy8cu.js} +1 -1
  41. package/dist/dashboard/assets/{fr-FR-RHASNOE6-DvWMfb10.js → fr-FR-RHASNOE6-B2d4Vdh-.js} +1 -1
  42. package/dist/dashboard/assets/{ganttDiagram-T4ZO3ILL-DFbnEWs4.js → ganttDiagram-T4ZO3ILL-By-_j9Pv.js} +1 -1
  43. package/dist/dashboard/assets/{gitGraphDiagram-UUTBAWPF-Bl-6_fjw.js → gitGraphDiagram-UUTBAWPF-CBzBCK_G.js} +1 -1
  44. package/dist/dashboard/assets/{gl-ES-HMX3MZ6V-CfsSyCvn.js → gl-ES-HMX3MZ6V-De8upZJp.js} +1 -1
  45. package/dist/dashboard/assets/{graph-BJt4v-K6.js → graph-J-UVSlk5.js} +1 -1
  46. package/dist/dashboard/assets/{he-IL-6SHJWFNN-DvCmEeEq.js → he-IL-6SHJWFNN-CzkQTV7s.js} +1 -1
  47. package/dist/dashboard/assets/{hi-IN-IWLTKZ5I-Caxq3QFJ.js → hi-IN-IWLTKZ5I-EoIL-8Zu.js} +1 -1
  48. package/dist/dashboard/assets/{hu-HU-A5ZG7DT2-Cak3F0Es.js → hu-HU-A5ZG7DT2-Bvpj8ZFl.js} +1 -1
  49. package/dist/dashboard/assets/{id-ID-SAP4L64H-G6xGS3sm.js → id-ID-SAP4L64H-ChSwBqMY.js} +1 -1
  50. package/dist/dashboard/assets/{index-CchlcoQO.js → index-Blbiu0cG.js} +7 -7
  51. package/dist/dashboard/assets/{index-CmFgzgpQ.js → index-DaMMCefx.js} +1 -1
  52. package/dist/dashboard/assets/{infoDiagram-42DDH7IO-CpKMgFKt.js → infoDiagram-42DDH7IO-BTUUmXjb.js} +1 -1
  53. package/dist/dashboard/assets/{ishikawaDiagram-UXIWVN3A-RFbi-dXL.js → ishikawaDiagram-UXIWVN3A-CupQbClR.js} +1 -1
  54. package/dist/dashboard/assets/{it-IT-JPQ66NNP-CRMjGfJO.js → it-IT-JPQ66NNP-CMB7hZdA.js} +1 -1
  55. package/dist/dashboard/assets/{ja-JP-DBVTYXUO-qKukhnUz.js → ja-JP-DBVTYXUO-CPFcY3Y_.js} +1 -1
  56. package/dist/dashboard/assets/{journeyDiagram-VCZTEJTY-CTNV9WYX.js → journeyDiagram-VCZTEJTY-DyF2JQlC.js} +1 -1
  57. package/dist/dashboard/assets/{kaa-6HZHGXH3-B5jCPUdj.js → kaa-6HZHGXH3-CXRqcV5G.js} +1 -1
  58. package/dist/dashboard/assets/{kab-KAB-ZGHBKWFO-BlL73uqK.js → kab-KAB-ZGHBKWFO-gzVjftfX.js} +1 -1
  59. package/dist/dashboard/assets/{kanban-definition-6JOO6SKY-COgJyhmy.js → kanban-definition-6JOO6SKY-DeI_CbHJ.js} +1 -1
  60. package/dist/dashboard/assets/{kk-KZ-P5N5QNE5-CG0hwSh6.js → kk-KZ-P5N5QNE5-DyUEJoXk.js} +1 -1
  61. package/dist/dashboard/assets/{km-KH-HSX4SM5Z-D7_LIf3_.js → km-KH-HSX4SM5Z-D5HN2Lp6.js} +1 -1
  62. package/dist/dashboard/assets/{ko-KR-MTYHY66A-DDs6LMMU.js → ko-KR-MTYHY66A-2ixYggAG.js} +1 -1
  63. package/dist/dashboard/assets/{ku-TR-6OUDTVRD-AmvNC30P.js → ku-TR-6OUDTVRD-DYmJTC0V.js} +1 -1
  64. package/dist/dashboard/assets/{layout-CpLiDGZe.js → layout-B--7dqfG.js} +1 -1
  65. package/dist/dashboard/assets/{linear-hxRkR_6Y.js → linear-PRP1ZkTO.js} +1 -1
  66. package/dist/dashboard/assets/{lt-LT-XHIRWOB4-DIZituwF.js → lt-LT-XHIRWOB4-BFCXCm91.js} +1 -1
  67. package/dist/dashboard/assets/{lv-LV-5QDEKY6T-BF9ddjMv.js → lv-LV-5QDEKY6T-D05oHFLX.js} +1 -1
  68. package/dist/dashboard/assets/{min-BXf0ulcG.js → min-kjTJ-4bD.js} +1 -1
  69. package/dist/dashboard/assets/{mindmap-definition-QFDTVHPH-CkrPsGZI.js → mindmap-definition-QFDTVHPH-B61nbOYh.js} +1 -1
  70. package/dist/dashboard/assets/{mr-IN-CRQNXWMA-DvT8rSdX.js → mr-IN-CRQNXWMA-B56KizQ7.js} +1 -1
  71. package/dist/dashboard/assets/{my-MM-5M5IBNSE-oTzpHZmp.js → my-MM-5M5IBNSE-BtX3oDcj.js} +1 -1
  72. package/dist/dashboard/assets/{nb-NO-T6EIAALU-mFTc2K9E.js → nb-NO-T6EIAALU-Dxf2gncy.js} +1 -1
  73. package/dist/dashboard/assets/{nl-NL-IS3SIHDZ-BvHG6k52.js → nl-NL-IS3SIHDZ-BrFCx2Ps.js} +1 -1
  74. package/dist/dashboard/assets/{nn-NO-6E72VCQL-DlLoXNop.js → nn-NO-6E72VCQL-CI9ofu1h.js} +1 -1
  75. package/dist/dashboard/assets/{oc-FR-POXYY2M6-Cxl6Ws6i.js → oc-FR-POXYY2M6-COVG8Pkg.js} +1 -1
  76. package/dist/dashboard/assets/{pa-IN-N4M65BXN-BWtil7Y8.js → pa-IN-N4M65BXN-T0uWbP9w.js} +1 -1
  77. package/dist/dashboard/assets/{percentages-BXMCSKIN-CLq2oyzj.js → percentages-BXMCSKIN-Dy9sVH3g.js} +7 -7
  78. package/dist/dashboard/assets/{pica-CMJDNnKQ.js → pica-Dgadywza.js} +1 -1
  79. package/dist/dashboard/assets/{pieDiagram-DEJITSTG-wlxYzLe8.js → pieDiagram-DEJITSTG-C3DFxMfl.js} +1 -1
  80. package/dist/dashboard/assets/{pl-PL-T2D74RX3-Bmw53sUP.js → pl-PL-T2D74RX3-BmxFDT39.js} +1 -1
  81. package/dist/dashboard/assets/{pt-BR-5N22H2LF-ULX3TBZk.js → pt-BR-5N22H2LF-N_amd8l2.js} +1 -1
  82. package/dist/dashboard/assets/{pt-PT-UZXXM6DQ-DfHyDkUR.js → pt-PT-UZXXM6DQ-CET2BSKY.js} +1 -1
  83. package/dist/dashboard/assets/{quadrantDiagram-34T5L4WZ-BR5iSy7H.js → quadrantDiagram-34T5L4WZ-CT-eCe-_.js} +1 -1
  84. package/dist/dashboard/assets/{requirementDiagram-MS252O5E-BNuuSVYh.js → requirementDiagram-MS252O5E-DmoLLM8r.js} +1 -1
  85. package/dist/dashboard/assets/{ro-RO-JPDTUUEW-BC_5xxMm.js → ro-RO-JPDTUUEW-DHKfCUcJ.js} +1 -1
  86. package/dist/dashboard/assets/{ru-RU-B4JR7IUQ-CQPnfmdC.js → ru-RU-B4JR7IUQ-CLmXi4Kh.js} +1 -1
  87. package/dist/dashboard/assets/{sankeyDiagram-XADWPNL6-CwwUGQVB.js → sankeyDiagram-XADWPNL6-CLo6gI4P.js} +1 -1
  88. package/dist/dashboard/assets/{sequenceDiagram-FGHM5R23-Dida7vc4.js → sequenceDiagram-FGHM5R23-DJEg_j4R.js} +1 -1
  89. package/dist/dashboard/assets/{si-LK-N5RQ5JYF-C53L84xe.js → si-LK-N5RQ5JYF-DNIU9N5W.js} +1 -1
  90. package/dist/dashboard/assets/{sk-SK-C5VTKIMK-BcDGWL_O.js → sk-SK-C5VTKIMK-DK8m4F-s.js} +1 -1
  91. package/dist/dashboard/assets/{sl-SI-NN7IZMDC-FuMpHBk9.js → sl-SI-NN7IZMDC-CwDkiq8l.js} +1 -1
  92. package/dist/dashboard/assets/{stateDiagram-FHFEXIEX-CNvfKe7v.js → stateDiagram-FHFEXIEX-ClIXb6Ze.js} +1 -1
  93. package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-CoiDH22q.js +1 -0
  94. package/dist/dashboard/assets/{subset-shared.chunk-Do9_AHqy.js → subset-shared.chunk-CAyWMkL5.js} +1 -1
  95. package/dist/dashboard/assets/{subset-worker.chunk-i2BHHQN3.js → subset-worker.chunk-CmQMH6YW.js} +1 -1
  96. package/dist/dashboard/assets/{sv-SE-XGPEYMSR-CAB9zxpi.js → sv-SE-XGPEYMSR-DCkGUpCS.js} +1 -1
  97. package/dist/dashboard/assets/{ta-IN-2NMHFXQM-yDO7M7xr.js → ta-IN-2NMHFXQM-B-JF3l8-.js} +1 -1
  98. package/dist/dashboard/assets/{th-TH-HPSO5L25-B1m3C6pX.js → th-TH-HPSO5L25-BUssI4Qx.js} +1 -1
  99. package/dist/dashboard/assets/{timeline-definition-GMOUNBTQ-CujUrKzh.js → timeline-definition-GMOUNBTQ-DFd98vtt.js} +1 -1
  100. package/dist/dashboard/assets/{tr-TR-DEFEU3FU-CL5wc1n8.js → tr-TR-DEFEU3FU-BJ0vNPSC.js} +1 -1
  101. package/dist/dashboard/assets/{uk-UA-QMV73CPH-BbweuNSf.js → uk-UA-QMV73CPH-DW6uMTkt.js} +1 -1
  102. package/dist/dashboard/assets/{vennDiagram-DHZGUBPP-ar0AgOfJ.js → vennDiagram-DHZGUBPP-Bz1mnQpB.js} +1 -1
  103. package/dist/dashboard/assets/{vi-VN-M7AON7JQ--lCR5VP0.js → vi-VN-M7AON7JQ-BybAv0UR.js} +1 -1
  104. package/dist/dashboard/assets/{wardley-RL74JXVD-DWD-UZhX.js → wardley-RL74JXVD-B1O-fe8V.js} +1 -1
  105. package/dist/dashboard/assets/{wardleyDiagram-NUSXRM2D-Et52gtVy.js → wardleyDiagram-NUSXRM2D-D4BoVVBq.js} +1 -1
  106. package/dist/dashboard/assets/{xychartDiagram-5P7HB3ND-pMHGVahC.js → xychartDiagram-5P7HB3ND-B8Mqq3ZE.js} +1 -1
  107. package/dist/dashboard/assets/{zh-CN-LNUGB5OW-DSVSl5q1.js → zh-CN-LNUGB5OW-D8zZgi2m.js} +1 -1
  108. package/dist/dashboard/assets/{zh-HK-E62DVLB3-DxZ5YtvV.js → zh-HK-E62DVLB3-BO03ysMO.js} +1 -1
  109. package/dist/dashboard/assets/{zh-TW-RAJ6MFWO-DlXNVnbL.js → zh-TW-RAJ6MFWO-7JII7AnC.js} +1 -1
  110. package/dist/dashboard/index.html +1 -1
  111. package/dist/index.js +6383 -5865
  112. package/package.json +3 -2
  113. package/skill/SKILL.md +1 -1
  114. package/skill/references/cli-reference.md +4 -2
  115. package/skill/references/knowledge-and-recall.md +2 -1
  116. package/dist/dashboard/assets/channel-BxXtm6aL.js +0 -1
  117. package/dist/dashboard/assets/classDiagram-6PBFFD2Q-DRDRixtt.js +0 -1
  118. package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-DRDRixtt.js +0 -1
  119. package/dist/dashboard/assets/clone-DDdzwqUk.js +0 -1
  120. package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-B8F8hUBl.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-DmNpeJAL.js","assets/core-Cn4yfEqx.js","assets/event-BbvoZQ5o.js","assets/index-NsrznfmA.js","assets/webviewWindow-BbG9Cr7f.js","assets/index-D-gsCv2F.js","assets/dagre-KV5264BT-Cl90-nVJ.js","assets/graph-BJt4v-K6.js","assets/_baseUniq-Ta62vsP4.js","assets/layout-CpLiDGZe.js","assets/min-BXf0ulcG.js","assets/clone-DDdzwqUk.js","assets/cose-bilkent-S5V4N54A-D-2ct0N_.js","assets/cytoscape.esm-D_LviqZs.js","assets/c4Diagram-AHTNJAMY-DPghs0tx.js","assets/chunk-YZCP3GAM-UDOQPnhm.js","assets/flowDiagram-DWJPFMVM-B27j9wPy.js","assets/chunk-FMBD7UC4-BowamHD9.js","assets/chunk-55IACEB6-DhAIH--W.js","assets/chunk-EDXVE4YY-Chs7mD-k.js","assets/channel-BxXtm6aL.js","assets/erDiagram-SMLLAGMA-HTrqyUnO.js","assets/gitGraphDiagram-UUTBAWPF-Bl-6_fjw.js","assets/chunk-4BX2VUAB-O7GB9cgM.js","assets/chunk-QZHKN3VN-BOqj47Nb.js","assets/wardley-RL74JXVD-DWD-UZhX.js","assets/ganttDiagram-T4ZO3ILL-DFbnEWs4.js","assets/linear-hxRkR_6Y.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-CpKMgFKt.js","assets/pieDiagram-DEJITSTG-wlxYzLe8.js","assets/arc-D-o-9UoH.js","assets/quadrantDiagram-34T5L4WZ-BR5iSy7H.js","assets/xychartDiagram-5P7HB3ND-pMHGVahC.js","assets/requirementDiagram-MS252O5E-BNuuSVYh.js","assets/sequenceDiagram-FGHM5R23-Dida7vc4.js","assets/classDiagram-6PBFFD2Q-DRDRixtt.js","assets/chunk-4TB4RGXK-BQOhV1JT.js","assets/classDiagram-v2-HSJHXN6E-DRDRixtt.js","assets/stateDiagram-FHFEXIEX-CNvfKe7v.js","assets/chunk-OYMX7WX6-D8UJr8j4.js","assets/stateDiagram-v2-QKLJ7IA2-B8F8hUBl.js","assets/journeyDiagram-VCZTEJTY-CTNV9WYX.js","assets/timeline-definition-GMOUNBTQ-CujUrKzh.js","assets/mindmap-definition-QFDTVHPH-CkrPsGZI.js","assets/kanban-definition-6JOO6SKY-COgJyhmy.js","assets/diagram-TYMM5635-b9Z_ORTT.js","assets/diagram-MMDJMWI5-CYpfsP8h.js","assets/blockDiagram-DXYQGD6D-RsaId3-k.js","assets/diagram-5BDNPKRD-CifW537A.js","assets/architectureDiagram-Q4EWVU46-DiKlGJXZ.js","assets/diagram-G4DWMVQ6-JF8e4CmK.js","assets/wardleyDiagram-NUSXRM2D-Et52gtVy.js","assets/percentages-BXMCSKIN-CLq2oyzj.js","assets/extends-CF3RwP-h.js","assets/percentages-BXMCSKIN-DnMnD4LF.css","assets/BrainCanvas3D-f5Y6PT-1.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-DmNpeJAL.js","assets/core-Cn4yfEqx.js","assets/event-BbvoZQ5o.js","assets/index-NsrznfmA.js","assets/webviewWindow-BbG9Cr7f.js","assets/index-D-gsCv2F.js","assets/dagre-KV5264BT-DZNKiVjW.js","assets/graph-J-UVSlk5.js","assets/_baseUniq-hRFfhv_G.js","assets/layout-B--7dqfG.js","assets/min-kjTJ-4bD.js","assets/clone-B94vjtQj.js","assets/cose-bilkent-S5V4N54A-Cwey9c1r.js","assets/cytoscape.esm-D_LviqZs.js","assets/c4Diagram-AHTNJAMY-Da0jvbfK.js","assets/chunk-YZCP3GAM-_UYdHqDn.js","assets/flowDiagram-DWJPFMVM-DvWNy8cu.js","assets/chunk-FMBD7UC4-BmeR0j4E.js","assets/chunk-55IACEB6-Dgx42FSM.js","assets/chunk-EDXVE4YY---gI75vB.js","assets/channel-CE9W9r0T.js","assets/erDiagram-SMLLAGMA-Ds6rT6PJ.js","assets/gitGraphDiagram-UUTBAWPF-CBzBCK_G.js","assets/chunk-4BX2VUAB-BHgdcref.js","assets/chunk-QZHKN3VN-xG7-j2u_.js","assets/wardley-RL74JXVD-B1O-fe8V.js","assets/ganttDiagram-T4ZO3ILL-By-_j9Pv.js","assets/linear-PRP1ZkTO.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-BTUUmXjb.js","assets/pieDiagram-DEJITSTG-C3DFxMfl.js","assets/arc-ERWvxQSK.js","assets/quadrantDiagram-34T5L4WZ-CT-eCe-_.js","assets/xychartDiagram-5P7HB3ND-B8Mqq3ZE.js","assets/requirementDiagram-MS252O5E-DmoLLM8r.js","assets/sequenceDiagram-FGHM5R23-DJEg_j4R.js","assets/classDiagram-6PBFFD2Q-c4kMgPz0.js","assets/chunk-4TB4RGXK-BerOzdCv.js","assets/classDiagram-v2-HSJHXN6E-c4kMgPz0.js","assets/stateDiagram-FHFEXIEX-ClIXb6Ze.js","assets/chunk-OYMX7WX6-BBjuXiyl.js","assets/stateDiagram-v2-QKLJ7IA2-CoiDH22q.js","assets/journeyDiagram-VCZTEJTY-DyF2JQlC.js","assets/timeline-definition-GMOUNBTQ-DFd98vtt.js","assets/mindmap-definition-QFDTVHPH-B61nbOYh.js","assets/kanban-definition-6JOO6SKY-DeI_CbHJ.js","assets/diagram-TYMM5635-C41sMFwW.js","assets/diagram-MMDJMWI5-CRSl3XwD.js","assets/blockDiagram-DXYQGD6D-BAQ8qHGf.js","assets/diagram-5BDNPKRD-M6a8mmLP.js","assets/architectureDiagram-Q4EWVU46-CdgUfjJH.js","assets/diagram-G4DWMVQ6-cds4vRT7.js","assets/wardleyDiagram-NUSXRM2D-D4BoVVBq.js","assets/percentages-BXMCSKIN-Dy9sVH3g.js","assets/extends-CF3RwP-h.js","assets/percentages-BXMCSKIN-DnMnD4LF.css","assets/BrainCanvas3D-C-h9U9EK.js"])))=>i.map(i=>d[i]);
2
2
  var IP=Object.defineProperty;var SE=r=>{throw TypeError(r)};var FP=(r,e,i)=>e in r?IP(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i;var Ut=(r,e,i)=>FP(r,typeof e!="symbol"?e+"":e,i),d0=(r,e,i)=>e.has(r)||SE("Cannot "+i);var me=(r,e,i)=>(d0(r,e,"read from private field"),i?i.call(r):e.get(r)),Wt=(r,e,i)=>e.has(r)?SE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,i),Ct=(r,e,i,n)=>(d0(r,e,"write to private field"),n?n.call(r,i):e.set(r,i),i),fr=(r,e,i)=>(d0(r,e,"access private method"),i);var cg=(r,e,i,n)=>({set _(s){Ct(r,e,s,i)},get _(){return me(r,e,n)}});function $P(r,e){for(var i=0;i<e.length;i++){const n=e[i];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in r)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(r,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const h of o.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function i(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=i(s);fetch(s.href,o)}})();var Bme=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function uu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Rme(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var i=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(i,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),i}var f0={exports:{}},od={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -47,7 +47,7 @@ var IP=Object.defineProperty;var SE=r=>{throw TypeError(r)};var FP=(r,e,i)=>e in
47
47
  `+ge[S].replace(" at new "," at ");return c.displayName&&We.includes("<anonymous>")&&(We=We.replace("<anonymous>",c.displayName)),We}while(1<=S&&0<=M);break}}}finally{qe=!1,Error.prepareStackTrace=b}return(b=c?c.displayName||c.name:"")?Ze(b):""}function pe(c,f){switch(c.tag){case 26:case 27:case 5:return Ze(c.type);case 16:return Ze("Lazy");case 13:return c.child!==f&&f!==null?Ze("Suspense Fallback"):Ze("Suspense");case 19:return Ze("SuspenseList");case 0:case 15:return Ye(c.type,!1);case 11:return Ye(c.type.render,!1);case 1:return Ye(c.type,!0);case 31:return Ze("Activity");default:return""}}function Ne(c){try{var f="",b=null;do f+=pe(c,b),b=c,c=c.return;while(c);return f}catch(S){return`
48
48
  Error generating stack: `+S.message+`
49
49
  `+S.stack}}var de=Object.prototype.hasOwnProperty,Ue=r.unstable_scheduleCallback,at=r.unstable_cancelCallback,Pt=r.unstable_shouldYield,Mt=r.unstable_requestPaint,Lt=r.unstable_now,Bt=r.unstable_getCurrentPriorityLevel,bt=r.unstable_ImmediatePriority,Se=r.unstable_UserBlockingPriority,De=r.unstable_NormalPriority,Me=r.unstable_LowPriority,Je=r.unstable_IdlePriority,wt=r.log,ot=r.unstable_setDisableYieldValue,At=null,Te=null;function ft(c){if(typeof wt=="function"&&ot(c),Te&&typeof Te.setStrictMode=="function")try{Te.setStrictMode(At,c)}catch{}}var lt=Math.clz32?Math.clz32:et,be=Math.log,ye=Math.LN2;function et(c){return c>>>=0,c===0?32:31-(be(c)/ye|0)|0}var Ge=256,vt=262144,ut=4194304;function kt(c){var f=c&42;if(f!==0)return f;switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return c&261888;case 262144:case 524288:case 1048576:case 2097152:return c&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return c&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return c}}function se(c,f,b){var S=c.pendingLanes;if(S===0)return 0;var M=0,B=c.suspendedLanes,V=c.pingedLanes;c=c.warmLanes;var te=S&134217727;return te!==0?(S=te&~B,S!==0?M=kt(S):(V&=te,V!==0?M=kt(V):b||(b=te&~c,b!==0&&(M=kt(b))))):(te=S&~B,te!==0?M=kt(te):V!==0?M=kt(V):b||(b=S&~c,b!==0&&(M=kt(b)))),M===0?0:f!==0&&f!==M&&(f&B)===0&&(B=M&-M,b=f&-f,B>=b||B===32&&(b&4194048)!==0)?f:M}function oe(c,f){return(c.pendingLanes&~(c.suspendedLanes&~c.pingedLanes)&f)===0}function we(c,f){switch(c){case 1:case 2:case 4:case 8:case 64:return f+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tt(){var c=ut;return ut<<=1,(ut&62914560)===0&&(ut=4194304),c}function Et(c){for(var f=[],b=0;31>b;b++)f.push(c);return f}function dt(c,f){c.pendingLanes|=f,f!==268435456&&(c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0)}function nt(c,f,b,S,M,B){var V=c.pendingLanes;c.pendingLanes=b,c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0,c.expiredLanes&=b,c.entangledLanes&=b,c.errorRecoveryDisabledLanes&=b,c.shellSuspendCounter=0;var te=c.entanglements,ge=c.expirationTimes,je=c.hiddenUpdates;for(b=V&~b;0<b;){var We=31-lt(b),Xe=1<<We;te[We]=0,ge[We]=-1;var Oe=je[We];if(Oe!==null)for(je[We]=null,We=0;We<Oe.length;We++){var Fe=Oe[We];Fe!==null&&(Fe.lane&=-536870913)}b&=~Xe}S!==0&&it(c,S,0),B!==0&&M===0&&c.tag!==0&&(c.suspendedLanes|=B&~(V&~f))}function it(c,f,b){c.pendingLanes|=f,c.suspendedLanes&=~f;var S=31-lt(f);c.entangledLanes|=f,c.entanglements[S]=c.entanglements[S]|1073741824|b&261930}function gt(c,f){var b=c.entangledLanes|=f;for(c=c.entanglements;b;){var S=31-lt(b),M=1<<S;M&f|c[S]&f&&(c[S]|=f),b&=~M}}function ae(c,f){var b=f&-f;return b=(b&42)!==0?1:le(b),(b&(c.suspendedLanes|f))!==0?0:b}function le(c){switch(c){case 2:c=1;break;case 8:c=4;break;case 32:c=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:c=128;break;case 268435456:c=134217728;break;default:c=0}return c}function ve(c){return c&=-c,2<c?8<c?(c&134217727)!==0?32:268435456:8:2}function Re(){var c=W.p;return c!==0?c:(c=window.event,c===void 0?32:bE(c.type))}function $e(c,f){var b=W.p;try{return W.p=c,f()}finally{W.p=b}}var Ke=Math.random().toString(36).slice(2),xt="__reactFiber$"+Ke,$t="__reactProps$"+Ke,Kr="__reactContainer$"+Ke,zr="__reactEvents$"+Ke,En="__reactListeners$"+Ke,Nn="__reactHandles$"+Ke,Li="__reactResources$"+Ke,Hn="__reactMarker$"+Ke;function Os(c){delete c[xt],delete c[$t],delete c[zr],delete c[En],delete c[Nn]}function xi(c){var f=c[xt];if(f)return f;for(var b=c.parentNode;b;){if(f=b[Kr]||b[xt]){if(b=f.alternate,f.child!==null||b!==null&&b.child!==null)for(c=rE(c);c!==null;){if(b=c[xt])return b;c=rE(c)}return f}c=b,b=c.parentNode}return null}function Qi(c){if(c=c[xt]||c[Kr]){var f=c.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return c}return null}function fn(c){var f=c.tag;if(f===5||f===26||f===27||f===6)return c.stateNode;throw Error(n(33))}function _i(c){var f=c[Li];return f||(f=c[Li]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function Lr(c){c[Hn]=!0}var Tt=new Set,ce={};function He(c,f){Ee(c,f),Ee(c+"Capture",f)}function Ee(c,f){for(ce[c]=f,c=0;c<f.length;c++)Tt.add(f[c])}var ct=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),mt={},zt={};function gr(c){return de.call(zt,c)?!0:de.call(mt,c)?!1:ct.test(c)?zt[c]=!0:(mt[c]=!0,!1)}function Br(c,f,b){if(gr(f))if(b===null)c.removeAttribute(f);else{switch(typeof b){case"undefined":case"function":case"symbol":c.removeAttribute(f);return;case"boolean":var S=f.toLowerCase().slice(0,5);if(S!=="data-"&&S!=="aria-"){c.removeAttribute(f);return}}c.setAttribute(f,""+b)}}function Cr(c,f,b){if(b===null)c.removeAttribute(f);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":c.removeAttribute(f);return}c.setAttribute(f,""+b)}}function ri(c,f,b,S){if(S===null)c.removeAttribute(b);else{switch(typeof S){case"undefined":case"function":case"symbol":case"boolean":c.removeAttribute(b);return}c.setAttributeNS(f,b,""+S)}}function ir(c){switch(typeof c){case"bigint":case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function si(c){var f=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Un(c,f,b){var S=Object.getOwnPropertyDescriptor(c.constructor.prototype,f);if(!c.hasOwnProperty(f)&&typeof S<"u"&&typeof S.get=="function"&&typeof S.set=="function"){var M=S.get,B=S.set;return Object.defineProperty(c,f,{configurable:!0,get:function(){return M.call(this)},set:function(V){b=""+V,B.call(this,V)}}),Object.defineProperty(c,f,{enumerable:S.enumerable}),{getValue:function(){return b},setValue:function(V){b=""+V},stopTracking:function(){c._valueTracker=null,delete c[f]}}}}function ms(c){if(!c._valueTracker){var f=si(c)?"checked":"value";c._valueTracker=Un(c,f,""+c[f])}}function Xa(c){if(!c)return!1;var f=c._valueTracker;if(!f)return!0;var b=f.getValue(),S="";return c&&(S=si(c)?c.checked?"true":"false":c.value),c=S,c!==b?(f.setValue(c),!0):!1}function la(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}var ol=/[\n"\\]/g;function Bi(c){return c.replace(ol,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function Wn(c,f,b,S,M,B,V,te){c.name="",V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?c.type=V:c.removeAttribute("type"),f!=null?V==="number"?(f===0&&c.value===""||c.value!=f)&&(c.value=""+ir(f)):c.value!==""+ir(f)&&(c.value=""+ir(f)):V!=="submit"&&V!=="reset"||c.removeAttribute("value"),f!=null?st(c,V,ir(f)):b!=null?st(c,V,ir(b)):S!=null&&c.removeAttribute("value"),M==null&&B!=null&&(c.defaultChecked=!!B),M!=null&&(c.checked=M&&typeof M!="function"&&typeof M!="symbol"),te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?c.name=""+ir(te):c.removeAttribute("name")}function Be(c,f,b,S,M,B,V,te){if(B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(c.type=B),f!=null||b!=null){if(!(B!=="submit"&&B!=="reset"||f!=null)){ms(c);return}b=b!=null?""+ir(b):"",f=f!=null?""+ir(f):b,te||f===c.value||(c.value=f),c.defaultValue=f}S=S??M,S=typeof S!="function"&&typeof S!="symbol"&&!!S,c.checked=te?c.checked:!!S,c.defaultChecked=!!S,V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(c.name=V),ms(c)}function st(c,f,b){f==="number"&&la(c.ownerDocument)===c||c.defaultValue===""+b||(c.defaultValue=""+b)}function rt(c,f,b,S){if(c=c.options,f){f={};for(var M=0;M<b.length;M++)f["$"+b[M]]=!0;for(b=0;b<c.length;b++)M=f.hasOwnProperty("$"+c[b].value),c[b].selected!==M&&(c[b].selected=M),M&&S&&(c[b].defaultSelected=!0)}else{for(b=""+ir(b),f=null,M=0;M<c.length;M++){if(c[M].value===b){c[M].selected=!0,S&&(c[M].defaultSelected=!0);return}f!==null||c[M].disabled||(f=c[M])}f!==null&&(f.selected=!0)}}function _t(c,f,b){if(f!=null&&(f=""+ir(f),f!==c.value&&(c.value=f),b==null)){c.defaultValue!==f&&(c.defaultValue=f);return}c.defaultValue=b!=null?""+ir(b):""}function hr(c,f,b,S){if(f==null){if(S!=null){if(b!=null)throw Error(n(92));if($(S)){if(1<S.length)throw Error(n(93));S=S[0]}b=S}b==null&&(b=""),f=b}b=ir(f),c.defaultValue=b,S=c.textContent,S===b&&S!==""&&S!==null&&(c.value=S),ms(c)}function yt(c,f){if(f){var b=c.firstChild;if(b&&b===c.lastChild&&b.nodeType===3){b.nodeValue=f;return}}c.textContent=f}var Tr=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function pr(c,f,b){var S=f.indexOf("--")===0;b==null||typeof b=="boolean"||b===""?S?c.setProperty(f,""):f==="float"?c.cssFloat="":c[f]="":S?c.setProperty(f,b):typeof b!="number"||b===0||Tr.has(f)?f==="float"?c.cssFloat=b:c[f]=(""+b).trim():c[f]=b+"px"}function br(c,f,b){if(f!=null&&typeof f!="object")throw Error(n(62));if(c=c.style,b!=null){for(var S in b)!b.hasOwnProperty(S)||f!=null&&f.hasOwnProperty(S)||(S.indexOf("--")===0?c.setProperty(S,""):S==="float"?c.cssFloat="":c[S]="");for(var M in f)S=f[M],f.hasOwnProperty(M)&&b[M]!==S&&pr(c,M,S)}else for(var B in f)f.hasOwnProperty(B)&&pr(c,B,f[B])}function qi(c){if(c.indexOf("-")===-1)return!1;switch(c){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gn=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Za=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qa(c){return Za.test(""+c)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":c}function pt(){}var Dt=null;function lr(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var vr=null,ii=null;function Kn(c){var f=Qi(c);if(f&&(c=f.stateNode)){var b=c[$t]||null;e:switch(c=f.stateNode,f.type){case"input":if(Wn(c,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name),f=b.name,b.type==="radio"&&f!=null){for(b=c;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll('input[name="'+Bi(""+f)+'"][type="radio"]'),f=0;f<b.length;f++){var S=b[f];if(S!==c&&S.form===c.form){var M=S[$t]||null;if(!M)throw Error(n(90));Wn(S,M.value,M.defaultValue,M.defaultValue,M.checked,M.defaultChecked,M.type,M.name)}}for(f=0;f<b.length;f++)S=b[f],S.form===c.form&&Xa(S)}break e;case"textarea":_t(c,b.value,b.defaultValue);break e;case"select":f=b.value,f!=null&&rt(c,!!b.multiple,f,!1)}}}var vu=!1;function ep(c,f,b){if(vu)return c(f,b);vu=!0;try{var S=c(f);return S}finally{if(vu=!1,(vr!==null||ii!==null)&&(zp(),vr&&(f=vr,c=ii,ii=vr=null,Kn(f),c)))for(f=0;f<c.length;f++)Kn(c[f])}}function xu(c,f){var b=c.stateNode;if(b===null)return null;var S=b[$t]||null;if(S===null)return null;b=S[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(S=!S.disabled)||(c=c.type,S=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!S;break e;default:c=!1}if(c)return null;if(b&&typeof b!="function")throw Error(n(231,f,typeof b));return b}var ca=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),db=!1;if(ca)try{var _u={};Object.defineProperty(_u,"passive",{get:function(){db=!0}}),window.addEventListener("test",_u,_u),window.removeEventListener("test",_u,_u)}catch{db=!1}var Ja=null,fb=null,tp=null;function Yk(){if(tp)return tp;var c,f=fb,b=f.length,S,M="value"in Ja?Ja.value:Ja.textContent,B=M.length;for(c=0;c<b&&f[c]===M[c];c++);var V=b-c;for(S=1;S<=V&&f[b-S]===M[B-S];S++);return tp=M.slice(c,1<S?1-S:void 0)}function rp(c){var f=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&f===13&&(c=13)):c=f,c===10&&(c=13),32<=c||c===13?c:0}function ip(){return!0}function Xk(){return!1}function pn(c){function f(b,S,M,B,V){this._reactName=b,this._targetInst=M,this.type=S,this.nativeEvent=B,this.target=V,this.currentTarget=null;for(var te in c)c.hasOwnProperty(te)&&(b=c[te],this[te]=b?b(B):B[te]);return this.isDefaultPrevented=(B.defaultPrevented!=null?B.defaultPrevented:B.returnValue===!1)?ip:Xk,this.isPropagationStopped=Xk,this}return p(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=ip)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=ip)},persist:function(){},isPersistent:ip}),f}var ll={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},np=pn(ll),Cu=p({},ll,{view:0,detail:0}),O$=pn(Cu),pb,gb,wu,sp=p({},Cu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yb,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==wu&&(wu&&c.type==="mousemove"?(pb=c.screenX-wu.screenX,gb=c.screenY-wu.screenY):gb=pb=0,wu=c),pb)},movementY:function(c){return"movementY"in c?c.movementY:gb}}),Zk=pn(sp),D$=p({},sp,{dataTransfer:0}),I$=pn(D$),F$=p({},Cu,{relatedTarget:0}),mb=pn(F$),$$=p({},ll,{animationName:0,elapsedTime:0,pseudoElement:0}),P$=pn($$),z$=p({},ll,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),q$=pn(z$),H$=p({},ll,{data:0}),Qk=pn(H$),U$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W$={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},G$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function K$(c){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(c):(c=G$[c])?!!f[c]:!1}function yb(){return K$}var V$=p({},Cu,{key:function(c){if(c.key){var f=U$[c.key]||c.key;if(f!=="Unidentified")return f}return c.type==="keypress"?(c=rp(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?W$[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yb,charCode:function(c){return c.type==="keypress"?rp(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?rp(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),Y$=pn(V$),X$=p({},sp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jk=pn(X$),Z$=p({},Cu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yb}),Q$=pn(Z$),J$=p({},ll,{propertyName:0,elapsedTime:0,pseudoElement:0}),e8=pn(J$),t8=p({},sp,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),r8=pn(t8),i8=p({},ll,{newState:0,oldState:0}),n8=pn(i8),s8=[9,13,27,32],bb=ca&&"CompositionEvent"in window,ku=null;ca&&"documentMode"in document&&(ku=document.documentMode);var a8=ca&&"TextEvent"in window&&!ku,eS=ca&&(!bb||ku&&8<ku&&11>=ku),tS=" ",rS=!1;function iS(c,f){switch(c){case"keyup":return s8.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nS(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var wc=!1;function o8(c,f){switch(c){case"compositionend":return nS(f);case"keypress":return f.which!==32?null:(rS=!0,tS);case"textInput":return c=f.data,c===tS&&rS?null:c;default:return null}}function l8(c,f){if(wc)return c==="compositionend"||!bb&&iS(c,f)?(c=Yk(),tp=fb=Ja=null,wc=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return eS&&f.locale!=="ko"?null:f.data;default:return null}}var c8={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function sS(c){var f=c&&c.nodeName&&c.nodeName.toLowerCase();return f==="input"?!!c8[c.type]:f==="textarea"}function aS(c,f,b,S){vr?ii?ii.push(S):ii=[S]:vr=S,f=Vp(f,"onChange"),0<f.length&&(b=new np("onChange","change",null,b,S),c.push({event:b,listeners:f}))}var Su=null,Tu=null;function h8(c){qT(c,0)}function ap(c){var f=fn(c);if(Xa(f))return c}function oS(c,f){if(c==="change")return f}var lS=!1;if(ca){var vb;if(ca){var xb="oninput"in document;if(!xb){var cS=document.createElement("div");cS.setAttribute("oninput","return;"),xb=typeof cS.oninput=="function"}vb=xb}else vb=!1;lS=vb&&(!document.documentMode||9<document.documentMode)}function hS(){Su&&(Su.detachEvent("onpropertychange",uS),Tu=Su=null)}function uS(c){if(c.propertyName==="value"&&ap(Tu)){var f=[];aS(f,Tu,c,lr(c)),ep(h8,f)}}function u8(c,f,b){c==="focusin"?(hS(),Su=f,Tu=b,Su.attachEvent("onpropertychange",uS)):c==="focusout"&&hS()}function d8(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return ap(Tu)}function f8(c,f){if(c==="click")return ap(f)}function p8(c,f){if(c==="input"||c==="change")return ap(f)}function g8(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var An=typeof Object.is=="function"?Object.is:g8;function Eu(c,f){if(An(c,f))return!0;if(typeof c!="object"||c===null||typeof f!="object"||f===null)return!1;var b=Object.keys(c),S=Object.keys(f);if(b.length!==S.length)return!1;for(S=0;S<b.length;S++){var M=b[S];if(!de.call(f,M)||!An(c[M],f[M]))return!1}return!0}function dS(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function fS(c,f){var b=dS(c);c=0;for(var S;b;){if(b.nodeType===3){if(S=c+b.textContent.length,c<=f&&S>=f)return{node:b,offset:f-c};c=S}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=dS(b)}}function pS(c,f){return c&&f?c===f?!0:c&&c.nodeType===3?!1:f&&f.nodeType===3?pS(c,f.parentNode):"contains"in c?c.contains(f):c.compareDocumentPosition?!!(c.compareDocumentPosition(f)&16):!1:!1}function gS(c){c=c!=null&&c.ownerDocument!=null&&c.ownerDocument.defaultView!=null?c.ownerDocument.defaultView:window;for(var f=la(c.document);f instanceof c.HTMLIFrameElement;){try{var b=typeof f.contentWindow.location.href=="string"}catch{b=!1}if(b)c=f.contentWindow;else break;f=la(c.document)}return f}function _b(c){var f=c&&c.nodeName&&c.nodeName.toLowerCase();return f&&(f==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||f==="textarea"||c.contentEditable==="true")}var m8=ca&&"documentMode"in document&&11>=document.documentMode,kc=null,Cb=null,Nu=null,wb=!1;function mS(c,f,b){var S=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;wb||kc==null||kc!==la(S)||(S=kc,"selectionStart"in S&&_b(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),Nu&&Eu(Nu,S)||(Nu=S,S=Vp(Cb,"onSelect"),0<S.length&&(f=new np("onSelect","select",null,f,b),c.push({event:f,listeners:S}),f.target=kc)))}function cl(c,f){var b={};return b[c.toLowerCase()]=f.toLowerCase(),b["Webkit"+c]="webkit"+f,b["Moz"+c]="moz"+f,b}var Sc={animationend:cl("Animation","AnimationEnd"),animationiteration:cl("Animation","AnimationIteration"),animationstart:cl("Animation","AnimationStart"),transitionrun:cl("Transition","TransitionRun"),transitionstart:cl("Transition","TransitionStart"),transitioncancel:cl("Transition","TransitionCancel"),transitionend:cl("Transition","TransitionEnd")},kb={},yS={};ca&&(yS=document.createElement("div").style,"AnimationEvent"in window||(delete Sc.animationend.animation,delete Sc.animationiteration.animation,delete Sc.animationstart.animation),"TransitionEvent"in window||delete Sc.transitionend.transition);function hl(c){if(kb[c])return kb[c];if(!Sc[c])return c;var f=Sc[c],b;for(b in f)if(f.hasOwnProperty(b)&&b in yS)return kb[c]=f[b];return c}var bS=hl("animationend"),vS=hl("animationiteration"),xS=hl("animationstart"),y8=hl("transitionrun"),b8=hl("transitionstart"),v8=hl("transitioncancel"),_S=hl("transitionend"),CS=new Map,Sb="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Sb.push("scrollEnd");function ys(c,f){CS.set(c,f),He(f,[c])}var op=typeof reportError=="function"?reportError:function(c){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof c=="object"&&c!==null&&typeof c.message=="string"?String(c.message):String(c),error:c});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",c);return}console.error(c)},Vn=[],Tc=0,Tb=0;function lp(){for(var c=Tc,f=Tb=Tc=0;f<c;){var b=Vn[f];Vn[f++]=null;var S=Vn[f];Vn[f++]=null;var M=Vn[f];Vn[f++]=null;var B=Vn[f];if(Vn[f++]=null,S!==null&&M!==null){var V=S.pending;V===null?M.next=M:(M.next=V.next,V.next=M),S.pending=M}B!==0&&wS(b,M,B)}}function cp(c,f,b,S){Vn[Tc++]=c,Vn[Tc++]=f,Vn[Tc++]=b,Vn[Tc++]=S,Tb|=S,c.lanes|=S,c=c.alternate,c!==null&&(c.lanes|=S)}function Eb(c,f,b,S){return cp(c,f,b,S),hp(c)}function ul(c,f){return cp(c,null,null,f),hp(c)}function wS(c,f,b){c.lanes|=b;var S=c.alternate;S!==null&&(S.lanes|=b);for(var M=!1,B=c.return;B!==null;)B.childLanes|=b,S=B.alternate,S!==null&&(S.childLanes|=b),B.tag===22&&(c=B.stateNode,c===null||c._visibility&1||(M=!0)),c=B,B=B.return;return c.tag===3?(B=c.stateNode,M&&f!==null&&(M=31-lt(b),c=B.hiddenUpdates,S=c[M],S===null?c[M]=[f]:S.push(f),f.lane=b|536870912),B):null}function hp(c){if(50<Xu)throw Xu=0,Dv=null,Error(n(185));for(var f=c.return;f!==null;)c=f,f=c.return;return c.tag===3?c.stateNode:null}var Ec={};function x8(c,f,b,S){this.tag=c,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(c,f,b,S){return new x8(c,f,b,S)}function Nb(c){return c=c.prototype,!(!c||!c.isReactComponent)}function ha(c,f){var b=c.alternate;return b===null?(b=jn(c.tag,f,c.key,c.mode),b.elementType=c.elementType,b.type=c.type,b.stateNode=c.stateNode,b.alternate=c,c.alternate=b):(b.pendingProps=f,b.type=c.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=c.flags&65011712,b.childLanes=c.childLanes,b.lanes=c.lanes,b.child=c.child,b.memoizedProps=c.memoizedProps,b.memoizedState=c.memoizedState,b.updateQueue=c.updateQueue,f=c.dependencies,b.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},b.sibling=c.sibling,b.index=c.index,b.ref=c.ref,b.refCleanup=c.refCleanup,b}function kS(c,f){c.flags&=65011714;var b=c.alternate;return b===null?(c.childLanes=0,c.lanes=f,c.child=null,c.subtreeFlags=0,c.memoizedProps=null,c.memoizedState=null,c.updateQueue=null,c.dependencies=null,c.stateNode=null):(c.childLanes=b.childLanes,c.lanes=b.lanes,c.child=b.child,c.subtreeFlags=0,c.deletions=null,c.memoizedProps=b.memoizedProps,c.memoizedState=b.memoizedState,c.updateQueue=b.updateQueue,c.type=b.type,f=b.dependencies,c.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),c}function up(c,f,b,S,M,B){var V=0;if(S=c,typeof c=="function")Nb(c)&&(V=1);else if(typeof c=="string")V=SP(c,b,ee.current)?26:c==="html"||c==="head"||c==="body"?27:5;else e:switch(c){case L:return c=jn(31,b,f,M),c.elementType=L,c.lanes=B,c;case _:return dl(b.children,M,B,f);case v:V=8,M|=24;break;case x:return c=jn(12,b,f,M|2),c.elementType=x,c.lanes=B,c;case N:return c=jn(13,b,f,M),c.elementType=N,c.lanes=B,c;case j:return c=jn(19,b,f,M),c.elementType=j,c.lanes=B,c;default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case k:V=10;break e;case C:V=9;break e;case T:V=11;break e;case A:V=14;break e;case E:V=16,S=null;break e}V=29,b=Error(n(130,c===null?"null":typeof c,"")),S=null}return f=jn(V,b,f,M),f.elementType=c,f.type=S,f.lanes=B,f}function dl(c,f,b,S){return c=jn(7,c,S,f),c.lanes=b,c}function Ab(c,f,b){return c=jn(6,c,null,f),c.lanes=b,c}function SS(c){var f=jn(18,null,null,0);return f.stateNode=c,f}function jb(c,f,b){return f=jn(4,c.children!==null?c.children:[],c.key,f),f.lanes=b,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}var TS=new WeakMap;function Yn(c,f){if(typeof c=="object"&&c!==null){var b=TS.get(c);return b!==void 0?b:(f={value:c,source:f,stack:Ne(f)},TS.set(c,f),f)}return{value:c,source:f,stack:Ne(f)}}var Nc=[],Ac=0,dp=null,Au=0,Xn=[],Zn=0,eo=null,Ds=1,Is="";function ua(c,f){Nc[Ac++]=Au,Nc[Ac++]=dp,dp=c,Au=f}function ES(c,f,b){Xn[Zn++]=Ds,Xn[Zn++]=Is,Xn[Zn++]=eo,eo=c;var S=Ds;c=Is;var M=32-lt(S)-1;S&=~(1<<M),b+=1;var B=32-lt(f)+M;if(30<B){var V=M-M%5;B=(S&(1<<V)-1).toString(32),S>>=V,M-=V,Ds=1<<32-lt(f)+M|b<<M|S,Is=B+c}else Ds=1<<B|b<<M|S,Is=c}function Mb(c){c.return!==null&&(ua(c,1),ES(c,1,0))}function Lb(c){for(;c===dp;)dp=Nc[--Ac],Nc[Ac]=null,Au=Nc[--Ac],Nc[Ac]=null;for(;c===eo;)eo=Xn[--Zn],Xn[Zn]=null,Is=Xn[--Zn],Xn[Zn]=null,Ds=Xn[--Zn],Xn[Zn]=null}function NS(c,f){Xn[Zn++]=Ds,Xn[Zn++]=Is,Xn[Zn++]=eo,Ds=f.id,Is=f.overflow,eo=c}var Ri=null,Vr=null,wr=!1,to=null,Qn=!1,Bb=Error(n(519));function ro(c){var f=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ju(Yn(f,c)),Bb}function AS(c){var f=c.stateNode,b=c.type,S=c.memoizedProps;switch(f[xt]=c,f[$t]=S,b){case"dialog":yr("cancel",f),yr("close",f);break;case"iframe":case"object":case"embed":yr("load",f);break;case"video":case"audio":for(b=0;b<Qu.length;b++)yr(Qu[b],f);break;case"source":yr("error",f);break;case"img":case"image":case"link":yr("error",f),yr("load",f);break;case"details":yr("toggle",f);break;case"input":yr("invalid",f),Be(f,S.value,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name,!0);break;case"select":yr("invalid",f);break;case"textarea":yr("invalid",f),hr(f,S.value,S.defaultValue,S.children)}b=S.children,typeof b!="string"&&typeof b!="number"&&typeof b!="bigint"||f.textContent===""+b||S.suppressHydrationWarning===!0||GT(f.textContent,b)?(S.popover!=null&&(yr("beforetoggle",f),yr("toggle",f)),S.onScroll!=null&&yr("scroll",f),S.onScrollEnd!=null&&yr("scrollend",f),S.onClick!=null&&(f.onclick=pt),f=!0):f=!1,f||ro(c,!0)}function jS(c){for(Ri=c.return;Ri;)switch(Ri.tag){case 5:case 31:case 13:Qn=!1;return;case 27:case 3:Qn=!0;return;default:Ri=Ri.return}}function jc(c){if(c!==Ri)return!1;if(!wr)return jS(c),wr=!0,!1;var f=c.tag,b;if((b=f!==3&&f!==27)&&((b=f===5)&&(b=c.type,b=!(b!=="form"&&b!=="button")||Zv(c.type,c.memoizedProps)),b=!b),b&&Vr&&ro(c),jS(c),f===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));Vr=tE(c)}else if(f===31){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));Vr=tE(c)}else f===27?(f=Vr,yo(c.type)?(c=r0,r0=null,Vr=c):Vr=f):Vr=Ri?es(c.stateNode.nextSibling):null;return!0}function fl(){Vr=Ri=null,wr=!1}function Rb(){var c=to;return c!==null&&(bn===null?bn=c:bn.push.apply(bn,c),to=null),c}function ju(c){to===null?to=[c]:to.push(c)}var Ob=z(null),pl=null,da=null;function io(c,f,b){ie(Ob,f._currentValue),f._currentValue=b}function fa(c){c._currentValue=Ob.current,X(Ob)}function Db(c,f,b){for(;c!==null;){var S=c.alternate;if((c.childLanes&f)!==f?(c.childLanes|=f,S!==null&&(S.childLanes|=f)):S!==null&&(S.childLanes&f)!==f&&(S.childLanes|=f),c===b)break;c=c.return}}function Ib(c,f,b,S){var M=c.child;for(M!==null&&(M.return=c);M!==null;){var B=M.dependencies;if(B!==null){var V=M.child;B=B.firstContext;e:for(;B!==null;){var te=B;B=M;for(var ge=0;ge<f.length;ge++)if(te.context===f[ge]){B.lanes|=b,te=B.alternate,te!==null&&(te.lanes|=b),Db(B.return,b,c),S||(V=null);break e}B=te.next}}else if(M.tag===18){if(V=M.return,V===null)throw Error(n(341));V.lanes|=b,B=V.alternate,B!==null&&(B.lanes|=b),Db(V,b,c),V=null}else V=M.child;if(V!==null)V.return=M;else for(V=M;V!==null;){if(V===c){V=null;break}if(M=V.sibling,M!==null){M.return=V.return,V=M;break}V=V.return}M=V}}function Mc(c,f,b,S){c=null;for(var M=f,B=!1;M!==null;){if(!B){if((M.flags&524288)!==0)B=!0;else if((M.flags&262144)!==0)break}if(M.tag===10){var V=M.alternate;if(V===null)throw Error(n(387));if(V=V.memoizedProps,V!==null){var te=M.type;An(M.pendingProps.value,V.value)||(c!==null?c.push(te):c=[te])}}else if(M===ne.current){if(V=M.alternate,V===null)throw Error(n(387));V.memoizedState.memoizedState!==M.memoizedState.memoizedState&&(c!==null?c.push(id):c=[id])}M=M.return}c!==null&&Ib(f,c,b,S),f.flags|=262144}function fp(c){for(c=c.firstContext;c!==null;){if(!An(c.context._currentValue,c.memoizedValue))return!0;c=c.next}return!1}function gl(c){pl=c,da=null,c=c.dependencies,c!==null&&(c.firstContext=null)}function Oi(c){return MS(pl,c)}function pp(c,f){return pl===null&&gl(c),MS(c,f)}function MS(c,f){var b=f._currentValue;if(f={context:f,memoizedValue:b,next:null},da===null){if(c===null)throw Error(n(308));da=f,c.dependencies={lanes:0,firstContext:f},c.flags|=524288}else da=da.next=f;return b}var _8=typeof AbortController<"u"?AbortController:function(){var c=[],f=this.signal={aborted:!1,addEventListener:function(b,S){c.push(S)}};this.abort=function(){f.aborted=!0,c.forEach(function(b){return b()})}},C8=r.unstable_scheduleCallback,w8=r.unstable_NormalPriority,pi={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fb(){return{controller:new _8,data:new Map,refCount:0}}function Mu(c){c.refCount--,c.refCount===0&&C8(w8,function(){c.controller.abort()})}var Lu=null,$b=0,Lc=0,Bc=null;function k8(c,f){if(Lu===null){var b=Lu=[];$b=0,Lc=qv(),Bc={status:"pending",value:void 0,then:function(S){b.push(S)}}}return $b++,f.then(LS,LS),f}function LS(){if(--$b===0&&Lu!==null){Bc!==null&&(Bc.status="fulfilled");var c=Lu;Lu=null,Lc=0,Bc=null;for(var f=0;f<c.length;f++)(0,c[f])()}}function S8(c,f){var b=[],S={status:"pending",value:null,reason:null,then:function(M){b.push(M)}};return c.then(function(){S.status="fulfilled",S.value=f;for(var M=0;M<b.length;M++)(0,b[M])(f)},function(M){for(S.status="rejected",S.reason=M,M=0;M<b.length;M++)(0,b[M])(void 0)}),S}var BS=F.S;F.S=function(c,f){mT=Lt(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&k8(c,f),BS!==null&&BS(c,f)};var ml=z(null);function Pb(){var c=ml.current;return c!==null?c:Wr.pooledCache}function gp(c,f){f===null?ie(ml,ml.current):ie(ml,f.pool)}function RS(){var c=Pb();return c===null?null:{parent:pi._currentValue,pool:c}}var Rc=Error(n(460)),zb=Error(n(474)),mp=Error(n(542)),yp={then:function(){}};function OS(c){return c=c.status,c==="fulfilled"||c==="rejected"}function DS(c,f,b){switch(b=c[b],b===void 0?c.push(f):b!==f&&(f.then(pt,pt),f=b),f.status){case"fulfilled":return f.value;case"rejected":throw c=f.reason,FS(c),c;default:if(typeof f.status=="string")f.then(pt,pt);else{if(c=Wr,c!==null&&100<c.shellSuspendCounter)throw Error(n(482));c=f,c.status="pending",c.then(function(S){if(f.status==="pending"){var M=f;M.status="fulfilled",M.value=S}},function(S){if(f.status==="pending"){var M=f;M.status="rejected",M.reason=S}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw c=f.reason,FS(c),c}throw bl=f,Rc}}function yl(c){try{var f=c._init;return f(c._payload)}catch(b){throw b!==null&&typeof b=="object"&&typeof b.then=="function"?(bl=b,Rc):b}}var bl=null;function IS(){if(bl===null)throw Error(n(459));var c=bl;return bl=null,c}function FS(c){if(c===Rc||c===mp)throw Error(n(483))}var Oc=null,Bu=0;function bp(c){var f=Bu;return Bu+=1,Oc===null&&(Oc=[]),DS(Oc,c,f)}function Ru(c,f){f=f.props.ref,c.ref=f!==void 0?f:null}function vp(c,f){throw f.$$typeof===m?Error(n(525)):(c=Object.prototype.toString.call(f),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":c)))}function $S(c){function f(ke,xe){if(c){var Ae=ke.deletions;Ae===null?(ke.deletions=[xe],ke.flags|=16):Ae.push(xe)}}function b(ke,xe){if(!c)return null;for(;xe!==null;)f(ke,xe),xe=xe.sibling;return null}function S(ke){for(var xe=new Map;ke!==null;)ke.key!==null?xe.set(ke.key,ke):xe.set(ke.index,ke),ke=ke.sibling;return xe}function M(ke,xe){return ke=ha(ke,xe),ke.index=0,ke.sibling=null,ke}function B(ke,xe,Ae){return ke.index=Ae,c?(Ae=ke.alternate,Ae!==null?(Ae=Ae.index,Ae<xe?(ke.flags|=67108866,xe):Ae):(ke.flags|=67108866,xe)):(ke.flags|=1048576,xe)}function V(ke){return c&&ke.alternate===null&&(ke.flags|=67108866),ke}function te(ke,xe,Ae,Ve){return xe===null||xe.tag!==6?(xe=Ab(Ae,ke.mode,Ve),xe.return=ke,xe):(xe=M(xe,Ae),xe.return=ke,xe)}function ge(ke,xe,Ae,Ve){var Gt=Ae.type;return Gt===_?We(ke,xe,Ae.props.children,Ve,Ae.key):xe!==null&&(xe.elementType===Gt||typeof Gt=="object"&&Gt!==null&&Gt.$$typeof===E&&yl(Gt)===xe.type)?(xe=M(xe,Ae.props),Ru(xe,Ae),xe.return=ke,xe):(xe=up(Ae.type,Ae.key,Ae.props,null,ke.mode,Ve),Ru(xe,Ae),xe.return=ke,xe)}function je(ke,xe,Ae,Ve){return xe===null||xe.tag!==4||xe.stateNode.containerInfo!==Ae.containerInfo||xe.stateNode.implementation!==Ae.implementation?(xe=jb(Ae,ke.mode,Ve),xe.return=ke,xe):(xe=M(xe,Ae.children||[]),xe.return=ke,xe)}function We(ke,xe,Ae,Ve,Gt){return xe===null||xe.tag!==7?(xe=dl(Ae,ke.mode,Ve,Gt),xe.return=ke,xe):(xe=M(xe,Ae),xe.return=ke,xe)}function Xe(ke,xe,Ae){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return xe=Ab(""+xe,ke.mode,Ae),xe.return=ke,xe;if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case y:return Ae=up(xe.type,xe.key,xe.props,null,ke.mode,Ae),Ru(Ae,xe),Ae.return=ke,Ae;case w:return xe=jb(xe,ke.mode,Ae),xe.return=ke,xe;case E:return xe=yl(xe),Xe(ke,xe,Ae)}if($(xe)||G(xe))return xe=dl(xe,ke.mode,Ae,null),xe.return=ke,xe;if(typeof xe.then=="function")return Xe(ke,bp(xe),Ae);if(xe.$$typeof===k)return Xe(ke,pp(ke,xe),Ae);vp(ke,xe)}return null}function Oe(ke,xe,Ae,Ve){var Gt=xe!==null?xe.key:null;if(typeof Ae=="string"&&Ae!==""||typeof Ae=="number"||typeof Ae=="bigint")return Gt!==null?null:te(ke,xe,""+Ae,Ve);if(typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case y:return Ae.key===Gt?ge(ke,xe,Ae,Ve):null;case w:return Ae.key===Gt?je(ke,xe,Ae,Ve):null;case E:return Ae=yl(Ae),Oe(ke,xe,Ae,Ve)}if($(Ae)||G(Ae))return Gt!==null?null:We(ke,xe,Ae,Ve,null);if(typeof Ae.then=="function")return Oe(ke,xe,bp(Ae),Ve);if(Ae.$$typeof===k)return Oe(ke,xe,pp(ke,Ae),Ve);vp(ke,Ae)}return null}function Fe(ke,xe,Ae,Ve,Gt){if(typeof Ve=="string"&&Ve!==""||typeof Ve=="number"||typeof Ve=="bigint")return ke=ke.get(Ae)||null,te(xe,ke,""+Ve,Gt);if(typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case y:return ke=ke.get(Ve.key===null?Ae:Ve.key)||null,ge(xe,ke,Ve,Gt);case w:return ke=ke.get(Ve.key===null?Ae:Ve.key)||null,je(xe,ke,Ve,Gt);case E:return Ve=yl(Ve),Fe(ke,xe,Ae,Ve,Gt)}if($(Ve)||G(Ve))return ke=ke.get(Ae)||null,We(xe,ke,Ve,Gt,null);if(typeof Ve.then=="function")return Fe(ke,xe,Ae,bp(Ve),Gt);if(Ve.$$typeof===k)return Fe(ke,xe,Ae,pp(xe,Ve),Gt);vp(xe,Ve)}return null}function Nt(ke,xe,Ae,Ve){for(var Gt=null,Er=null,It=xe,ur=xe=0,_r=null;It!==null&&ur<Ae.length;ur++){It.index>ur?(_r=It,It=null):_r=It.sibling;var Nr=Oe(ke,It,Ae[ur],Ve);if(Nr===null){It===null&&(It=_r);break}c&&It&&Nr.alternate===null&&f(ke,It),xe=B(Nr,xe,ur),Er===null?Gt=Nr:Er.sibling=Nr,Er=Nr,It=_r}if(ur===Ae.length)return b(ke,It),wr&&ua(ke,ur),Gt;if(It===null){for(;ur<Ae.length;ur++)It=Xe(ke,Ae[ur],Ve),It!==null&&(xe=B(It,xe,ur),Er===null?Gt=It:Er.sibling=It,Er=It);return wr&&ua(ke,ur),Gt}for(It=S(It);ur<Ae.length;ur++)_r=Fe(It,ke,ur,Ae[ur],Ve),_r!==null&&(c&&_r.alternate!==null&&It.delete(_r.key===null?ur:_r.key),xe=B(_r,xe,ur),Er===null?Gt=_r:Er.sibling=_r,Er=_r);return c&&It.forEach(function(Co){return f(ke,Co)}),wr&&ua(ke,ur),Gt}function Yt(ke,xe,Ae,Ve){if(Ae==null)throw Error(n(151));for(var Gt=null,Er=null,It=xe,ur=xe=0,_r=null,Nr=Ae.next();It!==null&&!Nr.done;ur++,Nr=Ae.next()){It.index>ur?(_r=It,It=null):_r=It.sibling;var Co=Oe(ke,It,Nr.value,Ve);if(Co===null){It===null&&(It=_r);break}c&&It&&Co.alternate===null&&f(ke,It),xe=B(Co,xe,ur),Er===null?Gt=Co:Er.sibling=Co,Er=Co,It=_r}if(Nr.done)return b(ke,It),wr&&ua(ke,ur),Gt;if(It===null){for(;!Nr.done;ur++,Nr=Ae.next())Nr=Xe(ke,Nr.value,Ve),Nr!==null&&(xe=B(Nr,xe,ur),Er===null?Gt=Nr:Er.sibling=Nr,Er=Nr);return wr&&ua(ke,ur),Gt}for(It=S(It);!Nr.done;ur++,Nr=Ae.next())Nr=Fe(It,ke,ur,Nr.value,Ve),Nr!==null&&(c&&Nr.alternate!==null&&It.delete(Nr.key===null?ur:Nr.key),xe=B(Nr,xe,ur),Er===null?Gt=Nr:Er.sibling=Nr,Er=Nr);return c&&It.forEach(function(DP){return f(ke,DP)}),wr&&ua(ke,ur),Gt}function Ur(ke,xe,Ae,Ve){if(typeof Ae=="object"&&Ae!==null&&Ae.type===_&&Ae.key===null&&(Ae=Ae.props.children),typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case y:e:{for(var Gt=Ae.key;xe!==null;){if(xe.key===Gt){if(Gt=Ae.type,Gt===_){if(xe.tag===7){b(ke,xe.sibling),Ve=M(xe,Ae.props.children),Ve.return=ke,ke=Ve;break e}}else if(xe.elementType===Gt||typeof Gt=="object"&&Gt!==null&&Gt.$$typeof===E&&yl(Gt)===xe.type){b(ke,xe.sibling),Ve=M(xe,Ae.props),Ru(Ve,Ae),Ve.return=ke,ke=Ve;break e}b(ke,xe);break}else f(ke,xe);xe=xe.sibling}Ae.type===_?(Ve=dl(Ae.props.children,ke.mode,Ve,Ae.key),Ve.return=ke,ke=Ve):(Ve=up(Ae.type,Ae.key,Ae.props,null,ke.mode,Ve),Ru(Ve,Ae),Ve.return=ke,ke=Ve)}return V(ke);case w:e:{for(Gt=Ae.key;xe!==null;){if(xe.key===Gt)if(xe.tag===4&&xe.stateNode.containerInfo===Ae.containerInfo&&xe.stateNode.implementation===Ae.implementation){b(ke,xe.sibling),Ve=M(xe,Ae.children||[]),Ve.return=ke,ke=Ve;break e}else{b(ke,xe);break}else f(ke,xe);xe=xe.sibling}Ve=jb(Ae,ke.mode,Ve),Ve.return=ke,ke=Ve}return V(ke);case E:return Ae=yl(Ae),Ur(ke,xe,Ae,Ve)}if($(Ae))return Nt(ke,xe,Ae,Ve);if(G(Ae)){if(Gt=G(Ae),typeof Gt!="function")throw Error(n(150));return Ae=Gt.call(Ae),Yt(ke,xe,Ae,Ve)}if(typeof Ae.then=="function")return Ur(ke,xe,bp(Ae),Ve);if(Ae.$$typeof===k)return Ur(ke,xe,pp(ke,Ae),Ve);vp(ke,Ae)}return typeof Ae=="string"&&Ae!==""||typeof Ae=="number"||typeof Ae=="bigint"?(Ae=""+Ae,xe!==null&&xe.tag===6?(b(ke,xe.sibling),Ve=M(xe,Ae),Ve.return=ke,ke=Ve):(b(ke,xe),Ve=Ab(Ae,ke.mode,Ve),Ve.return=ke,ke=Ve),V(ke)):b(ke,xe)}return function(ke,xe,Ae,Ve){try{Bu=0;var Gt=Ur(ke,xe,Ae,Ve);return Oc=null,Gt}catch(It){if(It===Rc||It===mp)throw It;var Er=jn(29,It,null,ke.mode);return Er.lanes=Ve,Er.return=ke,Er}finally{}}}var vl=$S(!0),PS=$S(!1),no=!1;function qb(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hb(c,f){c=c.updateQueue,f.updateQueue===c&&(f.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,callbacks:null})}function so(c){return{lane:c,tag:0,payload:null,callback:null,next:null}}function ao(c,f,b){var S=c.updateQueue;if(S===null)return null;if(S=S.shared,(Mr&2)!==0){var M=S.pending;return M===null?f.next=f:(f.next=M.next,M.next=f),S.pending=f,f=hp(c),wS(c,null,b),f}return cp(c,S,f,b),hp(c)}function Ou(c,f,b){if(f=f.updateQueue,f!==null&&(f=f.shared,(b&4194048)!==0)){var S=f.lanes;S&=c.pendingLanes,b|=S,f.lanes=b,gt(c,b)}}function Ub(c,f){var b=c.updateQueue,S=c.alternate;if(S!==null&&(S=S.updateQueue,b===S)){var M=null,B=null;if(b=b.firstBaseUpdate,b!==null){do{var V={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};B===null?M=B=V:B=B.next=V,b=b.next}while(b!==null);B===null?M=B=f:B=B.next=f}else M=B=f;b={baseState:S.baseState,firstBaseUpdate:M,lastBaseUpdate:B,shared:S.shared,callbacks:S.callbacks},c.updateQueue=b;return}c=b.lastBaseUpdate,c===null?b.firstBaseUpdate=f:c.next=f,b.lastBaseUpdate=f}var Wb=!1;function Du(){if(Wb){var c=Bc;if(c!==null)throw c}}function Iu(c,f,b,S){Wb=!1;var M=c.updateQueue;no=!1;var B=M.firstBaseUpdate,V=M.lastBaseUpdate,te=M.shared.pending;if(te!==null){M.shared.pending=null;var ge=te,je=ge.next;ge.next=null,V===null?B=je:V.next=je,V=ge;var We=c.alternate;We!==null&&(We=We.updateQueue,te=We.lastBaseUpdate,te!==V&&(te===null?We.firstBaseUpdate=je:te.next=je,We.lastBaseUpdate=ge))}if(B!==null){var Xe=M.baseState;V=0,We=je=ge=null,te=B;do{var Oe=te.lane&-536870913,Fe=Oe!==te.lane;if(Fe?(xr&Oe)===Oe:(S&Oe)===Oe){Oe!==0&&Oe===Lc&&(Wb=!0),We!==null&&(We=We.next={lane:0,tag:te.tag,payload:te.payload,callback:null,next:null});e:{var Nt=c,Yt=te;Oe=f;var Ur=b;switch(Yt.tag){case 1:if(Nt=Yt.payload,typeof Nt=="function"){Xe=Nt.call(Ur,Xe,Oe);break e}Xe=Nt;break e;case 3:Nt.flags=Nt.flags&-65537|128;case 0:if(Nt=Yt.payload,Oe=typeof Nt=="function"?Nt.call(Ur,Xe,Oe):Nt,Oe==null)break e;Xe=p({},Xe,Oe);break e;case 2:no=!0}}Oe=te.callback,Oe!==null&&(c.flags|=64,Fe&&(c.flags|=8192),Fe=M.callbacks,Fe===null?M.callbacks=[Oe]:Fe.push(Oe))}else Fe={lane:Oe,tag:te.tag,payload:te.payload,callback:te.callback,next:null},We===null?(je=We=Fe,ge=Xe):We=We.next=Fe,V|=Oe;if(te=te.next,te===null){if(te=M.shared.pending,te===null)break;Fe=te,te=Fe.next,Fe.next=null,M.lastBaseUpdate=Fe,M.shared.pending=null}}while(!0);We===null&&(ge=Xe),M.baseState=ge,M.firstBaseUpdate=je,M.lastBaseUpdate=We,B===null&&(M.shared.lanes=0),uo|=V,c.lanes=V,c.memoizedState=Xe}}function zS(c,f){if(typeof c!="function")throw Error(n(191,c));c.call(f)}function qS(c,f){var b=c.callbacks;if(b!==null)for(c.callbacks=null,c=0;c<b.length;c++)zS(b[c],f)}var Dc=z(null),xp=z(0);function HS(c,f){c=Ca,ie(xp,c),ie(Dc,f),Ca=c|f.baseLanes}function Gb(){ie(xp,Ca),ie(Dc,Dc.current)}function Kb(){Ca=xp.current,X(Dc),X(xp)}var Mn=z(null),Jn=null;function oo(c){var f=c.alternate;ie(ui,ui.current&1),ie(Mn,c),Jn===null&&(f===null||Dc.current!==null||f.memoizedState!==null)&&(Jn=c)}function Vb(c){ie(ui,ui.current),ie(Mn,c),Jn===null&&(Jn=c)}function US(c){c.tag===22?(ie(ui,ui.current),ie(Mn,c),Jn===null&&(Jn=c)):lo()}function lo(){ie(ui,ui.current),ie(Mn,Mn.current)}function Ln(c){X(Mn),Jn===c&&(Jn=null),X(ui)}var ui=z(0);function _p(c){for(var f=c;f!==null;){if(f.tag===13){var b=f.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||e0(b)||t0(b)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var pa=0,cr=null,qr=null,gi=null,Cp=!1,Ic=!1,xl=!1,wp=0,Fu=0,Fc=null,T8=0;function ai(){throw Error(n(321))}function Yb(c,f){if(f===null)return!1;for(var b=0;b<f.length&&b<c.length;b++)if(!An(c[b],f[b]))return!1;return!0}function Xb(c,f,b,S,M,B){return pa=B,cr=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,F.H=c===null||c.memoizedState===null?E2:uv,xl=!1,B=b(S,M),xl=!1,Ic&&(B=GS(f,b,S,M)),WS(c),B}function WS(c){F.H=zu;var f=qr!==null&&qr.next!==null;if(pa=0,gi=qr=cr=null,Cp=!1,Fu=0,Fc=null,f)throw Error(n(300));c===null||mi||(c=c.dependencies,c!==null&&fp(c)&&(mi=!0))}function GS(c,f,b,S){cr=c;var M=0;do{if(Ic&&(Fc=null),Fu=0,Ic=!1,25<=M)throw Error(n(301));if(M+=1,gi=qr=null,c.updateQueue!=null){var B=c.updateQueue;B.lastEffect=null,B.events=null,B.stores=null,B.memoCache!=null&&(B.memoCache.index=0)}F.H=N2,B=f(b,S)}while(Ic);return B}function E8(){var c=F.H,f=c.useState()[0];return f=typeof f.then=="function"?$u(f):f,c=c.useState()[0],(qr!==null?qr.memoizedState:null)!==c&&(cr.flags|=1024),f}function Zb(){var c=wp!==0;return wp=0,c}function Qb(c,f,b){f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~b}function Jb(c){if(Cp){for(c=c.memoizedState;c!==null;){var f=c.queue;f!==null&&(f.pending=null),c=c.next}Cp=!1}pa=0,gi=qr=cr=null,Ic=!1,Fu=wp=0,Fc=null}function Ji(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gi===null?cr.memoizedState=gi=c:gi=gi.next=c,gi}function di(){if(qr===null){var c=cr.alternate;c=c!==null?c.memoizedState:null}else c=qr.next;var f=gi===null?cr.memoizedState:gi.next;if(f!==null)gi=f,qr=c;else{if(c===null)throw cr.alternate===null?Error(n(467)):Error(n(310));qr=c,c={memoizedState:qr.memoizedState,baseState:qr.baseState,baseQueue:qr.baseQueue,queue:qr.queue,next:null},gi===null?cr.memoizedState=gi=c:gi=gi.next=c}return gi}function kp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $u(c){var f=Fu;return Fu+=1,Fc===null&&(Fc=[]),c=DS(Fc,c,f),f=cr,(gi===null?f.memoizedState:gi.next)===null&&(f=f.alternate,F.H=f===null||f.memoizedState===null?E2:uv),c}function Sp(c){if(c!==null&&typeof c=="object"){if(typeof c.then=="function")return $u(c);if(c.$$typeof===k)return Oi(c)}throw Error(n(438,String(c)))}function ev(c){var f=null,b=cr.updateQueue;if(b!==null&&(f=b.memoCache),f==null){var S=cr.alternate;S!==null&&(S=S.updateQueue,S!==null&&(S=S.memoCache,S!=null&&(f={data:S.data.map(function(M){return M.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),b===null&&(b=kp(),cr.updateQueue=b),b.memoCache=f,b=f.data[f.index],b===void 0)for(b=f.data[f.index]=Array(c),S=0;S<c;S++)b[S]=O;return f.index++,b}function ga(c,f){return typeof f=="function"?f(c):f}function Tp(c){var f=di();return tv(f,qr,c)}function tv(c,f,b){var S=c.queue;if(S===null)throw Error(n(311));S.lastRenderedReducer=b;var M=c.baseQueue,B=S.pending;if(B!==null){if(M!==null){var V=M.next;M.next=B.next,B.next=V}f.baseQueue=M=B,S.pending=null}if(B=c.baseState,M===null)c.memoizedState=B;else{f=M.next;var te=V=null,ge=null,je=f,We=!1;do{var Xe=je.lane&-536870913;if(Xe!==je.lane?(xr&Xe)===Xe:(pa&Xe)===Xe){var Oe=je.revertLane;if(Oe===0)ge!==null&&(ge=ge.next={lane:0,revertLane:0,gesture:null,action:je.action,hasEagerState:je.hasEagerState,eagerState:je.eagerState,next:null}),Xe===Lc&&(We=!0);else if((pa&Oe)===Oe){je=je.next,Oe===Lc&&(We=!0);continue}else Xe={lane:0,revertLane:je.revertLane,gesture:null,action:je.action,hasEagerState:je.hasEagerState,eagerState:je.eagerState,next:null},ge===null?(te=ge=Xe,V=B):ge=ge.next=Xe,cr.lanes|=Oe,uo|=Oe;Xe=je.action,xl&&b(B,Xe),B=je.hasEagerState?je.eagerState:b(B,Xe)}else Oe={lane:Xe,revertLane:je.revertLane,gesture:je.gesture,action:je.action,hasEagerState:je.hasEagerState,eagerState:je.eagerState,next:null},ge===null?(te=ge=Oe,V=B):ge=ge.next=Oe,cr.lanes|=Xe,uo|=Xe;je=je.next}while(je!==null&&je!==f);if(ge===null?V=B:ge.next=te,!An(B,c.memoizedState)&&(mi=!0,We&&(b=Bc,b!==null)))throw b;c.memoizedState=B,c.baseState=V,c.baseQueue=ge,S.lastRenderedState=B}return M===null&&(S.lanes=0),[c.memoizedState,S.dispatch]}function rv(c){var f=di(),b=f.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=c;var S=b.dispatch,M=b.pending,B=f.memoizedState;if(M!==null){b.pending=null;var V=M=M.next;do B=c(B,V.action),V=V.next;while(V!==M);An(B,f.memoizedState)||(mi=!0),f.memoizedState=B,f.baseQueue===null&&(f.baseState=B),b.lastRenderedState=B}return[B,S]}function KS(c,f,b){var S=cr,M=di(),B=wr;if(B){if(b===void 0)throw Error(n(407));b=b()}else b=f();var V=!An((qr||M).memoizedState,b);if(V&&(M.memoizedState=b,mi=!0),M=M.queue,sv(XS.bind(null,S,M,c),[c]),M.getSnapshot!==f||V||gi!==null&&gi.memoizedState.tag&1){if(S.flags|=2048,$c(9,{destroy:void 0},YS.bind(null,S,M,b,f),null),Wr===null)throw Error(n(349));B||(pa&127)!==0||VS(S,f,b)}return b}function VS(c,f,b){c.flags|=16384,c={getSnapshot:f,value:b},f=cr.updateQueue,f===null?(f=kp(),cr.updateQueue=f,f.stores=[c]):(b=f.stores,b===null?f.stores=[c]:b.push(c))}function YS(c,f,b,S){f.value=b,f.getSnapshot=S,ZS(f)&&QS(c)}function XS(c,f,b){return b(function(){ZS(f)&&QS(c)})}function ZS(c){var f=c.getSnapshot;c=c.value;try{var b=f();return!An(c,b)}catch{return!0}}function QS(c){var f=ul(c,2);f!==null&&vn(f,c,2)}function iv(c){var f=Ji();if(typeof c=="function"){var b=c;if(c=b(),xl){ft(!0);try{b()}finally{ft(!1)}}}return f.memoizedState=f.baseState=c,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:c},f}function JS(c,f,b,S){return c.baseState=b,tv(c,qr,typeof S=="function"?S:ga)}function N8(c,f,b,S,M){if(Ap(c))throw Error(n(485));if(c=f.action,c!==null){var B={payload:M,action:c,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(V){B.listeners.push(V)}};F.T!==null?b(!0):B.isTransition=!1,S(B),b=f.pending,b===null?(B.next=f.pending=B,e2(f,B)):(B.next=b.next,f.pending=b.next=B)}}function e2(c,f){var b=f.action,S=f.payload,M=c.state;if(f.isTransition){var B=F.T,V={};F.T=V;try{var te=b(M,S),ge=F.S;ge!==null&&ge(V,te),t2(c,f,te)}catch(je){nv(c,f,je)}finally{B!==null&&V.types!==null&&(B.types=V.types),F.T=B}}else try{B=b(M,S),t2(c,f,B)}catch(je){nv(c,f,je)}}function t2(c,f,b){b!==null&&typeof b=="object"&&typeof b.then=="function"?b.then(function(S){r2(c,f,S)},function(S){return nv(c,f,S)}):r2(c,f,b)}function r2(c,f,b){f.status="fulfilled",f.value=b,i2(f),c.state=b,f=c.pending,f!==null&&(b=f.next,b===f?c.pending=null:(b=b.next,f.next=b,e2(c,b)))}function nv(c,f,b){var S=c.pending;if(c.pending=null,S!==null){S=S.next;do f.status="rejected",f.reason=b,i2(f),f=f.next;while(f!==S)}c.action=null}function i2(c){c=c.listeners;for(var f=0;f<c.length;f++)(0,c[f])()}function n2(c,f){return f}function s2(c,f){if(wr){var b=Wr.formState;if(b!==null){e:{var S=cr;if(wr){if(Vr){t:{for(var M=Vr,B=Qn;M.nodeType!==8;){if(!B){M=null;break t}if(M=es(M.nextSibling),M===null){M=null;break t}}B=M.data,M=B==="F!"||B==="F"?M:null}if(M){Vr=es(M.nextSibling),S=M.data==="F!";break e}}ro(S)}S=!1}S&&(f=b[0])}}return b=Ji(),b.memoizedState=b.baseState=f,S={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n2,lastRenderedState:f},b.queue=S,b=k2.bind(null,cr,S),S.dispatch=b,S=iv(!1),B=hv.bind(null,cr,!1,S.queue),S=Ji(),M={state:f,dispatch:null,action:c,pending:null},S.queue=M,b=N8.bind(null,cr,M,B,b),M.dispatch=b,S.memoizedState=c,[f,b,!1]}function a2(c){var f=di();return o2(f,qr,c)}function o2(c,f,b){if(f=tv(c,f,n2)[0],c=Tp(ga)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var S=$u(f)}catch(V){throw V===Rc?mp:V}else S=f;f=di();var M=f.queue,B=M.dispatch;return b!==f.memoizedState&&(cr.flags|=2048,$c(9,{destroy:void 0},A8.bind(null,M,b),null)),[S,B,c]}function A8(c,f){c.action=f}function l2(c){var f=di(),b=qr;if(b!==null)return o2(f,b,c);di(),f=f.memoizedState,b=di();var S=b.queue.dispatch;return b.memoizedState=c,[f,S,!1]}function $c(c,f,b,S){return c={tag:c,create:b,deps:S,inst:f,next:null},f=cr.updateQueue,f===null&&(f=kp(),cr.updateQueue=f),b=f.lastEffect,b===null?f.lastEffect=c.next=c:(S=b.next,b.next=c,c.next=S,f.lastEffect=c),c}function c2(){return di().memoizedState}function Ep(c,f,b,S){var M=Ji();cr.flags|=c,M.memoizedState=$c(1|f,{destroy:void 0},b,S===void 0?null:S)}function Np(c,f,b,S){var M=di();S=S===void 0?null:S;var B=M.memoizedState.inst;qr!==null&&S!==null&&Yb(S,qr.memoizedState.deps)?M.memoizedState=$c(f,B,b,S):(cr.flags|=c,M.memoizedState=$c(1|f,B,b,S))}function h2(c,f){Ep(8390656,8,c,f)}function sv(c,f){Np(2048,8,c,f)}function j8(c){cr.flags|=4;var f=cr.updateQueue;if(f===null)f=kp(),cr.updateQueue=f,f.events=[c];else{var b=f.events;b===null?f.events=[c]:b.push(c)}}function u2(c){var f=di().memoizedState;return j8({ref:f,nextImpl:c}),function(){if((Mr&2)!==0)throw Error(n(440));return f.impl.apply(void 0,arguments)}}function d2(c,f){return Np(4,2,c,f)}function f2(c,f){return Np(4,4,c,f)}function p2(c,f){if(typeof f=="function"){c=c();var b=f(c);return function(){typeof b=="function"?b():f(null)}}if(f!=null)return c=c(),f.current=c,function(){f.current=null}}function g2(c,f,b){b=b!=null?b.concat([c]):null,Np(4,4,p2.bind(null,f,c),b)}function av(){}function m2(c,f){var b=di();f=f===void 0?null:f;var S=b.memoizedState;return f!==null&&Yb(f,S[1])?S[0]:(b.memoizedState=[c,f],c)}function y2(c,f){var b=di();f=f===void 0?null:f;var S=b.memoizedState;if(f!==null&&Yb(f,S[1]))return S[0];if(S=c(),xl){ft(!0);try{c()}finally{ft(!1)}}return b.memoizedState=[S,f],S}function ov(c,f,b){return b===void 0||(pa&1073741824)!==0&&(xr&261930)===0?c.memoizedState=f:(c.memoizedState=b,c=bT(),cr.lanes|=c,uo|=c,b)}function b2(c,f,b,S){return An(b,f)?b:Dc.current!==null?(c=ov(c,b,S),An(c,f)||(mi=!0),c):(pa&42)===0||(pa&1073741824)!==0&&(xr&261930)===0?(mi=!0,c.memoizedState=b):(c=bT(),cr.lanes|=c,uo|=c,f)}function v2(c,f,b,S,M){var B=W.p;W.p=B!==0&&8>B?B:8;var V=F.T,te={};F.T=te,hv(c,!1,f,b);try{var ge=M(),je=F.S;if(je!==null&&je(te,ge),ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var We=S8(ge,S);Pu(c,f,We,On(c))}else Pu(c,f,S,On(c))}catch(Xe){Pu(c,f,{then:function(){},status:"rejected",reason:Xe},On())}finally{W.p=B,V!==null&&te.types!==null&&(V.types=te.types),F.T=V}}function M8(){}function lv(c,f,b,S){if(c.tag!==5)throw Error(n(476));var M=x2(c).queue;v2(c,M,f,Y,b===null?M8:function(){return _2(c),b(S)})}function x2(c){var f=c.memoizedState;if(f!==null)return f;f={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:Y},next:null};var b={};return f.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:b},next:null},c.memoizedState=f,c=c.alternate,c!==null&&(c.memoizedState=f),f}function _2(c){var f=x2(c);f.next===null&&(f=c.alternate.memoizedState),Pu(c,f.next.queue,{},On())}function cv(){return Oi(id)}function C2(){return di().memoizedState}function w2(){return di().memoizedState}function L8(c){for(var f=c.return;f!==null;){switch(f.tag){case 24:case 3:var b=On();c=so(b);var S=ao(f,c,b);S!==null&&(vn(S,f,b),Ou(S,f,b)),f={cache:Fb()},c.payload=f;return}f=f.return}}function B8(c,f,b){var S=On();b={lane:S,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},Ap(c)?S2(f,b):(b=Eb(c,f,b,S),b!==null&&(vn(b,c,S),T2(b,f,S)))}function k2(c,f,b){var S=On();Pu(c,f,b,S)}function Pu(c,f,b,S){var M={lane:S,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(Ap(c))S2(f,M);else{var B=c.alternate;if(c.lanes===0&&(B===null||B.lanes===0)&&(B=f.lastRenderedReducer,B!==null))try{var V=f.lastRenderedState,te=B(V,b);if(M.hasEagerState=!0,M.eagerState=te,An(te,V))return cp(c,f,M,0),Wr===null&&lp(),!1}catch{}finally{}if(b=Eb(c,f,M,S),b!==null)return vn(b,c,S),T2(b,f,S),!0}return!1}function hv(c,f,b,S){if(S={lane:2,revertLane:qv(),gesture:null,action:S,hasEagerState:!1,eagerState:null,next:null},Ap(c)){if(f)throw Error(n(479))}else f=Eb(c,b,S,2),f!==null&&vn(f,c,2)}function Ap(c){var f=c.alternate;return c===cr||f!==null&&f===cr}function S2(c,f){Ic=Cp=!0;var b=c.pending;b===null?f.next=f:(f.next=b.next,b.next=f),c.pending=f}function T2(c,f,b){if((b&4194048)!==0){var S=f.lanes;S&=c.pendingLanes,b|=S,f.lanes=b,gt(c,b)}}var zu={readContext:Oi,use:Sp,useCallback:ai,useContext:ai,useEffect:ai,useImperativeHandle:ai,useLayoutEffect:ai,useInsertionEffect:ai,useMemo:ai,useReducer:ai,useRef:ai,useState:ai,useDebugValue:ai,useDeferredValue:ai,useTransition:ai,useSyncExternalStore:ai,useId:ai,useHostTransitionStatus:ai,useFormState:ai,useActionState:ai,useOptimistic:ai,useMemoCache:ai,useCacheRefresh:ai};zu.useEffectEvent=ai;var E2={readContext:Oi,use:Sp,useCallback:function(c,f){return Ji().memoizedState=[c,f===void 0?null:f],c},useContext:Oi,useEffect:h2,useImperativeHandle:function(c,f,b){b=b!=null?b.concat([c]):null,Ep(4194308,4,p2.bind(null,f,c),b)},useLayoutEffect:function(c,f){return Ep(4194308,4,c,f)},useInsertionEffect:function(c,f){Ep(4,2,c,f)},useMemo:function(c,f){var b=Ji();f=f===void 0?null:f;var S=c();if(xl){ft(!0);try{c()}finally{ft(!1)}}return b.memoizedState=[S,f],S},useReducer:function(c,f,b){var S=Ji();if(b!==void 0){var M=b(f);if(xl){ft(!0);try{b(f)}finally{ft(!1)}}}else M=f;return S.memoizedState=S.baseState=M,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:M},S.queue=c,c=c.dispatch=B8.bind(null,cr,c),[S.memoizedState,c]},useRef:function(c){var f=Ji();return c={current:c},f.memoizedState=c},useState:function(c){c=iv(c);var f=c.queue,b=k2.bind(null,cr,f);return f.dispatch=b,[c.memoizedState,b]},useDebugValue:av,useDeferredValue:function(c,f){var b=Ji();return ov(b,c,f)},useTransition:function(){var c=iv(!1);return c=v2.bind(null,cr,c.queue,!0,!1),Ji().memoizedState=c,[!1,c]},useSyncExternalStore:function(c,f,b){var S=cr,M=Ji();if(wr){if(b===void 0)throw Error(n(407));b=b()}else{if(b=f(),Wr===null)throw Error(n(349));(xr&127)!==0||VS(S,f,b)}M.memoizedState=b;var B={value:b,getSnapshot:f};return M.queue=B,h2(XS.bind(null,S,B,c),[c]),S.flags|=2048,$c(9,{destroy:void 0},YS.bind(null,S,B,b,f),null),b},useId:function(){var c=Ji(),f=Wr.identifierPrefix;if(wr){var b=Is,S=Ds;b=(S&~(1<<32-lt(S)-1)).toString(32)+b,f="_"+f+"R_"+b,b=wp++,0<b&&(f+="H"+b.toString(32)),f+="_"}else b=T8++,f="_"+f+"r_"+b.toString(32)+"_";return c.memoizedState=f},useHostTransitionStatus:cv,useFormState:s2,useActionState:s2,useOptimistic:function(c){var f=Ji();f.memoizedState=f.baseState=c;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=b,f=hv.bind(null,cr,!0,b),b.dispatch=f,[c,f]},useMemoCache:ev,useCacheRefresh:function(){return Ji().memoizedState=L8.bind(null,cr)},useEffectEvent:function(c){var f=Ji(),b={impl:c};return f.memoizedState=b,function(){if((Mr&2)!==0)throw Error(n(440));return b.impl.apply(void 0,arguments)}}},uv={readContext:Oi,use:Sp,useCallback:m2,useContext:Oi,useEffect:sv,useImperativeHandle:g2,useInsertionEffect:d2,useLayoutEffect:f2,useMemo:y2,useReducer:Tp,useRef:c2,useState:function(){return Tp(ga)},useDebugValue:av,useDeferredValue:function(c,f){var b=di();return b2(b,qr.memoizedState,c,f)},useTransition:function(){var c=Tp(ga)[0],f=di().memoizedState;return[typeof c=="boolean"?c:$u(c),f]},useSyncExternalStore:KS,useId:C2,useHostTransitionStatus:cv,useFormState:a2,useActionState:a2,useOptimistic:function(c,f){var b=di();return JS(b,qr,c,f)},useMemoCache:ev,useCacheRefresh:w2};uv.useEffectEvent=u2;var N2={readContext:Oi,use:Sp,useCallback:m2,useContext:Oi,useEffect:sv,useImperativeHandle:g2,useInsertionEffect:d2,useLayoutEffect:f2,useMemo:y2,useReducer:rv,useRef:c2,useState:function(){return rv(ga)},useDebugValue:av,useDeferredValue:function(c,f){var b=di();return qr===null?ov(b,c,f):b2(b,qr.memoizedState,c,f)},useTransition:function(){var c=rv(ga)[0],f=di().memoizedState;return[typeof c=="boolean"?c:$u(c),f]},useSyncExternalStore:KS,useId:C2,useHostTransitionStatus:cv,useFormState:l2,useActionState:l2,useOptimistic:function(c,f){var b=di();return qr!==null?JS(b,qr,c,f):(b.baseState=c,[c,b.queue.dispatch])},useMemoCache:ev,useCacheRefresh:w2};N2.useEffectEvent=u2;function dv(c,f,b,S){f=c.memoizedState,b=b(S,f),b=b==null?f:p({},f,b),c.memoizedState=b,c.lanes===0&&(c.updateQueue.baseState=b)}var fv={enqueueSetState:function(c,f,b){c=c._reactInternals;var S=On(),M=so(S);M.payload=f,b!=null&&(M.callback=b),f=ao(c,M,S),f!==null&&(vn(f,c,S),Ou(f,c,S))},enqueueReplaceState:function(c,f,b){c=c._reactInternals;var S=On(),M=so(S);M.tag=1,M.payload=f,b!=null&&(M.callback=b),f=ao(c,M,S),f!==null&&(vn(f,c,S),Ou(f,c,S))},enqueueForceUpdate:function(c,f){c=c._reactInternals;var b=On(),S=so(b);S.tag=2,f!=null&&(S.callback=f),f=ao(c,S,b),f!==null&&(vn(f,c,b),Ou(f,c,b))}};function A2(c,f,b,S,M,B,V){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(S,B,V):f.prototype&&f.prototype.isPureReactComponent?!Eu(b,S)||!Eu(M,B):!0}function j2(c,f,b,S){c=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(b,S),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(b,S),f.state!==c&&fv.enqueueReplaceState(f,f.state,null)}function _l(c,f){var b=f;if("ref"in f){b={};for(var S in f)S!=="ref"&&(b[S]=f[S])}if(c=c.defaultProps){b===f&&(b=p({},b));for(var M in c)b[M]===void 0&&(b[M]=c[M])}return b}function M2(c){op(c)}function L2(c){console.error(c)}function B2(c){op(c)}function jp(c,f){try{var b=c.onUncaughtError;b(f.value,{componentStack:f.stack})}catch(S){setTimeout(function(){throw S})}}function R2(c,f,b){try{var S=c.onCaughtError;S(b.value,{componentStack:b.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(M){setTimeout(function(){throw M})}}function pv(c,f,b){return b=so(b),b.tag=3,b.payload={element:null},b.callback=function(){jp(c,f)},b}function O2(c){return c=so(c),c.tag=3,c}function D2(c,f,b,S){var M=b.type.getDerivedStateFromError;if(typeof M=="function"){var B=S.value;c.payload=function(){return M(B)},c.callback=function(){R2(f,b,S)}}var V=b.stateNode;V!==null&&typeof V.componentDidCatch=="function"&&(c.callback=function(){R2(f,b,S),typeof M!="function"&&(fo===null?fo=new Set([this]):fo.add(this));var te=S.stack;this.componentDidCatch(S.value,{componentStack:te!==null?te:""})})}function R8(c,f,b,S,M){if(b.flags|=32768,S!==null&&typeof S=="object"&&typeof S.then=="function"){if(f=b.alternate,f!==null&&Mc(f,b,M,!0),b=Mn.current,b!==null){switch(b.tag){case 31:case 13:return Jn===null?qp():b.alternate===null&&oi===0&&(oi=3),b.flags&=-257,b.flags|=65536,b.lanes=M,S===yp?b.flags|=16384:(f=b.updateQueue,f===null?b.updateQueue=new Set([S]):f.add(S),$v(c,S,M)),!1;case 22:return b.flags|=65536,S===yp?b.flags|=16384:(f=b.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([S])},b.updateQueue=f):(b=f.retryQueue,b===null?f.retryQueue=new Set([S]):b.add(S)),$v(c,S,M)),!1}throw Error(n(435,b.tag))}return $v(c,S,M),qp(),!1}if(wr)return f=Mn.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=M,S!==Bb&&(c=Error(n(422),{cause:S}),ju(Yn(c,b)))):(S!==Bb&&(f=Error(n(423),{cause:S}),ju(Yn(f,b))),c=c.current.alternate,c.flags|=65536,M&=-M,c.lanes|=M,S=Yn(S,b),M=pv(c.stateNode,S,M),Ub(c,M),oi!==4&&(oi=2)),!1;var B=Error(n(520),{cause:S});if(B=Yn(B,b),Yu===null?Yu=[B]:Yu.push(B),oi!==4&&(oi=2),f===null)return!0;S=Yn(S,b),b=f;do{switch(b.tag){case 3:return b.flags|=65536,c=M&-M,b.lanes|=c,c=pv(b.stateNode,S,c),Ub(b,c),!1;case 1:if(f=b.type,B=b.stateNode,(b.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||B!==null&&typeof B.componentDidCatch=="function"&&(fo===null||!fo.has(B))))return b.flags|=65536,M&=-M,b.lanes|=M,M=O2(M),D2(M,c,b,S),Ub(b,M),!1}b=b.return}while(b!==null);return!1}var gv=Error(n(461)),mi=!1;function Di(c,f,b,S){f.child=c===null?PS(f,null,b,S):vl(f,c.child,b,S)}function I2(c,f,b,S,M){b=b.render;var B=f.ref;if("ref"in S){var V={};for(var te in S)te!=="ref"&&(V[te]=S[te])}else V=S;return gl(f),S=Xb(c,f,b,V,B,M),te=Zb(),c!==null&&!mi?(Qb(c,f,M),ma(c,f,M)):(wr&&te&&Mb(f),f.flags|=1,Di(c,f,S,M),f.child)}function F2(c,f,b,S,M){if(c===null){var B=b.type;return typeof B=="function"&&!Nb(B)&&B.defaultProps===void 0&&b.compare===null?(f.tag=15,f.type=B,$2(c,f,B,S,M)):(c=up(b.type,null,S,f,f.mode,M),c.ref=f.ref,c.return=f,f.child=c)}if(B=c.child,!wv(c,M)){var V=B.memoizedProps;if(b=b.compare,b=b!==null?b:Eu,b(V,S)&&c.ref===f.ref)return ma(c,f,M)}return f.flags|=1,c=ha(B,S),c.ref=f.ref,c.return=f,f.child=c}function $2(c,f,b,S,M){if(c!==null){var B=c.memoizedProps;if(Eu(B,S)&&c.ref===f.ref)if(mi=!1,f.pendingProps=S=B,wv(c,M))(c.flags&131072)!==0&&(mi=!0);else return f.lanes=c.lanes,ma(c,f,M)}return mv(c,f,b,S,M)}function P2(c,f,b,S){var M=S.children,B=c!==null?c.memoizedState:null;if(c===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),S.mode==="hidden"){if((f.flags&128)!==0){if(B=B!==null?B.baseLanes|b:b,c!==null){for(S=f.child=c.child,M=0;S!==null;)M=M|S.lanes|S.childLanes,S=S.sibling;S=M&~B}else S=0,f.child=null;return z2(c,f,B,b,S)}if((b&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},c!==null&&gp(f,B!==null?B.cachePool:null),B!==null?HS(f,B):Gb(),US(f);else return S=f.lanes=536870912,z2(c,f,B!==null?B.baseLanes|b:b,b,S)}else B!==null?(gp(f,B.cachePool),HS(f,B),lo(),f.memoizedState=null):(c!==null&&gp(f,null),Gb(),lo());return Di(c,f,M,b),f.child}function qu(c,f){return c!==null&&c.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function z2(c,f,b,S,M){var B=Pb();return B=B===null?null:{parent:pi._currentValue,pool:B},f.memoizedState={baseLanes:b,cachePool:B},c!==null&&gp(f,null),Gb(),US(f),c!==null&&Mc(c,f,S,!0),f.childLanes=M,null}function Mp(c,f){return f=Bp({mode:f.mode,children:f.children},c.mode),f.ref=c.ref,c.child=f,f.return=c,f}function q2(c,f,b){return vl(f,c.child,null,b),c=Mp(f,f.pendingProps),c.flags|=2,Ln(f),f.memoizedState=null,c}function O8(c,f,b){var S=f.pendingProps,M=(f.flags&128)!==0;if(f.flags&=-129,c===null){if(wr){if(S.mode==="hidden")return c=Mp(f,S),f.lanes=536870912,qu(null,c);if(Vb(f),(c=Vr)?(c=eE(c,Qn),c=c!==null&&c.data==="&"?c:null,c!==null&&(f.memoizedState={dehydrated:c,treeContext:eo!==null?{id:Ds,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},b=SS(c),b.return=f,f.child=b,Ri=f,Vr=null)):c=null,c===null)throw ro(f);return f.lanes=536870912,null}return Mp(f,S)}var B=c.memoizedState;if(B!==null){var V=B.dehydrated;if(Vb(f),M)if(f.flags&256)f.flags&=-257,f=q2(c,f,b);else if(f.memoizedState!==null)f.child=c.child,f.flags|=128,f=null;else throw Error(n(558));else if(mi||Mc(c,f,b,!1),M=(b&c.childLanes)!==0,mi||M){if(S=Wr,S!==null&&(V=ae(S,b),V!==0&&V!==B.retryLane))throw B.retryLane=V,ul(c,V),vn(S,c,V),gv;qp(),f=q2(c,f,b)}else c=B.treeContext,Vr=es(V.nextSibling),Ri=f,wr=!0,to=null,Qn=!1,c!==null&&NS(f,c),f=Mp(f,S),f.flags|=4096;return f}return c=ha(c.child,{mode:S.mode,children:S.children}),c.ref=f.ref,f.child=c,c.return=f,c}function Lp(c,f){var b=f.ref;if(b===null)c!==null&&c.ref!==null&&(f.flags|=4194816);else{if(typeof b!="function"&&typeof b!="object")throw Error(n(284));(c===null||c.ref!==b)&&(f.flags|=4194816)}}function mv(c,f,b,S,M){return gl(f),b=Xb(c,f,b,S,void 0,M),S=Zb(),c!==null&&!mi?(Qb(c,f,M),ma(c,f,M)):(wr&&S&&Mb(f),f.flags|=1,Di(c,f,b,M),f.child)}function H2(c,f,b,S,M,B){return gl(f),f.updateQueue=null,b=GS(f,S,b,M),WS(c),S=Zb(),c!==null&&!mi?(Qb(c,f,B),ma(c,f,B)):(wr&&S&&Mb(f),f.flags|=1,Di(c,f,b,B),f.child)}function U2(c,f,b,S,M){if(gl(f),f.stateNode===null){var B=Ec,V=b.contextType;typeof V=="object"&&V!==null&&(B=Oi(V)),B=new b(S,B),f.memoizedState=B.state!==null&&B.state!==void 0?B.state:null,B.updater=fv,f.stateNode=B,B._reactInternals=f,B=f.stateNode,B.props=S,B.state=f.memoizedState,B.refs={},qb(f),V=b.contextType,B.context=typeof V=="object"&&V!==null?Oi(V):Ec,B.state=f.memoizedState,V=b.getDerivedStateFromProps,typeof V=="function"&&(dv(f,b,V,S),B.state=f.memoizedState),typeof b.getDerivedStateFromProps=="function"||typeof B.getSnapshotBeforeUpdate=="function"||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(V=B.state,typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount(),V!==B.state&&fv.enqueueReplaceState(B,B.state,null),Iu(f,S,B,M),Du(),B.state=f.memoizedState),typeof B.componentDidMount=="function"&&(f.flags|=4194308),S=!0}else if(c===null){B=f.stateNode;var te=f.memoizedProps,ge=_l(b,te);B.props=ge;var je=B.context,We=b.contextType;V=Ec,typeof We=="object"&&We!==null&&(V=Oi(We));var Xe=b.getDerivedStateFromProps;We=typeof Xe=="function"||typeof B.getSnapshotBeforeUpdate=="function",te=f.pendingProps!==te,We||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(te||je!==V)&&j2(f,B,S,V),no=!1;var Oe=f.memoizedState;B.state=Oe,Iu(f,S,B,M),Du(),je=f.memoizedState,te||Oe!==je||no?(typeof Xe=="function"&&(dv(f,b,Xe,S),je=f.memoizedState),(ge=no||A2(f,b,ge,S,Oe,je,V))?(We||typeof B.UNSAFE_componentWillMount!="function"&&typeof B.componentWillMount!="function"||(typeof B.componentWillMount=="function"&&B.componentWillMount(),typeof B.UNSAFE_componentWillMount=="function"&&B.UNSAFE_componentWillMount()),typeof B.componentDidMount=="function"&&(f.flags|=4194308)):(typeof B.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=S,f.memoizedState=je),B.props=S,B.state=je,B.context=V,S=ge):(typeof B.componentDidMount=="function"&&(f.flags|=4194308),S=!1)}else{B=f.stateNode,Hb(c,f),V=f.memoizedProps,We=_l(b,V),B.props=We,Xe=f.pendingProps,Oe=B.context,je=b.contextType,ge=Ec,typeof je=="object"&&je!==null&&(ge=Oi(je)),te=b.getDerivedStateFromProps,(je=typeof te=="function"||typeof B.getSnapshotBeforeUpdate=="function")||typeof B.UNSAFE_componentWillReceiveProps!="function"&&typeof B.componentWillReceiveProps!="function"||(V!==Xe||Oe!==ge)&&j2(f,B,S,ge),no=!1,Oe=f.memoizedState,B.state=Oe,Iu(f,S,B,M),Du();var Fe=f.memoizedState;V!==Xe||Oe!==Fe||no||c!==null&&c.dependencies!==null&&fp(c.dependencies)?(typeof te=="function"&&(dv(f,b,te,S),Fe=f.memoizedState),(We=no||A2(f,b,We,S,Oe,Fe,ge)||c!==null&&c.dependencies!==null&&fp(c.dependencies))?(je||typeof B.UNSAFE_componentWillUpdate!="function"&&typeof B.componentWillUpdate!="function"||(typeof B.componentWillUpdate=="function"&&B.componentWillUpdate(S,Fe,ge),typeof B.UNSAFE_componentWillUpdate=="function"&&B.UNSAFE_componentWillUpdate(S,Fe,ge)),typeof B.componentDidUpdate=="function"&&(f.flags|=4),typeof B.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof B.componentDidUpdate!="function"||V===c.memoizedProps&&Oe===c.memoizedState||(f.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||V===c.memoizedProps&&Oe===c.memoizedState||(f.flags|=1024),f.memoizedProps=S,f.memoizedState=Fe),B.props=S,B.state=Fe,B.context=ge,S=We):(typeof B.componentDidUpdate!="function"||V===c.memoizedProps&&Oe===c.memoizedState||(f.flags|=4),typeof B.getSnapshotBeforeUpdate!="function"||V===c.memoizedProps&&Oe===c.memoizedState||(f.flags|=1024),S=!1)}return B=S,Lp(c,f),S=(f.flags&128)!==0,B||S?(B=f.stateNode,b=S&&typeof b.getDerivedStateFromError!="function"?null:B.render(),f.flags|=1,c!==null&&S?(f.child=vl(f,c.child,null,M),f.child=vl(f,null,b,M)):Di(c,f,b,M),f.memoizedState=B.state,c=f.child):c=ma(c,f,M),c}function W2(c,f,b,S){return fl(),f.flags|=256,Di(c,f,b,S),f.child}var yv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bv(c){return{baseLanes:c,cachePool:RS()}}function vv(c,f,b){return c=c!==null?c.childLanes&~b:0,f&&(c|=Rn),c}function G2(c,f,b){var S=f.pendingProps,M=!1,B=(f.flags&128)!==0,V;if((V=B)||(V=c!==null&&c.memoizedState===null?!1:(ui.current&2)!==0),V&&(M=!0,f.flags&=-129),V=(f.flags&32)!==0,f.flags&=-33,c===null){if(wr){if(M?oo(f):lo(),(c=Vr)?(c=eE(c,Qn),c=c!==null&&c.data!=="&"?c:null,c!==null&&(f.memoizedState={dehydrated:c,treeContext:eo!==null?{id:Ds,overflow:Is}:null,retryLane:536870912,hydrationErrors:null},b=SS(c),b.return=f,f.child=b,Ri=f,Vr=null)):c=null,c===null)throw ro(f);return t0(c)?f.lanes=32:f.lanes=536870912,null}var te=S.children;return S=S.fallback,M?(lo(),M=f.mode,te=Bp({mode:"hidden",children:te},M),S=dl(S,M,b,null),te.return=f,S.return=f,te.sibling=S,f.child=te,S=f.child,S.memoizedState=bv(b),S.childLanes=vv(c,V,b),f.memoizedState=yv,qu(null,S)):(oo(f),xv(f,te))}var ge=c.memoizedState;if(ge!==null&&(te=ge.dehydrated,te!==null)){if(B)f.flags&256?(oo(f),f.flags&=-257,f=_v(c,f,b)):f.memoizedState!==null?(lo(),f.child=c.child,f.flags|=128,f=null):(lo(),te=S.fallback,M=f.mode,S=Bp({mode:"visible",children:S.children},M),te=dl(te,M,b,null),te.flags|=2,S.return=f,te.return=f,S.sibling=te,f.child=S,vl(f,c.child,null,b),S=f.child,S.memoizedState=bv(b),S.childLanes=vv(c,V,b),f.memoizedState=yv,f=qu(null,S));else if(oo(f),t0(te)){if(V=te.nextSibling&&te.nextSibling.dataset,V)var je=V.dgst;V=je,S=Error(n(419)),S.stack="",S.digest=V,ju({value:S,source:null,stack:null}),f=_v(c,f,b)}else if(mi||Mc(c,f,b,!1),V=(b&c.childLanes)!==0,mi||V){if(V=Wr,V!==null&&(S=ae(V,b),S!==0&&S!==ge.retryLane))throw ge.retryLane=S,ul(c,S),vn(V,c,S),gv;e0(te)||qp(),f=_v(c,f,b)}else e0(te)?(f.flags|=192,f.child=c.child,f=null):(c=ge.treeContext,Vr=es(te.nextSibling),Ri=f,wr=!0,to=null,Qn=!1,c!==null&&NS(f,c),f=xv(f,S.children),f.flags|=4096);return f}return M?(lo(),te=S.fallback,M=f.mode,ge=c.child,je=ge.sibling,S=ha(ge,{mode:"hidden",children:S.children}),S.subtreeFlags=ge.subtreeFlags&65011712,je!==null?te=ha(je,te):(te=dl(te,M,b,null),te.flags|=2),te.return=f,S.return=f,S.sibling=te,f.child=S,qu(null,S),S=f.child,te=c.child.memoizedState,te===null?te=bv(b):(M=te.cachePool,M!==null?(ge=pi._currentValue,M=M.parent!==ge?{parent:ge,pool:ge}:M):M=RS(),te={baseLanes:te.baseLanes|b,cachePool:M}),S.memoizedState=te,S.childLanes=vv(c,V,b),f.memoizedState=yv,qu(c.child,S)):(oo(f),b=c.child,c=b.sibling,b=ha(b,{mode:"visible",children:S.children}),b.return=f,b.sibling=null,c!==null&&(V=f.deletions,V===null?(f.deletions=[c],f.flags|=16):V.push(c)),f.child=b,f.memoizedState=null,b)}function xv(c,f){return f=Bp({mode:"visible",children:f},c.mode),f.return=c,c.child=f}function Bp(c,f){return c=jn(22,c,null,f),c.lanes=0,c}function _v(c,f,b){return vl(f,c.child,null,b),c=xv(f,f.pendingProps.children),c.flags|=2,f.memoizedState=null,c}function K2(c,f,b){c.lanes|=f;var S=c.alternate;S!==null&&(S.lanes|=f),Db(c.return,f,b)}function Cv(c,f,b,S,M,B){var V=c.memoizedState;V===null?c.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:S,tail:b,tailMode:M,treeForkCount:B}:(V.isBackwards=f,V.rendering=null,V.renderingStartTime=0,V.last=S,V.tail=b,V.tailMode=M,V.treeForkCount=B)}function V2(c,f,b){var S=f.pendingProps,M=S.revealOrder,B=S.tail;S=S.children;var V=ui.current,te=(V&2)!==0;if(te?(V=V&1|2,f.flags|=128):V&=1,ie(ui,V),Di(c,f,S,b),S=wr?Au:0,!te&&c!==null&&(c.flags&128)!==0)e:for(c=f.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&K2(c,b,f);else if(c.tag===19)K2(c,b,f);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===f)break e;for(;c.sibling===null;){if(c.return===null||c.return===f)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}switch(M){case"forwards":for(b=f.child,M=null;b!==null;)c=b.alternate,c!==null&&_p(c)===null&&(M=b),b=b.sibling;b=M,b===null?(M=f.child,f.child=null):(M=b.sibling,b.sibling=null),Cv(f,!1,M,b,B,S);break;case"backwards":case"unstable_legacy-backwards":for(b=null,M=f.child,f.child=null;M!==null;){if(c=M.alternate,c!==null&&_p(c)===null){f.child=M;break}c=M.sibling,M.sibling=b,b=M,M=c}Cv(f,!0,b,null,B,S);break;case"together":Cv(f,!1,null,null,void 0,S);break;default:f.memoizedState=null}return f.child}function ma(c,f,b){if(c!==null&&(f.dependencies=c.dependencies),uo|=f.lanes,(b&f.childLanes)===0)if(c!==null){if(Mc(c,f,b,!1),(b&f.childLanes)===0)return null}else return null;if(c!==null&&f.child!==c.child)throw Error(n(153));if(f.child!==null){for(c=f.child,b=ha(c,c.pendingProps),f.child=b,b.return=f;c.sibling!==null;)c=c.sibling,b=b.sibling=ha(c,c.pendingProps),b.return=f;b.sibling=null}return f.child}function wv(c,f){return(c.lanes&f)!==0?!0:(c=c.dependencies,!!(c!==null&&fp(c)))}function D8(c,f,b){switch(f.tag){case 3:I(f,f.stateNode.containerInfo),io(f,pi,c.memoizedState.cache),fl();break;case 27:case 5:J(f);break;case 4:I(f,f.stateNode.containerInfo);break;case 10:io(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,Vb(f),null;break;case 13:var S=f.memoizedState;if(S!==null)return S.dehydrated!==null?(oo(f),f.flags|=128,null):(b&f.child.childLanes)!==0?G2(c,f,b):(oo(f),c=ma(c,f,b),c!==null?c.sibling:null);oo(f);break;case 19:var M=(c.flags&128)!==0;if(S=(b&f.childLanes)!==0,S||(Mc(c,f,b,!1),S=(b&f.childLanes)!==0),M){if(S)return V2(c,f,b);f.flags|=128}if(M=f.memoizedState,M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),ie(ui,ui.current),S)break;return null;case 22:return f.lanes=0,P2(c,f,b,f.pendingProps);case 24:io(f,pi,c.memoizedState.cache)}return ma(c,f,b)}function Y2(c,f,b){if(c!==null)if(c.memoizedProps!==f.pendingProps)mi=!0;else{if(!wv(c,b)&&(f.flags&128)===0)return mi=!1,D8(c,f,b);mi=(c.flags&131072)!==0}else mi=!1,wr&&(f.flags&1048576)!==0&&ES(f,Au,f.index);switch(f.lanes=0,f.tag){case 16:e:{var S=f.pendingProps;if(c=yl(f.elementType),f.type=c,typeof c=="function")Nb(c)?(S=_l(c,S),f.tag=1,f=U2(null,f,c,S,b)):(f.tag=0,f=mv(null,f,c,S,b));else{if(c!=null){var M=c.$$typeof;if(M===T){f.tag=11,f=I2(null,f,c,S,b);break e}else if(M===A){f.tag=14,f=F2(null,f,c,S,b);break e}}throw f=U(c)||c,Error(n(306,f,""))}}return f;case 0:return mv(c,f,f.type,f.pendingProps,b);case 1:return S=f.type,M=_l(S,f.pendingProps),U2(c,f,S,M,b);case 3:e:{if(I(f,f.stateNode.containerInfo),c===null)throw Error(n(387));S=f.pendingProps;var B=f.memoizedState;M=B.element,Hb(c,f),Iu(f,S,null,b);var V=f.memoizedState;if(S=V.cache,io(f,pi,S),S!==B.cache&&Ib(f,[pi],b,!0),Du(),S=V.element,B.isDehydrated)if(B={element:S,isDehydrated:!1,cache:V.cache},f.updateQueue.baseState=B,f.memoizedState=B,f.flags&256){f=W2(c,f,S,b);break e}else if(S!==M){M=Yn(Error(n(424)),f),ju(M),f=W2(c,f,S,b);break e}else{switch(c=f.stateNode.containerInfo,c.nodeType){case 9:c=c.body;break;default:c=c.nodeName==="HTML"?c.ownerDocument.body:c}for(Vr=es(c.firstChild),Ri=f,wr=!0,to=null,Qn=!0,b=PS(f,null,S,b),f.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling}else{if(fl(),S===M){f=ma(c,f,b);break e}Di(c,f,S,b)}f=f.child}return f;case 26:return Lp(c,f),c===null?(b=aE(f.type,null,f.pendingProps,null))?f.memoizedState=b:wr||(b=f.type,c=f.pendingProps,S=Yp(fe.current).createElement(b),S[xt]=f,S[$t]=c,Ii(S,b,c),Lr(S),f.stateNode=S):f.memoizedState=aE(f.type,c.memoizedProps,f.pendingProps,c.memoizedState),null;case 27:return J(f),c===null&&wr&&(S=f.stateNode=iE(f.type,f.pendingProps,fe.current),Ri=f,Qn=!0,M=Vr,yo(f.type)?(r0=M,Vr=es(S.firstChild)):Vr=M),Di(c,f,f.pendingProps.children,b),Lp(c,f),c===null&&(f.flags|=4194304),f.child;case 5:return c===null&&wr&&((M=S=Vr)&&(S=dP(S,f.type,f.pendingProps,Qn),S!==null?(f.stateNode=S,Ri=f,Vr=es(S.firstChild),Qn=!1,M=!0):M=!1),M||ro(f)),J(f),M=f.type,B=f.pendingProps,V=c!==null?c.memoizedProps:null,S=B.children,Zv(M,B)?S=null:V!==null&&Zv(M,V)&&(f.flags|=32),f.memoizedState!==null&&(M=Xb(c,f,E8,null,null,b),id._currentValue=M),Lp(c,f),Di(c,f,S,b),f.child;case 6:return c===null&&wr&&((c=b=Vr)&&(b=fP(b,f.pendingProps,Qn),b!==null?(f.stateNode=b,Ri=f,Vr=null,c=!0):c=!1),c||ro(f)),null;case 13:return G2(c,f,b);case 4:return I(f,f.stateNode.containerInfo),S=f.pendingProps,c===null?f.child=vl(f,null,S,b):Di(c,f,S,b),f.child;case 11:return I2(c,f,f.type,f.pendingProps,b);case 7:return Di(c,f,f.pendingProps,b),f.child;case 8:return Di(c,f,f.pendingProps.children,b),f.child;case 12:return Di(c,f,f.pendingProps.children,b),f.child;case 10:return S=f.pendingProps,io(f,f.type,S.value),Di(c,f,S.children,b),f.child;case 9:return M=f.type._context,S=f.pendingProps.children,gl(f),M=Oi(M),S=S(M),f.flags|=1,Di(c,f,S,b),f.child;case 14:return F2(c,f,f.type,f.pendingProps,b);case 15:return $2(c,f,f.type,f.pendingProps,b);case 19:return V2(c,f,b);case 31:return O8(c,f,b);case 22:return P2(c,f,b,f.pendingProps);case 24:return gl(f),S=Oi(pi),c===null?(M=Pb(),M===null&&(M=Wr,B=Fb(),M.pooledCache=B,B.refCount++,B!==null&&(M.pooledCacheLanes|=b),M=B),f.memoizedState={parent:S,cache:M},qb(f),io(f,pi,M)):((c.lanes&b)!==0&&(Hb(c,f),Iu(f,null,null,b),Du()),M=c.memoizedState,B=f.memoizedState,M.parent!==S?(M={parent:S,cache:S},f.memoizedState=M,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=M),io(f,pi,S)):(S=B.cache,io(f,pi,S),S!==M.cache&&Ib(f,[pi],b,!0))),Di(c,f,f.pendingProps.children,b),f.child;case 29:throw f.pendingProps}throw Error(n(156,f.tag))}function ya(c){c.flags|=4}function kv(c,f,b,S,M){if((f=(c.mode&32)!==0)&&(f=!1),f){if(c.flags|=16777216,(M&335544128)===M)if(c.stateNode.complete)c.flags|=8192;else if(CT())c.flags|=8192;else throw bl=yp,zb}else c.flags&=-16777217}function X2(c,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)c.flags&=-16777217;else if(c.flags|=16777216,!uE(f))if(CT())c.flags|=8192;else throw bl=yp,zb}function Rp(c,f){f!==null&&(c.flags|=4),c.flags&16384&&(f=c.tag!==22?tt():536870912,c.lanes|=f,Hc|=f)}function Hu(c,f){if(!wr)switch(c.tailMode){case"hidden":f=c.tail;for(var b=null;f!==null;)f.alternate!==null&&(b=f),f=f.sibling;b===null?c.tail=null:b.sibling=null;break;case"collapsed":b=c.tail;for(var S=null;b!==null;)b.alternate!==null&&(S=b),b=b.sibling;S===null?f||c.tail===null?c.tail=null:c.tail.sibling=null:S.sibling=null}}function Yr(c){var f=c.alternate!==null&&c.alternate.child===c.child,b=0,S=0;if(f)for(var M=c.child;M!==null;)b|=M.lanes|M.childLanes,S|=M.subtreeFlags&65011712,S|=M.flags&65011712,M.return=c,M=M.sibling;else for(M=c.child;M!==null;)b|=M.lanes|M.childLanes,S|=M.subtreeFlags,S|=M.flags,M.return=c,M=M.sibling;return c.subtreeFlags|=S,c.childLanes=b,f}function I8(c,f,b){var S=f.pendingProps;switch(Lb(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yr(f),null;case 1:return Yr(f),null;case 3:return b=f.stateNode,S=null,c!==null&&(S=c.memoizedState.cache),f.memoizedState.cache!==S&&(f.flags|=2048),fa(pi),Z(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(c===null||c.child===null)&&(jc(f)?ya(f):c===null||c.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,Rb())),Yr(f),null;case 26:var M=f.type,B=f.memoizedState;return c===null?(ya(f),B!==null?(Yr(f),X2(f,B)):(Yr(f),kv(f,M,null,S,b))):B?B!==c.memoizedState?(ya(f),Yr(f),X2(f,B)):(Yr(f),f.flags&=-16777217):(c=c.memoizedProps,c!==S&&ya(f),Yr(f),kv(f,M,c,S,b)),null;case 27:if(re(f),b=fe.current,M=f.type,c!==null&&f.stateNode!=null)c.memoizedProps!==S&&ya(f);else{if(!S){if(f.stateNode===null)throw Error(n(166));return Yr(f),null}c=ee.current,jc(f)?AS(f):(c=iE(M,S,b),f.stateNode=c,ya(f))}return Yr(f),null;case 5:if(re(f),M=f.type,c!==null&&f.stateNode!=null)c.memoizedProps!==S&&ya(f);else{if(!S){if(f.stateNode===null)throw Error(n(166));return Yr(f),null}if(B=ee.current,jc(f))AS(f);else{var V=Yp(fe.current);switch(B){case 1:B=V.createElementNS("http://www.w3.org/2000/svg",M);break;case 2:B=V.createElementNS("http://www.w3.org/1998/Math/MathML",M);break;default:switch(M){case"svg":B=V.createElementNS("http://www.w3.org/2000/svg",M);break;case"math":B=V.createElementNS("http://www.w3.org/1998/Math/MathML",M);break;case"script":B=V.createElement("div"),B.innerHTML="<script><\/script>",B=B.removeChild(B.firstChild);break;case"select":B=typeof S.is=="string"?V.createElement("select",{is:S.is}):V.createElement("select"),S.multiple?B.multiple=!0:S.size&&(B.size=S.size);break;default:B=typeof S.is=="string"?V.createElement(M,{is:S.is}):V.createElement(M)}}B[xt]=f,B[$t]=S;e:for(V=f.child;V!==null;){if(V.tag===5||V.tag===6)B.appendChild(V.stateNode);else if(V.tag!==4&&V.tag!==27&&V.child!==null){V.child.return=V,V=V.child;continue}if(V===f)break e;for(;V.sibling===null;){if(V.return===null||V.return===f)break e;V=V.return}V.sibling.return=V.return,V=V.sibling}f.stateNode=B;e:switch(Ii(B,M,S),M){case"button":case"input":case"select":case"textarea":S=!!S.autoFocus;break e;case"img":S=!0;break e;default:S=!1}S&&ya(f)}}return Yr(f),kv(f,f.type,c===null?null:c.memoizedProps,f.pendingProps,b),null;case 6:if(c&&f.stateNode!=null)c.memoizedProps!==S&&ya(f);else{if(typeof S!="string"&&f.stateNode===null)throw Error(n(166));if(c=fe.current,jc(f)){if(c=f.stateNode,b=f.memoizedProps,S=null,M=Ri,M!==null)switch(M.tag){case 27:case 5:S=M.memoizedProps}c[xt]=f,c=!!(c.nodeValue===b||S!==null&&S.suppressHydrationWarning===!0||GT(c.nodeValue,b)),c||ro(f,!0)}else c=Yp(c).createTextNode(S),c[xt]=f,f.stateNode=c}return Yr(f),null;case 31:if(b=f.memoizedState,c===null||c.memoizedState!==null){if(S=jc(f),b!==null){if(c===null){if(!S)throw Error(n(318));if(c=f.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(557));c[xt]=f}else fl(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Yr(f),c=!1}else b=Rb(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=b),c=!0;if(!c)return f.flags&256?(Ln(f),f):(Ln(f),null);if((f.flags&128)!==0)throw Error(n(558))}return Yr(f),null;case 13:if(S=f.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(M=jc(f),S!==null&&S.dehydrated!==null){if(c===null){if(!M)throw Error(n(318));if(M=f.memoizedState,M=M!==null?M.dehydrated:null,!M)throw Error(n(317));M[xt]=f}else fl(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Yr(f),M=!1}else M=Rb(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=M),M=!0;if(!M)return f.flags&256?(Ln(f),f):(Ln(f),null)}return Ln(f),(f.flags&128)!==0?(f.lanes=b,f):(b=S!==null,c=c!==null&&c.memoizedState!==null,b&&(S=f.child,M=null,S.alternate!==null&&S.alternate.memoizedState!==null&&S.alternate.memoizedState.cachePool!==null&&(M=S.alternate.memoizedState.cachePool.pool),B=null,S.memoizedState!==null&&S.memoizedState.cachePool!==null&&(B=S.memoizedState.cachePool.pool),B!==M&&(S.flags|=2048)),b!==c&&b&&(f.child.flags|=8192),Rp(f,f.updateQueue),Yr(f),null);case 4:return Z(),c===null&&Gv(f.stateNode.containerInfo),Yr(f),null;case 10:return fa(f.type),Yr(f),null;case 19:if(X(ui),S=f.memoizedState,S===null)return Yr(f),null;if(M=(f.flags&128)!==0,B=S.rendering,B===null)if(M)Hu(S,!1);else{if(oi!==0||c!==null&&(c.flags&128)!==0)for(c=f.child;c!==null;){if(B=_p(c),B!==null){for(f.flags|=128,Hu(S,!1),c=B.updateQueue,f.updateQueue=c,Rp(f,c),f.subtreeFlags=0,c=b,b=f.child;b!==null;)kS(b,c),b=b.sibling;return ie(ui,ui.current&1|2),wr&&ua(f,S.treeForkCount),f.child}c=c.sibling}S.tail!==null&&Lt()>$p&&(f.flags|=128,M=!0,Hu(S,!1),f.lanes=4194304)}else{if(!M)if(c=_p(B),c!==null){if(f.flags|=128,M=!0,c=c.updateQueue,f.updateQueue=c,Rp(f,c),Hu(S,!0),S.tail===null&&S.tailMode==="hidden"&&!B.alternate&&!wr)return Yr(f),null}else 2*Lt()-S.renderingStartTime>$p&&b!==536870912&&(f.flags|=128,M=!0,Hu(S,!1),f.lanes=4194304);S.isBackwards?(B.sibling=f.child,f.child=B):(c=S.last,c!==null?c.sibling=B:f.child=B,S.last=B)}return S.tail!==null?(c=S.tail,S.rendering=c,S.tail=c.sibling,S.renderingStartTime=Lt(),c.sibling=null,b=ui.current,ie(ui,M?b&1|2:b&1),wr&&ua(f,S.treeForkCount),c):(Yr(f),null);case 22:case 23:return Ln(f),Kb(),S=f.memoizedState!==null,c!==null?c.memoizedState!==null!==S&&(f.flags|=8192):S&&(f.flags|=8192),S?(b&536870912)!==0&&(f.flags&128)===0&&(Yr(f),f.subtreeFlags&6&&(f.flags|=8192)):Yr(f),b=f.updateQueue,b!==null&&Rp(f,b.retryQueue),b=null,c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),S=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(S=f.memoizedState.cachePool.pool),S!==b&&(f.flags|=2048),c!==null&&X(ml),null;case 24:return b=null,c!==null&&(b=c.memoizedState.cache),f.memoizedState.cache!==b&&(f.flags|=2048),fa(pi),Yr(f),null;case 25:return null;case 30:return null}throw Error(n(156,f.tag))}function F8(c,f){switch(Lb(f),f.tag){case 1:return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return fa(pi),Z(),c=f.flags,(c&65536)!==0&&(c&128)===0?(f.flags=c&-65537|128,f):null;case 26:case 27:case 5:return re(f),null;case 31:if(f.memoizedState!==null){if(Ln(f),f.alternate===null)throw Error(n(340));fl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 13:if(Ln(f),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(n(340));fl()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return X(ui),null;case 4:return Z(),null;case 10:return fa(f.type),null;case 22:case 23:return Ln(f),Kb(),c!==null&&X(ml),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 24:return fa(pi),null;case 25:return null;default:return null}}function Z2(c,f){switch(Lb(f),f.tag){case 3:fa(pi),Z();break;case 26:case 27:case 5:re(f);break;case 4:Z();break;case 31:f.memoizedState!==null&&Ln(f);break;case 13:Ln(f);break;case 19:X(ui);break;case 10:fa(f.type);break;case 22:case 23:Ln(f),Kb(),c!==null&&X(ml);break;case 24:fa(pi)}}function Uu(c,f){try{var b=f.updateQueue,S=b!==null?b.lastEffect:null;if(S!==null){var M=S.next;b=M;do{if((b.tag&c)===c){S=void 0;var B=b.create,V=b.inst;S=B(),V.destroy=S}b=b.next}while(b!==M)}}catch(te){Pr(f,f.return,te)}}function co(c,f,b){try{var S=f.updateQueue,M=S!==null?S.lastEffect:null;if(M!==null){var B=M.next;S=B;do{if((S.tag&c)===c){var V=S.inst,te=V.destroy;if(te!==void 0){V.destroy=void 0,M=f;var ge=b,je=te;try{je()}catch(We){Pr(M,ge,We)}}}S=S.next}while(S!==B)}}catch(We){Pr(f,f.return,We)}}function Q2(c){var f=c.updateQueue;if(f!==null){var b=c.stateNode;try{qS(f,b)}catch(S){Pr(c,c.return,S)}}}function J2(c,f,b){b.props=_l(c.type,c.memoizedProps),b.state=c.memoizedState;try{b.componentWillUnmount()}catch(S){Pr(c,f,S)}}function Wu(c,f){try{var b=c.ref;if(b!==null){switch(c.tag){case 26:case 27:case 5:var S=c.stateNode;break;case 30:S=c.stateNode;break;default:S=c.stateNode}typeof b=="function"?c.refCleanup=b(S):b.current=S}}catch(M){Pr(c,f,M)}}function Fs(c,f){var b=c.ref,S=c.refCleanup;if(b!==null)if(typeof S=="function")try{S()}catch(M){Pr(c,f,M)}finally{c.refCleanup=null,c=c.alternate,c!=null&&(c.refCleanup=null)}else if(typeof b=="function")try{b(null)}catch(M){Pr(c,f,M)}else b.current=null}function eT(c){var f=c.type,b=c.memoizedProps,S=c.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":b.autoFocus&&S.focus();break e;case"img":b.src?S.src=b.src:b.srcSet&&(S.srcset=b.srcSet)}}catch(M){Pr(c,c.return,M)}}function Sv(c,f,b){try{var S=c.stateNode;aP(S,c.type,b,f),S[$t]=f}catch(M){Pr(c,c.return,M)}}function tT(c){return c.tag===5||c.tag===3||c.tag===26||c.tag===27&&yo(c.type)||c.tag===4}function Tv(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||tT(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.tag===27&&yo(c.type)||c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function Ev(c,f,b){var S=c.tag;if(S===5||S===6)c=c.stateNode,f?(b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b).insertBefore(c,f):(f=b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b,f.appendChild(c),b=b._reactRootContainer,b!=null||f.onclick!==null||(f.onclick=pt));else if(S!==4&&(S===27&&yo(c.type)&&(b=c.stateNode,f=null),c=c.child,c!==null))for(Ev(c,f,b),c=c.sibling;c!==null;)Ev(c,f,b),c=c.sibling}function Op(c,f,b){var S=c.tag;if(S===5||S===6)c=c.stateNode,f?b.insertBefore(c,f):b.appendChild(c);else if(S!==4&&(S===27&&yo(c.type)&&(b=c.stateNode),c=c.child,c!==null))for(Op(c,f,b),c=c.sibling;c!==null;)Op(c,f,b),c=c.sibling}function rT(c){var f=c.stateNode,b=c.memoizedProps;try{for(var S=c.type,M=f.attributes;M.length;)f.removeAttributeNode(M[0]);Ii(f,S,b),f[xt]=c,f[$t]=b}catch(B){Pr(c,c.return,B)}}var ba=!1,yi=!1,Nv=!1,iT=typeof WeakSet=="function"?WeakSet:Set,Ai=null;function $8(c,f){if(c=c.containerInfo,Yv=rg,c=gS(c),_b(c)){if("selectionStart"in c)var b={start:c.selectionStart,end:c.selectionEnd};else e:{b=(b=c.ownerDocument)&&b.defaultView||window;var S=b.getSelection&&b.getSelection();if(S&&S.rangeCount!==0){b=S.anchorNode;var M=S.anchorOffset,B=S.focusNode;S=S.focusOffset;try{b.nodeType,B.nodeType}catch{b=null;break e}var V=0,te=-1,ge=-1,je=0,We=0,Xe=c,Oe=null;t:for(;;){for(var Fe;Xe!==b||M!==0&&Xe.nodeType!==3||(te=V+M),Xe!==B||S!==0&&Xe.nodeType!==3||(ge=V+S),Xe.nodeType===3&&(V+=Xe.nodeValue.length),(Fe=Xe.firstChild)!==null;)Oe=Xe,Xe=Fe;for(;;){if(Xe===c)break t;if(Oe===b&&++je===M&&(te=V),Oe===B&&++We===S&&(ge=V),(Fe=Xe.nextSibling)!==null)break;Xe=Oe,Oe=Xe.parentNode}Xe=Fe}b=te===-1||ge===-1?null:{start:te,end:ge}}else b=null}b=b||{start:0,end:0}}else b=null;for(Xv={focusedElem:c,selectionRange:b},rg=!1,Ai=f;Ai!==null;)if(f=Ai,c=f.child,(f.subtreeFlags&1028)!==0&&c!==null)c.return=f,Ai=c;else for(;Ai!==null;){switch(f=Ai,B=f.alternate,c=f.flags,f.tag){case 0:if((c&4)!==0&&(c=f.updateQueue,c=c!==null?c.events:null,c!==null))for(b=0;b<c.length;b++)M=c[b],M.ref.impl=M.nextImpl;break;case 11:case 15:break;case 1:if((c&1024)!==0&&B!==null){c=void 0,b=f,M=B.memoizedProps,B=B.memoizedState,S=b.stateNode;try{var Nt=_l(b.type,M);c=S.getSnapshotBeforeUpdate(Nt,B),S.__reactInternalSnapshotBeforeUpdate=c}catch(Yt){Pr(b,b.return,Yt)}}break;case 3:if((c&1024)!==0){if(c=f.stateNode.containerInfo,b=c.nodeType,b===9)Jv(c);else if(b===1)switch(c.nodeName){case"HEAD":case"HTML":case"BODY":Jv(c);break;default:c.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((c&1024)!==0)throw Error(n(163))}if(c=f.sibling,c!==null){c.return=f.return,Ai=c;break}Ai=f.return}}function nT(c,f,b){var S=b.flags;switch(b.tag){case 0:case 11:case 15:xa(c,b),S&4&&Uu(5,b);break;case 1:if(xa(c,b),S&4)if(c=b.stateNode,f===null)try{c.componentDidMount()}catch(V){Pr(b,b.return,V)}else{var M=_l(b.type,f.memoizedProps);f=f.memoizedState;try{c.componentDidUpdate(M,f,c.__reactInternalSnapshotBeforeUpdate)}catch(V){Pr(b,b.return,V)}}S&64&&Q2(b),S&512&&Wu(b,b.return);break;case 3:if(xa(c,b),S&64&&(c=b.updateQueue,c!==null)){if(f=null,b.child!==null)switch(b.child.tag){case 27:case 5:f=b.child.stateNode;break;case 1:f=b.child.stateNode}try{qS(c,f)}catch(V){Pr(b,b.return,V)}}break;case 27:f===null&&S&4&&rT(b);case 26:case 5:xa(c,b),f===null&&S&4&&eT(b),S&512&&Wu(b,b.return);break;case 12:xa(c,b);break;case 31:xa(c,b),S&4&&oT(c,b);break;case 13:xa(c,b),S&4&&lT(c,b),S&64&&(c=b.memoizedState,c!==null&&(c=c.dehydrated,c!==null&&(b=V8.bind(null,b),pP(c,b))));break;case 22:if(S=b.memoizedState!==null||ba,!S){f=f!==null&&f.memoizedState!==null||yi,M=ba;var B=yi;ba=S,(yi=f)&&!B?_a(c,b,(b.subtreeFlags&8772)!==0):xa(c,b),ba=M,yi=B}break;case 30:break;default:xa(c,b)}}function sT(c){var f=c.alternate;f!==null&&(c.alternate=null,sT(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&Os(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}var Qr=null,gn=!1;function va(c,f,b){for(b=b.child;b!==null;)aT(c,f,b),b=b.sibling}function aT(c,f,b){if(Te&&typeof Te.onCommitFiberUnmount=="function")try{Te.onCommitFiberUnmount(At,b)}catch{}switch(b.tag){case 26:yi||Fs(b,f),va(c,f,b),b.memoizedState?b.memoizedState.count--:b.stateNode&&(b=b.stateNode,b.parentNode.removeChild(b));break;case 27:yi||Fs(b,f);var S=Qr,M=gn;yo(b.type)&&(Qr=b.stateNode,gn=!1),va(c,f,b),ed(b.stateNode),Qr=S,gn=M;break;case 5:yi||Fs(b,f);case 6:if(S=Qr,M=gn,Qr=null,va(c,f,b),Qr=S,gn=M,Qr!==null)if(gn)try{(Qr.nodeType===9?Qr.body:Qr.nodeName==="HTML"?Qr.ownerDocument.body:Qr).removeChild(b.stateNode)}catch(B){Pr(b,f,B)}else try{Qr.removeChild(b.stateNode)}catch(B){Pr(b,f,B)}break;case 18:Qr!==null&&(gn?(c=Qr,QT(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,b.stateNode),Zc(c)):QT(Qr,b.stateNode));break;case 4:S=Qr,M=gn,Qr=b.stateNode.containerInfo,gn=!0,va(c,f,b),Qr=S,gn=M;break;case 0:case 11:case 14:case 15:co(2,b,f),yi||co(4,b,f),va(c,f,b);break;case 1:yi||(Fs(b,f),S=b.stateNode,typeof S.componentWillUnmount=="function"&&J2(b,f,S)),va(c,f,b);break;case 21:va(c,f,b);break;case 22:yi=(S=yi)||b.memoizedState!==null,va(c,f,b),yi=S;break;default:va(c,f,b)}}function oT(c,f){if(f.memoizedState===null&&(c=f.alternate,c!==null&&(c=c.memoizedState,c!==null))){c=c.dehydrated;try{Zc(c)}catch(b){Pr(f,f.return,b)}}}function lT(c,f){if(f.memoizedState===null&&(c=f.alternate,c!==null&&(c=c.memoizedState,c!==null&&(c=c.dehydrated,c!==null))))try{Zc(c)}catch(b){Pr(f,f.return,b)}}function P8(c){switch(c.tag){case 31:case 13:case 19:var f=c.stateNode;return f===null&&(f=c.stateNode=new iT),f;case 22:return c=c.stateNode,f=c._retryCache,f===null&&(f=c._retryCache=new iT),f;default:throw Error(n(435,c.tag))}}function Dp(c,f){var b=P8(c);f.forEach(function(S){if(!b.has(S)){b.add(S);var M=Y8.bind(null,c,S);S.then(M,M)}})}function mn(c,f){var b=f.deletions;if(b!==null)for(var S=0;S<b.length;S++){var M=b[S],B=c,V=f,te=V;e:for(;te!==null;){switch(te.tag){case 27:if(yo(te.type)){Qr=te.stateNode,gn=!1;break e}break;case 5:Qr=te.stateNode,gn=!1;break e;case 3:case 4:Qr=te.stateNode.containerInfo,gn=!0;break e}te=te.return}if(Qr===null)throw Error(n(160));aT(B,V,M),Qr=null,gn=!1,B=M.alternate,B!==null&&(B.return=null),M.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)cT(f,c),f=f.sibling}var bs=null;function cT(c,f){var b=c.alternate,S=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:mn(f,c),yn(c),S&4&&(co(3,c,c.return),Uu(3,c),co(5,c,c.return));break;case 1:mn(f,c),yn(c),S&512&&(yi||b===null||Fs(b,b.return)),S&64&&ba&&(c=c.updateQueue,c!==null&&(S=c.callbacks,S!==null&&(b=c.shared.hiddenCallbacks,c.shared.hiddenCallbacks=b===null?S:b.concat(S))));break;case 26:var M=bs;if(mn(f,c),yn(c),S&512&&(yi||b===null||Fs(b,b.return)),S&4){var B=b!==null?b.memoizedState:null;if(S=c.memoizedState,b===null)if(S===null)if(c.stateNode===null){e:{S=c.type,b=c.memoizedProps,M=M.ownerDocument||M;t:switch(S){case"title":B=M.getElementsByTagName("title")[0],(!B||B[Hn]||B[xt]||B.namespaceURI==="http://www.w3.org/2000/svg"||B.hasAttribute("itemprop"))&&(B=M.createElement(S),M.head.insertBefore(B,M.querySelector("head > title"))),Ii(B,S,b),B[xt]=c,Lr(B),S=B;break e;case"link":var V=cE("link","href",M).get(S+(b.href||""));if(V){for(var te=0;te<V.length;te++)if(B=V[te],B.getAttribute("href")===(b.href==null||b.href===""?null:b.href)&&B.getAttribute("rel")===(b.rel==null?null:b.rel)&&B.getAttribute("title")===(b.title==null?null:b.title)&&B.getAttribute("crossorigin")===(b.crossOrigin==null?null:b.crossOrigin)){V.splice(te,1);break t}}B=M.createElement(S),Ii(B,S,b),M.head.appendChild(B);break;case"meta":if(V=cE("meta","content",M).get(S+(b.content||""))){for(te=0;te<V.length;te++)if(B=V[te],B.getAttribute("content")===(b.content==null?null:""+b.content)&&B.getAttribute("name")===(b.name==null?null:b.name)&&B.getAttribute("property")===(b.property==null?null:b.property)&&B.getAttribute("http-equiv")===(b.httpEquiv==null?null:b.httpEquiv)&&B.getAttribute("charset")===(b.charSet==null?null:b.charSet)){V.splice(te,1);break t}}B=M.createElement(S),Ii(B,S,b),M.head.appendChild(B);break;default:throw Error(n(468,S))}B[xt]=c,Lr(B),S=B}c.stateNode=S}else hE(M,c.type,c.stateNode);else c.stateNode=lE(M,S,c.memoizedProps);else B!==S?(B===null?b.stateNode!==null&&(b=b.stateNode,b.parentNode.removeChild(b)):B.count--,S===null?hE(M,c.type,c.stateNode):lE(M,S,c.memoizedProps)):S===null&&c.stateNode!==null&&Sv(c,c.memoizedProps,b.memoizedProps)}break;case 27:mn(f,c),yn(c),S&512&&(yi||b===null||Fs(b,b.return)),b!==null&&S&4&&Sv(c,c.memoizedProps,b.memoizedProps);break;case 5:if(mn(f,c),yn(c),S&512&&(yi||b===null||Fs(b,b.return)),c.flags&32){M=c.stateNode;try{yt(M,"")}catch(Nt){Pr(c,c.return,Nt)}}S&4&&c.stateNode!=null&&(M=c.memoizedProps,Sv(c,M,b!==null?b.memoizedProps:M)),S&1024&&(Nv=!0);break;case 6:if(mn(f,c),yn(c),S&4){if(c.stateNode===null)throw Error(n(162));S=c.memoizedProps,b=c.stateNode;try{b.nodeValue=S}catch(Nt){Pr(c,c.return,Nt)}}break;case 3:if(Qp=null,M=bs,bs=Xp(f.containerInfo),mn(f,c),bs=M,yn(c),S&4&&b!==null&&b.memoizedState.isDehydrated)try{Zc(f.containerInfo)}catch(Nt){Pr(c,c.return,Nt)}Nv&&(Nv=!1,hT(c));break;case 4:S=bs,bs=Xp(c.stateNode.containerInfo),mn(f,c),yn(c),bs=S;break;case 12:mn(f,c),yn(c);break;case 31:mn(f,c),yn(c),S&4&&(S=c.updateQueue,S!==null&&(c.updateQueue=null,Dp(c,S)));break;case 13:mn(f,c),yn(c),c.child.flags&8192&&c.memoizedState!==null!=(b!==null&&b.memoizedState!==null)&&(Fp=Lt()),S&4&&(S=c.updateQueue,S!==null&&(c.updateQueue=null,Dp(c,S)));break;case 22:M=c.memoizedState!==null;var ge=b!==null&&b.memoizedState!==null,je=ba,We=yi;if(ba=je||M,yi=We||ge,mn(f,c),yi=We,ba=je,yn(c),S&8192)e:for(f=c.stateNode,f._visibility=M?f._visibility&-2:f._visibility|1,M&&(b===null||ge||ba||yi||Cl(c)),b=null,f=c;;){if(f.tag===5||f.tag===26){if(b===null){ge=b=f;try{if(B=ge.stateNode,M)V=B.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none";else{te=ge.stateNode;var Xe=ge.memoizedProps.style,Oe=Xe!=null&&Xe.hasOwnProperty("display")?Xe.display:null;te.style.display=Oe==null||typeof Oe=="boolean"?"":(""+Oe).trim()}}catch(Nt){Pr(ge,ge.return,Nt)}}}else if(f.tag===6){if(b===null){ge=f;try{ge.stateNode.nodeValue=M?"":ge.memoizedProps}catch(Nt){Pr(ge,ge.return,Nt)}}}else if(f.tag===18){if(b===null){ge=f;try{var Fe=ge.stateNode;M?JT(Fe,!0):JT(ge.stateNode,!1)}catch(Nt){Pr(ge,ge.return,Nt)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===c)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break e;for(;f.sibling===null;){if(f.return===null||f.return===c)break e;b===f&&(b=null),f=f.return}b===f&&(b=null),f.sibling.return=f.return,f=f.sibling}S&4&&(S=c.updateQueue,S!==null&&(b=S.retryQueue,b!==null&&(S.retryQueue=null,Dp(c,b))));break;case 19:mn(f,c),yn(c),S&4&&(S=c.updateQueue,S!==null&&(c.updateQueue=null,Dp(c,S)));break;case 30:break;case 21:break;default:mn(f,c),yn(c)}}function yn(c){var f=c.flags;if(f&2){try{for(var b,S=c.return;S!==null;){if(tT(S)){b=S;break}S=S.return}if(b==null)throw Error(n(160));switch(b.tag){case 27:var M=b.stateNode,B=Tv(c);Op(c,B,M);break;case 5:var V=b.stateNode;b.flags&32&&(yt(V,""),b.flags&=-33);var te=Tv(c);Op(c,te,V);break;case 3:case 4:var ge=b.stateNode.containerInfo,je=Tv(c);Ev(c,je,ge);break;default:throw Error(n(161))}}catch(We){Pr(c,c.return,We)}c.flags&=-3}f&4096&&(c.flags&=-4097)}function hT(c){if(c.subtreeFlags&1024)for(c=c.child;c!==null;){var f=c;hT(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),c=c.sibling}}function xa(c,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)nT(c,f.alternate,f),f=f.sibling}function Cl(c){for(c=c.child;c!==null;){var f=c;switch(f.tag){case 0:case 11:case 14:case 15:co(4,f,f.return),Cl(f);break;case 1:Fs(f,f.return);var b=f.stateNode;typeof b.componentWillUnmount=="function"&&J2(f,f.return,b),Cl(f);break;case 27:ed(f.stateNode);case 26:case 5:Fs(f,f.return),Cl(f);break;case 22:f.memoizedState===null&&Cl(f);break;case 30:Cl(f);break;default:Cl(f)}c=c.sibling}}function _a(c,f,b){for(b=b&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var S=f.alternate,M=c,B=f,V=B.flags;switch(B.tag){case 0:case 11:case 15:_a(M,B,b),Uu(4,B);break;case 1:if(_a(M,B,b),S=B,M=S.stateNode,typeof M.componentDidMount=="function")try{M.componentDidMount()}catch(je){Pr(S,S.return,je)}if(S=B,M=S.updateQueue,M!==null){var te=S.stateNode;try{var ge=M.shared.hiddenCallbacks;if(ge!==null)for(M.shared.hiddenCallbacks=null,M=0;M<ge.length;M++)zS(ge[M],te)}catch(je){Pr(S,S.return,je)}}b&&V&64&&Q2(B),Wu(B,B.return);break;case 27:rT(B);case 26:case 5:_a(M,B,b),b&&S===null&&V&4&&eT(B),Wu(B,B.return);break;case 12:_a(M,B,b);break;case 31:_a(M,B,b),b&&V&4&&oT(M,B);break;case 13:_a(M,B,b),b&&V&4&&lT(M,B);break;case 22:B.memoizedState===null&&_a(M,B,b),Wu(B,B.return);break;case 30:break;default:_a(M,B,b)}f=f.sibling}}function Av(c,f){var b=null;c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),c=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(c=f.memoizedState.cachePool.pool),c!==b&&(c!=null&&c.refCount++,b!=null&&Mu(b))}function jv(c,f){c=null,f.alternate!==null&&(c=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==c&&(f.refCount++,c!=null&&Mu(c))}function vs(c,f,b,S){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)uT(c,f,b,S),f=f.sibling}function uT(c,f,b,S){var M=f.flags;switch(f.tag){case 0:case 11:case 15:vs(c,f,b,S),M&2048&&Uu(9,f);break;case 1:vs(c,f,b,S);break;case 3:vs(c,f,b,S),M&2048&&(c=null,f.alternate!==null&&(c=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==c&&(f.refCount++,c!=null&&Mu(c)));break;case 12:if(M&2048){vs(c,f,b,S),c=f.stateNode;try{var B=f.memoizedProps,V=B.id,te=B.onPostCommit;typeof te=="function"&&te(V,f.alternate===null?"mount":"update",c.passiveEffectDuration,-0)}catch(ge){Pr(f,f.return,ge)}}else vs(c,f,b,S);break;case 31:vs(c,f,b,S);break;case 13:vs(c,f,b,S);break;case 23:break;case 22:B=f.stateNode,V=f.alternate,f.memoizedState!==null?B._visibility&2?vs(c,f,b,S):Gu(c,f):B._visibility&2?vs(c,f,b,S):(B._visibility|=2,Pc(c,f,b,S,(f.subtreeFlags&10256)!==0||!1)),M&2048&&Av(V,f);break;case 24:vs(c,f,b,S),M&2048&&jv(f.alternate,f);break;default:vs(c,f,b,S)}}function Pc(c,f,b,S,M){for(M=M&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var B=c,V=f,te=b,ge=S,je=V.flags;switch(V.tag){case 0:case 11:case 15:Pc(B,V,te,ge,M),Uu(8,V);break;case 23:break;case 22:var We=V.stateNode;V.memoizedState!==null?We._visibility&2?Pc(B,V,te,ge,M):Gu(B,V):(We._visibility|=2,Pc(B,V,te,ge,M)),M&&je&2048&&Av(V.alternate,V);break;case 24:Pc(B,V,te,ge,M),M&&je&2048&&jv(V.alternate,V);break;default:Pc(B,V,te,ge,M)}f=f.sibling}}function Gu(c,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var b=c,S=f,M=S.flags;switch(S.tag){case 22:Gu(b,S),M&2048&&Av(S.alternate,S);break;case 24:Gu(b,S),M&2048&&jv(S.alternate,S);break;default:Gu(b,S)}f=f.sibling}}var Ku=8192;function zc(c,f,b){if(c.subtreeFlags&Ku)for(c=c.child;c!==null;)dT(c,f,b),c=c.sibling}function dT(c,f,b){switch(c.tag){case 26:zc(c,f,b),c.flags&Ku&&c.memoizedState!==null&&TP(b,bs,c.memoizedState,c.memoizedProps);break;case 5:zc(c,f,b);break;case 3:case 4:var S=bs;bs=Xp(c.stateNode.containerInfo),zc(c,f,b),bs=S;break;case 22:c.memoizedState===null&&(S=c.alternate,S!==null&&S.memoizedState!==null?(S=Ku,Ku=16777216,zc(c,f,b),Ku=S):zc(c,f,b));break;default:zc(c,f,b)}}function fT(c){var f=c.alternate;if(f!==null&&(c=f.child,c!==null)){f.child=null;do f=c.sibling,c.sibling=null,c=f;while(c!==null)}}function Vu(c){var f=c.deletions;if((c.flags&16)!==0){if(f!==null)for(var b=0;b<f.length;b++){var S=f[b];Ai=S,gT(S,c)}fT(c)}if(c.subtreeFlags&10256)for(c=c.child;c!==null;)pT(c),c=c.sibling}function pT(c){switch(c.tag){case 0:case 11:case 15:Vu(c),c.flags&2048&&co(9,c,c.return);break;case 3:Vu(c);break;case 12:Vu(c);break;case 22:var f=c.stateNode;c.memoizedState!==null&&f._visibility&2&&(c.return===null||c.return.tag!==13)?(f._visibility&=-3,Ip(c)):Vu(c);break;default:Vu(c)}}function Ip(c){var f=c.deletions;if((c.flags&16)!==0){if(f!==null)for(var b=0;b<f.length;b++){var S=f[b];Ai=S,gT(S,c)}fT(c)}for(c=c.child;c!==null;){switch(f=c,f.tag){case 0:case 11:case 15:co(8,f,f.return),Ip(f);break;case 22:b=f.stateNode,b._visibility&2&&(b._visibility&=-3,Ip(f));break;default:Ip(f)}c=c.sibling}}function gT(c,f){for(;Ai!==null;){var b=Ai;switch(b.tag){case 0:case 11:case 15:co(8,b,f);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var S=b.memoizedState.cachePool.pool;S!=null&&S.refCount++}break;case 24:Mu(b.memoizedState.cache)}if(S=b.child,S!==null)S.return=b,Ai=S;else e:for(b=c;Ai!==null;){S=Ai;var M=S.sibling,B=S.return;if(sT(S),S===b){Ai=null;break e}if(M!==null){M.return=B,Ai=M;break e}Ai=B}}}var z8={getCacheForType:function(c){var f=Oi(pi),b=f.data.get(c);return b===void 0&&(b=c(),f.data.set(c,b)),b},cacheSignal:function(){return Oi(pi).controller.signal}},q8=typeof WeakMap=="function"?WeakMap:Map,Mr=0,Wr=null,mr=null,xr=0,$r=0,Bn=null,ho=!1,qc=!1,Mv=!1,Ca=0,oi=0,uo=0,wl=0,Lv=0,Rn=0,Hc=0,Yu=null,bn=null,Bv=!1,Fp=0,mT=0,$p=1/0,Pp=null,fo=null,Ci=0,po=null,Uc=null,wa=0,Rv=0,Ov=null,yT=null,Xu=0,Dv=null;function On(){return(Mr&2)!==0&&xr!==0?xr&-xr:F.T!==null?qv():Re()}function bT(){if(Rn===0)if((xr&536870912)===0||wr){var c=vt;vt<<=1,(vt&3932160)===0&&(vt=262144),Rn=c}else Rn=536870912;return c=Mn.current,c!==null&&(c.flags|=32),Rn}function vn(c,f,b){(c===Wr&&($r===2||$r===9)||c.cancelPendingCommit!==null)&&(Wc(c,0),go(c,xr,Rn,!1)),dt(c,b),((Mr&2)===0||c!==Wr)&&(c===Wr&&((Mr&2)===0&&(wl|=b),oi===4&&go(c,xr,Rn,!1)),$s(c))}function vT(c,f,b){if((Mr&6)!==0)throw Error(n(327));var S=!b&&(f&127)===0&&(f&c.expiredLanes)===0||oe(c,f),M=S?W8(c,f):Fv(c,f,!0),B=S;do{if(M===0){qc&&!S&&go(c,f,0,!1);break}else{if(b=c.current.alternate,B&&!H8(b)){M=Fv(c,f,!1),B=!1;continue}if(M===2){if(B=f,c.errorRecoveryDisabledLanes&B)var V=0;else V=c.pendingLanes&-536870913,V=V!==0?V:V&536870912?536870912:0;if(V!==0){f=V;e:{var te=c;M=Yu;var ge=te.current.memoizedState.isDehydrated;if(ge&&(Wc(te,V).flags|=256),V=Fv(te,V,!1),V!==2){if(Mv&&!ge){te.errorRecoveryDisabledLanes|=B,wl|=B,M=4;break e}B=bn,bn=M,B!==null&&(bn===null?bn=B:bn.push.apply(bn,B))}M=V}if(B=!1,M!==2)continue}}if(M===1){Wc(c,0),go(c,f,0,!0);break}e:{switch(S=c,B=M,B){case 0:case 1:throw Error(n(345));case 4:if((f&4194048)!==f)break;case 6:go(S,f,Rn,!ho);break e;case 2:bn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((f&62914560)===f&&(M=Fp+300-Lt(),10<M)){if(go(S,f,Rn,!ho),se(S,0,!0)!==0)break e;wa=f,S.timeoutHandle=XT(xT.bind(null,S,b,bn,Pp,Bv,f,Rn,wl,Hc,ho,B,"Throttled",-0,0),M);break e}xT(S,b,bn,Pp,Bv,f,Rn,wl,Hc,ho,B,null,-0,0)}}break}while(!0);$s(c)}function xT(c,f,b,S,M,B,V,te,ge,je,We,Xe,Oe,Fe){if(c.timeoutHandle=-1,Xe=f.subtreeFlags,Xe&8192||(Xe&16785408)===16785408){Xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pt},dT(f,B,Xe);var Nt=(B&62914560)===B?Fp-Lt():(B&4194048)===B?mT-Lt():0;if(Nt=EP(Xe,Nt),Nt!==null){wa=B,c.cancelPendingCommit=Nt(NT.bind(null,c,f,B,b,S,M,V,te,ge,We,Xe,null,Oe,Fe)),go(c,B,V,!je);return}}NT(c,f,B,b,S,M,V,te,ge)}function H8(c){for(var f=c;;){var b=f.tag;if((b===0||b===11||b===15)&&f.flags&16384&&(b=f.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var S=0;S<b.length;S++){var M=b[S],B=M.getSnapshot;M=M.value;try{if(!An(B(),M))return!1}catch{return!1}}if(b=f.child,f.subtreeFlags&16384&&b!==null)b.return=f,f=b;else{if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function go(c,f,b,S){f&=~Lv,f&=~wl,c.suspendedLanes|=f,c.pingedLanes&=~f,S&&(c.warmLanes|=f),S=c.expirationTimes;for(var M=f;0<M;){var B=31-lt(M),V=1<<B;S[B]=-1,M&=~V}b!==0&&it(c,b,f)}function zp(){return(Mr&6)===0?(Zu(0),!1):!0}function Iv(){if(mr!==null){if($r===0)var c=mr.return;else c=mr,da=pl=null,Jb(c),Oc=null,Bu=0,c=mr;for(;c!==null;)Z2(c.alternate,c),c=c.return;mr=null}}function Wc(c,f){var b=c.timeoutHandle;b!==-1&&(c.timeoutHandle=-1,cP(b)),b=c.cancelPendingCommit,b!==null&&(c.cancelPendingCommit=null,b()),wa=0,Iv(),Wr=c,mr=b=ha(c.current,null),xr=f,$r=0,Bn=null,ho=!1,qc=oe(c,f),Mv=!1,Hc=Rn=Lv=wl=uo=oi=0,bn=Yu=null,Bv=!1,(f&8)!==0&&(f|=f&32);var S=c.entangledLanes;if(S!==0)for(c=c.entanglements,S&=f;0<S;){var M=31-lt(S),B=1<<M;f|=c[M],S&=~B}return Ca=f,lp(),b}function _T(c,f){cr=null,F.H=zu,f===Rc||f===mp?(f=IS(),$r=3):f===zb?(f=IS(),$r=4):$r=f===gv?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,Bn=f,mr===null&&(oi=1,jp(c,Yn(f,c.current)))}function CT(){var c=Mn.current;return c===null?!0:(xr&4194048)===xr?Jn===null:(xr&62914560)===xr||(xr&536870912)!==0?c===Jn:!1}function wT(){var c=F.H;return F.H=zu,c===null?zu:c}function kT(){var c=F.A;return F.A=z8,c}function qp(){oi=4,ho||(xr&4194048)!==xr&&Mn.current!==null||(qc=!0),(uo&134217727)===0&&(wl&134217727)===0||Wr===null||go(Wr,xr,Rn,!1)}function Fv(c,f,b){var S=Mr;Mr|=2;var M=wT(),B=kT();(Wr!==c||xr!==f)&&(Pp=null,Wc(c,f)),f=!1;var V=oi;e:do try{if($r!==0&&mr!==null){var te=mr,ge=Bn;switch($r){case 8:Iv(),V=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(f=!0);var je=$r;if($r=0,Bn=null,Gc(c,te,ge,je),b&&qc){V=0;break e}break;default:je=$r,$r=0,Bn=null,Gc(c,te,ge,je)}}U8(),V=oi;break}catch(We){_T(c,We)}while(!0);return f&&c.shellSuspendCounter++,da=pl=null,Mr=S,F.H=M,F.A=B,mr===null&&(Wr=null,xr=0,lp()),V}function U8(){for(;mr!==null;)ST(mr)}function W8(c,f){var b=Mr;Mr|=2;var S=wT(),M=kT();Wr!==c||xr!==f?(Pp=null,$p=Lt()+500,Wc(c,f)):qc=oe(c,f);e:do try{if($r!==0&&mr!==null){f=mr;var B=Bn;t:switch($r){case 1:$r=0,Bn=null,Gc(c,f,B,1);break;case 2:case 9:if(OS(B)){$r=0,Bn=null,TT(f);break}f=function(){$r!==2&&$r!==9||Wr!==c||($r=7),$s(c)},B.then(f,f);break e;case 3:$r=7;break e;case 4:$r=5;break e;case 7:OS(B)?($r=0,Bn=null,TT(f)):($r=0,Bn=null,Gc(c,f,B,7));break;case 5:var V=null;switch(mr.tag){case 26:V=mr.memoizedState;case 5:case 27:var te=mr;if(V?uE(V):te.stateNode.complete){$r=0,Bn=null;var ge=te.sibling;if(ge!==null)mr=ge;else{var je=te.return;je!==null?(mr=je,Hp(je)):mr=null}break t}}$r=0,Bn=null,Gc(c,f,B,5);break;case 6:$r=0,Bn=null,Gc(c,f,B,6);break;case 8:Iv(),oi=6;break e;default:throw Error(n(462))}}G8();break}catch(We){_T(c,We)}while(!0);return da=pl=null,F.H=S,F.A=M,Mr=b,mr!==null?0:(Wr=null,xr=0,lp(),oi)}function G8(){for(;mr!==null&&!Pt();)ST(mr)}function ST(c){var f=Y2(c.alternate,c,Ca);c.memoizedProps=c.pendingProps,f===null?Hp(c):mr=f}function TT(c){var f=c,b=f.alternate;switch(f.tag){case 15:case 0:f=H2(b,f,f.pendingProps,f.type,void 0,xr);break;case 11:f=H2(b,f,f.pendingProps,f.type.render,f.ref,xr);break;case 5:Jb(f);default:Z2(b,f),f=mr=kS(f,Ca),f=Y2(b,f,Ca)}c.memoizedProps=c.pendingProps,f===null?Hp(c):mr=f}function Gc(c,f,b,S){da=pl=null,Jb(f),Oc=null,Bu=0;var M=f.return;try{if(R8(c,M,f,b,xr)){oi=1,jp(c,Yn(b,c.current)),mr=null;return}}catch(B){if(M!==null)throw mr=M,B;oi=1,jp(c,Yn(b,c.current)),mr=null;return}f.flags&32768?(wr||S===1?c=!0:qc||(xr&536870912)!==0?c=!1:(ho=c=!0,(S===2||S===9||S===3||S===6)&&(S=Mn.current,S!==null&&S.tag===13&&(S.flags|=16384))),ET(f,c)):Hp(f)}function Hp(c){var f=c;do{if((f.flags&32768)!==0){ET(f,ho);return}c=f.return;var b=I8(f.alternate,f,Ca);if(b!==null){mr=b;return}if(f=f.sibling,f!==null){mr=f;return}mr=f=c}while(f!==null);oi===0&&(oi=5)}function ET(c,f){do{var b=F8(c.alternate,c);if(b!==null){b.flags&=32767,mr=b;return}if(b=c.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!f&&(c=c.sibling,c!==null)){mr=c;return}mr=c=b}while(c!==null);oi=6,mr=null}function NT(c,f,b,S,M,B,V,te,ge){c.cancelPendingCommit=null;do Up();while(Ci!==0);if((Mr&6)!==0)throw Error(n(327));if(f!==null){if(f===c.current)throw Error(n(177));if(B=f.lanes|f.childLanes,B|=Tb,nt(c,b,B,V,te,ge),c===Wr&&(mr=Wr=null,xr=0),Uc=f,po=c,wa=b,Rv=B,Ov=M,yT=S,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(c.callbackNode=null,c.callbackPriority=0,X8(De,function(){return BT(),null})):(c.callbackNode=null,c.callbackPriority=0),S=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||S){S=F.T,F.T=null,M=W.p,W.p=2,V=Mr,Mr|=4;try{$8(c,f,b)}finally{Mr=V,W.p=M,F.T=S}}Ci=1,AT(),jT(),MT()}}function AT(){if(Ci===1){Ci=0;var c=po,f=Uc,b=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||b){b=F.T,F.T=null;var S=W.p;W.p=2;var M=Mr;Mr|=4;try{cT(f,c);var B=Xv,V=gS(c.containerInfo),te=B.focusedElem,ge=B.selectionRange;if(V!==te&&te&&te.ownerDocument&&pS(te.ownerDocument.documentElement,te)){if(ge!==null&&_b(te)){var je=ge.start,We=ge.end;if(We===void 0&&(We=je),"selectionStart"in te)te.selectionStart=je,te.selectionEnd=Math.min(We,te.value.length);else{var Xe=te.ownerDocument||document,Oe=Xe&&Xe.defaultView||window;if(Oe.getSelection){var Fe=Oe.getSelection(),Nt=te.textContent.length,Yt=Math.min(ge.start,Nt),Ur=ge.end===void 0?Yt:Math.min(ge.end,Nt);!Fe.extend&&Yt>Ur&&(V=Ur,Ur=Yt,Yt=V);var ke=fS(te,Yt),xe=fS(te,Ur);if(ke&&xe&&(Fe.rangeCount!==1||Fe.anchorNode!==ke.node||Fe.anchorOffset!==ke.offset||Fe.focusNode!==xe.node||Fe.focusOffset!==xe.offset)){var Ae=Xe.createRange();Ae.setStart(ke.node,ke.offset),Fe.removeAllRanges(),Yt>Ur?(Fe.addRange(Ae),Fe.extend(xe.node,xe.offset)):(Ae.setEnd(xe.node,xe.offset),Fe.addRange(Ae))}}}}for(Xe=[],Fe=te;Fe=Fe.parentNode;)Fe.nodeType===1&&Xe.push({element:Fe,left:Fe.scrollLeft,top:Fe.scrollTop});for(typeof te.focus=="function"&&te.focus(),te=0;te<Xe.length;te++){var Ve=Xe[te];Ve.element.scrollLeft=Ve.left,Ve.element.scrollTop=Ve.top}}rg=!!Yv,Xv=Yv=null}finally{Mr=M,W.p=S,F.T=b}}c.current=f,Ci=2}}function jT(){if(Ci===2){Ci=0;var c=po,f=Uc,b=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||b){b=F.T,F.T=null;var S=W.p;W.p=2;var M=Mr;Mr|=4;try{nT(c,f.alternate,f)}finally{Mr=M,W.p=S,F.T=b}}Ci=3}}function MT(){if(Ci===4||Ci===3){Ci=0,Mt();var c=po,f=Uc,b=wa,S=yT;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Ci=5:(Ci=0,Uc=po=null,LT(c,c.pendingLanes));var M=c.pendingLanes;if(M===0&&(fo=null),ve(b),f=f.stateNode,Te&&typeof Te.onCommitFiberRoot=="function")try{Te.onCommitFiberRoot(At,f,void 0,(f.current.flags&128)===128)}catch{}if(S!==null){f=F.T,M=W.p,W.p=2,F.T=null;try{for(var B=c.onRecoverableError,V=0;V<S.length;V++){var te=S[V];B(te.value,{componentStack:te.stack})}}finally{F.T=f,W.p=M}}(wa&3)!==0&&Up(),$s(c),M=c.pendingLanes,(b&261930)!==0&&(M&42)!==0?c===Dv?Xu++:(Xu=0,Dv=c):Xu=0,Zu(0)}}function LT(c,f){(c.pooledCacheLanes&=f)===0&&(f=c.pooledCache,f!=null&&(c.pooledCache=null,Mu(f)))}function Up(){return AT(),jT(),MT(),BT()}function BT(){if(Ci!==5)return!1;var c=po,f=Rv;Rv=0;var b=ve(wa),S=F.T,M=W.p;try{W.p=32>b?32:b,F.T=null,b=Ov,Ov=null;var B=po,V=wa;if(Ci=0,Uc=po=null,wa=0,(Mr&6)!==0)throw Error(n(331));var te=Mr;if(Mr|=4,pT(B.current),uT(B,B.current,V,b),Mr=te,Zu(0,!1),Te&&typeof Te.onPostCommitFiberRoot=="function")try{Te.onPostCommitFiberRoot(At,B)}catch{}return!0}finally{W.p=M,F.T=S,LT(c,f)}}function RT(c,f,b){f=Yn(b,f),f=pv(c.stateNode,f,2),c=ao(c,f,2),c!==null&&(dt(c,2),$s(c))}function Pr(c,f,b){if(c.tag===3)RT(c,c,b);else for(;f!==null;){if(f.tag===3){RT(f,c,b);break}else if(f.tag===1){var S=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(fo===null||!fo.has(S))){c=Yn(b,c),b=O2(2),S=ao(f,b,2),S!==null&&(D2(b,S,f,c),dt(S,2),$s(S));break}}f=f.return}}function $v(c,f,b){var S=c.pingCache;if(S===null){S=c.pingCache=new q8;var M=new Set;S.set(f,M)}else M=S.get(f),M===void 0&&(M=new Set,S.set(f,M));M.has(b)||(Mv=!0,M.add(b),c=K8.bind(null,c,f,b),f.then(c,c))}function K8(c,f,b){var S=c.pingCache;S!==null&&S.delete(f),c.pingedLanes|=c.suspendedLanes&b,c.warmLanes&=~b,Wr===c&&(xr&b)===b&&(oi===4||oi===3&&(xr&62914560)===xr&&300>Lt()-Fp?(Mr&2)===0&&Wc(c,0):Lv|=b,Hc===xr&&(Hc=0)),$s(c)}function OT(c,f){f===0&&(f=tt()),c=ul(c,f),c!==null&&(dt(c,f),$s(c))}function V8(c){var f=c.memoizedState,b=0;f!==null&&(b=f.retryLane),OT(c,b)}function Y8(c,f){var b=0;switch(c.tag){case 31:case 13:var S=c.stateNode,M=c.memoizedState;M!==null&&(b=M.retryLane);break;case 19:S=c.stateNode;break;case 22:S=c.stateNode._retryCache;break;default:throw Error(n(314))}S!==null&&S.delete(f),OT(c,b)}function X8(c,f){return Ue(c,f)}var Wp=null,Kc=null,Pv=!1,Gp=!1,zv=!1,mo=0;function $s(c){c!==Kc&&c.next===null&&(Kc===null?Wp=Kc=c:Kc=Kc.next=c),Gp=!0,Pv||(Pv=!0,Q8())}function Zu(c,f){if(!zv&&Gp){zv=!0;do for(var b=!1,S=Wp;S!==null;){if(c!==0){var M=S.pendingLanes;if(M===0)var B=0;else{var V=S.suspendedLanes,te=S.pingedLanes;B=(1<<31-lt(42|c)+1)-1,B&=M&~(V&~te),B=B&201326741?B&201326741|1:B?B|2:0}B!==0&&(b=!0,$T(S,B))}else B=xr,B=se(S,S===Wr?B:0,S.cancelPendingCommit!==null||S.timeoutHandle!==-1),(B&3)===0||oe(S,B)||(b=!0,$T(S,B));S=S.next}while(b);zv=!1}}function Z8(){DT()}function DT(){Gp=Pv=!1;var c=0;mo!==0&&lP()&&(c=mo);for(var f=Lt(),b=null,S=Wp;S!==null;){var M=S.next,B=IT(S,f);B===0?(S.next=null,b===null?Wp=M:b.next=M,M===null&&(Kc=b)):(b=S,(c!==0||(B&3)!==0)&&(Gp=!0)),S=M}Ci!==0&&Ci!==5||Zu(c),mo!==0&&(mo=0)}function IT(c,f){for(var b=c.suspendedLanes,S=c.pingedLanes,M=c.expirationTimes,B=c.pendingLanes&-62914561;0<B;){var V=31-lt(B),te=1<<V,ge=M[V];ge===-1?((te&b)===0||(te&S)!==0)&&(M[V]=we(te,f)):ge<=f&&(c.expiredLanes|=te),B&=~te}if(f=Wr,b=xr,b=se(c,c===f?b:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),S=c.callbackNode,b===0||c===f&&($r===2||$r===9)||c.cancelPendingCommit!==null)return S!==null&&S!==null&&at(S),c.callbackNode=null,c.callbackPriority=0;if((b&3)===0||oe(c,b)){if(f=b&-b,f===c.callbackPriority)return f;switch(S!==null&&at(S),ve(b)){case 2:case 8:b=Se;break;case 32:b=De;break;case 268435456:b=Je;break;default:b=De}return S=FT.bind(null,c),b=Ue(b,S),c.callbackPriority=f,c.callbackNode=b,f}return S!==null&&S!==null&&at(S),c.callbackPriority=2,c.callbackNode=null,2}function FT(c,f){if(Ci!==0&&Ci!==5)return c.callbackNode=null,c.callbackPriority=0,null;var b=c.callbackNode;if(Up()&&c.callbackNode!==b)return null;var S=xr;return S=se(c,c===Wr?S:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),S===0?null:(vT(c,S,f),IT(c,Lt()),c.callbackNode!=null&&c.callbackNode===b?FT.bind(null,c):null)}function $T(c,f){if(Up())return null;vT(c,f,!0)}function Q8(){hP(function(){(Mr&6)!==0?Ue(bt,Z8):DT()})}function qv(){if(mo===0){var c=Lc;c===0&&(c=Ge,Ge<<=1,(Ge&261888)===0&&(Ge=256)),mo=c}return mo}function PT(c){return c==null||typeof c=="symbol"||typeof c=="boolean"?null:typeof c=="function"?c:Qa(""+c)}function zT(c,f){var b=f.ownerDocument.createElement("input");return b.name=f.name,b.value=f.value,c.id&&b.setAttribute("form",c.id),f.parentNode.insertBefore(b,f),c=new FormData(c),b.parentNode.removeChild(b),c}function J8(c,f,b,S,M){if(f==="submit"&&b&&b.stateNode===M){var B=PT((M[$t]||null).action),V=S.submitter;V&&(f=(f=V[$t]||null)?PT(f.formAction):V.getAttribute("formAction"),f!==null&&(B=f,V=null));var te=new np("action","action",null,S,M);c.push({event:te,listeners:[{instance:null,listener:function(){if(S.defaultPrevented){if(mo!==0){var ge=V?zT(M,V):new FormData(M);lv(b,{pending:!0,data:ge,method:M.method,action:B},null,ge)}}else typeof B=="function"&&(te.preventDefault(),ge=V?zT(M,V):new FormData(M),lv(b,{pending:!0,data:ge,method:M.method,action:B},B,ge))},currentTarget:M}]})}}for(var Hv=0;Hv<Sb.length;Hv++){var Uv=Sb[Hv],eP=Uv.toLowerCase(),tP=Uv[0].toUpperCase()+Uv.slice(1);ys(eP,"on"+tP)}ys(bS,"onAnimationEnd"),ys(vS,"onAnimationIteration"),ys(xS,"onAnimationStart"),ys("dblclick","onDoubleClick"),ys("focusin","onFocus"),ys("focusout","onBlur"),ys(y8,"onTransitionRun"),ys(b8,"onTransitionStart"),ys(v8,"onTransitionCancel"),ys(_S,"onTransitionEnd"),Ee("onMouseEnter",["mouseout","mouseover"]),Ee("onMouseLeave",["mouseout","mouseover"]),Ee("onPointerEnter",["pointerout","pointerover"]),Ee("onPointerLeave",["pointerout","pointerover"]),He("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),He("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),He("onBeforeInput",["compositionend","keypress","textInput","paste"]),He("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),He("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),He("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),rP=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qu));function qT(c,f){f=(f&4)!==0;for(var b=0;b<c.length;b++){var S=c[b],M=S.event;S=S.listeners;e:{var B=void 0;if(f)for(var V=S.length-1;0<=V;V--){var te=S[V],ge=te.instance,je=te.currentTarget;if(te=te.listener,ge!==B&&M.isPropagationStopped())break e;B=te,M.currentTarget=je;try{B(M)}catch(We){op(We)}M.currentTarget=null,B=ge}else for(V=0;V<S.length;V++){if(te=S[V],ge=te.instance,je=te.currentTarget,te=te.listener,ge!==B&&M.isPropagationStopped())break e;B=te,M.currentTarget=je;try{B(M)}catch(We){op(We)}M.currentTarget=null,B=ge}}}}function yr(c,f){var b=f[zr];b===void 0&&(b=f[zr]=new Set);var S=c+"__bubble";b.has(S)||(HT(f,c,2,!1),b.add(S))}function Wv(c,f,b){var S=0;f&&(S|=4),HT(b,c,S,f)}var Kp="_reactListening"+Math.random().toString(36).slice(2);function Gv(c){if(!c[Kp]){c[Kp]=!0,Tt.forEach(function(b){b!=="selectionchange"&&(rP.has(b)||Wv(b,!1,c),Wv(b,!0,c))});var f=c.nodeType===9?c:c.ownerDocument;f===null||f[Kp]||(f[Kp]=!0,Wv("selectionchange",!1,f))}}function HT(c,f,b,S){switch(bE(f)){case 2:var M=jP;break;case 8:M=MP;break;default:M=o0}b=M.bind(null,f,b,c),M=void 0,!db||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(M=!0),S?M!==void 0?c.addEventListener(f,b,{capture:!0,passive:M}):c.addEventListener(f,b,!0):M!==void 0?c.addEventListener(f,b,{passive:M}):c.addEventListener(f,b,!1)}function Kv(c,f,b,S,M){var B=S;if((f&1)===0&&(f&2)===0&&S!==null)e:for(;;){if(S===null)return;var V=S.tag;if(V===3||V===4){var te=S.stateNode.containerInfo;if(te===M)break;if(V===4)for(V=S.return;V!==null;){var ge=V.tag;if((ge===3||ge===4)&&V.stateNode.containerInfo===M)return;V=V.return}for(;te!==null;){if(V=xi(te),V===null)return;if(ge=V.tag,ge===5||ge===6||ge===26||ge===27){S=B=V;continue e}te=te.parentNode}}S=S.return}ep(function(){var je=B,We=lr(b),Xe=[];e:{var Oe=CS.get(c);if(Oe!==void 0){var Fe=np,Nt=c;switch(c){case"keypress":if(rp(b)===0)break e;case"keydown":case"keyup":Fe=Y$;break;case"focusin":Nt="focus",Fe=mb;break;case"focusout":Nt="blur",Fe=mb;break;case"beforeblur":case"afterblur":Fe=mb;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Fe=Zk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Fe=I$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Fe=Q$;break;case bS:case vS:case xS:Fe=P$;break;case _S:Fe=e8;break;case"scroll":case"scrollend":Fe=O$;break;case"wheel":Fe=r8;break;case"copy":case"cut":case"paste":Fe=q$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Fe=Jk;break;case"toggle":case"beforetoggle":Fe=n8}var Yt=(f&4)!==0,Ur=!Yt&&(c==="scroll"||c==="scrollend"),ke=Yt?Oe!==null?Oe+"Capture":null:Oe;Yt=[];for(var xe=je,Ae;xe!==null;){var Ve=xe;if(Ae=Ve.stateNode,Ve=Ve.tag,Ve!==5&&Ve!==26&&Ve!==27||Ae===null||ke===null||(Ve=xu(xe,ke),Ve!=null&&Yt.push(Ju(xe,Ve,Ae))),Ur)break;xe=xe.return}0<Yt.length&&(Oe=new Fe(Oe,Nt,null,b,We),Xe.push({event:Oe,listeners:Yt}))}}if((f&7)===0){e:{if(Oe=c==="mouseover"||c==="pointerover",Fe=c==="mouseout"||c==="pointerout",Oe&&b!==Dt&&(Nt=b.relatedTarget||b.fromElement)&&(xi(Nt)||Nt[Kr]))break e;if((Fe||Oe)&&(Oe=We.window===We?We:(Oe=We.ownerDocument)?Oe.defaultView||Oe.parentWindow:window,Fe?(Nt=b.relatedTarget||b.toElement,Fe=je,Nt=Nt?xi(Nt):null,Nt!==null&&(Ur=o(Nt),Yt=Nt.tag,Nt!==Ur||Yt!==5&&Yt!==27&&Yt!==6)&&(Nt=null)):(Fe=null,Nt=je),Fe!==Nt)){if(Yt=Zk,Ve="onMouseLeave",ke="onMouseEnter",xe="mouse",(c==="pointerout"||c==="pointerover")&&(Yt=Jk,Ve="onPointerLeave",ke="onPointerEnter",xe="pointer"),Ur=Fe==null?Oe:fn(Fe),Ae=Nt==null?Oe:fn(Nt),Oe=new Yt(Ve,xe+"leave",Fe,b,We),Oe.target=Ur,Oe.relatedTarget=Ae,Ve=null,xi(We)===je&&(Yt=new Yt(ke,xe+"enter",Nt,b,We),Yt.target=Ae,Yt.relatedTarget=Ur,Ve=Yt),Ur=Ve,Fe&&Nt)t:{for(Yt=iP,ke=Fe,xe=Nt,Ae=0,Ve=ke;Ve;Ve=Yt(Ve))Ae++;Ve=0;for(var Gt=xe;Gt;Gt=Yt(Gt))Ve++;for(;0<Ae-Ve;)ke=Yt(ke),Ae--;for(;0<Ve-Ae;)xe=Yt(xe),Ve--;for(;Ae--;){if(ke===xe||xe!==null&&ke===xe.alternate){Yt=ke;break t}ke=Yt(ke),xe=Yt(xe)}Yt=null}else Yt=null;Fe!==null&&UT(Xe,Oe,Fe,Yt,!1),Nt!==null&&Ur!==null&&UT(Xe,Ur,Nt,Yt,!0)}}e:{if(Oe=je?fn(je):window,Fe=Oe.nodeName&&Oe.nodeName.toLowerCase(),Fe==="select"||Fe==="input"&&Oe.type==="file")var Er=oS;else if(sS(Oe))if(lS)Er=p8;else{Er=d8;var It=u8}else Fe=Oe.nodeName,!Fe||Fe.toLowerCase()!=="input"||Oe.type!=="checkbox"&&Oe.type!=="radio"?je&&qi(je.elementType)&&(Er=oS):Er=f8;if(Er&&(Er=Er(c,je))){aS(Xe,Er,b,We);break e}It&&It(c,Oe,je),c==="focusout"&&je&&Oe.type==="number"&&je.memoizedProps.value!=null&&st(Oe,"number",Oe.value)}switch(It=je?fn(je):window,c){case"focusin":(sS(It)||It.contentEditable==="true")&&(kc=It,Cb=je,Nu=null);break;case"focusout":Nu=Cb=kc=null;break;case"mousedown":wb=!0;break;case"contextmenu":case"mouseup":case"dragend":wb=!1,mS(Xe,b,We);break;case"selectionchange":if(m8)break;case"keydown":case"keyup":mS(Xe,b,We)}var ur;if(bb)e:{switch(c){case"compositionstart":var _r="onCompositionStart";break e;case"compositionend":_r="onCompositionEnd";break e;case"compositionupdate":_r="onCompositionUpdate";break e}_r=void 0}else wc?iS(c,b)&&(_r="onCompositionEnd"):c==="keydown"&&b.keyCode===229&&(_r="onCompositionStart");_r&&(eS&&b.locale!=="ko"&&(wc||_r!=="onCompositionStart"?_r==="onCompositionEnd"&&wc&&(ur=Yk()):(Ja=We,fb="value"in Ja?Ja.value:Ja.textContent,wc=!0)),It=Vp(je,_r),0<It.length&&(_r=new Qk(_r,c,null,b,We),Xe.push({event:_r,listeners:It}),ur?_r.data=ur:(ur=nS(b),ur!==null&&(_r.data=ur)))),(ur=a8?o8(c,b):l8(c,b))&&(_r=Vp(je,"onBeforeInput"),0<_r.length&&(It=new Qk("onBeforeInput","beforeinput",null,b,We),Xe.push({event:It,listeners:_r}),It.data=ur)),J8(Xe,c,je,b,We)}qT(Xe,f)})}function Ju(c,f,b){return{instance:c,listener:f,currentTarget:b}}function Vp(c,f){for(var b=f+"Capture",S=[];c!==null;){var M=c,B=M.stateNode;if(M=M.tag,M!==5&&M!==26&&M!==27||B===null||(M=xu(c,b),M!=null&&S.unshift(Ju(c,M,B)),M=xu(c,f),M!=null&&S.push(Ju(c,M,B))),c.tag===3)return S;c=c.return}return[]}function iP(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5&&c.tag!==27);return c||null}function UT(c,f,b,S,M){for(var B=f._reactName,V=[];b!==null&&b!==S;){var te=b,ge=te.alternate,je=te.stateNode;if(te=te.tag,ge!==null&&ge===S)break;te!==5&&te!==26&&te!==27||je===null||(ge=je,M?(je=xu(b,B),je!=null&&V.unshift(Ju(b,je,ge))):M||(je=xu(b,B),je!=null&&V.push(Ju(b,je,ge)))),b=b.return}V.length!==0&&c.push({event:f,listeners:V})}var nP=/\r\n?/g,sP=/\u0000|\uFFFD/g;function WT(c){return(typeof c=="string"?c:""+c).replace(nP,`
50
- `).replace(sP,"")}function GT(c,f){return f=WT(f),WT(c)===f}function Hr(c,f,b,S,M,B){switch(b){case"children":typeof S=="string"?f==="body"||f==="textarea"&&S===""||yt(c,S):(typeof S=="number"||typeof S=="bigint")&&f!=="body"&&yt(c,""+S);break;case"className":Cr(c,"class",S);break;case"tabIndex":Cr(c,"tabindex",S);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(c,b,S);break;case"style":br(c,S,B);break;case"data":if(f!=="object"){Cr(c,"data",S);break}case"src":case"href":if(S===""&&(f!=="a"||b!=="href")){c.removeAttribute(b);break}if(S==null||typeof S=="function"||typeof S=="symbol"||typeof S=="boolean"){c.removeAttribute(b);break}S=Qa(""+S),c.setAttribute(b,S);break;case"action":case"formAction":if(typeof S=="function"){c.setAttribute(b,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof B=="function"&&(b==="formAction"?(f!=="input"&&Hr(c,f,"name",M.name,M,null),Hr(c,f,"formEncType",M.formEncType,M,null),Hr(c,f,"formMethod",M.formMethod,M,null),Hr(c,f,"formTarget",M.formTarget,M,null)):(Hr(c,f,"encType",M.encType,M,null),Hr(c,f,"method",M.method,M,null),Hr(c,f,"target",M.target,M,null)));if(S==null||typeof S=="symbol"||typeof S=="boolean"){c.removeAttribute(b);break}S=Qa(""+S),c.setAttribute(b,S);break;case"onClick":S!=null&&(c.onclick=pt);break;case"onScroll":S!=null&&yr("scroll",c);break;case"onScrollEnd":S!=null&&yr("scrollend",c);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(n(61));if(b=S.__html,b!=null){if(M.children!=null)throw Error(n(60));c.innerHTML=b}}break;case"multiple":c.multiple=S&&typeof S!="function"&&typeof S!="symbol";break;case"muted":c.muted=S&&typeof S!="function"&&typeof S!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(S==null||typeof S=="function"||typeof S=="boolean"||typeof S=="symbol"){c.removeAttribute("xlink:href");break}b=Qa(""+S),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":S!=null&&typeof S!="function"&&typeof S!="symbol"?c.setAttribute(b,""+S):c.removeAttribute(b);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":S&&typeof S!="function"&&typeof S!="symbol"?c.setAttribute(b,""):c.removeAttribute(b);break;case"capture":case"download":S===!0?c.setAttribute(b,""):S!==!1&&S!=null&&typeof S!="function"&&typeof S!="symbol"?c.setAttribute(b,S):c.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":S!=null&&typeof S!="function"&&typeof S!="symbol"&&!isNaN(S)&&1<=S?c.setAttribute(b,S):c.removeAttribute(b);break;case"rowSpan":case"start":S==null||typeof S=="function"||typeof S=="symbol"||isNaN(S)?c.removeAttribute(b):c.setAttribute(b,S);break;case"popover":yr("beforetoggle",c),yr("toggle",c),Br(c,"popover",S);break;case"xlinkActuate":ri(c,"http://www.w3.org/1999/xlink","xlink:actuate",S);break;case"xlinkArcrole":ri(c,"http://www.w3.org/1999/xlink","xlink:arcrole",S);break;case"xlinkRole":ri(c,"http://www.w3.org/1999/xlink","xlink:role",S);break;case"xlinkShow":ri(c,"http://www.w3.org/1999/xlink","xlink:show",S);break;case"xlinkTitle":ri(c,"http://www.w3.org/1999/xlink","xlink:title",S);break;case"xlinkType":ri(c,"http://www.w3.org/1999/xlink","xlink:type",S);break;case"xmlBase":ri(c,"http://www.w3.org/XML/1998/namespace","xml:base",S);break;case"xmlLang":ri(c,"http://www.w3.org/XML/1998/namespace","xml:lang",S);break;case"xmlSpace":ri(c,"http://www.w3.org/XML/1998/namespace","xml:space",S);break;case"is":Br(c,"is",S);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=Gn.get(b)||b,Br(c,b,S))}}function Vv(c,f,b,S,M,B){switch(b){case"style":br(c,S,B);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(n(61));if(b=S.__html,b!=null){if(M.children!=null)throw Error(n(60));c.innerHTML=b}}break;case"children":typeof S=="string"?yt(c,S):(typeof S=="number"||typeof S=="bigint")&&yt(c,""+S);break;case"onScroll":S!=null&&yr("scroll",c);break;case"onScrollEnd":S!=null&&yr("scrollend",c);break;case"onClick":S!=null&&(c.onclick=pt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ce.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(M=b.endsWith("Capture"),f=b.slice(2,M?b.length-7:void 0),B=c[$t]||null,B=B!=null?B[b]:null,typeof B=="function"&&c.removeEventListener(f,B,M),typeof S=="function")){typeof B!="function"&&B!==null&&(b in c?c[b]=null:c.hasAttribute(b)&&c.removeAttribute(b)),c.addEventListener(f,S,M);break e}b in c?c[b]=S:S===!0?c.setAttribute(b,""):Br(c,b,S)}}}function Ii(c,f,b){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yr("error",c),yr("load",c);var S=!1,M=!1,B;for(B in b)if(b.hasOwnProperty(B)){var V=b[B];if(V!=null)switch(B){case"src":S=!0;break;case"srcSet":M=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,f));default:Hr(c,f,B,V,b,null)}}M&&Hr(c,f,"srcSet",b.srcSet,b,null),S&&Hr(c,f,"src",b.src,b,null);return;case"input":yr("invalid",c);var te=B=V=M=null,ge=null,je=null;for(S in b)if(b.hasOwnProperty(S)){var We=b[S];if(We!=null)switch(S){case"name":M=We;break;case"type":V=We;break;case"checked":ge=We;break;case"defaultChecked":je=We;break;case"value":B=We;break;case"defaultValue":te=We;break;case"children":case"dangerouslySetInnerHTML":if(We!=null)throw Error(n(137,f));break;default:Hr(c,f,S,We,b,null)}}Be(c,B,te,ge,je,V,M,!1);return;case"select":yr("invalid",c),S=V=B=null;for(M in b)if(b.hasOwnProperty(M)&&(te=b[M],te!=null))switch(M){case"value":B=te;break;case"defaultValue":V=te;break;case"multiple":S=te;default:Hr(c,f,M,te,b,null)}f=B,b=V,c.multiple=!!S,f!=null?rt(c,!!S,f,!1):b!=null&&rt(c,!!S,b,!0);return;case"textarea":yr("invalid",c),B=M=S=null;for(V in b)if(b.hasOwnProperty(V)&&(te=b[V],te!=null))switch(V){case"value":S=te;break;case"defaultValue":M=te;break;case"children":B=te;break;case"dangerouslySetInnerHTML":if(te!=null)throw Error(n(91));break;default:Hr(c,f,V,te,b,null)}hr(c,S,M,B);return;case"option":for(ge in b)if(b.hasOwnProperty(ge)&&(S=b[ge],S!=null))switch(ge){case"selected":c.selected=S&&typeof S!="function"&&typeof S!="symbol";break;default:Hr(c,f,ge,S,b,null)}return;case"dialog":yr("beforetoggle",c),yr("toggle",c),yr("cancel",c),yr("close",c);break;case"iframe":case"object":yr("load",c);break;case"video":case"audio":for(S=0;S<Qu.length;S++)yr(Qu[S],c);break;case"image":yr("error",c),yr("load",c);break;case"details":yr("toggle",c);break;case"embed":case"source":case"link":yr("error",c),yr("load",c);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(je in b)if(b.hasOwnProperty(je)&&(S=b[je],S!=null))switch(je){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,f));default:Hr(c,f,je,S,b,null)}return;default:if(qi(f)){for(We in b)b.hasOwnProperty(We)&&(S=b[We],S!==void 0&&Vv(c,f,We,S,b,void 0));return}}for(te in b)b.hasOwnProperty(te)&&(S=b[te],S!=null&&Hr(c,f,te,S,b,null))}function aP(c,f,b,S){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var M=null,B=null,V=null,te=null,ge=null,je=null,We=null;for(Fe in b){var Xe=b[Fe];if(b.hasOwnProperty(Fe)&&Xe!=null)switch(Fe){case"checked":break;case"value":break;case"defaultValue":ge=Xe;default:S.hasOwnProperty(Fe)||Hr(c,f,Fe,null,S,Xe)}}for(var Oe in S){var Fe=S[Oe];if(Xe=b[Oe],S.hasOwnProperty(Oe)&&(Fe!=null||Xe!=null))switch(Oe){case"type":B=Fe;break;case"name":M=Fe;break;case"checked":je=Fe;break;case"defaultChecked":We=Fe;break;case"value":V=Fe;break;case"defaultValue":te=Fe;break;case"children":case"dangerouslySetInnerHTML":if(Fe!=null)throw Error(n(137,f));break;default:Fe!==Xe&&Hr(c,f,Oe,Fe,S,Xe)}}Wn(c,V,te,ge,je,We,B,M);return;case"select":Fe=V=te=Oe=null;for(B in b)if(ge=b[B],b.hasOwnProperty(B)&&ge!=null)switch(B){case"value":break;case"multiple":Fe=ge;default:S.hasOwnProperty(B)||Hr(c,f,B,null,S,ge)}for(M in S)if(B=S[M],ge=b[M],S.hasOwnProperty(M)&&(B!=null||ge!=null))switch(M){case"value":Oe=B;break;case"defaultValue":te=B;break;case"multiple":V=B;default:B!==ge&&Hr(c,f,M,B,S,ge)}f=te,b=V,S=Fe,Oe!=null?rt(c,!!b,Oe,!1):!!S!=!!b&&(f!=null?rt(c,!!b,f,!0):rt(c,!!b,b?[]:"",!1));return;case"textarea":Fe=Oe=null;for(te in b)if(M=b[te],b.hasOwnProperty(te)&&M!=null&&!S.hasOwnProperty(te))switch(te){case"value":break;case"children":break;default:Hr(c,f,te,null,S,M)}for(V in S)if(M=S[V],B=b[V],S.hasOwnProperty(V)&&(M!=null||B!=null))switch(V){case"value":Oe=M;break;case"defaultValue":Fe=M;break;case"children":break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(n(91));break;default:M!==B&&Hr(c,f,V,M,S,B)}_t(c,Oe,Fe);return;case"option":for(var Nt in b)if(Oe=b[Nt],b.hasOwnProperty(Nt)&&Oe!=null&&!S.hasOwnProperty(Nt))switch(Nt){case"selected":c.selected=!1;break;default:Hr(c,f,Nt,null,S,Oe)}for(ge in S)if(Oe=S[ge],Fe=b[ge],S.hasOwnProperty(ge)&&Oe!==Fe&&(Oe!=null||Fe!=null))switch(ge){case"selected":c.selected=Oe&&typeof Oe!="function"&&typeof Oe!="symbol";break;default:Hr(c,f,ge,Oe,S,Fe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Yt in b)Oe=b[Yt],b.hasOwnProperty(Yt)&&Oe!=null&&!S.hasOwnProperty(Yt)&&Hr(c,f,Yt,null,S,Oe);for(je in S)if(Oe=S[je],Fe=b[je],S.hasOwnProperty(je)&&Oe!==Fe&&(Oe!=null||Fe!=null))switch(je){case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(n(137,f));break;default:Hr(c,f,je,Oe,S,Fe)}return;default:if(qi(f)){for(var Ur in b)Oe=b[Ur],b.hasOwnProperty(Ur)&&Oe!==void 0&&!S.hasOwnProperty(Ur)&&Vv(c,f,Ur,void 0,S,Oe);for(We in S)Oe=S[We],Fe=b[We],!S.hasOwnProperty(We)||Oe===Fe||Oe===void 0&&Fe===void 0||Vv(c,f,We,Oe,S,Fe);return}}for(var ke in b)Oe=b[ke],b.hasOwnProperty(ke)&&Oe!=null&&!S.hasOwnProperty(ke)&&Hr(c,f,ke,null,S,Oe);for(Xe in S)Oe=S[Xe],Fe=b[Xe],!S.hasOwnProperty(Xe)||Oe===Fe||Oe==null&&Fe==null||Hr(c,f,Xe,Oe,S,Fe)}function KT(c){switch(c){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function oP(){if(typeof performance.getEntriesByType=="function"){for(var c=0,f=0,b=performance.getEntriesByType("resource"),S=0;S<b.length;S++){var M=b[S],B=M.transferSize,V=M.initiatorType,te=M.duration;if(B&&te&&KT(V)){for(V=0,te=M.responseEnd,S+=1;S<b.length;S++){var ge=b[S],je=ge.startTime;if(je>te)break;var We=ge.transferSize,Xe=ge.initiatorType;We&&KT(Xe)&&(ge=ge.responseEnd,V+=We*(ge<te?1:(te-je)/(ge-je)))}if(--S,f+=8*(B+V)/(M.duration/1e3),c++,10<c)break}}if(0<c)return f/c/1e6}return navigator.connection&&(c=navigator.connection.downlink,typeof c=="number")?c:5}var Yv=null,Xv=null;function Yp(c){return c.nodeType===9?c:c.ownerDocument}function VT(c){switch(c){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function YT(c,f){if(c===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return c===1&&f==="foreignObject"?0:c}function Zv(c,f){return c==="textarea"||c==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var Qv=null;function lP(){var c=window.event;return c&&c.type==="popstate"?c===Qv?!1:(Qv=c,!0):(Qv=null,!1)}var XT=typeof setTimeout=="function"?setTimeout:void 0,cP=typeof clearTimeout=="function"?clearTimeout:void 0,ZT=typeof Promise=="function"?Promise:void 0,hP=typeof queueMicrotask=="function"?queueMicrotask:typeof ZT<"u"?function(c){return ZT.resolve(null).then(c).catch(uP)}:XT;function uP(c){setTimeout(function(){throw c})}function yo(c){return c==="head"}function QT(c,f){var b=f,S=0;do{var M=b.nextSibling;if(c.removeChild(b),M&&M.nodeType===8)if(b=M.data,b==="/$"||b==="/&"){if(S===0){c.removeChild(M),Zc(f);return}S--}else if(b==="$"||b==="$?"||b==="$~"||b==="$!"||b==="&")S++;else if(b==="html")ed(c.ownerDocument.documentElement);else if(b==="head"){b=c.ownerDocument.head,ed(b);for(var B=b.firstChild;B;){var V=B.nextSibling,te=B.nodeName;B[Hn]||te==="SCRIPT"||te==="STYLE"||te==="LINK"&&B.rel.toLowerCase()==="stylesheet"||b.removeChild(B),B=V}}else b==="body"&&ed(c.ownerDocument.body);b=M}while(b);Zc(f)}function JT(c,f){var b=c;c=0;do{var S=b.nextSibling;if(b.nodeType===1?f?(b._stashedDisplay=b.style.display,b.style.display="none"):(b.style.display=b._stashedDisplay||"",b.getAttribute("style")===""&&b.removeAttribute("style")):b.nodeType===3&&(f?(b._stashedText=b.nodeValue,b.nodeValue=""):b.nodeValue=b._stashedText||""),S&&S.nodeType===8)if(b=S.data,b==="/$"){if(c===0)break;c--}else b!=="$"&&b!=="$?"&&b!=="$~"&&b!=="$!"||c++;b=S}while(b)}function Jv(c){var f=c.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var b=f;switch(f=f.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":Jv(b),Os(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}c.removeChild(b)}}function dP(c,f,b,S){for(;c.nodeType===1;){var M=b;if(c.nodeName.toLowerCase()!==f.toLowerCase()){if(!S&&(c.nodeName!=="INPUT"||c.type!=="hidden"))break}else if(S){if(!c[Hn])switch(f){case"meta":if(!c.hasAttribute("itemprop"))break;return c;case"link":if(B=c.getAttribute("rel"),B==="stylesheet"&&c.hasAttribute("data-precedence"))break;if(B!==M.rel||c.getAttribute("href")!==(M.href==null||M.href===""?null:M.href)||c.getAttribute("crossorigin")!==(M.crossOrigin==null?null:M.crossOrigin)||c.getAttribute("title")!==(M.title==null?null:M.title))break;return c;case"style":if(c.hasAttribute("data-precedence"))break;return c;case"script":if(B=c.getAttribute("src"),(B!==(M.src==null?null:M.src)||c.getAttribute("type")!==(M.type==null?null:M.type)||c.getAttribute("crossorigin")!==(M.crossOrigin==null?null:M.crossOrigin))&&B&&c.hasAttribute("async")&&!c.hasAttribute("itemprop"))break;return c;default:return c}}else if(f==="input"&&c.type==="hidden"){var B=M.name==null?null:""+M.name;if(M.type==="hidden"&&c.getAttribute("name")===B)return c}else return c;if(c=es(c.nextSibling),c===null)break}return null}function fP(c,f,b){if(f==="")return null;for(;c.nodeType!==3;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!b||(c=es(c.nextSibling),c===null))return null;return c}function eE(c,f){for(;c.nodeType!==8;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!f||(c=es(c.nextSibling),c===null))return null;return c}function e0(c){return c.data==="$?"||c.data==="$~"}function t0(c){return c.data==="$!"||c.data==="$?"&&c.ownerDocument.readyState!=="loading"}function pP(c,f){var b=c.ownerDocument;if(c.data==="$~")c._reactRetry=f;else if(c.data!=="$?"||b.readyState!=="loading")f();else{var S=function(){f(),b.removeEventListener("DOMContentLoaded",S)};b.addEventListener("DOMContentLoaded",S),c._reactRetry=S}}function es(c){for(;c!=null;c=c.nextSibling){var f=c.nodeType;if(f===1||f===3)break;if(f===8){if(f=c.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return c}var r0=null;function tE(c){c=c.nextSibling;for(var f=0;c;){if(c.nodeType===8){var b=c.data;if(b==="/$"||b==="/&"){if(f===0)return es(c.nextSibling);f--}else b!=="$"&&b!=="$!"&&b!=="$?"&&b!=="$~"&&b!=="&"||f++}c=c.nextSibling}return null}function rE(c){c=c.previousSibling;for(var f=0;c;){if(c.nodeType===8){var b=c.data;if(b==="$"||b==="$!"||b==="$?"||b==="$~"||b==="&"){if(f===0)return c;f--}else b!=="/$"&&b!=="/&"||f++}c=c.previousSibling}return null}function iE(c,f,b){switch(f=Yp(b),c){case"html":if(c=f.documentElement,!c)throw Error(n(452));return c;case"head":if(c=f.head,!c)throw Error(n(453));return c;case"body":if(c=f.body,!c)throw Error(n(454));return c;default:throw Error(n(451))}}function ed(c){for(var f=c.attributes;f.length;)c.removeAttributeNode(f[0]);Os(c)}var ts=new Map,nE=new Set;function Xp(c){return typeof c.getRootNode=="function"?c.getRootNode():c.nodeType===9?c:c.ownerDocument}var ka=W.d;W.d={f:gP,r:mP,D:yP,C:bP,L:vP,m:xP,X:CP,S:_P,M:wP};function gP(){var c=ka.f(),f=zp();return c||f}function mP(c){var f=Qi(c);f!==null&&f.tag===5&&f.type==="form"?_2(f):ka.r(c)}var Vc=typeof document>"u"?null:document;function sE(c,f,b){var S=Vc;if(S&&typeof f=="string"&&f){var M=Bi(f);M='link[rel="'+c+'"][href="'+M+'"]',typeof b=="string"&&(M+='[crossorigin="'+b+'"]'),nE.has(M)||(nE.add(M),c={rel:c,crossOrigin:b,href:f},S.querySelector(M)===null&&(f=S.createElement("link"),Ii(f,"link",c),Lr(f),S.head.appendChild(f)))}}function yP(c){ka.D(c),sE("dns-prefetch",c,null)}function bP(c,f){ka.C(c,f),sE("preconnect",c,f)}function vP(c,f,b){ka.L(c,f,b);var S=Vc;if(S&&c&&f){var M='link[rel="preload"][as="'+Bi(f)+'"]';f==="image"&&b&&b.imageSrcSet?(M+='[imagesrcset="'+Bi(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(M+='[imagesizes="'+Bi(b.imageSizes)+'"]')):M+='[href="'+Bi(c)+'"]';var B=M;switch(f){case"style":B=Yc(c);break;case"script":B=Xc(c)}ts.has(B)||(c=p({rel:"preload",href:f==="image"&&b&&b.imageSrcSet?void 0:c,as:f},b),ts.set(B,c),S.querySelector(M)!==null||f==="style"&&S.querySelector(td(B))||f==="script"&&S.querySelector(rd(B))||(f=S.createElement("link"),Ii(f,"link",c),Lr(f),S.head.appendChild(f)))}}function xP(c,f){ka.m(c,f);var b=Vc;if(b&&c){var S=f&&typeof f.as=="string"?f.as:"script",M='link[rel="modulepreload"][as="'+Bi(S)+'"][href="'+Bi(c)+'"]',B=M;switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":B=Xc(c)}if(!ts.has(B)&&(c=p({rel:"modulepreload",href:c},f),ts.set(B,c),b.querySelector(M)===null)){switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(rd(B)))return}S=b.createElement("link"),Ii(S,"link",c),Lr(S),b.head.appendChild(S)}}}function _P(c,f,b){ka.S(c,f,b);var S=Vc;if(S&&c){var M=_i(S).hoistableStyles,B=Yc(c);f=f||"default";var V=M.get(B);if(!V){var te={loading:0,preload:null};if(V=S.querySelector(td(B)))te.loading=5;else{c=p({rel:"stylesheet",href:c,"data-precedence":f},b),(b=ts.get(B))&&i0(c,b);var ge=V=S.createElement("link");Lr(ge),Ii(ge,"link",c),ge._p=new Promise(function(je,We){ge.onload=je,ge.onerror=We}),ge.addEventListener("load",function(){te.loading|=1}),ge.addEventListener("error",function(){te.loading|=2}),te.loading|=4,Zp(V,f,S)}V={type:"stylesheet",instance:V,count:1,state:te},M.set(B,V)}}}function CP(c,f){ka.X(c,f);var b=Vc;if(b&&c){var S=_i(b).hoistableScripts,M=Xc(c),B=S.get(M);B||(B=b.querySelector(rd(M)),B||(c=p({src:c,async:!0},f),(f=ts.get(M))&&n0(c,f),B=b.createElement("script"),Lr(B),Ii(B,"link",c),b.head.appendChild(B)),B={type:"script",instance:B,count:1,state:null},S.set(M,B))}}function wP(c,f){ka.M(c,f);var b=Vc;if(b&&c){var S=_i(b).hoistableScripts,M=Xc(c),B=S.get(M);B||(B=b.querySelector(rd(M)),B||(c=p({src:c,async:!0,type:"module"},f),(f=ts.get(M))&&n0(c,f),B=b.createElement("script"),Lr(B),Ii(B,"link",c),b.head.appendChild(B)),B={type:"script",instance:B,count:1,state:null},S.set(M,B))}}function aE(c,f,b,S){var M=(M=fe.current)?Xp(M):null;if(!M)throw Error(n(446));switch(c){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(f=Yc(b.href),b=_i(M).hoistableStyles,S=b.get(f),S||(S={type:"style",instance:null,count:0,state:null},b.set(f,S)),S):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){c=Yc(b.href);var B=_i(M).hoistableStyles,V=B.get(c);if(V||(M=M.ownerDocument||M,V={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},B.set(c,V),(B=M.querySelector(td(c)))&&!B._p&&(V.instance=B,V.state.loading=5),ts.has(c)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},ts.set(c,b),B||kP(M,c,b,V.state))),f&&S===null)throw Error(n(528,""));return V}if(f&&S!==null)throw Error(n(529,""));return null;case"script":return f=b.async,b=b.src,typeof b=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=Xc(b),b=_i(M).hoistableScripts,S=b.get(f),S||(S={type:"script",instance:null,count:0,state:null},b.set(f,S)),S):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,c))}}function Yc(c){return'href="'+Bi(c)+'"'}function td(c){return'link[rel="stylesheet"]['+c+"]"}function oE(c){return p({},c,{"data-precedence":c.precedence,precedence:null})}function kP(c,f,b,S){c.querySelector('link[rel="preload"][as="style"]['+f+"]")?S.loading=1:(f=c.createElement("link"),S.preload=f,f.addEventListener("load",function(){return S.loading|=1}),f.addEventListener("error",function(){return S.loading|=2}),Ii(f,"link",b),Lr(f),c.head.appendChild(f))}function Xc(c){return'[src="'+Bi(c)+'"]'}function rd(c){return"script[async]"+c}function lE(c,f,b){if(f.count++,f.instance===null)switch(f.type){case"style":var S=c.querySelector('style[data-href~="'+Bi(b.href)+'"]');if(S)return f.instance=S,Lr(S),S;var M=p({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return S=(c.ownerDocument||c).createElement("style"),Lr(S),Ii(S,"style",M),Zp(S,b.precedence,c),f.instance=S;case"stylesheet":M=Yc(b.href);var B=c.querySelector(td(M));if(B)return f.state.loading|=4,f.instance=B,Lr(B),B;S=oE(b),(M=ts.get(M))&&i0(S,M),B=(c.ownerDocument||c).createElement("link"),Lr(B);var V=B;return V._p=new Promise(function(te,ge){V.onload=te,V.onerror=ge}),Ii(B,"link",S),f.state.loading|=4,Zp(B,b.precedence,c),f.instance=B;case"script":return B=Xc(b.src),(M=c.querySelector(rd(B)))?(f.instance=M,Lr(M),M):(S=b,(M=ts.get(B))&&(S=p({},b),n0(S,M)),c=c.ownerDocument||c,M=c.createElement("script"),Lr(M),Ii(M,"link",S),c.head.appendChild(M),f.instance=M);case"void":return null;default:throw Error(n(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(S=f.instance,f.state.loading|=4,Zp(S,b.precedence,c));return f.instance}function Zp(c,f,b){for(var S=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),M=S.length?S[S.length-1]:null,B=M,V=0;V<S.length;V++){var te=S[V];if(te.dataset.precedence===f)B=te;else if(B!==M)break}B?B.parentNode.insertBefore(c,B.nextSibling):(f=b.nodeType===9?b.head:b,f.insertBefore(c,f.firstChild))}function i0(c,f){c.crossOrigin==null&&(c.crossOrigin=f.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=f.referrerPolicy),c.title==null&&(c.title=f.title)}function n0(c,f){c.crossOrigin==null&&(c.crossOrigin=f.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=f.referrerPolicy),c.integrity==null&&(c.integrity=f.integrity)}var Qp=null;function cE(c,f,b){if(Qp===null){var S=new Map,M=Qp=new Map;M.set(b,S)}else M=Qp,S=M.get(b),S||(S=new Map,M.set(b,S));if(S.has(c))return S;for(S.set(c,null),b=b.getElementsByTagName(c),M=0;M<b.length;M++){var B=b[M];if(!(B[Hn]||B[xt]||c==="link"&&B.getAttribute("rel")==="stylesheet")&&B.namespaceURI!=="http://www.w3.org/2000/svg"){var V=B.getAttribute(f)||"";V=c+V;var te=S.get(V);te?te.push(B):S.set(V,[B])}}return S}function hE(c,f,b){c=c.ownerDocument||c,c.head.insertBefore(b,f==="title"?c.querySelector("head > title"):null)}function SP(c,f,b){if(b===1||f.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return c=f.disabled,typeof f.precedence=="string"&&c==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function uE(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function TP(c,f,b,S){if(b.type==="stylesheet"&&(typeof S.media!="string"||matchMedia(S.media).matches!==!1)&&(b.state.loading&4)===0){if(b.instance===null){var M=Yc(S.href),B=f.querySelector(td(M));if(B){f=B._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(c.count++,c=Jp.bind(c),f.then(c,c)),b.state.loading|=4,b.instance=B,Lr(B);return}B=f.ownerDocument||f,S=oE(S),(M=ts.get(M))&&i0(S,M),B=B.createElement("link"),Lr(B);var V=B;V._p=new Promise(function(te,ge){V.onload=te,V.onerror=ge}),Ii(B,"link",S),b.instance=B}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(b,f),(f=b.state.preload)&&(b.state.loading&3)===0&&(c.count++,b=Jp.bind(c),f.addEventListener("load",b),f.addEventListener("error",b))}}var s0=0;function EP(c,f){return c.stylesheets&&c.count===0&&tg(c,c.stylesheets),0<c.count||0<c.imgCount?function(b){var S=setTimeout(function(){if(c.stylesheets&&tg(c,c.stylesheets),c.unsuspend){var B=c.unsuspend;c.unsuspend=null,B()}},6e4+f);0<c.imgBytes&&s0===0&&(s0=62500*oP());var M=setTimeout(function(){if(c.waitingForImages=!1,c.count===0&&(c.stylesheets&&tg(c,c.stylesheets),c.unsuspend)){var B=c.unsuspend;c.unsuspend=null,B()}},(c.imgBytes>s0?50:800)+f);return c.unsuspend=b,function(){c.unsuspend=null,clearTimeout(S),clearTimeout(M)}}:null}function Jp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tg(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var eg=null;function tg(c,f){c.stylesheets=null,c.unsuspend!==null&&(c.count++,eg=new Map,f.forEach(NP,c),eg=null,Jp.call(c))}function NP(c,f){if(!(f.state.loading&4)){var b=eg.get(c);if(b)var S=b.get(null);else{b=new Map,eg.set(c,b);for(var M=c.querySelectorAll("link[data-precedence],style[data-precedence]"),B=0;B<M.length;B++){var V=M[B];(V.nodeName==="LINK"||V.getAttribute("media")!=="not all")&&(b.set(V.dataset.precedence,V),S=V)}S&&b.set(null,S)}M=f.instance,V=M.getAttribute("data-precedence"),B=b.get(V)||S,B===S&&b.set(null,M),b.set(V,M),this.count++,S=Jp.bind(this),M.addEventListener("load",S),M.addEventListener("error",S),B?B.parentNode.insertBefore(M,B.nextSibling):(c=c.nodeType===9?c.head:c,c.insertBefore(M,c.firstChild)),f.state.loading|=4}}var id={$$typeof:k,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function AP(c,f,b,S,M,B,V,te,ge){this.tag=1,this.containerInfo=c,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Et(0),this.hiddenUpdates=Et(null),this.identifierPrefix=S,this.onUncaughtError=M,this.onCaughtError=B,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ge,this.incompleteTransitions=new Map}function dE(c,f,b,S,M,B,V,te,ge,je,We,Xe){return c=new AP(c,f,b,V,ge,je,We,Xe,te),f=1,B===!0&&(f|=24),B=jn(3,null,null,f),c.current=B,B.stateNode=c,f=Fb(),f.refCount++,c.pooledCache=f,f.refCount++,B.memoizedState={element:S,isDehydrated:b,cache:f},qb(B),c}function fE(c){return c?(c=Ec,c):Ec}function pE(c,f,b,S,M,B){M=fE(M),S.context===null?S.context=M:S.pendingContext=M,S=so(f),S.payload={element:b},B=B===void 0?null:B,B!==null&&(S.callback=B),b=ao(c,S,f),b!==null&&(vn(b,c,f),Ou(b,c,f))}function gE(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var b=c.retryLane;c.retryLane=b!==0&&b<f?b:f}}function a0(c,f){gE(c,f),(c=c.alternate)&&gE(c,f)}function mE(c){if(c.tag===13||c.tag===31){var f=ul(c,67108864);f!==null&&vn(f,c,67108864),a0(c,67108864)}}function yE(c){if(c.tag===13||c.tag===31){var f=On();f=le(f);var b=ul(c,f);b!==null&&vn(b,c,f),a0(c,f)}}var rg=!0;function jP(c,f,b,S){var M=F.T;F.T=null;var B=W.p;try{W.p=2,o0(c,f,b,S)}finally{W.p=B,F.T=M}}function MP(c,f,b,S){var M=F.T;F.T=null;var B=W.p;try{W.p=8,o0(c,f,b,S)}finally{W.p=B,F.T=M}}function o0(c,f,b,S){if(rg){var M=l0(S);if(M===null)Kv(c,f,S,ig,b),vE(c,S);else if(BP(M,c,f,b,S))S.stopPropagation();else if(vE(c,S),f&4&&-1<LP.indexOf(c)){for(;M!==null;){var B=Qi(M);if(B!==null)switch(B.tag){case 3:if(B=B.stateNode,B.current.memoizedState.isDehydrated){var V=kt(B.pendingLanes);if(V!==0){var te=B;for(te.pendingLanes|=2,te.entangledLanes|=2;V;){var ge=1<<31-lt(V);te.entanglements[1]|=ge,V&=~ge}$s(B),(Mr&6)===0&&($p=Lt()+500,Zu(0))}}break;case 31:case 13:te=ul(B,2),te!==null&&vn(te,B,2),zp(),a0(B,2)}if(B=l0(S),B===null&&Kv(c,f,S,ig,b),B===M)break;M=B}M!==null&&S.stopPropagation()}else Kv(c,f,S,null,b)}}function l0(c){return c=lr(c),c0(c)}var ig=null;function c0(c){if(ig=null,c=xi(c),c!==null){var f=o(c);if(f===null)c=null;else{var b=f.tag;if(b===13){if(c=h(f),c!==null)return c;c=null}else if(b===31){if(c=l(f),c!==null)return c;c=null}else if(b===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;c=null}else f!==c&&(c=null)}}return ig=c,null}function bE(c){switch(c){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Bt()){case bt:return 2;case Se:return 8;case De:case Me:return 32;case Je:return 268435456;default:return 32}default:return 32}}var h0=!1,bo=null,vo=null,xo=null,nd=new Map,sd=new Map,_o=[],LP="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function vE(c,f){switch(c){case"focusin":case"focusout":bo=null;break;case"dragenter":case"dragleave":vo=null;break;case"mouseover":case"mouseout":xo=null;break;case"pointerover":case"pointerout":nd.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":sd.delete(f.pointerId)}}function ad(c,f,b,S,M,B){return c===null||c.nativeEvent!==B?(c={blockedOn:f,domEventName:b,eventSystemFlags:S,nativeEvent:B,targetContainers:[M]},f!==null&&(f=Qi(f),f!==null&&mE(f)),c):(c.eventSystemFlags|=S,f=c.targetContainers,M!==null&&f.indexOf(M)===-1&&f.push(M),c)}function BP(c,f,b,S,M){switch(f){case"focusin":return bo=ad(bo,c,f,b,S,M),!0;case"dragenter":return vo=ad(vo,c,f,b,S,M),!0;case"mouseover":return xo=ad(xo,c,f,b,S,M),!0;case"pointerover":var B=M.pointerId;return nd.set(B,ad(nd.get(B)||null,c,f,b,S,M)),!0;case"gotpointercapture":return B=M.pointerId,sd.set(B,ad(sd.get(B)||null,c,f,b,S,M)),!0}return!1}function xE(c){var f=xi(c.target);if(f!==null){var b=o(f);if(b!==null){if(f=b.tag,f===13){if(f=h(b),f!==null){c.blockedOn=f,$e(c.priority,function(){yE(b)});return}}else if(f===31){if(f=l(b),f!==null){c.blockedOn=f,$e(c.priority,function(){yE(b)});return}}else if(f===3&&b.stateNode.current.memoizedState.isDehydrated){c.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}c.blockedOn=null}function ng(c){if(c.blockedOn!==null)return!1;for(var f=c.targetContainers;0<f.length;){var b=l0(c.nativeEvent);if(b===null){b=c.nativeEvent;var S=new b.constructor(b.type,b);Dt=S,b.target.dispatchEvent(S),Dt=null}else return f=Qi(b),f!==null&&mE(f),c.blockedOn=b,!1;f.shift()}return!0}function _E(c,f,b){ng(c)&&b.delete(f)}function RP(){h0=!1,bo!==null&&ng(bo)&&(bo=null),vo!==null&&ng(vo)&&(vo=null),xo!==null&&ng(xo)&&(xo=null),nd.forEach(_E),sd.forEach(_E)}function sg(c,f){c.blockedOn===f&&(c.blockedOn=null,h0||(h0=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,RP)))}var ag=null;function CE(c){ag!==c&&(ag=c,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){ag===c&&(ag=null);for(var f=0;f<c.length;f+=3){var b=c[f],S=c[f+1],M=c[f+2];if(typeof S!="function"){if(c0(S||b)===null)continue;break}var B=Qi(b);B!==null&&(c.splice(f,3),f-=3,lv(B,{pending:!0,data:M,method:b.method,action:S},S,M))}}))}function Zc(c){function f(ge){return sg(ge,c)}bo!==null&&sg(bo,c),vo!==null&&sg(vo,c),xo!==null&&sg(xo,c),nd.forEach(f),sd.forEach(f);for(var b=0;b<_o.length;b++){var S=_o[b];S.blockedOn===c&&(S.blockedOn=null)}for(;0<_o.length&&(b=_o[0],b.blockedOn===null);)xE(b),b.blockedOn===null&&_o.shift();if(b=(c.ownerDocument||c).$$reactFormReplay,b!=null)for(S=0;S<b.length;S+=3){var M=b[S],B=b[S+1],V=M[$t]||null;if(typeof B=="function")V||CE(b);else if(V){var te=null;if(B&&B.hasAttribute("formAction")){if(M=B,V=B[$t]||null)te=V.formAction;else if(c0(M)!==null)continue}else te=V.action;typeof te=="function"?b[S+1]=te:(b.splice(S,3),S-=3),CE(b)}}}function wE(){function c(B){B.canIntercept&&B.info==="react-transition"&&B.intercept({handler:function(){return new Promise(function(V){return M=V})},focusReset:"manual",scroll:"manual"})}function f(){M!==null&&(M(),M=null),S||setTimeout(b,20)}function b(){if(!S&&!navigation.transition){var B=navigation.currentEntry;B&&B.url!=null&&navigation.navigate(B.url,{state:B.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var S=!1,M=null;return navigation.addEventListener("navigate",c),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(b,100),function(){S=!0,navigation.removeEventListener("navigate",c),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),M!==null&&(M(),M=null)}}}function u0(c){this._internalRoot=c}og.prototype.render=u0.prototype.render=function(c){var f=this._internalRoot;if(f===null)throw Error(n(409));var b=f.current,S=On();pE(b,S,c,f,null,null)},og.prototype.unmount=u0.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var f=c.containerInfo;pE(c.current,2,null,c,null,null),zp(),f[Kr]=null}};function og(c){this._internalRoot=c}og.prototype.unstable_scheduleHydration=function(c){if(c){var f=Re();c={blockedOn:null,target:c,priority:f};for(var b=0;b<_o.length&&f!==0&&f<_o[b].priority;b++);_o.splice(b,0,c),b===0&&xE(c)}};var kE=e.version;if(kE!=="19.2.4")throw Error(n(527,kE,"19.2.4"));W.findDOMNode=function(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=d(f),c=c!==null?g(c):null,c=c===null?null:c.stateNode,c};var OP={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lg.isDisabled&&lg.supportsFiber)try{At=lg.inject(OP),Te=lg}catch{}}return ld.createRoot=function(c,f){if(!s(c))throw Error(n(299));var b=!1,S="",M=M2,B=L2,V=B2;return f!=null&&(f.unstable_strictMode===!0&&(b=!0),f.identifierPrefix!==void 0&&(S=f.identifierPrefix),f.onUncaughtError!==void 0&&(M=f.onUncaughtError),f.onCaughtError!==void 0&&(B=f.onCaughtError),f.onRecoverableError!==void 0&&(V=f.onRecoverableError)),f=dE(c,1,!1,null,null,b,S,null,M,B,V,wE),c[Kr]=f.current,Gv(c),new u0(f)},ld.hydrateRoot=function(c,f,b){if(!s(c))throw Error(n(299));var S=!1,M="",B=M2,V=L2,te=B2,ge=null;return b!=null&&(b.unstable_strictMode===!0&&(S=!0),b.identifierPrefix!==void 0&&(M=b.identifierPrefix),b.onUncaughtError!==void 0&&(B=b.onUncaughtError),b.onCaughtError!==void 0&&(V=b.onCaughtError),b.onRecoverableError!==void 0&&(te=b.onRecoverableError),b.formState!==void 0&&(ge=b.formState)),f=dE(c,1,!0,f,b??null,S,M,ge,B,V,te,wE),f.context=fE(null),b=f.current,S=On(),S=le(S),M=so(S),M.callback=null,ao(b,M,S),b=S,f.current.lanes=b,dt(f,b),$s(f),c[Kr]=f.current,Gv(c),new og(f)},ld.version="19.2.4",ld}var OE;function KP(){if(OE)return g0.exports;OE=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),g0.exports=GP(),g0.exports}var VP=KP(),du=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(r){return this.listeners.add(r),this.onSubscribe(),()=>{this.listeners.delete(r),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},YP={setTimeout:(r,e)=>setTimeout(r,e),clearTimeout:r=>clearTimeout(r),setInterval:(r,e)=>setInterval(r,e),clearInterval:r=>clearInterval(r)},Bo,MC,$B,XP=($B=class{constructor(){Wt(this,Bo,YP);Wt(this,MC,!1)}setTimeoutProvider(r){Ct(this,Bo,r)}setTimeout(r,e){return me(this,Bo).setTimeout(r,e)}clearTimeout(r){me(this,Bo).clearTimeout(r)}setInterval(r,e){return me(this,Bo).setInterval(r,e)}clearInterval(r){me(this,Bo).clearInterval(r)}},Bo=new WeakMap,MC=new WeakMap,$B),Dl=new XP;function ZP(r){setTimeout(r,0)}var rc=typeof window>"u"||"Deno"in globalThis;function rn(){}function QP(r,e){return typeof r=="function"?r(e):r}function k_(r){return typeof r=="number"&&r>=0&&r!==1/0}function QB(r,e){return Math.max(r+(e||0)-Date.now(),0)}function Go(r,e){return typeof r=="function"?r(e):r}function os(r,e){return typeof r=="function"?r(e):r}function DE(r,e){const{type:i="all",exact:n,fetchStatus:s,predicate:o,queryKey:h,stale:l}=r;if(h){if(n){if(e.queryHash!==BC(h,e.options))return!1}else if(!pf(e.queryKey,h))return!1}if(i!=="all"){const u=e.isActive();if(i==="active"&&!u||i==="inactive"&&u)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||o&&!o(e))}function IE(r,e){const{exact:i,status:n,predicate:s,mutationKey:o}=r;if(o){if(!e.options.mutationKey)return!1;if(i){if(ic(e.options.mutationKey)!==ic(o))return!1}else if(!pf(e.options.mutationKey,o))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function BC(r,e){return((e==null?void 0:e.queryKeyHashFn)||ic)(r)}function ic(r){return JSON.stringify(r,(e,i)=>S_(i)?Object.keys(i).sort().reduce((n,s)=>(n[s]=i[s],n),{}):i)}function pf(r,e){return r===e?!0:typeof r!=typeof e?!1:r&&e&&typeof r=="object"&&typeof e=="object"?Object.keys(e).every(i=>pf(r[i],e[i])):!1}var JP=Object.prototype.hasOwnProperty;function JB(r,e,i=0){if(r===e)return r;if(i>500)return e;const n=FE(r)&&FE(e);if(!n&&!(S_(r)&&S_(e)))return e;const o=(n?r:Object.keys(r)).length,h=n?e:Object.keys(e),l=h.length,u=n?new Array(l):{};let d=0;for(let g=0;g<l;g++){const p=n?g:h[g],m=r[p],y=e[p];if(m===y){u[p]=m,(n?g<o:JP.call(r,p))&&d++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){u[p]=y;continue}const w=JB(m,y,i+1);u[p]=w,w===m&&d++}return o===l&&d===o?r:u}function wm(r,e){if(!e||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(r[i]!==e[i])return!1;return!0}function FE(r){return Array.isArray(r)&&r.length===Object.keys(r).length}function S_(r){if(!$E(r))return!1;const e=r.constructor;if(e===void 0)return!0;const i=e.prototype;return!(!$E(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(r)!==Object.prototype)}function $E(r){return Object.prototype.toString.call(r)==="[object Object]"}function ez(r){return new Promise(e=>{Dl.setTimeout(e,r)})}function T_(r,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(r,e):i.structuralSharing!==!1?JB(r,e):e}function tz(r){return r}function rz(r,e,i=0){const n=[...r,e];return i&&n.length>i?n.slice(1):n}function iz(r,e,i=0){const n=[e,...r];return i&&n.length>i?n.slice(0,-1):n}var RC=Symbol();function eR(r,e){return!r.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!r.queryFn||r.queryFn===RC?()=>Promise.reject(new Error(`Missing queryFn: '${r.queryHash}'`)):r.queryFn}function OC(r,e){return typeof r=="function"?r(...e):!!r}function nz(r,e,i){let n=!1,s;return Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(s??(s=e()),n||(n=!0,s.aborted?i():s.addEventListener("abort",i,{once:!0})),s)}),r}var ql,Ro,Nh,PB,sz=(PB=class extends du{constructor(){super();Wt(this,ql);Wt(this,Ro);Wt(this,Nh);Ct(this,Nh,e=>{if(!rc&&window.addEventListener){const i=()=>e();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){me(this,Ro)||this.setEventListener(me(this,Nh))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,Ro))==null||e.call(this),Ct(this,Ro,void 0))}setEventListener(e){var i;Ct(this,Nh,e),(i=me(this,Ro))==null||i.call(this),Ct(this,Ro,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){me(this,ql)!==e&&(Ct(this,ql,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(i=>{i(e)})}isFocused(){var e;return typeof me(this,ql)=="boolean"?me(this,ql):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ql=new WeakMap,Ro=new WeakMap,Nh=new WeakMap,PB),DC=new sz;function E_(){let r,e;const i=new Promise((s,o)=>{r=s,e=o});i.status="pending",i.catch(()=>{});function n(s){Object.assign(i,s),delete i.resolve,delete i.reject}return i.resolve=s=>{n({status:"fulfilled",value:s}),r(s)},i.reject=s=>{n({status:"rejected",reason:s}),e(s)},i}var az=ZP;function oz(){let r=[],e=0,i=l=>{l()},n=l=>{l()},s=az;const o=l=>{e?r.push(l):s(()=>{i(l)})},h=()=>{const l=r;r=[],l.length&&s(()=>{n(()=>{l.forEach(u=>{i(u)})})})};return{batch:l=>{let u;e++;try{u=l()}finally{e--,e||h()}return u},batchCalls:l=>(...u)=>{o(()=>{l(...u)})},schedule:o,setNotifyFunction:l=>{i=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Si=oz(),Ah,Oo,jh,zB,lz=(zB=class extends du{constructor(){super();Wt(this,Ah,!0);Wt(this,Oo);Wt(this,jh);Ct(this,jh,e=>{if(!rc&&window.addEventListener){const i=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",n)}}})}onSubscribe(){me(this,Oo)||this.setEventListener(me(this,jh))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,Oo))==null||e.call(this),Ct(this,Oo,void 0))}setEventListener(e){var i;Ct(this,jh,e),(i=me(this,Oo))==null||i.call(this),Ct(this,Oo,e(this.setOnline.bind(this)))}setOnline(e){me(this,Ah)!==e&&(Ct(this,Ah,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return me(this,Ah)}},Ah=new WeakMap,Oo=new WeakMap,jh=new WeakMap,zB),km=new lz;function cz(r){return Math.min(1e3*2**r,3e4)}function tR(r){return(r??"online")==="online"?km.isOnline():!0}var N_=class extends Error{constructor(r){super("CancelledError"),this.revert=r==null?void 0:r.revert,this.silent=r==null?void 0:r.silent}};function rR(r){let e=!1,i=0,n;const s=E_(),o=()=>s.status!=="pending",h=_=>{var v;if(!o()){const x=new N_(_);m(x),(v=r.onCancel)==null||v.call(r,x)}},l=()=>{e=!0},u=()=>{e=!1},d=()=>DC.isFocused()&&(r.networkMode==="always"||km.isOnline())&&r.canRun(),g=()=>tR(r.networkMode)&&r.canRun(),p=_=>{o()||(n==null||n(),s.resolve(_))},m=_=>{o()||(n==null||n(),s.reject(_))},y=()=>new Promise(_=>{var v;n=x=>{(o()||d())&&_(x)},(v=r.onPause)==null||v.call(r)}).then(()=>{var _;n=void 0,o()||(_=r.onContinue)==null||_.call(r)}),w=()=>{if(o())return;let _;const v=i===0?r.initialPromise:void 0;try{_=v??r.fn()}catch(x){_=Promise.reject(x)}Promise.resolve(_).then(p).catch(x=>{var j;if(o())return;const C=r.retry??(rc?0:3),k=r.retryDelay??cz,T=typeof k=="function"?k(i,x):k,N=C===!0||typeof C=="number"&&i<C||typeof C=="function"&&C(i,x);if(e||!N){m(x);return}i++,(j=r.onFail)==null||j.call(r,i,x),ez(T).then(()=>d()?void 0:y()).then(()=>{e?m(x):w()})})};return{promise:s,status:()=>s.status,cancel:h,continue:()=>(n==null||n(),s),cancelRetry:l,continueRetry:u,canStart:g,start:()=>(g()?w():y().then(w),s)}}var Hl,qB,iR=(qB=class{constructor(){Wt(this,Hl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),k_(this.gcTime)&&Ct(this,Hl,Dl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(r){this.gcTime=Math.max(this.gcTime||0,r??(rc?1/0:300*1e3))}clearGcTimeout(){me(this,Hl)&&(Dl.clearTimeout(me(this,Hl)),Ct(this,Hl,void 0))}},Hl=new WeakMap,qB),Ul,Mh,as,Wl,ji,Bf,Gl,_s,ja,HB,hz=(HB=class extends iR{constructor(e){super();Wt(this,_s);Wt(this,Ul);Wt(this,Mh);Wt(this,as);Wt(this,Wl);Wt(this,ji);Wt(this,Bf);Wt(this,Gl);Ct(this,Gl,!1),Ct(this,Bf,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ct(this,Wl,e.client),Ct(this,as,me(this,Wl).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ct(this,Ul,zE(this.options)),this.state=e.state??me(this,Ul),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=me(this,ji))==null?void 0:e.promise}setOptions(e){if(this.options={...me(this,Bf),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=zE(this.options);i.data!==void 0&&(this.setState(PE(i.data,i.dataUpdatedAt)),Ct(this,Ul,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,as).remove(this)}setData(e,i){const n=T_(this.state.data,e,this.options);return fr(this,_s,ja).call(this,{data:n,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),n}setState(e,i){fr(this,_s,ja).call(this,{type:"setState",state:e,setStateOptions:i})}cancel(e){var n,s;const i=(n=me(this,ji))==null?void 0:n.promise;return(s=me(this,ji))==null||s.cancel(e),i?i.then(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(me(this,Ul))}isActive(){return this.observers.some(e=>os(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===RC||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Go(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!QB(this.state.dataUpdatedAt,e)}onFocus(){var i;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(i=me(this,ji))==null||i.continue()}onOnline(){var i;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(i=me(this,ji))==null||i.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),me(this,as).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(i=>i!==e),this.observers.length||(me(this,ji)&&(me(this,Gl)?me(this,ji).cancel({revert:!0}):me(this,ji).cancelRetry()),this.scheduleGc()),me(this,as).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,_s,ja).call(this,{type:"invalidate"})}async fetch(e,i){var u,d,g,p,m,y,w,_,v,x,C,k;if(this.state.fetchStatus!=="idle"&&((u=me(this,ji))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(me(this,ji))return me(this,ji).continueRetry(),me(this,ji).promise}if(e&&this.setOptions(e),!this.options.queryFn){const T=this.observers.find(N=>N.options.queryFn);T&&this.setOptions(T.options)}const n=new AbortController,s=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Ct(this,Gl,!0),n.signal)})},o=()=>{const T=eR(this.options,i),j=(()=>{const A={client:me(this,Wl),queryKey:this.queryKey,meta:this.meta};return s(A),A})();return Ct(this,Gl,!1),this.options.persister?this.options.persister(T,j,this):T(j)},l=(()=>{const T={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:me(this,Wl),state:this.state,fetchFn:o};return s(T),T})();(d=this.options.behavior)==null||d.onFetch(l,this),Ct(this,Mh,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=l.fetchOptions)==null?void 0:g.meta))&&fr(this,_s,ja).call(this,{type:"fetch",meta:(p=l.fetchOptions)==null?void 0:p.meta}),Ct(this,ji,rR({initialPromise:i==null?void 0:i.initialPromise,fn:l.fetchFn,onCancel:T=>{T instanceof N_&&T.revert&&this.setState({...me(this,Mh),fetchStatus:"idle"}),n.abort()},onFail:(T,N)=>{fr(this,_s,ja).call(this,{type:"failed",failureCount:T,error:N})},onPause:()=>{fr(this,_s,ja).call(this,{type:"pause"})},onContinue:()=>{fr(this,_s,ja).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const T=await me(this,ji).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(y=(m=me(this,as).config).onSuccess)==null||y.call(m,T,this),(_=(w=me(this,as).config).onSettled)==null||_.call(w,T,this.state.error,this),T}catch(T){if(T instanceof N_){if(T.silent)return me(this,ji).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw fr(this,_s,ja).call(this,{type:"error",error:T}),(x=(v=me(this,as).config).onError)==null||x.call(v,T,this),(k=(C=me(this,as).config).onSettled)==null||k.call(C,this.state.data,T,this),T}finally{this.scheduleGc()}}},Ul=new WeakMap,Mh=new WeakMap,as=new WeakMap,Wl=new WeakMap,ji=new WeakMap,Bf=new WeakMap,Gl=new WeakMap,_s=new WeakSet,ja=function(e){const i=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...nR(n.data,this.options),fetchMeta:e.meta??null};case"success":const s={...n,...PE(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ct(this,Mh,e.manual?s:void 0),s;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=i(this.state),Si.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),me(this,as).notify({query:this,type:"updated",action:e})})},HB);function nR(r,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tR(e.networkMode)?"fetching":"paused",...r===void 0&&{error:null,status:"pending"}}}function PE(r,e){return{data:r,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zE(r){const e=typeof r.initialData=="function"?r.initialData():r.initialData,i=e!==void 0,n=i?typeof r.initialDataUpdatedAt=="function"?r.initialDataUpdatedAt():r.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:i?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var _n,kr,Rf,tn,Kl,Lh,Ba,Do,Of,Bh,Rh,Vl,Yl,Io,Oh,Dr,Fd,A_,j_,M_,L_,B_,R_,O_,sR,UB,uz=(UB=class extends du{constructor(e,i){super();Wt(this,Dr);Wt(this,_n);Wt(this,kr);Wt(this,Rf);Wt(this,tn);Wt(this,Kl);Wt(this,Lh);Wt(this,Ba);Wt(this,Do);Wt(this,Of);Wt(this,Bh);Wt(this,Rh);Wt(this,Vl);Wt(this,Yl);Wt(this,Io);Wt(this,Oh,new Set);this.options=i,Ct(this,_n,e),Ct(this,Do,null),Ct(this,Ba,E_()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,kr).addObserver(this),qE(me(this,kr),this.options)?fr(this,Dr,Fd).call(this):this.updateResult(),fr(this,Dr,L_).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return D_(me(this,kr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return D_(me(this,kr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,Dr,B_).call(this),fr(this,Dr,R_).call(this),me(this,kr).removeObserver(this)}setOptions(e){const i=this.options,n=me(this,kr);if(this.options=me(this,_n).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof os(this.options.enabled,me(this,kr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,Dr,O_).call(this),me(this,kr).setOptions(this.options),i._defaulted&&!wm(this.options,i)&&me(this,_n).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,kr),observer:this});const s=this.hasListeners();s&&HE(me(this,kr),n,this.options,i)&&fr(this,Dr,Fd).call(this),this.updateResult(),s&&(me(this,kr)!==n||os(this.options.enabled,me(this,kr))!==os(i.enabled,me(this,kr))||Go(this.options.staleTime,me(this,kr))!==Go(i.staleTime,me(this,kr)))&&fr(this,Dr,A_).call(this);const o=fr(this,Dr,j_).call(this);s&&(me(this,kr)!==n||os(this.options.enabled,me(this,kr))!==os(i.enabled,me(this,kr))||o!==me(this,Io))&&fr(this,Dr,M_).call(this,o)}getOptimisticResult(e){const i=me(this,_n).getQueryCache().build(me(this,_n),e),n=this.createResult(i,e);return fz(this,n)&&(Ct(this,tn,n),Ct(this,Lh,this.options),Ct(this,Kl,me(this,kr).state)),n}getCurrentResult(){return me(this,tn)}trackResult(e,i){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),i==null||i(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&me(this,Ba).status==="pending"&&me(this,Ba).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(e){me(this,Oh).add(e)}getCurrentQuery(){return me(this,kr)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const i=me(this,_n).defaultQueryOptions(e),n=me(this,_n).getQueryCache().build(me(this,_n),i);return n.fetch().then(()=>this.createResult(n,i))}fetch(e){return fr(this,Dr,Fd).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),me(this,tn)))}createResult(e,i){var L;const n=me(this,kr),s=this.options,o=me(this,tn),h=me(this,Kl),l=me(this,Lh),d=e!==n?e.state:me(this,Rf),{state:g}=e;let p={...g},m=!1,y;if(i._optimisticResults){const O=this.hasListeners(),D=!O&&qE(e,i),G=O&&HE(e,n,i,s);(D||G)&&(p={...p,...nR(g.data,e.options)}),i._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:w,errorUpdatedAt:_,status:v}=p;y=p.data;let x=!1;if(i.placeholderData!==void 0&&y===void 0&&v==="pending"){let O;o!=null&&o.isPlaceholderData&&i.placeholderData===(l==null?void 0:l.placeholderData)?(O=o.data,x=!0):O=typeof i.placeholderData=="function"?i.placeholderData((L=me(this,Rh))==null?void 0:L.state.data,me(this,Rh)):i.placeholderData,O!==void 0&&(v="success",y=T_(o==null?void 0:o.data,O,i),m=!0)}if(i.select&&y!==void 0&&!x)if(o&&y===(h==null?void 0:h.data)&&i.select===me(this,Of))y=me(this,Bh);else try{Ct(this,Of,i.select),y=i.select(y),y=T_(o==null?void 0:o.data,y,i),Ct(this,Bh,y),Ct(this,Do,null)}catch(O){Ct(this,Do,O)}me(this,Do)&&(w=me(this,Do),y=me(this,Bh),_=Date.now(),v="error");const C=p.fetchStatus==="fetching",k=v==="pending",T=v==="error",N=k&&C,j=y!==void 0,E={status:v,fetchStatus:p.fetchStatus,isPending:k,isSuccess:v==="success",isError:T,isInitialLoading:N,isLoading:N,data:y,dataUpdatedAt:p.dataUpdatedAt,error:w,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!k,isLoadingError:T&&!j,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:T&&j,isStale:IC(e,i),refetch:this.refetch,promise:me(this,Ba),isEnabled:os(i.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=E.data!==void 0,D=E.status==="error"&&!O,G=$=>{D?$.reject(E.error):O&&$.resolve(E.data)},q=()=>{const $=Ct(this,Ba,E.promise=E_());G($)},U=me(this,Ba);switch(U.status){case"pending":e.queryHash===n.queryHash&&G(U);break;case"fulfilled":(D||E.data!==U.value)&&q();break;case"rejected":(!D||E.error!==U.reason)&&q();break}}return E}updateResult(){const e=me(this,tn),i=this.createResult(me(this,kr),this.options);if(Ct(this,Kl,me(this,kr).state),Ct(this,Lh,this.options),me(this,Kl).data!==void 0&&Ct(this,Rh,me(this,kr)),wm(i,e))return;Ct(this,tn,i);const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!me(this,Oh).size)return!0;const h=new Set(o??me(this,Oh));return this.options.throwOnError&&h.add("error"),Object.keys(me(this,tn)).some(l=>{const u=l;return me(this,tn)[u]!==e[u]&&h.has(u)})};fr(this,Dr,sR).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,Dr,L_).call(this)}},_n=new WeakMap,kr=new WeakMap,Rf=new WeakMap,tn=new WeakMap,Kl=new WeakMap,Lh=new WeakMap,Ba=new WeakMap,Do=new WeakMap,Of=new WeakMap,Bh=new WeakMap,Rh=new WeakMap,Vl=new WeakMap,Yl=new WeakMap,Io=new WeakMap,Oh=new WeakMap,Dr=new WeakSet,Fd=function(e){fr(this,Dr,O_).call(this);let i=me(this,kr).fetch(this.options,e);return e!=null&&e.throwOnError||(i=i.catch(rn)),i},A_=function(){fr(this,Dr,B_).call(this);const e=Go(this.options.staleTime,me(this,kr));if(rc||me(this,tn).isStale||!k_(e))return;const n=QB(me(this,tn).dataUpdatedAt,e)+1;Ct(this,Vl,Dl.setTimeout(()=>{me(this,tn).isStale||this.updateResult()},n))},j_=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,kr)):this.options.refetchInterval)??!1},M_=function(e){fr(this,Dr,R_).call(this),Ct(this,Io,e),!(rc||os(this.options.enabled,me(this,kr))===!1||!k_(me(this,Io))||me(this,Io)===0)&&Ct(this,Yl,Dl.setInterval(()=>{(this.options.refetchIntervalInBackground||DC.isFocused())&&fr(this,Dr,Fd).call(this)},me(this,Io)))},L_=function(){fr(this,Dr,A_).call(this),fr(this,Dr,M_).call(this,fr(this,Dr,j_).call(this))},B_=function(){me(this,Vl)&&(Dl.clearTimeout(me(this,Vl)),Ct(this,Vl,void 0))},R_=function(){me(this,Yl)&&(Dl.clearInterval(me(this,Yl)),Ct(this,Yl,void 0))},O_=function(){const e=me(this,_n).getQueryCache().build(me(this,_n),this.options);if(e===me(this,kr))return;const i=me(this,kr);Ct(this,kr,e),Ct(this,Rf,e.state),this.hasListeners()&&(i==null||i.removeObserver(this),e.addObserver(this))},sR=function(e){Si.batch(()=>{e.listeners&&this.listeners.forEach(i=>{i(me(this,tn))}),me(this,_n).getQueryCache().notify({query:me(this,kr),type:"observerResultsUpdated"})})},UB);function dz(r,e){return os(e.enabled,r)!==!1&&r.state.data===void 0&&!(r.state.status==="error"&&e.retryOnMount===!1)}function qE(r,e){return dz(r,e)||r.state.data!==void 0&&D_(r,e,e.refetchOnMount)}function D_(r,e,i){if(os(e.enabled,r)!==!1&&Go(e.staleTime,r)!=="static"){const n=typeof i=="function"?i(r):i;return n==="always"||n!==!1&&IC(r,e)}return!1}function HE(r,e,i,n){return(r!==e||os(n.enabled,r)===!1)&&(!i.suspense||r.state.status!=="error")&&IC(r,i)}function IC(r,e){return os(e.enabled,r)!==!1&&r.isStaleByTime(Go(e.staleTime,r))}function fz(r,e){return!wm(r.getCurrentResult(),e)}function UE(r){return{onFetch:(e,i)=>{var g,p,m,y,w;const n=e.options,s=(m=(p=(g=e.fetchOptions)==null?void 0:g.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,o=((y=e.state.data)==null?void 0:y.pages)||[],h=((w=e.state.data)==null?void 0:w.pageParams)||[];let l={pages:[],pageParams:[]},u=0;const d=async()=>{let _=!1;const v=k=>{nz(k,()=>e.signal,()=>_=!0)},x=eR(e.options,e.fetchOptions),C=async(k,T,N)=>{if(_)return Promise.reject();if(T==null&&k.pages.length)return Promise.resolve(k);const A=(()=>{const D={client:e.client,queryKey:e.queryKey,pageParam:T,direction:N?"backward":"forward",meta:e.options.meta};return v(D),D})(),E=await x(A),{maxPages:L}=e.options,O=N?iz:rz;return{pages:O(k.pages,E,L),pageParams:O(k.pageParams,T,L)}};if(s&&o.length){const k=s==="backward",T=k?pz:WE,N={pages:o,pageParams:h},j=T(n,N);l=await C(N,j,k)}else{const k=r??o.length;do{const T=u===0?h[0]??n.initialPageParam:WE(n,l);if(u>0&&T==null)break;l=await C(l,T),u++}while(u<k)}return l};e.options.persister?e.fetchFn=()=>{var _,v;return(v=(_=e.options).persister)==null?void 0:v.call(_,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},i)}:e.fetchFn=d}}}function WE(r,{pages:e,pageParams:i}){const n=e.length-1;return e.length>0?r.getNextPageParam(e[n],e,i[n],i):void 0}function pz(r,{pages:e,pageParams:i}){var n;return e.length>0?(n=r.getPreviousPageParam)==null?void 0:n.call(r,e[0],e,i[0],i):void 0}var Df,Xs,Vi,Xl,Zs,No,WB,gz=(WB=class extends iR{constructor(e){super();Wt(this,Zs);Wt(this,Df);Wt(this,Xs);Wt(this,Vi);Wt(this,Xl);Ct(this,Df,e.client),this.mutationId=e.mutationId,Ct(this,Vi,e.mutationCache),Ct(this,Xs,[]),this.state=e.state||aR(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){me(this,Xs).includes(e)||(me(this,Xs).push(e),this.clearGcTimeout(),me(this,Vi).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ct(this,Xs,me(this,Xs).filter(i=>i!==e)),this.scheduleGc(),me(this,Vi).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){me(this,Xs).length||(this.state.status==="pending"?this.scheduleGc():me(this,Vi).remove(this))}continue(){var e;return((e=me(this,Xl))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var h,l,u,d,g,p,m,y,w,_,v,x,C,k,T,N,j,A;const i=()=>{fr(this,Zs,No).call(this,{type:"continue"})},n={client:me(this,Df),meta:this.options.meta,mutationKey:this.options.mutationKey};Ct(this,Xl,rR({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(E,L)=>{fr(this,Zs,No).call(this,{type:"failed",failureCount:E,error:L})},onPause:()=>{fr(this,Zs,No).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>me(this,Vi).canRun(this)}));const s=this.state.status==="pending",o=!me(this,Xl).canStart();try{if(s)i();else{fr(this,Zs,No).call(this,{type:"pending",variables:e,isPaused:o}),me(this,Vi).config.onMutate&&await me(this,Vi).config.onMutate(e,this,n);const L=await((l=(h=this.options).onMutate)==null?void 0:l.call(h,e,n));L!==this.state.context&&fr(this,Zs,No).call(this,{type:"pending",context:L,variables:e,isPaused:o})}const E=await me(this,Xl).start();return await((d=(u=me(this,Vi).config).onSuccess)==null?void 0:d.call(u,E,e,this.state.context,this,n)),await((p=(g=this.options).onSuccess)==null?void 0:p.call(g,E,e,this.state.context,n)),await((y=(m=me(this,Vi).config).onSettled)==null?void 0:y.call(m,E,null,this.state.variables,this.state.context,this,n)),await((_=(w=this.options).onSettled)==null?void 0:_.call(w,E,null,e,this.state.context,n)),fr(this,Zs,No).call(this,{type:"success",data:E}),E}catch(E){try{await((x=(v=me(this,Vi).config).onError)==null?void 0:x.call(v,E,e,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((k=(C=this.options).onError)==null?void 0:k.call(C,E,e,this.state.context,n))}catch(L){Promise.reject(L)}try{await((N=(T=me(this,Vi).config).onSettled)==null?void 0:N.call(T,void 0,E,this.state.variables,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((A=(j=this.options).onSettled)==null?void 0:A.call(j,void 0,E,e,this.state.context,n))}catch(L){Promise.reject(L)}throw fr(this,Zs,No).call(this,{type:"error",error:E}),E}finally{me(this,Vi).runNext(this)}}},Df=new WeakMap,Xs=new WeakMap,Vi=new WeakMap,Xl=new WeakMap,Zs=new WeakSet,No=function(e){const i=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Si.batch(()=>{me(this,Xs).forEach(n=>{n.onMutationUpdate(e)}),me(this,Vi).notify({mutation:this,type:"updated",action:e})})},WB);function aR(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ra,Cs,If,GB,mz=(GB=class extends du{constructor(e={}){super();Wt(this,Ra);Wt(this,Cs);Wt(this,If);this.config=e,Ct(this,Ra,new Set),Ct(this,Cs,new Map),Ct(this,If,0)}build(e,i,n){const s=new gz({client:e,mutationCache:this,mutationId:++cg(this,If)._,options:e.defaultMutationOptions(i),state:n});return this.add(s),s}add(e){me(this,Ra).add(e);const i=hg(e);if(typeof i=="string"){const n=me(this,Cs).get(i);n?n.push(e):me(this,Cs).set(i,[e])}this.notify({type:"added",mutation:e})}remove(e){if(me(this,Ra).delete(e)){const i=hg(e);if(typeof i=="string"){const n=me(this,Cs).get(i);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&me(this,Cs).delete(i)}}this.notify({type:"removed",mutation:e})}canRun(e){const i=hg(e);if(typeof i=="string"){const n=me(this,Cs).get(i),s=n==null?void 0:n.find(o=>o.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const i=hg(e);if(typeof i=="string"){const s=(n=me(this,Cs).get(i))==null?void 0:n.find(o=>o!==e&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Si.batch(()=>{me(this,Ra).forEach(e=>{this.notify({type:"removed",mutation:e})}),me(this,Ra).clear(),me(this,Cs).clear()})}getAll(){return Array.from(me(this,Ra))}find(e){const i={exact:!0,...e};return this.getAll().find(n=>IE(i,n))}findAll(e={}){return this.getAll().filter(i=>IE(e,i))}notify(e){Si.batch(()=>{this.listeners.forEach(i=>{i(e)})})}resumePausedMutations(){const e=this.getAll().filter(i=>i.state.isPaused);return Si.batch(()=>Promise.all(e.map(i=>i.continue().catch(rn))))}},Ra=new WeakMap,Cs=new WeakMap,If=new WeakMap,GB);function hg(r){var e;return(e=r.options.scope)==null?void 0:e.id}var Oa,Fo,Cn,Da,Ha,im,I_,KB,yz=(KB=class extends du{constructor(i,n){super();Wt(this,Ha);Wt(this,Oa);Wt(this,Fo);Wt(this,Cn);Wt(this,Da);Ct(this,Oa,i),this.setOptions(n),this.bindMethods(),fr(this,Ha,im).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(i){var s;const n=this.options;this.options=me(this,Oa).defaultMutationOptions(i),wm(this.options,n)||me(this,Oa).getMutationCache().notify({type:"observerOptionsUpdated",mutation:me(this,Cn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ic(n.mutationKey)!==ic(this.options.mutationKey)?this.reset():((s=me(this,Cn))==null?void 0:s.state.status)==="pending"&&me(this,Cn).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=me(this,Cn))==null||i.removeObserver(this)}onMutationUpdate(i){fr(this,Ha,im).call(this),fr(this,Ha,I_).call(this,i)}getCurrentResult(){return me(this,Fo)}reset(){var i;(i=me(this,Cn))==null||i.removeObserver(this),Ct(this,Cn,void 0),fr(this,Ha,im).call(this),fr(this,Ha,I_).call(this)}mutate(i,n){var s;return Ct(this,Da,n),(s=me(this,Cn))==null||s.removeObserver(this),Ct(this,Cn,me(this,Oa).getMutationCache().build(me(this,Oa),this.options)),me(this,Cn).addObserver(this),me(this,Cn).execute(i)}},Oa=new WeakMap,Fo=new WeakMap,Cn=new WeakMap,Da=new WeakMap,Ha=new WeakSet,im=function(){var n;const i=((n=me(this,Cn))==null?void 0:n.state)??aR();Ct(this,Fo,{...i,isPending:i.status==="pending",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset})},I_=function(i){Si.batch(()=>{var n,s,o,h,l,u,d,g;if(me(this,Da)&&this.hasListeners()){const p=me(this,Fo).variables,m=me(this,Fo).context,y={client:me(this,Oa),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(s=(n=me(this,Da)).onSuccess)==null||s.call(n,i.data,p,m,y)}catch(w){Promise.reject(w)}try{(h=(o=me(this,Da)).onSettled)==null||h.call(o,i.data,null,p,m,y)}catch(w){Promise.reject(w)}}else if((i==null?void 0:i.type)==="error"){try{(u=(l=me(this,Da)).onError)==null||u.call(l,i.error,p,m,y)}catch(w){Promise.reject(w)}try{(g=(d=me(this,Da)).onSettled)==null||g.call(d,void 0,i.error,p,m,y)}catch(w){Promise.reject(w)}}}this.listeners.forEach(p=>{p(me(this,Fo))})})},KB),Qs,VB,bz=(VB=class extends du{constructor(e={}){super();Wt(this,Qs);this.config=e,Ct(this,Qs,new Map)}build(e,i,n){const s=i.queryKey,o=i.queryHash??BC(s,i);let h=this.get(o);return h||(h=new hz({client:e,queryKey:s,queryHash:o,options:e.defaultQueryOptions(i),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(h)),h}add(e){me(this,Qs).has(e.queryHash)||(me(this,Qs).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const i=me(this,Qs).get(e.queryHash);i&&(e.destroy(),i===e&&me(this,Qs).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Si.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return me(this,Qs).get(e)}getAll(){return[...me(this,Qs).values()]}find(e){const i={exact:!0,...e};return this.getAll().find(n=>DE(i,n))}findAll(e={}){const i=this.getAll();return Object.keys(e).length>0?i.filter(n=>DE(e,n)):i}notify(e){Si.batch(()=>{this.listeners.forEach(i=>{i(e)})})}onFocus(){Si.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Si.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qs=new WeakMap,VB),hi,$o,Po,Dh,Ih,zo,Fh,$h,YB,vz=(YB=class{constructor(r={}){Wt(this,hi);Wt(this,$o);Wt(this,Po);Wt(this,Dh);Wt(this,Ih);Wt(this,zo);Wt(this,Fh);Wt(this,$h);Ct(this,hi,r.queryCache||new bz),Ct(this,$o,r.mutationCache||new mz),Ct(this,Po,r.defaultOptions||{}),Ct(this,Dh,new Map),Ct(this,Ih,new Map),Ct(this,zo,0)}mount(){cg(this,zo)._++,me(this,zo)===1&&(Ct(this,Fh,DC.subscribe(async r=>{r&&(await this.resumePausedMutations(),me(this,hi).onFocus())})),Ct(this,$h,km.subscribe(async r=>{r&&(await this.resumePausedMutations(),me(this,hi).onOnline())})))}unmount(){var r,e;cg(this,zo)._--,me(this,zo)===0&&((r=me(this,Fh))==null||r.call(this),Ct(this,Fh,void 0),(e=me(this,$h))==null||e.call(this),Ct(this,$h,void 0))}isFetching(r){return me(this,hi).findAll({...r,fetchStatus:"fetching"}).length}isMutating(r){return me(this,$o).findAll({...r,status:"pending"}).length}getQueryData(r){var i;const e=this.defaultQueryOptions({queryKey:r});return(i=me(this,hi).get(e.queryHash))==null?void 0:i.state.data}ensureQueryData(r){const e=this.defaultQueryOptions(r),i=me(this,hi).build(this,e),n=i.state.data;return n===void 0?this.fetchQuery(r):(r.revalidateIfStale&&i.isStaleByTime(Go(e.staleTime,i))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(r){return me(this,hi).findAll(r).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(r,e,i){const n=this.defaultQueryOptions({queryKey:r}),s=me(this,hi).get(n.queryHash),o=s==null?void 0:s.state.data,h=QP(e,o);if(h!==void 0)return me(this,hi).build(this,n).setData(h,{...i,manual:!0})}setQueriesData(r,e,i){return Si.batch(()=>me(this,hi).findAll(r).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(r){var i;const e=this.defaultQueryOptions({queryKey:r});return(i=me(this,hi).get(e.queryHash))==null?void 0:i.state}removeQueries(r){const e=me(this,hi);Si.batch(()=>{e.findAll(r).forEach(i=>{e.remove(i)})})}resetQueries(r,e){const i=me(this,hi);return Si.batch(()=>(i.findAll(r).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...r},e)))}cancelQueries(r,e={}){const i={revert:!0,...e},n=Si.batch(()=>me(this,hi).findAll(r).map(s=>s.cancel(i)));return Promise.all(n).then(rn).catch(rn)}invalidateQueries(r,e={}){return Si.batch(()=>(me(this,hi).findAll(r).forEach(i=>{i.invalidate()}),(r==null?void 0:r.refetchType)==="none"?Promise.resolve():this.refetchQueries({...r,type:(r==null?void 0:r.refetchType)??(r==null?void 0:r.type)??"active"},e)))}refetchQueries(r,e={}){const i={...e,cancelRefetch:e.cancelRefetch??!0},n=Si.batch(()=>me(this,hi).findAll(r).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,i);return i.throwOnError||(o=o.catch(rn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(rn)}fetchQuery(r){const e=this.defaultQueryOptions(r);e.retry===void 0&&(e.retry=!1);const i=me(this,hi).build(this,e);return i.isStaleByTime(Go(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(r){return this.fetchQuery(r).then(rn).catch(rn)}fetchInfiniteQuery(r){return r.behavior=UE(r.pages),this.fetchQuery(r)}prefetchInfiniteQuery(r){return this.fetchInfiniteQuery(r).then(rn).catch(rn)}ensureInfiniteQueryData(r){return r.behavior=UE(r.pages),this.ensureQueryData(r)}resumePausedMutations(){return km.isOnline()?me(this,$o).resumePausedMutations():Promise.resolve()}getQueryCache(){return me(this,hi)}getMutationCache(){return me(this,$o)}getDefaultOptions(){return me(this,Po)}setDefaultOptions(r){Ct(this,Po,r)}setQueryDefaults(r,e){me(this,Dh).set(ic(r),{queryKey:r,defaultOptions:e})}getQueryDefaults(r){const e=[...me(this,Dh).values()],i={};return e.forEach(n=>{pf(r,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(r,e){me(this,Ih).set(ic(r),{mutationKey:r,defaultOptions:e})}getMutationDefaults(r){const e=[...me(this,Ih).values()],i={};return e.forEach(n=>{pf(r,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(r){if(r._defaulted)return r;const e={...me(this,Po).queries,...this.getQueryDefaults(r.queryKey),...r,_defaulted:!0};return e.queryHash||(e.queryHash=BC(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===RC&&(e.enabled=!1),e}defaultMutationOptions(r){return r!=null&&r._defaulted?r:{...me(this,Po).mutations,...(r==null?void 0:r.mutationKey)&&this.getMutationDefaults(r.mutationKey),...r,_defaulted:!0}}clear(){me(this,hi).clear(),me(this,$o).clear()}},hi=new WeakMap,$o=new WeakMap,Po=new WeakMap,Dh=new WeakMap,Ih=new WeakMap,zo=new WeakMap,Fh=new WeakMap,$h=new WeakMap,YB),oR=R.createContext(void 0),rr=r=>{const e=R.useContext(oR);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},GE=({client:r,children:e})=>(R.useEffect(()=>(r.mount(),()=>{r.unmount()}),[r]),a.jsx(oR.Provider,{value:r,children:e})),lR=R.createContext(!1),xz=()=>R.useContext(lR);lR.Provider;function _z(){let r=!1;return{clearReset:()=>{r=!1},reset:()=>{r=!0},isReset:()=>r}}var Cz=R.createContext(_z()),wz=()=>R.useContext(Cz),kz=(r,e,i)=>{const n=i!=null&&i.state.error&&typeof r.throwOnError=="function"?OC(r.throwOnError,[i.state.error,i]):r.throwOnError;(r.suspense||r.experimental_prefetchInRender||n)&&(e.isReset()||(r.retryOnMount=!1))},Sz=r=>{R.useEffect(()=>{r.clearReset()},[r])},Tz=({result:r,errorResetBoundary:e,throwOnError:i,query:n,suspense:s})=>r.isError&&!e.isReset()&&!r.isFetching&&n&&(s&&r.data===void 0||OC(i,[r.error,n])),Ez=r=>{if(r.suspense){const i=s=>s==="static"?s:Math.max(s??1e3,1e3),n=r.staleTime;r.staleTime=typeof n=="function"?(...s)=>i(n(...s)):i(n),typeof r.gcTime=="number"&&(r.gcTime=Math.max(r.gcTime,1e3))}},Nz=(r,e)=>r.isLoading&&r.isFetching&&!e,Az=(r,e)=>(r==null?void 0:r.suspense)&&e.isPending,KE=(r,e,i)=>e.fetchOptimistic(r).catch(()=>{i.clearReset()});function jz(r,e,i){var m,y,w,_;const n=xz(),s=wz(),o=rr(),h=o.defaultQueryOptions(r);(y=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,h);const l=o.getQueryCache().get(h.queryHash);h._optimisticResults=n?"isRestoring":"optimistic",Ez(h),kz(h,s,l),Sz(s);const u=!o.getQueryCache().get(h.queryHash),[d]=R.useState(()=>new e(o,h)),g=d.getOptimisticResult(h),p=!n&&r.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(v=>{const x=p?d.subscribe(Si.batchCalls(v)):rn;return d.updateResult(),x},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(h)},[h,d]),Az(h,g))throw KE(h,d,s);if(Tz({result:g,errorResetBoundary:s,throwOnError:h.throwOnError,query:l,suspense:h.suspense}))throw g.error;if((_=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||_.call(w,h,g),h.experimental_prefetchInRender&&!rc&&Nz(g,n)){const v=u?KE(h,d,s):l==null?void 0:l.promise;v==null||v.catch(rn).finally(()=>{d.updateResult()})}return h.notifyOnChangeProps?g:d.trackResult(g)}function Zt(r,e){return jz(r,uz)}function sr(r,e){const i=rr(),[n]=R.useState(()=>new yz(i,r));R.useEffect(()=>{n.setOptions(r)},[n,r]);const s=R.useSyncExternalStore(R.useCallback(h=>n.subscribe(Si.batchCalls(h)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=R.useCallback((h,l)=>{n.mutate(h,l).catch(rn)},[n]);if(s.error&&OC(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const Mz="/api";let Sm=null;function FC(r){Sm=r}function cR(){return Sm}class Lz{async request(e,i){const n={"Content-Type":"application/json",...i==null?void 0:i.headers};Sm&&(n["X-Dreamcontext-Vault"]=Sm);const s=await fetch(`${Mz}${e}`,{...i,headers:n});if(!s.ok){let o=`Request failed: ${s.status}`;try{const h=await s.json();h.message&&(o=h.message)}catch{}throw new Error(o)}return await s.json()}get(e){return this.request(e)}post(e,i){return this.request(e,{method:"POST",body:JSON.stringify(i)})}patch(e,i){return this.request(e,{method:"PATCH",body:JSON.stringify(i)})}put(e,i){return this.request(e,{method:"PUT",body:JSON.stringify(i)})}del(e){return this.request(e,{method:"DELETE"})}}const ze=new Lz;function hR(){const{data:r}=Zt({queryKey:["health"],queryFn:()=>ze.get("/health"),staleTime:6e4,retry:1});return{health:r,serverCurrent:(r==null?void 0:r.version)==="0.13.1"}}const Bz=[["vaults"],["launcher-status"],["launcher-federation-graph"],["connections"]];function gc(r){for(const e of Bz)r.invalidateQueries({queryKey:e})}function Rz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/register",e),onSuccess:()=>{gc(r)}})}function Oz(){return Zt({queryKey:["launcher-defaults"],queryFn:()=>ze.get("/launcher/defaults"),staleTime:1/0})}function Dz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/scaffold",e),onSuccess:()=>{gc(r)}})}function Iz(){return Zt({queryKey:["launcher-catalog"],queryFn:()=>ze.get("/launcher/catalog"),staleTime:1/0})}async function Fz(r){return ze.get(`/launcher/detect?path=${encodeURIComponent(r)}`)}function uR(r=!0){return Zt({queryKey:["launcher-status"],queryFn:()=>ze.get("/launcher/status"),enabled:r})}function dR(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/update",{name:e}),onSuccess:()=>{gc(r)}})}function $z(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/unregister",{name:e}),onSuccess:()=>{gc(r)}})}function Pz(){return Zt({queryKey:["launcher-federation-graph"],queryFn:()=>ze.get("/launcher/federation-graph")})}function zz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/connection",e),onSuccess:()=>{gc(r)}})}function qz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/connection/remove",e),onSuccess:()=>{gc(r)}})}function Hz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/shareable",e),onSuccess:()=>{gc(r)}})}const Pn={status:["brain-status"],settings:["brain-settings"],authStatus:["brain-auth-status"],discover:["brain-discover"],teamUpdates:["brain-team-updates"]};function Ty(r){r.invalidateQueries({queryKey:Pn.status}),r.invalidateQueries({queryKey:Pn.settings}),r.invalidateQueries({queryKey:Pn.teamUpdates})}function fR(){return Zt({queryKey:Pn.status,queryFn:()=>ze.get("/brain/status")})}function Uz(){return Zt({queryKey:Pn.settings,queryFn:()=>ze.get("/brain/settings")})}function Wz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/settings",{enabled:e}),onSuccess:e=>{r.setQueryData(Pn.settings,e),Ty(r)}})}function $C(){return Zt({queryKey:Pn.authStatus,queryFn:()=>ze.get("/brain/auth/status")})}function Gz(){return sr({mutationFn:()=>ze.post("/brain/auth/device/start",{})})}function Kz(){return sr({mutationFn:r=>ze.post("/brain/auth/device/poll",{sessionId:r})})}function Vz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/auth/token",{token:e}),onSuccess:e=>r.setQueryData(Pn.authStatus,e)})}function Yz(){const r=rr();return sr({mutationFn:()=>ze.post("/brain/auth/logout",{}),onSuccess:e=>r.setQueryData(Pn.authStatus,e)})}function Xz(r){return Zt({queryKey:Pn.discover,queryFn:()=>ze.get("/brain/discover"),select:e=>e.repos,enabled:r,retry:!1})}function Zz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/create",e),onSuccess:()=>Ty(r)})}function Qz(){return sr({mutationFn:r=>ze.post("/brain/attach-preview",{url:r})})}function Jz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/attach",e),onSuccess:()=>Ty(r)})}function e7(){const r=rr();return sr({mutationFn:()=>ze.post("/brain/disconnect",{}),onSuccess:()=>Ty(r)})}function pR(){return Zt({queryKey:Pn.teamUpdates,queryFn:()=>ze.get("/brain/team/updates"),select:r=>r.vaults})}function gR(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/team/fetch",e?{vault:e}:{}),onSuccess:()=>{r.invalidateQueries({queryKey:Pn.teamUpdates}),r.invalidateQueries({queryKey:Pn.status})}})}const t7="modulepreload",r7=function(r){return"/"+r},VE={},Xt=function(e,i,n){let s=Promise.resolve();if(i&&i.length>0){let h=function(d){return Promise.all(d.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=h(i.map(d=>{if(d=r7(d),d in VE)return;VE[d]=!0;const g=d.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=g?"stylesheet":t7,g||(m.as="script"),m.crossOrigin="",m.href=d,u&&m.setAttribute("nonce",u),document.head.appendChild(m),g)return new Promise((y,w)=>{m.addEventListener("load",y),m.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(h){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=h,window.dispatchEvent(l),!l.defaultPrevented)throw h}return s.then(h=>{for(const l of h||[])l.status==="rejected"&&o(l.reason);return e().catch(o)})};function un(){return!!window.__TAURI_INTERNALS__}const i7='button, input, a, select, textarea, [role="button"], [data-no-drag]';function PC(r){return r instanceof Element&&r.closest(i7)!==null}async function n7(r){if(un()&&!PC(r))try{const{getCurrentWindow:e}=await Xt(async()=>{const{getCurrentWindow:i}=await import("./window-DmNpeJAL.js").then(n=>n.w);return{getCurrentWindow:i}},__vite__mapDeps([0,1,2]));await e().startDragging()}catch{}}async function s7(){if(un())try{const{getCurrentWindow:r}=await Xt(async()=>{const{getCurrentWindow:e}=await import("./window-DmNpeJAL.js").then(i=>i.w);return{getCurrentWindow:e}},__vite__mapDeps([0,1,2]));await r().close()}catch{}}function mR(r){if(r.button!==0)return;const e=r.target;if(PC(e))return;const i=r.clientX,n=r.clientY,s=h=>{(Math.abs(h.clientX-i)>4||Math.abs(h.clientY-n)>4)&&(o(),n7(e))},o=()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",s),window.addEventListener("mouseup",o)}async function yR(r){if(un()&&!PC(r))try{const{getCurrentWindow:e}=await Xt(async()=>{const{getCurrentWindow:i}=await import("./window-DmNpeJAL.js").then(n=>n.w);return{getCurrentWindow:i}},__vite__mapDeps([0,1,2]));await e().toggleMaximize()}catch{}}async function a7(){if(un()){const{open:e}=await Xt(async()=>{const{open:n}=await import("./index-NsrznfmA.js");return{open:n}},__vite__mapDeps([3,1])),i=await e({directory:!0,multiple:!1});return typeof i=="string"?i:null}const r=window.prompt("Enter an absolute path to a dreamcontext project:");return r&&r.trim()?r.trim():null}async function o7(){if(un())try{const{open:e}=await Xt(async()=>{const{open:n}=await import("./index-NsrznfmA.js");return{open:n}},__vite__mapDeps([3,1])),i=await e({directory:!1,multiple:!0});return Array.isArray(i)?i.filter(n=>typeof n=="string"):typeof i=="string"?[i]:[]}catch{return[]}const r=window.prompt("Enter absolute file path(s), comma-separated:");return r?r.split(",").map(e=>e.trim()).filter(Boolean):[]}function bR(r,e){return new Promise((i,n)=>{r.once("tauri://created",()=>i()),r.once("tauri://error",s=>n(new Error(`${e} window create failed: ${String(s.payload)}`)))})}async function vR(r){if(un()){const{WebviewWindow:e}=await Xt(async()=>{const{WebviewWindow:o}=await import("./webviewWindow-BbG9Cr7f.js");return{WebviewWindow:o}},__vite__mapDeps([4,0,1,2])),i=`vault-${r.replace(/[^a-zA-Z0-9_-]/g,"-")}`,n=await e.getByLabel(i);if(n){await n.setFocus();return}const s=new e(i,{url:`${window.location.origin}/?vault=${encodeURIComponent(r)}`,title:`dreamcontext — ${r}`,width:1280,height:800,titleBarStyle:"overlay",hiddenTitle:!0,dragDropEnabled:!1});await bR(s,`vault "${r}"`);return}window.open(`/?vault=${encodeURIComponent(r)}`,"_blank")}async function l7(){if(un()){const{WebviewWindow:r}=await Xt(async()=>{const{WebviewWindow:n}=await import("./webviewWindow-BbG9Cr7f.js");return{WebviewWindow:n}},__vite__mapDeps([4,0,1,2])),e=await r.getByLabel("main");if(e){await e.setFocus();return}const i=new r("main",{url:`${window.location.origin}/`,title:"dreamcontext",width:1280,height:800,titleBarStyle:"overlay",hiddenTitle:!0,dragDropEnabled:!1});await bR(i,"launcher");return}window.location.assign(`${window.location.origin}/`)}async function YE(r){await vR(r)}function Tm({exists:r,needsUpdate:e,title:i,className:n}){const s=r?e?"stale":"ok":"gone";return a.jsx("span",{className:`vault-dot vault-dot--${s}${n?` ${n}`:""}`,title:i,"aria-hidden":"true"})}const c7={en:{"nav.brain":"Map","nav.tasks":"Tasks","nav.roadmap":"Roadmap","nav.labpage":"Insights","nav.core":"Core","nav.knowledge":"Knowledge","nav.sleep":"Sleep Cycle","nav.council":"Council","nav.settings":"Settings","nav.packs":"Packs","nav.taxonomy":"Taxonomy","nav.about":"What is this?","nav.lab":"Lab","nav.beta":"Beta","nav.group.workspace":"Workspace","nav.group.memory":"Memory","nav.group.brain":"Brain","nav.group.control":"Control Panel","nav.collapse":"Collapse","nav.expand":"Expand","council.title":"Council","council.tab.verdict":"Verdict","council.tab.matrix":"Matrix","council.tab.transcript":"Transcript","council.search.placeholder":"Search sessions…","council.search.matrix":"Filter cells by text…","council.search.transcript":"Search transcript…","council.filter.all":"All","council.filter.status":"Status","council.inspector.empty":"Select a persona or cell to inspect.","council.inspector.selectCell":"Select a cell in the matrix for round details.","council.verdict.awaitingSynthesis":"Awaiting synthesis","council.verdict.synthPending":"The final report will appear here once the synthesizer runs.","council.empty.list":"No debates yet.","council.empty.detail":"Select a council session from the list.","council.lab.tagline":"A panel of AI personas debates a hard decision across rounds, then synthesizes a verdict you can trace.","council.new":"New debate","council.empty.cta":"Start your first debate","council.empty.nomatch":"No debates match your search.","tasks.title":"Tasks","tasks.create":"New Task","tasks.filter":"Filter","tasks.todo":"To Do","tasks.in_progress":"In Progress","tasks.in_review":"In Review","tasks.completed":"Completed","tasks.name":"Task Name","tasks.description":"Description","tasks.priority":"Priority","tasks.tags":"Tags","tasks.save":"Create Task","tasks.cancel":"Cancel","tasks.changelog":"Changelog","tasks.add_entry":"Add Entry","tasks.customFields.sectionLabel":"Custom","rice.title":"RICE","rice.reach":"Reach","rice.impact":"Impact","rice.confidence":"Confidence","rice.effort":"Effort","rice.score":"Score","rice.clear":"Clear RICE","rice.tooltip.reach":"How many people / sessions / units affected (1–10)","rice.tooltip.impact":"How much per affected unit (1=minimal, 5=massive)","rice.tooltip.confidence":"How sure are you? (25, 50, 75, 100)","rice.tooltip.effort":"Person-weeks (0.5–8 typical, max 52)","rice.empty":"Not rated","sort.rice":"RICE score","filter.min_rice":"Min RICE","priority.critical":"Critical","priority.high":"High","priority.medium":"Medium","priority.low":"Low","sleep.title":"Sleep State","sleep.debt":"Debt","sleep.level":"Level","sleep.last_sleep":"Last Sleep","sleep.sessions":"Sessions","sleep.alert":"Alert","sleep.drowsy":"Drowsy","sleep.sleepy":"Sleepy","sleep.must_sleep":"Must Sleep","sleep.active":"Sleeping","sleep.waiting":"Waiting to sleep…","sleep.menu.details":"Show sleep details","sleep.menu.run":"Run sleep agent","sleep.menu.run.disabled":"Agent unavailable — needs the desktop app with node-pty + the Claude CLI","sleep.menu.run.active":"A consolidation is already in progress","sleep.menu.run.waiting":"Waiting for the sleep agent to start…","sleep.changelog":"Changelog","sleep.changelog.pending":"Will fold into next sleep","sleep.changelog.breaking":"BREAKING","sleep.changelog.earlier":"earlier entries not shown","sleep.summary":"Summary","sleep.never":"Never","sleep.tagline.alert":"Wide awake. Your project memory is fresh and fully consolidated.","sleep.tagline.drowsy":"Resting easy. A handful of new memories have gathered since the last sleep.","sleep.tagline.sleepy":"Getting drowsy. A consolidation will soon weave recent work into long-term memory.","sleep.tagline.must_sleep":"It's time to sleep. Run a consolidation to fold recent work into long-term memory.","sleep.next.title":"Next sleep will consolidate","sleep.next.subtitle":"Everything captured since the last sleep — folded into long-term memory on the next cycle.","sleep.next.change":"change","sleep.next.changes":"changes","sleep.dashboard_changes":"Dashboard Changes","sleep.cloud.title":"Sleep cloud","sleep.cloud.subtitle":"Everything gathered since your last sleep — the next consolidation will weave it all into long-term memory.","sleep.cloud.item":"item","sleep.cloud.items":"items","sleep.cloud.stat.sessions":"Work sessions","sleep.cloud.stat.dashboard":"Dashboard edits","sleep.cloud.stat.highlights":"Highlights","sleep.cloud.stat.changelog":"Captured","sleep.cloud.group.dashboard":"Dashboard activity","sleep.cloud.group.dashboard.hint":"Manual edits you made in the dashboard — tasks, knowledge, features and more.","sleep.cloud.group.sessions":"Work sessions","sleep.cloud.group.sessions.hint":"Coding sessions since the last sleep, scored into the debt meter.","sleep.cloud.group.highlights":"Highlights","sleep.cloud.group.highlights.hint":"High-signal moments auto-tagged during work — processed first.","sleep.cloud.group.changelog":"Captured changelog","sleep.cloud.group.changelog.hint":"Shipped notes captured since the last sleep.","sleep.cloud.empty.title":"The cloud is clear","sleep.cloud.empty.sub":"Your memory is fully consolidated. New sessions and dashboard edits will gather here until the next sleep.","sleep.cloud.active":"Active","sleep.entity.task":"Tasks","sleep.entity.knowledge":"Knowledge","sleep.entity.feature":"Features","sleep.entity.core":"Core","sleep.entity.sleep":"Sleep","core.title":"Core Files","knowledge.title":"Knowledge","knowledge.pin":"Pin","knowledge.unpin":"Unpin","knowledge.search":"Search knowledge...","knowledge.fullscreen":"Full screen","settings.title":"Settings","settings.nav.platforms":"Platforms","settings.nav.tasks":"Cloud Tasks","settings.nav.format":"Task Format","settings.nav.memory":"Memory","settings.nav.connections":"Connections","settings.nav.brain":"Cloud sync","settings.nav.agents":"Agents","settings.nav.sleepy":"Sleepy","settings.navdesc.platforms":"Which AI coding agents this project uses","settings.navdesc.tasks":"Sync tasks to ClickUp or GitHub","settings.navdesc.format":"Add custom fields to your tasks","settings.navdesc.memory":"Control Claude's built-in memory","settings.navdesc.connections":"Share knowledge between your projects","settings.navdesc.brain":"Back up and share your project memory on GitHub","settings.navdesc.agents":"The in-app Claude Code panel","settings.navdesc.sleepy":"Notch quick-capture hotkey","settings.desc.platforms":"Tell dreamcontext which AI coding agents you use. It installs the right hooks and context files for each one so your project memory loads automatically.","settings.desc.tasks":"By default your tasks live in local files. Turn this on to mirror them to a cloud backend (ClickUp or GitHub Issues) so your team can see them too — recall, snapshots and this dashboard keep working either way.","settings.desc.memory":"dreamcontext can be the single source of your project's memory instead of Claude Code's built-in memory file.","settings.desc.brain":"Sign in with GitHub and connect a brain repo to back up your project memory to the cloud and share it with your team. Off by default — nothing syncs until you turn it on.","settings.agents.title":"Agents — in-app Claude Code","settings.agents.enable":"Enable the Agents surface","settings.agents.enable_hint":"Show the in-app agent launcher (the corner button and session dock). Turning this off hides it and closes any open agent view; running sessions keep going in the background.","settings.agents.restore_tabs":"Reopen past tabs on launch","settings.agents.restore_tabs_hint":"When the app starts, restore the agent/terminal tabs from your last session (agents resume their conversation). Off = always start with a clean slate.","settings.agents.default_agent":"Default agent","settings.agents.default_agent_hint":"Which agent a new session runs. Only Claude Code is available for now.","settings.agents.agent.claude":"Claude Code","settings.agents.auto_title":"Auto-name tabs from your first message","settings.agents.auto_title_hint":"Off by default. When on, after a new agent session's first turn a fast Haiku model reads your opening message and renames the tab to a short, descriptive title. Only tabs still named “Agent N” are renamed — tabs you've renamed yourself are never touched.","settings.agents.hotkey":"Quick open/close hotkey","settings.agents.hotkey_hint":"Press this anywhere in the app to open or close the Agents view. Default ⌃A. Click the field and press a new combo to rebind — or double-tap a single modifier (Ctrl, Option, ⌘, or Shift) to bind it as ⌃⌃-style two-taps. Backspace clears it. A chord yields to a focused terminal (close it with Esc or the collapse button); a double-tap toggles from anywhere, even inside a terminal.","settings.agents.hotkey_capturing":"Press a combo, or double-tap a modifier…","settings.platforms":"Platforms","settings.save":"Save","settings.saving":"Saving...","settings.saved":"Saved","settings.no_config":"No configuration file found. Saving will create one with your selections.","settings.platform.claude":"Claude (Anthropic)","settings.packs.installed":"Installed","settings.memory":"Memory","settings.brain":"Cloud sync","settings.native_memory.label":"Disable Claude's native memory","settings.native_memory.hint":"Recommended — dreamcontext becomes the single source of project memory instead of Claude Code’s built-in MEMORY.md.","settings.tasks":"Tasks","settings.cloud_tasks.label":"Cloud Task Management","settings.cloud_tasks.hint":"Tasks live in a remote backend; a gitignored local mirror keeps recall, snapshots, and the dashboard working unchanged.","settings.cloud_tasks.provider":"Provider","settings.cloud_tasks.provider.clickup":"ClickUp","settings.cloud_tasks.provider.github":"GitHub","settings.cloud_tasks.team":"Team ID","settings.cloud_tasks.space":"Space ID","settings.cloud_tasks.list":"List ID","settings.cloud_tasks.token_hint":"The key is saved to a gitignored secrets file (never in this config). You can also set it from the CLI with `dreamcontext config clickup-token`.","settings.cloud_tasks.github.hint":"Tasks sync to a GitHub repository's Issues; a gitignored local mirror keeps recall, snapshots, and the dashboard working unchanged.","settings.cloud_tasks.github.owner":"Owner","settings.cloud_tasks.github.repo":"Repository","settings.cloud_tasks.github.repo_picker":"Discovered repository","settings.cloud_tasks.github.pick":"Pick the repository to sync to…","settings.cloud_tasks.github.search":"Search repositories…","settings.cloud_tasks.github.token_hint":"The token is saved to a gitignored secrets file (never in this config). You can also set it from the CLI with `dreamcontext config github-token`. Needs `repo` scope (classic) or Issues read/write + Metadata (fine-grained).","settings.cloud_tasks.github.provision":"Provision labels","settings.cloud_tasks.github.provisioning":"Provisioning…","settings.cloud_tasks.list_pick":"Pick the list to sync to…","settings.cloud_tasks.list_search":"Search lists…","settings.cloud_tasks.keep_current":"(keep current)","settings.cloud_tasks.list_label":"List","settings.cloud_tasks.provision":"Provision fields","settings.cloud_tasks.provisioning":"Provisioning…","settings.cloud_tasks.test":"Test connection","settings.cloud_tasks.testing":"Testing…","settings.cloud_tasks.test_ok":"Connected as","settings.cloud_tasks.status":"Sync status","settings.cloud_tasks.pending":"pending push","settings.cloud_tasks.conflicts":"conflict(s) preserved in state/.conflicts/","settings.cloud_tasks.api_key":"API key","settings.cloud_tasks.api_key_placeholder":"Paste your API key…","settings.cloud_tasks.api_key_none":"No key saved yet — paste it above, then Test connection (it saves automatically).","settings.cloud_tasks.api_key_set":"Key saved ✓","settings.cloud_tasks.api_key_env":"Using an environment variable ✓ (overrides any saved key)","settings.cloud_tasks.preview_title":"These custom fields will be created on the list:","settings.cloud_tasks.github.preview_title":"These labels will be created on the repository:","settings.cloud_tasks.preview_will_create":"Will create ({n})","settings.cloud_tasks.preview_existing":"Already exist ({n})","settings.cloud_tasks.provision_confirm":"Create {n} now","settings.cloud_tasks.provision_creating":"Creating…","settings.cloud_tasks.provision_cancel":"Cancel","settings.cloud_tasks.provision_created":"Created","settings.cloud_tasks.provision_backfilled":"backfilled {n} value(s)","settings.cloud_tasks.provision_nothing":"All recommended fields already exist.","settings.federation":"Cross-Project Federation","settings.desc.connections":"Connect this project to your other dreamcontext projects so they can share knowledge. Everything here is off until you opt in.","federation.board.title":"Connection map","federation.board.desc":"Each card is one of your projects. Drag from one project to another to make the first read the second live. Click a project to see who reads it or to let others read it; click a wire to remove it.","federation.advanced":"More — list view, topic filters, inbox & sync preview","federation.vaults.desc":"Every dreamcontext project on this machine that this one can connect to.","federation.connections.desc":"Projects this one is already linked with. Set the direction and, optionally, limit which topics flow.","federation.add.desc":"Link a new project and choose whether you read from it, share to it, or both.","federation.inbox.desc":"Knowledge that connected projects have sent you. It folds into your memory on the next sleep cycle.","federation.preview.title":"Preview what you would share","federation.intro.title":"What is cross-project federation?","federation.intro.body":"Federation lets your projects share knowledge with each other. Connect two projects and one can “read” the other — its agent can recall decisions, changelog and knowledge from across the link. It’s off by default: nothing is shared until you opt in.","federation.intro.step1":"1. Turn on Sharing below so other projects are allowed to read this one.","federation.intro.step2":"2. Add a connection to a peer and choose the direction — read it, share to it, or both.","federation.intro.step3":"3. Incoming knowledge lands in the digest inbox and is folded in on the next sleep cycle.","federation.sharing":"Sharing","federation.shareable.label":"Let other projects read this one","federation.shareable.hint":"When on, projects you’ve connected may pull this project’s knowledge into their recall. Off = private (the default). This only controls who may READ you — it never stops you reading others.","federation.vaults":"Registered vaults","federation.vaults.empty":"No vaults registered. Run `dreamcontext vaults discover --register` to add sibling projects.","federation.current":"This project","federation.connections":"Connections","federation.connections.empty":"No connections yet. Add a peer below to read or share knowledge across projects.","federation.stale":"Stale","federation.remove":"Remove","federation.direction":"Direction","federation.direction.out":"→ Share to","federation.direction.in":"← Read from","federation.direction.both":"⇄ Two-way","federation.direction.out.hint":"Your knowledge flows to this peer, and your recall can reach into theirs.","federation.direction.in.hint":"Accept this peer’s digests into your inbox.","federation.direction.both.hint":"Read from and share to this peer.","federation.topics.placeholder":"topics (comma-separated, blank = all)","federation.topics.label":"Limit to topics","federation.add":"Add a connection","federation.add.pick":"Pick a vault…","federation.add.none":"Every registered vault is already connected (or none are available to add).","federation.connect":"Connect","federation.error.pick_vault":"Pick a vault to connect to.","federation.inbox":"Digest inbox","federation.inbox.pending":"Pending","federation.inbox.consumed":"Consumed","federation.inbox.empty":"Inbox is empty — no peer digests waiting. The next sleep cycle drains it.","federation.inbox.quarantined":"Quarantined (incompatible schema — left in place)","federation.inbox.from":"from","federation.preview":"Preview sync","federation.preview.running":"Previewing…","federation.preview.hint":"Dry-run: computes the digests that would be pushed to consenting peers. Writes nothing.","federation.preview.none":"No out/both connections to preview.","federation.preview.stale":"unreachable (stale)","federation.preview.noconsent":"no consent (peer must link in/both back)","federation.preview.nodelta":"no new entries since last sync","federation.preview.entries":"entries would be pushed","federation.map.help":"How it works","federation.map.connections":"Connections","federation.map.hint.default":"Drag from one project to another to connect them. Click a project for details, or click a wire to edit it.","federation.map.hint.first":"Try it: drag from one project card onto another — the first will read the second, live.","federation.map.hint.armed":"Now click the project “{name}” should read. Esc cancels.","federation.map.legend.live":"reads — live, nothing copied","federation.map.legend.inert":"not Readable yet","federation.map.legend.ok":"up to date","federation.map.legend.stale":"needs update","federation.map.legend.gone":"folder missing","federation.map.note.connected":"“{from}” now reads “{to}” — live.","federation.map.note.inert":"“{from}” now reads “{to}”, but “{to}” isn’t Readable yet — the wire stays inert until you switch it on.","federation.map.note.makeReadable":"Turn on Readable","federation.map.note.readable":"“{name}” is now Readable — its wires are live.","federation.map.note.failed":"Failed to connect.","federation.map.wire.reads":"reads","federation.map.wire.mutual":"read each other","federation.map.wiremenu.title":"Connection","federation.map.wiremenu.row":"“{from}” reads “{to}”","federation.map.wiremenu.notLive":"not live — “{name}” isn’t Readable","federation.map.wiremenu.remove":"Remove","federation.map.wiremenu.makeReadable":"Make “{name}” Readable","federation.map.conns.title":"All connections","federation.map.conns.empty":"No connections yet — drag one project onto another to create the first wire.","federation.map.conns.mutual":"{a} ⇄ {b} — read each other","federation.map.conns.reads":"{from} reads {to}","federation.map.conns.inert":" — not Readable yet","federation.map.detail.gone":"Folder is gone.","federation.map.detail.behind":"Behind: v{from} → v{to}","federation.map.detail.current":"Up to date (v{v})","federation.map.detail.update":"Update","federation.map.detail.updating":"Updating…","federation.map.detail.readable":"Readable — let connected projects read this one","federation.map.detail.connect":"Connect to another project…","federation.map.detail.connections":"Connections","federation.map.detail.none":"No connections yet.","federation.map.detail.youRead":"Reads “{name}” live","federation.map.detail.readsYou":"“{name}” reads this project live","federation.map.detail.notLive":" — not Readable yet","federation.map.status.loading":"Loading the connection map…","federation.map.status.error":"Failed to load the connection map.","federation.map.empty.title":"Nothing to connect yet","federation.map.empty.body":"Register at least two projects, then wire them so one can read the other’s memory live.","federation.map.guide.title":"How the connection map works","federation.map.guide.def":"App reads Libs’ canonical memory live during recall — a reference, never a copy. Each project stays the single source of truth for its own knowledge.","federation.map.guide.step1":"Drag from one project onto another — the first now reads the second.","federation.map.guide.step2":"Click a project to see its connections and switch on Readable (violet dot) so others may read it.","federation.map.guide.step3":"Click any wire to remove it — or to make its target Readable if it isn’t live yet.","federation.map.guide.keys":"Shortcuts: + / − zoom · 0 fit · Esc cancel · ? this guide","federation.map.guide.gotit":"Got it","federation.map.guide.start":"Start wiring","federation.map.zoom.in":"Zoom in","federation.map.zoom.out":"Zoom out","federation.map.zoom.fit":"Fit to view","packs.title":"Skill Packs","packs.section.packs":"Packs","packs.section.standalone":"Standalone Skills","packs.detail.base":"Base Skill","packs.detail.subskills":"Sub-Skills","packs.detail.agents":"Related Agents","packs.detail.close":"Close","packs.action.install":"Install","packs.action.remove":"Remove","packs.action.installing":"Installing…","packs.action.removing":"Removing…","packs.action.error":"Action failed","update.available":"Update available","update.title":"Update Available","update.dismiss":"Dismiss","update.managePacks":"Manage packs →","update.upgradeAll":"Upgrade everything","update.upgradeHint":"Updates the CLI, this desktop app, and every project — in one step.","update.upgrading":"Upgrading…","update.upgraded":"Upgrade complete.","update.relaunch":"Relaunch to finish","update.relaunchHint":"Quit and reopen dreamcontext to apply the new version.","update.upgradeFailed":"Upgrade failed.","update.retry":"Try again","taxonomy.title":"Taxonomy","common.loading":"Loading...","common.error":"Error","common.empty":"Nothing here yet.","common.close":"Close","common.cancel":"Cancel","brain.sidebar.connect":"Connect GitHub","brain.sidebar.setup":"Set up team sync","brain.sidebar.synced":"Synced","brain.auth.title":"GitHub sign-in","brain.auth.continueWithGithub":"Continue with GitHub","brain.auth.signedIn":"Signed in with GitHub","brain.auth.signedInAs":"Signed in as {login}","brain.auth.signOut":"Sign out","brain.auth.scopeDisclosure":"This grants access to all your private repositories — GitHub does not offer a narrower scope for the device flow. If you would rather limit access to one repo, use a fine-grained personal access token instead.","brain.auth.device.hint":"Enter this code on GitHub to finish connecting.","brain.auth.device.open":"Open GitHub","brain.auth.device.waiting":"Waiting for you to approve on GitHub…","brain.auth.device.starting":"Starting…","brain.auth.device.denied":"Sign-in was denied on GitHub.","brain.auth.device.expired":"This code expired. Try again.","brain.auth.device.error":"Something went wrong signing in with GitHub.","brain.auth.oauthUnavailable":"Connect with a personal access token below. Create a fine-grained token limited to just your brain repo, with Contents read/write access, then paste it here.","brain.auth.pat.recommend":"Prefer a fine-grained token? Use a personal access token instead","brain.auth.pat.hide":"Hide token form","brain.auth.pat.hint":"Recommended for tighter scope: create a fine-grained personal access token limited to just the brain repo, with Contents read/write access, and paste it below.","brain.auth.pat.placeholder":"ghp_… or github_pat_…","brain.auth.pat.submit":"Connect","brain.auth.pat.submitting":"Connecting…","brain.setup.title":"Brain repo","brain.setup.signInFirst":"Sign in with GitHub above to set up your brain repo.","brain.setup.alreadyConnected":"Connected to","brain.setup.switchHint":"To switch to a different repo, attach the new one below — or disconnect first.","brain.setup.disconnect":"Disconnect","brain.setup.disconnecting":"Disconnecting…","brain.setup.notConnected":"No brain repo connected yet — create, discover, or attach one below.","brain.setup.inTree":"No brain repo connected. Your project memory is committed in-tree inside your code repo ({origin}) and does not sync to the cloud on its own.","brain.setup.tab.create":"Create","brain.setup.tab.discover":"Discover","brain.setup.tab.attach":"Attach","brain.create.name":"Repository name","brain.create.namePlaceholder":"my-project-brain","brain.create.makePublic":"Make this repository public","brain.create.publicWarning":"A public brain repo means anyone can read your project memory — tasks, knowledge, decisions and changelog. Only make it public if that is intended.","brain.create.publicConfirm":"I understand this repository's contents will be public.","brain.create.creating":"Creating…","brain.create.submit":"Create repository","brain.create.nameRequired":"Enter a repository name first.","brain.create.confirmPublicFirst":"Confirm the public-repository checkbox first, or keep the repo private.","brain.create.scrubBlocked":"Creation blocked — likely secrets found in your project memory. Remove them and try again.","brain.discover.find":"Find my brain repos","brain.discover.loading":"Searching your GitHub repositories…","brain.discover.error":"Could not search your GitHub repositories.","brain.discover.empty":"No brain repos found in your GitHub account.","brain.discover.private":"Private","brain.discover.select":"Select","brain.attach.url":"Repository URL","brain.attach.preview":"Preview","brain.attach.previewing":"Checking…","brain.attach.unreachable":"Could not reach this repository.","brain.attach.refused":"This repository was refused.","brain.attach.trustTitle":"Only attach a repo you control","brain.attach.trustBody":"Attaching loads this repository's content verbatim into every future AI session — including for anyone else who attaches it. Only attach a repo that you and your team control.","brain.attach.repo":"Repository","brain.attach.visibility":"Visibility","brain.attach.private":"Private","brain.attach.publicVisibility":"Public","brain.attach.isBrainRepo":"Brain repo","brain.attach.notBrainRepo":"This does not look like a dreamcontext brain repo.","brain.attach.branch":"Default branch","brain.attach.iTrust":"I trust this repository and its content.","brain.attach.attaching":"Attaching…","brain.attach.submit":"Attach repository","brain.attach.bootstrapBlocked":"Attached — but the first push was blocked: something in your project memory looks like a secret. Remove it, then run a sync.","brain.cloudSync.label":"Cloud sync","brain.cloudSync.hint":"Sync your project memory to a GitHub repository so your team can share it.","brain.cloudSync.source.explicit":"set here","brain.cloudSync.source.derived":"from config","brain.team.title":"Team updates","brain.team.updates":"{n} updates","brain.team.updatesShort":"updates","brain.team.pending":"Update pending","brain.team.awaitingAgent":"Awaiting agent merge","brain.team.checkNow":"Check now","brain.team.checking":"Checking…"}},xR=R.createContext(null);function XE({children:r}){const[e,i]=R.useState("en"),n=s=>{var o;return((o=c7[e])==null?void 0:o[s])??s};return a.jsx(xR.Provider,{value:{locale:e,setLocale:i,t:n},children:r})}function Fr(){const r=R.useContext(xR);if(!r)throw new Error("useI18n must be used within I18nProvider");return r}function _R({vaultName:r,compact:e}){const{t:i}=Fr(),{data:n}=pR(),s=gR(),[o,h]=R.useState(!1),l=r?(n??[]).filter(p=>p.name===r):n??[],u=l.reduce((p,m)=>p+(m.updates??0),0),d=l.some(p=>p.pendingAgentMerge);if(u===0&&!d)return null;const g=()=>s.mutate(r);return a.jsxs("div",{className:"update-badge team-updates-badge",children:[a.jsxs("button",{type:"button",className:"update-badge-trigger",onClick:()=>h(p=>!p),"aria-expanded":o,title:i("brain.team.title"),children:[a.jsx("span",{className:"update-badge-dot"}),!e&&a.jsx("span",{className:"update-badge-label",children:d?i("brain.team.pending"):i("brain.team.updates").replace("{n}",String(u))}),e&&a.jsx("span",{className:"update-badge-label",children:u})]}),o&&a.jsxs("div",{className:"update-badge-popover team-updates-popover",children:[a.jsxs("div",{className:"update-badge-popover-header",children:[a.jsx("span",{className:"update-badge-popover-title",children:i("brain.team.title")}),a.jsx("button",{className:"update-badge-dismiss",onClick:()=>h(!1),"aria-label":i("update.dismiss"),children:"×"})]}),a.jsx("div",{className:"update-badge-content",children:a.jsx("ul",{className:"team-updates-list",children:l.map(p=>a.jsxs("li",{className:"team-updates-item",children:[a.jsx("span",{className:"team-updates-vault",children:p.name}),a.jsx("span",{className:"team-updates-count",children:p.pendingAgentMerge?i("brain.team.awaitingAgent"):`${p.updates} ${i("brain.team.updatesShort")}`})]},p.name))})}),a.jsx("button",{className:"update-badge-action",onClick:g,disabled:s.isPending,children:s.isPending?i("brain.team.checking"):i("brain.team.checkNow")})]})]})}const h7=["name","description","targetUser","stack","priority","platforms","packs","review"],u7=["path","description","targetUser","stack","priority","platforms","packs","review"],d7=["path","platforms","packs","review"],v0={name:{label:"What is this project called?",hint:"Used as the folder name and the vault name."},description:{label:"One line — what is it?",hint:"A short description. Optional.",optional:!0},targetUser:{label:"Who is it for?",hint:"The target user. Optional.",optional:!0},stack:{label:"Tech stack?",hint:"Comma-separated. Auto-detected for existing folders. Optional.",optional:!0},priority:{label:"Current focus?",hint:"What you are working on right now. Optional.",optional:!0}};function f7({onClose:r,onReady:e}){const i=Oz(),n=Iz(),s=Dz(),o=Rz(),[h,l]=R.useState(null),[u,d]=R.useState(0),[g,p]=R.useState(null),[m,y]=R.useState(null),[w,_]=R.useState(null),[v,x]=R.useState(!1),[C,k]=R.useState(""),[T,N]=R.useState(""),[j,A]=R.useState(""),[E,L]=R.useState(""),[O,D]=R.useState(""),[G,q]=R.useState(""),[U,$]=R.useState(""),[F,W]=R.useState(["claude"]),[Y,P]=R.useState([]),[K,z]=R.useState(!1),X=R.useRef(null);function ie(Ne,de,Ue){de(Ne.includes(Ue)?Ne.filter(at=>at!==Ue):[...Ne,Ue])}R.useEffect(()=>{var Ne;h==="new"&&!T&&((Ne=i.data)!=null&&Ne.defaultParent)&&N(i.data.defaultParent)},[h,T,i.data]);const ee=h==="existing"?K?d7:u7:h7,he=ee[u];R.useEffect(()=>{var Ne;(Ne=X.current)==null||Ne.focus()},[he,h]);function fe(Ne){l(Ne),d(0),p(null)}async function ne(Ne){p(null);const de=await a7();if(de){if(Ne==="parent"){N(de);return}A(de);try{const Ue=await Fz(de);if(k(Ue.name),!G&&Ue.stack&&q(Ue.stack),z(Ue.hasContext),Ue.hasContext){try{await o.mutateAsync({name:Ue.name,path:de})}catch(at){const Pt=at instanceof Error?at.message:String(at);if(!/already registered/i.test(Pt))throw at}e(Ue.name);return}d(1)}catch(Ue){p(Ue instanceof Error?Ue.message:String(Ue))}}}const I=R.useMemo(()=>he==="name"?C.trim().length>0&&T.trim().length>0:he==="path"?j.trim().length>0:!0,[he,C,T,j]);function Z(){p(null),u<ee.length-1&&d(Ne=>Ne+1)}function J(){p(null),u>0?d(Ne=>Ne-1):l(null)}async function re(){p(null);const Ne=h==="existing"?{mode:"existing",name:C.trim(),projectPath:j.trim()}:{mode:"new",name:C.trim(),parentDir:T.trim()};Ne.description=E.trim()||void 0,Ne.targetUser=O.trim()||void 0,Ne.stack=G.trim()||void 0,Ne.priority=U.trim()||void 0,Ne.platforms=F.length>0?F:void 0,Ne.packs=Y.length>0?Y:void 0;try{const de=await s.mutateAsync(Ne);y(de.vault),_(de.cli??null)}catch(de){p(de instanceof Error?de.message:String(de))}}const ue="Enrich my dreamcontext: scan the codebase and fill soul, memory, and tech_stack with real detail, then propose initial feature PRDs and a first task. No placeholders.";async function Le(){try{await navigator.clipboard.writeText(ue),x(!0),setTimeout(()=>x(!1),1500)}catch{p("Could not copy to clipboard.")}}function Ze(Ne,de,Ue){return a.jsx("input",{ref:X,type:"text",className:"wiz-input",value:Ne,placeholder:Ue,onChange:at=>de(at.target.value),onKeyDown:at=>{at.key==="Enter"&&I&&Z()}})}function qe(){var Lt,Bt,bt;if(m)return a.jsxs("div",{className:"wiz-success",children:[a.jsx("div",{className:"wiz-success-check","aria-hidden":!0,children:"✓"}),a.jsxs("h2",{className:"wiz-q",children:["“",m.name,"” is ready"]}),a.jsx("p",{className:"wiz-hint",children:m.path}),(w==null?void 0:w.status)==="installed"&&a.jsx("p",{className:"wiz-hint",children:"Installed the dreamcontext CLI from npm so your hooks work."}),(w==null?void 0:w.status)==="failed"&&a.jsx("div",{className:"wiz-error",children:w.message??"Run: npm install -g dreamcontext"}),a.jsxs("div",{className:"wiz-handoff",children:[a.jsx("div",{className:"wiz-handoff-title",children:"Next: enrich it in Claude Code"}),a.jsx("p",{className:"wiz-hint",children:"The skeleton is in place. Open this project in Claude Code and paste the prompt below so the agent can scan your code and fill in real context."}),a.jsx("pre",{className:"wiz-handoff-prompt",children:ue}),a.jsx("button",{type:"button",className:"wiz-btn",onClick:Le,children:v?"Copied ✓":"Copy prompt"})]}),a.jsxs("div",{className:"wiz-actions",children:[a.jsx("button",{type:"button",className:"wiz-btn",onClick:r,children:"Close"}),a.jsx("button",{type:"button",className:"wiz-btn wiz-btn-primary",onClick:()=>e(m.name),children:"Open project →"})]})]});if(h===null)return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Add a project"}),a.jsx("p",{className:"wiz-hint",children:"Create something new, or set up a folder you already have."}),a.jsxs("div",{className:"wiz-choices",children:[a.jsxs("button",{type:"button",className:"wiz-choice",onClick:()=>fe("new"),children:[a.jsx("span",{className:"wiz-choice-title",children:"Create new"}),a.jsx("span",{className:"wiz-hint",children:"Make a new folder and initialize dreamcontext in it."})]}),a.jsxs("button",{type:"button",className:"wiz-choice",onClick:()=>fe("existing"),children:[a.jsx("span",{className:"wiz-choice-title",children:"Open existing"}),a.jsx("span",{className:"wiz-hint",children:"Pick a folder on your Mac and set up dreamcontext there."})]})]})]});if(he==="path")return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Which folder?"}),a.jsx("p",{className:"wiz-hint",children:"Choose the project folder. If it's already a dreamcontext project, it opens straight away."}),a.jsxs("div",{className:"wiz-row",children:[a.jsx("input",{className:"wiz-input",type:"text",value:j,readOnly:!0,placeholder:"No folder chosen"}),a.jsx("button",{type:"button",className:"wiz-btn",onClick:()=>ne("project"),children:s.isPending?"Working…":"Browse…"})]})]});if(he==="name")return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:v0.name.label}),a.jsx("p",{className:"wiz-hint",children:v0.name.hint}),Ze(C,k,"my-project"),a.jsx("label",{className:"wiz-sublabel",children:"Where should it live?"}),a.jsxs("div",{className:"wiz-row",children:[a.jsx("input",{className:"wiz-input",type:"text",value:T,placeholder:((Lt=i.data)==null?void 0:Lt.defaultParent)??"~/projects",onChange:Se=>N(Se.target.value)}),a.jsx("button",{type:"button",className:"wiz-btn",onClick:()=>ne("parent"),children:"Browse…"})]}),C.trim()&&T.trim()&&a.jsxs("p",{className:"wiz-hint wiz-preview",children:["Creates: ",T.replace(/\/+$/,""),"/",C.trim()]})]});if(he==="review")return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Ready to set up"}),a.jsxs("dl",{className:"wiz-review",children:[a.jsx("dt",{children:"Name"}),a.jsx("dd",{children:C.trim()}),a.jsx("dt",{children:"Location"}),a.jsx("dd",{children:h==="new"?`${T.replace(/\/+$/,"")}/${C.trim()}`:j}),E.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Description"}),a.jsx("dd",{children:E.trim()})]}),O.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"For"}),a.jsx("dd",{children:O.trim()})]}),G.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Stack"}),a.jsx("dd",{children:G.trim()})]}),U.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Focus"}),a.jsx("dd",{children:U.trim()})]}),a.jsx("dt",{children:"Platforms"}),a.jsx("dd",{children:(F.length>0?F:["claude"]).map(Se=>{var De,Me;return((Me=(De=n.data)==null?void 0:De.platforms.find(Je=>Je.id===Se))==null?void 0:Me.label)??Se}).join(", ")}),Y.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Skill packs"}),a.jsx("dd",{children:Y.join(", ")})]})]})]});if(he==="platforms"){const Se=((Bt=n.data)==null?void 0:Bt.platforms)??[];return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Which agent platforms?"}),a.jsx("p",{className:"wiz-hint",children:"Where dreamcontext installs its skills, agents, and hooks. Pick one or more."}),a.jsx("div",{className:"wiz-choices",children:Se.map(De=>{const Me=F.includes(De.id);return a.jsxs("button",{type:"button",className:`wiz-choice wiz-select${Me?" wiz-select-on":""}`,onClick:()=>ie(F,W,De.id),"aria-pressed":Me,children:[a.jsxs("span",{className:"wiz-choice-title",children:[De.label,De.recommended&&a.jsx("span",{className:"wiz-badge",children:"Recommended"})]}),a.jsx("span",{className:"wiz-hint",children:De.description})]},De.id)})}),F.length===0&&a.jsx("p",{className:"wiz-hint wiz-preview",children:"Nothing selected — defaults to Claude."})]})}if(he==="packs"){const Se=((bt=n.data)==null?void 0:bt.packs)??[];return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Add skill packs?"}),a.jsx("p",{className:"wiz-hint",children:"Optional curated skills for your agent. You can add more later. Skip if unsure."}),Se.length===0?a.jsx("p",{className:"wiz-hint",children:"No optional packs available."}):a.jsx("div",{className:"wiz-choices",children:Se.map(De=>{const Me=Y.includes(De.name);return a.jsxs("button",{type:"button",className:`wiz-choice wiz-select${Me?" wiz-select-on":""}`,onClick:()=>ie(Y,P,De.name),"aria-pressed":Me,children:[a.jsxs("span",{className:"wiz-choice-title",children:[a.jsx("span",{className:"wiz-check","aria-hidden":!0,children:Me?"☑":"☐"})," ",De.name]}),a.jsx("span",{className:"wiz-hint",children:De.description})]},De.name)})})]})}const de=v0[he],Ue={description:[E,L,"A persistent brain for AI agents…"],targetUser:[O,D,"Developers"],stack:[G,q,"TypeScript, React, Node…"],priority:[U,$,"Initial setup"]},[at,Pt,Mt]=Ue[he];return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:de.label}),a.jsx("p",{className:"wiz-hint",children:de.hint}),Ze(at,Pt,Mt)]})}const Ye=he==="review",pe=h!==null&&he!=="path"&&!m;return a.jsx("div",{className:"wiz-overlay",role:"dialog","aria-modal":"true",onClick:r,children:a.jsxs("div",{className:"wiz-modal",onClick:Ne=>Ne.stopPropagation(),children:[a.jsx("button",{type:"button",className:"wiz-close",onClick:r,"aria-label":"Close",children:"×"}),a.jsx("div",{className:"wiz-body",children:qe()}),g&&a.jsx("div",{className:"wiz-error",children:g}),pe&&a.jsxs("div",{className:"wiz-actions",children:[a.jsx("button",{type:"button",className:"wiz-btn",onClick:J,children:"Back"}),Ye?a.jsx("button",{type:"button",className:"wiz-btn wiz-btn-primary",onClick:re,disabled:s.isPending||!C.trim(),children:s.isPending?"Setting up…":"Set up project"}):a.jsx("button",{type:"button",className:"wiz-btn wiz-btn-primary",onClick:Z,disabled:!I,children:"Next"})]})]})})}function p7(r,e){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var n,s,o,h,l=[],u=!0,d=!1;try{if(o=(i=i.call(r)).next,e===0){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(g){d=!0,s=g}finally{try{if(!u&&i.return!=null&&(h=i.return(),Object(h)!==h))return}finally{if(d)throw s}}return l}}function g7(r,e,i){return e=w7(e),e in r?Object.defineProperty(r,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[e]=i,r}function ZE(r,e){return b7(r)||p7(r,e)||CR(r,e)||_7()}function m7(r){return y7(r)||v7(r)||CR(r)||x7()}function y7(r){if(Array.isArray(r))return F_(r)}function b7(r){if(Array.isArray(r))return r}function v7(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function CR(r,e){if(r){if(typeof r=="string")return F_(r,e);var i=Object.prototype.toString.call(r).slice(8,-1);if(i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set")return Array.from(r);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return F_(r,e)}}function F_(r,e){(e==null||e>r.length)&&(e=r.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=r[i];return n}function x7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
50
+ `).replace(sP,"")}function GT(c,f){return f=WT(f),WT(c)===f}function Hr(c,f,b,S,M,B){switch(b){case"children":typeof S=="string"?f==="body"||f==="textarea"&&S===""||yt(c,S):(typeof S=="number"||typeof S=="bigint")&&f!=="body"&&yt(c,""+S);break;case"className":Cr(c,"class",S);break;case"tabIndex":Cr(c,"tabindex",S);break;case"dir":case"role":case"viewBox":case"width":case"height":Cr(c,b,S);break;case"style":br(c,S,B);break;case"data":if(f!=="object"){Cr(c,"data",S);break}case"src":case"href":if(S===""&&(f!=="a"||b!=="href")){c.removeAttribute(b);break}if(S==null||typeof S=="function"||typeof S=="symbol"||typeof S=="boolean"){c.removeAttribute(b);break}S=Qa(""+S),c.setAttribute(b,S);break;case"action":case"formAction":if(typeof S=="function"){c.setAttribute(b,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof B=="function"&&(b==="formAction"?(f!=="input"&&Hr(c,f,"name",M.name,M,null),Hr(c,f,"formEncType",M.formEncType,M,null),Hr(c,f,"formMethod",M.formMethod,M,null),Hr(c,f,"formTarget",M.formTarget,M,null)):(Hr(c,f,"encType",M.encType,M,null),Hr(c,f,"method",M.method,M,null),Hr(c,f,"target",M.target,M,null)));if(S==null||typeof S=="symbol"||typeof S=="boolean"){c.removeAttribute(b);break}S=Qa(""+S),c.setAttribute(b,S);break;case"onClick":S!=null&&(c.onclick=pt);break;case"onScroll":S!=null&&yr("scroll",c);break;case"onScrollEnd":S!=null&&yr("scrollend",c);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(n(61));if(b=S.__html,b!=null){if(M.children!=null)throw Error(n(60));c.innerHTML=b}}break;case"multiple":c.multiple=S&&typeof S!="function"&&typeof S!="symbol";break;case"muted":c.muted=S&&typeof S!="function"&&typeof S!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(S==null||typeof S=="function"||typeof S=="boolean"||typeof S=="symbol"){c.removeAttribute("xlink:href");break}b=Qa(""+S),c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":S!=null&&typeof S!="function"&&typeof S!="symbol"?c.setAttribute(b,""+S):c.removeAttribute(b);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":S&&typeof S!="function"&&typeof S!="symbol"?c.setAttribute(b,""):c.removeAttribute(b);break;case"capture":case"download":S===!0?c.setAttribute(b,""):S!==!1&&S!=null&&typeof S!="function"&&typeof S!="symbol"?c.setAttribute(b,S):c.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":S!=null&&typeof S!="function"&&typeof S!="symbol"&&!isNaN(S)&&1<=S?c.setAttribute(b,S):c.removeAttribute(b);break;case"rowSpan":case"start":S==null||typeof S=="function"||typeof S=="symbol"||isNaN(S)?c.removeAttribute(b):c.setAttribute(b,S);break;case"popover":yr("beforetoggle",c),yr("toggle",c),Br(c,"popover",S);break;case"xlinkActuate":ri(c,"http://www.w3.org/1999/xlink","xlink:actuate",S);break;case"xlinkArcrole":ri(c,"http://www.w3.org/1999/xlink","xlink:arcrole",S);break;case"xlinkRole":ri(c,"http://www.w3.org/1999/xlink","xlink:role",S);break;case"xlinkShow":ri(c,"http://www.w3.org/1999/xlink","xlink:show",S);break;case"xlinkTitle":ri(c,"http://www.w3.org/1999/xlink","xlink:title",S);break;case"xlinkType":ri(c,"http://www.w3.org/1999/xlink","xlink:type",S);break;case"xmlBase":ri(c,"http://www.w3.org/XML/1998/namespace","xml:base",S);break;case"xmlLang":ri(c,"http://www.w3.org/XML/1998/namespace","xml:lang",S);break;case"xmlSpace":ri(c,"http://www.w3.org/XML/1998/namespace","xml:space",S);break;case"is":Br(c,"is",S);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=Gn.get(b)||b,Br(c,b,S))}}function Vv(c,f,b,S,M,B){switch(b){case"style":br(c,S,B);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(n(61));if(b=S.__html,b!=null){if(M.children!=null)throw Error(n(60));c.innerHTML=b}}break;case"children":typeof S=="string"?yt(c,S):(typeof S=="number"||typeof S=="bigint")&&yt(c,""+S);break;case"onScroll":S!=null&&yr("scroll",c);break;case"onScrollEnd":S!=null&&yr("scrollend",c);break;case"onClick":S!=null&&(c.onclick=pt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ce.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(M=b.endsWith("Capture"),f=b.slice(2,M?b.length-7:void 0),B=c[$t]||null,B=B!=null?B[b]:null,typeof B=="function"&&c.removeEventListener(f,B,M),typeof S=="function")){typeof B!="function"&&B!==null&&(b in c?c[b]=null:c.hasAttribute(b)&&c.removeAttribute(b)),c.addEventListener(f,S,M);break e}b in c?c[b]=S:S===!0?c.setAttribute(b,""):Br(c,b,S)}}}function Ii(c,f,b){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yr("error",c),yr("load",c);var S=!1,M=!1,B;for(B in b)if(b.hasOwnProperty(B)){var V=b[B];if(V!=null)switch(B){case"src":S=!0;break;case"srcSet":M=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,f));default:Hr(c,f,B,V,b,null)}}M&&Hr(c,f,"srcSet",b.srcSet,b,null),S&&Hr(c,f,"src",b.src,b,null);return;case"input":yr("invalid",c);var te=B=V=M=null,ge=null,je=null;for(S in b)if(b.hasOwnProperty(S)){var We=b[S];if(We!=null)switch(S){case"name":M=We;break;case"type":V=We;break;case"checked":ge=We;break;case"defaultChecked":je=We;break;case"value":B=We;break;case"defaultValue":te=We;break;case"children":case"dangerouslySetInnerHTML":if(We!=null)throw Error(n(137,f));break;default:Hr(c,f,S,We,b,null)}}Be(c,B,te,ge,je,V,M,!1);return;case"select":yr("invalid",c),S=V=B=null;for(M in b)if(b.hasOwnProperty(M)&&(te=b[M],te!=null))switch(M){case"value":B=te;break;case"defaultValue":V=te;break;case"multiple":S=te;default:Hr(c,f,M,te,b,null)}f=B,b=V,c.multiple=!!S,f!=null?rt(c,!!S,f,!1):b!=null&&rt(c,!!S,b,!0);return;case"textarea":yr("invalid",c),B=M=S=null;for(V in b)if(b.hasOwnProperty(V)&&(te=b[V],te!=null))switch(V){case"value":S=te;break;case"defaultValue":M=te;break;case"children":B=te;break;case"dangerouslySetInnerHTML":if(te!=null)throw Error(n(91));break;default:Hr(c,f,V,te,b,null)}hr(c,S,M,B);return;case"option":for(ge in b)if(b.hasOwnProperty(ge)&&(S=b[ge],S!=null))switch(ge){case"selected":c.selected=S&&typeof S!="function"&&typeof S!="symbol";break;default:Hr(c,f,ge,S,b,null)}return;case"dialog":yr("beforetoggle",c),yr("toggle",c),yr("cancel",c),yr("close",c);break;case"iframe":case"object":yr("load",c);break;case"video":case"audio":for(S=0;S<Qu.length;S++)yr(Qu[S],c);break;case"image":yr("error",c),yr("load",c);break;case"details":yr("toggle",c);break;case"embed":case"source":case"link":yr("error",c),yr("load",c);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(je in b)if(b.hasOwnProperty(je)&&(S=b[je],S!=null))switch(je){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,f));default:Hr(c,f,je,S,b,null)}return;default:if(qi(f)){for(We in b)b.hasOwnProperty(We)&&(S=b[We],S!==void 0&&Vv(c,f,We,S,b,void 0));return}}for(te in b)b.hasOwnProperty(te)&&(S=b[te],S!=null&&Hr(c,f,te,S,b,null))}function aP(c,f,b,S){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var M=null,B=null,V=null,te=null,ge=null,je=null,We=null;for(Fe in b){var Xe=b[Fe];if(b.hasOwnProperty(Fe)&&Xe!=null)switch(Fe){case"checked":break;case"value":break;case"defaultValue":ge=Xe;default:S.hasOwnProperty(Fe)||Hr(c,f,Fe,null,S,Xe)}}for(var Oe in S){var Fe=S[Oe];if(Xe=b[Oe],S.hasOwnProperty(Oe)&&(Fe!=null||Xe!=null))switch(Oe){case"type":B=Fe;break;case"name":M=Fe;break;case"checked":je=Fe;break;case"defaultChecked":We=Fe;break;case"value":V=Fe;break;case"defaultValue":te=Fe;break;case"children":case"dangerouslySetInnerHTML":if(Fe!=null)throw Error(n(137,f));break;default:Fe!==Xe&&Hr(c,f,Oe,Fe,S,Xe)}}Wn(c,V,te,ge,je,We,B,M);return;case"select":Fe=V=te=Oe=null;for(B in b)if(ge=b[B],b.hasOwnProperty(B)&&ge!=null)switch(B){case"value":break;case"multiple":Fe=ge;default:S.hasOwnProperty(B)||Hr(c,f,B,null,S,ge)}for(M in S)if(B=S[M],ge=b[M],S.hasOwnProperty(M)&&(B!=null||ge!=null))switch(M){case"value":Oe=B;break;case"defaultValue":te=B;break;case"multiple":V=B;default:B!==ge&&Hr(c,f,M,B,S,ge)}f=te,b=V,S=Fe,Oe!=null?rt(c,!!b,Oe,!1):!!S!=!!b&&(f!=null?rt(c,!!b,f,!0):rt(c,!!b,b?[]:"",!1));return;case"textarea":Fe=Oe=null;for(te in b)if(M=b[te],b.hasOwnProperty(te)&&M!=null&&!S.hasOwnProperty(te))switch(te){case"value":break;case"children":break;default:Hr(c,f,te,null,S,M)}for(V in S)if(M=S[V],B=b[V],S.hasOwnProperty(V)&&(M!=null||B!=null))switch(V){case"value":Oe=M;break;case"defaultValue":Fe=M;break;case"children":break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(n(91));break;default:M!==B&&Hr(c,f,V,M,S,B)}_t(c,Oe,Fe);return;case"option":for(var Nt in b)if(Oe=b[Nt],b.hasOwnProperty(Nt)&&Oe!=null&&!S.hasOwnProperty(Nt))switch(Nt){case"selected":c.selected=!1;break;default:Hr(c,f,Nt,null,S,Oe)}for(ge in S)if(Oe=S[ge],Fe=b[ge],S.hasOwnProperty(ge)&&Oe!==Fe&&(Oe!=null||Fe!=null))switch(ge){case"selected":c.selected=Oe&&typeof Oe!="function"&&typeof Oe!="symbol";break;default:Hr(c,f,ge,Oe,S,Fe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Yt in b)Oe=b[Yt],b.hasOwnProperty(Yt)&&Oe!=null&&!S.hasOwnProperty(Yt)&&Hr(c,f,Yt,null,S,Oe);for(je in S)if(Oe=S[je],Fe=b[je],S.hasOwnProperty(je)&&Oe!==Fe&&(Oe!=null||Fe!=null))switch(je){case"children":case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(n(137,f));break;default:Hr(c,f,je,Oe,S,Fe)}return;default:if(qi(f)){for(var Ur in b)Oe=b[Ur],b.hasOwnProperty(Ur)&&Oe!==void 0&&!S.hasOwnProperty(Ur)&&Vv(c,f,Ur,void 0,S,Oe);for(We in S)Oe=S[We],Fe=b[We],!S.hasOwnProperty(We)||Oe===Fe||Oe===void 0&&Fe===void 0||Vv(c,f,We,Oe,S,Fe);return}}for(var ke in b)Oe=b[ke],b.hasOwnProperty(ke)&&Oe!=null&&!S.hasOwnProperty(ke)&&Hr(c,f,ke,null,S,Oe);for(Xe in S)Oe=S[Xe],Fe=b[Xe],!S.hasOwnProperty(Xe)||Oe===Fe||Oe==null&&Fe==null||Hr(c,f,Xe,Oe,S,Fe)}function KT(c){switch(c){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function oP(){if(typeof performance.getEntriesByType=="function"){for(var c=0,f=0,b=performance.getEntriesByType("resource"),S=0;S<b.length;S++){var M=b[S],B=M.transferSize,V=M.initiatorType,te=M.duration;if(B&&te&&KT(V)){for(V=0,te=M.responseEnd,S+=1;S<b.length;S++){var ge=b[S],je=ge.startTime;if(je>te)break;var We=ge.transferSize,Xe=ge.initiatorType;We&&KT(Xe)&&(ge=ge.responseEnd,V+=We*(ge<te?1:(te-je)/(ge-je)))}if(--S,f+=8*(B+V)/(M.duration/1e3),c++,10<c)break}}if(0<c)return f/c/1e6}return navigator.connection&&(c=navigator.connection.downlink,typeof c=="number")?c:5}var Yv=null,Xv=null;function Yp(c){return c.nodeType===9?c:c.ownerDocument}function VT(c){switch(c){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function YT(c,f){if(c===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return c===1&&f==="foreignObject"?0:c}function Zv(c,f){return c==="textarea"||c==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var Qv=null;function lP(){var c=window.event;return c&&c.type==="popstate"?c===Qv?!1:(Qv=c,!0):(Qv=null,!1)}var XT=typeof setTimeout=="function"?setTimeout:void 0,cP=typeof clearTimeout=="function"?clearTimeout:void 0,ZT=typeof Promise=="function"?Promise:void 0,hP=typeof queueMicrotask=="function"?queueMicrotask:typeof ZT<"u"?function(c){return ZT.resolve(null).then(c).catch(uP)}:XT;function uP(c){setTimeout(function(){throw c})}function yo(c){return c==="head"}function QT(c,f){var b=f,S=0;do{var M=b.nextSibling;if(c.removeChild(b),M&&M.nodeType===8)if(b=M.data,b==="/$"||b==="/&"){if(S===0){c.removeChild(M),Zc(f);return}S--}else if(b==="$"||b==="$?"||b==="$~"||b==="$!"||b==="&")S++;else if(b==="html")ed(c.ownerDocument.documentElement);else if(b==="head"){b=c.ownerDocument.head,ed(b);for(var B=b.firstChild;B;){var V=B.nextSibling,te=B.nodeName;B[Hn]||te==="SCRIPT"||te==="STYLE"||te==="LINK"&&B.rel.toLowerCase()==="stylesheet"||b.removeChild(B),B=V}}else b==="body"&&ed(c.ownerDocument.body);b=M}while(b);Zc(f)}function JT(c,f){var b=c;c=0;do{var S=b.nextSibling;if(b.nodeType===1?f?(b._stashedDisplay=b.style.display,b.style.display="none"):(b.style.display=b._stashedDisplay||"",b.getAttribute("style")===""&&b.removeAttribute("style")):b.nodeType===3&&(f?(b._stashedText=b.nodeValue,b.nodeValue=""):b.nodeValue=b._stashedText||""),S&&S.nodeType===8)if(b=S.data,b==="/$"){if(c===0)break;c--}else b!=="$"&&b!=="$?"&&b!=="$~"&&b!=="$!"||c++;b=S}while(b)}function Jv(c){var f=c.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var b=f;switch(f=f.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":Jv(b),Os(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}c.removeChild(b)}}function dP(c,f,b,S){for(;c.nodeType===1;){var M=b;if(c.nodeName.toLowerCase()!==f.toLowerCase()){if(!S&&(c.nodeName!=="INPUT"||c.type!=="hidden"))break}else if(S){if(!c[Hn])switch(f){case"meta":if(!c.hasAttribute("itemprop"))break;return c;case"link":if(B=c.getAttribute("rel"),B==="stylesheet"&&c.hasAttribute("data-precedence"))break;if(B!==M.rel||c.getAttribute("href")!==(M.href==null||M.href===""?null:M.href)||c.getAttribute("crossorigin")!==(M.crossOrigin==null?null:M.crossOrigin)||c.getAttribute("title")!==(M.title==null?null:M.title))break;return c;case"style":if(c.hasAttribute("data-precedence"))break;return c;case"script":if(B=c.getAttribute("src"),(B!==(M.src==null?null:M.src)||c.getAttribute("type")!==(M.type==null?null:M.type)||c.getAttribute("crossorigin")!==(M.crossOrigin==null?null:M.crossOrigin))&&B&&c.hasAttribute("async")&&!c.hasAttribute("itemprop"))break;return c;default:return c}}else if(f==="input"&&c.type==="hidden"){var B=M.name==null?null:""+M.name;if(M.type==="hidden"&&c.getAttribute("name")===B)return c}else return c;if(c=es(c.nextSibling),c===null)break}return null}function fP(c,f,b){if(f==="")return null;for(;c.nodeType!==3;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!b||(c=es(c.nextSibling),c===null))return null;return c}function eE(c,f){for(;c.nodeType!==8;)if((c.nodeType!==1||c.nodeName!=="INPUT"||c.type!=="hidden")&&!f||(c=es(c.nextSibling),c===null))return null;return c}function e0(c){return c.data==="$?"||c.data==="$~"}function t0(c){return c.data==="$!"||c.data==="$?"&&c.ownerDocument.readyState!=="loading"}function pP(c,f){var b=c.ownerDocument;if(c.data==="$~")c._reactRetry=f;else if(c.data!=="$?"||b.readyState!=="loading")f();else{var S=function(){f(),b.removeEventListener("DOMContentLoaded",S)};b.addEventListener("DOMContentLoaded",S),c._reactRetry=S}}function es(c){for(;c!=null;c=c.nextSibling){var f=c.nodeType;if(f===1||f===3)break;if(f===8){if(f=c.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return c}var r0=null;function tE(c){c=c.nextSibling;for(var f=0;c;){if(c.nodeType===8){var b=c.data;if(b==="/$"||b==="/&"){if(f===0)return es(c.nextSibling);f--}else b!=="$"&&b!=="$!"&&b!=="$?"&&b!=="$~"&&b!=="&"||f++}c=c.nextSibling}return null}function rE(c){c=c.previousSibling;for(var f=0;c;){if(c.nodeType===8){var b=c.data;if(b==="$"||b==="$!"||b==="$?"||b==="$~"||b==="&"){if(f===0)return c;f--}else b!=="/$"&&b!=="/&"||f++}c=c.previousSibling}return null}function iE(c,f,b){switch(f=Yp(b),c){case"html":if(c=f.documentElement,!c)throw Error(n(452));return c;case"head":if(c=f.head,!c)throw Error(n(453));return c;case"body":if(c=f.body,!c)throw Error(n(454));return c;default:throw Error(n(451))}}function ed(c){for(var f=c.attributes;f.length;)c.removeAttributeNode(f[0]);Os(c)}var ts=new Map,nE=new Set;function Xp(c){return typeof c.getRootNode=="function"?c.getRootNode():c.nodeType===9?c:c.ownerDocument}var ka=W.d;W.d={f:gP,r:mP,D:yP,C:bP,L:vP,m:xP,X:CP,S:_P,M:wP};function gP(){var c=ka.f(),f=zp();return c||f}function mP(c){var f=Qi(c);f!==null&&f.tag===5&&f.type==="form"?_2(f):ka.r(c)}var Vc=typeof document>"u"?null:document;function sE(c,f,b){var S=Vc;if(S&&typeof f=="string"&&f){var M=Bi(f);M='link[rel="'+c+'"][href="'+M+'"]',typeof b=="string"&&(M+='[crossorigin="'+b+'"]'),nE.has(M)||(nE.add(M),c={rel:c,crossOrigin:b,href:f},S.querySelector(M)===null&&(f=S.createElement("link"),Ii(f,"link",c),Lr(f),S.head.appendChild(f)))}}function yP(c){ka.D(c),sE("dns-prefetch",c,null)}function bP(c,f){ka.C(c,f),sE("preconnect",c,f)}function vP(c,f,b){ka.L(c,f,b);var S=Vc;if(S&&c&&f){var M='link[rel="preload"][as="'+Bi(f)+'"]';f==="image"&&b&&b.imageSrcSet?(M+='[imagesrcset="'+Bi(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(M+='[imagesizes="'+Bi(b.imageSizes)+'"]')):M+='[href="'+Bi(c)+'"]';var B=M;switch(f){case"style":B=Yc(c);break;case"script":B=Xc(c)}ts.has(B)||(c=p({rel:"preload",href:f==="image"&&b&&b.imageSrcSet?void 0:c,as:f},b),ts.set(B,c),S.querySelector(M)!==null||f==="style"&&S.querySelector(td(B))||f==="script"&&S.querySelector(rd(B))||(f=S.createElement("link"),Ii(f,"link",c),Lr(f),S.head.appendChild(f)))}}function xP(c,f){ka.m(c,f);var b=Vc;if(b&&c){var S=f&&typeof f.as=="string"?f.as:"script",M='link[rel="modulepreload"][as="'+Bi(S)+'"][href="'+Bi(c)+'"]',B=M;switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":B=Xc(c)}if(!ts.has(B)&&(c=p({rel:"modulepreload",href:c},f),ts.set(B,c),b.querySelector(M)===null)){switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(rd(B)))return}S=b.createElement("link"),Ii(S,"link",c),Lr(S),b.head.appendChild(S)}}}function _P(c,f,b){ka.S(c,f,b);var S=Vc;if(S&&c){var M=_i(S).hoistableStyles,B=Yc(c);f=f||"default";var V=M.get(B);if(!V){var te={loading:0,preload:null};if(V=S.querySelector(td(B)))te.loading=5;else{c=p({rel:"stylesheet",href:c,"data-precedence":f},b),(b=ts.get(B))&&i0(c,b);var ge=V=S.createElement("link");Lr(ge),Ii(ge,"link",c),ge._p=new Promise(function(je,We){ge.onload=je,ge.onerror=We}),ge.addEventListener("load",function(){te.loading|=1}),ge.addEventListener("error",function(){te.loading|=2}),te.loading|=4,Zp(V,f,S)}V={type:"stylesheet",instance:V,count:1,state:te},M.set(B,V)}}}function CP(c,f){ka.X(c,f);var b=Vc;if(b&&c){var S=_i(b).hoistableScripts,M=Xc(c),B=S.get(M);B||(B=b.querySelector(rd(M)),B||(c=p({src:c,async:!0},f),(f=ts.get(M))&&n0(c,f),B=b.createElement("script"),Lr(B),Ii(B,"link",c),b.head.appendChild(B)),B={type:"script",instance:B,count:1,state:null},S.set(M,B))}}function wP(c,f){ka.M(c,f);var b=Vc;if(b&&c){var S=_i(b).hoistableScripts,M=Xc(c),B=S.get(M);B||(B=b.querySelector(rd(M)),B||(c=p({src:c,async:!0,type:"module"},f),(f=ts.get(M))&&n0(c,f),B=b.createElement("script"),Lr(B),Ii(B,"link",c),b.head.appendChild(B)),B={type:"script",instance:B,count:1,state:null},S.set(M,B))}}function aE(c,f,b,S){var M=(M=fe.current)?Xp(M):null;if(!M)throw Error(n(446));switch(c){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(f=Yc(b.href),b=_i(M).hoistableStyles,S=b.get(f),S||(S={type:"style",instance:null,count:0,state:null},b.set(f,S)),S):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){c=Yc(b.href);var B=_i(M).hoistableStyles,V=B.get(c);if(V||(M=M.ownerDocument||M,V={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},B.set(c,V),(B=M.querySelector(td(c)))&&!B._p&&(V.instance=B,V.state.loading=5),ts.has(c)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},ts.set(c,b),B||kP(M,c,b,V.state))),f&&S===null)throw Error(n(528,""));return V}if(f&&S!==null)throw Error(n(529,""));return null;case"script":return f=b.async,b=b.src,typeof b=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=Xc(b),b=_i(M).hoistableScripts,S=b.get(f),S||(S={type:"script",instance:null,count:0,state:null},b.set(f,S)),S):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,c))}}function Yc(c){return'href="'+Bi(c)+'"'}function td(c){return'link[rel="stylesheet"]['+c+"]"}function oE(c){return p({},c,{"data-precedence":c.precedence,precedence:null})}function kP(c,f,b,S){c.querySelector('link[rel="preload"][as="style"]['+f+"]")?S.loading=1:(f=c.createElement("link"),S.preload=f,f.addEventListener("load",function(){return S.loading|=1}),f.addEventListener("error",function(){return S.loading|=2}),Ii(f,"link",b),Lr(f),c.head.appendChild(f))}function Xc(c){return'[src="'+Bi(c)+'"]'}function rd(c){return"script[async]"+c}function lE(c,f,b){if(f.count++,f.instance===null)switch(f.type){case"style":var S=c.querySelector('style[data-href~="'+Bi(b.href)+'"]');if(S)return f.instance=S,Lr(S),S;var M=p({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return S=(c.ownerDocument||c).createElement("style"),Lr(S),Ii(S,"style",M),Zp(S,b.precedence,c),f.instance=S;case"stylesheet":M=Yc(b.href);var B=c.querySelector(td(M));if(B)return f.state.loading|=4,f.instance=B,Lr(B),B;S=oE(b),(M=ts.get(M))&&i0(S,M),B=(c.ownerDocument||c).createElement("link"),Lr(B);var V=B;return V._p=new Promise(function(te,ge){V.onload=te,V.onerror=ge}),Ii(B,"link",S),f.state.loading|=4,Zp(B,b.precedence,c),f.instance=B;case"script":return B=Xc(b.src),(M=c.querySelector(rd(B)))?(f.instance=M,Lr(M),M):(S=b,(M=ts.get(B))&&(S=p({},b),n0(S,M)),c=c.ownerDocument||c,M=c.createElement("script"),Lr(M),Ii(M,"link",S),c.head.appendChild(M),f.instance=M);case"void":return null;default:throw Error(n(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(S=f.instance,f.state.loading|=4,Zp(S,b.precedence,c));return f.instance}function Zp(c,f,b){for(var S=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),M=S.length?S[S.length-1]:null,B=M,V=0;V<S.length;V++){var te=S[V];if(te.dataset.precedence===f)B=te;else if(B!==M)break}B?B.parentNode.insertBefore(c,B.nextSibling):(f=b.nodeType===9?b.head:b,f.insertBefore(c,f.firstChild))}function i0(c,f){c.crossOrigin==null&&(c.crossOrigin=f.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=f.referrerPolicy),c.title==null&&(c.title=f.title)}function n0(c,f){c.crossOrigin==null&&(c.crossOrigin=f.crossOrigin),c.referrerPolicy==null&&(c.referrerPolicy=f.referrerPolicy),c.integrity==null&&(c.integrity=f.integrity)}var Qp=null;function cE(c,f,b){if(Qp===null){var S=new Map,M=Qp=new Map;M.set(b,S)}else M=Qp,S=M.get(b),S||(S=new Map,M.set(b,S));if(S.has(c))return S;for(S.set(c,null),b=b.getElementsByTagName(c),M=0;M<b.length;M++){var B=b[M];if(!(B[Hn]||B[xt]||c==="link"&&B.getAttribute("rel")==="stylesheet")&&B.namespaceURI!=="http://www.w3.org/2000/svg"){var V=B.getAttribute(f)||"";V=c+V;var te=S.get(V);te?te.push(B):S.set(V,[B])}}return S}function hE(c,f,b){c=c.ownerDocument||c,c.head.insertBefore(b,f==="title"?c.querySelector("head > title"):null)}function SP(c,f,b){if(b===1||f.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return c=f.disabled,typeof f.precedence=="string"&&c==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function uE(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function TP(c,f,b,S){if(b.type==="stylesheet"&&(typeof S.media!="string"||matchMedia(S.media).matches!==!1)&&(b.state.loading&4)===0){if(b.instance===null){var M=Yc(S.href),B=f.querySelector(td(M));if(B){f=B._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(c.count++,c=Jp.bind(c),f.then(c,c)),b.state.loading|=4,b.instance=B,Lr(B);return}B=f.ownerDocument||f,S=oE(S),(M=ts.get(M))&&i0(S,M),B=B.createElement("link"),Lr(B);var V=B;V._p=new Promise(function(te,ge){V.onload=te,V.onerror=ge}),Ii(B,"link",S),b.instance=B}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(b,f),(f=b.state.preload)&&(b.state.loading&3)===0&&(c.count++,b=Jp.bind(c),f.addEventListener("load",b),f.addEventListener("error",b))}}var s0=0;function EP(c,f){return c.stylesheets&&c.count===0&&tg(c,c.stylesheets),0<c.count||0<c.imgCount?function(b){var S=setTimeout(function(){if(c.stylesheets&&tg(c,c.stylesheets),c.unsuspend){var B=c.unsuspend;c.unsuspend=null,B()}},6e4+f);0<c.imgBytes&&s0===0&&(s0=62500*oP());var M=setTimeout(function(){if(c.waitingForImages=!1,c.count===0&&(c.stylesheets&&tg(c,c.stylesheets),c.unsuspend)){var B=c.unsuspend;c.unsuspend=null,B()}},(c.imgBytes>s0?50:800)+f);return c.unsuspend=b,function(){c.unsuspend=null,clearTimeout(S),clearTimeout(M)}}:null}function Jp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tg(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var eg=null;function tg(c,f){c.stylesheets=null,c.unsuspend!==null&&(c.count++,eg=new Map,f.forEach(NP,c),eg=null,Jp.call(c))}function NP(c,f){if(!(f.state.loading&4)){var b=eg.get(c);if(b)var S=b.get(null);else{b=new Map,eg.set(c,b);for(var M=c.querySelectorAll("link[data-precedence],style[data-precedence]"),B=0;B<M.length;B++){var V=M[B];(V.nodeName==="LINK"||V.getAttribute("media")!=="not all")&&(b.set(V.dataset.precedence,V),S=V)}S&&b.set(null,S)}M=f.instance,V=M.getAttribute("data-precedence"),B=b.get(V)||S,B===S&&b.set(null,M),b.set(V,M),this.count++,S=Jp.bind(this),M.addEventListener("load",S),M.addEventListener("error",S),B?B.parentNode.insertBefore(M,B.nextSibling):(c=c.nodeType===9?c.head:c,c.insertBefore(M,c.firstChild)),f.state.loading|=4}}var id={$$typeof:k,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function AP(c,f,b,S,M,B,V,te,ge){this.tag=1,this.containerInfo=c,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Et(0),this.hiddenUpdates=Et(null),this.identifierPrefix=S,this.onUncaughtError=M,this.onCaughtError=B,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ge,this.incompleteTransitions=new Map}function dE(c,f,b,S,M,B,V,te,ge,je,We,Xe){return c=new AP(c,f,b,V,ge,je,We,Xe,te),f=1,B===!0&&(f|=24),B=jn(3,null,null,f),c.current=B,B.stateNode=c,f=Fb(),f.refCount++,c.pooledCache=f,f.refCount++,B.memoizedState={element:S,isDehydrated:b,cache:f},qb(B),c}function fE(c){return c?(c=Ec,c):Ec}function pE(c,f,b,S,M,B){M=fE(M),S.context===null?S.context=M:S.pendingContext=M,S=so(f),S.payload={element:b},B=B===void 0?null:B,B!==null&&(S.callback=B),b=ao(c,S,f),b!==null&&(vn(b,c,f),Ou(b,c,f))}function gE(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var b=c.retryLane;c.retryLane=b!==0&&b<f?b:f}}function a0(c,f){gE(c,f),(c=c.alternate)&&gE(c,f)}function mE(c){if(c.tag===13||c.tag===31){var f=ul(c,67108864);f!==null&&vn(f,c,67108864),a0(c,67108864)}}function yE(c){if(c.tag===13||c.tag===31){var f=On();f=le(f);var b=ul(c,f);b!==null&&vn(b,c,f),a0(c,f)}}var rg=!0;function jP(c,f,b,S){var M=F.T;F.T=null;var B=W.p;try{W.p=2,o0(c,f,b,S)}finally{W.p=B,F.T=M}}function MP(c,f,b,S){var M=F.T;F.T=null;var B=W.p;try{W.p=8,o0(c,f,b,S)}finally{W.p=B,F.T=M}}function o0(c,f,b,S){if(rg){var M=l0(S);if(M===null)Kv(c,f,S,ig,b),vE(c,S);else if(BP(M,c,f,b,S))S.stopPropagation();else if(vE(c,S),f&4&&-1<LP.indexOf(c)){for(;M!==null;){var B=Qi(M);if(B!==null)switch(B.tag){case 3:if(B=B.stateNode,B.current.memoizedState.isDehydrated){var V=kt(B.pendingLanes);if(V!==0){var te=B;for(te.pendingLanes|=2,te.entangledLanes|=2;V;){var ge=1<<31-lt(V);te.entanglements[1]|=ge,V&=~ge}$s(B),(Mr&6)===0&&($p=Lt()+500,Zu(0))}}break;case 31:case 13:te=ul(B,2),te!==null&&vn(te,B,2),zp(),a0(B,2)}if(B=l0(S),B===null&&Kv(c,f,S,ig,b),B===M)break;M=B}M!==null&&S.stopPropagation()}else Kv(c,f,S,null,b)}}function l0(c){return c=lr(c),c0(c)}var ig=null;function c0(c){if(ig=null,c=xi(c),c!==null){var f=o(c);if(f===null)c=null;else{var b=f.tag;if(b===13){if(c=h(f),c!==null)return c;c=null}else if(b===31){if(c=l(f),c!==null)return c;c=null}else if(b===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;c=null}else f!==c&&(c=null)}}return ig=c,null}function bE(c){switch(c){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Bt()){case bt:return 2;case Se:return 8;case De:case Me:return 32;case Je:return 268435456;default:return 32}default:return 32}}var h0=!1,bo=null,vo=null,xo=null,nd=new Map,sd=new Map,_o=[],LP="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function vE(c,f){switch(c){case"focusin":case"focusout":bo=null;break;case"dragenter":case"dragleave":vo=null;break;case"mouseover":case"mouseout":xo=null;break;case"pointerover":case"pointerout":nd.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":sd.delete(f.pointerId)}}function ad(c,f,b,S,M,B){return c===null||c.nativeEvent!==B?(c={blockedOn:f,domEventName:b,eventSystemFlags:S,nativeEvent:B,targetContainers:[M]},f!==null&&(f=Qi(f),f!==null&&mE(f)),c):(c.eventSystemFlags|=S,f=c.targetContainers,M!==null&&f.indexOf(M)===-1&&f.push(M),c)}function BP(c,f,b,S,M){switch(f){case"focusin":return bo=ad(bo,c,f,b,S,M),!0;case"dragenter":return vo=ad(vo,c,f,b,S,M),!0;case"mouseover":return xo=ad(xo,c,f,b,S,M),!0;case"pointerover":var B=M.pointerId;return nd.set(B,ad(nd.get(B)||null,c,f,b,S,M)),!0;case"gotpointercapture":return B=M.pointerId,sd.set(B,ad(sd.get(B)||null,c,f,b,S,M)),!0}return!1}function xE(c){var f=xi(c.target);if(f!==null){var b=o(f);if(b!==null){if(f=b.tag,f===13){if(f=h(b),f!==null){c.blockedOn=f,$e(c.priority,function(){yE(b)});return}}else if(f===31){if(f=l(b),f!==null){c.blockedOn=f,$e(c.priority,function(){yE(b)});return}}else if(f===3&&b.stateNode.current.memoizedState.isDehydrated){c.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}c.blockedOn=null}function ng(c){if(c.blockedOn!==null)return!1;for(var f=c.targetContainers;0<f.length;){var b=l0(c.nativeEvent);if(b===null){b=c.nativeEvent;var S=new b.constructor(b.type,b);Dt=S,b.target.dispatchEvent(S),Dt=null}else return f=Qi(b),f!==null&&mE(f),c.blockedOn=b,!1;f.shift()}return!0}function _E(c,f,b){ng(c)&&b.delete(f)}function RP(){h0=!1,bo!==null&&ng(bo)&&(bo=null),vo!==null&&ng(vo)&&(vo=null),xo!==null&&ng(xo)&&(xo=null),nd.forEach(_E),sd.forEach(_E)}function sg(c,f){c.blockedOn===f&&(c.blockedOn=null,h0||(h0=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,RP)))}var ag=null;function CE(c){ag!==c&&(ag=c,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){ag===c&&(ag=null);for(var f=0;f<c.length;f+=3){var b=c[f],S=c[f+1],M=c[f+2];if(typeof S!="function"){if(c0(S||b)===null)continue;break}var B=Qi(b);B!==null&&(c.splice(f,3),f-=3,lv(B,{pending:!0,data:M,method:b.method,action:S},S,M))}}))}function Zc(c){function f(ge){return sg(ge,c)}bo!==null&&sg(bo,c),vo!==null&&sg(vo,c),xo!==null&&sg(xo,c),nd.forEach(f),sd.forEach(f);for(var b=0;b<_o.length;b++){var S=_o[b];S.blockedOn===c&&(S.blockedOn=null)}for(;0<_o.length&&(b=_o[0],b.blockedOn===null);)xE(b),b.blockedOn===null&&_o.shift();if(b=(c.ownerDocument||c).$$reactFormReplay,b!=null)for(S=0;S<b.length;S+=3){var M=b[S],B=b[S+1],V=M[$t]||null;if(typeof B=="function")V||CE(b);else if(V){var te=null;if(B&&B.hasAttribute("formAction")){if(M=B,V=B[$t]||null)te=V.formAction;else if(c0(M)!==null)continue}else te=V.action;typeof te=="function"?b[S+1]=te:(b.splice(S,3),S-=3),CE(b)}}}function wE(){function c(B){B.canIntercept&&B.info==="react-transition"&&B.intercept({handler:function(){return new Promise(function(V){return M=V})},focusReset:"manual",scroll:"manual"})}function f(){M!==null&&(M(),M=null),S||setTimeout(b,20)}function b(){if(!S&&!navigation.transition){var B=navigation.currentEntry;B&&B.url!=null&&navigation.navigate(B.url,{state:B.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var S=!1,M=null;return navigation.addEventListener("navigate",c),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(b,100),function(){S=!0,navigation.removeEventListener("navigate",c),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),M!==null&&(M(),M=null)}}}function u0(c){this._internalRoot=c}og.prototype.render=u0.prototype.render=function(c){var f=this._internalRoot;if(f===null)throw Error(n(409));var b=f.current,S=On();pE(b,S,c,f,null,null)},og.prototype.unmount=u0.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var f=c.containerInfo;pE(c.current,2,null,c,null,null),zp(),f[Kr]=null}};function og(c){this._internalRoot=c}og.prototype.unstable_scheduleHydration=function(c){if(c){var f=Re();c={blockedOn:null,target:c,priority:f};for(var b=0;b<_o.length&&f!==0&&f<_o[b].priority;b++);_o.splice(b,0,c),b===0&&xE(c)}};var kE=e.version;if(kE!=="19.2.4")throw Error(n(527,kE,"19.2.4"));W.findDOMNode=function(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=d(f),c=c!==null?g(c):null,c=c===null?null:c.stateNode,c};var OP={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lg.isDisabled&&lg.supportsFiber)try{At=lg.inject(OP),Te=lg}catch{}}return ld.createRoot=function(c,f){if(!s(c))throw Error(n(299));var b=!1,S="",M=M2,B=L2,V=B2;return f!=null&&(f.unstable_strictMode===!0&&(b=!0),f.identifierPrefix!==void 0&&(S=f.identifierPrefix),f.onUncaughtError!==void 0&&(M=f.onUncaughtError),f.onCaughtError!==void 0&&(B=f.onCaughtError),f.onRecoverableError!==void 0&&(V=f.onRecoverableError)),f=dE(c,1,!1,null,null,b,S,null,M,B,V,wE),c[Kr]=f.current,Gv(c),new u0(f)},ld.hydrateRoot=function(c,f,b){if(!s(c))throw Error(n(299));var S=!1,M="",B=M2,V=L2,te=B2,ge=null;return b!=null&&(b.unstable_strictMode===!0&&(S=!0),b.identifierPrefix!==void 0&&(M=b.identifierPrefix),b.onUncaughtError!==void 0&&(B=b.onUncaughtError),b.onCaughtError!==void 0&&(V=b.onCaughtError),b.onRecoverableError!==void 0&&(te=b.onRecoverableError),b.formState!==void 0&&(ge=b.formState)),f=dE(c,1,!0,f,b??null,S,M,ge,B,V,te,wE),f.context=fE(null),b=f.current,S=On(),S=le(S),M=so(S),M.callback=null,ao(b,M,S),b=S,f.current.lanes=b,dt(f,b),$s(f),c[Kr]=f.current,Gv(c),new og(f)},ld.version="19.2.4",ld}var OE;function KP(){if(OE)return g0.exports;OE=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),g0.exports=GP(),g0.exports}var VP=KP(),du=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(r){return this.listeners.add(r),this.onSubscribe(),()=>{this.listeners.delete(r),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},YP={setTimeout:(r,e)=>setTimeout(r,e),clearTimeout:r=>clearTimeout(r),setInterval:(r,e)=>setInterval(r,e),clearInterval:r=>clearInterval(r)},Bo,MC,$B,XP=($B=class{constructor(){Wt(this,Bo,YP);Wt(this,MC,!1)}setTimeoutProvider(r){Ct(this,Bo,r)}setTimeout(r,e){return me(this,Bo).setTimeout(r,e)}clearTimeout(r){me(this,Bo).clearTimeout(r)}setInterval(r,e){return me(this,Bo).setInterval(r,e)}clearInterval(r){me(this,Bo).clearInterval(r)}},Bo=new WeakMap,MC=new WeakMap,$B),Dl=new XP;function ZP(r){setTimeout(r,0)}var rc=typeof window>"u"||"Deno"in globalThis;function rn(){}function QP(r,e){return typeof r=="function"?r(e):r}function k_(r){return typeof r=="number"&&r>=0&&r!==1/0}function QB(r,e){return Math.max(r+(e||0)-Date.now(),0)}function Go(r,e){return typeof r=="function"?r(e):r}function os(r,e){return typeof r=="function"?r(e):r}function DE(r,e){const{type:i="all",exact:n,fetchStatus:s,predicate:o,queryKey:h,stale:l}=r;if(h){if(n){if(e.queryHash!==BC(h,e.options))return!1}else if(!pf(e.queryKey,h))return!1}if(i!=="all"){const u=e.isActive();if(i==="active"&&!u||i==="inactive"&&u)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||o&&!o(e))}function IE(r,e){const{exact:i,status:n,predicate:s,mutationKey:o}=r;if(o){if(!e.options.mutationKey)return!1;if(i){if(ic(e.options.mutationKey)!==ic(o))return!1}else if(!pf(e.options.mutationKey,o))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function BC(r,e){return((e==null?void 0:e.queryKeyHashFn)||ic)(r)}function ic(r){return JSON.stringify(r,(e,i)=>S_(i)?Object.keys(i).sort().reduce((n,s)=>(n[s]=i[s],n),{}):i)}function pf(r,e){return r===e?!0:typeof r!=typeof e?!1:r&&e&&typeof r=="object"&&typeof e=="object"?Object.keys(e).every(i=>pf(r[i],e[i])):!1}var JP=Object.prototype.hasOwnProperty;function JB(r,e,i=0){if(r===e)return r;if(i>500)return e;const n=FE(r)&&FE(e);if(!n&&!(S_(r)&&S_(e)))return e;const o=(n?r:Object.keys(r)).length,h=n?e:Object.keys(e),l=h.length,u=n?new Array(l):{};let d=0;for(let g=0;g<l;g++){const p=n?g:h[g],m=r[p],y=e[p];if(m===y){u[p]=m,(n?g<o:JP.call(r,p))&&d++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){u[p]=y;continue}const w=JB(m,y,i+1);u[p]=w,w===m&&d++}return o===l&&d===o?r:u}function wm(r,e){if(!e||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(r[i]!==e[i])return!1;return!0}function FE(r){return Array.isArray(r)&&r.length===Object.keys(r).length}function S_(r){if(!$E(r))return!1;const e=r.constructor;if(e===void 0)return!0;const i=e.prototype;return!(!$E(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(r)!==Object.prototype)}function $E(r){return Object.prototype.toString.call(r)==="[object Object]"}function ez(r){return new Promise(e=>{Dl.setTimeout(e,r)})}function T_(r,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(r,e):i.structuralSharing!==!1?JB(r,e):e}function tz(r){return r}function rz(r,e,i=0){const n=[...r,e];return i&&n.length>i?n.slice(1):n}function iz(r,e,i=0){const n=[e,...r];return i&&n.length>i?n.slice(0,-1):n}var RC=Symbol();function eR(r,e){return!r.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!r.queryFn||r.queryFn===RC?()=>Promise.reject(new Error(`Missing queryFn: '${r.queryHash}'`)):r.queryFn}function OC(r,e){return typeof r=="function"?r(...e):!!r}function nz(r,e,i){let n=!1,s;return Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(s??(s=e()),n||(n=!0,s.aborted?i():s.addEventListener("abort",i,{once:!0})),s)}),r}var ql,Ro,Nh,PB,sz=(PB=class extends du{constructor(){super();Wt(this,ql);Wt(this,Ro);Wt(this,Nh);Ct(this,Nh,e=>{if(!rc&&window.addEventListener){const i=()=>e();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){me(this,Ro)||this.setEventListener(me(this,Nh))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,Ro))==null||e.call(this),Ct(this,Ro,void 0))}setEventListener(e){var i;Ct(this,Nh,e),(i=me(this,Ro))==null||i.call(this),Ct(this,Ro,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){me(this,ql)!==e&&(Ct(this,ql,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(i=>{i(e)})}isFocused(){var e;return typeof me(this,ql)=="boolean"?me(this,ql):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ql=new WeakMap,Ro=new WeakMap,Nh=new WeakMap,PB),DC=new sz;function E_(){let r,e;const i=new Promise((s,o)=>{r=s,e=o});i.status="pending",i.catch(()=>{});function n(s){Object.assign(i,s),delete i.resolve,delete i.reject}return i.resolve=s=>{n({status:"fulfilled",value:s}),r(s)},i.reject=s=>{n({status:"rejected",reason:s}),e(s)},i}var az=ZP;function oz(){let r=[],e=0,i=l=>{l()},n=l=>{l()},s=az;const o=l=>{e?r.push(l):s(()=>{i(l)})},h=()=>{const l=r;r=[],l.length&&s(()=>{n(()=>{l.forEach(u=>{i(u)})})})};return{batch:l=>{let u;e++;try{u=l()}finally{e--,e||h()}return u},batchCalls:l=>(...u)=>{o(()=>{l(...u)})},schedule:o,setNotifyFunction:l=>{i=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Si=oz(),Ah,Oo,jh,zB,lz=(zB=class extends du{constructor(){super();Wt(this,Ah,!0);Wt(this,Oo);Wt(this,jh);Ct(this,jh,e=>{if(!rc&&window.addEventListener){const i=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",n)}}})}onSubscribe(){me(this,Oo)||this.setEventListener(me(this,jh))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,Oo))==null||e.call(this),Ct(this,Oo,void 0))}setEventListener(e){var i;Ct(this,jh,e),(i=me(this,Oo))==null||i.call(this),Ct(this,Oo,e(this.setOnline.bind(this)))}setOnline(e){me(this,Ah)!==e&&(Ct(this,Ah,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return me(this,Ah)}},Ah=new WeakMap,Oo=new WeakMap,jh=new WeakMap,zB),km=new lz;function cz(r){return Math.min(1e3*2**r,3e4)}function tR(r){return(r??"online")==="online"?km.isOnline():!0}var N_=class extends Error{constructor(r){super("CancelledError"),this.revert=r==null?void 0:r.revert,this.silent=r==null?void 0:r.silent}};function rR(r){let e=!1,i=0,n;const s=E_(),o=()=>s.status!=="pending",h=_=>{var v;if(!o()){const x=new N_(_);m(x),(v=r.onCancel)==null||v.call(r,x)}},l=()=>{e=!0},u=()=>{e=!1},d=()=>DC.isFocused()&&(r.networkMode==="always"||km.isOnline())&&r.canRun(),g=()=>tR(r.networkMode)&&r.canRun(),p=_=>{o()||(n==null||n(),s.resolve(_))},m=_=>{o()||(n==null||n(),s.reject(_))},y=()=>new Promise(_=>{var v;n=x=>{(o()||d())&&_(x)},(v=r.onPause)==null||v.call(r)}).then(()=>{var _;n=void 0,o()||(_=r.onContinue)==null||_.call(r)}),w=()=>{if(o())return;let _;const v=i===0?r.initialPromise:void 0;try{_=v??r.fn()}catch(x){_=Promise.reject(x)}Promise.resolve(_).then(p).catch(x=>{var j;if(o())return;const C=r.retry??(rc?0:3),k=r.retryDelay??cz,T=typeof k=="function"?k(i,x):k,N=C===!0||typeof C=="number"&&i<C||typeof C=="function"&&C(i,x);if(e||!N){m(x);return}i++,(j=r.onFail)==null||j.call(r,i,x),ez(T).then(()=>d()?void 0:y()).then(()=>{e?m(x):w()})})};return{promise:s,status:()=>s.status,cancel:h,continue:()=>(n==null||n(),s),cancelRetry:l,continueRetry:u,canStart:g,start:()=>(g()?w():y().then(w),s)}}var Hl,qB,iR=(qB=class{constructor(){Wt(this,Hl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),k_(this.gcTime)&&Ct(this,Hl,Dl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(r){this.gcTime=Math.max(this.gcTime||0,r??(rc?1/0:300*1e3))}clearGcTimeout(){me(this,Hl)&&(Dl.clearTimeout(me(this,Hl)),Ct(this,Hl,void 0))}},Hl=new WeakMap,qB),Ul,Mh,as,Wl,ji,Bf,Gl,_s,ja,HB,hz=(HB=class extends iR{constructor(e){super();Wt(this,_s);Wt(this,Ul);Wt(this,Mh);Wt(this,as);Wt(this,Wl);Wt(this,ji);Wt(this,Bf);Wt(this,Gl);Ct(this,Gl,!1),Ct(this,Bf,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ct(this,Wl,e.client),Ct(this,as,me(this,Wl).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ct(this,Ul,zE(this.options)),this.state=e.state??me(this,Ul),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=me(this,ji))==null?void 0:e.promise}setOptions(e){if(this.options={...me(this,Bf),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=zE(this.options);i.data!==void 0&&(this.setState(PE(i.data,i.dataUpdatedAt)),Ct(this,Ul,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,as).remove(this)}setData(e,i){const n=T_(this.state.data,e,this.options);return fr(this,_s,ja).call(this,{data:n,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),n}setState(e,i){fr(this,_s,ja).call(this,{type:"setState",state:e,setStateOptions:i})}cancel(e){var n,s;const i=(n=me(this,ji))==null?void 0:n.promise;return(s=me(this,ji))==null||s.cancel(e),i?i.then(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(me(this,Ul))}isActive(){return this.observers.some(e=>os(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===RC||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Go(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!QB(this.state.dataUpdatedAt,e)}onFocus(){var i;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(i=me(this,ji))==null||i.continue()}onOnline(){var i;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(i=me(this,ji))==null||i.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),me(this,as).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(i=>i!==e),this.observers.length||(me(this,ji)&&(me(this,Gl)?me(this,ji).cancel({revert:!0}):me(this,ji).cancelRetry()),this.scheduleGc()),me(this,as).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,_s,ja).call(this,{type:"invalidate"})}async fetch(e,i){var u,d,g,p,m,y,w,_,v,x,C,k;if(this.state.fetchStatus!=="idle"&&((u=me(this,ji))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(me(this,ji))return me(this,ji).continueRetry(),me(this,ji).promise}if(e&&this.setOptions(e),!this.options.queryFn){const T=this.observers.find(N=>N.options.queryFn);T&&this.setOptions(T.options)}const n=new AbortController,s=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Ct(this,Gl,!0),n.signal)})},o=()=>{const T=eR(this.options,i),j=(()=>{const A={client:me(this,Wl),queryKey:this.queryKey,meta:this.meta};return s(A),A})();return Ct(this,Gl,!1),this.options.persister?this.options.persister(T,j,this):T(j)},l=(()=>{const T={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:me(this,Wl),state:this.state,fetchFn:o};return s(T),T})();(d=this.options.behavior)==null||d.onFetch(l,this),Ct(this,Mh,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=l.fetchOptions)==null?void 0:g.meta))&&fr(this,_s,ja).call(this,{type:"fetch",meta:(p=l.fetchOptions)==null?void 0:p.meta}),Ct(this,ji,rR({initialPromise:i==null?void 0:i.initialPromise,fn:l.fetchFn,onCancel:T=>{T instanceof N_&&T.revert&&this.setState({...me(this,Mh),fetchStatus:"idle"}),n.abort()},onFail:(T,N)=>{fr(this,_s,ja).call(this,{type:"failed",failureCount:T,error:N})},onPause:()=>{fr(this,_s,ja).call(this,{type:"pause"})},onContinue:()=>{fr(this,_s,ja).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const T=await me(this,ji).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(y=(m=me(this,as).config).onSuccess)==null||y.call(m,T,this),(_=(w=me(this,as).config).onSettled)==null||_.call(w,T,this.state.error,this),T}catch(T){if(T instanceof N_){if(T.silent)return me(this,ji).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw fr(this,_s,ja).call(this,{type:"error",error:T}),(x=(v=me(this,as).config).onError)==null||x.call(v,T,this),(k=(C=me(this,as).config).onSettled)==null||k.call(C,this.state.data,T,this),T}finally{this.scheduleGc()}}},Ul=new WeakMap,Mh=new WeakMap,as=new WeakMap,Wl=new WeakMap,ji=new WeakMap,Bf=new WeakMap,Gl=new WeakMap,_s=new WeakSet,ja=function(e){const i=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...nR(n.data,this.options),fetchMeta:e.meta??null};case"success":const s={...n,...PE(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ct(this,Mh,e.manual?s:void 0),s;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=i(this.state),Si.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),me(this,as).notify({query:this,type:"updated",action:e})})},HB);function nR(r,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tR(e.networkMode)?"fetching":"paused",...r===void 0&&{error:null,status:"pending"}}}function PE(r,e){return{data:r,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zE(r){const e=typeof r.initialData=="function"?r.initialData():r.initialData,i=e!==void 0,n=i?typeof r.initialDataUpdatedAt=="function"?r.initialDataUpdatedAt():r.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:i?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var _n,kr,Rf,tn,Kl,Lh,Ba,Do,Of,Bh,Rh,Vl,Yl,Io,Oh,Dr,Fd,A_,j_,M_,L_,B_,R_,O_,sR,UB,uz=(UB=class extends du{constructor(e,i){super();Wt(this,Dr);Wt(this,_n);Wt(this,kr);Wt(this,Rf);Wt(this,tn);Wt(this,Kl);Wt(this,Lh);Wt(this,Ba);Wt(this,Do);Wt(this,Of);Wt(this,Bh);Wt(this,Rh);Wt(this,Vl);Wt(this,Yl);Wt(this,Io);Wt(this,Oh,new Set);this.options=i,Ct(this,_n,e),Ct(this,Do,null),Ct(this,Ba,E_()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,kr).addObserver(this),qE(me(this,kr),this.options)?fr(this,Dr,Fd).call(this):this.updateResult(),fr(this,Dr,L_).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return D_(me(this,kr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return D_(me(this,kr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,Dr,B_).call(this),fr(this,Dr,R_).call(this),me(this,kr).removeObserver(this)}setOptions(e){const i=this.options,n=me(this,kr);if(this.options=me(this,_n).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof os(this.options.enabled,me(this,kr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,Dr,O_).call(this),me(this,kr).setOptions(this.options),i._defaulted&&!wm(this.options,i)&&me(this,_n).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,kr),observer:this});const s=this.hasListeners();s&&HE(me(this,kr),n,this.options,i)&&fr(this,Dr,Fd).call(this),this.updateResult(),s&&(me(this,kr)!==n||os(this.options.enabled,me(this,kr))!==os(i.enabled,me(this,kr))||Go(this.options.staleTime,me(this,kr))!==Go(i.staleTime,me(this,kr)))&&fr(this,Dr,A_).call(this);const o=fr(this,Dr,j_).call(this);s&&(me(this,kr)!==n||os(this.options.enabled,me(this,kr))!==os(i.enabled,me(this,kr))||o!==me(this,Io))&&fr(this,Dr,M_).call(this,o)}getOptimisticResult(e){const i=me(this,_n).getQueryCache().build(me(this,_n),e),n=this.createResult(i,e);return fz(this,n)&&(Ct(this,tn,n),Ct(this,Lh,this.options),Ct(this,Kl,me(this,kr).state)),n}getCurrentResult(){return me(this,tn)}trackResult(e,i){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),i==null||i(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&me(this,Ba).status==="pending"&&me(this,Ba).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(e){me(this,Oh).add(e)}getCurrentQuery(){return me(this,kr)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const i=me(this,_n).defaultQueryOptions(e),n=me(this,_n).getQueryCache().build(me(this,_n),i);return n.fetch().then(()=>this.createResult(n,i))}fetch(e){return fr(this,Dr,Fd).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),me(this,tn)))}createResult(e,i){var L;const n=me(this,kr),s=this.options,o=me(this,tn),h=me(this,Kl),l=me(this,Lh),d=e!==n?e.state:me(this,Rf),{state:g}=e;let p={...g},m=!1,y;if(i._optimisticResults){const O=this.hasListeners(),D=!O&&qE(e,i),G=O&&HE(e,n,i,s);(D||G)&&(p={...p,...nR(g.data,e.options)}),i._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:w,errorUpdatedAt:_,status:v}=p;y=p.data;let x=!1;if(i.placeholderData!==void 0&&y===void 0&&v==="pending"){let O;o!=null&&o.isPlaceholderData&&i.placeholderData===(l==null?void 0:l.placeholderData)?(O=o.data,x=!0):O=typeof i.placeholderData=="function"?i.placeholderData((L=me(this,Rh))==null?void 0:L.state.data,me(this,Rh)):i.placeholderData,O!==void 0&&(v="success",y=T_(o==null?void 0:o.data,O,i),m=!0)}if(i.select&&y!==void 0&&!x)if(o&&y===(h==null?void 0:h.data)&&i.select===me(this,Of))y=me(this,Bh);else try{Ct(this,Of,i.select),y=i.select(y),y=T_(o==null?void 0:o.data,y,i),Ct(this,Bh,y),Ct(this,Do,null)}catch(O){Ct(this,Do,O)}me(this,Do)&&(w=me(this,Do),y=me(this,Bh),_=Date.now(),v="error");const C=p.fetchStatus==="fetching",k=v==="pending",T=v==="error",N=k&&C,j=y!==void 0,E={status:v,fetchStatus:p.fetchStatus,isPending:k,isSuccess:v==="success",isError:T,isInitialLoading:N,isLoading:N,data:y,dataUpdatedAt:p.dataUpdatedAt,error:w,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!k,isLoadingError:T&&!j,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:T&&j,isStale:IC(e,i),refetch:this.refetch,promise:me(this,Ba),isEnabled:os(i.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=E.data!==void 0,D=E.status==="error"&&!O,G=$=>{D?$.reject(E.error):O&&$.resolve(E.data)},q=()=>{const $=Ct(this,Ba,E.promise=E_());G($)},U=me(this,Ba);switch(U.status){case"pending":e.queryHash===n.queryHash&&G(U);break;case"fulfilled":(D||E.data!==U.value)&&q();break;case"rejected":(!D||E.error!==U.reason)&&q();break}}return E}updateResult(){const e=me(this,tn),i=this.createResult(me(this,kr),this.options);if(Ct(this,Kl,me(this,kr).state),Ct(this,Lh,this.options),me(this,Kl).data!==void 0&&Ct(this,Rh,me(this,kr)),wm(i,e))return;Ct(this,tn,i);const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!me(this,Oh).size)return!0;const h=new Set(o??me(this,Oh));return this.options.throwOnError&&h.add("error"),Object.keys(me(this,tn)).some(l=>{const u=l;return me(this,tn)[u]!==e[u]&&h.has(u)})};fr(this,Dr,sR).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,Dr,L_).call(this)}},_n=new WeakMap,kr=new WeakMap,Rf=new WeakMap,tn=new WeakMap,Kl=new WeakMap,Lh=new WeakMap,Ba=new WeakMap,Do=new WeakMap,Of=new WeakMap,Bh=new WeakMap,Rh=new WeakMap,Vl=new WeakMap,Yl=new WeakMap,Io=new WeakMap,Oh=new WeakMap,Dr=new WeakSet,Fd=function(e){fr(this,Dr,O_).call(this);let i=me(this,kr).fetch(this.options,e);return e!=null&&e.throwOnError||(i=i.catch(rn)),i},A_=function(){fr(this,Dr,B_).call(this);const e=Go(this.options.staleTime,me(this,kr));if(rc||me(this,tn).isStale||!k_(e))return;const n=QB(me(this,tn).dataUpdatedAt,e)+1;Ct(this,Vl,Dl.setTimeout(()=>{me(this,tn).isStale||this.updateResult()},n))},j_=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,kr)):this.options.refetchInterval)??!1},M_=function(e){fr(this,Dr,R_).call(this),Ct(this,Io,e),!(rc||os(this.options.enabled,me(this,kr))===!1||!k_(me(this,Io))||me(this,Io)===0)&&Ct(this,Yl,Dl.setInterval(()=>{(this.options.refetchIntervalInBackground||DC.isFocused())&&fr(this,Dr,Fd).call(this)},me(this,Io)))},L_=function(){fr(this,Dr,A_).call(this),fr(this,Dr,M_).call(this,fr(this,Dr,j_).call(this))},B_=function(){me(this,Vl)&&(Dl.clearTimeout(me(this,Vl)),Ct(this,Vl,void 0))},R_=function(){me(this,Yl)&&(Dl.clearInterval(me(this,Yl)),Ct(this,Yl,void 0))},O_=function(){const e=me(this,_n).getQueryCache().build(me(this,_n),this.options);if(e===me(this,kr))return;const i=me(this,kr);Ct(this,kr,e),Ct(this,Rf,e.state),this.hasListeners()&&(i==null||i.removeObserver(this),e.addObserver(this))},sR=function(e){Si.batch(()=>{e.listeners&&this.listeners.forEach(i=>{i(me(this,tn))}),me(this,_n).getQueryCache().notify({query:me(this,kr),type:"observerResultsUpdated"})})},UB);function dz(r,e){return os(e.enabled,r)!==!1&&r.state.data===void 0&&!(r.state.status==="error"&&e.retryOnMount===!1)}function qE(r,e){return dz(r,e)||r.state.data!==void 0&&D_(r,e,e.refetchOnMount)}function D_(r,e,i){if(os(e.enabled,r)!==!1&&Go(e.staleTime,r)!=="static"){const n=typeof i=="function"?i(r):i;return n==="always"||n!==!1&&IC(r,e)}return!1}function HE(r,e,i,n){return(r!==e||os(n.enabled,r)===!1)&&(!i.suspense||r.state.status!=="error")&&IC(r,i)}function IC(r,e){return os(e.enabled,r)!==!1&&r.isStaleByTime(Go(e.staleTime,r))}function fz(r,e){return!wm(r.getCurrentResult(),e)}function UE(r){return{onFetch:(e,i)=>{var g,p,m,y,w;const n=e.options,s=(m=(p=(g=e.fetchOptions)==null?void 0:g.meta)==null?void 0:p.fetchMore)==null?void 0:m.direction,o=((y=e.state.data)==null?void 0:y.pages)||[],h=((w=e.state.data)==null?void 0:w.pageParams)||[];let l={pages:[],pageParams:[]},u=0;const d=async()=>{let _=!1;const v=k=>{nz(k,()=>e.signal,()=>_=!0)},x=eR(e.options,e.fetchOptions),C=async(k,T,N)=>{if(_)return Promise.reject();if(T==null&&k.pages.length)return Promise.resolve(k);const A=(()=>{const D={client:e.client,queryKey:e.queryKey,pageParam:T,direction:N?"backward":"forward",meta:e.options.meta};return v(D),D})(),E=await x(A),{maxPages:L}=e.options,O=N?iz:rz;return{pages:O(k.pages,E,L),pageParams:O(k.pageParams,T,L)}};if(s&&o.length){const k=s==="backward",T=k?pz:WE,N={pages:o,pageParams:h},j=T(n,N);l=await C(N,j,k)}else{const k=r??o.length;do{const T=u===0?h[0]??n.initialPageParam:WE(n,l);if(u>0&&T==null)break;l=await C(l,T),u++}while(u<k)}return l};e.options.persister?e.fetchFn=()=>{var _,v;return(v=(_=e.options).persister)==null?void 0:v.call(_,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},i)}:e.fetchFn=d}}}function WE(r,{pages:e,pageParams:i}){const n=e.length-1;return e.length>0?r.getNextPageParam(e[n],e,i[n],i):void 0}function pz(r,{pages:e,pageParams:i}){var n;return e.length>0?(n=r.getPreviousPageParam)==null?void 0:n.call(r,e[0],e,i[0],i):void 0}var Df,Xs,Vi,Xl,Zs,No,WB,gz=(WB=class extends iR{constructor(e){super();Wt(this,Zs);Wt(this,Df);Wt(this,Xs);Wt(this,Vi);Wt(this,Xl);Ct(this,Df,e.client),this.mutationId=e.mutationId,Ct(this,Vi,e.mutationCache),Ct(this,Xs,[]),this.state=e.state||aR(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){me(this,Xs).includes(e)||(me(this,Xs).push(e),this.clearGcTimeout(),me(this,Vi).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ct(this,Xs,me(this,Xs).filter(i=>i!==e)),this.scheduleGc(),me(this,Vi).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){me(this,Xs).length||(this.state.status==="pending"?this.scheduleGc():me(this,Vi).remove(this))}continue(){var e;return((e=me(this,Xl))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var h,l,u,d,g,p,m,y,w,_,v,x,C,k,T,N,j,A;const i=()=>{fr(this,Zs,No).call(this,{type:"continue"})},n={client:me(this,Df),meta:this.options.meta,mutationKey:this.options.mutationKey};Ct(this,Xl,rR({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(E,L)=>{fr(this,Zs,No).call(this,{type:"failed",failureCount:E,error:L})},onPause:()=>{fr(this,Zs,No).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>me(this,Vi).canRun(this)}));const s=this.state.status==="pending",o=!me(this,Xl).canStart();try{if(s)i();else{fr(this,Zs,No).call(this,{type:"pending",variables:e,isPaused:o}),me(this,Vi).config.onMutate&&await me(this,Vi).config.onMutate(e,this,n);const L=await((l=(h=this.options).onMutate)==null?void 0:l.call(h,e,n));L!==this.state.context&&fr(this,Zs,No).call(this,{type:"pending",context:L,variables:e,isPaused:o})}const E=await me(this,Xl).start();return await((d=(u=me(this,Vi).config).onSuccess)==null?void 0:d.call(u,E,e,this.state.context,this,n)),await((p=(g=this.options).onSuccess)==null?void 0:p.call(g,E,e,this.state.context,n)),await((y=(m=me(this,Vi).config).onSettled)==null?void 0:y.call(m,E,null,this.state.variables,this.state.context,this,n)),await((_=(w=this.options).onSettled)==null?void 0:_.call(w,E,null,e,this.state.context,n)),fr(this,Zs,No).call(this,{type:"success",data:E}),E}catch(E){try{await((x=(v=me(this,Vi).config).onError)==null?void 0:x.call(v,E,e,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((k=(C=this.options).onError)==null?void 0:k.call(C,E,e,this.state.context,n))}catch(L){Promise.reject(L)}try{await((N=(T=me(this,Vi).config).onSettled)==null?void 0:N.call(T,void 0,E,this.state.variables,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((A=(j=this.options).onSettled)==null?void 0:A.call(j,void 0,E,e,this.state.context,n))}catch(L){Promise.reject(L)}throw fr(this,Zs,No).call(this,{type:"error",error:E}),E}finally{me(this,Vi).runNext(this)}}},Df=new WeakMap,Xs=new WeakMap,Vi=new WeakMap,Xl=new WeakMap,Zs=new WeakSet,No=function(e){const i=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Si.batch(()=>{me(this,Xs).forEach(n=>{n.onMutationUpdate(e)}),me(this,Vi).notify({mutation:this,type:"updated",action:e})})},WB);function aR(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ra,Cs,If,GB,mz=(GB=class extends du{constructor(e={}){super();Wt(this,Ra);Wt(this,Cs);Wt(this,If);this.config=e,Ct(this,Ra,new Set),Ct(this,Cs,new Map),Ct(this,If,0)}build(e,i,n){const s=new gz({client:e,mutationCache:this,mutationId:++cg(this,If)._,options:e.defaultMutationOptions(i),state:n});return this.add(s),s}add(e){me(this,Ra).add(e);const i=hg(e);if(typeof i=="string"){const n=me(this,Cs).get(i);n?n.push(e):me(this,Cs).set(i,[e])}this.notify({type:"added",mutation:e})}remove(e){if(me(this,Ra).delete(e)){const i=hg(e);if(typeof i=="string"){const n=me(this,Cs).get(i);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&me(this,Cs).delete(i)}}this.notify({type:"removed",mutation:e})}canRun(e){const i=hg(e);if(typeof i=="string"){const n=me(this,Cs).get(i),s=n==null?void 0:n.find(o=>o.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const i=hg(e);if(typeof i=="string"){const s=(n=me(this,Cs).get(i))==null?void 0:n.find(o=>o!==e&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Si.batch(()=>{me(this,Ra).forEach(e=>{this.notify({type:"removed",mutation:e})}),me(this,Ra).clear(),me(this,Cs).clear()})}getAll(){return Array.from(me(this,Ra))}find(e){const i={exact:!0,...e};return this.getAll().find(n=>IE(i,n))}findAll(e={}){return this.getAll().filter(i=>IE(e,i))}notify(e){Si.batch(()=>{this.listeners.forEach(i=>{i(e)})})}resumePausedMutations(){const e=this.getAll().filter(i=>i.state.isPaused);return Si.batch(()=>Promise.all(e.map(i=>i.continue().catch(rn))))}},Ra=new WeakMap,Cs=new WeakMap,If=new WeakMap,GB);function hg(r){var e;return(e=r.options.scope)==null?void 0:e.id}var Oa,Fo,Cn,Da,Ha,im,I_,KB,yz=(KB=class extends du{constructor(i,n){super();Wt(this,Ha);Wt(this,Oa);Wt(this,Fo);Wt(this,Cn);Wt(this,Da);Ct(this,Oa,i),this.setOptions(n),this.bindMethods(),fr(this,Ha,im).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(i){var s;const n=this.options;this.options=me(this,Oa).defaultMutationOptions(i),wm(this.options,n)||me(this,Oa).getMutationCache().notify({type:"observerOptionsUpdated",mutation:me(this,Cn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ic(n.mutationKey)!==ic(this.options.mutationKey)?this.reset():((s=me(this,Cn))==null?void 0:s.state.status)==="pending"&&me(this,Cn).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=me(this,Cn))==null||i.removeObserver(this)}onMutationUpdate(i){fr(this,Ha,im).call(this),fr(this,Ha,I_).call(this,i)}getCurrentResult(){return me(this,Fo)}reset(){var i;(i=me(this,Cn))==null||i.removeObserver(this),Ct(this,Cn,void 0),fr(this,Ha,im).call(this),fr(this,Ha,I_).call(this)}mutate(i,n){var s;return Ct(this,Da,n),(s=me(this,Cn))==null||s.removeObserver(this),Ct(this,Cn,me(this,Oa).getMutationCache().build(me(this,Oa),this.options)),me(this,Cn).addObserver(this),me(this,Cn).execute(i)}},Oa=new WeakMap,Fo=new WeakMap,Cn=new WeakMap,Da=new WeakMap,Ha=new WeakSet,im=function(){var n;const i=((n=me(this,Cn))==null?void 0:n.state)??aR();Ct(this,Fo,{...i,isPending:i.status==="pending",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset})},I_=function(i){Si.batch(()=>{var n,s,o,h,l,u,d,g;if(me(this,Da)&&this.hasListeners()){const p=me(this,Fo).variables,m=me(this,Fo).context,y={client:me(this,Oa),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(s=(n=me(this,Da)).onSuccess)==null||s.call(n,i.data,p,m,y)}catch(w){Promise.reject(w)}try{(h=(o=me(this,Da)).onSettled)==null||h.call(o,i.data,null,p,m,y)}catch(w){Promise.reject(w)}}else if((i==null?void 0:i.type)==="error"){try{(u=(l=me(this,Da)).onError)==null||u.call(l,i.error,p,m,y)}catch(w){Promise.reject(w)}try{(g=(d=me(this,Da)).onSettled)==null||g.call(d,void 0,i.error,p,m,y)}catch(w){Promise.reject(w)}}}this.listeners.forEach(p=>{p(me(this,Fo))})})},KB),Qs,VB,bz=(VB=class extends du{constructor(e={}){super();Wt(this,Qs);this.config=e,Ct(this,Qs,new Map)}build(e,i,n){const s=i.queryKey,o=i.queryHash??BC(s,i);let h=this.get(o);return h||(h=new hz({client:e,queryKey:s,queryHash:o,options:e.defaultQueryOptions(i),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(h)),h}add(e){me(this,Qs).has(e.queryHash)||(me(this,Qs).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const i=me(this,Qs).get(e.queryHash);i&&(e.destroy(),i===e&&me(this,Qs).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Si.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return me(this,Qs).get(e)}getAll(){return[...me(this,Qs).values()]}find(e){const i={exact:!0,...e};return this.getAll().find(n=>DE(i,n))}findAll(e={}){const i=this.getAll();return Object.keys(e).length>0?i.filter(n=>DE(e,n)):i}notify(e){Si.batch(()=>{this.listeners.forEach(i=>{i(e)})})}onFocus(){Si.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Si.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qs=new WeakMap,VB),hi,$o,Po,Dh,Ih,zo,Fh,$h,YB,vz=(YB=class{constructor(r={}){Wt(this,hi);Wt(this,$o);Wt(this,Po);Wt(this,Dh);Wt(this,Ih);Wt(this,zo);Wt(this,Fh);Wt(this,$h);Ct(this,hi,r.queryCache||new bz),Ct(this,$o,r.mutationCache||new mz),Ct(this,Po,r.defaultOptions||{}),Ct(this,Dh,new Map),Ct(this,Ih,new Map),Ct(this,zo,0)}mount(){cg(this,zo)._++,me(this,zo)===1&&(Ct(this,Fh,DC.subscribe(async r=>{r&&(await this.resumePausedMutations(),me(this,hi).onFocus())})),Ct(this,$h,km.subscribe(async r=>{r&&(await this.resumePausedMutations(),me(this,hi).onOnline())})))}unmount(){var r,e;cg(this,zo)._--,me(this,zo)===0&&((r=me(this,Fh))==null||r.call(this),Ct(this,Fh,void 0),(e=me(this,$h))==null||e.call(this),Ct(this,$h,void 0))}isFetching(r){return me(this,hi).findAll({...r,fetchStatus:"fetching"}).length}isMutating(r){return me(this,$o).findAll({...r,status:"pending"}).length}getQueryData(r){var i;const e=this.defaultQueryOptions({queryKey:r});return(i=me(this,hi).get(e.queryHash))==null?void 0:i.state.data}ensureQueryData(r){const e=this.defaultQueryOptions(r),i=me(this,hi).build(this,e),n=i.state.data;return n===void 0?this.fetchQuery(r):(r.revalidateIfStale&&i.isStaleByTime(Go(e.staleTime,i))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(r){return me(this,hi).findAll(r).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(r,e,i){const n=this.defaultQueryOptions({queryKey:r}),s=me(this,hi).get(n.queryHash),o=s==null?void 0:s.state.data,h=QP(e,o);if(h!==void 0)return me(this,hi).build(this,n).setData(h,{...i,manual:!0})}setQueriesData(r,e,i){return Si.batch(()=>me(this,hi).findAll(r).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(r){var i;const e=this.defaultQueryOptions({queryKey:r});return(i=me(this,hi).get(e.queryHash))==null?void 0:i.state}removeQueries(r){const e=me(this,hi);Si.batch(()=>{e.findAll(r).forEach(i=>{e.remove(i)})})}resetQueries(r,e){const i=me(this,hi);return Si.batch(()=>(i.findAll(r).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...r},e)))}cancelQueries(r,e={}){const i={revert:!0,...e},n=Si.batch(()=>me(this,hi).findAll(r).map(s=>s.cancel(i)));return Promise.all(n).then(rn).catch(rn)}invalidateQueries(r,e={}){return Si.batch(()=>(me(this,hi).findAll(r).forEach(i=>{i.invalidate()}),(r==null?void 0:r.refetchType)==="none"?Promise.resolve():this.refetchQueries({...r,type:(r==null?void 0:r.refetchType)??(r==null?void 0:r.type)??"active"},e)))}refetchQueries(r,e={}){const i={...e,cancelRefetch:e.cancelRefetch??!0},n=Si.batch(()=>me(this,hi).findAll(r).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,i);return i.throwOnError||(o=o.catch(rn)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(rn)}fetchQuery(r){const e=this.defaultQueryOptions(r);e.retry===void 0&&(e.retry=!1);const i=me(this,hi).build(this,e);return i.isStaleByTime(Go(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(r){return this.fetchQuery(r).then(rn).catch(rn)}fetchInfiniteQuery(r){return r.behavior=UE(r.pages),this.fetchQuery(r)}prefetchInfiniteQuery(r){return this.fetchInfiniteQuery(r).then(rn).catch(rn)}ensureInfiniteQueryData(r){return r.behavior=UE(r.pages),this.ensureQueryData(r)}resumePausedMutations(){return km.isOnline()?me(this,$o).resumePausedMutations():Promise.resolve()}getQueryCache(){return me(this,hi)}getMutationCache(){return me(this,$o)}getDefaultOptions(){return me(this,Po)}setDefaultOptions(r){Ct(this,Po,r)}setQueryDefaults(r,e){me(this,Dh).set(ic(r),{queryKey:r,defaultOptions:e})}getQueryDefaults(r){const e=[...me(this,Dh).values()],i={};return e.forEach(n=>{pf(r,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(r,e){me(this,Ih).set(ic(r),{mutationKey:r,defaultOptions:e})}getMutationDefaults(r){const e=[...me(this,Ih).values()],i={};return e.forEach(n=>{pf(r,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(r){if(r._defaulted)return r;const e={...me(this,Po).queries,...this.getQueryDefaults(r.queryKey),...r,_defaulted:!0};return e.queryHash||(e.queryHash=BC(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===RC&&(e.enabled=!1),e}defaultMutationOptions(r){return r!=null&&r._defaulted?r:{...me(this,Po).mutations,...(r==null?void 0:r.mutationKey)&&this.getMutationDefaults(r.mutationKey),...r,_defaulted:!0}}clear(){me(this,hi).clear(),me(this,$o).clear()}},hi=new WeakMap,$o=new WeakMap,Po=new WeakMap,Dh=new WeakMap,Ih=new WeakMap,zo=new WeakMap,Fh=new WeakMap,$h=new WeakMap,YB),oR=R.createContext(void 0),rr=r=>{const e=R.useContext(oR);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},GE=({client:r,children:e})=>(R.useEffect(()=>(r.mount(),()=>{r.unmount()}),[r]),a.jsx(oR.Provider,{value:r,children:e})),lR=R.createContext(!1),xz=()=>R.useContext(lR);lR.Provider;function _z(){let r=!1;return{clearReset:()=>{r=!1},reset:()=>{r=!0},isReset:()=>r}}var Cz=R.createContext(_z()),wz=()=>R.useContext(Cz),kz=(r,e,i)=>{const n=i!=null&&i.state.error&&typeof r.throwOnError=="function"?OC(r.throwOnError,[i.state.error,i]):r.throwOnError;(r.suspense||r.experimental_prefetchInRender||n)&&(e.isReset()||(r.retryOnMount=!1))},Sz=r=>{R.useEffect(()=>{r.clearReset()},[r])},Tz=({result:r,errorResetBoundary:e,throwOnError:i,query:n,suspense:s})=>r.isError&&!e.isReset()&&!r.isFetching&&n&&(s&&r.data===void 0||OC(i,[r.error,n])),Ez=r=>{if(r.suspense){const i=s=>s==="static"?s:Math.max(s??1e3,1e3),n=r.staleTime;r.staleTime=typeof n=="function"?(...s)=>i(n(...s)):i(n),typeof r.gcTime=="number"&&(r.gcTime=Math.max(r.gcTime,1e3))}},Nz=(r,e)=>r.isLoading&&r.isFetching&&!e,Az=(r,e)=>(r==null?void 0:r.suspense)&&e.isPending,KE=(r,e,i)=>e.fetchOptimistic(r).catch(()=>{i.clearReset()});function jz(r,e,i){var m,y,w,_;const n=xz(),s=wz(),o=rr(),h=o.defaultQueryOptions(r);(y=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||y.call(m,h);const l=o.getQueryCache().get(h.queryHash);h._optimisticResults=n?"isRestoring":"optimistic",Ez(h),kz(h,s,l),Sz(s);const u=!o.getQueryCache().get(h.queryHash),[d]=R.useState(()=>new e(o,h)),g=d.getOptimisticResult(h),p=!n&&r.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(v=>{const x=p?d.subscribe(Si.batchCalls(v)):rn;return d.updateResult(),x},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(h)},[h,d]),Az(h,g))throw KE(h,d,s);if(Tz({result:g,errorResetBoundary:s,throwOnError:h.throwOnError,query:l,suspense:h.suspense}))throw g.error;if((_=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||_.call(w,h,g),h.experimental_prefetchInRender&&!rc&&Nz(g,n)){const v=u?KE(h,d,s):l==null?void 0:l.promise;v==null||v.catch(rn).finally(()=>{d.updateResult()})}return h.notifyOnChangeProps?g:d.trackResult(g)}function Zt(r,e){return jz(r,uz)}function sr(r,e){const i=rr(),[n]=R.useState(()=>new yz(i,r));R.useEffect(()=>{n.setOptions(r)},[n,r]);const s=R.useSyncExternalStore(R.useCallback(h=>n.subscribe(Si.batchCalls(h)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=R.useCallback((h,l)=>{n.mutate(h,l).catch(rn)},[n]);if(s.error&&OC(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const Mz="/api";let Sm=null;function FC(r){Sm=r}function cR(){return Sm}class Lz{async request(e,i){const n={"Content-Type":"application/json",...i==null?void 0:i.headers};Sm&&(n["X-Dreamcontext-Vault"]=Sm);const s=await fetch(`${Mz}${e}`,{...i,headers:n});if(!s.ok){let o=`Request failed: ${s.status}`;try{const h=await s.json();h.message&&(o=h.message)}catch{}throw new Error(o)}return await s.json()}get(e){return this.request(e)}post(e,i){return this.request(e,{method:"POST",body:JSON.stringify(i)})}patch(e,i){return this.request(e,{method:"PATCH",body:JSON.stringify(i)})}put(e,i){return this.request(e,{method:"PUT",body:JSON.stringify(i)})}del(e){return this.request(e,{method:"DELETE"})}}const ze=new Lz;function hR(){const{data:r}=Zt({queryKey:["health"],queryFn:()=>ze.get("/health"),staleTime:6e4,retry:1});return{health:r,serverCurrent:(r==null?void 0:r.version)==="0.14.0"}}const Bz=[["vaults"],["launcher-status"],["launcher-federation-graph"],["connections"]];function gc(r){for(const e of Bz)r.invalidateQueries({queryKey:e})}function Rz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/register",e),onSuccess:()=>{gc(r)}})}function Oz(){return Zt({queryKey:["launcher-defaults"],queryFn:()=>ze.get("/launcher/defaults"),staleTime:1/0})}function Dz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/scaffold",e),onSuccess:()=>{gc(r)}})}function Iz(){return Zt({queryKey:["launcher-catalog"],queryFn:()=>ze.get("/launcher/catalog"),staleTime:1/0})}async function Fz(r){return ze.get(`/launcher/detect?path=${encodeURIComponent(r)}`)}function uR(r=!0){return Zt({queryKey:["launcher-status"],queryFn:()=>ze.get("/launcher/status"),enabled:r})}function dR(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/update",{name:e}),onSuccess:()=>{gc(r)}})}function $z(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/unregister",{name:e}),onSuccess:()=>{gc(r)}})}function Pz(){return Zt({queryKey:["launcher-federation-graph"],queryFn:()=>ze.get("/launcher/federation-graph")})}function zz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/connection",e),onSuccess:()=>{gc(r)}})}function qz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/connection/remove",e),onSuccess:()=>{gc(r)}})}function Hz(){const r=rr();return sr({mutationFn:e=>ze.post("/launcher/shareable",e),onSuccess:()=>{gc(r)}})}const Pn={status:["brain-status"],settings:["brain-settings"],authStatus:["brain-auth-status"],discover:["brain-discover"],teamUpdates:["brain-team-updates"]};function Ty(r){r.invalidateQueries({queryKey:Pn.status}),r.invalidateQueries({queryKey:Pn.settings}),r.invalidateQueries({queryKey:Pn.teamUpdates})}function fR(){return Zt({queryKey:Pn.status,queryFn:()=>ze.get("/brain/status")})}function Uz(){return Zt({queryKey:Pn.settings,queryFn:()=>ze.get("/brain/settings")})}function Wz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/settings",{enabled:e}),onSuccess:e=>{r.setQueryData(Pn.settings,e),Ty(r)}})}function $C(){return Zt({queryKey:Pn.authStatus,queryFn:()=>ze.get("/brain/auth/status")})}function Gz(){return sr({mutationFn:()=>ze.post("/brain/auth/device/start",{})})}function Kz(){return sr({mutationFn:r=>ze.post("/brain/auth/device/poll",{sessionId:r})})}function Vz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/auth/token",{token:e}),onSuccess:e=>r.setQueryData(Pn.authStatus,e)})}function Yz(){const r=rr();return sr({mutationFn:()=>ze.post("/brain/auth/logout",{}),onSuccess:e=>r.setQueryData(Pn.authStatus,e)})}function Xz(r){return Zt({queryKey:Pn.discover,queryFn:()=>ze.get("/brain/discover"),select:e=>e.repos,enabled:r,retry:!1})}function Zz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/create",e),onSuccess:()=>Ty(r)})}function Qz(){return sr({mutationFn:r=>ze.post("/brain/attach-preview",{url:r})})}function Jz(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/attach",e),onSuccess:()=>Ty(r)})}function e7(){const r=rr();return sr({mutationFn:()=>ze.post("/brain/disconnect",{}),onSuccess:()=>Ty(r)})}function pR(){return Zt({queryKey:Pn.teamUpdates,queryFn:()=>ze.get("/brain/team/updates"),select:r=>r.vaults})}function gR(){const r=rr();return sr({mutationFn:e=>ze.post("/brain/team/fetch",e?{vault:e}:{}),onSuccess:()=>{r.invalidateQueries({queryKey:Pn.teamUpdates}),r.invalidateQueries({queryKey:Pn.status})}})}const t7="modulepreload",r7=function(r){return"/"+r},VE={},Xt=function(e,i,n){let s=Promise.resolve();if(i&&i.length>0){let h=function(d){return Promise.all(d.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=h(i.map(d=>{if(d=r7(d),d in VE)return;VE[d]=!0;const g=d.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=g?"stylesheet":t7,g||(m.as="script"),m.crossOrigin="",m.href=d,u&&m.setAttribute("nonce",u),document.head.appendChild(m),g)return new Promise((y,w)=>{m.addEventListener("load",y),m.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(h){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=h,window.dispatchEvent(l),!l.defaultPrevented)throw h}return s.then(h=>{for(const l of h||[])l.status==="rejected"&&o(l.reason);return e().catch(o)})};function un(){return!!window.__TAURI_INTERNALS__}const i7='button, input, a, select, textarea, [role="button"], [data-no-drag]';function PC(r){return r instanceof Element&&r.closest(i7)!==null}async function n7(r){if(un()&&!PC(r))try{const{getCurrentWindow:e}=await Xt(async()=>{const{getCurrentWindow:i}=await import("./window-DmNpeJAL.js").then(n=>n.w);return{getCurrentWindow:i}},__vite__mapDeps([0,1,2]));await e().startDragging()}catch{}}async function s7(){if(un())try{const{getCurrentWindow:r}=await Xt(async()=>{const{getCurrentWindow:e}=await import("./window-DmNpeJAL.js").then(i=>i.w);return{getCurrentWindow:e}},__vite__mapDeps([0,1,2]));await r().close()}catch{}}function mR(r){if(r.button!==0)return;const e=r.target;if(PC(e))return;const i=r.clientX,n=r.clientY,s=h=>{(Math.abs(h.clientX-i)>4||Math.abs(h.clientY-n)>4)&&(o(),n7(e))},o=()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",o)};window.addEventListener("mousemove",s),window.addEventListener("mouseup",o)}async function yR(r){if(un()&&!PC(r))try{const{getCurrentWindow:e}=await Xt(async()=>{const{getCurrentWindow:i}=await import("./window-DmNpeJAL.js").then(n=>n.w);return{getCurrentWindow:i}},__vite__mapDeps([0,1,2]));await e().toggleMaximize()}catch{}}async function a7(){if(un()){const{open:e}=await Xt(async()=>{const{open:n}=await import("./index-NsrznfmA.js");return{open:n}},__vite__mapDeps([3,1])),i=await e({directory:!0,multiple:!1});return typeof i=="string"?i:null}const r=window.prompt("Enter an absolute path to a dreamcontext project:");return r&&r.trim()?r.trim():null}async function o7(){if(un())try{const{open:e}=await Xt(async()=>{const{open:n}=await import("./index-NsrznfmA.js");return{open:n}},__vite__mapDeps([3,1])),i=await e({directory:!1,multiple:!0});return Array.isArray(i)?i.filter(n=>typeof n=="string"):typeof i=="string"?[i]:[]}catch{return[]}const r=window.prompt("Enter absolute file path(s), comma-separated:");return r?r.split(",").map(e=>e.trim()).filter(Boolean):[]}function bR(r,e){return new Promise((i,n)=>{r.once("tauri://created",()=>i()),r.once("tauri://error",s=>n(new Error(`${e} window create failed: ${String(s.payload)}`)))})}async function vR(r){if(un()){const{WebviewWindow:e}=await Xt(async()=>{const{WebviewWindow:o}=await import("./webviewWindow-BbG9Cr7f.js");return{WebviewWindow:o}},__vite__mapDeps([4,0,1,2])),i=`vault-${r.replace(/[^a-zA-Z0-9_-]/g,"-")}`,n=await e.getByLabel(i);if(n){await n.setFocus();return}const s=new e(i,{url:`${window.location.origin}/?vault=${encodeURIComponent(r)}`,title:`dreamcontext — ${r}`,width:1280,height:800,titleBarStyle:"overlay",hiddenTitle:!0,dragDropEnabled:!1});await bR(s,`vault "${r}"`);return}window.open(`/?vault=${encodeURIComponent(r)}`,"_blank")}async function l7(){if(un()){const{WebviewWindow:r}=await Xt(async()=>{const{WebviewWindow:n}=await import("./webviewWindow-BbG9Cr7f.js");return{WebviewWindow:n}},__vite__mapDeps([4,0,1,2])),e=await r.getByLabel("main");if(e){await e.setFocus();return}const i=new r("main",{url:`${window.location.origin}/`,title:"dreamcontext",width:1280,height:800,titleBarStyle:"overlay",hiddenTitle:!0,dragDropEnabled:!1});await bR(i,"launcher");return}window.location.assign(`${window.location.origin}/`)}async function YE(r){await vR(r)}function Tm({exists:r,needsUpdate:e,title:i,className:n}){const s=r?e?"stale":"ok":"gone";return a.jsx("span",{className:`vault-dot vault-dot--${s}${n?` ${n}`:""}`,title:i,"aria-hidden":"true"})}const c7={en:{"nav.brain":"Map","nav.tasks":"Tasks","nav.roadmap":"Roadmap","nav.labpage":"Insights","nav.core":"Core","nav.knowledge":"Knowledge","nav.sleep":"Sleep Cycle","nav.council":"Council","nav.settings":"Settings","nav.packs":"Packs","nav.taxonomy":"Taxonomy","nav.about":"What is this?","nav.lab":"Lab","nav.beta":"Beta","nav.group.workspace":"Workspace","nav.group.memory":"Memory","nav.group.brain":"Brain","nav.group.control":"Control Panel","nav.collapse":"Collapse","nav.expand":"Expand","council.title":"Council","council.tab.verdict":"Verdict","council.tab.matrix":"Matrix","council.tab.transcript":"Transcript","council.search.placeholder":"Search sessions…","council.search.matrix":"Filter cells by text…","council.search.transcript":"Search transcript…","council.filter.all":"All","council.filter.status":"Status","council.inspector.empty":"Select a persona or cell to inspect.","council.inspector.selectCell":"Select a cell in the matrix for round details.","council.verdict.awaitingSynthesis":"Awaiting synthesis","council.verdict.synthPending":"The final report will appear here once the synthesizer runs.","council.empty.list":"No debates yet.","council.empty.detail":"Select a council session from the list.","council.lab.tagline":"A panel of AI personas debates a hard decision across rounds, then synthesizes a verdict you can trace.","council.new":"New debate","council.empty.cta":"Start your first debate","council.empty.nomatch":"No debates match your search.","tasks.title":"Tasks","tasks.create":"New Task","tasks.filter":"Filter","tasks.todo":"To Do","tasks.in_progress":"In Progress","tasks.in_review":"In Review","tasks.completed":"Completed","tasks.name":"Task Name","tasks.description":"Description","tasks.priority":"Priority","tasks.tags":"Tags","tasks.save":"Create Task","tasks.cancel":"Cancel","tasks.changelog":"Changelog","tasks.add_entry":"Add Entry","tasks.customFields.sectionLabel":"Custom","rice.title":"RICE","rice.reach":"Reach","rice.impact":"Impact","rice.confidence":"Confidence","rice.effort":"Effort","rice.score":"Score","rice.clear":"Clear RICE","rice.tooltip.reach":"How many people / sessions / units affected (1–10)","rice.tooltip.impact":"How much per affected unit (1=minimal, 5=massive)","rice.tooltip.confidence":"How sure are you? (25, 50, 75, 100)","rice.tooltip.effort":"Person-weeks (0.5–8 typical, max 52)","rice.empty":"Not rated","sort.rice":"RICE score","filter.min_rice":"Min RICE","priority.critical":"Critical","priority.high":"High","priority.medium":"Medium","priority.low":"Low","sleep.title":"Sleep State","sleep.debt":"Debt","sleep.level":"Level","sleep.last_sleep":"Last Sleep","sleep.sessions":"Sessions","sleep.alert":"Alert","sleep.drowsy":"Drowsy","sleep.sleepy":"Sleepy","sleep.must_sleep":"Must Sleep","sleep.active":"Sleeping","sleep.waiting":"Waiting to sleep…","sleep.menu.details":"Show sleep details","sleep.menu.run":"Run sleep agent","sleep.menu.run.disabled":"Agent unavailable — needs the desktop app with node-pty + the Claude CLI","sleep.menu.run.active":"A consolidation is already in progress","sleep.menu.run.waiting":"Waiting for the sleep agent to start…","sleep.changelog":"Changelog","sleep.changelog.pending":"Will fold into next sleep","sleep.changelog.breaking":"BREAKING","sleep.changelog.earlier":"earlier entries not shown","sleep.summary":"Summary","sleep.never":"Never","sleep.tagline.alert":"Wide awake. Your project memory is fresh and fully consolidated.","sleep.tagline.drowsy":"Resting easy. A handful of new memories have gathered since the last sleep.","sleep.tagline.sleepy":"Getting drowsy. A consolidation will soon weave recent work into long-term memory.","sleep.tagline.must_sleep":"It's time to sleep. Run a consolidation to fold recent work into long-term memory.","sleep.next.title":"Next sleep will consolidate","sleep.next.subtitle":"Everything captured since the last sleep — folded into long-term memory on the next cycle.","sleep.next.change":"change","sleep.next.changes":"changes","sleep.dashboard_changes":"Dashboard Changes","sleep.cloud.title":"Sleep cloud","sleep.cloud.subtitle":"Everything gathered since your last sleep — the next consolidation will weave it all into long-term memory.","sleep.cloud.item":"item","sleep.cloud.items":"items","sleep.cloud.stat.sessions":"Work sessions","sleep.cloud.stat.dashboard":"Dashboard edits","sleep.cloud.stat.highlights":"Highlights","sleep.cloud.stat.changelog":"Captured","sleep.cloud.group.dashboard":"Dashboard activity","sleep.cloud.group.dashboard.hint":"Manual edits you made in the dashboard — tasks, knowledge, features and more.","sleep.cloud.group.sessions":"Work sessions","sleep.cloud.group.sessions.hint":"Coding sessions since the last sleep, scored into the debt meter.","sleep.cloud.group.highlights":"Highlights","sleep.cloud.group.highlights.hint":"High-signal moments auto-tagged during work — processed first.","sleep.cloud.group.changelog":"Captured changelog","sleep.cloud.group.changelog.hint":"Shipped notes captured since the last sleep.","sleep.cloud.empty.title":"The cloud is clear","sleep.cloud.empty.sub":"Your memory is fully consolidated. New sessions and dashboard edits will gather here until the next sleep.","sleep.cloud.active":"Active","sleep.entity.task":"Tasks","sleep.entity.knowledge":"Knowledge","sleep.entity.feature":"Features","sleep.entity.core":"Core","sleep.entity.sleep":"Sleep","core.title":"Core Files","knowledge.title":"Knowledge","knowledge.pin":"Pin","knowledge.unpin":"Unpin","knowledge.search":"Search knowledge...","knowledge.fullscreen":"Full screen","settings.title":"Settings","settings.nav.platforms":"Platforms","settings.nav.tasks":"Cloud Tasks","settings.nav.format":"Task Format","settings.nav.memory":"Memory","settings.nav.connections":"Connections","settings.nav.brain":"Cloud sync","settings.nav.agents":"Agents","settings.nav.sleepy":"Sleepy","settings.navdesc.platforms":"Which AI coding agents this project uses","settings.navdesc.tasks":"Sync tasks to ClickUp or GitHub","settings.navdesc.format":"Add custom fields to your tasks","settings.navdesc.memory":"Control Claude's built-in memory","settings.navdesc.connections":"Share knowledge between your projects","settings.navdesc.brain":"Back up and share your project memory on GitHub","settings.navdesc.agents":"The in-app Claude Code panel","settings.navdesc.sleepy":"Notch quick-capture hotkey","settings.desc.platforms":"Tell dreamcontext which AI coding agents you use. It installs the right hooks and context files for each one so your project memory loads automatically.","settings.desc.tasks":"By default your tasks live in local files. Turn this on to mirror them to a cloud backend (ClickUp or GitHub Issues) so your team can see them too — recall, snapshots and this dashboard keep working either way.","settings.desc.memory":"dreamcontext can be the single source of your project's memory instead of Claude Code's built-in memory file.","settings.desc.brain":"Sign in with GitHub and connect a brain repo to back up your project memory to the cloud and share it with your team. Off by default — nothing syncs until you turn it on.","settings.agents.title":"Agents — in-app Claude Code","settings.agents.enable":"Enable the Agents surface","settings.agents.enable_hint":"Show the in-app agent launcher (the corner button and session dock). Turning this off hides it and closes any open agent view; running sessions keep going in the background.","settings.agents.restore_tabs":"Reopen past tabs on launch","settings.agents.restore_tabs_hint":"When the app starts, restore the agent/terminal tabs from your last session (agents resume their conversation). Off = always start with a clean slate.","settings.agents.default_agent":"Default agent","settings.agents.default_agent_hint":"Which agent a new session runs. Only Claude Code is available for now.","settings.agents.agent.claude":"Claude Code","settings.agents.auto_title":"Auto-name tabs from your first message","settings.agents.auto_title_hint":"Off by default. When on, after a new agent session's first turn a fast Haiku model reads your opening message and renames the tab to a short, descriptive title. Only tabs still named “Agent N” are renamed — tabs you've renamed yourself are never touched.","settings.agents.hotkey":"Quick open/close hotkey","settings.agents.hotkey_hint":"Press this anywhere in the app to open or close the Agents view. Default ⌃A. Click the field and press a new combo to rebind — or double-tap a single modifier (Ctrl, Option, ⌘, or Shift) to bind it as ⌃⌃-style two-taps. Backspace clears it. A chord yields to a focused terminal (close it with Esc or the collapse button); a double-tap toggles from anywhere, even inside a terminal.","settings.agents.hotkey_capturing":"Press a combo, or double-tap a modifier…","settings.platforms":"Platforms","settings.save":"Save","settings.saving":"Saving...","settings.saved":"Saved","settings.no_config":"No configuration file found. Saving will create one with your selections.","settings.platform.claude":"Claude (Anthropic)","settings.packs.installed":"Installed","settings.memory":"Memory","settings.brain":"Cloud sync","settings.native_memory.label":"Disable Claude's native memory","settings.native_memory.hint":"Recommended — dreamcontext becomes the single source of project memory instead of Claude Code’s built-in MEMORY.md.","settings.tasks":"Tasks","settings.cloud_tasks.label":"Cloud Task Management","settings.cloud_tasks.hint":"Tasks live in a remote backend; a gitignored local mirror keeps recall, snapshots, and the dashboard working unchanged.","settings.cloud_tasks.provider":"Provider","settings.cloud_tasks.provider.clickup":"ClickUp","settings.cloud_tasks.provider.github":"GitHub","settings.cloud_tasks.team":"Team ID","settings.cloud_tasks.space":"Space ID","settings.cloud_tasks.list":"List ID","settings.cloud_tasks.token_hint":"The key is saved to a gitignored secrets file (never in this config). You can also set it from the CLI with `dreamcontext config clickup-token`.","settings.cloud_tasks.github.hint":"Tasks sync to a GitHub repository's Issues; a gitignored local mirror keeps recall, snapshots, and the dashboard working unchanged.","settings.cloud_tasks.github.owner":"Owner","settings.cloud_tasks.github.repo":"Repository","settings.cloud_tasks.github.repo_picker":"Discovered repository","settings.cloud_tasks.github.pick":"Pick the repository to sync to…","settings.cloud_tasks.github.search":"Search repositories…","settings.cloud_tasks.github.token_hint":"The token is saved to a gitignored secrets file (never in this config). You can also set it from the CLI with `dreamcontext config github-token`. Needs `repo` scope (classic) or Issues read/write + Metadata (fine-grained).","settings.cloud_tasks.github.provision":"Provision labels","settings.cloud_tasks.github.provisioning":"Provisioning…","settings.cloud_tasks.list_pick":"Pick the list to sync to…","settings.cloud_tasks.list_search":"Search lists…","settings.cloud_tasks.keep_current":"(keep current)","settings.cloud_tasks.list_label":"List","settings.cloud_tasks.provision":"Provision fields","settings.cloud_tasks.provisioning":"Provisioning…","settings.cloud_tasks.test":"Test connection","settings.cloud_tasks.testing":"Testing…","settings.cloud_tasks.test_ok":"Connected as","settings.cloud_tasks.status":"Sync status","settings.cloud_tasks.pending":"pending push","settings.cloud_tasks.conflicts":"conflict(s) preserved in state/.conflicts/","settings.cloud_tasks.api_key":"API key","settings.cloud_tasks.api_key_placeholder":"Paste your API key…","settings.cloud_tasks.api_key_none":"No key saved yet — paste it above, then Test connection (it saves automatically).","settings.cloud_tasks.api_key_set":"Key saved ✓","settings.cloud_tasks.api_key_env":"Using an environment variable ✓ (overrides any saved key)","settings.cloud_tasks.preview_title":"These custom fields will be created on the list:","settings.cloud_tasks.github.preview_title":"These labels will be created on the repository:","settings.cloud_tasks.preview_will_create":"Will create ({n})","settings.cloud_tasks.preview_existing":"Already exist ({n})","settings.cloud_tasks.provision_confirm":"Create {n} now","settings.cloud_tasks.provision_creating":"Creating…","settings.cloud_tasks.provision_cancel":"Cancel","settings.cloud_tasks.provision_created":"Created","settings.cloud_tasks.provision_backfilled":"backfilled {n} value(s)","settings.cloud_tasks.provision_nothing":"All recommended fields already exist.","settings.federation":"Cross-Project Federation","settings.desc.connections":"Connect this project to your other dreamcontext projects so they can share knowledge. Everything here is off until you opt in.","federation.board.title":"Connection map","federation.board.desc":"Each card is one of your projects. Drag from one project to another to make the first read the second live. Click a project to see who reads it or to let others read it; click a wire to remove it.","federation.advanced":"More — list view, topic filters, inbox & sync preview","federation.vaults.desc":"Every dreamcontext project on this machine that this one can connect to.","federation.connections.desc":"Projects this one is already linked with. Set the direction and, optionally, limit which topics flow.","federation.add.desc":"Link a new project and choose whether you read from it, share to it, or both.","federation.inbox.desc":"Knowledge that connected projects have sent you. It folds into your memory on the next sleep cycle.","federation.preview.title":"Preview what you would share","federation.intro.title":"What is cross-project federation?","federation.intro.body":"Federation lets your projects share knowledge with each other. Connect two projects and one can “read” the other — its agent can recall decisions, changelog and knowledge from across the link. It’s off by default: nothing is shared until you opt in.","federation.intro.step1":"1. Turn on Sharing below so other projects are allowed to read this one.","federation.intro.step2":"2. Add a connection to a peer and choose the direction — read it, share to it, or both.","federation.intro.step3":"3. Incoming knowledge lands in the digest inbox and is folded in on the next sleep cycle.","federation.sharing":"Sharing","federation.shareable.label":"Let other projects read this one","federation.shareable.hint":"When on, projects you’ve connected may pull this project’s knowledge into their recall. Off = private (the default). This only controls who may READ you — it never stops you reading others.","federation.vaults":"Registered vaults","federation.vaults.empty":"No vaults registered. Run `dreamcontext vaults discover --register` to add sibling projects.","federation.current":"This project","federation.connections":"Connections","federation.connections.empty":"No connections yet. Add a peer below to read or share knowledge across projects.","federation.stale":"Stale","federation.remove":"Remove","federation.direction":"Direction","federation.direction.out":"→ Share to","federation.direction.in":"← Read from","federation.direction.both":"⇄ Two-way","federation.direction.out.hint":"Your knowledge flows to this peer, and your recall can reach into theirs.","federation.direction.in.hint":"Accept this peer’s digests into your inbox.","federation.direction.both.hint":"Read from and share to this peer.","federation.topics.placeholder":"topics (comma-separated, blank = all)","federation.topics.label":"Limit to topics","federation.add":"Add a connection","federation.add.pick":"Pick a vault…","federation.add.none":"Every registered vault is already connected (or none are available to add).","federation.connect":"Connect","federation.error.pick_vault":"Pick a vault to connect to.","federation.inbox":"Digest inbox","federation.inbox.pending":"Pending","federation.inbox.consumed":"Consumed","federation.inbox.empty":"Inbox is empty — no peer digests waiting. The next sleep cycle drains it.","federation.inbox.quarantined":"Quarantined (incompatible schema — left in place)","federation.inbox.from":"from","federation.preview":"Preview sync","federation.preview.running":"Previewing…","federation.preview.hint":"Dry-run: computes the digests that would be pushed to consenting peers. Writes nothing.","federation.preview.none":"No out/both connections to preview.","federation.preview.stale":"unreachable (stale)","federation.preview.noconsent":"no consent (peer must link in/both back)","federation.preview.nodelta":"no new entries since last sync","federation.preview.entries":"entries would be pushed","federation.map.help":"How it works","federation.map.connections":"Connections","federation.map.hint.default":"Drag from one project to another to connect them. Click a project for details, or click a wire to edit it.","federation.map.hint.first":"Try it: drag from one project card onto another — the first will read the second, live.","federation.map.hint.armed":"Now click the project “{name}” should read. Esc cancels.","federation.map.legend.live":"reads — live, nothing copied","federation.map.legend.inert":"not Readable yet","federation.map.legend.ok":"up to date","federation.map.legend.stale":"needs update","federation.map.legend.gone":"folder missing","federation.map.note.connected":"“{from}” now reads “{to}” — live.","federation.map.note.inert":"“{from}” now reads “{to}”, but “{to}” isn’t Readable yet — the wire stays inert until you switch it on.","federation.map.note.makeReadable":"Turn on Readable","federation.map.note.readable":"“{name}” is now Readable — its wires are live.","federation.map.note.failed":"Failed to connect.","federation.map.wire.reads":"reads","federation.map.wire.mutual":"read each other","federation.map.wiremenu.title":"Connection","federation.map.wiremenu.row":"“{from}” reads “{to}”","federation.map.wiremenu.notLive":"not live — “{name}” isn’t Readable","federation.map.wiremenu.remove":"Remove","federation.map.wiremenu.makeReadable":"Make “{name}” Readable","federation.map.conns.title":"All connections","federation.map.conns.empty":"No connections yet — drag one project onto another to create the first wire.","federation.map.conns.mutual":"{a} ⇄ {b} — read each other","federation.map.conns.reads":"{from} reads {to}","federation.map.conns.inert":" — not Readable yet","federation.map.detail.gone":"Folder is gone.","federation.map.detail.behind":"Behind: v{from} → v{to}","federation.map.detail.current":"Up to date (v{v})","federation.map.detail.update":"Update","federation.map.detail.updating":"Updating…","federation.map.detail.readable":"Readable — let connected projects read this one","federation.map.detail.connect":"Connect to another project…","federation.map.detail.connections":"Connections","federation.map.detail.none":"No connections yet.","federation.map.detail.youRead":"Reads “{name}” live","federation.map.detail.readsYou":"“{name}” reads this project live","federation.map.detail.notLive":" — not Readable yet","federation.map.status.loading":"Loading the connection map…","federation.map.status.error":"Failed to load the connection map.","federation.map.empty.title":"Nothing to connect yet","federation.map.empty.body":"Register at least two projects, then wire them so one can read the other’s memory live.","federation.map.guide.title":"How the connection map works","federation.map.guide.def":"App reads Libs’ canonical memory live during recall — a reference, never a copy. Each project stays the single source of truth for its own knowledge.","federation.map.guide.step1":"Drag from one project onto another — the first now reads the second.","federation.map.guide.step2":"Click a project to see its connections and switch on Readable (violet dot) so others may read it.","federation.map.guide.step3":"Click any wire to remove it — or to make its target Readable if it isn’t live yet.","federation.map.guide.keys":"Shortcuts: + / − zoom · 0 fit · Esc cancel · ? this guide","federation.map.guide.gotit":"Got it","federation.map.guide.start":"Start wiring","federation.map.zoom.in":"Zoom in","federation.map.zoom.out":"Zoom out","federation.map.zoom.fit":"Fit to view","packs.title":"Skill Packs","packs.section.packs":"Packs","packs.section.standalone":"Standalone Skills","packs.detail.base":"Base Skill","packs.detail.subskills":"Sub-Skills","packs.detail.agents":"Related Agents","packs.detail.close":"Close","packs.action.install":"Install","packs.action.remove":"Remove","packs.action.installing":"Installing…","packs.action.removing":"Removing…","packs.action.error":"Action failed","update.available":"Update available","update.title":"Update Available","update.dismiss":"Dismiss","update.managePacks":"Manage packs →","update.upgradeAll":"Upgrade everything","update.upgradeHint":"Updates the CLI, this desktop app, and every project — in one step.","update.upgrading":"Upgrading…","update.upgraded":"Upgrade complete.","update.relaunch":"Relaunch to finish","update.relaunchHint":"Quit and reopen dreamcontext to apply the new version.","update.upgradeFailed":"Upgrade failed.","update.retry":"Try again","taxonomy.title":"Taxonomy","common.loading":"Loading...","common.error":"Error","common.empty":"Nothing here yet.","common.close":"Close","common.cancel":"Cancel","brain.sidebar.connect":"Connect GitHub","brain.sidebar.setup":"Set up team sync","brain.sidebar.synced":"Synced","brain.auth.title":"GitHub sign-in","brain.auth.continueWithGithub":"Continue with GitHub","brain.auth.signedIn":"Signed in with GitHub","brain.auth.signedInAs":"Signed in as {login}","brain.auth.signOut":"Sign out","brain.auth.scopeDisclosure":"This grants access to all your private repositories — GitHub does not offer a narrower scope for the device flow. If you would rather limit access to one repo, use a fine-grained personal access token instead.","brain.auth.device.hint":"Enter this code on GitHub to finish connecting.","brain.auth.device.open":"Open GitHub","brain.auth.device.waiting":"Waiting for you to approve on GitHub…","brain.auth.device.starting":"Starting…","brain.auth.device.denied":"Sign-in was denied on GitHub.","brain.auth.device.expired":"This code expired. Try again.","brain.auth.device.error":"Something went wrong signing in with GitHub.","brain.auth.oauthUnavailable":"Connect with a personal access token below. Create a fine-grained token limited to just your brain repo, with Contents read/write access, then paste it here.","brain.auth.pat.recommend":"Prefer a fine-grained token? Use a personal access token instead","brain.auth.pat.hide":"Hide token form","brain.auth.pat.hint":"Recommended for tighter scope: create a fine-grained personal access token limited to just the brain repo, with Contents read/write access, and paste it below.","brain.auth.pat.placeholder":"ghp_… or github_pat_…","brain.auth.pat.submit":"Connect","brain.auth.pat.submitting":"Connecting…","brain.setup.title":"Brain repo","brain.setup.signInFirst":"Sign in with GitHub above to set up your brain repo.","brain.setup.alreadyConnected":"Connected to","brain.setup.switchHint":"To switch to a different repo, attach the new one below — or disconnect first.","brain.setup.disconnect":"Disconnect","brain.setup.disconnecting":"Disconnecting…","brain.setup.notConnected":"No brain repo connected yet — create, discover, or attach one below.","brain.setup.inTree":"No brain repo connected. Your project memory is committed in-tree inside your code repo ({origin}) and does not sync to the cloud on its own.","brain.setup.tab.create":"Create","brain.setup.tab.discover":"Discover","brain.setup.tab.attach":"Attach","brain.create.name":"Repository name","brain.create.namePlaceholder":"my-project-brain","brain.create.makePublic":"Make this repository public","brain.create.publicWarning":"A public brain repo means anyone can read your project memory — tasks, knowledge, decisions and changelog. Only make it public if that is intended.","brain.create.publicConfirm":"I understand this repository's contents will be public.","brain.create.creating":"Creating…","brain.create.submit":"Create repository","brain.create.nameRequired":"Enter a repository name first.","brain.create.confirmPublicFirst":"Confirm the public-repository checkbox first, or keep the repo private.","brain.create.scrubBlocked":"Creation blocked — likely secrets found in your project memory. Remove them and try again.","brain.discover.find":"Find my brain repos","brain.discover.loading":"Searching your GitHub repositories…","brain.discover.error":"Could not search your GitHub repositories.","brain.discover.empty":"No brain repos found in your GitHub account.","brain.discover.private":"Private","brain.discover.select":"Select","brain.attach.url":"Repository URL","brain.attach.preview":"Preview","brain.attach.previewing":"Checking…","brain.attach.unreachable":"Could not reach this repository.","brain.attach.refused":"This repository was refused.","brain.attach.trustTitle":"Only attach a repo you control","brain.attach.trustBody":"Attaching loads this repository's content verbatim into every future AI session — including for anyone else who attaches it. Only attach a repo that you and your team control.","brain.attach.repo":"Repository","brain.attach.visibility":"Visibility","brain.attach.private":"Private","brain.attach.publicVisibility":"Public","brain.attach.isBrainRepo":"Brain repo","brain.attach.notBrainRepo":"This does not look like a dreamcontext brain repo.","brain.attach.branch":"Default branch","brain.attach.iTrust":"I trust this repository and its content.","brain.attach.attaching":"Attaching…","brain.attach.submit":"Attach repository","brain.attach.bootstrapBlocked":"Attached — but the first push was blocked: something in your project memory looks like a secret. Remove it, then run a sync.","brain.cloudSync.label":"Cloud sync","brain.cloudSync.hint":"Sync your project memory to a GitHub repository so your team can share it.","brain.cloudSync.source.explicit":"set here","brain.cloudSync.source.derived":"from config","brain.team.title":"Team updates","brain.team.updates":"{n} updates","brain.team.updatesShort":"updates","brain.team.pending":"Update pending","brain.team.awaitingAgent":"Awaiting agent merge","brain.team.checkNow":"Check now","brain.team.checking":"Checking…"}},xR=R.createContext(null);function XE({children:r}){const[e,i]=R.useState("en"),n=s=>{var o;return((o=c7[e])==null?void 0:o[s])??s};return a.jsx(xR.Provider,{value:{locale:e,setLocale:i,t:n},children:r})}function Fr(){const r=R.useContext(xR);if(!r)throw new Error("useI18n must be used within I18nProvider");return r}function _R({vaultName:r,compact:e}){const{t:i}=Fr(),{data:n}=pR(),s=gR(),[o,h]=R.useState(!1),l=r?(n??[]).filter(p=>p.name===r):n??[],u=l.reduce((p,m)=>p+(m.updates??0),0),d=l.some(p=>p.pendingAgentMerge);if(u===0&&!d)return null;const g=()=>s.mutate(r);return a.jsxs("div",{className:"update-badge team-updates-badge",children:[a.jsxs("button",{type:"button",className:"update-badge-trigger",onClick:()=>h(p=>!p),"aria-expanded":o,title:i("brain.team.title"),children:[a.jsx("span",{className:"update-badge-dot"}),!e&&a.jsx("span",{className:"update-badge-label",children:d?i("brain.team.pending"):i("brain.team.updates").replace("{n}",String(u))}),e&&a.jsx("span",{className:"update-badge-label",children:u})]}),o&&a.jsxs("div",{className:"update-badge-popover team-updates-popover",children:[a.jsxs("div",{className:"update-badge-popover-header",children:[a.jsx("span",{className:"update-badge-popover-title",children:i("brain.team.title")}),a.jsx("button",{className:"update-badge-dismiss",onClick:()=>h(!1),"aria-label":i("update.dismiss"),children:"×"})]}),a.jsx("div",{className:"update-badge-content",children:a.jsx("ul",{className:"team-updates-list",children:l.map(p=>a.jsxs("li",{className:"team-updates-item",children:[a.jsx("span",{className:"team-updates-vault",children:p.name}),a.jsx("span",{className:"team-updates-count",children:p.pendingAgentMerge?i("brain.team.awaitingAgent"):`${p.updates} ${i("brain.team.updatesShort")}`})]},p.name))})}),a.jsx("button",{className:"update-badge-action",onClick:g,disabled:s.isPending,children:s.isPending?i("brain.team.checking"):i("brain.team.checkNow")})]})]})}const h7=["name","description","targetUser","stack","priority","platforms","packs","review"],u7=["path","description","targetUser","stack","priority","platforms","packs","review"],d7=["path","platforms","packs","review"],v0={name:{label:"What is this project called?",hint:"Used as the folder name and the vault name."},description:{label:"One line — what is it?",hint:"A short description. Optional.",optional:!0},targetUser:{label:"Who is it for?",hint:"The target user. Optional.",optional:!0},stack:{label:"Tech stack?",hint:"Comma-separated. Auto-detected for existing folders. Optional.",optional:!0},priority:{label:"Current focus?",hint:"What you are working on right now. Optional.",optional:!0}};function f7({onClose:r,onReady:e}){const i=Oz(),n=Iz(),s=Dz(),o=Rz(),[h,l]=R.useState(null),[u,d]=R.useState(0),[g,p]=R.useState(null),[m,y]=R.useState(null),[w,_]=R.useState(null),[v,x]=R.useState(!1),[C,k]=R.useState(""),[T,N]=R.useState(""),[j,A]=R.useState(""),[E,L]=R.useState(""),[O,D]=R.useState(""),[G,q]=R.useState(""),[U,$]=R.useState(""),[F,W]=R.useState(["claude"]),[Y,P]=R.useState([]),[K,z]=R.useState(!1),X=R.useRef(null);function ie(Ne,de,Ue){de(Ne.includes(Ue)?Ne.filter(at=>at!==Ue):[...Ne,Ue])}R.useEffect(()=>{var Ne;h==="new"&&!T&&((Ne=i.data)!=null&&Ne.defaultParent)&&N(i.data.defaultParent)},[h,T,i.data]);const ee=h==="existing"?K?d7:u7:h7,he=ee[u];R.useEffect(()=>{var Ne;(Ne=X.current)==null||Ne.focus()},[he,h]);function fe(Ne){l(Ne),d(0),p(null)}async function ne(Ne){p(null);const de=await a7();if(de){if(Ne==="parent"){N(de);return}A(de);try{const Ue=await Fz(de);if(k(Ue.name),!G&&Ue.stack&&q(Ue.stack),z(Ue.hasContext),Ue.hasContext){try{await o.mutateAsync({name:Ue.name,path:de})}catch(at){const Pt=at instanceof Error?at.message:String(at);if(!/already registered/i.test(Pt))throw at}e(Ue.name);return}d(1)}catch(Ue){p(Ue instanceof Error?Ue.message:String(Ue))}}}const I=R.useMemo(()=>he==="name"?C.trim().length>0&&T.trim().length>0:he==="path"?j.trim().length>0:!0,[he,C,T,j]);function Z(){p(null),u<ee.length-1&&d(Ne=>Ne+1)}function J(){p(null),u>0?d(Ne=>Ne-1):l(null)}async function re(){p(null);const Ne=h==="existing"?{mode:"existing",name:C.trim(),projectPath:j.trim()}:{mode:"new",name:C.trim(),parentDir:T.trim()};Ne.description=E.trim()||void 0,Ne.targetUser=O.trim()||void 0,Ne.stack=G.trim()||void 0,Ne.priority=U.trim()||void 0,Ne.platforms=F.length>0?F:void 0,Ne.packs=Y.length>0?Y:void 0;try{const de=await s.mutateAsync(Ne);y(de.vault),_(de.cli??null)}catch(de){p(de instanceof Error?de.message:String(de))}}const ue="Enrich my dreamcontext: scan the codebase and fill soul, memory, and tech_stack with real detail, then propose initial feature PRDs and a first task. No placeholders.";async function Le(){try{await navigator.clipboard.writeText(ue),x(!0),setTimeout(()=>x(!1),1500)}catch{p("Could not copy to clipboard.")}}function Ze(Ne,de,Ue){return a.jsx("input",{ref:X,type:"text",className:"wiz-input",value:Ne,placeholder:Ue,onChange:at=>de(at.target.value),onKeyDown:at=>{at.key==="Enter"&&I&&Z()}})}function qe(){var Lt,Bt,bt;if(m)return a.jsxs("div",{className:"wiz-success",children:[a.jsx("div",{className:"wiz-success-check","aria-hidden":!0,children:"✓"}),a.jsxs("h2",{className:"wiz-q",children:["“",m.name,"” is ready"]}),a.jsx("p",{className:"wiz-hint",children:m.path}),(w==null?void 0:w.status)==="installed"&&a.jsx("p",{className:"wiz-hint",children:"Installed the dreamcontext CLI from npm so your hooks work."}),(w==null?void 0:w.status)==="failed"&&a.jsx("div",{className:"wiz-error",children:w.message??"Run: npm install -g dreamcontext"}),a.jsxs("div",{className:"wiz-handoff",children:[a.jsx("div",{className:"wiz-handoff-title",children:"Next: enrich it in Claude Code"}),a.jsx("p",{className:"wiz-hint",children:"The skeleton is in place. Open this project in Claude Code and paste the prompt below so the agent can scan your code and fill in real context."}),a.jsx("pre",{className:"wiz-handoff-prompt",children:ue}),a.jsx("button",{type:"button",className:"wiz-btn",onClick:Le,children:v?"Copied ✓":"Copy prompt"})]}),a.jsxs("div",{className:"wiz-actions",children:[a.jsx("button",{type:"button",className:"wiz-btn",onClick:r,children:"Close"}),a.jsx("button",{type:"button",className:"wiz-btn wiz-btn-primary",onClick:()=>e(m.name),children:"Open project →"})]})]});if(h===null)return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Add a project"}),a.jsx("p",{className:"wiz-hint",children:"Create something new, or set up a folder you already have."}),a.jsxs("div",{className:"wiz-choices",children:[a.jsxs("button",{type:"button",className:"wiz-choice",onClick:()=>fe("new"),children:[a.jsx("span",{className:"wiz-choice-title",children:"Create new"}),a.jsx("span",{className:"wiz-hint",children:"Make a new folder and initialize dreamcontext in it."})]}),a.jsxs("button",{type:"button",className:"wiz-choice",onClick:()=>fe("existing"),children:[a.jsx("span",{className:"wiz-choice-title",children:"Open existing"}),a.jsx("span",{className:"wiz-hint",children:"Pick a folder on your Mac and set up dreamcontext there."})]})]})]});if(he==="path")return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Which folder?"}),a.jsx("p",{className:"wiz-hint",children:"Choose the project folder. If it's already a dreamcontext project, it opens straight away."}),a.jsxs("div",{className:"wiz-row",children:[a.jsx("input",{className:"wiz-input",type:"text",value:j,readOnly:!0,placeholder:"No folder chosen"}),a.jsx("button",{type:"button",className:"wiz-btn",onClick:()=>ne("project"),children:s.isPending?"Working…":"Browse…"})]})]});if(he==="name")return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:v0.name.label}),a.jsx("p",{className:"wiz-hint",children:v0.name.hint}),Ze(C,k,"my-project"),a.jsx("label",{className:"wiz-sublabel",children:"Where should it live?"}),a.jsxs("div",{className:"wiz-row",children:[a.jsx("input",{className:"wiz-input",type:"text",value:T,placeholder:((Lt=i.data)==null?void 0:Lt.defaultParent)??"~/projects",onChange:Se=>N(Se.target.value)}),a.jsx("button",{type:"button",className:"wiz-btn",onClick:()=>ne("parent"),children:"Browse…"})]}),C.trim()&&T.trim()&&a.jsxs("p",{className:"wiz-hint wiz-preview",children:["Creates: ",T.replace(/\/+$/,""),"/",C.trim()]})]});if(he==="review")return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Ready to set up"}),a.jsxs("dl",{className:"wiz-review",children:[a.jsx("dt",{children:"Name"}),a.jsx("dd",{children:C.trim()}),a.jsx("dt",{children:"Location"}),a.jsx("dd",{children:h==="new"?`${T.replace(/\/+$/,"")}/${C.trim()}`:j}),E.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Description"}),a.jsx("dd",{children:E.trim()})]}),O.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"For"}),a.jsx("dd",{children:O.trim()})]}),G.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Stack"}),a.jsx("dd",{children:G.trim()})]}),U.trim()&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Focus"}),a.jsx("dd",{children:U.trim()})]}),a.jsx("dt",{children:"Platforms"}),a.jsx("dd",{children:(F.length>0?F:["claude"]).map(Se=>{var De,Me;return((Me=(De=n.data)==null?void 0:De.platforms.find(Je=>Je.id===Se))==null?void 0:Me.label)??Se}).join(", ")}),Y.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Skill packs"}),a.jsx("dd",{children:Y.join(", ")})]})]})]});if(he==="platforms"){const Se=((Bt=n.data)==null?void 0:Bt.platforms)??[];return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Which agent platforms?"}),a.jsx("p",{className:"wiz-hint",children:"Where dreamcontext installs its skills, agents, and hooks. Pick one or more."}),a.jsx("div",{className:"wiz-choices",children:Se.map(De=>{const Me=F.includes(De.id);return a.jsxs("button",{type:"button",className:`wiz-choice wiz-select${Me?" wiz-select-on":""}`,onClick:()=>ie(F,W,De.id),"aria-pressed":Me,children:[a.jsxs("span",{className:"wiz-choice-title",children:[De.label,De.recommended&&a.jsx("span",{className:"wiz-badge",children:"Recommended"})]}),a.jsx("span",{className:"wiz-hint",children:De.description})]},De.id)})}),F.length===0&&a.jsx("p",{className:"wiz-hint wiz-preview",children:"Nothing selected — defaults to Claude."})]})}if(he==="packs"){const Se=((bt=n.data)==null?void 0:bt.packs)??[];return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:"Add skill packs?"}),a.jsx("p",{className:"wiz-hint",children:"Optional curated skills for your agent. You can add more later. Skip if unsure."}),Se.length===0?a.jsx("p",{className:"wiz-hint",children:"No optional packs available."}):a.jsx("div",{className:"wiz-choices",children:Se.map(De=>{const Me=Y.includes(De.name);return a.jsxs("button",{type:"button",className:`wiz-choice wiz-select${Me?" wiz-select-on":""}`,onClick:()=>ie(Y,P,De.name),"aria-pressed":Me,children:[a.jsxs("span",{className:"wiz-choice-title",children:[a.jsx("span",{className:"wiz-check","aria-hidden":!0,children:Me?"☑":"☐"})," ",De.name]}),a.jsx("span",{className:"wiz-hint",children:De.description})]},De.name)})})]})}const de=v0[he],Ue={description:[E,L,"A persistent brain for AI agents…"],targetUser:[O,D,"Developers"],stack:[G,q,"TypeScript, React, Node…"],priority:[U,$,"Initial setup"]},[at,Pt,Mt]=Ue[he];return a.jsxs("div",{children:[a.jsx("h2",{className:"wiz-q",children:de.label}),a.jsx("p",{className:"wiz-hint",children:de.hint}),Ze(at,Pt,Mt)]})}const Ye=he==="review",pe=h!==null&&he!=="path"&&!m;return a.jsx("div",{className:"wiz-overlay",role:"dialog","aria-modal":"true",onClick:r,children:a.jsxs("div",{className:"wiz-modal",onClick:Ne=>Ne.stopPropagation(),children:[a.jsx("button",{type:"button",className:"wiz-close",onClick:r,"aria-label":"Close",children:"×"}),a.jsx("div",{className:"wiz-body",children:qe()}),g&&a.jsx("div",{className:"wiz-error",children:g}),pe&&a.jsxs("div",{className:"wiz-actions",children:[a.jsx("button",{type:"button",className:"wiz-btn",onClick:J,children:"Back"}),Ye?a.jsx("button",{type:"button",className:"wiz-btn wiz-btn-primary",onClick:re,disabled:s.isPending||!C.trim(),children:s.isPending?"Setting up…":"Set up project"}):a.jsx("button",{type:"button",className:"wiz-btn wiz-btn-primary",onClick:Z,disabled:!I,children:"Next"})]})]})})}function p7(r,e){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var n,s,o,h,l=[],u=!0,d=!1;try{if(o=(i=i.call(r)).next,e===0){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(g){d=!0,s=g}finally{try{if(!u&&i.return!=null&&(h=i.return(),Object(h)!==h))return}finally{if(d)throw s}}return l}}function g7(r,e,i){return e=w7(e),e in r?Object.defineProperty(r,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[e]=i,r}function ZE(r,e){return b7(r)||p7(r,e)||CR(r,e)||_7()}function m7(r){return y7(r)||v7(r)||CR(r)||x7()}function y7(r){if(Array.isArray(r))return F_(r)}function b7(r){if(Array.isArray(r))return r}function v7(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function CR(r,e){if(r){if(typeof r=="string")return F_(r,e);var i=Object.prototype.toString.call(r).slice(8,-1);if(i==="Object"&&r.constructor&&(i=r.constructor.name),i==="Map"||i==="Set")return Array.from(r);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return F_(r,e)}}function F_(r,e){(e==null||e>r.length)&&(e=r.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=r[i];return n}function x7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
51
51
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
52
52
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C7(r,e){if(typeof r!="object"||r===null)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var n=i.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function w7(r){var e=C7(r,"string");return typeof e=="symbol"?e:String(e)}var k7=function(e,i){var n=new Set(i);return Object.assign.apply(Object,[{}].concat(m7(Object.entries(e).filter(function(s){var o=ZE(s,1),h=o[0];return!n.has(h)}).map(function(s){var o=ZE(s,2),h=o[0],l=o[1];return g7({},h,l)}))))};function $_(r,e){(e==null||e>r.length)&&(e=r.length);for(var i=0,n=Array(e);i<e;i++)n[i]=r[i];return n}function S7(r){if(Array.isArray(r))return r}function T7(r){if(Array.isArray(r))return $_(r)}function E7(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function N7(r,e){var i=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(i!=null){var n,s,o,h,l=[],u=!0,d=!1;try{if(o=(i=i.call(r)).next,e!==0)for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(g){d=!0,s=g}finally{try{if(!u&&i.return!=null&&(h=i.return(),Object(h)!==h))return}finally{if(d)throw s}}return l}}function A7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
53
53
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
@@ -444,8 +444,8 @@ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error
444
444
  L0,20`)},"requirement_arrow"),dne=H((r,e,i)=>{const n=ni(),{themeVariables:s}=n,{strokeWidth:o}=s;r.append("defs").append("marker").attr("id",i+"_"+e+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${o}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
445
445
  L20,10
446
446
  M20,10
447
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),fne=H((r,e,i)=>{const n=r.append("defs").append("marker").attr("id",i+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),pne=H((r,e,i)=>{const n=ni(),{themeVariables:s}=n,{strokeWidth:o}=s,h=r.append("defs").append("marker").attr("id",i+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");h.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),h.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),h.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),h.selectAll("*").attr("stroke-width",`${o}`)},"requirement_contains_neo"),gne={extension:Kie,composition:Vie,aggregation:Yie,dependency:Xie,lollipop:Zie,point:Qie,circle:Jie,cross:ene,barb:tne,barbNeo:rne,only_one:ine,zero_or_one:nne,one_or_more:sne,zero_or_more:ane,only_one_neo:one,zero_or_one_neo:lne,one_or_more_neo:cne,zero_or_more_neo:hne,requirement_arrow:une,requirement_contains:fne,requirement_arrow_neo:dne,requirement_contains_neo:pne},mne=Gie,yne={common:Gf,getConfig:ni,insertCluster:pie,insertEdge:Wie,insertEdgeLabel:$ie,insertMarkers:mne,insertNode:WI,interpolateToCurve:Gw,labelHelper:Qt,log:Qe,positionEdgeLabel:Pie},Af={},YI=H(r=>{for(const e of r)Af[e.name]=e},"registerLayoutLoaders"),bne=H(()=>{YI([{name:"dagre",loader:H(async()=>await Xt(()=>import("./dagre-KV5264BT-Cl90-nVJ.js"),__vite__mapDeps([6,7,8,9,10,11])),"loader")},{name:"cose-bilkent",loader:H(async()=>await Xt(()=>import("./cose-bilkent-S5V4N54A-D-2ct0N_.js"),__vite__mapDeps([12,13])),"loader")}])},"registerDefaultLayoutLoaders");bne();var cye=H(async(r,e)=>{if(!(r.layoutAlgorithm in Af))throw new Error(`Unknown layout algorithm: ${r.layoutAlgorithm}`);if(r.diagramId)for(const g of r.nodes){const p=g.domId||g.id;g.domId=`${r.diagramId}-${p}`}const i=Af[r.layoutAlgorithm],n=await i.loader(),{theme:s,themeVariables:o}=r.config,{useGradient:h,gradientStart:l,gradientStop:u}=o,d=e.attr("id");if(e.append("defs").append("filter").attr("id",`${d}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${d}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),h){const g=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");g.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),g.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return n.render(r,e,yne,{algorithm:i.algorithm})},"render"),hye=H((r="",{fallback:e="dagre"}={})=>{if(r in Af)return r;if(e in Af)return Qe.warn(`Layout algorithm ${r} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${r} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),XI="comm",ZI="rule",QI="decl",vne="@import",xne="@namespace",_ne="@keyframes",Cne="@layer",wne=Math.abs,uf=String.fromCharCode;function JI(r){return r.trim()}function eC(r,e,i){return r.replace(e,i)}function Th(r,e){return r.charCodeAt(e)|0}function au(r,e,i){return r.slice(e,i)}function Ys(r){return r.length}function kne(r){return r.length}function Ng(r,e){return e.push(r),r}var rb=1,ou=1,e6=0,ps=0,bi=0,yu="";function fk(r,e,i,n,s,o,h,l){return{value:r,root:e,parent:i,type:n,props:s,children:o,line:rb,column:ou,length:h,return:"",siblings:l}}function Sne(){return bi}function Tne(){return bi=ps>0?Th(yu,--ps):0,ou--,bi===10&&(ou=1,rb--),bi}function As(){return bi=ps<e6?Th(yu,ps++):0,ou++,bi===10&&(ou=1,rb++),bi}function Ho(){return Th(yu,ps)}function bm(){return ps}function ib(r,e){return au(yu,r,e)}function jf(r){switch(r){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ene(r){return rb=ou=1,e6=Ys(yu=r),ps=0,[]}function Nne(r){return yu="",r}function J0(r){return JI(ib(ps-1,tC(r===91?r+2:r===40?r+1:r)))}function Ane(r){for(;(bi=Ho())&&bi<33;)As();return jf(r)>2||jf(bi)>3?"":" "}function jne(r,e){for(;--e&&As()&&!(bi<48||bi>102||bi>57&&bi<65||bi>70&&bi<97););return ib(r,bm()+(e<6&&Ho()==32&&As()==32))}function tC(r){for(;As();)switch(bi){case r:return ps;case 34:case 39:r!==34&&r!==39&&tC(bi);break;case 40:r===41&&tC(r);break;case 92:As();break}return ps}function Mne(r,e){for(;As()&&r+bi!==57;)if(r+bi===84&&Ho()===47)break;return"/*"+ib(e,ps-1)+"*"+uf(r===47?r:As())}function Lne(r){for(;!jf(Ho());)As();return ib(r,ps)}function Bne(r){return Nne(vm("",null,null,null,[""],r=Ene(r),0,[0],r))}function vm(r,e,i,n,s,o,h,l,u){for(var d=0,g=0,p=h,m=0,y=0,w=0,_=1,v=1,x=1,C=0,k=0,T="",N=s,j=o,A=n,E=T;v;)switch(w=k,k=As()){case 40:w!=108&&Th(E,p-1)==58?(C++,E+="("):E+=J0(k);break;case 41:C--,E+=")";break;case 34:case 39:case 91:E+=J0(k);break;case 9:case 10:case 13:case 32:if(C>0){E+=uf(k);break}E+=Ane(w);break;case 92:E+=jne(bm()-1,7);continue;case 47:switch(Ho()){case 42:case 47:Ng(Rne(Mne(As(),bm()),e,i,u),u),(jf(w||1)==5||jf(Ho()||1)==5)&&Ys(E)&&au(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*_:l[d++]=Ys(E)*x;case 125*_:case 59:case 0:if(C>0&&k){E+=uf(k);break}switch(k){case 0:case 125:v=0;case 59+g:x==-1&&(E=eC(E,/\f/g,"")),y>0&&(Ys(E)-p||_===0)&&Ng(y>32?Qj(E+";",n,i,p-1,u):Qj(eC(E," ","")+";",n,i,p-2,u),u);break;case 59:E+=";";default:if(Ng(A=Zj(E,e,i,d,g,s,l,T,N=[],j=[],p,o),o),k===123)if(g===0)vm(E,e,A,A,N,o,p,l,j);else{switch(m){case 99:if(Th(E,3)===110)break;case 108:if(Th(E,2)===97)break;default:g=0;case 100:case 109:case 115:}g?vm(r,A,A,n&&Ng(Zj(r,A,A,0,0,s,l,T,s,N=[],p,j),j),s,j,p,l,n?N:j):vm(E,A,A,A,[""],j,0,l,j)}}d=g=y=0,_=x=1,T=E="",p=h;break;case 58:p=1+Ys(E),y=w;default:if(_<1){if(k==123)--_;else if(k==125&&_++==0&&Tne()==125)continue}switch(E+=uf(k),k*_){case 38:x=g>0?1:(E+="\f",-1);break;case 44:if(C>0)break;l[d++]=(Ys(E)-1)*x,x=1;break;case 64:Ho()===45&&(E+=J0(As())),m=Ho(),g=p=Ys(T=E+=Lne(bm())),k++;break;case 45:w===45&&Ys(E)==2&&(_=0)}}return o}function Zj(r,e,i,n,s,o,h,l,u,d,g,p){for(var m=s-1,y=s===0?o:[""],w=kne(y),_=0,v=0,x=0;_<n;++_)for(var C=0,k=au(r,m+1,m=wne(v=h[_])),T=r;C<w;++C)(T=JI(v>0?y[C]+" "+k:eC(k,/&\f/g,y[C])))&&(u[x++]=T);return fk(r,e,i,s===0?ZI:l,u,d,g,p)}function Rne(r,e,i,n){return fk(r,e,i,XI,uf(Sne()),au(r,2,-2),0,n)}function Qj(r,e,i,n,s){return fk(r,e,i,QI,au(r,0,n),au(r,n+1,-1),n,s)}function rC(r,e){for(var i="",n=0;n<r.length;n++)i+=e(r[n],n,r,e)||"";return i}function One(r,e,i,n){switch(r.type){case Cne:if(r.children.length)break;case vne:case xne:case QI:return r.return=r.return||r.value;case XI:return"";case _ne:return r.return=r.value+"{"+rC(r.children,n)+"}";case ZI:if(!Ys(r.value=r.props.join(",")))return""}return Ys(i=rC(r.children,n))?r.return=r.value+"{"+i+"}":""}var t6="c4",Dne=H(r=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(r),"detector"),Ine=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./c4Diagram-AHTNJAMY-DPghs0tx.js");return{diagram:e}},__vite__mapDeps([14,15]));return{id:t6,diagram:r}},"loader"),Fne={id:t6,detector:Dne,loader:Ine},$ne=Fne,r6="flowchart",Pne=H((r,e)=>{var i,n;return((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(r)},"detector"),zne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-B27j9wPy.js");return{diagram:e}},__vite__mapDeps([16,17,15,18,19,20]));return{id:r6,diagram:r}},"loader"),qne={id:r6,detector:Pne,loader:zne},Hne=qne,i6="flowchart-v2",Une=H((r,e)=>{var i,n,s;return((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(r)&&((s=e==null?void 0:e.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(r))},"detector"),Wne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-B27j9wPy.js");return{diagram:e}},__vite__mapDeps([16,17,15,18,19,20]));return{id:i6,diagram:r}},"loader"),Gne={id:i6,detector:Une,loader:Wne},Kne=Gne,n6="er",Vne=H(r=>/^\s*erDiagram/.test(r),"detector"),Yne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./erDiagram-SMLLAGMA-HTrqyUnO.js");return{diagram:e}},__vite__mapDeps([21,18,19,20]));return{id:n6,diagram:r}},"loader"),Xne={id:n6,detector:Vne,loader:Yne},Zne=Xne,s6="gitGraph",Qne=H(r=>/^\s*gitGraph/.test(r),"detector"),Jne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-UUTBAWPF-Bl-6_fjw.js");return{diagram:e}},__vite__mapDeps([22,23,24,25,10,8]));return{id:s6,diagram:r}},"loader"),ese={id:s6,detector:Qne,loader:Jne},tse=ese,a6="gantt",rse=H(r=>/^\s*gantt/.test(r),"detector"),ise=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./ganttDiagram-T4ZO3ILL-DFbnEWs4.js");return{diagram:e}},__vite__mapDeps([26,27,28]));return{id:a6,diagram:r}},"loader"),nse={id:a6,detector:rse,loader:ise},sse=nse,o6="info",ase=H(r=>/^\s*info/.test(r),"detector"),ose=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./infoDiagram-42DDH7IO-CpKMgFKt.js");return{diagram:e}},__vite__mapDeps([29,25,10,8]));return{id:o6,diagram:r}},"loader"),lse={id:o6,detector:ase,loader:ose},l6="pie",cse=H(r=>/^\s*pie/.test(r),"detector"),hse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./pieDiagram-DEJITSTG-wlxYzLe8.js");return{diagram:e}},__vite__mapDeps([30,23,25,10,8,31]));return{id:l6,diagram:r}},"loader"),use={id:l6,detector:cse,loader:hse},c6="quadrantChart",dse=H(r=>/^\s*quadrantChart/.test(r),"detector"),fse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./quadrantDiagram-34T5L4WZ-BR5iSy7H.js");return{diagram:e}},__vite__mapDeps([32,27,28]));return{id:c6,diagram:r}},"loader"),pse={id:c6,detector:dse,loader:fse},gse=pse,h6="xychart",mse=H(r=>/^\s*xychart(-beta)?/.test(r),"detector"),yse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./xychartDiagram-5P7HB3ND-pMHGVahC.js");return{diagram:e}},__vite__mapDeps([33,27,28]));return{id:h6,diagram:r}},"loader"),bse={id:h6,detector:mse,loader:yse},vse=bse,u6="requirement",xse=H(r=>/^\s*requirement(Diagram)?/.test(r),"detector"),_se=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./requirementDiagram-MS252O5E-BNuuSVYh.js");return{diagram:e}},__vite__mapDeps([34,18,19]));return{id:u6,diagram:r}},"loader"),Cse={id:u6,detector:xse,loader:_se},wse=Cse,d6="sequence",kse=H(r=>/^\s*sequenceDiagram/.test(r),"detector"),Sse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./sequenceDiagram-FGHM5R23-Dida7vc4.js");return{diagram:e}},__vite__mapDeps([35,15,24]));return{id:d6,diagram:r}},"loader"),Tse={id:d6,detector:kse,loader:Sse},Ese=Tse,f6="class",Nse=H((r,e)=>{var i;return((i=e==null?void 0:e.class)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(r)},"detector"),Ase=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./classDiagram-6PBFFD2Q-DRDRixtt.js");return{diagram:e}},__vite__mapDeps([36,37,17,15,18,19]));return{id:f6,diagram:r}},"loader"),jse={id:f6,detector:Nse,loader:Ase},Mse=jse,p6="classDiagram",Lse=H((r,e)=>{var i;return/^\s*classDiagram/.test(r)&&((i=e==null?void 0:e.class)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(r)},"detector"),Bse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./classDiagram-v2-HSJHXN6E-DRDRixtt.js");return{diagram:e}},__vite__mapDeps([38,37,17,15,18,19]));return{id:p6,diagram:r}},"loader"),Rse={id:p6,detector:Lse,loader:Bse},Ose=Rse,g6="state",Dse=H((r,e)=>{var i;return((i=e==null?void 0:e.state)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(r)},"detector"),Ise=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./stateDiagram-FHFEXIEX-CNvfKe7v.js");return{diagram:e}},__vite__mapDeps([39,40,18,19,7,8,9,10]));return{id:g6,diagram:r}},"loader"),Fse={id:g6,detector:Dse,loader:Ise},$se=Fse,m6="stateDiagram",Pse=H((r,e)=>{var i;return!!(/^\s*stateDiagram-v2/.test(r)||/^\s*stateDiagram/.test(r)&&((i=e==null?void 0:e.state)==null?void 0:i.defaultRenderer)==="dagre-wrapper")},"detector"),zse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-QKLJ7IA2-B8F8hUBl.js");return{diagram:e}},__vite__mapDeps([41,40,18,19]));return{id:m6,diagram:r}},"loader"),qse={id:m6,detector:Pse,loader:zse},Hse=qse,y6="journey",Use=H(r=>/^\s*journey/.test(r),"detector"),Wse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./journeyDiagram-VCZTEJTY-CTNV9WYX.js");return{diagram:e}},__vite__mapDeps([42,17,15,31]));return{id:y6,diagram:r}},"loader"),Gse={id:y6,detector:Use,loader:Wse},Kse=Gse,Vse=H((r,e,i)=>{Qe.debug(`rendering svg for syntax error
448
- `);const n=see(e),s=n.append("g");n.attr("viewBox","0 0 2412 512"),A5(n,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${i}`)},"draw"),b6={draw:Vse},Yse=b6,Xse={db:{},renderer:b6,parser:{parse:H(()=>{},"parse")}},Zse=Xse,v6="flowchart-elk",Qse=H((r,e={})=>{var i;return/^\s*flowchart-elk/.test(r)||/^\s*(flowchart|graph)/.test(r)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),Jse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-B27j9wPy.js");return{diagram:e}},__vite__mapDeps([16,17,15,18,19,20]));return{id:v6,diagram:r}},"loader"),eae={id:v6,detector:Qse,loader:Jse},tae=eae,x6="timeline",rae=H(r=>/^\s*timeline/.test(r),"detector"),iae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./timeline-definition-GMOUNBTQ-CujUrKzh.js");return{diagram:e}},__vite__mapDeps([43,31]));return{id:x6,diagram:r}},"loader"),nae={id:x6,detector:rae,loader:iae},sae=nae,_6="mindmap",aae=H(r=>/^\s*mindmap/.test(r),"detector"),oae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./mindmap-definition-QFDTVHPH-CkrPsGZI.js");return{diagram:e}},__vite__mapDeps([44,18,19]));return{id:_6,diagram:r}},"loader"),lae={id:_6,detector:aae,loader:oae},cae=lae,C6="kanban",hae=H(r=>/^\s*kanban/.test(r),"detector"),uae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./kanban-definition-6JOO6SKY-COgJyhmy.js");return{diagram:e}},__vite__mapDeps([45,17]));return{id:C6,diagram:r}},"loader"),dae={id:C6,detector:hae,loader:uae},fae=dae,w6="sankey",pae=H(r=>/^\s*sankey(-beta)?/.test(r),"detector"),gae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./sankeyDiagram-XADWPNL6-CwwUGQVB.js");return{diagram:e}},[]);return{id:w6,diagram:r}},"loader"),mae={id:w6,detector:pae,loader:gae},yae=mae,k6="packet",bae=H(r=>/^\s*packet(-beta)?/.test(r),"detector"),vae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-TYMM5635-b9Z_ORTT.js");return{diagram:e}},__vite__mapDeps([46,23,25,10,8]));return{id:k6,diagram:r}},"loader"),xae={id:k6,detector:bae,loader:vae},S6="radar",_ae=H(r=>/^\s*radar-beta/.test(r),"detector"),Cae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-MMDJMWI5-CYpfsP8h.js");return{diagram:e}},__vite__mapDeps([47,23,25,10,8]));return{id:S6,diagram:r}},"loader"),wae={id:S6,detector:_ae,loader:Cae},T6="block",kae=H(r=>/^\s*block(-beta)?/.test(r),"detector"),Sae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./blockDiagram-DXYQGD6D-RsaId3-k.js");return{diagram:e}},__vite__mapDeps([48,17,11,7,8,20]));return{id:T6,diagram:r}},"loader"),Tae={id:T6,detector:kae,loader:Sae},Eae=Tae,E6="treeView",Nae=H(r=>/^\s*treeView-beta/.test(r),"detector"),Aae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-5BDNPKRD-CifW537A.js");return{diagram:e}},__vite__mapDeps([49,23,24,25,10,8]));return{id:E6,diagram:r}},"loader"),jae={id:E6,detector:Nae,loader:Aae},Mae=jae,N6="architecture",Lae=H(r=>/^\s*architecture/.test(r),"detector"),Bae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./architectureDiagram-Q4EWVU46-DiKlGJXZ.js");return{diagram:e}},__vite__mapDeps([50,23,25,10,8,13]));return{id:N6,diagram:r}},"loader"),Rae={id:N6,detector:Lae,loader:Bae},Oae=Rae,A6="ishikawa",Dae=H(r=>/^\s*ishikawa(-beta)?\b/i.test(r),"detector"),Iae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-UXIWVN3A-RFbi-dXL.js");return{diagram:e}},[]);return{id:A6,diagram:r}},"loader"),Fae={id:A6,detector:Dae,loader:Iae},j6="venn",$ae=H(r=>/^\s*venn-beta/.test(r),"detector"),Pae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./vennDiagram-DHZGUBPP-ar0AgOfJ.js");return{diagram:e}},[]);return{id:j6,diagram:r}},"loader"),zae={id:j6,detector:$ae,loader:Pae},qae=zae,M6="treemap",Hae=H(r=>/^\s*treemap/.test(r),"detector"),Uae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-G4DWMVQ6-JF8e4CmK.js");return{diagram:e}},__vite__mapDeps([51,19,23,25,10,8,28]));return{id:M6,diagram:r}},"loader"),Wae={id:M6,detector:Hae,loader:Uae},L6="wardley-beta",Gae=H(r=>/^\s*wardley-beta/i.test(r),"detector"),Kae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./wardleyDiagram-NUSXRM2D-Et52gtVy.js");return{diagram:e}},__vite__mapDeps([52,23,25,10,8]));return{id:L6,diagram:r}},"loader"),Vae={id:L6,detector:Gae,loader:Kae},Yae=Vae,Jj=!1,nb=H(()=>{Jj||(Jj=!0,Qm("error",Zse,r=>r.toLowerCase().trim()==="error"),Qm("---",{db:{clear:H(()=>{},"clear")},styles:{},renderer:{draw:H(()=>{},"draw")},parser:{parse:H(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:H(()=>null,"init")},r=>r.toLowerCase().trimStart().startsWith("---")),b1(tae,cae,Oae),b1($ne,fae,Ose,Mse,Zne,sse,lse,use,wse,Ese,Kne,Hne,sae,tse,Hse,$se,Kse,gse,yae,xae,vse,Eae,Mae,wae,Fae,Wae,qae,Yae))},"addDiagrams"),Xae=H(async()=>{Qe.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(lc).map(async([i,{detector:n,loader:s}])=>{if(s)try{C1(i)}catch{try{const{diagram:o,id:h}=await s();Qm(h,o,n)}catch(o){throw Qe.error(`Failed to load external diagram with key ${i}. Removing from detectors.`),delete lc[i],o}}}))).filter(i=>i.status==="rejected");if(e.length>0){Qe.error(`Failed to load ${e.length} external diagrams`);for(const i of e)Qe.error(i);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),Zae="graphics-document document";function B6(r,e){r.attr("role",Zae),e!==""&&r.attr("aria-roledescription",e)}H(B6,"setA11yDiagramInfo");function R6(r,e,i,n){if(r.insert!==void 0){if(i){const s=`chart-desc-${n}`;r.attr("aria-describedby",s),r.insert("desc",":first-child").attr("id",s).text(i)}if(e){const s=`chart-title-${n}`;r.attr("aria-labelledby",s),r.insert("title",":first-child").attr("id",s).text(e)}}}H(R6,"addSVGa11yTitleDescription");var tc,iC=(tc=class{constructor(e,i,n,s,o){this.type=e,this.text=i,this.db=n,this.parser=s,this.renderer=o}static async fromText(e,i={}){var d,g;const n=ni(),s=Ew(e,n);e=Rte(e)+`
447
+ L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),fne=H((r,e,i)=>{const n=r.append("defs").append("marker").attr("id",i+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),pne=H((r,e,i)=>{const n=ni(),{themeVariables:s}=n,{strokeWidth:o}=s,h=r.append("defs").append("marker").attr("id",i+"_"+e+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");h.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),h.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),h.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),h.selectAll("*").attr("stroke-width",`${o}`)},"requirement_contains_neo"),gne={extension:Kie,composition:Vie,aggregation:Yie,dependency:Xie,lollipop:Zie,point:Qie,circle:Jie,cross:ene,barb:tne,barbNeo:rne,only_one:ine,zero_or_one:nne,one_or_more:sne,zero_or_more:ane,only_one_neo:one,zero_or_one_neo:lne,one_or_more_neo:cne,zero_or_more_neo:hne,requirement_arrow:une,requirement_contains:fne,requirement_arrow_neo:dne,requirement_contains_neo:pne},mne=Gie,yne={common:Gf,getConfig:ni,insertCluster:pie,insertEdge:Wie,insertEdgeLabel:$ie,insertMarkers:mne,insertNode:WI,interpolateToCurve:Gw,labelHelper:Qt,log:Qe,positionEdgeLabel:Pie},Af={},YI=H(r=>{for(const e of r)Af[e.name]=e},"registerLayoutLoaders"),bne=H(()=>{YI([{name:"dagre",loader:H(async()=>await Xt(()=>import("./dagre-KV5264BT-DZNKiVjW.js"),__vite__mapDeps([6,7,8,9,10,11])),"loader")},{name:"cose-bilkent",loader:H(async()=>await Xt(()=>import("./cose-bilkent-S5V4N54A-Cwey9c1r.js"),__vite__mapDeps([12,13])),"loader")}])},"registerDefaultLayoutLoaders");bne();var cye=H(async(r,e)=>{if(!(r.layoutAlgorithm in Af))throw new Error(`Unknown layout algorithm: ${r.layoutAlgorithm}`);if(r.diagramId)for(const g of r.nodes){const p=g.domId||g.id;g.domId=`${r.diagramId}-${p}`}const i=Af[r.layoutAlgorithm],n=await i.loader(),{theme:s,themeVariables:o}=r.config,{useGradient:h,gradientStart:l,gradientStop:u}=o,d=e.attr("id");if(e.append("defs").append("filter").attr("id",`${d}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${d}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s!=null&&s.includes("dark")?"#FFFFFF":"#000000"}`),h){const g=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");g.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),g.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return n.render(r,e,yne,{algorithm:i.algorithm})},"render"),hye=H((r="",{fallback:e="dagre"}={})=>{if(r in Af)return r;if(e in Af)return Qe.warn(`Layout algorithm ${r} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${r} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm"),XI="comm",ZI="rule",QI="decl",vne="@import",xne="@namespace",_ne="@keyframes",Cne="@layer",wne=Math.abs,uf=String.fromCharCode;function JI(r){return r.trim()}function eC(r,e,i){return r.replace(e,i)}function Th(r,e){return r.charCodeAt(e)|0}function au(r,e,i){return r.slice(e,i)}function Ys(r){return r.length}function kne(r){return r.length}function Ng(r,e){return e.push(r),r}var rb=1,ou=1,e6=0,ps=0,bi=0,yu="";function fk(r,e,i,n,s,o,h,l){return{value:r,root:e,parent:i,type:n,props:s,children:o,line:rb,column:ou,length:h,return:"",siblings:l}}function Sne(){return bi}function Tne(){return bi=ps>0?Th(yu,--ps):0,ou--,bi===10&&(ou=1,rb--),bi}function As(){return bi=ps<e6?Th(yu,ps++):0,ou++,bi===10&&(ou=1,rb++),bi}function Ho(){return Th(yu,ps)}function bm(){return ps}function ib(r,e){return au(yu,r,e)}function jf(r){switch(r){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ene(r){return rb=ou=1,e6=Ys(yu=r),ps=0,[]}function Nne(r){return yu="",r}function J0(r){return JI(ib(ps-1,tC(r===91?r+2:r===40?r+1:r)))}function Ane(r){for(;(bi=Ho())&&bi<33;)As();return jf(r)>2||jf(bi)>3?"":" "}function jne(r,e){for(;--e&&As()&&!(bi<48||bi>102||bi>57&&bi<65||bi>70&&bi<97););return ib(r,bm()+(e<6&&Ho()==32&&As()==32))}function tC(r){for(;As();)switch(bi){case r:return ps;case 34:case 39:r!==34&&r!==39&&tC(bi);break;case 40:r===41&&tC(r);break;case 92:As();break}return ps}function Mne(r,e){for(;As()&&r+bi!==57;)if(r+bi===84&&Ho()===47)break;return"/*"+ib(e,ps-1)+"*"+uf(r===47?r:As())}function Lne(r){for(;!jf(Ho());)As();return ib(r,ps)}function Bne(r){return Nne(vm("",null,null,null,[""],r=Ene(r),0,[0],r))}function vm(r,e,i,n,s,o,h,l,u){for(var d=0,g=0,p=h,m=0,y=0,w=0,_=1,v=1,x=1,C=0,k=0,T="",N=s,j=o,A=n,E=T;v;)switch(w=k,k=As()){case 40:w!=108&&Th(E,p-1)==58?(C++,E+="("):E+=J0(k);break;case 41:C--,E+=")";break;case 34:case 39:case 91:E+=J0(k);break;case 9:case 10:case 13:case 32:if(C>0){E+=uf(k);break}E+=Ane(w);break;case 92:E+=jne(bm()-1,7);continue;case 47:switch(Ho()){case 42:case 47:Ng(Rne(Mne(As(),bm()),e,i,u),u),(jf(w||1)==5||jf(Ho()||1)==5)&&Ys(E)&&au(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*_:l[d++]=Ys(E)*x;case 125*_:case 59:case 0:if(C>0&&k){E+=uf(k);break}switch(k){case 0:case 125:v=0;case 59+g:x==-1&&(E=eC(E,/\f/g,"")),y>0&&(Ys(E)-p||_===0)&&Ng(y>32?Qj(E+";",n,i,p-1,u):Qj(eC(E," ","")+";",n,i,p-2,u),u);break;case 59:E+=";";default:if(Ng(A=Zj(E,e,i,d,g,s,l,T,N=[],j=[],p,o),o),k===123)if(g===0)vm(E,e,A,A,N,o,p,l,j);else{switch(m){case 99:if(Th(E,3)===110)break;case 108:if(Th(E,2)===97)break;default:g=0;case 100:case 109:case 115:}g?vm(r,A,A,n&&Ng(Zj(r,A,A,0,0,s,l,T,s,N=[],p,j),j),s,j,p,l,n?N:j):vm(E,A,A,A,[""],j,0,l,j)}}d=g=y=0,_=x=1,T=E="",p=h;break;case 58:p=1+Ys(E),y=w;default:if(_<1){if(k==123)--_;else if(k==125&&_++==0&&Tne()==125)continue}switch(E+=uf(k),k*_){case 38:x=g>0?1:(E+="\f",-1);break;case 44:if(C>0)break;l[d++]=(Ys(E)-1)*x,x=1;break;case 64:Ho()===45&&(E+=J0(As())),m=Ho(),g=p=Ys(T=E+=Lne(bm())),k++;break;case 45:w===45&&Ys(E)==2&&(_=0)}}return o}function Zj(r,e,i,n,s,o,h,l,u,d,g,p){for(var m=s-1,y=s===0?o:[""],w=kne(y),_=0,v=0,x=0;_<n;++_)for(var C=0,k=au(r,m+1,m=wne(v=h[_])),T=r;C<w;++C)(T=JI(v>0?y[C]+" "+k:eC(k,/&\f/g,y[C])))&&(u[x++]=T);return fk(r,e,i,s===0?ZI:l,u,d,g,p)}function Rne(r,e,i,n){return fk(r,e,i,XI,uf(Sne()),au(r,2,-2),0,n)}function Qj(r,e,i,n,s){return fk(r,e,i,QI,au(r,0,n),au(r,n+1,-1),n,s)}function rC(r,e){for(var i="",n=0;n<r.length;n++)i+=e(r[n],n,r,e)||"";return i}function One(r,e,i,n){switch(r.type){case Cne:if(r.children.length)break;case vne:case xne:case QI:return r.return=r.return||r.value;case XI:return"";case _ne:return r.return=r.value+"{"+rC(r.children,n)+"}";case ZI:if(!Ys(r.value=r.props.join(",")))return""}return Ys(i=rC(r.children,n))?r.return=r.value+"{"+i+"}":""}var t6="c4",Dne=H(r=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(r),"detector"),Ine=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./c4Diagram-AHTNJAMY-Da0jvbfK.js");return{diagram:e}},__vite__mapDeps([14,15]));return{id:t6,diagram:r}},"loader"),Fne={id:t6,detector:Dne,loader:Ine},$ne=Fne,r6="flowchart",Pne=H((r,e)=>{var i,n;return((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-wrapper"||((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"?!1:/^\s*graph/.test(r)},"detector"),zne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-DvWNy8cu.js");return{diagram:e}},__vite__mapDeps([16,17,15,18,19,20]));return{id:r6,diagram:r}},"loader"),qne={id:r6,detector:Pne,loader:zne},Hne=qne,i6="flowchart-v2",Une=H((r,e)=>{var i,n,s;return((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="dagre-d3"?!1:(((n=e==null?void 0:e.flowchart)==null?void 0:n.defaultRenderer)==="elk"&&(e.layout="elk"),/^\s*graph/.test(r)&&((s=e==null?void 0:e.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(r))},"detector"),Wne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-DvWNy8cu.js");return{diagram:e}},__vite__mapDeps([16,17,15,18,19,20]));return{id:i6,diagram:r}},"loader"),Gne={id:i6,detector:Une,loader:Wne},Kne=Gne,n6="er",Vne=H(r=>/^\s*erDiagram/.test(r),"detector"),Yne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./erDiagram-SMLLAGMA-Ds6rT6PJ.js");return{diagram:e}},__vite__mapDeps([21,18,19,20]));return{id:n6,diagram:r}},"loader"),Xne={id:n6,detector:Vne,loader:Yne},Zne=Xne,s6="gitGraph",Qne=H(r=>/^\s*gitGraph/.test(r),"detector"),Jne=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./gitGraphDiagram-UUTBAWPF-CBzBCK_G.js");return{diagram:e}},__vite__mapDeps([22,23,24,25,10,8]));return{id:s6,diagram:r}},"loader"),ese={id:s6,detector:Qne,loader:Jne},tse=ese,a6="gantt",rse=H(r=>/^\s*gantt/.test(r),"detector"),ise=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./ganttDiagram-T4ZO3ILL-By-_j9Pv.js");return{diagram:e}},__vite__mapDeps([26,27,28]));return{id:a6,diagram:r}},"loader"),nse={id:a6,detector:rse,loader:ise},sse=nse,o6="info",ase=H(r=>/^\s*info/.test(r),"detector"),ose=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./infoDiagram-42DDH7IO-BTUUmXjb.js");return{diagram:e}},__vite__mapDeps([29,25,10,8]));return{id:o6,diagram:r}},"loader"),lse={id:o6,detector:ase,loader:ose},l6="pie",cse=H(r=>/^\s*pie/.test(r),"detector"),hse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./pieDiagram-DEJITSTG-C3DFxMfl.js");return{diagram:e}},__vite__mapDeps([30,23,25,10,8,31]));return{id:l6,diagram:r}},"loader"),use={id:l6,detector:cse,loader:hse},c6="quadrantChart",dse=H(r=>/^\s*quadrantChart/.test(r),"detector"),fse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./quadrantDiagram-34T5L4WZ-CT-eCe-_.js");return{diagram:e}},__vite__mapDeps([32,27,28]));return{id:c6,diagram:r}},"loader"),pse={id:c6,detector:dse,loader:fse},gse=pse,h6="xychart",mse=H(r=>/^\s*xychart(-beta)?/.test(r),"detector"),yse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./xychartDiagram-5P7HB3ND-B8Mqq3ZE.js");return{diagram:e}},__vite__mapDeps([33,27,28]));return{id:h6,diagram:r}},"loader"),bse={id:h6,detector:mse,loader:yse},vse=bse,u6="requirement",xse=H(r=>/^\s*requirement(Diagram)?/.test(r),"detector"),_se=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./requirementDiagram-MS252O5E-DmoLLM8r.js");return{diagram:e}},__vite__mapDeps([34,18,19]));return{id:u6,diagram:r}},"loader"),Cse={id:u6,detector:xse,loader:_se},wse=Cse,d6="sequence",kse=H(r=>/^\s*sequenceDiagram/.test(r),"detector"),Sse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./sequenceDiagram-FGHM5R23-DJEg_j4R.js");return{diagram:e}},__vite__mapDeps([35,15,24]));return{id:d6,diagram:r}},"loader"),Tse={id:d6,detector:kse,loader:Sse},Ese=Tse,f6="class",Nse=H((r,e)=>{var i;return((i=e==null?void 0:e.class)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(r)},"detector"),Ase=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./classDiagram-6PBFFD2Q-c4kMgPz0.js");return{diagram:e}},__vite__mapDeps([36,37,17,15,18,19]));return{id:f6,diagram:r}},"loader"),jse={id:f6,detector:Nse,loader:Ase},Mse=jse,p6="classDiagram",Lse=H((r,e)=>{var i;return/^\s*classDiagram/.test(r)&&((i=e==null?void 0:e.class)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(r)},"detector"),Bse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./classDiagram-v2-HSJHXN6E-c4kMgPz0.js");return{diagram:e}},__vite__mapDeps([38,37,17,15,18,19]));return{id:p6,diagram:r}},"loader"),Rse={id:p6,detector:Lse,loader:Bse},Ose=Rse,g6="state",Dse=H((r,e)=>{var i;return((i=e==null?void 0:e.state)==null?void 0:i.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(r)},"detector"),Ise=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./stateDiagram-FHFEXIEX-ClIXb6Ze.js");return{diagram:e}},__vite__mapDeps([39,40,18,19,7,8,9,10]));return{id:g6,diagram:r}},"loader"),Fse={id:g6,detector:Dse,loader:Ise},$se=Fse,m6="stateDiagram",Pse=H((r,e)=>{var i;return!!(/^\s*stateDiagram-v2/.test(r)||/^\s*stateDiagram/.test(r)&&((i=e==null?void 0:e.state)==null?void 0:i.defaultRenderer)==="dagre-wrapper")},"detector"),zse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./stateDiagram-v2-QKLJ7IA2-CoiDH22q.js");return{diagram:e}},__vite__mapDeps([41,40,18,19]));return{id:m6,diagram:r}},"loader"),qse={id:m6,detector:Pse,loader:zse},Hse=qse,y6="journey",Use=H(r=>/^\s*journey/.test(r),"detector"),Wse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./journeyDiagram-VCZTEJTY-DyF2JQlC.js");return{diagram:e}},__vite__mapDeps([42,17,15,31]));return{id:y6,diagram:r}},"loader"),Gse={id:y6,detector:Use,loader:Wse},Kse=Gse,Vse=H((r,e,i)=>{Qe.debug(`rendering svg for syntax error
448
+ `);const n=see(e),s=n.append("g");n.attr("viewBox","0 0 2412 512"),A5(n,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${i}`)},"draw"),b6={draw:Vse},Yse=b6,Xse={db:{},renderer:b6,parser:{parse:H(()=>{},"parse")}},Zse=Xse,v6="flowchart-elk",Qse=H((r,e={})=>{var i;return/^\s*flowchart-elk/.test(r)||/^\s*(flowchart|graph)/.test(r)&&((i=e==null?void 0:e.flowchart)==null?void 0:i.defaultRenderer)==="elk"?(e.layout="elk",!0):!1},"detector"),Jse=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./flowDiagram-DWJPFMVM-DvWNy8cu.js");return{diagram:e}},__vite__mapDeps([16,17,15,18,19,20]));return{id:v6,diagram:r}},"loader"),eae={id:v6,detector:Qse,loader:Jse},tae=eae,x6="timeline",rae=H(r=>/^\s*timeline/.test(r),"detector"),iae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./timeline-definition-GMOUNBTQ-DFd98vtt.js");return{diagram:e}},__vite__mapDeps([43,31]));return{id:x6,diagram:r}},"loader"),nae={id:x6,detector:rae,loader:iae},sae=nae,_6="mindmap",aae=H(r=>/^\s*mindmap/.test(r),"detector"),oae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./mindmap-definition-QFDTVHPH-B61nbOYh.js");return{diagram:e}},__vite__mapDeps([44,18,19]));return{id:_6,diagram:r}},"loader"),lae={id:_6,detector:aae,loader:oae},cae=lae,C6="kanban",hae=H(r=>/^\s*kanban/.test(r),"detector"),uae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./kanban-definition-6JOO6SKY-DeI_CbHJ.js");return{diagram:e}},__vite__mapDeps([45,17]));return{id:C6,diagram:r}},"loader"),dae={id:C6,detector:hae,loader:uae},fae=dae,w6="sankey",pae=H(r=>/^\s*sankey(-beta)?/.test(r),"detector"),gae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./sankeyDiagram-XADWPNL6-CLo6gI4P.js");return{diagram:e}},[]);return{id:w6,diagram:r}},"loader"),mae={id:w6,detector:pae,loader:gae},yae=mae,k6="packet",bae=H(r=>/^\s*packet(-beta)?/.test(r),"detector"),vae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-TYMM5635-C41sMFwW.js");return{diagram:e}},__vite__mapDeps([46,23,25,10,8]));return{id:k6,diagram:r}},"loader"),xae={id:k6,detector:bae,loader:vae},S6="radar",_ae=H(r=>/^\s*radar-beta/.test(r),"detector"),Cae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-MMDJMWI5-CRSl3XwD.js");return{diagram:e}},__vite__mapDeps([47,23,25,10,8]));return{id:S6,diagram:r}},"loader"),wae={id:S6,detector:_ae,loader:Cae},T6="block",kae=H(r=>/^\s*block(-beta)?/.test(r),"detector"),Sae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./blockDiagram-DXYQGD6D-BAQ8qHGf.js");return{diagram:e}},__vite__mapDeps([48,17,11,7,8,20]));return{id:T6,diagram:r}},"loader"),Tae={id:T6,detector:kae,loader:Sae},Eae=Tae,E6="treeView",Nae=H(r=>/^\s*treeView-beta/.test(r),"detector"),Aae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-5BDNPKRD-M6a8mmLP.js");return{diagram:e}},__vite__mapDeps([49,23,24,25,10,8]));return{id:E6,diagram:r}},"loader"),jae={id:E6,detector:Nae,loader:Aae},Mae=jae,N6="architecture",Lae=H(r=>/^\s*architecture/.test(r),"detector"),Bae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./architectureDiagram-Q4EWVU46-CdgUfjJH.js");return{diagram:e}},__vite__mapDeps([50,23,25,10,8,13]));return{id:N6,diagram:r}},"loader"),Rae={id:N6,detector:Lae,loader:Bae},Oae=Rae,A6="ishikawa",Dae=H(r=>/^\s*ishikawa(-beta)?\b/i.test(r),"detector"),Iae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./ishikawaDiagram-UXIWVN3A-CupQbClR.js");return{diagram:e}},[]);return{id:A6,diagram:r}},"loader"),Fae={id:A6,detector:Dae,loader:Iae},j6="venn",$ae=H(r=>/^\s*venn-beta/.test(r),"detector"),Pae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./vennDiagram-DHZGUBPP-Bz1mnQpB.js");return{diagram:e}},[]);return{id:j6,diagram:r}},"loader"),zae={id:j6,detector:$ae,loader:Pae},qae=zae,M6="treemap",Hae=H(r=>/^\s*treemap/.test(r),"detector"),Uae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./diagram-G4DWMVQ6-cds4vRT7.js");return{diagram:e}},__vite__mapDeps([51,19,23,25,10,8,28]));return{id:M6,diagram:r}},"loader"),Wae={id:M6,detector:Hae,loader:Uae},L6="wardley-beta",Gae=H(r=>/^\s*wardley-beta/i.test(r),"detector"),Kae=H(async()=>{const{diagram:r}=await Xt(async()=>{const{diagram:e}=await import("./wardleyDiagram-NUSXRM2D-D4BoVVBq.js");return{diagram:e}},__vite__mapDeps([52,23,25,10,8]));return{id:L6,diagram:r}},"loader"),Vae={id:L6,detector:Gae,loader:Kae},Yae=Vae,Jj=!1,nb=H(()=>{Jj||(Jj=!0,Qm("error",Zse,r=>r.toLowerCase().trim()==="error"),Qm("---",{db:{clear:H(()=>{},"clear")},styles:{},renderer:{draw:H(()=>{},"draw")},parser:{parse:H(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:H(()=>null,"init")},r=>r.toLowerCase().trimStart().startsWith("---")),b1(tae,cae,Oae),b1($ne,fae,Ose,Mse,Zne,sse,lse,use,wse,Ese,Kne,Hne,sae,tse,Hse,$se,Kse,gse,yae,xae,vse,Eae,Mae,wae,Fae,Wae,qae,Yae))},"addDiagrams"),Xae=H(async()=>{Qe.debug("Loading registered diagrams");const e=(await Promise.allSettled(Object.entries(lc).map(async([i,{detector:n,loader:s}])=>{if(s)try{C1(i)}catch{try{const{diagram:o,id:h}=await s();Qm(h,o,n)}catch(o){throw Qe.error(`Failed to load external diagram with key ${i}. Removing from detectors.`),delete lc[i],o}}}))).filter(i=>i.status==="rejected");if(e.length>0){Qe.error(`Failed to load ${e.length} external diagrams`);for(const i of e)Qe.error(i);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),Zae="graphics-document document";function B6(r,e){r.attr("role",Zae),e!==""&&r.attr("aria-roledescription",e)}H(B6,"setA11yDiagramInfo");function R6(r,e,i,n){if(r.insert!==void 0){if(i){const s=`chart-desc-${n}`;r.attr("aria-describedby",s),r.insert("desc",":first-child").attr("id",s).text(i)}if(e){const s=`chart-title-${n}`;r.attr("aria-labelledby",s),r.insert("title",":first-child").attr("id",s).text(e)}}}H(R6,"addSVGa11yTitleDescription");var tc,iC=(tc=class{constructor(e,i,n,s,o){this.type=e,this.text=i,this.db=n,this.parser=s,this.renderer=o}static async fromText(e,i={}){var d,g;const n=ni(),s=Ew(e,n);e=Rte(e)+`
449
449
  `;try{C1(s)}catch{const p=FQ(s);if(!p)throw new g5(`Diagram ${s} not found.`);const{id:m,diagram:y}=await p();Qm(m,y)}const{db:o,parser:h,renderer:l,init:u}=C1(s);return h.parser&&(h.parser.yy=o),(d=o.clear)==null||d.call(o),u==null||u(n),i.title&&((g=o.setDiagramTitle)==null||g.call(o,i.title)),await h.parse(e),new tc(s,e,o,h,l)}async render(e,i){await this.renderer.draw(this.text,e,i,this)}getParser(){return this.parser}getType(){return this.type}},H(tc,"Diagram"),tc),eM=[],Qae=H(()=>{eM.forEach(r=>{r()}),eM=[]},"attachFunctions"),Jae=H(r=>r.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function O6(r){const e=r.match(p5);if(!e)return{text:r,metadata:{}};let i=dte(e[1],{schema:ute})??{};i=typeof i=="object"&&!Array.isArray(i)?i:{};const n={};return i.displayMode&&(n.displayMode=i.displayMode.toString()),i.title&&(n.title=i.title.toString()),i.config&&(n.config=i.config),{text:r.slice(e[0].length),metadata:n}}H(O6,"extractFrontMatter");var eoe=H(r=>r.replace(/\r\n?/g,`
450
450
  `).replace(/<(\w+)([^>]*)>/g,(e,i,n)=>"<"+i+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),toe=H(r=>{const{text:e,metadata:i}=O6(r),{displayMode:n,title:s,config:o={}}=i;return n&&(o.gantt||(o.gantt={}),o.gantt.displayMode=n),{title:s,config:o,text:e}},"processFrontmatter"),roe=H(r=>{const e=Ts.detectInit(r)??{},i=Ts.detectDirective(r,"wrap");return Array.isArray(i)?e.wrap=i.some(({type:n})=>n==="wrap"):(i==null?void 0:i.type)==="wrap"&&(e.wrap=!0),{text:_te(r),directive:e}},"processDirectives");function pk(r){const e=eoe(r),i=toe(e),n=roe(i.text),s=Zw(i.config,n.directive);return r=Jae(n.text),{code:r,title:i.title,config:s}}H(pk,"preprocessDiagram");function D6(r){const e=new TextEncoder().encode(r),i=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(i)}H(D6,"toBase64");var ioe=5e4,noe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",soe="sandbox",aoe="loose",ooe="http://www.w3.org/2000/svg",loe="http://www.w3.org/1999/xlink",coe="http://www.w3.org/1999/xhtml",hoe="100%",uoe="100%",doe="border:0;margin:0;",foe="margin:0",poe="allow-top-navigation-by-user-activation allow-popups",goe='The "iframe" tag is not supported by your browser.',moe=["foreignobject"],yoe=["dominant-baseline"];function gk(r){const e=pk(r);return Xm(),dJ(e.config??{}),e}H(gk,"processAndSetConfigs");async function I6(r,e){nb();try{const{code:i,config:n}=gk(r);return{diagramType:(await $6(i)).type,config:n}}catch(i){if(e!=null&&e.suppressErrors)return!1;throw i}}H(I6,"parse");var tM=H((r,e,i=[])=>`
451
451
  .${r} ${e} { ${i.join(" !important; ")} !important; }`,"cssImportantStyles"),boe=H((r,e=new Map)=>{let i="";if(r.themeCSS!==void 0&&(i+=`
@@ -465,7 +465,7 @@ Couldn't relaunch automatically (${(O==null?void 0:O.reason)??"app not installed
465
465
 
466
466
  Couldn't reach the relaunch service. Reopen the app manually to finish.`.trimStart())}_(!1)},[]),j=R.useCallback(O=>{O.key==="Escape"&&u&&g!=="running"&&d(!1)},[u,g]);if(R.useEffect(()=>(document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)),[j]),!(o||s.length>0||!!n))return null;const E=o&&h&&l?`v${h} → v${l}`:null,L=g==="running"||w;return a.jsxs("div",{className:"update-badge",children:[a.jsxs("button",{className:"update-badge-trigger",onClick:()=>d(O=>!O),"aria-expanded":u,title:e("update.title"),children:[a.jsx("span",{className:`update-badge-dot ${g==="running"?"update-badge-dot--busy":""}`}),a.jsx("span",{className:"update-badge-label",children:e(g==="running"?"update.upgrading":"update.available")})]}),u&&a.jsxs("div",{className:"update-badge-popover",children:[a.jsxs("div",{className:"update-badge-popover-header",children:[a.jsx("span",{className:"update-badge-popover-title",children:e("update.title")}),a.jsx("button",{className:"update-badge-dismiss",onClick:()=>d(!1),disabled:g==="running",title:e("update.dismiss"),"aria-label":e("update.dismiss"),children:"×"})]}),g!=="idle"?a.jsxs("div",{className:"update-badge-content",children:[a.jsxs("div",{className:`update-badge-status update-badge-status--${g}`,children:[g==="running"&&a.jsx("span",{className:"update-badge-spinner","aria-hidden":"true"}),a.jsxs("span",{className:"update-badge-status-text",children:[g==="running"&&e("update.upgrading"),g==="done"&&e("update.upgraded"),g==="error"&&e("update.upgradeFailed")]})]}),m&&a.jsx("pre",{className:"update-badge-log",children:m}),g==="done"&&a.jsx("p",{className:"update-badge-note",children:e("update.relaunchHint")})]}):a.jsxs("div",{className:"update-badge-content",children:[E&&a.jsx("p",{className:"update-badge-version",children:E}),a.jsx("p",{className:"update-badge-hint",children:e("update.upgradeHint")}),n&&a.jsxs("details",{className:"update-badge-details",children:[a.jsx("summary",{children:e("update.title")}),a.jsx(Qf,{content:n})]})]}),g==="idle"&&a.jsx("button",{className:"update-badge-action",onClick:T,disabled:L,children:e("update.upgradeAll")}),g==="done"&&a.jsx("button",{className:"update-badge-action",onClick:N,disabled:w,children:e("update.relaunch")}),g==="error"&&a.jsx("button",{className:"update-badge-action",onClick:T,disabled:L,children:e("update.retry")}),g==="idle"&&s.length>0&&r&&a.jsx("button",{className:"update-badge-action update-badge-action--secondary",onClick:()=>{r(),d(!1)},children:e("update.managePacks")})]})]})}const V6=8,yk=14,sb=20,Ag=sb;function kle(r){return r<V6?"Alert":r<yk?"Drowsy":r<sb?"Sleepy":"Must Sleep"}function Y6(r){return r<V6?"alert":r<yk?"drowsy":r<sb?"sleepy":"must_sleep"}function X6(r){return r<yk?"idle":r<sb?"sleepy":"sleeps"}function Z6(){return Zt({queryKey:["sleep"],queryFn:()=>ze.get("/sleep")})}const qM=[{id:"brain",label:"Brain lifecycle",triggers:[{insert:"/initializer ",label:"Initializer",hint:"Bootstrap a missing or sparse brain from your real material.",what:"Bootstraps a missing or sparse brain from your real material — docs, wikis, Obsidian/Notion exports, or just the codebase — into a proper knowledge / feature / task hierarchy.",how:["Scout inventories your code + docs into a categorized ingestion manifest","You confirm the proposed knowledge / feature / task hierarchy","Ingestor agents fan out per batch, distilling sources into real files (never templates)","Verifier gates: no placeholders, doctor clean, recall actually returns hits"],agents:["initializer-scout","initializer-ingestor","initializer-verifier"]},{insert:"/curator ",label:"Curator",hint:"The periodic brain refactor that sleep won't do.",what:"The periodic brain REFACTOR that sleep won't do — re-orders the whole corpus into the right shape (MOVE / MERGE / SPLIT / RENAME / RE-TYPE / RETIRE) to conform to current conventions.",how:["Auditors fan out per domain, reading conventions live from the skill + taxonomy + soul","A reorg PLAN is proposed: source → action → target for every drifted file","You confirm the shape before anything moves","Workers execute via the CLI so frontmatter, wikilinks and indexes stay coherent","Verifier gates: doctor clean, zero duplicate topics, recall not regressed"],agents:["curator-auditor","curator-worker","curator-verifier"]},{insert:"/dreamcontext-deep-research ",label:"Deep Research",hint:"Heavy cross-corpus synthesis across a large or multi-project brain.",what:"Heavy, iterative synthesis across a large or multi-project brain and connected peer vaults — for when a single explore pass under-serves the question.",how:["Searchers fan out over knowledge, features, tasks, memory, changelog + connected peers","Load-bearing claims are adversarially verified, not trusted","Returns a synthesized, CITED report — not a pile of raw hits"]},{insert:"/dream-sync ",label:"Sync",hint:"Resolve the team brain-merge the CLI defers to you.",what:"The agent half of the team brain-merge — resolves the prose conflicts the CLI deliberately hands off.",how:["The CLI auto-resolves every deterministic file (JSON, task statuses, changelogs)","It defers only PROSE where two people edited the same section","You read base / ours / theirs and write the true semantic merge","Hand back to the CLI to commit + push"]}]},{id:"build",label:"Build & review",triggers:[{insert:"/goal-skill ",label:"Goal",hint:"Drive a non-trivial goal to done under planned, reviewed, validated orchestration.",what:'Drives a non-trivial goal to done under rigorous orchestration — the orchestrator gates each phase; sub-agents do the work; "done" means validation passes against criteria you agreed to.',how:["Planner produces a file-by-file plan grounded in the real codebase","Parallel plan-reviewers critique it from different lenses → SOLID / NEEDS_WORK","The plan is persisted as a dreamcontext task with agreed acceptance criteria","Implementer builds strictly to the criteria; the reviewer gates the diff","Validator runs your chosen tests / checklist → PASS / FAIL, looping until reached"],agents:["goal-planner","goal-plan-reviewer","goal-implementer","reviewer","goal-validator"]},{insert:"/multi-review ",label:"Multi-review",hint:"Route the diff to specialist reviewers, then consolidate one report.",what:"Team code review — routes a diff to niche specialists in parallel, then consolidates their findings into one greptile-style report with a verdict.",how:["Router classifies the diff by size tier + affected domains","Specialists review in parallel: security · cloud-functions · frontend · edge-cases","Coordinator dedupes, re-ranks and drops false positives → one final verdict"],agents:["review-router","review-security","review-cloud-functions","review-frontend","review-edge-cases","review-coordinator"]}]},{id:"decide",label:"Decide & draw",triggers:[{insert:"/council ",label:"Council",hint:"Run a structured multi-persona debate, then synthesize a decision.",what:"A structured multi-persona debate for a hard decision, ending in a synthesized decision report that traces every reason back to who raised it.",how:["3–10 persona agents debate the question over N rounds","Each argues from its own assigned perspective, with optional web research","A synthesizer reads every report and writes the final decision + minority views"],agents:["council-persona","council-synthesizer"]},{insert:"/excalidraw ",label:"Excalidraw",hint:"Generate or extend an Obsidian Excalidraw board from a spec.",what:"Generate or extend an Obsidian Excalidraw board — images, labels, shapes, arrows, lanes, grids — from a small spec.",how:["You describe the board (or point at screenshots to embed)","A deterministic script emits valid plugin markup — ~no tokens, always renders"]}]}],Q6={models:[{id:"opus",label:"Opus"},{id:"sonnet",label:"Sonnet"},{id:"haiku",label:"Haiku"},{id:"fable",label:"Fable"}],efforts:["low","medium","high","xhigh","max"],defaultModel:"opus",defaultEffort:"high"};function HM(r){return r&&r.charAt(0).toUpperCase()+r.slice(1)}function jg(r){if(r<1e3)return String(Math.round(r));if(r<1e6){const e=r/1e3;return`${e<10?e.toFixed(1):Math.round(e)}k`}return`${(r/1e6).toFixed(1)}M`}function UM(r){return r<=0?"$0.00":r<.01?"<$0.01":r<100?`$${r.toFixed(2)}`:`$${Math.round(r)}`}function Sle(r){const e=[...r].filter(i=>{const n=i.codePointAt(0)??0;return n>=32&&n!==127}).join("");return/^[\w@%+=:,./-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function J6(){return Zt({queryKey:["agent-capabilities"],queryFn:()=>ze.get("/agent/capabilities"),staleTime:3e4,refetchInterval:3e4,retry:!1})}function Tle(r){return!!(r!=null&&r.desktop&&r.embeddedTerminal&&r.claudeCli)}function Ele(){return Zt({queryKey:["agent-model-config"],queryFn:()=>ze.get("/agent/model-config"),staleTime:1e4,refetchInterval:3e4,refetchOnWindowFocus:!0,retry:!1,placeholderData:Q6})}const Nle={contextTokens:null,contextLimit:null,costUsd:null};function Ale(r,e){return Zt({queryKey:["agent-session-stats",r],queryFn:()=>ze.get(`/agent/session-stats?claudeId=${encodeURIComponent(r)}`),enabled:e&&!!r,refetchInterval:e?5e3:!1,staleTime:4e3,retry:!1,placeholderData:Nle})}const eF="agent:settings:v1",Mf="dreamcontext-agent-settings",sC={enabled:!0,restoreTabs:!0,defaultAgent:"claude",autoTitle:!1,hotkey:"Ctrl+A"};function tF(r){const e=r??{};return{enabled:e.enabled!==!1,restoreTabs:e.restoreTabs!==!1,defaultAgent:e.defaultAgent==="claude"?"claude":sC.defaultAgent,autoTitle:e.autoTitle===!0,hotkey:typeof e.hotkey=="string"&&e.hotkey.trim()?e.hotkey.trim():sC.hotkey}}function bk(){try{const r=localStorage.getItem(eF);if(r)return tF(JSON.parse(r))}catch{}return{...sC}}function rF(r){try{localStorage.setItem(eF,JSON.stringify(r))}catch{}}function jle(r){rF(r),ze.post("/launcher/agent-settings",r).catch(()=>{});try{window.dispatchEvent(new CustomEvent(Mf,{detail:r}))}catch{}}async function iF(){try{const r=await ze.get("/launcher/agent-settings"),e=tF(r);return rF(e),e}catch{return bk()}}function nF(r){if(["Meta","Control","Alt","Shift"].includes(r.key))return null;const e=[];if(r.metaKey&&e.push("Cmd"),r.ctrlKey&&e.push("Ctrl"),r.altKey&&e.push("Alt"),r.shiftKey&&e.push("Shift"),e.length===0)return null;let i=r.key;return i===" "?i="Space":i.length===1?i=i.toUpperCase():i=i.charAt(0).toUpperCase()+i.slice(1),[...e,i].join("+")}function Mle(r,e){const i=nF(r);if(!i)return!1;const n=s=>s.split("+").map(o=>o.trim().toLowerCase()).sort().join("+");return n(i)===n(e)}const sF=400,aF={Control:"Ctrl",Alt:"Alt",Meta:"Cmd",Shift:"Shift",Fn:"Fn",FnLock:"Fn"};function oF(r){return aF[r.key]??null}function lF(r){const e=r.split("+").map(i=>i.trim());return e.length===2&&e[0]&&e[0]===e[1]&&Object.values(aF).includes(e[0])?e[0]:null}function Lle(r){const e=lF(r);return e?`${e} ×2`:r}function Ble(r,e=sF){let i=0;return n=>{if(oF(n)!==r)return n.repeat||(i=0),!1;if(n.repeat)return!1;const s=Date.now();return i!==0&&s-i<=e?(i=0,!0):(i=s,!1)}}const aC="dreamcontext-run-sleep-agent",WM="Sleep",GM='Think hard. Run a full dreamcontext memory consolidation ("sleep") for THIS project now, fully autonomously — do NOT ask any questions. Follow the project\'s dreamcontext sleep flow: pin the epoch with `dreamcontext sleep start`, reconcile the task / changelog / knowledge / feature files to current truth (prefer updating existing entities over creating new ones), then close the cycle with `dreamcontext sleep done "<one-paragraph summary>"` to reset the debt. When finished, reply with a SHORT Markdown summary of what was consolidated.';function Rle(){window.dispatchEvent(new CustomEvent(aC))}const vk="dreamcontext:sleep-pending-at",vy="dreamcontext-sleep-pending",Ole=3*6e4;function Dle(){try{localStorage.setItem(vk,String(Date.now()))}catch{}window.dispatchEvent(new CustomEvent(vy))}function Ile(){try{localStorage.removeItem(vk)}catch{}window.dispatchEvent(new CustomEvent(vy))}function $x(){try{const r=localStorage.getItem(vk);if(!r)return null;const e=Number(r);return!Number.isFinite(e)||Date.now()-e>Ole?null:e}catch{return null}}function Fle({onOpen:r}){const{t:e}=Fr(),{data:i}=Z6(),{data:n}=J6(),[s,o]=R.useState(!1),[h,l]=R.useState(()=>bk()),[u,d]=R.useState(()=>$x()),g=R.useRef(null);if(R.useEffect(()=>{const j=()=>d($x());window.addEventListener(vy,j);const A=window.setInterval(j,4e3);return()=>{window.removeEventListener(vy,j),window.clearInterval(A)}},[]),R.useEffect(()=>{const j=A=>{const E=A.detail;E&&l(E)};return window.addEventListener(Mf,j),()=>window.removeEventListener(Mf,j)},[]),R.useEffect(()=>{i!=null&&i.sleep_started_at&&$x()!=null&&Ile()},[i==null?void 0:i.sleep_started_at]),R.useEffect(()=>{if(!s)return;const j=E=>{var L;(L=g.current)!=null&&L.contains(E.target)||o(!1)},A=E=>{E.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",j,!0),window.addEventListener("keydown",A,!0),()=>{document.removeEventListener("mousedown",j,!0),window.removeEventListener("keydown",A,!0)}},[s]),!i)return null;const p=Math.max(0,i.debt),m=!!i.sleep_started_at,y=!m&&u!=null,w=m?"must_sleep":Y6(p),_=m?"sleeps":y?"sleepy":X6(p),v=m?100:Math.min(100,p/Ag*100),x=e(`sleep.${w}`),C=Tle(n)&&h.enabled,k=()=>{o(!1),Dle(),Rle()},T=()=>{o(!1),r==null||r()},N=m?e("sleep.active"):y?e("sleep.waiting"):`${x} · ${p}/${Ag} ${e("sleep.debt")}`;return a.jsxs("div",{className:"sleep-tracker-wrap",ref:g,children:[a.jsxs("button",{type:"button",className:`sleep-tracker sleep-tracker--${w}${m?" sleep-tracker--sleeping":""}${y?" sleep-tracker--waiting":""}`,"data-no-drag":!0,onClick:()=>o(j=>!j),title:N,"aria-haspopup":"menu","aria-expanded":s,"aria-label":m?e("sleep.active"):y?e("sleep.waiting"):`${e("sleep.level")}: ${x}. ${e("sleep.debt")} ${p} / ${Ag}.`,children:[a.jsx("span",{className:"sleep-tracker-face","aria-hidden":!0,children:a.jsx(oc,{mood:_,size:30,compact:!0})}),a.jsxs("span",{className:"sleep-tracker-body",children:[a.jsxs("span",{className:"sleep-tracker-top",children:[a.jsx("span",{className:"sleep-tracker-level",children:m?e("sleep.active"):y?e("sleep.waiting"):x}),m?a.jsxs("span",{className:"sleep-tracker-zzz","aria-hidden":!0,children:[a.jsx("span",{children:"z"}),a.jsx("span",{children:"z"}),a.jsx("span",{children:"z"})]}):y?a.jsxs("span",{className:"sleep-tracker-wait-dots","aria-hidden":!0,children:[a.jsx("span",{children:"·"}),a.jsx("span",{children:"·"}),a.jsx("span",{children:"·"})]}):a.jsxs("span",{className:"sleep-tracker-count",children:[p,a.jsxs("span",{className:"sleep-tracker-count-max",children:["/",Ag]})]})]}),a.jsx("span",{className:"sleep-tracker-bar","aria-hidden":!0,children:a.jsx("span",{className:"sleep-tracker-fill",style:{width:`${v}%`}})})]})]}),s&&a.jsxs("div",{className:"sleep-tracker-menu",role:"menu",children:[a.jsxs("button",{type:"button",className:"sleep-tracker-menu-item",role:"menuitem",onClick:T,disabled:!r,children:[a.jsx("span",{className:"sleep-tracker-menu-glyph","aria-hidden":!0,children:"☾"}),a.jsx("span",{className:"sleep-tracker-menu-label",children:e("sleep.menu.details")})]}),a.jsxs("button",{type:"button",className:"sleep-tracker-menu-item",role:"menuitem",onClick:k,disabled:!C||m||y,title:m?e("sleep.menu.run.active"):y?e("sleep.menu.run.waiting"):C?void 0:e("sleep.menu.run.disabled"),children:[a.jsx("span",{className:"sleep-tracker-menu-glyph","aria-hidden":!0,children:"▸"}),a.jsx("span",{className:"sleep-tracker-menu-label",children:e("sleep.menu.run")}),m&&a.jsx("span",{className:"sleep-tracker-menu-hint",children:e("sleep.active")}),y&&a.jsx("span",{className:"sleep-tracker-menu-hint",children:e("sleep.waiting")})]})]})]})}const Yd=[.85,.9,1,1.1,1.2],cF="dreamcontext-zoom";function $le(){try{const r=localStorage.getItem(cF);if(r!==null){const e=parseFloat(r);if(Yd.includes(e))return e}}catch{}return 1}function Ple(r){document.documentElement.style.setProperty("--zoom",String(r)),window.dispatchEvent(new CustomEvent("dreamcontext-zoom",{detail:r}))}function zle(){if(typeof window>"u")return"";try{return new URLSearchParams(window.location.search).get("vault")??""}catch{return""}}function qle({onNavigate:r,sidebarCollapsed:e,onToggleSidebar:i,onOpenSearch:n}){const{theme:s,setTheme:o,resolved:h}=Uf(),l=rr(),[u,d]=R.useState($le),[g,p]=R.useState(!1),m=zle(),y=async()=>{p(!0);try{await l.refetchQueries({type:"active"})}finally{p(!1)}};R.useEffect(()=>{Ple(u)},[u]);const w=()=>{o(s==="system"?"light":s==="light"?"dark":"system")},_=s==="system"?`System (${h})`:h==="dark"?"Dark":"Light",v=Yd.indexOf(u),x=v>0,C=v<Yd.length-1,k=T=>{const N=v+T;if(N<0||N>=Yd.length)return;const j=Yd[N];d(j);try{localStorage.setItem(cF,String(j))}catch{}};return a.jsxs("header",{className:"header",onMouseDown:mR,onDoubleClick:T=>void yR(T.target),children:[a.jsxs("div",{className:"header-left",children:[a.jsx("button",{className:"header-icon-btn","data-testid":"sidebar-collapse",onClick:i,title:e?"Expand sidebar":"Collapse sidebar","aria-label":e?"Expand sidebar":"Collapse sidebar","aria-expanded":!e,children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[a.jsx("rect",{x:"1.4",y:"2.4",width:"13.2",height:"11.2",rx:"2.2",stroke:"currentColor",strokeWidth:"1.4"}),a.jsx("line",{x1:"6.1",y1:"2.8",x2:"6.1",y2:"13.2",stroke:"currentColor",strokeWidth:"1.4"})]})}),a.jsxs("button",{className:"header-search-pill","data-no-drag":!0,onClick:n,title:"Search the brain (⌘K)","aria-label":"Search the brain",children:[a.jsx("span",{className:"header-search-pill-icon","aria-hidden":"true",children:a.jsx(Km,{size:14})}),a.jsx("span",{className:"header-search-pill-text",children:"Search the brain…"}),a.jsx("kbd",{className:"header-search-pill-kbd",children:"⌘K"})]})]}),m&&a.jsx("div",{className:"header-vault",title:m,children:m}),a.jsxs("div",{className:"header-right",children:[a.jsx(Fle,{onOpen:r?()=>r("sleep"):void 0}),a.jsx("button",{className:`header-refresh ${g?"header-refresh--spinning":""}`,onClick:y,disabled:g,title:"Refresh now","aria-label":"Refresh now",children:a.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M13.65 4.5A6 6 0 1 0 14 8"}),a.jsx("path",{d:"M14 2v3h-3"})]})}),a.jsx(wle,{onManagePacks:r?()=>r("packs"):void 0}),a.jsxs("div",{className:"zoom-controls",children:[a.jsx("button",{className:"zoom-btn",onClick:()=>k(-1),disabled:!x,title:"Zoom out",children:"-"}),a.jsxs("span",{className:"zoom-label",children:[Math.round(u*100),"%"]}),a.jsx("button",{className:"zoom-btn",onClick:()=>k(1),disabled:!C,title:"Zoom in",children:"+"})]}),a.jsx("button",{className:"theme-toggle",onClick:w,title:`Theme: ${_}`,children:h==="dark"?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:a.jsx("path",{d:"M8 1a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 1zm0 10a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 11zm7-3a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 15 8zM5 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 5 8zm7.07-4.07a.5.5 0 0 1 0 .71l-1.41 1.41a.5.5 0 1 1-.71-.71l1.41-1.41a.5.5 0 0 1 .71 0zM6.05 10.66a.5.5 0 0 1 0 .71l-1.41 1.41a.5.5 0 0 1-.71-.71l1.41-1.41a.5.5 0 0 1 .71 0zm7.72 3.12a.5.5 0 0 1-.71 0l-1.41-1.41a.5.5 0 1 1 .71-.71l1.41 1.41a.5.5 0 0 1 0 .71zM5.34 6.05a.5.5 0 0 1-.71 0L3.22 4.64a.5.5 0 0 1 .71-.71l1.41 1.41a.5.5 0 0 1 0 .71zM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8z"})}):a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:a.jsx("path",{d:"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"})})})]})]})}function ab({size:r=34,glow:e=!1,className:i,title:n}){return a.jsx("img",{src:"/logo.png",width:r,height:r,className:i,alt:n??"dreamcontext",draggable:!1,style:{objectFit:"contain",...e?{filter:"drop-shadow(0 6px 16px rgba(123,104,238,0.35))"}:{}}})}const Hle={fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"};function gs({children:r}){return a.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14",...Hle,"aria-hidden":"true",children:r})}function Ule(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M3.5 6.5 5 8l2.4-2.6"}),a.jsx("line",{x1:"10",y1:"6.5",x2:"20.5",y2:"6.5"}),a.jsx("path",{d:"M3.5 12 5 13.5 7.4 10.9"}),a.jsx("line",{x1:"10",y1:"12",x2:"20.5",y2:"12"}),a.jsx("line",{x1:"3.5",y1:"17.5",x2:"6.5",y2:"17.5"}),a.jsx("line",{x1:"10",y1:"17.5",x2:"20.5",y2:"17.5"})]})}function Wle(){return a.jsxs(gs,{children:[a.jsx("line",{x1:"3",y1:"4.5",x2:"21",y2:"4.5"}),a.jsx("rect",{x:"3",y:"7.4",width:"11",height:"3.2",rx:"1.2"}),a.jsx("rect",{x:"8",y:"13.2",width:"13",height:"3.2",rx:"1.2"}),a.jsx("rect",{x:"3",y:"19",width:"8",height:"3.2",rx:"1.2"}),a.jsx("line",{x1:"10",y1:"3",x2:"10",y2:"21",strokeDasharray:"1.6 2",opacity:"0.55"})]})}function Gle(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M3 5.5h9a1.8 1.8 0 0 1 1.8 1.8v3.4A1.8 1.8 0 0 1 12 12.5H7l-3 2.6V12.5a1.8 1.8 0 0 1-1-1.6V7.3A1.8 1.8 0 0 1 3 5.5z"}),a.jsx("path",{d:"M21 11.5v3.4a1.8 1.8 0 0 1-1.8 1.8H16l-2.4 2.1v-2.1"})]})}function Kle(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M6 3.5h12l3.5 5.5L12 21 2.5 9z"}),a.jsx("path",{d:"M2.5 9h19"}),a.jsx("path",{d:"M9 3.5 7 9l5 12 5-12-2-5.5"})]})}function Vle(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M12 6.2C10.1 4.9 7.8 4.2 5 4.2c-.9 0-1.7.1-2.5.3v13c.8-.2 1.6-.3 2.5-.3 2.8 0 5.1.7 7 2"}),a.jsx("path",{d:"M12 6.2c1.9-1.3 4.2-2 7-2 .9 0 1.7.1 2.5.3v13c-.8-.2-1.6-.3-2.5-.3-2.8 0-5.1.7-7 2"}),a.jsx("line",{x1:"12",y1:"6.2",x2:"12",y2:"19.2"})]})}function Yle(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M3 11.4V5a2 2 0 0 1 2-2h6.4a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8l-6.4 6.4a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 11.4z"}),a.jsx("circle",{cx:"7.6",cy:"7.6",r:"1.3"})]})}function Xle(){return a.jsxs(gs,{children:[a.jsx("circle",{cx:"6",cy:"6",r:"2.1"}),a.jsx("circle",{cx:"18",cy:"7.5",r:"2.1"}),a.jsx("circle",{cx:"8.5",cy:"18",r:"2.1"}),a.jsx("circle",{cx:"17.5",cy:"17",r:"2.1"}),a.jsx("line",{x1:"7.7",y1:"7.4",x2:"8.2",y2:"15.9"}),a.jsx("line",{x1:"8",y1:"6.4",x2:"15.9",y2:"7.1"}),a.jsx("line",{x1:"10.6",y1:"17.7",x2:"15.4",y2:"17.2"}),a.jsx("line",{x1:"17.6",y1:"9.5",x2:"9.5",y2:"16.2"})]})}function Zle(){return a.jsx(gs,{children:a.jsx("path",{d:"M20.5 14.6A8.2 8.2 0 0 1 9.4 3.5a8.2 8.2 0 1 0 11.1 11.1z"})})}function Qle(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M12 3 21.5 8 12 13 2.5 8z"}),a.jsx("path",{d:"M2.5 12 12 17l9.5-5"}),a.jsx("path",{d:"M2.5 16 12 21l9.5-5"})]})}function Jle(){return a.jsxs(gs,{children:[a.jsx("line",{x1:"3.5",y1:"8",x2:"20.5",y2:"8"}),a.jsx("circle",{cx:"9",cy:"8",r:"2.2"}),a.jsx("line",{x1:"3.5",y1:"16",x2:"20.5",y2:"16"}),a.jsx("circle",{cx:"15",cy:"16",r:"2.2"})]})}function ece(){return a.jsxs(gs,{children:[a.jsx("path",{d:"M12 2.8a6 6 0 0 1 3.7 10.7c-.75.6-1.2 1.3-1.2 2.1v.9H9.5v-.9c0-.8-.45-1.5-1.2-2.1A6 6 0 0 1 12 2.8z"}),a.jsx("line",{x1:"9.8",y1:"19.4",x2:"14.2",y2:"19.4"}),a.jsx("line",{x1:"10.6",y1:"21.4",x2:"13.4",y2:"21.4"})]})}function tce(){return a.jsxs(gs,{children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M9.3 9.2a2.8 2.8 0 0 1 5.4 1c0 1.9-2.7 2.5-2.7 2.5"}),a.jsx("circle",{cx:"11.9",cy:"16.6",r:"0.7",fill:"currentColor",stroke:"none"})]})}const rce={tasks:Ule,roadmap:Wle,lab:ece,council:Gle,core:Kle,knowledge:Vle,taxonomy:Yle,brain:Xle,sleep:Zle,packs:Qle,settings:Jle,about:tce};function ice({page:r}){const e=rce[r];return e?a.jsx(e,{}):null}function xy({size:r=16}){return a.jsx("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}const nce=300;function sce(){const{t:r}=Fr(),{data:e,isLoading:i}=$C(),n=Gz(),s=Kz(),o=Vz(),h=Yz(),[l,u]=R.useState("idle"),[d,g]=R.useState(null),[p,m]=R.useState(null),[y,w]=R.useState(!1),[_,v]=R.useState(""),[x,C]=R.useState(null),k=R.useRef(null),T=R.useRef(0),N=R.useRef(!1),j=R.useCallback(()=>{N.current=!0,k.current&&(clearTimeout(k.current),k.current=null)},[]);R.useEffect(()=>()=>j(),[j]);const A=R.useCallback((G,q)=>{N.current||(k.current=setTimeout(async()=>{if(!N.current){if(T.current+=1,T.current>nce){u("error"),m(r("brain.auth.device.expired"));return}try{const U=await s.mutateAsync(G);if(N.current)return;switch(U.status){case"authorized":j(),u("idle"),g(null);break;case"slow_down":A(G,U.interval);break;case"pending":A(G,q);break;case"expired":j(),u("error"),m(r("brain.auth.device.expired"));break;case"denied":j(),u("error"),m(r("brain.auth.device.denied"));break;default:j(),u("error"),m(U.message??r("brain.auth.device.error"))}}catch(U){j(),u("error"),m(U instanceof Error?U.message:String(U))}}},Math.max(1,q)*1e3))},[s,j,r]),E=async()=>{m(null),u("starting"),N.current=!1,T.current=0;try{const G=await n.mutateAsync();g({userCode:G.userCode,verificationUri:G.verificationUri}),u("waiting"),A(G.sessionId,G.interval)}catch(G){u("error"),m(G instanceof Error?G.message:String(G))}},L=()=>{j(),u("idle"),g(null)},O=async()=>{C(null);try{await o.mutateAsync(_.trim()),v(""),w(!1)}catch(G){C(G instanceof Error?G.message:String(G))}};if(i)return a.jsx("p",{className:"settings-field-hint",children:r("common.loading")});if(e!=null&&e.connected)return a.jsxs("div",{className:"gh-login gh-login--connected",children:[a.jsxs("span",{className:"gh-login-badge",children:[a.jsx(xy,{size:15}),e.login?r("brain.auth.signedInAs").replace("{login}",e.login):r("brain.auth.signedIn")]}),a.jsx("button",{type:"button",className:"btn btn--ghost gh-login-logout",onClick:()=>h.mutate(),disabled:h.isPending,children:r("brain.auth.signOut")})]});const D=a.jsxs("div",{className:"gh-login-pat-form",children:[a.jsx("p",{className:"settings-field-hint",children:r("brain.auth.pat.hint")}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("input",{type:"password",className:"settings-text-input",autoComplete:"off",placeholder:r("brain.auth.pat.placeholder"),value:_,onChange:G=>v(G.target.value)}),a.jsx("button",{type:"button",className:"btn btn--primary",onClick:O,disabled:o.isPending||!_.trim(),children:o.isPending?r("brain.auth.pat.submitting"):r("brain.auth.pat.submit")})]}),x&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",x]})]});return(e==null?void 0:e.oauthConfigured)===!1?a.jsxs("div",{className:"gh-login gh-login--pat-primary",children:[a.jsx("p",{className:"gh-login-disclosure",children:r("brain.auth.oauthUnavailable")}),D]}):a.jsxs("div",{className:"gh-login",children:[a.jsx("p",{className:"gh-login-disclosure",children:r("brain.auth.scopeDisclosure")}),l==="waiting"&&d?a.jsxs("div",{className:"gh-login-device",children:[a.jsx("p",{className:"gh-login-device-hint",children:r("brain.auth.device.hint")}),a.jsx("div",{className:"gh-login-code",children:d.userCode}),a.jsx("a",{className:"btn btn--primary gh-login-open",href:d.verificationUri,target:"_blank",rel:"noreferrer",children:r("brain.auth.device.open")}),a.jsxs("p",{className:"gh-login-waiting",children:[a.jsx("span",{className:"gh-login-spinner","aria-hidden":"true"}),r("brain.auth.device.waiting")]}),a.jsx("button",{type:"button",className:"btn btn--ghost",onClick:L,children:r("common.cancel")})]}):a.jsxs("button",{type:"button",className:"btn btn--primary gh-login-start",onClick:E,disabled:l==="starting",children:[a.jsx(xy,{size:15}),r(l==="starting"?"brain.auth.device.starting":"brain.auth.continueWithGithub")]}),p&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",p]}),a.jsx("button",{type:"button",className:"gh-login-pat-toggle",onClick:()=>w(G=>!G),children:r(y?"brain.auth.pat.hide":"brain.auth.pat.recommend")}),y&&D]})}function ace(){if(typeof window>"u")return"";try{return new URLSearchParams(window.location.search).get("vault")??""}catch{return""}}const oce=[{labelKey:"nav.group.workspace",items:[{page:"tasks",labelKey:"nav.tasks"},{page:"roadmap",labelKey:"nav.roadmap",beta:!0},{page:"lab",labelKey:"nav.labpage",lab:!0},{page:"council",labelKey:"nav.council",lab:!0}]},{labelKey:"nav.group.memory",items:[{page:"core",labelKey:"nav.core"},{page:"knowledge",labelKey:"nav.knowledge"},{page:"taxonomy",labelKey:"nav.taxonomy"}]},{labelKey:"nav.group.brain",items:[{page:"brain",labelKey:"nav.brain"},{page:"sleep",labelKey:"nav.sleep"}]},{labelKey:"nav.group.control",items:[{page:"packs",labelKey:"nav.packs"},{page:"settings",labelKey:"nav.settings"}]}],KM="dreamcontext.dashboard.aboutSeen",VM="dreamcontext.dashboard.githubSyncSeen";function YM(r){if(typeof window>"u")return!1;try{return window.localStorage.getItem(r)==="1"}catch{return!1}}function XM(r){try{window.localStorage.setItem(r,"1")}catch{}}function lce({activePage:r,onNavigate:e,collapsed:i}){const{t:n}=Fr(),[s,o]=R.useState(()=>YM(KM)),[h,l]=R.useState(()=>YM(VM)),{data:u}=$C(),{data:d}=fR(),g=ace(),p=()=>{s||(o(!0),XM(KM)),e("about")},m=()=>{h||(l(!0),XM(VM)),e("settings","brain")},y=!s&&r!=="about",w=!h,_=!!(u!=null&&u.connected),v=!!(d!=null&&d.hasRemote),x=n(_?v?"brain.sidebar.synced":"brain.sidebar.setup":"brain.sidebar.connect");let C=0;return a.jsxs("nav",{className:`sidebar${i?" sidebar--collapsed":""}`,"aria-label":"Primary",children:[a.jsxs("div",{className:"sidebar-brand",title:"dreamcontext",children:[a.jsx(ab,{size:30,glow:!0}),a.jsxs("div",{className:"sidebar-brand-text",children:[a.jsxs("span",{className:"sidebar-brand-word",children:["dream",a.jsx("span",{children:"context"})]}),g&&a.jsx("span",{className:"sidebar-brand-vault",children:g})]})]}),oce.map(k=>a.jsxs("div",{className:"sidebar-group",children:[a.jsx("span",{className:"sidebar-group-label",children:n(k.labelKey)}),a.jsx("ul",{className:"sidebar-nav",children:k.items.map(({page:T,labelKey:N,lab:j,beta:A})=>{C+=1;const E=n(N),L=j?n("nav.lab"):A?n("nav.beta"):null,O=T==="about";return a.jsx("li",{className:`animate-stagger animate-stagger-${C}`,children:a.jsxs("button",{className:`sidebar-item ${r===T?"sidebar-item--active":""}${O&&y?" sidebar-item--nudge":""}`,onClick:O?p:()=>e(T),title:L?`${E} — ${L}`:E,"aria-current":r===T?"page":void 0,children:[a.jsx("span",{className:"sidebar-icon",children:a.jsx(ice,{page:T})}),a.jsx("span",{className:"sidebar-label",children:E}),j&&a.jsx("span",{className:"sidebar-lab-tag",children:n("nav.lab")}),A&&a.jsx("span",{className:"sidebar-lab-tag sidebar-beta-tag",children:n("nav.beta")})]})},T)})})]},k.labelKey)),a.jsx("div",{className:"sidebar-footer",children:_&&v?a.jsxs("div",{className:"sidebar-brain-sync sidebar-brain-sync--connected",children:[a.jsx(_R,{compact:!0}),a.jsxs("button",{className:"sidebar-item sidebar-item--synced",onClick:m,title:n("brain.sidebar.synced"),children:[a.jsx("span",{className:"sidebar-icon",children:a.jsx(xy,{size:14})}),a.jsx("span",{className:"sidebar-label",children:n("brain.sidebar.synced")})]})]}):a.jsxs("button",{className:`sidebar-item sidebar-item--brain-sync${w?" sidebar-item--nudge":""}`,onClick:m,title:x,children:[a.jsx("span",{className:"sidebar-icon",children:a.jsx(xy,{size:14})}),a.jsx("span",{className:"sidebar-label",children:x})]})})]})}function hF(r,e,i=12){const n=r.trim(),s=e.length?e.join(","):"";return Zt({queryKey:["recall",n,s,i],queryFn:()=>{const o=new URLSearchParams({q:n,top:String(i)});return s&&o.set("types",s),ze.get(`/recall?${o.toString()}`)},enabled:n.length>0,placeholderData:tz,staleTime:5e3})}async function uF(r,e,i=4){const n=r.trim();if(!n)return[];const s=new URLSearchParams({q:n,top:String(i)});return e.length&&s.set("types",e.join(",")),(await ze.get(`/recall?${s.toString()}`)).hits}async function dF(r,e){const i=r.trim();if(!i)return{query:"",mode:"haiku",skip:!1,tookMs:0,hits:[]};const n=new URLSearchParams({q:i});return e.length&&n.set("types",e.join(",")),ze.get(`/recall/haiku?${n.toString()}`)}const cce=new Set(["text","int","integer","numeric","boolean","timestamp","jsonb","json","serial","bigint","smallint","real","double","float","date","time","uuid","bytea","blob","varchar","char","array"]);function Px(r){const e=r.replace(/\(.*\)/,"").replace(/\[.*\]/,"").toLowerCase();return cce.has(e)}function hce(r){const{entities:e,relations:i}=uce(r),n=dce(r),s=new Set(e.map(g=>g.name.toLowerCase())),o=[...e,...n.filter(g=>!s.has(g.name.toLowerCase()))],h=fce(o),l=g=>`${g.from}.${g.fromField}->${g.to}.${g.toField}`,u=new Set(i.map(l)),d=[...i,...h.filter(g=>!u.has(l(g)))];return{entities:o,relations:d}}function uce(r){const e=[],i=[],n=r.split(`
467
467
  `);let s=null,o=[],h,l=!1,u=null;function d(){s&&o.length>0&&e.push({name:s,path:h,fields:o,storageType:"table",notes:[]}),s=null,h=void 0,o=[],l=!1,u=null}for(let g=0;g<n.length;g++){const p=n[g],m=p.trim();if(/^\s*--\s*\d+\.\s+\w+/.test(p)){const L=p.match(/\/\w+\/\{[^}]+\}/);L&&(h=L[0]);continue}const y=m.match(/^CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?[`"']?(\w+)[`"']?\s*\(/i);if(y){d(),s=y[1],o=[],l=!0;continue}if(!l||!s)continue;if(/^\s*\)\s*;/.test(p)){d();continue}if(/^\s*--/.test(p)){const O=p.replace(/^\s*--\s?/,"").trim();if(!O||/^[═─=\-*]{3,}/.test(O))continue;if(O.startsWith(".")){const G=O.match(/^\.(\w+(?:\.\w+)*)\s+(\w+(?:(?:\([^)]*\))|(?:\[[\w,\s]*\]))?)\s*(.*)/i);if(G&&Px(G[2])&&u){const q=G[1],U=G[2].toLowerCase(),F=(G[3]||"").match(/--\s*(.+)$/),W=F?F[1].trim():void 0;o.push({name:`${u}.${q}`,type:U,description:W,isNested:!0,parentField:u})}continue}const D=O.match(/^(\w+(?:\[\])?)\.(\w+(?:\.\w+)*)\s+(\w+(?:(?:\([^)]*\))|(?:\[[\w,\s]*\]))?)\s*(.*)/i);if(D&&Px(D[3])){const G=D[1].replace(/\[\]$/,""),q=D[2],U=D[3].toLowerCase(),F=(D[4]||"").match(/--\s*(.+)$/),W=F?F[1].trim():void 0;u=G,o.push({name:`${G}.${q}`,type:U,description:W,isNested:!0,parentField:G});continue}continue}if(!m)continue;const _=m.replace(/--.*$/,"").trim().replace(/,\s*$/,"").trim();if(/^(PRIMARY|FOREIGN|UNIQUE|CHECK|CONSTRAINT|INDEX)\b/i.test(_))continue;const v=_.match(/^[`"']?(\w+)[`"']?\s+(\w+(?:(?:\([^)]*\))|(?:\[[\w,\s]*\]))?)\s*(.*)/i);if(!v)continue;const x=v[1],C=v[2],k=v[3]||"";if(!Px(C))continue;const T=C.toLowerCase(),N=/PRIMARY\s+KEY/i.test(k),j=k.match(/REFERENCES\s+[`"']?(\w+)[`"']?\s*\(\s*[`"']?(\w+)[`"']?\s*\)/i);j&&i.push({from:s,fromField:x,to:j[1],toField:j[2],cardinality:"1:1"});const A=p.match(/--\s*(.+)$/),E=A?A[1].trim():void 0;(T==="jsonb"||T==="json")&&(u=x),o.push({name:x,type:T,isPrimary:N,description:E})}return d(),{entities:e,relations:i}}function dce(r){var o,h,l,u,d;const e=[];let i=null,n=!1;const s=r.split(`
468
- `);for(let g=0;g<s.length;g++){const m=s[g].match(/^--\s?(.*)/);if(!m)continue;const y=m[1].trim();if(/^={4,}$/.test(y)){i&&i.fields.length>0&&e.push(i),i=null,n=!1;continue}if(/^[A-Z ]+\(/.test(y)&&!y.match(/^[a-z_]/))continue;const w=y.match(/^([A-Z][A-Z _]+?):\s+(\S.+)$/);if(w&&!n){const _=w[1].trim();if(_===_.toUpperCase()&&_.length>1){i&&i.fields.length>0&&e.push(i);const v=w[2].trim();i={name:_,path:v,storageType:v.endsWith(".json")?"json":"file",notes:[],fields:[]},n=!1;continue}}if(i){const _=y.match(/^(?:Created|Managed)\s+by:\s+(.+)/i);if(_){i.managedBy=_[1].trim();continue}}if(y.includes("Fields in YAML frontmatter")||y.startsWith("Schema ")){n=!0;continue}if(y==="["||y==="{"){n=!0;continue}if(!(y==="]"||y==="}"||y==="..."||y==="},")){if(i&&n){const _=y.match(/^([a-z_]\w*):\s+(.+?)(?:\s{2,}--\s+(.+))?$/);if(_){const{type:x,enumValues:C}=ZM(_[2].trim(),(o=_[3])==null?void 0:o.trim());i.fields.push({name:_[1],type:x,enumValues:C,description:(h=_[3])==null?void 0:h.trim(),isPrimary:_[1]==="id"});continue}const v=y.match(/^"([a-z_]\w*)":\s+(.+?)(?:,)?(?:\s{2,}--\s+(.+))?$/);if(v){const{type:x,enumValues:C}=ZM(v[2].trim(),(l=v[3])==null?void 0:l.trim());i.fields.push({name:v[1],type:x,enumValues:C,description:(u=v[3])==null?void 0:u.trim()});continue}}if(i&&y.startsWith("Body ")&&(i.notes.push(y),y.includes("sections")&&g+1<s.length)){const _=(d=s[g+1])==null?void 0:d.match(/^--\s?(.*)/);_&&/^\s*(Why|[A-Z])/.test(_[1])&&(i.notes.push(_[1].trim()),g++)}}}return i&&i.fields.length>0&&e.push(i),e}function ZM(r,e){return r.includes("|")?{type:"enum",enumValues:r.split("|").map(n=>n.trim().replace(/^"|"$/g,""))}:r==="[]"?{type:e!=null&&e.includes("string")?"string[]":"array"}:r.startsWith("[")?{type:"array"}:r==="true"||r==="false"?{type:"boolean"}:r==="null"?{type:"nullable"}:/^\d+$/.test(r)?{type:"number"}:/\d{4}-\d{2}-\d{2}/.test(r.replace(/"/g,""))?{type:"date"}:{type:"string"}}function fce(r){const e=[];for(const i of r)for(const n of i.fields)if(!n.isNested){if(n.description){const s=n.description.match(/(task|feature|knowledge)\s+IDs?/i);if(s){const o=s[1].toLowerCase(),h=r.find(l=>l.name.toLowerCase().includes(o));if(h&&h.name!==i.name){const l=h.fields.find(u=>u.isPrimary);e.push({from:i.name,fromField:n.name,to:h.name,toField:l?l.name:"_id",cardinality:n.type.includes("array")||n.type==="array"?"1:N":"1:1"})}}}if(n.name==="parent_task"||n.name==="parent_id"){const s=i.fields.find(o=>o.isPrimary);e.push({from:i.name,fromField:n.name,to:i.name,toField:s?s.name:"_id",cardinality:"1:1"})}}return e}function oC(r){return r.toLowerCase().replace(/\s+/g,"-")}function QM(r){return r==="enum"?"enum":r==="array"||r.endsWith("[]")||r.startsWith("array")?"array":r==="boolean"?"boolean":r==="nullable"?"nullable":r==="date"||r==="timestamp"?"date":r==="int"||r==="integer"||r==="numeric"||r==="serial"||r==="bigint"||r==="smallint"||r==="real"||r==="float"||r==="double"?"number":r==="jsonb"||r==="json"?"json":"string"}function pce(r,e,i){return r.isPrimary?{icon:"PK",cls:"entity-field-icon--key"}:e.some(s=>s.from===i&&s.fromField===r.name)?{icon:"FK",cls:"entity-field-icon--ref"}:null}function gce(r,e,i,n){if(n){const _=r.right-i.left,v=r.top+r.height*.35-i.top,x=36,C=28;return{d:`M ${_},${v} C ${_+x},${v-C*.3} ${_+x},${v-C*1.3} ${_},${v-C}`,labelX:_+x+4,labelY:v-C*.5}}const s=r.left+r.width/2-i.left,o=e.left+e.width/2-i.left,h=r.top+r.height/2-i.top,l=e.top+e.height/2-i.top,u=Math.abs(s-o),d=Math.abs(h-l);let g,p,m,y;if(u>d){s<o?(g=r.right-i.left,m=e.left-i.left):(g=r.left-i.left,m=e.right-i.left),p=h,y=l;const _=(m-g)*.4;return{d:`M ${g},${p} C ${g+_},${p} ${m-_},${y} ${m},${y}`,labelX:(g+m)/2,labelY:(p+y)/2-10}}g=s,m=o,h<l?(p=r.bottom-i.top,y=e.top-i.top):(p=r.top-i.top,y=e.bottom-i.top);const w=(y-p)*.4;return{d:`M ${g},${p} C ${g},${p+w} ${m},${y-w} ${m},${y}`,labelX:(g+m)/2,labelY:(p+y)/2-10}}function mce({entity:r,relations:e}){const[i,n]=R.useState(new Set),s=r.storageType==="json"?"{ }":r.storageType==="table"?"SQL":"☰",o=r.fields.filter(u=>!u.isNested),h=R.useMemo(()=>{const u=new Map;for(const d of r.fields)if(d.isNested&&d.parentField){const g=u.get(d.parentField)||[];g.push(d),u.set(d.parentField,g)}return u},[r.fields]),l=u=>{n(d=>{const g=new Set(d);return g.has(u)?g.delete(u):g.add(u),g})};return a.jsxs("div",{className:"entity-card","data-entity":oC(r.name),children:[a.jsxs("div",{className:"entity-card-header",children:[a.jsxs("div",{className:"entity-card-title-group",children:[a.jsx("span",{className:"entity-card-category-icon",children:s}),a.jsx("span",{className:"entity-card-name",children:r.name})]}),a.jsx("span",{className:"entity-card-badge","data-storage":r.storageType,children:r.storageType})]}),r.path&&a.jsx("div",{className:"entity-card-path",title:r.path,children:r.path}),r.managedBy&&a.jsx("div",{className:"entity-card-managed",children:r.managedBy}),a.jsx("div",{className:"entity-fields",children:o.map(u=>{const d=pce(u,e,r.name),g=QM(u.type),p=h.get(u.name),m=i.has(u.name);return a.jsxs(R.Fragment,{children:[a.jsxs("div",{className:`entity-field${p?" entity-field--expandable":""}`,onClick:p?()=>l(u.name):void 0,children:[a.jsx("span",{className:`entity-field-icon ${(d==null?void 0:d.cls)??""}`,children:(d==null?void 0:d.icon)??""}),a.jsx("span",{className:"entity-field-name",children:u.name}),u.type==="enum"&&u.enumValues?a.jsx("span",{className:"entity-field-enum-group",children:u.enumValues.map(y=>a.jsx("span",{className:"entity-field-enum-pill",children:y},y))}):a.jsx("span",{className:"entity-field-type","data-type":g,children:u.type}),p&&a.jsxs("span",{className:"entity-field-toggle",children:[a.jsx("span",{className:`entity-field-toggle-arrow${m?" entity-field-toggle-arrow--open":""}`,children:"▶"}),a.jsx("span",{className:"entity-field-toggle-count",children:p.length})]}),!p&&u.description&&a.jsx("span",{className:"entity-field-desc",title:u.description,children:u.description})]}),p&&m&&p.map(y=>{var v;const w=QM(y.type),_=y.name.slice((((v=y.parentField)==null?void 0:v.length)??0)+1);return a.jsxs("div",{className:"entity-field entity-field--nested",children:[a.jsx("span",{className:"entity-field-icon"}),a.jsxs("span",{className:"entity-field-name entity-field-name--nested",children:[".",_]}),a.jsx("span",{className:"entity-field-type","data-type":w,children:y.type}),y.description&&a.jsx("span",{className:"entity-field-desc",title:y.description,children:y.description})]},y.name)})]},u.name)})}),r.notes.length>0&&a.jsx("div",{className:"entity-card-notes",children:r.notes.map((u,d)=>a.jsx("div",{className:"entity-card-note",children:u},d))})]})}function yce({relations:r,entities:e}){return r.length===0?null:a.jsxs("div",{className:"sql-preview-legend",children:[a.jsx("div",{className:"sql-preview-legend-title",children:"Relationships"}),a.jsx("div",{className:"sql-preview-legend-items",children:r.map((i,n)=>{var l,u;const s=((l=e.find(d=>d.name===i.from))==null?void 0:l.name)??i.from,o=((u=e.find(d=>d.name===i.to))==null?void 0:u.name)??i.to,h=i.from===i.to;return a.jsxs("div",{className:"sql-preview-legend-item",children:[a.jsx("span",{className:"sql-preview-legend-line"}),a.jsx("span",{children:h?`${s}.${i.fromField} ↻ self`:`${s}.${i.fromField} → ${o}.${i.toField}`}),a.jsx("span",{className:"sql-preview-legend-cardinality",children:i.cardinality})]},n)})})]})}function xk({content:r}){const e=R.useRef(null),[i,n]=R.useState([]),[s,o]=R.useState({width:0,height:0}),h=R.useMemo(()=>hce(r),[r]),l=R.useCallback(()=>{const u=e.current;if(!u||h.relations.length===0){n([]);return}const d=u.getBoundingClientRect();o({width:u.scrollWidth,height:u.scrollHeight});const g=[];for(const p of h.relations){const m=u.querySelector(`[data-entity="${oC(p.from)}"]`),y=u.querySelector(`[data-entity="${oC(p.to)}"]`);if(!m||!y)continue;const w=m.getBoundingClientRect(),_=y.getBoundingClientRect(),{d:v,labelX:x,labelY:C}=gce(w,_,d,p.from===p.to);g.push({d:v,labelX:x,labelY:C,label:p.cardinality})}n(g)},[h]);if(R.useEffect(()=>{const u=requestAnimationFrame(l),d=new ResizeObserver(l);return e.current&&d.observe(e.current),()=>{cancelAnimationFrame(u),d.disconnect()}},[l]),h.entities.length===0){const u=r.trim().length>0;return a.jsx("div",{className:"sql-preview",children:u?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sql-preview-empty sql-preview-empty--hint",children:"No table definitions to diagram — showing the raw SQL."}),a.jsx("pre",{className:"sql-preview-raw",children:a.jsx("code",{children:r.trim()})})]}):a.jsx("div",{className:"sql-preview-empty",children:"No schema entities found in this file."})})}return a.jsxs("div",{className:"sql-preview",ref:e,children:[a.jsxs("svg",{className:"sql-preview-svg",width:s.width||"100%",height:s.height||"100%",viewBox:s.width?`0 0 ${s.width} ${s.height}`:void 0,children:[a.jsx("defs",{children:a.jsx("marker",{id:"rel-arrowhead",viewBox:"0 0 10 7",refX:"9",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:a.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"sql-preview-arrowhead"})})}),i.map((u,d)=>a.jsxs("g",{children:[a.jsx("path",{d:u.d,className:"sql-preview-line",markerEnd:"url(#rel-arrowhead)"}),a.jsx("rect",{className:"sql-preview-line-label-bg",x:u.labelX-12,y:u.labelY-7,width:24,height:14}),a.jsx("text",{className:"sql-preview-line-label",x:u.labelX,y:u.labelY+4,textAnchor:"middle",children:u.label})]},d))]}),a.jsx("div",{className:"sql-preview-grid",children:h.entities.map(u=>a.jsx(mce,{entity:u,relations:h.relations},u.name))}),a.jsx(yce,{relations:h.relations,entities:h.entities})]})}var zx={exports:{}},JM;function bce(){return JM||(JM=1,(function(r){var e=(function(){var i=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",o={};function h(u,d){if(!o[u]){o[u]={};for(var g=0;g<u.length;g++)o[u][u.charAt(g)]=g}return o[u][d]}var l={compressToBase64:function(u){if(u==null)return"";var d=l._compress(u,6,function(g){return n.charAt(g)});switch(d.length%4){default:case 0:return d;case 1:return d+"===";case 2:return d+"==";case 3:return d+"="}},decompressFromBase64:function(u){return u==null?"":u==""?null:l._decompress(u.length,32,function(d){return h(n,u.charAt(d))})},compressToUTF16:function(u){return u==null?"":l._compress(u,15,function(d){return i(d+32)})+" "},decompressFromUTF16:function(u){return u==null?"":u==""?null:l._decompress(u.length,16384,function(d){return u.charCodeAt(d)-32})},compressToUint8Array:function(u){for(var d=l.compress(u),g=new Uint8Array(d.length*2),p=0,m=d.length;p<m;p++){var y=d.charCodeAt(p);g[p*2]=y>>>8,g[p*2+1]=y%256}return g},decompressFromUint8Array:function(u){if(u==null)return l.decompress(u);for(var d=new Array(u.length/2),g=0,p=d.length;g<p;g++)d[g]=u[g*2]*256+u[g*2+1];var m=[];return d.forEach(function(y){m.push(i(y))}),l.decompress(m.join(""))},compressToEncodedURIComponent:function(u){return u==null?"":l._compress(u,6,function(d){return s.charAt(d)})},decompressFromEncodedURIComponent:function(u){return u==null?"":u==""?null:(u=u.replace(/ /g,"+"),l._decompress(u.length,32,function(d){return h(s,u.charAt(d))}))},compress:function(u){return l._compress(u,16,function(d){return i(d)})},_compress:function(u,d,g){if(u==null)return"";var p,m,y={},w={},_="",v="",x="",C=2,k=3,T=2,N=[],j=0,A=0,E;for(E=0;E<u.length;E+=1)if(_=u.charAt(E),Object.prototype.hasOwnProperty.call(y,_)||(y[_]=k++,w[_]=!0),v=x+_,Object.prototype.hasOwnProperty.call(y,v))x=v;else{if(Object.prototype.hasOwnProperty.call(w,x)){if(x.charCodeAt(0)<256){for(p=0;p<T;p++)j=j<<1,A==d-1?(A=0,N.push(g(j)),j=0):A++;for(m=x.charCodeAt(0),p=0;p<8;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}else{for(m=1,p=0;p<T;p++)j=j<<1|m,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=0;for(m=x.charCodeAt(0),p=0;p<16;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}C--,C==0&&(C=Math.pow(2,T),T++),delete w[x]}else for(m=y[x],p=0;p<T;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1;C--,C==0&&(C=Math.pow(2,T),T++),y[v]=k++,x=String(_)}if(x!==""){if(Object.prototype.hasOwnProperty.call(w,x)){if(x.charCodeAt(0)<256){for(p=0;p<T;p++)j=j<<1,A==d-1?(A=0,N.push(g(j)),j=0):A++;for(m=x.charCodeAt(0),p=0;p<8;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}else{for(m=1,p=0;p<T;p++)j=j<<1|m,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=0;for(m=x.charCodeAt(0),p=0;p<16;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}C--,C==0&&(C=Math.pow(2,T),T++),delete w[x]}else for(m=y[x],p=0;p<T;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1;C--,C==0&&(C=Math.pow(2,T),T++)}for(m=2,p=0;p<T;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1;for(;;)if(j=j<<1,A==d-1){N.push(g(j));break}else A++;return N.join("")},decompress:function(u){return u==null?"":u==""?null:l._decompress(u.length,32768,function(d){return u.charCodeAt(d)})},_decompress:function(u,d,g){var p=[],m=4,y=4,w=3,_="",v=[],x,C,k,T,N,j,A,E={val:g(0),position:d,index:1};for(x=0;x<3;x+=1)p[x]=x;for(k=0,N=Math.pow(2,2),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;switch(k){case 0:for(k=0,N=Math.pow(2,8),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;A=i(k);break;case 1:for(k=0,N=Math.pow(2,16),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;A=i(k);break;case 2:return""}for(p[3]=A,C=A,v.push(A);;){if(E.index>u)return"";for(k=0,N=Math.pow(2,w),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;switch(A=k){case 0:for(k=0,N=Math.pow(2,8),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;p[y++]=i(k),A=y-1,m--;break;case 1:for(k=0,N=Math.pow(2,16),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;p[y++]=i(k),A=y-1,m--;break;case 2:return v.join("")}if(m==0&&(m=Math.pow(2,w),w++),p[A])_=p[A];else if(A===y)_=C+C.charAt(0);else return null;v.push(_),p[y++]=C+_.charAt(0),m--,C=_,m==0&&(m=Math.pow(2,w),w++)}}};return l})();r!=null?r.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(zx)),zx.exports}var vce=bce();const xce=/##\s*Drawing\s*```(compressed-json|json)\s*([\s\S]*?)```/;function _ce(r){const e=r.match(xce);if(!e)return null;const[,i,n]=e;let s;if(i==="compressed-json"){const o=vce.decompressFromBase64(n.replace(/\s+/g,""));if(!o)return null;s=o}else s=n;try{const o=JSON.parse(s);return Array.isArray(o.elements)?o:null}catch{return null}}function Lf(r){return r.endsWith(".excalidraw")}function Cce(){return Zt({queryKey:["knowledge"],queryFn:()=>ze.get("/knowledge"),select:r=>r.entries})}function wce(r){return Zt({queryKey:["knowledge",r],queryFn:()=>ze.get(`/knowledge/${r}`),select:e=>e.entry,enabled:!!r,staleTime:1/0,refetchInterval:!1})}function kce(r,e){return Zt({queryKey:["knowledge-assets",r],queryFn:()=>ze.get(`/knowledge-assets/${r}`),select:i=>i.files,enabled:e&&!!r,staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1})}function Sce(r,e,i){const n=rr();R.useEffect(()=>{!r||e===void 0||i===void 0||e<=i||(n.invalidateQueries({queryKey:["knowledge",r]}),n.invalidateQueries({queryKey:["knowledge-assets",r]}))},[r,e,i,n])}function Tce(){const r=rr();return sr({mutationFn:({slug:e,pinned:i})=>ze.patch(`/knowledge/${e}`,{pinned:i}),onSuccess:()=>{r.invalidateQueries({queryKey:["knowledge"]})}})}function fF(r,e){const i=`chunk-reloaded:${r}`;return R.lazy(async()=>{try{const n=await e();return window.sessionStorage.removeItem(i),n}catch(n){if(!(window.sessionStorage.getItem(i)==="1"))return window.sessionStorage.setItem(i,"1"),window.location.reload(),new Promise(()=>{});throw window.sessionStorage.removeItem(i),n}})}const Ece=fF("ExcalidrawCanvas",()=>Xt(()=>import("./percentages-BXMCSKIN-CLq2oyzj.js").then(r=>r.E),__vite__mapDeps([53,54,55]))),eL=()=>a.jsxs("div",{className:"excalidraw-loading","aria-live":"polite",children:[a.jsx("span",{className:"excalidraw-spinner","aria-hidden":"true"}),a.jsx("span",{className:"excalidraw-loading-label",children:"Loading diagram…"})]});function pF({content:r,slug:e}){const{resolved:i}=Uf(),n=R.useMemo(()=>_ce(r),[r]),s=R.useMemo(()=>r.includes("## Embedded Files"),[r]),o=kce(e??"",!!e&&s),h=o.data,l=!!e&&s&&o.isLoading,u=R.useMemo(()=>{const d={...(n==null?void 0:n.files)??{}};if(h)for(const[g,p]of Object.entries(h))d[g]={id:g,mimeType:p.mimeType,dataURL:p.dataURL,created:0};return d},[n,h]);return n?a.jsx("div",{className:"excalidraw-preview","data-theme":i,children:l?a.jsx(eL,{}):a.jsx(R.Suspense,{fallback:a.jsx(eL,{}),children:a.jsx(Ece,{elements:n.elements,files:u,appState:n.appState,theme:i==="dark"?"dark":"light"},e??"board")})}):a.jsx("div",{className:"excalidraw-error",children:"Could not read the Excalidraw drawing in this file."})}const Nce=/```sql\s*\n([\s\S]*?)```/gi;function gF(r){return r.replace(/^.*?knowledge\//,"").replace(/\.md$/,"")}function Ace(r,e){if(!r.startsWith("data-structures/"))return null;const i=[...e.matchAll(Nce)].map(n=>n[1]);return i.length>0?i.join(`
468
+ `);for(let g=0;g<s.length;g++){const m=s[g].match(/^--\s?(.*)/);if(!m)continue;const y=m[1].trim();if(/^={4,}$/.test(y)){i&&i.fields.length>0&&e.push(i),i=null,n=!1;continue}if(/^[A-Z ]+\(/.test(y)&&!y.match(/^[a-z_]/))continue;const w=y.match(/^([A-Z][A-Z _]+?):\s+(\S.+)$/);if(w&&!n){const _=w[1].trim();if(_===_.toUpperCase()&&_.length>1){i&&i.fields.length>0&&e.push(i);const v=w[2].trim();i={name:_,path:v,storageType:v.endsWith(".json")?"json":"file",notes:[],fields:[]},n=!1;continue}}if(i){const _=y.match(/^(?:Created|Managed)\s+by:\s+(.+)/i);if(_){i.managedBy=_[1].trim();continue}}if(y.includes("Fields in YAML frontmatter")||y.startsWith("Schema ")){n=!0;continue}if(y==="["||y==="{"){n=!0;continue}if(!(y==="]"||y==="}"||y==="..."||y==="},")){if(i&&n){const _=y.match(/^([a-z_]\w*):\s+(.+?)(?:\s{2,}--\s+(.+))?$/);if(_){const{type:x,enumValues:C}=ZM(_[2].trim(),(o=_[3])==null?void 0:o.trim());i.fields.push({name:_[1],type:x,enumValues:C,description:(h=_[3])==null?void 0:h.trim(),isPrimary:_[1]==="id"});continue}const v=y.match(/^"([a-z_]\w*)":\s+(.+?)(?:,)?(?:\s{2,}--\s+(.+))?$/);if(v){const{type:x,enumValues:C}=ZM(v[2].trim(),(l=v[3])==null?void 0:l.trim());i.fields.push({name:v[1],type:x,enumValues:C,description:(u=v[3])==null?void 0:u.trim()});continue}}if(i&&y.startsWith("Body ")&&(i.notes.push(y),y.includes("sections")&&g+1<s.length)){const _=(d=s[g+1])==null?void 0:d.match(/^--\s?(.*)/);_&&/^\s*(Why|[A-Z])/.test(_[1])&&(i.notes.push(_[1].trim()),g++)}}}return i&&i.fields.length>0&&e.push(i),e}function ZM(r,e){return r.includes("|")?{type:"enum",enumValues:r.split("|").map(n=>n.trim().replace(/^"|"$/g,""))}:r==="[]"?{type:e!=null&&e.includes("string")?"string[]":"array"}:r.startsWith("[")?{type:"array"}:r==="true"||r==="false"?{type:"boolean"}:r==="null"?{type:"nullable"}:/^\d+$/.test(r)?{type:"number"}:/\d{4}-\d{2}-\d{2}/.test(r.replace(/"/g,""))?{type:"date"}:{type:"string"}}function fce(r){const e=[];for(const i of r)for(const n of i.fields)if(!n.isNested){if(n.description){const s=n.description.match(/(task|feature|knowledge)\s+IDs?/i);if(s){const o=s[1].toLowerCase(),h=r.find(l=>l.name.toLowerCase().includes(o));if(h&&h.name!==i.name){const l=h.fields.find(u=>u.isPrimary);e.push({from:i.name,fromField:n.name,to:h.name,toField:l?l.name:"_id",cardinality:n.type.includes("array")||n.type==="array"?"1:N":"1:1"})}}}if(n.name==="parent_task"||n.name==="parent_id"){const s=i.fields.find(o=>o.isPrimary);e.push({from:i.name,fromField:n.name,to:i.name,toField:s?s.name:"_id",cardinality:"1:1"})}}return e}function oC(r){return r.toLowerCase().replace(/\s+/g,"-")}function QM(r){return r==="enum"?"enum":r==="array"||r.endsWith("[]")||r.startsWith("array")?"array":r==="boolean"?"boolean":r==="nullable"?"nullable":r==="date"||r==="timestamp"?"date":r==="int"||r==="integer"||r==="numeric"||r==="serial"||r==="bigint"||r==="smallint"||r==="real"||r==="float"||r==="double"?"number":r==="jsonb"||r==="json"?"json":"string"}function pce(r,e,i){return r.isPrimary?{icon:"PK",cls:"entity-field-icon--key"}:e.some(s=>s.from===i&&s.fromField===r.name)?{icon:"FK",cls:"entity-field-icon--ref"}:null}function gce(r,e,i,n){if(n){const _=r.right-i.left,v=r.top+r.height*.35-i.top,x=36,C=28;return{d:`M ${_},${v} C ${_+x},${v-C*.3} ${_+x},${v-C*1.3} ${_},${v-C}`,labelX:_+x+4,labelY:v-C*.5}}const s=r.left+r.width/2-i.left,o=e.left+e.width/2-i.left,h=r.top+r.height/2-i.top,l=e.top+e.height/2-i.top,u=Math.abs(s-o),d=Math.abs(h-l);let g,p,m,y;if(u>d){s<o?(g=r.right-i.left,m=e.left-i.left):(g=r.left-i.left,m=e.right-i.left),p=h,y=l;const _=(m-g)*.4;return{d:`M ${g},${p} C ${g+_},${p} ${m-_},${y} ${m},${y}`,labelX:(g+m)/2,labelY:(p+y)/2-10}}g=s,m=o,h<l?(p=r.bottom-i.top,y=e.top-i.top):(p=r.top-i.top,y=e.bottom-i.top);const w=(y-p)*.4;return{d:`M ${g},${p} C ${g},${p+w} ${m},${y-w} ${m},${y}`,labelX:(g+m)/2,labelY:(p+y)/2-10}}function mce({entity:r,relations:e}){const[i,n]=R.useState(new Set),s=r.storageType==="json"?"{ }":r.storageType==="table"?"SQL":"☰",o=r.fields.filter(u=>!u.isNested),h=R.useMemo(()=>{const u=new Map;for(const d of r.fields)if(d.isNested&&d.parentField){const g=u.get(d.parentField)||[];g.push(d),u.set(d.parentField,g)}return u},[r.fields]),l=u=>{n(d=>{const g=new Set(d);return g.has(u)?g.delete(u):g.add(u),g})};return a.jsxs("div",{className:"entity-card","data-entity":oC(r.name),children:[a.jsxs("div",{className:"entity-card-header",children:[a.jsxs("div",{className:"entity-card-title-group",children:[a.jsx("span",{className:"entity-card-category-icon",children:s}),a.jsx("span",{className:"entity-card-name",children:r.name})]}),a.jsx("span",{className:"entity-card-badge","data-storage":r.storageType,children:r.storageType})]}),r.path&&a.jsx("div",{className:"entity-card-path",title:r.path,children:r.path}),r.managedBy&&a.jsx("div",{className:"entity-card-managed",children:r.managedBy}),a.jsx("div",{className:"entity-fields",children:o.map(u=>{const d=pce(u,e,r.name),g=QM(u.type),p=h.get(u.name),m=i.has(u.name);return a.jsxs(R.Fragment,{children:[a.jsxs("div",{className:`entity-field${p?" entity-field--expandable":""}`,onClick:p?()=>l(u.name):void 0,children:[a.jsx("span",{className:`entity-field-icon ${(d==null?void 0:d.cls)??""}`,children:(d==null?void 0:d.icon)??""}),a.jsx("span",{className:"entity-field-name",children:u.name}),u.type==="enum"&&u.enumValues?a.jsx("span",{className:"entity-field-enum-group",children:u.enumValues.map(y=>a.jsx("span",{className:"entity-field-enum-pill",children:y},y))}):a.jsx("span",{className:"entity-field-type","data-type":g,children:u.type}),p&&a.jsxs("span",{className:"entity-field-toggle",children:[a.jsx("span",{className:`entity-field-toggle-arrow${m?" entity-field-toggle-arrow--open":""}`,children:"▶"}),a.jsx("span",{className:"entity-field-toggle-count",children:p.length})]}),!p&&u.description&&a.jsx("span",{className:"entity-field-desc",title:u.description,children:u.description})]}),p&&m&&p.map(y=>{var v;const w=QM(y.type),_=y.name.slice((((v=y.parentField)==null?void 0:v.length)??0)+1);return a.jsxs("div",{className:"entity-field entity-field--nested",children:[a.jsx("span",{className:"entity-field-icon"}),a.jsxs("span",{className:"entity-field-name entity-field-name--nested",children:[".",_]}),a.jsx("span",{className:"entity-field-type","data-type":w,children:y.type}),y.description&&a.jsx("span",{className:"entity-field-desc",title:y.description,children:y.description})]},y.name)})]},u.name)})}),r.notes.length>0&&a.jsx("div",{className:"entity-card-notes",children:r.notes.map((u,d)=>a.jsx("div",{className:"entity-card-note",children:u},d))})]})}function yce({relations:r,entities:e}){return r.length===0?null:a.jsxs("div",{className:"sql-preview-legend",children:[a.jsx("div",{className:"sql-preview-legend-title",children:"Relationships"}),a.jsx("div",{className:"sql-preview-legend-items",children:r.map((i,n)=>{var l,u;const s=((l=e.find(d=>d.name===i.from))==null?void 0:l.name)??i.from,o=((u=e.find(d=>d.name===i.to))==null?void 0:u.name)??i.to,h=i.from===i.to;return a.jsxs("div",{className:"sql-preview-legend-item",children:[a.jsx("span",{className:"sql-preview-legend-line"}),a.jsx("span",{children:h?`${s}.${i.fromField} ↻ self`:`${s}.${i.fromField} → ${o}.${i.toField}`}),a.jsx("span",{className:"sql-preview-legend-cardinality",children:i.cardinality})]},n)})})]})}function xk({content:r}){const e=R.useRef(null),[i,n]=R.useState([]),[s,o]=R.useState({width:0,height:0}),h=R.useMemo(()=>hce(r),[r]),l=R.useCallback(()=>{const u=e.current;if(!u||h.relations.length===0){n([]);return}const d=u.getBoundingClientRect();o({width:u.scrollWidth,height:u.scrollHeight});const g=[];for(const p of h.relations){const m=u.querySelector(`[data-entity="${oC(p.from)}"]`),y=u.querySelector(`[data-entity="${oC(p.to)}"]`);if(!m||!y)continue;const w=m.getBoundingClientRect(),_=y.getBoundingClientRect(),{d:v,labelX:x,labelY:C}=gce(w,_,d,p.from===p.to);g.push({d:v,labelX:x,labelY:C,label:p.cardinality})}n(g)},[h]);if(R.useEffect(()=>{const u=requestAnimationFrame(l),d=new ResizeObserver(l);return e.current&&d.observe(e.current),()=>{cancelAnimationFrame(u),d.disconnect()}},[l]),h.entities.length===0){const u=r.trim().length>0;return a.jsx("div",{className:"sql-preview",children:u?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sql-preview-empty sql-preview-empty--hint",children:"No table definitions to diagram — showing the raw SQL."}),a.jsx("pre",{className:"sql-preview-raw",children:a.jsx("code",{children:r.trim()})})]}):a.jsx("div",{className:"sql-preview-empty",children:"No schema entities found in this file."})})}return a.jsxs("div",{className:"sql-preview",ref:e,children:[a.jsxs("svg",{className:"sql-preview-svg",width:s.width||"100%",height:s.height||"100%",viewBox:s.width?`0 0 ${s.width} ${s.height}`:void 0,children:[a.jsx("defs",{children:a.jsx("marker",{id:"rel-arrowhead",viewBox:"0 0 10 7",refX:"9",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:a.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"sql-preview-arrowhead"})})}),i.map((u,d)=>a.jsxs("g",{children:[a.jsx("path",{d:u.d,className:"sql-preview-line",markerEnd:"url(#rel-arrowhead)"}),a.jsx("rect",{className:"sql-preview-line-label-bg",x:u.labelX-12,y:u.labelY-7,width:24,height:14}),a.jsx("text",{className:"sql-preview-line-label",x:u.labelX,y:u.labelY+4,textAnchor:"middle",children:u.label})]},d))]}),a.jsx("div",{className:"sql-preview-grid",children:h.entities.map(u=>a.jsx(mce,{entity:u,relations:h.relations},u.name))}),a.jsx(yce,{relations:h.relations,entities:h.entities})]})}var zx={exports:{}},JM;function bce(){return JM||(JM=1,(function(r){var e=(function(){var i=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",o={};function h(u,d){if(!o[u]){o[u]={};for(var g=0;g<u.length;g++)o[u][u.charAt(g)]=g}return o[u][d]}var l={compressToBase64:function(u){if(u==null)return"";var d=l._compress(u,6,function(g){return n.charAt(g)});switch(d.length%4){default:case 0:return d;case 1:return d+"===";case 2:return d+"==";case 3:return d+"="}},decompressFromBase64:function(u){return u==null?"":u==""?null:l._decompress(u.length,32,function(d){return h(n,u.charAt(d))})},compressToUTF16:function(u){return u==null?"":l._compress(u,15,function(d){return i(d+32)})+" "},decompressFromUTF16:function(u){return u==null?"":u==""?null:l._decompress(u.length,16384,function(d){return u.charCodeAt(d)-32})},compressToUint8Array:function(u){for(var d=l.compress(u),g=new Uint8Array(d.length*2),p=0,m=d.length;p<m;p++){var y=d.charCodeAt(p);g[p*2]=y>>>8,g[p*2+1]=y%256}return g},decompressFromUint8Array:function(u){if(u==null)return l.decompress(u);for(var d=new Array(u.length/2),g=0,p=d.length;g<p;g++)d[g]=u[g*2]*256+u[g*2+1];var m=[];return d.forEach(function(y){m.push(i(y))}),l.decompress(m.join(""))},compressToEncodedURIComponent:function(u){return u==null?"":l._compress(u,6,function(d){return s.charAt(d)})},decompressFromEncodedURIComponent:function(u){return u==null?"":u==""?null:(u=u.replace(/ /g,"+"),l._decompress(u.length,32,function(d){return h(s,u.charAt(d))}))},compress:function(u){return l._compress(u,16,function(d){return i(d)})},_compress:function(u,d,g){if(u==null)return"";var p,m,y={},w={},_="",v="",x="",C=2,k=3,T=2,N=[],j=0,A=0,E;for(E=0;E<u.length;E+=1)if(_=u.charAt(E),Object.prototype.hasOwnProperty.call(y,_)||(y[_]=k++,w[_]=!0),v=x+_,Object.prototype.hasOwnProperty.call(y,v))x=v;else{if(Object.prototype.hasOwnProperty.call(w,x)){if(x.charCodeAt(0)<256){for(p=0;p<T;p++)j=j<<1,A==d-1?(A=0,N.push(g(j)),j=0):A++;for(m=x.charCodeAt(0),p=0;p<8;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}else{for(m=1,p=0;p<T;p++)j=j<<1|m,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=0;for(m=x.charCodeAt(0),p=0;p<16;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}C--,C==0&&(C=Math.pow(2,T),T++),delete w[x]}else for(m=y[x],p=0;p<T;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1;C--,C==0&&(C=Math.pow(2,T),T++),y[v]=k++,x=String(_)}if(x!==""){if(Object.prototype.hasOwnProperty.call(w,x)){if(x.charCodeAt(0)<256){for(p=0;p<T;p++)j=j<<1,A==d-1?(A=0,N.push(g(j)),j=0):A++;for(m=x.charCodeAt(0),p=0;p<8;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}else{for(m=1,p=0;p<T;p++)j=j<<1|m,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=0;for(m=x.charCodeAt(0),p=0;p<16;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1}C--,C==0&&(C=Math.pow(2,T),T++),delete w[x]}else for(m=y[x],p=0;p<T;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1;C--,C==0&&(C=Math.pow(2,T),T++)}for(m=2,p=0;p<T;p++)j=j<<1|m&1,A==d-1?(A=0,N.push(g(j)),j=0):A++,m=m>>1;for(;;)if(j=j<<1,A==d-1){N.push(g(j));break}else A++;return N.join("")},decompress:function(u){return u==null?"":u==""?null:l._decompress(u.length,32768,function(d){return u.charCodeAt(d)})},_decompress:function(u,d,g){var p=[],m=4,y=4,w=3,_="",v=[],x,C,k,T,N,j,A,E={val:g(0),position:d,index:1};for(x=0;x<3;x+=1)p[x]=x;for(k=0,N=Math.pow(2,2),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;switch(k){case 0:for(k=0,N=Math.pow(2,8),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;A=i(k);break;case 1:for(k=0,N=Math.pow(2,16),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;A=i(k);break;case 2:return""}for(p[3]=A,C=A,v.push(A);;){if(E.index>u)return"";for(k=0,N=Math.pow(2,w),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;switch(A=k){case 0:for(k=0,N=Math.pow(2,8),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;p[y++]=i(k),A=y-1,m--;break;case 1:for(k=0,N=Math.pow(2,16),j=1;j!=N;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=d,E.val=g(E.index++)),k|=(T>0?1:0)*j,j<<=1;p[y++]=i(k),A=y-1,m--;break;case 2:return v.join("")}if(m==0&&(m=Math.pow(2,w),w++),p[A])_=p[A];else if(A===y)_=C+C.charAt(0);else return null;v.push(_),p[y++]=C+_.charAt(0),m--,C=_,m==0&&(m=Math.pow(2,w),w++)}}};return l})();r!=null?r.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(zx)),zx.exports}var vce=bce();const xce=/##\s*Drawing\s*```(compressed-json|json)\s*([\s\S]*?)```/;function _ce(r){const e=r.match(xce);if(!e)return null;const[,i,n]=e;let s;if(i==="compressed-json"){const o=vce.decompressFromBase64(n.replace(/\s+/g,""));if(!o)return null;s=o}else s=n;try{const o=JSON.parse(s);return Array.isArray(o.elements)?o:null}catch{return null}}function Lf(r){return r.endsWith(".excalidraw")}function Cce(){return Zt({queryKey:["knowledge"],queryFn:()=>ze.get("/knowledge"),select:r=>r.entries})}function wce(r){return Zt({queryKey:["knowledge",r],queryFn:()=>ze.get(`/knowledge/${r}`),select:e=>e.entry,enabled:!!r,staleTime:1/0,refetchInterval:!1})}function kce(r,e){return Zt({queryKey:["knowledge-assets",r],queryFn:()=>ze.get(`/knowledge-assets/${r}`),select:i=>i.files,enabled:e&&!!r,staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1})}function Sce(r,e,i){const n=rr();R.useEffect(()=>{!r||e===void 0||i===void 0||e<=i||(n.invalidateQueries({queryKey:["knowledge",r]}),n.invalidateQueries({queryKey:["knowledge-assets",r]}))},[r,e,i,n])}function Tce(){const r=rr();return sr({mutationFn:({slug:e,pinned:i})=>ze.patch(`/knowledge/${e}`,{pinned:i}),onSuccess:()=>{r.invalidateQueries({queryKey:["knowledge"]})}})}function fF(r,e){const i=`chunk-reloaded:${r}`;return R.lazy(async()=>{try{const n=await e();return window.sessionStorage.removeItem(i),n}catch(n){if(!(window.sessionStorage.getItem(i)==="1"))return window.sessionStorage.setItem(i,"1"),window.location.reload(),new Promise(()=>{});throw window.sessionStorage.removeItem(i),n}})}const Ece=fF("ExcalidrawCanvas",()=>Xt(()=>import("./percentages-BXMCSKIN-Dy9sVH3g.js").then(r=>r.E),__vite__mapDeps([53,54,55]))),eL=()=>a.jsxs("div",{className:"excalidraw-loading","aria-live":"polite",children:[a.jsx("span",{className:"excalidraw-spinner","aria-hidden":"true"}),a.jsx("span",{className:"excalidraw-loading-label",children:"Loading diagram…"})]});function pF({content:r,slug:e}){const{resolved:i}=Uf(),n=R.useMemo(()=>_ce(r),[r]),s=R.useMemo(()=>r.includes("## Embedded Files"),[r]),o=kce(e??"",!!e&&s),h=o.data,l=!!e&&s&&o.isLoading,u=R.useMemo(()=>{const d={...(n==null?void 0:n.files)??{}};if(h)for(const[g,p]of Object.entries(h))d[g]={id:g,mimeType:p.mimeType,dataURL:p.dataURL,created:0};return d},[n,h]);return n?a.jsx("div",{className:"excalidraw-preview","data-theme":i,children:l?a.jsx(eL,{}):a.jsx(R.Suspense,{fallback:a.jsx(eL,{}),children:a.jsx(Ece,{elements:n.elements,files:u,appState:n.appState,theme:i==="dark"?"dark":"light"},e??"board")})}):a.jsx("div",{className:"excalidraw-error",children:"Could not read the Excalidraw drawing in this file."})}const Nce=/```sql\s*\n([\s\S]*?)```/gi;function gF(r){return r.replace(/^.*?knowledge\//,"").replace(/\.md$/,"")}function Ace(r,e){if(!r.startsWith("data-structures/"))return null;const i=[...e.matchAll(Nce)].map(n=>n[1]);return i.length>0?i.join(`
469
469
 
470
470
  `):null}function jce(r){switch(r.type){case"knowledge":case"feature":return{url:`/knowledge/${gF(r.path)}`,pick:e=>tL(e,["entry","content"])};case"task":return{url:`/tasks/${r.slug}`,pick:e=>tL(e,["task","body"])};default:return null}}function tL(r,e){let i=r;for(const n of e)if(i&&typeof i=="object"&&n in i)i=i[n];else return"";return typeof i=="string"?i:""}function Mce({hit:r}){const e=R.useMemo(()=>jce(r),[r]),{data:i,isLoading:n,isError:s}=Zt({queryKey:["docdetail",r.type,r.path,r.slug],queryFn:()=>ze.get(e.url),enabled:!!e,staleTime:3e4});if(e&&n)return a.jsx("div",{style:{color:"var(--text-5)",fontSize:"13px",padding:"8px 2px"},children:"Loading document…"});const o=e&&!s&&i?e.pick(i):r.body;if(r.type==="knowledge"){const h=gF(r.path);if(Lf(h))return a.jsx("div",{style:{height:"440px",borderRadius:"10px",overflow:"hidden",border:"1px solid var(--border)"},children:a.jsx(pF,{content:o,slug:h})});const l=Ace(h,o);if(l)return a.jsx(xk,{content:l})}return a.jsx(Qf,{content:o})}function rL(r){return r.replace(/^.*?knowledge\//,"").replace(/\.md$/,"")}function Lce(r){const e=r.match(/(?:^|\/)core\/([^/]+)$/);return e?e[1]:""}function Bce(r){switch(r.type){case"knowledge":return{page:"knowledge",slug:rL(r.path)};case"feature":return{page:"knowledge",slug:rL(r.path)};case"task":return{page:"tasks",slug:r.slug};case"changelog":case"memory":default:return{page:"core",slug:Lce(r.path)}}}const Yo=[];function _k(r){const e=Yo.indexOf(r);e!==-1&&Yo.splice(e,1),Yo.push(r)}function Ck(r){const e=Yo.indexOf(r);e!==-1&&Yo.splice(e,1)}function wk(r){return Yo.length>0&&Yo[Yo.length-1]===r}function mF({id:r,open:e,onClose:i,ariaLabel:n,className:s,children:o}){if(R.useEffect(()=>{if(!e)return;_k(r);const l=u=>{u.key==="Escape"&&wk(r)&&(u.preventDefault(),u.stopImmediatePropagation(),i())};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0),Ck(r)}},[e,i,r]),!e)return null;const h=s?` ${s}`:"";return a.jsx("div",{className:`cmd-modal-scrim${h}`,onMouseDown:i,children:a.jsx("div",{className:`cmd-modal${h}`,role:"dialog","aria-modal":"true","aria-label":n,onMouseDown:l=>l.stopPropagation(),children:o})})}function yF({length:r,onEnter:e}){const[i,n]=R.useState(0);R.useEffect(()=>{n(o=>Math.min(o,Math.max(0,r-1)))},[r]);const s=R.useCallback(o=>{o.key==="ArrowDown"?(o.preventDefault(),n(h=>Math.min(r-1,h+1))):o.key==="ArrowUp"?(o.preventDefault(),n(h=>Math.max(0,h-1))):o.key==="Enter"&&(o.preventDefault(),e(i))},[r,e,i]);return{focused:i,setFocused:n,onKeyDown:s}}const bF="dreamcontext.cmdk.intelligent";function Rce(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(bF)==="1"}catch{return!1}}function Oce(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function iL({text:r,tokens:e}){if(!e.length||!r)return a.jsx(a.Fragment,{children:r});const i=new RegExp(`(${e.map(Oce).join("|")})`,"gi"),n=new Set(e.map(s=>s.toLowerCase()));return a.jsx(a.Fragment,{children:r.split(i).map((s,o)=>n.has(s.toLowerCase())?a.jsx("mark",{className:"cmdk-hl",children:s},o):a.jsx("span",{children:s},o))})}function Dce({open:r,onClose:e,onNavigate:i}){const[n,s]=R.useState(""),[o,h]=R.useState(""),l=R.useRef(null),[u,d]=R.useState(Rce),[g,p]=R.useState([]),[m,y]=R.useState("idle"),[w,_]=R.useState(""),[v,x]=R.useState("haiku"),C=n.trim();R.useEffect(()=>{const z=setTimeout(()=>h(C),110);return()=>clearTimeout(z)},[C]);const{data:k,isFetching:T}=hF(r&&!u?o:"",[],12),N=R.useMemo(()=>(k==null?void 0:k.hits)??[],[k]),j=u&&m==="done"&&w!==""&&w===C,A=u?j?g:[]:N,E=R.useCallback(z=>{const X=Bce(z);i(X.page,X.slug),e()},[i,e]),L=R.useCallback(()=>{var z;try{(z=l.current)==null||z.focus()}catch{}},[]),{focused:O,setFocused:D,onKeyDown:G}=yF({length:A.length,onEnter:z=>{if(u&&!j&&C){U();return}A[z]&&E(A[z])}}),q=R.useMemo(()=>(u?w:C).toLowerCase().split(/\s+/).filter(Boolean),[u,w,C]),U=R.useCallback(async()=>{const z=C;if(z){y("thinking"),_(z),D(0);try{const X=await dF(z,[]);p(X.hits),x(X.mode)}catch{try{p(await uF(z,[],12))}catch{p([])}x("bm25")}y("done")}},[C,D]),$=R.useCallback(()=>{d(z=>{const X=!z;try{window.localStorage.setItem(bF,X?"1":"0")}catch{}return X}),y("idle"),p([]),_(""),D(0),L()},[L,D]);R.useEffect(()=>{if(!r)return;s(""),h(""),D(0),p([]),y("idle"),_("");const z=requestAnimationFrame(()=>{var X;try{(X=l.current)==null||X.focus()}catch{}});return()=>cancelAnimationFrame(z)},[r,D]);const F=A[O]??null,W=u&&!!C&&m!=="thinking"&&!j,Y=u&&m==="thinking",P=!!C&&(!u&&!T&&N.length===0&&o===C||u&&j&&g.length===0),K=!C;return a.jsxs(mF,{id:"command-palette",open:r,onClose:e,ariaLabel:"Search the brain",className:"command-palette",children:[a.jsxs("div",{className:"cmdk-input-row",children:[a.jsxs("div",{className:`cmdk-field${u?" cmdk-field--intel":""}`,children:[a.jsx("span",{className:"cmdk-input-icon","aria-hidden":"true",children:a.jsx(Km,{size:17})}),a.jsx("input",{ref:l,className:"cmdk-input",value:n,placeholder:u?"Ask the brain — press ↵ to reason…":"Search the brain…",spellCheck:!1,autoComplete:"off","aria-label":"Search the brain",onChange:z=>{s(z.target.value),D(0),u&&y("idle")},onKeyDown:G}),!u&&T&&!!C&&a.jsx("span",{className:"cmdk-spin","aria-hidden":"true"}),a.jsxs("button",{type:"button",className:`cmdk-intel${u?" cmdk-intel--on":""}`,onClick:$,"aria-pressed":u,title:u?"Intelligent search is on — reasons over your brain with Haiku (uses tokens)":"Turn on intelligent search — intent-aware, beyond keywords",children:[a.jsx("span",{className:"cmdk-intel-dot","aria-hidden":"true"}),a.jsx(kh,{size:13,color:u?"#fff":"currentColor"}),a.jsx("span",{className:"cmdk-intel-label",children:"Intelligent"})]})]}),a.jsx("kbd",{className:"cmdk-kbd",children:"esc"})]}),a.jsxs("div",{className:"cmdk-body",children:[a.jsxs("div",{className:"cmdk-list",role:"listbox","aria-label":"Search results",children:[K&&a.jsx("div",{className:"cmdk-empty",children:u?"Ask anything — Intelligent search reasons over your whole brain.":"Search tasks, knowledge, core and memory."}),W&&a.jsxs("button",{className:"cmdk-cta",onClick:()=>void U(),children:[a.jsx(kh,{size:15,color:"#fff"}),"Run intelligent search",a.jsx("kbd",{className:"cmdk-cta-kbd",children:"↵"})]}),Y&&a.jsxs("div",{className:"cmdk-thinking",children:[a.jsx("span",{className:"cmdk-thinking-spark",children:a.jsx(kh,{size:14,color:"currentColor"})}),"Reasoning over your brain…",a.jsxs("div",{className:"cmdk-skel",children:[a.jsx("i",{}),a.jsx("i",{}),a.jsx("i",{})]})]}),P&&a.jsxs("div",{className:"cmdk-empty",children:["No matches for “",C,"”."]}),A.map((z,X)=>a.jsxs("button",{type:"button",role:"option","aria-selected":X===O,className:`cmdk-row${X===O?" cmdk-row--focused":""}`,onClick:()=>E(z),onMouseEnter:()=>D(X),children:[a.jsx("span",{className:"cmdk-row-icon","aria-hidden":"true",children:a.jsx(y1,{type:z.type,size:15})}),a.jsxs("span",{className:"cmdk-row-main",children:[a.jsx("span",{className:"cmdk-row-title",children:a.jsx(iL,{text:z.title,tokens:q})}),a.jsx("span",{className:"cmdk-row-snippet",children:a.jsx(iL,{text:z.snippet||z.description,tokens:q})})]}),a.jsx("span",{className:"cmdk-row-type",children:z.type})]},`${z.type}/${z.slug}/${X}`))]}),F&&a.jsxs("div",{className:"cmdk-preview",children:[a.jsxs("div",{className:"cmdk-preview-head",children:[a.jsx("span",{className:"cmdk-preview-icon","aria-hidden":"true",children:a.jsx(y1,{type:F.type,size:15})}),a.jsx("span",{className:"cmdk-preview-title",children:F.title})]}),a.jsx("div",{className:"cmdk-preview-path",children:F.path}),a.jsx("div",{className:"cmdk-preview-body",children:a.jsx(Mce,{hit:F})})]})]}),a.jsxs("div",{className:"cmdk-foot",children:[a.jsxs("span",{children:[a.jsx("kbd",{children:"↑"}),a.jsx("kbd",{children:"↓"})," move"]}),a.jsxs("span",{children:[a.jsx("kbd",{children:"↵"})," ",u&&!j?"reason":"open"]}),a.jsxs("span",{children:[a.jsx("kbd",{children:"esc"})," close"]}),a.jsx("span",{className:`cmdk-foot-mode${u?" cmdk-foot-mode--intel":""}`,children:u?j&&v==="bm25"?"bm25 · fallback":"intelligent · haiku":"local · bm25"})]})]})}const vF="dreamcontext.dashboard.sidebarCollapsed",lh=typeof window<"u"&&window.matchMedia?window.matchMedia("(max-width: 1024px)"):null;function Ice(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vF)==="1"}catch{return!1}}function Fce(){const[r,e]=R.useState(Ice),[i,n]=R.useState((lh==null?void 0:lh.matches)??!1);R.useEffect(()=>{if(!lh)return;const o=h=>n(h.matches);return lh.addEventListener("change",o),()=>lh.removeEventListener("change",o)},[]);const s=R.useCallback(()=>{e(o=>{const h=!o;try{window.localStorage.setItem(vF,h?"1":"0")}catch{}return h})},[]);return{collapsed:i||r,toggle:s}}const xF="dreamcontext.dashboard.activePage",nL=["tasks","roadmap","lab","core","knowledge","sleep","brain","council","taxonomy","settings","packs","about"];function $ce(){if(typeof window>"u")return"tasks";try{const r=new URLSearchParams(window.location.search).get("page");if(r&&nL.includes(r))return r}catch{}try{const r=window.localStorage.getItem(xF);if(r&&nL.includes(r))return r}catch{}return"tasks"}function Pce({children:r}){const[e,i]=R.useState($ce),[n,s]=R.useState(null),[o,h]=R.useState(0),[l,u]=R.useState(!1),{collapsed:d,toggle:g}=Fce();R.useEffect(()=>{const _=v=>{(v.metaKey||v.ctrlKey)&&!v.altKey&&v.key.toLowerCase()==="k"&&(v.preventDefault(),u(x=>!x))};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[]),R.useEffect(()=>{document.documentElement.dataset.sidebar=d?"collapsed":"expanded"},[d]);const p=R.useCallback((_,v)=>{i(_),s(v),h(x=>x+1),window.dispatchEvent(new CustomEvent("dreamcontext-navigate",{detail:{page:_}}));try{window.localStorage.setItem(xF,_)}catch{}},[]),m=R.useCallback((_,v)=>{p(_,v??null)},[p]),y=R.useCallback(()=>s(null),[]),w=R.useCallback(()=>u(!1),[]);return a.jsxs("div",{className:"shell",children:[a.jsx(qle,{onNavigate:m,sidebarCollapsed:d,onToggleSidebar:g,onOpenSearch:()=>u(!0)}),a.jsxs("div",{className:"shell-body",children:[a.jsx(lce,{activePage:e,onNavigate:m,collapsed:d}),a.jsx("main",{className:"shell-main",children:r({page:e,focusId:n,nonce:o,navigate:p,clearFocus:y})})]}),a.jsx(Dce,{open:l,onClose:w,onNavigate:p})]})}function zce(){try{return new URLSearchParams(window.location.search).get("vault")}catch{return null}}function qce(r){return r instanceof Element?!!r.closest('input, textarea, select, [contenteditable="true"], .xterm, .agent-surface'):!1}function Hce(r){return r instanceof Element?!!r.closest(".xterm, .agent-surface"):!1}function sL(){const[r,e]=R.useState(!1),[i,n]=R.useState(""),s=R.useRef(null),{data:o}=uR(r),h=R.useMemo(()=>(o==null?void 0:o.vaults)??[],[o]),l=zce(),u=l===null,d=R.useMemo(()=>h.filter(T=>T.exists),[h]),g=R.useMemo(()=>{const T=i.trim().toLowerCase();return T?h.filter(N=>N.name.toLowerCase().includes(T)||N.path.toLowerCase().includes(T)):h},[h,i]),p=R.useCallback(T=>{e(!1),T.exists&&T.name!==l&&YE(T.name)},[l]),m=R.useCallback(()=>{e(!1),l7()},[]),y=R.useCallback(()=>e(!1),[]),w=R.useMemo(()=>{const T=[];u||T.push({kind:"home"});for(const N of g)T.push({kind:"vault",vault:N,quickIdx:d.indexOf(N)});return T},[u,g,d]),_=R.useCallback(T=>{const N=w[T];N&&(N.kind==="home"?m():p(N.vault))},[w,m,p]),{focused:v,setFocused:x,onKeyDown:C}=yF({length:w.length,onEnter:_}),k=R.useRef(null);return R.useEffect(()=>{var T,N;(N=(T=k.current)==null?void 0:T.querySelector(`[data-row-index="${v}"]`))==null||N.scrollIntoView({block:"nearest"})},[v]),R.useEffect(()=>{const T=N=>{if(!(!(N.metaKey||N.ctrlKey)||N.altKey)){if(N.key.toLowerCase()==="p"&&!N.shiftKey&&!Hce(N.target)){N.preventDefault(),e(A=>!A);return}if(/^[1-9]$/.test(N.key)&&!N.shiftKey&&!qce(N.target)){const A=d[Number(N.key)-1];if(!A)return;N.preventDefault(),A.name!==l&&YE(A.name)}}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[d,l]),R.useEffect(()=>{if(!r)return;n(""),x(0);const T=requestAnimationFrame(()=>{var N;try{(N=s.current)==null||N.focus()}catch{}});return()=>cancelAnimationFrame(T)},[r,x]),a.jsxs(mF,{id:"project-switcher",open:r,onClose:y,ariaLabel:"Go to project",className:"psw-modal",children:[a.jsxs("div",{className:"psw-input-row",children:[a.jsx("input",{ref:s,className:"psw-input",value:i,placeholder:"Go to project…",spellCheck:!1,autoComplete:"off","aria-label":"Go to project",onChange:T=>{n(T.target.value),x(0)},onKeyDown:C}),a.jsx("kbd",{className:"psw-kbd",children:"esc"})]}),a.jsxs("div",{className:"psw-list",role:"listbox","aria-label":"Projects",ref:k,children:[w.map((T,N)=>{const j=N===v;if(T.kind==="home")return a.jsxs("button",{type:"button",role:"option","aria-selected":j,"data-row-index":N,className:`psw-row psw-row--home${j?" psw-row--focused":""}`,onClick:m,onMouseEnter:()=>x(N),children:[a.jsx("span",{className:"psw-home-glyph","aria-hidden":"true",children:"←"}),a.jsx("span",{className:"psw-row-main",children:a.jsx("span",{className:"psw-row-name",children:"Launcher"})}),a.jsx("span",{className:"psw-row-hint",children:"home"})]},"__home__");const{vault:A,quickIdx:E}=T,L=A.name===l;return a.jsxs("button",{type:"button",role:"option","aria-selected":j,"data-row-index":N,disabled:!A.exists,className:`psw-row${j?" psw-row--focused":""}${L?" psw-row--current":""}`,onClick:()=>p(A),onMouseEnter:()=>x(N),children:[a.jsx(Tm,{exists:A.exists,needsUpdate:A.needsUpdate}),a.jsxs("span",{className:"psw-row-main",children:[a.jsx("span",{className:"psw-row-name",children:A.name}),a.jsx("span",{className:"psw-row-path",children:A.path})]}),L?a.jsx("span",{className:"psw-row-hint psw-row-hint--current",children:"current"}):E>=0&&E<9?a.jsxs("kbd",{className:"psw-row-num",children:["⌘",E+1]}):null]},A.name)}),w.length===0&&a.jsx("div",{className:"psw-empty",children:h.length===0?"No projects registered yet.":`No projects match “${i.trim()}”.`})]}),a.jsxs("div",{className:"psw-foot",children:[a.jsxs("span",{children:[a.jsx("kbd",{children:"↑"}),a.jsx("kbd",{children:"↓"})," move"]}),a.jsxs("span",{children:[a.jsx("kbd",{children:"↵"})," open"]}),a.jsxs("span",{children:[a.jsx("kbd",{children:"⌘"}),a.jsx("kbd",{children:"1-9"})," jump"]}),a.jsxs("span",{children:[a.jsx("kbd",{children:"esc"})," close"]})]})]})}var qx={exports:{}},aL;function Uce(){return aL||(aL=1,(function(r,e){(function(i,n){r.exports=n()})(globalThis,(()=>(()=>{var i={4567:function(h,l,u){var d=this&&this.__decorate||function(C,k,T,N){var j,A=arguments.length,E=A<3?k:N===null?N=Object.getOwnPropertyDescriptor(k,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,k,T,N);else for(var L=C.length-1;L>=0;L--)(j=C[L])&&(E=(A<3?j(E):A>3?j(k,T,E):j(k,T))||E);return A>3&&E&&Object.defineProperty(k,T,E),E},g=this&&this.__param||function(C,k){return function(T,N){k(T,N,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const p=u(9042),m=u(9924),y=u(844),w=u(4725),_=u(2585),v=u(3656);let x=l.AccessibilityManager=class extends y.Disposable{constructor(C,k,T,N){super(),this._terminal=C,this._coreBrowserService=T,this._renderService=N,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let j=0;j<this._terminal.rows;j++)this._rowElements[j]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[j]);if(this._topBoundaryFocusListener=j=>this._handleBoundaryFocus(j,0),this._bottomBoundaryFocusListener=j=>this._handleBoundaryFocus(j,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new m.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((j=>this._handleResize(j.rows)))),this.register(this._terminal.onRender((j=>this._refreshRows(j.start,j.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((j=>this._handleChar(j)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
471
471
  `)))),this.register(this._terminal.onA11yTab((j=>this._handleTab(j)))),this.register(this._terminal.onKey((j=>this._handleKey(j.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(C){for(let k=0;k<C;k++)this._handleChar(" ")}_handleChar(C){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==C&&(this._charsToAnnounce+=C):this._charsToAnnounce+=C,C===`
@@ -510,7 +510,7 @@ Drag to reschedule · drag an edge to resize`,children:[a.jsx("div",{className:"
510
510
 
511
511
  This removes it from the roadmap and clears it from any dependent objectives and any tasks assigned to it. This cannot be undone.`)&&g.mutate(r.slug,{onSuccess:I=>{var Z;o(),(Z=I.unhealedTasks)!=null&&Z.length&&h(`Deleted — but ${I.unhealedTasks.length} task file(s) couldn't be updated; check them for a stale reference to “${r.slug}”.`)},onError:I=>h(I instanceof Error?I.message:"Could not delete objective.")})},G=(I,Z)=>E({start_date:I,target_date:Z}),q=()=>{const I=k;if(!I)return;const Z=I.label.trim(),J={label:Z||"Metric",unit:I.unit&&I.unit.trim()?I.unit.trim():null,baseline:Number.isFinite(I.baseline)?I.baseline:0,target:I.target,current:Number.isFinite(I.current)?I.current:0};if(!Z||!Number.isFinite(J.target)||J.target===J.baseline){T(r.metric),h("Metric needs a label and a target that differs from the baseline.");return}const re=r.metric;re&&re.label===J.label&&re.unit===J.unit&&re.baseline===J.baseline&&re.target===J.target&&re.current===J.current||E({metric:J},"Could not update metric.")},U=()=>E({metric:{label:"MRR",unit:null,baseline:0,target:100,current:0}}),$=p.find(I=>{var Z;return((Z=I.binding)==null?void 0:Z.objective)===r.slug})??null,F=()=>{$&&m.mutate({slug:$.slug,binding:null},{onError:()=>h("Could not disconnect the insight.")}),E({metric:null})},W=I=>{if(I===null){if(!$)return;m.mutate({slug:$.slug,binding:null},{onSuccess:()=>h("Insight disconnected — the metric is manual again."),onError:Z=>h(Z instanceof Error?Z.message:"Could not disconnect the insight.")});return}m.mutate({slug:I,binding:{objective:r.slug,value:"latest"}},{onSuccess:Z=>h(Z.seededCurrent!==null?`Connected — current set to ${Z.seededCurrent} from the insight.`:"Connected — current updates on the next lab sync."),onError:Z=>h(Z instanceof Error?Z.message:"Could not connect the insight.")})},Y=I=>E({impact:r.impact===I?null:I}),P=I=>E({effort:r.effort===I?null:I}),K=I=>{for(const Z of I.filter(J=>!r.depends_on.includes(J)))u.mutate({slug:r.slug,to:Z},{onError:J=>h(J instanceof Error?J.message:"Could not link.")});for(const Z of r.depends_on.filter(J=>!I.includes(J)))d.mutate({slug:r.slug,to:Z},{onError:()=>h("Could not unlink.")})};let z,X,ie,ee,he;if(e.slipping){z="slip",X="🔴",he=Jl,ie=`Slipping — ${e.slipDays} day${e.slipDays===1?"":"s"} past target`;const I=r.slipUpstream.length>0?` Likely cause: upstream ${r.slipUpstream.join(", ")} running late.`:" Cause: this objective’s own tasks overrun the target.";ee=`Forecast end (${hs(e.forecast_end)}) overshoots the committed target (${hs(e.target)}). The slip cascades to everything this blocks.${I}`}else if(!e.forecastable)z="unforecastable",X="◔",he="var(--color-text-secondary)",ie="Unforecastable",ee="No dates to project from. Set a start/target below (or link dated member tasks) to compute a forecast.";else{z="ontrack",X="🟢",he="#3fb950";const I=Math.abs(e.slipDays);ie=`On track — ${I} day${I===1?"":"s"} of buffer`,ee=`Forecast end (${hs(e.forecast_end)}) lands before the committed target (${hs(e.target)}).`}const fe=e.dependents.map(I=>{const Z=i.get(I),J=n.get(I);return{slug:I,title:(Z==null?void 0:Z.title)??I,color:ds[(Z==null?void 0:Z.status)??"not_started"].color,slipping:!!(J!=null&&J.slipping)}}),ne=[...i.values()].filter(I=>I.slug!==r.slug).map(I=>({slug:I.slug,title:I.title,status:I.status}));return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"odp-overlay",onClick:o}),a.jsxs("div",{className:"odp-panel",role:"dialog","aria-modal":"true","aria-label":r.title,children:[a.jsxs("div",{className:"odp-head",children:[a.jsxs("div",{className:"odp-head-row",children:[a.jsxs("div",{className:"odp-status-wrap",children:[a.jsxs("button",{className:"odp-status",style:{color:"var(--color-text)",background:fC(j.color,.14),border:`1px solid ${fC(j.color,.3)}`},onClick:()=>C(I=>!I),title:"Change status",children:[a.jsx("span",{className:"odp-status-dot",style:{background:j.color}}),j.label,a.jsx("span",{className:"odp-caret",children:"▾"})]}),x&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"odp-drop-away",onClick:()=>C(!1)}),a.jsxs("div",{className:"odp-drop",children:[Hde.map(I=>a.jsxs("div",{className:"odp-drop-row",onClick:()=>O(I),children:[a.jsx("span",{className:"odp-drop-dot",style:{background:ds[I].color}}),a.jsx("span",{className:"odp-drop-label",children:ds[I].label}),r.status===I&&r.statusOverride&&a.jsx("span",{className:"odp-drop-check",children:"✓"})]},I)),a.jsx("div",{className:"odp-drop-sep"}),a.jsxs("div",{className:"odp-drop-row",onClick:()=>O(null),title:"Clear the manual override — status falls back to the task rollup",children:[a.jsx("span",{className:"odp-drop-dot odp-drop-dot--auto",children:"↺"}),a.jsx("span",{className:"odp-drop-label",children:"Auto (from tasks)"}),!r.statusOverride&&a.jsx("span",{className:"odp-drop-check",children:"✓"})]})]})]})]}),r.statusOverride&&a.jsx("span",{className:"odp-override",title:"Status set manually — click the pill → Auto to clear",children:"✎ override"}),a.jsx("span",{className:"odp-spacer"}),a.jsx("span",{className:"odp-close",onClick:o,title:"Close (Esc)",children:"✕"})]}),_?a.jsx("input",{ref:N,className:"odp-title-input",value:y,autoFocus:!0,onChange:I=>w(I.target.value),onBlur:L,onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),L())}}):a.jsxs("div",{className:"odp-title",onClick:()=>v(!0),title:"Click to rename",children:[r.title,a.jsx("span",{className:"odp-title-edit",children:"✎"})]}),a.jsx("div",{className:"odp-slug",children:r.slug}),r.description&&a.jsx("div",{className:"odp-desc",children:r.description})]}),a.jsxs("div",{className:"odp-body bd-scroll",children:[a.jsxs("div",{className:`odp-risk odp-risk--${z}`,children:[a.jsx("span",{className:"odp-risk-glyph",children:X}),a.jsxs("div",{children:[a.jsx("div",{className:"odp-risk-title",style:{color:he},children:ie}),a.jsx("div",{className:"odp-risk-sub",children:ee})]})]}),a.jsxs("div",{className:"odp-section-label",children:["Committed window ",a.jsx("span",{className:"odp-hint",children:"editable"})]}),a.jsx("div",{className:"odp-range",children:a.jsx(ZF,{start:r.start_date,end:r.target_date,onChange:G,placeholder:"Set start & target dates"})}),a.jsxs("div",{className:"odp-forecast-line",children:[a.jsx("span",{className:"odp-forecast-cap",children:"Forecast · computed"}),a.jsx("span",{style:{color:e.slipping?Jl:e.forecastable?"var(--color-text-secondary)":"var(--color-text-tertiary)",fontFamily:"var(--font-mono)",fontWeight:600},children:e.forecast_end?hs(e.forecast_end):"none"}),e.forecastable&&a.jsx("span",{className:"odp-forecast-note",children:e.slipping?`slipping ${e.slipDays}d`:`${Math.abs(e.slipDays)}d buffer`})]}),r.metric?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"odp-section-label",children:["Key Result ",a.jsx("span",{className:"odp-hint",children:"editable"}),a.jsx("button",{className:"odp-metric-clear",onClick:F,title:"Remove the metric — track by tasks instead",children:"track by tasks"})]}),a.jsxs("div",{className:"odp-metric",children:[a.jsxs("div",{className:"odp-metric-row",children:[a.jsx("input",{className:"odp-metric-label",value:(k==null?void 0:k.label)??"",placeholder:"Metric",onChange:I=>T(Z=>Z&&{...Z,label:I.target.value}),onBlur:()=>q(),onKeyDown:I=>{I.key==="Enter"&&I.currentTarget.blur()}}),a.jsx("input",{className:"odp-metric-unit",value:(k==null?void 0:k.unit)??"",placeholder:"unit",onChange:I=>T(Z=>Z&&{...Z,unit:I.target.value||null}),onBlur:()=>q(),onKeyDown:I=>{I.key==="Enter"&&I.currentTarget.blur()}})]}),a.jsxs("div",{className:"odp-prog",children:[a.jsx("div",{className:"odp-prog-track",children:a.jsx("div",{className:"odp-prog-fill",style:{width:`${A??0}%`,background:`linear-gradient(90deg, ${j.lite}, ${j.color})`}})}),a.jsxs("span",{className:"odp-prog-label",children:[rl(r.metric.current,r.metric.unit)," / ",rl(r.metric.target,r.metric.unit)," · ",A,"%"]})]}),a.jsxs("div",{className:"odp-metric-grid",children:[a.jsxs("label",{className:"odp-metric-field",children:[a.jsx("span",{children:"Current"}),a.jsx("input",{type:"number",value:(k==null?void 0:k.current)??0,onChange:I=>T(Z=>Z&&{...Z,current:I.target.valueAsNumber}),onBlur:()=>q(),onKeyDown:I=>{I.key==="Enter"&&I.currentTarget.blur()}})]}),a.jsxs("label",{className:"odp-metric-field",children:[a.jsx("span",{children:"Baseline"}),a.jsx("input",{type:"number",value:(k==null?void 0:k.baseline)??0,onChange:I=>T(Z=>Z&&{...Z,baseline:I.target.valueAsNumber}),onBlur:()=>q(),onKeyDown:I=>{I.key==="Enter"&&I.currentTarget.blur()}})]}),a.jsxs("label",{className:"odp-metric-field",children:[a.jsx("span",{children:"Target"}),a.jsx("input",{type:"number",value:(k==null?void 0:k.target)??0,onChange:I=>T(Z=>Z&&{...Z,target:I.target.valueAsNumber}),onBlur:()=>q(),onKeyDown:I=>{I.key==="Enter"&&I.currentTarget.blur()}})]})]}),p.length>0&&a.jsxs("div",{className:"odp-metric-insight",children:[a.jsx(JF,{insights:p,selected:($==null?void 0:$.slug)??null,objectiveSlug:r.slug,onSelect:W,disabled:m.isPending}),$&&a.jsx("span",{className:"odp-metric-insight-hint",children:"Current updates automatically from this insight on every lab sync."})]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"odp-section-label",children:"Progress"}),r.progress.total>0?a.jsxs("div",{className:"odp-prog",children:[a.jsx("div",{className:"odp-prog-track",children:a.jsx("div",{className:"odp-prog-fill",style:{width:`${A??0}%`,background:`linear-gradient(90deg, ${j.lite}, ${j.color})`}})}),a.jsxs("span",{className:"odp-prog-label",children:[r.progress.done," / ",r.progress.total," · ",A,"%"]})]}):a.jsx("div",{className:"odp-prog-empty",children:"No tasks yet — assign tasks to roll up progress."}),a.jsxs("button",{className:"odp-goal-add",onClick:U,title:"Track this objective by an outcome number (e.g. MRR) instead of task completion",children:[a.jsx("span",{className:"odp-goal-add-plus","aria-hidden":"true",children:"+"}),a.jsxs("span",{className:"odp-goal-add-text",children:[a.jsx("strong",{children:"Track by a metric"}),a.jsx("span",{children:"Set a goal number — e.g. MRR, customers, %"})]})]})]}),a.jsxs("div",{className:"odp-section-label",children:["Impact ",a.jsx("span",{className:"odp-times",children:"×"})," Effort ",a.jsx("span",{className:"odp-hint",children:"editable"})]}),a.jsxs("div",{className:"odp-prio",children:[a.jsxs("div",{className:"odp-prio-axis",children:[a.jsx("span",{className:"odp-prio-cap",children:"Impact"}),a.jsx("div",{className:"odp-seg",children:[1,2,3,4,5].map(I=>a.jsx("button",{className:`odp-seg-btn ${r.impact===I?"odp-seg-btn--on":""}`,onClick:()=>Y(I),title:Ude[I],children:I},I))})]}),a.jsxs("div",{className:"odp-prio-axis",children:[a.jsx("span",{className:"odp-prio-cap",children:"Effort"}),a.jsx("div",{className:"odp-seg",children:Wde.map(I=>a.jsxs("button",{className:`odp-seg-btn ${r.effort===I?"odp-seg-btn--on":""}`,onClick:()=>P(I),title:`${I} week${I===1?"":"s"}`,children:[I,"w"]},I))})]})]}),a.jsx("div",{className:"odp-deps",children:a.jsxs("div",{className:"odp-deps-col",children:[a.jsxs("div",{className:"odp-section-label",children:["Depends on ",a.jsx("span",{className:"odp-hint",children:"editable"})]}),a.jsx(QF,{options:ne,selected:r.depends_on,onChange:K})]})}),a.jsxs("div",{className:"odp-blocks",children:[a.jsx("div",{className:"odp-section-label",children:"Blocks"}),fe.length===0?a.jsx("div",{className:"odp-none",children:"— none"}):fe.map(I=>a.jsxs("div",{className:"odp-dep-chip",onClick:()=>s(I.slug),children:[a.jsx("span",{className:"odp-dep-dot",style:{background:I.color}}),a.jsx("span",{className:"odp-dep-title",children:I.title}),I.slipping&&a.jsx("span",{className:"odp-dep-slip",children:"●"})]},I.slug))]}),a.jsxs("div",{className:"odp-tasks-head",children:[a.jsx("span",{className:"odp-section-label",style:{margin:0},children:"Member tasks"}),a.jsx("span",{className:"odp-tasks-count",children:r.tasks.length})]}),r.tasks.length===0?a.jsxs("div",{className:"odp-notasks",children:["No tasks yet — link work by adding ",a.jsxs("span",{className:"odp-mono",children:["objectives: [",r.slug,"]"]})," to a task's frontmatter."]}):a.jsx("div",{className:"odp-tasklist",children:r.tasks.map(I=>{const Z=fde[I.status]??{label:I.status,color:"var(--color-text-tertiary)"};return a.jsxs("div",{className:"odp-task",children:[a.jsx("span",{className:"odp-task-dot",style:{background:Z.color}}),a.jsx("span",{className:"odp-task-slug",children:I.slug}),a.jsx("span",{className:"odp-task-status",style:{color:Z.color},children:Z.label})]},I.slug)})})]}),a.jsxs("div",{className:"odp-foot",children:[a.jsx("span",{className:"odp-foot-note",children:r.progress.total>0?`forecast from ${r.progress.total} task${r.progress.total===1?"":"s"} + deps`:"forecast from committed dates + deps"}),a.jsx("button",{className:"odp-delete",onClick:D,title:"Delete this objective",children:g.isPending?"Deleting…":"Delete"})]})]})]})}const m_="dreamcontext:";function Fk(r,e){const{projectId:i}=CQ(),n=i?`${m_}${i}:${r}`:`${m_}${r}`,[s,o]=R.useState(()=>{try{const l=localStorage.getItem(n);if(l!==null)return JSON.parse(l);if(i){const u=`${m_}${r}`,d=localStorage.getItem(u);if(d!==null)return localStorage.setItem(n,d),localStorage.removeItem(u),JSON.parse(d)}}catch{}return e}),h=R.useCallback(l=>{o(u=>{const d=typeof l=="function"?l(u):l;try{localStorage.setItem(n,JSON.stringify(d))}catch{}return d})},[n]);return[s,h]}const r$={search:"",sortBy:"manual",sortDir:"asc",layout:"timeline",cardProps:{target:!0,forecast:!0,progress:!0,status:!0,dependencies:!0,priority:!0,tasks:!1},filters:{status:{inc:[],exc:[]},signal:{inc:[],exc:[]}}};function y_(r){var i,n;const e=r$;return{search:typeof r.search=="string"?r.search:e.search,sortBy:r.sortBy??e.sortBy,sortDir:r.sortDir==="desc"?"desc":"asc",layout:r.layout??e.layout,cardProps:{...e.cardProps,...r.cardProps??{}},filters:{status:{...e.filters.status,...((i=r.filters)==null?void 0:i.status)??{}},signal:{...e.filters.signal,...((n=r.filters)==null?void 0:n.signal)??{}}}}}function Kde(){const[r,e]=Fk("roadmap:prefs:v1",r$),i=R.useMemo(()=>y_(r),[r]),n=R.useRef(!1);R.useEffect(()=>{if(n.current)return;let w=!1;return ze.get("/roadmap-prefs").then(_=>{if(w)return;n.current=!0;const v=_.settings;v&&typeof v=="object"&&Object.keys(v).length>0&&e(y_(v))}).catch(()=>{n.current=!0}),()=>{w=!0}},[e]);const s=R.useRef(null),o=R.useCallback(w=>{n.current&&(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{ze.put("/roadmap-prefs",{settings:w}).catch(()=>{})},600))},[]),h=R.useCallback(w=>{e(_=>{const v=w(y_(_));return o(v),v})},[e,o]),l=R.useCallback(w=>h(_=>({..._,search:w})),[h]),u=R.useCallback(w=>h(_=>({..._,sortBy:w})),[h]),d=R.useCallback(()=>h(w=>({...w,sortDir:w.sortDir==="asc"?"desc":"asc"})),[h]),g=R.useCallback(w=>h(_=>({..._,layout:w})),[h]),p=R.useCallback(w=>h(_=>({..._,cardProps:{..._.cardProps,[w]:!_.cardProps[w]}})),[h]),m=R.useCallback(()=>h(w=>({...w,filters:{status:{inc:[],exc:[]},signal:{inc:[],exc:[]}}})),[h]),y=R.useCallback((w,_,v)=>{h(x=>{const C=x.filters[w],k=v==="inc"?{inc:C.inc.includes(_)?C.inc.filter(T=>T!==_):[...C.inc,_],exc:C.exc.filter(T=>T!==_)}:{exc:C.exc.includes(_)?C.exc.filter(T=>T!==_):[...C.exc,_],inc:C.inc.filter(T=>T!==_)};return{...x,filters:{...x.filters,[w]:k}}})},[h]);return{prefs:i,setSearch:l,setSort:u,toggleSortDir:d,setLayout:g,toggleCardProp:p,cycleFilter:y,clearAllFilters:m}}function Vde(){const{data:r=[],isLoading:e}=Rk(),{data:i}=kue();return{items:R.useMemo(()=>{const s=new Map(((i==null?void 0:i.objectives)??[]).map(o=>[o.slug,o]));return r.map(o=>{const h=s.get(o.slug);return{slug:o.slug,title:o.title,description:(h==null?void 0:h.description)??null,start_date:o.start_date,target_date:o.target_date,depends_on:o.depends_on,status:o.status??(h==null?void 0:h.status)??"not_started",statusOverride:o.status!=null,progress:(h==null?void 0:h.progress)??{done:0,total:0,pct:o.metric?0:null,source:o.metric?"metric":"tasks",metric:o.metric},tasks:(h==null?void 0:h.tasks)??[],impact:o.impact,effort:o.effort,metric:o.metric,slipDays:(h==null?void 0:h.slip_days)??null,slipUpstream:(h==null?void 0:h.slip_upstream)??[]}})},[r,i]),warnings:(i==null?void 0:i.warnings)??[],isLoading:e}}function uB(r,e){return!(e.exc.includes(r)||e.inc.length>0&&!e.inc.includes(r))}function Yde(){const{prefs:r,setSearch:e,setSort:i,toggleSortDir:n,setLayout:s,toggleCardProp:o,cycleFilter:h,clearAllFilters:l}=Kde(),{search:u,sortBy:d,sortDir:g,layout:p,cardProps:m,filters:y}=r,[w,_]=R.useState(null),[v,x]=R.useState(!1),[C,k]=R.useState(null),[T,N]=R.useState(!1),[j,A]=R.useState(null),{items:E,warnings:L,isLoading:O}=Vde(),D=R.useCallback(P=>A(P),[]);R.useEffect(()=>{if(!j)return;const P=setTimeout(()=>A(null),2600);return()=>clearTimeout(P)},[j]);const G=R.useCallback(()=>_(null),[]),q=R.useMemo(()=>gC(E),[E]),U=R.useMemo(()=>new Map(E.map(P=>[P.slug,P])),[E]),$=R.useMemo(()=>{const P=u.trim().toLowerCase();let K=E.filter(ie=>{var ee;return(!P||ie.title.toLowerCase().includes(P)||ie.slug.includes(P))&&uB(ie.status,y.status)&&uB(((ee=q.get(ie.slug))==null?void 0:ee.signal)??"unforecastable",y.signal)});const z=g==="asc"?1:-1,X=(ie,ee)=>(ie??"9999-99-99").localeCompare(ee??"9999-99-99")*z;return d==="title"?K=[...K].sort((ie,ee)=>ie.title.localeCompare(ee.title)*z):d==="target"?K=[...K].sort((ie,ee)=>{var he,fe;return X((he=q.get(ie.slug))==null?void 0:he.target,(fe=q.get(ee.slug))==null?void 0:fe.target)}):d==="forecast"?K=[...K].sort((ie,ee)=>{var he,fe;return X((he=q.get(ie.slug))==null?void 0:he.forecast_end,(fe=q.get(ee.slug))==null?void 0:fe.forecast_end)}):d==="progress"&&(K=[...K].sort((ie,ee)=>((ie.progress.pct??-1)-(ee.progress.pct??-1))*z)),K},[E,u,y,d,g,q]),F=C?U.get(C):void 0,W=C?q.get(C):void 0,Y=L.length>0&&!T;return a.jsxs("div",{style:{zoom:"var(--zoom)",height:"calc(100dvh - var(--header-height) - 2 * var(--space-4))",maxHeight:"calc(100dvh - var(--header-height) - 2 * var(--space-4))",display:"flex",flexDirection:"column",position:"relative",background:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:14,overflow:"hidden",boxShadow:"var(--shadow-md)"},children:[a.jsx(Cde,{search:u,setSearch:e,sortBy:d,setSort:i,sortDir:g,toggleSortDir:n,layout:p,setLayout:s,cardProps:m,toggleCardProp:o,filters:y,cycleFilter:h,clearAllFilters:l,openMenu:w,setOpenMenu:_,onNewObjective:()=>x(!0)}),Y&&a.jsxs("div",{className:"rm-warn",children:[a.jsx("span",{className:"rm-warn-icon",children:"⚠"}),a.jsx("div",{className:"rm-warn-list",children:L.map((P,K)=>a.jsx("span",{className:"rm-warn-item",children:P},K))}),a.jsx("span",{className:"rm-warn-x",onClick:()=>N(!0),title:"Dismiss",children:"✕"})]}),a.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",background:"var(--color-bg)"},children:O?a.jsx(Xde,{children:"Loading objectives…"}):E.length===0?a.jsx(Zde,{onCreate:()=>x(!0)}):$.length===0?a.jsx(Qde,{onClear:l}):p==="board"?a.jsx(qde,{items:$,forecasts:q,onOpen:k}):a.jsx(Pde,{items:$,allItems:E,cardProps:m,onOpen:k,onToast:D})}),w!==null&&a.jsx("div",{onClick:G,style:{position:"absolute",inset:0,zIndex:35}}),F&&W&&a.jsx(Gde,{item:F,forecast:W,itemsBySlug:U,forecasts:q,onOpen:k,onClose:()=>k(null),onToast:D},F.slug),v&&a.jsx(Mde,{onClose:()=>x(!1),onCreated:P=>D(`Objective “${P.title}” created`)}),j&&a.jsxs("div",{className:"bd-pop",style:{position:"absolute",bottom:22,left:"50%",transform:"translateX(-50%)",zIndex:60,display:"flex",alignItems:"center",gap:9,padding:"10px 16px",borderRadius:11,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border)",boxShadow:"var(--shadow-lg)",fontSize:13,color:"var(--color-text)"},children:[a.jsx("span",{style:{color:"var(--color-accent)"},children:"✓"}),j]})]})}function Xde({children:r}){return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:13},children:r})}function Zde({onCreate:r}){return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,textAlign:"center",padding:40},children:[a.jsx("div",{style:{width:70,height:70,borderRadius:18,background:"linear-gradient(160deg, rgba(123,104,238,0.16), rgba(123,104,238,0.05))",border:"1px solid rgba(157,140,255,0.28)",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:12},children:a.jsxs("svg",{width:"34",height:"34",viewBox:"0 0 32 32",fill:"none",children:[a.jsx("line",{x1:"5",y1:"9",x2:"20",y2:"9",stroke:"#9d8cff",strokeWidth:"2.4",strokeLinecap:"round"}),a.jsx("line",{x1:"9",y1:"16",x2:"27",y2:"16",stroke:"#9d8cff",strokeWidth:"2.4",strokeLinecap:"round",opacity:"0.65"}),a.jsx("line",{x1:"5",y1:"23",x2:"16",y2:"23",stroke:"#9d8cff",strokeWidth:"2.4",strokeLinecap:"round",opacity:"0.4"})]})}),a.jsx("div",{style:{fontFamily:"var(--font-family-display)",fontWeight:700,fontSize:22,color:"var(--color-text)",letterSpacing:"-0.02em"},children:"No objectives yet"}),a.jsx("div",{style:{fontSize:14,color:"var(--color-text-tertiary)",maxWidth:440,lineHeight:1.55},children:"A roadmap is a board of outcomes you're driving toward. Author your first objective — the system computes progress, forecasts and slip for you."}),a.jsx("button",{onClick:r,className:"bd-chip",style:{marginTop:14,padding:"10px 18px",borderRadius:11,cursor:"pointer",background:"linear-gradient(150deg,#8b7bff,#6f5ce0)",color:"#fff",fontSize:13.5,fontWeight:600,border:"none",boxShadow:"0 8px 20px -6px rgba(123,104,238,0.8)"},children:"+ Create your first objective"})]})}function Qde({onClear:r}){return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,textAlign:"center",padding:40},children:[a.jsx("div",{style:{width:56,height:56,borderRadius:15,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22,color:"var(--color-text-tertiary)",marginBottom:8},children:"⌕"}),a.jsx("div",{style:{fontFamily:"var(--font-family-display)",fontWeight:700,fontSize:18,color:"var(--color-text)"},children:"No objectives match your filters"}),a.jsx("div",{style:{fontSize:13.5,color:"var(--color-text-tertiary)"},children:"Try clearing a status or the slipping filter."}),a.jsx("button",{onClick:r,className:"bd-chip",style:{marginTop:8,padding:"8px 15px",borderRadius:9,cursor:"pointer",background:"var(--color-accent-soft)",color:"var(--color-accent-text)",fontSize:12.5,fontWeight:600,border:"none"},children:"✕ Clear filters"})]})}function Jde(){return a.jsx("div",{style:{height:"100%",minHeight:0},children:a.jsx(Yde,{})})}const efe={order:{},collapsed:[]};function b_(r){const e={};if(r.order&&typeof r.order=="object"&&!Array.isArray(r.order))for(const[n,s]of Object.entries(r.order))Array.isArray(s)&&(e[n]=s.filter(o=>typeof o=="string"));const i=Array.isArray(r.collapsed)?r.collapsed.filter(n=>typeof n=="string"):[];return{order:e,collapsed:i}}function tfe(){const[r,e]=Fk("lab:prefs:v1",efe),i=R.useMemo(()=>b_(r),[r]),n=R.useRef(!1);R.useEffect(()=>{if(n.current)return;let d=!1;return ze.get("/lab-prefs").then(g=>{if(d)return;n.current=!0;const p=g.settings;p&&typeof p=="object"&&Object.keys(p).length>0&&e(b_(p))}).catch(()=>{n.current=!0}),()=>{d=!0}},[e]);const s=R.useRef(null),o=R.useCallback(d=>{n.current&&(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{ze.put("/lab-prefs",{settings:d}).catch(()=>{})},600))},[]),h=R.useCallback(d=>{e(g=>{const p=d(b_(g));return o(p),p})},[e,o]),l=R.useCallback(d=>{h(g=>({...g,collapsed:g.collapsed.includes(d)?g.collapsed.filter(p=>p!==d):[...g.collapsed,d]}))},[h]),u=R.useCallback((d,g)=>{h(p=>({...p,order:{...p.order,[d]:g}}))},[h]);return{prefs:i,toggleCollapsed:l,setGroupOrder:u}}function rfe(r){var s;const e=((s=r[0])==null?void 0:s.points)??[];if(e.length<2)return null;const i=e[e.length-2].v;return e[e.length-1].v-i}function i$({latest:r,unit:e,series:i}){const n=rfe(i),s=n===null?"var(--color-text-tertiary)":n>0?"var(--color-success)":n<0?"var(--color-error)":"var(--color-text-tertiary)",o=n!==null&&n>0?"+":"";return a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:10},children:[a.jsx("span",{style:{fontFamily:"var(--font-family-display)",fontWeight:700,fontSize:32,color:"var(--color-text)",letterSpacing:"-0.02em"},children:r!==null?r.toLocaleString():"—"}),e&&a.jsx("span",{style:{fontSize:14,color:"var(--color-text-tertiary)"},children:e}),n!==null&&a.jsxs("span",{style:{fontSize:13,fontWeight:600,color:s},children:[o,n.toLocaleString()]})]})}const fh=["#7b68ee","#0091ff","#ff5b36","#4ade80","#ffae3b"],Bd=560,Wi={top:12,right:12,bottom:24,left:12};function mC({series:r,unit:e=null,height:i=200}){const n=R.useRef(null),[s,o]=R.useState(null),h=Bd-Wi.left-Wi.right,l=i-Wi.top-Wi.bottom,{xKeys:u,xFor:d,yFor:g,polylines:p,hasData:m}=R.useMemo(()=>{const T=r.flatMap(U=>U.points),N=Array.from(new Set(T.map(U=>U.t))).sort(),j=new Map(N.map((U,$)=>[U,$])),A=T.map(U=>U.v),E=Math.min(...A,0),O=Math.max(...A,1)-E||1,D=U=>{const $=j.get(U)??0;return N.length<=1?Wi.left+h/2:Wi.left+$/(N.length-1)*h},G=U=>Wi.top+l-(U-E)/O*l,q=r.map((U,$)=>({name:U.name,color:fh[$%fh.length],path:U.points.map(F=>`${D(F.t)},${G(F.v)}`).join(" ")}));return{xKeys:N,xFor:D,yFor:G,polylines:q,hasData:T.length>0}},[r,h,l]);if(!m)return a.jsx("div",{style:{color:"var(--color-text-tertiary)",fontSize:13,padding:"24px 0"},children:"No data yet."});const y=T=>{const N=n.current;if(!N||u.length===0)return;const j=N.getBoundingClientRect();if(j.width===0)return;const E=((T.clientX-j.left)/j.width*Bd-Wi.left)/h,L=Math.round(E*(u.length-1));o(Math.max(0,Math.min(u.length-1,L)))},w=u[0],_=u[u.length-1],v=s!==null?u[s]??null:null,x=v!==null?d(v):null,C=v!==null?r.map((T,N)=>({name:T.name,color:fh[N%fh.length],point:T.points.find(j=>j.t===v)??null})):[],k=x!==null&&x>Bd/2;return a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("svg",{ref:n,viewBox:`0 0 ${Bd} ${i}`,width:"100%",height:i,role:"img","aria-label":"Line chart",style:{display:"block",touchAction:"pan-y"},onPointerMove:y,onPointerLeave:()=>o(null),children:[a.jsx("line",{x1:Wi.left,y1:Wi.top+l,x2:Wi.left+h,y2:Wi.top+l,stroke:"var(--color-border)",strokeWidth:1}),p.map(T=>a.jsx("polyline",{points:T.path,fill:"none",stroke:T.color,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"},T.name)),x!==null&&a.jsxs("g",{pointerEvents:"none",children:[a.jsx("line",{x1:x,y1:Wi.top,x2:x,y2:Wi.top+l,stroke:"var(--color-text-tertiary)",strokeWidth:1,strokeDasharray:"3 3"}),C.map(T=>T.point?a.jsx("circle",{cx:x,cy:g(T.point.v),r:4,fill:T.color,stroke:"var(--color-bg-secondary)",strokeWidth:2},T.name):null)]}),a.jsx("text",{x:Wi.left,y:i-4,fontSize:10,fill:"var(--color-text-tertiary)",children:w}),a.jsx("text",{x:Wi.left+h,y:i-4,fontSize:10,fill:"var(--color-text-tertiary)",textAnchor:"end",children:_})]}),x!==null&&v!==null&&a.jsxs("div",{style:{position:"absolute",top:8,left:`${x/Bd*100}%`,transform:k?"translateX(calc(-100% - 10px))":"translateX(10px)",pointerEvents:"none",zIndex:5,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border)",borderRadius:8,boxShadow:"var(--shadow-md)",padding:"7px 10px",minWidth:90,fontSize:12},children:[a.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10.5,color:"var(--color-text-tertiary)",marginBottom:4},children:v}),C.map(T=>a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[a.jsx("span",{style:{width:10,height:2,borderRadius:1,background:T.color,flexShrink:0}}),a.jsxs("span",{style:{fontWeight:700,color:"var(--color-text)",fontFamily:"var(--font-mono)"},children:[T.point?T.point.v.toLocaleString():"—",T.point&&e?` ${e}`:""]}),r.length>1&&a.jsx("span",{style:{color:"var(--color-text-secondary)",fontSize:11.5},children:T.name})]},T.name))]}),r.length>1&&a.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",marginTop:4},children:r.map((T,N)=>a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:5,fontSize:12,color:"var(--color-text-secondary)"},children:[a.jsx("span",{style:{width:9,height:9,borderRadius:3,background:fh[N%fh.length],display:"inline-block"}}),T.name]},T.name))})]})}const dB=["#7b68ee","#0091ff","#ff5b36","#4ade80","#ffae3b","#c8ccd9"];function ife(r,e,i,n,s){const o=p=>[r+i*Math.cos(p),e+i*Math.sin(p)],[h,l]=o(n),[u,d]=o(s),g=s-n>Math.PI?1:0;return`M ${r} ${e} L ${h} ${l} A ${i} ${i} 0 ${g} 1 ${u} ${d} Z`}function n$({series:r,size:e=140,unit:i=null}){const[n,s]=R.useState(null),o=e/2,h=e/2,l=e*.43,u=r.map(y=>({name:y.name,value:y.points.length>0?y.points[y.points.length-1].v:0})).filter(y=>y.value>0),d=u.reduce((y,w)=>y+w.value,0);if(u.length===0||d<=0)return a.jsx("div",{style:{color:"var(--color-text-tertiary)",fontSize:13,padding:"24px 0"},children:"No data yet."});let g=-Math.PI/2;const p=u.map((y,w)=>{const _=y.value/d,v=g,x=g+_*2*Math.PI;return g=x,{name:y.name,value:y.value,frac:_,d:ife(o,h,l,v,x),color:dB[w%dB.length]}}),m=p.find(y=>y.name===n)??null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsxs("div",{style:{position:"relative",flexShrink:0},children:[a.jsx("svg",{viewBox:`0 0 ${e} ${e}`,width:e,height:e,role:"img","aria-label":"Pie chart",children:p.map(y=>p.length===1?a.jsx("circle",{cx:o,cy:h,r:l,fill:y.color,stroke:"var(--color-bg)",strokeWidth:1,onPointerEnter:()=>s(y.name),onPointerLeave:()=>s(null)},y.name):a.jsx("path",{d:y.d,fill:y.color,stroke:"var(--color-bg)",strokeWidth:1,opacity:n===null||n===y.name?1:.45,style:{transition:"opacity 0.12s ease",cursor:"default"},onPointerEnter:()=>s(y.name),onPointerLeave:()=>s(null)},y.name))}),m&&a.jsxs("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translate(-50%, -100%)",pointerEvents:"none",zIndex:5,whiteSpace:"nowrap",background:"var(--color-bg-elevated)",border:"1px solid var(--color-border)",borderRadius:8,boxShadow:"var(--shadow-md)",padding:"6px 10px",fontSize:12},children:[a.jsxs("span",{style:{fontWeight:700,color:"var(--color-text)",fontFamily:"var(--font-mono)"},children:[m.value.toLocaleString(),i?` ${i}`:""]}),a.jsxs("span",{style:{color:"var(--color-text-secondary)",marginLeft:6},children:[m.name," · ",(m.frac*100).toFixed(1),"%"]})]})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:p.map(y=>a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12,color:n===y.name?"var(--color-text)":"var(--color-text-secondary)"},onPointerEnter:()=>s(y.name),onPointerLeave:()=>s(null),children:[a.jsx("span",{style:{width:9,height:9,borderRadius:3,background:y.color,display:"inline-block"}}),y.name," — ",(y.frac*100).toFixed(1),"%"]},y.name))})]})}function s$({series:r}){const[e,i]=R.useState("table");return a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8},children:[a.jsx("button",{onClick:()=>i("table"),style:{padding:"4px 10px",borderRadius:7,fontSize:12,fontWeight:600,cursor:"pointer",border:"1px solid var(--color-border)",background:e==="table"?"var(--color-accent-soft)":"transparent",color:e==="table"?"var(--color-accent)":"var(--color-text-secondary)"},children:"Table"}),a.jsx("button",{onClick:()=>i("json"),style:{padding:"4px 10px",borderRadius:7,fontSize:12,fontWeight:600,cursor:"pointer",border:"1px solid var(--color-border)",background:e==="json"?"var(--color-accent-soft)":"transparent",color:e==="json"?"var(--color-accent)":"var(--color-text-secondary)"},children:"JSON"})]}),e==="table"?a.jsx("div",{style:{maxHeight:220,overflow:"auto",border:"1px solid var(--color-border)",borderRadius:8},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12.5},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--color-bg-tertiary)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 10px"},children:"Series"}),a.jsx("th",{style:{textAlign:"left",padding:"6px 10px"},children:"Time"}),a.jsx("th",{style:{textAlign:"right",padding:"6px 10px"},children:"Value"})]})}),a.jsx("tbody",{children:r.flatMap(n=>n.points.map((s,o)=>a.jsxs("tr",{style:{borderTop:"1px solid var(--color-border)"},children:[a.jsx("td",{style:{padding:"5px 10px",color:"var(--color-text-secondary)"},children:n.name}),a.jsx("td",{style:{padding:"5px 10px"},children:s.t}),a.jsx("td",{style:{padding:"5px 10px",textAlign:"right",fontFamily:"var(--font-mono)"},children:s.v})]},`${n.name}-${s.t}-${o}`)))})]})}):a.jsx("pre",{style:{maxHeight:220,overflow:"auto",margin:0,padding:10,borderRadius:8,border:"1px solid var(--color-border)",background:"var(--color-bg-tertiary)",fontFamily:"var(--font-mono)",fontSize:11.5,color:"var(--color-text)"},children:JSON.stringify(r,null,2)})]})}function a$({tweaks:r,onSave:e,saving:i}){const[n,s]=R.useState(()=>{const h={};for(const l of r)h[l.key]=l.value??l.default??"";return h});if(r.length===0)return null;const o=(h,l)=>s(u=>({...u,[h]:l}));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[r.map(h=>a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5},children:[a.jsx("span",{style:{minWidth:90,color:"var(--color-text-secondary)"},children:h.label??h.key}),h.type==="enum"?a.jsx("select",{value:n[h.key]??"",onChange:l=>o(h.key,l.target.value),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--color-border)",background:"var(--color-bg)",color:"var(--color-text)",fontSize:12.5},children:(h.options??[]).map(l=>a.jsx("option",{value:l,children:l},l))}):h.type==="date"?a.jsx("input",{type:"date",value:n[h.key]??"",onChange:l=>o(h.key,l.target.value),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--color-border)",background:"var(--color-bg)",color:"var(--color-text)",fontSize:12.5}}):a.jsx("input",{type:"text",value:n[h.key]??"",onChange:l=>o(h.key,l.target.value),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--color-border)",background:"var(--color-bg)",color:"var(--color-text)",fontSize:12.5,flex:1}})]},h.key)),a.jsx("button",{onClick:()=>e(n),disabled:i,style:{alignSelf:"flex-start",padding:"5px 12px",borderRadius:7,fontSize:12,fontWeight:600,cursor:i?"default":"pointer",border:"none",background:"var(--color-accent)",color:"var(--color-accent-text)",opacity:i?.6:1},children:i?"Saving…":"Save"})]})}function nfe({summary:r}){if(r.error)return a.jsx("span",{className:"lab-badge lab-badge--error",title:r.error,children:"⚠ error"});if(!r.fetchedAt)return a.jsx("span",{className:"lab-badge lab-badge--muted",children:"never synced"});if(r.stale){const e=r.staleMinutes!==null?Math.round(r.staleMinutes/60):null;return a.jsxs("span",{className:"lab-badge lab-badge--stale",children:["stale",e!==null?` (${e}h)`:""]})}return a.jsx("span",{className:"lab-badge lab-badge--fresh",children:"fresh"})}function sfe({summary:r,onToast:e,onOpen:i,dragging:n=!1,dropTarget:s=!1,onDragStart:o,onDragOver:h,onDrop:l,onDragEnd:u}){var C;const[d,g]=R.useState(!1),p=KF(r.slug),m=VF(),y=XF(),w=(C=p.data)==null?void 0:C.cache,_=(w==null?void 0:w.series)??[],v=()=>{m.mutate(r.slug,{onSuccess:k=>{const T=k.results[0];(T==null?void 0:T.status)==="failed"?e(`${r.title}: sync failed — ${T.error??"unknown error"}`):e(`${r.title}: refreshed.`)},onError:k=>e(`${r.title}: refresh failed — ${k.message}`)})},x=k=>{y.mutate({slug:r.slug,tweaks:k},{onSuccess:()=>e(`${r.title}: tweaks saved.`),onError:T=>e(`${r.title}: could not save tweaks — ${T.message}`)})};return a.jsxs("div",{className:`lab-card lab-card--clickable${n?" lab-card--dragging":""}${s?" lab-card--drop-target":""}`,onClick:()=>i(r.slug),role:"button",tabIndex:0,onKeyDown:k=>{k.key==="Enter"&&i(r.slug)},title:"Open details, history & interactive chart",draggable:!0,onDragStart:o,onDragOver:h,onDrop:l,onDragEnd:u,children:[a.jsxs("div",{className:"lab-card-header",children:[a.jsxs("div",{className:"lab-card-title-row",children:[a.jsx("span",{className:"lab-card-title",children:r.title}),r.binding&&a.jsxs("span",{className:"lab-badge lab-badge--binding",title:`Feeds objective: ${r.binding.objective}`,children:["feeds ",r.binding.objective]})]}),a.jsxs("div",{className:"lab-card-actions",onClick:k=>k.stopPropagation(),children:[a.jsx(nfe,{summary:r}),a.jsx("button",{className:"lab-card-refresh",onClick:v,disabled:m.isPending,title:"Refresh this insight",children:m.isPending?"…":"↻"})]})]}),a.jsxs("div",{className:"lab-card-body",children:[r.render==="number"&&a.jsx(i$,{latest:r.latest,unit:r.unit,series:_}),r.render==="line"&&a.jsx(mC,{series:_,unit:r.unit}),r.render==="pie"&&a.jsx(n$,{series:_,unit:r.unit}),r.render==="raw"&&a.jsx("div",{onClick:k=>k.stopPropagation(),children:a.jsx(s$,{series:_})})]}),r.tweaks.length>0&&a.jsxs("div",{className:"lab-card-tweaks",onClick:k=>k.stopPropagation(),children:[a.jsx("button",{className:"lab-card-tweaks-toggle",onClick:()=>g(k=>!k),children:d?"Hide tweaks":"Edit tweaks"}),d&&a.jsx(a$,{tweaks:r.tweaks,saving:y.isPending,onSave:x})]})]})}function yC(r){const e=new Date(r);return Number.isNaN(e.getTime())?r:e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function afe(r){return r%1440===0?`${r/1440}d`:r%60===0?`${r/60}h`:`${r}m`}function ofe({summary:r}){if(r.error)return a.jsx("span",{className:"lab-badge lab-badge--error",title:r.error,children:"⚠ error"});if(!r.fetchedAt)return a.jsx("span",{className:"lab-badge lab-badge--muted",children:"never synced"});if(r.stale){const e=r.staleMinutes!==null?Math.round(r.staleMinutes/60):null;return a.jsxs("span",{className:"lab-badge lab-badge--stale",children:["stale",e!==null?` (${e}h)`:""]})}return a.jsx("span",{className:"lab-badge lab-badge--fresh",children:"fresh"})}function lfe({event:r,unit:e}){return a.jsxs("div",{className:"idp-history-row",children:[a.jsx("span",{className:`idp-history-dot idp-history-dot--${r.status}`}),a.jsx("span",{className:"idp-history-when",children:yC(r.at)}),r.status==="ok"?a.jsxs("span",{className:"idp-history-value",children:[r.latest!==null?r.latest.toLocaleString():"—",r.latest!==null&&e?` ${e}`:"",r.granularity&&a.jsx("span",{className:"idp-history-gran",children:r.granularity})]}):a.jsx("span",{className:"idp-history-error",title:r.error??void 0,children:r.error??"failed"})]})}function cfe({summary:r,onClose:e,onToast:i}){var v,x,C,k;const n=KF(r.slug),s=VF(),o=XF();R.useEffect(()=>{const T="insight-detail-panel";_k(T);const N=j=>{if(j.key!=="Escape"||!wk(T))return;const A=j.target;if(A&&(A.tagName==="INPUT"||A.tagName==="TEXTAREA"||A.tagName==="SELECT")){A.blur();return}j.preventDefault(),j.stopImmediatePropagation(),e()};return window.addEventListener("keydown",N,!0),()=>{window.removeEventListener("keydown",N,!0),Ck(T)}},[e]);const h=((v=n.data)==null?void 0:v.insight)??null,l=((x=n.data)==null?void 0:x.cache)??null,u=(l==null?void 0:l.series)??[],d=(((C=n.data)==null?void 0:C.meaning)??"").replace(/^##\s*Meaning\s*/i,"").trim(),g=((k=n.data)==null?void 0:k.resolvedTweaks)??{},p=Array.isArray(l==null?void 0:l.history)?[...l.history].reverse():[],m=()=>{s.mutate(r.slug,{onSuccess:T=>{const N=T.results[0];(N==null?void 0:N.status)==="failed"?i(`${r.title}: sync failed — ${N.error??"unknown error"}`):i(`${r.title}: refreshed.`)},onError:T=>i(`${r.title}: refresh failed — ${T.message}`)})},y=T=>{o.mutate({slug:r.slug,tweaks:T},{onSuccess:()=>i(`${r.title}: tweaks saved.`),onError:N=>i(`${r.title}: could not save tweaks — ${N.message}`)})},w=[];r.group&&w.push(["Group",r.group]),h!=null&&h.adapter&&w.push(["Source",h.adapter==="http"?`HTTP ${h.method??"GET"}`:"custom script"]),w.push(["Render",r.render]),r.unit&&w.push(["Unit",r.unit]),w.push(["Refresh TTL",afe(r.ttlMinutes)]),l!=null&&l.granularity&&w.push(["Granularity",l.granularity]),r.fetchedAt&&w.push(["Last synced",yC(r.fetchedAt)]),h&&h.credentials_used.length>0&&w.push(["Credentials",h.credentials_used.join(", ")]);const _=Object.entries(g);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"idp-overlay",onClick:e}),a.jsxs("div",{className:"idp-panel",role:"dialog","aria-modal":"true","aria-label":r.title,children:[a.jsxs("div",{className:"idp-head",children:[a.jsxs("div",{className:"idp-head-row",children:[a.jsx(ofe,{summary:r}),r.binding&&a.jsxs("span",{className:"lab-badge lab-badge--binding",title:`Feeds objective: ${r.binding.objective}`,children:["feeds ",r.binding.objective]}),a.jsx("span",{className:"idp-spacer"}),a.jsx("button",{className:"idp-refresh",onClick:m,disabled:s.isPending,title:"Refresh this insight",children:s.isPending?"Refreshing…":"↻ Refresh"}),a.jsx("span",{className:"idp-close",onClick:e,title:"Close (Esc)",children:"✕"})]}),a.jsx("div",{className:"idp-title",children:r.title}),a.jsx("div",{className:"idp-slug",children:r.slug}),(h==null?void 0:h.description)&&a.jsx("div",{className:"idp-desc",children:h.description})]}),a.jsxs("div",{className:"idp-body",children:[r.error&&a.jsxs("div",{className:"idp-error-banner",children:[a.jsx("span",{className:"idp-error-glyph",children:"⚠"}),a.jsxs("div",{children:[a.jsxs("div",{className:"idp-error-title",children:["Last sync failed",r.errorAt?` · ${yC(r.errorAt)}`:""]}),a.jsx("div",{className:"idp-error-sub",children:r.error})]})]}),n.isLoading?a.jsx("div",{className:"idp-loading",children:"Loading…"}):a.jsxs("div",{className:"idp-columns",children:[a.jsxs("div",{className:"idp-col-main",children:[a.jsxs("div",{className:"idp-chart",children:[r.render==="number"&&a.jsxs(a.Fragment,{children:[a.jsx(i$,{latest:r.latest,unit:r.unit,series:u}),u.some(T=>T.points.length>1)&&a.jsx("div",{className:"idp-chart-trend",children:a.jsx(mC,{series:u,unit:r.unit,height:280})})]}),r.render==="line"&&a.jsx(mC,{series:u,unit:r.unit,height:340}),r.render==="pie"&&a.jsx(n$,{series:u,size:240,unit:r.unit}),r.render==="raw"&&a.jsx(s$,{series:u})]}),d&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"idp-section-label",children:"Meaning"}),a.jsx("div",{className:"idp-meaning",children:d})]})]}),a.jsxs("div",{className:"idp-col-rail",children:[a.jsx("div",{className:"idp-section-label",children:"Details"}),a.jsxs("div",{className:"idp-details",children:[w.map(([T,N])=>a.jsxs("div",{className:"idp-detail-row",children:[a.jsx("span",{className:"idp-detail-label",children:T}),a.jsx("span",{className:"idp-detail-value",children:N})]},T)),_.length>0&&a.jsxs("div",{className:"idp-detail-row",children:[a.jsx("span",{className:"idp-detail-label",children:"Tweaks"}),a.jsx("span",{className:"idp-detail-value",children:_.map(([T,N])=>`${T}=${N}`).join(" · ")})]})]}),r.tweaks.length>0&&a.jsxs("div",{className:"idp-tweaks",children:[a.jsx("div",{className:"idp-section-label",children:"Edit tweaks"}),a.jsx(a$,{tweaks:r.tweaks,saving:o.isPending,onSave:y})]}),a.jsxs("div",{className:"idp-section-label",children:["Update history",p.length>0&&a.jsx("span",{className:"idp-history-count",children:p.length})]}),p.length===0?a.jsx("div",{className:"idp-history-empty",children:"No sync history yet — each refresh from now on is recorded here."}):a.jsx("div",{className:"idp-history",children:p.map((T,N)=>a.jsx(lfe,{event:T,unit:r.unit},`${T.at}-${N}`))})]})]})]})]})]})}function hfe(r,e,i){const n=i*.6,o=Math.max(6,Math.floor((e-i*2)/n));if(r.length<=o)return[r];const h=[];let l="";const u=(d,g)=>{const p=l?l+g+d:d;l&&p.length>o?(h.push(l),l=d):l=p};return r.split(" · ").forEach((d,g)=>{const p=g===0?"":" · ";d.length<=o?u(d,p):d.split(" ").forEach((m,y)=>u(m,y===0?p:" "))}),l&&h.push(l),h}function Cc({spec:r,className:e,size:i="full"}){const s=R.useId().replace(/[^a-zA-Z0-9_-]/g,""),o=`fd-node-${s}`,h=`fd-dot-${s}`,l=`fd-arrow-${s}`,u=i==="mini"?5:7;return a.jsx("div",{className:`fd fd--${i} ${e??""}`,role:"img","aria-label":r.ariaLabel,children:a.jsxs("svg",{viewBox:r.viewBox,preserveAspectRatio:"xMidYMid meet",className:"fd-svg",children:[a.jsxs("defs",{children:[a.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0",className:"fd-node-grad-a"}),a.jsx("stop",{offset:"1",className:"fd-node-grad-b"})]}),a.jsxs("radialGradient",{id:h,children:[a.jsx("stop",{offset:"0",className:"fd-dot-core"}),a.jsx("stop",{offset:"0.45",className:"fd-dot-mid"}),a.jsx("stop",{offset:"1",className:"fd-dot-edge"})]}),a.jsx("marker",{id:l,viewBox:"0 0 10 10",refX:"8.5",refY:"5",markerWidth:"6.5",markerHeight:"6.5",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:a.jsx("path",{d:"M0 1 L9 5 L0 9 z",className:"fd-arrowhead"})})]}),a.jsx("g",{className:"fd-wires",fill:"none",children:r.edges.map(d=>a.jsxs("g",{children:[a.jsx("path",{d:d.d,className:`fd-wire${d.dashed?" fd-wire--dashed":""}${d.thin?" fd-wire--thin":""}`,markerEnd:d.arrow?`url(#${l})`:void 0}),d.comet!==!1&&a.jsx("circle",{cx:"0",cy:"0",r:u,className:"fd-comet-dot",fill:`url(#${h})`,style:{offsetPath:`path('${d.d}')`,animationDelay:`${d.delay??0}s`,animationDuration:`${d.dur??2.6}s`}}),d.label&&a.jsx("text",{x:d.label.x,y:d.label.y,className:"fd-label",transform:d.label.rotate!==void 0?`rotate(${d.label.rotate} ${d.label.x} ${d.label.y})`:void 0,children:d.label.text})]},d.id))}),r.nodes.map(d=>{const g=d.x+d.w/2,p=d.y+d.h/2,m=d.sub==null?[]:Array.isArray(d.sub)?d.sub:d.glyph?[d.sub]:hfe(d.sub,d.w,i==="mini"?10:12),y=15,w=d.glyph?p+6:m.length?p-8-(m.length-1)*(y/2):p,_=d.glyph?d.y+d.h-16:w+22;return a.jsxs("g",{className:`fd-node fd-node--${d.variant??"plain"}${d.breathe?" fd-node--breathe":""}`,children:[a.jsx("rect",{x:d.x,y:d.y,width:d.w,height:d.h,rx:"14",fill:`url(#${o})`,style:d.breathe&&d.breatheDelay!==void 0?{animationDelay:`${d.breatheDelay}s`}:void 0}),d.glyph&&a.jsx("text",{x:g,y:d.y+26,className:"fd-region-glyph",children:d.glyph}),a.jsx("text",{x:g,y:w,className:"fd-node-title",children:d.title}),m.length>0&&a.jsx("text",{x:g,y:_,className:"fd-node-sub",children:m.map((v,x)=>a.jsx("tspan",{x:g,dy:x===0?0:y,children:v},x))})]},d.id)})]})})}const ufe=3,dfe=9;function fB(r,e,i,n){const s=r.w/2+n,o=r.h/2+n,h=e-r.cx,l=i-r.cy,u=h!==0?s/Math.abs(h):1/0,d=l!==0?o/Math.abs(l):1/0,g=Math.min(u,d);return[r.cx+h*g,r.cy+l*g]}function o$(r){return function(i,n,s=0){const o=r[i],h=r[n],[l,u]=fB(o,h.cx,h.cy,ufe),[d,g]=fB(h,o.cx,o.cy,dfe),p=(l+d)/2,m=(u+g)/2;let y=d-l,w=g-u;const _=Math.hypot(y,w)||1;y/=_,w/=_;const v=p+-w*s*_,x=m+y*s*_;return`M ${l.toFixed(1)} ${u.toFixed(1)} Q ${v.toFixed(1)} ${x.toFixed(1)} ${d.toFixed(1)} ${g.toFixed(1)}`}}const bC=120,vC=50,$k=[{id:"s1",x:20,y:44,title:"PostHog",sub:"product",delay:0},{id:"s2",x:20,y:158,title:"Stripe",sub:"revenue",delay:.4},{id:"s3",x:20,y:272,title:"HTTP · script",sub:"anything",delay:.8}],l$=[{id:"sync",x:209,y:156,w:134,h:100,title:"sync",sub:["↻ TTL-gated","rollup · cap"],variant:"rem"},{id:"cache",x:409,y:170,w:126,h:72,title:"insight",sub:"cached series",variant:"accent"},{id:"c1",x:550,y:114,w:140,h:56,title:"agents",sub:"session snapshot",variant:"agent"},{id:"c2",x:550,y:242,w:140,h:56,title:"roadmap KR",sub:"measured metric",variant:"agent"}],Pk={};for(const r of $k)Pk[r.id]={cx:r.x+bC/2,cy:r.y+vC/2,w:bC,h:vC};for(const r of l$)Pk[r.id]={cx:r.x+r.w/2,cy:r.y+r.h/2,w:r.w,h:r.h};const Cm=o$(Pk),ffe=$k.map((r,e)=>({id:`${r.id}-sync`,d:Cm(r.id,"sync"),arrow:!0,thin:!0,dur:2.4+e%3*.2,delay:e*.5%2.4})),pfe={viewBox:"0 0 700 366",ariaLabel:"External sources — a PostHog query, a Stripe number, any HTTP API or local script — converge into one sync, which rolls the raw data down to a capped curated series, caches it in the brain, and fans it out to every agent’s session snapshot and a bound roadmap Key Result.",nodes:[...$k.map(r=>({id:r.id,x:r.x,y:r.y,w:bC,h:vC,title:r.title,sub:r.sub,variant:"region",breathe:!0,breatheDelay:r.delay})),...l$],edges:[...ffe,{id:"sync-cache",d:Cm("sync","cache"),arrow:!0,dur:2.3,delay:.3},{id:"cache-c1",d:Cm("cache","c1",.06),arrow:!0,dur:2.2,delay:.9},{id:"cache-c2",d:Cm("cache","c2",-.06),arrow:!0,dur:2.2,delay:1.3}]};function gfe(){return a.jsxs("div",{className:"lab-stage",children:[a.jsx("span",{className:"lab-stage-tag",children:"Insights"}),a.jsx(Cc,{spec:pfe,className:"lab-stage-flow"})]})}function mfe(){return a.jsxs("div",{className:"lab-intro",children:[a.jsx("div",{className:"lab-intro-mark",children:a.jsx(ab,{size:40,glow:!0})}),a.jsx("p",{className:"lab-intro-kicker",children:"Insights"}),a.jsxs("h2",{className:"lab-intro-title",children:["The metrics that matter, ",a.jsx("span",{children:"live in the brain"}),"."]}),a.jsx("p",{className:"lab-intro-lead",children:"Insights are curated analytics — WAU, conversion, revenue — pulled from PostHog, Stripe, any HTTP API, or your own script. One sync rolls the raw data into a capped series, caches it here, and feeds it to every agent’s session snapshot and your bound roadmap Key Results. Not a BI tool — a metrics-delivery layer for agents."}),a.jsx(gfe,{}),a.jsx("p",{className:"lab-intro-scaffold",children:"Scaffold your first insight from the CLI:"}),a.jsx("code",{className:"lab-intro-cmd",children:'dreamcontext lab create <slug> --title "Weekly Active Users" --render number --adapter http'}),a.jsx("p",{className:"lab-intro-foot",children:"Insights is experimental. Sources sync on demand (TTL-gated); credentials stay gitignored and are never logged. Bind an insight to a roadmap objective to turn asserted targets into measured ones."})]})}const Vg="Ungrouped";function yfe(r){const e=new Map;for(const s of r){const o=s.group??Vg,h=e.get(o);h?h.push(s):e.set(o,[s])}const i=[...e.keys()].filter(s=>s!==Vg).sort();return(e.has(Vg)?[...i,Vg]:i).map(s=>[s,e.get(s)])}function bfe(r,e){if(!e||e.length===0)return r;const i=new Map(e.map((n,s)=>[n,s]));return r.map((n,s)=>({item:n,key:i.get(n.slug)??e.length+s})).sort((n,s)=>n.key-s.key).map(n=>n.item)}function vfe(){const{data:r,isLoading:e,isError:i,error:n}=Ik(),s=wde(),{prefs:o,toggleCollapsed:h,setGroupOrder:l}=tfe(),[u,d]=R.useState(null),[g,p]=R.useState(null),[m,y]=R.useState(null),[w,_]=R.useState(null);R.useEffect(()=>{if(!u)return;const N=setTimeout(()=>d(null),4200);return()=>clearTimeout(N)},[u]);const v=R.useMemo(()=>yfe(r??[]).map(([N,j])=>[N,bfe(j,o.order[N])]),[r,o.order]),x=g?(r??[]).find(N=>N.slug===g)??null:null,C=R.useCallback(()=>{y(null),_(null)},[]),k=R.useCallback((N,j,A)=>{if(!m||m.group!==N){C();return}const E=j.map(O=>O.slug).filter(O=>O!==m.slug),L=A===null?E.length:E.indexOf(A);E.splice(L===-1?E.length:L,0,m.slug),l(N,E),C()},[m,l,C]),T=()=>{s.mutate(!0,{onSuccess:N=>{if(N.failed.length>0){const j=N.failed.map(A=>A.slug).join(", ");d(`⚠ ${N.failed.length} of ${N.results.length} insight(s) failed: ${j}`)}else d(`Synced ${N.results.length} insight(s).`)},onError:N=>d(`Sync all failed: ${N.message}`)})};return e?a.jsx("div",{className:"lab-board",children:a.jsx("div",{className:"lab-board-loading",children:"Loading insights…"})}):i?a.jsx("div",{className:"lab-board",children:a.jsxs("div",{className:"error-state",children:["Failed to load insights. ",n==null?void 0:n.message]})}):!r||r.length===0?a.jsx("div",{className:"lab-board lab-board--empty",children:a.jsx(mfe,{})}):a.jsxs("div",{className:"lab-board",children:[a.jsx("div",{className:"lab-board-toolbar",children:a.jsx("button",{className:"lab-board-sync-all",onClick:T,disabled:s.isPending,children:s.isPending?"Syncing…":"Sync all"})}),a.jsx("div",{className:"lab-board-sections",children:v.map(([N,j])=>{const A=o.collapsed.includes(N);return a.jsxs("section",{className:"lab-board-section",children:[a.jsxs("button",{className:"lab-board-section-header",onClick:()=>h(N),"aria-expanded":!A,children:[a.jsx("svg",{className:`lab-board-section-chevron ${A?"":"lab-board-section-chevron--open"}`,width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:a.jsx("path",{d:"M3 2L7 5L3 8",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})}),a.jsx("span",{className:"lab-board-section-title",children:N}),a.jsx("span",{className:"lab-board-section-count",children:j.length})]}),!A&&a.jsx("div",{className:"lab-board-grid",onDragOver:E=>{(m==null?void 0:m.group)===N&&(E.preventDefault(),E.dataTransfer.dropEffect="move")},onDrop:E=>{(m==null?void 0:m.group)===N&&(E.preventDefault(),k(N,j,null))},children:j.map(E=>a.jsx(sfe,{summary:E,onToast:d,onOpen:p,dragging:(m==null?void 0:m.slug)===E.slug,dropTarget:w===E.slug&&(m==null?void 0:m.slug)!==E.slug,onDragStart:L=>{y({slug:E.slug,group:N});try{L.dataTransfer.effectAllowed="move"}catch{}},onDragOver:L=>{(m==null?void 0:m.group)===N&&(L.preventDefault(),L.dataTransfer.dropEffect="move",_(E.slug))},onDrop:L=>{(m==null?void 0:m.group)===N&&(L.preventDefault(),L.stopPropagation(),k(N,j,E.slug))},onDragEnd:C},E.slug))})]},N)})}),x&&a.jsx(cfe,{summary:x,onClose:()=>p(null),onToast:d}),u&&a.jsx("div",{className:"lab-toast",children:u})]})}function xfe(){return a.jsx("div",{style:{height:"100%",minHeight:0},children:a.jsx(vfe,{})})}function _fe(){return Zt({queryKey:["changelog"],queryFn:()=>ze.get("/changelog")})}const Cfe=25,wfe={task:{icon:kw,labelKey:"sleep.entity.task"},knowledge:{icon:Cw,labelKey:"sleep.entity.knowledge"},feature:{icon:ww,labelKey:"sleep.entity.feature"},core:{icon:Sw,labelKey:"sleep.entity.core"},sleep:{icon:qy,labelKey:"sleep.entity.sleep"}};function zk(r){if(!r)return"";const e=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(r);return e?`${e[1]} ${e[2]}`:r.slice(0,16)}function pB({entry:r}){const{t:e}=Fr();return a.jsxs("div",{className:"changelog-item",children:[a.jsxs("div",{className:"changelog-meta",children:[a.jsx("span",{className:"task-tag","data-hue":na(r.type),children:r.type}),r.scope&&a.jsx("span",{className:"changelog-scope",children:r.scope}),r.breaking&&a.jsx("span",{className:"changelog-breaking",children:e("sleep.changelog.breaking")})]}),a.jsx("p",{className:"changelog-summary",children:r.summary}),r.description&&a.jsx("p",{className:"changelog-desc",children:r.description})]})}function Yg({icon:r,count:e,label:i}){return a.jsxs("div",{className:"cloud-stat",children:[a.jsx("span",{className:"cloud-stat-icon",children:a.jsx(r,{size:16})}),a.jsx("span",{className:"cloud-stat-count",children:e}),a.jsx("span",{className:"cloud-stat-label",children:i})]})}function Xg({title:r,hint:e,count:i,children:n}){return a.jsxs("div",{className:"cloud-group",children:[a.jsxs("div",{className:"cloud-group-head",children:[a.jsx("h3",{className:"cloud-group-title",children:r}),a.jsx("span",{className:"cloud-group-count",children:i})]}),a.jsx("p",{className:"cloud-group-hint",children:e}),a.jsx("div",{className:"cloud-rows",children:n})]})}function kfe({session:r}){const{t:e}=Fr();return a.jsxs("div",{className:"cloud-row",children:[a.jsxs("div",{className:"cloud-row-meta",children:[a.jsx("span",{className:"cloud-row-time",children:zk(r.stopped_at)||e("sleep.cloud.active")}),r.score!==null&&a.jsxs("span",{className:"session-score",children:["+",r.score]}),r.change_count!==null&&a.jsxs("span",{className:"session-changes",children:[r.change_count," changes"]}),r.tool_count!=null&&a.jsxs("span",{className:"session-changes",children:[r.tool_count," tools"]})]}),r.last_assistant_message&&a.jsxs("p",{className:"cloud-row-text",children:[r.last_assistant_message.slice(0,160),r.last_assistant_message.length>160?"…":""]})]})}function Sfe({change:r}){const{t:e}=Fr(),i=wfe[r.entity],n=(i==null?void 0:i.icon)??qy;return a.jsxs("div",{className:"cloud-row",children:[a.jsxs("div",{className:"cloud-row-meta",children:[a.jsxs("span",{className:"cloud-entity",children:[a.jsx(n,{size:14}),i?e(i.labelKey):r.entity]}),a.jsx("span",{className:`cloud-action cloud-action--${r.action}`,children:r.action}),a.jsx("span",{className:"cloud-row-time",children:zk(r.timestamp)})]}),a.jsx("p",{className:"cloud-row-text",children:r.summary})]})}function Tfe(r){const e=[];for(const i of r){const n=e[e.length-1];n&&n.date===i.date?n.items.push(i):e.push({date:i.date,items:[i]})}return e}function Efe(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=Z6(),{data:o}=_fe();if(i||!e)return a.jsx("div",{className:"loading",children:r("common.loading")});if(n)return a.jsxs("div",{className:"error-state",children:["Failed to load sleep state. ",s==null?void 0:s.message]});const h=kle(e.debt),l=Y6(e.debt),u=X6(e.debt),d=e.last_sleep,g=(o==null?void 0:o.entries)??[],p=d?g.filter(N=>N.date>d):[],m=d?g.filter(N=>N.date<=d):g,y=m.slice(0,Cfe),w=Tfe(y),_=m.length-y.length,v=e.sessions,x=e.dashboard_changes,C=e.bookmarks??[],k=x.reduce((N,j)=>{var A;return(N[A=j.entity]??(N[A]=[])).push(j),N},{}),T=v.length+x.length+C.length+p.length;return a.jsxs("div",{className:"sleep-page",children:[a.jsxs("section",{className:`sleep-card sleep-card--${l}`,children:[a.jsxs("div",{className:"sleep-hero",children:[a.jsxs("div",{className:"sleep-hero-stage",children:[a.jsx("div",{className:"sleep-hero-aura","aria-hidden":!0}),a.jsx(oc,{mood:u,size:148})]}),a.jsxs("div",{className:"sleep-hero-body",children:[a.jsxs("div",{className:"sleep-hero-headline",children:[a.jsx("span",{className:"sleep-hero-level",children:h}),a.jsxs("span",{className:"sleep-hero-debt",children:[a.jsx("span",{className:"sleep-hero-debt-num",children:e.debt}),a.jsx("span",{className:"sleep-hero-debt-unit",children:r("sleep.debt")})]}),T>0&&a.jsxs("span",{className:"sleep-hero-cloud-count",children:[T," ",r(T===1?"sleep.cloud.item":"sleep.cloud.items")]})]}),a.jsx("p",{className:"sleep-hero-tagline",children:r(`sleep.tagline.${l}`)}),a.jsxs("div",{className:"sleep-hero-meta",children:[a.jsxs("div",{className:"sleep-hero-meta-item",children:[a.jsx("span",{className:"sleep-hero-meta-label",children:r("sleep.last_sleep")}),a.jsx("span",{className:"sleep-hero-meta-value",children:e.last_sleep??r("sleep.never")})]}),e.last_sleep_summary&&a.jsxs("div",{className:"sleep-hero-meta-item sleep-hero-meta-item--summary",children:[a.jsx("span",{className:"sleep-hero-meta-label",children:r("sleep.summary")}),a.jsx("span",{className:"sleep-hero-meta-value sleep-hero-meta-value--summary",children:e.last_sleep_summary.slice(0,220)})]})]})]})]}),T===0?a.jsx("div",{className:"sleep-cloud sleep-cloud--empty",children:a.jsxs("div",{className:"sleep-cloud-empty",children:[a.jsx("p",{className:"sleep-cloud-empty-title",children:r("sleep.cloud.empty.title")}),a.jsx("p",{className:"sleep-cloud-empty-sub",children:r("sleep.cloud.empty.sub")})]})}):a.jsxs("div",{className:"sleep-cloud",children:[a.jsxs("div",{className:"sleep-cloud-stats",children:[x.length>0&&a.jsx(Yg,{icon:kw,count:x.length,label:r("sleep.cloud.stat.dashboard")}),v.length>0&&a.jsx(Yg,{icon:Sw,count:v.length,label:r("sleep.cloud.stat.sessions")}),C.length>0&&a.jsx(Yg,{icon:qy,count:C.length,label:r("sleep.cloud.stat.highlights")}),p.length>0&&a.jsx(Yg,{icon:ww,count:p.length,label:r("sleep.cloud.stat.changelog")})]}),a.jsxs("div",{className:"sleep-cloud-body",children:[x.length>0&&a.jsx(Xg,{title:r("sleep.cloud.group.dashboard"),hint:r("sleep.cloud.group.dashboard.hint"),count:x.length,children:Object.entries(k).flatMap(([,N])=>N.map((j,A)=>a.jsx(Sfe,{change:j},`${j.entity}-${A}`)))}),v.length>0&&a.jsx(Xg,{title:r("sleep.cloud.group.sessions"),hint:r("sleep.cloud.group.sessions.hint"),count:v.length,children:v.map((N,j)=>a.jsx(kfe,{session:N},j))}),C.length>0&&a.jsx(Xg,{title:r("sleep.cloud.group.highlights"),hint:r("sleep.cloud.group.highlights.hint"),count:C.length,children:C.map(N=>a.jsxs("div",{className:"cloud-row",children:[a.jsxs("div",{className:"cloud-row-meta",children:[a.jsx("span",{className:"cloud-salience","data-salience":N.salience,children:"★".repeat(Math.max(1,Math.min(3,N.salience)))}),a.jsx("span",{className:"cloud-row-time",children:zk(N.created_at)})]}),a.jsx("p",{className:"cloud-row-text",children:N.text})]},N.id))}),p.length>0&&a.jsx(Xg,{title:r("sleep.cloud.group.changelog"),hint:r("sleep.cloud.group.changelog.hint"),count:p.length,children:p.map((N,j)=>a.jsx(pB,{entry:N},`p-${j}`))})]})]})]}),m.length>0&&a.jsxs("div",{className:"sleep-section",children:[a.jsxs("h2",{className:"sleep-section-title",children:[r("sleep.changelog")," (",m.length,")"]}),w.map(N=>a.jsxs("div",{className:"changelog-group",children:[a.jsx("h3",{className:"changelog-group-title changelog-group-title--day",children:N.date}),a.jsx("div",{className:"changelog-list",children:N.items.map((j,A)=>a.jsx(pB,{entry:j},`${N.date}-${A}`))})]},N.date)),_>0&&a.jsxs("p",{className:"changelog-more",children:[_," ",r("sleep.changelog.earlier")]})]})]})}const Nfe={feat:"type--feat",fix:"type--fix",refactor:"type--refactor",chore:"type--chore",docs:"type--docs",test:"type--test",perf:"type--perf"};function xC({type:r}){return a.jsx("span",{className:`json-type-badge ${Nfe[r]??""}`,children:r})}function _C(){return a.jsx("span",{className:"json-breaking-badge",children:"BREAKING"})}function Afe({data:r}){const[e,i]=R.useState("all"),[n,s]=R.useState(new Set),o=R.useMemo(()=>{const u=e==="all"?r:r.filter(g=>g.type===e),d=new Map;for(let g=0;g<u.length;g++){const p=u[g],m=d.get(p.date)||[];m.push({entry:p,index:g}),d.set(p.date,m)}return d},[r,e]),h=u=>{s(d=>{const g=new Set(d);return g.has(u)?g.delete(u):g.add(u),g})},l=R.useMemo(()=>{const u={};for(const d of r)u[d.type]=(u[d.type]||0)+1;return u},[r]);return a.jsxs("div",{className:"json-preview",children:[a.jsx("div",{className:"json-preview-header",children:a.jsxs("div",{className:"json-preview-stats",children:[a.jsxs("span",{className:"json-preview-total",children:[r.length," entries"]}),Object.entries(l).sort((u,d)=>d[1]-u[1]).map(([u,d])=>a.jsxs("button",{className:`json-stat-chip ${e===u?"json-stat-chip--active":""}`,onClick:()=>i(g=>g===u?"all":u),children:[a.jsx(xC,{type:u})," ",d]},u))]})}),a.jsx("div",{className:"json-timeline",children:Array.from(o.entries()).map(([u,d])=>a.jsxs("div",{className:"json-date-group",children:[a.jsxs("div",{className:"json-date-marker",children:[a.jsx("span",{className:"json-date-dot"}),a.jsx("span",{className:"json-date-label",children:u}),a.jsx("span",{className:"json-date-count",children:d.length})]}),a.jsx("div",{className:"json-date-entries",children:d.map(({entry:g,index:p})=>{const m=n.has(p),y=g.scope.length>50?g.scope.slice(0,47)+"...":g.scope;return a.jsxs("div",{className:`json-entry ${m?"json-entry--expanded":""}`,onClick:()=>h(p),children:[a.jsxs("div",{className:"json-entry-header",children:[a.jsx(xC,{type:g.type}),g.breaking&&a.jsx(_C,{}),a.jsx("span",{className:"json-entry-scope",title:g.scope,children:y})]}),a.jsx("div",{className:`json-entry-desc ${m?"":"json-entry-desc--clamped"}`,children:g.description})]},p)})})]},u))})]})}function jfe({data:r}){const[e,i]=R.useState(new Set([0])),n=s=>{i(o=>{const h=new Set(o);return h.has(s)?h.delete(s):h.add(s),h})};return a.jsxs("div",{className:"json-preview",children:[a.jsx("div",{className:"json-preview-header",children:a.jsxs("span",{className:"json-preview-total",children:[r.length," release",r.length!==1?"s":""]})}),a.jsx("div",{className:"json-releases",children:r.map((s,o)=>{var l,u,d,g;const h=e.has(o);return a.jsxs("div",{className:`json-release ${h?"json-release--expanded":""}`,children:[a.jsxs("div",{className:"json-release-header",onClick:()=>n(o),children:[a.jsx("span",{className:"json-release-version",children:s.version}),a.jsx("span",{className:"json-release-date",children:s.date}),s.breaking&&a.jsx(_C,{}),a.jsxs("span",{className:"json-release-meta",children:[(l=s.features)!=null&&l.length?`${s.features.length} features`:"",(u=s.features)!=null&&u.length&&((d=s.tasks)!=null&&d.length)?" / ":"",(g=s.tasks)!=null&&g.length?`${s.tasks.length} task${s.tasks.length!==1?"s":""}`:""]}),a.jsx("span",{className:`json-release-chevron ${h?"json-release-chevron--open":""}`,children:"▶"})]}),h&&a.jsxs("div",{className:"json-release-body",children:[a.jsx("div",{className:"json-release-summary",children:s.summary}),s.features&&s.features.length>0&&a.jsxs("div",{className:"json-release-section",children:[a.jsx("div",{className:"json-release-section-title",children:"Features"}),a.jsx("div",{className:"json-release-ids",children:s.features.map(p=>a.jsx("span",{className:"json-id-chip json-id-chip--feature",children:p},p))})]}),s.tasks&&s.tasks.length>0&&a.jsxs("div",{className:"json-release-section",children:[a.jsx("div",{className:"json-release-section-title",children:"Tasks"}),a.jsx("div",{className:"json-release-ids",children:s.tasks.map(p=>a.jsx("span",{className:"json-id-chip json-id-chip--task",children:p},p))})]}),s.changelog&&s.changelog.length>0&&a.jsxs("div",{className:"json-release-section",children:[a.jsxs("div",{className:"json-release-section-title",children:["Changelog (",s.changelog.length,")"]}),a.jsx("div",{className:"json-release-changelog",children:s.changelog.map((p,m)=>a.jsxs("div",{className:"json-release-cl-entry",children:[a.jsx(xC,{type:p.type}),p.breaking&&a.jsx(_C,{}),a.jsx("span",{className:"json-release-cl-scope",children:p.scope}),a.jsx("span",{className:"json-release-cl-desc",children:p.description})]},m))})]})]})]},s.version)})})]})}function Mfe({data:r,filename:e}){var s,o,h;if(!Array.isArray(r)||r.length===0)return a.jsx("div",{className:"json-preview",children:a.jsx("div",{className:"json-preview-empty",children:"No data found in this file."})});const i=e.toLowerCase().includes("changelog"),n=e.toLowerCase().includes("release");return i&&((s=r[0])!=null&&s.type)&&((o=r[0])!=null&&o.description)?a.jsx(Afe,{data:r}):n&&((h=r[0])!=null&&h.version)?a.jsx(jfe,{data:r}):a.jsxs("div",{className:"json-preview",children:[a.jsx("div",{className:"json-preview-header",children:a.jsxs("span",{className:"json-preview-total",children:[r.length," items"]})}),a.jsx("div",{className:"json-generic-list",children:r.map((l,u)=>a.jsx("pre",{className:"json-generic-item",children:JSON.stringify(l,null,2)},u))})]})}function Lfe(r){return r.endsWith(".sql")||r.endsWith(".json")||r.endsWith(".md")}function Bfe({onNavigateTaxonomy:r,focus:e}={}){var A,E;const{t:i}=Fr(),n=rr(),[s,o]=R.useState(null),[h,l]=R.useState(null),[u,d]=R.useState(!1),[g,p]=R.useState("preview");Tk(e,L=>{o(L),d(!1),p("preview")});const{data:m,isLoading:y,isError:w,error:_}=Zt({queryKey:["core"],queryFn:()=>ze.get("/core")}),v=s??((E=(A=m==null?void 0:m.files)==null?void 0:A[0])==null?void 0:E.filename)??null,{data:x}=Zt({queryKey:["core",v],queryFn:()=>ze.get(`/core/${v}`),enabled:!!v}),C=sr({mutationFn:({filename:L,content:O})=>ze.put(`/core/${L}`,{content:O}),onSuccess:()=>{n.invalidateQueries({queryKey:["core"]}),d(!1)}}),k=()=>{(x==null?void 0:x.content)!==void 0&&(l(x.content),d(!0))},T=()=>{v&&h!==null&&C.mutate({filename:v,content:h})};if(y)return a.jsx("div",{className:"loading",children:i("common.loading")});if(w)return a.jsxs("div",{className:"error-state",children:["Failed to load core files. ",_==null?void 0:_.message]});const N=(m==null?void 0:m.files)??[],j=()=>{if(!v||!x)return null;if(v==="taxonomy.json"&&r)return a.jsxs("div",{className:"core-taxonomy-link",children:[a.jsx("p",{className:"core-taxonomy-link-hint",children:"This file is managed by the Taxonomy system."}),a.jsx("button",{className:"btn btn--primary",onClick:r,children:"Open Taxonomy page"})]});if(g==="preview"){if(v.endsWith(".sql")&&x.content)return a.jsx(xk,{content:x.content});if(v.endsWith(".json")&&x.data)return a.jsx(Mfe,{data:x.data,filename:v});if(v.endsWith(".md")&&x.content)return a.jsx(Qf,{content:x.content,frontmatter:x.frontmatter})}return a.jsx("pre",{className:"core-viewer-content",children:x.content??JSON.stringify(x.data,null,2)})};return a.jsx("div",{className:"core-page",children:a.jsxs("div",{className:"core-layout",children:[a.jsx("div",{className:"core-list",children:N.map((L,O)=>a.jsxs("button",{className:`core-list-item ${v===L.filename?"core-list-item--active":""} animate-stagger animate-stagger-${Math.min(O+1,8)}`,onClick:()=>{o(L.filename),d(!1),p("preview")},children:[a.jsx("span",{className:"core-list-name",children:L.name}),a.jsx("span",{className:"core-list-type",children:L.type})]},L.filename))}),a.jsxs("div",{className:"core-detail",children:[!v&&a.jsx("div",{className:"core-empty",children:"Select a file to view."}),v&&x&&!u&&a.jsxs("div",{className:"core-viewer",children:[a.jsxs("div",{className:"core-viewer-header",children:[a.jsx("h2",{className:"core-viewer-title",children:x.filename}),a.jsxs("div",{className:"core-viewer-actions",children:[Lfe(v)&&a.jsxs("div",{className:"core-tabs",children:[a.jsx("button",{className:`core-tab ${g==="file"?"core-tab--active":""}`,onClick:()=>p("file"),children:"File"}),a.jsx("button",{className:`core-tab ${g==="preview"?"core-tab--active":""}`,onClick:()=>p("preview"),children:"Preview"})]}),x.type==="markdown"&&a.jsx("button",{className:"btn btn--ghost",onClick:k,children:"Edit"})]})]}),j()]}),v&&u&&a.jsxs("div",{className:"core-editor",children:[a.jsxs("div",{className:"core-editor-header",children:[a.jsxs("h2",{className:"core-viewer-title",children:["Editing: ",v]}),a.jsxs("div",{className:"core-editor-actions",children:[a.jsx("button",{className:"btn btn--ghost",onClick:()=>d(!1),children:"Cancel"}),a.jsx("button",{className:"btn btn--primary",onClick:T,disabled:C.isPending,children:C.isPending?"Saving...":"Save"})]})]}),a.jsxs("div",{className:"core-editor-split",children:[a.jsx("textarea",{className:"core-editor-textarea",value:h??"",onChange:L=>l(L.target.value)}),a.jsx("pre",{className:"core-editor-preview",children:h})]})]})]})]})})}const Rfe='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Ofe({label:r,actions:e,onClose:i,children:n}){const{t:s}=Fr(),o=R.useRef(null),h=R.useRef(i);return R.useEffect(()=>{h.current=i}),R.useEffect(()=>{const l=o.current;if(!l)return;const u=document.activeElement,d=document.body,g=d.style.overflow,p=d.style.paddingRight,m=window.innerWidth-document.documentElement.clientWidth;d.style.overflow="hidden",m>0&&(d.style.paddingRight=`${m}px`),l.focus();const y=w=>{if(w.key==="Escape"){w.stopPropagation(),h.current();return}if(w.key!=="Tab")return;const _=l.querySelectorAll(Rfe);if(_.length===0){w.preventDefault();return}const v=_[0],x=_[_.length-1],C=document.activeElement;!C||!l.contains(C)?(w.preventDefault(),(w.shiftKey?x:v).focus()):w.shiftKey&&(C===v||C===l)?(w.preventDefault(),x.focus()):!w.shiftKey&&C===x&&(w.preventDefault(),v.focus())};return document.addEventListener("keydown",y,!0),()=>{var w;document.removeEventListener("keydown",y,!0),d.style.overflow=g,d.style.paddingRight=p,(w=u==null?void 0:u.focus)==null||w.call(u)}},[]),a.jsxs("div",{ref:o,className:"fullscreen-overlay",role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[a.jsxs("div",{className:"fullscreen-overlay-header",children:[a.jsx("h2",{className:"fullscreen-overlay-title",children:r}),a.jsxs("div",{className:"fullscreen-overlay-actions",children:[e,a.jsx("button",{className:"fullscreen-overlay-close",onClick:i,title:s("common.close"),"aria-label":s("common.close"),children:"✕"})]})]}),a.jsx("div",{className:"fullscreen-overlay-body",children:n})]})}const Dfe={knowledge:["knowledge","feature"]};function gB(r){return r.path.replace(/^.*?knowledge\//,"").replace(/\.md$/,"")}function Ife(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mB({text:r,tokens:e}){if(!e.length||!r)return a.jsx(a.Fragment,{children:r});const i=new RegExp(`(${e.map(Ife).join("|")})`,"gi"),n=new Set(e.map(o=>o.toLowerCase())),s=r.split(i);return a.jsx(a.Fragment,{children:s.map((o,h)=>n.has(o.toLowerCase())?a.jsx("mark",{className:"bsearch-hl",children:o},h):a.jsx("span",{children:o},h))})}function Ffe({scope:r,placeholder:e,selectedSlug:i,onOpen:n,browse:s,detail:o,formatTitle:h}){const[l,u]=R.useState(""),[d,g]=R.useState(""),[p,m]=R.useState(!1),[y,w]=R.useState([]),[_,v]=R.useState("idle"),[x,C]=R.useState(""),[k,T]=R.useState("haiku"),[N,j]=R.useState(0),A=R.useRef(null),E=R.useMemo(()=>Dfe[r],[r]),L=l.trim(),O=L.length>0,D=!p;R.useEffect(()=>{const re=setTimeout(()=>g(L),110);return()=>clearTimeout(re)},[L]);const{data:G,isFetching:q}=hF(D?d:"",E,14),U=R.useMemo(()=>(G==null?void 0:G.hits)??[],[G]),$=p&&_==="done"&&x===L,F=p?$?y:[]:U,W=R.useMemo(()=>F.length?Math.max(...F.map(re=>re.rankScore||re.score||1)):1,[F]),Y=R.useMemo(()=>(p?x:L).toLowerCase().split(/\s+/).filter(Boolean),[p,x,L]),P=!O,K=p&&O&&_!=="thinking"&&!$,z=p&&_==="thinking",X=O&&(p?$:!0)&&F.length>0,ie=O&&(D&&!q&&U.length===0&&d===L||p&&$&&y.length===0),ee=R.useCallback(()=>{var re;try{(re=A.current)==null||re.focus()}catch{}},[]);R.useEffect(()=>{j(re=>Math.min(re,Math.max(0,F.length-1)))},[F.length]);const he=R.useCallback(async()=>{const re=L;if(re){v("thinking"),C(re),j(0);try{const ue=await dF(re,E);w(ue.hits),T(ue.mode)}catch{try{w(await uF(re,E,14))}catch{w([])}T("bm25")}v("done")}},[L,E]),fe=()=>{m(re=>(v("idle"),w([]),C(""),j(0),!re)),ee()},ne=()=>{u(""),g(""),v("idle"),w([]),C(""),j(0),ee()},I=re=>n({slug:gB(re),title:re.title,type:re.type}),Z=re=>{if(re.key==="Escape"){ne();return}if(re.key==="Enter"){if(p&&!$){re.preventDefault(),he();return}F[N]&&(re.preventDefault(),I(F[N]));return}F.length&&(re.key==="ArrowDown"?(re.preventDefault(),j(ue=>Math.min(ue+1,F.length-1))):re.key==="ArrowUp"&&(re.preventDefault(),j(ue=>Math.max(ue-1,0))))},J=re=>h?h(re):re.title;return a.jsxs("div",{className:"bsearch",children:[a.jsxs("div",{className:`bsearch-bar ${O?"bsearch-bar--active":""}`,children:[a.jsx("span",{className:"bsearch-bar-icon",children:a.jsx(Km,{size:16})}),a.jsx("input",{ref:A,className:"bsearch-input",placeholder:e,value:l,onChange:re=>{u(re.target.value),p&&v("idle")},onKeyDown:Z,spellCheck:!1,autoComplete:"off"}),D&&q&&O&&a.jsx("span",{className:"bsearch-spin","aria-hidden":"true"}),O&&a.jsx("button",{className:"bsearch-clear",onClick:ne,title:"Clear","aria-label":"Clear search",children:"×"}),a.jsxs("button",{className:`bsearch-intel ${p?"bsearch-intel--on":""}`,onClick:fe,title:p?"Intelligent search is on — reasons over your brain (uses tokens)":"Turn on intelligent search — intent-aware, beyond keywords",children:[a.jsx("span",{className:"bsearch-intel-dot"}),a.jsx(kh,{size:13,color:p?"#fff":"currentColor"}),"Intelligent"]})]}),a.jsxs("div",{className:"bsearch-layout",children:[a.jsxs("div",{className:"bsearch-list",children:[P&&s,K&&a.jsxs("button",{className:"bsearch-cta",onClick:()=>void he(),children:[a.jsx(kh,{size:15,color:"#fff"}),"Run intelligent search",a.jsx("kbd",{className:"bsearch-kbd",children:"↵"})]}),z&&a.jsxs("div",{className:"bsearch-thinking",children:[a.jsx("span",{className:"bsearch-thinking-spark",children:a.jsx(kh,{size:14,color:"currentColor"})}),"Reasoning over your ",r,"…",a.jsxs("div",{className:"bsearch-skel",children:[a.jsx("i",{}),a.jsx("i",{}),a.jsx("i",{})]})]}),X&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"bsearch-meta",children:[a.jsxs("span",{className:"bsearch-count",children:[F.length," ",F.length===1?"match":"matches"]}),a.jsx("span",{className:`bsearch-mode ${p?"bsearch-mode--intel":""}`,children:p?k==="haiku"?"intelligent":"bm25 fallback":"keyword"})]}),F.map((re,ue)=>{const Le=Math.round((re.rankScore||re.score||0)/W*100),Ze=(p?re.snippet:re.snippet||re.description)??"",qe=gB(re);return a.jsxs("button",{className:`bsearch-row ${i===qe?"bsearch-row--active":""} ${N===ue?"bsearch-row--focused":""}`,onClick:()=>I(re),onMouseEnter:()=>j(ue),children:[a.jsx("span",{className:"bsearch-row-icon",children:a.jsx(y1,{type:re.type,size:15})}),a.jsxs("span",{className:"bsearch-row-main",children:[a.jsx("span",{className:"bsearch-row-title",children:a.jsx(mB,{text:J(re),tokens:Y})}),Ze&&a.jsx("span",{className:"bsearch-row-snippet",children:a.jsx(mB,{text:Ze,tokens:Y})}),re.tags.length>0&&a.jsx("span",{className:"bsearch-row-tags",children:re.tags.slice(0,4).map(Ye=>a.jsx("span",{className:"task-tag","data-hue":na(Ye),children:Ye},Ye))})]}),a.jsx("span",{className:"bsearch-row-score",title:`relevance ${Le}%`,children:a.jsx("span",{className:"bsearch-score-track",children:a.jsx("i",{style:{width:`${Math.max(Le,6)}%`}})})})]},re.slug)})]}),ie&&a.jsxs("div",{className:"bsearch-empty",children:[a.jsx(Km,{size:22}),a.jsxs("p",{children:["No ",r," match “",L,"”."]}),!p&&a.jsxs("span",{children:["Try ",a.jsx("button",{className:"bsearch-empty-link",onClick:fe,children:"Intelligent search"})," for intent-aware matches."]})]})]}),a.jsx("div",{className:"bsearch-detail",children:o})]})]})}const $fe=/```sql\s*\n([\s\S]*?)```/gi;function Pfe(r,e){if(!r.startsWith("data-structures/"))return null;const i=[...e.matchAll($fe)].map(n=>n[1]);return i.length>0?i.join(`
512
512
 
513
- `):null}function zfe(r){return r.split(/[-_]/).map(e=>e&&e[0].toUpperCase()+e.slice(1)).join(" ")}function CC(r,e){if(!e)return r.name;if(Lf(r.slug)){const i=r.slug.lastIndexOf("/");return i>=0?r.slug.slice(i+1):r.slug}return r.name.startsWith(`${e}/`)?r.name.slice(e.length+1):r.name}function c$(r){return r.cards.length+r.folders.reduce((e,i)=>e+c$(i),0)}function qfe(r){const e=[],i={path:"",folders:[],cards:[]},n=new Map;for(const h of r){const l=h.slug.split("/");for(let u=1;u<l.length;u++){const d=l.slice(0,u).join("/");n.set(d,(n.get(d)??0)+1)}}const s=(h,l)=>{let u=h.folders.find(d=>d.name===l);if(!u){const d=h.path?`${h.path}/${l}`:l;u={name:l,path:d,label:zfe(l),folders:[],cards:[]},h.folders.push(u)}return u};for(const h of r){const l=h.slug.split("/"),u=l[l.length-1];let d=l.slice(0,-1);if(Lf(h.slug)&&d.length>0){const p=u.replace(/\.excalidraw$/,""),m=d.join("/");d[d.length-1]===p&&(n.get(m)??0)<=1&&(d=d.slice(0,-1))}if(d.length===0){e.push(h);continue}let g=i;for(const p of d)g=s(g,p);g.cards.push(h)}const o=h=>{h.folders.sort((l,u)=>l.label.localeCompare(u.label)),h.cards.sort((l,u)=>CC(l,h.path).localeCompare(CC(u,h.path))),h.folders.forEach(o)};return o(i),{roots:e,folders:i.folders}}function Hfe(r){const e=r.split("/"),i=[];for(let n=1;n<e.length;n++)i.push(e.slice(0,n).join("/"));return i}function Ufe({focus:r}={}){const{t:e}=Fr(),{data:i,isLoading:n,isError:s,error:o}=Cce(),h=Tce(),[l,u]=R.useState(null),[d,g]=R.useState("preview"),[p,m]=R.useState(new Set),[y,w]=R.useState(!1);Tk(r,D=>{u(D),g("preview"),m(G=>{const q=new Set(G);for(const U of Hfe(D))q.add(U);return q})});const{data:_}=wce(l??""),v=R.useMemo(()=>{var D;return(D=i==null?void 0:i.find(G=>G.slug===l))==null?void 0:D.mtime},[i,l]);Sce(l,v,_==null?void 0:_.mtime);const{roots:x,folders:C}=R.useMemo(()=>qfe(i??[]),[i]),k=D=>p.has(D),T=D=>{m(G=>{const q=new Set(G);return q.has(D)?q.delete(D):q.add(D),q})},N=(D,G=null)=>a.jsxs("button",{className:`knowledge-card ${l===D.slug?"knowledge-card--active":""}`,onClick:()=>{u(D.slug),g("preview")},children:[a.jsxs("div",{className:"knowledge-card-header",children:[a.jsxs("span",{className:"knowledge-card-title",children:[Lf(D.slug)&&a.jsx("span",{className:"knowledge-card-icon",title:"Diagram / sketch","aria-label":"Diagram",children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M12 20h9"}),a.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}),a.jsx("span",{className:"knowledge-card-name",children:CC(D,G)}),D.type==="feature"&&D.status&&a.jsx("span",{className:`knowledge-card-status knowledge-card-status--${D.status}`,children:D.status})]}),a.jsx("button",{className:`pin-btn ${D.pinned?"pin-btn--active":""}`,onClick:q=>{q.stopPropagation(),h.mutate({slug:D.slug,pinned:!D.pinned})},title:D.pinned?e("knowledge.unpin"):e("knowledge.pin"),children:D.pinned?"◆":"◇"})]}),D.description&&a.jsx("p",{className:"knowledge-card-desc",children:D.description}),a.jsx("div",{className:"knowledge-card-tags",children:D.tags.map(q=>a.jsx("span",{className:"task-tag","data-hue":na(q),children:q},q))})]},D.slug),j=D=>a.jsxs("div",{className:"knowledge-folder",children:[a.jsxs("button",{className:"knowledge-folder-header",onClick:()=>T(D.path),"aria-expanded":k(D.path),children:[a.jsx("span",{className:"knowledge-folder-chevron",children:k(D.path)?"▾":"▸"}),a.jsx("span",{className:"knowledge-folder-name",children:D.label}),a.jsx("span",{className:"knowledge-folder-count",children:c$(D)})]}),k(D.path)&&a.jsxs("div",{className:"knowledge-folder-items",children:[D.folders.map(j),D.cards.map(G=>N(G,D.path))]})]},D.path),A=()=>a.jsxs("div",{className:"core-tabs",children:[a.jsx("button",{className:`core-tab ${d==="file"?"core-tab--active":""}`,onClick:()=>g("file"),children:"File"}),a.jsx("button",{className:`core-tab ${d==="preview"?"core-tab--active":""}`,onClick:()=>g("preview"),children:"Preview"})]}),E=D=>{if(d==="preview"&&D.content){if(Lf(D.slug))return a.jsx(pF,{content:D.content,slug:D.slug});const G=Pfe(D.slug,D.content);return G?a.jsx(xk,{content:G}):a.jsx(Qf,{content:D.content})}return a.jsx("pre",{className:"core-viewer-content",children:D.content})};if(n)return a.jsx("div",{className:"loading",children:e("common.loading")});if(s)return a.jsxs("div",{className:"error-state",children:["Failed to load knowledge. ",o==null?void 0:o.message]});const L=a.jsxs(a.Fragment,{children:[(!i||i.length===0)&&a.jsx("div",{className:"core-empty",children:e("common.empty")}),C.map(j),x.map(D=>N(D))]}),O=a.jsxs(a.Fragment,{children:[!l&&a.jsxs("div",{className:"knowledge-detail-empty",children:[a.jsx("span",{className:"knowledge-detail-empty-icon","aria-hidden":"true",children:a.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 6.2C10.1 4.9 7.8 4.2 5 4.2c-.9 0-1.7.1-2.5.3v13c.8-.2 1.6-.3 2.5-.3 2.8 0 5.1.7 7 2"}),a.jsx("path",{d:"M12 6.2c1.9-1.3 4.2-2 7-2 .9 0 1.7.1 2.5.3v13c-.8-.2-1.6-.3-2.5-.3-2.8 0-5.1.7-7 2"}),a.jsx("line",{x1:"12",y1:"6.2",x2:"12",y2:"19.2"})]})}),a.jsx("p",{children:"Select a knowledge file, or search to recall across your brain."})]}),l&&!_&&a.jsx("div",{className:"core-empty",children:"Loading document…"}),l&&_&&a.jsxs("div",{className:"core-viewer",children:[a.jsxs("div",{className:"core-viewer-header",children:[a.jsx("h2",{className:"core-viewer-title",children:_.name}),a.jsxs("div",{className:"core-viewer-actions",children:[A(),a.jsx("button",{className:"core-expand-btn",onClick:()=>w(!0),title:e("knowledge.fullscreen"),"aria-label":e("knowledge.fullscreen"),children:"⛶"})]})]}),y?a.jsx(Ofe,{label:_.name,actions:A(),onClose:()=>w(!1),children:E(_)}):E(_)]})]});return a.jsx("div",{className:"knowledge-page",children:a.jsx(Ffe,{scope:"knowledge",placeholder:e("knowledge.search"),selectedSlug:l,onOpen:D=>{u(D.slug),g("preview")},browse:L,detail:O})})}function Wfe(){return Zt({queryKey:["graph"],queryFn:()=>ze.get("/graph"),staleTime:3e4})}const _h={filters:{search:"",showTags:!0,showOrphans:!0,showAttachments:!1,existingFilesOnly:!1},groups:[],display:{view:"2d",arrows:!1,textFadeThreshold:.85,nodeSize:.5,linkThickness:.5},forces:{centerStrength:.7,repelStrength:.35,linkStrength:.9,linkDistance:.35}};function Gfe(r){return{centerStrength:.05+r.centerStrength*.45,repelStrength:-(30+r.repelStrength*240),linkStrength:.1+r.linkStrength*1.2,linkDistance:20+r.linkDistance*180}}function Kfe(r){return{filters:{..._h.filters,...r.filters},groups:Array.isArray(r.groups)?r.groups:_h.groups,display:{..._h.display,...r.display},forces:{..._h.forces,...r.forces}}}function Vfe(){const[r,e]=Fk("brain:settings:v1",_h),i=R.useRef(!1);R.useEffect(()=>{if(i.current)return;let d=!1;return ze.get("/brain-settings").then(g=>{if(d)return;i.current=!0;const p=g.settings;p&&typeof p=="object"&&Object.keys(p).length>0&&e(Kfe(p))}).catch(()=>{i.current=!0}),()=>{d=!0}},[e]);const n=R.useRef(null),s=R.useCallback(d=>{i.current&&(n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{ze.put("/brain-settings",{settings:d}).catch(()=>{})},600))},[]),o=R.useCallback(d=>{e(g=>{const p=d(g);return s(p),p})},[e,s]),h=R.useCallback((d,g)=>{o(p=>({...p,[d]:{...p[d],...g}}))},[o]),l=R.useCallback(d=>{o(g=>({...g,groups:d}))},[o]),u=R.useCallback(()=>{o(()=>_h)},[o]);return{settings:r,patch:h,setGroups:l,reset:u}}function Yfe(r){const e=[];let i=0;for(;i<r.length;){const n=r[i];if(/\s/.test(n)){i++;continue}if(n==="("){e.push({type:"LPAREN"}),i++;continue}if(n===")"){e.push({type:"RPAREN"}),i++;continue}if(n==="-"&&i+1<r.length&&!/\s/.test(r[i+1])){e.push({type:"NOT"}),i++;continue}if(n==='"'){let l=i+1,u="";for(;l<r.length&&r[l]!=='"';)r[l]==="\\"&&l+1<r.length?(u+=r[l+1],l+=2):(u+=r[l],l++);e.push({type:"PHRASE",value:u}),i=l+1;continue}if(n==="/"){let l=i+1,u="";for(;l<r.length&&r[l]!=="/";)r[l]==="\\"&&l+1<r.length?(u+=r[l]+r[l+1],l+=2):(u+=r[l],l++);if(l<r.length){e.push({type:"REGEX",value:u}),i=l+1;continue}}let s=i;for(;s<r.length&&!/[\s()]/.test(r[s])&&r[s]!=='"';)s++;const o=r.slice(i,s),h=o.match(/^(tag|path|file|content):(.*)$/i);h?e.push({type:"OP",value:h[1].toLowerCase(),arg:h[2]}):o.toUpperCase()==="OR"?e.push({type:"OR"}):o.toUpperCase()==="AND"||o.length>0&&e.push({type:"WORD",value:o}),i=s}return e}class Xfe{constructor(e){Ut(this,"pos",0);this.tokens=e}parse(){return this.parseOr()}parseOr(){var i;let e=this.parseAnd();for(;((i=this.peek())==null?void 0:i.type)==="OR";){this.pos++;const n=this.parseAnd();e.type==="or"?e.children.push(n):e={type:"or",children:[e,n]}}return e}parseAnd(){var i,n;const e=[];for(;this.pos<this.tokens.length&&((i=this.peek())==null?void 0:i.type)!=="RPAREN"&&((n=this.peek())==null?void 0:n.type)!=="OR";){const s=this.parseTerm();s&&e.push(s)}return e.length===0?{type:"and",children:[]}:e.length===1?e[0]:{type:"and",children:e}}parseTerm(){var s;const e=this.peek();if(!e)return null;let i=!1;e.type==="NOT"&&(i=!0,this.pos++);const n=this.peek();if(!n)return null;if(n.type==="LPAREN"){this.pos++;const o=this.parseOr();return((s=this.peek())==null?void 0:s.type)==="RPAREN"&&this.pos++,i?h$(o):o}if(n.type==="WORD")return this.pos++,{type:"word",value:n.value.toLowerCase(),negated:i};if(n.type==="PHRASE")return this.pos++,{type:"phrase",value:n.value.toLowerCase(),negated:i};if(n.type==="REGEX"){this.pos++;try{return{type:"regex",value:new RegExp(n.value,"i"),negated:i}}catch{return null}}return n.type==="OP"?(this.pos++,{type:"op",op:n.value,arg:n.arg.toLowerCase(),negated:i}):(this.pos++,null)}peek(){return this.tokens[this.pos]}}function h$(r){return r.type==="and"||r.type==="or"?{...r,children:r.children.map(h$)}:{...r,negated:!r.negated}}function yB(r){const e=r.trim();if(!e)return{match:()=>!0,raw:"",isEmpty:!0};const i=Yfe(e),n=new Xfe(i).parse();return{match:s=>wC(n,s),raw:e,isEmpty:!1}}function wC(r,e){switch(r.type){case"and":return r.children.every(i=>wC(i,e));case"or":return r.children.some(i=>wC(i,e));case"word":return Zg(bB(e,r.value),r.negated);case"phrase":return Zg(bB(e,r.value),r.negated);case"regex":return Zg(Zfe(e,r.value),r.negated);case"op":return Zg(Qfe(e,r.op,r.arg),r.negated)}}function Zg(r,e){return e?!r:r}function u$(r){return[r.label,r.path,r.id,r.meta.description??"",...r.meta.tags??[]].join(" ").toLowerCase()}function bB(r,e){return u$(r).includes(e)}function Zfe(r,e){return e.test(u$(r))}function Qfe(r,e,i){var s;const n=i.toLowerCase();switch(e){case"path":return r.path.toLowerCase().includes(n);case"file":return(((s=r.path.split("/").pop())==null?void 0:s.toLowerCase())??r.label.toLowerCase()).includes(n);case"tag":{const o=n.replace(/^#/,"");return(r.meta.tags??[]).some(h=>h.toLowerCase()===o)||r.group==="tag"&&r.label.toLowerCase().replace(/^#/,"")===o}case"content":return(r.meta.description??"").toLowerCase().includes(n);default:return!1}}const Qg={filters:"Filters",groups:"Groups",display:"Display",forces:"Forces"},v_=["#10b981","#4fb3e6","#a78bfa","#f59e0b","#ef4444","#e11d74","#9ca3af","#eab308","#22d3ee","#f472b6"];function Jfe({settings:r,patch:e,setGroups:i,reset:n,onClose:s}){const[o,h]=R.useState({filters:!0,groups:!0,display:!0,forces:!0}),l=u=>h(d=>({...d,[u]:!d[u]}));return a.jsxs("aside",{className:"brain-settings",children:[a.jsxs("div",{className:"brain-settings-header",children:[a.jsx("span",{className:"brain-settings-title",children:"Graph settings"}),a.jsxs("div",{className:"brain-settings-header-actions",children:[a.jsx("button",{className:"brain-settings-mini-btn",onClick:n,title:"Restore default settings",children:"↻"}),a.jsx("button",{className:"brain-settings-mini-btn",onClick:s,title:"Close",children:"×"})]})]}),a.jsxs("div",{className:"brain-settings-body",children:[a.jsxs(Jg,{label:Qg.filters,open:o.filters,onToggle:()=>l("filters"),children:[a.jsx("label",{className:"brain-settings-label",children:"Search files"}),a.jsx("input",{type:"search",className:"brain-settings-input",placeholder:"Search…",value:r.filters.search,onChange:u=>e("filters",{search:u.target.value})}),a.jsxs("p",{className:"brain-settings-hint",children:["Operators: ",a.jsx("code",{children:"tag:"})," ",a.jsx("code",{children:"path:"})," ",a.jsx("code",{children:"file:"})," ",a.jsx("code",{children:"-not"})," ",a.jsx("code",{children:"OR"})," ",a.jsx("code",{children:'"phrase"'})," ",a.jsx("code",{children:"/regex/"})]}),a.jsx(Rd,{label:"Tags",checked:r.filters.showTags,onChange:u=>e("filters",{showTags:u})}),a.jsx(Rd,{label:"Attachments",checked:r.filters.showAttachments,onChange:u=>e("filters",{showAttachments:u})}),a.jsx(Rd,{label:"Existing files only",checked:r.filters.existingFilesOnly,onChange:u=>e("filters",{existingFilesOnly:u})}),a.jsx(Rd,{label:"Orphans",checked:r.filters.showOrphans,onChange:u=>e("filters",{showOrphans:u})})]}),a.jsx(Jg,{label:Qg.groups,open:o.groups,onToggle:()=>l("groups"),children:a.jsx(tpe,{groups:r.groups,onChange:i})}),a.jsxs(Jg,{label:Qg.display,open:o.display,onToggle:()=>l("display"),children:[a.jsx(epe,{label:"View",value:r.display.view==="3d"?"3d":"2d",options:[{value:"2d",label:"2D"},{value:"3d",label:"3D"}],onChange:u=>e("display",{view:u})}),a.jsx(Rd,{label:"Arrows",checked:r.display.arrows,onChange:u=>e("display",{arrows:u})}),a.jsx(Nl,{label:"Text fade threshold",value:r.display.textFadeThreshold,onChange:u=>e("display",{textFadeThreshold:u})}),a.jsx(Nl,{label:"Node size",value:r.display.nodeSize,onChange:u=>e("display",{nodeSize:u})}),a.jsx(Nl,{label:"Link thickness",value:r.display.linkThickness,onChange:u=>e("display",{linkThickness:u})})]}),a.jsxs(Jg,{label:Qg.forces,open:o.forces,onToggle:()=>l("forces"),children:[a.jsx(Nl,{label:"Center force",value:r.forces.centerStrength,onChange:u=>e("forces",{centerStrength:u})}),a.jsx(Nl,{label:"Repel force",value:r.forces.repelStrength,onChange:u=>e("forces",{repelStrength:u})}),a.jsx(Nl,{label:"Link force",value:r.forces.linkStrength,onChange:u=>e("forces",{linkStrength:u})}),a.jsx(Nl,{label:"Link distance",value:r.forces.linkDistance,onChange:u=>e("forces",{linkDistance:u})})]})]})]})}function Jg({label:r,open:e,onToggle:i,children:n}){return a.jsxs("div",{className:`brain-section ${e?"brain-section--open":""}`,children:[a.jsxs("button",{className:"brain-section-header",onClick:i,type:"button",children:[a.jsx("span",{className:"brain-section-caret",children:e?"▾":"▸"}),a.jsx("span",{children:r})]}),e&&a.jsx("div",{className:"brain-section-body",children:n})]})}function Rd({label:r,checked:e,onChange:i}){return a.jsxs("label",{className:"brain-toggle-row",children:[a.jsx("span",{children:r}),a.jsx("span",{className:`brain-toggle ${e?"brain-toggle--on":""}`,onClick:()=>i(!e),children:a.jsx("span",{className:"brain-toggle-knob"})})]})}function epe({label:r,value:e,options:i,onChange:n}){return a.jsxs("div",{className:"brain-segmented-row",children:[a.jsx("span",{className:"brain-segmented-label",children:r}),a.jsx("div",{className:"brain-segmented",role:"tablist",children:i.map(s=>a.jsx("button",{type:"button",role:"tab","aria-selected":e===s.value,className:`brain-segmented-btn ${e===s.value?"brain-segmented-btn--active":""}`,onClick:()=>n(s.value),children:s.label},s.value))})]})}function Nl({label:r,value:e,onChange:i}){return a.jsxs("label",{className:"brain-slider-row",children:[a.jsx("span",{className:"brain-slider-label-text",children:r}),a.jsx("input",{type:"range",min:0,max:1,step:.01,value:e,onChange:n=>i(parseFloat(n.target.value))})]})}function tpe({groups:r,onChange:e}){const[i,n]=R.useState(""),[s,o]=R.useState(null),h=()=>{const d=i.trim();if(!d)return;const g=`grp_${Math.random().toString(36).slice(2,8)}`;e([...r,{id:g,query:d,color:v_[r.length%v_.length]}]),n("")},l=(d,g)=>{e(r.map(p=>p.id===d?{...p,...g}:p))},u=d=>e(r.filter(g=>g.id!==d));return a.jsxs(a.Fragment,{children:[r.length===0&&a.jsxs("p",{className:"brain-settings-hint",children:["Color nodes that match a query. First matching group wins. Example:"," ",a.jsx("code",{children:"tag:#architecture"})]}),a.jsx("div",{className:"brain-groups-list",children:r.map(d=>a.jsxs("div",{className:"brain-group-row",children:[a.jsx("button",{className:"brain-group-color",style:{background:d.color},onClick:()=>o(s===d.id?null:d.id),title:"Pick color"}),a.jsx("input",{className:"brain-settings-input brain-group-input",value:d.query,onChange:g=>l(d.id,{query:g.target.value})}),a.jsx("button",{className:"brain-settings-mini-btn",onClick:()=>u(d.id),title:"Remove group",children:"×"}),s===d.id&&a.jsx("div",{className:"brain-swatch-picker",children:v_.map(g=>a.jsx("button",{className:"brain-swatch",style:{background:g},onClick:()=>{l(d.id,{color:g}),o(null)}},g))})]},d.id))}),a.jsxs("div",{className:"brain-group-add",children:[a.jsx("input",{className:"brain-settings-input",placeholder:"New group query…",value:i,onChange:d=>n(d.target.value),onKeyDown:d=>{d.key==="Enter"&&h()}}),a.jsx("button",{className:"brain-settings-btn",onClick:h,disabled:!i.trim(),children:"New group"})]})]})}function rpe(r){return Zt({queryKey:["graph","content",(r==null?void 0:r.path)??null],queryFn:()=>{if(!r||!r.path)throw new Error("No path for node");return ze.get(`/graph/content?path=${encodeURIComponent(r.path)}`)},enabled:!!(r&&r.path),staleTime:3e4})}const vB={soul:"#4fb3e6",user:"#4fb3e6",memory:"#4fb3e6",core:"#4fb3e6",feature:"#10b981",task:"#f59e0b",knowledge:"#a78bfa",release:"#e11d74",inbox:"#9ca3af",tag:"#10b981"},ipe={soul:"Soul",user:"User",memory:"Memory",core:"Core",feature:"Feature",task:"Task",knowledge:"Knowledge",release:"Release",inbox:"Inbox",tag:"Tag"},npe={related_feature:"feature",parent_task:"parent",release_includes:"released",sibling_core:"spine",has_tag:"tag"};function spe(r){return r==="task"?"tasks":r==="feature"||r==="knowledge"?"knowledge":r==="soul"||r==="user"||r==="memory"||r==="core"?"core":null}function ape(r,e){return r==="knowledge"&&e.path?e.path.replace(/^knowledge\//,"").replace(/\.md$/,""):e.id}function ope({node:r,onClose:e,onSelectRelated:i,relatedNodes:n,inDegree:s,totalDegree:o,onNavigate:h}){const l=!!(r!=null&&r.path),u=rpe(l?r:null);if(!r)return a.jsx("aside",{className:"brain-drawer"});const d=spe(r.group),g=u.data;return a.jsxs("aside",{className:"brain-drawer brain-drawer--open",children:[a.jsx("button",{className:"brain-drawer-close",onClick:e,"aria-label":"Close",children:"×"}),a.jsxs("div",{className:"brain-drawer-header",children:[a.jsxs("span",{className:"brain-drawer-group-badge",children:[a.jsx("span",{className:"brain-related-dot",style:{background:vB[r.group]}}),ipe[r.group]]}),a.jsx("h2",{className:"brain-drawer-title",children:r.label}),r.path&&a.jsx("span",{className:"brain-drawer-id",children:r.path})]}),a.jsxs("div",{className:"brain-drawer-body",children:[l&&u.isLoading&&a.jsx("p",{className:"brain-description",children:"Loading…"}),l&&u.error&&a.jsxs("p",{className:"brain-description",children:["Failed to load file: ",String(u.error)]}),(g==null?void 0:g.type)==="markdown"&&a.jsx(Qf,{content:g.content,frontmatter:g.frontmatter}),(g==null?void 0:g.type)==="json"&&a.jsx("pre",{className:"brain-codeblock",children:g.data!==void 0?JSON.stringify(g.data,null,2):g.raw??"(empty)"}),(g==null?void 0:g.type)==="text"&&a.jsx("pre",{className:"brain-codeblock",children:g.content}),!l&&r.group==="tag"&&a.jsxs("p",{className:"brain-description",children:["Tag ",a.jsxs("code",{children:["#",r.label.replace(/^#/,"")]})," — ",n.length," ",n.length===1?"file":"files"," reference this tag."]}),!l&&r.group!=="tag"&&a.jsx("p",{className:"brain-description",children:r.meta.description??"No file content."}),n.length>0&&a.jsxs("section",{className:"brain-drawer-section",children:[a.jsxs("h3",{className:"brain-drawer-section-title",children:["Connections (",n.length,") · in ",s," · total ",o]}),a.jsx("div",{className:"brain-related-list",children:n.map(({node:p,kind:m})=>a.jsxs("button",{className:"brain-related-item",onClick:()=>i(p.id),children:[a.jsx("span",{className:"brain-related-dot",style:{background:vB[p.group]}}),a.jsx("span",{children:p.label}),a.jsx("span",{className:"brain-related-kind",children:npe[m]??m})]},`${p.id}-${m}`))})]})]}),d&&h&&a.jsx("div",{className:"brain-drawer-footer",children:a.jsxs("button",{className:"brain-btn",onClick:()=>h(d,ape(d,r)),children:["Open in ",d.charAt(0).toUpperCase()+d.slice(1)," to edit →"]})})]})}const lpe=fF("BrainCanvas3D",()=>Xt(()=>import("./BrainCanvas3D-f5Y6PT-1.js"),__vite__mapDeps([56,54])).then(r=>({default:r.BrainCanvas3D}))),cpe={soul:"#4fb3e6",user:"#4fb3e6",memory:"#4fb3e6",core:"#4fb3e6",feature:"#10b981",task:"#f59e0b",knowledge:"#a78bfa",release:"#e11d74",inbox:"#9ca3af",tag:"#10b981"},hpe={soul:"#0d7bb8",user:"#0d7bb8",memory:"#0d7bb8",core:"#0d7bb8",feature:"#047857",task:"#b45309",knowledge:"#6d28d9",release:"#be185d",inbox:"#475569",tag:"#047857"};function xB(r){return typeof r=="string"?r:r.id}function d$(r){const e=r.group==="soul"?8:r.group==="user"||r.group==="memory"?6:r.group==="tag"?3:4,i=r.__inDegree??0;return e+Math.min(14,i*1.2)}function _B(r,e){return Math.sqrt(d$(r)*e)*3}function upe(r,e,i){for(const{group:n,parsed:s}of e)if(s.match(r))return n.color;return i[r.group]}function dpe({onNavigate:r}){const{data:e,isLoading:i,error:n}=Wfe(),s=rr(),{settings:o,patch:h,setGroups:l,reset:u}=Vfe(),{resolved:d}=Uf(),g=d==="dark",p=g?cpe:hpe,m=R.useRef(null),y=R.useRef(void 0),[w,_]=R.useState({w:0,h:0}),[v,x]=R.useState(null),[C,k]=R.useState(null),[T,N]=R.useState(!0),j=R.useRef(!1);R.useEffect(()=>{if(!m.current)return;const I=m.current,Z=()=>_({w:I.clientWidth,h:I.clientHeight});Z();const J=new ResizeObserver(Z);return J.observe(I),()=>J.disconnect()},[]);const A=R.useMemo(()=>yB(o.filters.search),[o.filters.search]),E=R.useMemo(()=>o.groups.map(I=>({group:I,parsed:yB(I.query)})).filter(({parsed:I})=>!I.isEmpty),[o.groups]),{filteredData:L,neighborsById:O,totalDegreeById:D,inDegreeById:G}=R.useMemo(()=>{if(!e)return{filteredData:{nodes:[],links:[]},neighborsById:new Map,totalDegreeById:new Map,inDegreeById:new Map};const I=new Map,Z=new Map;for(const qe of e.nodes)I.set(qe.id,0),Z.set(qe.id,0);for(const qe of e.links){const Ye=typeof qe.source=="string"?qe.source:qe.source.id,pe=typeof qe.target=="string"?qe.target:qe.target.id;I.set(pe,(I.get(pe)??0)+1),Z.set(Ye,(Z.get(Ye)??0)+1),Z.set(pe,(Z.get(pe)??0)+1)}const J=qe=>(Z.get(qe)??0)===0,re=[],ue=new Set;for(const qe of e.nodes){if(!o.filters.showTags&&qe.group==="tag"||!o.filters.showOrphans&&J(qe.id)||!A.isEmpty&&!A.match(qe))continue;const Ye={...qe};Ye.__inDegree=I.get(qe.id)??0,Ye.__totalDegree=Z.get(qe.id)??0,Ye.__color=upe(qe,E,p),re.push(Ye),ue.add(qe.id)}const Le=[],Ze=new Map;for(const qe of re)Ze.set(qe.id,new Set);for(const qe of e.links){const Ye=typeof qe.source=="string"?qe.source:qe.source.id,pe=typeof qe.target=="string"?qe.target:qe.target.id;!ue.has(Ye)||!ue.has(pe)||(Le.push({source:Ye,target:pe,kind:qe.kind}),Ze.get(Ye).add(pe),Ze.get(pe).add(Ye))}return{filteredData:{nodes:re,links:Le},neighborsById:Ze,totalDegreeById:Z,inDegreeById:I}},[e,o.filters,A,E]),q=R.useMemo(()=>Gfe(o.forces),[o.forces]),U=.4+o.display.nodeSize*2.2;R.useEffect(()=>{var ue,Le,Ze,qe,Ye,pe,Ne,de,Ue;const I=y.current;if(!I)return;const Z=(ue=I.d3Force)==null?void 0:ue.call(I,"charge");Z!=null&&Z.strength&&Z.strength(q.repelStrength),Z!=null&&Z.distanceMax&&Z.distanceMax(420);const J=(Le=I.d3Force)==null?void 0:Le.call(I,"link");J&&((Ze=J.strength)==null||Ze.call(J,q.linkStrength),(qe=J.distance)==null||qe.call(J,q.linkDistance));const re=(Ye=I.d3Force)==null?void 0:Ye.call(I,"center");re!=null&&re.strength&&re.strength(q.centerStrength),(pe=I.d3Force)==null||pe.call(I,"collide",LO().radius(at=>_B(at,U)+4).strength(.9).iterations(2)),(Ne=I.d3Force)==null||Ne.call(I,"x",BO(0).strength(q.centerStrength*.4)),(de=I.d3Force)==null||de.call(I,"y",RO(0).strength(q.centerStrength*.4)),(Ue=I.d3ReheatSimulation)==null||Ue.call(I)},[q,U,L]),R.useEffect(()=>{j.current=!1},[e==null?void 0:e.nodes.length]),R.useEffect(()=>{if(!e||!L.nodes.length)return;const I=[];return[800,1600,2600].forEach(Z=>{I.push(setTimeout(()=>{var re;if(j.current)return;const J=y.current;J&&((re=J.zoomToFit)==null||re.call(J,500,80),Z>=2600&&(j.current=!0))},Z))}),()=>I.forEach(clearTimeout)},[e,L.nodes.length]);const $=R.useMemo(()=>L.nodes.find(I=>I.id===v)??null,[L,v]),F=R.useMemo(()=>{if(!$||!e)return[];const I=[],Z=new Map(e.nodes.map(J=>[J.id,J]));for(const J of e.links){const re=typeof J.source=="string"?J.source:J.source.id,ue=typeof J.target=="string"?J.target:J.target.id;if(re===$.id){const Le=Z.get(ue);Le&&I.push({node:Le,kind:J.kind})}else if(ue===$.id){const Le=Z.get(re);Le&&I.push({node:Le,kind:J.kind})}}return I},[e,$]),W=I=>{x(I.id);const Z=y.current;Z&&typeof I.x=="number"&&typeof I.y=="number"&&(Z.centerAt(I.x,I.y,400),Z.zoom(Math.max(Z.zoom(),2.2),400))},Y=()=>s.invalidateQueries({queryKey:["graph"]});R.useEffect(()=>{const I=Z=>{var ue;if((ue=Z.target)!=null&&ue.matches("input,textarea"))return;const J=y.current;if(!J)return;const re=J.zoom();if(Z.key==="+"||Z.key==="=")J.zoom(re*1.2,200);else if(Z.key==="-"||Z.key==="_")J.zoom(re/1.2,200);else if(Z.key.startsWith("Arrow")){const Le=Z.shiftKey?120:40,Ze=J.centerAt();let qe=0,Ye=0;Z.key==="ArrowUp"?Ye=-Le:Z.key==="ArrowDown"?Ye=Le:Z.key==="ArrowLeft"?qe=-Le:Z.key==="ArrowRight"&&(qe=Le),J.centerAt(((Ze==null?void 0:Ze.x)??0)+qe/re,((Ze==null?void 0:Ze.y)??0)+Ye/re,150)}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]);const P=C??v,K=P?O.get(P)??new Set:null,z=I=>!P||I===P?!1:!(K!=null&&K.has(I)),X=I=>{const Z=I.__color??p[I.group];return z(I.id)?fpe(Z,g?.18:.3):Z},ie=I=>{const Z=xB(I.source),J=xB(I.target);return P?Z===P||J===P?g?"rgba(220, 225, 240, 0.85)":"rgba(30, 35, 50, 0.85)":g?"rgba(140, 150, 170, 0.07)":"rgba(60, 65, 80, 0.06)":g?"rgba(140, 150, 170, 0.35)":"rgba(60, 65, 80, 0.28)"},ee=.5+o.display.linkThickness*2.5,he=I=>I.kind==="sibling_core"||I.kind==="release_includes"?ee*1.3:ee,fe=I=>d$(I)*U,ne=(1-o.display.textFadeThreshold)*.8;return a.jsxs("div",{className:"brain-page",children:[a.jsxs("header",{className:"brain-header",children:[a.jsxs("h1",{className:"brain-title",children:[a.jsx("span",{className:"brain-title-mark",children:"◉"}),"Brain"]}),e&&a.jsxs("span",{className:"brain-stats",children:[L.nodes.length,"/",e.nodes.length," nodes · ",L.links.length," links"]}),a.jsxs("div",{className:"brain-header-actions",children:[a.jsx("button",{className:"brain-btn",onClick:Y,title:"Refresh",children:"↻"}),a.jsx("button",{className:`brain-btn ${T?"brain-btn--active":""}`,onClick:()=>N(I=>!I),title:"Graph settings",children:"⚙"})]})]}),a.jsxs("div",{className:"brain-canvas-wrap",ref:m,onPointerLeave:()=>k(null),onPointerDown:()=>k(null),children:[T&&a.jsx(Jfe,{settings:o,patch:h,setGroups:l,reset:u,onClose:()=>N(!1)}),i&&a.jsx("div",{className:"brain-loading",children:"Loading brain…"}),n&&a.jsxs("div",{className:"brain-empty",children:["Failed to load graph: ",String(n)]}),e&&L.nodes.length===0&&!i&&a.jsx("div",{className:"brain-empty",children:"No nodes match the current filters."}),e&&L.nodes.length>0&&w.w>0&&o.display.view!=="3d"&&a.jsx($y,{ref:y,graphData:L,width:w.w,height:w.h,backgroundColor:g?"#151518":"#ffffff",nodeId:"id",nodeLabel:I=>I.label,nodeColor:I=>X(I),nodeVal:I=>fe(I),nodeRelSize:3,linkColor:I=>ie(I),linkWidth:I=>he(I),linkDirectionalArrowLength:I=>o.display.arrows?3.5:0,linkDirectionalArrowRelPos:.94,linkDirectionalArrowColor:()=>g?"rgba(180, 185, 200, 0.6)":"rgba(60, 65, 80, 0.55)",onNodeClick:I=>W(I),onNodeHover:I=>k(I?I.id:null),onNodeDrag:()=>k(null),onZoom:()=>k(null),onBackgroundClick:()=>{x(null),k(null)},onEngineStop:()=>{var Z;if(j.current)return;const I=y.current;I&&((Z=I.zoomToFit)==null||Z.call(I,600,80),j.current=!0)},cooldownTicks:160,d3AlphaDecay:.025,d3VelocityDecay:.28,enableNodeDrag:!0,nodeCanvasObjectMode:()=>"after",nodeCanvasObject:(I,Z,J)=>{if(!(I.id===C||I.id===v||P&&(K==null?void 0:K.has(I.id)))&&J<ne)return;const ue=I.label,Le=Math.max(10,13/Math.max(J,.7));Z.font=`${Le}px -apple-system, BlinkMacSystemFont, 'Visby CF', sans-serif`,Z.textAlign="center",Z.textBaseline="top";const Ze=_B(I,U),qe=(I.y??0)+Ze+3,Ye=z(I.id);g?Z.fillStyle=Ye?"rgba(200, 210, 225, 0.3)":"rgba(235, 240, 250, 0.95)":Z.fillStyle=Ye?"rgba(60, 65, 80, 0.3)":"rgba(20, 24, 36, 0.92)",Z.fillText(ue,I.x??0,qe)}}),e&&L.nodes.length>0&&w.w>0&&o.display.view==="3d"&&a.jsx(R.Suspense,{fallback:a.jsx("div",{className:"brain-loading",children:"Loading 3D engine…"}),children:a.jsx(lpe,{graphData:L,width:w.w,height:w.h,isDark:g,nodeColor:X,nodeVal:fe,linkColor:ie,linkWidth:he,showArrows:o.display.arrows,forces:q,nodeSizeScale:U,isDimmed:z,neighborsById:O,onNodeClick:W,onNodeHover:I=>k(I?I.id:null),onBackgroundClick:()=>{x(null),k(null)}})}),a.jsx(ope,{node:$,onClose:()=>x(null),onSelectRelated:I=>x(I),relatedNodes:F,inDegree:$?G.get($.id)??0:0,totalDegree:$?D.get($.id)??0:0,onNavigate:r})]})]})}function fpe(r,e){const i=r.replace("#",""),n=parseInt(i,16),s=n>>16&255,o=n>>8&255,h=n&255;return`rgba(${s}, ${o}, ${h}, ${e})`}function ppe(){return Zt({queryKey:["council"],queryFn:()=>ze.get("/council"),select:r=>r.debates})}function gpe(r){return Zt({queryKey:["council",r],queryFn:()=>ze.get(`/council/${r}`),select:e=>e.debate,enabled:!!r})}function f$(r){if(!r)return null;const e=r.split(`
513
+ `):null}function zfe(r){return r.split(/[-_]/).map(e=>e&&e[0].toUpperCase()+e.slice(1)).join(" ")}function CC(r,e){if(!e)return r.name;if(Lf(r.slug)){const i=r.slug.lastIndexOf("/");return i>=0?r.slug.slice(i+1):r.slug}return r.name.startsWith(`${e}/`)?r.name.slice(e.length+1):r.name}function c$(r){return r.cards.length+r.folders.reduce((e,i)=>e+c$(i),0)}function qfe(r){const e=[],i={path:"",folders:[],cards:[]},n=new Map;for(const h of r){const l=h.slug.split("/");for(let u=1;u<l.length;u++){const d=l.slice(0,u).join("/");n.set(d,(n.get(d)??0)+1)}}const s=(h,l)=>{let u=h.folders.find(d=>d.name===l);if(!u){const d=h.path?`${h.path}/${l}`:l;u={name:l,path:d,label:zfe(l),folders:[],cards:[]},h.folders.push(u)}return u};for(const h of r){const l=h.slug.split("/"),u=l[l.length-1];let d=l.slice(0,-1);if(Lf(h.slug)&&d.length>0){const p=u.replace(/\.excalidraw$/,""),m=d.join("/");d[d.length-1]===p&&(n.get(m)??0)<=1&&(d=d.slice(0,-1))}if(d.length===0){e.push(h);continue}let g=i;for(const p of d)g=s(g,p);g.cards.push(h)}const o=h=>{h.folders.sort((l,u)=>l.label.localeCompare(u.label)),h.cards.sort((l,u)=>CC(l,h.path).localeCompare(CC(u,h.path))),h.folders.forEach(o)};return o(i),{roots:e,folders:i.folders}}function Hfe(r){const e=r.split("/"),i=[];for(let n=1;n<e.length;n++)i.push(e.slice(0,n).join("/"));return i}function Ufe({focus:r}={}){const{t:e}=Fr(),{data:i,isLoading:n,isError:s,error:o}=Cce(),h=Tce(),[l,u]=R.useState(null),[d,g]=R.useState("preview"),[p,m]=R.useState(new Set),[y,w]=R.useState(!1);Tk(r,D=>{u(D),g("preview"),m(G=>{const q=new Set(G);for(const U of Hfe(D))q.add(U);return q})});const{data:_}=wce(l??""),v=R.useMemo(()=>{var D;return(D=i==null?void 0:i.find(G=>G.slug===l))==null?void 0:D.mtime},[i,l]);Sce(l,v,_==null?void 0:_.mtime);const{roots:x,folders:C}=R.useMemo(()=>qfe(i??[]),[i]),k=D=>p.has(D),T=D=>{m(G=>{const q=new Set(G);return q.has(D)?q.delete(D):q.add(D),q})},N=(D,G=null)=>a.jsxs("button",{className:`knowledge-card ${l===D.slug?"knowledge-card--active":""}`,onClick:()=>{u(D.slug),g("preview")},children:[a.jsxs("div",{className:"knowledge-card-header",children:[a.jsxs("span",{className:"knowledge-card-title",children:[Lf(D.slug)&&a.jsx("span",{className:"knowledge-card-icon",title:"Diagram / sketch","aria-label":"Diagram",children:a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("path",{d:"M12 20h9"}),a.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}),a.jsx("span",{className:"knowledge-card-name",children:CC(D,G)}),D.type==="feature"&&D.status&&a.jsx("span",{className:`knowledge-card-status knowledge-card-status--${D.status}`,children:D.status})]}),a.jsx("button",{className:`pin-btn ${D.pinned?"pin-btn--active":""}`,onClick:q=>{q.stopPropagation(),h.mutate({slug:D.slug,pinned:!D.pinned})},title:D.pinned?e("knowledge.unpin"):e("knowledge.pin"),children:D.pinned?"◆":"◇"})]}),D.description&&a.jsx("p",{className:"knowledge-card-desc",children:D.description}),a.jsx("div",{className:"knowledge-card-tags",children:D.tags.map(q=>a.jsx("span",{className:"task-tag","data-hue":na(q),children:q},q))})]},D.slug),j=D=>a.jsxs("div",{className:"knowledge-folder",children:[a.jsxs("button",{className:"knowledge-folder-header",onClick:()=>T(D.path),"aria-expanded":k(D.path),children:[a.jsx("span",{className:"knowledge-folder-chevron",children:k(D.path)?"▾":"▸"}),a.jsx("span",{className:"knowledge-folder-name",children:D.label}),a.jsx("span",{className:"knowledge-folder-count",children:c$(D)})]}),k(D.path)&&a.jsxs("div",{className:"knowledge-folder-items",children:[D.folders.map(j),D.cards.map(G=>N(G,D.path))]})]},D.path),A=()=>a.jsxs("div",{className:"core-tabs",children:[a.jsx("button",{className:`core-tab ${d==="file"?"core-tab--active":""}`,onClick:()=>g("file"),children:"File"}),a.jsx("button",{className:`core-tab ${d==="preview"?"core-tab--active":""}`,onClick:()=>g("preview"),children:"Preview"})]}),E=D=>{if(d==="preview"&&D.content){if(Lf(D.slug))return a.jsx(pF,{content:D.content,slug:D.slug});const G=Pfe(D.slug,D.content);return G?a.jsx(xk,{content:G}):a.jsx(Qf,{content:D.content})}return a.jsx("pre",{className:"core-viewer-content",children:D.content})};if(n)return a.jsx("div",{className:"loading",children:e("common.loading")});if(s)return a.jsxs("div",{className:"error-state",children:["Failed to load knowledge. ",o==null?void 0:o.message]});const L=a.jsxs(a.Fragment,{children:[(!i||i.length===0)&&a.jsx("div",{className:"core-empty",children:e("common.empty")}),C.map(j),x.map(D=>N(D))]}),O=a.jsxs(a.Fragment,{children:[!l&&a.jsxs("div",{className:"knowledge-detail-empty",children:[a.jsx("span",{className:"knowledge-detail-empty-icon","aria-hidden":"true",children:a.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 6.2C10.1 4.9 7.8 4.2 5 4.2c-.9 0-1.7.1-2.5.3v13c.8-.2 1.6-.3 2.5-.3 2.8 0 5.1.7 7 2"}),a.jsx("path",{d:"M12 6.2c1.9-1.3 4.2-2 7-2 .9 0 1.7.1 2.5.3v13c-.8-.2-1.6-.3-2.5-.3-2.8 0-5.1.7-7 2"}),a.jsx("line",{x1:"12",y1:"6.2",x2:"12",y2:"19.2"})]})}),a.jsx("p",{children:"Select a knowledge file, or search to recall across your brain."})]}),l&&!_&&a.jsx("div",{className:"core-empty",children:"Loading document…"}),l&&_&&a.jsxs("div",{className:"core-viewer",children:[a.jsxs("div",{className:"core-viewer-header",children:[a.jsx("h2",{className:"core-viewer-title",children:_.name}),a.jsxs("div",{className:"core-viewer-actions",children:[A(),a.jsx("button",{className:"core-expand-btn",onClick:()=>w(!0),title:e("knowledge.fullscreen"),"aria-label":e("knowledge.fullscreen"),children:"⛶"})]})]}),y?a.jsx(Ofe,{label:_.name,actions:A(),onClose:()=>w(!1),children:E(_)}):E(_)]})]});return a.jsx("div",{className:"knowledge-page",children:a.jsx(Ffe,{scope:"knowledge",placeholder:e("knowledge.search"),selectedSlug:l,onOpen:D=>{u(D.slug),g("preview")},browse:L,detail:O})})}function Wfe(){return Zt({queryKey:["graph"],queryFn:()=>ze.get("/graph"),staleTime:3e4})}const _h={filters:{search:"",showTags:!0,showOrphans:!0,showAttachments:!1,existingFilesOnly:!1},groups:[],display:{view:"2d",arrows:!1,textFadeThreshold:.85,nodeSize:.5,linkThickness:.5},forces:{centerStrength:.7,repelStrength:.35,linkStrength:.9,linkDistance:.35}};function Gfe(r){return{centerStrength:.05+r.centerStrength*.45,repelStrength:-(30+r.repelStrength*240),linkStrength:.1+r.linkStrength*1.2,linkDistance:20+r.linkDistance*180}}function Kfe(r){return{filters:{..._h.filters,...r.filters},groups:Array.isArray(r.groups)?r.groups:_h.groups,display:{..._h.display,...r.display},forces:{..._h.forces,...r.forces}}}function Vfe(){const[r,e]=Fk("brain:settings:v1",_h),i=R.useRef(!1);R.useEffect(()=>{if(i.current)return;let d=!1;return ze.get("/brain-settings").then(g=>{if(d)return;i.current=!0;const p=g.settings;p&&typeof p=="object"&&Object.keys(p).length>0&&e(Kfe(p))}).catch(()=>{i.current=!0}),()=>{d=!0}},[e]);const n=R.useRef(null),s=R.useCallback(d=>{i.current&&(n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{ze.put("/brain-settings",{settings:d}).catch(()=>{})},600))},[]),o=R.useCallback(d=>{e(g=>{const p=d(g);return s(p),p})},[e,s]),h=R.useCallback((d,g)=>{o(p=>({...p,[d]:{...p[d],...g}}))},[o]),l=R.useCallback(d=>{o(g=>({...g,groups:d}))},[o]),u=R.useCallback(()=>{o(()=>_h)},[o]);return{settings:r,patch:h,setGroups:l,reset:u}}function Yfe(r){const e=[];let i=0;for(;i<r.length;){const n=r[i];if(/\s/.test(n)){i++;continue}if(n==="("){e.push({type:"LPAREN"}),i++;continue}if(n===")"){e.push({type:"RPAREN"}),i++;continue}if(n==="-"&&i+1<r.length&&!/\s/.test(r[i+1])){e.push({type:"NOT"}),i++;continue}if(n==='"'){let l=i+1,u="";for(;l<r.length&&r[l]!=='"';)r[l]==="\\"&&l+1<r.length?(u+=r[l+1],l+=2):(u+=r[l],l++);e.push({type:"PHRASE",value:u}),i=l+1;continue}if(n==="/"){let l=i+1,u="";for(;l<r.length&&r[l]!=="/";)r[l]==="\\"&&l+1<r.length?(u+=r[l]+r[l+1],l+=2):(u+=r[l],l++);if(l<r.length){e.push({type:"REGEX",value:u}),i=l+1;continue}}let s=i;for(;s<r.length&&!/[\s()]/.test(r[s])&&r[s]!=='"';)s++;const o=r.slice(i,s),h=o.match(/^(tag|path|file|content):(.*)$/i);h?e.push({type:"OP",value:h[1].toLowerCase(),arg:h[2]}):o.toUpperCase()==="OR"?e.push({type:"OR"}):o.toUpperCase()==="AND"||o.length>0&&e.push({type:"WORD",value:o}),i=s}return e}class Xfe{constructor(e){Ut(this,"pos",0);this.tokens=e}parse(){return this.parseOr()}parseOr(){var i;let e=this.parseAnd();for(;((i=this.peek())==null?void 0:i.type)==="OR";){this.pos++;const n=this.parseAnd();e.type==="or"?e.children.push(n):e={type:"or",children:[e,n]}}return e}parseAnd(){var i,n;const e=[];for(;this.pos<this.tokens.length&&((i=this.peek())==null?void 0:i.type)!=="RPAREN"&&((n=this.peek())==null?void 0:n.type)!=="OR";){const s=this.parseTerm();s&&e.push(s)}return e.length===0?{type:"and",children:[]}:e.length===1?e[0]:{type:"and",children:e}}parseTerm(){var s;const e=this.peek();if(!e)return null;let i=!1;e.type==="NOT"&&(i=!0,this.pos++);const n=this.peek();if(!n)return null;if(n.type==="LPAREN"){this.pos++;const o=this.parseOr();return((s=this.peek())==null?void 0:s.type)==="RPAREN"&&this.pos++,i?h$(o):o}if(n.type==="WORD")return this.pos++,{type:"word",value:n.value.toLowerCase(),negated:i};if(n.type==="PHRASE")return this.pos++,{type:"phrase",value:n.value.toLowerCase(),negated:i};if(n.type==="REGEX"){this.pos++;try{return{type:"regex",value:new RegExp(n.value,"i"),negated:i}}catch{return null}}return n.type==="OP"?(this.pos++,{type:"op",op:n.value,arg:n.arg.toLowerCase(),negated:i}):(this.pos++,null)}peek(){return this.tokens[this.pos]}}function h$(r){return r.type==="and"||r.type==="or"?{...r,children:r.children.map(h$)}:{...r,negated:!r.negated}}function yB(r){const e=r.trim();if(!e)return{match:()=>!0,raw:"",isEmpty:!0};const i=Yfe(e),n=new Xfe(i).parse();return{match:s=>wC(n,s),raw:e,isEmpty:!1}}function wC(r,e){switch(r.type){case"and":return r.children.every(i=>wC(i,e));case"or":return r.children.some(i=>wC(i,e));case"word":return Zg(bB(e,r.value),r.negated);case"phrase":return Zg(bB(e,r.value),r.negated);case"regex":return Zg(Zfe(e,r.value),r.negated);case"op":return Zg(Qfe(e,r.op,r.arg),r.negated)}}function Zg(r,e){return e?!r:r}function u$(r){return[r.label,r.path,r.id,r.meta.description??"",...r.meta.tags??[]].join(" ").toLowerCase()}function bB(r,e){return u$(r).includes(e)}function Zfe(r,e){return e.test(u$(r))}function Qfe(r,e,i){var s;const n=i.toLowerCase();switch(e){case"path":return r.path.toLowerCase().includes(n);case"file":return(((s=r.path.split("/").pop())==null?void 0:s.toLowerCase())??r.label.toLowerCase()).includes(n);case"tag":{const o=n.replace(/^#/,"");return(r.meta.tags??[]).some(h=>h.toLowerCase()===o)||r.group==="tag"&&r.label.toLowerCase().replace(/^#/,"")===o}case"content":return(r.meta.description??"").toLowerCase().includes(n);default:return!1}}const Qg={filters:"Filters",groups:"Groups",display:"Display",forces:"Forces"},v_=["#10b981","#4fb3e6","#a78bfa","#f59e0b","#ef4444","#e11d74","#9ca3af","#eab308","#22d3ee","#f472b6"];function Jfe({settings:r,patch:e,setGroups:i,reset:n,onClose:s}){const[o,h]=R.useState({filters:!0,groups:!0,display:!0,forces:!0}),l=u=>h(d=>({...d,[u]:!d[u]}));return a.jsxs("aside",{className:"brain-settings",children:[a.jsxs("div",{className:"brain-settings-header",children:[a.jsx("span",{className:"brain-settings-title",children:"Graph settings"}),a.jsxs("div",{className:"brain-settings-header-actions",children:[a.jsx("button",{className:"brain-settings-mini-btn",onClick:n,title:"Restore default settings",children:"↻"}),a.jsx("button",{className:"brain-settings-mini-btn",onClick:s,title:"Close",children:"×"})]})]}),a.jsxs("div",{className:"brain-settings-body",children:[a.jsxs(Jg,{label:Qg.filters,open:o.filters,onToggle:()=>l("filters"),children:[a.jsx("label",{className:"brain-settings-label",children:"Search files"}),a.jsx("input",{type:"search",className:"brain-settings-input",placeholder:"Search…",value:r.filters.search,onChange:u=>e("filters",{search:u.target.value})}),a.jsxs("p",{className:"brain-settings-hint",children:["Operators: ",a.jsx("code",{children:"tag:"})," ",a.jsx("code",{children:"path:"})," ",a.jsx("code",{children:"file:"})," ",a.jsx("code",{children:"-not"})," ",a.jsx("code",{children:"OR"})," ",a.jsx("code",{children:'"phrase"'})," ",a.jsx("code",{children:"/regex/"})]}),a.jsx(Rd,{label:"Tags",checked:r.filters.showTags,onChange:u=>e("filters",{showTags:u})}),a.jsx(Rd,{label:"Attachments",checked:r.filters.showAttachments,onChange:u=>e("filters",{showAttachments:u})}),a.jsx(Rd,{label:"Existing files only",checked:r.filters.existingFilesOnly,onChange:u=>e("filters",{existingFilesOnly:u})}),a.jsx(Rd,{label:"Orphans",checked:r.filters.showOrphans,onChange:u=>e("filters",{showOrphans:u})})]}),a.jsx(Jg,{label:Qg.groups,open:o.groups,onToggle:()=>l("groups"),children:a.jsx(tpe,{groups:r.groups,onChange:i})}),a.jsxs(Jg,{label:Qg.display,open:o.display,onToggle:()=>l("display"),children:[a.jsx(epe,{label:"View",value:r.display.view==="3d"?"3d":"2d",options:[{value:"2d",label:"2D"},{value:"3d",label:"3D"}],onChange:u=>e("display",{view:u})}),a.jsx(Rd,{label:"Arrows",checked:r.display.arrows,onChange:u=>e("display",{arrows:u})}),a.jsx(Nl,{label:"Text fade threshold",value:r.display.textFadeThreshold,onChange:u=>e("display",{textFadeThreshold:u})}),a.jsx(Nl,{label:"Node size",value:r.display.nodeSize,onChange:u=>e("display",{nodeSize:u})}),a.jsx(Nl,{label:"Link thickness",value:r.display.linkThickness,onChange:u=>e("display",{linkThickness:u})})]}),a.jsxs(Jg,{label:Qg.forces,open:o.forces,onToggle:()=>l("forces"),children:[a.jsx(Nl,{label:"Center force",value:r.forces.centerStrength,onChange:u=>e("forces",{centerStrength:u})}),a.jsx(Nl,{label:"Repel force",value:r.forces.repelStrength,onChange:u=>e("forces",{repelStrength:u})}),a.jsx(Nl,{label:"Link force",value:r.forces.linkStrength,onChange:u=>e("forces",{linkStrength:u})}),a.jsx(Nl,{label:"Link distance",value:r.forces.linkDistance,onChange:u=>e("forces",{linkDistance:u})})]})]})]})}function Jg({label:r,open:e,onToggle:i,children:n}){return a.jsxs("div",{className:`brain-section ${e?"brain-section--open":""}`,children:[a.jsxs("button",{className:"brain-section-header",onClick:i,type:"button",children:[a.jsx("span",{className:"brain-section-caret",children:e?"▾":"▸"}),a.jsx("span",{children:r})]}),e&&a.jsx("div",{className:"brain-section-body",children:n})]})}function Rd({label:r,checked:e,onChange:i}){return a.jsxs("label",{className:"brain-toggle-row",children:[a.jsx("span",{children:r}),a.jsx("span",{className:`brain-toggle ${e?"brain-toggle--on":""}`,onClick:()=>i(!e),children:a.jsx("span",{className:"brain-toggle-knob"})})]})}function epe({label:r,value:e,options:i,onChange:n}){return a.jsxs("div",{className:"brain-segmented-row",children:[a.jsx("span",{className:"brain-segmented-label",children:r}),a.jsx("div",{className:"brain-segmented",role:"tablist",children:i.map(s=>a.jsx("button",{type:"button",role:"tab","aria-selected":e===s.value,className:`brain-segmented-btn ${e===s.value?"brain-segmented-btn--active":""}`,onClick:()=>n(s.value),children:s.label},s.value))})]})}function Nl({label:r,value:e,onChange:i}){return a.jsxs("label",{className:"brain-slider-row",children:[a.jsx("span",{className:"brain-slider-label-text",children:r}),a.jsx("input",{type:"range",min:0,max:1,step:.01,value:e,onChange:n=>i(parseFloat(n.target.value))})]})}function tpe({groups:r,onChange:e}){const[i,n]=R.useState(""),[s,o]=R.useState(null),h=()=>{const d=i.trim();if(!d)return;const g=`grp_${Math.random().toString(36).slice(2,8)}`;e([...r,{id:g,query:d,color:v_[r.length%v_.length]}]),n("")},l=(d,g)=>{e(r.map(p=>p.id===d?{...p,...g}:p))},u=d=>e(r.filter(g=>g.id!==d));return a.jsxs(a.Fragment,{children:[r.length===0&&a.jsxs("p",{className:"brain-settings-hint",children:["Color nodes that match a query. First matching group wins. Example:"," ",a.jsx("code",{children:"tag:#architecture"})]}),a.jsx("div",{className:"brain-groups-list",children:r.map(d=>a.jsxs("div",{className:"brain-group-row",children:[a.jsx("button",{className:"brain-group-color",style:{background:d.color},onClick:()=>o(s===d.id?null:d.id),title:"Pick color"}),a.jsx("input",{className:"brain-settings-input brain-group-input",value:d.query,onChange:g=>l(d.id,{query:g.target.value})}),a.jsx("button",{className:"brain-settings-mini-btn",onClick:()=>u(d.id),title:"Remove group",children:"×"}),s===d.id&&a.jsx("div",{className:"brain-swatch-picker",children:v_.map(g=>a.jsx("button",{className:"brain-swatch",style:{background:g},onClick:()=>{l(d.id,{color:g}),o(null)}},g))})]},d.id))}),a.jsxs("div",{className:"brain-group-add",children:[a.jsx("input",{className:"brain-settings-input",placeholder:"New group query…",value:i,onChange:d=>n(d.target.value),onKeyDown:d=>{d.key==="Enter"&&h()}}),a.jsx("button",{className:"brain-settings-btn",onClick:h,disabled:!i.trim(),children:"New group"})]})]})}function rpe(r){return Zt({queryKey:["graph","content",(r==null?void 0:r.path)??null],queryFn:()=>{if(!r||!r.path)throw new Error("No path for node");return ze.get(`/graph/content?path=${encodeURIComponent(r.path)}`)},enabled:!!(r&&r.path),staleTime:3e4})}const vB={soul:"#4fb3e6",user:"#4fb3e6",memory:"#4fb3e6",core:"#4fb3e6",feature:"#10b981",task:"#f59e0b",knowledge:"#a78bfa",release:"#e11d74",inbox:"#9ca3af",tag:"#10b981"},ipe={soul:"Soul",user:"User",memory:"Memory",core:"Core",feature:"Feature",task:"Task",knowledge:"Knowledge",release:"Release",inbox:"Inbox",tag:"Tag"},npe={related_feature:"feature",parent_task:"parent",release_includes:"released",sibling_core:"spine",has_tag:"tag"};function spe(r){return r==="task"?"tasks":r==="feature"||r==="knowledge"?"knowledge":r==="soul"||r==="user"||r==="memory"||r==="core"?"core":null}function ape(r,e){return r==="knowledge"&&e.path?e.path.replace(/^knowledge\//,"").replace(/\.md$/,""):e.id}function ope({node:r,onClose:e,onSelectRelated:i,relatedNodes:n,inDegree:s,totalDegree:o,onNavigate:h}){const l=!!(r!=null&&r.path),u=rpe(l?r:null);if(!r)return a.jsx("aside",{className:"brain-drawer"});const d=spe(r.group),g=u.data;return a.jsxs("aside",{className:"brain-drawer brain-drawer--open",children:[a.jsx("button",{className:"brain-drawer-close",onClick:e,"aria-label":"Close",children:"×"}),a.jsxs("div",{className:"brain-drawer-header",children:[a.jsxs("span",{className:"brain-drawer-group-badge",children:[a.jsx("span",{className:"brain-related-dot",style:{background:vB[r.group]}}),ipe[r.group]]}),a.jsx("h2",{className:"brain-drawer-title",children:r.label}),r.path&&a.jsx("span",{className:"brain-drawer-id",children:r.path})]}),a.jsxs("div",{className:"brain-drawer-body",children:[l&&u.isLoading&&a.jsx("p",{className:"brain-description",children:"Loading…"}),l&&u.error&&a.jsxs("p",{className:"brain-description",children:["Failed to load file: ",String(u.error)]}),(g==null?void 0:g.type)==="markdown"&&a.jsx(Qf,{content:g.content,frontmatter:g.frontmatter}),(g==null?void 0:g.type)==="json"&&a.jsx("pre",{className:"brain-codeblock",children:g.data!==void 0?JSON.stringify(g.data,null,2):g.raw??"(empty)"}),(g==null?void 0:g.type)==="text"&&a.jsx("pre",{className:"brain-codeblock",children:g.content}),!l&&r.group==="tag"&&a.jsxs("p",{className:"brain-description",children:["Tag ",a.jsxs("code",{children:["#",r.label.replace(/^#/,"")]})," — ",n.length," ",n.length===1?"file":"files"," reference this tag."]}),!l&&r.group!=="tag"&&a.jsx("p",{className:"brain-description",children:r.meta.description??"No file content."}),n.length>0&&a.jsxs("section",{className:"brain-drawer-section",children:[a.jsxs("h3",{className:"brain-drawer-section-title",children:["Connections (",n.length,") · in ",s," · total ",o]}),a.jsx("div",{className:"brain-related-list",children:n.map(({node:p,kind:m})=>a.jsxs("button",{className:"brain-related-item",onClick:()=>i(p.id),children:[a.jsx("span",{className:"brain-related-dot",style:{background:vB[p.group]}}),a.jsx("span",{children:p.label}),a.jsx("span",{className:"brain-related-kind",children:npe[m]??m})]},`${p.id}-${m}`))})]})]}),d&&h&&a.jsx("div",{className:"brain-drawer-footer",children:a.jsxs("button",{className:"brain-btn",onClick:()=>h(d,ape(d,r)),children:["Open in ",d.charAt(0).toUpperCase()+d.slice(1)," to edit →"]})})]})}const lpe=fF("BrainCanvas3D",()=>Xt(()=>import("./BrainCanvas3D-C-h9U9EK.js"),__vite__mapDeps([56,54])).then(r=>({default:r.BrainCanvas3D}))),cpe={soul:"#4fb3e6",user:"#4fb3e6",memory:"#4fb3e6",core:"#4fb3e6",feature:"#10b981",task:"#f59e0b",knowledge:"#a78bfa",release:"#e11d74",inbox:"#9ca3af",tag:"#10b981"},hpe={soul:"#0d7bb8",user:"#0d7bb8",memory:"#0d7bb8",core:"#0d7bb8",feature:"#047857",task:"#b45309",knowledge:"#6d28d9",release:"#be185d",inbox:"#475569",tag:"#047857"};function xB(r){return typeof r=="string"?r:r.id}function d$(r){const e=r.group==="soul"?8:r.group==="user"||r.group==="memory"?6:r.group==="tag"?3:4,i=r.__inDegree??0;return e+Math.min(14,i*1.2)}function _B(r,e){return Math.sqrt(d$(r)*e)*3}function upe(r,e,i){for(const{group:n,parsed:s}of e)if(s.match(r))return n.color;return i[r.group]}function dpe({onNavigate:r}){const{data:e,isLoading:i,error:n}=Wfe(),s=rr(),{settings:o,patch:h,setGroups:l,reset:u}=Vfe(),{resolved:d}=Uf(),g=d==="dark",p=g?cpe:hpe,m=R.useRef(null),y=R.useRef(void 0),[w,_]=R.useState({w:0,h:0}),[v,x]=R.useState(null),[C,k]=R.useState(null),[T,N]=R.useState(!0),j=R.useRef(!1);R.useEffect(()=>{if(!m.current)return;const I=m.current,Z=()=>_({w:I.clientWidth,h:I.clientHeight});Z();const J=new ResizeObserver(Z);return J.observe(I),()=>J.disconnect()},[]);const A=R.useMemo(()=>yB(o.filters.search),[o.filters.search]),E=R.useMemo(()=>o.groups.map(I=>({group:I,parsed:yB(I.query)})).filter(({parsed:I})=>!I.isEmpty),[o.groups]),{filteredData:L,neighborsById:O,totalDegreeById:D,inDegreeById:G}=R.useMemo(()=>{if(!e)return{filteredData:{nodes:[],links:[]},neighborsById:new Map,totalDegreeById:new Map,inDegreeById:new Map};const I=new Map,Z=new Map;for(const qe of e.nodes)I.set(qe.id,0),Z.set(qe.id,0);for(const qe of e.links){const Ye=typeof qe.source=="string"?qe.source:qe.source.id,pe=typeof qe.target=="string"?qe.target:qe.target.id;I.set(pe,(I.get(pe)??0)+1),Z.set(Ye,(Z.get(Ye)??0)+1),Z.set(pe,(Z.get(pe)??0)+1)}const J=qe=>(Z.get(qe)??0)===0,re=[],ue=new Set;for(const qe of e.nodes){if(!o.filters.showTags&&qe.group==="tag"||!o.filters.showOrphans&&J(qe.id)||!A.isEmpty&&!A.match(qe))continue;const Ye={...qe};Ye.__inDegree=I.get(qe.id)??0,Ye.__totalDegree=Z.get(qe.id)??0,Ye.__color=upe(qe,E,p),re.push(Ye),ue.add(qe.id)}const Le=[],Ze=new Map;for(const qe of re)Ze.set(qe.id,new Set);for(const qe of e.links){const Ye=typeof qe.source=="string"?qe.source:qe.source.id,pe=typeof qe.target=="string"?qe.target:qe.target.id;!ue.has(Ye)||!ue.has(pe)||(Le.push({source:Ye,target:pe,kind:qe.kind}),Ze.get(Ye).add(pe),Ze.get(pe).add(Ye))}return{filteredData:{nodes:re,links:Le},neighborsById:Ze,totalDegreeById:Z,inDegreeById:I}},[e,o.filters,A,E]),q=R.useMemo(()=>Gfe(o.forces),[o.forces]),U=.4+o.display.nodeSize*2.2;R.useEffect(()=>{var ue,Le,Ze,qe,Ye,pe,Ne,de,Ue;const I=y.current;if(!I)return;const Z=(ue=I.d3Force)==null?void 0:ue.call(I,"charge");Z!=null&&Z.strength&&Z.strength(q.repelStrength),Z!=null&&Z.distanceMax&&Z.distanceMax(420);const J=(Le=I.d3Force)==null?void 0:Le.call(I,"link");J&&((Ze=J.strength)==null||Ze.call(J,q.linkStrength),(qe=J.distance)==null||qe.call(J,q.linkDistance));const re=(Ye=I.d3Force)==null?void 0:Ye.call(I,"center");re!=null&&re.strength&&re.strength(q.centerStrength),(pe=I.d3Force)==null||pe.call(I,"collide",LO().radius(at=>_B(at,U)+4).strength(.9).iterations(2)),(Ne=I.d3Force)==null||Ne.call(I,"x",BO(0).strength(q.centerStrength*.4)),(de=I.d3Force)==null||de.call(I,"y",RO(0).strength(q.centerStrength*.4)),(Ue=I.d3ReheatSimulation)==null||Ue.call(I)},[q,U,L]),R.useEffect(()=>{j.current=!1},[e==null?void 0:e.nodes.length]),R.useEffect(()=>{if(!e||!L.nodes.length)return;const I=[];return[800,1600,2600].forEach(Z=>{I.push(setTimeout(()=>{var re;if(j.current)return;const J=y.current;J&&((re=J.zoomToFit)==null||re.call(J,500,80),Z>=2600&&(j.current=!0))},Z))}),()=>I.forEach(clearTimeout)},[e,L.nodes.length]);const $=R.useMemo(()=>L.nodes.find(I=>I.id===v)??null,[L,v]),F=R.useMemo(()=>{if(!$||!e)return[];const I=[],Z=new Map(e.nodes.map(J=>[J.id,J]));for(const J of e.links){const re=typeof J.source=="string"?J.source:J.source.id,ue=typeof J.target=="string"?J.target:J.target.id;if(re===$.id){const Le=Z.get(ue);Le&&I.push({node:Le,kind:J.kind})}else if(ue===$.id){const Le=Z.get(re);Le&&I.push({node:Le,kind:J.kind})}}return I},[e,$]),W=I=>{x(I.id);const Z=y.current;Z&&typeof I.x=="number"&&typeof I.y=="number"&&(Z.centerAt(I.x,I.y,400),Z.zoom(Math.max(Z.zoom(),2.2),400))},Y=()=>s.invalidateQueries({queryKey:["graph"]});R.useEffect(()=>{const I=Z=>{var ue;if((ue=Z.target)!=null&&ue.matches("input,textarea"))return;const J=y.current;if(!J)return;const re=J.zoom();if(Z.key==="+"||Z.key==="=")J.zoom(re*1.2,200);else if(Z.key==="-"||Z.key==="_")J.zoom(re/1.2,200);else if(Z.key.startsWith("Arrow")){const Le=Z.shiftKey?120:40,Ze=J.centerAt();let qe=0,Ye=0;Z.key==="ArrowUp"?Ye=-Le:Z.key==="ArrowDown"?Ye=Le:Z.key==="ArrowLeft"?qe=-Le:Z.key==="ArrowRight"&&(qe=Le),J.centerAt(((Ze==null?void 0:Ze.x)??0)+qe/re,((Ze==null?void 0:Ze.y)??0)+Ye/re,150)}};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[]);const P=C??v,K=P?O.get(P)??new Set:null,z=I=>!P||I===P?!1:!(K!=null&&K.has(I)),X=I=>{const Z=I.__color??p[I.group];return z(I.id)?fpe(Z,g?.18:.3):Z},ie=I=>{const Z=xB(I.source),J=xB(I.target);return P?Z===P||J===P?g?"rgba(220, 225, 240, 0.85)":"rgba(30, 35, 50, 0.85)":g?"rgba(140, 150, 170, 0.07)":"rgba(60, 65, 80, 0.06)":g?"rgba(140, 150, 170, 0.35)":"rgba(60, 65, 80, 0.28)"},ee=.5+o.display.linkThickness*2.5,he=I=>I.kind==="sibling_core"||I.kind==="release_includes"?ee*1.3:ee,fe=I=>d$(I)*U,ne=(1-o.display.textFadeThreshold)*.8;return a.jsxs("div",{className:"brain-page",children:[a.jsxs("header",{className:"brain-header",children:[a.jsxs("h1",{className:"brain-title",children:[a.jsx("span",{className:"brain-title-mark",children:"◉"}),"Brain"]}),e&&a.jsxs("span",{className:"brain-stats",children:[L.nodes.length,"/",e.nodes.length," nodes · ",L.links.length," links"]}),a.jsxs("div",{className:"brain-header-actions",children:[a.jsx("button",{className:"brain-btn",onClick:Y,title:"Refresh",children:"↻"}),a.jsx("button",{className:`brain-btn ${T?"brain-btn--active":""}`,onClick:()=>N(I=>!I),title:"Graph settings",children:"⚙"})]})]}),a.jsxs("div",{className:"brain-canvas-wrap",ref:m,onPointerLeave:()=>k(null),onPointerDown:()=>k(null),children:[T&&a.jsx(Jfe,{settings:o,patch:h,setGroups:l,reset:u,onClose:()=>N(!1)}),i&&a.jsx("div",{className:"brain-loading",children:"Loading brain…"}),n&&a.jsxs("div",{className:"brain-empty",children:["Failed to load graph: ",String(n)]}),e&&L.nodes.length===0&&!i&&a.jsx("div",{className:"brain-empty",children:"No nodes match the current filters."}),e&&L.nodes.length>0&&w.w>0&&o.display.view!=="3d"&&a.jsx($y,{ref:y,graphData:L,width:w.w,height:w.h,backgroundColor:g?"#151518":"#ffffff",nodeId:"id",nodeLabel:I=>I.label,nodeColor:I=>X(I),nodeVal:I=>fe(I),nodeRelSize:3,linkColor:I=>ie(I),linkWidth:I=>he(I),linkDirectionalArrowLength:I=>o.display.arrows?3.5:0,linkDirectionalArrowRelPos:.94,linkDirectionalArrowColor:()=>g?"rgba(180, 185, 200, 0.6)":"rgba(60, 65, 80, 0.55)",onNodeClick:I=>W(I),onNodeHover:I=>k(I?I.id:null),onNodeDrag:()=>k(null),onZoom:()=>k(null),onBackgroundClick:()=>{x(null),k(null)},onEngineStop:()=>{var Z;if(j.current)return;const I=y.current;I&&((Z=I.zoomToFit)==null||Z.call(I,600,80),j.current=!0)},cooldownTicks:160,d3AlphaDecay:.025,d3VelocityDecay:.28,enableNodeDrag:!0,nodeCanvasObjectMode:()=>"after",nodeCanvasObject:(I,Z,J)=>{if(!(I.id===C||I.id===v||P&&(K==null?void 0:K.has(I.id)))&&J<ne)return;const ue=I.label,Le=Math.max(10,13/Math.max(J,.7));Z.font=`${Le}px -apple-system, BlinkMacSystemFont, 'Visby CF', sans-serif`,Z.textAlign="center",Z.textBaseline="top";const Ze=_B(I,U),qe=(I.y??0)+Ze+3,Ye=z(I.id);g?Z.fillStyle=Ye?"rgba(200, 210, 225, 0.3)":"rgba(235, 240, 250, 0.95)":Z.fillStyle=Ye?"rgba(60, 65, 80, 0.3)":"rgba(20, 24, 36, 0.92)",Z.fillText(ue,I.x??0,qe)}}),e&&L.nodes.length>0&&w.w>0&&o.display.view==="3d"&&a.jsx(R.Suspense,{fallback:a.jsx("div",{className:"brain-loading",children:"Loading 3D engine…"}),children:a.jsx(lpe,{graphData:L,width:w.w,height:w.h,isDark:g,nodeColor:X,nodeVal:fe,linkColor:ie,linkWidth:he,showArrows:o.display.arrows,forces:q,nodeSizeScale:U,isDimmed:z,neighborsById:O,onNodeClick:W,onNodeHover:I=>k(I?I.id:null),onBackgroundClick:()=>{x(null),k(null)}})}),a.jsx(ope,{node:$,onClose:()=>x(null),onSelectRelated:I=>x(I),relatedNodes:F,inDegree:$?G.get($.id)??0:0,totalDegree:$?D.get($.id)??0:0,onNavigate:r})]})]})}function fpe(r,e){const i=r.replace("#",""),n=parseInt(i,16),s=n>>16&255,o=n>>8&255,h=n&255;return`rgba(${s}, ${o}, ${h}, ${e})`}function ppe(){return Zt({queryKey:["council"],queryFn:()=>ze.get("/council"),select:r=>r.debates})}function gpe(r){return Zt({queryKey:["council",r],queryFn:()=>ze.get(`/council/${r}`),select:e=>e.debate,enabled:!!r})}function f$(r){if(!r)return null;const e=r.split(`
514
514
  `)[0].trim();if(!e)return null;const n=e.replace(/^(recommend(?:ed|ing)?|i\s+(?:would\s+)?recommend|proposal|my\s+position|conclusion|verdict)\s*[:\-—]?\s*/i,"").replace(/\.$/,"").split(/\s+/).slice(0,3).join(" ");return(n.length>18?n.slice(0,17).trimEnd()+"…":n).toUpperCase()}function mpe(r){if(!r)return"other";const e=r.toLowerCase();return/\b(go\b|ship|launch|proceed|approve|yes|adopt|migrate\b)/.test(e)?"go":/\b(defer|postpone|delay|wait|later|q[2-9]|next\s+(?:quarter|year))/.test(e)?"defer":/\b(no-go|no\b|reject|abandon|stop|cancel|block)/.test(e)?"hold":/\b(pivot|phased|poc|proof.?of.?concept|pilot|partial|subset|scope\s+down)/.test(e)?"pivot":"other"}function p$(r,e){return r.rounds.find(i=>i.round===e)??null}function g$(r){if(!r.reactions)return 0;const e=(r.reactions.match(/\*\*[a-z][a-z0-9-]+\*\*/g)??[]).length;return e>0?e:(r.reactions.match(/^####\s+/gm)??[]).length}function ype(r,e){if(!r.reactions)return[];const i=new Set(e),n=[],s=/\*\*([a-z][a-z0-9-]+)\*\*/g;let o;for(;(o=s.exec(r.reactions))!==null;)i.has(o[1])&&!n.includes(o[1])&&n.push(o[1]);return n}function bpe(r){return r.openQuestions?(r.openQuestions.match(/^\s*[-*\d]/gm)??[]).length:0}function vpe(r){const e=r.frontmatter.rounds_planned||r.personas.reduce((h,l)=>Math.max(h,...l.rounds.map(u=>u.round),0),0),i=r.personas.length,n=r.personas.reduce((h,l)=>h+l.rounds.reduce((u,d)=>u+g$(d),0),0);let s=0,o=0;if(r.finalReport){const h=r.finalReport.content,l=h.match(/##\s+Open\s+risks\s*\n([\s\S]*?)(?=^##\s+|\Z)/im);l&&(s=(l[1].match(/^\s*[-*]/gm)??[]).length);const u=h.match(/##\s+Minority\s+views\s*\n([\s\S]*?)(?=^##\s+|\Z)/im);if(u){const d=u[1].trim();d.length>0&&!/\(none\)|n\/?a/i.test(d)&&(o=Math.max(1,(d.match(/^\s*[-*]/gm)??[]).length))}}return{rounds:e,personas:i,pushbacks:n,openRisks:s,minorityViews:o}}function xpe(r){let e=0;for(let i=0;i<r.length;i++)e=e*31+r.charCodeAt(i)>>>0;return e%360}const CB=["◈","◉","◎","◆","◇","✦","✧","❖","⬡","⬢","▲","▼","●","■","◐","◑","◒","◓"];function _pe(r){let e=0;for(let i=0;i<r.length;i++)e=e*31+r.charCodeAt(i)>>>0;return CB[e%CB.length]}function Cpe(r){const e=(r||"").toLowerCase();return e.includes("opus")?245:e.includes("sonnet")?195:e.includes("haiku")?160:280}function wpe(r){const e={verdict:"",appendix:null,sections:[]},i=/^##\s+(.+?)\s*\n([\s\S]*?)(?=^##\s+|\Z)/gim;let n;for(;(n=i.exec(r))!==null;){const s=n[1].trim(),o=n[2].trim();if(!e.verdict&&/^verdict\b/i.test(s)){e.verdict=o;continue}if(/^appendix\b/i.test(s)){e.appendix||(e.appendix={heading:s,body:o});continue}e.sections.push({heading:s,body:o})}return e}function Jf({slug:r,size:e=36,title:i,onClick:n}){const s=xpe(r),o=`linear-gradient(135deg, hsl(${s} 72% 52%), hsl(${(s+36)%360} 72% 44%))`,h=_pe(r);return a.jsx("span",{className:"council-avatar",onClick:n,title:i??r,style:{width:e,height:e,fontSize:e*.45,background:o,cursor:n?"pointer":"default"},"aria-label":r,children:h})}const kC=122,SC=48,m$=[{id:"p1",x:189,y:36,title:"Architect",sub:"systems",delay:0},{id:"p2",x:322,y:113,title:"Pragmatist",sub:"shipping",delay:.2},{id:"p3",x:322,y:267,title:"Skeptic",sub:"risk",delay:.4},{id:"p4",x:189,y:344,title:"Researcher",sub:"evidence",delay:.6},{id:"p5",x:56,y:267,title:"Advocate",sub:"the user",delay:.8},{id:"p6",x:56,y:113,title:"Strategist",sub:"long game",delay:1}],qk={};for(const r of m$)qk[r.id]={cx:r.x+kC/2,cy:r.y+SC/2,w:kC,h:SC};qk.syn={cx:566,cy:214,w:132,h:96};const kpe=o$(qk),TC=(r,e,i=.1)=>kpe(r,e,i),Spe=[["p1","p4"],["p5","p1"],["p1","p3"],["p2","p5"],["p2","p6"],["p3","p6"],["p4","p2"],["p4","p6"],["p5","p3"]],Tpe=Spe.map(([r,e],i)=>({id:`${r}-${e}`,d:TC(r,e),arrow:!0,thin:!0,dur:2.5+i%3*.25,delay:i*.27%2.5})),y$={viewBox:"0 0 700 412",ariaLabel:"A council of six persona sub-agents reads each other’s reasoning across the table, round after round, then the resolved debate converges into a synthesizer that writes one decision report.",nodes:[...m$.map(r=>({id:r.id,x:r.x,y:r.y,w:kC,h:SC,title:r.title,sub:r.sub,variant:"region",breathe:!0,breatheDelay:r.delay})),{id:"syn",x:500,y:166,w:132,h:96,title:"synthesizer",sub:"decision report",variant:"rem"}],edges:[...Tpe,{id:"rounds",d:"M 250 214 L 250 214",comet:!1,label:{text:"↻ rounds",x:250,y:214}},{id:"p2-syn",d:TC("p2","syn"),arrow:!0,dur:2.4,delay:.5},{id:"p3-syn",d:TC("p3","syn"),arrow:!0,dur:2.4,delay:1}]},b$="dreamcontext.dashboard.councilShowcaseDismissed";function Epe(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(b$)==="1"}catch{return!1}}function Npe(){return a.jsxs("div",{className:"council-stage",children:[a.jsx("span",{className:"council-stage-tag",children:"Agents · Lab"}),a.jsx(Cc,{spec:y$,className:"council-stage-flow"})]})}function Ape(){const[r,e]=R.useState(Epe);if(r)return null;const i=()=>{e(!0);try{window.localStorage.setItem(b$,"1")}catch{}};return a.jsxs("div",{className:"council-banner",children:[a.jsxs("div",{className:"council-banner-text",children:[a.jsx("p",{className:"council-intro-kicker",children:"How Council works"}),a.jsx("p",{className:"council-banner-body",children:"A panel of persona sub-agents debates your decision across rounds, sees each other’s reasoning, then a synthesizer writes one traceable verdict."})]}),a.jsx("div",{className:"council-banner-flow",children:a.jsx(Cc,{spec:y$,size:"mini"})}),a.jsx("button",{type:"button",className:"council-banner-close",onClick:i,"aria-label":"Hide explainer",title:"Hide explainer",children:"✕"})]})}function jpe({onNew:r}){return a.jsxs("div",{className:"council-intro",children:[a.jsx("div",{className:"council-intro-mark",children:a.jsx(ab,{size:40,glow:!0})}),a.jsx("p",{className:"council-intro-kicker",children:"Lab · Council"}),a.jsxs("h2",{className:"council-intro-title",children:["Put your hardest decisions to a ",a.jsx("span",{children:"council"}),"."]}),a.jsx("p",{className:"council-intro-lead",children:"When one perspective isn’t enough, Council convenes a panel of AI personas to debate the question across rounds, expose each other’s reasoning, and synthesize a verdict you can trace back to who argued what."}),a.jsx(Npe,{}),a.jsxs("button",{type:"button",className:"council-new-btn council-intro-cta",onClick:r,children:[a.jsx("span",{"aria-hidden":!0,children:"+"})," Start your first debate"]}),a.jsx("p",{className:"council-intro-foot",children:"Council is experimental. Debates are convened from Claude today — this page is where you read them back."})]})}const Mpe=[{value:"all",label:"All"},{value:"in_progress",label:"In progress"},{value:"synthesizing",label:"Synthesizing"},{value:"complete",label:"Complete"},{value:"promoted",label:"Promoted"}];function Lpe(r,e,i){var s;if(i!=="all"&&(i==="in_progress"&&!r.status.endsWith("_running")||i==="synthesizing"&&r.status!=="synthesizing"||i==="complete"&&r.status!=="complete"||i==="promoted"&&!r.promoted_to_knowledge))return!1;if(!e.trim())return!0;const n=e.trim().toLowerCase();return!!((r.topic||"").toLowerCase().includes(n)||r.id.toLowerCase().includes(n)||(s=r.personaSlugs)!=null&&s.some(o=>o.toLowerCase().includes(n)))}function Bpe(r){return r==="complete"?"council-hall-status--complete":r==="synthesizing"?"council-hall-status--synth":r.endsWith("_running")?"council-hall-status--running":"council-hall-status--pending"}function Rpe(r){return r==="complete"?"Complete":r==="synthesizing"?"Synthesizing":r.endsWith("_running")?"In progress":"Pending"}function Ope({debates:r,onOpen:e,onNew:i}){const{t:n}=Fr(),[s,o]=R.useState(""),[h,l]=R.useState("all"),u=R.useMemo(()=>r.filter(d=>Lpe(d,s,h)),[r,s,h]);return r.length===0?a.jsx(jpe,{onNew:i}):a.jsxs("div",{className:"council-hall",children:[a.jsx(Ape,{}),a.jsxs("div",{className:"council-hall-bar",children:[a.jsxs("label",{className:"council-hall-search",children:[a.jsx("span",{"aria-hidden":!0,children:"🔍"}),a.jsx("input",{type:"search",value:s,onChange:d=>o(d.target.value),placeholder:n("council.search.placeholder")})]}),a.jsx("select",{className:"council-hall-filter",value:h,onChange:d=>l(d.target.value),"aria-label":n("council.filter.status"),children:Mpe.map(d=>a.jsx("option",{value:d.value,children:d.label},d.value))}),a.jsxs("span",{className:"council-hall-count",children:[u.length," / ",r.length]}),a.jsxs("button",{type:"button",className:"council-new-btn",onClick:i,children:[a.jsx("span",{"aria-hidden":!0,children:"+"})," ",n("council.new")]})]}),u.length===0?a.jsx("div",{className:"council-empty",children:a.jsx("p",{className:"council-empty-msg",children:n("council.empty.nomatch")})}):a.jsx("div",{className:"council-hall-grid",children:u.map(d=>a.jsxs("button",{type:"button",className:"council-hall-card",onClick:()=>e(d.id),children:[a.jsxs("div",{className:"council-hall-card-head",children:[a.jsxs("span",{className:`council-hall-status ${Bpe(d.status)}`,children:[a.jsx("span",{className:"council-hall-status-dot"}),Rpe(d.status)]}),a.jsxs("span",{className:"council-hall-rounds",children:["R",d.current_round,"/",d.rounds_planned]})]}),a.jsx("h3",{className:"council-hall-topic",children:d.topic||d.id}),a.jsxs("div",{className:"council-hall-foot",children:[d.personaSlugs&&d.personaSlugs.length>0&&a.jsxs("div",{className:"council-hall-avatars","aria-label":`${d.personaSlugs.length} personas`,children:[d.personaSlugs.slice(0,6).map((g,p)=>a.jsx("span",{className:"council-hall-avatar-wrap",style:{zIndex:10-p},children:a.jsx(Jf,{slug:g,size:20})},g)),d.personaSlugs.length>6&&a.jsxs("span",{className:"council-hall-avatar-more",children:["+",d.personaSlugs.length-6]})]}),a.jsx("span",{className:"council-hall-date",children:d.updated_at||d.created_at}),d.promoted_to_knowledge&&a.jsx("span",{className:"council-hall-promoted",title:"Promoted to knowledge",children:"📜"})]})]},d.id))})]})}function Dpe(r){var e,i;if(r==="complete")return{label:"Complete",tone:"complete"};if(r==="synthesizing")return{label:"Synthesizing",tone:"synth"};if(/_running$/.test(r)){const n=(e=r.match(/^round_(\d+)_running$/))==null?void 0:e[1];return{label:n?`Round ${n} running`:"Running",tone:"running"}}if(/_complete$/.test(r)){const n=(i=r.match(/^round_(\d+)_complete$/))==null?void 0:i[1];return{label:n?`Round ${n} done`:"Round done",tone:"pending"}}return r==="created"?{label:"Created",tone:"pending"}:{label:r,tone:"pending"}}function Ipe({status:r,size:e="md"}){const{label:i,tone:n}=Dpe(r);return a.jsxs("span",{className:`council-status council-status--${n} council-status--${e}`,children:[a.jsx("span",{className:"council-status-dot"}),i]})}function Od({value:r,label:e,tone:i="default"}){return a.jsxs("div",{className:`council-stat-tile council-stat-tile--${i}`,children:[a.jsx("div",{className:"council-stat-value",children:r}),a.jsx("div",{className:"council-stat-label",children:e})]})}function Fpe({debate:r,onCiteJump:e,onAgentJump:i}){const{t:n}=Fr(),s=R.useMemo(()=>vpe(r),[r]),o=r.finalReport?wpe(r.finalReport.content):null,h=r.personas.map(u=>u.slug),l=u=>{const d=u.toLowerCase();return/\b(risk|danger|warning|caveat)/.test(d)?"council-ov-card--risks":/\b(minority|dissent|objection)/.test(d)?"council-ov-card--minority":/^why\b/.test(d)?"council-ov-card--why":""};return a.jsxs("div",{className:"council-ov",children:[a.jsxs("section",{className:"council-ov-problem",children:[a.jsx("div",{className:"council-ov-label",children:"Problem"}),a.jsx("h2",{className:"council-ov-topic",children:r.frontmatter.topic||r.frontmatter.id}),r.frontmatter.promoted_to_knowledge&&a.jsxs("div",{className:"council-ov-promoted",children:[a.jsx("span",{children:"📜"}),a.jsxs("span",{children:["Promoted to knowledge: ",a.jsx("code",{children:r.frontmatter.promoted_to_knowledge})]})]})]}),!o&&a.jsxs("section",{className:"council-ov-pending",children:[a.jsx("div",{className:"council-ov-label",children:n("council.verdict.awaitingSynthesis")}),a.jsx("p",{children:n("council.verdict.synthPending")}),r.roundLog&&a.jsxs("div",{className:"council-roundlog",children:[a.jsx("h4",{children:"Round log"}),a.jsx("div",{className:"council-sheet-prose",dangerouslySetInnerHTML:{__html:ar.parse(r.roundLog)}})]})]}),o&&a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"council-ov-verdict",children:[a.jsx("div",{className:"council-ov-label",children:"Verdict"}),a.jsx("div",{className:"council-ov-verdict-text",dangerouslySetInnerHTML:{__html:ar.parse(o.verdict||"*No verdict section found.*")}})]}),a.jsxs("div",{className:"council-ov-stats",children:[a.jsx(Od,{value:s.rounds,label:"rounds"}),a.jsx(Od,{value:s.personas,label:"personas"}),a.jsx(Od,{value:s.pushbacks,label:"pushbacks"}),a.jsx(Od,{value:s.openRisks,label:"open risks",tone:"warning"}),a.jsx(Od,{value:s.minorityViews,label:"dissent",tone:"dissent"})]}),o.sections.length>0&&a.jsx("div",{className:"council-ov-sections",children:o.sections.map(u=>a.jsxs("section",{className:`council-ov-card ${l(u.heading)}`,children:[a.jsx("h3",{children:u.heading}),a.jsx($pe,{text:u.body,knownSlugs:h,onCiteJump:e,onAgentJump:i})]},u.heading))}),o.appendix&&a.jsxs("details",{className:"council-ov-appendix",children:[a.jsx("summary",{children:o.appendix.heading}),a.jsx("div",{className:"council-sheet-prose",dangerouslySetInnerHTML:{__html:ar.parse(o.appendix.body)}})]})]})]})}function $pe({text:r,knownSlugs:e,onCiteJump:i,onAgentJump:n}){const s=[],o=new Set(e);let h=r.replace(/([a-z][a-z0-9-]+)\s+in\s+R(\d+)/g,(m,y,w)=>{if(!o.has(y))return m;const _=s.length;return s.push({slug:y,round:Number(w)}),`\0CITE${_}\0`});const l=[];h=h.replace(/\*\*([a-z][a-z0-9-]+)\*\*/g,(m,y)=>{if(!o.has(y))return m;const w=l.length;return l.push(y),`\0AGENT${w}\0`});const d=ar.parse(h).split(/\u0000(CITE|AGENT)(\d+)\u0000/),g=[];let p=0;for(;p<d.length;){const m=d[p];if(p+2<d.length&&(d[p+1]==="CITE"||d[p+1]==="AGENT")){g.push(a.jsx("span",{dangerouslySetInnerHTML:{__html:m}},`h-${p}`));const y=d[p+1],w=Number(d[p+2]);if(y==="CITE"){const _=s[w];g.push(a.jsxs("button",{type:"button",className:"council-cite-chip",onClick:()=>i(_.slug,_.round),children:[a.jsx(Jf,{slug:_.slug,size:14}),a.jsx("span",{children:_.slug}),a.jsxs("span",{className:"council-cite-round",children:["R",_.round]})]},`c-${p}`))}else{const _=l[w];g.push(a.jsx("button",{type:"button",className:"council-inline-slug",onClick:()=>n(_),children:_},`a-${p}`))}p+=3}else g.push(a.jsx("span",{dangerouslySetInnerHTML:{__html:m}},`h-${p}`)),p+=1}return a.jsx("div",{className:"council-sheet-prose council-citation-prose",children:g})}function v$({model:r}){const e=Cpe(r),i=r?r.charAt(0).toUpperCase()+r.slice(1):"unknown";return a.jsx("span",{className:"council-model-badge",style:{background:`hsl(${e} 85% 55% / 0.14)`,color:`hsl(${e} 85% 40%)`,borderColor:`hsl(${e} 85% 55% / 0.35)`},title:`Model: ${i}`,children:i})}function Ppe(r,e){if(!e.trim())return!0;const i=e.trim().toLowerCase();if(r.slug.toLowerCase().includes(i))return!0;for(const n of r.rounds)if([n.executiveSummary,n.position,n.reasoning,n.reactions,n.openQuestions].filter(Boolean).join(`
515
515
  `).toLowerCase().includes(i))return!0;return!1}function Hk(r,e){if(!e.trim())return r;const n=e.trim().replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return r.replace(new RegExp(`(${n})`,"gi"),"<mark>$1</mark>")}function zpe({debate:r,focusSlug:e}){const{t:i}=Fr(),[n,s]=R.useState(""),[o,h]=R.useState(()=>new Set),l=R.useRef(null),u=R.useMemo(()=>r.personas.filter(g=>Ppe(g,n)),[r.personas,n]);R.useEffect(()=>{if(!e)return;h(p=>{const m=new Set(p);return m.delete(e),m});const g=setTimeout(()=>{var m;const p=(m=l.current)==null?void 0:m.querySelector(`[data-agent="${e}"]`);p==null||p.scrollIntoView({behavior:"smooth",block:"start"})},30);return()=>clearTimeout(g)},[e]);const d=g=>{h(p=>{const m=new Set(p);return m.has(g)?m.delete(g):m.add(g),m})};return a.jsxs("div",{className:"council-transcript",ref:l,children:[a.jsxs("div",{className:"council-transcript-searchbar",children:[a.jsxs("label",{className:"council-transcript-search",children:[a.jsx("span",{"aria-hidden":!0,children:"🔍"}),a.jsx("input",{type:"search",value:n,onChange:g=>s(g.target.value),placeholder:i("council.search.transcript")})]}),a.jsxs("span",{className:"council-transcript-count",children:[u.length," of ",r.personas.length," persona",r.personas.length===1?"":"s"]})]}),a.jsxs("div",{className:"council-transcript-body",children:[u.length===0&&a.jsx("div",{className:"council-empty",children:"No personas match this search."}),u.map(g=>a.jsx(qpe,{persona:g,query:n,collapsed:o.has(g.slug),highlighted:e===g.slug,onToggle:()=>d(g.slug)},g.slug))]})]})}function qpe({persona:r,query:e,collapsed:i,highlighted:n,onToggle:s}){return a.jsxs("article",{className:`council-transcript-block ${n?"is-highlighted":""}`,"data-agent":r.slug,children:[a.jsxs("header",{className:"council-transcript-block-head",onClick:s,children:[a.jsxs("div",{className:"council-transcript-block-title",children:[a.jsx(Jf,{slug:r.slug,size:24}),a.jsxs("div",{children:[a.jsx("h3",{className:"council-transcript-block-name",children:r.slug}),a.jsxs("div",{className:"council-transcript-block-meta",children:[a.jsx(v$,{model:r.frontmatter.model}),r.frontmatter.aspects.slice(0,4).map(o=>a.jsx("span",{className:"council-aspect",children:o},o))]})]})]}),a.jsx("span",{className:`council-transcript-chev ${i?"":"is-open"}`,"aria-hidden":!0,children:"▸"})]}),!i&&a.jsxs("div",{className:"council-transcript-block-body",children:[r.persona&&a.jsxs("section",{className:"council-sheet-section",children:[a.jsx("h4",{children:"Persona prompt"}),a.jsx("div",{className:"council-sheet-prose",dangerouslySetInnerHTML:{__html:Hk(ar.parse(r.persona),e)}})]}),r.rounds.length===0&&a.jsx("div",{className:"council-sheet-empty",children:"No rounds submitted."}),r.rounds.slice().sort((o,h)=>h.round-o.round).map(o=>a.jsx(Hpe,{round:o,crossContext:r.crossContext[o.round]??null,query:e},o.round)),r.researches.length>0&&a.jsxs("section",{className:"council-sheet-section",children:[a.jsx("h4",{children:"Research notes"}),a.jsx("ul",{className:"council-research-list",children:r.researches.map(o=>a.jsxs("li",{children:[a.jsx("span",{className:"council-research-topic",children:o.topic}),a.jsx("span",{className:"council-research-date",children:o.added_at})]},o.slug))})]})]})]})}function Hpe({round:r,crossContext:e,query:i}){const n=f$(r.position);return a.jsxs("section",{className:"council-round-panel",children:[a.jsxs("header",{className:"council-round-panel-head",children:[a.jsxs("h4",{className:"council-round-panel-title",children:["Round ",r.round]}),n&&a.jsx("span",{className:"council-chip-pos",children:n})]}),e&&a.jsxs("blockquote",{className:"council-crosscontext",children:[a.jsx("strong",{children:"Cross-context loaded"}),a.jsx("div",{className:"council-sheet-prose",dangerouslySetInnerHTML:{__html:Hk(ar.parse(e),i)}})]}),r.executiveSummary&&a.jsx(Dd,{title:"Executive summary",body:r.executiveSummary,query:i}),r.position&&a.jsx(Dd,{title:"Position",body:r.position,query:i}),r.reasoning&&a.jsx(Dd,{title:"Reasoning",body:r.reasoning,query:i}),r.reactions&&a.jsx(Dd,{title:"Reactions to peers",body:r.reactions,query:i}),r.openQuestions&&a.jsx(Dd,{title:"Open questions",body:r.openQuestions,query:i})]})}function Dd({title:r,body:e,query:i}){const n=Hk(ar.parse(e),i);return a.jsxs("div",{className:"council-round-sub",children:[a.jsx("h5",{className:"council-round-sub-title",children:r}),a.jsx("div",{className:"council-sheet-prose",dangerouslySetInnerHTML:{__html:n}})]})}function x$(r,e){return e.trim()?r?[r.executiveSummary,r.position,r.reasoning].filter(Boolean).join(`
516
- `).toLowerCase().includes(e.trim().toLowerCase()):!1:!0}function Upe({debate:r,query:e,onQueryChange:i,selected:n,onSelectCell:s,onClearSelection:o}){const h=R.useRef(null),l=R.useMemo(()=>Array.from({length:Math.max(1,r.frontmatter.rounds_planned)},(g,p)=>p+1),[r.frontmatter.rounds_planned]),u=R.useMemo(()=>r.personas.map(g=>g.slug),[r.personas]),d=R.useMemo(()=>{if(!e.trim())return null;let g=0;for(const p of r.personas)for(const m of l)x$(p$(p,m),e)&&g++;return g},[e,r,l]);return R.useEffect(()=>{if(!n)return;const g=p=>{const m=p.target;if(m&&["INPUT","TEXTAREA"].includes(m.tagName))return;if(p.key==="Escape"){o();return}const y=r.personas.findIndex(_=>_.slug===n.slug);if(y===-1)return;const w=r.frontmatter.rounds_planned;p.key==="ArrowRight"&&n.round<w?(p.preventDefault(),s(n.slug,n.round+1)):p.key==="ArrowLeft"&&n.round>1?(p.preventDefault(),s(n.slug,n.round-1)):p.key==="ArrowDown"&&y<r.personas.length-1?(p.preventDefault(),s(r.personas[y+1].slug,n.round)):p.key==="ArrowUp"&&y>0&&(p.preventDefault(),s(r.personas[y-1].slug,n.round))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[n,r,o,s]),R.useEffect(()=>{if(!n||!h.current)return;const g=h.current.querySelector(`[data-persona="${n.slug}"][data-round="${n.round}"]`);g==null||g.scrollIntoView({behavior:"smooth",block:"center"})},[n]),a.jsxs("div",{className:"council-matrix",children:[a.jsxs("div",{className:"council-matrix-bar",children:[a.jsxs("label",{className:"council-matrix-search-input",children:[a.jsx("span",{className:"council-matrix-search-icon","aria-hidden":!0,children:"🔍"}),a.jsx("input",{type:"search",value:e,onChange:g=>i(g.target.value),placeholder:"Filter cells by text…"}),e&&a.jsx("button",{type:"button",className:"council-matrix-search-clear",onClick:()=>i(""),children:"×"})]}),d!=null&&a.jsxs("span",{className:"council-matrix-count",children:[d," match",d===1?"":"es"]})]}),a.jsx("div",{className:"council-matrix-scroll",ref:h,children:a.jsxs("div",{className:"council-matrix-grid",style:{gridTemplateColumns:`180px repeat(${l.length}, minmax(220px, 1fr))`},children:[a.jsx("div",{className:"council-matrix-corner","aria-hidden":!0}),l.map(g=>{const p=r.frontmatter.status===`round_${g}_running`,m=r.frontmatter.current_round>=g&&!p;return a.jsxs("div",{className:`council-round-head ${p?"is-running":""} ${m?"is-done":""}`,children:["Round ",g]},`h-${g}`)}),r.personas.map(g=>a.jsx(Wpe,{persona:g,rounds:l,debate:r,query:e,selected:n,knownSlugs:u,onSelectCell:s},g.slug))]})})]})}function Wpe({persona:r,rounds:e,debate:i,query:n,selected:s,knownSlugs:o,onSelectCell:h}){return a.jsxs(a.Fragment,{children:[a.jsxs("aside",{className:"council-matrix-row-head",children:[a.jsx(Jf,{slug:r.slug,size:22}),a.jsxs("div",{className:"council-matrix-row-id",children:[a.jsx("div",{className:"council-matrix-row-name",children:r.slug}),a.jsx(v$,{model:r.frontmatter.model})]})]}),e.map(l=>{const u=p$(r,l),d=i.frontmatter.status===`round_${l}_running`,g=!!s&&s.slug===r.slug&&s.round===l,p=x$(u,n),m=!!n.trim()&&!p;return a.jsx(Gpe,{personaSlug:r.slug,round:l,data:u,isRunning:d,active:g,dimmed:m,knownSlugs:o,onSelect:h},l)})]})}function Gpe({personaSlug:r,round:e,data:i,isRunning:n,active:s,dimmed:o,knownSlugs:h,onSelect:l}){if(!i)return a.jsx("div",{className:`council-cell council-cell--empty ${n?"council-cell--pending":""} ${o?"is-dimmed":""}`,"data-persona":r,"data-round":e,children:a.jsx("span",{className:"council-cell-empty-label",children:n?"awaiting…":"— silent —"})});const u=f$(i.position),d=mpe(i.position),g=g$(i),p=bpe(i),m=ype(i,h);return a.jsxs("button",{type:"button",className:`council-cell council-cell--${d} ${s?"is-active":""} ${o?"is-dimmed":""}`,"data-persona":r,"data-round":e,onClick:()=>l(r,e),children:[a.jsxs("div",{className:"council-cell-top",children:[u&&a.jsx("span",{className:`council-chip-pos council-chip-pos--${d}`,children:u}),(g>0||p>0)&&a.jsxs("span",{className:"council-cell-meta",children:[g>0&&a.jsxs(a.Fragment,{children:["↯ ",g]}),g>0&&p>0&&a.jsx("span",{children:" · "}),p>0&&a.jsxs(a.Fragment,{children:["? ",p]})]})]}),!s&&i.executiveSummary&&a.jsx("p",{className:"council-cell-exec",children:i.executiveSummary}),s&&a.jsxs("div",{className:"council-cell-full",children:[i.executiveSummary&&a.jsx(Id,{title:"Executive summary",children:a.jsx("p",{children:i.executiveSummary})}),i.position&&a.jsx(Id,{title:"Position",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.position)}})}),i.reasoning&&a.jsx(Id,{title:"Reasoning",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.reasoning)}})}),i.reactions&&a.jsxs(Id,{title:"Reactions to peers",children:[a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.reactions)}}),m.length>0&&a.jsx("div",{className:"council-cell-react-chips",children:m.map(y=>a.jsxs("span",{className:"council-cell-react-chip",children:[a.jsx(Jf,{slug:y,size:14}),a.jsx("span",{children:y})]},y))})]}),i.openQuestions&&a.jsx(Id,{title:"Open questions",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.openQuestions)}})})]})]})}function Id({title:r,children:e}){return a.jsxs("section",{className:"council-cell-sub",children:[a.jsx("h5",{children:r}),a.jsx("div",{className:"council-cell-sub-body",children:e})]})}function wB(r){return r==="complete"||r==="synthesizing"?"overview":"matrix"}function Kpe({debate:r,onBack:e}){const{t:i}=Fr(),[n,s]=R.useState(()=>wB(r.frontmatter.status)),[o,h]=R.useState(""),[l,u]=R.useState(null),[d,g]=R.useState(null);R.useEffect(()=>{s(wB(r.frontmatter.status)),h(""),u(null),g(null)},[r.frontmatter.id]);const p=(w,_)=>{s("matrix"),u({slug:w,round:_})},m=w=>{s("agents"),g(w)},y=()=>{var w;return(w=navigator.clipboard)==null?void 0:w.writeText(r.frontmatter.id).catch(()=>{})};return a.jsxs("div",{className:"council-detail",children:[a.jsxs("header",{className:"council-detail-head",children:[a.jsxs("button",{type:"button",className:"council-detail-back",onClick:e,children:["← ",i("council.title")]}),a.jsxs("div",{className:"council-detail-meta",children:[a.jsx(Ipe,{status:r.frontmatter.status}),a.jsxs("span",{className:"council-detail-rounds",children:["R",r.frontmatter.current_round,"/",r.frontmatter.rounds_planned]}),a.jsx("span",{className:"council-session-dot",children:"·"}),a.jsx("span",{className:"council-detail-date",children:r.frontmatter.created_at}),a.jsx("span",{className:"council-session-dot",children:"·"}),a.jsx("button",{type:"button",className:"council-session-id",onClick:y,title:"Copy debate id",children:r.frontmatter.id})]})]}),a.jsxs("nav",{className:"council-tabs",role:"tablist",children:[a.jsx(x_,{active:n==="overview",onClick:()=>s("overview"),label:"Overview"}),a.jsx(x_,{active:n==="agents",onClick:()=>s("agents"),label:"Agents"}),a.jsx(x_,{active:n==="matrix",onClick:()=>s("matrix"),label:"Matrix"})]}),a.jsxs("div",{className:"council-detail-body",children:[n==="overview"&&a.jsx(Fpe,{debate:r,onCiteJump:p,onAgentJump:m}),n==="agents"&&a.jsx(zpe,{debate:r,focusSlug:d}),n==="matrix"&&a.jsx(Upe,{debate:r,query:o,onQueryChange:h,selected:l,onSelectCell:(w,_)=>u({slug:w,round:_}),onClearSelection:()=>u(null)})]})]})}function x_({active:r,onClick:e,label:i}){return a.jsx("button",{type:"button",role:"tab","aria-selected":r,className:`council-tab ${r?"is-active":""}`,onClick:e,children:i})}const kB="/council";function Vpe({onClose:r}){const[e,i]=R.useState(!1);R.useEffect(()=>{const s=o=>{o.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[r]);const n=()=>{var s;(s=navigator.clipboard)==null||s.writeText(kB).then(()=>{i(!0),window.setTimeout(()=>i(!1),1600)}).catch(()=>{})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"council-modal-scrim",onClick:r}),a.jsxs("div",{className:"council-modal",role:"dialog","aria-modal":"true","aria-label":"Start a new debate",children:[a.jsxs("header",{className:"council-modal-head",children:[a.jsxs("h2",{className:"council-modal-title",children:["Start a debate",a.jsx("span",{className:"council-lab-badge",children:"Lab"})]}),a.jsx("button",{type:"button",className:"council-modal-close",onClick:r,"aria-label":"Close",children:"✕"})]}),a.jsx("p",{className:"council-modal-lede",children:"Council convenes a panel of AI personas to debate a hard decision across several rounds, exposes each one to the others' reasoning, then synthesizes a final verdict you can trace back to who argued what."}),a.jsxs("div",{className:"council-modal-soon",children:[a.jsx("span",{className:"council-modal-soon-tag",children:"Coming soon"}),a.jsxs("p",{children:["Soon this button will open ",a.jsx("strong",{children:"Sleepy"})," pre-filled with a debate prompt so you can convene a council without leaving the dashboard. That flow isn't wired up yet."]})]}),a.jsxs("div",{className:"council-modal-now",children:[a.jsx("span",{className:"council-ov-label",children:"Right now"}),a.jsx("p",{className:"council-modal-now-body",children:"Open Claude in your project and run the Council skill:"}),a.jsxs("div",{className:"council-modal-cmd",children:[a.jsx("code",{children:kB}),a.jsx("button",{type:"button",className:"council-modal-cmd-copy",onClick:n,children:e?"Copied":"Copy"})]}),a.jsxs("p",{className:"council-modal-hint",children:["Tip: phrases like ",a.jsx("em",{children:'"debate this"'})," or ",a.jsx("em",{children:'"help me decide"'})," also prompt Council automatically. Finished debates show up here, where you can read every round, the agent matrix, and the final report."]})]}),a.jsx("footer",{className:"council-modal-foot",children:a.jsx("button",{type:"button",className:"council-modal-btn",onClick:r,children:"Got it"})})]})]})}function Ype(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=ppe(),[o,h]=R.useState(null),[l,u]=R.useState(!1),{data:d,isLoading:g}=gpe(o);return i?a.jsx("div",{className:"loading",children:r("common.loading")}):n?a.jsxs("div",{className:"error-state",children:["Failed to load council sessions. ",s==null?void 0:s.message]}):o?a.jsxs("div",{className:"council-page council-page--detail",children:[g&&a.jsx("div",{className:"loading",children:"Loading session…"}),d&&a.jsx(Kpe,{debate:d,onBack:()=>h(null)})]}):a.jsxs("div",{className:"council-page",children:[a.jsx(Ope,{debates:e??[],onOpen:h,onNew:()=>u(!0)}),l&&a.jsx(Vpe,{onClose:()=>u(!1)})]})}function Xpe(){return Zt({queryKey:["config"],queryFn:()=>ze.get("/config"),select:r=>r.config})}function Zpe(){const r=rr();return sr({mutationFn:e=>ze.patch("/config",e),onSuccess:()=>{r.invalidateQueries({queryKey:["config"]})}})}function Qpe(){return Zt({queryKey:["vaults"],queryFn:()=>ze.get("/vaults")})}function Jpe(){return Zt({queryKey:["connections"],queryFn:()=>ze.get("/connections"),select:r=>r.connections})}function ege(){const r=rr();return sr({mutationFn:e=>ze.post("/connections",e),onSuccess:()=>{r.invalidateQueries({queryKey:["connections"]}),r.invalidateQueries({queryKey:["vaults"]}),r.invalidateQueries({queryKey:["launcher-status"]}),r.invalidateQueries({queryKey:["launcher-federation-graph"]})}})}function tge(){const r=rr();return sr({mutationFn:e=>ze.del(`/connections/${encodeURIComponent(e)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["connections"]}),r.invalidateQueries({queryKey:["vaults"]}),r.invalidateQueries({queryKey:["launcher-status"]}),r.invalidateQueries({queryKey:["launcher-federation-graph"]})}})}function rge(){return Zt({queryKey:["federation","inbox"],queryFn:()=>ze.get("/federation/inbox")})}function ige(){return sr({mutationFn:()=>ze.post("/federation/sync",{})})}const SB=["out","in","both"];function nge({shareable:r,onToggleShareable:e,shareablePending:i}){const{t:n}=Fr(),{data:s}=Qpe(),{data:o}=Jpe(),h=ege(),l=tge(),{data:u}=rge(),d=ige(),[g,p]=R.useState(""),[m,y]=R.useState("both"),[w,_]=R.useState(null),v=(s==null?void 0:s.vaults)??[],x=(s==null?void 0:s.current)??null,C=o??[],k=new Set(C.map(E=>E.vault)),T=v.filter(E=>E.name!==x&&!k.has(E.name)),N=()=>{if(_(null),!g){_(n("federation.error.pick_vault"));return}h.mutate({vault:g,direction:m},{onSuccess:()=>{p(""),y("both")},onError:E=>_(E instanceof Error?E.message:String(E))})},j=(E,L)=>{h.mutate({vault:E.vault,direction:L,topics:E.topics})},A=(E,L)=>{const O=L.split(",").map(D=>D.trim()).filter(Boolean);h.mutate({vault:E.vault,direction:E.direction,topics:O.length>0?O:null})};return a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"fed-head",children:[a.jsx("h2",{className:"settings-section-title",children:n("settings.federation")}),a.jsxs("label",{className:"fed-sharing-toggle settings-checkbox-label",title:n("federation.shareable.hint"),children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:r,disabled:i,onChange:E=>e(E.target.checked)}),a.jsx("span",{children:n("federation.shareable.label")})]})]}),a.jsx(UO,{variant:"embedded"}),a.jsxs("details",{className:"fed-advanced",children:[a.jsx("summary",{className:"fed-advanced-summary",children:n("federation.advanced")}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.vaults")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.vaults.desc")})]}),v.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.vaults.empty")}):a.jsx("ul",{className:"fed-vault-list",children:v.map(E=>a.jsxs("li",{className:`fed-vault-item${E.name===x?" fed-vault-item--current":""}`,children:[a.jsx("span",{className:"fed-vault-name",children:E.name}),E.name===x&&a.jsx("span",{className:"fed-badge",children:n("federation.current")}),a.jsx("span",{className:"fed-vault-path",children:E.path})]},E.name))})]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.connections")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.connections.desc")})]}),C.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.connections.empty")}):a.jsx("ul",{className:"fed-conn-list",children:C.map(E=>{var L;return a.jsxs("li",{className:"fed-conn-item",children:[a.jsxs("div",{className:"fed-conn-head",children:[a.jsx("span",{className:"fed-conn-name",children:E.vault}),E.status==="stale"&&a.jsx("span",{className:"fed-badge fed-badge--stale",children:n("federation.stale")}),a.jsx("button",{className:"btn fed-conn-remove",onClick:()=>l.mutate(E.vault),disabled:l.isPending,children:n("federation.remove")})]}),a.jsxs("div",{className:"fed-conn-controls",children:[a.jsx("div",{className:"fed-direction",role:"group","aria-label":n("federation.direction"),children:SB.map(O=>a.jsx("button",{className:`fed-dir-btn${E.direction===O?" fed-dir-btn--active":""}`,onClick:()=>j(E,O),disabled:h.isPending,children:n(`federation.direction.${O}`)},O))}),a.jsx("input",{className:"settings-text-input fed-topics-input",defaultValue:((L=E.topics)==null?void 0:L.join(", "))??"",placeholder:n("federation.topics.placeholder"),onBlur:O=>{const D=O.target.value.split(",").map(q=>q.trim()).filter(Boolean).join(", "),G=(E.topics??[]).join(", ");D!==G&&A(E,O.target.value)}})]}),a.jsx("p",{className:"settings-field-hint fed-dir-hint",children:n(`federation.direction.${E.direction}.hint`)})]},E.vault)})})]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.add")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.add.desc")})]}),T.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.add.none")}):a.jsxs("div",{className:"fed-add-row",children:[a.jsxs("select",{className:"settings-text-input",value:g,onChange:E=>p(E.target.value),children:[a.jsx("option",{value:"",children:n("federation.add.pick")}),T.map(E=>a.jsx("option",{value:E.name,children:E.name},E.name))]}),a.jsx("div",{className:"fed-direction",role:"group","aria-label":n("federation.direction"),children:SB.map(E=>a.jsx("button",{className:`fed-dir-btn${m===E?" fed-dir-btn--active":""}`,onClick:()=>y(E),children:n(`federation.direction.${E}`)},E))}),a.jsx("button",{className:"btn btn--primary",onClick:N,disabled:h.isPending||!g,children:n("federation.connect")})]}),T.length>0&&a.jsx("p",{className:"settings-field-hint fed-dir-hint",children:n(`federation.direction.${m}.hint`)}),w&&a.jsx("p",{className:"settings-test-err",children:w})]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.inbox")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.inbox.desc")})]}),(()=>{const E=(u==null?void 0:u.pending)??[],L=(u==null?void 0:u.consumed)??[],O=(u==null?void 0:u.quarantined)??[];return E.length===0&&L.length===0&&O.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.inbox.empty")}):a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs("div",{className:"fed-inbox-group",children:[a.jsxs("h4",{className:"fed-inbox-group-title",children:[n("federation.inbox.pending")," (",E.length,")"]}),a.jsx("ul",{className:"fed-entry-list",children:E.map(D=>a.jsx(TB,{entry:D,fromLabel:n("federation.inbox.from")},`p-${D.id}`))})]}),L.length>0&&a.jsxs("div",{className:"fed-inbox-group",children:[a.jsxs("h4",{className:"fed-inbox-group-title",children:[n("federation.inbox.consumed")," (",L.length,")"]}),a.jsx("ul",{className:"fed-entry-list fed-entry-list--consumed",children:L.map(D=>a.jsx(TB,{entry:D,fromLabel:n("federation.inbox.from")},`c-${D.id}`))})]}),O.length>0&&a.jsxs("div",{className:"fed-inbox-group",children:[a.jsxs("h4",{className:"fed-inbox-group-title fed-inbox-group-title--warn",children:[n("federation.inbox.quarantined")," (",O.length,")"]}),a.jsx("ul",{className:"fed-entry-list",children:O.map(D=>a.jsxs("li",{className:"fed-entry fed-entry--quarantined",children:[a.jsx("code",{className:"fed-entry-file",children:D.file}),a.jsxs("span",{className:"fed-entry-meta",children:["v",D.version]})]},`q-${D.file}`))})]})]})})()]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.preview.title")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.preview.hint")})]}),a.jsx("div",{className:"fed-preview-head",children:a.jsx("button",{className:"btn btn--secondary",onClick:()=>d.mutate(),disabled:d.isPending,children:d.isPending?n("federation.preview.running"):n("federation.preview")})}),d.isError&&a.jsx("p",{className:"settings-test-err",children:d.error instanceof Error?d.error.message:String(d.error)}),d.data&&a.jsx(sge,{deltas:d.data.deltas,t:n})]})]})]})}function TB({entry:r,fromLabel:e}){return a.jsxs("li",{className:"fed-entry",children:[a.jsxs("div",{className:"fed-entry-head",children:[a.jsx("span",{className:"fed-entry-title",children:r.title}),a.jsx("span",{className:`fed-entry-kind fed-entry-kind--${r.kind}`,children:r.kind})]}),a.jsxs("span",{className:"fed-entry-meta",children:[e," ",a.jsx("strong",{children:r.origin.vault}),r.origin.sourceTimestamp?` · ${r.origin.sourceTimestamp}`:""]})]})}function sge({deltas:r,t:e}){return r.length===0?a.jsx("p",{className:"settings-field-hint",children:e("federation.preview.none")}):a.jsx("ul",{className:"fed-delta-list",children:r.map(i=>{let n;return i.stale?n=e("federation.preview.stale"):i.consented?i.entries.length===0?n=e("federation.preview.nodelta"):n=`${i.entries.length} ${e("federation.preview.entries")}`:n=e("federation.preview.noconsent"),a.jsxs("li",{className:"fed-delta",children:[a.jsxs("div",{className:"fed-delta-head",children:[a.jsx("span",{className:"fed-delta-vault",children:i.vault}),a.jsx("span",{className:"fed-delta-status",children:n})]}),i.entries.length>0&&a.jsx("ul",{className:"fed-entry-list",children:i.entries.map((s,o)=>a.jsx("li",{className:"fed-entry",children:a.jsxs("div",{className:"fed-entry-head",children:[a.jsx("span",{className:"fed-entry-title",children:s.title}),a.jsx("span",{className:`fed-entry-kind fed-entry-kind--${s.kind}`,children:s.kind})]})},`${i.vault}-${o}`))})]},i.vault)})})}function age(){const{data:r,isLoading:e}=Nhe(),i=jhe(),[n,s]=R.useState(""),[o,h]=R.useState(null);R.useEffect(()=>{s((r==null?void 0:r.raw)??"")},[r]);const l=(r==null?void 0:r.warnings)??[],u=(r==null?void 0:r.customFields)??[];return a.jsxs("section",{className:"settings-section",children:[a.jsxs("h2",{className:"settings-section-title",children:["Task Format & Custom Fields",a.jsx("span",{className:"settings-beta-badge",children:"BETA"})]}),a.jsxs("p",{className:"settings-field-hint",children:["Declare custom fields for this project — they’re written to ",a.jsx("code",{children:"overrides/task.md"})," (committed to git) and apply to everyone: the CLI, the dashboard, the main agent, and sleep agents. Required fields must be set on every task. Custom fields sync to ClickUp / GitHub."]}),a.jsxs("details",{className:"tov-doc",children:[a.jsx("summary",{children:"How the format works"}),a.jsxs("div",{className:"tov-doc-body",children:[a.jsxs("p",{children:[a.jsx("code",{children:"_dream_context/overrides/task.md"})," has two parts — YAML frontmatter plus a body. With no file, tasks use the shipped defaults (nothing changes)."]}),a.jsxs("p",{children:[a.jsxs("strong",{children:["1. Frontmatter ",a.jsx("code",{children:"custom_fields:"})]})," — a list; each field accepts:"]}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("code",{children:"name"})," — display name (required)."]}),a.jsxs("li",{children:[a.jsx("code",{children:"key"})," — stable id used by the CLI and backend (optional; defaults to the snake_cased name)."]}),a.jsxs("li",{children:[a.jsx("code",{children:"type"})," — ",a.jsx("code",{children:"text"}),", ",a.jsx("code",{children:"number"}),", ",a.jsx("code",{children:"select"}),", or ",a.jsx("code",{children:"date"}),"."]}),a.jsxs("li",{children:[a.jsx("code",{children:"required"})," — ",a.jsx("code",{children:"true"})," to force the agent to set it on every task (default: optional)."]}),a.jsxs("li",{children:[a.jsx("code",{children:"options"})," — the allowed values, for a ",a.jsx("code",{children:"select"}),"."]}),a.jsxs("li",{children:[a.jsx("code",{children:"sync"})," — ",a.jsx("code",{children:"[clickup, github]"})," (both by default): which backend(s) the field syncs to."]}),a.jsxs("li",{children:[a.jsx("code",{children:"prompt"})," — tells the agent how to fill the field; shown in every agent’s briefing."]})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"2. Body"})," — your task template (the sections a new task scaffolds with;"," ",a.jsx("code",{children:"{{WHY}}"})," is a placeholder), plus an optional ",a.jsx("code",{children:"## Agent Instructions"})," ","section the agents follow when creating a task (it is stripped from the created task). The body is edited via git/CLI — the box below is a read-only preview."]}),a.jsxs("p",{className:"tov-doc-note",children:["Values are set with ",a.jsx("code",{children:"tasks field <slug> <key> <value>"})," or"," ",a.jsx("code",{children:"tasks create --field key=value"}),", and show up wherever a task is read or listed. A malformed field is skipped with a warning — never fatal."]})]})]}),u.length>0&&a.jsx("div",{className:"tov-fields",children:u.map(d=>{var g;return a.jsxs("div",{className:"tov-field",children:[a.jsx("span",{className:"tov-field-name",children:d.name}),a.jsx("span",{className:`tov-field-req${d.required?" tov-field-req--on":""}`,children:d.required?"required":"optional"}),a.jsxs("span",{className:"tov-field-meta",children:["id ",a.jsx("code",{children:d.key})," · ",d.type,d.type==="select"&&((g=d.options)!=null&&g.length)?` (${d.options.join(", ")})`:"",` · ${d.sync.join("+")||"none"}`]}),d.prompt&&a.jsxs("span",{className:"tov-field-prompt",children:["“",d.prompt,"”"]}),a.jsxs("div",{className:"tov-field-actions",children:[a.jsx("button",{type:"button",className:"tov-edit",title:"Edit field","aria-label":`Edit field ${d.name}`,onClick:()=>h(d),children:"✎"}),a.jsx("button",{type:"button",className:"tov-remove",title:"Remove field","aria-label":`Remove field ${d.name}`,onClick:()=>{(o==null?void 0:o.key)===d.key&&h(null),i.mutate(d.key)},children:"×"})]})]},d.key)})}),o?a.jsx(uC,{initial:o,onClose:()=>h(null)},o.key):a.jsx(uC,{},"add"),l.length>0&&a.jsx("ul",{className:"tov-warnings",children:l.map((d,g)=>a.jsxs("li",{children:["⚠ ",d]},g))}),a.jsxs("label",{className:"tov-preview-label",children:["Generated ",a.jsx("code",{children:"overrides/task.md"})," — read-only"]}),a.jsx("textarea",{className:"tov-editor",spellCheck:!1,value:n,readOnly:!0,placeholder:e?"Loading…":"No override yet — add a custom field above to create it.",rows:14})]})}function sl({children:r,...e}){return a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:r})}function oge(r){return a.jsxs(sl,{...r,children:[a.jsx("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.75"}),a.jsx("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.75"}),a.jsx("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.75"}),a.jsx("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.75"})]})}function lge(r){return a.jsx(sl,{...r,children:a.jsx("path",{d:"M6.5 18.5a4 4 0 0 1-.7-7.94 5.25 5.25 0 0 1 10.16-1.9A3.75 3.75 0 0 1 17.5 18.5H6.5Z"})})}function cge(r){return a.jsxs(sl,{...r,children:[a.jsx("ellipse",{cx:"12",cy:"6",rx:"7",ry:"3"}),a.jsx("path",{d:"M5 6v6c0 1.66 3.13 3 7 3s7-1.34 7-3V6"}),a.jsx("path",{d:"M5 12v6c0 1.66 3.13 3 7 3s7-1.34 7-3v-6"})]})}function hge(r){return a.jsxs(sl,{...r,children:[a.jsx("circle",{cx:"6",cy:"12",r:"2.5"}),a.jsx("circle",{cx:"18",cy:"6",r:"2.5"}),a.jsx("circle",{cx:"18",cy:"18",r:"2.5"}),a.jsx("path",{d:"M8.2 10.8 15.8 7.2M8.2 13.2l7.6 3.6"})]})}function uge(r){return a.jsxs(sl,{...r,children:[a.jsx("path",{d:"M8 6h12M8 12h12M8 18h12"}),a.jsx("circle",{cx:"4",cy:"6",r:"1.25",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.25",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4",cy:"18",r:"1.25",fill:"currentColor",stroke:"none"})]})}function dge(r){return a.jsxs(sl,{...r,children:[a.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.25"}),a.jsx("path",{d:"M7.5 9.5 10 12l-2.5 2.5M12.5 14.5h4"})]})}function fge(r){return a.jsx(sl,{...r,children:a.jsx("path",{d:"M20.5 14.3A8.25 8.25 0 0 1 9.7 3.5a8.25 8.25 0 1 0 10.8 10.8Z"})})}function pge(r){return a.jsxs(sl,{...r,children:[a.jsx("path",{d:"M6.5 17.5a4 4 0 0 1-.7-7.94 5.25 5.25 0 0 1 10.16-1.9A3.75 3.75 0 0 1 17.5 17.5H6.5Z"}),a.jsx("path",{d:"M9.5 13.5 12 11l2.5 2.5M12 11v6.5"})]})}const gge={platforms:oge,tasks:lge,memory:cge,connections:hge,format:uge,brain:pge,agents:dge,sleepy:fge};function mge({blocks:r}){return a.jsx("ul",{className:"brain-scrub-list",children:r.map((e,i)=>a.jsxs("li",{className:"brain-scrub-item",children:[a.jsxs("code",{children:[e.file,":",e.line]})," — ",e.excerpt]},i))})}function yge({disabled:r}){const{t:e}=Fr(),{data:i}=$C(),{data:n}=fR(),s=!!(i!=null&&i.connected),o=!!r||!s,[h,l]=R.useState("create"),u=e7(),[d,g]=R.useState(null),p=async()=>{g(null);try{await u.mutateAsync()}catch(ee){g(ee instanceof Error?ee.message:String(ee))}},m=Zz(),[y,w]=R.useState(""),[_,v]=R.useState(!1),[x,C]=R.useState(!1),[k,T]=R.useState(null),[N,j]=R.useState(null),A=async()=>{var ee;if(T(null),j(null),!y.trim()){T(e("brain.create.nameRequired"));return}if(_&&!x){T(e("brain.create.confirmPublicFirst"));return}try{const he=await m.mutateAsync({name:y.trim(),public:_,confirmed:_?x:void 0});if(he.blocked){j(((ee=he.scrub)==null?void 0:ee.blocks)??[]);return}w(""),v(!1),C(!1)}catch(he){T(he instanceof Error?he.message:String(he))}},[E,L]=R.useState(!1),{data:O,isFetching:D,isError:G}=Xz(E),q=Qz(),U=Jz(),[$,F]=R.useState(""),[W,Y]=R.useState(!1),[P,K]=R.useState(null),z=async()=>{K(null),Y(!1);try{await q.mutateAsync($.trim())}catch(ee){K(ee instanceof Error?ee.message:String(ee))}},X=async()=>{K(null);try{const ee=await U.mutateAsync({url:$.trim(),confirmed:!0});if(!ee.ok){K(ee.reason??e("brain.attach.refused"));return}ee.bootstrap==="blocked-scrub"&&K(e("brain.attach.bootstrapBlocked")),F(""),Y(!1)}catch(ee){K(ee instanceof Error?ee.message:String(ee))}},ie=q.data;return a.jsxs("div",{className:`brain-setup${o?" brain-setup--disabled":""}`,children:[!s&&a.jsx("p",{className:"settings-field-hint",children:e("brain.setup.signInFirst")}),n!=null&&n.hasRemote?a.jsxs("div",{className:"brain-setup-connected",children:[a.jsxs("p",{className:"brain-setup-already",children:["✓ ",e("brain.setup.alreadyConnected")," ",a.jsx("code",{children:n.remote})]}),a.jsx("p",{className:"settings-field-hint",children:e("brain.setup.switchHint")}),a.jsx("button",{type:"button",className:"btn btn--ghost",onClick:p,disabled:o||u.isPending,children:u.isPending?e("brain.setup.disconnecting"):e("brain.setup.disconnect")}),d&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",d]})]}):n?a.jsx("p",{className:"settings-field-hint",children:n.codeOrigin?e("brain.setup.inTree").replace("{origin}",n.codeOrigin):e("brain.setup.notConnected")}):null,a.jsx("div",{className:"brain-setup-tabs",role:"tablist",children:["create","discover","attach"].map(ee=>a.jsx("button",{type:"button",role:"tab","aria-selected":h===ee,className:`brain-setup-tab${h===ee?" brain-setup-tab--active":""}`,onClick:()=>l(ee),disabled:o,children:e(`brain.setup.tab.${ee}`)},ee))}),h==="create"&&a.jsxs("div",{className:"brain-setup-panel",children:[a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("brain.create.name")}),a.jsx("input",{className:"settings-text-input",value:y,onChange:ee=>w(ee.target.value),placeholder:e("brain.create.namePlaceholder"),disabled:o})]}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:_,onChange:ee=>{v(ee.target.checked),C(!1)},disabled:o}),a.jsx("span",{children:e("brain.create.makePublic")})]}),_&&a.jsxs("div",{className:"brain-setup-public-warning",children:[a.jsx("p",{children:e("brain.create.publicWarning")}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:x,onChange:ee=>C(ee.target.checked),disabled:o}),a.jsx("span",{children:e("brain.create.publicConfirm")})]})]}),a.jsx("button",{type:"button",className:"btn btn--primary",onClick:A,disabled:o||m.isPending,children:m.isPending?e("brain.create.creating"):e("brain.create.submit")}),k&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",k]}),N&&a.jsxs("div",{className:"brain-scrub-block",children:[a.jsxs("p",{className:"settings-test-err",children:["✗ ",e("brain.create.scrubBlocked")]}),a.jsx(mge,{blocks:N})]})]}),h==="discover"&&a.jsxs("div",{className:"brain-setup-panel",children:[a.jsx("button",{type:"button",className:"btn btn--secondary",onClick:()=>L(!0),disabled:o||D,children:e(D?"brain.discover.loading":"brain.discover.find")}),G&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",e("brain.discover.error")]}),E&&!D&&(O??[]).length===0&&!G&&a.jsx("p",{className:"settings-field-hint",children:e("brain.discover.empty")}),(O??[]).length>0&&a.jsx("ul",{className:"brain-discover-list",children:O.map(ee=>a.jsxs("li",{className:"brain-discover-item",children:[a.jsxs("span",{className:"brain-discover-name",children:[ee.fullName,ee.private&&a.jsx("span",{className:"brain-discover-private",children:e("brain.discover.private")})]}),a.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>{F(ee.htmlUrl),l("attach")},children:e("brain.discover.select")})]},ee.fullName))})]}),h==="attach"&&a.jsxs("div",{className:"brain-setup-panel",children:[a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("brain.attach.url")}),a.jsx("input",{className:"settings-text-input",value:$,onChange:ee=>{F(ee.target.value),Y(!1)},placeholder:"https://github.com/owner/brain-repo",disabled:o})]}),a.jsx("button",{type:"button",className:"btn btn--secondary",onClick:z,disabled:o||q.isPending||!$.trim(),children:q.isPending?e("brain.attach.previewing"):e("brain.attach.preview")}),ie&&a.jsx("div",{className:"brain-attach-preview",children:ie.reachable?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"brain-trust-warning",children:[a.jsx("p",{className:"brain-trust-warning-title",children:e("brain.attach.trustTitle")}),a.jsx("p",{children:e("brain.attach.trustBody")})]}),a.jsxs("dl",{className:"brain-attach-meta",children:[a.jsx("dt",{children:e("brain.attach.repo")}),a.jsx("dd",{children:ie.fullName}),a.jsx("dt",{children:e("brain.attach.visibility")}),a.jsx("dd",{children:ie.private?e("brain.attach.private"):e("brain.attach.publicVisibility")}),a.jsx("dt",{children:e("brain.attach.isBrainRepo")}),a.jsx("dd",{children:ie.isBrainRepo?"✓":`✗ ${e("brain.attach.notBrainRepo")}`}),a.jsx("dt",{children:e("brain.attach.branch")}),a.jsx("dd",{children:ie.defaultBranch})]}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:W,onChange:ee=>Y(ee.target.checked),disabled:o}),a.jsx("span",{children:e("brain.attach.iTrust")})]}),a.jsx("button",{type:"button",className:"btn btn--primary",onClick:X,disabled:o||U.isPending||!W,children:U.isPending?e("brain.attach.attaching"):e("brain.attach.submit")})]}):a.jsxs("p",{className:"settings-test-err",children:["✗ ",ie.reason??e("brain.attach.unreachable")]})}),P&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",P]})]})]})}function bge(r){const e=[];r.metaKey&&e.push("Cmd"),r.ctrlKey&&e.push("Ctrl"),r.altKey&&e.push("Alt"),r.shiftKey&&e.push("Shift");let i=r.key;return["Meta","Control","Alt","Shift"].includes(i)||(i===" "?i="Space":i.length===1?i=i.toUpperCase():i=i.charAt(0).toUpperCase()+i.slice(1),e.length===0)?null:[...e,i].join("+")}const vge=[{id:"claude",labelKey:"settings.platform.claude"}],__={platforms:[],disableNativeMemory:!0},xge=[{id:"platforms",labelKey:"settings.nav.platforms",descKey:"settings.navdesc.platforms"},{id:"tasks",labelKey:"settings.nav.tasks",descKey:"settings.navdesc.tasks"},{id:"memory",labelKey:"settings.nav.memory",descKey:"settings.navdesc.memory"},{id:"connections",labelKey:"settings.nav.connections",descKey:"settings.navdesc.connections"},{id:"brain",labelKey:"settings.nav.brain",descKey:"settings.navdesc.brain"},{id:"format",labelKey:"settings.nav.format",descKey:"settings.navdesc.format",beta:!0},{id:"agents",labelKey:"settings.nav.agents",descKey:"settings.navdesc.agents",desktopOnly:!0,beta:!0},{id:"sleepy",labelKey:"settings.nav.sleepy",descKey:"settings.navdesc.sleepy",desktopOnly:!0,lab:!0}];function _ge({focus:r}){var se;const{t:e}=Fr(),i=rr(),{data:n,isLoading:s,isError:o}=Xpe(),h=Zpe(),{data:l}=J6(),u=((l==null?void 0:l.desktop)??!1)||un(),{data:d}=Uz(),g=Wz(),[p,m]=R.useState("platforms"),y=xge.filter(oe=>!oe.desktopOnly||u),[w,_]=R.useState(__.platforms),[v,x]=R.useState(__.disableNativeMemory),[C,k]=R.useState(!1),[T,N]=R.useState("clickup"),[j,A]=R.useState(""),[E,L]=R.useState(""),[O,D]=R.useState(""),[G,q]=R.useState(""),[U,$]=R.useState(""),[F,W]=R.useState(""),[Y,P]=R.useState(""),[K,z]=R.useState(null),[X,ie]=R.useState(!1),[ee,he]=R.useState(null),[fe,ne]=R.useState(null),[I,Z]=R.useState(!1),[J,re]=R.useState(null),[ue,Le]=R.useState(!1),[Ze,qe]=R.useState(!1),[Ye,pe]=R.useState(()=>_w()),[Ne,de]=R.useState(!1),Ue=oe=>{pe(oe),aQ(oe),m1(oe)},[at,Pt]=R.useState(null),[Mt,Lt]=R.useState(!1),Bt=R.useRef(null);R.useEffect(()=>{if(!u)return;let oe=!1;return iF().then(we=>{oe||Pt(we)}),()=>{oe=!0}},[u]);const bt=oe=>{Pt(oe),jle(oe)},{data:Se}=Zt({queryKey:["tasks-sync-status"],queryFn:()=>ze.get("/tasks/sync-status"),select:oe=>oe.status}),{data:De}=Zt({queryKey:["tasks-token-status"],queryFn:()=>ze.get("/tasks/token-status"),enabled:C}),Me=De&&De.backend===T?De:void 0,{data:Je}=Zt({queryKey:["tasks-containers"],queryFn:()=>ze.get("/tasks/containers"),select:oe=>oe.containers,enabled:C,staleTime:300*1e3}),wt=oe=>{const we=(Je??[]).find(tt=>tt.path===oe);we&&(T==="github"?(q(we.ids.owner??""),$(we.ids.repo??"")):(A(we.ids.teamId??""),L(we.ids.spaceId??""),D(we.ids.listId??"")),Ge())},ot=async()=>{const oe=C?T:"local",we=(T==="github"?Y:F).trim();try{return await h.mutateAsync({platforms:w,disableNativeMemory:v,taskBackend:oe,...C&&T==="clickup"?{clickup:{teamId:j||void 0,spaceId:E||void 0,listId:O||void 0}}:{},...C&&T==="github"?{github:{owner:G||void 0,repo:U||void 0}}:{}}),C&&we&&await ze.post("/tasks/token",{token:we}),we&&(T==="github"?P(""):W("")),await Promise.all([i.invalidateQueries({queryKey:["tasks-token-status"]}),i.invalidateQueries({queryKey:["tasks-containers"]}),i.invalidateQueries({queryKey:["tasks-sync-status"]})]),Le(!1),re(null),!0}catch(tt){return re(tt instanceof Error?tt.message:String(tt)),!1}},At=oe=>oe.errors.length>0?`⚠ ${oe.errors[0]}`:oe.created.length>0?`✓ ${e("settings.cloud_tasks.provision_created")}: ${oe.created.join(", ")}${oe.backfilled>0?` · ${e("settings.cloud_tasks.provision_backfilled").replace("{n}",String(oe.backfilled))}`:""}`:`✓ ${e("settings.cloud_tasks.provision_nothing")}`,Te=oe=>!oe||!oe.set?e("settings.cloud_tasks.api_key_none"):oe.source==="env"?`${e("settings.cloud_tasks.api_key_env")} ${oe.masked??""}`.trim():`${e("settings.cloud_tasks.api_key_set")} ${oe.masked??""}`.trim(),ft=async()=>{Z(!0),he(null),ne(null);try{if(!await ot())return;const{result:oe}=await ze.post("/tasks/provision",{dryRun:!0});oe.created.length===0&&oe.errors.length===0?he(`✓ ${e("settings.cloud_tasks.provision_nothing")}`):ne(oe)}catch(oe){he(`⚠ ${oe instanceof Error?oe.message:String(oe)}`)}finally{Z(!1)}},lt=async()=>{Z(!0),he(null);try{const{result:oe}=await ze.post("/tasks/provision",{dryRun:!1});ne(null),he(At(oe)),i.invalidateQueries({queryKey:["tasks-sync-status"]})}catch(oe){he(`⚠ ${oe instanceof Error?oe.message:String(oe)}`)}finally{Z(!1)}};if(R.useEffect(()=>{var tt,Et,dt,nt,it;const oe=n??__;_(oe.platforms),x(oe.disableNativeMemory??!0);const we=n;k((we==null?void 0:we.taskBackend)==="clickup"||(we==null?void 0:we.taskBackend)==="github"),N((we==null?void 0:we.taskBackend)==="github"?"github":"clickup"),A(((tt=we==null?void 0:we.clickup)==null?void 0:tt.teamId)??""),L(((Et=we==null?void 0:we.clickup)==null?void 0:Et.spaceId)??""),D(((dt=we==null?void 0:we.clickup)==null?void 0:dt.listId)??""),q(((nt=we==null?void 0:we.github)==null?void 0:nt.owner)??""),$(((it=we==null?void 0:we.github)==null?void 0:it.repo)??""),Le(!1),qe(!1)},[n]),R.useEffect(()=>{(r==null?void 0:r.id)==="brain"&&m("brain")},[r==null?void 0:r.id,r==null?void 0:r.nonce]),s)return a.jsx("div",{className:"loading",children:e("common.loading")});if(o)return a.jsx("div",{className:"error-state",children:e("common.error")});const be=oe=>{_(we=>{const tt=we.includes(oe)?we.filter(Et=>Et!==oe):[...we,oe];return Le(!0),qe(!1),tt})},ye=()=>{x(oe=>!oe),Le(!0),qe(!1)},et=async()=>{qe(!1),await ot()&&qe(!0)},Ge=()=>{Le(!0),qe(!1)},vt=(n==null?void 0:n.shareable)===!0,ut=oe=>{h.mutate({shareable:oe})},kt=async()=>{ie(!0),z(null),ne(null);try{if(!await ot())return;z(await ze.post("/tasks/sync-test",{}))}catch(oe){z({ok:!1,backend:T,error:oe instanceof Error?oe.message:String(oe)})}finally{ie(!1)}};return a.jsxs("div",{className:"settings-page",children:[a.jsx("div",{className:"settings-header",children:a.jsxs("div",{className:"settings-save-row",children:[Ze&&!ue&&a.jsx("span",{className:"settings-saved",children:e("settings.saved")}),h.isError&&a.jsx("span",{className:"settings-error",children:e("common.error")}),a.jsx("button",{className:"btn btn--primary",onClick:et,disabled:!ue||h.isPending,children:h.isPending?e("settings.saving"):e("settings.save")})]})}),n===null&&a.jsx("div",{className:"settings-empty-notice",children:e("settings.no_config")}),a.jsxs("div",{className:"settings-body",children:[a.jsx("nav",{className:"settings-nav","aria-label":e("settings.title"),children:y.map(oe=>{const we=gge[oe.id],tt=p===oe.id;return a.jsxs("button",{type:"button",className:`settings-nav-item${tt?" settings-nav-item--active":""}`,"aria-current":tt?"page":void 0,onClick:()=>m(oe.id),children:[a.jsx("span",{className:"settings-nav-icon","aria-hidden":"true",children:we?a.jsx(we,{}):null}),a.jsxs("span",{className:"settings-nav-text",children:[a.jsxs("span",{className:"settings-nav-label",children:[e(oe.labelKey),oe.lab&&a.jsx("span",{className:"settings-lab-badge",children:e("nav.lab")}),oe.beta&&a.jsx("span",{className:"settings-beta-badge",children:"BETA"})]}),a.jsx("span",{className:"settings-nav-desc",children:e(oe.descKey)})]})]},oe.id)})}),a.jsxs("div",{className:"settings-content",children:[p==="platforms"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.platforms")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.platforms")})]}),a.jsx("div",{className:"settings-checkboxes",children:vge.map(({id:oe,labelKey:we})=>a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:w.includes(oe),onChange:()=>be(oe)}),a.jsx("span",{children:e(we)})]},oe))})]}),p==="tasks"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.tasks")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.tasks")})]}),a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:C,onChange:()=>{k(oe=>!oe),Ge()}}),a.jsx("span",{children:e("settings.cloud_tasks.label")})]}),a.jsx("p",{className:"settings-field-hint",children:e(T==="github"?"settings.cloud_tasks.github.hint":"settings.cloud_tasks.hint")}),C&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.provider")}),a.jsxs("select",{className:"settings-text-input",value:T,onChange:oe=>{const we=oe.target.value;N(we),z(null),Ge()},children:[a.jsx("option",{value:"clickup",children:e("settings.cloud_tasks.provider.clickup")}),a.jsx("option",{value:"github",children:e("settings.cloud_tasks.provider.github")})]})]}),T==="clickup"&&a.jsxs(a.Fragment,{children:[(Je??[]).length>0&&a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.list_label")}),a.jsx(ff,{value:O?((se=(Je??[]).find(oe=>oe.ids.listId===O))==null?void 0:se.path)??null:null,options:(Je??[]).map(oe=>({value:oe.path,label:oe.path})),placeholder:e("settings.cloud_tasks.list_pick"),searchPlaceholder:e("settings.cloud_tasks.list_search"),clearLabel:e("settings.cloud_tasks.keep_current"),onChange:wt})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.team")}),a.jsx("input",{className:"settings-text-input",value:j,onChange:oe=>{A(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.space")}),a.jsx("input",{className:"settings-text-input",value:E,onChange:oe=>{L(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.list")}),a.jsx("input",{className:"settings-text-input",value:O,onChange:oe=>{D(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.api_key")}),a.jsx("input",{type:"password",className:"settings-text-input",autoComplete:"off",value:F,placeholder:Me!=null&&Me.set?Me.masked??"••••••••":e("settings.cloud_tasks.api_key_placeholder"),onChange:oe=>{W(oe.target.value),Ge()}})]}),a.jsx("p",{className:"settings-field-hint",children:Te(Me)}),a.jsx("p",{className:"settings-field-hint",children:e("settings.cloud_tasks.token_hint")})]}),T==="github"&&a.jsxs(a.Fragment,{children:[(Je??[]).length>0&&a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.github.repo_picker")}),a.jsx(ff,{value:G&&U?`${G}/${U}`:null,options:(Je??[]).map(oe=>({value:oe.path,label:oe.path})),placeholder:e("settings.cloud_tasks.github.pick"),searchPlaceholder:e("settings.cloud_tasks.github.search"),clearLabel:e("settings.cloud_tasks.keep_current"),onChange:wt})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.github.owner")}),a.jsx("input",{className:"settings-text-input",value:G,onChange:oe=>{q(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.github.repo")}),a.jsx("input",{className:"settings-text-input",value:U,onChange:oe=>{$(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.api_key")}),a.jsx("input",{type:"password",className:"settings-text-input",autoComplete:"off",value:Y,placeholder:Me!=null&&Me.set?Me.masked??"••••••••":e("settings.cloud_tasks.api_key_placeholder"),onChange:oe=>{P(oe.target.value),Ge()}})]}),a.jsx("p",{className:"settings-field-hint",children:Te(Me)}),a.jsx("p",{className:"settings-field-hint",children:e("settings.cloud_tasks.github.token_hint")})]}),a.jsxs("div",{className:"settings-test-row",children:[a.jsx("button",{className:"btn btn--secondary",onClick:kt,disabled:X||I,children:e(X?"settings.cloud_tasks.testing":"settings.cloud_tasks.test")}),a.jsx("button",{className:"btn btn--secondary",onClick:ft,disabled:I||X,children:e(I&&!fe?T==="github"?"settings.cloud_tasks.github.provisioning":"settings.cloud_tasks.provisioning":T==="github"?"settings.cloud_tasks.github.provision":"settings.cloud_tasks.provision")}),K&&K.ok&&a.jsxs("span",{className:"settings-test-ok",children:["✓ ",K.note??`${e("settings.cloud_tasks.test_ok")} ${K.user}`]}),K&&!K.ok&&a.jsxs("span",{className:"settings-test-err",children:["✗ ",K.error]})]}),J&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",J]}),ee&&a.jsx("p",{className:"settings-field-hint",children:ee}),fe&&a.jsxs("div",{className:"settings-provision-preview",children:[a.jsx("p",{className:"settings-provision-preview-title",children:e(T==="github"?"settings.cloud_tasks.github.preview_title":"settings.cloud_tasks.preview_title")}),fe.created.length>0&&a.jsxs("p",{className:"settings-provision-line",children:[a.jsx("span",{className:"settings-provision-badge settings-provision-badge--new",children:e("settings.cloud_tasks.preview_will_create").replace("{n}",String(fe.created.length))})," ",fe.created.join(", ")]}),fe.existing.length>0&&a.jsxs("p",{className:"settings-provision-line settings-provision-line--muted",children:[a.jsx("span",{className:"settings-provision-badge",children:e("settings.cloud_tasks.preview_existing").replace("{n}",String(fe.existing.length))})," ",fe.existing.join(", ")]}),a.jsxs("div",{className:"settings-provision-actions",children:[a.jsx("button",{className:"btn btn--primary",onClick:lt,disabled:I,children:I?e("settings.cloud_tasks.provision_creating"):e("settings.cloud_tasks.provision_confirm").replace("{n}",String(fe.created.length))}),a.jsx("button",{className:"btn btn--ghost",onClick:()=>ne(null),disabled:I,children:e("settings.cloud_tasks.provision_cancel")})]})]}),Se&&Se.backend!=="local"&&a.jsxs("p",{className:"settings-sync-badge",children:[e("settings.cloud_tasks.status"),": ",Se.pendingPush," ",e("settings.cloud_tasks.pending"),Se.conflicts>0&&` · ${Se.conflicts} ${e("settings.cloud_tasks.conflicts")}`]})]})]})]}),p==="format"&&a.jsx(age,{}),p==="memory"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.memory")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.memory")})]}),a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:v,onChange:ye}),a.jsx("span",{children:e("settings.native_memory.label")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.native_memory.hint")})]})]}),p==="connections"&&a.jsx(nge,{shareable:vt,onToggleShareable:ut,shareablePending:h.isPending}),p==="brain"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"fed-head",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.brain")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.brain")})]}),a.jsxs("label",{className:"fed-sharing-toggle settings-checkbox-label",title:e("brain.cloudSync.hint"),children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:(d==null?void 0:d.enabled)??!1,disabled:g.isPending,onChange:oe=>g.mutate(oe.target.checked)}),a.jsxs("span",{children:[e("brain.cloudSync.label"),d&&a.jsxs("span",{className:"settings-field-hint brain-cloudsync-source",children:[" ","(",d.source==="explicit"?e("brain.cloudSync.source.explicit"):e("brain.cloudSync.source.derived"),")"]})]})]})]}),a.jsxs("div",{className:"settings-subsection",children:[a.jsx("h3",{className:"settings-nav-label",children:e("brain.auth.title")}),a.jsx(sce,{})]}),a.jsxs("div",{className:"settings-subsection",children:[a.jsx("h3",{className:"settings-nav-label",children:e("brain.setup.title")}),a.jsx(yge,{disabled:!((d==null?void 0:d.enabled)??!1)})]})]}),p==="agents"&&u&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("h2",{className:"settings-section-title",children:[e("settings.agents.title"),a.jsx("span",{className:"settings-beta-badge",children:"BETA"})]}),at?a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:at.enabled,onChange:()=>bt({...at,enabled:!at.enabled})}),a.jsx("span",{children:e("settings.agents.enable")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.enable_hint")}),at.enabled&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:at.restoreTabs,onChange:()=>bt({...at,restoreTabs:!at.restoreTabs})}),a.jsx("span",{children:e("settings.agents.restore_tabs")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.restore_tabs_hint")}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.agents.default_agent")}),a.jsx("select",{className:"settings-text-input",value:at.defaultAgent,onChange:oe=>bt({...at,defaultAgent:oe.target.value}),children:a.jsx("option",{value:"claude",children:e("settings.agents.agent.claude")})})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.default_agent_hint")}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:at.autoTitle,onChange:()=>bt({...at,autoTitle:!at.autoTitle})}),a.jsx("span",{children:e("settings.agents.auto_title")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.auto_title_hint")}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.agents.hotkey")}),a.jsx("input",{className:"settings-text-input",readOnly:!0,value:Mt?e("settings.agents.hotkey_capturing"):Lle(at.hotkey),onFocus:()=>{Lt(!0),Bt.current=null},onBlur:()=>{Lt(!1),Bt.current=null},onKeyDown:oe=>{if(oe.preventDefault(),oe.key==="Backspace"||oe.key==="Delete"){bt({...at,hotkey:""}),Bt.current=null,Lt(!1),oe.currentTarget.blur();return}const we=oF(oe);if(we){if(oe.repeat)return;const Et=Date.now(),dt=Bt.current;dt&&dt.token===we&&Et-dt.ts<=sF?(Bt.current=null,bt({...at,hotkey:`${we}+${we}`}),Lt(!1),oe.currentTarget.blur()):Bt.current={token:we,ts:Et};return}Bt.current=null;const tt=nF(oe);tt&&(bt({...at,hotkey:tt}),Lt(!1),oe.currentTarget.blur())}})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.hotkey_hint")})]})]}):a.jsx("p",{className:"settings-field-hint",children:e("common.loading")})]}),p==="sleepy"&&u&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("h2",{className:"settings-section-title",children:["Sleepy — notch quick-capture",a.jsx("span",{className:"settings-lab-badge",children:e("nav.lab")})]}),a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:Ye.enabled,onChange:()=>Ue({...Ye,enabled:!Ye.enabled})}),a.jsx("span",{children:"Enable Sleepy"})]}),a.jsx("p",{className:"settings-field-hint",children:"Press the hotkey anywhere to drop a capture bar under the notch: pick a project, type a thought, hit return — it's saved to that project's memory and learned."}),Ye.enabled&&a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:"Hotkey"}),a.jsx("input",{className:"settings-text-input",readOnly:!0,value:Ne?"Press a key combo…":Ye.hotkey,onFocus:()=>de(!0),onBlur:()=>de(!1),onKeyDown:oe=>{oe.preventDefault();const we=bge(oe);we&&(Ue({...Ye,hotkey:we}),de(!1),oe.currentTarget.blur())}})]})]})]})]})]})]})}function _$(){return Zt({queryKey:["packs"],queryFn:()=>ze.get("/packs")})}function Cge(){const r=rr();return sr({mutationFn:e=>ze.post(`/packs/${encodeURIComponent(e)}/install`,{}),onSuccess:()=>{r.invalidateQueries({queryKey:["packs"]})}})}function wge(){const r=rr();return sr({mutationFn:e=>ze.del(`/packs/${encodeURIComponent(e)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["packs"]})}})}function kge(r){return"base"in r}function C$({item:r,onActionDone:e}){const{t:i}=Fr(),n=Cge(),s=wge(),o=r.installed,h=o?s:n,l=h.isPending,u=h.isError,d=i(o?"packs.action.remove":"packs.action.install"),g=i(o?"packs.action.removing":"packs.action.installing"),p=l?g:d,m=y=>{y.stopPropagation(),y.preventDefault(),!l&&h.mutate(r.name,{onSuccess:()=>e==null?void 0:e()})};return a.jsxs("div",{className:"packs-card-actions",children:[a.jsx("button",{type:"button",className:`packs-action-btn btn btn--ghost${o?" packs-action-btn--danger":""}`,onClick:m,disabled:l,"aria-invalid":u||void 0,"aria-busy":l||void 0,children:p}),u&&a.jsx("span",{className:"packs-action-error",role:"alert",children:i("packs.action.error")})]})}function Sge({item:r,onClose:e}){const{t:i}=Fr(),n=R.useCallback(s=>{s.target===s.currentTarget&&e()},[e]);return R.useEffect(()=>{const s=o=>{o.key==="Escape"&&e()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),a.jsx("div",{className:"packs-modal-overlay",onClick:n,"aria-modal":"true",role:"dialog","aria-label":r.name,children:a.jsxs("div",{className:"packs-modal-panel",children:[a.jsxs("div",{className:"packs-modal-header",children:[a.jsxs("div",{className:"packs-modal-title-row",children:[a.jsx("h2",{className:"packs-modal-name",children:r.name}),r.installed&&a.jsx("span",{className:"packs-installed-pill",children:i("settings.packs.installed")})]}),a.jsxs("div",{className:"packs-modal-header-actions",children:[a.jsx(C$,{item:r,onActionDone:e}),a.jsx("button",{className:"packs-modal-close btn btn--ghost",type:"button",onClick:e,"aria-label":i("packs.detail.close"),children:i("packs.detail.close")})]})]}),r.description&&a.jsx("p",{className:"packs-modal-desc",children:r.description}),r.tags.length>0&&a.jsx("div",{className:"packs-modal-tags",children:r.tags.map(s=>a.jsx("span",{className:"task-tag","data-hue":na(s),children:s},s))}),kge(r)&&a.jsxs(a.Fragment,{children:[r.base&&a.jsxs("div",{className:"packs-modal-section",children:[a.jsx("h3",{className:"packs-modal-section-title",children:i("packs.detail.base")}),a.jsx("p",{className:"packs-modal-mono",children:r.base})]}),r.subSkills.length>0&&a.jsxs("div",{className:"packs-modal-section",children:[a.jsx("h3",{className:"packs-modal-section-title",children:i("packs.detail.subskills")}),a.jsx("ul",{className:"packs-modal-subskills",children:r.subSkills.map(s=>a.jsxs("li",{className:"packs-modal-subskill",children:[a.jsx("span",{className:"packs-modal-subskill-name",children:s.name}),s.description&&a.jsx("span",{className:"packs-modal-subskill-desc",children:s.description})]},s.name))})]}),r.relatedAgents&&r.relatedAgents.length>0&&a.jsxs("div",{className:"packs-modal-section",children:[a.jsx("h3",{className:"packs-modal-section-title",children:i("packs.detail.agents")}),a.jsx("ul",{className:"packs-modal-agents",children:r.relatedAgents.map(s=>a.jsx("li",{className:"packs-modal-agent",children:s},s))})]})]})]})})}function EB({item:r,onClick:e}){const{t:i}=Fr(),n=s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),e(r))};return a.jsxs("div",{className:"packs-card packs-card--clickable",role:"button",tabIndex:0,onClick:()=>e(r),onKeyDown:n,"aria-label":r.name,children:[a.jsxs("div",{className:"packs-card-header",children:[a.jsx("span",{className:"packs-card-name",children:r.name}),r.installed&&a.jsx("span",{className:"packs-installed-pill",children:i("settings.packs.installed")})]}),r.description&&a.jsx("p",{className:"packs-card-desc",children:r.description}),r.tags.length>0&&a.jsx("div",{className:"packs-card-tags",children:r.tags.map(s=>a.jsx("span",{className:"task-tag","data-hue":na(s),children:s},s))}),a.jsx(C$,{item:r})]})}function Tge(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=_$(),[o,h]=R.useState(null);if(i)return a.jsx("div",{className:"loading",children:r("common.loading")});if(n)return a.jsxs("div",{className:"error-state",children:[r("common.error")," ",s==null?void 0:s.message]});const l=(e==null?void 0:e.packs)??[],u=(e==null?void 0:e.standalone)??[];return a.jsxs("div",{className:"packs-page",children:[l.length===0&&u.length===0&&a.jsx("div",{className:"packs-empty",children:r("common.empty")}),l.length>0&&a.jsxs("section",{className:"packs-section",children:[a.jsx("h2",{className:"packs-section-title",children:r("packs.section.packs")}),a.jsx("div",{className:"packs-grid",children:l.map(d=>a.jsx(EB,{item:d,onClick:h},d.name))})]}),u.length>0&&a.jsxs("section",{className:"packs-section",children:[a.jsx("h2",{className:"packs-section-title",children:r("packs.section.standalone")}),a.jsx("div",{className:"packs-grid",children:u.map(d=>a.jsx(EB,{item:d,onClick:h},d.name))})]}),o!==null&&a.jsx(Sge,{item:o,onClose:()=>h(null)})]})}function Ege(){return a.jsxs("header",{className:"about-hero",children:[a.jsxs("div",{className:"about-hero-copy",children:[a.jsxs("a",{className:"about-lockup",href:"#top","aria-label":"dreamcontext",children:[a.jsx(ab,{size:34,className:"about-lockup-mark",glow:!0}),a.jsxs("span",{className:"about-lockup-word",children:["dream",a.jsx("span",{style:{color:"var(--color-accent)"},children:"context"})]})]}),a.jsxs("h1",{className:"about-title",children:["The persistent brain for",a.jsx("span",{className:"about-title-accent",children:" AI natives."})]}),a.jsxs("p",{className:"about-lead",children:["It remembers every decision you made, knows how your project is structured, and is learning to act on that knowledge — so every session starts ",a.jsx("em",{children:"ready"})," instead of blind. Built for founders and builders, technical or not."]}),a.jsxs("div",{className:"about-compat",children:[a.jsx("span",{className:"about-compat-mark","aria-hidden":"true",children:"✓"}),"Works with ",a.jsx("strong",{children:"Claude Code"})]}),a.jsxs("div",{className:"about-cta-row",children:[a.jsx("code",{className:"about-command",children:"npm i -g dreamcontext"}),a.jsx("a",{className:"about-link-btn",href:"https://www.npmjs.com/package/dreamcontext",target:"_blank",rel:"noreferrer",children:"npm ↗"}),a.jsx("a",{className:"about-link-btn about-link-btn--ghost",href:"https://github.com/meanllbrl/dreamcontext",target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),a.jsxs("div",{className:"about-hero-media",children:[a.jsx("div",{className:"about-hero-aura","aria-hidden":"true"}),a.jsxs("video",{className:"about-hero-video",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,poster:"/media/brain-hero.png",children:[a.jsx("source",{src:"/media/brain.webm",type:"video/webm"}),a.jsx("source",{src:"/media/brain.mp4",type:"video/mp4"})]})]})]})}function Nge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"The problem"}),a.jsx("h2",{className:"about-h2",children:"Your project is bigger than anyone can hold."}),a.jsxs("p",{className:"about-section-lead",children:["dreamcontext isn't a memory file. It builds a deep understanding of your whole project — the company, the codebase, even how you work — then ",a.jsx("em",{children:"surfaces what's hiding"}),": the scattered decisions, the forgotten reasons, the connections no one wrote down. Because it never forgets and sees the whole graph, the agent sometimes understands your project better than you do."]}),a.jsxs("div",{className:"about-contrast",children:[a.jsxs("div",{className:"about-contrast-card about-contrast-card--bad",children:[a.jsx("span",{className:"about-contrast-tag",children:"Without dreamcontext"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Decisions scatter across chats, commits, and your head"}),a.jsx("li",{children:`The "why" behind last month's choice is already gone`}),a.jsx("li",{children:"You re-explain the project from scratch every session"}),a.jsx("li",{children:"Blind to the connections between what you've decided"})]})]}),a.jsxs("div",{className:"about-contrast-card about-contrast-card--good",children:[a.jsx("span",{className:"about-contrast-tag",children:"With dreamcontext"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Deep understanding of the whole project, across every session"}),a.jsx("li",{children:"Surfaces the hidden links between scattered decisions"}),a.jsx("li",{children:"Holds the whole picture — company, code, and work-life context"}),a.jsx("li",{children:"Gets sharper every time it consolidates what changed"})]})]})]})]})}function hn(r,e,i,n){const s=(e+n)/2;return`M ${r} ${e} C ${r} ${s}, ${i} ${s}, ${i} ${n}`}const Uk=[{file:"soul",region:"Identity",glyph:"◆"},{file:"user",region:"Episodic",glyph:"◉"},{file:"memory",region:"Semantic",glyph:"✦"},{file:"knowledge",region:"Procedural",glyph:"⚙"},{file:"state",region:"Working",glyph:"▦"},{file:"data-structures",region:"Schema",glyph:"▤"},{file:"skills",region:"Capabilities",glyph:"✧"},{file:"sub-agents",region:"Workers",glyph:"⬡"}],Ol=600,hb=250,w$=92,pc=4,NB=(1200-pc*hb)/(pc+1),Wk=196,Age=320,jge=Age-Wk,Mge=120,k$=470,Lge=548,AB=632;function S$(r){return NB+r*(hb+NB)}function T$(r){return S$(r)+hb/2}function E$(r){return Wk+r*jge}const Bge=Uk.map((r,e)=>{const i=e%pc,n=Math.floor(e/pc);return{id:`cat-${r.file}`,x:S$(i),y:E$(n),w:hb,h:w$,title:r.file,sub:r.region,glyph:r.glyph,variant:"region",breathe:!0,breatheDelay:e*.18}}),Rge=Uk.slice(0,pc).map((r,e)=>({id:`fan-${e}`,d:hn(Ol,Mge,T$(e),Wk),travel:220,delay:e*.18,dur:2.6})),Oge=Uk.map((r,e)=>{const i=e%pc,n=Math.floor(e/pc);return{id:`conv-${r.file}`,d:hn(T$(i),E$(n)+w$,Ol,k$),travel:300,delay:.5+e*.12,dur:2.8}}),Dge={viewBox:"0 0 1200 780",ariaLabel:"How dreamcontext works: a SessionStart hook preloads eight context categories — identity, episodic, semantic, procedural, working, schema, capabilities and workers — with zero tool calls. The agent then works with the whole picture, and RemSleep parallel specialists consolidate the session and feed the distilled knowledge back into the context categories. The loop is the product.",nodes:[{id:"hook",x:Ol-215,y:40,w:430,h:80,title:"SessionStart hook fires",sub:"preloads context · 0 tool calls",variant:"hook"},...Bge,{id:"agent",x:Ol-250,y:k$,w:500,h:78,title:"Your agent works with the whole picture",sub:"no re-exploring · no blind search spiral",variant:"agent"},{id:"rem",x:Ol-200,y:AB,w:400,h:78,title:"RemSleep — parallel specialists",sub:"multi-agent consolidation",variant:"rem"}],edges:[...Rge,...Oge,{id:"agent-rem",d:`M ${Ol} ${Lge} L ${Ol} ${AB}`,travel:90,delay:1.6,dur:1.8},{id:"feedback",d:"M 800 671 C 1140 671, 1170 470, 1170 300 C 1170 170, 1110 170, 1010 170",dashed:!0,travel:520,delay:0,dur:4.2,label:{text:"consolidates & feeds back",x:1180,y:420,rotate:90}}]},Ks=550,ub=300,N$=116,jB=3,MB=(1100-jB*ub)/(jB+1),Gk=280,Ige=196,A$=470,Fge=540,LB=596;function j$(r){return MB+r*(ub+MB)}function M$(r){return j$(r)+ub/2}const Kk=[{id:"sleep-tasks",title:"sleep-tasks",sub:"state/*.md tasks"},{id:"sleep-state",title:"sleep-state",sub:"soul · user · memory · core 3-6 · data-structures · changelog · releases"},{id:"sleep-product",title:"sleep-product",sub:"knowledge/ + features/ · conditional"}],$ge=Kk.map((r,e)=>({id:r.id,x:j$(e),y:Gk,w:ub,h:N$,title:r.title,sub:r.sub,variant:"region",breathe:!0,breatheDelay:e*.25})),Pge=Kk.map((r,e)=>({id:`fan-${r.id}`,d:hn(Ks,Ige,M$(e),Gk),travel:200,delay:e*.3,dur:2.4})),zge=Kk.map((r,e)=>({id:`conv-${r.id}`,d:hn(M$(e),Gk+N$,Ks,A$),travel:200,delay:.9+e*.2,dur:2.4})),qge={viewBox:"0 0 1100 680",ariaLabel:"Sleep consolidation: sessions accumulate sleep debt; running sleep start fans out to three parallel specialists — sleep-tasks updates task files, sleep-state updates core files, changelog and releases, and sleep-product conditionally updates knowledge and feature docs. Their reports converge into updated system knowledge, then sleep done resets the debt.",nodes:[{id:"debt",x:Ks-230,y:36,w:460,h:76,title:"Sessions accumulate → sleep debt",sub:"Alert · Drowsy · Sleepy · Must Sleep",variant:"accent"},{id:"sleep-start",x:Ks-130,y:132,w:260,h:64,title:"sleep start",sub:"pins the epoch",variant:"hook"},...$ge,{id:"converge",x:Ks-220,y:A$,w:440,h:70,title:"system knowledge updated",sub:"reports stitched into one summary",variant:"agent"},{id:"sleep-done",x:Ks-130,y:LB,w:260,h:64,title:"sleep done",sub:"debt reset",variant:"rem"}],edges:[{id:"debt-start",d:`M ${Ks} 112 L ${Ks} 132`,travel:26,delay:0,dur:1.4},...Pge,...zge,{id:"converge-done",d:`M ${Ks} ${Fge} L ${Ks} ${LB}`,travel:64,delay:1.8,dur:1.8}]},EC=230,L$=230,BB=132,NC=[{id:"prompt",x:40,title:"Your prompt",sub:"any language",variant:"hook"},{id:"bm25",x:320,title:"BM25F keyword match",sub:"field-weighted · stemming · synonyms",variant:"region"},{id:"haiku",x:600,title:"Haiku recall",sub:"smallest cloud agent · 0-3 docs · BM25 fallback",variant:"region"},{id:"snapshot",x:880,title:"SessionStart snapshot",sub:"warm + cold knowledge · features · index · pinned",variant:"rem"}],Hge=NC.map(r=>({id:r.id,x:r.x,y:EC-BB/2,w:L$,h:BB,title:r.title,sub:r.sub,variant:r.variant})),Uge=NC.slice(0,-1).map((r,e)=>{const i=NC[e+1],n=r.x+L$,s=i.x;return{id:`pipe-${r.id}`,d:`M ${n} ${EC} L ${s} ${EC}`,travel:s-n,delay:e*.4,dur:2.2}}),Wge={viewBox:"0 0 1150 460",ariaLabel:"Memory recall pipeline: your prompt is matched by field-weighted BM25F keyword search with stemming and synonyms; a small Haiku cloud agent picks zero to three directly relevant docs (falling back to BM25 when unavailable); and the SessionStart snapshot assembles warm and cold knowledge, features, the index and pinned docs.",nodes:Hge,edges:Uge},Gge=[{n:"01",title:"It loads",body:"A SessionStart hook preloads the whole project picture — soul, user, memory, knowledge and state, plus data-structures, skills and sub-agents — before the agent makes a single tool call."},{n:"02",title:"It works",body:"With identity, history, procedures, schema and capabilities already in context, your agent works against the real project — no re-exploring, no blind search spiral, no re-teaching what it learned last time."},{n:"03",title:"It sleeps",body:"RemSleep is multi-agent: parallel specialists consolidate the session in their own domains and feed the distilled knowledge back into those context files — so the next session starts even sharper."}];function Kge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"How it works"}),a.jsx("h2",{className:"about-h2",children:"A brain that loads, works, and sleeps — across your whole system."}),a.jsxs("p",{className:"about-section-lead",children:["Three moves, repeated every session. A hook preloads the entire context set with"," ",a.jsx("em",{children:"zero tool calls"}),", your agent works with the whole picture, and a multi-agent RemSleep cycle consolidates what changed. The loop is the product."]}),a.jsx(Cc,{spec:Dge}),a.jsx("div",{className:"hiw2-steps",children:Gge.map(r=>a.jsxs("div",{className:"hiw2-step",children:[a.jsx("span",{className:"hiw2-step-n",children:r.n}),a.jsx("h3",{className:"hiw2-step-title",children:r.title}),a.jsx("p",{className:"hiw2-step-body",children:r.body})]},r.n))})]})}const Vge=[{level:"Alert",range:"0–3",note:"fresh — nothing to consolidate yet"},{level:"Drowsy",range:"4–6",note:"consolidation offered"},{level:"Sleepy",range:"7–9",note:"advisory note prepended"},{level:"Must Sleep",range:"10+",note:"critical directive prepended"}],Yge=[{name:"sleep-tasks",domain:"state/*.md — logs progress, bumps statuses, reconciles task bodies and workflow nodes.",always:!0},{name:"sleep-state",domain:"soul · user · memory · data-structures · CHANGELOG · RELEASES — surgical core-file updates with an anti-bloat sweep.",always:!0},{name:"sleep-product",domain:"knowledge/ (incl. features/ PRDs) — writes and refreshes knowledge files and feature PRDs.",always:!1}];function Xge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"How sleep works"}),a.jsx("h2",{className:"about-h2",children:"It sleeps to remember — like REM, but for your project."}),a.jsxs("p",{className:"about-section-lead",children:["Every session adds ",a.jsx("em",{children:"sleep debt"}),". When it builds up, one command fans out to parallel specialists that fold what changed back into the brain — then resets the meter."]}),a.jsx(Cc,{spec:qge}),a.jsxs("div",{className:"sleepf-cards",children:[a.jsxs("article",{className:"sleepf-card sleepf-card--debt",children:[a.jsx("h3",{className:"sleepf-card-title",children:"Debt accumulates across sessions"}),a.jsx("p",{className:"sleepf-card-body",children:"Each session scores by how much changed; the score adds to a running debt total that crosses graduated thresholds, so consolidation urgency is never ambiguous."}),a.jsx("ul",{className:"sleepf-debt",children:Vge.map(r=>a.jsxs("li",{className:"sleepf-debt-row",children:[a.jsx("span",{className:"sleepf-debt-level",children:r.level}),a.jsx("span",{className:"sleepf-debt-range",children:r.range}),a.jsx("span",{className:"sleepf-debt-note",children:r.note})]},r.level))})]}),a.jsxs("article",{className:"sleepf-card",children:[a.jsx("h3",{className:"sleepf-card-title",children:"Specialists run in parallel"}),a.jsxs("p",{className:"sleepf-card-body",children:[a.jsx("code",{className:"sleepf-cmd",children:"sleep start"})," pins the epoch, then the main agent dispatches the specialists together in a single message — each updating a distinct knowledge domain, never editing outside it."]}),a.jsx("ul",{className:"sleepf-specialists",children:Yge.map(r=>a.jsxs("li",{className:"sleepf-spec-row",children:[a.jsx("code",{className:"sleepf-spec-name",children:r.name}),a.jsx("span",{className:`sleepf-spec-badge${r.always?" sleepf-spec-badge--always":""}`,children:r.always?"always fires":"conditional"}),a.jsx("span",{className:"sleepf-spec-domain",children:r.domain})]},r.name))})]}),a.jsxs("article",{className:"sleepf-card sleepf-card--done",children:[a.jsxs("h3",{className:"sleepf-card-title",children:[a.jsx("code",{className:"sleepf-cmd",children:"sleep done"})," resets the debt"]}),a.jsxs("p",{className:"sleepf-card-body",children:["Their reports converge into one stitched summary of updated system knowledge. The main agent calls ",a.jsx("code",{className:"sleepf-cmd",children:"sleep done"}),", which records the consolidation and resets the debt to zero — ready for the next cycle."]})]})]})]})}const Zge=[{n:"01",tag:"Keyword match",title:"Field-weighted BM25F",body:"Your prompt is matched against the corpus — knowledge, features, tasks, memory and changelog — with field weighting, stemming and synonym expansion. It runs locally in under 100ms, with zero token overhead."},{n:"02",tag:"Intent recall",title:"The Haiku agent",body:"The smallest cloud agent reads your full prompt and a relevance-ranked corpus index, then returns only the 0–3 documents that are directly relevant — resolving intent across languages. If it is unavailable, the pipeline falls back to raw BM25."},{n:"03",tag:"Session start",title:"The snapshot assembles",body:"At SessionStart a hook composes the knowledge distribution — warm and cold knowledge, the features summary, the knowledge index, and pinned docs — and hands it to the agent so it begins each session already oriented."}];function Qge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"How the system remembers"}),a.jsx("h2",{className:"about-h2",children:"The right memory, surfaced before you ask."}),a.jsxs("p",{className:"about-section-lead",children:["Remembering is a read pipeline. Three stages take a prompt — or a fresh session — and put exactly the relevant context in front of the agent, so it works on what you actually meant. It ",a.jsx("em",{children:"augments"})," the agent's reach; you stay in the driver's seat."]}),a.jsx(Cc,{spec:Wge}),a.jsx("div",{className:"recallf-stages",children:Zge.map(r=>a.jsxs("article",{className:"recallf-stage",children:[a.jsxs("div",{className:"recallf-stage-head",children:[a.jsx("span",{className:"recallf-stage-n",children:r.n}),a.jsx("span",{className:"recallf-stage-tag",children:r.tag})]}),a.jsx("h3",{className:"recallf-stage-title",children:r.title}),a.jsx("p",{className:"recallf-stage-body",children:r.body})]},r.n))})]})}const RB=[{file:"0.soul",glyph:"◆",region:"Identity",brain:"sense of self",desc:"Who it is — purpose, principles, and the rules it must never break."},{file:"1.user",glyph:"◉",region:"Episodic",brain:"lived history",desc:"What you did and decided, session over session."},{file:"2.memory",glyph:"✦",region:"Semantic",brain:"durable facts",desc:"What's true about the project — facts that hold across every session."},{file:"data-structures/",glyph:"▤",region:"Schema",brain:"mental models",desc:"The shapes of your data — the structures everything else is built on."},{file:"knowledge/",glyph:"⚙",region:"Procedural",brain:"learned skill",desc:"How to do things here — patterns, recipes, and hard-won know-how.",rides:{label:"skills",desc:"capabilities it can pick up and apply"}},{file:"state/",glyph:"▦",region:"Working",brain:"in attention",desc:"What's in flight right now — tasks, features, and the sleep cycle.",rides:{label:"sub-agents",desc:"workers it directs under your steer"}}];function Jge(){return a.jsxs("section",{className:"about-section arch","aria-labelledby":"arch-heading",children:[a.jsx("p",{className:"about-kicker",children:"The architecture"}),a.jsx("h2",{className:"about-h2",id:"arch-heading",children:"Memory, organized like a mind."}),a.jsx("p",{className:"about-section-lead",children:"Knowledge isn't one flat file. It's laid down in strata — each a purpose-built region that mirrors a part of the brain — so the agent reaches for the right kind of memory at the right moment."}),a.jsxs("div",{className:"arch-stage",role:"img","aria-label":"A cross-section of the project's memory, stacked as layered brain regions.",children:[a.jsx("div",{className:"arch-glow","aria-hidden":"true"}),a.jsx("ol",{className:"arch-stack",children:RB.map((r,e)=>a.jsxs("li",{className:"arch-stratum",style:{"--i":e,"--n":RB.length},children:[a.jsx("div",{className:"arch-edge","aria-hidden":"true"}),a.jsxs("div",{className:"arch-face",children:[a.jsx("span",{className:"arch-glyph","aria-hidden":"true",children:r.glyph}),a.jsxs("div",{className:"arch-meta",children:[a.jsxs("div",{className:"arch-meta-top",children:[a.jsx("code",{className:"arch-file",children:r.file}),a.jsx("span",{className:"arch-region",children:r.region}),a.jsx("span",{className:"arch-brain",children:r.brain})]}),a.jsx("p",{className:"arch-desc",children:r.desc})]}),r.rides?a.jsxs("div",{className:"arch-rides",children:[a.jsx("span",{className:"arch-rides-plus","aria-hidden":"true",children:"+"}),a.jsx("span",{className:"arch-rides-label",children:r.rides.label}),a.jsx("span",{className:"arch-rides-desc",children:r.rides.desc})]}):null]})]},r.file))})]}),a.jsxs("p",{className:"arch-foot",children:["Six strata, one mind — read top-down, the agent goes from"," ",a.jsx("em",{children:"who it is"})," to ",a.jsx("em",{children:"what it's doing right now"}),"."]})]})}function eme(r){return"base"in r}function OB({item:r}){const e=eme(r)?"pack":"standalone",i=e==="pack"?"pack":r.tags[0]??"standalone";return a.jsxs("li",{className:"marquee-card",children:[a.jsx("span",{className:`marquee-chip marquee-chip--${e}`,children:i}),a.jsx("span",{className:"marquee-card-name",children:r.name}),r.description&&a.jsx("p",{className:"marquee-card-desc",children:r.description})]})}function tme(){const{data:r,isLoading:e,isError:i}=_$(),n=R.useMemo(()=>r?[...r.packs,...r.standalone]:[],[r]),s=Math.min(60,Math.max(40,n.length*2.2)),o=a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"about-kicker",children:"Skill packs"}),a.jsx("h2",{className:"about-h2",children:"A growing library of expertise."}),a.jsx("p",{className:"about-section-lead",children:"The agent loads the right pack for the task — and more are added all the time."})]});return e?a.jsxs("section",{className:"about-section",children:[o,a.jsx("div",{className:"marquee-viewport marquee-viewport--static","aria-hidden":"true",children:a.jsx("ul",{className:"marquee-track marquee-track--skeleton",children:Array.from({length:6}).map((h,l)=>a.jsx("li",{className:"marquee-card marquee-card--skeleton"},l))})}),a.jsx("p",{className:"marquee-status",children:"Loading packs…"})]}):i||n.length===0?a.jsx("section",{className:"about-section",children:o}):a.jsxs("section",{className:"about-section",children:[o,a.jsxs("div",{className:"marquee-viewport",style:{"--marquee-duration":`${s}s`},children:[a.jsx("ul",{className:"marquee-track",children:n.map(h=>a.jsx(OB,{item:h},`a-${h.name}`))}),a.jsx("ul",{className:"marquee-track marquee-track--dup","aria-hidden":"true",children:n.map(h=>a.jsx(OB,{item:h},`b-${h.name}`))})]})]})}const al="0 0 360 170";function B$(r,e,i){return{viewBox:al,ariaLabel:r,nodes:[{id:"a",x:20,y:50,w:140,h:70,title:e.title,sub:e.sub,variant:e.variant??"hook"},{id:"b",x:200,y:50,w:140,h:70,title:i.title,sub:i.sub,variant:i.variant??"rem"}],edges:[{id:"a-b",d:"M 160 85 L 200 85",travel:40,dur:2}]}}const rme={viewBox:al,ariaLabel:"Context snapshot: a SessionStart hook injects the soul, memory, active tasks and knowledge index straight into the agent with zero tool calls.",nodes:[{id:"hook",x:110,y:12,w:140,h:50,title:"SessionStart",sub:"0 tool calls",variant:"hook"},{id:"brain",x:16,y:100,w:150,h:56,title:"project brain",sub:"soul · memory · tasks",variant:"region",breathe:!0},{id:"agent",x:194,y:100,w:150,h:56,title:"your agent",sub:"oriented",variant:"agent"}],edges:[{id:"h-b",d:hn(180,62,91,100),travel:80,dur:2.2},{id:"b-a",d:"M 166 128 L 194 128",travel:28,dur:1.6,delay:.5}]},ime={viewBox:al,ariaLabel:"Memory recall: a question is scored by BM25 keyword match, optionally refined by a small Haiku agent, returning the most relevant docs in under 100 milliseconds.",nodes:[{id:"q",x:14,y:52,w:96,h:66,title:"question",sub:"any language",variant:"hook"},{id:"bm25",x:132,y:52,w:96,h:66,title:"BM25",sub:"+ Haiku",variant:"region",breathe:!0},{id:"docs",x:250,y:52,w:96,h:66,title:"top docs",sub:"<100ms",variant:"rem"}],edges:[{id:"q-b",d:"M 110 85 L 132 85",travel:22,dur:1.6},{id:"b-d",d:"M 228 85 L 250 85",travel:22,dur:1.6,delay:.4}]},nme={viewBox:al,ariaLabel:"RemSleep: accumulated sleep debt triggers a fan-out to three parallel specialists that consolidate the session and reset the meter.",nodes:[{id:"debt",x:108,y:10,w:144,h:46,title:"sleep debt",sub:"crosses threshold",variant:"accent"},{id:"s1",x:14,y:92,w:100,h:50,title:"sleep-tasks",variant:"region",breathe:!0},{id:"s2",x:130,y:92,w:100,h:50,title:"sleep-state",variant:"region",breathe:!0,breatheDelay:.2},{id:"s3",x:246,y:92,w:100,h:50,title:"sleep-product",variant:"region",breathe:!0,breatheDelay:.4}],edges:[{id:"d-1",d:hn(180,56,64,92),travel:90,dur:2.2},{id:"d-2",d:"M 180 56 L 180 92",travel:36,dur:1.8,delay:.2},{id:"d-3",d:hn(180,56,296,92),travel:90,dur:2.2,delay:.4}]},sme={viewBox:al,ariaLabel:"Brain-region core files: soul, user, memory and the knowledge index sit in a numbered band the snapshot always loads.",nodes:[{id:"soul",x:14,y:24,w:158,h:54,title:"0.soul",sub:"identity · rules",variant:"region",breathe:!0},{id:"mem",x:188,y:24,w:158,h:54,title:"2.memory",sub:"decisions · issues",variant:"region",breathe:!0,breatheDelay:.2},{id:"user",x:14,y:96,w:158,h:54,title:"1.user",sub:"preferences",variant:"region",breathe:!0,breatheDelay:.4},{id:"know",x:188,y:96,w:158,h:54,title:"knowledge",sub:"index · pinned",variant:"region",breathe:!0,breatheDelay:.6}],edges:[]},ame={viewBox:al,ariaLabel:"Tag-based relation graph: knowledge, features and tasks link through shared tags into a navigable brain view.",nodes:[{id:"tag",x:110,y:58,w:140,h:54,title:"shared tag",sub:"the edge",variant:"accent",breathe:!0},{id:"k",x:14,y:10,w:110,h:44,title:"knowledge",variant:"region"},{id:"f",x:236,y:10,w:110,h:44,title:"features",variant:"region"},{id:"t",x:125,y:122,w:110,h:40,title:"tasks",variant:"region"}],edges:[{id:"k-tag",d:hn(69,54,150,58),travel:90,dur:2.4},{id:"f-tag",d:hn(291,54,210,58),travel:90,dur:2.4,delay:.4},{id:"t-tag",d:"M 180 122 L 180 112",travel:12,dur:1.6,delay:.8}]},ome={viewBox:al,ariaLabel:"Task management: each task carries a LIFO changelog viewable as a Kanban board, an Eisenhower matrix, or RICE-scored.",nodes:[{id:"task",x:16,y:50,w:130,h:70,title:"task .md",sub:"LIFO changelog",variant:"hook"},{id:"views",x:200,y:24,w:144,h:44,title:"Kanban",variant:"region",breathe:!0},{id:"eis",x:200,y:74,w:144,h:40,title:"Eisenhower",variant:"region",breathe:!0,breatheDelay:.2},{id:"rice",x:200,y:120,w:144,h:40,title:"RICE score",variant:"region",breathe:!0,breatheDelay:.4}],edges:[{id:"t-k",d:hn(146,85,272,46),travel:90,dur:2.2},{id:"t-e",d:"M 146 85 L 200 94",travel:56,dur:2,delay:.3},{id:"t-r",d:hn(146,85,272,140),travel:90,dur:2.2,delay:.6}]},lme={viewBox:al,ariaLabel:"Sub-agents: the main agent fans work out to briefed specialist sub-agents that report back, keeping the main context small.",nodes:[{id:"main",x:110,y:12,w:140,h:46,title:"main agent",variant:"agent"},{id:"a",x:16,y:96,w:96,h:50,title:"reviewer",variant:"region",breathe:!0},{id:"b",x:132,y:96,w:96,h:50,title:"planner",variant:"region",breathe:!0,breatheDelay:.2},{id:"c",x:248,y:96,w:96,h:50,title:"researcher",variant:"region",breathe:!0,breatheDelay:.4}],edges:[{id:"m-a",d:hn(180,58,64,96),travel:90,dur:2.2},{id:"m-b",d:"M 180 58 L 180 96",travel:38,dur:1.8,delay:.2},{id:"m-c",d:hn(180,58,296,96),travel:90,dur:2.2,delay:.4}]},cme={viewBox:"0 0 400 232",ariaLabel:"Council: three persona sub-agents debate each other in a cycle — each sees the others’ reasoning, round after round — then the debate converges into a synthesizer that writes one decision report.",nodes:[{id:"p1",x:70,y:14,w:96,h:46,title:"persona",sub:"lens A",variant:"region",breathe:!0},{id:"p2",x:18,y:118,w:96,h:46,title:"persona",sub:"lens B",variant:"region",breathe:!0,breatheDelay:.25},{id:"p3",x:130,y:118,w:96,h:46,title:"persona",sub:"lens C",variant:"region",breathe:!0,breatheDelay:.5},{id:"syn",x:286,y:70,w:104,h:72,title:"synthesizer",sub:"decision report",variant:"rem"}],edges:[{id:"p1-p2",d:"M 96 60 L 80 118",travel:60,dur:1.8},{id:"p2-p3",d:"M 114 141 L 130 141",travel:16,dur:1.1,delay:.3,label:{text:"↻ rounds",x:118,y:95}},{id:"p3-p1",d:"M 178 118 L 152 60",travel:60,dur:1.8,delay:.6},{id:"p1-syn",d:hn(166,40,286,96),travel:130,dur:2.4,delay:.4},{id:"p3-syn",d:hn(226,136,286,116),travel:76,dur:2.2,delay:.9}]},hme={viewBox:"0 0 1000 330",ariaLabel:"Goal-skill orchestration: a goal-planner drafts a file-by-file plan; parallel reviewers vote SOLID or NEEDS_WORK and loop back to the planner until solid; the plan is persisted as a task; a goal-implementer builds to the acceptance criteria; a code reviewer and then a goal-validator each gate the result, looping back to the implementer on FAIL; every gate is capped at three retries before escalating to the user, after which the work ships as a task in review.",nodes:[{id:"plan",x:20,y:40,w:140,h:86,title:"planner",sub:"file-by-file plan",variant:"agent"},{id:"plan-review",x:184,y:40,w:140,h:86,title:"plan review",sub:"SOLID · NEEDS_WORK",variant:"region",breathe:!0},{id:"impl",x:348,y:40,w:140,h:86,title:"implementer",sub:"builds to criteria",variant:"agent"},{id:"code-review",x:512,y:40,w:140,h:86,title:"code review",sub:"PASS · FAIL",variant:"region",breathe:!0,breatheDelay:.2},{id:"validate",x:676,y:40,w:140,h:86,title:"validator",sub:"tests · PASS · FAIL",variant:"region",breathe:!0,breatheDelay:.4},{id:"done",x:840,y:40,w:140,h:86,title:"shipped",sub:"task → in_review",variant:"rem"}],edges:[{id:"f1",d:"M 160 83 L 184 83",dur:2},{id:"f2",d:"M 324 83 L 348 83",dur:2,delay:.2},{id:"f3",d:"M 488 83 L 512 83",dur:2,delay:.1},{id:"f4",d:"M 652 83 L 676 83",dur:2,delay:.2},{id:"f5",d:"M 816 83 L 840 83",dur:2,delay:.3},{id:"l1",d:"M 254 126 C 254 196, 90 196, 90 126",dashed:!0,dur:3.2,delay:.5,label:{text:"↻ ≤3",x:172,y:186}},{id:"l2",d:"M 582 126 C 582 196, 418 196, 418 126",dashed:!0,dur:3.2,delay:.7,label:{text:"↻ ≤3",x:500,y:186}},{id:"l3",d:"M 746 126 C 746 262, 418 262, 418 126",dashed:!0,dur:3.6,delay:.9,label:{text:"↻ ≤3",x:582,y:252}}]},ume=B$("Skill packs: curated domain packs install a base skill plus on-demand sub-skills into the agent.",{title:"skill pack",sub:"engineering · design · growth",variant:"hook"},{title:"agent gains",sub:"base + sub-skills",variant:"rem"}),dme=B$("Knowledge base: tagged knowledge files are indexed every session; pinned files load warm, the rest load cold on demand.",{title:"knowledge/*.md",sub:"tagged · indexed",variant:"region"},{title:"snapshot",sub:"warm + cold",variant:"rem"}),R$=[{id:"context-snapshot",title:"Context snapshot",tagline:"Every session starts with the whole brain, zero tool calls.",body:"A SessionStart hook injects your project identity, user preferences, memory, active tasks and the knowledge index straight into the agent — so it orients instantly instead of grepping around blind.",defaultOpen:!0,tag:"Memory",flow:rme},{id:"memory-recall",title:"Memory recall",tagline:'Ask "where did we decide X?" and get an answer in under 100ms.',body:"A deterministic BM25 search ranks every knowledge file, PRD, task, memory entry and changelog line — optionally sharpened by a small Haiku agent — so the right context surfaces without scrolling or grepping. Handles English, Turkish and mixed queries.",defaultOpen:!0,tag:"Memory",flow:ime},{id:"rem-sleep",title:"RemSleep consolidation",tagline:"It sleeps to remember — multi-agent consolidation, like REM.",body:"Sessions accumulate sleep debt; when it builds up, one command fans out to three parallel specialists that fold what changed back into the brain, then resets the meter. Knowledge compounds instead of decaying.",defaultOpen:!0,tag:"Sleep",flow:nme},{id:"brain-regions",title:"Brain-region core files",tagline:"A numbered band of core files — soul, user, memory, knowledge.",body:"The brain is a handful of small, always-loaded files: identity and rules, user preferences, durable memory, and the knowledge index. Kept lightweight on purpose so the snapshot stays under budget every session.",defaultOpen:!0,tag:"Memory",flow:sme},{id:"knowledge-base",title:"Knowledge base",tagline:"Tagged research that loads warm when pinned, cold on demand.",body:"Deep research and domain context live in tagged knowledge files the snapshot indexes every session. Pin the critical ones to load them in full; the rest stay one read away when an agent needs them.",defaultOpen:!0,tag:"Knowledge",flow:dme},{id:"brain-graph",title:"Relation graph (Brain view)",tagline:"Knowledge, features and tasks linked through shared tags.",body:"A tag-based graph connects every knowledge file, feature and task into one navigable Brain view — so you can see how the parts of a project relate instead of reading them one file at a time.",defaultOpen:!0,tag:"Knowledge",flow:ame},{id:"task-management",title:"Task management",tagline:"LIFO changelogs, viewable as Kanban, Eisenhower or RICE.",body:"Each task is a Markdown file with a LIFO changelog, so any session reads where the last one left off. View the backlog as a Kanban board, triage it on an Eisenhower matrix, or rank it numerically with RICE — Reach × Impact × Confidence ÷ Effort.",defaultOpen:!0,tag:"Tasks",flow:ome},{id:"skill-packs",title:"Skill packs",tagline:"Curated, installable skills by domain — one command.",body:"Extend an agent with domain packs — engineering, design, growth, brand-voice and more — each a base skill plus on-demand sub-skills. Install interactively or name a pack directly; prerequisites resolve automatically.",defaultOpen:!0,tag:"Skills",flow:ume},{id:"sub-agents",title:"Sub-agents",tagline:"Fan work out to briefed specialists; keep the main context lean.",body:"The main agent dispatches focused sub-agents — reviewers, planners, researchers — each launched with a lightweight context briefing so it knows the project structure without any tool calls. They report back; the main thread stays small.",defaultOpen:!0,tag:"Agents",flow:lme},{id:"council",title:"Council",tagline:"Persona sub-agents debate a hard call, a synthesizer decides.",body:"For a non-trivial decision, Council spins up 3–10 persona sub-agents that debate across rounds, see each other's reasoning, then hand off to a dedicated synthesizer that writes one decision report — promotable straight into knowledge.",defaultOpen:!0,tag:"Agents",flow:cme},{id:"goal-skill",title:"Goal-skill orchestration",tagline:"Plan it, review it, build it, review it, validate it — on a leash.",body:"Turn the main agent into an orchestrator. A goal-planner drafts a file-by-file plan; parallel reviewers vote SOLID or NEEDS_WORK and bounce it back until it holds; the plan is persisted as a task; a goal-implementer builds to the acceptance criteria; then a code reviewer and a goal-validator each gate the result, looping back to the implementer on a fail. Every gate is capped at three retries and escalates to you instead of spinning.",defaultOpen:!0,tag:"Agents",flow:hme},{id:"bookmarking",title:"Bookmarking (salience)",tagline:"High-signal moments tagged so sleep can find them later.",body:"Corrections, error-to-fix turns and decisions are auto-bookmarked during a session, marking the moments worth keeping — so consolidation folds the right learnings into the brain without manual flagging.",defaultOpen:!1,tag:"Memory",glyph:"◈"},{id:"warm-cold-knowledge",title:"Warm vs cold knowledge",tagline:"Pinned files load in full; the rest stay one read away.",body:"Pinned (warm) knowledge is inlined into every snapshot; unpinned (cold) knowledge appears only in the index and loads on demand. The split keeps the always-on context small while nothing gets lost.",defaultOpen:!1,tag:"Knowledge",glyph:"❄"},{id:"feature-prds",title:"Feature PRDs",tagline:"Living docs that capture not just what was built, but why.",body:"Each feature has a PRD with user stories, acceptance criteria and design decisions that update as work progresses — so an agent understands the product surface without reconstructing it from conversation history.",defaultOpen:!1,tag:"Knowledge",glyph:"▤"},{id:"versions-releases",title:"Versions & releases",tagline:"Changelog and release readiness tracked in the brain.",body:"A structured changelog and release notes live alongside the context, so version history and release readiness are part of the brain the agent reads — not an afterthought scattered across commits.",defaultOpen:!1,tag:"Knowledge",glyph:"⎇"},{id:"multi-vault",title:"Multi-vault registry",tagline:"Switch between project brains from one global registry.",body:"A global vault registry tracks every project brain on your machine. List, add and remove vaults, then point the dashboard at any one — so multiple projects each keep their own clean context.",defaultOpen:!1,tag:"Setup",glyph:"▦"},{id:"multi-product",title:"Multi-product support",tagline:"Per-product knowledge auto-injected from the active task.",body:"Monorepos and portfolios get a product namespace: per-product knowledge and data structures, plus automatic injection of the right product's knowledge at session start when the active task carries a product tag.",defaultOpen:!1,tag:"Knowledge",glyph:"◫"},{id:"manifest-install",title:"Manifest install & update",tagline:"Clean upgrades — stale files tracked and removed, not layered.",body:"A manifest tracks every file dreamcontext owns, so updates remove what a new version drops instead of leaving stale agents and configs behind. Includes a one-line install script and an in-session update nudge.",defaultOpen:!1,tag:"Setup",glyph:"⟳"},{id:"project-init",title:"Project initialization",tagline:"Blank repo to agent-aware workspace in under a minute.",body:"One init command scaffolds the whole context directory, detects your tech stack, runs token substitution on the templates, and wires up the Claude Code hooks — no manual setup.",defaultOpen:!1,tag:"Setup",glyph:"⊕"},{id:"control-panel",title:"Control panel",tagline:"Configure platforms, packs and vaults in the browser.",body:"The dashboard control panel closes the loop on configuration — edit platforms and skill packs, see which packs are actually installed on disk, manage vaults, and get notified in-app when a newer version ships.",defaultOpen:!1,tag:"Setup",glyph:"⚙"},{id:"multi-review",title:"Multi-review",tagline:"Route a diff to niche reviewers, get one merged report.",body:"A router classifies a diff by domain and dispatches specialist reviewers — security, frontend, cloud functions, edge cases — in parallel; a coordinator dedupes their findings into a single report. Each specialist reviews against your live project rules.",defaultOpen:!1,tag:"Agents",glyph:"⊜"},{id:"continuous-capture",title:"Continuous capture",tagline:"Session digests and auto-bookmarks, searchable next session.",body:"Transcripts are digested and indexed as you work, so a decision from one session is searchable in the next — before any sleep consolidation runs. Capture is down-weighted so it never crowds out curated knowledge.",defaultOpen:!1,tag:"Memory",glyph:"◌"},{id:"context-gate",title:"Context gate",tagline:"Nudges the agent to load relevant skills before it acts.",body:"A prompt-time hook detects when an installed skill is plausibly relevant and injects a directive to review the full skill list and invoke what fits — deliberately not a pre-selected top-N, so the right skill is never anchored out.",defaultOpen:!1,tag:"Skills",glyph:"⊳"},{id:"auto-dashboard",title:"Auto-open dashboard hook",tagline:"The dashboard surfaces itself when it is worth a look.",body:"A hook can open the dashboard at the right moment so the visual view of tasks, knowledge and the brain is one glance away — without you remembering to launch it.",defaultOpen:!1,tag:"Setup",glyph:"◰"},{id:"post-edit-hook",title:"Post-edit format & typecheck",tagline:"Format and typecheck fire automatically after an edit.",body:"A post-edit hook runs your formatter and type checker right after the agent changes a file, so problems surface immediately instead of piling up — keeping the working tree clean as work proceeds.",defaultOpen:!1,tag:"Setup",glyph:"✓"},{id:"marketing-pack",title:"Marketing pack",tagline:"Brand-voice and growth skills for going to market.",body:"A bundled set of go-to-market skills — brand voice, growth, performance marketing — so the same agent that builds a feature can help position and launch it, on-brand.",defaultOpen:!1,tag:"Skills",glyph:"✦"}],AC=R$.filter(r=>r.defaultOpen),DB=R$.filter(r=>!r.defaultOpen),ns=AC.length,C_=16,fme=62,pme=.72,gme=40,mme=140,yme=8;function bme(){const[r,e]=R.useState(0),i=R.useId(),n=R.useRef([]),s=R.useRef([]),o=R.useRef([]),h=R.useRef(null),l=R.useRef(null),u=R.useRef(null),d=R.useRef(!1),g=R.useRef(0),p=v=>`${i}-tab-${v}`,m=v=>`${i}-panel-${v}`,y=R.useCallback(v=>{const x=Math.max(0,Math.min(ns-1,v));x!==g.current&&(g.current=x,e(x))},[]);R.useLayoutEffect(()=>{const v=h.current,x=l.current;if(!v||!x)return;d.current=window.matchMedia("(prefers-reduced-motion: reduce)").matches;const C=v.closest(".shell-main")??null,k=C??window;let T=0;const N=()=>{T=0;const L=v.getBoundingClientRect(),O=C?C.getBoundingClientRect().top:0,D=L.height-x.offsetHeight;if(D<=0)return;const G=Math.max(0,Math.min(1,(O+C_-L.top)/D));u.current&&(u.current.style.transform=`scaleX(${G})`);const q=G*(ns-1);for(let U=0;U<ns;U++){const $=s.current[U];if(!$)continue;const F=U-q,W=Math.abs(F);$.style.opacity=String(Math.max(0,1-W/pme)),$.style.transform=d.current?"none":`translate3d(0, ${F*gme}px, 0)`;const Y=W<.5;$.style.zIndex=Y?"2":"1",$.style.pointerEvents=Y?"auto":"none";const P=W<1.05;o.current[U]!==P&&(o.current[U]=P,$.classList.toggle("feat-panel--near",P))}y(Math.round(q))};let j=0;const A=()=>{if(!C)return;const L=v.getBoundingClientRect(),O=L.height-x.offsetHeight;if(O<=0)return;const D=(C.getBoundingClientRect().top+C_-L.top)/O;if(D<=.012||D>=.988)return;const q=(Math.round(D*(ns-1))/(ns-1)-D)*O;Math.abs(q)<yme||C.scrollTo({top:C.scrollTop+q,behavior:d.current?"auto":"smooth"})},E=()=>{T||(T=requestAnimationFrame(N)),j&&clearTimeout(j),j=window.setTimeout(A,mme)};return k.addEventListener("scroll",E,{passive:!0}),window.addEventListener("resize",E),N(),()=>{k.removeEventListener("scroll",E),window.removeEventListener("resize",E),T&&cancelAnimationFrame(T),j&&clearTimeout(j)}},[y]);const w=R.useCallback(v=>{const x=h.current,C=l.current,k=x==null?void 0:x.closest(".shell-main");if(!x||!C||!k){y(v);return}const T=x.getBoundingClientRect(),N=T.height-C.offsetHeight;if(N<=0){y(v);return}const A=v/(ns-1)*N-(k.getBoundingClientRect().top+C_-T.top);k.scrollTo({top:k.scrollTop+A,behavior:d.current?"auto":"smooth"})},[y]);function _(v){var C;let x=g.current;if(v.key==="ArrowDown"||v.key==="ArrowRight")x=(g.current+1)%ns;else if(v.key==="ArrowUp"||v.key==="ArrowLeft")x=(g.current-1+ns)%ns;else if(v.key==="Home")x=0;else if(v.key==="End")x=ns-1;else return;v.preventDefault(),y(x),(C=n.current[x])==null||C.focus(),w(x)}return a.jsxs("section",{className:"about-section feat-section",children:[a.jsx("div",{className:"feat-scroller",ref:h,style:{"--feat-track-h":`${ns*fme}vh`},children:a.jsxs("div",{className:"feat-sticky",ref:l,children:[a.jsx("p",{className:"about-kicker",children:"Everything inside"}),a.jsx("h2",{className:"about-h2",children:"One brain, many faculties."}),a.jsxs("p",{className:"about-section-lead",children:["Every capability dreamcontext gives your agents — ",a.jsx("em",{children:"scroll to move through them, or pick one."})]}),a.jsxs("div",{className:"feat-spotlight",children:[a.jsxs("div",{className:"feat-rail-wrap",children:[a.jsxs("div",{className:"feat-rail-head","aria-hidden":"true",children:[a.jsxs("span",{className:"feat-rail-step",children:[String(r+1).padStart(2,"0")," ",a.jsxs("i",{children:["/ ",String(ns).padStart(2,"0")]})]}),a.jsx("div",{className:"feat-rail-track",children:a.jsx("span",{className:"feat-rail-fill",ref:u})})]}),a.jsx("div",{className:"feat-rail",role:"tablist","aria-orientation":"vertical","aria-label":"Core faculties",onKeyDown:_,children:AC.map((v,x)=>{const C=x===r;return a.jsxs("button",{ref:k=>{n.current[x]=k},id:p(x),role:"tab",type:"button","aria-selected":C,"aria-controls":m(x),tabIndex:C?0:-1,className:`feat-rail-item${C?" feat-rail-item--active":""}`,onClick:()=>{y(x),w(x)},children:[a.jsx("span",{className:"feat-rail-title",children:v.title}),v.tag&&a.jsx("span",{className:"feat-rail-tag",children:v.tag})]},v.id)})})]}),a.jsx("div",{className:"feat-stage",children:AC.map((v,x)=>a.jsxs("div",{ref:C=>{s.current[x]=C},className:"feat-panel",role:"tabpanel",id:m(x),"aria-labelledby":p(x),"aria-hidden":x!==r,tabIndex:x===r?0:-1,children:[a.jsxs("div",{className:"feat-stage-head",children:[v.tag&&a.jsx("span",{className:"feat-stage-chip",children:v.tag}),a.jsx("h3",{className:"feat-stage-title",children:v.title})]}),a.jsx("p",{className:"feat-stage-body",children:v.body}),v.flow&&a.jsx(Cc,{spec:v.flow,className:"feat-stage-flow"})]},v.id))})]})]})}),a.jsxs("div",{className:"feat-more",children:[a.jsxs("div",{className:"feat-more-head",children:[a.jsx("span",{className:"feat-more-label",children:"Everything else"}),a.jsx("span",{className:"feat-more-count",children:DB.length})]}),a.jsx("div",{className:"feat-more-grid",children:DB.map(v=>a.jsxs("div",{className:"feat-more-card",children:[a.jsx("span",{className:"feat-more-glyph","aria-hidden":"true",children:v.glyph??"✦"}),a.jsxs("div",{className:"feat-more-meta",children:[a.jsx("span",{className:"feat-more-title",children:v.title}),a.jsx("span",{className:"feat-more-tagline",children:v.tagline})]})]},v.id))})]})]})}const vme=[{cmd:"dreamcontext init",hint:"# set up the brain"},{cmd:"dreamcontext dashboard",hint:"# open this dashboard"},{cmd:"dreamcontext sleep",hint:"# consolidate the session"}];function xme(){return a.jsxs("section",{className:"closing","aria-labelledby":"closing-heading",children:[a.jsx("h2",{className:"closing-title",id:"closing-heading",children:"So — what is this?"}),a.jsxs("p",{className:"closing-body",children:[a.jsx("strong",{children:"dreamcontext"})," is a small CLI that gives your AI coding agents a structured, persistent brain across sessions. It pre-loads what matters, keeps a living map of your project, and consolidates new knowledge as you go — so you stop paying, every single session, to re-teach the agent what it already learned."]}),a.jsx("div",{className:"closing-cmds",role:"list",children:vme.map(r=>a.jsxs("div",{className:"closing-cmd",role:"listitem",children:[a.jsx("span",{className:"closing-cmd-c","aria-hidden":"true",children:"$"}),a.jsx("span",{className:"closing-cmd-text",children:r.cmd}),a.jsx("span",{className:"closing-cmd-hint",children:r.hint})]},r.cmd))}),a.jsx("p",{className:"closing-foot",children:"You're looking at the dashboard now. The brain graph, tasks, and sleep state in the sidebar are this project's actual memory — live."})]})}function _me(){return a.jsxs("div",{className:"about","data-testid":"about-page",children:[a.jsx(Ege,{}),a.jsx(Nge,{}),a.jsx(Kge,{}),a.jsx(Xge,{}),a.jsx(Qge,{}),a.jsx(Jge,{}),a.jsx(tme,{}),a.jsx(bme,{}),a.jsx(xme,{})]})}function Cme(){return Zt({queryKey:["taxonomy"],queryFn:()=>ze.get("/taxonomy")})}const wme={domain:"Domain",layer:"Layer",kind:"Kind",topic:"Topic"};function IB({tag:r,count:e,dimmed:i}){return a.jsxs("span",{className:`taxonomy-chip${i?" taxonomy-chip--dim":""}`,"data-hue":na(r),title:e>0?`${e} use${e===1?"":"s"}`:"unused",children:[a.jsx("span",{className:"taxonomy-chip-label",children:r}),e>0&&a.jsx("span",{className:"taxonomy-chip-count",children:e})]})}function em({label:r,count:e,children:i,defaultOpen:n=!1}){const[s,o]=R.useState(n);return e===0?null:a.jsxs("div",{className:"taxonomy-expandable",children:[a.jsxs("button",{className:"taxonomy-expandable-header",onClick:()=>o(h=>!h),"aria-expanded":s,children:[a.jsx("span",{className:"taxonomy-expandable-chevron",children:s?"▾":"▸"}),a.jsx("span",{className:"taxonomy-expandable-label",children:r}),a.jsx("span",{className:"taxonomy-expandable-badge",children:e})]}),s&&a.jsx("div",{className:"taxonomy-expandable-body",children:i})]})}function kme(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=Cme();if(i)return a.jsx("div",{className:"loading",children:r("common.loading")});if(n)return a.jsxs("div",{className:"error-state",children:["Failed to load taxonomy. ",s==null?void 0:s.message]});if(!e)return null;const{vocabulary:o,usage:h,audit:l}=e,u=["domain","layer","kind","topic"],d=l.untagged.length===0&&l.nonCanonical.length===0&&l.orphan.length===0&&l.nearDups.length===0;return a.jsxs("div",{className:"taxonomy-page",children:[a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Faceted Tags"}),a.jsx("div",{className:"taxonomy-facets",children:u.map(g=>{const p=o.facetTags[g]??[];return p.length===0?null:a.jsxs("div",{className:"taxonomy-facet-group",children:[a.jsx("span",{className:"taxonomy-facet-label",children:wme[g]??g}),a.jsx("div",{className:"taxonomy-chip-cluster",children:p.map(m=>{const y=h[m]??0;return a.jsx(IB,{tag:m,count:y,dimmed:y===0},m)})})]},g)})})]}),o.bareTags.length>0&&a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Bare Tags"}),a.jsx("div",{className:"taxonomy-chip-cluster",children:o.bareTags.map(g=>{const p=h[g]??0;return a.jsx(IB,{tag:g,count:p,dimmed:p===0},g)})})]}),Object.keys(o.aliases).length>0&&a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Aliases"}),a.jsx("div",{className:"taxonomy-alias-list",children:Object.entries(o.aliases).map(([g,p])=>a.jsxs("div",{className:"taxonomy-alias-pair",children:[a.jsx("span",{className:"taxonomy-chip taxonomy-chip--alias","data-hue":na(g),children:a.jsx("span",{className:"taxonomy-chip-label",children:g})}),a.jsx("span",{className:"taxonomy-alias-arrow","aria-hidden":"true",children:"→"}),a.jsx("span",{className:"taxonomy-chip","data-hue":na(p),children:a.jsx("span",{className:"taxonomy-chip-label",children:p})})]},g))})]}),a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Drift Audit"}),d?a.jsxs("div",{className:"taxonomy-healthy",children:[a.jsx("span",{className:"taxonomy-healthy-icon",children:"✓"}),a.jsx("span",{children:"Taxonomy healthy — no drift detected."})]}):a.jsxs("div",{className:"taxonomy-audit-panel",children:[a.jsx(em,{label:"Untagged docs",count:l.untagged.length,defaultOpen:l.untagged.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.untagged.map(g=>a.jsx("li",{className:"taxonomy-audit-item",children:a.jsx("code",{children:g})},g))})}),a.jsx(em,{label:"Non-canonical tags",count:l.nonCanonical.length,defaultOpen:l.nonCanonical.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.nonCanonical.map((g,p)=>a.jsxs("li",{className:"taxonomy-audit-item taxonomy-audit-item--suggest",children:[a.jsx("code",{className:"taxonomy-audit-doc",children:g.doc}),a.jsx("span",{className:"taxonomy-audit-tag",children:g.tag}),g.suggestion!==g.tag&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"taxonomy-alias-arrow","aria-hidden":"true",children:"→"}),a.jsx("span",{className:"taxonomy-audit-suggestion",children:g.suggestion})]})]},p))})}),a.jsx(em,{label:"Orphan tags",count:l.orphan.length,defaultOpen:l.orphan.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.orphan.map(g=>a.jsx("li",{className:"taxonomy-audit-item",children:a.jsx("span",{className:"taxonomy-audit-tag",children:g})},g))})}),a.jsx(em,{label:"Near-duplicates",count:l.nearDups.length,defaultOpen:l.nearDups.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.nearDups.map(([g,p],m)=>a.jsxs("li",{className:"taxonomy-audit-item taxonomy-audit-item--pair",children:[a.jsx("span",{className:"taxonomy-audit-tag",children:g}),a.jsx("span",{className:"taxonomy-alias-arrow","aria-hidden":"true",children:"≈"}),a.jsx("span",{className:"taxonomy-audit-tag",children:p})]},m))})})]})]})]})}function Sme(){const{health:r,serverCurrent:e}=hR();return!r||e?null:a.jsxs("div",{className:"stale-server-banner",children:["⚠ The dashboard server is running an older build (",r.version??"unknown"," vs ","0.13.1",") — some actions will fail. Restart it: ",a.jsx("code",{children:"dreamcontext dashboard"})]})}const FB=new vz({defaultOptions:{queries:{staleTime:5e3,retry:1,refetchOnWindowFocus:!0,refetchInterval:15e3,refetchIntervalInBackground:!1},mutations:{retry:0}}});function Tme({nav:r}){const e=(n,s)=>{const o={tasks:"tasks",knowledge:"knowledge",core:"core"};r.navigate(o[n],s)},i={id:r.focusId,nonce:r.nonce};switch(r.page){case"brain":return a.jsx(dpe,{onNavigate:e});case"tasks":return a.jsx(ude,{focus:i});case"roadmap":return a.jsx(Jde,{});case"lab":return a.jsx(xfe,{});case"sleep":return a.jsx(Efe,{});case"core":return a.jsx(Bfe,{onNavigateTaxonomy:()=>r.navigate("taxonomy",null),focus:i});case"knowledge":return a.jsx(Ufe,{focus:i});case"council":return a.jsx(Ype,{});case"settings":return a.jsx(_ge,{focus:i});case"packs":return a.jsx(Tge,{});case"taxonomy":return a.jsx(kme,{});case"about":return a.jsx(_me,{})}}class tm extends R.Component{constructor(){super(...arguments);Ut(this,"state",{error:null})}static getDerivedStateFromError(i){return{error:i}}render(){return this.state.error?a.jsxs("div",{className:"error-boundary",children:[a.jsx("h1",{children:"Something went wrong."}),a.jsx("p",{children:this.state.error.message}),a.jsx("button",{onClick:()=>window.location.reload(),children:"Reload"})]}):this.props.children}}const Vk=new URLSearchParams(window.location.search),jC=Vk.get("vault"),Eme=Vk.get("capture")==="1",Nme=Vk.get("perch")==="1";jC&&FC(jC);function Ame(){return R.useEffect(()=>{oQ().then(e=>m1(e));const r=e=>{(e.key===null||e.key===s5)&&m1(_w())};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)},[]),null}function jme(){return Eme?a.jsx(tm,{children:a.jsx(yQ,{})}):Nme?a.jsx(tm,{children:a.jsx(vQ,{})}):jC?a.jsx(tm,{children:a.jsx(GE,{client:FB,children:a.jsx(_Q,{children:a.jsx(QA,{children:a.jsxs(XE,{children:[a.jsx(Sme,{}),a.jsx(Pce,{children:r=>a.jsx(Tme,{nav:r})}),a.jsx(khe,{}),a.jsx(sL,{})]})})})})}):a.jsx(tm,{children:a.jsx(GE,{client:FB,children:a.jsx(QA,{children:a.jsxs(XE,{children:[a.jsx(Ame,{}),a.jsx(UX,{}),a.jsx(sL,{})]})})})})}const Mme=!!window.__TAURI_INTERNALS__;Mme&&navigator.platform.toLowerCase().includes("mac")&&document.documentElement.classList.add("tauri-overlay");VP.createRoot(document.getElementById("root")).render(a.jsx(R.StrictMode,{children:a.jsx(jme,{})}));export{j5 as $,zme as A,Ko as B,AQ as C,ni as D,PJ as E,Zw as F,v5 as G,Tte as H,see as I,ute as J,UQ as K,wf as L,$me as M,Yy as N,xJ as O,N5 as P,rj as Q,XJ as R,S1 as S,Ste as T,Wf as U,Rs as V,Pe as W,Ie as X,NJ as Y,yte as Z,H as _,RJ as a,eK as a$,GJ as a0,aj as a1,sj as a2,Yme as a3,Ume as a4,Kme as a5,Gme as a6,qme as a7,Bw as a8,Vme as a9,Pie as aA,$ie as aB,IO as aC,lX as aD,Hre as aE,f5 as aF,KJ as aG,uu as aH,Fme as aI,My as aJ,Rm as aK,kU as aL,QR as aM,Yf as aN,zre as aO,Pre as aP,cX as aQ,UC as aR,jo as aS,bf as aT,hN as aU,Iq as aV,hW as aW,sO as aX,aO as aY,JG as aZ,Bm as a_,Hme as aa,sh as ab,Zme as ac,Xme as ad,Wme as ae,pie as af,WI as ag,oye as ah,fte as ai,cn as aj,Va as ak,_d as al,Qw as am,PD as an,uc as ao,UD as ap,nr as aq,ra as ar,jt as as,mne as at,aye as au,lye as av,nye as aw,Ft as ax,sye as ay,Wie as az,BJ as b,Dm as b$,fu as b0,Al as b1,YW as b2,MN as b3,js as b4,ZU as b5,QC as b6,GG as b7,tK as b8,pu as b9,PY as bA,LV as bB,Ht as bC,hX as bD,MV as bE,uO as bF,HN as bG,Ql as bH,L7 as bI,_e as bJ,R as bK,LO as bL,BO as bM,RO as bN,a as bO,kN as bP,nW as bQ,uW as bR,pW as bS,jy as bT,iK as bU,ZC as bV,JR as bW,pK as bX,JW as bY,iG as bZ,zf as b_,cW as ba,dW as bb,oK as bc,rW as bd,XC as be,qN as bf,Ot as bg,WD as bh,mk as bi,Sn as bj,jq as bk,HC as bl,FR as bm,Pf as bn,zR as bo,Ime as bp,_N as bq,xN as br,NQ as bs,Ni as bt,gue as bu,Rr as bv,ew as bw,zY as bx,$Y as by,MY as bz,Ar as c,il as c0,zN as c1,JC as c2,eO as c3,Z_ as c4,Bme as c5,Xt as c6,XB as c7,kk as c8,Ome as c9,uye as ca,LC as cb,Rme as cc,Kt as d,A5 as e,Ti as f,DJ as g,Wa as h,Ms as i,mte as j,Gf as k,Qe as l,qD as m,Pme as n,hye as o,IJ as p,FJ as q,cye as r,OJ as s,dte as t,Ts as u,Rie as v,Ate as w,Qme as x,Xo as y,LJ as z};
516
+ `).toLowerCase().includes(e.trim().toLowerCase()):!1:!0}function Upe({debate:r,query:e,onQueryChange:i,selected:n,onSelectCell:s,onClearSelection:o}){const h=R.useRef(null),l=R.useMemo(()=>Array.from({length:Math.max(1,r.frontmatter.rounds_planned)},(g,p)=>p+1),[r.frontmatter.rounds_planned]),u=R.useMemo(()=>r.personas.map(g=>g.slug),[r.personas]),d=R.useMemo(()=>{if(!e.trim())return null;let g=0;for(const p of r.personas)for(const m of l)x$(p$(p,m),e)&&g++;return g},[e,r,l]);return R.useEffect(()=>{if(!n)return;const g=p=>{const m=p.target;if(m&&["INPUT","TEXTAREA"].includes(m.tagName))return;if(p.key==="Escape"){o();return}const y=r.personas.findIndex(_=>_.slug===n.slug);if(y===-1)return;const w=r.frontmatter.rounds_planned;p.key==="ArrowRight"&&n.round<w?(p.preventDefault(),s(n.slug,n.round+1)):p.key==="ArrowLeft"&&n.round>1?(p.preventDefault(),s(n.slug,n.round-1)):p.key==="ArrowDown"&&y<r.personas.length-1?(p.preventDefault(),s(r.personas[y+1].slug,n.round)):p.key==="ArrowUp"&&y>0&&(p.preventDefault(),s(r.personas[y-1].slug,n.round))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[n,r,o,s]),R.useEffect(()=>{if(!n||!h.current)return;const g=h.current.querySelector(`[data-persona="${n.slug}"][data-round="${n.round}"]`);g==null||g.scrollIntoView({behavior:"smooth",block:"center"})},[n]),a.jsxs("div",{className:"council-matrix",children:[a.jsxs("div",{className:"council-matrix-bar",children:[a.jsxs("label",{className:"council-matrix-search-input",children:[a.jsx("span",{className:"council-matrix-search-icon","aria-hidden":!0,children:"🔍"}),a.jsx("input",{type:"search",value:e,onChange:g=>i(g.target.value),placeholder:"Filter cells by text…"}),e&&a.jsx("button",{type:"button",className:"council-matrix-search-clear",onClick:()=>i(""),children:"×"})]}),d!=null&&a.jsxs("span",{className:"council-matrix-count",children:[d," match",d===1?"":"es"]})]}),a.jsx("div",{className:"council-matrix-scroll",ref:h,children:a.jsxs("div",{className:"council-matrix-grid",style:{gridTemplateColumns:`180px repeat(${l.length}, minmax(220px, 1fr))`},children:[a.jsx("div",{className:"council-matrix-corner","aria-hidden":!0}),l.map(g=>{const p=r.frontmatter.status===`round_${g}_running`,m=r.frontmatter.current_round>=g&&!p;return a.jsxs("div",{className:`council-round-head ${p?"is-running":""} ${m?"is-done":""}`,children:["Round ",g]},`h-${g}`)}),r.personas.map(g=>a.jsx(Wpe,{persona:g,rounds:l,debate:r,query:e,selected:n,knownSlugs:u,onSelectCell:s},g.slug))]})})]})}function Wpe({persona:r,rounds:e,debate:i,query:n,selected:s,knownSlugs:o,onSelectCell:h}){return a.jsxs(a.Fragment,{children:[a.jsxs("aside",{className:"council-matrix-row-head",children:[a.jsx(Jf,{slug:r.slug,size:22}),a.jsxs("div",{className:"council-matrix-row-id",children:[a.jsx("div",{className:"council-matrix-row-name",children:r.slug}),a.jsx(v$,{model:r.frontmatter.model})]})]}),e.map(l=>{const u=p$(r,l),d=i.frontmatter.status===`round_${l}_running`,g=!!s&&s.slug===r.slug&&s.round===l,p=x$(u,n),m=!!n.trim()&&!p;return a.jsx(Gpe,{personaSlug:r.slug,round:l,data:u,isRunning:d,active:g,dimmed:m,knownSlugs:o,onSelect:h},l)})]})}function Gpe({personaSlug:r,round:e,data:i,isRunning:n,active:s,dimmed:o,knownSlugs:h,onSelect:l}){if(!i)return a.jsx("div",{className:`council-cell council-cell--empty ${n?"council-cell--pending":""} ${o?"is-dimmed":""}`,"data-persona":r,"data-round":e,children:a.jsx("span",{className:"council-cell-empty-label",children:n?"awaiting…":"— silent —"})});const u=f$(i.position),d=mpe(i.position),g=g$(i),p=bpe(i),m=ype(i,h);return a.jsxs("button",{type:"button",className:`council-cell council-cell--${d} ${s?"is-active":""} ${o?"is-dimmed":""}`,"data-persona":r,"data-round":e,onClick:()=>l(r,e),children:[a.jsxs("div",{className:"council-cell-top",children:[u&&a.jsx("span",{className:`council-chip-pos council-chip-pos--${d}`,children:u}),(g>0||p>0)&&a.jsxs("span",{className:"council-cell-meta",children:[g>0&&a.jsxs(a.Fragment,{children:["↯ ",g]}),g>0&&p>0&&a.jsx("span",{children:" · "}),p>0&&a.jsxs(a.Fragment,{children:["? ",p]})]})]}),!s&&i.executiveSummary&&a.jsx("p",{className:"council-cell-exec",children:i.executiveSummary}),s&&a.jsxs("div",{className:"council-cell-full",children:[i.executiveSummary&&a.jsx(Id,{title:"Executive summary",children:a.jsx("p",{children:i.executiveSummary})}),i.position&&a.jsx(Id,{title:"Position",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.position)}})}),i.reasoning&&a.jsx(Id,{title:"Reasoning",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.reasoning)}})}),i.reactions&&a.jsxs(Id,{title:"Reactions to peers",children:[a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.reactions)}}),m.length>0&&a.jsx("div",{className:"council-cell-react-chips",children:m.map(y=>a.jsxs("span",{className:"council-cell-react-chip",children:[a.jsx(Jf,{slug:y,size:14}),a.jsx("span",{children:y})]},y))})]}),i.openQuestions&&a.jsx(Id,{title:"Open questions",children:a.jsx("div",{dangerouslySetInnerHTML:{__html:ar.parse(i.openQuestions)}})})]})]})}function Id({title:r,children:e}){return a.jsxs("section",{className:"council-cell-sub",children:[a.jsx("h5",{children:r}),a.jsx("div",{className:"council-cell-sub-body",children:e})]})}function wB(r){return r==="complete"||r==="synthesizing"?"overview":"matrix"}function Kpe({debate:r,onBack:e}){const{t:i}=Fr(),[n,s]=R.useState(()=>wB(r.frontmatter.status)),[o,h]=R.useState(""),[l,u]=R.useState(null),[d,g]=R.useState(null);R.useEffect(()=>{s(wB(r.frontmatter.status)),h(""),u(null),g(null)},[r.frontmatter.id]);const p=(w,_)=>{s("matrix"),u({slug:w,round:_})},m=w=>{s("agents"),g(w)},y=()=>{var w;return(w=navigator.clipboard)==null?void 0:w.writeText(r.frontmatter.id).catch(()=>{})};return a.jsxs("div",{className:"council-detail",children:[a.jsxs("header",{className:"council-detail-head",children:[a.jsxs("button",{type:"button",className:"council-detail-back",onClick:e,children:["← ",i("council.title")]}),a.jsxs("div",{className:"council-detail-meta",children:[a.jsx(Ipe,{status:r.frontmatter.status}),a.jsxs("span",{className:"council-detail-rounds",children:["R",r.frontmatter.current_round,"/",r.frontmatter.rounds_planned]}),a.jsx("span",{className:"council-session-dot",children:"·"}),a.jsx("span",{className:"council-detail-date",children:r.frontmatter.created_at}),a.jsx("span",{className:"council-session-dot",children:"·"}),a.jsx("button",{type:"button",className:"council-session-id",onClick:y,title:"Copy debate id",children:r.frontmatter.id})]})]}),a.jsxs("nav",{className:"council-tabs",role:"tablist",children:[a.jsx(x_,{active:n==="overview",onClick:()=>s("overview"),label:"Overview"}),a.jsx(x_,{active:n==="agents",onClick:()=>s("agents"),label:"Agents"}),a.jsx(x_,{active:n==="matrix",onClick:()=>s("matrix"),label:"Matrix"})]}),a.jsxs("div",{className:"council-detail-body",children:[n==="overview"&&a.jsx(Fpe,{debate:r,onCiteJump:p,onAgentJump:m}),n==="agents"&&a.jsx(zpe,{debate:r,focusSlug:d}),n==="matrix"&&a.jsx(Upe,{debate:r,query:o,onQueryChange:h,selected:l,onSelectCell:(w,_)=>u({slug:w,round:_}),onClearSelection:()=>u(null)})]})]})}function x_({active:r,onClick:e,label:i}){return a.jsx("button",{type:"button",role:"tab","aria-selected":r,className:`council-tab ${r?"is-active":""}`,onClick:e,children:i})}const kB="/council";function Vpe({onClose:r}){const[e,i]=R.useState(!1);R.useEffect(()=>{const s=o=>{o.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[r]);const n=()=>{var s;(s=navigator.clipboard)==null||s.writeText(kB).then(()=>{i(!0),window.setTimeout(()=>i(!1),1600)}).catch(()=>{})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"council-modal-scrim",onClick:r}),a.jsxs("div",{className:"council-modal",role:"dialog","aria-modal":"true","aria-label":"Start a new debate",children:[a.jsxs("header",{className:"council-modal-head",children:[a.jsxs("h2",{className:"council-modal-title",children:["Start a debate",a.jsx("span",{className:"council-lab-badge",children:"Lab"})]}),a.jsx("button",{type:"button",className:"council-modal-close",onClick:r,"aria-label":"Close",children:"✕"})]}),a.jsx("p",{className:"council-modal-lede",children:"Council convenes a panel of AI personas to debate a hard decision across several rounds, exposes each one to the others' reasoning, then synthesizes a final verdict you can trace back to who argued what."}),a.jsxs("div",{className:"council-modal-soon",children:[a.jsx("span",{className:"council-modal-soon-tag",children:"Coming soon"}),a.jsxs("p",{children:["Soon this button will open ",a.jsx("strong",{children:"Sleepy"})," pre-filled with a debate prompt so you can convene a council without leaving the dashboard. That flow isn't wired up yet."]})]}),a.jsxs("div",{className:"council-modal-now",children:[a.jsx("span",{className:"council-ov-label",children:"Right now"}),a.jsx("p",{className:"council-modal-now-body",children:"Open Claude in your project and run the Council skill:"}),a.jsxs("div",{className:"council-modal-cmd",children:[a.jsx("code",{children:kB}),a.jsx("button",{type:"button",className:"council-modal-cmd-copy",onClick:n,children:e?"Copied":"Copy"})]}),a.jsxs("p",{className:"council-modal-hint",children:["Tip: phrases like ",a.jsx("em",{children:'"debate this"'})," or ",a.jsx("em",{children:'"help me decide"'})," also prompt Council automatically. Finished debates show up here, where you can read every round, the agent matrix, and the final report."]})]}),a.jsx("footer",{className:"council-modal-foot",children:a.jsx("button",{type:"button",className:"council-modal-btn",onClick:r,children:"Got it"})})]})]})}function Ype(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=ppe(),[o,h]=R.useState(null),[l,u]=R.useState(!1),{data:d,isLoading:g}=gpe(o);return i?a.jsx("div",{className:"loading",children:r("common.loading")}):n?a.jsxs("div",{className:"error-state",children:["Failed to load council sessions. ",s==null?void 0:s.message]}):o?a.jsxs("div",{className:"council-page council-page--detail",children:[g&&a.jsx("div",{className:"loading",children:"Loading session…"}),d&&a.jsx(Kpe,{debate:d,onBack:()=>h(null)})]}):a.jsxs("div",{className:"council-page",children:[a.jsx(Ope,{debates:e??[],onOpen:h,onNew:()=>u(!0)}),l&&a.jsx(Vpe,{onClose:()=>u(!1)})]})}function Xpe(){return Zt({queryKey:["config"],queryFn:()=>ze.get("/config"),select:r=>r.config})}function Zpe(){const r=rr();return sr({mutationFn:e=>ze.patch("/config",e),onSuccess:()=>{r.invalidateQueries({queryKey:["config"]})}})}function Qpe(){return Zt({queryKey:["vaults"],queryFn:()=>ze.get("/vaults")})}function Jpe(){return Zt({queryKey:["connections"],queryFn:()=>ze.get("/connections"),select:r=>r.connections})}function ege(){const r=rr();return sr({mutationFn:e=>ze.post("/connections",e),onSuccess:()=>{r.invalidateQueries({queryKey:["connections"]}),r.invalidateQueries({queryKey:["vaults"]}),r.invalidateQueries({queryKey:["launcher-status"]}),r.invalidateQueries({queryKey:["launcher-federation-graph"]})}})}function tge(){const r=rr();return sr({mutationFn:e=>ze.del(`/connections/${encodeURIComponent(e)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["connections"]}),r.invalidateQueries({queryKey:["vaults"]}),r.invalidateQueries({queryKey:["launcher-status"]}),r.invalidateQueries({queryKey:["launcher-federation-graph"]})}})}function rge(){return Zt({queryKey:["federation","inbox"],queryFn:()=>ze.get("/federation/inbox")})}function ige(){return sr({mutationFn:()=>ze.post("/federation/sync",{})})}const SB=["out","in","both"];function nge({shareable:r,onToggleShareable:e,shareablePending:i}){const{t:n}=Fr(),{data:s}=Qpe(),{data:o}=Jpe(),h=ege(),l=tge(),{data:u}=rge(),d=ige(),[g,p]=R.useState(""),[m,y]=R.useState("both"),[w,_]=R.useState(null),v=(s==null?void 0:s.vaults)??[],x=(s==null?void 0:s.current)??null,C=o??[],k=new Set(C.map(E=>E.vault)),T=v.filter(E=>E.name!==x&&!k.has(E.name)),N=()=>{if(_(null),!g){_(n("federation.error.pick_vault"));return}h.mutate({vault:g,direction:m},{onSuccess:()=>{p(""),y("both")},onError:E=>_(E instanceof Error?E.message:String(E))})},j=(E,L)=>{h.mutate({vault:E.vault,direction:L,topics:E.topics})},A=(E,L)=>{const O=L.split(",").map(D=>D.trim()).filter(Boolean);h.mutate({vault:E.vault,direction:E.direction,topics:O.length>0?O:null})};return a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"fed-head",children:[a.jsx("h2",{className:"settings-section-title",children:n("settings.federation")}),a.jsxs("label",{className:"fed-sharing-toggle settings-checkbox-label",title:n("federation.shareable.hint"),children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:r,disabled:i,onChange:E=>e(E.target.checked)}),a.jsx("span",{children:n("federation.shareable.label")})]})]}),a.jsx(UO,{variant:"embedded"}),a.jsxs("details",{className:"fed-advanced",children:[a.jsx("summary",{className:"fed-advanced-summary",children:n("federation.advanced")}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.vaults")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.vaults.desc")})]}),v.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.vaults.empty")}):a.jsx("ul",{className:"fed-vault-list",children:v.map(E=>a.jsxs("li",{className:`fed-vault-item${E.name===x?" fed-vault-item--current":""}`,children:[a.jsx("span",{className:"fed-vault-name",children:E.name}),E.name===x&&a.jsx("span",{className:"fed-badge",children:n("federation.current")}),a.jsx("span",{className:"fed-vault-path",children:E.path})]},E.name))})]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.connections")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.connections.desc")})]}),C.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.connections.empty")}):a.jsx("ul",{className:"fed-conn-list",children:C.map(E=>{var L;return a.jsxs("li",{className:"fed-conn-item",children:[a.jsxs("div",{className:"fed-conn-head",children:[a.jsx("span",{className:"fed-conn-name",children:E.vault}),E.status==="stale"&&a.jsx("span",{className:"fed-badge fed-badge--stale",children:n("federation.stale")}),a.jsx("button",{className:"btn fed-conn-remove",onClick:()=>l.mutate(E.vault),disabled:l.isPending,children:n("federation.remove")})]}),a.jsxs("div",{className:"fed-conn-controls",children:[a.jsx("div",{className:"fed-direction",role:"group","aria-label":n("federation.direction"),children:SB.map(O=>a.jsx("button",{className:`fed-dir-btn${E.direction===O?" fed-dir-btn--active":""}`,onClick:()=>j(E,O),disabled:h.isPending,children:n(`federation.direction.${O}`)},O))}),a.jsx("input",{className:"settings-text-input fed-topics-input",defaultValue:((L=E.topics)==null?void 0:L.join(", "))??"",placeholder:n("federation.topics.placeholder"),onBlur:O=>{const D=O.target.value.split(",").map(q=>q.trim()).filter(Boolean).join(", "),G=(E.topics??[]).join(", ");D!==G&&A(E,O.target.value)}})]}),a.jsx("p",{className:"settings-field-hint fed-dir-hint",children:n(`federation.direction.${E.direction}.hint`)})]},E.vault)})})]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.add")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.add.desc")})]}),T.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.add.none")}):a.jsxs("div",{className:"fed-add-row",children:[a.jsxs("select",{className:"settings-text-input",value:g,onChange:E=>p(E.target.value),children:[a.jsx("option",{value:"",children:n("federation.add.pick")}),T.map(E=>a.jsx("option",{value:E.name,children:E.name},E.name))]}),a.jsx("div",{className:"fed-direction",role:"group","aria-label":n("federation.direction"),children:SB.map(E=>a.jsx("button",{className:`fed-dir-btn${m===E?" fed-dir-btn--active":""}`,onClick:()=>y(E),children:n(`federation.direction.${E}`)},E))}),a.jsx("button",{className:"btn btn--primary",onClick:N,disabled:h.isPending||!g,children:n("federation.connect")})]}),T.length>0&&a.jsx("p",{className:"settings-field-hint fed-dir-hint",children:n(`federation.direction.${m}.hint`)}),w&&a.jsx("p",{className:"settings-test-err",children:w})]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.inbox")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.inbox.desc")})]}),(()=>{const E=(u==null?void 0:u.pending)??[],L=(u==null?void 0:u.consumed)??[],O=(u==null?void 0:u.quarantined)??[];return E.length===0&&L.length===0&&O.length===0?a.jsx("p",{className:"settings-field-hint",children:n("federation.inbox.empty")}):a.jsxs(a.Fragment,{children:[E.length>0&&a.jsxs("div",{className:"fed-inbox-group",children:[a.jsxs("h4",{className:"fed-inbox-group-title",children:[n("federation.inbox.pending")," (",E.length,")"]}),a.jsx("ul",{className:"fed-entry-list",children:E.map(D=>a.jsx(TB,{entry:D,fromLabel:n("federation.inbox.from")},`p-${D.id}`))})]}),L.length>0&&a.jsxs("div",{className:"fed-inbox-group",children:[a.jsxs("h4",{className:"fed-inbox-group-title",children:[n("federation.inbox.consumed")," (",L.length,")"]}),a.jsx("ul",{className:"fed-entry-list fed-entry-list--consumed",children:L.map(D=>a.jsx(TB,{entry:D,fromLabel:n("federation.inbox.from")},`c-${D.id}`))})]}),O.length>0&&a.jsxs("div",{className:"fed-inbox-group",children:[a.jsxs("h4",{className:"fed-inbox-group-title fed-inbox-group-title--warn",children:[n("federation.inbox.quarantined")," (",O.length,")"]}),a.jsx("ul",{className:"fed-entry-list",children:O.map(D=>a.jsxs("li",{className:"fed-entry fed-entry--quarantined",children:[a.jsx("code",{className:"fed-entry-file",children:D.file}),a.jsxs("span",{className:"fed-entry-meta",children:["v",D.version]})]},`q-${D.file}`))})]})]})})()]}),a.jsxs("div",{className:"fed-card",children:[a.jsxs("div",{className:"fed-card-head",children:[a.jsx("h3",{className:"fed-card-title",children:n("federation.preview.title")}),a.jsx("p",{className:"fed-card-desc",children:n("federation.preview.hint")})]}),a.jsx("div",{className:"fed-preview-head",children:a.jsx("button",{className:"btn btn--secondary",onClick:()=>d.mutate(),disabled:d.isPending,children:d.isPending?n("federation.preview.running"):n("federation.preview")})}),d.isError&&a.jsx("p",{className:"settings-test-err",children:d.error instanceof Error?d.error.message:String(d.error)}),d.data&&a.jsx(sge,{deltas:d.data.deltas,t:n})]})]})]})}function TB({entry:r,fromLabel:e}){return a.jsxs("li",{className:"fed-entry",children:[a.jsxs("div",{className:"fed-entry-head",children:[a.jsx("span",{className:"fed-entry-title",children:r.title}),a.jsx("span",{className:`fed-entry-kind fed-entry-kind--${r.kind}`,children:r.kind})]}),a.jsxs("span",{className:"fed-entry-meta",children:[e," ",a.jsx("strong",{children:r.origin.vault}),r.origin.sourceTimestamp?` · ${r.origin.sourceTimestamp}`:""]})]})}function sge({deltas:r,t:e}){return r.length===0?a.jsx("p",{className:"settings-field-hint",children:e("federation.preview.none")}):a.jsx("ul",{className:"fed-delta-list",children:r.map(i=>{let n;return i.stale?n=e("federation.preview.stale"):i.consented?i.entries.length===0?n=e("federation.preview.nodelta"):n=`${i.entries.length} ${e("federation.preview.entries")}`:n=e("federation.preview.noconsent"),a.jsxs("li",{className:"fed-delta",children:[a.jsxs("div",{className:"fed-delta-head",children:[a.jsx("span",{className:"fed-delta-vault",children:i.vault}),a.jsx("span",{className:"fed-delta-status",children:n})]}),i.entries.length>0&&a.jsx("ul",{className:"fed-entry-list",children:i.entries.map((s,o)=>a.jsx("li",{className:"fed-entry",children:a.jsxs("div",{className:"fed-entry-head",children:[a.jsx("span",{className:"fed-entry-title",children:s.title}),a.jsx("span",{className:`fed-entry-kind fed-entry-kind--${s.kind}`,children:s.kind})]})},`${i.vault}-${o}`))})]},i.vault)})})}function age(){const{data:r,isLoading:e}=Nhe(),i=jhe(),[n,s]=R.useState(""),[o,h]=R.useState(null);R.useEffect(()=>{s((r==null?void 0:r.raw)??"")},[r]);const l=(r==null?void 0:r.warnings)??[],u=(r==null?void 0:r.customFields)??[];return a.jsxs("section",{className:"settings-section",children:[a.jsxs("h2",{className:"settings-section-title",children:["Task Format & Custom Fields",a.jsx("span",{className:"settings-beta-badge",children:"BETA"})]}),a.jsxs("p",{className:"settings-field-hint",children:["Declare custom fields for this project — they’re written to ",a.jsx("code",{children:"overrides/task.md"})," (committed to git) and apply to everyone: the CLI, the dashboard, the main agent, and sleep agents. Required fields must be set on every task. Custom fields sync to ClickUp / GitHub."]}),a.jsxs("details",{className:"tov-doc",children:[a.jsx("summary",{children:"How the format works"}),a.jsxs("div",{className:"tov-doc-body",children:[a.jsxs("p",{children:[a.jsx("code",{children:"_dream_context/overrides/task.md"})," has two parts — YAML frontmatter plus a body. With no file, tasks use the shipped defaults (nothing changes)."]}),a.jsxs("p",{children:[a.jsxs("strong",{children:["1. Frontmatter ",a.jsx("code",{children:"custom_fields:"})]})," — a list; each field accepts:"]}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("code",{children:"name"})," — display name (required)."]}),a.jsxs("li",{children:[a.jsx("code",{children:"key"})," — stable id used by the CLI and backend (optional; defaults to the snake_cased name)."]}),a.jsxs("li",{children:[a.jsx("code",{children:"type"})," — ",a.jsx("code",{children:"text"}),", ",a.jsx("code",{children:"number"}),", ",a.jsx("code",{children:"select"}),", or ",a.jsx("code",{children:"date"}),"."]}),a.jsxs("li",{children:[a.jsx("code",{children:"required"})," — ",a.jsx("code",{children:"true"})," to force the agent to set it on every task (default: optional)."]}),a.jsxs("li",{children:[a.jsx("code",{children:"options"})," — the allowed values, for a ",a.jsx("code",{children:"select"}),"."]}),a.jsxs("li",{children:[a.jsx("code",{children:"sync"})," — ",a.jsx("code",{children:"[clickup, github]"})," (both by default): which backend(s) the field syncs to."]}),a.jsxs("li",{children:[a.jsx("code",{children:"prompt"})," — tells the agent how to fill the field; shown in every agent’s briefing."]})]}),a.jsxs("p",{children:[a.jsx("strong",{children:"2. Body"})," — your task template (the sections a new task scaffolds with;"," ",a.jsx("code",{children:"{{WHY}}"})," is a placeholder), plus an optional ",a.jsx("code",{children:"## Agent Instructions"})," ","section the agents follow when creating a task (it is stripped from the created task). The body is edited via git/CLI — the box below is a read-only preview."]}),a.jsxs("p",{className:"tov-doc-note",children:["Values are set with ",a.jsx("code",{children:"tasks field <slug> <key> <value>"})," or"," ",a.jsx("code",{children:"tasks create --field key=value"}),", and show up wherever a task is read or listed. A malformed field is skipped with a warning — never fatal."]})]})]}),u.length>0&&a.jsx("div",{className:"tov-fields",children:u.map(d=>{var g;return a.jsxs("div",{className:"tov-field",children:[a.jsx("span",{className:"tov-field-name",children:d.name}),a.jsx("span",{className:`tov-field-req${d.required?" tov-field-req--on":""}`,children:d.required?"required":"optional"}),a.jsxs("span",{className:"tov-field-meta",children:["id ",a.jsx("code",{children:d.key})," · ",d.type,d.type==="select"&&((g=d.options)!=null&&g.length)?` (${d.options.join(", ")})`:"",` · ${d.sync.join("+")||"none"}`]}),d.prompt&&a.jsxs("span",{className:"tov-field-prompt",children:["“",d.prompt,"”"]}),a.jsxs("div",{className:"tov-field-actions",children:[a.jsx("button",{type:"button",className:"tov-edit",title:"Edit field","aria-label":`Edit field ${d.name}`,onClick:()=>h(d),children:"✎"}),a.jsx("button",{type:"button",className:"tov-remove",title:"Remove field","aria-label":`Remove field ${d.name}`,onClick:()=>{(o==null?void 0:o.key)===d.key&&h(null),i.mutate(d.key)},children:"×"})]})]},d.key)})}),o?a.jsx(uC,{initial:o,onClose:()=>h(null)},o.key):a.jsx(uC,{},"add"),l.length>0&&a.jsx("ul",{className:"tov-warnings",children:l.map((d,g)=>a.jsxs("li",{children:["⚠ ",d]},g))}),a.jsxs("label",{className:"tov-preview-label",children:["Generated ",a.jsx("code",{children:"overrides/task.md"})," — read-only"]}),a.jsx("textarea",{className:"tov-editor",spellCheck:!1,value:n,readOnly:!0,placeholder:e?"Loading…":"No override yet — add a custom field above to create it.",rows:14})]})}function sl({children:r,...e}){return a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:r})}function oge(r){return a.jsxs(sl,{...r,children:[a.jsx("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.75"}),a.jsx("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.75"}),a.jsx("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.75"}),a.jsx("rect",{x:"13.5",y:"13.5",width:"7",height:"7",rx:"1.75"})]})}function lge(r){return a.jsx(sl,{...r,children:a.jsx("path",{d:"M6.5 18.5a4 4 0 0 1-.7-7.94 5.25 5.25 0 0 1 10.16-1.9A3.75 3.75 0 0 1 17.5 18.5H6.5Z"})})}function cge(r){return a.jsxs(sl,{...r,children:[a.jsx("ellipse",{cx:"12",cy:"6",rx:"7",ry:"3"}),a.jsx("path",{d:"M5 6v6c0 1.66 3.13 3 7 3s7-1.34 7-3V6"}),a.jsx("path",{d:"M5 12v6c0 1.66 3.13 3 7 3s7-1.34 7-3v-6"})]})}function hge(r){return a.jsxs(sl,{...r,children:[a.jsx("circle",{cx:"6",cy:"12",r:"2.5"}),a.jsx("circle",{cx:"18",cy:"6",r:"2.5"}),a.jsx("circle",{cx:"18",cy:"18",r:"2.5"}),a.jsx("path",{d:"M8.2 10.8 15.8 7.2M8.2 13.2l7.6 3.6"})]})}function uge(r){return a.jsxs(sl,{...r,children:[a.jsx("path",{d:"M8 6h12M8 12h12M8 18h12"}),a.jsx("circle",{cx:"4",cy:"6",r:"1.25",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.25",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4",cy:"18",r:"1.25",fill:"currentColor",stroke:"none"})]})}function dge(r){return a.jsxs(sl,{...r,children:[a.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2.25"}),a.jsx("path",{d:"M7.5 9.5 10 12l-2.5 2.5M12.5 14.5h4"})]})}function fge(r){return a.jsx(sl,{...r,children:a.jsx("path",{d:"M20.5 14.3A8.25 8.25 0 0 1 9.7 3.5a8.25 8.25 0 1 0 10.8 10.8Z"})})}function pge(r){return a.jsxs(sl,{...r,children:[a.jsx("path",{d:"M6.5 17.5a4 4 0 0 1-.7-7.94 5.25 5.25 0 0 1 10.16-1.9A3.75 3.75 0 0 1 17.5 17.5H6.5Z"}),a.jsx("path",{d:"M9.5 13.5 12 11l2.5 2.5M12 11v6.5"})]})}const gge={platforms:oge,tasks:lge,memory:cge,connections:hge,format:uge,brain:pge,agents:dge,sleepy:fge};function mge({blocks:r}){return a.jsx("ul",{className:"brain-scrub-list",children:r.map((e,i)=>a.jsxs("li",{className:"brain-scrub-item",children:[a.jsxs("code",{children:[e.file,":",e.line]})," — ",e.excerpt]},i))})}function yge({disabled:r}){const{t:e}=Fr(),{data:i}=$C(),{data:n}=fR(),s=!!(i!=null&&i.connected),o=!!r||!s,[h,l]=R.useState("create"),u=e7(),[d,g]=R.useState(null),p=async()=>{g(null);try{await u.mutateAsync()}catch(ee){g(ee instanceof Error?ee.message:String(ee))}},m=Zz(),[y,w]=R.useState(""),[_,v]=R.useState(!1),[x,C]=R.useState(!1),[k,T]=R.useState(null),[N,j]=R.useState(null),A=async()=>{var ee;if(T(null),j(null),!y.trim()){T(e("brain.create.nameRequired"));return}if(_&&!x){T(e("brain.create.confirmPublicFirst"));return}try{const he=await m.mutateAsync({name:y.trim(),public:_,confirmed:_?x:void 0});if(he.blocked){j(((ee=he.scrub)==null?void 0:ee.blocks)??[]);return}w(""),v(!1),C(!1)}catch(he){T(he instanceof Error?he.message:String(he))}},[E,L]=R.useState(!1),{data:O,isFetching:D,isError:G}=Xz(E),q=Qz(),U=Jz(),[$,F]=R.useState(""),[W,Y]=R.useState(!1),[P,K]=R.useState(null),z=async()=>{K(null),Y(!1);try{await q.mutateAsync($.trim())}catch(ee){K(ee instanceof Error?ee.message:String(ee))}},X=async()=>{K(null);try{const ee=await U.mutateAsync({url:$.trim(),confirmed:!0});if(!ee.ok){K(ee.reason??e("brain.attach.refused"));return}ee.bootstrap==="blocked-scrub"&&K(e("brain.attach.bootstrapBlocked")),F(""),Y(!1)}catch(ee){K(ee instanceof Error?ee.message:String(ee))}},ie=q.data;return a.jsxs("div",{className:`brain-setup${o?" brain-setup--disabled":""}`,children:[!s&&a.jsx("p",{className:"settings-field-hint",children:e("brain.setup.signInFirst")}),n!=null&&n.hasRemote?a.jsxs("div",{className:"brain-setup-connected",children:[a.jsxs("p",{className:"brain-setup-already",children:["✓ ",e("brain.setup.alreadyConnected")," ",a.jsx("code",{children:n.remote})]}),a.jsx("p",{className:"settings-field-hint",children:e("brain.setup.switchHint")}),a.jsx("button",{type:"button",className:"btn btn--ghost",onClick:p,disabled:o||u.isPending,children:u.isPending?e("brain.setup.disconnecting"):e("brain.setup.disconnect")}),d&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",d]})]}):n?a.jsx("p",{className:"settings-field-hint",children:n.codeOrigin?e("brain.setup.inTree").replace("{origin}",n.codeOrigin):e("brain.setup.notConnected")}):null,a.jsx("div",{className:"brain-setup-tabs",role:"tablist",children:["create","discover","attach"].map(ee=>a.jsx("button",{type:"button",role:"tab","aria-selected":h===ee,className:`brain-setup-tab${h===ee?" brain-setup-tab--active":""}`,onClick:()=>l(ee),disabled:o,children:e(`brain.setup.tab.${ee}`)},ee))}),h==="create"&&a.jsxs("div",{className:"brain-setup-panel",children:[a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("brain.create.name")}),a.jsx("input",{className:"settings-text-input",value:y,onChange:ee=>w(ee.target.value),placeholder:e("brain.create.namePlaceholder"),disabled:o})]}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:_,onChange:ee=>{v(ee.target.checked),C(!1)},disabled:o}),a.jsx("span",{children:e("brain.create.makePublic")})]}),_&&a.jsxs("div",{className:"brain-setup-public-warning",children:[a.jsx("p",{children:e("brain.create.publicWarning")}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:x,onChange:ee=>C(ee.target.checked),disabled:o}),a.jsx("span",{children:e("brain.create.publicConfirm")})]})]}),a.jsx("button",{type:"button",className:"btn btn--primary",onClick:A,disabled:o||m.isPending,children:m.isPending?e("brain.create.creating"):e("brain.create.submit")}),k&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",k]}),N&&a.jsxs("div",{className:"brain-scrub-block",children:[a.jsxs("p",{className:"settings-test-err",children:["✗ ",e("brain.create.scrubBlocked")]}),a.jsx(mge,{blocks:N})]})]}),h==="discover"&&a.jsxs("div",{className:"brain-setup-panel",children:[a.jsx("button",{type:"button",className:"btn btn--secondary",onClick:()=>L(!0),disabled:o||D,children:e(D?"brain.discover.loading":"brain.discover.find")}),G&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",e("brain.discover.error")]}),E&&!D&&(O??[]).length===0&&!G&&a.jsx("p",{className:"settings-field-hint",children:e("brain.discover.empty")}),(O??[]).length>0&&a.jsx("ul",{className:"brain-discover-list",children:O.map(ee=>a.jsxs("li",{className:"brain-discover-item",children:[a.jsxs("span",{className:"brain-discover-name",children:[ee.fullName,ee.private&&a.jsx("span",{className:"brain-discover-private",children:e("brain.discover.private")})]}),a.jsx("button",{type:"button",className:"btn btn--ghost",onClick:()=>{F(ee.htmlUrl),l("attach")},children:e("brain.discover.select")})]},ee.fullName))})]}),h==="attach"&&a.jsxs("div",{className:"brain-setup-panel",children:[a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("brain.attach.url")}),a.jsx("input",{className:"settings-text-input",value:$,onChange:ee=>{F(ee.target.value),Y(!1)},placeholder:"https://github.com/owner/brain-repo",disabled:o})]}),a.jsx("button",{type:"button",className:"btn btn--secondary",onClick:z,disabled:o||q.isPending||!$.trim(),children:q.isPending?e("brain.attach.previewing"):e("brain.attach.preview")}),ie&&a.jsx("div",{className:"brain-attach-preview",children:ie.reachable?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"brain-trust-warning",children:[a.jsx("p",{className:"brain-trust-warning-title",children:e("brain.attach.trustTitle")}),a.jsx("p",{children:e("brain.attach.trustBody")})]}),a.jsxs("dl",{className:"brain-attach-meta",children:[a.jsx("dt",{children:e("brain.attach.repo")}),a.jsx("dd",{children:ie.fullName}),a.jsx("dt",{children:e("brain.attach.visibility")}),a.jsx("dd",{children:ie.private?e("brain.attach.private"):e("brain.attach.publicVisibility")}),a.jsx("dt",{children:e("brain.attach.isBrainRepo")}),a.jsx("dd",{children:ie.isBrainRepo?"✓":`✗ ${e("brain.attach.notBrainRepo")}`}),a.jsx("dt",{children:e("brain.attach.branch")}),a.jsx("dd",{children:ie.defaultBranch})]}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:W,onChange:ee=>Y(ee.target.checked),disabled:o}),a.jsx("span",{children:e("brain.attach.iTrust")})]}),a.jsx("button",{type:"button",className:"btn btn--primary",onClick:X,disabled:o||U.isPending||!W,children:U.isPending?e("brain.attach.attaching"):e("brain.attach.submit")})]}):a.jsxs("p",{className:"settings-test-err",children:["✗ ",ie.reason??e("brain.attach.unreachable")]})}),P&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",P]})]})]})}function bge(r){const e=[];r.metaKey&&e.push("Cmd"),r.ctrlKey&&e.push("Ctrl"),r.altKey&&e.push("Alt"),r.shiftKey&&e.push("Shift");let i=r.key;return["Meta","Control","Alt","Shift"].includes(i)||(i===" "?i="Space":i.length===1?i=i.toUpperCase():i=i.charAt(0).toUpperCase()+i.slice(1),e.length===0)?null:[...e,i].join("+")}const vge=[{id:"claude",labelKey:"settings.platform.claude"}],__={platforms:[],disableNativeMemory:!0},xge=[{id:"platforms",labelKey:"settings.nav.platforms",descKey:"settings.navdesc.platforms"},{id:"tasks",labelKey:"settings.nav.tasks",descKey:"settings.navdesc.tasks"},{id:"memory",labelKey:"settings.nav.memory",descKey:"settings.navdesc.memory"},{id:"connections",labelKey:"settings.nav.connections",descKey:"settings.navdesc.connections"},{id:"brain",labelKey:"settings.nav.brain",descKey:"settings.navdesc.brain"},{id:"format",labelKey:"settings.nav.format",descKey:"settings.navdesc.format",beta:!0},{id:"agents",labelKey:"settings.nav.agents",descKey:"settings.navdesc.agents",desktopOnly:!0,beta:!0},{id:"sleepy",labelKey:"settings.nav.sleepy",descKey:"settings.navdesc.sleepy",desktopOnly:!0,lab:!0}];function _ge({focus:r}){var se;const{t:e}=Fr(),i=rr(),{data:n,isLoading:s,isError:o}=Xpe(),h=Zpe(),{data:l}=J6(),u=((l==null?void 0:l.desktop)??!1)||un(),{data:d}=Uz(),g=Wz(),[p,m]=R.useState("platforms"),y=xge.filter(oe=>!oe.desktopOnly||u),[w,_]=R.useState(__.platforms),[v,x]=R.useState(__.disableNativeMemory),[C,k]=R.useState(!1),[T,N]=R.useState("clickup"),[j,A]=R.useState(""),[E,L]=R.useState(""),[O,D]=R.useState(""),[G,q]=R.useState(""),[U,$]=R.useState(""),[F,W]=R.useState(""),[Y,P]=R.useState(""),[K,z]=R.useState(null),[X,ie]=R.useState(!1),[ee,he]=R.useState(null),[fe,ne]=R.useState(null),[I,Z]=R.useState(!1),[J,re]=R.useState(null),[ue,Le]=R.useState(!1),[Ze,qe]=R.useState(!1),[Ye,pe]=R.useState(()=>_w()),[Ne,de]=R.useState(!1),Ue=oe=>{pe(oe),aQ(oe),m1(oe)},[at,Pt]=R.useState(null),[Mt,Lt]=R.useState(!1),Bt=R.useRef(null);R.useEffect(()=>{if(!u)return;let oe=!1;return iF().then(we=>{oe||Pt(we)}),()=>{oe=!0}},[u]);const bt=oe=>{Pt(oe),jle(oe)},{data:Se}=Zt({queryKey:["tasks-sync-status"],queryFn:()=>ze.get("/tasks/sync-status"),select:oe=>oe.status}),{data:De}=Zt({queryKey:["tasks-token-status"],queryFn:()=>ze.get("/tasks/token-status"),enabled:C}),Me=De&&De.backend===T?De:void 0,{data:Je}=Zt({queryKey:["tasks-containers"],queryFn:()=>ze.get("/tasks/containers"),select:oe=>oe.containers,enabled:C,staleTime:300*1e3}),wt=oe=>{const we=(Je??[]).find(tt=>tt.path===oe);we&&(T==="github"?(q(we.ids.owner??""),$(we.ids.repo??"")):(A(we.ids.teamId??""),L(we.ids.spaceId??""),D(we.ids.listId??"")),Ge())},ot=async()=>{const oe=C?T:"local",we=(T==="github"?Y:F).trim();try{return await h.mutateAsync({platforms:w,disableNativeMemory:v,taskBackend:oe,...C&&T==="clickup"?{clickup:{teamId:j||void 0,spaceId:E||void 0,listId:O||void 0}}:{},...C&&T==="github"?{github:{owner:G||void 0,repo:U||void 0}}:{}}),C&&we&&await ze.post("/tasks/token",{token:we}),we&&(T==="github"?P(""):W("")),await Promise.all([i.invalidateQueries({queryKey:["tasks-token-status"]}),i.invalidateQueries({queryKey:["tasks-containers"]}),i.invalidateQueries({queryKey:["tasks-sync-status"]})]),Le(!1),re(null),!0}catch(tt){return re(tt instanceof Error?tt.message:String(tt)),!1}},At=oe=>oe.errors.length>0?`⚠ ${oe.errors[0]}`:oe.created.length>0?`✓ ${e("settings.cloud_tasks.provision_created")}: ${oe.created.join(", ")}${oe.backfilled>0?` · ${e("settings.cloud_tasks.provision_backfilled").replace("{n}",String(oe.backfilled))}`:""}`:`✓ ${e("settings.cloud_tasks.provision_nothing")}`,Te=oe=>!oe||!oe.set?e("settings.cloud_tasks.api_key_none"):oe.source==="env"?`${e("settings.cloud_tasks.api_key_env")} ${oe.masked??""}`.trim():`${e("settings.cloud_tasks.api_key_set")} ${oe.masked??""}`.trim(),ft=async()=>{Z(!0),he(null),ne(null);try{if(!await ot())return;const{result:oe}=await ze.post("/tasks/provision",{dryRun:!0});oe.created.length===0&&oe.errors.length===0?he(`✓ ${e("settings.cloud_tasks.provision_nothing")}`):ne(oe)}catch(oe){he(`⚠ ${oe instanceof Error?oe.message:String(oe)}`)}finally{Z(!1)}},lt=async()=>{Z(!0),he(null);try{const{result:oe}=await ze.post("/tasks/provision",{dryRun:!1});ne(null),he(At(oe)),i.invalidateQueries({queryKey:["tasks-sync-status"]})}catch(oe){he(`⚠ ${oe instanceof Error?oe.message:String(oe)}`)}finally{Z(!1)}};if(R.useEffect(()=>{var tt,Et,dt,nt,it;const oe=n??__;_(oe.platforms),x(oe.disableNativeMemory??!0);const we=n;k((we==null?void 0:we.taskBackend)==="clickup"||(we==null?void 0:we.taskBackend)==="github"),N((we==null?void 0:we.taskBackend)==="github"?"github":"clickup"),A(((tt=we==null?void 0:we.clickup)==null?void 0:tt.teamId)??""),L(((Et=we==null?void 0:we.clickup)==null?void 0:Et.spaceId)??""),D(((dt=we==null?void 0:we.clickup)==null?void 0:dt.listId)??""),q(((nt=we==null?void 0:we.github)==null?void 0:nt.owner)??""),$(((it=we==null?void 0:we.github)==null?void 0:it.repo)??""),Le(!1),qe(!1)},[n]),R.useEffect(()=>{(r==null?void 0:r.id)==="brain"&&m("brain")},[r==null?void 0:r.id,r==null?void 0:r.nonce]),s)return a.jsx("div",{className:"loading",children:e("common.loading")});if(o)return a.jsx("div",{className:"error-state",children:e("common.error")});const be=oe=>{_(we=>{const tt=we.includes(oe)?we.filter(Et=>Et!==oe):[...we,oe];return Le(!0),qe(!1),tt})},ye=()=>{x(oe=>!oe),Le(!0),qe(!1)},et=async()=>{qe(!1),await ot()&&qe(!0)},Ge=()=>{Le(!0),qe(!1)},vt=(n==null?void 0:n.shareable)===!0,ut=oe=>{h.mutate({shareable:oe})},kt=async()=>{ie(!0),z(null),ne(null);try{if(!await ot())return;z(await ze.post("/tasks/sync-test",{}))}catch(oe){z({ok:!1,backend:T,error:oe instanceof Error?oe.message:String(oe)})}finally{ie(!1)}};return a.jsxs("div",{className:"settings-page",children:[a.jsx("div",{className:"settings-header",children:a.jsxs("div",{className:"settings-save-row",children:[Ze&&!ue&&a.jsx("span",{className:"settings-saved",children:e("settings.saved")}),h.isError&&a.jsx("span",{className:"settings-error",children:e("common.error")}),a.jsx("button",{className:"btn btn--primary",onClick:et,disabled:!ue||h.isPending,children:h.isPending?e("settings.saving"):e("settings.save")})]})}),n===null&&a.jsx("div",{className:"settings-empty-notice",children:e("settings.no_config")}),a.jsxs("div",{className:"settings-body",children:[a.jsx("nav",{className:"settings-nav","aria-label":e("settings.title"),children:y.map(oe=>{const we=gge[oe.id],tt=p===oe.id;return a.jsxs("button",{type:"button",className:`settings-nav-item${tt?" settings-nav-item--active":""}`,"aria-current":tt?"page":void 0,onClick:()=>m(oe.id),children:[a.jsx("span",{className:"settings-nav-icon","aria-hidden":"true",children:we?a.jsx(we,{}):null}),a.jsxs("span",{className:"settings-nav-text",children:[a.jsxs("span",{className:"settings-nav-label",children:[e(oe.labelKey),oe.lab&&a.jsx("span",{className:"settings-lab-badge",children:e("nav.lab")}),oe.beta&&a.jsx("span",{className:"settings-beta-badge",children:"BETA"})]}),a.jsx("span",{className:"settings-nav-desc",children:e(oe.descKey)})]})]},oe.id)})}),a.jsxs("div",{className:"settings-content",children:[p==="platforms"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.platforms")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.platforms")})]}),a.jsx("div",{className:"settings-checkboxes",children:vge.map(({id:oe,labelKey:we})=>a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:w.includes(oe),onChange:()=>be(oe)}),a.jsx("span",{children:e(we)})]},oe))})]}),p==="tasks"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.tasks")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.tasks")})]}),a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:C,onChange:()=>{k(oe=>!oe),Ge()}}),a.jsx("span",{children:e("settings.cloud_tasks.label")})]}),a.jsx("p",{className:"settings-field-hint",children:e(T==="github"?"settings.cloud_tasks.github.hint":"settings.cloud_tasks.hint")}),C&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.provider")}),a.jsxs("select",{className:"settings-text-input",value:T,onChange:oe=>{const we=oe.target.value;N(we),z(null),Ge()},children:[a.jsx("option",{value:"clickup",children:e("settings.cloud_tasks.provider.clickup")}),a.jsx("option",{value:"github",children:e("settings.cloud_tasks.provider.github")})]})]}),T==="clickup"&&a.jsxs(a.Fragment,{children:[(Je??[]).length>0&&a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.list_label")}),a.jsx(ff,{value:O?((se=(Je??[]).find(oe=>oe.ids.listId===O))==null?void 0:se.path)??null:null,options:(Je??[]).map(oe=>({value:oe.path,label:oe.path})),placeholder:e("settings.cloud_tasks.list_pick"),searchPlaceholder:e("settings.cloud_tasks.list_search"),clearLabel:e("settings.cloud_tasks.keep_current"),onChange:wt})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.team")}),a.jsx("input",{className:"settings-text-input",value:j,onChange:oe=>{A(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.space")}),a.jsx("input",{className:"settings-text-input",value:E,onChange:oe=>{L(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.list")}),a.jsx("input",{className:"settings-text-input",value:O,onChange:oe=>{D(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.api_key")}),a.jsx("input",{type:"password",className:"settings-text-input",autoComplete:"off",value:F,placeholder:Me!=null&&Me.set?Me.masked??"••••••••":e("settings.cloud_tasks.api_key_placeholder"),onChange:oe=>{W(oe.target.value),Ge()}})]}),a.jsx("p",{className:"settings-field-hint",children:Te(Me)}),a.jsx("p",{className:"settings-field-hint",children:e("settings.cloud_tasks.token_hint")})]}),T==="github"&&a.jsxs(a.Fragment,{children:[(Je??[]).length>0&&a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.github.repo_picker")}),a.jsx(ff,{value:G&&U?`${G}/${U}`:null,options:(Je??[]).map(oe=>({value:oe.path,label:oe.path})),placeholder:e("settings.cloud_tasks.github.pick"),searchPlaceholder:e("settings.cloud_tasks.github.search"),clearLabel:e("settings.cloud_tasks.keep_current"),onChange:wt})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.github.owner")}),a.jsx("input",{className:"settings-text-input",value:G,onChange:oe=>{q(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.github.repo")}),a.jsx("input",{className:"settings-text-input",value:U,onChange:oe=>{$(oe.target.value),Ge()}})]}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.cloud_tasks.api_key")}),a.jsx("input",{type:"password",className:"settings-text-input",autoComplete:"off",value:Y,placeholder:Me!=null&&Me.set?Me.masked??"••••••••":e("settings.cloud_tasks.api_key_placeholder"),onChange:oe=>{P(oe.target.value),Ge()}})]}),a.jsx("p",{className:"settings-field-hint",children:Te(Me)}),a.jsx("p",{className:"settings-field-hint",children:e("settings.cloud_tasks.github.token_hint")})]}),a.jsxs("div",{className:"settings-test-row",children:[a.jsx("button",{className:"btn btn--secondary",onClick:kt,disabled:X||I,children:e(X?"settings.cloud_tasks.testing":"settings.cloud_tasks.test")}),a.jsx("button",{className:"btn btn--secondary",onClick:ft,disabled:I||X,children:e(I&&!fe?T==="github"?"settings.cloud_tasks.github.provisioning":"settings.cloud_tasks.provisioning":T==="github"?"settings.cloud_tasks.github.provision":"settings.cloud_tasks.provision")}),K&&K.ok&&a.jsxs("span",{className:"settings-test-ok",children:["✓ ",K.note??`${e("settings.cloud_tasks.test_ok")} ${K.user}`]}),K&&!K.ok&&a.jsxs("span",{className:"settings-test-err",children:["✗ ",K.error]})]}),J&&a.jsxs("p",{className:"settings-test-err",children:["✗ ",J]}),ee&&a.jsx("p",{className:"settings-field-hint",children:ee}),fe&&a.jsxs("div",{className:"settings-provision-preview",children:[a.jsx("p",{className:"settings-provision-preview-title",children:e(T==="github"?"settings.cloud_tasks.github.preview_title":"settings.cloud_tasks.preview_title")}),fe.created.length>0&&a.jsxs("p",{className:"settings-provision-line",children:[a.jsx("span",{className:"settings-provision-badge settings-provision-badge--new",children:e("settings.cloud_tasks.preview_will_create").replace("{n}",String(fe.created.length))})," ",fe.created.join(", ")]}),fe.existing.length>0&&a.jsxs("p",{className:"settings-provision-line settings-provision-line--muted",children:[a.jsx("span",{className:"settings-provision-badge",children:e("settings.cloud_tasks.preview_existing").replace("{n}",String(fe.existing.length))})," ",fe.existing.join(", ")]}),a.jsxs("div",{className:"settings-provision-actions",children:[a.jsx("button",{className:"btn btn--primary",onClick:lt,disabled:I,children:I?e("settings.cloud_tasks.provision_creating"):e("settings.cloud_tasks.provision_confirm").replace("{n}",String(fe.created.length))}),a.jsx("button",{className:"btn btn--ghost",onClick:()=>ne(null),disabled:I,children:e("settings.cloud_tasks.provision_cancel")})]})]}),Se&&Se.backend!=="local"&&a.jsxs("p",{className:"settings-sync-badge",children:[e("settings.cloud_tasks.status"),": ",Se.pendingPush," ",e("settings.cloud_tasks.pending"),Se.conflicts>0&&` · ${Se.conflicts} ${e("settings.cloud_tasks.conflicts")}`]})]})]})]}),p==="format"&&a.jsx(age,{}),p==="memory"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.memory")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.memory")})]}),a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:v,onChange:ye}),a.jsx("span",{children:e("settings.native_memory.label")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.native_memory.hint")})]})]}),p==="connections"&&a.jsx(nge,{shareable:vt,onToggleShareable:ut,shareablePending:h.isPending}),p==="brain"&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("div",{className:"fed-head",children:[a.jsxs("div",{className:"settings-section-head",children:[a.jsx("h2",{className:"settings-section-title",children:e("settings.brain")}),a.jsx("p",{className:"settings-section-desc",children:e("settings.desc.brain")})]}),a.jsxs("label",{className:"fed-sharing-toggle settings-checkbox-label",title:e("brain.cloudSync.hint"),children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:(d==null?void 0:d.enabled)??!1,disabled:g.isPending,onChange:oe=>g.mutate(oe.target.checked)}),a.jsxs("span",{children:[e("brain.cloudSync.label"),d&&a.jsxs("span",{className:"settings-field-hint brain-cloudsync-source",children:[" ","(",d.source==="explicit"?e("brain.cloudSync.source.explicit"):e("brain.cloudSync.source.derived"),")"]})]})]})]}),a.jsxs("div",{className:"settings-subsection",children:[a.jsx("h3",{className:"settings-nav-label",children:e("brain.auth.title")}),a.jsx(sce,{})]}),a.jsxs("div",{className:"settings-subsection",children:[a.jsx("h3",{className:"settings-nav-label",children:e("brain.setup.title")}),a.jsx(yge,{disabled:!((d==null?void 0:d.enabled)??!1)})]})]}),p==="agents"&&u&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("h2",{className:"settings-section-title",children:[e("settings.agents.title"),a.jsx("span",{className:"settings-beta-badge",children:"BETA"})]}),at?a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:at.enabled,onChange:()=>bt({...at,enabled:!at.enabled})}),a.jsx("span",{children:e("settings.agents.enable")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.enable_hint")}),at.enabled&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:at.restoreTabs,onChange:()=>bt({...at,restoreTabs:!at.restoreTabs})}),a.jsx("span",{children:e("settings.agents.restore_tabs")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.restore_tabs_hint")}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.agents.default_agent")}),a.jsx("select",{className:"settings-text-input",value:at.defaultAgent,onChange:oe=>bt({...at,defaultAgent:oe.target.value}),children:a.jsx("option",{value:"claude",children:e("settings.agents.agent.claude")})})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.default_agent_hint")}),a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:at.autoTitle,onChange:()=>bt({...at,autoTitle:!at.autoTitle})}),a.jsx("span",{children:e("settings.agents.auto_title")})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.auto_title_hint")}),a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:e("settings.agents.hotkey")}),a.jsx("input",{className:"settings-text-input",readOnly:!0,value:Mt?e("settings.agents.hotkey_capturing"):Lle(at.hotkey),onFocus:()=>{Lt(!0),Bt.current=null},onBlur:()=>{Lt(!1),Bt.current=null},onKeyDown:oe=>{if(oe.preventDefault(),oe.key==="Backspace"||oe.key==="Delete"){bt({...at,hotkey:""}),Bt.current=null,Lt(!1),oe.currentTarget.blur();return}const we=oF(oe);if(we){if(oe.repeat)return;const Et=Date.now(),dt=Bt.current;dt&&dt.token===we&&Et-dt.ts<=sF?(Bt.current=null,bt({...at,hotkey:`${we}+${we}`}),Lt(!1),oe.currentTarget.blur()):Bt.current={token:we,ts:Et};return}Bt.current=null;const tt=nF(oe);tt&&(bt({...at,hotkey:tt}),Lt(!1),oe.currentTarget.blur())}})]}),a.jsx("p",{className:"settings-field-hint",children:e("settings.agents.hotkey_hint")})]})]}):a.jsx("p",{className:"settings-field-hint",children:e("common.loading")})]}),p==="sleepy"&&u&&a.jsxs("section",{className:"settings-section",children:[a.jsxs("h2",{className:"settings-section-title",children:["Sleepy — notch quick-capture",a.jsx("span",{className:"settings-lab-badge",children:e("nav.lab")})]}),a.jsxs("div",{className:"settings-checkboxes",children:[a.jsxs("label",{className:"settings-checkbox-label",children:[a.jsx("input",{type:"checkbox",className:"settings-checkbox",checked:Ye.enabled,onChange:()=>Ue({...Ye,enabled:!Ye.enabled})}),a.jsx("span",{children:"Enable Sleepy"})]}),a.jsx("p",{className:"settings-field-hint",children:"Press the hotkey anywhere to drop a capture bar under the notch: pick a project, type a thought, hit return — it's saved to that project's memory and learned."}),Ye.enabled&&a.jsxs("div",{className:"settings-field-row",children:[a.jsx("label",{children:"Hotkey"}),a.jsx("input",{className:"settings-text-input",readOnly:!0,value:Ne?"Press a key combo…":Ye.hotkey,onFocus:()=>de(!0),onBlur:()=>de(!1),onKeyDown:oe=>{oe.preventDefault();const we=bge(oe);we&&(Ue({...Ye,hotkey:we}),de(!1),oe.currentTarget.blur())}})]})]})]})]})]})]})}function _$(){return Zt({queryKey:["packs"],queryFn:()=>ze.get("/packs")})}function Cge(){const r=rr();return sr({mutationFn:e=>ze.post(`/packs/${encodeURIComponent(e)}/install`,{}),onSuccess:()=>{r.invalidateQueries({queryKey:["packs"]})}})}function wge(){const r=rr();return sr({mutationFn:e=>ze.del(`/packs/${encodeURIComponent(e)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["packs"]})}})}function kge(r){return"base"in r}function C$({item:r,onActionDone:e}){const{t:i}=Fr(),n=Cge(),s=wge(),o=r.installed,h=o?s:n,l=h.isPending,u=h.isError,d=i(o?"packs.action.remove":"packs.action.install"),g=i(o?"packs.action.removing":"packs.action.installing"),p=l?g:d,m=y=>{y.stopPropagation(),y.preventDefault(),!l&&h.mutate(r.name,{onSuccess:()=>e==null?void 0:e()})};return a.jsxs("div",{className:"packs-card-actions",children:[a.jsx("button",{type:"button",className:`packs-action-btn btn btn--ghost${o?" packs-action-btn--danger":""}`,onClick:m,disabled:l,"aria-invalid":u||void 0,"aria-busy":l||void 0,children:p}),u&&a.jsx("span",{className:"packs-action-error",role:"alert",children:i("packs.action.error")})]})}function Sge({item:r,onClose:e}){const{t:i}=Fr(),n=R.useCallback(s=>{s.target===s.currentTarget&&e()},[e]);return R.useEffect(()=>{const s=o=>{o.key==="Escape"&&e()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e]),a.jsx("div",{className:"packs-modal-overlay",onClick:n,"aria-modal":"true",role:"dialog","aria-label":r.name,children:a.jsxs("div",{className:"packs-modal-panel",children:[a.jsxs("div",{className:"packs-modal-header",children:[a.jsxs("div",{className:"packs-modal-title-row",children:[a.jsx("h2",{className:"packs-modal-name",children:r.name}),r.installed&&a.jsx("span",{className:"packs-installed-pill",children:i("settings.packs.installed")})]}),a.jsxs("div",{className:"packs-modal-header-actions",children:[a.jsx(C$,{item:r,onActionDone:e}),a.jsx("button",{className:"packs-modal-close btn btn--ghost",type:"button",onClick:e,"aria-label":i("packs.detail.close"),children:i("packs.detail.close")})]})]}),r.description&&a.jsx("p",{className:"packs-modal-desc",children:r.description}),r.tags.length>0&&a.jsx("div",{className:"packs-modal-tags",children:r.tags.map(s=>a.jsx("span",{className:"task-tag","data-hue":na(s),children:s},s))}),kge(r)&&a.jsxs(a.Fragment,{children:[r.base&&a.jsxs("div",{className:"packs-modal-section",children:[a.jsx("h3",{className:"packs-modal-section-title",children:i("packs.detail.base")}),a.jsx("p",{className:"packs-modal-mono",children:r.base})]}),r.subSkills.length>0&&a.jsxs("div",{className:"packs-modal-section",children:[a.jsx("h3",{className:"packs-modal-section-title",children:i("packs.detail.subskills")}),a.jsx("ul",{className:"packs-modal-subskills",children:r.subSkills.map(s=>a.jsxs("li",{className:"packs-modal-subskill",children:[a.jsx("span",{className:"packs-modal-subskill-name",children:s.name}),s.description&&a.jsx("span",{className:"packs-modal-subskill-desc",children:s.description})]},s.name))})]}),r.relatedAgents&&r.relatedAgents.length>0&&a.jsxs("div",{className:"packs-modal-section",children:[a.jsx("h3",{className:"packs-modal-section-title",children:i("packs.detail.agents")}),a.jsx("ul",{className:"packs-modal-agents",children:r.relatedAgents.map(s=>a.jsx("li",{className:"packs-modal-agent",children:s},s))})]})]})]})})}function EB({item:r,onClick:e}){const{t:i}=Fr(),n=s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),e(r))};return a.jsxs("div",{className:"packs-card packs-card--clickable",role:"button",tabIndex:0,onClick:()=>e(r),onKeyDown:n,"aria-label":r.name,children:[a.jsxs("div",{className:"packs-card-header",children:[a.jsx("span",{className:"packs-card-name",children:r.name}),r.installed&&a.jsx("span",{className:"packs-installed-pill",children:i("settings.packs.installed")})]}),r.description&&a.jsx("p",{className:"packs-card-desc",children:r.description}),r.tags.length>0&&a.jsx("div",{className:"packs-card-tags",children:r.tags.map(s=>a.jsx("span",{className:"task-tag","data-hue":na(s),children:s},s))}),a.jsx(C$,{item:r})]})}function Tge(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=_$(),[o,h]=R.useState(null);if(i)return a.jsx("div",{className:"loading",children:r("common.loading")});if(n)return a.jsxs("div",{className:"error-state",children:[r("common.error")," ",s==null?void 0:s.message]});const l=(e==null?void 0:e.packs)??[],u=(e==null?void 0:e.standalone)??[];return a.jsxs("div",{className:"packs-page",children:[l.length===0&&u.length===0&&a.jsx("div",{className:"packs-empty",children:r("common.empty")}),l.length>0&&a.jsxs("section",{className:"packs-section",children:[a.jsx("h2",{className:"packs-section-title",children:r("packs.section.packs")}),a.jsx("div",{className:"packs-grid",children:l.map(d=>a.jsx(EB,{item:d,onClick:h},d.name))})]}),u.length>0&&a.jsxs("section",{className:"packs-section",children:[a.jsx("h2",{className:"packs-section-title",children:r("packs.section.standalone")}),a.jsx("div",{className:"packs-grid",children:u.map(d=>a.jsx(EB,{item:d,onClick:h},d.name))})]}),o!==null&&a.jsx(Sge,{item:o,onClose:()=>h(null)})]})}function Ege(){return a.jsxs("header",{className:"about-hero",children:[a.jsxs("div",{className:"about-hero-copy",children:[a.jsxs("a",{className:"about-lockup",href:"#top","aria-label":"dreamcontext",children:[a.jsx(ab,{size:34,className:"about-lockup-mark",glow:!0}),a.jsxs("span",{className:"about-lockup-word",children:["dream",a.jsx("span",{style:{color:"var(--color-accent)"},children:"context"})]})]}),a.jsxs("h1",{className:"about-title",children:["The persistent brain for",a.jsx("span",{className:"about-title-accent",children:" AI natives."})]}),a.jsxs("p",{className:"about-lead",children:["It remembers every decision you made, knows how your project is structured, and is learning to act on that knowledge — so every session starts ",a.jsx("em",{children:"ready"})," instead of blind. Built for founders and builders, technical or not."]}),a.jsxs("div",{className:"about-compat",children:[a.jsx("span",{className:"about-compat-mark","aria-hidden":"true",children:"✓"}),"Works with ",a.jsx("strong",{children:"Claude Code"})]}),a.jsxs("div",{className:"about-cta-row",children:[a.jsx("code",{className:"about-command",children:"npm i -g dreamcontext"}),a.jsx("a",{className:"about-link-btn",href:"https://www.npmjs.com/package/dreamcontext",target:"_blank",rel:"noreferrer",children:"npm ↗"}),a.jsx("a",{className:"about-link-btn about-link-btn--ghost",href:"https://github.com/meanllbrl/dreamcontext",target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),a.jsxs("div",{className:"about-hero-media",children:[a.jsx("div",{className:"about-hero-aura","aria-hidden":"true"}),a.jsxs("video",{className:"about-hero-video",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,poster:"/media/brain-hero.png",children:[a.jsx("source",{src:"/media/brain.webm",type:"video/webm"}),a.jsx("source",{src:"/media/brain.mp4",type:"video/mp4"})]})]})]})}function Nge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"The problem"}),a.jsx("h2",{className:"about-h2",children:"Your project is bigger than anyone can hold."}),a.jsxs("p",{className:"about-section-lead",children:["dreamcontext isn't a memory file. It builds a deep understanding of your whole project — the company, the codebase, even how you work — then ",a.jsx("em",{children:"surfaces what's hiding"}),": the scattered decisions, the forgotten reasons, the connections no one wrote down. Because it never forgets and sees the whole graph, the agent sometimes understands your project better than you do."]}),a.jsxs("div",{className:"about-contrast",children:[a.jsxs("div",{className:"about-contrast-card about-contrast-card--bad",children:[a.jsx("span",{className:"about-contrast-tag",children:"Without dreamcontext"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Decisions scatter across chats, commits, and your head"}),a.jsx("li",{children:`The "why" behind last month's choice is already gone`}),a.jsx("li",{children:"You re-explain the project from scratch every session"}),a.jsx("li",{children:"Blind to the connections between what you've decided"})]})]}),a.jsxs("div",{className:"about-contrast-card about-contrast-card--good",children:[a.jsx("span",{className:"about-contrast-tag",children:"With dreamcontext"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Deep understanding of the whole project, across every session"}),a.jsx("li",{children:"Surfaces the hidden links between scattered decisions"}),a.jsx("li",{children:"Holds the whole picture — company, code, and work-life context"}),a.jsx("li",{children:"Gets sharper every time it consolidates what changed"})]})]})]})]})}function hn(r,e,i,n){const s=(e+n)/2;return`M ${r} ${e} C ${r} ${s}, ${i} ${s}, ${i} ${n}`}const Uk=[{file:"soul",region:"Identity",glyph:"◆"},{file:"user",region:"Episodic",glyph:"◉"},{file:"memory",region:"Semantic",glyph:"✦"},{file:"knowledge",region:"Procedural",glyph:"⚙"},{file:"state",region:"Working",glyph:"▦"},{file:"data-structures",region:"Schema",glyph:"▤"},{file:"skills",region:"Capabilities",glyph:"✧"},{file:"sub-agents",region:"Workers",glyph:"⬡"}],Ol=600,hb=250,w$=92,pc=4,NB=(1200-pc*hb)/(pc+1),Wk=196,Age=320,jge=Age-Wk,Mge=120,k$=470,Lge=548,AB=632;function S$(r){return NB+r*(hb+NB)}function T$(r){return S$(r)+hb/2}function E$(r){return Wk+r*jge}const Bge=Uk.map((r,e)=>{const i=e%pc,n=Math.floor(e/pc);return{id:`cat-${r.file}`,x:S$(i),y:E$(n),w:hb,h:w$,title:r.file,sub:r.region,glyph:r.glyph,variant:"region",breathe:!0,breatheDelay:e*.18}}),Rge=Uk.slice(0,pc).map((r,e)=>({id:`fan-${e}`,d:hn(Ol,Mge,T$(e),Wk),travel:220,delay:e*.18,dur:2.6})),Oge=Uk.map((r,e)=>{const i=e%pc,n=Math.floor(e/pc);return{id:`conv-${r.file}`,d:hn(T$(i),E$(n)+w$,Ol,k$),travel:300,delay:.5+e*.12,dur:2.8}}),Dge={viewBox:"0 0 1200 780",ariaLabel:"How dreamcontext works: a SessionStart hook preloads eight context categories — identity, episodic, semantic, procedural, working, schema, capabilities and workers — with zero tool calls. The agent then works with the whole picture, and RemSleep parallel specialists consolidate the session and feed the distilled knowledge back into the context categories. The loop is the product.",nodes:[{id:"hook",x:Ol-215,y:40,w:430,h:80,title:"SessionStart hook fires",sub:"preloads context · 0 tool calls",variant:"hook"},...Bge,{id:"agent",x:Ol-250,y:k$,w:500,h:78,title:"Your agent works with the whole picture",sub:"no re-exploring · no blind search spiral",variant:"agent"},{id:"rem",x:Ol-200,y:AB,w:400,h:78,title:"RemSleep — parallel specialists",sub:"multi-agent consolidation",variant:"rem"}],edges:[...Rge,...Oge,{id:"agent-rem",d:`M ${Ol} ${Lge} L ${Ol} ${AB}`,travel:90,delay:1.6,dur:1.8},{id:"feedback",d:"M 800 671 C 1140 671, 1170 470, 1170 300 C 1170 170, 1110 170, 1010 170",dashed:!0,travel:520,delay:0,dur:4.2,label:{text:"consolidates & feeds back",x:1180,y:420,rotate:90}}]},Ks=550,ub=300,N$=116,jB=3,MB=(1100-jB*ub)/(jB+1),Gk=280,Ige=196,A$=470,Fge=540,LB=596;function j$(r){return MB+r*(ub+MB)}function M$(r){return j$(r)+ub/2}const Kk=[{id:"sleep-tasks",title:"sleep-tasks",sub:"state/*.md tasks"},{id:"sleep-state",title:"sleep-state",sub:"soul · user · memory · core 3-6 · data-structures · changelog · releases"},{id:"sleep-product",title:"sleep-product",sub:"knowledge/ + features/ · conditional"}],$ge=Kk.map((r,e)=>({id:r.id,x:j$(e),y:Gk,w:ub,h:N$,title:r.title,sub:r.sub,variant:"region",breathe:!0,breatheDelay:e*.25})),Pge=Kk.map((r,e)=>({id:`fan-${r.id}`,d:hn(Ks,Ige,M$(e),Gk),travel:200,delay:e*.3,dur:2.4})),zge=Kk.map((r,e)=>({id:`conv-${r.id}`,d:hn(M$(e),Gk+N$,Ks,A$),travel:200,delay:.9+e*.2,dur:2.4})),qge={viewBox:"0 0 1100 680",ariaLabel:"Sleep consolidation: sessions accumulate sleep debt; running sleep start fans out to three parallel specialists — sleep-tasks updates task files, sleep-state updates core files, changelog and releases, and sleep-product conditionally updates knowledge and feature docs. Their reports converge into updated system knowledge, then sleep done resets the debt.",nodes:[{id:"debt",x:Ks-230,y:36,w:460,h:76,title:"Sessions accumulate → sleep debt",sub:"Alert · Drowsy · Sleepy · Must Sleep",variant:"accent"},{id:"sleep-start",x:Ks-130,y:132,w:260,h:64,title:"sleep start",sub:"pins the epoch",variant:"hook"},...$ge,{id:"converge",x:Ks-220,y:A$,w:440,h:70,title:"system knowledge updated",sub:"reports stitched into one summary",variant:"agent"},{id:"sleep-done",x:Ks-130,y:LB,w:260,h:64,title:"sleep done",sub:"debt reset",variant:"rem"}],edges:[{id:"debt-start",d:`M ${Ks} 112 L ${Ks} 132`,travel:26,delay:0,dur:1.4},...Pge,...zge,{id:"converge-done",d:`M ${Ks} ${Fge} L ${Ks} ${LB}`,travel:64,delay:1.8,dur:1.8}]},EC=230,L$=230,BB=132,NC=[{id:"prompt",x:40,title:"Your prompt",sub:"any language",variant:"hook"},{id:"bm25",x:320,title:"BM25F keyword match",sub:"field-weighted · stemming · synonyms",variant:"region"},{id:"haiku",x:600,title:"Haiku recall",sub:"smallest cloud agent · 0-3 docs · BM25 fallback",variant:"region"},{id:"snapshot",x:880,title:"SessionStart snapshot",sub:"warm + cold knowledge · features · index · pinned",variant:"rem"}],Hge=NC.map(r=>({id:r.id,x:r.x,y:EC-BB/2,w:L$,h:BB,title:r.title,sub:r.sub,variant:r.variant})),Uge=NC.slice(0,-1).map((r,e)=>{const i=NC[e+1],n=r.x+L$,s=i.x;return{id:`pipe-${r.id}`,d:`M ${n} ${EC} L ${s} ${EC}`,travel:s-n,delay:e*.4,dur:2.2}}),Wge={viewBox:"0 0 1150 460",ariaLabel:"Memory recall pipeline: your prompt is matched by field-weighted BM25F keyword search with stemming and synonyms; a small Haiku cloud agent picks zero to three directly relevant docs (falling back to BM25 when unavailable); and the SessionStart snapshot assembles warm and cold knowledge, features, the index and pinned docs.",nodes:Hge,edges:Uge},Gge=[{n:"01",title:"It loads",body:"A SessionStart hook preloads the whole project picture — soul, user, memory, knowledge and state, plus data-structures, skills and sub-agents — before the agent makes a single tool call."},{n:"02",title:"It works",body:"With identity, history, procedures, schema and capabilities already in context, your agent works against the real project — no re-exploring, no blind search spiral, no re-teaching what it learned last time."},{n:"03",title:"It sleeps",body:"RemSleep is multi-agent: parallel specialists consolidate the session in their own domains and feed the distilled knowledge back into those context files — so the next session starts even sharper."}];function Kge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"How it works"}),a.jsx("h2",{className:"about-h2",children:"A brain that loads, works, and sleeps — across your whole system."}),a.jsxs("p",{className:"about-section-lead",children:["Three moves, repeated every session. A hook preloads the entire context set with"," ",a.jsx("em",{children:"zero tool calls"}),", your agent works with the whole picture, and a multi-agent RemSleep cycle consolidates what changed. The loop is the product."]}),a.jsx(Cc,{spec:Dge}),a.jsx("div",{className:"hiw2-steps",children:Gge.map(r=>a.jsxs("div",{className:"hiw2-step",children:[a.jsx("span",{className:"hiw2-step-n",children:r.n}),a.jsx("h3",{className:"hiw2-step-title",children:r.title}),a.jsx("p",{className:"hiw2-step-body",children:r.body})]},r.n))})]})}const Vge=[{level:"Alert",range:"0–3",note:"fresh — nothing to consolidate yet"},{level:"Drowsy",range:"4–6",note:"consolidation offered"},{level:"Sleepy",range:"7–9",note:"advisory note prepended"},{level:"Must Sleep",range:"10+",note:"critical directive prepended"}],Yge=[{name:"sleep-tasks",domain:"state/*.md — logs progress, bumps statuses, reconciles task bodies and workflow nodes.",always:!0},{name:"sleep-state",domain:"soul · user · memory · data-structures · CHANGELOG · RELEASES — surgical core-file updates with an anti-bloat sweep.",always:!0},{name:"sleep-product",domain:"knowledge/ (incl. features/ PRDs) — writes and refreshes knowledge files and feature PRDs.",always:!1}];function Xge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"How sleep works"}),a.jsx("h2",{className:"about-h2",children:"It sleeps to remember — like REM, but for your project."}),a.jsxs("p",{className:"about-section-lead",children:["Every session adds ",a.jsx("em",{children:"sleep debt"}),". When it builds up, one command fans out to parallel specialists that fold what changed back into the brain — then resets the meter."]}),a.jsx(Cc,{spec:qge}),a.jsxs("div",{className:"sleepf-cards",children:[a.jsxs("article",{className:"sleepf-card sleepf-card--debt",children:[a.jsx("h3",{className:"sleepf-card-title",children:"Debt accumulates across sessions"}),a.jsx("p",{className:"sleepf-card-body",children:"Each session scores by how much changed; the score adds to a running debt total that crosses graduated thresholds, so consolidation urgency is never ambiguous."}),a.jsx("ul",{className:"sleepf-debt",children:Vge.map(r=>a.jsxs("li",{className:"sleepf-debt-row",children:[a.jsx("span",{className:"sleepf-debt-level",children:r.level}),a.jsx("span",{className:"sleepf-debt-range",children:r.range}),a.jsx("span",{className:"sleepf-debt-note",children:r.note})]},r.level))})]}),a.jsxs("article",{className:"sleepf-card",children:[a.jsx("h3",{className:"sleepf-card-title",children:"Specialists run in parallel"}),a.jsxs("p",{className:"sleepf-card-body",children:[a.jsx("code",{className:"sleepf-cmd",children:"sleep start"})," pins the epoch, then the main agent dispatches the specialists together in a single message — each updating a distinct knowledge domain, never editing outside it."]}),a.jsx("ul",{className:"sleepf-specialists",children:Yge.map(r=>a.jsxs("li",{className:"sleepf-spec-row",children:[a.jsx("code",{className:"sleepf-spec-name",children:r.name}),a.jsx("span",{className:`sleepf-spec-badge${r.always?" sleepf-spec-badge--always":""}`,children:r.always?"always fires":"conditional"}),a.jsx("span",{className:"sleepf-spec-domain",children:r.domain})]},r.name))})]}),a.jsxs("article",{className:"sleepf-card sleepf-card--done",children:[a.jsxs("h3",{className:"sleepf-card-title",children:[a.jsx("code",{className:"sleepf-cmd",children:"sleep done"})," resets the debt"]}),a.jsxs("p",{className:"sleepf-card-body",children:["Their reports converge into one stitched summary of updated system knowledge. The main agent calls ",a.jsx("code",{className:"sleepf-cmd",children:"sleep done"}),", which records the consolidation and resets the debt to zero — ready for the next cycle."]})]})]})]})}const Zge=[{n:"01",tag:"Keyword match",title:"Field-weighted BM25F",body:"Your prompt is matched against the corpus — knowledge, features, tasks, memory and changelog — with field weighting, stemming and synonym expansion. It runs locally in under 100ms, with zero token overhead."},{n:"02",tag:"Intent recall",title:"The Haiku agent",body:"The smallest cloud agent reads your full prompt and a relevance-ranked corpus index, then returns only the 0–3 documents that are directly relevant — resolving intent across languages. If it is unavailable, the pipeline falls back to raw BM25."},{n:"03",tag:"Session start",title:"The snapshot assembles",body:"At SessionStart a hook composes the knowledge distribution — warm and cold knowledge, the features summary, the knowledge index, and pinned docs — and hands it to the agent so it begins each session already oriented."}];function Qge(){return a.jsxs("section",{className:"about-section",children:[a.jsx("p",{className:"about-kicker",children:"How the system remembers"}),a.jsx("h2",{className:"about-h2",children:"The right memory, surfaced before you ask."}),a.jsxs("p",{className:"about-section-lead",children:["Remembering is a read pipeline. Three stages take a prompt — or a fresh session — and put exactly the relevant context in front of the agent, so it works on what you actually meant. It ",a.jsx("em",{children:"augments"})," the agent's reach; you stay in the driver's seat."]}),a.jsx(Cc,{spec:Wge}),a.jsx("div",{className:"recallf-stages",children:Zge.map(r=>a.jsxs("article",{className:"recallf-stage",children:[a.jsxs("div",{className:"recallf-stage-head",children:[a.jsx("span",{className:"recallf-stage-n",children:r.n}),a.jsx("span",{className:"recallf-stage-tag",children:r.tag})]}),a.jsx("h3",{className:"recallf-stage-title",children:r.title}),a.jsx("p",{className:"recallf-stage-body",children:r.body})]},r.n))})]})}const RB=[{file:"0.soul",glyph:"◆",region:"Identity",brain:"sense of self",desc:"Who it is — purpose, principles, and the rules it must never break."},{file:"1.user",glyph:"◉",region:"Episodic",brain:"lived history",desc:"What you did and decided, session over session."},{file:"2.memory",glyph:"✦",region:"Semantic",brain:"durable facts",desc:"What's true about the project — facts that hold across every session."},{file:"data-structures/",glyph:"▤",region:"Schema",brain:"mental models",desc:"The shapes of your data — the structures everything else is built on."},{file:"knowledge/",glyph:"⚙",region:"Procedural",brain:"learned skill",desc:"How to do things here — patterns, recipes, and hard-won know-how.",rides:{label:"skills",desc:"capabilities it can pick up and apply"}},{file:"state/",glyph:"▦",region:"Working",brain:"in attention",desc:"What's in flight right now — tasks, features, and the sleep cycle.",rides:{label:"sub-agents",desc:"workers it directs under your steer"}}];function Jge(){return a.jsxs("section",{className:"about-section arch","aria-labelledby":"arch-heading",children:[a.jsx("p",{className:"about-kicker",children:"The architecture"}),a.jsx("h2",{className:"about-h2",id:"arch-heading",children:"Memory, organized like a mind."}),a.jsx("p",{className:"about-section-lead",children:"Knowledge isn't one flat file. It's laid down in strata — each a purpose-built region that mirrors a part of the brain — so the agent reaches for the right kind of memory at the right moment."}),a.jsxs("div",{className:"arch-stage",role:"img","aria-label":"A cross-section of the project's memory, stacked as layered brain regions.",children:[a.jsx("div",{className:"arch-glow","aria-hidden":"true"}),a.jsx("ol",{className:"arch-stack",children:RB.map((r,e)=>a.jsxs("li",{className:"arch-stratum",style:{"--i":e,"--n":RB.length},children:[a.jsx("div",{className:"arch-edge","aria-hidden":"true"}),a.jsxs("div",{className:"arch-face",children:[a.jsx("span",{className:"arch-glyph","aria-hidden":"true",children:r.glyph}),a.jsxs("div",{className:"arch-meta",children:[a.jsxs("div",{className:"arch-meta-top",children:[a.jsx("code",{className:"arch-file",children:r.file}),a.jsx("span",{className:"arch-region",children:r.region}),a.jsx("span",{className:"arch-brain",children:r.brain})]}),a.jsx("p",{className:"arch-desc",children:r.desc})]}),r.rides?a.jsxs("div",{className:"arch-rides",children:[a.jsx("span",{className:"arch-rides-plus","aria-hidden":"true",children:"+"}),a.jsx("span",{className:"arch-rides-label",children:r.rides.label}),a.jsx("span",{className:"arch-rides-desc",children:r.rides.desc})]}):null]})]},r.file))})]}),a.jsxs("p",{className:"arch-foot",children:["Six strata, one mind — read top-down, the agent goes from"," ",a.jsx("em",{children:"who it is"})," to ",a.jsx("em",{children:"what it's doing right now"}),"."]})]})}function eme(r){return"base"in r}function OB({item:r}){const e=eme(r)?"pack":"standalone",i=e==="pack"?"pack":r.tags[0]??"standalone";return a.jsxs("li",{className:"marquee-card",children:[a.jsx("span",{className:`marquee-chip marquee-chip--${e}`,children:i}),a.jsx("span",{className:"marquee-card-name",children:r.name}),r.description&&a.jsx("p",{className:"marquee-card-desc",children:r.description})]})}function tme(){const{data:r,isLoading:e,isError:i}=_$(),n=R.useMemo(()=>r?[...r.packs,...r.standalone]:[],[r]),s=Math.min(60,Math.max(40,n.length*2.2)),o=a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"about-kicker",children:"Skill packs"}),a.jsx("h2",{className:"about-h2",children:"A growing library of expertise."}),a.jsx("p",{className:"about-section-lead",children:"The agent loads the right pack for the task — and more are added all the time."})]});return e?a.jsxs("section",{className:"about-section",children:[o,a.jsx("div",{className:"marquee-viewport marquee-viewport--static","aria-hidden":"true",children:a.jsx("ul",{className:"marquee-track marquee-track--skeleton",children:Array.from({length:6}).map((h,l)=>a.jsx("li",{className:"marquee-card marquee-card--skeleton"},l))})}),a.jsx("p",{className:"marquee-status",children:"Loading packs…"})]}):i||n.length===0?a.jsx("section",{className:"about-section",children:o}):a.jsxs("section",{className:"about-section",children:[o,a.jsxs("div",{className:"marquee-viewport",style:{"--marquee-duration":`${s}s`},children:[a.jsx("ul",{className:"marquee-track",children:n.map(h=>a.jsx(OB,{item:h},`a-${h.name}`))}),a.jsx("ul",{className:"marquee-track marquee-track--dup","aria-hidden":"true",children:n.map(h=>a.jsx(OB,{item:h},`b-${h.name}`))})]})]})}const al="0 0 360 170";function B$(r,e,i){return{viewBox:al,ariaLabel:r,nodes:[{id:"a",x:20,y:50,w:140,h:70,title:e.title,sub:e.sub,variant:e.variant??"hook"},{id:"b",x:200,y:50,w:140,h:70,title:i.title,sub:i.sub,variant:i.variant??"rem"}],edges:[{id:"a-b",d:"M 160 85 L 200 85",travel:40,dur:2}]}}const rme={viewBox:al,ariaLabel:"Context snapshot: a SessionStart hook injects the soul, memory, active tasks and knowledge index straight into the agent with zero tool calls.",nodes:[{id:"hook",x:110,y:12,w:140,h:50,title:"SessionStart",sub:"0 tool calls",variant:"hook"},{id:"brain",x:16,y:100,w:150,h:56,title:"project brain",sub:"soul · memory · tasks",variant:"region",breathe:!0},{id:"agent",x:194,y:100,w:150,h:56,title:"your agent",sub:"oriented",variant:"agent"}],edges:[{id:"h-b",d:hn(180,62,91,100),travel:80,dur:2.2},{id:"b-a",d:"M 166 128 L 194 128",travel:28,dur:1.6,delay:.5}]},ime={viewBox:al,ariaLabel:"Memory recall: a question is scored by BM25 keyword match, optionally refined by a small Haiku agent, returning the most relevant docs in under 100 milliseconds.",nodes:[{id:"q",x:14,y:52,w:96,h:66,title:"question",sub:"any language",variant:"hook"},{id:"bm25",x:132,y:52,w:96,h:66,title:"BM25",sub:"+ Haiku",variant:"region",breathe:!0},{id:"docs",x:250,y:52,w:96,h:66,title:"top docs",sub:"<100ms",variant:"rem"}],edges:[{id:"q-b",d:"M 110 85 L 132 85",travel:22,dur:1.6},{id:"b-d",d:"M 228 85 L 250 85",travel:22,dur:1.6,delay:.4}]},nme={viewBox:al,ariaLabel:"RemSleep: accumulated sleep debt triggers a fan-out to three parallel specialists that consolidate the session and reset the meter.",nodes:[{id:"debt",x:108,y:10,w:144,h:46,title:"sleep debt",sub:"crosses threshold",variant:"accent"},{id:"s1",x:14,y:92,w:100,h:50,title:"sleep-tasks",variant:"region",breathe:!0},{id:"s2",x:130,y:92,w:100,h:50,title:"sleep-state",variant:"region",breathe:!0,breatheDelay:.2},{id:"s3",x:246,y:92,w:100,h:50,title:"sleep-product",variant:"region",breathe:!0,breatheDelay:.4}],edges:[{id:"d-1",d:hn(180,56,64,92),travel:90,dur:2.2},{id:"d-2",d:"M 180 56 L 180 92",travel:36,dur:1.8,delay:.2},{id:"d-3",d:hn(180,56,296,92),travel:90,dur:2.2,delay:.4}]},sme={viewBox:al,ariaLabel:"Brain-region core files: soul, user, memory and the knowledge index sit in a numbered band the snapshot always loads.",nodes:[{id:"soul",x:14,y:24,w:158,h:54,title:"0.soul",sub:"identity · rules",variant:"region",breathe:!0},{id:"mem",x:188,y:24,w:158,h:54,title:"2.memory",sub:"decisions · issues",variant:"region",breathe:!0,breatheDelay:.2},{id:"user",x:14,y:96,w:158,h:54,title:"1.user",sub:"preferences",variant:"region",breathe:!0,breatheDelay:.4},{id:"know",x:188,y:96,w:158,h:54,title:"knowledge",sub:"index · pinned",variant:"region",breathe:!0,breatheDelay:.6}],edges:[]},ame={viewBox:al,ariaLabel:"Tag-based relation graph: knowledge, features and tasks link through shared tags into a navigable brain view.",nodes:[{id:"tag",x:110,y:58,w:140,h:54,title:"shared tag",sub:"the edge",variant:"accent",breathe:!0},{id:"k",x:14,y:10,w:110,h:44,title:"knowledge",variant:"region"},{id:"f",x:236,y:10,w:110,h:44,title:"features",variant:"region"},{id:"t",x:125,y:122,w:110,h:40,title:"tasks",variant:"region"}],edges:[{id:"k-tag",d:hn(69,54,150,58),travel:90,dur:2.4},{id:"f-tag",d:hn(291,54,210,58),travel:90,dur:2.4,delay:.4},{id:"t-tag",d:"M 180 122 L 180 112",travel:12,dur:1.6,delay:.8}]},ome={viewBox:al,ariaLabel:"Task management: each task carries a LIFO changelog viewable as a Kanban board, an Eisenhower matrix, or RICE-scored.",nodes:[{id:"task",x:16,y:50,w:130,h:70,title:"task .md",sub:"LIFO changelog",variant:"hook"},{id:"views",x:200,y:24,w:144,h:44,title:"Kanban",variant:"region",breathe:!0},{id:"eis",x:200,y:74,w:144,h:40,title:"Eisenhower",variant:"region",breathe:!0,breatheDelay:.2},{id:"rice",x:200,y:120,w:144,h:40,title:"RICE score",variant:"region",breathe:!0,breatheDelay:.4}],edges:[{id:"t-k",d:hn(146,85,272,46),travel:90,dur:2.2},{id:"t-e",d:"M 146 85 L 200 94",travel:56,dur:2,delay:.3},{id:"t-r",d:hn(146,85,272,140),travel:90,dur:2.2,delay:.6}]},lme={viewBox:al,ariaLabel:"Sub-agents: the main agent fans work out to briefed specialist sub-agents that report back, keeping the main context small.",nodes:[{id:"main",x:110,y:12,w:140,h:46,title:"main agent",variant:"agent"},{id:"a",x:16,y:96,w:96,h:50,title:"reviewer",variant:"region",breathe:!0},{id:"b",x:132,y:96,w:96,h:50,title:"planner",variant:"region",breathe:!0,breatheDelay:.2},{id:"c",x:248,y:96,w:96,h:50,title:"researcher",variant:"region",breathe:!0,breatheDelay:.4}],edges:[{id:"m-a",d:hn(180,58,64,96),travel:90,dur:2.2},{id:"m-b",d:"M 180 58 L 180 96",travel:38,dur:1.8,delay:.2},{id:"m-c",d:hn(180,58,296,96),travel:90,dur:2.2,delay:.4}]},cme={viewBox:"0 0 400 232",ariaLabel:"Council: three persona sub-agents debate each other in a cycle — each sees the others’ reasoning, round after round — then the debate converges into a synthesizer that writes one decision report.",nodes:[{id:"p1",x:70,y:14,w:96,h:46,title:"persona",sub:"lens A",variant:"region",breathe:!0},{id:"p2",x:18,y:118,w:96,h:46,title:"persona",sub:"lens B",variant:"region",breathe:!0,breatheDelay:.25},{id:"p3",x:130,y:118,w:96,h:46,title:"persona",sub:"lens C",variant:"region",breathe:!0,breatheDelay:.5},{id:"syn",x:286,y:70,w:104,h:72,title:"synthesizer",sub:"decision report",variant:"rem"}],edges:[{id:"p1-p2",d:"M 96 60 L 80 118",travel:60,dur:1.8},{id:"p2-p3",d:"M 114 141 L 130 141",travel:16,dur:1.1,delay:.3,label:{text:"↻ rounds",x:118,y:95}},{id:"p3-p1",d:"M 178 118 L 152 60",travel:60,dur:1.8,delay:.6},{id:"p1-syn",d:hn(166,40,286,96),travel:130,dur:2.4,delay:.4},{id:"p3-syn",d:hn(226,136,286,116),travel:76,dur:2.2,delay:.9}]},hme={viewBox:"0 0 1000 330",ariaLabel:"Goal-skill orchestration: a goal-planner drafts a file-by-file plan; parallel reviewers vote SOLID or NEEDS_WORK and loop back to the planner until solid; the plan is persisted as a task; a goal-implementer builds to the acceptance criteria; a code reviewer and then a goal-validator each gate the result, looping back to the implementer on FAIL; every gate is capped at three retries before escalating to the user, after which the work ships as a task in review.",nodes:[{id:"plan",x:20,y:40,w:140,h:86,title:"planner",sub:"file-by-file plan",variant:"agent"},{id:"plan-review",x:184,y:40,w:140,h:86,title:"plan review",sub:"SOLID · NEEDS_WORK",variant:"region",breathe:!0},{id:"impl",x:348,y:40,w:140,h:86,title:"implementer",sub:"builds to criteria",variant:"agent"},{id:"code-review",x:512,y:40,w:140,h:86,title:"code review",sub:"PASS · FAIL",variant:"region",breathe:!0,breatheDelay:.2},{id:"validate",x:676,y:40,w:140,h:86,title:"validator",sub:"tests · PASS · FAIL",variant:"region",breathe:!0,breatheDelay:.4},{id:"done",x:840,y:40,w:140,h:86,title:"shipped",sub:"task → in_review",variant:"rem"}],edges:[{id:"f1",d:"M 160 83 L 184 83",dur:2},{id:"f2",d:"M 324 83 L 348 83",dur:2,delay:.2},{id:"f3",d:"M 488 83 L 512 83",dur:2,delay:.1},{id:"f4",d:"M 652 83 L 676 83",dur:2,delay:.2},{id:"f5",d:"M 816 83 L 840 83",dur:2,delay:.3},{id:"l1",d:"M 254 126 C 254 196, 90 196, 90 126",dashed:!0,dur:3.2,delay:.5,label:{text:"↻ ≤3",x:172,y:186}},{id:"l2",d:"M 582 126 C 582 196, 418 196, 418 126",dashed:!0,dur:3.2,delay:.7,label:{text:"↻ ≤3",x:500,y:186}},{id:"l3",d:"M 746 126 C 746 262, 418 262, 418 126",dashed:!0,dur:3.6,delay:.9,label:{text:"↻ ≤3",x:582,y:252}}]},ume=B$("Skill packs: curated domain packs install a base skill plus on-demand sub-skills into the agent.",{title:"skill pack",sub:"engineering · design · growth",variant:"hook"},{title:"agent gains",sub:"base + sub-skills",variant:"rem"}),dme=B$("Knowledge base: tagged knowledge files are indexed every session; pinned files load warm, the rest load cold on demand.",{title:"knowledge/*.md",sub:"tagged · indexed",variant:"region"},{title:"snapshot",sub:"warm + cold",variant:"rem"}),R$=[{id:"context-snapshot",title:"Context snapshot",tagline:"Every session starts with the whole brain, zero tool calls.",body:"A SessionStart hook injects your project identity, user preferences, memory, active tasks and the knowledge index straight into the agent — so it orients instantly instead of grepping around blind.",defaultOpen:!0,tag:"Memory",flow:rme},{id:"memory-recall",title:"Memory recall",tagline:'Ask "where did we decide X?" and get an answer in under 100ms.',body:"A deterministic BM25 search ranks every knowledge file, PRD, task, memory entry and changelog line — optionally sharpened by a small Haiku agent — so the right context surfaces without scrolling or grepping. Handles English, Turkish and mixed queries.",defaultOpen:!0,tag:"Memory",flow:ime},{id:"rem-sleep",title:"RemSleep consolidation",tagline:"It sleeps to remember — multi-agent consolidation, like REM.",body:"Sessions accumulate sleep debt; when it builds up, one command fans out to three parallel specialists that fold what changed back into the brain, then resets the meter. Knowledge compounds instead of decaying.",defaultOpen:!0,tag:"Sleep",flow:nme},{id:"brain-regions",title:"Brain-region core files",tagline:"A numbered band of core files — soul, user, memory, knowledge.",body:"The brain is a handful of small, always-loaded files: identity and rules, user preferences, durable memory, and the knowledge index. Kept lightweight on purpose so the snapshot stays under budget every session.",defaultOpen:!0,tag:"Memory",flow:sme},{id:"knowledge-base",title:"Knowledge base",tagline:"Tagged research that loads warm when pinned, cold on demand.",body:"Deep research and domain context live in tagged knowledge files the snapshot indexes every session. Pin the critical ones to load them in full; the rest stay one read away when an agent needs them.",defaultOpen:!0,tag:"Knowledge",flow:dme},{id:"brain-graph",title:"Relation graph (Brain view)",tagline:"Knowledge, features and tasks linked through shared tags.",body:"A tag-based graph connects every knowledge file, feature and task into one navigable Brain view — so you can see how the parts of a project relate instead of reading them one file at a time.",defaultOpen:!0,tag:"Knowledge",flow:ame},{id:"task-management",title:"Task management",tagline:"LIFO changelogs, viewable as Kanban, Eisenhower or RICE.",body:"Each task is a Markdown file with a LIFO changelog, so any session reads where the last one left off. View the backlog as a Kanban board, triage it on an Eisenhower matrix, or rank it numerically with RICE — Reach × Impact × Confidence ÷ Effort.",defaultOpen:!0,tag:"Tasks",flow:ome},{id:"skill-packs",title:"Skill packs",tagline:"Curated, installable skills by domain — one command.",body:"Extend an agent with domain packs — engineering, design, growth, brand-voice and more — each a base skill plus on-demand sub-skills. Install interactively or name a pack directly; prerequisites resolve automatically.",defaultOpen:!0,tag:"Skills",flow:ume},{id:"sub-agents",title:"Sub-agents",tagline:"Fan work out to briefed specialists; keep the main context lean.",body:"The main agent dispatches focused sub-agents — reviewers, planners, researchers — each launched with a lightweight context briefing so it knows the project structure without any tool calls. They report back; the main thread stays small.",defaultOpen:!0,tag:"Agents",flow:lme},{id:"council",title:"Council",tagline:"Persona sub-agents debate a hard call, a synthesizer decides.",body:"For a non-trivial decision, Council spins up 3–10 persona sub-agents that debate across rounds, see each other's reasoning, then hand off to a dedicated synthesizer that writes one decision report — promotable straight into knowledge.",defaultOpen:!0,tag:"Agents",flow:cme},{id:"goal-skill",title:"Goal-skill orchestration",tagline:"Plan it, review it, build it, review it, validate it — on a leash.",body:"Turn the main agent into an orchestrator. A goal-planner drafts a file-by-file plan; parallel reviewers vote SOLID or NEEDS_WORK and bounce it back until it holds; the plan is persisted as a task; a goal-implementer builds to the acceptance criteria; then a code reviewer and a goal-validator each gate the result, looping back to the implementer on a fail. Every gate is capped at three retries and escalates to you instead of spinning.",defaultOpen:!0,tag:"Agents",flow:hme},{id:"bookmarking",title:"Bookmarking (salience)",tagline:"High-signal moments tagged so sleep can find them later.",body:"Corrections, error-to-fix turns and decisions are auto-bookmarked during a session, marking the moments worth keeping — so consolidation folds the right learnings into the brain without manual flagging.",defaultOpen:!1,tag:"Memory",glyph:"◈"},{id:"warm-cold-knowledge",title:"Warm vs cold knowledge",tagline:"Pinned files load in full; the rest stay one read away.",body:"Pinned (warm) knowledge is inlined into every snapshot; unpinned (cold) knowledge appears only in the index and loads on demand. The split keeps the always-on context small while nothing gets lost.",defaultOpen:!1,tag:"Knowledge",glyph:"❄"},{id:"feature-prds",title:"Feature PRDs",tagline:"Living docs that capture not just what was built, but why.",body:"Each feature has a PRD with user stories, acceptance criteria and design decisions that update as work progresses — so an agent understands the product surface without reconstructing it from conversation history.",defaultOpen:!1,tag:"Knowledge",glyph:"▤"},{id:"versions-releases",title:"Versions & releases",tagline:"Changelog and release readiness tracked in the brain.",body:"A structured changelog and release notes live alongside the context, so version history and release readiness are part of the brain the agent reads — not an afterthought scattered across commits.",defaultOpen:!1,tag:"Knowledge",glyph:"⎇"},{id:"multi-vault",title:"Multi-vault registry",tagline:"Switch between project brains from one global registry.",body:"A global vault registry tracks every project brain on your machine. List, add and remove vaults, then point the dashboard at any one — so multiple projects each keep their own clean context.",defaultOpen:!1,tag:"Setup",glyph:"▦"},{id:"multi-product",title:"Multi-product support",tagline:"Per-product knowledge auto-injected from the active task.",body:"Monorepos and portfolios get a product namespace: per-product knowledge and data structures, plus automatic injection of the right product's knowledge at session start when the active task carries a product tag.",defaultOpen:!1,tag:"Knowledge",glyph:"◫"},{id:"manifest-install",title:"Manifest install & update",tagline:"Clean upgrades — stale files tracked and removed, not layered.",body:"A manifest tracks every file dreamcontext owns, so updates remove what a new version drops instead of leaving stale agents and configs behind. Includes a one-line install script and an in-session update nudge.",defaultOpen:!1,tag:"Setup",glyph:"⟳"},{id:"project-init",title:"Project initialization",tagline:"Blank repo to agent-aware workspace in under a minute.",body:"One init command scaffolds the whole context directory, detects your tech stack, runs token substitution on the templates, and wires up the Claude Code hooks — no manual setup.",defaultOpen:!1,tag:"Setup",glyph:"⊕"},{id:"control-panel",title:"Control panel",tagline:"Configure platforms, packs and vaults in the browser.",body:"The dashboard control panel closes the loop on configuration — edit platforms and skill packs, see which packs are actually installed on disk, manage vaults, and get notified in-app when a newer version ships.",defaultOpen:!1,tag:"Setup",glyph:"⚙"},{id:"multi-review",title:"Multi-review",tagline:"Route a diff to niche reviewers, get one merged report.",body:"A router classifies a diff by domain and dispatches specialist reviewers — security, frontend, cloud functions, edge cases — in parallel; a coordinator dedupes their findings into a single report. Each specialist reviews against your live project rules.",defaultOpen:!1,tag:"Agents",glyph:"⊜"},{id:"continuous-capture",title:"Continuous capture",tagline:"Session digests and auto-bookmarks, searchable next session.",body:"Transcripts are digested and indexed as you work, so a decision from one session is searchable in the next — before any sleep consolidation runs. Capture is down-weighted so it never crowds out curated knowledge.",defaultOpen:!1,tag:"Memory",glyph:"◌"},{id:"context-gate",title:"Context gate",tagline:"Nudges the agent to load relevant skills before it acts.",body:"A prompt-time hook detects when an installed skill is plausibly relevant and injects a directive to review the full skill list and invoke what fits — deliberately not a pre-selected top-N, so the right skill is never anchored out.",defaultOpen:!1,tag:"Skills",glyph:"⊳"},{id:"auto-dashboard",title:"Auto-open dashboard hook",tagline:"The dashboard surfaces itself when it is worth a look.",body:"A hook can open the dashboard at the right moment so the visual view of tasks, knowledge and the brain is one glance away — without you remembering to launch it.",defaultOpen:!1,tag:"Setup",glyph:"◰"},{id:"post-edit-hook",title:"Post-edit format & typecheck",tagline:"Format and typecheck fire automatically after an edit.",body:"A post-edit hook runs your formatter and type checker right after the agent changes a file, so problems surface immediately instead of piling up — keeping the working tree clean as work proceeds.",defaultOpen:!1,tag:"Setup",glyph:"✓"},{id:"marketing-pack",title:"Marketing pack",tagline:"Brand-voice and growth skills for going to market.",body:"A bundled set of go-to-market skills — brand voice, growth, performance marketing — so the same agent that builds a feature can help position and launch it, on-brand.",defaultOpen:!1,tag:"Skills",glyph:"✦"}],AC=R$.filter(r=>r.defaultOpen),DB=R$.filter(r=>!r.defaultOpen),ns=AC.length,C_=16,fme=62,pme=.72,gme=40,mme=140,yme=8;function bme(){const[r,e]=R.useState(0),i=R.useId(),n=R.useRef([]),s=R.useRef([]),o=R.useRef([]),h=R.useRef(null),l=R.useRef(null),u=R.useRef(null),d=R.useRef(!1),g=R.useRef(0),p=v=>`${i}-tab-${v}`,m=v=>`${i}-panel-${v}`,y=R.useCallback(v=>{const x=Math.max(0,Math.min(ns-1,v));x!==g.current&&(g.current=x,e(x))},[]);R.useLayoutEffect(()=>{const v=h.current,x=l.current;if(!v||!x)return;d.current=window.matchMedia("(prefers-reduced-motion: reduce)").matches;const C=v.closest(".shell-main")??null,k=C??window;let T=0;const N=()=>{T=0;const L=v.getBoundingClientRect(),O=C?C.getBoundingClientRect().top:0,D=L.height-x.offsetHeight;if(D<=0)return;const G=Math.max(0,Math.min(1,(O+C_-L.top)/D));u.current&&(u.current.style.transform=`scaleX(${G})`);const q=G*(ns-1);for(let U=0;U<ns;U++){const $=s.current[U];if(!$)continue;const F=U-q,W=Math.abs(F);$.style.opacity=String(Math.max(0,1-W/pme)),$.style.transform=d.current?"none":`translate3d(0, ${F*gme}px, 0)`;const Y=W<.5;$.style.zIndex=Y?"2":"1",$.style.pointerEvents=Y?"auto":"none";const P=W<1.05;o.current[U]!==P&&(o.current[U]=P,$.classList.toggle("feat-panel--near",P))}y(Math.round(q))};let j=0;const A=()=>{if(!C)return;const L=v.getBoundingClientRect(),O=L.height-x.offsetHeight;if(O<=0)return;const D=(C.getBoundingClientRect().top+C_-L.top)/O;if(D<=.012||D>=.988)return;const q=(Math.round(D*(ns-1))/(ns-1)-D)*O;Math.abs(q)<yme||C.scrollTo({top:C.scrollTop+q,behavior:d.current?"auto":"smooth"})},E=()=>{T||(T=requestAnimationFrame(N)),j&&clearTimeout(j),j=window.setTimeout(A,mme)};return k.addEventListener("scroll",E,{passive:!0}),window.addEventListener("resize",E),N(),()=>{k.removeEventListener("scroll",E),window.removeEventListener("resize",E),T&&cancelAnimationFrame(T),j&&clearTimeout(j)}},[y]);const w=R.useCallback(v=>{const x=h.current,C=l.current,k=x==null?void 0:x.closest(".shell-main");if(!x||!C||!k){y(v);return}const T=x.getBoundingClientRect(),N=T.height-C.offsetHeight;if(N<=0){y(v);return}const A=v/(ns-1)*N-(k.getBoundingClientRect().top+C_-T.top);k.scrollTo({top:k.scrollTop+A,behavior:d.current?"auto":"smooth"})},[y]);function _(v){var C;let x=g.current;if(v.key==="ArrowDown"||v.key==="ArrowRight")x=(g.current+1)%ns;else if(v.key==="ArrowUp"||v.key==="ArrowLeft")x=(g.current-1+ns)%ns;else if(v.key==="Home")x=0;else if(v.key==="End")x=ns-1;else return;v.preventDefault(),y(x),(C=n.current[x])==null||C.focus(),w(x)}return a.jsxs("section",{className:"about-section feat-section",children:[a.jsx("div",{className:"feat-scroller",ref:h,style:{"--feat-track-h":`${ns*fme}vh`},children:a.jsxs("div",{className:"feat-sticky",ref:l,children:[a.jsx("p",{className:"about-kicker",children:"Everything inside"}),a.jsx("h2",{className:"about-h2",children:"One brain, many faculties."}),a.jsxs("p",{className:"about-section-lead",children:["Every capability dreamcontext gives your agents — ",a.jsx("em",{children:"scroll to move through them, or pick one."})]}),a.jsxs("div",{className:"feat-spotlight",children:[a.jsxs("div",{className:"feat-rail-wrap",children:[a.jsxs("div",{className:"feat-rail-head","aria-hidden":"true",children:[a.jsxs("span",{className:"feat-rail-step",children:[String(r+1).padStart(2,"0")," ",a.jsxs("i",{children:["/ ",String(ns).padStart(2,"0")]})]}),a.jsx("div",{className:"feat-rail-track",children:a.jsx("span",{className:"feat-rail-fill",ref:u})})]}),a.jsx("div",{className:"feat-rail",role:"tablist","aria-orientation":"vertical","aria-label":"Core faculties",onKeyDown:_,children:AC.map((v,x)=>{const C=x===r;return a.jsxs("button",{ref:k=>{n.current[x]=k},id:p(x),role:"tab",type:"button","aria-selected":C,"aria-controls":m(x),tabIndex:C?0:-1,className:`feat-rail-item${C?" feat-rail-item--active":""}`,onClick:()=>{y(x),w(x)},children:[a.jsx("span",{className:"feat-rail-title",children:v.title}),v.tag&&a.jsx("span",{className:"feat-rail-tag",children:v.tag})]},v.id)})})]}),a.jsx("div",{className:"feat-stage",children:AC.map((v,x)=>a.jsxs("div",{ref:C=>{s.current[x]=C},className:"feat-panel",role:"tabpanel",id:m(x),"aria-labelledby":p(x),"aria-hidden":x!==r,tabIndex:x===r?0:-1,children:[a.jsxs("div",{className:"feat-stage-head",children:[v.tag&&a.jsx("span",{className:"feat-stage-chip",children:v.tag}),a.jsx("h3",{className:"feat-stage-title",children:v.title})]}),a.jsx("p",{className:"feat-stage-body",children:v.body}),v.flow&&a.jsx(Cc,{spec:v.flow,className:"feat-stage-flow"})]},v.id))})]})]})}),a.jsxs("div",{className:"feat-more",children:[a.jsxs("div",{className:"feat-more-head",children:[a.jsx("span",{className:"feat-more-label",children:"Everything else"}),a.jsx("span",{className:"feat-more-count",children:DB.length})]}),a.jsx("div",{className:"feat-more-grid",children:DB.map(v=>a.jsxs("div",{className:"feat-more-card",children:[a.jsx("span",{className:"feat-more-glyph","aria-hidden":"true",children:v.glyph??"✦"}),a.jsxs("div",{className:"feat-more-meta",children:[a.jsx("span",{className:"feat-more-title",children:v.title}),a.jsx("span",{className:"feat-more-tagline",children:v.tagline})]})]},v.id))})]})]})}const vme=[{cmd:"dreamcontext init",hint:"# set up the brain"},{cmd:"dreamcontext dashboard",hint:"# open this dashboard"},{cmd:"dreamcontext sleep",hint:"# consolidate the session"}];function xme(){return a.jsxs("section",{className:"closing","aria-labelledby":"closing-heading",children:[a.jsx("h2",{className:"closing-title",id:"closing-heading",children:"So — what is this?"}),a.jsxs("p",{className:"closing-body",children:[a.jsx("strong",{children:"dreamcontext"})," is a small CLI that gives your AI coding agents a structured, persistent brain across sessions. It pre-loads what matters, keeps a living map of your project, and consolidates new knowledge as you go — so you stop paying, every single session, to re-teach the agent what it already learned."]}),a.jsx("div",{className:"closing-cmds",role:"list",children:vme.map(r=>a.jsxs("div",{className:"closing-cmd",role:"listitem",children:[a.jsx("span",{className:"closing-cmd-c","aria-hidden":"true",children:"$"}),a.jsx("span",{className:"closing-cmd-text",children:r.cmd}),a.jsx("span",{className:"closing-cmd-hint",children:r.hint})]},r.cmd))}),a.jsx("p",{className:"closing-foot",children:"You're looking at the dashboard now. The brain graph, tasks, and sleep state in the sidebar are this project's actual memory — live."})]})}function _me(){return a.jsxs("div",{className:"about","data-testid":"about-page",children:[a.jsx(Ege,{}),a.jsx(Nge,{}),a.jsx(Kge,{}),a.jsx(Xge,{}),a.jsx(Qge,{}),a.jsx(Jge,{}),a.jsx(tme,{}),a.jsx(bme,{}),a.jsx(xme,{})]})}function Cme(){return Zt({queryKey:["taxonomy"],queryFn:()=>ze.get("/taxonomy")})}const wme={domain:"Domain",layer:"Layer",kind:"Kind",topic:"Topic"};function IB({tag:r,count:e,dimmed:i}){return a.jsxs("span",{className:`taxonomy-chip${i?" taxonomy-chip--dim":""}`,"data-hue":na(r),title:e>0?`${e} use${e===1?"":"s"}`:"unused",children:[a.jsx("span",{className:"taxonomy-chip-label",children:r}),e>0&&a.jsx("span",{className:"taxonomy-chip-count",children:e})]})}function em({label:r,count:e,children:i,defaultOpen:n=!1}){const[s,o]=R.useState(n);return e===0?null:a.jsxs("div",{className:"taxonomy-expandable",children:[a.jsxs("button",{className:"taxonomy-expandable-header",onClick:()=>o(h=>!h),"aria-expanded":s,children:[a.jsx("span",{className:"taxonomy-expandable-chevron",children:s?"▾":"▸"}),a.jsx("span",{className:"taxonomy-expandable-label",children:r}),a.jsx("span",{className:"taxonomy-expandable-badge",children:e})]}),s&&a.jsx("div",{className:"taxonomy-expandable-body",children:i})]})}function kme(){const{t:r}=Fr(),{data:e,isLoading:i,isError:n,error:s}=Cme();if(i)return a.jsx("div",{className:"loading",children:r("common.loading")});if(n)return a.jsxs("div",{className:"error-state",children:["Failed to load taxonomy. ",s==null?void 0:s.message]});if(!e)return null;const{vocabulary:o,usage:h,audit:l}=e,u=["domain","layer","kind","topic"],d=l.untagged.length===0&&l.nonCanonical.length===0&&l.orphan.length===0&&l.nearDups.length===0;return a.jsxs("div",{className:"taxonomy-page",children:[a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Faceted Tags"}),a.jsx("div",{className:"taxonomy-facets",children:u.map(g=>{const p=o.facetTags[g]??[];return p.length===0?null:a.jsxs("div",{className:"taxonomy-facet-group",children:[a.jsx("span",{className:"taxonomy-facet-label",children:wme[g]??g}),a.jsx("div",{className:"taxonomy-chip-cluster",children:p.map(m=>{const y=h[m]??0;return a.jsx(IB,{tag:m,count:y,dimmed:y===0},m)})})]},g)})})]}),o.bareTags.length>0&&a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Bare Tags"}),a.jsx("div",{className:"taxonomy-chip-cluster",children:o.bareTags.map(g=>{const p=h[g]??0;return a.jsx(IB,{tag:g,count:p,dimmed:p===0},g)})})]}),Object.keys(o.aliases).length>0&&a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Aliases"}),a.jsx("div",{className:"taxonomy-alias-list",children:Object.entries(o.aliases).map(([g,p])=>a.jsxs("div",{className:"taxonomy-alias-pair",children:[a.jsx("span",{className:"taxonomy-chip taxonomy-chip--alias","data-hue":na(g),children:a.jsx("span",{className:"taxonomy-chip-label",children:g})}),a.jsx("span",{className:"taxonomy-alias-arrow","aria-hidden":"true",children:"→"}),a.jsx("span",{className:"taxonomy-chip","data-hue":na(p),children:a.jsx("span",{className:"taxonomy-chip-label",children:p})})]},g))})]}),a.jsxs("section",{className:"taxonomy-section",children:[a.jsx("h2",{className:"taxonomy-section-heading",children:"Drift Audit"}),d?a.jsxs("div",{className:"taxonomy-healthy",children:[a.jsx("span",{className:"taxonomy-healthy-icon",children:"✓"}),a.jsx("span",{children:"Taxonomy healthy — no drift detected."})]}):a.jsxs("div",{className:"taxonomy-audit-panel",children:[a.jsx(em,{label:"Untagged docs",count:l.untagged.length,defaultOpen:l.untagged.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.untagged.map(g=>a.jsx("li",{className:"taxonomy-audit-item",children:a.jsx("code",{children:g})},g))})}),a.jsx(em,{label:"Non-canonical tags",count:l.nonCanonical.length,defaultOpen:l.nonCanonical.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.nonCanonical.map((g,p)=>a.jsxs("li",{className:"taxonomy-audit-item taxonomy-audit-item--suggest",children:[a.jsx("code",{className:"taxonomy-audit-doc",children:g.doc}),a.jsx("span",{className:"taxonomy-audit-tag",children:g.tag}),g.suggestion!==g.tag&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"taxonomy-alias-arrow","aria-hidden":"true",children:"→"}),a.jsx("span",{className:"taxonomy-audit-suggestion",children:g.suggestion})]})]},p))})}),a.jsx(em,{label:"Orphan tags",count:l.orphan.length,defaultOpen:l.orphan.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.orphan.map(g=>a.jsx("li",{className:"taxonomy-audit-item",children:a.jsx("span",{className:"taxonomy-audit-tag",children:g})},g))})}),a.jsx(em,{label:"Near-duplicates",count:l.nearDups.length,defaultOpen:l.nearDups.length>0,children:a.jsx("ul",{className:"taxonomy-audit-list",children:l.nearDups.map(([g,p],m)=>a.jsxs("li",{className:"taxonomy-audit-item taxonomy-audit-item--pair",children:[a.jsx("span",{className:"taxonomy-audit-tag",children:g}),a.jsx("span",{className:"taxonomy-alias-arrow","aria-hidden":"true",children:"≈"}),a.jsx("span",{className:"taxonomy-audit-tag",children:p})]},m))})})]})]})]})}function Sme(){const{health:r,serverCurrent:e}=hR();return!r||e?null:a.jsxs("div",{className:"stale-server-banner",children:["⚠ The dashboard server is running an older build (",r.version??"unknown"," vs ","0.14.0",") — some actions will fail. Restart it: ",a.jsx("code",{children:"dreamcontext dashboard"})]})}const FB=new vz({defaultOptions:{queries:{staleTime:5e3,retry:1,refetchOnWindowFocus:!0,refetchInterval:15e3,refetchIntervalInBackground:!1},mutations:{retry:0}}});function Tme({nav:r}){const e=(n,s)=>{const o={tasks:"tasks",knowledge:"knowledge",core:"core"};r.navigate(o[n],s)},i={id:r.focusId,nonce:r.nonce};switch(r.page){case"brain":return a.jsx(dpe,{onNavigate:e});case"tasks":return a.jsx(ude,{focus:i});case"roadmap":return a.jsx(Jde,{});case"lab":return a.jsx(xfe,{});case"sleep":return a.jsx(Efe,{});case"core":return a.jsx(Bfe,{onNavigateTaxonomy:()=>r.navigate("taxonomy",null),focus:i});case"knowledge":return a.jsx(Ufe,{focus:i});case"council":return a.jsx(Ype,{});case"settings":return a.jsx(_ge,{focus:i});case"packs":return a.jsx(Tge,{});case"taxonomy":return a.jsx(kme,{});case"about":return a.jsx(_me,{})}}class tm extends R.Component{constructor(){super(...arguments);Ut(this,"state",{error:null})}static getDerivedStateFromError(i){return{error:i}}render(){return this.state.error?a.jsxs("div",{className:"error-boundary",children:[a.jsx("h1",{children:"Something went wrong."}),a.jsx("p",{children:this.state.error.message}),a.jsx("button",{onClick:()=>window.location.reload(),children:"Reload"})]}):this.props.children}}const Vk=new URLSearchParams(window.location.search),jC=Vk.get("vault"),Eme=Vk.get("capture")==="1",Nme=Vk.get("perch")==="1";jC&&FC(jC);function Ame(){return R.useEffect(()=>{oQ().then(e=>m1(e));const r=e=>{(e.key===null||e.key===s5)&&m1(_w())};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)},[]),null}function jme(){return Eme?a.jsx(tm,{children:a.jsx(yQ,{})}):Nme?a.jsx(tm,{children:a.jsx(vQ,{})}):jC?a.jsx(tm,{children:a.jsx(GE,{client:FB,children:a.jsx(_Q,{children:a.jsx(QA,{children:a.jsxs(XE,{children:[a.jsx(Sme,{}),a.jsx(Pce,{children:r=>a.jsx(Tme,{nav:r})}),a.jsx(khe,{}),a.jsx(sL,{})]})})})})}):a.jsx(tm,{children:a.jsx(GE,{client:FB,children:a.jsx(QA,{children:a.jsxs(XE,{children:[a.jsx(Ame,{}),a.jsx(UX,{}),a.jsx(sL,{})]})})})})}const Mme=!!window.__TAURI_INTERNALS__;Mme&&navigator.platform.toLowerCase().includes("mac")&&document.documentElement.classList.add("tauri-overlay");VP.createRoot(document.getElementById("root")).render(a.jsx(R.StrictMode,{children:a.jsx(jme,{})}));export{j5 as $,zme as A,Ko as B,AQ as C,ni as D,PJ as E,Zw as F,v5 as G,Tte as H,see as I,ute as J,UQ as K,wf as L,$me as M,Yy as N,xJ as O,N5 as P,rj as Q,XJ as R,S1 as S,Ste as T,Wf as U,Rs as V,Pe as W,Ie as X,NJ as Y,yte as Z,H as _,RJ as a,eK as a$,GJ as a0,aj as a1,sj as a2,Yme as a3,Ume as a4,Kme as a5,Gme as a6,qme as a7,Bw as a8,Vme as a9,Pie as aA,$ie as aB,IO as aC,lX as aD,Hre as aE,f5 as aF,KJ as aG,uu as aH,Fme as aI,My as aJ,Rm as aK,kU as aL,QR as aM,Yf as aN,zre as aO,Pre as aP,cX as aQ,UC as aR,jo as aS,bf as aT,hN as aU,Iq as aV,hW as aW,sO as aX,aO as aY,JG as aZ,Bm as a_,Hme as aa,sh as ab,Zme as ac,Xme as ad,Wme as ae,pie as af,WI as ag,oye as ah,fte as ai,cn as aj,Va as ak,_d as al,Qw as am,PD as an,uc as ao,UD as ap,nr as aq,ra as ar,jt as as,mne as at,aye as au,lye as av,nye as aw,Ft as ax,sye as ay,Wie as az,BJ as b,Dm as b$,fu as b0,Al as b1,YW as b2,MN as b3,js as b4,ZU as b5,QC as b6,GG as b7,tK as b8,pu as b9,PY as bA,LV as bB,Ht as bC,hX as bD,MV as bE,uO as bF,HN as bG,Ql as bH,L7 as bI,_e as bJ,R as bK,LO as bL,BO as bM,RO as bN,a as bO,kN as bP,nW as bQ,uW as bR,pW as bS,jy as bT,iK as bU,ZC as bV,JR as bW,pK as bX,JW as bY,iG as bZ,zf as b_,cW as ba,dW as bb,oK as bc,rW as bd,XC as be,qN as bf,Ot as bg,WD as bh,mk as bi,Sn as bj,jq as bk,HC as bl,FR as bm,Pf as bn,zR as bo,Ime as bp,_N as bq,xN as br,NQ as bs,Ni as bt,gue as bu,Rr as bv,ew as bw,zY as bx,$Y as by,MY as bz,Ar as c,il as c0,zN as c1,JC as c2,eO as c3,Z_ as c4,Bme as c5,Xt as c6,XB as c7,kk as c8,Ome as c9,uye as ca,LC as cb,Rme as cc,Kt as d,A5 as e,Ti as f,DJ as g,Wa as h,Ms as i,mte as j,Gf as k,Qe as l,qD as m,Pme as n,hye as o,IJ as p,FJ as q,cye as r,OJ as s,dte as t,Ts as u,Rie as v,Ate as w,Qme as x,Xo as y,LJ as z};