@ours.network/messenger-server 1.0.26 → 1.0.27

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 (129) hide show
  1. package/dist/chunks/{chunk-MEQ5E356.js → chunk-57ATYRSM.js} +1 -1
  2. package/dist/chunks/{server-5BGVFYYE.js → server-4AGPXARB.js} +1 -1
  3. package/dist/cli.js +2 -2
  4. package/dist/web/assets/{abnfDiagram-N423BO3Z-bqnK4YOC.js → abnfDiagram-N423BO3Z-BwZpfEGF.js} +2 -2
  5. package/dist/web/assets/{abnfDiagram-N423BO3Z-bqnK4YOC.js.map → abnfDiagram-N423BO3Z-BwZpfEGF.js.map} +1 -1
  6. package/dist/web/assets/{arc-DjGIt3BG.js → arc-BFaE218e.js} +2 -2
  7. package/dist/web/assets/{arc-DjGIt3BG.js.map → arc-BFaE218e.js.map} +1 -1
  8. package/dist/web/assets/{architectureDiagram-T3A2C74G-I4gVGUSn.js → architectureDiagram-T3A2C74G-C5THhoig.js} +2 -2
  9. package/dist/web/assets/{architectureDiagram-T3A2C74G-I4gVGUSn.js.map → architectureDiagram-T3A2C74G-C5THhoig.js.map} +1 -1
  10. package/dist/web/assets/{blockDiagram-VBNYF7ZC-B0VmVirY.js → blockDiagram-VBNYF7ZC-DnCtG56-.js} +2 -2
  11. package/dist/web/assets/{blockDiagram-VBNYF7ZC-B0VmVirY.js.map → blockDiagram-VBNYF7ZC-DnCtG56-.js.map} +1 -1
  12. package/dist/web/assets/{browser-DThvWPee.js → browser-ByIBVK5q.js} +2 -2
  13. package/dist/web/assets/{browser-DThvWPee.js.map → browser-ByIBVK5q.js.map} +1 -1
  14. package/dist/web/assets/{c4Diagram-5PPSVZJV-Dj0yWM90.js → c4Diagram-5PPSVZJV-DwQkOksn.js} +2 -2
  15. package/dist/web/assets/{c4Diagram-5PPSVZJV-Dj0yWM90.js.map → c4Diagram-5PPSVZJV-DwQkOksn.js.map} +1 -1
  16. package/dist/web/assets/channel-CeQIUqXs.js +2 -0
  17. package/dist/web/assets/{channel-qDsnjLTa.js.map → channel-CeQIUqXs.js.map} +1 -1
  18. package/dist/web/assets/{chunk-2GRJ4B5K-BvcZvduT.js → chunk-2GRJ4B5K-BC7cfF0z.js} +2 -2
  19. package/dist/web/assets/{chunk-2GRJ4B5K-BvcZvduT.js.map → chunk-2GRJ4B5K-BC7cfF0z.js.map} +1 -1
  20. package/dist/web/assets/{chunk-2Q5K7J3B-sve7p0NV.js → chunk-2Q5K7J3B-DSl8ovDM.js} +2 -2
  21. package/dist/web/assets/{chunk-2Q5K7J3B-sve7p0NV.js.map → chunk-2Q5K7J3B-DSl8ovDM.js.map} +1 -1
  22. package/dist/web/assets/{chunk-5RXB4S5H-CkAR-zTz.js → chunk-5RXB4S5H-DEuB2ZNu.js} +2 -2
  23. package/dist/web/assets/{chunk-5RXB4S5H-CkAR-zTz.js.map → chunk-5RXB4S5H-DEuB2ZNu.js.map} +1 -1
  24. package/dist/web/assets/{chunk-5VM5RSS4-Ch1WCith.js → chunk-5VM5RSS4-G2C_wvpZ.js} +2 -2
  25. package/dist/web/assets/{chunk-5VM5RSS4-Ch1WCith.js.map → chunk-5VM5RSS4-G2C_wvpZ.js.map} +1 -1
  26. package/dist/web/assets/{chunk-6Q2QTUOP-C4-zGQ3z.js → chunk-6Q2QTUOP-n48Dn6tF.js} +2 -2
  27. package/dist/web/assets/{chunk-6Q2QTUOP-C4-zGQ3z.js.map → chunk-6Q2QTUOP-n48Dn6tF.js.map} +1 -1
  28. package/dist/web/assets/{chunk-GF5L2VYU-CzZYOdx6.js → chunk-GF5L2VYU-0cDRfE0v.js} +2 -2
  29. package/dist/web/assets/{chunk-GF5L2VYU-CzZYOdx6.js.map → chunk-GF5L2VYU-0cDRfE0v.js.map} +1 -1
  30. package/dist/web/assets/{chunk-JWPE2WC7-DO9iwi6J.js → chunk-JWPE2WC7-B-sIaUe_.js} +2 -2
  31. package/dist/web/assets/{chunk-JWPE2WC7-DO9iwi6J.js.map → chunk-JWPE2WC7-B-sIaUe_.js.map} +1 -1
  32. package/dist/web/assets/{chunk-KBJHAD2P-BPPtvPBo.js → chunk-KBJHAD2P-CJdfxI0W.js} +2 -2
  33. package/dist/web/assets/{chunk-KBJHAD2P-BPPtvPBo.js.map → chunk-KBJHAD2P-CJdfxI0W.js.map} +1 -1
  34. package/dist/web/assets/{chunk-RYQCIY6F-CkfxakyT.js → chunk-RYQCIY6F-B-bC01qp.js} +2 -2
  35. package/dist/web/assets/{chunk-RYQCIY6F-CkfxakyT.js.map → chunk-RYQCIY6F-B-bC01qp.js.map} +1 -1
  36. package/dist/web/assets/{chunk-XXDRQBXY-C5cYxQrY.js → chunk-XXDRQBXY-B2zsroXX.js} +2 -2
  37. package/dist/web/assets/{chunk-XXDRQBXY-C5cYxQrY.js.map → chunk-XXDRQBXY-B2zsroXX.js.map} +1 -1
  38. package/dist/web/assets/classDiagram-JCYQIIEL-CkjBLoHE.js +2 -0
  39. package/dist/web/assets/{classDiagram-JCYQIIEL-D6QSunf-.js.map → classDiagram-JCYQIIEL-CkjBLoHE.js.map} +1 -1
  40. package/dist/web/assets/classDiagram-v2-OCEON4UE-CkjBLoHE.js +2 -0
  41. package/dist/web/assets/{classDiagram-v2-OCEON4UE-D6QSunf-.js.map → classDiagram-v2-OCEON4UE-CkjBLoHE.js.map} +1 -1
  42. package/dist/web/assets/{cose-bilkent-JH36ORCC-CDS01wHW.js → cose-bilkent-JH36ORCC-DDphJuHu.js} +2 -2
  43. package/dist/web/assets/{cose-bilkent-JH36ORCC-CDS01wHW.js.map → cose-bilkent-JH36ORCC-DDphJuHu.js.map} +1 -1
  44. package/dist/web/assets/{cynefin-VYW2F7L2-Bs1x5Hdp.js → cynefin-VYW2F7L2-BoKcfef3.js} +2 -2
  45. package/dist/web/assets/{cynefin-VYW2F7L2-Bs1x5Hdp.js.map → cynefin-VYW2F7L2-BoKcfef3.js.map} +1 -1
  46. package/dist/web/assets/{cynefinDiagram-MW4NZA55-BdK-Gc8j.js → cynefinDiagram-MW4NZA55-C0L9ol2q.js} +2 -2
  47. package/dist/web/assets/{cynefinDiagram-MW4NZA55-BdK-Gc8j.js.map → cynefinDiagram-MW4NZA55-C0L9ol2q.js.map} +1 -1
  48. package/dist/web/assets/{dagre-VZM6K2ZE-DHA2ivcw.js → dagre-VZM6K2ZE-CeDDh-x1.js} +2 -2
  49. package/dist/web/assets/{dagre-VZM6K2ZE-DHA2ivcw.js.map → dagre-VZM6K2ZE-CeDDh-x1.js.map} +1 -1
  50. package/dist/web/assets/{diagram-7IWD3JNH-DIVtPE3t.js → diagram-7IWD3JNH-D_tUp0VL.js} +2 -2
  51. package/dist/web/assets/{diagram-7IWD3JNH-DIVtPE3t.js.map → diagram-7IWD3JNH-D_tUp0VL.js.map} +1 -1
  52. package/dist/web/assets/{diagram-B4RE2ZJO-DUbP1jlq.js → diagram-B4RE2ZJO-DZDYOecW.js} +2 -2
  53. package/dist/web/assets/{diagram-B4RE2ZJO-DUbP1jlq.js.map → diagram-B4RE2ZJO-DZDYOecW.js.map} +1 -1
  54. package/dist/web/assets/{diagram-LBJQPF4R-Uf0SV5Oa.js → diagram-LBJQPF4R-Cpc35PFW.js} +2 -2
  55. package/dist/web/assets/{diagram-LBJQPF4R-Uf0SV5Oa.js.map → diagram-LBJQPF4R-Cpc35PFW.js.map} +1 -1
  56. package/dist/web/assets/{diagram-Q27KOJAE-fnNTxd1b.js → diagram-Q27KOJAE-BOz6TqHv.js} +2 -2
  57. package/dist/web/assets/{diagram-Q27KOJAE-fnNTxd1b.js.map → diagram-Q27KOJAE-BOz6TqHv.js.map} +1 -1
  58. package/dist/web/assets/{diagram-UB23O5K3-DDqZawju.js → diagram-UB23O5K3-Ds6nWxHH.js} +2 -2
  59. package/dist/web/assets/{diagram-UB23O5K3-DDqZawju.js.map → diagram-UB23O5K3-Ds6nWxHH.js.map} +1 -1
  60. package/dist/web/assets/{ebnfDiagram-BXEA7PRR-BCaUK5eF.js → ebnfDiagram-BXEA7PRR-CCFR7qwF.js} +2 -2
  61. package/dist/web/assets/{ebnfDiagram-BXEA7PRR-BCaUK5eF.js.map → ebnfDiagram-BXEA7PRR-CCFR7qwF.js.map} +1 -1
  62. package/dist/web/assets/{erDiagram-JOGREHBK-BKrRBZ8v.js → erDiagram-JOGREHBK-Dy3fKeW1.js} +2 -2
  63. package/dist/web/assets/{erDiagram-JOGREHBK-BKrRBZ8v.js.map → erDiagram-JOGREHBK-Dy3fKeW1.js.map} +1 -1
  64. package/dist/web/assets/{flowDiagram-UKHOOZJN-BnZS06hc.js → flowDiagram-UKHOOZJN-DmGXUo_i.js} +2 -2
  65. package/dist/web/assets/{flowDiagram-UKHOOZJN-BnZS06hc.js.map → flowDiagram-UKHOOZJN-DmGXUo_i.js.map} +1 -1
  66. package/dist/web/assets/{ganttDiagram-PKOTCBZU-MlPWl_7U.js → ganttDiagram-PKOTCBZU-DRlsIr-9.js} +2 -2
  67. package/dist/web/assets/{ganttDiagram-PKOTCBZU-MlPWl_7U.js.map → ganttDiagram-PKOTCBZU-DRlsIr-9.js.map} +1 -1
  68. package/dist/web/assets/{gitGraphDiagram-DS77QQ5N-DmQ7grmW.js → gitGraphDiagram-DS77QQ5N-BF8sMWrB.js} +2 -2
  69. package/dist/web/assets/{gitGraphDiagram-DS77QQ5N-DmQ7grmW.js.map → gitGraphDiagram-DS77QQ5N-BF8sMWrB.js.map} +1 -1
  70. package/dist/web/assets/{index-zEjyXfYx.js → index-BWJKsro0.js} +10 -10
  71. package/dist/web/assets/index-BWJKsro0.js.map +1 -0
  72. package/dist/web/assets/{infoDiagram-6WML65LV-DnQLhWz5.js → infoDiagram-6WML65LV-C2ziOwwF.js} +2 -2
  73. package/dist/web/assets/{infoDiagram-6WML65LV-DnQLhWz5.js.map → infoDiagram-6WML65LV-C2ziOwwF.js.map} +1 -1
  74. package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-DrmsJJLQ.js → ishikawaDiagram-WSZJBQD7-Dj6G7tMI.js} +2 -2
  75. package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-DrmsJJLQ.js.map → ishikawaDiagram-WSZJBQD7-Dj6G7tMI.js.map} +1 -1
  76. package/dist/web/assets/{journeyDiagram-NVQOT4AX-CSXPLegv.js → journeyDiagram-NVQOT4AX-YHJIDkiw.js} +2 -2
  77. package/dist/web/assets/{journeyDiagram-NVQOT4AX-CSXPLegv.js.map → journeyDiagram-NVQOT4AX-YHJIDkiw.js.map} +1 -1
  78. package/dist/web/assets/{jsQR-D4Lkm6eX.js → jsQR-Ck2KRhtk.js} +2 -2
  79. package/dist/web/assets/{jsQR-D4Lkm6eX.js.map → jsQR-Ck2KRhtk.js.map} +1 -1
  80. package/dist/web/assets/{kanban-definition-27J2QSJJ-DLoixRJV.js → kanban-definition-27J2QSJJ-CR6vkjK8.js} +2 -2
  81. package/dist/web/assets/{kanban-definition-27J2QSJJ-DLoixRJV.js.map → kanban-definition-27J2QSJJ-CR6vkjK8.js.map} +1 -1
  82. package/dist/web/assets/{linear-BPoG-jmO.js → linear-B80VHMM1.js} +2 -2
  83. package/dist/web/assets/{linear-BPoG-jmO.js.map → linear-B80VHMM1.js.map} +1 -1
  84. package/dist/web/assets/{mermaid.core-ZtqQ8zsB.js → mermaid.core-Bo5ITjWV.js} +5 -5
  85. package/dist/web/assets/{mermaid.core-ZtqQ8zsB.js.map → mermaid.core-Bo5ITjWV.js.map} +1 -1
  86. package/dist/web/assets/{mindmap-definition-FAOFIHXS-Dy4r-CaI.js → mindmap-definition-FAOFIHXS-BzBemuVP.js} +2 -2
  87. package/dist/web/assets/{mindmap-definition-FAOFIHXS-Dy4r-CaI.js.map → mindmap-definition-FAOFIHXS-BzBemuVP.js.map} +1 -1
  88. package/dist/web/assets/{pegDiagram-VL7TDLO6-C16cg9P3.js → pegDiagram-VL7TDLO6-DdouWlYr.js} +2 -2
  89. package/dist/web/assets/{pegDiagram-VL7TDLO6-C16cg9P3.js.map → pegDiagram-VL7TDLO6-DdouWlYr.js.map} +1 -1
  90. package/dist/web/assets/{pieDiagram-7S7Q4E2Y-CMvKs4-p.js → pieDiagram-7S7Q4E2Y-C5fE7edx.js} +2 -2
  91. package/dist/web/assets/{pieDiagram-7S7Q4E2Y-CMvKs4-p.js.map → pieDiagram-7S7Q4E2Y-C5fE7edx.js.map} +1 -1
  92. package/dist/web/assets/{quadrantDiagram-CIZ2JOQS-DA7_M3R0.js → quadrantDiagram-CIZ2JOQS-fB-F7K1O.js} +2 -2
  93. package/dist/web/assets/{quadrantDiagram-CIZ2JOQS-DA7_M3R0.js.map → quadrantDiagram-CIZ2JOQS-fB-F7K1O.js.map} +1 -1
  94. package/dist/web/assets/{railroadDiagram-AXF67PYL--Shm95FE.js → railroadDiagram-AXF67PYL-DUAfsiQL.js} +2 -2
  95. package/dist/web/assets/{railroadDiagram-AXF67PYL--Shm95FE.js.map → railroadDiagram-AXF67PYL-DUAfsiQL.js.map} +1 -1
  96. package/dist/web/assets/{requirementDiagram-LRYGKXZP-DNFEY8Mb.js → requirementDiagram-LRYGKXZP-DqY0pzOx.js} +2 -2
  97. package/dist/web/assets/{requirementDiagram-LRYGKXZP-DNFEY8Mb.js.map → requirementDiagram-LRYGKXZP-DqY0pzOx.js.map} +1 -1
  98. package/dist/web/assets/{sankeyDiagram-W5VNT64P-DFHaPJPk.js → sankeyDiagram-W5VNT64P-vrR_C7WB.js} +2 -2
  99. package/dist/web/assets/{sankeyDiagram-W5VNT64P-DFHaPJPk.js.map → sankeyDiagram-W5VNT64P-vrR_C7WB.js.map} +1 -1
  100. package/dist/web/assets/{sequenceDiagram-SI44F4Z6-Bt3pTAA0.js → sequenceDiagram-SI44F4Z6-CHym7nQT.js} +2 -2
  101. package/dist/web/assets/{sequenceDiagram-SI44F4Z6-Bt3pTAA0.js.map → sequenceDiagram-SI44F4Z6-CHym7nQT.js.map} +1 -1
  102. package/dist/web/assets/{sizeCapture-X5ZJPWSS-CzolchdE.js → sizeCapture-X5ZJPWSS-DaDxWiPk.js} +2 -2
  103. package/dist/web/assets/{sizeCapture-X5ZJPWSS-CzolchdE.js.map → sizeCapture-X5ZJPWSS-DaDxWiPk.js.map} +1 -1
  104. package/dist/web/assets/{stateDiagram-OKZ733FA-DYmkQolZ.js → stateDiagram-OKZ733FA-CoZ6mTYC.js} +2 -2
  105. package/dist/web/assets/{stateDiagram-OKZ733FA-DYmkQolZ.js.map → stateDiagram-OKZ733FA-CoZ6mTYC.js.map} +1 -1
  106. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-J-MJucj5.js +2 -0
  107. package/dist/web/assets/{stateDiagram-v2-UEYNNEHI-BsDm8e4d.js.map → stateDiagram-v2-UEYNNEHI-J-MJucj5.js.map} +1 -1
  108. package/dist/web/assets/{swimlanes-SLNWSIFB-Kr8FvnEp.js → swimlanes-SLNWSIFB-CYNnaMLq.js} +3 -3
  109. package/dist/web/assets/{swimlanes-SLNWSIFB-Kr8FvnEp.js.map → swimlanes-SLNWSIFB-CYNnaMLq.js.map} +1 -1
  110. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-CkkSw8Sw.js +9 -0
  111. package/dist/web/assets/{swimlanesDiagram-ULZ7WXOC-B6tsVVP8.js.map → swimlanesDiagram-ULZ7WXOC-CkkSw8Sw.js.map} +1 -1
  112. package/dist/web/assets/{timeline-definition-Z64GVDOM-CKQQh7ke.js → timeline-definition-Z64GVDOM-DZ1Y1cvh.js} +2 -2
  113. package/dist/web/assets/{timeline-definition-Z64GVDOM-CKQQh7ke.js.map → timeline-definition-Z64GVDOM-DZ1Y1cvh.js.map} +1 -1
  114. package/dist/web/assets/{vennDiagram-T6HMQDX7-BUVOiP60.js → vennDiagram-T6HMQDX7-jmfMoaEa.js} +2 -2
  115. package/dist/web/assets/{vennDiagram-T6HMQDX7-BUVOiP60.js.map → vennDiagram-T6HMQDX7-jmfMoaEa.js.map} +1 -1
  116. package/dist/web/assets/{wardleyDiagram-T6FBY63Y-YFCU116Z.js → wardleyDiagram-T6FBY63Y-Kt8p2YSi.js} +2 -2
  117. package/dist/web/assets/{wardleyDiagram-T6FBY63Y-YFCU116Z.js.map → wardleyDiagram-T6FBY63Y-Kt8p2YSi.js.map} +1 -1
  118. package/dist/web/assets/{xychartDiagram-ELKLHX3M-BidhLB_2.js → xychartDiagram-ELKLHX3M-CSD7wGPG.js} +2 -2
  119. package/dist/web/assets/{xychartDiagram-ELKLHX3M-BidhLB_2.js.map → xychartDiagram-ELKLHX3M-CSD7wGPG.js.map} +1 -1
  120. package/dist/web/index.html +1 -1
  121. package/dist/web/sw.js +1 -1
  122. package/dist/web/version.json +1 -1
  123. package/package.json +2 -2
  124. package/dist/web/assets/channel-qDsnjLTa.js +0 -2
  125. package/dist/web/assets/classDiagram-JCYQIIEL-D6QSunf-.js +0 -2
  126. package/dist/web/assets/classDiagram-v2-OCEON4UE-D6QSunf-.js +0 -2
  127. package/dist/web/assets/index-zEjyXfYx.js.map +0 -1
  128. package/dist/web/assets/stateDiagram-v2-UEYNNEHI-BsDm8e4d.js +0 -2
  129. package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-B6tsVVP8.js +0 -9
@@ -6,7 +6,7 @@ function cC(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Fg;function fC(){if(Fg)return Ve;Fg=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.iterator;function v(F){return F===null||typeof F!="object"?null:(F=p&&F[p]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function E(F,Q,M){this.props=F,this.context=Q,this.refs=C,this.updater=M||w}E.prototype.isReactComponent={},E.prototype.setState=function(F,Q){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,Q,"setState")},E.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function R(){}R.prototype=E.prototype;function A(F,Q,M){this.props=F,this.context=Q,this.refs=C,this.updater=M||w}var T=A.prototype=new R;T.constructor=A,S(T,E.prototype),T.isPureReactComponent=!0;var P=Array.isArray,O=Object.prototype.hasOwnProperty,D={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function B(F,Q,M){var Z,ye={},me=null,he=null;if(Q!=null)for(Z in Q.ref!==void 0&&(he=Q.ref),Q.key!==void 0&&(me=""+Q.key),Q)O.call(Q,Z)&&!H.hasOwnProperty(Z)&&(ye[Z]=Q[Z]);var be=arguments.length-2;if(be===1)ye.children=M;else if(1<be){for(var xe=Array(be),Be=0;Be<be;Be++)xe[Be]=arguments[Be+2];ye.children=xe}if(F&&F.defaultProps)for(Z in be=F.defaultProps,be)ye[Z]===void 0&&(ye[Z]=be[Z]);return{$$typeof:e,type:F,key:me,ref:he,props:ye,_owner:D.current}}function _(F,Q){return{$$typeof:e,type:F.type,key:Q,ref:F.ref,props:F.props,_owner:F._owner}}function N(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function q(F){var Q={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(M){return Q[M]})}var V=/\/+/g;function ae(F,Q){return typeof F=="object"&&F!==null&&F.key!=null?q(""+F.key):Q.toString(36)}function J(F,Q,M,Z,ye){var me=typeof F;(me==="undefined"||me==="boolean")&&(F=null);var he=!1;if(F===null)he=!0;else switch(me){case"string":case"number":he=!0;break;case"object":switch(F.$$typeof){case e:case t:he=!0}}if(he)return he=F,ye=ye(he),F=Z===""?"."+ae(he,0):Z,P(ye)?(M="",F!=null&&(M=F.replace(V,"$&/")+"/"),J(ye,Q,M,"",function(Be){return Be})):ye!=null&&(N(ye)&&(ye=_(ye,M+(!ye.key||he&&he.key===ye.key?"":(""+ye.key).replace(V,"$&/")+"/")+F)),Q.push(ye)),1;if(he=0,Z=Z===""?".":Z+":",P(F))for(var be=0;be<F.length;be++){me=F[be];var xe=Z+ae(me,be);he+=J(me,Q,M,xe,ye)}else if(xe=v(F),typeof xe=="function")for(F=xe.call(F),be=0;!(me=F.next()).done;)me=me.value,xe=Z+ae(me,be++),he+=J(me,Q,M,xe,ye);else if(me==="object")throw Q=String(F),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return he}function ee(F,Q,M){if(F==null)return F;var Z=[],ye=0;return J(F,Z,"","",function(me){return Q.call(M,me,ye++)}),Z}function ge(F){if(F._status===-1){var Q=F._result;Q=Q(),Q.then(function(M){(F._status===0||F._status===-1)&&(F._status=1,F._result=M)},function(M){(F._status===0||F._status===-1)&&(F._status=2,F._result=M)}),F._status===-1&&(F._status=0,F._result=Q)}if(F._status===1)return F._result.default;throw F._result}var we={current:null},G={transition:null},le={ReactCurrentDispatcher:we,ReactCurrentBatchConfig:G,ReactCurrentOwner:D};function j(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:ee,forEach:function(F,Q,M){ee(F,function(){Q.apply(this,arguments)},M)},count:function(F){var Q=0;return ee(F,function(){Q++}),Q},toArray:function(F){return ee(F,function(Q){return Q})||[]},only:function(F){if(!N(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},Ve.Component=E,Ve.Fragment=n,Ve.Profiler=s,Ve.PureComponent=A,Ve.StrictMode=i,Ve.Suspense=f,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=le,Ve.act=j,Ve.cloneElement=function(F,Q,M){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var Z=S({},F.props),ye=F.key,me=F.ref,he=F._owner;if(Q!=null){if(Q.ref!==void 0&&(me=Q.ref,he=D.current),Q.key!==void 0&&(ye=""+Q.key),F.type&&F.type.defaultProps)var be=F.type.defaultProps;for(xe in Q)O.call(Q,xe)&&!H.hasOwnProperty(xe)&&(Z[xe]=Q[xe]===void 0&&be!==void 0?be[xe]:Q[xe])}var xe=arguments.length-2;if(xe===1)Z.children=M;else if(1<xe){be=Array(xe);for(var Be=0;Be<xe;Be++)be[Be]=arguments[Be+2];Z.children=be}return{$$typeof:e,type:F.type,key:ye,ref:me,props:Z,_owner:he}},Ve.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:a,_context:F},F.Consumer=F},Ve.createElement=B,Ve.createFactory=function(F){var Q=B.bind(null,F);return Q.type=F,Q},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(F){return{$$typeof:c,render:F}},Ve.isValidElement=N,Ve.lazy=function(F){return{$$typeof:m,_payload:{_status:-1,_result:F},_init:ge}},Ve.memo=function(F,Q){return{$$typeof:h,type:F,compare:Q===void 0?null:Q}},Ve.startTransition=function(F){var Q=G.transition;G.transition={};try{F()}finally{G.transition=Q}},Ve.unstable_act=j,Ve.useCallback=function(F,Q){return we.current.useCallback(F,Q)},Ve.useContext=function(F){return we.current.useContext(F)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(F){return we.current.useDeferredValue(F)},Ve.useEffect=function(F,Q){return we.current.useEffect(F,Q)},Ve.useId=function(){return we.current.useId()},Ve.useImperativeHandle=function(F,Q,M){return we.current.useImperativeHandle(F,Q,M)},Ve.useInsertionEffect=function(F,Q){return we.current.useInsertionEffect(F,Q)},Ve.useLayoutEffect=function(F,Q){return we.current.useLayoutEffect(F,Q)},Ve.useMemo=function(F,Q){return we.current.useMemo(F,Q)},Ve.useReducer=function(F,Q,M){return we.current.useReducer(F,Q,M)},Ve.useRef=function(F){return we.current.useRef(F)},Ve.useState=function(F){return we.current.useState(F)},Ve.useSyncExternalStore=function(F,Q,M){return we.current.useSyncExternalStore(F,Q,M)},Ve.useTransition=function(){return we.current.useTransition()},Ve.version="18.3.1",Ve}var zg;function Zd(){return zg||(zg=1,Gc.exports=fC()),Gc.exports}/**
9
+ */var Fg;function fC(){if(Fg)return Ve;Fg=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.iterator;function v(F){return F===null||typeof F!="object"?null:(F=p&&F[p]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function E(F,Q,M){this.props=F,this.context=Q,this.refs=C,this.updater=M||w}E.prototype.isReactComponent={},E.prototype.setState=function(F,Q){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,Q,"setState")},E.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function R(){}R.prototype=E.prototype;function A(F,Q,M){this.props=F,this.context=Q,this.refs=C,this.updater=M||w}var T=A.prototype=new R;T.constructor=A,S(T,E.prototype),T.isPureReactComponent=!0;var P=Array.isArray,O=Object.prototype.hasOwnProperty,D={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function B(F,Q,M){var Z,ye={},me=null,pe=null;if(Q!=null)for(Z in Q.ref!==void 0&&(pe=Q.ref),Q.key!==void 0&&(me=""+Q.key),Q)O.call(Q,Z)&&!H.hasOwnProperty(Z)&&(ye[Z]=Q[Z]);var be=arguments.length-2;if(be===1)ye.children=M;else if(1<be){for(var xe=Array(be),Be=0;Be<be;Be++)xe[Be]=arguments[Be+2];ye.children=xe}if(F&&F.defaultProps)for(Z in be=F.defaultProps,be)ye[Z]===void 0&&(ye[Z]=be[Z]);return{$$typeof:e,type:F,key:me,ref:pe,props:ye,_owner:D.current}}function _(F,Q){return{$$typeof:e,type:F.type,key:Q,ref:F.ref,props:F.props,_owner:F._owner}}function N(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function q(F){var Q={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(M){return Q[M]})}var V=/\/+/g;function ae(F,Q){return typeof F=="object"&&F!==null&&F.key!=null?q(""+F.key):Q.toString(36)}function J(F,Q,M,Z,ye){var me=typeof F;(me==="undefined"||me==="boolean")&&(F=null);var pe=!1;if(F===null)pe=!0;else switch(me){case"string":case"number":pe=!0;break;case"object":switch(F.$$typeof){case e:case t:pe=!0}}if(pe)return pe=F,ye=ye(pe),F=Z===""?"."+ae(pe,0):Z,P(ye)?(M="",F!=null&&(M=F.replace(V,"$&/")+"/"),J(ye,Q,M,"",function(Be){return Be})):ye!=null&&(N(ye)&&(ye=_(ye,M+(!ye.key||pe&&pe.key===ye.key?"":(""+ye.key).replace(V,"$&/")+"/")+F)),Q.push(ye)),1;if(pe=0,Z=Z===""?".":Z+":",P(F))for(var be=0;be<F.length;be++){me=F[be];var xe=Z+ae(me,be);pe+=J(me,Q,M,xe,ye)}else if(xe=v(F),typeof xe=="function")for(F=xe.call(F),be=0;!(me=F.next()).done;)me=me.value,xe=Z+ae(me,be++),pe+=J(me,Q,M,xe,ye);else if(me==="object")throw Q=String(F),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return pe}function ee(F,Q,M){if(F==null)return F;var Z=[],ye=0;return J(F,Z,"","",function(me){return Q.call(M,me,ye++)}),Z}function ge(F){if(F._status===-1){var Q=F._result;Q=Q(),Q.then(function(M){(F._status===0||F._status===-1)&&(F._status=1,F._result=M)},function(M){(F._status===0||F._status===-1)&&(F._status=2,F._result=M)}),F._status===-1&&(F._status=0,F._result=Q)}if(F._status===1)return F._result.default;throw F._result}var we={current:null},G={transition:null},le={ReactCurrentDispatcher:we,ReactCurrentBatchConfig:G,ReactCurrentOwner:D};function j(){throw Error("act(...) is not supported in production builds of React.")}return Ve.Children={map:ee,forEach:function(F,Q,M){ee(F,function(){Q.apply(this,arguments)},M)},count:function(F){var Q=0;return ee(F,function(){Q++}),Q},toArray:function(F){return ee(F,function(Q){return Q})||[]},only:function(F){if(!N(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},Ve.Component=E,Ve.Fragment=n,Ve.Profiler=s,Ve.PureComponent=A,Ve.StrictMode=i,Ve.Suspense=f,Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=le,Ve.act=j,Ve.cloneElement=function(F,Q,M){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var Z=S({},F.props),ye=F.key,me=F.ref,pe=F._owner;if(Q!=null){if(Q.ref!==void 0&&(me=Q.ref,pe=D.current),Q.key!==void 0&&(ye=""+Q.key),F.type&&F.type.defaultProps)var be=F.type.defaultProps;for(xe in Q)O.call(Q,xe)&&!H.hasOwnProperty(xe)&&(Z[xe]=Q[xe]===void 0&&be!==void 0?be[xe]:Q[xe])}var xe=arguments.length-2;if(xe===1)Z.children=M;else if(1<xe){be=Array(xe);for(var Be=0;Be<xe;Be++)be[Be]=arguments[Be+2];Z.children=be}return{$$typeof:e,type:F.type,key:ye,ref:me,props:Z,_owner:pe}},Ve.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:a,_context:F},F.Consumer=F},Ve.createElement=B,Ve.createFactory=function(F){var Q=B.bind(null,F);return Q.type=F,Q},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(F){return{$$typeof:c,render:F}},Ve.isValidElement=N,Ve.lazy=function(F){return{$$typeof:m,_payload:{_status:-1,_result:F},_init:ge}},Ve.memo=function(F,Q){return{$$typeof:h,type:F,compare:Q===void 0?null:Q}},Ve.startTransition=function(F){var Q=G.transition;G.transition={};try{F()}finally{G.transition=Q}},Ve.unstable_act=j,Ve.useCallback=function(F,Q){return we.current.useCallback(F,Q)},Ve.useContext=function(F){return we.current.useContext(F)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(F){return we.current.useDeferredValue(F)},Ve.useEffect=function(F,Q){return we.current.useEffect(F,Q)},Ve.useId=function(){return we.current.useId()},Ve.useImperativeHandle=function(F,Q,M){return we.current.useImperativeHandle(F,Q,M)},Ve.useInsertionEffect=function(F,Q){return we.current.useInsertionEffect(F,Q)},Ve.useLayoutEffect=function(F,Q){return we.current.useLayoutEffect(F,Q)},Ve.useMemo=function(F,Q){return we.current.useMemo(F,Q)},Ve.useReducer=function(F,Q,M){return we.current.useReducer(F,Q,M)},Ve.useRef=function(F){return we.current.useRef(F)},Ve.useState=function(F){return we.current.useState(F)},Ve.useSyncExternalStore=function(F,Q,M){return we.current.useSyncExternalStore(F,Q,M)},Ve.useTransition=function(){return we.current.useTransition()},Ve.version="18.3.1",Ve}var zg;function Zd(){return zg||(zg=1,Gc.exports=fC()),Gc.exports}/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -22,7 +22,7 @@ function cC(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var $g;function pC(){return $g||($g=1,function(e){function t(G,le){var j=G.length;G.push(le);e:for(;0<j;){var F=j-1>>>1,Q=G[F];if(0<s(Q,le))G[F]=le,G[j]=Q,j=F;else break e}}function n(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var le=G[0],j=G.pop();if(j!==le){G[0]=j;e:for(var F=0,Q=G.length,M=Q>>>1;F<M;){var Z=2*(F+1)-1,ye=G[Z],me=Z+1,he=G[me];if(0>s(ye,j))me<Q&&0>s(he,ye)?(G[F]=he,G[me]=j,F=me):(G[F]=ye,G[Z]=j,F=Z);else if(me<Q&&0>s(he,j))G[F]=he,G[me]=j,F=me;else break e}}return le}function s(G,le){var j=G.sortIndex-le.sortIndex;return j!==0?j:G.id-le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var f=[],h=[],m=1,p=null,v=3,w=!1,S=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(G){for(var le=n(h);le!==null;){if(le.callback===null)i(h);else if(le.startTime<=G)i(h),le.sortIndex=le.expirationTime,t(f,le);else break;le=n(h)}}function P(G){if(C=!1,T(G),!S)if(n(f)!==null)S=!0,ge(O);else{var le=n(h);le!==null&&we(P,le.startTime-G)}}function O(G,le){S=!1,C&&(C=!1,R(B),B=-1),w=!0;var j=v;try{for(T(le),p=n(f);p!==null&&(!(p.expirationTime>le)||G&&!q());){var F=p.callback;if(typeof F=="function"){p.callback=null,v=p.priorityLevel;var Q=F(p.expirationTime<=le);le=e.unstable_now(),typeof Q=="function"?p.callback=Q:p===n(f)&&i(f),T(le)}else i(f);p=n(f)}if(p!==null)var M=!0;else{var Z=n(h);Z!==null&&we(P,Z.startTime-le),M=!1}return M}finally{p=null,v=j,w=!1}}var D=!1,H=null,B=-1,_=5,N=-1;function q(){return!(e.unstable_now()-N<_)}function V(){if(H!==null){var G=e.unstable_now();N=G;var le=!0;try{le=H(!0,G)}finally{le?ae():(D=!1,H=null)}}else D=!1}var ae;if(typeof A=="function")ae=function(){A(V)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,ee=J.port2;J.port1.onmessage=V,ae=function(){ee.postMessage(null)}}else ae=function(){E(V,0)};function ge(G){H=G,D||(D=!0,ae())}function we(G,le){B=E(function(){G(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_continueExecution=function(){S||w||(S=!0,ge(O))},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(G){switch(v){case 1:case 2:case 3:var le=3;break;default:le=v}var j=v;v=le;try{return G()}finally{v=j}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(G,le){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var j=v;v=G;try{return le()}finally{v=j}},e.unstable_scheduleCallback=function(G,le,j){var F=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?F+j:F):j=F,G){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=j+Q,G={id:m++,callback:le,priorityLevel:G,startTime:j,expirationTime:Q,sortIndex:-1},j>F?(G.sortIndex=j,t(h,G),n(f)===null&&G===n(h)&&(C?(R(B),B=-1):C=!0,we(P,j-F))):(G.sortIndex=Q,t(f,G),S||w||(S=!0,ge(O))),G},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(G){var le=v;return function(){var j=v;v=le;try{return G.apply(this,arguments)}finally{v=j}}}}(Zc)),Zc}var Ug;function mC(){return Ug||(Ug=1,Jc.exports=pC()),Jc.exports}/**
25
+ */var $g;function pC(){return $g||($g=1,function(e){function t(G,le){var j=G.length;G.push(le);e:for(;0<j;){var F=j-1>>>1,Q=G[F];if(0<s(Q,le))G[F]=le,G[j]=Q,j=F;else break e}}function n(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var le=G[0],j=G.pop();if(j!==le){G[0]=j;e:for(var F=0,Q=G.length,M=Q>>>1;F<M;){var Z=2*(F+1)-1,ye=G[Z],me=Z+1,pe=G[me];if(0>s(ye,j))me<Q&&0>s(pe,ye)?(G[F]=pe,G[me]=j,F=me):(G[F]=ye,G[Z]=j,F=Z);else if(me<Q&&0>s(pe,j))G[F]=pe,G[me]=j,F=me;else break e}}return le}function s(G,le){var j=G.sortIndex-le.sortIndex;return j!==0?j:G.id-le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var f=[],h=[],m=1,p=null,v=3,w=!1,S=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(G){for(var le=n(h);le!==null;){if(le.callback===null)i(h);else if(le.startTime<=G)i(h),le.sortIndex=le.expirationTime,t(f,le);else break;le=n(h)}}function P(G){if(C=!1,T(G),!S)if(n(f)!==null)S=!0,ge(O);else{var le=n(h);le!==null&&we(P,le.startTime-G)}}function O(G,le){S=!1,C&&(C=!1,R(B),B=-1),w=!0;var j=v;try{for(T(le),p=n(f);p!==null&&(!(p.expirationTime>le)||G&&!q());){var F=p.callback;if(typeof F=="function"){p.callback=null,v=p.priorityLevel;var Q=F(p.expirationTime<=le);le=e.unstable_now(),typeof Q=="function"?p.callback=Q:p===n(f)&&i(f),T(le)}else i(f);p=n(f)}if(p!==null)var M=!0;else{var Z=n(h);Z!==null&&we(P,Z.startTime-le),M=!1}return M}finally{p=null,v=j,w=!1}}var D=!1,H=null,B=-1,_=5,N=-1;function q(){return!(e.unstable_now()-N<_)}function V(){if(H!==null){var G=e.unstable_now();N=G;var le=!0;try{le=H(!0,G)}finally{le?ae():(D=!1,H=null)}}else D=!1}var ae;if(typeof A=="function")ae=function(){A(V)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,ee=J.port2;J.port1.onmessage=V,ae=function(){ee.postMessage(null)}}else ae=function(){E(V,0)};function ge(G){H=G,D||(D=!0,ae())}function we(G,le){B=E(function(){G(e.unstable_now())},le)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_continueExecution=function(){S||w||(S=!0,ge(O))},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(G){switch(v){case 1:case 2:case 3:var le=3;break;default:le=v}var j=v;v=le;try{return G()}finally{v=j}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(G,le){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var j=v;v=G;try{return le()}finally{v=j}},e.unstable_scheduleCallback=function(G,le,j){var F=e.unstable_now();switch(typeof j=="object"&&j!==null?(j=j.delay,j=typeof j=="number"&&0<j?F+j:F):j=F,G){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=j+Q,G={id:m++,callback:le,priorityLevel:G,startTime:j,expirationTime:Q,sortIndex:-1},j>F?(G.sortIndex=j,t(h,G),n(f)===null&&G===n(h)&&(C?(R(B),B=-1):C=!0,we(P,j-F))):(G.sortIndex=Q,t(f,G),S||w||(S=!0,ge(O))),G},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(G){var le=v;return function(){var j=v;v=le;try{return G.apply(this,arguments)}finally{v=j}}}}(Zc)),Zc}var Ug;function mC(){return Ug||(Ug=1,Jc.exports=pC()),Jc.exports}/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -34,8 +34,8 @@ function cC(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&
34
34
  `+F+r}var M=!1;function Z(r,o){if(!r||M)return"";M=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(K){var d=K}Reflect.construct(r,[],o)}else{try{o.call()}catch(K){d=K}r.call(o.prototype)}else{try{throw Error()}catch(K){d=K}r()}}catch(K){if(K&&d&&typeof K.stack=="string"){for(var g=K.stack.split(`
35
35
  `),x=d.stack.split(`
36
36
  `),b=g.length-1,I=x.length-1;1<=b&&0<=I&&g[b]!==x[I];)I--;for(;1<=b&&0<=I;b--,I--)if(g[b]!==x[I]){if(b!==1||I!==1)do if(b--,I--,0>I||g[b]!==x[I]){var L=`
37
- `+g[b].replace(" at new "," at ");return r.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",r.displayName)),L}while(1<=b&&0<=I);break}}}finally{M=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?Q(r):""}function ye(r){switch(r.tag){case 5:return Q(r.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return r=Z(r.type,!1),r;case 11:return r=Z(r.type.render,!1),r;case 1:return r=Z(r.type,!0),r;default:return""}}function me(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case H:return"Fragment";case D:return"Portal";case _:return"Profiler";case B:return"StrictMode";case ae:return"Suspense";case J:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case N:return(r._context.displayName||"Context")+".Provider";case V:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ee:return o=r.displayName||null,o!==null?o:me(r.type)||"Memo";case ge:o=r._payload,r=r._init;try{return me(r(o))}catch{}}return null}function he(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(o);case 8:return o===B?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function be(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function xe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Be(r){var o=xe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),d=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var g=u.get,x=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return g.call(this)},set:function(b){d=""+b,x.call(this,b)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return d},setValue:function(b){d=""+b},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Oe(r){r._valueTracker||(r._valueTracker=Be(r))}function Ge(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),d="";return r&&(d=xe(r)?r.checked?"true":"false":r.value),r=d,r!==u?(o.setValue(r),!0):!1}function ut(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function it(r,o){var u=o.checked;return j({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function Mt(r,o){var u=o.defaultValue==null?"":o.defaultValue,d=o.checked!=null?o.checked:o.defaultChecked;u=be(o.value!=null?o.value:u),r._wrapperState={initialChecked:d,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Xt(r,o){o=o.checked,o!=null&&T(r,"checked",o,!1)}function Je(r,o){Xt(r,o);var u=be(o.value),d=o.type;if(u!=null)d==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(d==="submit"||d==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?bn(r,o.type,u):o.hasOwnProperty("defaultValue")&&bn(r,o.type,be(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function zt(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var d=o.type;if(!(d!=="submit"&&d!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function bn(r,o,u){(o!=="number"||ut(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var It=Array.isArray;function Yt(r,o,u,d){if(r=r.options,o){o={};for(var g=0;g<u.length;g++)o["$"+u[g]]=!0;for(u=0;u<r.length;u++)g=o.hasOwnProperty("$"+r[u].value),r[u].selected!==g&&(r[u].selected=g),g&&d&&(r[u].defaultSelected=!0)}else{for(u=""+be(u),o=null,g=0;g<r.length;g++){if(r[g].value===u){r[g].selected=!0,d&&(r[g].defaultSelected=!0);return}o!==null||r[g].disabled||(o=r[g])}o!==null&&(o.selected=!0)}}function Tt(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return j({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function We(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(It(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:be(u)}}function Cr(r,o){var u=be(o.value),d=be(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),d!=null&&(r.defaultValue=""+d)}function ur(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function X(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ie(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?X(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var je,Ne=function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,d,g){MSApp.execUnsafeLocalFunction(function(){return r(o,u,d,g)})}:r}(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(je=je||document.createElement("div"),je.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=je.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Fe(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var ot={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},U=["Webkit","ms","Moz","O"];Object.keys(ot).forEach(function(r){U.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),ot[o]=ot[r]})});function ue(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||ot.hasOwnProperty(r)&&ot[r]?(""+o).trim():o+"px"}function fe(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var d=u.indexOf("--")===0,g=ue(u,o[u],d);u==="float"&&(u="cssFloat"),d?r.setProperty(u,g):r[u]=g}}var Ae=j({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(r,o){if(o){if(Ae[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function de(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){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 ze=null;function Gt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Qt=null,ht=null,pt=null;function Ze(r){if(r=Jo(r)){if(typeof Qt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=wa(o),Qt(r.stateNode,r.type,o))}}function Ln(r){ht?pt?pt.push(r):pt=[r]:ht=r}function mn(){if(ht){var r=ht,o=pt;if(pt=ht=null,Ze(r),o)for(r=0;r<o.length;r++)Ze(o[r])}}function Vt(r,o){return r(o)}function _i(){}var Er=!1;function Mo(r,o,u){if(Er)return r(o,u);Er=!0;try{return Vt(r,o,u)}finally{Er=!1,(ht!==null||pt!==null)&&(_i(),mn())}}function oi(r,o){var u=r.stateNode;if(u===null)return null;var d=wa(u);if(d===null)return null;u=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var si=!1;if(c)try{var ai={};Object.defineProperty(ai,"passive",{get:function(){si=!0}}),window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{si=!1}function Io(r,o,u,d,g,x,b,I,L){var K=Array.prototype.slice.call(arguments,3);try{o.apply(u,K)}catch(ne){this.onError(ne)}}var Tr=!1,Y=null,ce=!1,pe=null,$e={onError:function(r){Tr=!0,Y=r}};function Bt(r,o,u,d,g,x,b,I,L){Tr=!1,Y=null,Io.apply($e,arguments)}function sn(r,o,u,d,g,x,b,I,L){if(Bt.apply(this,arguments),Tr){if(Tr){var K=Y;Tr=!1,Y=null}else throw Error(n(198));ce||(ce=!0,pe=K)}}function Pt(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function On(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Dt(r){if(Pt(r)!==r)throw Error(n(188))}function Cn(r){var o=r.alternate;if(!o){if(o=Pt(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,d=o;;){var g=u.return;if(g===null)break;var x=g.alternate;if(x===null){if(d=g.return,d!==null){u=d;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===u)return Dt(g),r;if(x===d)return Dt(g),o;x=x.sibling}throw Error(n(188))}if(u.return!==d.return)u=g,d=x;else{for(var b=!1,I=g.child;I;){if(I===u){b=!0,u=g,d=x;break}if(I===d){b=!0,d=g,u=x;break}I=I.sibling}if(!b){for(I=x.child;I;){if(I===u){b=!0,u=x,d=g;break}if(I===d){b=!0,d=x,u=g;break}I=I.sibling}if(!b)throw Error(n(189))}}if(u.alternate!==d)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function yt(r){return r=Cn(r),r!==null?cr(r):null}function cr(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=cr(r);if(o!==null)return o;r=r.sibling}return null}var fp=t.unstable_scheduleCallback,dp=t.unstable_cancelCallback,kS=t.unstable_shouldYield,SS=t.unstable_requestPaint,vt=t.unstable_now,bS=t.unstable_getCurrentPriorityLevel,mu=t.unstable_ImmediatePriority,hp=t.unstable_UserBlockingPriority,ea=t.unstable_NormalPriority,CS=t.unstable_LowPriority,pp=t.unstable_IdlePriority,ta=null,Gn=null;function ES(r){if(Gn&&typeof Gn.onCommitFiberRoot=="function")try{Gn.onCommitFiberRoot(ta,r,void 0,(r.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:RS,TS=Math.log,PS=Math.LN2;function RS(r){return r>>>=0,r===0?32:31-(TS(r)/PS|0)|0}var na=64,ra=4194304;function Do(r){switch(r&-r){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: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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function ia(r,o){var u=r.pendingLanes;if(u===0)return 0;var d=0,g=r.suspendedLanes,x=r.pingedLanes,b=u&268435455;if(b!==0){var I=b&~g;I!==0?d=Do(I):(x&=b,x!==0&&(d=Do(x)))}else b=u&~g,b!==0?d=Do(b):x!==0&&(d=Do(x));if(d===0)return 0;if(o!==0&&o!==d&&(o&g)===0&&(g=d&-d,x=o&-o,g>=x||g===16&&(x&4194240)!==0))return o;if((d&4)!==0&&(d|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=d;0<o;)u=31-Fn(o),g=1<<u,d|=r[u],o&=~g;return d}function AS(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jS(r,o){for(var u=r.suspendedLanes,d=r.pingedLanes,g=r.expirationTimes,x=r.pendingLanes;0<x;){var b=31-Fn(x),I=1<<b,L=g[b];L===-1?((I&u)===0||(I&d)!==0)&&(g[b]=AS(I,o)):L<=o&&(r.expiredLanes|=I),x&=~I}}function gu(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function mp(){var r=na;return na<<=1,(na&4194240)===0&&(na=64),r}function yu(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function _o(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-Fn(o),r[o]=u}function NS(r,o){var u=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var d=r.eventTimes;for(r=r.expirationTimes;0<u;){var g=31-Fn(u),x=1<<g;o[g]=0,d[g]=-1,r[g]=-1,u&=~x}}function vu(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var d=31-Fn(u),g=1<<d;g&o|r[d]&o&&(r[d]|=o),u&=~g}}var Qe=0;function gp(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var yp,xu,vp,xp,wp,wu=!1,oa=[],Pr=null,Rr=null,Ar=null,Lo=new Map,Oo=new Map,jr=[],MS="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 submit".split(" ");function kp(r,o){switch(r){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Rr=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":Lo.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(o.pointerId)}}function Fo(r,o,u,d,g,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:u,eventSystemFlags:d,nativeEvent:x,targetContainers:[g]},o!==null&&(o=Jo(o),o!==null&&xu(o)),r):(r.eventSystemFlags|=d,o=r.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),r)}function IS(r,o,u,d,g){switch(o){case"focusin":return Pr=Fo(Pr,r,o,u,d,g),!0;case"dragenter":return Rr=Fo(Rr,r,o,u,d,g),!0;case"mouseover":return Ar=Fo(Ar,r,o,u,d,g),!0;case"pointerover":var x=g.pointerId;return Lo.set(x,Fo(Lo.get(x)||null,r,o,u,d,g)),!0;case"gotpointercapture":return x=g.pointerId,Oo.set(x,Fo(Oo.get(x)||null,r,o,u,d,g)),!0}return!1}function Sp(r){var o=li(r.target);if(o!==null){var u=Pt(o);if(u!==null){if(o=u.tag,o===13){if(o=On(u),o!==null){r.blockedOn=o,wp(r.priority,function(){vp(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function sa(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Su(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);ze=d,u.target.dispatchEvent(d),ze=null}else return o=Jo(u),o!==null&&xu(o),r.blockedOn=u,!1;o.shift()}return!0}function bp(r,o,u){sa(r)&&u.delete(o)}function DS(){wu=!1,Pr!==null&&sa(Pr)&&(Pr=null),Rr!==null&&sa(Rr)&&(Rr=null),Ar!==null&&sa(Ar)&&(Ar=null),Lo.forEach(bp),Oo.forEach(bp)}function zo(r,o){r.blockedOn===o&&(r.blockedOn=null,wu||(wu=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,DS)))}function Vo(r){function o(g){return zo(g,r)}if(0<oa.length){zo(oa[0],r);for(var u=1;u<oa.length;u++){var d=oa[u];d.blockedOn===r&&(d.blockedOn=null)}}for(Pr!==null&&zo(Pr,r),Rr!==null&&zo(Rr,r),Ar!==null&&zo(Ar,r),Lo.forEach(o),Oo.forEach(o),u=0;u<jr.length;u++)d=jr[u],d.blockedOn===r&&(d.blockedOn=null);for(;0<jr.length&&(u=jr[0],u.blockedOn===null);)Sp(u),u.blockedOn===null&&jr.shift()}var Li=P.ReactCurrentBatchConfig,aa=!0;function _S(r,o,u,d){var g=Qe,x=Li.transition;Li.transition=null;try{Qe=1,ku(r,o,u,d)}finally{Qe=g,Li.transition=x}}function LS(r,o,u,d){var g=Qe,x=Li.transition;Li.transition=null;try{Qe=4,ku(r,o,u,d)}finally{Qe=g,Li.transition=x}}function ku(r,o,u,d){if(aa){var g=Su(r,o,u,d);if(g===null)zu(r,o,d,la,u),kp(r,d);else if(IS(g,r,o,u,d))d.stopPropagation();else if(kp(r,d),o&4&&-1<MS.indexOf(r)){for(;g!==null;){var x=Jo(g);if(x!==null&&yp(x),x=Su(r,o,u,d),x===null&&zu(r,o,d,la,u),x===g)break;g=x}g!==null&&d.stopPropagation()}else zu(r,o,d,null,u)}}var la=null;function Su(r,o,u,d){if(la=null,r=Gt(d),r=li(r),r!==null)if(o=Pt(r),o===null)r=null;else if(u=o.tag,u===13){if(r=On(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return la=r,null}function Cp(r){switch(r){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(bS()){case mu:return 1;case hp:return 4;case ea:case CS:return 16;case pp:return 536870912;default:return 16}default:return 16}}var Nr=null,bu=null,ua=null;function Ep(){if(ua)return ua;var r,o=bu,u=o.length,d,g="value"in Nr?Nr.value:Nr.textContent,x=g.length;for(r=0;r<u&&o[r]===g[r];r++);var b=u-r;for(d=1;d<=b&&o[u-d]===g[x-d];d++);return ua=g.slice(r,1<d?1-d:void 0)}function ca(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function fa(){return!0}function Tp(){return!1}function gn(r){function o(u,d,g,x,b){this._reactName=u,this._targetInst=g,this.type=d,this.nativeEvent=x,this.target=b,this.currentTarget=null;for(var I in r)r.hasOwnProperty(I)&&(u=r[I],this[I]=u?u(x):x[I]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fa:Tp,this.isPropagationStopped=Tp,this}return j(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=fa)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fa)},persist:function(){},isPersistent:fa}),o}var Oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cu=gn(Oi),Bo=j({},Oi,{view:0,detail:0}),OS=gn(Bo),Eu,Tu,$o,da=j({},Bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ru,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==$o&&($o&&r.type==="mousemove"?(Eu=r.screenX-$o.screenX,Tu=r.screenY-$o.screenY):Tu=Eu=0,$o=r),Eu)},movementY:function(r){return"movementY"in r?r.movementY:Tu}}),Pp=gn(da),FS=j({},da,{dataTransfer:0}),zS=gn(FS),VS=j({},Bo,{relatedTarget:0}),Pu=gn(VS),BS=j({},Oi,{animationName:0,elapsedTime:0,pseudoElement:0}),$S=gn(BS),US=j({},Oi,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),WS=gn(US),HS=j({},Oi,{data:0}),Rp=gn(HS),KS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qS={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"},XS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YS(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=XS[r])?!!o[r]:!1}function Ru(){return YS}var GS=j({},Bo,{key:function(r){if(r.key){var o=KS[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ca(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?qS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ru,charCode:function(r){return r.type==="keypress"?ca(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ca(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),QS=gn(GS),JS=j({},da,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ap=gn(JS),ZS=j({},Bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ru}),eb=gn(ZS),tb=j({},Oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),nb=gn(tb),rb=j({},da,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),ib=gn(rb),ob=[9,13,27,32],Au=c&&"CompositionEvent"in window,Uo=null;c&&"documentMode"in document&&(Uo=document.documentMode);var sb=c&&"TextEvent"in window&&!Uo,jp=c&&(!Au||Uo&&8<Uo&&11>=Uo),Np=" ",Mp=!1;function Ip(r,o){switch(r){case"keyup":return ob.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dp(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Fi=!1;function ab(r,o){switch(r){case"compositionend":return Dp(o);case"keypress":return o.which!==32?null:(Mp=!0,Np);case"textInput":return r=o.data,r===Np&&Mp?null:r;default:return null}}function lb(r,o){if(Fi)return r==="compositionend"||!Au&&Ip(r,o)?(r=Ep(),ua=bu=Nr=null,Fi=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return jp&&o.locale!=="ko"?null:o.data;default:return null}}var ub={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 _p(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!ub[r.type]:o==="textarea"}function Lp(r,o,u,d){Ln(d),o=ya(o,"onChange"),0<o.length&&(u=new Cu("onChange","change",null,u,d),r.push({event:u,listeners:o}))}var Wo=null,Ho=null;function cb(r){em(r,0)}function ha(r){var o=Ui(r);if(Ge(o))return r}function fb(r,o){if(r==="change")return o}var Op=!1;if(c){var ju;if(c){var Nu="oninput"in document;if(!Nu){var Fp=document.createElement("div");Fp.setAttribute("oninput","return;"),Nu=typeof Fp.oninput=="function"}ju=Nu}else ju=!1;Op=ju&&(!document.documentMode||9<document.documentMode)}function zp(){Wo&&(Wo.detachEvent("onpropertychange",Vp),Ho=Wo=null)}function Vp(r){if(r.propertyName==="value"&&ha(Ho)){var o=[];Lp(o,Ho,r,Gt(r)),Mo(cb,o)}}function db(r,o,u){r==="focusin"?(zp(),Wo=o,Ho=u,Wo.attachEvent("onpropertychange",Vp)):r==="focusout"&&zp()}function hb(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ha(Ho)}function pb(r,o){if(r==="click")return ha(o)}function mb(r,o){if(r==="input"||r==="change")return ha(o)}function gb(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var zn=typeof Object.is=="function"?Object.is:gb;function Ko(r,o){if(zn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),d=Object.keys(o);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var g=u[d];if(!f.call(o,g)||!zn(r[g],o[g]))return!1}return!0}function Bp(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function $p(r,o){var u=Bp(r);r=0;for(var d;u;){if(u.nodeType===3){if(d=r+u.textContent.length,r<=o&&d>=o)return{node:u,offset:o-r};r=d}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Bp(u)}}function Up(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Up(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Wp(){for(var r=window,o=ut();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=ut(r.document)}return o}function Mu(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function yb(r){var o=Wp(),u=r.focusedElem,d=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Up(u.ownerDocument.documentElement,u)){if(d!==null&&Mu(u)){if(o=d.start,r=d.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var g=u.textContent.length,x=Math.min(d.start,g);d=d.end===void 0?x:Math.min(d.end,g),!r.extend&&x>d&&(g=d,d=x,x=g),g=$p(u,x);var b=$p(u,d);g&&b&&(r.rangeCount!==1||r.anchorNode!==g.node||r.anchorOffset!==g.offset||r.focusNode!==b.node||r.focusOffset!==b.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),r.removeAllRanges(),x>d?(r.addRange(o),r.extend(b.node,b.offset)):(o.setEnd(b.node,b.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var vb=c&&"documentMode"in document&&11>=document.documentMode,zi=null,Iu=null,qo=null,Du=!1;function Hp(r,o,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Du||zi==null||zi!==ut(d)||(d=zi,"selectionStart"in d&&Mu(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),qo&&Ko(qo,d)||(qo=d,d=ya(Iu,"onSelect"),0<d.length&&(o=new Cu("onSelect","select",null,o,u),r.push({event:o,listeners:d}),o.target=zi)))}function pa(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Vi={animationend:pa("Animation","AnimationEnd"),animationiteration:pa("Animation","AnimationIteration"),animationstart:pa("Animation","AnimationStart"),transitionend:pa("Transition","TransitionEnd")},_u={},Kp={};c&&(Kp=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function ma(r){if(_u[r])return _u[r];if(!Vi[r])return r;var o=Vi[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in Kp)return _u[r]=o[u];return r}var qp=ma("animationend"),Xp=ma("animationiteration"),Yp=ma("animationstart"),Gp=ma("transitionend"),Qp=new Map,Jp="abort auxClick 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(" ");function Mr(r,o){Qp.set(r,o),a(o,[r])}for(var Lu=0;Lu<Jp.length;Lu++){var Ou=Jp[Lu],xb=Ou.toLowerCase(),wb=Ou[0].toUpperCase()+Ou.slice(1);Mr(xb,"on"+wb)}Mr(qp,"onAnimationEnd"),Mr(Xp,"onAnimationIteration"),Mr(Yp,"onAnimationStart"),Mr("dblclick","onDoubleClick"),Mr("focusin","onFocus"),Mr("focusout","onBlur"),Mr(Gp,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xo="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(" "),kb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xo));function Zp(r,o,u){var d=r.type||"unknown-event";r.currentTarget=u,sn(d,o,void 0,r),r.currentTarget=null}function em(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],g=d.event;d=d.listeners;e:{var x=void 0;if(o)for(var b=d.length-1;0<=b;b--){var I=d[b],L=I.instance,K=I.currentTarget;if(I=I.listener,L!==x&&g.isPropagationStopped())break e;Zp(g,I,K),x=L}else for(b=0;b<d.length;b++){if(I=d[b],L=I.instance,K=I.currentTarget,I=I.listener,L!==x&&g.isPropagationStopped())break e;Zp(g,I,K),x=L}}}if(ce)throw r=pe,ce=!1,pe=null,r}function at(r,o){var u=o[Hu];u===void 0&&(u=o[Hu]=new Set);var d=r+"__bubble";u.has(d)||(tm(o,r,2,!1),u.add(d))}function Fu(r,o,u){var d=0;o&&(d|=4),tm(u,r,d,o)}var ga="_reactListening"+Math.random().toString(36).slice(2);function Yo(r){if(!r[ga]){r[ga]=!0,i.forEach(function(u){u!=="selectionchange"&&(kb.has(u)||Fu(u,!1,r),Fu(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[ga]||(o[ga]=!0,Fu("selectionchange",!1,o))}}function tm(r,o,u,d){switch(Cp(o)){case 1:var g=_S;break;case 4:g=LS;break;default:g=ku}u=g.bind(null,o,u,r),g=void 0,!si||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(g=!0),d?g!==void 0?r.addEventListener(o,u,{capture:!0,passive:g}):r.addEventListener(o,u,!0):g!==void 0?r.addEventListener(o,u,{passive:g}):r.addEventListener(o,u,!1)}function zu(r,o,u,d,g){var x=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var b=d.tag;if(b===3||b===4){var I=d.stateNode.containerInfo;if(I===g||I.nodeType===8&&I.parentNode===g)break;if(b===4)for(b=d.return;b!==null;){var L=b.tag;if((L===3||L===4)&&(L=b.stateNode.containerInfo,L===g||L.nodeType===8&&L.parentNode===g))return;b=b.return}for(;I!==null;){if(b=li(I),b===null)return;if(L=b.tag,L===5||L===6){d=x=b;continue e}I=I.parentNode}}d=d.return}Mo(function(){var K=x,ne=Gt(u),re=[];e:{var te=Qp.get(r);if(te!==void 0){var ve=Cu,Ce=r;switch(r){case"keypress":if(ca(u)===0)break e;case"keydown":case"keyup":ve=QS;break;case"focusin":Ce="focus",ve=Pu;break;case"focusout":Ce="blur",ve=Pu;break;case"beforeblur":case"afterblur":ve=Pu;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=Pp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=zS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=eb;break;case qp:case Xp:case Yp:ve=$S;break;case Gp:ve=nb;break;case"scroll":ve=OS;break;case"wheel":ve=ib;break;case"copy":case"cut":case"paste":ve=WS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=Ap}var Te=(o&4)!==0,xt=!Te&&r==="scroll",$=Te?te!==null?te+"Capture":null:te;Te=[];for(var z=K,W;z!==null;){W=z;var se=W.stateNode;if(W.tag===5&&se!==null&&(W=se,$!==null&&(se=oi(z,$),se!=null&&Te.push(Go(z,se,W)))),xt)break;z=z.return}0<Te.length&&(te=new ve(te,Ce,null,u,ne),re.push({event:te,listeners:Te}))}}if((o&7)===0){e:{if(te=r==="mouseover"||r==="pointerover",ve=r==="mouseout"||r==="pointerout",te&&u!==ze&&(Ce=u.relatedTarget||u.fromElement)&&(li(Ce)||Ce[fr]))break e;if((ve||te)&&(te=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,ve?(Ce=u.relatedTarget||u.toElement,ve=K,Ce=Ce?li(Ce):null,Ce!==null&&(xt=Pt(Ce),Ce!==xt||Ce.tag!==5&&Ce.tag!==6)&&(Ce=null)):(ve=null,Ce=K),ve!==Ce)){if(Te=Pp,se="onMouseLeave",$="onMouseEnter",z="mouse",(r==="pointerout"||r==="pointerover")&&(Te=Ap,se="onPointerLeave",$="onPointerEnter",z="pointer"),xt=ve==null?te:Ui(ve),W=Ce==null?te:Ui(Ce),te=new Te(se,z+"leave",ve,u,ne),te.target=xt,te.relatedTarget=W,se=null,li(ne)===K&&(Te=new Te($,z+"enter",Ce,u,ne),Te.target=W,Te.relatedTarget=xt,se=Te),xt=se,ve&&Ce)t:{for(Te=ve,$=Ce,z=0,W=Te;W;W=Bi(W))z++;for(W=0,se=$;se;se=Bi(se))W++;for(;0<z-W;)Te=Bi(Te),z--;for(;0<W-z;)$=Bi($),W--;for(;z--;){if(Te===$||$!==null&&Te===$.alternate)break t;Te=Bi(Te),$=Bi($)}Te=null}else Te=null;ve!==null&&nm(re,te,ve,Te,!1),Ce!==null&&xt!==null&&nm(re,xt,Ce,Te,!0)}}e:{if(te=K?Ui(K):window,ve=te.nodeName&&te.nodeName.toLowerCase(),ve==="select"||ve==="input"&&te.type==="file")var Re=fb;else if(_p(te))if(Op)Re=mb;else{Re=hb;var Me=db}else(ve=te.nodeName)&&ve.toLowerCase()==="input"&&(te.type==="checkbox"||te.type==="radio")&&(Re=pb);if(Re&&(Re=Re(r,K))){Lp(re,Re,u,ne);break e}Me&&Me(r,te,K),r==="focusout"&&(Me=te._wrapperState)&&Me.controlled&&te.type==="number"&&bn(te,"number",te.value)}switch(Me=K?Ui(K):window,r){case"focusin":(_p(Me)||Me.contentEditable==="true")&&(zi=Me,Iu=K,qo=null);break;case"focusout":qo=Iu=zi=null;break;case"mousedown":Du=!0;break;case"contextmenu":case"mouseup":case"dragend":Du=!1,Hp(re,u,ne);break;case"selectionchange":if(vb)break;case"keydown":case"keyup":Hp(re,u,ne)}var Ie;if(Au)e:{switch(r){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else Fi?Ip(r,u)&&(_e="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(_e="onCompositionStart");_e&&(jp&&u.locale!=="ko"&&(Fi||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Fi&&(Ie=Ep()):(Nr=ne,bu="value"in Nr?Nr.value:Nr.textContent,Fi=!0)),Me=ya(K,_e),0<Me.length&&(_e=new Rp(_e,r,null,u,ne),re.push({event:_e,listeners:Me}),Ie?_e.data=Ie:(Ie=Dp(u),Ie!==null&&(_e.data=Ie)))),(Ie=sb?ab(r,u):lb(r,u))&&(K=ya(K,"onBeforeInput"),0<K.length&&(ne=new Rp("onBeforeInput","beforeinput",null,u,ne),re.push({event:ne,listeners:K}),ne.data=Ie))}em(re,o)})}function Go(r,o,u){return{instance:r,listener:o,currentTarget:u}}function ya(r,o){for(var u=o+"Capture",d=[];r!==null;){var g=r,x=g.stateNode;g.tag===5&&x!==null&&(g=x,x=oi(r,u),x!=null&&d.unshift(Go(r,x,g)),x=oi(r,o),x!=null&&d.push(Go(r,x,g))),r=r.return}return d}function Bi(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function nm(r,o,u,d,g){for(var x=o._reactName,b=[];u!==null&&u!==d;){var I=u,L=I.alternate,K=I.stateNode;if(L!==null&&L===d)break;I.tag===5&&K!==null&&(I=K,g?(L=oi(u,x),L!=null&&b.unshift(Go(u,L,I))):g||(L=oi(u,x),L!=null&&b.push(Go(u,L,I)))),u=u.return}b.length!==0&&r.push({event:o,listeners:b})}var Sb=/\r\n?/g,bb=/\u0000|\uFFFD/g;function rm(r){return(typeof r=="string"?r:""+r).replace(Sb,`
38
- `).replace(bb,"")}function va(r,o,u){if(o=rm(o),rm(r)!==o&&u)throw Error(n(425))}function xa(){}var Vu=null,Bu=null;function $u(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Uu=typeof setTimeout=="function"?setTimeout:void 0,Cb=typeof clearTimeout=="function"?clearTimeout:void 0,im=typeof Promise=="function"?Promise:void 0,Eb=typeof queueMicrotask=="function"?queueMicrotask:typeof im<"u"?function(r){return im.resolve(null).then(r).catch(Tb)}:Uu;function Tb(r){setTimeout(function(){throw r})}function Wu(r,o){var u=o,d=0;do{var g=u.nextSibling;if(r.removeChild(u),g&&g.nodeType===8)if(u=g.data,u==="/$"){if(d===0){r.removeChild(g),Vo(o);return}d--}else u!=="$"&&u!=="$?"&&u!=="$!"||d++;u=g}while(u);Vo(o)}function Ir(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function om(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var $i=Math.random().toString(36).slice(2),Qn="__reactFiber$"+$i,Qo="__reactProps$"+$i,fr="__reactContainer$"+$i,Hu="__reactEvents$"+$i,Pb="__reactListeners$"+$i,Rb="__reactHandles$"+$i;function li(r){var o=r[Qn];if(o)return o;for(var u=r.parentNode;u;){if(o=u[fr]||u[Qn]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=om(r);r!==null;){if(u=r[Qn])return u;r=om(r)}return o}r=u,u=r.parentNode}return null}function Jo(r){return r=r[Qn]||r[fr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Ui(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function wa(r){return r[Qo]||null}var Ku=[],Wi=-1;function Dr(r){return{current:r}}function lt(r){0>Wi||(r.current=Ku[Wi],Ku[Wi]=null,Wi--)}function st(r,o){Wi++,Ku[Wi]=r.current,r.current=o}var _r={},$t=Dr(_r),an=Dr(!1),ui=_r;function Hi(r,o){var u=r.type.contextTypes;if(!u)return _r;var d=r.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===o)return d.__reactInternalMemoizedMaskedChildContext;var g={},x;for(x in u)g[x]=o[x];return d&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=g),g}function ln(r){return r=r.childContextTypes,r!=null}function ka(){lt(an),lt($t)}function sm(r,o,u){if($t.current!==_r)throw Error(n(168));st($t,o),st(an,u)}function am(r,o,u){var d=r.stateNode;if(o=o.childContextTypes,typeof d.getChildContext!="function")return u;d=d.getChildContext();for(var g in d)if(!(g in o))throw Error(n(108,he(r)||"Unknown",g));return j({},u,d)}function Sa(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||_r,ui=$t.current,st($t,r),st(an,an.current),!0}function lm(r,o,u){var d=r.stateNode;if(!d)throw Error(n(169));u?(r=am(r,o,ui),d.__reactInternalMemoizedMergedChildContext=r,lt(an),lt($t),st($t,r)):lt(an),st(an,u)}var dr=null,ba=!1,qu=!1;function um(r){dr===null?dr=[r]:dr.push(r)}function Ab(r){ba=!0,um(r)}function Lr(){if(!qu&&dr!==null){qu=!0;var r=0,o=Qe;try{var u=dr;for(Qe=1;r<u.length;r++){var d=u[r];do d=d(!0);while(d!==null)}dr=null,ba=!1}catch(g){throw dr!==null&&(dr=dr.slice(r+1)),fp(mu,Lr),g}finally{Qe=o,qu=!1}}return null}var Ki=[],qi=0,Ca=null,Ea=0,En=[],Tn=0,ci=null,hr=1,pr="";function fi(r,o){Ki[qi++]=Ea,Ki[qi++]=Ca,Ca=r,Ea=o}function cm(r,o,u){En[Tn++]=hr,En[Tn++]=pr,En[Tn++]=ci,ci=r;var d=hr;r=pr;var g=32-Fn(d)-1;d&=~(1<<g),u+=1;var x=32-Fn(o)+g;if(30<x){var b=g-g%5;x=(d&(1<<b)-1).toString(32),d>>=b,g-=b,hr=1<<32-Fn(o)+g|u<<g|d,pr=x+r}else hr=1<<x|u<<g|d,pr=r}function Xu(r){r.return!==null&&(fi(r,1),cm(r,1,0))}function Yu(r){for(;r===Ca;)Ca=Ki[--qi],Ki[qi]=null,Ea=Ki[--qi],Ki[qi]=null;for(;r===ci;)ci=En[--Tn],En[Tn]=null,pr=En[--Tn],En[Tn]=null,hr=En[--Tn],En[Tn]=null}var yn=null,vn=null,ct=!1,Vn=null;function fm(r,o){var u=jn(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function dm(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,yn=r,vn=Ir(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,yn=r,vn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=ci!==null?{id:hr,overflow:pr}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=jn(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,yn=r,vn=null,!0):!1;default:return!1}}function Gu(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Qu(r){if(ct){var o=vn;if(o){var u=o;if(!dm(r,o)){if(Gu(r))throw Error(n(418));o=Ir(u.nextSibling);var d=yn;o&&dm(r,o)?fm(d,u):(r.flags=r.flags&-4097|2,ct=!1,yn=r)}}else{if(Gu(r))throw Error(n(418));r.flags=r.flags&-4097|2,ct=!1,yn=r}}}function hm(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;yn=r}function Ta(r){if(r!==yn)return!1;if(!ct)return hm(r),ct=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!$u(r.type,r.memoizedProps)),o&&(o=vn)){if(Gu(r))throw pm(),Error(n(418));for(;o;)fm(r,o),o=Ir(o.nextSibling)}if(hm(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(o===0){vn=Ir(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}vn=null}}else vn=yn?Ir(r.stateNode.nextSibling):null;return!0}function pm(){for(var r=vn;r;)r=Ir(r.nextSibling)}function Xi(){vn=yn=null,ct=!1}function Ju(r){Vn===null?Vn=[r]:Vn.push(r)}var jb=P.ReactCurrentBatchConfig;function Zo(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var d=u.stateNode}if(!d)throw Error(n(147,r));var g=d,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(b){var I=g.refs;b===null?delete I[x]:I[x]=b},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Pa(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function mm(r){var o=r._init;return o(r._payload)}function gm(r){function o($,z){if(r){var W=$.deletions;W===null?($.deletions=[z],$.flags|=16):W.push(z)}}function u($,z){if(!r)return null;for(;z!==null;)o($,z),z=z.sibling;return null}function d($,z){for($=new Map;z!==null;)z.key!==null?$.set(z.key,z):$.set(z.index,z),z=z.sibling;return $}function g($,z){return $=Wr($,z),$.index=0,$.sibling=null,$}function x($,z,W){return $.index=W,r?(W=$.alternate,W!==null?(W=W.index,W<z?($.flags|=2,z):W):($.flags|=2,z)):($.flags|=1048576,z)}function b($){return r&&$.alternate===null&&($.flags|=2),$}function I($,z,W,se){return z===null||z.tag!==6?(z=Uc(W,$.mode,se),z.return=$,z):(z=g(z,W),z.return=$,z)}function L($,z,W,se){var Re=W.type;return Re===H?ne($,z,W.props.children,se,W.key):z!==null&&(z.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ge&&mm(Re)===z.type)?(se=g(z,W.props),se.ref=Zo($,z,W),se.return=$,se):(se=Qa(W.type,W.key,W.props,null,$.mode,se),se.ref=Zo($,z,W),se.return=$,se)}function K($,z,W,se){return z===null||z.tag!==4||z.stateNode.containerInfo!==W.containerInfo||z.stateNode.implementation!==W.implementation?(z=Wc(W,$.mode,se),z.return=$,z):(z=g(z,W.children||[]),z.return=$,z)}function ne($,z,W,se,Re){return z===null||z.tag!==7?(z=xi(W,$.mode,se,Re),z.return=$,z):(z=g(z,W),z.return=$,z)}function re($,z,W){if(typeof z=="string"&&z!==""||typeof z=="number")return z=Uc(""+z,$.mode,W),z.return=$,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case O:return W=Qa(z.type,z.key,z.props,null,$.mode,W),W.ref=Zo($,null,z),W.return=$,W;case D:return z=Wc(z,$.mode,W),z.return=$,z;case ge:var se=z._init;return re($,se(z._payload),W)}if(It(z)||le(z))return z=xi(z,$.mode,W,null),z.return=$,z;Pa($,z)}return null}function te($,z,W,se){var Re=z!==null?z.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return Re!==null?null:I($,z,""+W,se);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case O:return W.key===Re?L($,z,W,se):null;case D:return W.key===Re?K($,z,W,se):null;case ge:return Re=W._init,te($,z,Re(W._payload),se)}if(It(W)||le(W))return Re!==null?null:ne($,z,W,se,null);Pa($,W)}return null}function ve($,z,W,se,Re){if(typeof se=="string"&&se!==""||typeof se=="number")return $=$.get(W)||null,I(z,$,""+se,Re);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case O:return $=$.get(se.key===null?W:se.key)||null,L(z,$,se,Re);case D:return $=$.get(se.key===null?W:se.key)||null,K(z,$,se,Re);case ge:var Me=se._init;return ve($,z,W,Me(se._payload),Re)}if(It(se)||le(se))return $=$.get(W)||null,ne(z,$,se,Re,null);Pa(z,se)}return null}function Ce($,z,W,se){for(var Re=null,Me=null,Ie=z,_e=z=0,jt=null;Ie!==null&&_e<W.length;_e++){Ie.index>_e?(jt=Ie,Ie=null):jt=Ie.sibling;var Xe=te($,Ie,W[_e],se);if(Xe===null){Ie===null&&(Ie=jt);break}r&&Ie&&Xe.alternate===null&&o($,Ie),z=x(Xe,z,_e),Me===null?Re=Xe:Me.sibling=Xe,Me=Xe,Ie=jt}if(_e===W.length)return u($,Ie),ct&&fi($,_e),Re;if(Ie===null){for(;_e<W.length;_e++)Ie=re($,W[_e],se),Ie!==null&&(z=x(Ie,z,_e),Me===null?Re=Ie:Me.sibling=Ie,Me=Ie);return ct&&fi($,_e),Re}for(Ie=d($,Ie);_e<W.length;_e++)jt=ve(Ie,$,_e,W[_e],se),jt!==null&&(r&&jt.alternate!==null&&Ie.delete(jt.key===null?_e:jt.key),z=x(jt,z,_e),Me===null?Re=jt:Me.sibling=jt,Me=jt);return r&&Ie.forEach(function(Hr){return o($,Hr)}),ct&&fi($,_e),Re}function Te($,z,W,se){var Re=le(W);if(typeof Re!="function")throw Error(n(150));if(W=Re.call(W),W==null)throw Error(n(151));for(var Me=Re=null,Ie=z,_e=z=0,jt=null,Xe=W.next();Ie!==null&&!Xe.done;_e++,Xe=W.next()){Ie.index>_e?(jt=Ie,Ie=null):jt=Ie.sibling;var Hr=te($,Ie,Xe.value,se);if(Hr===null){Ie===null&&(Ie=jt);break}r&&Ie&&Hr.alternate===null&&o($,Ie),z=x(Hr,z,_e),Me===null?Re=Hr:Me.sibling=Hr,Me=Hr,Ie=jt}if(Xe.done)return u($,Ie),ct&&fi($,_e),Re;if(Ie===null){for(;!Xe.done;_e++,Xe=W.next())Xe=re($,Xe.value,se),Xe!==null&&(z=x(Xe,z,_e),Me===null?Re=Xe:Me.sibling=Xe,Me=Xe);return ct&&fi($,_e),Re}for(Ie=d($,Ie);!Xe.done;_e++,Xe=W.next())Xe=ve(Ie,$,_e,Xe.value,se),Xe!==null&&(r&&Xe.alternate!==null&&Ie.delete(Xe.key===null?_e:Xe.key),z=x(Xe,z,_e),Me===null?Re=Xe:Me.sibling=Xe,Me=Xe);return r&&Ie.forEach(function(uC){return o($,uC)}),ct&&fi($,_e),Re}function xt($,z,W,se){if(typeof W=="object"&&W!==null&&W.type===H&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case O:e:{for(var Re=W.key,Me=z;Me!==null;){if(Me.key===Re){if(Re=W.type,Re===H){if(Me.tag===7){u($,Me.sibling),z=g(Me,W.props.children),z.return=$,$=z;break e}}else if(Me.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ge&&mm(Re)===Me.type){u($,Me.sibling),z=g(Me,W.props),z.ref=Zo($,Me,W),z.return=$,$=z;break e}u($,Me);break}else o($,Me);Me=Me.sibling}W.type===H?(z=xi(W.props.children,$.mode,se,W.key),z.return=$,$=z):(se=Qa(W.type,W.key,W.props,null,$.mode,se),se.ref=Zo($,z,W),se.return=$,$=se)}return b($);case D:e:{for(Me=W.key;z!==null;){if(z.key===Me)if(z.tag===4&&z.stateNode.containerInfo===W.containerInfo&&z.stateNode.implementation===W.implementation){u($,z.sibling),z=g(z,W.children||[]),z.return=$,$=z;break e}else{u($,z);break}else o($,z);z=z.sibling}z=Wc(W,$.mode,se),z.return=$,$=z}return b($);case ge:return Me=W._init,xt($,z,Me(W._payload),se)}if(It(W))return Ce($,z,W,se);if(le(W))return Te($,z,W,se);Pa($,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,z!==null&&z.tag===6?(u($,z.sibling),z=g(z,W),z.return=$,$=z):(u($,z),z=Uc(W,$.mode,se),z.return=$,$=z),b($)):u($,z)}return xt}var Yi=gm(!0),ym=gm(!1),Ra=Dr(null),Aa=null,Gi=null,Zu=null;function ec(){Zu=Gi=Aa=null}function tc(r){var o=Ra.current;lt(Ra),r._currentValue=o}function nc(r,o,u){for(;r!==null;){var d=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),r===u)break;r=r.return}}function Qi(r,o){Aa=r,Zu=Gi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(un=!0),r.firstContext=null)}function Pn(r){var o=r._currentValue;if(Zu!==r)if(r={context:r,memoizedValue:o,next:null},Gi===null){if(Aa===null)throw Error(n(308));Gi=r,Aa.dependencies={lanes:0,firstContext:r}}else Gi=Gi.next=r;return o}var di=null;function rc(r){di===null?di=[r]:di.push(r)}function vm(r,o,u,d){var g=o.interleaved;return g===null?(u.next=u,rc(o)):(u.next=g.next,g.next=u),o.interleaved=u,mr(r,d)}function mr(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Or=!1;function ic(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xm(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function gr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Fr(r,o,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(qe&2)!==0){var g=d.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),d.pending=o,mr(r,u)}return g=d.interleaved,g===null?(o.next=o,rc(d)):(o.next=g.next,g.next=o),d.interleaved=o,mr(r,u)}function ja(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var d=o.lanes;d&=r.pendingLanes,u|=d,o.lanes=u,vu(r,u)}}function wm(r,o){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var g=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var b={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};x===null?g=x=b:x=x.next=b,u=u.next}while(u!==null);x===null?g=x=o:x=x.next=o}else g=x=o;u={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:d.shared,effects:d.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Na(r,o,u,d){var g=r.updateQueue;Or=!1;var x=g.firstBaseUpdate,b=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var L=I,K=L.next;L.next=null,b===null?x=K:b.next=K,b=L;var ne=r.alternate;ne!==null&&(ne=ne.updateQueue,I=ne.lastBaseUpdate,I!==b&&(I===null?ne.firstBaseUpdate=K:I.next=K,ne.lastBaseUpdate=L))}if(x!==null){var re=g.baseState;b=0,ne=K=L=null,I=x;do{var te=I.lane,ve=I.eventTime;if((d&te)===te){ne!==null&&(ne=ne.next={eventTime:ve,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var Ce=r,Te=I;switch(te=o,ve=u,Te.tag){case 1:if(Ce=Te.payload,typeof Ce=="function"){re=Ce.call(ve,re,te);break e}re=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Te.payload,te=typeof Ce=="function"?Ce.call(ve,re,te):Ce,te==null)break e;re=j({},re,te);break e;case 2:Or=!0}}I.callback!==null&&I.lane!==0&&(r.flags|=64,te=g.effects,te===null?g.effects=[I]:te.push(I))}else ve={eventTime:ve,lane:te,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ne===null?(K=ne=ve,L=re):ne=ne.next=ve,b|=te;if(I=I.next,I===null){if(I=g.shared.pending,I===null)break;te=I,I=te.next,te.next=null,g.lastBaseUpdate=te,g.shared.pending=null}}while(!0);if(ne===null&&(L=re),g.baseState=L,g.firstBaseUpdate=K,g.lastBaseUpdate=ne,o=g.shared.interleaved,o!==null){g=o;do b|=g.lane,g=g.next;while(g!==o)}else x===null&&(g.shared.lanes=0);mi|=b,r.lanes=b,r.memoizedState=re}}function km(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var d=r[o],g=d.callback;if(g!==null){if(d.callback=null,d=u,typeof g!="function")throw Error(n(191,g));g.call(d)}}}var es={},Jn=Dr(es),ts=Dr(es),ns=Dr(es);function hi(r){if(r===es)throw Error(n(174));return r}function oc(r,o){switch(st(ns,o),st(ts,r),st(Jn,es),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ie(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ie(o,r)}lt(Jn),st(Jn,o)}function Ji(){lt(Jn),lt(ts),lt(ns)}function Sm(r){hi(ns.current);var o=hi(Jn.current),u=ie(o,r.type);o!==u&&(st(ts,r),st(Jn,u))}function sc(r){ts.current===r&&(lt(Jn),lt(ts))}var ft=Dr(0);function Ma(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var ac=[];function lc(){for(var r=0;r<ac.length;r++)ac[r]._workInProgressVersionPrimary=null;ac.length=0}var Ia=P.ReactCurrentDispatcher,uc=P.ReactCurrentBatchConfig,pi=0,dt=null,bt=null,Rt=null,Da=!1,rs=!1,is=0,Nb=0;function Ut(){throw Error(n(321))}function cc(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!zn(r[u],o[u]))return!1;return!0}function fc(r,o,u,d,g,x){if(pi=x,dt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ia.current=r===null||r.memoizedState===null?_b:Lb,r=u(d,g),rs){x=0;do{if(rs=!1,is=0,25<=x)throw Error(n(301));x+=1,Rt=bt=null,o.updateQueue=null,Ia.current=Ob,r=u(d,g)}while(rs)}if(Ia.current=Oa,o=bt!==null&&bt.next!==null,pi=0,Rt=bt=dt=null,Da=!1,o)throw Error(n(300));return r}function dc(){var r=is!==0;return is=0,r}function Zn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?dt.memoizedState=Rt=r:Rt=Rt.next=r,Rt}function Rn(){if(bt===null){var r=dt.alternate;r=r!==null?r.memoizedState:null}else r=bt.next;var o=Rt===null?dt.memoizedState:Rt.next;if(o!==null)Rt=o,bt=r;else{if(r===null)throw Error(n(310));bt=r,r={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Rt===null?dt.memoizedState=Rt=r:Rt=Rt.next=r}return Rt}function os(r,o){return typeof o=="function"?o(r):o}function hc(r){var o=Rn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var d=bt,g=d.baseQueue,x=u.pending;if(x!==null){if(g!==null){var b=g.next;g.next=x.next,x.next=b}d.baseQueue=g=x,u.pending=null}if(g!==null){x=g.next,d=d.baseState;var I=b=null,L=null,K=x;do{var ne=K.lane;if((pi&ne)===ne)L!==null&&(L=L.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),d=K.hasEagerState?K.eagerState:r(d,K.action);else{var re={lane:ne,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};L===null?(I=L=re,b=d):L=L.next=re,dt.lanes|=ne,mi|=ne}K=K.next}while(K!==null&&K!==x);L===null?b=d:L.next=I,zn(d,o.memoizedState)||(un=!0),o.memoizedState=d,o.baseState=b,o.baseQueue=L,u.lastRenderedState=d}if(r=u.interleaved,r!==null){g=r;do x=g.lane,dt.lanes|=x,mi|=x,g=g.next;while(g!==r)}else g===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function pc(r){var o=Rn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var d=u.dispatch,g=u.pending,x=o.memoizedState;if(g!==null){u.pending=null;var b=g=g.next;do x=r(x,b.action),b=b.next;while(b!==g);zn(x,o.memoizedState)||(un=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),u.lastRenderedState=x}return[x,d]}function bm(){}function Cm(r,o){var u=dt,d=Rn(),g=o(),x=!zn(d.memoizedState,g);if(x&&(d.memoizedState=g,un=!0),d=d.queue,mc(Pm.bind(null,u,d,r),[r]),d.getSnapshot!==o||x||Rt!==null&&Rt.memoizedState.tag&1){if(u.flags|=2048,ss(9,Tm.bind(null,u,d,g,o),void 0,null),At===null)throw Error(n(349));(pi&30)!==0||Em(u,o,g)}return g}function Em(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=dt.updateQueue,o===null?(o={lastEffect:null,stores:null},dt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function Tm(r,o,u,d){o.value=u,o.getSnapshot=d,Rm(o)&&Am(r)}function Pm(r,o,u){return u(function(){Rm(o)&&Am(r)})}function Rm(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!zn(r,u)}catch{return!0}}function Am(r){var o=mr(r,1);o!==null&&Wn(o,r,1,-1)}function jm(r){var o=Zn();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:r},o.queue=r,r=r.dispatch=Db.bind(null,dt,r),[o.memoizedState,r]}function ss(r,o,u,d){return r={tag:r,create:o,destroy:u,deps:d,next:null},o=dt.updateQueue,o===null?(o={lastEffect:null,stores:null},dt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(d=u.next,u.next=r,r.next=d,o.lastEffect=r)),r}function Nm(){return Rn().memoizedState}function _a(r,o,u,d){var g=Zn();dt.flags|=r,g.memoizedState=ss(1|o,u,void 0,d===void 0?null:d)}function La(r,o,u,d){var g=Rn();d=d===void 0?null:d;var x=void 0;if(bt!==null){var b=bt.memoizedState;if(x=b.destroy,d!==null&&cc(d,b.deps)){g.memoizedState=ss(o,u,x,d);return}}dt.flags|=r,g.memoizedState=ss(1|o,u,x,d)}function Mm(r,o){return _a(8390656,8,r,o)}function mc(r,o){return La(2048,8,r,o)}function Im(r,o){return La(4,2,r,o)}function Dm(r,o){return La(4,4,r,o)}function _m(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function Lm(r,o,u){return u=u!=null?u.concat([r]):null,La(4,4,_m.bind(null,o,r),u)}function gc(){}function Om(r,o){var u=Rn();o=o===void 0?null:o;var d=u.memoizedState;return d!==null&&o!==null&&cc(o,d[1])?d[0]:(u.memoizedState=[r,o],r)}function Fm(r,o){var u=Rn();o=o===void 0?null:o;var d=u.memoizedState;return d!==null&&o!==null&&cc(o,d[1])?d[0]:(r=r(),u.memoizedState=[r,o],r)}function zm(r,o,u){return(pi&21)===0?(r.baseState&&(r.baseState=!1,un=!0),r.memoizedState=u):(zn(u,o)||(u=mp(),dt.lanes|=u,mi|=u,r.baseState=!0),o)}function Mb(r,o){var u=Qe;Qe=u!==0&&4>u?u:4,r(!0);var d=uc.transition;uc.transition={};try{r(!1),o()}finally{Qe=u,uc.transition=d}}function Vm(){return Rn().memoizedState}function Ib(r,o,u){var d=$r(r);if(u={lane:d,action:u,hasEagerState:!1,eagerState:null,next:null},Bm(r))$m(o,u);else if(u=vm(r,o,u,d),u!==null){var g=Zt();Wn(u,r,d,g),Um(u,o,d)}}function Db(r,o,u){var d=$r(r),g={lane:d,action:u,hasEagerState:!1,eagerState:null,next:null};if(Bm(r))$m(o,g);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var b=o.lastRenderedState,I=x(b,u);if(g.hasEagerState=!0,g.eagerState=I,zn(I,b)){var L=o.interleaved;L===null?(g.next=g,rc(o)):(g.next=L.next,L.next=g),o.interleaved=g;return}}catch{}finally{}u=vm(r,o,g,d),u!==null&&(g=Zt(),Wn(u,r,d,g),Um(u,o,d))}}function Bm(r){var o=r.alternate;return r===dt||o!==null&&o===dt}function $m(r,o){rs=Da=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function Um(r,o,u){if((u&4194240)!==0){var d=o.lanes;d&=r.pendingLanes,u|=d,o.lanes=u,vu(r,u)}}var Oa={readContext:Pn,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},_b={readContext:Pn,useCallback:function(r,o){return Zn().memoizedState=[r,o===void 0?null:o],r},useContext:Pn,useEffect:Mm,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,_a(4194308,4,_m.bind(null,o,r),u)},useLayoutEffect:function(r,o){return _a(4194308,4,r,o)},useInsertionEffect:function(r,o){return _a(4,2,r,o)},useMemo:function(r,o){var u=Zn();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var d=Zn();return o=u!==void 0?u(o):o,d.memoizedState=d.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},d.queue=r,r=r.dispatch=Ib.bind(null,dt,r),[d.memoizedState,r]},useRef:function(r){var o=Zn();return r={current:r},o.memoizedState=r},useState:jm,useDebugValue:gc,useDeferredValue:function(r){return Zn().memoizedState=r},useTransition:function(){var r=jm(!1),o=r[0];return r=Mb.bind(null,r[1]),Zn().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var d=dt,g=Zn();if(ct){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),At===null)throw Error(n(349));(pi&30)!==0||Em(d,o,u)}g.memoizedState=u;var x={value:u,getSnapshot:o};return g.queue=x,Mm(Pm.bind(null,d,x,r),[r]),d.flags|=2048,ss(9,Tm.bind(null,d,x,u,o),void 0,null),u},useId:function(){var r=Zn(),o=At.identifierPrefix;if(ct){var u=pr,d=hr;u=(d&~(1<<32-Fn(d)-1)).toString(32)+u,o=":"+o+"R"+u,u=is++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=Nb++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},Lb={readContext:Pn,useCallback:Om,useContext:Pn,useEffect:mc,useImperativeHandle:Lm,useInsertionEffect:Im,useLayoutEffect:Dm,useMemo:Fm,useReducer:hc,useRef:Nm,useState:function(){return hc(os)},useDebugValue:gc,useDeferredValue:function(r){var o=Rn();return zm(o,bt.memoizedState,r)},useTransition:function(){var r=hc(os)[0],o=Rn().memoizedState;return[r,o]},useMutableSource:bm,useSyncExternalStore:Cm,useId:Vm,unstable_isNewReconciler:!1},Ob={readContext:Pn,useCallback:Om,useContext:Pn,useEffect:mc,useImperativeHandle:Lm,useInsertionEffect:Im,useLayoutEffect:Dm,useMemo:Fm,useReducer:pc,useRef:Nm,useState:function(){return pc(os)},useDebugValue:gc,useDeferredValue:function(r){var o=Rn();return bt===null?o.memoizedState=r:zm(o,bt.memoizedState,r)},useTransition:function(){var r=pc(os)[0],o=Rn().memoizedState;return[r,o]},useMutableSource:bm,useSyncExternalStore:Cm,useId:Vm,unstable_isNewReconciler:!1};function Bn(r,o){if(r&&r.defaultProps){o=j({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function yc(r,o,u,d){o=r.memoizedState,u=u(d,o),u=u==null?o:j({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Fa={isMounted:function(r){return(r=r._reactInternals)?Pt(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var d=Zt(),g=$r(r),x=gr(d,g);x.payload=o,u!=null&&(x.callback=u),o=Fr(r,x,g),o!==null&&(Wn(o,r,g,d),ja(o,r,g))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var d=Zt(),g=$r(r),x=gr(d,g);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=Fr(r,x,g),o!==null&&(Wn(o,r,g,d),ja(o,r,g))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=Zt(),d=$r(r),g=gr(u,d);g.tag=2,o!=null&&(g.callback=o),o=Fr(r,g,d),o!==null&&(Wn(o,r,d,u),ja(o,r,d))}};function Wm(r,o,u,d,g,x,b){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,b):o.prototype&&o.prototype.isPureReactComponent?!Ko(u,d)||!Ko(g,x):!0}function Hm(r,o,u){var d=!1,g=_r,x=o.contextType;return typeof x=="object"&&x!==null?x=Pn(x):(g=ln(o)?ui:$t.current,d=o.contextTypes,x=(d=d!=null)?Hi(r,g):_r),o=new o(u,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Fa,r.stateNode=o,o._reactInternals=r,d&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=g,r.__reactInternalMemoizedMaskedChildContext=x),o}function Km(r,o,u,d){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,d),o.state!==r&&Fa.enqueueReplaceState(o,o.state,null)}function vc(r,o,u,d){var g=r.stateNode;g.props=u,g.state=r.memoizedState,g.refs={},ic(r);var x=o.contextType;typeof x=="object"&&x!==null?g.context=Pn(x):(x=ln(o)?ui:$t.current,g.context=Hi(r,x)),g.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(yc(r,o,x,u),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(o=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),o!==g.state&&Fa.enqueueReplaceState(g,g.state,null),Na(r,u,g,d),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308)}function Zi(r,o){try{var u="",d=o;do u+=ye(d),d=d.return;while(d);var g=u}catch(x){g=`
37
+ `+g[b].replace(" at new "," at ");return r.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",r.displayName)),L}while(1<=b&&0<=I);break}}}finally{M=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?Q(r):""}function ye(r){switch(r.tag){case 5:return Q(r.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return r=Z(r.type,!1),r;case 11:return r=Z(r.type.render,!1),r;case 1:return r=Z(r.type,!0),r;default:return""}}function me(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case H:return"Fragment";case D:return"Portal";case _:return"Profiler";case B:return"StrictMode";case ae:return"Suspense";case J:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case N:return(r._context.displayName||"Context")+".Provider";case V:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ee:return o=r.displayName||null,o!==null?o:me(r.type)||"Memo";case ge:o=r._payload,r=r._init;try{return me(r(o))}catch{}}return null}function pe(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(o);case 8:return o===B?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function be(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function xe(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Be(r){var o=xe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),d=""+r[o];if(!r.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var g=u.get,x=u.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return g.call(this)},set:function(b){d=""+b,x.call(this,b)}}),Object.defineProperty(r,o,{enumerable:u.enumerable}),{getValue:function(){return d},setValue:function(b){d=""+b},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Oe(r){r._valueTracker||(r._valueTracker=Be(r))}function Ge(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var u=o.getValue(),d="";return r&&(d=xe(r)?r.checked?"true":"false":r.value),r=d,r!==u?(o.setValue(r),!0):!1}function ut(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function it(r,o){var u=o.checked;return j({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function Mt(r,o){var u=o.defaultValue==null?"":o.defaultValue,d=o.checked!=null?o.checked:o.defaultChecked;u=be(o.value!=null?o.value:u),r._wrapperState={initialChecked:d,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Xt(r,o){o=o.checked,o!=null&&T(r,"checked",o,!1)}function Je(r,o){Xt(r,o);var u=be(o.value),d=o.type;if(u!=null)d==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(d==="submit"||d==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?bn(r,o.type,u):o.hasOwnProperty("defaultValue")&&bn(r,o.type,be(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function zt(r,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var d=o.type;if(!(d!=="submit"&&d!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,u||o===r.value||(r.value=o),r.defaultValue=o}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function bn(r,o,u){(o!=="number"||ut(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var It=Array.isArray;function Yt(r,o,u,d){if(r=r.options,o){o={};for(var g=0;g<u.length;g++)o["$"+u[g]]=!0;for(u=0;u<r.length;u++)g=o.hasOwnProperty("$"+r[u].value),r[u].selected!==g&&(r[u].selected=g),g&&d&&(r[u].defaultSelected=!0)}else{for(u=""+be(u),o=null,g=0;g<r.length;g++){if(r[g].value===u){r[g].selected=!0,d&&(r[g].defaultSelected=!0);return}o!==null||r[g].disabled||(o=r[g])}o!==null&&(o.selected=!0)}}function Tt(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return j({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function We(r,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(n(92));if(It(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),u=o}r._wrapperState={initialValue:be(u)}}function Cr(r,o){var u=be(o.value),d=be(o.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),o.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),d!=null&&(r.defaultValue=""+d)}function ur(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function X(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ie(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?X(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var je,Ne=function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,d,g){MSApp.execUnsafeLocalFunction(function(){return r(o,u,d,g)})}:r}(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(je=je||document.createElement("div"),je.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=je.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Fe(r,o){if(o){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=o;return}}r.textContent=o}var ot={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},U=["Webkit","ms","Moz","O"];Object.keys(ot).forEach(function(r){U.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),ot[o]=ot[r]})});function ue(r,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||ot.hasOwnProperty(r)&&ot[r]?(""+o).trim():o+"px"}function fe(r,o){r=r.style;for(var u in o)if(o.hasOwnProperty(u)){var d=u.indexOf("--")===0,g=ue(u,o[u],d);u==="float"&&(u="cssFloat"),d?r.setProperty(u,g):r[u]=g}}var Ae=j({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(r,o){if(o){if(Ae[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function de(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){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 ze=null;function Gt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Qt=null,ht=null,pt=null;function Ze(r){if(r=Jo(r)){if(typeof Qt!="function")throw Error(n(280));var o=r.stateNode;o&&(o=wa(o),Qt(r.stateNode,r.type,o))}}function Ln(r){ht?pt?pt.push(r):pt=[r]:ht=r}function mn(){if(ht){var r=ht,o=pt;if(pt=ht=null,Ze(r),o)for(r=0;r<o.length;r++)Ze(o[r])}}function Vt(r,o){return r(o)}function _i(){}var Er=!1;function Mo(r,o,u){if(Er)return r(o,u);Er=!0;try{return Vt(r,o,u)}finally{Er=!1,(ht!==null||pt!==null)&&(_i(),mn())}}function oi(r,o){var u=r.stateNode;if(u===null)return null;var d=wa(u);if(d===null)return null;u=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,o,typeof u));return u}var si=!1;if(c)try{var ai={};Object.defineProperty(ai,"passive",{get:function(){si=!0}}),window.addEventListener("test",ai,ai),window.removeEventListener("test",ai,ai)}catch{si=!1}function Io(r,o,u,d,g,x,b,I,L){var K=Array.prototype.slice.call(arguments,3);try{o.apply(u,K)}catch(ne){this.onError(ne)}}var Tr=!1,Y=null,ce=!1,he=null,$e={onError:function(r){Tr=!0,Y=r}};function Bt(r,o,u,d,g,x,b,I,L){Tr=!1,Y=null,Io.apply($e,arguments)}function sn(r,o,u,d,g,x,b,I,L){if(Bt.apply(this,arguments),Tr){if(Tr){var K=Y;Tr=!1,Y=null}else throw Error(n(198));ce||(ce=!0,he=K)}}function Pt(r){var o=r,u=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(u=o.return),r=o.return;while(r)}return o.tag===3?u:null}function On(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function Dt(r){if(Pt(r)!==r)throw Error(n(188))}function Cn(r){var o=r.alternate;if(!o){if(o=Pt(r),o===null)throw Error(n(188));return o!==r?null:r}for(var u=r,d=o;;){var g=u.return;if(g===null)break;var x=g.alternate;if(x===null){if(d=g.return,d!==null){u=d;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===u)return Dt(g),r;if(x===d)return Dt(g),o;x=x.sibling}throw Error(n(188))}if(u.return!==d.return)u=g,d=x;else{for(var b=!1,I=g.child;I;){if(I===u){b=!0,u=g,d=x;break}if(I===d){b=!0,d=g,u=x;break}I=I.sibling}if(!b){for(I=x.child;I;){if(I===u){b=!0,u=x,d=g;break}if(I===d){b=!0,d=x,u=g;break}I=I.sibling}if(!b)throw Error(n(189))}}if(u.alternate!==d)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:o}function yt(r){return r=Cn(r),r!==null?cr(r):null}function cr(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=cr(r);if(o!==null)return o;r=r.sibling}return null}var fp=t.unstable_scheduleCallback,dp=t.unstable_cancelCallback,kS=t.unstable_shouldYield,SS=t.unstable_requestPaint,vt=t.unstable_now,bS=t.unstable_getCurrentPriorityLevel,mu=t.unstable_ImmediatePriority,hp=t.unstable_UserBlockingPriority,ea=t.unstable_NormalPriority,CS=t.unstable_LowPriority,pp=t.unstable_IdlePriority,ta=null,Gn=null;function ES(r){if(Gn&&typeof Gn.onCommitFiberRoot=="function")try{Gn.onCommitFiberRoot(ta,r,void 0,(r.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:RS,TS=Math.log,PS=Math.LN2;function RS(r){return r>>>=0,r===0?32:31-(TS(r)/PS|0)|0}var na=64,ra=4194304;function Do(r){switch(r&-r){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: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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function ia(r,o){var u=r.pendingLanes;if(u===0)return 0;var d=0,g=r.suspendedLanes,x=r.pingedLanes,b=u&268435455;if(b!==0){var I=b&~g;I!==0?d=Do(I):(x&=b,x!==0&&(d=Do(x)))}else b=u&~g,b!==0?d=Do(b):x!==0&&(d=Do(x));if(d===0)return 0;if(o!==0&&o!==d&&(o&g)===0&&(g=d&-d,x=o&-o,g>=x||g===16&&(x&4194240)!==0))return o;if((d&4)!==0&&(d|=u&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=d;0<o;)u=31-Fn(o),g=1<<u,d|=r[u],o&=~g;return d}function AS(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function jS(r,o){for(var u=r.suspendedLanes,d=r.pingedLanes,g=r.expirationTimes,x=r.pendingLanes;0<x;){var b=31-Fn(x),I=1<<b,L=g[b];L===-1?((I&u)===0||(I&d)!==0)&&(g[b]=AS(I,o)):L<=o&&(r.expiredLanes|=I),x&=~I}}function gu(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function mp(){var r=na;return na<<=1,(na&4194240)===0&&(na=64),r}function yu(r){for(var o=[],u=0;31>u;u++)o.push(r);return o}function _o(r,o,u){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-Fn(o),r[o]=u}function NS(r,o){var u=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var d=r.eventTimes;for(r=r.expirationTimes;0<u;){var g=31-Fn(u),x=1<<g;o[g]=0,d[g]=-1,r[g]=-1,u&=~x}}function vu(r,o){var u=r.entangledLanes|=o;for(r=r.entanglements;u;){var d=31-Fn(u),g=1<<d;g&o|r[d]&o&&(r[d]|=o),u&=~g}}var Qe=0;function gp(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var yp,xu,vp,xp,wp,wu=!1,oa=[],Pr=null,Rr=null,Ar=null,Lo=new Map,Oo=new Map,jr=[],MS="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 submit".split(" ");function kp(r,o){switch(r){case"focusin":case"focusout":Pr=null;break;case"dragenter":case"dragleave":Rr=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":Lo.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(o.pointerId)}}function Fo(r,o,u,d,g,x){return r===null||r.nativeEvent!==x?(r={blockedOn:o,domEventName:u,eventSystemFlags:d,nativeEvent:x,targetContainers:[g]},o!==null&&(o=Jo(o),o!==null&&xu(o)),r):(r.eventSystemFlags|=d,o=r.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),r)}function IS(r,o,u,d,g){switch(o){case"focusin":return Pr=Fo(Pr,r,o,u,d,g),!0;case"dragenter":return Rr=Fo(Rr,r,o,u,d,g),!0;case"mouseover":return Ar=Fo(Ar,r,o,u,d,g),!0;case"pointerover":var x=g.pointerId;return Lo.set(x,Fo(Lo.get(x)||null,r,o,u,d,g)),!0;case"gotpointercapture":return x=g.pointerId,Oo.set(x,Fo(Oo.get(x)||null,r,o,u,d,g)),!0}return!1}function Sp(r){var o=li(r.target);if(o!==null){var u=Pt(o);if(u!==null){if(o=u.tag,o===13){if(o=On(u),o!==null){r.blockedOn=o,wp(r.priority,function(){vp(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function sa(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var u=Su(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);ze=d,u.target.dispatchEvent(d),ze=null}else return o=Jo(u),o!==null&&xu(o),r.blockedOn=u,!1;o.shift()}return!0}function bp(r,o,u){sa(r)&&u.delete(o)}function DS(){wu=!1,Pr!==null&&sa(Pr)&&(Pr=null),Rr!==null&&sa(Rr)&&(Rr=null),Ar!==null&&sa(Ar)&&(Ar=null),Lo.forEach(bp),Oo.forEach(bp)}function zo(r,o){r.blockedOn===o&&(r.blockedOn=null,wu||(wu=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,DS)))}function Vo(r){function o(g){return zo(g,r)}if(0<oa.length){zo(oa[0],r);for(var u=1;u<oa.length;u++){var d=oa[u];d.blockedOn===r&&(d.blockedOn=null)}}for(Pr!==null&&zo(Pr,r),Rr!==null&&zo(Rr,r),Ar!==null&&zo(Ar,r),Lo.forEach(o),Oo.forEach(o),u=0;u<jr.length;u++)d=jr[u],d.blockedOn===r&&(d.blockedOn=null);for(;0<jr.length&&(u=jr[0],u.blockedOn===null);)Sp(u),u.blockedOn===null&&jr.shift()}var Li=P.ReactCurrentBatchConfig,aa=!0;function _S(r,o,u,d){var g=Qe,x=Li.transition;Li.transition=null;try{Qe=1,ku(r,o,u,d)}finally{Qe=g,Li.transition=x}}function LS(r,o,u,d){var g=Qe,x=Li.transition;Li.transition=null;try{Qe=4,ku(r,o,u,d)}finally{Qe=g,Li.transition=x}}function ku(r,o,u,d){if(aa){var g=Su(r,o,u,d);if(g===null)zu(r,o,d,la,u),kp(r,d);else if(IS(g,r,o,u,d))d.stopPropagation();else if(kp(r,d),o&4&&-1<MS.indexOf(r)){for(;g!==null;){var x=Jo(g);if(x!==null&&yp(x),x=Su(r,o,u,d),x===null&&zu(r,o,d,la,u),x===g)break;g=x}g!==null&&d.stopPropagation()}else zu(r,o,d,null,u)}}var la=null;function Su(r,o,u,d){if(la=null,r=Gt(d),r=li(r),r!==null)if(o=Pt(r),o===null)r=null;else if(u=o.tag,u===13){if(r=On(o),r!==null)return r;r=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return la=r,null}function Cp(r){switch(r){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(bS()){case mu:return 1;case hp:return 4;case ea:case CS:return 16;case pp:return 536870912;default:return 16}default:return 16}}var Nr=null,bu=null,ua=null;function Ep(){if(ua)return ua;var r,o=bu,u=o.length,d,g="value"in Nr?Nr.value:Nr.textContent,x=g.length;for(r=0;r<u&&o[r]===g[r];r++);var b=u-r;for(d=1;d<=b&&o[u-d]===g[x-d];d++);return ua=g.slice(r,1<d?1-d:void 0)}function ca(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function fa(){return!0}function Tp(){return!1}function gn(r){function o(u,d,g,x,b){this._reactName=u,this._targetInst=g,this.type=d,this.nativeEvent=x,this.target=b,this.currentTarget=null;for(var I in r)r.hasOwnProperty(I)&&(u=r[I],this[I]=u?u(x):x[I]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?fa:Tp,this.isPropagationStopped=Tp,this}return j(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=fa)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fa)},persist:function(){},isPersistent:fa}),o}var Oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cu=gn(Oi),Bo=j({},Oi,{view:0,detail:0}),OS=gn(Bo),Eu,Tu,$o,da=j({},Bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ru,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==$o&&($o&&r.type==="mousemove"?(Eu=r.screenX-$o.screenX,Tu=r.screenY-$o.screenY):Tu=Eu=0,$o=r),Eu)},movementY:function(r){return"movementY"in r?r.movementY:Tu}}),Pp=gn(da),FS=j({},da,{dataTransfer:0}),zS=gn(FS),VS=j({},Bo,{relatedTarget:0}),Pu=gn(VS),BS=j({},Oi,{animationName:0,elapsedTime:0,pseudoElement:0}),$S=gn(BS),US=j({},Oi,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),WS=gn(US),HS=j({},Oi,{data:0}),Rp=gn(HS),KS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qS={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"},XS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YS(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=XS[r])?!!o[r]:!1}function Ru(){return YS}var GS=j({},Bo,{key:function(r){if(r.key){var o=KS[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=ca(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?qS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ru,charCode:function(r){return r.type==="keypress"?ca(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ca(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),QS=gn(GS),JS=j({},da,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ap=gn(JS),ZS=j({},Bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ru}),eb=gn(ZS),tb=j({},Oi,{propertyName:0,elapsedTime:0,pseudoElement:0}),nb=gn(tb),rb=j({},da,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),ib=gn(rb),ob=[9,13,27,32],Au=c&&"CompositionEvent"in window,Uo=null;c&&"documentMode"in document&&(Uo=document.documentMode);var sb=c&&"TextEvent"in window&&!Uo,jp=c&&(!Au||Uo&&8<Uo&&11>=Uo),Np=" ",Mp=!1;function Ip(r,o){switch(r){case"keyup":return ob.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dp(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Fi=!1;function ab(r,o){switch(r){case"compositionend":return Dp(o);case"keypress":return o.which!==32?null:(Mp=!0,Np);case"textInput":return r=o.data,r===Np&&Mp?null:r;default:return null}}function lb(r,o){if(Fi)return r==="compositionend"||!Au&&Ip(r,o)?(r=Ep(),ua=bu=Nr=null,Fi=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return jp&&o.locale!=="ko"?null:o.data;default:return null}}var ub={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 _p(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!ub[r.type]:o==="textarea"}function Lp(r,o,u,d){Ln(d),o=ya(o,"onChange"),0<o.length&&(u=new Cu("onChange","change",null,u,d),r.push({event:u,listeners:o}))}var Wo=null,Ho=null;function cb(r){em(r,0)}function ha(r){var o=Ui(r);if(Ge(o))return r}function fb(r,o){if(r==="change")return o}var Op=!1;if(c){var ju;if(c){var Nu="oninput"in document;if(!Nu){var Fp=document.createElement("div");Fp.setAttribute("oninput","return;"),Nu=typeof Fp.oninput=="function"}ju=Nu}else ju=!1;Op=ju&&(!document.documentMode||9<document.documentMode)}function zp(){Wo&&(Wo.detachEvent("onpropertychange",Vp),Ho=Wo=null)}function Vp(r){if(r.propertyName==="value"&&ha(Ho)){var o=[];Lp(o,Ho,r,Gt(r)),Mo(cb,o)}}function db(r,o,u){r==="focusin"?(zp(),Wo=o,Ho=u,Wo.attachEvent("onpropertychange",Vp)):r==="focusout"&&zp()}function hb(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ha(Ho)}function pb(r,o){if(r==="click")return ha(o)}function mb(r,o){if(r==="input"||r==="change")return ha(o)}function gb(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var zn=typeof Object.is=="function"?Object.is:gb;function Ko(r,o){if(zn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var u=Object.keys(r),d=Object.keys(o);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var g=u[d];if(!f.call(o,g)||!zn(r[g],o[g]))return!1}return!0}function Bp(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function $p(r,o){var u=Bp(r);r=0;for(var d;u;){if(u.nodeType===3){if(d=r+u.textContent.length,r<=o&&d>=o)return{node:u,offset:o-r};r=d}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Bp(u)}}function Up(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?Up(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Wp(){for(var r=window,o=ut();o instanceof r.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)r=o.contentWindow;else break;o=ut(r.document)}return o}function Mu(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function yb(r){var o=Wp(),u=r.focusedElem,d=r.selectionRange;if(o!==u&&u&&u.ownerDocument&&Up(u.ownerDocument.documentElement,u)){if(d!==null&&Mu(u)){if(o=d.start,r=d.end,r===void 0&&(r=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(r,u.value.length);else if(r=(o=u.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var g=u.textContent.length,x=Math.min(d.start,g);d=d.end===void 0?x:Math.min(d.end,g),!r.extend&&x>d&&(g=d,d=x,x=g),g=$p(u,x);var b=$p(u,d);g&&b&&(r.rangeCount!==1||r.anchorNode!==g.node||r.anchorOffset!==g.offset||r.focusNode!==b.node||r.focusOffset!==b.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),r.removeAllRanges(),x>d?(r.addRange(o),r.extend(b.node,b.offset)):(o.setEnd(b.node,b.offset),r.addRange(o)))}}for(o=[],r=u;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)r=o[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var vb=c&&"documentMode"in document&&11>=document.documentMode,zi=null,Iu=null,qo=null,Du=!1;function Hp(r,o,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Du||zi==null||zi!==ut(d)||(d=zi,"selectionStart"in d&&Mu(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),qo&&Ko(qo,d)||(qo=d,d=ya(Iu,"onSelect"),0<d.length&&(o=new Cu("onSelect","select",null,o,u),r.push({event:o,listeners:d}),o.target=zi)))}function pa(r,o){var u={};return u[r.toLowerCase()]=o.toLowerCase(),u["Webkit"+r]="webkit"+o,u["Moz"+r]="moz"+o,u}var Vi={animationend:pa("Animation","AnimationEnd"),animationiteration:pa("Animation","AnimationIteration"),animationstart:pa("Animation","AnimationStart"),transitionend:pa("Transition","TransitionEnd")},_u={},Kp={};c&&(Kp=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function ma(r){if(_u[r])return _u[r];if(!Vi[r])return r;var o=Vi[r],u;for(u in o)if(o.hasOwnProperty(u)&&u in Kp)return _u[r]=o[u];return r}var qp=ma("animationend"),Xp=ma("animationiteration"),Yp=ma("animationstart"),Gp=ma("transitionend"),Qp=new Map,Jp="abort auxClick 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(" ");function Mr(r,o){Qp.set(r,o),a(o,[r])}for(var Lu=0;Lu<Jp.length;Lu++){var Ou=Jp[Lu],xb=Ou.toLowerCase(),wb=Ou[0].toUpperCase()+Ou.slice(1);Mr(xb,"on"+wb)}Mr(qp,"onAnimationEnd"),Mr(Xp,"onAnimationIteration"),Mr(Yp,"onAnimationStart"),Mr("dblclick","onDoubleClick"),Mr("focusin","onFocus"),Mr("focusout","onBlur"),Mr(Gp,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xo="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(" "),kb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xo));function Zp(r,o,u){var d=r.type||"unknown-event";r.currentTarget=u,sn(d,o,void 0,r),r.currentTarget=null}function em(r,o){o=(o&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],g=d.event;d=d.listeners;e:{var x=void 0;if(o)for(var b=d.length-1;0<=b;b--){var I=d[b],L=I.instance,K=I.currentTarget;if(I=I.listener,L!==x&&g.isPropagationStopped())break e;Zp(g,I,K),x=L}else for(b=0;b<d.length;b++){if(I=d[b],L=I.instance,K=I.currentTarget,I=I.listener,L!==x&&g.isPropagationStopped())break e;Zp(g,I,K),x=L}}}if(ce)throw r=he,ce=!1,he=null,r}function at(r,o){var u=o[Hu];u===void 0&&(u=o[Hu]=new Set);var d=r+"__bubble";u.has(d)||(tm(o,r,2,!1),u.add(d))}function Fu(r,o,u){var d=0;o&&(d|=4),tm(u,r,d,o)}var ga="_reactListening"+Math.random().toString(36).slice(2);function Yo(r){if(!r[ga]){r[ga]=!0,i.forEach(function(u){u!=="selectionchange"&&(kb.has(u)||Fu(u,!1,r),Fu(u,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[ga]||(o[ga]=!0,Fu("selectionchange",!1,o))}}function tm(r,o,u,d){switch(Cp(o)){case 1:var g=_S;break;case 4:g=LS;break;default:g=ku}u=g.bind(null,o,u,r),g=void 0,!si||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(g=!0),d?g!==void 0?r.addEventListener(o,u,{capture:!0,passive:g}):r.addEventListener(o,u,!0):g!==void 0?r.addEventListener(o,u,{passive:g}):r.addEventListener(o,u,!1)}function zu(r,o,u,d,g){var x=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var b=d.tag;if(b===3||b===4){var I=d.stateNode.containerInfo;if(I===g||I.nodeType===8&&I.parentNode===g)break;if(b===4)for(b=d.return;b!==null;){var L=b.tag;if((L===3||L===4)&&(L=b.stateNode.containerInfo,L===g||L.nodeType===8&&L.parentNode===g))return;b=b.return}for(;I!==null;){if(b=li(I),b===null)return;if(L=b.tag,L===5||L===6){d=x=b;continue e}I=I.parentNode}}d=d.return}Mo(function(){var K=x,ne=Gt(u),re=[];e:{var te=Qp.get(r);if(te!==void 0){var ve=Cu,Ce=r;switch(r){case"keypress":if(ca(u)===0)break e;case"keydown":case"keyup":ve=QS;break;case"focusin":Ce="focus",ve=Pu;break;case"focusout":Ce="blur",ve=Pu;break;case"beforeblur":case"afterblur":ve=Pu;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=Pp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=zS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=eb;break;case qp:case Xp:case Yp:ve=$S;break;case Gp:ve=nb;break;case"scroll":ve=OS;break;case"wheel":ve=ib;break;case"copy":case"cut":case"paste":ve=WS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=Ap}var Te=(o&4)!==0,xt=!Te&&r==="scroll",$=Te?te!==null?te+"Capture":null:te;Te=[];for(var z=K,W;z!==null;){W=z;var se=W.stateNode;if(W.tag===5&&se!==null&&(W=se,$!==null&&(se=oi(z,$),se!=null&&Te.push(Go(z,se,W)))),xt)break;z=z.return}0<Te.length&&(te=new ve(te,Ce,null,u,ne),re.push({event:te,listeners:Te}))}}if((o&7)===0){e:{if(te=r==="mouseover"||r==="pointerover",ve=r==="mouseout"||r==="pointerout",te&&u!==ze&&(Ce=u.relatedTarget||u.fromElement)&&(li(Ce)||Ce[fr]))break e;if((ve||te)&&(te=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,ve?(Ce=u.relatedTarget||u.toElement,ve=K,Ce=Ce?li(Ce):null,Ce!==null&&(xt=Pt(Ce),Ce!==xt||Ce.tag!==5&&Ce.tag!==6)&&(Ce=null)):(ve=null,Ce=K),ve!==Ce)){if(Te=Pp,se="onMouseLeave",$="onMouseEnter",z="mouse",(r==="pointerout"||r==="pointerover")&&(Te=Ap,se="onPointerLeave",$="onPointerEnter",z="pointer"),xt=ve==null?te:Ui(ve),W=Ce==null?te:Ui(Ce),te=new Te(se,z+"leave",ve,u,ne),te.target=xt,te.relatedTarget=W,se=null,li(ne)===K&&(Te=new Te($,z+"enter",Ce,u,ne),Te.target=W,Te.relatedTarget=xt,se=Te),xt=se,ve&&Ce)t:{for(Te=ve,$=Ce,z=0,W=Te;W;W=Bi(W))z++;for(W=0,se=$;se;se=Bi(se))W++;for(;0<z-W;)Te=Bi(Te),z--;for(;0<W-z;)$=Bi($),W--;for(;z--;){if(Te===$||$!==null&&Te===$.alternate)break t;Te=Bi(Te),$=Bi($)}Te=null}else Te=null;ve!==null&&nm(re,te,ve,Te,!1),Ce!==null&&xt!==null&&nm(re,xt,Ce,Te,!0)}}e:{if(te=K?Ui(K):window,ve=te.nodeName&&te.nodeName.toLowerCase(),ve==="select"||ve==="input"&&te.type==="file")var Re=fb;else if(_p(te))if(Op)Re=mb;else{Re=hb;var Me=db}else(ve=te.nodeName)&&ve.toLowerCase()==="input"&&(te.type==="checkbox"||te.type==="radio")&&(Re=pb);if(Re&&(Re=Re(r,K))){Lp(re,Re,u,ne);break e}Me&&Me(r,te,K),r==="focusout"&&(Me=te._wrapperState)&&Me.controlled&&te.type==="number"&&bn(te,"number",te.value)}switch(Me=K?Ui(K):window,r){case"focusin":(_p(Me)||Me.contentEditable==="true")&&(zi=Me,Iu=K,qo=null);break;case"focusout":qo=Iu=zi=null;break;case"mousedown":Du=!0;break;case"contextmenu":case"mouseup":case"dragend":Du=!1,Hp(re,u,ne);break;case"selectionchange":if(vb)break;case"keydown":case"keyup":Hp(re,u,ne)}var Ie;if(Au)e:{switch(r){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else Fi?Ip(r,u)&&(_e="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(_e="onCompositionStart");_e&&(jp&&u.locale!=="ko"&&(Fi||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Fi&&(Ie=Ep()):(Nr=ne,bu="value"in Nr?Nr.value:Nr.textContent,Fi=!0)),Me=ya(K,_e),0<Me.length&&(_e=new Rp(_e,r,null,u,ne),re.push({event:_e,listeners:Me}),Ie?_e.data=Ie:(Ie=Dp(u),Ie!==null&&(_e.data=Ie)))),(Ie=sb?ab(r,u):lb(r,u))&&(K=ya(K,"onBeforeInput"),0<K.length&&(ne=new Rp("onBeforeInput","beforeinput",null,u,ne),re.push({event:ne,listeners:K}),ne.data=Ie))}em(re,o)})}function Go(r,o,u){return{instance:r,listener:o,currentTarget:u}}function ya(r,o){for(var u=o+"Capture",d=[];r!==null;){var g=r,x=g.stateNode;g.tag===5&&x!==null&&(g=x,x=oi(r,u),x!=null&&d.unshift(Go(r,x,g)),x=oi(r,o),x!=null&&d.push(Go(r,x,g))),r=r.return}return d}function Bi(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function nm(r,o,u,d,g){for(var x=o._reactName,b=[];u!==null&&u!==d;){var I=u,L=I.alternate,K=I.stateNode;if(L!==null&&L===d)break;I.tag===5&&K!==null&&(I=K,g?(L=oi(u,x),L!=null&&b.unshift(Go(u,L,I))):g||(L=oi(u,x),L!=null&&b.push(Go(u,L,I)))),u=u.return}b.length!==0&&r.push({event:o,listeners:b})}var Sb=/\r\n?/g,bb=/\u0000|\uFFFD/g;function rm(r){return(typeof r=="string"?r:""+r).replace(Sb,`
38
+ `).replace(bb,"")}function va(r,o,u){if(o=rm(o),rm(r)!==o&&u)throw Error(n(425))}function xa(){}var Vu=null,Bu=null;function $u(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Uu=typeof setTimeout=="function"?setTimeout:void 0,Cb=typeof clearTimeout=="function"?clearTimeout:void 0,im=typeof Promise=="function"?Promise:void 0,Eb=typeof queueMicrotask=="function"?queueMicrotask:typeof im<"u"?function(r){return im.resolve(null).then(r).catch(Tb)}:Uu;function Tb(r){setTimeout(function(){throw r})}function Wu(r,o){var u=o,d=0;do{var g=u.nextSibling;if(r.removeChild(u),g&&g.nodeType===8)if(u=g.data,u==="/$"){if(d===0){r.removeChild(g),Vo(o);return}d--}else u!=="$"&&u!=="$?"&&u!=="$!"||d++;u=g}while(u);Vo(o)}function Ir(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function om(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return r;o--}else u==="/$"&&o++}r=r.previousSibling}return null}var $i=Math.random().toString(36).slice(2),Qn="__reactFiber$"+$i,Qo="__reactProps$"+$i,fr="__reactContainer$"+$i,Hu="__reactEvents$"+$i,Pb="__reactListeners$"+$i,Rb="__reactHandles$"+$i;function li(r){var o=r[Qn];if(o)return o;for(var u=r.parentNode;u;){if(o=u[fr]||u[Qn]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(r=om(r);r!==null;){if(u=r[Qn])return u;r=om(r)}return o}r=u,u=r.parentNode}return null}function Jo(r){return r=r[Qn]||r[fr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Ui(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function wa(r){return r[Qo]||null}var Ku=[],Wi=-1;function Dr(r){return{current:r}}function lt(r){0>Wi||(r.current=Ku[Wi],Ku[Wi]=null,Wi--)}function st(r,o){Wi++,Ku[Wi]=r.current,r.current=o}var _r={},$t=Dr(_r),an=Dr(!1),ui=_r;function Hi(r,o){var u=r.type.contextTypes;if(!u)return _r;var d=r.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===o)return d.__reactInternalMemoizedMaskedChildContext;var g={},x;for(x in u)g[x]=o[x];return d&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=g),g}function ln(r){return r=r.childContextTypes,r!=null}function ka(){lt(an),lt($t)}function sm(r,o,u){if($t.current!==_r)throw Error(n(168));st($t,o),st(an,u)}function am(r,o,u){var d=r.stateNode;if(o=o.childContextTypes,typeof d.getChildContext!="function")return u;d=d.getChildContext();for(var g in d)if(!(g in o))throw Error(n(108,pe(r)||"Unknown",g));return j({},u,d)}function Sa(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||_r,ui=$t.current,st($t,r),st(an,an.current),!0}function lm(r,o,u){var d=r.stateNode;if(!d)throw Error(n(169));u?(r=am(r,o,ui),d.__reactInternalMemoizedMergedChildContext=r,lt(an),lt($t),st($t,r)):lt(an),st(an,u)}var dr=null,ba=!1,qu=!1;function um(r){dr===null?dr=[r]:dr.push(r)}function Ab(r){ba=!0,um(r)}function Lr(){if(!qu&&dr!==null){qu=!0;var r=0,o=Qe;try{var u=dr;for(Qe=1;r<u.length;r++){var d=u[r];do d=d(!0);while(d!==null)}dr=null,ba=!1}catch(g){throw dr!==null&&(dr=dr.slice(r+1)),fp(mu,Lr),g}finally{Qe=o,qu=!1}}return null}var Ki=[],qi=0,Ca=null,Ea=0,En=[],Tn=0,ci=null,hr=1,pr="";function fi(r,o){Ki[qi++]=Ea,Ki[qi++]=Ca,Ca=r,Ea=o}function cm(r,o,u){En[Tn++]=hr,En[Tn++]=pr,En[Tn++]=ci,ci=r;var d=hr;r=pr;var g=32-Fn(d)-1;d&=~(1<<g),u+=1;var x=32-Fn(o)+g;if(30<x){var b=g-g%5;x=(d&(1<<b)-1).toString(32),d>>=b,g-=b,hr=1<<32-Fn(o)+g|u<<g|d,pr=x+r}else hr=1<<x|u<<g|d,pr=r}function Xu(r){r.return!==null&&(fi(r,1),cm(r,1,0))}function Yu(r){for(;r===Ca;)Ca=Ki[--qi],Ki[qi]=null,Ea=Ki[--qi],Ki[qi]=null;for(;r===ci;)ci=En[--Tn],En[Tn]=null,pr=En[--Tn],En[Tn]=null,hr=En[--Tn],En[Tn]=null}var yn=null,vn=null,ct=!1,Vn=null;function fm(r,o){var u=jn(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=r,o=r.deletions,o===null?(r.deletions=[u],r.flags|=16):o.push(u)}function dm(r,o){switch(r.tag){case 5:var u=r.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,yn=r,vn=Ir(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,yn=r,vn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=ci!==null?{id:hr,overflow:pr}:null,r.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=jn(18,null,null,0),u.stateNode=o,u.return=r,r.child=u,yn=r,vn=null,!0):!1;default:return!1}}function Gu(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Qu(r){if(ct){var o=vn;if(o){var u=o;if(!dm(r,o)){if(Gu(r))throw Error(n(418));o=Ir(u.nextSibling);var d=yn;o&&dm(r,o)?fm(d,u):(r.flags=r.flags&-4097|2,ct=!1,yn=r)}}else{if(Gu(r))throw Error(n(418));r.flags=r.flags&-4097|2,ct=!1,yn=r}}}function hm(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;yn=r}function Ta(r){if(r!==yn)return!1;if(!ct)return hm(r),ct=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!$u(r.type,r.memoizedProps)),o&&(o=vn)){if(Gu(r))throw pm(),Error(n(418));for(;o;)fm(r,o),o=Ir(o.nextSibling)}if(hm(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(o===0){vn=Ir(r.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}r=r.nextSibling}vn=null}}else vn=yn?Ir(r.stateNode.nextSibling):null;return!0}function pm(){for(var r=vn;r;)r=Ir(r.nextSibling)}function Xi(){vn=yn=null,ct=!1}function Ju(r){Vn===null?Vn=[r]:Vn.push(r)}var jb=P.ReactCurrentBatchConfig;function Zo(r,o,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var d=u.stateNode}if(!d)throw Error(n(147,r));var g=d,x=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(b){var I=g.refs;b===null?delete I[x]:I[x]=b},o._stringRef=x,o)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function Pa(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function mm(r){var o=r._init;return o(r._payload)}function gm(r){function o($,z){if(r){var W=$.deletions;W===null?($.deletions=[z],$.flags|=16):W.push(z)}}function u($,z){if(!r)return null;for(;z!==null;)o($,z),z=z.sibling;return null}function d($,z){for($=new Map;z!==null;)z.key!==null?$.set(z.key,z):$.set(z.index,z),z=z.sibling;return $}function g($,z){return $=Wr($,z),$.index=0,$.sibling=null,$}function x($,z,W){return $.index=W,r?(W=$.alternate,W!==null?(W=W.index,W<z?($.flags|=2,z):W):($.flags|=2,z)):($.flags|=1048576,z)}function b($){return r&&$.alternate===null&&($.flags|=2),$}function I($,z,W,se){return z===null||z.tag!==6?(z=Uc(W,$.mode,se),z.return=$,z):(z=g(z,W),z.return=$,z)}function L($,z,W,se){var Re=W.type;return Re===H?ne($,z,W.props.children,se,W.key):z!==null&&(z.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ge&&mm(Re)===z.type)?(se=g(z,W.props),se.ref=Zo($,z,W),se.return=$,se):(se=Qa(W.type,W.key,W.props,null,$.mode,se),se.ref=Zo($,z,W),se.return=$,se)}function K($,z,W,se){return z===null||z.tag!==4||z.stateNode.containerInfo!==W.containerInfo||z.stateNode.implementation!==W.implementation?(z=Wc(W,$.mode,se),z.return=$,z):(z=g(z,W.children||[]),z.return=$,z)}function ne($,z,W,se,Re){return z===null||z.tag!==7?(z=xi(W,$.mode,se,Re),z.return=$,z):(z=g(z,W),z.return=$,z)}function re($,z,W){if(typeof z=="string"&&z!==""||typeof z=="number")return z=Uc(""+z,$.mode,W),z.return=$,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case O:return W=Qa(z.type,z.key,z.props,null,$.mode,W),W.ref=Zo($,null,z),W.return=$,W;case D:return z=Wc(z,$.mode,W),z.return=$,z;case ge:var se=z._init;return re($,se(z._payload),W)}if(It(z)||le(z))return z=xi(z,$.mode,W,null),z.return=$,z;Pa($,z)}return null}function te($,z,W,se){var Re=z!==null?z.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return Re!==null?null:I($,z,""+W,se);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case O:return W.key===Re?L($,z,W,se):null;case D:return W.key===Re?K($,z,W,se):null;case ge:return Re=W._init,te($,z,Re(W._payload),se)}if(It(W)||le(W))return Re!==null?null:ne($,z,W,se,null);Pa($,W)}return null}function ve($,z,W,se,Re){if(typeof se=="string"&&se!==""||typeof se=="number")return $=$.get(W)||null,I(z,$,""+se,Re);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case O:return $=$.get(se.key===null?W:se.key)||null,L(z,$,se,Re);case D:return $=$.get(se.key===null?W:se.key)||null,K(z,$,se,Re);case ge:var Me=se._init;return ve($,z,W,Me(se._payload),Re)}if(It(se)||le(se))return $=$.get(W)||null,ne(z,$,se,Re,null);Pa(z,se)}return null}function Ce($,z,W,se){for(var Re=null,Me=null,Ie=z,_e=z=0,jt=null;Ie!==null&&_e<W.length;_e++){Ie.index>_e?(jt=Ie,Ie=null):jt=Ie.sibling;var Xe=te($,Ie,W[_e],se);if(Xe===null){Ie===null&&(Ie=jt);break}r&&Ie&&Xe.alternate===null&&o($,Ie),z=x(Xe,z,_e),Me===null?Re=Xe:Me.sibling=Xe,Me=Xe,Ie=jt}if(_e===W.length)return u($,Ie),ct&&fi($,_e),Re;if(Ie===null){for(;_e<W.length;_e++)Ie=re($,W[_e],se),Ie!==null&&(z=x(Ie,z,_e),Me===null?Re=Ie:Me.sibling=Ie,Me=Ie);return ct&&fi($,_e),Re}for(Ie=d($,Ie);_e<W.length;_e++)jt=ve(Ie,$,_e,W[_e],se),jt!==null&&(r&&jt.alternate!==null&&Ie.delete(jt.key===null?_e:jt.key),z=x(jt,z,_e),Me===null?Re=jt:Me.sibling=jt,Me=jt);return r&&Ie.forEach(function(Hr){return o($,Hr)}),ct&&fi($,_e),Re}function Te($,z,W,se){var Re=le(W);if(typeof Re!="function")throw Error(n(150));if(W=Re.call(W),W==null)throw Error(n(151));for(var Me=Re=null,Ie=z,_e=z=0,jt=null,Xe=W.next();Ie!==null&&!Xe.done;_e++,Xe=W.next()){Ie.index>_e?(jt=Ie,Ie=null):jt=Ie.sibling;var Hr=te($,Ie,Xe.value,se);if(Hr===null){Ie===null&&(Ie=jt);break}r&&Ie&&Hr.alternate===null&&o($,Ie),z=x(Hr,z,_e),Me===null?Re=Hr:Me.sibling=Hr,Me=Hr,Ie=jt}if(Xe.done)return u($,Ie),ct&&fi($,_e),Re;if(Ie===null){for(;!Xe.done;_e++,Xe=W.next())Xe=re($,Xe.value,se),Xe!==null&&(z=x(Xe,z,_e),Me===null?Re=Xe:Me.sibling=Xe,Me=Xe);return ct&&fi($,_e),Re}for(Ie=d($,Ie);!Xe.done;_e++,Xe=W.next())Xe=ve(Ie,$,_e,Xe.value,se),Xe!==null&&(r&&Xe.alternate!==null&&Ie.delete(Xe.key===null?_e:Xe.key),z=x(Xe,z,_e),Me===null?Re=Xe:Me.sibling=Xe,Me=Xe);return r&&Ie.forEach(function(uC){return o($,uC)}),ct&&fi($,_e),Re}function xt($,z,W,se){if(typeof W=="object"&&W!==null&&W.type===H&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case O:e:{for(var Re=W.key,Me=z;Me!==null;){if(Me.key===Re){if(Re=W.type,Re===H){if(Me.tag===7){u($,Me.sibling),z=g(Me,W.props.children),z.return=$,$=z;break e}}else if(Me.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ge&&mm(Re)===Me.type){u($,Me.sibling),z=g(Me,W.props),z.ref=Zo($,Me,W),z.return=$,$=z;break e}u($,Me);break}else o($,Me);Me=Me.sibling}W.type===H?(z=xi(W.props.children,$.mode,se,W.key),z.return=$,$=z):(se=Qa(W.type,W.key,W.props,null,$.mode,se),se.ref=Zo($,z,W),se.return=$,$=se)}return b($);case D:e:{for(Me=W.key;z!==null;){if(z.key===Me)if(z.tag===4&&z.stateNode.containerInfo===W.containerInfo&&z.stateNode.implementation===W.implementation){u($,z.sibling),z=g(z,W.children||[]),z.return=$,$=z;break e}else{u($,z);break}else o($,z);z=z.sibling}z=Wc(W,$.mode,se),z.return=$,$=z}return b($);case ge:return Me=W._init,xt($,z,Me(W._payload),se)}if(It(W))return Ce($,z,W,se);if(le(W))return Te($,z,W,se);Pa($,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,z!==null&&z.tag===6?(u($,z.sibling),z=g(z,W),z.return=$,$=z):(u($,z),z=Uc(W,$.mode,se),z.return=$,$=z),b($)):u($,z)}return xt}var Yi=gm(!0),ym=gm(!1),Ra=Dr(null),Aa=null,Gi=null,Zu=null;function ec(){Zu=Gi=Aa=null}function tc(r){var o=Ra.current;lt(Ra),r._currentValue=o}function nc(r,o,u){for(;r!==null;){var d=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),r===u)break;r=r.return}}function Qi(r,o){Aa=r,Zu=Gi=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(un=!0),r.firstContext=null)}function Pn(r){var o=r._currentValue;if(Zu!==r)if(r={context:r,memoizedValue:o,next:null},Gi===null){if(Aa===null)throw Error(n(308));Gi=r,Aa.dependencies={lanes:0,firstContext:r}}else Gi=Gi.next=r;return o}var di=null;function rc(r){di===null?di=[r]:di.push(r)}function vm(r,o,u,d){var g=o.interleaved;return g===null?(u.next=u,rc(o)):(u.next=g.next,g.next=u),o.interleaved=u,mr(r,d)}function mr(r,o){r.lanes|=o;var u=r.alternate;for(u!==null&&(u.lanes|=o),u=r,r=r.return;r!==null;)r.childLanes|=o,u=r.alternate,u!==null&&(u.childLanes|=o),u=r,r=r.return;return u.tag===3?u.stateNode:null}var Or=!1;function ic(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xm(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function gr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Fr(r,o,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(qe&2)!==0){var g=d.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),d.pending=o,mr(r,u)}return g=d.interleaved,g===null?(o.next=o,rc(d)):(o.next=g.next,g.next=o),d.interleaved=o,mr(r,u)}function ja(r,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var d=o.lanes;d&=r.pendingLanes,u|=d,o.lanes=u,vu(r,u)}}function wm(r,o){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var g=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var b={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};x===null?g=x=b:x=x.next=b,u=u.next}while(u!==null);x===null?g=x=o:x=x.next=o}else g=x=o;u={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:x,shared:d.shared,effects:d.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=o:r.next=o,u.lastBaseUpdate=o}function Na(r,o,u,d){var g=r.updateQueue;Or=!1;var x=g.firstBaseUpdate,b=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var L=I,K=L.next;L.next=null,b===null?x=K:b.next=K,b=L;var ne=r.alternate;ne!==null&&(ne=ne.updateQueue,I=ne.lastBaseUpdate,I!==b&&(I===null?ne.firstBaseUpdate=K:I.next=K,ne.lastBaseUpdate=L))}if(x!==null){var re=g.baseState;b=0,ne=K=L=null,I=x;do{var te=I.lane,ve=I.eventTime;if((d&te)===te){ne!==null&&(ne=ne.next={eventTime:ve,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var Ce=r,Te=I;switch(te=o,ve=u,Te.tag){case 1:if(Ce=Te.payload,typeof Ce=="function"){re=Ce.call(ve,re,te);break e}re=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Te.payload,te=typeof Ce=="function"?Ce.call(ve,re,te):Ce,te==null)break e;re=j({},re,te);break e;case 2:Or=!0}}I.callback!==null&&I.lane!==0&&(r.flags|=64,te=g.effects,te===null?g.effects=[I]:te.push(I))}else ve={eventTime:ve,lane:te,tag:I.tag,payload:I.payload,callback:I.callback,next:null},ne===null?(K=ne=ve,L=re):ne=ne.next=ve,b|=te;if(I=I.next,I===null){if(I=g.shared.pending,I===null)break;te=I,I=te.next,te.next=null,g.lastBaseUpdate=te,g.shared.pending=null}}while(!0);if(ne===null&&(L=re),g.baseState=L,g.firstBaseUpdate=K,g.lastBaseUpdate=ne,o=g.shared.interleaved,o!==null){g=o;do b|=g.lane,g=g.next;while(g!==o)}else x===null&&(g.shared.lanes=0);mi|=b,r.lanes=b,r.memoizedState=re}}function km(r,o,u){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var d=r[o],g=d.callback;if(g!==null){if(d.callback=null,d=u,typeof g!="function")throw Error(n(191,g));g.call(d)}}}var es={},Jn=Dr(es),ts=Dr(es),ns=Dr(es);function hi(r){if(r===es)throw Error(n(174));return r}function oc(r,o){switch(st(ns,o),st(ts,r),st(Jn,es),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ie(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=ie(o,r)}lt(Jn),st(Jn,o)}function Ji(){lt(Jn),lt(ts),lt(ns)}function Sm(r){hi(ns.current);var o=hi(Jn.current),u=ie(o,r.type);o!==u&&(st(ts,r),st(Jn,u))}function sc(r){ts.current===r&&(lt(Jn),lt(ts))}var ft=Dr(0);function Ma(r){for(var o=r;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var ac=[];function lc(){for(var r=0;r<ac.length;r++)ac[r]._workInProgressVersionPrimary=null;ac.length=0}var Ia=P.ReactCurrentDispatcher,uc=P.ReactCurrentBatchConfig,pi=0,dt=null,bt=null,Rt=null,Da=!1,rs=!1,is=0,Nb=0;function Ut(){throw Error(n(321))}function cc(r,o){if(o===null)return!1;for(var u=0;u<o.length&&u<r.length;u++)if(!zn(r[u],o[u]))return!1;return!0}function fc(r,o,u,d,g,x){if(pi=x,dt=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ia.current=r===null||r.memoizedState===null?_b:Lb,r=u(d,g),rs){x=0;do{if(rs=!1,is=0,25<=x)throw Error(n(301));x+=1,Rt=bt=null,o.updateQueue=null,Ia.current=Ob,r=u(d,g)}while(rs)}if(Ia.current=Oa,o=bt!==null&&bt.next!==null,pi=0,Rt=bt=dt=null,Da=!1,o)throw Error(n(300));return r}function dc(){var r=is!==0;return is=0,r}function Zn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?dt.memoizedState=Rt=r:Rt=Rt.next=r,Rt}function Rn(){if(bt===null){var r=dt.alternate;r=r!==null?r.memoizedState:null}else r=bt.next;var o=Rt===null?dt.memoizedState:Rt.next;if(o!==null)Rt=o,bt=r;else{if(r===null)throw Error(n(310));bt=r,r={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Rt===null?dt.memoizedState=Rt=r:Rt=Rt.next=r}return Rt}function os(r,o){return typeof o=="function"?o(r):o}function hc(r){var o=Rn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var d=bt,g=d.baseQueue,x=u.pending;if(x!==null){if(g!==null){var b=g.next;g.next=x.next,x.next=b}d.baseQueue=g=x,u.pending=null}if(g!==null){x=g.next,d=d.baseState;var I=b=null,L=null,K=x;do{var ne=K.lane;if((pi&ne)===ne)L!==null&&(L=L.next={lane:0,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),d=K.hasEagerState?K.eagerState:r(d,K.action);else{var re={lane:ne,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null};L===null?(I=L=re,b=d):L=L.next=re,dt.lanes|=ne,mi|=ne}K=K.next}while(K!==null&&K!==x);L===null?b=d:L.next=I,zn(d,o.memoizedState)||(un=!0),o.memoizedState=d,o.baseState=b,o.baseQueue=L,u.lastRenderedState=d}if(r=u.interleaved,r!==null){g=r;do x=g.lane,dt.lanes|=x,mi|=x,g=g.next;while(g!==r)}else g===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function pc(r){var o=Rn(),u=o.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var d=u.dispatch,g=u.pending,x=o.memoizedState;if(g!==null){u.pending=null;var b=g=g.next;do x=r(x,b.action),b=b.next;while(b!==g);zn(x,o.memoizedState)||(un=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),u.lastRenderedState=x}return[x,d]}function bm(){}function Cm(r,o){var u=dt,d=Rn(),g=o(),x=!zn(d.memoizedState,g);if(x&&(d.memoizedState=g,un=!0),d=d.queue,mc(Pm.bind(null,u,d,r),[r]),d.getSnapshot!==o||x||Rt!==null&&Rt.memoizedState.tag&1){if(u.flags|=2048,ss(9,Tm.bind(null,u,d,g,o),void 0,null),At===null)throw Error(n(349));(pi&30)!==0||Em(u,o,g)}return g}function Em(r,o,u){r.flags|=16384,r={getSnapshot:o,value:u},o=dt.updateQueue,o===null?(o={lastEffect:null,stores:null},dt.updateQueue=o,o.stores=[r]):(u=o.stores,u===null?o.stores=[r]:u.push(r))}function Tm(r,o,u,d){o.value=u,o.getSnapshot=d,Rm(o)&&Am(r)}function Pm(r,o,u){return u(function(){Rm(o)&&Am(r)})}function Rm(r){var o=r.getSnapshot;r=r.value;try{var u=o();return!zn(r,u)}catch{return!0}}function Am(r){var o=mr(r,1);o!==null&&Wn(o,r,1,-1)}function jm(r){var o=Zn();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:r},o.queue=r,r=r.dispatch=Db.bind(null,dt,r),[o.memoizedState,r]}function ss(r,o,u,d){return r={tag:r,create:o,destroy:u,deps:d,next:null},o=dt.updateQueue,o===null?(o={lastEffect:null,stores:null},dt.updateQueue=o,o.lastEffect=r.next=r):(u=o.lastEffect,u===null?o.lastEffect=r.next=r:(d=u.next,u.next=r,r.next=d,o.lastEffect=r)),r}function Nm(){return Rn().memoizedState}function _a(r,o,u,d){var g=Zn();dt.flags|=r,g.memoizedState=ss(1|o,u,void 0,d===void 0?null:d)}function La(r,o,u,d){var g=Rn();d=d===void 0?null:d;var x=void 0;if(bt!==null){var b=bt.memoizedState;if(x=b.destroy,d!==null&&cc(d,b.deps)){g.memoizedState=ss(o,u,x,d);return}}dt.flags|=r,g.memoizedState=ss(1|o,u,x,d)}function Mm(r,o){return _a(8390656,8,r,o)}function mc(r,o){return La(2048,8,r,o)}function Im(r,o){return La(4,2,r,o)}function Dm(r,o){return La(4,4,r,o)}function _m(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function Lm(r,o,u){return u=u!=null?u.concat([r]):null,La(4,4,_m.bind(null,o,r),u)}function gc(){}function Om(r,o){var u=Rn();o=o===void 0?null:o;var d=u.memoizedState;return d!==null&&o!==null&&cc(o,d[1])?d[0]:(u.memoizedState=[r,o],r)}function Fm(r,o){var u=Rn();o=o===void 0?null:o;var d=u.memoizedState;return d!==null&&o!==null&&cc(o,d[1])?d[0]:(r=r(),u.memoizedState=[r,o],r)}function zm(r,o,u){return(pi&21)===0?(r.baseState&&(r.baseState=!1,un=!0),r.memoizedState=u):(zn(u,o)||(u=mp(),dt.lanes|=u,mi|=u,r.baseState=!0),o)}function Mb(r,o){var u=Qe;Qe=u!==0&&4>u?u:4,r(!0);var d=uc.transition;uc.transition={};try{r(!1),o()}finally{Qe=u,uc.transition=d}}function Vm(){return Rn().memoizedState}function Ib(r,o,u){var d=$r(r);if(u={lane:d,action:u,hasEagerState:!1,eagerState:null,next:null},Bm(r))$m(o,u);else if(u=vm(r,o,u,d),u!==null){var g=Zt();Wn(u,r,d,g),Um(u,o,d)}}function Db(r,o,u){var d=$r(r),g={lane:d,action:u,hasEagerState:!1,eagerState:null,next:null};if(Bm(r))$m(o,g);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var b=o.lastRenderedState,I=x(b,u);if(g.hasEagerState=!0,g.eagerState=I,zn(I,b)){var L=o.interleaved;L===null?(g.next=g,rc(o)):(g.next=L.next,L.next=g),o.interleaved=g;return}}catch{}finally{}u=vm(r,o,g,d),u!==null&&(g=Zt(),Wn(u,r,d,g),Um(u,o,d))}}function Bm(r){var o=r.alternate;return r===dt||o!==null&&o===dt}function $m(r,o){rs=Da=!0;var u=r.pending;u===null?o.next=o:(o.next=u.next,u.next=o),r.pending=o}function Um(r,o,u){if((u&4194240)!==0){var d=o.lanes;d&=r.pendingLanes,u|=d,o.lanes=u,vu(r,u)}}var Oa={readContext:Pn,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},_b={readContext:Pn,useCallback:function(r,o){return Zn().memoizedState=[r,o===void 0?null:o],r},useContext:Pn,useEffect:Mm,useImperativeHandle:function(r,o,u){return u=u!=null?u.concat([r]):null,_a(4194308,4,_m.bind(null,o,r),u)},useLayoutEffect:function(r,o){return _a(4194308,4,r,o)},useInsertionEffect:function(r,o){return _a(4,2,r,o)},useMemo:function(r,o){var u=Zn();return o=o===void 0?null:o,r=r(),u.memoizedState=[r,o],r},useReducer:function(r,o,u){var d=Zn();return o=u!==void 0?u(o):o,d.memoizedState=d.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},d.queue=r,r=r.dispatch=Ib.bind(null,dt,r),[d.memoizedState,r]},useRef:function(r){var o=Zn();return r={current:r},o.memoizedState=r},useState:jm,useDebugValue:gc,useDeferredValue:function(r){return Zn().memoizedState=r},useTransition:function(){var r=jm(!1),o=r[0];return r=Mb.bind(null,r[1]),Zn().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,u){var d=dt,g=Zn();if(ct){if(u===void 0)throw Error(n(407));u=u()}else{if(u=o(),At===null)throw Error(n(349));(pi&30)!==0||Em(d,o,u)}g.memoizedState=u;var x={value:u,getSnapshot:o};return g.queue=x,Mm(Pm.bind(null,d,x,r),[r]),d.flags|=2048,ss(9,Tm.bind(null,d,x,u,o),void 0,null),u},useId:function(){var r=Zn(),o=At.identifierPrefix;if(ct){var u=pr,d=hr;u=(d&~(1<<32-Fn(d)-1)).toString(32)+u,o=":"+o+"R"+u,u=is++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=Nb++,o=":"+o+"r"+u.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},Lb={readContext:Pn,useCallback:Om,useContext:Pn,useEffect:mc,useImperativeHandle:Lm,useInsertionEffect:Im,useLayoutEffect:Dm,useMemo:Fm,useReducer:hc,useRef:Nm,useState:function(){return hc(os)},useDebugValue:gc,useDeferredValue:function(r){var o=Rn();return zm(o,bt.memoizedState,r)},useTransition:function(){var r=hc(os)[0],o=Rn().memoizedState;return[r,o]},useMutableSource:bm,useSyncExternalStore:Cm,useId:Vm,unstable_isNewReconciler:!1},Ob={readContext:Pn,useCallback:Om,useContext:Pn,useEffect:mc,useImperativeHandle:Lm,useInsertionEffect:Im,useLayoutEffect:Dm,useMemo:Fm,useReducer:pc,useRef:Nm,useState:function(){return pc(os)},useDebugValue:gc,useDeferredValue:function(r){var o=Rn();return bt===null?o.memoizedState=r:zm(o,bt.memoizedState,r)},useTransition:function(){var r=pc(os)[0],o=Rn().memoizedState;return[r,o]},useMutableSource:bm,useSyncExternalStore:Cm,useId:Vm,unstable_isNewReconciler:!1};function Bn(r,o){if(r&&r.defaultProps){o=j({},o),r=r.defaultProps;for(var u in r)o[u]===void 0&&(o[u]=r[u]);return o}return o}function yc(r,o,u,d){o=r.memoizedState,u=u(d,o),u=u==null?o:j({},o,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Fa={isMounted:function(r){return(r=r._reactInternals)?Pt(r)===r:!1},enqueueSetState:function(r,o,u){r=r._reactInternals;var d=Zt(),g=$r(r),x=gr(d,g);x.payload=o,u!=null&&(x.callback=u),o=Fr(r,x,g),o!==null&&(Wn(o,r,g,d),ja(o,r,g))},enqueueReplaceState:function(r,o,u){r=r._reactInternals;var d=Zt(),g=$r(r),x=gr(d,g);x.tag=1,x.payload=o,u!=null&&(x.callback=u),o=Fr(r,x,g),o!==null&&(Wn(o,r,g,d),ja(o,r,g))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var u=Zt(),d=$r(r),g=gr(u,d);g.tag=2,o!=null&&(g.callback=o),o=Fr(r,g,d),o!==null&&(Wn(o,r,d,u),ja(o,r,d))}};function Wm(r,o,u,d,g,x,b){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,b):o.prototype&&o.prototype.isPureReactComponent?!Ko(u,d)||!Ko(g,x):!0}function Hm(r,o,u){var d=!1,g=_r,x=o.contextType;return typeof x=="object"&&x!==null?x=Pn(x):(g=ln(o)?ui:$t.current,d=o.contextTypes,x=(d=d!=null)?Hi(r,g):_r),o=new o(u,x),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Fa,r.stateNode=o,o._reactInternals=r,d&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=g,r.__reactInternalMemoizedMaskedChildContext=x),o}function Km(r,o,u,d){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,d),o.state!==r&&Fa.enqueueReplaceState(o,o.state,null)}function vc(r,o,u,d){var g=r.stateNode;g.props=u,g.state=r.memoizedState,g.refs={},ic(r);var x=o.contextType;typeof x=="object"&&x!==null?g.context=Pn(x):(x=ln(o)?ui:$t.current,g.context=Hi(r,x)),g.state=r.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(yc(r,o,x,u),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(o=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),o!==g.state&&Fa.enqueueReplaceState(g,g.state,null),Na(r,u,g,d),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308)}function Zi(r,o){try{var u="",d=o;do u+=ye(d),d=d.return;while(d);var g=u}catch(x){g=`
39
39
  Error generating stack: `+x.message+`
40
40
  `+x.stack}return{value:r,source:o,stack:g,digest:null}}function xc(r,o,u){return{value:r,source:null,stack:u??null,digest:o??null}}function wc(r,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var Fb=typeof WeakMap=="function"?WeakMap:Map;function qm(r,o,u){u=gr(-1,u),u.tag=3,u.payload={element:null};var d=o.value;return u.callback=function(){Ha||(Ha=!0,_c=d),wc(r,o)},u}function Xm(r,o,u){u=gr(-1,u),u.tag=3;var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var g=o.value;u.payload=function(){return d(g)},u.callback=function(){wc(r,o)}}var x=r.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(u.callback=function(){wc(r,o),typeof d!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var b=o.stack;this.componentDidCatch(o.value,{componentStack:b!==null?b:""})}),u}function Ym(r,o,u){var d=r.pingCache;if(d===null){d=r.pingCache=new Fb;var g=new Set;d.set(o,g)}else g=d.get(o),g===void 0&&(g=new Set,d.set(o,g));g.has(u)||(g.add(u),r=Jb.bind(null,r,o,u),o.then(r,r))}function Gm(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function Qm(r,o,u,d,g){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=gr(-1,1),o.tag=2,Fr(u,o,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=g,r)}var zb=P.ReactCurrentOwner,un=!1;function Jt(r,o,u,d){o.child=r===null?ym(o,null,u,d):Yi(o,r.child,u,d)}function Jm(r,o,u,d,g){u=u.render;var x=o.ref;return Qi(o,g),d=fc(r,o,u,d,x,g),u=dc(),r!==null&&!un?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,yr(r,o,g)):(ct&&u&&Xu(o),o.flags|=1,Jt(r,o,d,g),o.child)}function Zm(r,o,u,d,g){if(r===null){var x=u.type;return typeof x=="function"&&!$c(x)&&x.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=x,eg(r,o,x,d,g)):(r=Qa(u.type,null,d,o,o.mode,g),r.ref=o.ref,r.return=o,o.child=r)}if(x=r.child,(r.lanes&g)===0){var b=x.memoizedProps;if(u=u.compare,u=u!==null?u:Ko,u(b,d)&&r.ref===o.ref)return yr(r,o,g)}return o.flags|=1,r=Wr(x,d),r.ref=o.ref,r.return=o,o.child=r}function eg(r,o,u,d,g){if(r!==null){var x=r.memoizedProps;if(Ko(x,d)&&r.ref===o.ref)if(un=!1,o.pendingProps=d=x,(r.lanes&g)!==0)(r.flags&131072)!==0&&(un=!0);else return o.lanes=r.lanes,yr(r,o,g)}return kc(r,o,u,d,g)}function tg(r,o,u){var d=o.pendingProps,g=d.children,x=r!==null?r.memoizedState:null;if(d.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},st(to,xn),xn|=u;else{if((u&1073741824)===0)return r=x!==null?x.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,st(to,xn),xn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=x!==null?x.baseLanes:u,st(to,xn),xn|=d}else x!==null?(d=x.baseLanes|u,o.memoizedState=null):d=u,st(to,xn),xn|=d;return Jt(r,o,g,u),o.child}function ng(r,o){var u=o.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function kc(r,o,u,d,g){var x=ln(u)?ui:$t.current;return x=Hi(o,x),Qi(o,g),u=fc(r,o,u,d,x,g),d=dc(),r!==null&&!un?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,yr(r,o,g)):(ct&&d&&Xu(o),o.flags|=1,Jt(r,o,u,g),o.child)}function rg(r,o,u,d,g){if(ln(u)){var x=!0;Sa(o)}else x=!1;if(Qi(o,g),o.stateNode===null)Va(r,o),Hm(o,u,d),vc(o,u,d,g),d=!0;else if(r===null){var b=o.stateNode,I=o.memoizedProps;b.props=I;var L=b.context,K=u.contextType;typeof K=="object"&&K!==null?K=Pn(K):(K=ln(u)?ui:$t.current,K=Hi(o,K));var ne=u.getDerivedStateFromProps,re=typeof ne=="function"||typeof b.getSnapshotBeforeUpdate=="function";re||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(I!==d||L!==K)&&Km(o,b,d,K),Or=!1;var te=o.memoizedState;b.state=te,Na(o,d,b,g),L=o.memoizedState,I!==d||te!==L||an.current||Or?(typeof ne=="function"&&(yc(o,u,ne,d),L=o.memoizedState),(I=Or||Wm(o,u,I,d,te,L,K))?(re||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"&&(o.flags|=4194308)):(typeof b.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=L),b.props=d,b.state=L,b.context=K,d=I):(typeof b.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{b=o.stateNode,xm(r,o),I=o.memoizedProps,K=o.type===o.elementType?I:Bn(o.type,I),b.props=K,re=o.pendingProps,te=b.context,L=u.contextType,typeof L=="object"&&L!==null?L=Pn(L):(L=ln(u)?ui:$t.current,L=Hi(o,L));var ve=u.getDerivedStateFromProps;(ne=typeof ve=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(I!==re||te!==L)&&Km(o,b,d,L),Or=!1,te=o.memoizedState,b.state=te,Na(o,d,b,g);var Ce=o.memoizedState;I!==re||te!==Ce||an.current||Or?(typeof ve=="function"&&(yc(o,u,ve,d),Ce=o.memoizedState),(K=Or||Wm(o,u,K,d,te,Ce,L)||!1)?(ne||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(d,Ce,L),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,Ce,L)),typeof b.componentDidUpdate=="function"&&(o.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof b.componentDidUpdate!="function"||I===r.memoizedProps&&te===r.memoizedState||(o.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&te===r.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=Ce),b.props=d,b.state=Ce,b.context=L,d=K):(typeof b.componentDidUpdate!="function"||I===r.memoizedProps&&te===r.memoizedState||(o.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&te===r.memoizedState||(o.flags|=1024),d=!1)}return Sc(r,o,u,d,x,g)}function Sc(r,o,u,d,g,x){ng(r,o);var b=(o.flags&128)!==0;if(!d&&!b)return g&&lm(o,u,!1),yr(r,o,x);d=o.stateNode,zb.current=o;var I=b&&typeof u.getDerivedStateFromError!="function"?null:d.render();return o.flags|=1,r!==null&&b?(o.child=Yi(o,r.child,null,x),o.child=Yi(o,null,I,x)):Jt(r,o,I,x),o.memoizedState=d.state,g&&lm(o,u,!0),o.child}function ig(r){var o=r.stateNode;o.pendingContext?sm(r,o.pendingContext,o.pendingContext!==o.context):o.context&&sm(r,o.context,!1),oc(r,o.containerInfo)}function og(r,o,u,d,g){return Xi(),Ju(g),o.flags|=256,Jt(r,o,u,d),o.child}var bc={dehydrated:null,treeContext:null,retryLane:0};function Cc(r){return{baseLanes:r,cachePool:null,transitions:null}}function sg(r,o,u){var d=o.pendingProps,g=ft.current,x=!1,b=(o.flags&128)!==0,I;if((I=b)||(I=r!==null&&r.memoizedState===null?!1:(g&2)!==0),I?(x=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(g|=1),st(ft,g&1),r===null)return Qu(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(b=d.children,r=d.fallback,x?(d=o.mode,x=o.child,b={mode:"hidden",children:b},(d&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=b):x=Ja(b,d,0,null),r=xi(r,d,u,null),x.return=o,r.return=o,x.sibling=r,o.child=x,o.child.memoizedState=Cc(u),o.memoizedState=bc,r):Ec(o,b));if(g=r.memoizedState,g!==null&&(I=g.dehydrated,I!==null))return Vb(r,o,b,d,I,g,u);if(x){x=d.fallback,b=o.mode,g=r.child,I=g.sibling;var L={mode:"hidden",children:d.children};return(b&1)===0&&o.child!==g?(d=o.child,d.childLanes=0,d.pendingProps=L,o.deletions=null):(d=Wr(g,L),d.subtreeFlags=g.subtreeFlags&14680064),I!==null?x=Wr(I,x):(x=xi(x,b,u,null),x.flags|=2),x.return=o,d.return=o,d.sibling=x,o.child=d,d=x,x=o.child,b=r.child.memoizedState,b=b===null?Cc(u):{baseLanes:b.baseLanes|u,cachePool:null,transitions:b.transitions},x.memoizedState=b,x.childLanes=r.childLanes&~u,o.memoizedState=bc,d}return x=r.child,r=x.sibling,d=Wr(x,{mode:"visible",children:d.children}),(o.mode&1)===0&&(d.lanes=u),d.return=o,d.sibling=null,r!==null&&(u=o.deletions,u===null?(o.deletions=[r],o.flags|=16):u.push(r)),o.child=d,o.memoizedState=null,d}function Ec(r,o){return o=Ja({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function za(r,o,u,d){return d!==null&&Ju(d),Yi(o,r.child,null,u),r=Ec(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function Vb(r,o,u,d,g,x,b){if(u)return o.flags&256?(o.flags&=-257,d=xc(Error(n(422))),za(r,o,b,d)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(x=d.fallback,g=o.mode,d=Ja({mode:"visible",children:d.children},g,0,null),x=xi(x,g,b,null),x.flags|=2,d.return=o,x.return=o,d.sibling=x,o.child=d,(o.mode&1)!==0&&Yi(o,r.child,null,b),o.child.memoizedState=Cc(b),o.memoizedState=bc,x);if((o.mode&1)===0)return za(r,o,b,null);if(g.data==="$!"){if(d=g.nextSibling&&g.nextSibling.dataset,d)var I=d.dgst;return d=I,x=Error(n(419)),d=xc(x,d,void 0),za(r,o,b,d)}if(I=(b&r.childLanes)!==0,un||I){if(d=At,d!==null){switch(b&-b){case 4:g=2;break;case 16:g=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(d.suspendedLanes|b))!==0?0:g,g!==0&&g!==x.retryLane&&(x.retryLane=g,mr(r,g),Wn(d,r,g,-1))}return Bc(),d=xc(Error(n(421))),za(r,o,b,d)}return g.data==="$?"?(o.flags|=128,o.child=r.child,o=Zb.bind(null,r),g._reactRetry=o,null):(r=x.treeContext,vn=Ir(g.nextSibling),yn=o,ct=!0,Vn=null,r!==null&&(En[Tn++]=hr,En[Tn++]=pr,En[Tn++]=ci,hr=r.id,pr=r.overflow,ci=o),o=Ec(o,d.children),o.flags|=4096,o)}function ag(r,o,u){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o),nc(r.return,o,u)}function Tc(r,o,u,d,g){var x=r.memoizedState;x===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:g}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=d,x.tail=u,x.tailMode=g)}function lg(r,o,u){var d=o.pendingProps,g=d.revealOrder,x=d.tail;if(Jt(r,o,d.children,u),d=ft.current,(d&2)!==0)d=d&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&ag(r,u,o);else if(r.tag===19)ag(r,u,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}d&=1}if(st(ft,d),(o.mode&1)===0)o.memoizedState=null;else switch(g){case"forwards":for(u=o.child,g=null;u!==null;)r=u.alternate,r!==null&&Ma(r)===null&&(g=u),u=u.sibling;u=g,u===null?(g=o.child,o.child=null):(g=u.sibling,u.sibling=null),Tc(o,!1,g,u,x);break;case"backwards":for(u=null,g=o.child,o.child=null;g!==null;){if(r=g.alternate,r!==null&&Ma(r)===null){o.child=g;break}r=g.sibling,g.sibling=u,u=g,g=r}Tc(o,!0,u,null,x);break;case"together":Tc(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Va(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function yr(r,o,u){if(r!==null&&(o.dependencies=r.dependencies),mi|=o.lanes,(u&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,u=Wr(r,r.pendingProps),o.child=u,u.return=o;r.sibling!==null;)r=r.sibling,u=u.sibling=Wr(r,r.pendingProps),u.return=o;u.sibling=null}return o.child}function Bb(r,o,u){switch(o.tag){case 3:ig(o),Xi();break;case 5:Sm(o);break;case 1:ln(o.type)&&Sa(o);break;case 4:oc(o,o.stateNode.containerInfo);break;case 10:var d=o.type._context,g=o.memoizedProps.value;st(Ra,d._currentValue),d._currentValue=g;break;case 13:if(d=o.memoizedState,d!==null)return d.dehydrated!==null?(st(ft,ft.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?sg(r,o,u):(st(ft,ft.current&1),r=yr(r,o,u),r!==null?r.sibling:null);st(ft,ft.current&1);break;case 19:if(d=(u&o.childLanes)!==0,(r.flags&128)!==0){if(d)return lg(r,o,u);o.flags|=128}if(g=o.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),st(ft,ft.current),d)break;return null;case 22:case 23:return o.lanes=0,tg(r,o,u)}return yr(r,o,u)}var ug,Pc,cg,fg;ug=function(r,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Pc=function(){},cg=function(r,o,u,d){var g=r.memoizedProps;if(g!==d){r=o.stateNode,hi(Jn.current);var x=null;switch(u){case"input":g=it(r,g),d=it(r,d),x=[];break;case"select":g=j({},g,{value:void 0}),d=j({},d,{value:void 0}),x=[];break;case"textarea":g=Tt(r,g),d=Tt(r,d),x=[];break;default:typeof g.onClick!="function"&&typeof d.onClick=="function"&&(r.onclick=xa)}Pe(u,d);var b;u=null;for(K in g)if(!d.hasOwnProperty(K)&&g.hasOwnProperty(K)&&g[K]!=null)if(K==="style"){var I=g[K];for(b in I)I.hasOwnProperty(b)&&(u||(u={}),u[b]="")}else K!=="dangerouslySetInnerHTML"&&K!=="children"&&K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&K!=="autoFocus"&&(s.hasOwnProperty(K)?x||(x=[]):(x=x||[]).push(K,null));for(K in d){var L=d[K];if(I=g?.[K],d.hasOwnProperty(K)&&L!==I&&(L!=null||I!=null))if(K==="style")if(I){for(b in I)!I.hasOwnProperty(b)||L&&L.hasOwnProperty(b)||(u||(u={}),u[b]="");for(b in L)L.hasOwnProperty(b)&&I[b]!==L[b]&&(u||(u={}),u[b]=L[b])}else u||(x||(x=[]),x.push(K,u)),u=L;else K==="dangerouslySetInnerHTML"?(L=L?L.__html:void 0,I=I?I.__html:void 0,L!=null&&I!==L&&(x=x||[]).push(K,L)):K==="children"?typeof L!="string"&&typeof L!="number"||(x=x||[]).push(K,""+L):K!=="suppressContentEditableWarning"&&K!=="suppressHydrationWarning"&&(s.hasOwnProperty(K)?(L!=null&&K==="onScroll"&&at("scroll",r),x||I===L||(x=[])):(x=x||[]).push(K,L))}u&&(x=x||[]).push("style",u);var K=x;(o.updateQueue=K)&&(o.flags|=4)}},fg=function(r,o,u,d){u!==d&&(o.flags|=4)};function as(r,o){if(!ct)switch(r.tailMode){case"hidden":o=r.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Wt(r){var o=r.alternate!==null&&r.alternate.child===r.child,u=0,d=0;if(o)for(var g=r.child;g!==null;)u|=g.lanes|g.childLanes,d|=g.subtreeFlags&14680064,d|=g.flags&14680064,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)u|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=d,r.childLanes=u,o}function $b(r,o,u){var d=o.pendingProps;switch(Yu(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(o),null;case 1:return ln(o.type)&&ka(),Wt(o),null;case 3:return d=o.stateNode,Ji(),lt(an),lt($t),lc(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(r===null||r.child===null)&&(Ta(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Vn!==null&&(Fc(Vn),Vn=null))),Pc(r,o),Wt(o),null;case 5:sc(o);var g=hi(ns.current);if(u=o.type,r!==null&&o.stateNode!=null)cg(r,o,u,d,g),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!d){if(o.stateNode===null)throw Error(n(166));return Wt(o),null}if(r=hi(Jn.current),Ta(o)){d=o.stateNode,u=o.type;var x=o.memoizedProps;switch(d[Qn]=o,d[Qo]=x,r=(o.mode&1)!==0,u){case"dialog":at("cancel",d),at("close",d);break;case"iframe":case"object":case"embed":at("load",d);break;case"video":case"audio":for(g=0;g<Xo.length;g++)at(Xo[g],d);break;case"source":at("error",d);break;case"img":case"image":case"link":at("error",d),at("load",d);break;case"details":at("toggle",d);break;case"input":Mt(d,x),at("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!x.multiple},at("invalid",d);break;case"textarea":We(d,x),at("invalid",d)}Pe(u,x),g=null;for(var b in x)if(x.hasOwnProperty(b)){var I=x[b];b==="children"?typeof I=="string"?d.textContent!==I&&(x.suppressHydrationWarning!==!0&&va(d.textContent,I,r),g=["children",I]):typeof I=="number"&&d.textContent!==""+I&&(x.suppressHydrationWarning!==!0&&va(d.textContent,I,r),g=["children",""+I]):s.hasOwnProperty(b)&&I!=null&&b==="onScroll"&&at("scroll",d)}switch(u){case"input":Oe(d),zt(d,x,!0);break;case"textarea":Oe(d),ur(d);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(d.onclick=xa)}d=g,o.updateQueue=d,d!==null&&(o.flags|=4)}else{b=g.nodeType===9?g:g.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=X(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=b.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof d.is=="string"?r=b.createElement(u,{is:d.is}):(r=b.createElement(u),u==="select"&&(b=r,d.multiple?b.multiple=!0:d.size&&(b.size=d.size))):r=b.createElementNS(r,u),r[Qn]=o,r[Qo]=d,ug(r,o,!1,!1),o.stateNode=r;e:{switch(b=de(u,d),u){case"dialog":at("cancel",r),at("close",r),g=d;break;case"iframe":case"object":case"embed":at("load",r),g=d;break;case"video":case"audio":for(g=0;g<Xo.length;g++)at(Xo[g],r);g=d;break;case"source":at("error",r),g=d;break;case"img":case"image":case"link":at("error",r),at("load",r),g=d;break;case"details":at("toggle",r),g=d;break;case"input":Mt(r,d),g=it(r,d),at("invalid",r);break;case"option":g=d;break;case"select":r._wrapperState={wasMultiple:!!d.multiple},g=j({},d,{value:void 0}),at("invalid",r);break;case"textarea":We(r,d),g=Tt(r,d),at("invalid",r);break;default:g=d}Pe(u,g),I=g;for(x in I)if(I.hasOwnProperty(x)){var L=I[x];x==="style"?fe(r,L):x==="dangerouslySetInnerHTML"?(L=L?L.__html:void 0,L!=null&&Ne(r,L)):x==="children"?typeof L=="string"?(u!=="textarea"||L!=="")&&Fe(r,L):typeof L=="number"&&Fe(r,""+L):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(s.hasOwnProperty(x)?L!=null&&x==="onScroll"&&at("scroll",r):L!=null&&T(r,x,L,b))}switch(u){case"input":Oe(r),zt(r,d,!1);break;case"textarea":Oe(r),ur(r);break;case"option":d.value!=null&&r.setAttribute("value",""+be(d.value));break;case"select":r.multiple=!!d.multiple,x=d.value,x!=null?Yt(r,!!d.multiple,x,!1):d.defaultValue!=null&&Yt(r,!!d.multiple,d.defaultValue,!0);break;default:typeof g.onClick=="function"&&(r.onclick=xa)}switch(u){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Wt(o),null;case 6:if(r&&o.stateNode!=null)fg(r,o,r.memoizedProps,d);else{if(typeof d!="string"&&o.stateNode===null)throw Error(n(166));if(u=hi(ns.current),hi(Jn.current),Ta(o)){if(d=o.stateNode,u=o.memoizedProps,d[Qn]=o,(x=d.nodeValue!==u)&&(r=yn,r!==null))switch(r.tag){case 3:va(d.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&va(d.nodeValue,u,(r.mode&1)!==0)}x&&(o.flags|=4)}else d=(u.nodeType===9?u:u.ownerDocument).createTextNode(d),d[Qn]=o,o.stateNode=d}return Wt(o),null;case 13:if(lt(ft),d=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(ct&&vn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)pm(),Xi(),o.flags|=98560,x=!1;else if(x=Ta(o),d!==null&&d.dehydrated!==null){if(r===null){if(!x)throw Error(n(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[Qn]=o}else Xi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Wt(o),x=!1}else Vn!==null&&(Fc(Vn),Vn=null),x=!0;if(!x)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(d=d!==null,d!==(r!==null&&r.memoizedState!==null)&&d&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(ft.current&1)!==0?Ct===0&&(Ct=3):Bc())),o.updateQueue!==null&&(o.flags|=4),Wt(o),null);case 4:return Ji(),Pc(r,o),r===null&&Yo(o.stateNode.containerInfo),Wt(o),null;case 10:return tc(o.type._context),Wt(o),null;case 17:return ln(o.type)&&ka(),Wt(o),null;case 19:if(lt(ft),x=o.memoizedState,x===null)return Wt(o),null;if(d=(o.flags&128)!==0,b=x.rendering,b===null)if(d)as(x,!1);else{if(Ct!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(b=Ma(r),b!==null){for(o.flags|=128,as(x,!1),d=b.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),o.subtreeFlags=0,d=u,u=o.child;u!==null;)x=u,r=d,x.flags&=14680066,b=x.alternate,b===null?(x.childLanes=0,x.lanes=r,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=b.childLanes,x.lanes=b.lanes,x.child=b.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=b.memoizedProps,x.memoizedState=b.memoizedState,x.updateQueue=b.updateQueue,x.type=b.type,r=b.dependencies,x.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return st(ft,ft.current&1|2),o.child}r=r.sibling}x.tail!==null&&vt()>no&&(o.flags|=128,d=!0,as(x,!1),o.lanes=4194304)}else{if(!d)if(r=Ma(b),r!==null){if(o.flags|=128,d=!0,u=r.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),as(x,!0),x.tail===null&&x.tailMode==="hidden"&&!b.alternate&&!ct)return Wt(o),null}else 2*vt()-x.renderingStartTime>no&&u!==1073741824&&(o.flags|=128,d=!0,as(x,!1),o.lanes=4194304);x.isBackwards?(b.sibling=o.child,o.child=b):(u=x.last,u!==null?u.sibling=b:o.child=b,x.last=b)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=vt(),o.sibling=null,u=ft.current,st(ft,d?u&1|2:u&1),o):(Wt(o),null);case 22:case 23:return Vc(),d=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==d&&(o.flags|=8192),d&&(o.mode&1)!==0?(xn&1073741824)!==0&&(Wt(o),o.subtreeFlags&6&&(o.flags|=8192)):Wt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function Ub(r,o){switch(Yu(o),o.tag){case 1:return ln(o.type)&&ka(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Ji(),lt(an),lt($t),lc(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return sc(o),null;case 13:if(lt(ft),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Xi()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return lt(ft),null;case 4:return Ji(),null;case 10:return tc(o.type._context),null;case 22:case 23:return Vc(),null;case 24:return null;default:return null}}var Ba=!1,Ht=!1,Wb=typeof WeakSet=="function"?WeakSet:Set,ke=null;function eo(r,o){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(d){mt(r,o,d)}else u.current=null}function Rc(r,o,u){try{u()}catch(d){mt(r,o,d)}}var dg=!1;function Hb(r,o){if(Vu=aa,r=Wp(),Mu(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var d=u.getSelection&&u.getSelection();if(d&&d.rangeCount!==0){u=d.anchorNode;var g=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var b=0,I=-1,L=-1,K=0,ne=0,re=r,te=null;t:for(;;){for(var ve;re!==u||g!==0&&re.nodeType!==3||(I=b+g),re!==x||d!==0&&re.nodeType!==3||(L=b+d),re.nodeType===3&&(b+=re.nodeValue.length),(ve=re.firstChild)!==null;)te=re,re=ve;for(;;){if(re===r)break t;if(te===u&&++K===g&&(I=b),te===x&&++ne===d&&(L=b),(ve=re.nextSibling)!==null)break;re=te,te=re.parentNode}re=ve}u=I===-1||L===-1?null:{start:I,end:L}}else u=null}u=u||{start:0,end:0}}else u=null;for(Bu={focusedElem:r,selectionRange:u},aa=!1,ke=o;ke!==null;)if(o=ke,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,ke=r;else for(;ke!==null;){o=ke;try{var Ce=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(Ce!==null){var Te=Ce.memoizedProps,xt=Ce.memoizedState,$=o.stateNode,z=$.getSnapshotBeforeUpdate(o.elementType===o.type?Te:Bn(o.type,Te),xt);$.__reactInternalSnapshotBeforeUpdate=z}break;case 3:var W=o.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(se){mt(o,o.return,se)}if(r=o.sibling,r!==null){r.return=o.return,ke=r;break}ke=o.return}return Ce=dg,dg=!1,Ce}function ls(r,o,u){var d=o.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&r)===r){var x=g.destroy;g.destroy=void 0,x!==void 0&&Rc(o,u,x)}g=g.next}while(g!==d)}}function $a(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&r)===r){var d=u.create;u.destroy=d()}u=u.next}while(u!==o)}}function Ac(r){var o=r.ref;if(o!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof o=="function"?o(r):o.current=r}}function hg(r){var o=r.alternate;o!==null&&(r.alternate=null,hg(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[Qn],delete o[Qo],delete o[Hu],delete o[Pb],delete o[Rb])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function pg(r){return r.tag===5||r.tag===3||r.tag===4}function mg(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||pg(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function jc(r,o,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(r,o):u.insertBefore(r,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(r,u)):(o=u,o.appendChild(r)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=xa));else if(d!==4&&(r=r.child,r!==null))for(jc(r,o,u),r=r.sibling;r!==null;)jc(r,o,u),r=r.sibling}function Nc(r,o,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?u.insertBefore(r,o):u.appendChild(r);else if(d!==4&&(r=r.child,r!==null))for(Nc(r,o,u),r=r.sibling;r!==null;)Nc(r,o,u),r=r.sibling}var _t=null,$n=!1;function zr(r,o,u){for(u=u.child;u!==null;)gg(r,o,u),u=u.sibling}function gg(r,o,u){if(Gn&&typeof Gn.onCommitFiberUnmount=="function")try{Gn.onCommitFiberUnmount(ta,u)}catch{}switch(u.tag){case 5:Ht||eo(u,o);case 6:var d=_t,g=$n;_t=null,zr(r,o,u),_t=d,$n=g,_t!==null&&($n?(r=_t,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):_t.removeChild(u.stateNode));break;case 18:_t!==null&&($n?(r=_t,u=u.stateNode,r.nodeType===8?Wu(r.parentNode,u):r.nodeType===1&&Wu(r,u),Vo(r)):Wu(_t,u.stateNode));break;case 4:d=_t,g=$n,_t=u.stateNode.containerInfo,$n=!0,zr(r,o,u),_t=d,$n=g;break;case 0:case 11:case 14:case 15:if(!Ht&&(d=u.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){g=d=d.next;do{var x=g,b=x.destroy;x=x.tag,b!==void 0&&((x&2)!==0||(x&4)!==0)&&Rc(u,o,b),g=g.next}while(g!==d)}zr(r,o,u);break;case 1:if(!Ht&&(eo(u,o),d=u.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=u.memoizedProps,d.state=u.memoizedState,d.componentWillUnmount()}catch(I){mt(u,o,I)}zr(r,o,u);break;case 21:zr(r,o,u);break;case 22:u.mode&1?(Ht=(d=Ht)||u.memoizedState!==null,zr(r,o,u),Ht=d):zr(r,o,u);break;default:zr(r,o,u)}}function yg(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new Wb),o.forEach(function(d){var g=eC.bind(null,r,d);u.has(d)||(u.add(d),d.then(g,g))})}}function Un(r,o){var u=o.deletions;if(u!==null)for(var d=0;d<u.length;d++){var g=u[d];try{var x=r,b=o,I=b;e:for(;I!==null;){switch(I.tag){case 5:_t=I.stateNode,$n=!1;break e;case 3:_t=I.stateNode.containerInfo,$n=!0;break e;case 4:_t=I.stateNode.containerInfo,$n=!0;break e}I=I.return}if(_t===null)throw Error(n(160));gg(x,b,g),_t=null,$n=!1;var L=g.alternate;L!==null&&(L.return=null),g.return=null}catch(K){mt(g,o,K)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)vg(o,r),o=o.sibling}function vg(r,o){var u=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Un(o,r),er(r),d&4){try{ls(3,r,r.return),$a(3,r)}catch(Te){mt(r,r.return,Te)}try{ls(5,r,r.return)}catch(Te){mt(r,r.return,Te)}}break;case 1:Un(o,r),er(r),d&512&&u!==null&&eo(u,u.return);break;case 5:if(Un(o,r),er(r),d&512&&u!==null&&eo(u,u.return),r.flags&32){var g=r.stateNode;try{Fe(g,"")}catch(Te){mt(r,r.return,Te)}}if(d&4&&(g=r.stateNode,g!=null)){var x=r.memoizedProps,b=u!==null?u.memoizedProps:x,I=r.type,L=r.updateQueue;if(r.updateQueue=null,L!==null)try{I==="input"&&x.type==="radio"&&x.name!=null&&Xt(g,x),de(I,b);var K=de(I,x);for(b=0;b<L.length;b+=2){var ne=L[b],re=L[b+1];ne==="style"?fe(g,re):ne==="dangerouslySetInnerHTML"?Ne(g,re):ne==="children"?Fe(g,re):T(g,ne,re,K)}switch(I){case"input":Je(g,x);break;case"textarea":Cr(g,x);break;case"select":var te=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!x.multiple;var ve=x.value;ve!=null?Yt(g,!!x.multiple,ve,!1):te!==!!x.multiple&&(x.defaultValue!=null?Yt(g,!!x.multiple,x.defaultValue,!0):Yt(g,!!x.multiple,x.multiple?[]:"",!1))}g[Qo]=x}catch(Te){mt(r,r.return,Te)}}break;case 6:if(Un(o,r),er(r),d&4){if(r.stateNode===null)throw Error(n(162));g=r.stateNode,x=r.memoizedProps;try{g.nodeValue=x}catch(Te){mt(r,r.return,Te)}}break;case 3:if(Un(o,r),er(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{Vo(o.containerInfo)}catch(Te){mt(r,r.return,Te)}break;case 4:Un(o,r),er(r);break;case 13:Un(o,r),er(r),g=r.child,g.flags&8192&&(x=g.memoizedState!==null,g.stateNode.isHidden=x,!x||g.alternate!==null&&g.alternate.memoizedState!==null||(Dc=vt())),d&4&&yg(r);break;case 22:if(ne=u!==null&&u.memoizedState!==null,r.mode&1?(Ht=(K=Ht)||ne,Un(o,r),Ht=K):Un(o,r),er(r),d&8192){if(K=r.memoizedState!==null,(r.stateNode.isHidden=K)&&!ne&&(r.mode&1)!==0)for(ke=r,ne=r.child;ne!==null;){for(re=ke=ne;ke!==null;){switch(te=ke,ve=te.child,te.tag){case 0:case 11:case 14:case 15:ls(4,te,te.return);break;case 1:eo(te,te.return);var Ce=te.stateNode;if(typeof Ce.componentWillUnmount=="function"){d=te,u=te.return;try{o=d,Ce.props=o.memoizedProps,Ce.state=o.memoizedState,Ce.componentWillUnmount()}catch(Te){mt(d,u,Te)}}break;case 5:eo(te,te.return);break;case 22:if(te.memoizedState!==null){kg(re);continue}}ve!==null?(ve.return=te,ke=ve):kg(re)}ne=ne.sibling}e:for(ne=null,re=r;;){if(re.tag===5){if(ne===null){ne=re;try{g=re.stateNode,K?(x=g.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(I=re.stateNode,L=re.memoizedProps.style,b=L!=null&&L.hasOwnProperty("display")?L.display:null,I.style.display=ue("display",b))}catch(Te){mt(r,r.return,Te)}}}else if(re.tag===6){if(ne===null)try{re.stateNode.nodeValue=K?"":re.memoizedProps}catch(Te){mt(r,r.return,Te)}}else if((re.tag!==22&&re.tag!==23||re.memoizedState===null||re===r)&&re.child!==null){re.child.return=re,re=re.child;continue}if(re===r)break e;for(;re.sibling===null;){if(re.return===null||re.return===r)break e;ne===re&&(ne=null),re=re.return}ne===re&&(ne=null),re.sibling.return=re.return,re=re.sibling}}break;case 19:Un(o,r),er(r),d&4&&yg(r);break;case 21:break;default:Un(o,r),er(r)}}function er(r){var o=r.flags;if(o&2){try{e:{for(var u=r.return;u!==null;){if(pg(u)){var d=u;break e}u=u.return}throw Error(n(160))}switch(d.tag){case 5:var g=d.stateNode;d.flags&32&&(Fe(g,""),d.flags&=-33);var x=mg(r);Nc(r,x,g);break;case 3:case 4:var b=d.stateNode.containerInfo,I=mg(r);jc(r,I,b);break;default:throw Error(n(161))}}catch(L){mt(r,r.return,L)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function Kb(r,o,u){ke=r,xg(r)}function xg(r,o,u){for(var d=(r.mode&1)!==0;ke!==null;){var g=ke,x=g.child;if(g.tag===22&&d){var b=g.memoizedState!==null||Ba;if(!b){var I=g.alternate,L=I!==null&&I.memoizedState!==null||Ht;I=Ba;var K=Ht;if(Ba=b,(Ht=L)&&!K)for(ke=g;ke!==null;)b=ke,L=b.child,b.tag===22&&b.memoizedState!==null?Sg(g):L!==null?(L.return=b,ke=L):Sg(g);for(;x!==null;)ke=x,xg(x),x=x.sibling;ke=g,Ba=I,Ht=K}wg(r)}else(g.subtreeFlags&8772)!==0&&x!==null?(x.return=g,ke=x):wg(r)}}function wg(r){for(;ke!==null;){var o=ke;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:Ht||$a(5,o);break;case 1:var d=o.stateNode;if(o.flags&4&&!Ht)if(u===null)d.componentDidMount();else{var g=o.elementType===o.type?u.memoizedProps:Bn(o.type,u.memoizedProps);d.componentDidUpdate(g,u.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&km(o,x,d);break;case 3:var b=o.updateQueue;if(b!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}km(o,b,u)}break;case 5:var I=o.stateNode;if(u===null&&o.flags&4){u=I;var L=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":L.autoFocus&&u.focus();break;case"img":L.src&&(u.src=L.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var K=o.alternate;if(K!==null){var ne=K.memoizedState;if(ne!==null){var re=ne.dehydrated;re!==null&&Vo(re)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Ht||o.flags&512&&Ac(o)}catch(te){mt(o,o.return,te)}}if(o===r){ke=null;break}if(u=o.sibling,u!==null){u.return=o.return,ke=u;break}ke=o.return}}function kg(r){for(;ke!==null;){var o=ke;if(o===r){ke=null;break}var u=o.sibling;if(u!==null){u.return=o.return,ke=u;break}ke=o.return}}function Sg(r){for(;ke!==null;){var o=ke;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{$a(4,o)}catch(L){mt(o,u,L)}break;case 1:var d=o.stateNode;if(typeof d.componentDidMount=="function"){var g=o.return;try{d.componentDidMount()}catch(L){mt(o,g,L)}}var x=o.return;try{Ac(o)}catch(L){mt(o,x,L)}break;case 5:var b=o.return;try{Ac(o)}catch(L){mt(o,b,L)}}}catch(L){mt(o,o.return,L)}if(o===r){ke=null;break}var I=o.sibling;if(I!==null){I.return=o.return,ke=I;break}ke=o.return}}var qb=Math.ceil,Ua=P.ReactCurrentDispatcher,Mc=P.ReactCurrentOwner,An=P.ReactCurrentBatchConfig,qe=0,At=null,wt=null,Lt=0,xn=0,to=Dr(0),Ct=0,us=null,mi=0,Wa=0,Ic=0,cs=null,cn=null,Dc=0,no=1/0,vr=null,Ha=!1,_c=null,Vr=null,Ka=!1,Br=null,qa=0,fs=0,Lc=null,Xa=-1,Ya=0;function Zt(){return(qe&6)!==0?vt():Xa!==-1?Xa:Xa=vt()}function $r(r){return(r.mode&1)===0?1:(qe&2)!==0&&Lt!==0?Lt&-Lt:jb.transition!==null?(Ya===0&&(Ya=mp()),Ya):(r=Qe,r!==0||(r=window.event,r=r===void 0?16:Cp(r.type)),r)}function Wn(r,o,u,d){if(50<fs)throw fs=0,Lc=null,Error(n(185));_o(r,u,d),((qe&2)===0||r!==At)&&(r===At&&((qe&2)===0&&(Wa|=u),Ct===4&&Ur(r,Lt)),fn(r,d),u===1&&qe===0&&(o.mode&1)===0&&(no=vt()+500,ba&&Lr()))}function fn(r,o){var u=r.callbackNode;jS(r,o);var d=ia(r,r===At?Lt:0);if(d===0)u!==null&&dp(u),r.callbackNode=null,r.callbackPriority=0;else if(o=d&-d,r.callbackPriority!==o){if(u!=null&&dp(u),o===1)r.tag===0?Ab(Cg.bind(null,r)):um(Cg.bind(null,r)),Eb(function(){(qe&6)===0&&Lr()}),u=null;else{switch(gp(d)){case 1:u=mu;break;case 4:u=hp;break;case 16:u=ea;break;case 536870912:u=pp;break;default:u=ea}u=Mg(u,bg.bind(null,r))}r.callbackPriority=o,r.callbackNode=u}}function bg(r,o){if(Xa=-1,Ya=0,(qe&6)!==0)throw Error(n(327));var u=r.callbackNode;if(ro()&&r.callbackNode!==u)return null;var d=ia(r,r===At?Lt:0);if(d===0)return null;if((d&30)!==0||(d&r.expiredLanes)!==0||o)o=Ga(r,d);else{o=d;var g=qe;qe|=2;var x=Tg();(At!==r||Lt!==o)&&(vr=null,no=vt()+500,yi(r,o));do try{Gb();break}catch(I){Eg(r,I)}while(!0);ec(),Ua.current=x,qe=g,wt!==null?o=0:(At=null,Lt=0,o=Ct)}if(o!==0){if(o===2&&(g=gu(r),g!==0&&(d=g,o=Oc(r,g))),o===1)throw u=us,yi(r,0),Ur(r,d),fn(r,vt()),u;if(o===6)Ur(r,d);else{if(g=r.current.alternate,(d&30)===0&&!Xb(g)&&(o=Ga(r,d),o===2&&(x=gu(r),x!==0&&(d=x,o=Oc(r,x))),o===1))throw u=us,yi(r,0),Ur(r,d),fn(r,vt()),u;switch(r.finishedWork=g,r.finishedLanes=d,o){case 0:case 1:throw Error(n(345));case 2:vi(r,cn,vr);break;case 3:if(Ur(r,d),(d&130023424)===d&&(o=Dc+500-vt(),10<o)){if(ia(r,0)!==0)break;if(g=r.suspendedLanes,(g&d)!==d){Zt(),r.pingedLanes|=r.suspendedLanes&g;break}r.timeoutHandle=Uu(vi.bind(null,r,cn,vr),o);break}vi(r,cn,vr);break;case 4:if(Ur(r,d),(d&4194240)===d)break;for(o=r.eventTimes,g=-1;0<d;){var b=31-Fn(d);x=1<<b,b=o[b],b>g&&(g=b),d&=~x}if(d=g,d=vt()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*qb(d/1960))-d,10<d){r.timeoutHandle=Uu(vi.bind(null,r,cn,vr),d);break}vi(r,cn,vr);break;case 5:vi(r,cn,vr);break;default:throw Error(n(329))}}}return fn(r,vt()),r.callbackNode===u?bg.bind(null,r):null}function Oc(r,o){var u=cs;return r.current.memoizedState.isDehydrated&&(yi(r,o).flags|=256),r=Ga(r,o),r!==2&&(o=cn,cn=u,o!==null&&Fc(o)),r}function Fc(r){cn===null?cn=r:cn.push.apply(cn,r)}function Xb(r){for(var o=r;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var d=0;d<u.length;d++){var g=u[d],x=g.getSnapshot;g=g.value;try{if(!zn(x(),g))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ur(r,o){for(o&=~Ic,o&=~Wa,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var u=31-Fn(o),d=1<<u;r[u]=-1,o&=~d}}function Cg(r){if((qe&6)!==0)throw Error(n(327));ro();var o=ia(r,0);if((o&1)===0)return fn(r,vt()),null;var u=Ga(r,o);if(r.tag!==0&&u===2){var d=gu(r);d!==0&&(o=d,u=Oc(r,d))}if(u===1)throw u=us,yi(r,0),Ur(r,o),fn(r,vt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,vi(r,cn,vr),fn(r,vt()),null}function zc(r,o){var u=qe;qe|=1;try{return r(o)}finally{qe=u,qe===0&&(no=vt()+500,ba&&Lr())}}function gi(r){Br!==null&&Br.tag===0&&(qe&6)===0&&ro();var o=qe;qe|=1;var u=An.transition,d=Qe;try{if(An.transition=null,Qe=1,r)return r()}finally{Qe=d,An.transition=u,qe=o,(qe&6)===0&&Lr()}}function Vc(){xn=to.current,lt(to)}function yi(r,o){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,Cb(u)),wt!==null)for(u=wt.return;u!==null;){var d=u;switch(Yu(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&ka();break;case 3:Ji(),lt(an),lt($t),lc();break;case 5:sc(d);break;case 4:Ji();break;case 13:lt(ft);break;case 19:lt(ft);break;case 10:tc(d.type._context);break;case 22:case 23:Vc()}u=u.return}if(At=r,wt=r=Wr(r.current,null),Lt=xn=o,Ct=0,us=null,Ic=Wa=mi=0,cn=cs=null,di!==null){for(o=0;o<di.length;o++)if(u=di[o],d=u.interleaved,d!==null){u.interleaved=null;var g=d.next,x=u.pending;if(x!==null){var b=x.next;x.next=g,d.next=b}u.pending=d}di=null}return r}function Eg(r,o){do{var u=wt;try{if(ec(),Ia.current=Oa,Da){for(var d=dt.memoizedState;d!==null;){var g=d.queue;g!==null&&(g.pending=null),d=d.next}Da=!1}if(pi=0,Rt=bt=dt=null,rs=!1,is=0,Mc.current=null,u===null||u.return===null){Ct=1,us=o,wt=null;break}e:{var x=r,b=u.return,I=u,L=o;if(o=Lt,I.flags|=32768,L!==null&&typeof L=="object"&&typeof L.then=="function"){var K=L,ne=I,re=ne.tag;if((ne.mode&1)===0&&(re===0||re===11||re===15)){var te=ne.alternate;te?(ne.updateQueue=te.updateQueue,ne.memoizedState=te.memoizedState,ne.lanes=te.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var ve=Gm(b);if(ve!==null){ve.flags&=-257,Qm(ve,b,I,x,o),ve.mode&1&&Ym(x,K,o),o=ve,L=K;var Ce=o.updateQueue;if(Ce===null){var Te=new Set;Te.add(L),o.updateQueue=Te}else Ce.add(L);break e}else{if((o&1)===0){Ym(x,K,o),Bc();break e}L=Error(n(426))}}else if(ct&&I.mode&1){var xt=Gm(b);if(xt!==null){(xt.flags&65536)===0&&(xt.flags|=256),Qm(xt,b,I,x,o),Ju(Zi(L,I));break e}}x=L=Zi(L,I),Ct!==4&&(Ct=2),cs===null?cs=[x]:cs.push(x),x=b;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var $=qm(x,L,o);wm(x,$);break e;case 1:I=L;var z=x.type,W=x.stateNode;if((x.flags&128)===0&&(typeof z.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(Vr===null||!Vr.has(W)))){x.flags|=65536,o&=-o,x.lanes|=o;var se=Xm(x,I,o);wm(x,se);break e}}x=x.return}while(x!==null)}Rg(u)}catch(Re){o=Re,wt===u&&u!==null&&(wt=u=u.return);continue}break}while(!0)}function Tg(){var r=Ua.current;return Ua.current=Oa,r===null?Oa:r}function Bc(){(Ct===0||Ct===3||Ct===2)&&(Ct=4),At===null||(mi&268435455)===0&&(Wa&268435455)===0||Ur(At,Lt)}function Ga(r,o){var u=qe;qe|=2;var d=Tg();(At!==r||Lt!==o)&&(vr=null,yi(r,o));do try{Yb();break}catch(g){Eg(r,g)}while(!0);if(ec(),qe=u,Ua.current=d,wt!==null)throw Error(n(261));return At=null,Lt=0,Ct}function Yb(){for(;wt!==null;)Pg(wt)}function Gb(){for(;wt!==null&&!kS();)Pg(wt)}function Pg(r){var o=Ng(r.alternate,r,xn);r.memoizedProps=r.pendingProps,o===null?Rg(r):wt=o,Mc.current=null}function Rg(r){var o=r;do{var u=o.alternate;if(r=o.return,(o.flags&32768)===0){if(u=$b(u,o,xn),u!==null){wt=u;return}}else{if(u=Ub(u,o),u!==null){u.flags&=32767,wt=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Ct=6,wt=null;return}}if(o=o.sibling,o!==null){wt=o;return}wt=o=r}while(o!==null);Ct===0&&(Ct=5)}function vi(r,o,u){var d=Qe,g=An.transition;try{An.transition=null,Qe=1,Qb(r,o,u,d)}finally{An.transition=g,Qe=d}return null}function Qb(r,o,u,d){do ro();while(Br!==null);if((qe&6)!==0)throw Error(n(327));u=r.finishedWork;var g=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var x=u.lanes|u.childLanes;if(NS(r,x),r===At&&(wt=At=null,Lt=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Ka||(Ka=!0,Mg(ea,function(){return ro(),null})),x=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||x){x=An.transition,An.transition=null;var b=Qe;Qe=1;var I=qe;qe|=4,Mc.current=null,Hb(r,u),vg(u,r),yb(Bu),aa=!!Vu,Bu=Vu=null,r.current=u,Kb(u),SS(),qe=I,Qe=b,An.transition=x}else r.current=u;if(Ka&&(Ka=!1,Br=r,qa=g),x=r.pendingLanes,x===0&&(Vr=null),ES(u.stateNode),fn(r,vt()),o!==null)for(d=r.onRecoverableError,u=0;u<o.length;u++)g=o[u],d(g.value,{componentStack:g.stack,digest:g.digest});if(Ha)throw Ha=!1,r=_c,_c=null,r;return(qa&1)!==0&&r.tag!==0&&ro(),x=r.pendingLanes,(x&1)!==0?r===Lc?fs++:(fs=0,Lc=r):fs=0,Lr(),null}function ro(){if(Br!==null){var r=gp(qa),o=An.transition,u=Qe;try{if(An.transition=null,Qe=16>r?16:r,Br===null)var d=!1;else{if(r=Br,Br=null,qa=0,(qe&6)!==0)throw Error(n(331));var g=qe;for(qe|=4,ke=r.current;ke!==null;){var x=ke,b=x.child;if((ke.flags&16)!==0){var I=x.deletions;if(I!==null){for(var L=0;L<I.length;L++){var K=I[L];for(ke=K;ke!==null;){var ne=ke;switch(ne.tag){case 0:case 11:case 15:ls(8,ne,x)}var re=ne.child;if(re!==null)re.return=ne,ke=re;else for(;ke!==null;){ne=ke;var te=ne.sibling,ve=ne.return;if(hg(ne),ne===K){ke=null;break}if(te!==null){te.return=ve,ke=te;break}ke=ve}}}var Ce=x.alternate;if(Ce!==null){var Te=Ce.child;if(Te!==null){Ce.child=null;do{var xt=Te.sibling;Te.sibling=null,Te=xt}while(Te!==null)}}ke=x}}if((x.subtreeFlags&2064)!==0&&b!==null)b.return=x,ke=b;else e:for(;ke!==null;){if(x=ke,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:ls(9,x,x.return)}var $=x.sibling;if($!==null){$.return=x.return,ke=$;break e}ke=x.return}}var z=r.current;for(ke=z;ke!==null;){b=ke;var W=b.child;if((b.subtreeFlags&2064)!==0&&W!==null)W.return=b,ke=W;else e:for(b=z;ke!==null;){if(I=ke,(I.flags&2048)!==0)try{switch(I.tag){case 0:case 11:case 15:$a(9,I)}}catch(Re){mt(I,I.return,Re)}if(I===b){ke=null;break e}var se=I.sibling;if(se!==null){se.return=I.return,ke=se;break e}ke=I.return}}if(qe=g,Lr(),Gn&&typeof Gn.onPostCommitFiberRoot=="function")try{Gn.onPostCommitFiberRoot(ta,r)}catch{}d=!0}return d}finally{Qe=u,An.transition=o}}return!1}function Ag(r,o,u){o=Zi(u,o),o=qm(r,o,1),r=Fr(r,o,1),o=Zt(),r!==null&&(_o(r,1,o),fn(r,o))}function mt(r,o,u){if(r.tag===3)Ag(r,r,u);else for(;o!==null;){if(o.tag===3){Ag(o,r,u);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Vr===null||!Vr.has(d))){r=Zi(u,r),r=Xm(o,r,1),o=Fr(o,r,1),r=Zt(),o!==null&&(_o(o,1,r),fn(o,r));break}}o=o.return}}function Jb(r,o,u){var d=r.pingCache;d!==null&&d.delete(o),o=Zt(),r.pingedLanes|=r.suspendedLanes&u,At===r&&(Lt&u)===u&&(Ct===4||Ct===3&&(Lt&130023424)===Lt&&500>vt()-Dc?yi(r,0):Ic|=u),fn(r,o)}function jg(r,o){o===0&&((r.mode&1)===0?o=1:(o=ra,ra<<=1,(ra&130023424)===0&&(ra=4194304)));var u=Zt();r=mr(r,o),r!==null&&(_o(r,o,u),fn(r,u))}function Zb(r){var o=r.memoizedState,u=0;o!==null&&(u=o.retryLane),jg(r,u)}function eC(r,o){var u=0;switch(r.tag){case 13:var d=r.stateNode,g=r.memoizedState;g!==null&&(u=g.retryLane);break;case 19:d=r.stateNode;break;default:throw Error(n(314))}d!==null&&d.delete(o),jg(r,u)}var Ng;Ng=function(r,o,u){if(r!==null)if(r.memoizedProps!==o.pendingProps||an.current)un=!0;else{if((r.lanes&u)===0&&(o.flags&128)===0)return un=!1,Bb(r,o,u);un=(r.flags&131072)!==0}else un=!1,ct&&(o.flags&1048576)!==0&&cm(o,Ea,o.index);switch(o.lanes=0,o.tag){case 2:var d=o.type;Va(r,o),r=o.pendingProps;var g=Hi(o,$t.current);Qi(o,u),g=fc(null,o,d,r,g,u);var x=dc();return o.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,ln(d)?(x=!0,Sa(o)):x=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,ic(o),g.updater=Fa,o.stateNode=g,g._reactInternals=o,vc(o,d,r,u),o=Sc(null,o,d,!0,x,u)):(o.tag=0,ct&&x&&Xu(o),Jt(null,o,g,u),o=o.child),o;case 16:d=o.elementType;e:{switch(Va(r,o),r=o.pendingProps,g=d._init,d=g(d._payload),o.type=d,g=o.tag=nC(d),r=Bn(d,r),g){case 0:o=kc(null,o,d,r,u);break e;case 1:o=rg(null,o,d,r,u);break e;case 11:o=Jm(null,o,d,r,u);break e;case 14:o=Zm(null,o,d,Bn(d.type,r),u);break e}throw Error(n(306,d,""))}return o;case 0:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Bn(d,g),kc(r,o,d,g,u);case 1:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Bn(d,g),rg(r,o,d,g,u);case 3:e:{if(ig(o),r===null)throw Error(n(387));d=o.pendingProps,x=o.memoizedState,g=x.element,xm(r,o),Na(o,d,null,u);var b=o.memoizedState;if(d=b.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:b.cache,pendingSuspenseBoundaries:b.pendingSuspenseBoundaries,transitions:b.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){g=Zi(Error(n(423)),o),o=og(r,o,d,u,g);break e}else if(d!==g){g=Zi(Error(n(424)),o),o=og(r,o,d,u,g);break e}else for(vn=Ir(o.stateNode.containerInfo.firstChild),yn=o,ct=!0,Vn=null,u=ym(o,null,d,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Xi(),d===g){o=yr(r,o,u);break e}Jt(r,o,d,u)}o=o.child}return o;case 5:return Sm(o),r===null&&Qu(o),d=o.type,g=o.pendingProps,x=r!==null?r.memoizedProps:null,b=g.children,$u(d,g)?b=null:x!==null&&$u(d,x)&&(o.flags|=32),ng(r,o),Jt(r,o,b,u),o.child;case 6:return r===null&&Qu(o),null;case 13:return sg(r,o,u);case 4:return oc(o,o.stateNode.containerInfo),d=o.pendingProps,r===null?o.child=Yi(o,null,d,u):Jt(r,o,d,u),o.child;case 11:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Bn(d,g),Jm(r,o,d,g,u);case 7:return Jt(r,o,o.pendingProps,u),o.child;case 8:return Jt(r,o,o.pendingProps.children,u),o.child;case 12:return Jt(r,o,o.pendingProps.children,u),o.child;case 10:e:{if(d=o.type._context,g=o.pendingProps,x=o.memoizedProps,b=g.value,st(Ra,d._currentValue),d._currentValue=b,x!==null)if(zn(x.value,b)){if(x.children===g.children&&!an.current){o=yr(r,o,u);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var I=x.dependencies;if(I!==null){b=x.child;for(var L=I.firstContext;L!==null;){if(L.context===d){if(x.tag===1){L=gr(-1,u&-u),L.tag=2;var K=x.updateQueue;if(K!==null){K=K.shared;var ne=K.pending;ne===null?L.next=L:(L.next=ne.next,ne.next=L),K.pending=L}}x.lanes|=u,L=x.alternate,L!==null&&(L.lanes|=u),nc(x.return,u,o),I.lanes|=u;break}L=L.next}}else if(x.tag===10)b=x.type===o.type?null:x.child;else if(x.tag===18){if(b=x.return,b===null)throw Error(n(341));b.lanes|=u,I=b.alternate,I!==null&&(I.lanes|=u),nc(b,u,o),b=x.sibling}else b=x.child;if(b!==null)b.return=x;else for(b=x;b!==null;){if(b===o){b=null;break}if(x=b.sibling,x!==null){x.return=b.return,b=x;break}b=b.return}x=b}Jt(r,o,g.children,u),o=o.child}return o;case 9:return g=o.type,d=o.pendingProps.children,Qi(o,u),g=Pn(g),d=d(g),o.flags|=1,Jt(r,o,d,u),o.child;case 14:return d=o.type,g=Bn(d,o.pendingProps),g=Bn(d.type,g),Zm(r,o,d,g,u);case 15:return eg(r,o,o.type,o.pendingProps,u);case 17:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Bn(d,g),Va(r,o),o.tag=1,ln(d)?(r=!0,Sa(o)):r=!1,Qi(o,u),Hm(o,d,g),vc(o,d,g,u),Sc(null,o,d,!0,r,u);case 19:return lg(r,o,u);case 22:return tg(r,o,u)}throw Error(n(156,o.tag))};function Mg(r,o){return fp(r,o)}function tC(r,o,u,d){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jn(r,o,u,d){return new tC(r,o,u,d)}function $c(r){return r=r.prototype,!(!r||!r.isReactComponent)}function nC(r){if(typeof r=="function")return $c(r)?1:0;if(r!=null){if(r=r.$$typeof,r===V)return 11;if(r===ee)return 14}return 2}function Wr(r,o){var u=r.alternate;return u===null?(u=jn(r.tag,o,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=o,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,o=r.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function Qa(r,o,u,d,g,x){var b=2;if(d=r,typeof r=="function")$c(r)&&(b=1);else if(typeof r=="string")b=5;else e:switch(r){case H:return xi(u.children,g,x,o);case B:b=8,g|=8;break;case _:return r=jn(12,u,o,g|2),r.elementType=_,r.lanes=x,r;case ae:return r=jn(13,u,o,g),r.elementType=ae,r.lanes=x,r;case J:return r=jn(19,u,o,g),r.elementType=J,r.lanes=x,r;case we:return Ja(u,g,x,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case N:b=10;break e;case q:b=9;break e;case V:b=11;break e;case ee:b=14;break e;case ge:b=16,d=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=jn(b,u,o,g),o.elementType=r,o.type=d,o.lanes=x,o}function xi(r,o,u,d){return r=jn(7,r,d,o),r.lanes=u,r}function Ja(r,o,u,d){return r=jn(22,r,d,o),r.elementType=we,r.lanes=u,r.stateNode={isHidden:!1},r}function Uc(r,o,u){return r=jn(6,r,null,o),r.lanes=u,r}function Wc(r,o,u){return o=jn(4,r.children!==null?r.children:[],r.key,o),o.lanes=u,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function rC(r,o,u,d,g){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yu(0),this.expirationTimes=yu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yu(0),this.identifierPrefix=d,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Hc(r,o,u,d,g,x,b,I,L){return r=new rC(r,o,u,I,L),o===1?(o=1,x===!0&&(o|=8)):o=0,x=jn(3,null,null,o),r.current=x,x.stateNode=r,x.memoizedState={element:d,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},ic(x),r}function iC(r,o,u){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:D,key:d==null?null:""+d,children:r,containerInfo:o,implementation:u}}function Ig(r){if(!r)return _r;r=r._reactInternals;e:{if(Pt(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(ln(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(ln(u))return am(r,u,o)}return o}function Dg(r,o,u,d,g,x,b,I,L){return r=Hc(u,d,!0,r,g,x,b,I,L),r.context=Ig(null),u=r.current,d=Zt(),g=$r(u),x=gr(d,g),x.callback=o??null,Fr(u,x,g),r.current.lanes=g,_o(r,g,d),fn(r,d),r}function Za(r,o,u,d){var g=o.current,x=Zt(),b=$r(g);return u=Ig(u),o.context===null?o.context=u:o.pendingContext=u,o=gr(x,b),o.payload={element:r},d=d===void 0?null:d,d!==null&&(o.callback=d),r=Fr(g,o,b),r!==null&&(Wn(r,g,b,x),ja(r,g,b)),b}function el(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function _g(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<o?u:o}}function Kc(r,o){_g(r,o),(r=r.alternate)&&_g(r,o)}function oC(){return null}var Lg=typeof reportError=="function"?reportError:function(r){console.error(r)};function qc(r){this._internalRoot=r}tl.prototype.render=qc.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Za(r,o,null,null)},tl.prototype.unmount=qc.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;gi(function(){Za(null,r,null,null)}),o[fr]=null}};function tl(r){this._internalRoot=r}tl.prototype.unstable_scheduleHydration=function(r){if(r){var o=xp();r={blockedOn:null,target:r,priority:o};for(var u=0;u<jr.length&&o!==0&&o<jr[u].priority;u++);jr.splice(u,0,r),u===0&&Sp(r)}};function Xc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function nl(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Og(){}function sC(r,o,u,d,g){if(g){if(typeof d=="function"){var x=d;d=function(){var K=el(b);x.call(K)}}var b=Dg(o,d,r,0,null,!1,!1,"",Og);return r._reactRootContainer=b,r[fr]=b.current,Yo(r.nodeType===8?r.parentNode:r),gi(),b}for(;g=r.lastChild;)r.removeChild(g);if(typeof d=="function"){var I=d;d=function(){var K=el(L);I.call(K)}}var L=Hc(r,0,!1,null,null,!1,!1,"",Og);return r._reactRootContainer=L,r[fr]=L.current,Yo(r.nodeType===8?r.parentNode:r),gi(function(){Za(o,L,u,d)}),L}function rl(r,o,u,d,g){var x=u._reactRootContainer;if(x){var b=x;if(typeof g=="function"){var I=g;g=function(){var L=el(b);I.call(L)}}Za(o,b,r,g)}else b=sC(u,o,r,g,d);return el(b)}yp=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var u=Do(o.pendingLanes);u!==0&&(vu(o,u|1),fn(o,vt()),(qe&6)===0&&(no=vt()+500,Lr()))}break;case 13:gi(function(){var d=mr(r,1);if(d!==null){var g=Zt();Wn(d,r,1,g)}}),Kc(r,1)}},xu=function(r){if(r.tag===13){var o=mr(r,134217728);if(o!==null){var u=Zt();Wn(o,r,134217728,u)}Kc(r,134217728)}},vp=function(r){if(r.tag===13){var o=$r(r),u=mr(r,o);if(u!==null){var d=Zt();Wn(u,r,o,d)}Kc(r,o)}},xp=function(){return Qe},wp=function(r,o){var u=Qe;try{return Qe=r,o()}finally{Qe=u}},Qt=function(r,o,u){switch(o){case"input":if(Je(r,u),o=u.name,u.type==="radio"&&o!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var d=u[o];if(d!==r&&d.form===r.form){var g=wa(d);if(!g)throw Error(n(90));Ge(d),Je(d,g)}}}break;case"textarea":Cr(r,u);break;case"select":o=u.value,o!=null&&Yt(r,!!u.multiple,o,!1)}},Vt=zc,_i=gi;var aC={usingClientEntryPoint:!1,Events:[Jo,Ui,wa,Ln,mn,zc]},ds={findFiberByHostInstance:li,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},lC={bundleType:ds.bundleType,version:ds.version,rendererPackageName:ds.rendererPackageName,rendererConfig:ds.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=yt(r),r===null?null:r.stateNode},findFiberByHostInstance:ds.findFiberByHostInstance||oC,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var il=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!il.isDisabled&&il.supportsFiber)try{ta=il.inject(lC),Gn=il}catch{}}return dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aC,dn.createPortal=function(r,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xc(o))throw Error(n(200));return iC(r,o,null,u)},dn.createRoot=function(r,o){if(!Xc(r))throw Error(n(299));var u=!1,d="",g=Lg;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=Hc(r,1,!1,null,null,u,!1,d,g),r[fr]=o.current,Yo(r.nodeType===8?r.parentNode:r),new qc(o)},dn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=yt(o),r=r===null?null:r.stateNode,r},dn.flushSync=function(r){return gi(r)},dn.hydrate=function(r,o,u){if(!nl(o))throw Error(n(200));return rl(null,r,o,!0,u)},dn.hydrateRoot=function(r,o,u){if(!Xc(r))throw Error(n(405));var d=u!=null&&u.hydratedSources||null,g=!1,x="",b=Lg;if(u!=null&&(u.unstable_strictMode===!0&&(g=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onRecoverableError!==void 0&&(b=u.onRecoverableError)),o=Dg(o,null,r,1,u??null,g,!1,x,b),r[fr]=o.current,Yo(r),d)for(r=0;r<d.length;r++)u=d[r],g=u._getVersion,g=g(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,g]:o.mutableSourceEagerHydrationData.push(u,g);return new tl(o)},dn.render=function(r,o,u){if(!nl(o))throw Error(n(200));return rl(null,r,o,!1,u)},dn.unmountComponentAtNode=function(r){if(!nl(r))throw Error(n(40));return r._reactRootContainer?(gi(function(){rl(null,null,r,!1,function(){r._reactRootContainer=null,r[fr]=null})}),!0):!1},dn.unstable_batchedUpdates=zc,dn.unstable_renderSubtreeIntoContainer=function(r,o,u,d){if(!nl(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return rl(r,o,u,!1,d)},dn.version="18.3.1-next-f1338f8080-20240426",dn}var Hg;function Xx(){if(Hg)return Qc.exports;Hg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Qc.exports=gC(),Qc.exports}var Kg;function yC(){if(Kg)return ol;Kg=1;var e=Xx();return ol.createRoot=e.createRoot,ol.hydrateRoot=e.hydrateRoot,ol}var vC=yC(),k=Zd();const xC=Jd(k),$s=cC({__proto__:null,default:xC},[k]),eh=k.createContext({});function tu(e){const t=k.useRef(null);return t.current===null&&(t.current=e()),t.current}const wC=typeof window<"u",th=wC?k.useLayoutEffect:k.useEffect,nu=k.createContext(null);function nh(e,t){e.indexOf(t)===-1&&e.push(t)}function Dl(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const sr=(e,t,n)=>n>t?t:n<e?e:n;let ru=()=>{};const Zr={},Yx=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Gx=e=>typeof e=="object"&&e!==null,Qx=e=>/^0[^.\s]+$/u.test(e);function Jx(e){let t;return()=>(t===void 0&&(t=e()),t)}const Dn=e=>e,Us=(...e)=>e.reduce((t,n)=>i=>n(t(i))),Ns=(e,t,n)=>{const i=t-e;return i?(n-e)/i:1};class rh{constructor(){this.subscriptions=[]}add(t){return nh(this.subscriptions,t),()=>Dl(this.subscriptions,t)}notify(t,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,i);else for(let a=0;a<s;a++){const l=this.subscriptions[a];l&&l(t,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const kn=e=>e*1e3,In=e=>e/1e3,Zx=(e,t)=>t?e*(1e3/t):0,ew=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,kC=1e-7,SC=12;function bC(e,t,n,i,s){let a,l,c=0;do l=t+(n-t)/2,a=ew(l,i,s)-e,a>0?n=l:t=l;while(Math.abs(a)>kC&&++c<SC);return l}function Ws(e,t,n,i){if(e===t&&n===i)return Dn;const s=a=>bC(a,0,1,e,n);return a=>a===0||a===1?a:ew(s(a),t,i)}const tw=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,nw=e=>t=>1-e(1-t),rw=Ws(.33,1.53,.69,.99),ih=nw(rw),iw=tw(ih),ow=e=>e>=1?1:(e*=2)<1?.5*ih(e):.5*(2-Math.pow(2,-10*(e-1))),oh=e=>1-Math.sin(Math.acos(e)),sw=nw(oh),aw=tw(oh),CC=Ws(.42,0,1,1),EC=Ws(0,0,.58,1),lw=Ws(.42,0,.58,1),TC=e=>Array.isArray(e)&&typeof e[0]!="number",uw=e=>Array.isArray(e)&&typeof e[0]=="number",PC={linear:Dn,easeIn:CC,easeInOut:lw,easeOut:EC,circIn:oh,circInOut:aw,circOut:sw,backIn:ih,backInOut:iw,backOut:rw,anticipate:ow},RC=e=>typeof e=="string",qg=e=>{if(uw(e)){ru(e.length===4);const[t,n,i,s]=e;return Ws(t,n,i,s)}else if(RC(e))return PC[e];return e},sl=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function AC(e){let t=new Set,n=new Set,i=!1,s=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(h){a.has(h)&&(f.schedule(h),e()),h(l)}const f={schedule:(h,m=!1,p=!1)=>{const w=p&&i?t:n;return m&&a.add(h),w.add(h),h},cancel:h=>{n.delete(h),a.delete(h)},process:h=>{if(l=h,i){s=!0;return}i=!0;const m=t;t=n,n=m,t.forEach(c),t.clear(),i=!1,s&&(s=!1,f.process(h))}};return f}const jC=40;function cw(e,t){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,l=sl.reduce((T,P)=>(T[P]=AC(a),T),{}),{setup:c,read:f,resolveKeyframes:h,preUpdate:m,update:p,preRender:v,render:w,postRender:S}=l,C=()=>{const T=Zr.useManualTiming,P=T?s.timestamp:performance.now();n=!1,T||(s.delta=i?1e3/60:Math.max(Math.min(P-s.timestamp,jC),1)),s.timestamp=P,s.isProcessing=!0,c.process(s),f.process(s),h.process(s),m.process(s),p.process(s),v.process(s),w.process(s),S.process(s),s.isProcessing=!1,n&&t&&(i=!1,e(C))},E=()=>{n=!0,i=!0,s.isProcessing||e(C)};return{schedule:sl.reduce((T,P)=>{const O=l[P];return T[P]=(D,H=!1,B=!1)=>(n||E(),O.schedule(D,H,B)),T},{}),cancel:T=>{for(let P=0;P<sl.length;P++)l[sl[P]].cancel(T)},state:s,steps:l}}const{schedule:nt,cancel:ei,state:Ot,steps:ef}=cw(typeof requestAnimationFrame<"u"?requestAnimationFrame:Dn,!0);let kl;function NC(){kl=void 0}const nn={now:()=>(kl===void 0&&nn.set(Ot.isProcessing||Zr.useManualTiming?Ot.timestamp:performance.now()),kl),set:e=>{kl=e,queueMicrotask(NC)}},fw=e=>t=>typeof t=="string"&&t.startsWith(e),dw=fw("--"),MC=fw("var(--"),sh=e=>MC(e)?IC.test(e.split("/*")[0].trim()):!1,IC=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Xg(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Eo={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ms={...Eo,transform:e=>sr(0,1,e)},al={...Eo,default:1},bs=e=>Math.round(e*1e5)/1e5,ah=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function DC(e){return e==null}const _C=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lh=(e,t)=>n=>!!(typeof n=="string"&&_C.test(n)&&n.startsWith(e)||t&&!DC(n)&&Object.prototype.hasOwnProperty.call(n,t)),hw=(e,t,n)=>i=>{if(typeof i!="string")return i;const[s,a,l,c]=i.match(ah);return{[e]:parseFloat(s),[t]:parseFloat(a),[n]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},LC=e=>sr(0,255,e),tf={...Eo,transform:e=>Math.round(LC(e))},Ei={test:lh("rgb","red"),parse:hw("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+tf.transform(e)+", "+tf.transform(t)+", "+tf.transform(n)+", "+bs(Ms.transform(i))+")"};function OC(e){let t="",n="",i="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const Wf={test:lh("#"),parse:OC,transform:Ei.transform},Hs=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),xr=Hs("deg"),or=Hs("%"),Ee=Hs("px"),FC=Hs("vh"),zC=Hs("vw"),Yg={...or,parse:e=>or.parse(e)/100,transform:e=>or.transform(e*100)},po={test:lh("hsl","hue"),parse:hw("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+or.transform(bs(t))+", "+or.transform(bs(n))+", "+bs(Ms.transform(i))+")"},St={test:e=>Ei.test(e)||Wf.test(e)||po.test(e),parse:e=>Ei.test(e)?Ei.parse(e):po.test(e)?po.parse(e):Wf.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ei.transform(e):po.transform(e),getAnimatableNone:e=>{const t=St.parse(e);return t.alpha=0,St.transform(t)}},VC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function BC(e){return isNaN(e)&&typeof e=="string"&&(e.match(ah)?.length||0)+(e.match(VC)?.length||0)>0}const pw="number",mw="color",$C="var",UC="var(",Gg="${}",WC=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function wo(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[];let a=0;const c=t.replace(WC,f=>(St.test(f)?(i.color.push(a),s.push(mw),n.push(St.parse(f))):f.startsWith(UC)?(i.var.push(a),s.push($C),n.push(f)):(i.number.push(a),s.push(pw),n.push(parseFloat(f))),++a,Gg)).split(Gg);return{values:n,split:c,indexes:i,types:s}}function HC(e){return wo(e).values}function gw({split:e,types:t}){const n=e.length;return i=>{let s="";for(let a=0;a<n;a++)if(s+=e[a],i[a]!==void 0){const l=t[a];l===pw?s+=bs(i[a]):l===mw?s+=St.transform(i[a]):s+=i[a]}return s}}function KC(e){return gw(wo(e))}const qC=e=>typeof e=="number"?0:St.test(e)?St.getAnimatableNone(e):e,XC=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:qC(e);function YC(e){const t=wo(e);return gw(t)(t.values.map((i,s)=>XC(i,t.split[s])))}const qn={test:BC,parse:HC,createTransformer:KC,getAnimatableNone:YC};function nf(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function GC({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,t/=100,n/=100;let s=0,a=0,l=0;if(!t)s=a=l=n;else{const c=n<.5?n*(1+t):n+t-n*t,f=2*n-c;s=nf(f,c,e+1/3),a=nf(f,c,e),l=nf(f,c,e-1/3)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(l*255),alpha:i}}function _l(e,t){return n=>n>0?t:e}const tt=(e,t,n)=>e+(t-e)*n,rf=(e,t,n)=>{const i=e*e,s=n*(t*t-i)+i;return s<0?0:Math.sqrt(s)},QC=[Wf,Ei,po],JC=e=>QC.find(t=>t.test(e));function Qg(e){const t=JC(e);if(!t)return!1;let n=t.parse(e);return t===po&&(n=GC(n)),n}const Jg=(e,t)=>{const n=Qg(e),i=Qg(t);if(!n||!i)return _l(e,t);const s={...n};return a=>(s.red=rf(n.red,i.red,a),s.green=rf(n.green,i.green,a),s.blue=rf(n.blue,i.blue,a),s.alpha=tt(n.alpha,i.alpha,a),Ei.transform(s))},Hf=new Set(["none","hidden"]);function ZC(e,t){return Hf.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function eE(e,t){return n=>tt(e,t,n)}function uh(e){return typeof e=="number"?eE:typeof e=="string"?sh(e)?_l:St.test(e)?Jg:rE:Array.isArray(e)?yw:typeof e=="object"?St.test(e)?Jg:tE:_l}function yw(e,t){const n=[...e],i=n.length,s=e.map((a,l)=>uh(a)(a,t[l]));return a=>{for(let l=0;l<i;l++)n[l]=s[l](a);return n}}function tE(e,t){const n={...e,...t},i={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(i[s]=uh(e[s])(e[s],t[s]));return s=>{for(const a in i)n[a]=i[a](s);return n}}function nE(e,t){const n=[],i={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const a=t.types[s],l=e.indexes[a][i[a]],c=e.values[l]??0;n[s]=c,i[a]++}return n}const rE=(e,t)=>{const n=qn.createTransformer(t),i=wo(e),s=wo(t);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?Hf.has(e)&&!s.values.length||Hf.has(t)&&!i.values.length?ZC(e,t):Us(yw(nE(i,s),s.values),n):_l(e,t)};function vw(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?tt(e,t,n):uh(e)(e,t)}const iE=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>nt.update(t,n),stop:()=>ei(t),now:()=>Ot.isProcessing?Ot.timestamp:nn.now()}},xw=(e,t,n=10)=>{let i="";const s=Math.max(Math.round(t/n),2);for(let a=0;a<s;a++)i+=Math.round(e(a/(s-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Ll=2e4;function ch(e){let t=0;const n=50;let i=e.next(t);for(;!i.done&&t<Ll;)t+=n,i=e.next(t);return t>=Ll?1/0:t}function oE(e,t=100,n){const i=n({...e,keyframes:[0,t]}),s=Math.min(ch(i),Ll);return{type:"keyframes",ease:a=>i.next(s*a).value/t,duration:In(s)}}const gt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Kf(e,t){return e*Math.sqrt(1-t*t)}const sE=12;function aE(e,t,n){let i=n;for(let s=1;s<sE;s++)i=i-e(i)/t(i);return i}const of=.001;function lE({duration:e=gt.duration,bounce:t=gt.bounce,velocity:n=gt.velocity,mass:i=gt.mass}){let s,a,l=1-t;l=sr(gt.minDamping,gt.maxDamping,l),e=sr(gt.minDuration,gt.maxDuration,In(e)),l<1?(s=h=>{const m=h*l,p=m*e,v=m-n,w=Kf(h,l),S=Math.exp(-p);return of-v/w*S},a=h=>{const p=h*l*e,v=p*n+n,w=Math.pow(l,2)*Math.pow(h,2)*e,S=Math.exp(-p),C=Kf(Math.pow(h,2),l);return(-s(h)+of>0?-1:1)*((v-w)*S)/C}):(s=h=>{const m=Math.exp(-h*e),p=(h-n)*e+1;return-of+m*p},a=h=>{const m=Math.exp(-h*e),p=(n-h)*(e*e);return m*p});const c=5/e,f=aE(s,a,c);if(e=kn(e),isNaN(f))return{stiffness:gt.stiffness,damping:gt.damping,duration:e};{const h=Math.pow(f,2)*i;return{stiffness:h,damping:l*2*Math.sqrt(i*h),duration:e}}}const uE=["duration","bounce"],cE=["stiffness","damping","mass"];function Zg(e,t){return t.some(n=>e[n]!==void 0)}function fE(e){let t={velocity:gt.velocity,stiffness:gt.stiffness,damping:gt.damping,mass:gt.mass,isResolvedFromDuration:!1,...e};if(!Zg(e,cE)&&Zg(e,uE))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,a=2*sr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:gt.mass,stiffness:s,damping:a}}else{const n=lE({...e,velocity:0});t={...t,...n,mass:gt.mass},t.isResolvedFromDuration=!0}return t}function Ol(e=gt.visualDuration,t=gt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:s}=n;const a=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],c={done:!1,value:a},{stiffness:f,damping:h,mass:m,duration:p,velocity:v,isResolvedFromDuration:w}=fE({...n,velocity:-In(n.velocity||0)}),S=v||0,C=h/(2*Math.sqrt(f*m)),E=l-a,R=In(Math.sqrt(f/m)),A=Math.abs(E)<5;i||(i=A?gt.restSpeed.granular:gt.restSpeed.default),s||(s=A?gt.restDelta.granular:gt.restDelta.default);let T,P,O,D,H,B;if(C<1)O=Kf(R,C),D=(S+C*R*E)/O,T=N=>{const q=Math.exp(-C*R*N);return l-q*(D*Math.sin(O*N)+E*Math.cos(O*N))},H=C*R*D+E*O,B=C*R*E-D*O,P=N=>Math.exp(-C*R*N)*(H*Math.sin(O*N)+B*Math.cos(O*N));else if(C===1){T=q=>l-Math.exp(-R*q)*(E+(S+R*E)*q);const N=S+R*E;P=q=>Math.exp(-R*q)*(R*N*q-S)}else{const N=R*Math.sqrt(C*C-1);T=J=>{const ee=Math.exp(-C*R*J),ge=Math.min(N*J,300);return l-ee*((S+C*R*E)*Math.sinh(ge)+N*E*Math.cosh(ge))/N};const q=(S+C*R*E)/N,V=C*R*q-E*N,ae=C*R*E-q*N;P=J=>{const ee=Math.exp(-C*R*J),ge=Math.min(N*J,300);return ee*(V*Math.sinh(ge)+ae*Math.cosh(ge))}}const _={calculatedDuration:w&&p||null,velocity:N=>kn(P(N)),next:N=>{if(!w&&C<1){const V=Math.exp(-C*R*N),ae=Math.sin(O*N),J=Math.cos(O*N),ee=l-V*(D*ae+E*J),ge=kn(V*(H*ae+B*J));return c.done=Math.abs(ge)<=i&&Math.abs(l-ee)<=s,c.value=c.done?l:ee,c}const q=T(N);if(w)c.done=N>=p;else{const V=kn(P(N));c.done=Math.abs(V)<=i&&Math.abs(l-q)<=s}return c.value=c.done?l:q,c},toString:()=>{const N=Math.min(ch(_),Ll),q=xw(V=>_.next(N*V).value,N,30);return N+"ms "+q},toTransition:()=>{}};return _}Ol.applyToOptions=e=>{const t=oE(e,100,Ol);return e.ease=t.ease,e.duration=kn(t.duration),e.type="keyframes",e};const dE=5;function ww(e,t,n){const i=Math.max(t-dE,0);return Zx(n-e(i),t-i)}function qf({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:l,min:c,max:f,restDelta:h=.5,restSpeed:m}){const p=e[0],v={done:!1,value:p},w=B=>c!==void 0&&B<c||f!==void 0&&B>f,S=B=>c===void 0?f:f===void 0||Math.abs(c-B)<Math.abs(f-B)?c:f;let C=n*t;const E=p+C,R=l===void 0?E:l(E);R!==E&&(C=R-p);const A=B=>-C*Math.exp(-B/i),T=B=>R+A(B),P=B=>{const _=A(B),N=T(B);v.done=Math.abs(_)<=h,v.value=v.done?R:N};let O,D;const H=B=>{w(v.value)&&(O=B,D=Ol({keyframes:[v.value,S(v.value)],velocity:ww(T,B,v.value),damping:s,stiffness:a,restDelta:h,restSpeed:m}))};return H(0),{calculatedDuration:null,next:B=>{let _=!1;return!D&&O===void 0&&(_=!0,P(B),H(B)),O!==void 0&&B>=O?D.next(B-O):(!_&&P(B),v)}}}function hE(e,t,n){const i=[],s=n||Zr.mix||vw,a=e.length-1;for(let l=0;l<a;l++){let c=s(e[l],e[l+1]);if(t){const f=Array.isArray(t)?t[l]||Dn:t;c=Us(f,c)}i.push(c)}return i}function pE(e,t,{clamp:n=!0,ease:i,mixer:s}={}){const a=e.length;if(ru(a===t.length),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=hE(t,i,s),f=c.length,h=m=>{if(l&&m<e[0])return t[0];let p=0;if(f>1)for(;p<e.length-2&&!(m<e[p+1]);p++);const v=Ns(e[p],e[p+1],m);return c[p](v)};return n?m=>h(sr(e[0],e[a-1],m)):h}function mE(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const s=Ns(0,t,i);e.push(tt(n,1,s))}}function gE(e){const t=[0];return mE(t,e.length-1),t}function yE(e,t){return e.map(n=>n*t)}function vE(e,t){return e.map(()=>t||lw).splice(0,e.length-1)}function Cs({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const s=TC(i)?i.map(qg):qg(i),a={done:!1,value:t[0]},l=yE(n&&n.length===t.length?n:gE(t),e),c=pE(l,t,{ease:Array.isArray(s)?s:vE(t,s)});return{calculatedDuration:e,next:f=>(a.value=c(f),a.done=f>=e,a)}}const xE=e=>e!==null;function iu(e,{repeat:t,repeatType:n="loop"},i,s=1){const a=e.filter(xE),c=s<0||t&&n!=="loop"&&t%2===1?0:a.length-1;return!c||i===void 0?a[c]:i}const wE={decay:qf,inertia:qf,tween:Cs,keyframes:Cs,spring:Ol};function kw(e){typeof e.type=="string"&&(e.type=wE[e.type])}class fh{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const kE=e=>e/100;class Fl extends fh{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==nn.now()&&this.tick(nn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;kw(t);const{type:n=Cs,repeat:i=0,repeatDelay:s=0,repeatType:a,velocity:l=0}=t;let{keyframes:c}=t;const f=n||Cs;f!==Cs&&typeof c[0]!="number"&&(this.mixKeyframes=Us(kE,vw(c[0],c[1])),c=[0,100]);const h=f({...t,keyframes:c});a==="mirror"&&(this.mirroredGenerator=f({...t,keyframes:[...c].reverse(),velocity:-l})),h.calculatedDuration===null&&(h.calculatedDuration=ch(h));const{calculatedDuration:m}=h;this.calculatedDuration=m,this.resolvedDuration=m+s,this.totalDuration=this.resolvedDuration*(i+1)-s,this.generator=h}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:i,totalDuration:s,mixKeyframes:a,mirroredGenerator:l,resolvedDuration:c,calculatedDuration:f}=this;if(this.startTime===null)return i.next(0);const{delay:h=0,keyframes:m,repeat:p,repeatType:v,repeatDelay:w,type:S,onUpdate:C,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const R=this.currentTime-h*(this.playbackSpeed>=0?1:-1),A=this.playbackSpeed>=0?R<0:R>s;this.currentTime=Math.max(R,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,P=i;if(p){const B=Math.min(this.currentTime,s)/c;let _=Math.floor(B),N=B%1;!N&&B>=1&&(N=1),N===1&&_--,_=Math.min(_,p+1),!!(_%2)&&(v==="reverse"?(N=1-N,w&&(N-=w/c)):v==="mirror"&&(P=l)),T=sr(0,1,N)*c}let O;A?(this.delayState.value=m[0],O=this.delayState):O=P.next(T),a&&!A&&(O.value=a(O.value));let{done:D}=O;!A&&f!==null&&(D=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return H&&S!==qf&&(O.value=iu(m,this.options,E,this.speed)),C&&C(O.value),H&&this.finish(),O}then(t,n){return this.finished.then(t,n)}get duration(){return In(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+In(t)}get time(){return In(this.currentTime)}set time(t){t=kn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return ww(i=>this.generator.next(i).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(nn.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=In(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=iE,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(nn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function SE(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ti=e=>e*180/Math.PI,Xf=e=>{const t=Ti(Math.atan2(e[1],e[0]));return Yf(t)},bE={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Xf,rotateZ:Xf,skewX:e=>Ti(Math.atan(e[1])),skewY:e=>Ti(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Yf=e=>(e=e%360,e<0&&(e+=360),e),ey=Xf,ty=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),ny=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),CE={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ty,scaleY:ny,scale:e=>(ty(e)+ny(e))/2,rotateX:e=>Yf(Ti(Math.atan2(e[6],e[5]))),rotateY:e=>Yf(Ti(Math.atan2(-e[2],e[0]))),rotateZ:ey,rotate:ey,skewX:e=>Ti(Math.atan(e[4])),skewY:e=>Ti(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Gf(e){return e.includes("scale")?1:0}function Qf(e,t){if(!e||e==="none")return Gf(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=CE,s=n;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=bE,s=c}if(!s)return Gf(t);const a=i[t],l=s[1].split(",").map(TE);return typeof a=="function"?a(l):l[a]}const EE=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Qf(n,t)};function TE(e){return parseFloat(e.trim())}const To=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Po=new Set([...To,"pathRotation"]),ry=e=>e===Eo||e===Ee,PE=new Set(["x","y","z"]),RE=To.filter(e=>!PE.has(e));function AE(e){const t=[];return RE.forEach(n=>{const i=e.getValue(n);i!==void 0&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}const Qr={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:i})=>{const s=e.max-e.min;return i==="border-box"?s:s-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:i})=>{const s=e.max-e.min;return i==="border-box"?s:s-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Qf(t,"x"),y:(e,{transform:t})=>Qf(t,"y")};Qr.translateX=Qr.x;Qr.translateY=Qr.y;const Pi=new Set;let Jf=!1,Zf=!1,ed=!1;function Sw(){if(Zf){const e=Array.from(Pi).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),n=new Map;t.forEach(i=>{const s=AE(i);s.length&&(n.set(i,s),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([a,l])=>{i.getValue(a)?.set(l)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Zf=!1,Jf=!1,Pi.forEach(e=>e.complete(ed)),Pi.clear()}function bw(){Pi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Zf=!0)})}function jE(){ed=!0,bw(),Sw(),ed=!1}class dh{constructor(t,n,i,s,a,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=i,this.motionValue=s,this.element=a,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Pi.add(this),Jf||(Jf=!0,nt.read(bw),nt.resolveKeyframes(Sw))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:i,motionValue:s}=this;if(t[0]===null){const a=s?.get(),l=t[t.length-1];if(a!==void 0)t[0]=a;else if(i&&n){const c=i.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&a===void 0&&s.set(t[0])}SE(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Pi.delete(this)}cancel(){this.state==="scheduled"&&(Pi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const NE=e=>e.startsWith("--");function Cw(e,t,n){NE(t)?e.style.setProperty(t,n):e.style[t]=n}const ME={};function Ew(e,t){const n=Jx(e);return()=>ME[t]??n()}const IE=Ew(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Tw=Ew(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ws=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,iy={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ws([0,.65,.55,1]),circOut:ws([.55,0,1,.45]),backIn:ws([.31,.01,.66,-.59]),backOut:ws([.33,1.53,.69,.99])};function Pw(e,t){if(e)return typeof e=="function"?Tw()?xw(e,t):"ease-out":uw(e)?ws(e):Array.isArray(e)?e.map(n=>Pw(n,t)||iy.easeOut):iy[e]}function DE(e,t,n,{delay:i=0,duration:s=300,repeat:a=0,repeatType:l="loop",ease:c="easeOut",times:f}={},h=void 0){const m={[t]:n};f&&(m.offset=f);const p=Pw(c,s);Array.isArray(p)&&(m.easing=p);const v={delay:i,duration:s,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:a+1,direction:l==="reverse"?"alternate":"normal"};return h&&(v.pseudoElement=h),e.animate(m,v)}function Rw(e){return typeof e=="function"&&"applyToOptions"in e}function _E({type:e,...t}){return Rw(e)&&Tw()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Aw extends fh{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:i,keyframes:s,pseudoElement:a,allowFlatten:l=!1,finalKeyframe:c,onComplete:f}=t;this.isPseudoElement=!!a,this.allowFlatten=l,this.options=t,ru(typeof t.type!="string");const h=_E(t);this.animation=DE(n,i,s,h,a),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const m=iu(s,this.options,c,this.speed);this.updateMotionValue&&this.updateMotionValue(m),Cw(n,i,m),this.animation.cancel()}f?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return In(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+In(t)}get time(){return In(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=kn(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:i,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&IE()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),i&&(this.animation.rangeEnd=i),Dn):s(this)}}const jw={anticipate:ow,backInOut:iw,circInOut:aw};function LE(e){return e in jw}function OE(e){typeof e.ease=="string"&&LE(e.ease)&&(e.ease=jw[e.ease])}const sf=10;class FE extends Aw{constructor(t){OE(t),kw(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:i,onComplete:s,element:a,...l}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const c=new Fl({...l,autoplay:!1}),f=Math.max(sf,nn.now()-this.startTime),h=sr(0,sf,f-sf),m=c.sample(f).value,{name:p}=this.options;a&&p&&Cw(a,p,m),n.setWithVelocity(c.sample(Math.max(0,f-h)).value,m,h),c.stop()}}const oy=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(qn.test(e)||e==="0")&&!e.startsWith("url("));function zE(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function VE(e,t,n,i){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const a=e[e.length-1],l=oy(s,t),c=oy(a,t);return!l||!c?!1:zE(e)||(n==="spring"||Rw(n))&&i}function td(e){e.duration=0,e.type="keyframes"}const Nw=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),BE=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function $E(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&BE.test(e[t]))return!0;return!1}const UE=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),WE=Jx(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function HE(e){const{motionValue:t,name:n,repeatDelay:i,repeatType:s,damping:a,type:l,keyframes:c}=e,f=t?.owner?.current;if(!(f instanceof HTMLElement)&&!(f instanceof SVGElement))return!1;const{onUpdate:h,transformTemplate:m}=t.owner.getProps();return WE()&&n&&(Nw.has(n)||UE.has(n)&&$E(c))&&(n!=="transform"||!m)&&!h&&!i&&s!=="mirror"&&a!==0&&l!=="inertia"}const KE=40;class qE extends fh{constructor({autoplay:t=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:l="loop",keyframes:c,name:f,motionValue:h,element:m,...p}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=nn.now();const v={autoplay:t,delay:n,type:i,repeat:s,repeatDelay:a,repeatType:l,name:f,motionValue:h,element:m,...p},w=m?.KeyframeResolver||dh;this.keyframeResolver=new w(c,(S,C,E)=>this.onKeyframesResolved(S,C,v,!E),f,h,m),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,i,s){this.keyframeResolver=void 0;const{name:a,type:l,velocity:c,delay:f,isHandoff:h,onUpdate:m}=i;this.resolvedAt=nn.now();let p=!0;VE(t,a,l,c)||(p=!1,(Zr.instantAnimations||!f)&&m?.(iu(t,i,n)),t[0]=t[t.length-1],td(i),i.repeat=0);const w={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>KE?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:t},S=p&&!h&&HE(w),C=w.motionValue?.owner?.current;let E;if(S)try{E=new FE({...w,element:C})}catch{E=new Fl(w)}else E=new Fl(w);E.finished.then(()=>{this.notifyFinished()}).catch(Dn),this.pendingTimeline&&(this.stopTimeline=E.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=E}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),jE()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Mw(e,t,n,i=0,s=1){const a=Array.from(e).sort((h,m)=>h.sortNodePosition(m)).indexOf(t),l=e.size,c=(l-1)*i;return typeof n=="function"?n(a,l):s===1?a*i:c-a*i}const sy=30,XE=e=>!isNaN(parseFloat(e));class YE{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const s=nn.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=nn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=XE(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new rh);const i=this.events[t].add(n);return t==="change"?()=>{i(),nt.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=nn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>sy)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,sy);return Zx(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ko(e,t){return new YE(e,t)}function hh(e,t){if(e?.inherit&&t){const{inherit:n,...i}=e;return{...t,...i}}return e}function ph(e,t){const n=e?.[t]??e?.default??e;return n!==e?hh(n,e):n}const GE={type:"spring",stiffness:500,damping:25,restSpeed:10},QE=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),JE={type:"keyframes",duration:.8},ZE={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},eT=(e,{keyframes:t})=>t.length>2?JE:Po.has(e)?e.startsWith("scale")?QE(t[1]):GE:ZE,tT=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function nT(e){for(const t in e)if(!tT.has(t))return!0;return!1}const mh=(e,t,n,i={},s,a)=>l=>{const c=ph(i,e)||{},f=c.delay||i.delay||0;let{elapsed:h=0}=i;h=h-kn(f);const m={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-h,onUpdate:v=>{t.set(v),c.onUpdate&&c.onUpdate(v)},onComplete:()=>{l(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:a?void 0:s};nT(c)||Object.assign(m,eT(e,m)),m.duration&&(m.duration=kn(m.duration)),m.repeatDelay&&(m.repeatDelay=kn(m.repeatDelay)),m.from!==void 0&&(m.keyframes[0]=m.from);let p=!1;if((m.type===!1||m.duration===0&&!m.repeatDelay)&&(td(m),m.delay===0&&(p=!0)),(Zr.instantAnimations||Zr.skipAnimations||s?.shouldSkipAnimations||c.skipAnimations)&&(p=!0,td(m),m.delay=0),m.allowFlatten=!c.type&&!c.ease,p&&!a&&t.get()!==void 0){const v=iu(m.keyframes,c);if(v!==void 0){nt.update(()=>{m.onUpdate(v),m.onComplete()});return}}return c.isSync?new Fl(m):new qE(m)},rT=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function iT(e){const t=rT.exec(e);if(!t)return[,];const[,n,i,s]=t;return[`--${n??i}`,s]}function Iw(e,t,n=1){const[i,s]=iT(e);if(!i)return;const a=window.getComputedStyle(t).getPropertyValue(i);if(a){const l=a.trim();return Yx(l)?parseFloat(l):l}return sh(s)?Iw(s,t,n+1):s}function ay(e){const t=[{},{}];return e?.values.forEach((n,i)=>{t[0][i]=n.get(),t[1][i]=n.getVelocity()}),t}function gh(e,t,n,i){if(typeof t=="function"){const[s,a]=ay(i);t=t(n!==void 0?n:e.custom,s,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,a]=ay(i);t=t(n!==void 0?n:e.custom,s,a)}return t}function Ri(e,t,n){const i=e.getProps();return gh(i,t,n!==void 0?n:i.custom,e)}const Dw=new Set(["width","height","top","left","right","bottom",...To]),nd=e=>Array.isArray(e);function oT(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ko(n))}function sT(e){return nd(e)?e[e.length-1]||0:e}function aT(e,t){const n=Ri(e,t);let{transitionEnd:i={},transition:s={},...a}=n||{};a={...a,...i};for(const l in a){const c=sT(a[l]);oT(e,l,c)}}const Ft=e=>!!(e&&e.getVelocity);function lT(e){return!!(Ft(e)&&e.add)}function rd(e,t){const n=e.getValue("willChange");if(lT(n))return n.add(t);if(!n&&Zr.WillChange){const i=new Zr.WillChange("auto");e.addValue("willChange",i),i.add(t)}}function yh(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const uT="framerAppearId",_w="data-"+yh(uT);function Lw(e){return e.props[_w]}function cT({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,i}function Ow(e,t,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:a,transitionEnd:l,...c}=t;const f=e.getDefaultTransition();a=a?hh(a,f):f;const h=a?.reduceMotion,m=a?.skipAnimations;i&&(a=i);const p=[],v=s&&e.animationState&&e.animationState.getState()[s],w=a?.path;w&&w.animateVisualElement(e,c,a,n,p);for(const S in c){const C=e.getValue(S,e.latestValues[S]??null),E=c[S];if(E===void 0||v&&cT(v,S))continue;const R={delay:n,...ph(a||{},S)};m&&(R.skipAnimations=!0);const A=C.get();if(A!==void 0&&!C.isAnimating()&&!Array.isArray(E)&&E===A&&!R.velocity){nt.update(()=>C.set(E));continue}let T=!1;if(window.MotionHandoffAnimation){const D=Lw(e);if(D){const H=window.MotionHandoffAnimation(D,S,nt);H!==null&&(R.startTime=H,T=!0)}}rd(e,S);const P=h??e.shouldReduceMotion;C.start(mh(S,C,E,P&&Dw.has(S)?{type:!1}:R,e,T));const O=C.animation;O&&p.push(O)}if(l){const S=()=>nt.update(()=>{l&&aT(e,l)});p.length?Promise.all(p).then(S):S()}return p}function id(e,t,n={}){const i=Ri(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const a=i?()=>Promise.all(Ow(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:h=0,staggerChildren:m,staggerDirection:p}=s;return fT(e,t,f,h,m,p,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[f,h]=c==="beforeChildren"?[a,l]:[l,a];return f().then(()=>h())}else return Promise.all([a(),l(n.delay)])}function fT(e,t,n=0,i=0,s=0,a=1,l){const c=[];for(const f of e.variantChildren)f.notify("AnimationStart",t),c.push(id(f,t,{...l,delay:n+(typeof i=="function"?0:i)+Mw(e.variantChildren,f,i,s,a)}).then(()=>f.notify("AnimationComplete",t)));return Promise.all(c)}function dT(e,t,n={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const s=t.map(a=>id(e,a,n));i=Promise.all(s)}else if(typeof t=="string")i=id(e,t,n);else{const s=typeof t=="function"?Ri(e,t,n.custom):t;i=Promise.all(Ow(e,s,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}const hT={test:e=>e==="auto",parse:e=>e},Fw=e=>t=>t.test(e),zw=[Eo,Ee,or,xr,zC,FC,hT],ly=e=>zw.find(Fw(e));function pT(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Qx(e):!0}const mT=new Set(["brightness","contrast","saturate","opacity"]);function gT(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=n.match(ah)||[];if(!i)return e;const s=n.replace(i,"");let a=mT.has(t)?1:0;return i!==n&&(a*=100),t+"("+a+s+")"}const yT=/\b([a-z-]*)\(.*?\)/gu,od={...qn,getAnimatableNone:e=>{const t=e.match(yT);return t?t.map(gT).join(" "):e}},sd={...qn,getAnimatableNone:e=>{const t=qn.parse(e);return qn.createTransformer(e)(t.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},uy={...Eo,transform:Math.round},vT={rotate:xr,pathRotation:xr,rotateX:xr,rotateY:xr,rotateZ:xr,scale:al,scaleX:al,scaleY:al,scaleZ:al,skew:xr,skewX:xr,skewY:xr,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:Ms,originX:Yg,originY:Yg,originZ:Ee},zl={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,inset:Ee,insetBlock:Ee,insetBlockStart:Ee,insetBlockEnd:Ee,insetInline:Ee,insetInlineStart:Ee,insetInlineEnd:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,paddingBlock:Ee,paddingBlockStart:Ee,paddingBlockEnd:Ee,paddingInline:Ee,paddingInlineStart:Ee,paddingInlineEnd:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,marginBlock:Ee,marginBlockStart:Ee,marginBlockEnd:Ee,marginInline:Ee,marginInlineStart:Ee,marginInlineEnd:Ee,fontSize:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee,...vT,zIndex:uy,fillOpacity:Ms,strokeOpacity:Ms,numOctaves:uy},xT={...zl,color:St,backgroundColor:St,outlineColor:St,fill:St,stroke:St,borderColor:St,borderTopColor:St,borderRightColor:St,borderBottomColor:St,borderLeftColor:St,filter:od,WebkitFilter:od,mask:sd,WebkitMask:sd},Vw=e=>xT[e],wT=new Set([od,sd]);function Bw(e,t){let n=Vw(e);return wT.has(n)||(n=qn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const kT=new Set(["auto","none","0"]);function ST(e,t,n){let i=0,s;for(;i<e.length&&!s;){const a=e[i];typeof a=="string"&&!kT.has(a)&&wo(a).values.length&&(s=e[i]),i++}if(s&&n)for(const a of t)e[a]=Bw(n,s)}class bT extends dh{constructor(t,n,i,s,a){super(t,n,i,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let m=0;m<t.length;m++){let p=t[m];if(typeof p=="string"&&(p=p.trim(),sh(p))){const v=Iw(p,n.current);v!==void 0&&(t[m]=v),m===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!Dw.has(i)||t.length!==2)return;const[s,a]=t,l=ly(s),c=ly(a),f=Xg(s),h=Xg(a);if(f!==h&&Qr[i]){this.needsMeasurement=!0;return}if(l!==c)if(ry(l)&&ry(c))for(let m=0;m<t.length;m++){const p=t[m];typeof p=="string"&&(t[m]=parseFloat(p))}else Qr[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,i=[];for(let s=0;s<t.length;s++)(t[s]===null||pT(t[s]))&&i.push(s);i.length&&ST(t,i,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:i}=this;if(!t||!t.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Qr[i](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(i,s).jump(s,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=i.length-1,l=i[a];i[a]=Qr[n](t.measureViewportBox(),window.getComputedStyle(t.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,f])=>{t.getValue(c).set(f)}),this.resolveNoneKeyframes()}}const vh=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function $w(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;const s=n?.[e]??i.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(i=>i!=null)}const ad=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Sl(e){return Gx(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:xh}=cw(queueMicrotask,!1),Kn={x:!1,y:!1};function Uw(){return Kn.x||Kn.y}function CT(e){return e==="x"||e==="y"?Kn[e]?null:(Kn[e]=!0,()=>{Kn[e]=!1}):Kn.x||Kn.y?null:(Kn.x=Kn.y=!0,()=>{Kn.x=Kn.y=!1})}function Ww(e,t){const n=$w(e),i=new AbortController,s={passive:!0,...t,signal:i.signal};return[n,s,()=>i.abort()]}function ET(e){return!(e.pointerType==="touch"||Uw())}function TT(e,t,n={}){const[i,s,a]=Ww(e,n);return i.forEach(l=>{let c=!1,f=!1,h;const m=()=>{l.removeEventListener("pointerleave",S)},p=E=>{h&&(h(E),h=void 0),m()},v=E=>{c=!1,window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),f&&(f=!1,p(E))},w=()=>{c=!0,window.addEventListener("pointerup",v,s),window.addEventListener("pointercancel",v,s)},S=E=>{if(E.pointerType!=="touch"){if(c){f=!0;return}p(E)}},C=E=>{if(!ET(E))return;f=!1;const R=t(l,E);typeof R=="function"&&(h=R,l.addEventListener("pointerleave",S,s))};l.addEventListener("pointerenter",C,s),l.addEventListener("pointerdown",w,s)}),a}const Hw=(e,t)=>t?e===t?!0:Hw(e,t.parentElement):!1,wh=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,PT=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function RT(e){return PT.has(e.tagName)||e.isContentEditable===!0}const AT=new Set(["INPUT","SELECT","TEXTAREA"]);function jT(e){return AT.has(e.tagName)||e.isContentEditable===!0}const bl=new WeakSet;function cy(e){return t=>{t.key==="Enter"&&e(t)}}function af(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const NT=(e,t)=>{const n=e.currentTarget;if(!n)return;const i=cy(()=>{if(bl.has(n))return;af(n,"down");const s=cy(()=>{af(n,"up")}),a=()=>af(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)};function fy(e){return wh(e)&&!Uw()}const dy=new WeakSet;function MT(e,t,n={}){const[i,s,a]=Ww(e,n),l=c=>{const f=c.currentTarget;if(!fy(c)||dy.has(c))return;bl.add(f),n.stopPropagation&&dy.add(c);const h=t(f,c),m={...s,capture:!0},p=(S,C)=>{window.removeEventListener("pointerup",v,m),window.removeEventListener("pointercancel",w,m),bl.has(f)&&bl.delete(f),fy(S)&&typeof h=="function"&&h(S,{success:C})},v=S=>{p(S,f===window||f===document||n.useGlobalTarget||Hw(f,S.target))},w=S=>{p(S,!1)};window.addEventListener("pointerup",v,m),window.addEventListener("pointercancel",w,m)};return i.forEach(c=>{(n.useGlobalTarget?window:c).addEventListener("pointerdown",l,s),Sl(c)&&(c.addEventListener("focus",h=>NT(h,s)),!RT(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),a}function kh(e){return Gx(e)&&"ownerSVGElement"in e}const Cl=new WeakMap;let El;const Kw=(e,t,n)=>(i,s)=>s&&s[0]?s[0][e+"Size"]:kh(i)&&"getBBox"in i?i.getBBox()[t]:i[n],IT=Kw("inline","width","offsetWidth"),DT=Kw("block","height","offsetHeight");function _T({target:e,borderBoxSize:t}){Cl.get(e)?.forEach(n=>{n(e,{get width(){return IT(e,t)},get height(){return DT(e,t)}})})}function LT(e){e.forEach(_T)}function OT(){typeof ResizeObserver>"u"||(El=new ResizeObserver(LT))}function FT(e,t){El||OT();const n=$w(e);return n.forEach(i=>{let s=Cl.get(i);s||(s=new Set,Cl.set(i,s)),s.add(t),El?.observe(i)}),()=>{n.forEach(i=>{const s=Cl.get(i);s?.delete(t),s?.size||El?.unobserve(i)})}}const Tl=new Set;let mo;function zT(){mo=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Tl.forEach(t=>t(e))},window.addEventListener("resize",mo)}function VT(e){return Tl.add(e),mo||zT(),()=>{Tl.delete(e),!Tl.size&&typeof mo=="function"&&(window.removeEventListener("resize",mo),mo=void 0)}}function hy(e,t){return typeof e=="function"?VT(e):FT(e,t)}function BT(e){return kh(e)&&e.tagName==="svg"}const $T=[...zw,St,qn],UT=e=>$T.find(Fw(e)),py=()=>({translate:0,scale:1,origin:0,originPoint:0}),go=()=>({x:py(),y:py()}),my=()=>({min:0,max:0}),Et=()=>({x:my(),y:my()}),WT=new WeakMap;function ou(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Is(e){return typeof e=="string"||Array.isArray(e)}const Sh=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],bh=["initial",...Sh];function su(e){return ou(e.animate)||bh.some(t=>Is(e[t]))}function qw(e){return!!(su(e)||e.variants)}function HT(e,t,n){for(const i in t){const s=t[i],a=n[i];if(Ft(s))e.addValue(i,s);else if(Ft(a))e.addValue(i,ko(s,{owner:e}));else if(a!==s)if(e.hasValue(i)){const l=e.getValue(i);l.liveStyle===!0?l.jump(s):l.hasAnimated||l.set(s)}else{const l=e.getStaticValue(i);e.addValue(i,ko(l!==void 0?l:s,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const ld={current:null},Xw={current:!1},KT=typeof window<"u";function qT(){if(Xw.current=!0,!!KT)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ld.current=e.matches;e.addEventListener("change",t),t()}else ld.current=!1}const gy=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Vl={};function Yw(e){Vl=e}function XT(){return Vl}class YT{scrapeMotionValuesFromProps(t,n,i){return{}}constructor({parent:t,props:n,presenceContext:i,reducedMotionConfig:s,skipAnimations:a,blockInitialAnimation:l,visualState:c},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const w=nn.now();this.renderScheduledAt<w&&(this.renderScheduledAt=w,nt.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=t,this.props=n,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=a,this.options=f,this.blockInitialAnimation=!!l,this.isControllingVariants=su(n),this.isVariantNode=qw(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...v}=this.scrapeMotionValuesFromProps(n,{},this);for(const w in v){const S=v[w];h[w]!==void 0&&Ft(S)&&S.set(h[w])}}mount(t){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=t,WT.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Xw.current||qT(),this.shouldReduceMotion=ld.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),ei(this.notifyUpdate),ei(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&Nw.has(t)&&this.current instanceof HTMLElement){const{factory:l,keyframes:c,times:f,ease:h,duration:m}=n.accelerate,p=new Aw({element:this.current,name:t,keyframes:c,times:f,ease:h,duration:kn(m)}),v=l(p);this.valueSubscriptions.set(t,()=>{v(),p.cancel()});return}const i=Po.has(t);i&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&nt.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),a&&a()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Vl){const n=Vl[t];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Et()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<gy.length;i++){const s=gy[i];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,l=t[a];l&&(this.propEventSubscriptions[s]=this.on(s,l))}this.prevMotionValues=HT(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const i=this.values.get(t);n!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return i===void 0&&n!==void 0&&(i=ko(n===null?void 0:n,{owner:this}),this.addValue(t,i)),i}readValue(t,n){let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(Yx(i)||Qx(i))?i=parseFloat(i):!UT(i)&&qn.test(n)&&(i=Bw(t,n)),this.setBaseTarget(t,Ft(i)?i.get():i)),Ft(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const a=gh(this.props,n,this.presenceContext?.custom);a&&(i=a[t])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Ft(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new rh),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){xh.render(this.render)}}class Gw extends YT{constructor(){super(...arguments),this.KeyframeResolver=bT}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const i=t.style;return i?i[n]:void 0}removeValueFromRenderState(t,{vars:n,style:i}){delete n[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ft(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class ri{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Qw({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function GT({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function QT(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function lf(e){return e===void 0||e===1}function ud({scale:e,scaleX:t,scaleY:n}){return!lf(e)||!lf(t)||!lf(n)}function Si(e){return ud(e)||Jw(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Jw(e){return yy(e.x)||yy(e.y)}function yy(e){return e&&e!=="0%"}function Bl(e,t,n){const i=e-n,s=t*i;return n+s}function vy(e,t,n,i,s){return s!==void 0&&(e=Bl(e,s,i)),Bl(e,n,i)+t}function cd(e,t=0,n=1,i,s){e.min=vy(e.min,t,n,i,s),e.max=vy(e.max,t,n,i,s)}function Zw(e,{x:t,y:n}){cd(e.x,t.translate,t.scale,t.originPoint),cd(e.y,n.translate,n.scale,n.originPoint)}const xy=.999999999999,wy=1.0000000000001;function JT(e,t,n,i=!1){const s=n.length;if(!s)return;t.x=t.y=1;let a,l;for(let c=0;c<s;c++){a=n[c],l=a.projectionDelta;const{visualElement:f}=a.options;f&&f.props.style&&f.props.style.display==="contents"||(i&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(rr(e.x,-a.scroll.offset.x),rr(e.y,-a.scroll.offset.y)),l&&(t.x*=l.x.scale,t.y*=l.y.scale,Zw(e,l)),i&&Si(a.latestValues)&&Pl(e,a.latestValues,a.layout?.layoutBox))}t.x<wy&&t.x>xy&&(t.x=1),t.y<wy&&t.y>xy&&(t.y=1)}function rr(e,t){e.min+=t,e.max+=t}function ky(e,t,n,i,s=.5){const a=tt(e.min,e.max,s);cd(e,t,n,a,i)}function Sy(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Pl(e,t,n){const i=n??e;ky(e.x,Sy(t.x,i.x),t.scaleX,t.scale,t.originX),ky(e.y,Sy(t.y,i.y),t.scaleY,t.scale,t.originY)}function e0(e,t){return Qw(QT(e.getBoundingClientRect(),t))}function ZT(e,t,n){const i=e0(e,n),{scroll:s}=t;return s&&(rr(i.x,s.offset.x),rr(i.y,s.offset.y)),i}const eP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tP=To.length;function nP(e,t,n){let i="",s=!0;for(let l=0;l<tP;l++){const c=To[l],f=e[c];if(f===void 0)continue;let h=!0;if(typeof f=="number")h=f===(c.startsWith("scale")?1:0);else{const m=parseFloat(f);h=c.startsWith("scale")?m===1:m===0}if(!h||n){const m=ad(f,zl[c]);if(!h){s=!1;const p=eP[c]||c;i+=`${p}(${m}) `}n&&(t[c]=m)}}const a=e.pathRotation;return a&&(s=!1,i+=`rotate(${ad(a,zl.pathRotation)}) `),i=i.trim(),n?i=n(t,s?"":i):s&&(i="none"),i}function Ch(e,t,n){const{style:i,vars:s,transformOrigin:a}=e;let l=!1,c=!1;for(const f in t){const h=t[f];if(Po.has(f)){l=!0;continue}else if(dw(f)){s[f]=h;continue}else{const m=ad(h,zl[f]);f.startsWith("origin")?(c=!0,a[f]=m):i[f]=m}}if(t.transform||(l||n?i.transform=nP(t,e.transform,n):i.transform&&(i.transform="none")),c){const{originX:f="50%",originY:h="50%",originZ:m=0}=a;i.transformOrigin=`${f} ${h} ${m}`}}function t0(e,{style:t,vars:n},i,s){const a=e.style;let l;for(l in t)a[l]=t[l];s?.applyProjectionStyles(a,i);for(l in n)a.setProperty(l,n[l])}function by(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ps={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ee.test(e))e=parseFloat(e);else return e;const n=by(e,t.target.x),i=by(e,t.target.y);return`${n}% ${i}%`}},rP={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,s=qn.parse(e);if(s.length>5)return i;const a=qn.createTransformer(e),l=typeof s[0]!="number"?1:0,c=n.x.scale*t.x,f=n.y.scale*t.y;s[0+l]/=c,s[1+l]/=f;const h=tt(c,f,.5);return typeof s[2+l]=="number"&&(s[2+l]/=h),typeof s[3+l]=="number"&&(s[3+l]/=h),a(s)}},fd={borderRadius:{...ps,applyTo:[...vh]},borderTopLeftRadius:ps,borderTopRightRadius:ps,borderBottomLeftRadius:ps,borderBottomRightRadius:ps,boxShadow:rP};function n0(e,{layout:t,layoutId:n}){return Po.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!fd[e]||e==="opacity")}function Eh(e,t,n){const i=e.style,s=t?.style,a={};if(!i)return a;for(const l in i)(Ft(i[l])||s&&Ft(s[l])||n0(l,e)||n?.getValue(l)?.liveStyle!==void 0)&&(a[l]=i[l]);return a}function iP(e){return window.getComputedStyle(e)}class oP extends Gw{constructor(){super(...arguments),this.type="html",this.renderInstance=t0}mount(t){ru(!!t.style),super.mount(t)}readValueFromInstance(t,n){if(Po.has(n))return this.projection?.isProjecting?Gf(n):EE(t,n);{const i=iP(t),s=(dw(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return e0(t,n)}build(t,n,i){Ch(t,n,i.transformTemplate)}scrapeMotionValuesFromProps(t,n,i){return Eh(t,n,i)}}const sP={offset:"stroke-dashoffset",array:"stroke-dasharray"},aP={offset:"strokeDashoffset",array:"strokeDasharray"};function lP(e,t,n=1,i=0,s=!0){e.pathLength=1;const a=s?sP:aP;e[a.offset]=`${-i}`,e[a.array]=`${t} ${n}`}const uP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function r0(e,{attrX:t,attrY:n,attrScale:i,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...c},f,h,m){if(Ch(e,c,h),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:v}=e;p.transform&&(v.transform=p.transform,delete p.transform),(v.transform||p.transformOrigin)&&(v.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),v.transform&&(v.transformBox=m?.transformBox??"fill-box",delete p.transformBox);for(const w of uP)p[w]!==void 0&&(v[w]=p[w],delete p[w]);t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),i!==void 0&&(p.scale=i),s!==void 0&&lP(p,s,a,l,!1)}const i0=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),o0=e=>typeof e=="string"&&e.toLowerCase()==="svg";function cP(e,t,n,i){t0(e,t,void 0,i);for(const s in t.attrs)e.setAttribute(i0.has(s)?s:yh(s),t.attrs[s])}function s0(e,t,n){const i=Eh(e,t,n);for(const s in e)if(Ft(e[s])||Ft(t[s])){const a=To.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[a]=e[s]}return i}class fP extends Gw{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Et}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Po.has(n)){const i=Vw(n);return i&&i.default||0}return n=i0.has(n)?n:yh(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,i){return s0(t,n,i)}build(t,n,i){r0(t,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,n,i,s){cP(t,n,i,s)}mount(t){this.isSVGTag=o0(t.tagName),super.mount(t)}}const dP=bh.length;function a0(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?a0(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<dP;n++){const i=bh[n],s=e.props[i];(Is(s)||s===!1)&&(t[i]=s)}return t}function l0(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}const hP=[...Sh].reverse(),pP=Sh.length;function mP(e){return t=>Promise.all(t.map(({animation:n,options:i})=>dT(e,n,i)))}function gP(e){let t=mP(e),n=Cy(),i=!0,s=!1;const a=h=>(m,p)=>{const v=Ri(e,p,h==="exit"?e.presenceContext?.custom:void 0);if(v){const{transition:w,transitionEnd:S,...C}=v;m={...m,...C,...S}}return m};function l(h){t=h(e)}function c(h){const{props:m}=e,p=a0(e.parent)||{},v=[],w=new Set;let S={},C=1/0;for(let R=0;R<pP;R++){const A=hP[R],T=n[A],P=m[A]!==void 0?m[A]:p[A],O=Is(P),D=A===h?T.isActive:null;D===!1&&(C=R);let H=P===p[A]&&P!==m[A]&&O;if(H&&(i||s)&&e.manuallyAnimateOnMount&&(H=!1),T.protectedKeys={...S},!T.isActive&&D===null||!P&&!T.prevProp||ou(P)||typeof P=="boolean")continue;if(A==="exit"&&T.isActive&&D!==!0){T.prevResolvedValues&&(S={...S,...T.prevResolvedValues});continue}const B=yP(T.prevProp,P);let _=B||A===h&&T.isActive&&!H&&O||R>C&&O,N=!1;const q=Array.isArray(P)?P:[P];let V=q.reduce(a(A),{});D===!1&&(V={});const{prevResolvedValues:ae={}}=T,J={...ae,...V},ee=G=>{_=!0,w.has(G)&&(N=!0,w.delete(G)),T.needsAnimating[G]=!0;const le=e.getValue(G);le&&(le.liveStyle=!1)};for(const G in J){const le=V[G],j=ae[G];if(S.hasOwnProperty(G))continue;let F=!1;nd(le)&&nd(j)?F=!l0(le,j)||B:F=le!==j,F?le!=null?ee(G):w.add(G):le!==void 0&&w.has(G)?ee(G):T.protectedKeys[G]=!0}T.prevProp=P,T.prevResolvedValues=V,T.isActive&&(S={...S,...V}),(i||s)&&e.blockInitialAnimation&&(_=!1);const ge=H&&B;_&&(!ge||N)&&v.push(...q.map(G=>{const le={type:A};if(typeof G=="string"&&(i||s)&&!ge&&e.manuallyAnimateOnMount&&e.parent){const{parent:j}=e,F=Ri(j,G);if(j.enteringChildren&&F){const{delayChildren:Q}=F.transition||{};le.delay=Mw(j.enteringChildren,e,Q)}}return{animation:G,options:le}}))}if(w.size){const R={};if(typeof m.initial!="boolean"){const A=Ri(e,Array.isArray(m.initial)?m.initial[0]:m.initial);A&&A.transition&&(R.transition=A.transition)}w.forEach(A=>{const T=e.getBaseTarget(A),P=e.getValue(A);P&&(P.liveStyle=!0),R[A]=T??null}),v.push({animation:R})}let E=!!v.length;return i&&(m.initial===!1||m.initial===m.animate)&&!e.manuallyAnimateOnMount&&(E=!1),i=!1,s=!1,E?t(v):Promise.resolve()}function f(h,m){if(n[h].isActive===m)return Promise.resolve();e.variantChildren?.forEach(v=>v.animationState?.setActive(h,m)),n[h].isActive=m;const p=c(h);for(const v in n)n[v].protectedKeys={};return p}return{animateChanges:c,setActive:f,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Cy(),s=!0}}}function yP(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!l0(t,e):!1}function wi(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Cy(){return{animate:wi(!0),whileInView:wi(),whileHover:wi(),whileTap:wi(),whileDrag:wi(),whileFocus:wi(),exit:wi()}}function dd(e,t){e.min=t.min,e.max=t.max}function Hn(e,t){dd(e.x,t.x),dd(e.y,t.y)}function Ey(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const u0=1e-4,vP=1-u0,xP=1+u0,c0=.01,wP=0-c0,kP=0+c0;function rn(e){return e.max-e.min}function SP(e,t,n){return Math.abs(e-t)<=n}function Ty(e,t,n,i=.5){e.origin=i,e.originPoint=tt(t.min,t.max,e.origin),e.scale=rn(n)/rn(t),e.translate=tt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=vP&&e.scale<=xP||isNaN(e.scale))&&(e.scale=1),(e.translate>=wP&&e.translate<=kP||isNaN(e.translate))&&(e.translate=0)}function Es(e,t,n,i){Ty(e.x,t.x,n.x,i?i.originX:void 0),Ty(e.y,t.y,n.y,i?i.originY:void 0)}function Py(e,t,n,i=0){const s=i?tt(n.min,n.max,i):n.min;e.min=s+t.min,e.max=e.min+rn(t)}function bP(e,t,n,i){Py(e.x,t.x,n.x,i?.x),Py(e.y,t.y,n.y,i?.y)}function Ry(e,t,n,i=0){const s=i?tt(n.min,n.max,i):n.min;e.min=t.min-s,e.max=e.min+rn(t)}function $l(e,t,n,i){Ry(e.x,t.x,n.x,i?.x),Ry(e.y,t.y,n.y,i?.y)}function Ay(e,t,n,i,s){return e-=t,e=Bl(e,1/n,i),s!==void 0&&(e=Bl(e,1/s,i)),e}function CP(e,t=0,n=1,i=.5,s,a=e,l=e){if(or.test(t)&&(t=parseFloat(t),t=tt(l.min,l.max,t/100)-l.min),typeof t!="number")return;let c=tt(a.min,a.max,i);e===a&&(c-=t),e.min=Ay(e.min,t,n,c,s),e.max=Ay(e.max,t,n,c,s)}function jy(e,t,[n,i,s],a,l){CP(e,t[n],t[i],t[s],t.scale,a,l)}const EP=["x","scaleX","originX"],TP=["y","scaleY","originY"];function Ny(e,t,n,i){jy(e.x,t,EP,n?n.x:void 0,i?i.x:void 0),jy(e.y,t,TP,n?n.y:void 0,i?i.y:void 0)}function My(e){return e.translate===0&&e.scale===1}function f0(e){return My(e.x)&&My(e.y)}function Iy(e,t){return e.min===t.min&&e.max===t.max}function PP(e,t){return Iy(e.x,t.x)&&Iy(e.y,t.y)}function Dy(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function d0(e,t){return Dy(e.x,t.x)&&Dy(e.y,t.y)}function _y(e){return rn(e.x)/rn(e.y)}function Ly(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function tr(e){return[e("x"),e("y")]}function RP(e,t,n){let i="";const s=e.x.translate/t.x,a=e.y.translate/t.y,l=n?.z||0;if((s||a||l)&&(i=`translate3d(${s}px, ${a}px, ${l}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:h,rotate:m,pathRotation:p,rotateX:v,rotateY:w,skewX:S,skewY:C}=n;h&&(i=`perspective(${h}px) ${i}`),m&&(i+=`rotate(${m}deg) `),p&&(i+=`rotate(${p}deg) `),v&&(i+=`rotateX(${v}deg) `),w&&(i+=`rotateY(${w}deg) `),S&&(i+=`skewX(${S}deg) `),C&&(i+=`skewY(${C}deg) `)}const c=e.x.scale*t.x,f=e.y.scale*t.y;return(c!==1||f!==1)&&(i+=`scale(${c}, ${f})`),i||"none"}const AP=vh.length,Oy=e=>typeof e=="string"?parseFloat(e):e,Fy=e=>typeof e=="number"||Ee.test(e);function jP(e,t,n,i,s,a){s?(e.opacity=tt(0,n.opacity??1,NP(i)),e.opacityExit=tt(t.opacity??1,0,MP(i))):a&&(e.opacity=tt(t.opacity??1,n.opacity??1,i));for(let l=0;l<AP;l++){const c=vh[l];let f=zy(t,c),h=zy(n,c);if(f===void 0&&h===void 0)continue;f||(f=0),h||(h=0),f===0||h===0||Fy(f)===Fy(h)?(e[c]=Math.max(tt(Oy(f),Oy(h),i),0),(or.test(h)||or.test(f))&&(e[c]+="%")):e[c]=h}(t.rotate||n.rotate)&&(e.rotate=tt(t.rotate||0,n.rotate||0,i))}function zy(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const NP=h0(0,.5,sw),MP=h0(.5,.95,Dn);function h0(e,t,n){return i=>i<e?0:i>t?1:n(Ns(e,t,i))}function IP(e,t,n){const i=Ft(e)?e:ko(e);return i.start(mh("",i,t,n)),i.animation}function Ds(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}const DP=(e,t)=>e.depth-t.depth;class _P{constructor(){this.children=[],this.isDirty=!1}add(t){nh(this.children,t),this.isDirty=!0}remove(t){Dl(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(DP),this.isDirty=!1,this.children.forEach(t)}}function LP(e,t){const n=nn.now(),i=({timestamp:s})=>{const a=s-n;a>=t&&(ei(i),e(a-t))};return nt.setup(i,!0),()=>ei(i)}function Rl(e){return Ft(e)?e.get():e}class OP{constructor(){this.members=[]}add(t){nh(this.members,t);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===t||i===this.lead||i===this.prevLead)continue;const s=i.instance;(!s||s.isConnected===!1)&&!i.snapshot&&(Dl(this.members,i),i.unmount())}t.scheduleRender()}remove(t){if(Dl(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const i=this.members[n];if(i.isPresent!==!1&&i.instance?.isConnected!==!1)return this.promote(i),!0}return!1}promote(t,n){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=i.options,{layoutDependency:a}=t.options;(s===void 0||s!==a)&&(t.resumeFrom=i,n&&(i.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const Al={hasAnimatedSinceResize:!0,hasEverUpdated:!1},uf=["","X","Y","Z"],FP=1e3;let zP=0;function cf(e,t,n,i){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),i&&(i[e]=0))}function p0(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Lw(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",nt,!(s||a))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&p0(i)}function m0({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(l={},c=t?.()){this.id=zP++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach($P),this.nodes.forEach(XP),this.nodes.forEach(YP),this.nodes.forEach(UP)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let f=0;f<this.path.length;f++)this.path[f].shouldResetTransform=!0;this.root===this&&(this.nodes=new _P)}addEventListener(l,c){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new rh),this.eventHandlers.get(l).add(c)}notifyListeners(l,...c){const f=this.eventHandlers.get(l);f&&f.notify(...c)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=kh(l)&&!BT(l),this.instance=l;const{layoutId:c,layout:f,visualElement:h}=this.options;if(h&&!h.current&&h.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(f||c)&&(this.isLayoutDirty=!0),e){let m,p=0;const v=()=>this.root.updateBlockedByResize=!1;nt.read(()=>{p=window.innerWidth}),e(l,()=>{const w=window.innerWidth;w!==p&&(p=w,this.root.updateBlockedByResize=!0,m&&m(),m=LP(v,250),Al.hasAnimatedSinceResize&&(Al.hasAnimatedSinceResize=!1,this.nodes.forEach($y)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&h&&(c||f)&&this.addEventListener("didUpdate",({delta:m,hasLayoutChanged:p,hasRelativeLayoutChanged:v,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||h.getDefaultTransition()||eR,{onLayoutAnimationStart:C,onLayoutAnimationComplete:E}=h.getProps(),R=!this.targetLayout||!d0(this.targetLayout,w),A=!p&&v;if(this.options.layoutRoot||this.resumeFrom||A||p&&(R||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...ph(S,"layout"),onPlay:C,onComplete:E};(h.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(m,A,T.path)}else p||$y(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ei(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(GP),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&p0(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let m=0;m<this.path.length;m++){const p=this.path[m];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:c,layout:f}=this.options;if(c===void 0&&!f)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const f=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),f&&this.nodes.forEach(HP),this.nodes.forEach(Vy);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(By);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(KP),this.nodes.forEach(qP),this.nodes.forEach(VP),this.nodes.forEach(BP)):this.nodes.forEach(By),this.clearAllSnapshots();const c=nn.now();Ot.delta=sr(0,1e3/60,c-Ot.timestamp),Ot.timestamp=c,Ot.isProcessing=!0,ef.update.process(Ot),ef.preRender.process(Ot),ef.render.process(Ot),Ot.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,xh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(WP),this.sharedNodes.forEach(QP)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,nt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){nt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!rn(this.snapshot.measuredBox.x)&&!rn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let f=0;f<this.path.length;f++)this.path[f].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Et()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(c=!1),c&&this.instance){const f=i(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:f,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:f}}}resetTransform(){if(!s)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!f0(this.projectionDelta),f=this.getTransformTemplate(),h=f?f(this.latestValues,""):void 0,m=h!==this.prevTransformTemplateValue;l&&this.instance&&(c||Si(this.latestValues)||m)&&(s(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const c=this.measurePageBox();let f=this.removeElementScroll(c);return l&&(f=this.removeTransform(f)),tR(f),{animationId:this.root.animationId,measuredBox:c,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return Et();const c=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(nR))){const{scroll:h}=this.root;h&&(rr(c.x,h.offset.x),rr(c.y,h.offset.y))}return c}removeElementScroll(l){const c=Et();if(Hn(c,l),this.scroll?.wasRoot)return c;for(let f=0;f<this.path.length;f++){const h=this.path[f],{scroll:m,options:p}=h;h!==this.root&&m&&p.layoutScroll&&(m.wasRoot&&Hn(c,l),rr(c.x,m.offset.x),rr(c.y,m.offset.y))}return c}applyTransform(l,c=!1,f){const h=f||Et();Hn(h,l);for(let m=0;m<this.path.length;m++){const p=this.path[m];!c&&p.options.layoutScroll&&p.scroll&&p!==p.root&&(rr(h.x,-p.scroll.offset.x),rr(h.y,-p.scroll.offset.y)),Si(p.latestValues)&&Pl(h,p.latestValues,p.layout?.layoutBox)}return Si(this.latestValues)&&Pl(h,this.latestValues,this.layout?.layoutBox),h}removeTransform(l){const c=Et();Hn(c,l);for(let f=0;f<this.path.length;f++){const h=this.path[f];if(!Si(h.latestValues))continue;let m;h.instance&&(ud(h.latestValues)&&h.updateSnapshot(),m=Et(),Hn(m,h.measurePageBox())),Ny(c,h.latestValues,h.snapshot?.layoutBox,m)}return Si(this.latestValues)&&Ny(c,this.latestValues),c}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ot.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const f=!!this.resumingFrom||this!==c;if(!(l||f&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:m,layoutId:p}=this.options;if(!this.layout||!(m||p))return;this.resolvedRelativeTargetAt=Ot.timestamp;const v=this.getClosestProjectingParent();v&&this.linkedParentVersion!==v.layoutVersion&&!v.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&v&&v.layout?this.createRelativeTarget(v,this.layout.layoutBox,v.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Et(),this.targetWithTransforms=Et()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),bP(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Hn(this.target,this.layout.layoutBox),Zw(this.target,this.targetDelta)):Hn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?this.createRelativeTarget(v,this.target,v.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||ud(this.parent.latestValues)||Jw(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,c,f){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Et(),this.relativeTargetOrigin=Et(),$l(this.relativeTargetOrigin,c,f,this.options.layoutAnchor||void 0),Hn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),c=!!this.resumingFrom||this!==l;let f=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(f=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===Ot.timestamp&&(f=!1),f)return;const{layout:h,layoutId:m}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||m))return;Hn(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,v=this.treeScale.y;JT(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Et());const{target:w}=l;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ey(this.prevProjectionDelta.x,this.projectionDelta.x),Ey(this.prevProjectionDelta.y,this.projectionDelta.y)),Es(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==v||!Ly(this.projectionDelta.x,this.prevProjectionDelta.x)||!Ly(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=go(),this.projectionDelta=go(),this.projectionDeltaWithTransform=go()}setAnimationOrigin(l,c=!1,f){const h=this.snapshot,m=h?h.latestValues:{},p={...this.latestValues},v=go();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const w=Et(),S=h?h.source:void 0,C=this.layout?this.layout.source:void 0,E=S!==C,R=this.getStack(),A=!R||R.members.length<=1,T=!!(E&&!A&&this.options.crossfade===!0&&!this.path.some(ZP));this.animationProgress=0;let P;const O=f?.interpolateProjection(l);this.mixTargetDelta=D=>{const H=D/1e3,B=O?.(H);B?(v.x.translate=B.x,v.x.scale=tt(l.x.scale,1,H),v.x.origin=l.x.origin,v.x.originPoint=l.x.originPoint,v.y.translate=B.y,v.y.scale=tt(l.y.scale,1,H),v.y.origin=l.y.origin,v.y.originPoint=l.y.originPoint):(Uy(v.x,l.x,H),Uy(v.y,l.y,H)),this.setTargetDelta(v),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&($l(w,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),JP(this.relativeTarget,this.relativeTargetOrigin,w,H),P&&PP(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=Et()),Hn(P,this.relativeTarget)),E&&(this.animationValues=p,jP(p,m,this.latestValues,H,T,A)),B&&B.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=B.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=H},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ei(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=nt.update(()=>{Al.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ko(0)),this.motionValue.jump(0,!1),this.currentAnimation=IP(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),l.onUpdate&&l.onUpdate(c)},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(FP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:c,target:f,layout:h,latestValues:m}=l;if(!(!c||!f||!h)){if(this!==l&&this.layout&&h&&g0(this.options.animationType,this.layout.layoutBox,h.layoutBox)){f=this.target||Et();const p=rn(this.layout.layoutBox.x);f.x.min=l.target.x.min,f.x.max=f.x.min+p;const v=rn(this.layout.layoutBox.y);f.y.min=l.target.y.min,f.y.max=f.y.min+v}Hn(c,f),Pl(c,m),Es(this.projectionDeltaWithTransform,this.layoutCorrected,c,m)}}registerSharedNode(l,c){this.sharedNodes.has(l)||this.sharedNodes.set(l,new OP),this.sharedNodes.get(l).add(c);const h=c.options.initialPromotionConfig;c.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(c):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:c,preserveFollowOpacity:f}={}){const h=this.getStack();h&&h.promote(this,f),l&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let c=!1;const{latestValues:f}=l;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(c=!0),!c)return;const h={};f.z&&cf("z",l,h,this.animationValues);for(let m=0;m<uf.length;m++)cf(`rotate${uf[m]}`,l,h,this.animationValues),cf(`skew${uf[m]}`,l,h,this.animationValues);l.render();for(const m in h)l.setStaticValue(m,h[m]),this.animationValues&&(this.animationValues[m]=h[m]);l.scheduleRender()}applyProjectionStyles(l,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const f=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Rl(c?.pointerEvents)||"",l.transform=f?f(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Rl(c?.pointerEvents)||""),this.hasProjected&&!Si(this.latestValues)&&(l.transform=f?f({},""):"none",this.hasProjected=!1);return}l.visibility="";const m=h.animationValues||h.latestValues;this.applyTransformsToTarget();let p=RP(this.projectionDeltaWithTransform,this.treeScale,m);f&&(p=f(m,p)),l.transform=p;const{x:v,y:w}=this.projectionDelta;l.transformOrigin=`${v.origin*100}% ${w.origin*100}% 0`,h.animationValues?l.opacity=h===this?m.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:m.opacityExit:l.opacity=h===this?m.opacity!==void 0?m.opacity:"":m.opacityExit!==void 0?m.opacityExit:0;for(const S in fd){if(m[S]===void 0)continue;const{correct:C,applyTo:E,isCSSVariable:R}=fd[S],A=p==="none"?m[S]:C(m[S],h);if(E){const T=E.length;for(let P=0;P<T;P++)l[E[P]]=A}else R?this.options.visualElement.renderState.vars[S]=A:l[S]=A}this.options.layoutId&&(l.pointerEvents=h===this?Rl(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(Vy),this.root.sharedNodes.clear()}}}function VP(e){e.updateLayout()}function BP(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=e.layout,{animationType:s}=e.options,a=t.source!==e.layout.source;if(s==="size")tr(m=>{const p=a?t.measuredBox[m]:t.layoutBox[m],v=rn(p);p.min=n[m].min,p.max=p.min+v});else if(s==="x"||s==="y"){const m=s==="x"?"y":"x";dd(a?t.measuredBox[m]:t.layoutBox[m],n[m])}else g0(s,t.layoutBox,n)&&tr(m=>{const p=a?t.measuredBox[m]:t.layoutBox[m],v=rn(n[m]);p.max=p.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[m].max=e.relativeTarget[m].min+v)});const l=go();Es(l,n,t.layoutBox);const c=go();a?Es(c,e.applyTransform(i,!0),t.measuredBox):Es(c,n,t.layoutBox);const f=!f0(l);let h=!1;if(!e.resumeFrom){const m=e.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:p,layout:v}=m;if(p&&v){const w=e.options.layoutAnchor||void 0,S=Et();$l(S,t.layoutBox,p.layoutBox,w);const C=Et();$l(C,n,v.layoutBox,w),d0(S,C)||(h=!0),m.options.layoutRoot&&(e.relativeTarget=C,e.relativeTargetOrigin=S,e.relativeParent=m)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:f,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function $P(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function UP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function WP(e){e.clearSnapshot()}function Vy(e){e.clearMeasurements()}function HP(e){e.isLayoutDirty=!0,e.updateLayout()}function By(e){e.isLayoutDirty=!1}function KP(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function qP(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function $y(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function XP(e){e.resolveTargetDelta()}function YP(e){e.calcProjection()}function GP(e){e.resetSkewAndRotation()}function QP(e){e.removeLeadSnapshot()}function Uy(e,t,n){e.translate=tt(t.translate,0,n),e.scale=tt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Wy(e,t,n,i){e.min=tt(t.min,n.min,i),e.max=tt(t.max,n.max,i)}function JP(e,t,n,i){Wy(e.x,t.x,n.x,i),Wy(e.y,t.y,n.y,i)}function ZP(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const eR={duration:.45,ease:[.4,0,.1,1]},Hy=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ky=Hy("applewebkit/")&&!Hy("chrome/")?Math.round:Dn;function qy(e){e.min=Ky(e.min),e.max=Ky(e.max)}function tR(e){qy(e.x),qy(e.y)}function g0(e,t,n){return e==="position"||e==="preserve-aspect"&&!SP(_y(t),_y(n),.2)}function nR(e){return e!==e.root&&e.scroll?.wasRoot}const rR=m0({attachResizeListener:(e,t)=>Ds(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),ff={current:void 0},y0=m0({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ff.current){const e=new rR({});e.mount(window),e.setOptions({layoutScroll:!0}),ff.current=e}return ff.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_s=k.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Xy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iR(...e){return t=>{let n=!1;const i=e.map(s=>{const a=Xy(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():Xy(e[s],null)}}}}function oR(...e){return k.useCallback(iR(...e),e)}class sR extends k.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Sl(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=n.offsetParent,s=Sl(i)&&i.offsetWidth||0,a=Sl(i)&&i.offsetHeight||0,l=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(l.height),c.width=parseFloat(l.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=s-c.width-c.left,c.bottom=a-c.height-c.top,c.direction=l.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function aR({children:e,isPresent:t,anchorX:n,anchorY:i,root:s,pop:a}){const l=k.useId(),c=k.useRef(null),f=k.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:h}=k.useContext(_s),m=a!==!1?e.props?.ref??e?.ref:void 0,p=oR(c,m);return k.useInsertionEffect(()=>{const{width:v,height:w,top:S,left:C,right:E,bottom:R,direction:A}=f.current;if(t||a===!1||!c.current||!v||!w)return;const T=A==="rtl",P=n==="left"?T?`right: ${E}`:`left: ${C}`:T?`left: ${C}`:`right: ${E}`,O=i==="bottom"?`bottom: ${R}`:`top: ${S}`;c.current.dataset.motionPopId=l;const D=document.createElement("style");h&&(D.nonce=h);const H=s??document.head;return H.appendChild(D),D.sheet&&D.sheet.insertRule(`
41
41
  [data-motion-pop-id="${l}"] {
@@ -260,16 +260,16 @@ Error generating stack: `+x.message+`
260
260
  `))+1))}const l="#".repeat(s),c=n.enter("headingAtx"),f=n.enter("phrasing");a.move(l+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
261
261
  `,...a.current()});return/^[\t ]/.test(h)&&(h=Fs(h.charCodeAt(0))+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),f(),c(),h}Q0.peek=h2;function Q0(e){return e.value||""}function h2(){return"<"}J0.peek=p2;function J0(e,t,n,i){const s=Ih(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const f=n.createTracker(i);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(c=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),c(),e.title&&(c=n.enter(`title${a}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),c()),h+=f.move(")"),l(),h}function p2(){return"!"}Z0.peek=m2;function Z0(e,t,n,i){const s=e.referenceType,a=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(i);let f=c.move("![");const h=n.safe(e.alt,{before:f,after:"]",...c.current()});f+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:f,after:"]",...c.current()});return l(),n.stack=m,a(),s==="full"||!h||h!==p?f+=c.move(p+"]"):s==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function m2(){return"!"}e1.peek=g2;function e1(e,t,n){let i=e.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++a<n.unsafe.length;){const l=n.unsafe[a],c=n.compilePattern(l);let f;if(l.atBreak)for(;f=c.exec(i);){let h=f.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(f.index+1)}}return s+i+s}function g2(){return"`"}function t1(e,t){const n=_h(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}n1.peek=y2;function n1(e,t,n,i){const s=Ih(n),a=s==='"'?"Quote":"Apostrophe",l=n.createTracker(i);let c,f;if(t1(e,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,{before:p,after:">",...l.current()})),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),f=n.enter("label");let h=l.move("[");return h+=l.move(n.containerPhrasing(e,{before:h,after:"](",...l.current()})),h+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(e.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(f=n.enter("destinationRaw"),h+=l.move(n.safe(e.url,{before:h,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${a}`),h+=l.move(" "+s),h+=l.move(n.safe(e.title,{before:h,after:s,...l.current()})),h+=l.move(s),f()),h+=l.move(")"),c(),h}function y2(e,t,n){return t1(e,n)?"<":"["}r1.peek=v2;function r1(e,t,n,i){const s=e.referenceType,a=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(i);let f=c.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...c.current()});f+=c.move(h+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),{before:f,after:"]",...c.current()});return l(),n.stack=m,a(),s==="full"||!h||h!==p?f+=c.move(p+"]"):s==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function v2(){return"["}function Lh(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function x2(e){const t=Lh(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function w2(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function i1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function k2(e,t,n,i){const s=n.enter("list"),a=n.bulletCurrent;let l=e.ordered?w2(n):Lh(n);const c=e.ordered?l==="."?")":".":x2(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),i1(n)===l&&m){let p=-1;for(;++p<e.children.length;){const v=e.children[p];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=c),n.bulletCurrent=l;const h=n.containerFlow(e,i);return n.bulletLastUsed=l,n.bulletCurrent=a,s(),h}function S2(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function b2(e,t,n,i){const s=S2(n);let a=n.bulletCurrent||Lh(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let l=a.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(i);c.move(a+" ".repeat(l-a.length)),c.shift(l);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,c.current()),m);return f(),h;function m(p,v,w){return v?(w?"":" ".repeat(l))+p:(w?a:a+" ".repeat(l-a.length))+p}}function C2(e,t,n,i){const s=n.enter("paragraph"),a=n.enter("phrasing"),l=n.containerPhrasing(e,i);return a(),s(),l}const E2=cu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function T2(e,t,n,i){return(e.children.some(function(l){return E2(l)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function P2(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}o1.peek=R2;function o1(e,t,n,i){const s=P2(n),a=n.enter("strong"),l=n.createTracker(i),c=l.move(s+s);let f=l.move(n.containerPhrasing(e,{after:s,before:c,...l.current()}));const h=f.charCodeAt(0),m=Yl(i.before.charCodeAt(i.before.length-1),h,s);m.inside&&(f=Fs(h)+f.slice(1));const p=f.charCodeAt(f.length-1),v=Yl(i.after.charCodeAt(0),p,s);v.inside&&(f=f.slice(0,-1)+Fs(p));const w=l.move(s+s);return a(),n.attentionEncodeSurroundingInfo={after:v.outside,before:m.outside},c+f+w}function R2(e,t,n){return n.options.strong||"*"}function A2(e,t,n,i){return n.safe(e.value,i)}function j2(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function N2(e,t,n){const i=(i1(n)+(n.options.ruleSpaces?" ":"")).repeat(j2(n));return n.options.ruleSpaces?i.slice(0,-1):i}const s1={blockquote:JN,break:Pv,code:i2,definition:s2,emphasis:Y0,hardBreak:Pv,heading:d2,html:Q0,image:J0,imageReference:Z0,inlineCode:e1,link:n1,linkReference:r1,list:k2,listItem:b2,paragraph:C2,root:T2,strong:o1,text:A2,thematicBreak:N2},Av=document.createElement("i");function Oh(e){const t="&"+e+";";Av.innerHTML=t;const n=Av.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function a1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const M2=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I2(e){return e.replace(M2,D2)}function D2(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return a1(n.slice(a?2:1),a?16:10)}return Oh(n)||e}function _2(){return{enter:{table:L2,tableData:jv,tableHeader:jv,tableRow:F2},exit:{codeText:z2,table:O2,tableData:Sf,tableHeader:Sf,tableRow:Sf}}}function L2(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function O2(e){this.exit(e),this.data.inTable=void 0}function F2(e){this.enter({type:"tableRow",children:[]},e)}function Sf(e){this.exit(e)}function jv(e){this.enter({type:"tableCell",children:[]},e)}function z2(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V2));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function V2(e,t){return t==="|"?t:e}function B2(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,s=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
262
262
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:l,tableCell:f,tableRow:c}};function l(w,S,C,E){return h(m(w,C,E),w.align)}function c(w,S,C,E){const R=p(w,C,E),A=h([R]);return A.slice(0,A.indexOf(`
263
- `))}function f(w,S,C,E){const R=C.enter("tableCell"),A=C.enter("phrasing"),T=C.containerPhrasing(w,{...E,before:a,after:a});return A(),R(),T}function h(w,S){return GN(w,{align:S,alignDelimiters:i,padding:n,stringLength:s})}function m(w,S,C){const E=w.children;let R=-1;const A=[],T=S.enter("table");for(;++R<E.length;)A[R]=p(E[R],S,C);return T(),A}function p(w,S,C){const E=w.children;let R=-1;const A=[],T=S.enter("tableRow");for(;++R<E.length;)A[R]=f(E[R],w,S,C);return T(),A}function v(w,S,C){let E=s1.inlineCode(w,S,C);return C.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function $2(){return{exit:{taskListCheckValueChecked:Nv,taskListCheckValueUnchecked:Nv,paragraph:W2}}}function U2(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H2}}}function Nv(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function W2(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const s=t.children;let a=-1,l;for(;++a<s.length;){const c=s[a];if(c.type==="paragraph"){l=c;break}}l===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function H2(e,t,n,i){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(i);a&&c.move(l);let f=s1.listItem(e,t,n,{...i,...c.current()});return a&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(m){return m+l}}function l1(){return[xN(),VN(),WN(),_2(),$2()]}function K2(e){return{extensions:[wN(),BN(e),HN(),B2(e),U2()]}}function Sn(e,t,n,i){const s=e.length;let a=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)l=Array.from(i),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<i.length;)l=i.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Nn(e,t){return e.length>0?(Sn(e,e.length,0,t),e):t}const Mv={}.hasOwnProperty;function u1(e){const t={};let n=-1;for(;++n<e.length;)q2(t,e[n]);return t}function q2(e,t){let n;for(n in t){const s=(Mv.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){Mv.call(s,l)||(s[l]=[]);const c=a[l];X2(s[l],Array.isArray(c)?c:c?[c]:[])}}}function X2(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Sn(e,0,0,i)}function Ro(e){const t=[];let n=-1,i=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&Kt(e.charCodeAt(n+1))&&Kt(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(l=String.fromCharCode(a,c),s=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(i,n),encodeURIComponent(l)),i=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function Ke(e,t,n,i){const s=i?i-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(f){return Ue(f)?(e.enter(n),c(f)):t(f)}function c(f){return Ue(f)&&a++<s?(e.consume(f),c):(e.exit(n),t(f))}}const Y2={tokenize:G2};function G2(e){const t=e.attempt(this.parser.constructs.contentInitial,i,s);let n;return t;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ke(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),a(c)}function a(c){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return De(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),l)}}const Q2={tokenize:J2},Iv={tokenize:Z2};function J2(e){const t=this,n=[];let i=0,s,a,l;return c;function c(T){if(i<n.length){const P=n[i];return t.containerState=P[1],e.attempt(P[0].continuation,f,h)(T)}return h(T)}function f(T){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&A();const P=t.events.length;let O=P,D;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){D=t.events[O][1].end;break}R(i);let H=P;for(;H<t.events.length;)t.events[H][1].end={...D},H++;return Sn(t.events,O+1,0,t.events.slice(P)),t.events.length=H,h(T)}return c(T)}function h(T){if(i===n.length){if(!s)return v(T);if(s.currentConstruct&&s.currentConstruct.concrete)return S(T);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Iv,m,p)(T)}function m(T){return s&&A(),R(i),v(T)}function p(T){return t.parser.lazy[t.now().line]=i!==n.length,l=t.now().offset,S(T)}function v(T){return t.containerState={},e.attempt(Iv,w,S)(T)}function w(T){return i++,n.push([t.currentConstruct,t.containerState]),v(T)}function S(T){if(T===null){s&&A(),R(0),e.consume(T);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),C(T)}function C(T){if(T===null){E(e.exit("chunkFlow"),!0),R(0),e.consume(T);return}return De(T)?(e.consume(T),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,c):(e.consume(T),C)}function E(T,P){const O=t.sliceStream(T);if(P&&O.push(null),T.previous=a,a&&(a.next=T),a=T,s.defineSkip(T.start),s.write(O),t.parser.lazy[T.start.line]){let D=s.events.length;for(;D--;)if(s.events[D][1].start.offset<l&&(!s.events[D][1].end||s.events[D][1].end.offset>l))return;const H=t.events.length;let B=H,_,N;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(_){N=t.events[B][1].end;break}_=!0}for(R(i),D=H;D<t.events.length;)t.events[D][1].end={...N},D++;Sn(t.events,B+1,0,t.events.slice(H)),t.events.length=D}}function R(T){let P=n.length;for(;P-- >T;){const O=n[P];t.containerState=O[1],O[0].exit.call(t,e)}n.length=T}function A(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Z2(e,t,n){return Ke(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function du(e,t,n){const i=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!i.includes(a)&&(t=a(t,n),i.push(a))}return t}const Ed={name:"attention",resolveAll:eM,tokenize:tM};function eM(e,t){let n=-1,i,s,a,l,c,f,h,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[i][1].end},v={...e[n][1].start};Dv(p,-f),Dv(v,f),l={type:f>1?"strongSequence":"emphasisSequence",start:p,end:{...e[i][1].end}},c={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},a={type:f>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[i][1].end={...l.start},e[n][1].start={...c.end},h=[],e[i][1].end.offset-e[i][1].start.offset&&(h=Nn(h,[["enter",e[i][1],t],["exit",e[i][1],t]])),h=Nn(h,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",a,t]]),h=Nn(h,du(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),h=Nn(h,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,h=Nn(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Sn(e,i-1,n-i+3,h),n=i+h.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function tM(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,s=bo(i);let a;return l;function l(f){return a=f,e.enter("attentionSequence"),c(f)}function c(f){if(f===a)return e.consume(f),c;const h=e.exit("attentionSequence"),m=bo(f),p=!m||m===2&&s||n.includes(f),v=!s||s===2&&m||n.includes(i);return h._open=!!(a===42?p:p&&(s||!v)),h._close=!!(a===42?v:v&&(m||!p)),t(f)}}function Dv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const nM={name:"autolink",tokenize:rM};function rM(e,t,n){let i=0;return s;function s(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(w){return tn(w)?(e.consume(w),l):w===64?n(w):h(w)}function l(w){return w===43||w===45||w===46||Kt(w)?(i=1,c(w)):h(w)}function c(w){return w===58?(e.consume(w),i=0,f):(w===43||w===45||w===46||Kt(w))&&i++<32?(e.consume(w),c):(i=0,h(w))}function f(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Xl(w)?n(w):(e.consume(w),f)}function h(w){return w===64?(e.consume(w),m):rN(w)?(e.consume(w),h):n(w)}function m(w){return Kt(w)?p(w):n(w)}function p(w){return w===46?(e.consume(w),i=0,m):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):v(w)}function v(w){if((w===45||Kt(w))&&i++<63){const S=w===45?v:p;return e.consume(w),S}return n(w)}}const Xs={partial:!0,tokenize:iM};function iM(e,t,n){return i;function i(a){return Ue(a)?Ke(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||De(a)?t(a):n(a)}}const c1={continuation:{tokenize:sM},exit:aM,name:"blockQuote",tokenize:oM};function oM(e,t,n){const i=this;return s;function s(l){if(l===62){const c=i.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Ue(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function sM(e,t,n){const i=this;return s;function s(l){return Ue(l)?Ke(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(c1,t,n)(l)}}function aM(e){e.exit("blockQuote")}const f1={name:"characterEscape",tokenize:lM};function lM(e,t,n){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return oN(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const d1={name:"characterReference",tokenize:uM};function uM(e,t,n){const i=this;let s=0,a,l;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),f}function f(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),a=31,l=Kt,m(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=iN,m):(e.enter("characterReferenceValue"),a=7,l=bd,m(p))}function m(p){if(p===59&&s){const v=e.exit("characterReferenceValue");return l===Kt&&!Oh(i.sliceSerialize(v))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&s++<a?(e.consume(p),m):n(p)}}const _v={partial:!0,tokenize:fM},Lv={concrete:!0,name:"codeFenced",tokenize:cM};function cM(e,t,n){const i=this,s={partial:!0,tokenize:O};let a=0,l=0,c;return f;function f(D){return h(D)}function h(D){const H=i.events[i.events.length-1];return a=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,c=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(D)}function m(D){return D===c?(l++,e.consume(D),m):l<3?n(D):(e.exit("codeFencedFenceSequence"),Ue(D)?Ke(e,p,"whitespace")(D):p(D))}function p(D){return D===null||De(D)?(e.exit("codeFencedFence"),i.interrupt?t(D):e.check(_v,C,P)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===null||De(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(D)):Ue(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,w,"whitespace")(D)):D===96&&D===c?n(D):(e.consume(D),v)}function w(D){return D===null||De(D)?p(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(D))}function S(D){return D===null||De(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(D)):D===96&&D===c?n(D):(e.consume(D),S)}function C(D){return e.attempt(s,P,E)(D)}function E(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),R}function R(D){return a>0&&Ue(D)?Ke(e,A,"linePrefix",a+1)(D):A(D)}function A(D){return D===null||De(D)?e.check(_v,C,P)(D):(e.enter("codeFlowValue"),T(D))}function T(D){return D===null||De(D)?(e.exit("codeFlowValue"),A(D)):(e.consume(D),T)}function P(D){return e.exit("codeFenced"),t(D)}function O(D,H,B){let _=0;return N;function N(ee){return D.enter("lineEnding"),D.consume(ee),D.exit("lineEnding"),q}function q(ee){return D.enter("codeFencedFence"),Ue(ee)?Ke(D,V,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ee):V(ee)}function V(ee){return ee===c?(D.enter("codeFencedFenceSequence"),ae(ee)):B(ee)}function ae(ee){return ee===c?(_++,D.consume(ee),ae):_>=l?(D.exit("codeFencedFenceSequence"),Ue(ee)?Ke(D,J,"whitespace")(ee):J(ee)):B(ee)}function J(ee){return ee===null||De(ee)?(D.exit("codeFencedFence"),H(ee)):B(ee)}}}function fM(e,t,n){const i=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}const bf={name:"codeIndented",tokenize:hM},dM={partial:!0,tokenize:pM};function hM(e,t,n){const i=this;return s;function s(h){return e.enter("codeIndented"),Ke(e,a,"linePrefix",5)(h)}function a(h){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?f(h):De(h)?e.attempt(dM,l,f)(h):(e.enter("codeFlowValue"),c(h))}function c(h){return h===null||De(h)?(e.exit("codeFlowValue"),l(h)):(e.consume(h),c)}function f(h){return e.exit("codeIndented"),t(h)}}function pM(e,t,n){const i=this;return s;function s(l){return i.parser.lazy[i.now().line]?n(l):De(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):Ke(e,a,"linePrefix",5)(l)}function a(l){const c=i.events[i.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):De(l)?s(l):n(l)}}const mM={name:"codeText",previous:yM,resolve:gM,tokenize:vM};function gM(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)s===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(s=i):(i===t||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),t-=i-s-2,i=s+2),s=void 0);return e}function yM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vM(e,t,n){let i=0,s,a;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),i++,c):(e.exit("codeTextSequence"),f(p))}function f(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),f):p===96?(a=e.enter("codeTextSequence"),s=0,m(p)):De(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||De(p)?(e.exit("codeTextData"),f(p)):(e.consume(p),h)}function m(p){return p===96?(e.consume(p),s++,m):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(a.type="codeTextData",h(p))}}class xM{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&gs(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),gs(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),gs(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);gs(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);gs(this.left,n.reverse())}}}function gs(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function h1(e){const t={};let n=-1,i,s,a,l,c,f,h;const m=new xM(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(i=m.get(n),n&&i[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,a=0,a<f.length&&f[a][1].type==="lineEndingBlank"&&(a+=2),a<f.length&&f[a][1].type==="content"))for(;++a<f.length&&f[a][1].type!=="content";)f[a][1].type==="chunkText"&&(f[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,wM(m,n)),n=t[n],h=!0);else if(i[1]._container){for(a=n,s=void 0;a--;)if(l=m.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(m.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(i[1].end={...m.get(s)[1].start},c=m.slice(s,n),c.unshift(i),m.splice(s,n-s+1,c))}}return Sn(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!h}function wM(e,t){const n=e.get(t)[1],i=e.get(t)[2];let s=t-1;const a=[];let l=n._tokenizer;l||(l=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,f=[],h={};let m,p,v=-1,w=n,S=0,C=0;const E=[C];for(;w;){for(;e.get(++s)[1]!==w;);a.push(s),w._tokenizer||(m=i.sliceStream(w),w.next||m.push(null),p&&l.defineSkip(w.start),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=n;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(C=v+1,E.push(C),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(l.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),v=E.length;v--;){const R=c.slice(E[v],E[v+1]),A=a.pop();f.push([A,A+R.length-1]),e.splice(A,2,R)}for(f.reverse(),v=-1;++v<f.length;)h[S+f[v][0]]=S+f[v][1],S+=f[v][1]-f[v][0]-1;return h}const kM={resolve:bM,tokenize:CM},SM={partial:!0,tokenize:EM};function bM(e){return h1(e),e}function CM(e,t){let n;return i;function i(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?a(c):De(c)?e.check(SM,l,a)(c):(e.consume(c),s)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function EM(e,t,n){const i=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ke(e,a,"linePrefix")}function a(l){if(l===null||De(l))return n(l);const c=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(i.parser.constructs.flow,n,t)(l)}}function p1(e,t,n,i,s,a,l,c,f){const h=f||Number.POSITIVE_INFINITY;let m=0;return p;function p(R){return R===60?(e.enter(i),e.enter(s),e.enter(a),e.consume(R),e.exit(a),v):R===null||R===32||R===41||Xl(R)?n(R):(e.enter(i),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),C(R))}function v(R){return R===62?(e.enter(a),e.consume(R),e.exit(a),e.exit(s),e.exit(i),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),w(R))}function w(R){return R===62?(e.exit("chunkString"),e.exit(c),v(R)):R===null||R===60||De(R)?n(R):(e.consume(R),R===92?S:w)}function S(R){return R===60||R===62||R===92?(e.consume(R),w):w(R)}function C(R){return!m&&(R===null||R===41||rt(R))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(i),t(R)):m<h&&R===40?(e.consume(R),m++,C):R===41?(e.consume(R),m--,C):R===null||R===32||R===40||Xl(R)?n(R):(e.consume(R),R===92?E:C)}function E(R){return R===40||R===41||R===92?(e.consume(R),C):C(R)}}function m1(e,t,n,i,s,a){const l=this;let c=0,f;return h;function h(w){return e.enter(i),e.enter(s),e.consume(w),e.exit(s),e.enter(a),m}function m(w){return c>999||w===null||w===91||w===93&&!f||w===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(w):w===93?(e.exit(a),e.enter(s),e.consume(w),e.exit(s),e.exit(i),t):De(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||De(w)||c++>999?(e.exit("chunkString"),m(w)):(e.consume(w),f||(f=!Ue(w)),w===92?v:p)}function v(w){return w===91||w===92||w===93?(e.consume(w),c++,p):p(w)}}function g1(e,t,n,i,s,a){let l;return c;function c(v){return v===34||v===39||v===40?(e.enter(i),e.enter(s),e.consume(v),e.exit(s),l=v===40?41:v,f):n(v)}function f(v){return v===l?(e.enter(s),e.consume(v),e.exit(s),e.exit(i),t):(e.enter(a),h(v))}function h(v){return v===l?(e.exit(a),f(l)):v===null?n(v):De(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Ke(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===l||v===null||De(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?p:m)}function p(v){return v===l||v===92?(e.consume(v),m):m(v)}}function Ps(e,t){let n;return i;function i(s){return De(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):Ue(s)?Ke(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const TM={name:"definition",tokenize:RM},PM={partial:!0,tokenize:AM};function RM(e,t,n){const i=this;let s;return a;function a(w){return e.enter("definition"),l(w)}function l(w){return m1.call(i,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function c(w){return s=Xn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),f):n(w)}function f(w){return rt(w)?Ps(e,h)(w):h(w)}function h(w){return p1(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function m(w){return e.attempt(PM,p,p)(w)}function p(w){return Ue(w)?Ke(e,v,"whitespace")(w):v(w)}function v(w){return w===null||De(w)?(e.exit("definition"),i.parser.defined.push(s),t(w)):n(w)}}function AM(e,t,n){return i;function i(c){return rt(c)?Ps(e,s)(c):n(c)}function s(c){return g1(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Ue(c)?Ke(e,l,"whitespace")(c):l(c)}function l(c){return c===null||De(c)?t(c):n(c)}}const jM={name:"hardBreakEscape",tokenize:NM};function NM(e,t,n){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return De(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const MM={name:"headingAtx",resolve:IM,tokenize:DM};function IM(e,t){let n=e.length-2,i=3,s,a;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},a={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Sn(e,i,n-i+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function DM(e,t,n){let i=0;return s;function s(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&i++<6?(e.consume(m),l):m===null||rt(m)?(e.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),f(m)):m===null||De(m)?(e.exit("atxHeading"),t(m)):Ue(m)?Ke(e,c,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function f(m){return m===35?(e.consume(m),f):(e.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||rt(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),h)}}const _M=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ov=["pre","script","style","textarea"],LM={concrete:!0,name:"htmlFlow",resolveTo:zM,tokenize:VM},OM={partial:!0,tokenize:$M},FM={partial:!0,tokenize:BM};function zM(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function VM(e,t,n){const i=this;let s,a,l,c,f;return h;function h(M){return m(M)}function m(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),p}function p(M){return M===33?(e.consume(M),v):M===47?(e.consume(M),a=!0,C):M===63?(e.consume(M),s=3,i.interrupt?t:j):tn(M)?(e.consume(M),l=String.fromCharCode(M),E):n(M)}function v(M){return M===45?(e.consume(M),s=2,w):M===91?(e.consume(M),s=5,c=0,S):tn(M)?(e.consume(M),s=4,i.interrupt?t:j):n(M)}function w(M){return M===45?(e.consume(M),i.interrupt?t:j):n(M)}function S(M){const Z="CDATA[";return M===Z.charCodeAt(c++)?(e.consume(M),c===Z.length?i.interrupt?t:V:S):n(M)}function C(M){return tn(M)?(e.consume(M),l=String.fromCharCode(M),E):n(M)}function E(M){if(M===null||M===47||M===62||rt(M)){const Z=M===47,ye=l.toLowerCase();return!Z&&!a&&Ov.includes(ye)?(s=1,i.interrupt?t(M):V(M)):_M.includes(l.toLowerCase())?(s=6,Z?(e.consume(M),R):i.interrupt?t(M):V(M)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(M):a?A(M):T(M))}return M===45||Kt(M)?(e.consume(M),l+=String.fromCharCode(M),E):n(M)}function R(M){return M===62?(e.consume(M),i.interrupt?t:V):n(M)}function A(M){return Ue(M)?(e.consume(M),A):N(M)}function T(M){return M===47?(e.consume(M),N):M===58||M===95||tn(M)?(e.consume(M),P):Ue(M)?(e.consume(M),T):N(M)}function P(M){return M===45||M===46||M===58||M===95||Kt(M)?(e.consume(M),P):O(M)}function O(M){return M===61?(e.consume(M),D):Ue(M)?(e.consume(M),O):T(M)}function D(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),f=M,H):Ue(M)?(e.consume(M),D):B(M)}function H(M){return M===f?(e.consume(M),f=null,_):M===null||De(M)?n(M):(e.consume(M),H)}function B(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||rt(M)?O(M):(e.consume(M),B)}function _(M){return M===47||M===62||Ue(M)?T(M):n(M)}function N(M){return M===62?(e.consume(M),q):n(M)}function q(M){return M===null||De(M)?V(M):Ue(M)?(e.consume(M),q):n(M)}function V(M){return M===45&&s===2?(e.consume(M),ge):M===60&&s===1?(e.consume(M),we):M===62&&s===4?(e.consume(M),F):M===63&&s===3?(e.consume(M),j):M===93&&s===5?(e.consume(M),le):De(M)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(OM,Q,ae)(M)):M===null||De(M)?(e.exit("htmlFlowData"),ae(M)):(e.consume(M),V)}function ae(M){return e.check(FM,J,Q)(M)}function J(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ee}function ee(M){return M===null||De(M)?ae(M):(e.enter("htmlFlowData"),V(M))}function ge(M){return M===45?(e.consume(M),j):V(M)}function we(M){return M===47?(e.consume(M),l="",G):V(M)}function G(M){if(M===62){const Z=l.toLowerCase();return Ov.includes(Z)?(e.consume(M),F):V(M)}return tn(M)&&l.length<8?(e.consume(M),l+=String.fromCharCode(M),G):V(M)}function le(M){return M===93?(e.consume(M),j):V(M)}function j(M){return M===62?(e.consume(M),F):M===45&&s===2?(e.consume(M),j):V(M)}function F(M){return M===null||De(M)?(e.exit("htmlFlowData"),Q(M)):(e.consume(M),F)}function Q(M){return e.exit("htmlFlow"),t(M)}}function BM(e,t,n){const i=this;return s;function s(l){return De(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}function $M(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Xs,t,n)}}const UM={name:"htmlText",tokenize:WM};function WM(e,t,n){const i=this;let s,a,l;return c;function c(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),f}function f(j){return j===33?(e.consume(j),h):j===47?(e.consume(j),O):j===63?(e.consume(j),T):tn(j)?(e.consume(j),B):n(j)}function h(j){return j===45?(e.consume(j),m):j===91?(e.consume(j),a=0,S):tn(j)?(e.consume(j),A):n(j)}function m(j){return j===45?(e.consume(j),w):n(j)}function p(j){return j===null?n(j):j===45?(e.consume(j),v):De(j)?(l=p,we(j)):(e.consume(j),p)}function v(j){return j===45?(e.consume(j),w):p(j)}function w(j){return j===62?ge(j):j===45?v(j):p(j)}function S(j){const F="CDATA[";return j===F.charCodeAt(a++)?(e.consume(j),a===F.length?C:S):n(j)}function C(j){return j===null?n(j):j===93?(e.consume(j),E):De(j)?(l=C,we(j)):(e.consume(j),C)}function E(j){return j===93?(e.consume(j),R):C(j)}function R(j){return j===62?ge(j):j===93?(e.consume(j),R):C(j)}function A(j){return j===null||j===62?ge(j):De(j)?(l=A,we(j)):(e.consume(j),A)}function T(j){return j===null?n(j):j===63?(e.consume(j),P):De(j)?(l=T,we(j)):(e.consume(j),T)}function P(j){return j===62?ge(j):T(j)}function O(j){return tn(j)?(e.consume(j),D):n(j)}function D(j){return j===45||Kt(j)?(e.consume(j),D):H(j)}function H(j){return De(j)?(l=H,we(j)):Ue(j)?(e.consume(j),H):ge(j)}function B(j){return j===45||Kt(j)?(e.consume(j),B):j===47||j===62||rt(j)?_(j):n(j)}function _(j){return j===47?(e.consume(j),ge):j===58||j===95||tn(j)?(e.consume(j),N):De(j)?(l=_,we(j)):Ue(j)?(e.consume(j),_):ge(j)}function N(j){return j===45||j===46||j===58||j===95||Kt(j)?(e.consume(j),N):q(j)}function q(j){return j===61?(e.consume(j),V):De(j)?(l=q,we(j)):Ue(j)?(e.consume(j),q):_(j)}function V(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),s=j,ae):De(j)?(l=V,we(j)):Ue(j)?(e.consume(j),V):(e.consume(j),J)}function ae(j){return j===s?(e.consume(j),s=void 0,ee):j===null?n(j):De(j)?(l=ae,we(j)):(e.consume(j),ae)}function J(j){return j===null||j===34||j===39||j===60||j===61||j===96?n(j):j===47||j===62||rt(j)?_(j):(e.consume(j),J)}function ee(j){return j===47||j===62||rt(j)?_(j):n(j)}function ge(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),t):n(j)}function we(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),G}function G(j){return Ue(j)?Ke(e,le,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):le(j)}function le(j){return e.enter("htmlTextData"),l(j)}}const Fh={name:"labelEnd",resolveAll:XM,resolveTo:YM,tokenize:GM},HM={tokenize:QM},KM={tokenize:JM},qM={tokenize:ZM};function XM(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",t+=s}}return e.length!==n.length&&Sn(e,0,e.length,n),e}function YM(e,t){let n=e.length,i=0,s,a,l,c;for(;n--;)if(s=e[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(l=n);const f={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},m={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",f,t],["enter",h,t]],c=Nn(c,e.slice(a+1,a+i+3)),c=Nn(c,[["enter",m,t]]),c=Nn(c,du(t.parser.constructs.insideSpan.null,e.slice(a+i+4,l-3),t)),c=Nn(c,[["exit",m,t],e[l-2],e[l-1],["exit",h,t]]),c=Nn(c,e.slice(l+1)),c=Nn(c,[["exit",f,t]]),Sn(e,a,e.length,c),e}function GM(e,t,n){const i=this;let s=i.events.length,a,l;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){a=i.events[s][1];break}return c;function c(v){return a?a._inactive?p(v):(l=i.parser.defined.includes(Xn(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),f):n(v)}function f(v){return v===40?e.attempt(HM,m,l?m:p)(v):v===91?e.attempt(KM,m,l?h:p)(v):l?m(v):p(v)}function h(v){return e.attempt(qM,m,p)(v)}function m(v){return t(v)}function p(v){return a._balanced=!0,n(v)}}function QM(e,t,n){return i;function i(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return rt(p)?Ps(e,a)(p):a(p)}function a(p){return p===41?m(p):p1(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return rt(p)?Ps(e,f)(p):m(p)}function c(p){return n(p)}function f(p){return p===34||p===39||p===40?g1(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):m(p)}function h(p){return rt(p)?Ps(e,m)(p):m(p)}function m(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function JM(e,t,n){const i=this;return s;function s(c){return m1.call(i,e,a,l,"reference","referenceMarker","referenceString")(c)}function a(c){return i.parser.defined.includes(Xn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function ZM(e,t,n){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const eI={name:"labelStartImage",resolveAll:Fh.resolveAll,tokenize:tI};function tI(e,t,n){const i=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(c):t(c)}}const nI={name:"labelStartLink",resolveAll:Fh.resolveAll,tokenize:rI};function rI(e,t,n){const i=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(l):t(l)}}const Cf={name:"lineEnding",tokenize:iI};function iI(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ke(e,t,"linePrefix")}}const jl={name:"thematicBreak",tokenize:oI};function oI(e,t,n){let i=0,s;return a;function a(h){return e.enter("thematicBreak"),l(h)}function l(h){return s=h,c(h)}function c(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):i>=3&&(h===null||De(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),i++,f):(e.exit("thematicBreakSequence"),Ue(h)?Ke(e,c,"whitespace")(h):c(h))}}const hn={continuation:{tokenize:uI},exit:fI,name:"list",tokenize:lI},sI={partial:!0,tokenize:dI},aI={partial:!0,tokenize:cI};function lI(e,t,n){const i=this,s=i.events[i.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(w){const S=i.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||w===i.containerState.marker:bd(w)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(jl,n,h)(w):h(w);if(!i.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(w)}return n(w)}function f(w){return bd(w)&&++l<10?(e.consume(w),f):(!i.interrupt||l<2)&&(i.containerState.marker?w===i.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):n(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||w,e.check(Xs,i.interrupt?n:m,e.attempt(sI,v,p))}function m(w){return i.containerState.initialBlankLine=!0,a++,v(w)}function p(w){return Ue(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),v):n(w)}function v(w){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function uI(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Xs,s,a);function s(c){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Ke(e,t,"listItemIndent",i.containerState.size+1)(c)}function a(c){return i.containerState.furtherBlankLines||!Ue(c)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,l(c)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(aI,t,l)(c))}function l(c){return i.containerState._closeFlow=!0,i.interrupt=void 0,Ke(e,e.attempt(hn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function cI(e,t,n){const i=this;return Ke(e,s,"listItemIndent",i.containerState.size+1);function s(a){const l=i.events[i.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===i.containerState.size?t(a):n(a)}}function fI(e){e.exit(this.containerState.type)}function dI(e,t,n){const i=this;return Ke(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const l=i.events[i.events.length-1];return!Ue(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Fv={name:"setextUnderline",resolveTo:hI,tokenize:pI};function hI(e,t){let n=e.length,i,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",l,t]),e.splice(a+1,0,["exit",e[i][1],t]),e[i][1].end={...e[a][1].end}):e[i][1]=l,e.push(["exit",l,t]),e}function pI(e,t,n){const i=this;let s;return a;function a(h){let m=i.events.length,p;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){p=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||p)?(e.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return e.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(e.consume(h),c):(e.exit("setextHeadingLineSequence"),Ue(h)?Ke(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||De(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const mI={tokenize:gI};function gI(e){const t=this,n=e.attempt(Xs,i,e.attempt(this.parser.constructs.flowInitial,s,Ke(e,e.attempt(this.parser.constructs.flow,s,e.attempt(kM,s)),"linePrefix")));return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yI={resolveAll:v1()},vI=y1("string"),xI=y1("text");function y1(e){return{resolveAll:v1(e==="text"?wI:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],a=n.attempt(s,l,c);return l;function l(m){return h(m)?a(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),f}function f(m){return h(m)?(n.exit("data"),a(m)):(n.consume(m),f)}function h(m){if(m===null)return!0;const p=s[m];let v=-1;if(p)for(;++v<p.length;){const w=p[v];if(!w.previous||w.previous.call(i,i.previous))return!0}return!1}}}function v1(e){return t;function t(n,i){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,i):n}}function wI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],s=t.sliceStream(i);let a=s.length,l=-1,c=0,f;for(;a--;){const h=s[a];if(typeof h=="string"){for(l=h.length;h.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(h===-2)f=!0,c++;else if(h!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const h={type:n===e.length||f||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:i.start._bufferIndex+l,_index:i.start._index+a,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const kI={42:hn,43:hn,45:hn,48:hn,49:hn,50:hn,51:hn,52:hn,53:hn,54:hn,55:hn,56:hn,57:hn,62:c1},SI={91:TM},bI={[-2]:bf,[-1]:bf,32:bf},CI={35:MM,42:jl,45:[Fv,jl],60:LM,61:Fv,95:jl,96:Lv,126:Lv},EI={38:d1,92:f1},TI={[-5]:Cf,[-4]:Cf,[-3]:Cf,33:eI,38:d1,42:Ed,60:[nM,UM],91:nI,92:[jM,f1],93:Fh,95:Ed,96:mM},PI={null:[Ed,yI]},RI={null:[42,95]},AI={null:[]},jI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:RI,contentInitial:SI,disable:AI,document:kI,flow:CI,flowInitial:bI,insideSpan:PI,string:EI,text:TI},Symbol.toStringTag,{value:"Module"}));function NI(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let l=[],c=[];const f={attempt:H(O),check:H(D),consume:A,enter:T,exit:P,interrupt:H(D,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:S,parser:e,previous:null,sliceSerialize:v,sliceStream:w,write:p};let m=t.tokenize.call(h,f);return t.resolveAll&&a.push(t),h;function p(q){return l=Nn(l,q),E(),l[l.length-1]!==null?[]:(B(t,0),h.events=du(a,h.events,h),h.events)}function v(q,V){return II(w(q),V)}function w(q){return MI(l,q)}function S(){const{_bufferIndex:q,_index:V,line:ae,column:J,offset:ee}=i;return{_bufferIndex:q,_index:V,line:ae,column:J,offset:ee}}function C(q){s[q.line]=q.column,N()}function E(){let q;for(;i._index<l.length;){const V=l[i._index];if(typeof V=="string")for(q=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===q&&i._bufferIndex<V.length;)R(V.charCodeAt(i._bufferIndex));else R(V)}}function R(q){m=m(q)}function A(q){De(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,N()):q!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===l[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=q}function T(q,V){const ae=V||{};return ae.type=q,ae.start=S(),h.events.push(["enter",ae,h]),c.push(ae),ae}function P(q){const V=c.pop();return V.end=S(),h.events.push(["exit",V,h]),V}function O(q,V){B(q,V.from)}function D(q,V){V.restore()}function H(q,V){return ae;function ae(J,ee,ge){let we,G,le,j;return Array.isArray(J)?Q(J):"tokenize"in J?Q([J]):F(J);function F(me){return he;function he(be){const xe=be!==null&&me[be],Be=be!==null&&me.null,Oe=[...Array.isArray(xe)?xe:xe?[xe]:[],...Array.isArray(Be)?Be:Be?[Be]:[]];return Q(Oe)(be)}}function Q(me){return we=me,G=0,me.length===0?ge:M(me[G])}function M(me){return he;function he(be){return j=_(),le=me,me.partial||(h.currentConstruct=me),me.name&&h.parser.constructs.disable.null.includes(me.name)?ye():me.tokenize.call(V?Object.assign(Object.create(h),V):h,f,Z,ye)(be)}}function Z(me){return q(le,j),ee}function ye(me){return j.restore(),++G<we.length?M(we[G]):ge}}}function B(q,V){q.resolveAll&&!a.includes(q)&&a.push(q),q.resolve&&Sn(h.events,V,h.events.length-V,q.resolve(h.events.slice(V),h)),q.resolveTo&&(h.events=q.resolveTo(h.events,h))}function _(){const q=S(),V=h.previous,ae=h.currentConstruct,J=h.events.length,ee=Array.from(c);return{from:J,restore:ge};function ge(){i=q,h.previous=V,h.currentConstruct=ae,h.events.length=J,c=ee,N()}}function N(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function MI(e,t){const n=t.start._index,i=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(i,a)];else{if(l=e.slice(n,s),i>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(i):l.shift()}a>0&&l.push(e[s].slice(0,a))}return l}function II(e,t){let n=-1;const i=[];let s;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
263
+ `))}function f(w,S,C,E){const R=C.enter("tableCell"),A=C.enter("phrasing"),T=C.containerPhrasing(w,{...E,before:a,after:a});return A(),R(),T}function h(w,S){return GN(w,{align:S,alignDelimiters:i,padding:n,stringLength:s})}function m(w,S,C){const E=w.children;let R=-1;const A=[],T=S.enter("table");for(;++R<E.length;)A[R]=p(E[R],S,C);return T(),A}function p(w,S,C){const E=w.children;let R=-1;const A=[],T=S.enter("tableRow");for(;++R<E.length;)A[R]=f(E[R],w,S,C);return T(),A}function v(w,S,C){let E=s1.inlineCode(w,S,C);return C.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function $2(){return{exit:{taskListCheckValueChecked:Nv,taskListCheckValueUnchecked:Nv,paragraph:W2}}}function U2(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H2}}}function Nv(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function W2(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const s=t.children;let a=-1,l;for(;++a<s.length;){const c=s[a];if(c.type==="paragraph"){l=c;break}}l===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function H2(e,t,n,i){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(i);a&&c.move(l);let f=s1.listItem(e,t,n,{...i,...c.current()});return a&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(m){return m+l}}function l1(){return[xN(),VN(),WN(),_2(),$2()]}function K2(e){return{extensions:[wN(),BN(e),HN(),B2(e),U2()]}}function Sn(e,t,n,i){const s=e.length;let a=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)l=Array.from(i),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<i.length;)l=i.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Nn(e,t){return e.length>0?(Sn(e,e.length,0,t),e):t}const Mv={}.hasOwnProperty;function u1(e){const t={};let n=-1;for(;++n<e.length;)q2(t,e[n]);return t}function q2(e,t){let n;for(n in t){const s=(Mv.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){Mv.call(s,l)||(s[l]=[]);const c=a[l];X2(s[l],Array.isArray(c)?c:c?[c]:[])}}}function X2(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Sn(e,0,0,i)}function Ro(e){const t=[];let n=-1,i=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&Kt(e.charCodeAt(n+1))&&Kt(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(l=String.fromCharCode(a,c),s=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(i,n),encodeURIComponent(l)),i=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function Ke(e,t,n,i){const s=i?i-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(f){return Ue(f)?(e.enter(n),c(f)):t(f)}function c(f){return Ue(f)&&a++<s?(e.consume(f),c):(e.exit(n),t(f))}}const Y2={tokenize:G2};function G2(e){const t=e.attempt(this.parser.constructs.contentInitial,i,s);let n;return t;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ke(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),a(c)}function a(c){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return De(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),l)}}const Q2={tokenize:J2},Iv={tokenize:Z2};function J2(e){const t=this,n=[];let i=0,s,a,l;return c;function c(T){if(i<n.length){const P=n[i];return t.containerState=P[1],e.attempt(P[0].continuation,f,h)(T)}return h(T)}function f(T){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&A();const P=t.events.length;let O=P,D;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){D=t.events[O][1].end;break}R(i);let H=P;for(;H<t.events.length;)t.events[H][1].end={...D},H++;return Sn(t.events,O+1,0,t.events.slice(P)),t.events.length=H,h(T)}return c(T)}function h(T){if(i===n.length){if(!s)return v(T);if(s.currentConstruct&&s.currentConstruct.concrete)return S(T);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Iv,m,p)(T)}function m(T){return s&&A(),R(i),v(T)}function p(T){return t.parser.lazy[t.now().line]=i!==n.length,l=t.now().offset,S(T)}function v(T){return t.containerState={},e.attempt(Iv,w,S)(T)}function w(T){return i++,n.push([t.currentConstruct,t.containerState]),v(T)}function S(T){if(T===null){s&&A(),R(0),e.consume(T);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),C(T)}function C(T){if(T===null){E(e.exit("chunkFlow"),!0),R(0),e.consume(T);return}return De(T)?(e.consume(T),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,c):(e.consume(T),C)}function E(T,P){const O=t.sliceStream(T);if(P&&O.push(null),T.previous=a,a&&(a.next=T),a=T,s.defineSkip(T.start),s.write(O),t.parser.lazy[T.start.line]){let D=s.events.length;for(;D--;)if(s.events[D][1].start.offset<l&&(!s.events[D][1].end||s.events[D][1].end.offset>l))return;const H=t.events.length;let B=H,_,N;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(_){N=t.events[B][1].end;break}_=!0}for(R(i),D=H;D<t.events.length;)t.events[D][1].end={...N},D++;Sn(t.events,B+1,0,t.events.slice(H)),t.events.length=D}}function R(T){let P=n.length;for(;P-- >T;){const O=n[P];t.containerState=O[1],O[0].exit.call(t,e)}n.length=T}function A(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Z2(e,t,n){return Ke(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function du(e,t,n){const i=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!i.includes(a)&&(t=a(t,n),i.push(a))}return t}const Ed={name:"attention",resolveAll:eM,tokenize:tM};function eM(e,t){let n=-1,i,s,a,l,c,f,h,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[i][1].end},v={...e[n][1].start};Dv(p,-f),Dv(v,f),l={type:f>1?"strongSequence":"emphasisSequence",start:p,end:{...e[i][1].end}},c={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},a={type:f>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[i][1].end={...l.start},e[n][1].start={...c.end},h=[],e[i][1].end.offset-e[i][1].start.offset&&(h=Nn(h,[["enter",e[i][1],t],["exit",e[i][1],t]])),h=Nn(h,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",a,t]]),h=Nn(h,du(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),h=Nn(h,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,h=Nn(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Sn(e,i-1,n-i+3,h),n=i+h.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function tM(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,s=bo(i);let a;return l;function l(f){return a=f,e.enter("attentionSequence"),c(f)}function c(f){if(f===a)return e.consume(f),c;const h=e.exit("attentionSequence"),m=bo(f),p=!m||m===2&&s||n.includes(f),v=!s||s===2&&m||n.includes(i);return h._open=!!(a===42?p:p&&(s||!v)),h._close=!!(a===42?v:v&&(m||!p)),t(f)}}function Dv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const nM={name:"autolink",tokenize:rM};function rM(e,t,n){let i=0;return s;function s(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(w){return tn(w)?(e.consume(w),l):w===64?n(w):h(w)}function l(w){return w===43||w===45||w===46||Kt(w)?(i=1,c(w)):h(w)}function c(w){return w===58?(e.consume(w),i=0,f):(w===43||w===45||w===46||Kt(w))&&i++<32?(e.consume(w),c):(i=0,h(w))}function f(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Xl(w)?n(w):(e.consume(w),f)}function h(w){return w===64?(e.consume(w),m):rN(w)?(e.consume(w),h):n(w)}function m(w){return Kt(w)?p(w):n(w)}function p(w){return w===46?(e.consume(w),i=0,m):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):v(w)}function v(w){if((w===45||Kt(w))&&i++<63){const S=w===45?v:p;return e.consume(w),S}return n(w)}}const Xs={partial:!0,tokenize:iM};function iM(e,t,n){return i;function i(a){return Ue(a)?Ke(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||De(a)?t(a):n(a)}}const c1={continuation:{tokenize:sM},exit:aM,name:"blockQuote",tokenize:oM};function oM(e,t,n){const i=this;return s;function s(l){if(l===62){const c=i.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Ue(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function sM(e,t,n){const i=this;return s;function s(l){return Ue(l)?Ke(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(c1,t,n)(l)}}function aM(e){e.exit("blockQuote")}const f1={name:"characterEscape",tokenize:lM};function lM(e,t,n){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return oN(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const d1={name:"characterReference",tokenize:uM};function uM(e,t,n){const i=this;let s=0,a,l;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),f}function f(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),a=31,l=Kt,m(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=iN,m):(e.enter("characterReferenceValue"),a=7,l=bd,m(p))}function m(p){if(p===59&&s){const v=e.exit("characterReferenceValue");return l===Kt&&!Oh(i.sliceSerialize(v))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&s++<a?(e.consume(p),m):n(p)}}const _v={partial:!0,tokenize:fM},Lv={concrete:!0,name:"codeFenced",tokenize:cM};function cM(e,t,n){const i=this,s={partial:!0,tokenize:O};let a=0,l=0,c;return f;function f(D){return h(D)}function h(D){const H=i.events[i.events.length-1];return a=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,c=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(D)}function m(D){return D===c?(l++,e.consume(D),m):l<3?n(D):(e.exit("codeFencedFenceSequence"),Ue(D)?Ke(e,p,"whitespace")(D):p(D))}function p(D){return D===null||De(D)?(e.exit("codeFencedFence"),i.interrupt?t(D):e.check(_v,C,P)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(D))}function v(D){return D===null||De(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(D)):Ue(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,w,"whitespace")(D)):D===96&&D===c?n(D):(e.consume(D),v)}function w(D){return D===null||De(D)?p(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(D))}function S(D){return D===null||De(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(D)):D===96&&D===c?n(D):(e.consume(D),S)}function C(D){return e.attempt(s,P,E)(D)}function E(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),R}function R(D){return a>0&&Ue(D)?Ke(e,A,"linePrefix",a+1)(D):A(D)}function A(D){return D===null||De(D)?e.check(_v,C,P)(D):(e.enter("codeFlowValue"),T(D))}function T(D){return D===null||De(D)?(e.exit("codeFlowValue"),A(D)):(e.consume(D),T)}function P(D){return e.exit("codeFenced"),t(D)}function O(D,H,B){let _=0;return N;function N(ee){return D.enter("lineEnding"),D.consume(ee),D.exit("lineEnding"),q}function q(ee){return D.enter("codeFencedFence"),Ue(ee)?Ke(D,V,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ee):V(ee)}function V(ee){return ee===c?(D.enter("codeFencedFenceSequence"),ae(ee)):B(ee)}function ae(ee){return ee===c?(_++,D.consume(ee),ae):_>=l?(D.exit("codeFencedFenceSequence"),Ue(ee)?Ke(D,J,"whitespace")(ee):J(ee)):B(ee)}function J(ee){return ee===null||De(ee)?(D.exit("codeFencedFence"),H(ee)):B(ee)}}}function fM(e,t,n){const i=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}const bf={name:"codeIndented",tokenize:hM},dM={partial:!0,tokenize:pM};function hM(e,t,n){const i=this;return s;function s(h){return e.enter("codeIndented"),Ke(e,a,"linePrefix",5)(h)}function a(h){const m=i.events[i.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(h):n(h)}function l(h){return h===null?f(h):De(h)?e.attempt(dM,l,f)(h):(e.enter("codeFlowValue"),c(h))}function c(h){return h===null||De(h)?(e.exit("codeFlowValue"),l(h)):(e.consume(h),c)}function f(h){return e.exit("codeIndented"),t(h)}}function pM(e,t,n){const i=this;return s;function s(l){return i.parser.lazy[i.now().line]?n(l):De(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):Ke(e,a,"linePrefix",5)(l)}function a(l){const c=i.events[i.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):De(l)?s(l):n(l)}}const mM={name:"codeText",previous:yM,resolve:gM,tokenize:vM};function gM(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)s===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(s=i):(i===t||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),t-=i-s-2,i=s+2),s=void 0);return e}function yM(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vM(e,t,n){let i=0,s,a;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),i++,c):(e.exit("codeTextSequence"),f(p))}function f(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),f):p===96?(a=e.enter("codeTextSequence"),s=0,m(p)):De(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||De(p)?(e.exit("codeTextData"),f(p)):(e.consume(p),h)}function m(p){return p===96?(e.consume(p),s++,m):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(a.type="codeTextData",h(p))}}class xM{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&gs(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),gs(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),gs(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);gs(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);gs(this.left,n.reverse())}}}function gs(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function h1(e){const t={};let n=-1,i,s,a,l,c,f,h;const m=new xM(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(i=m.get(n),n&&i[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,a=0,a<f.length&&f[a][1].type==="lineEndingBlank"&&(a+=2),a<f.length&&f[a][1].type==="content"))for(;++a<f.length&&f[a][1].type!=="content";)f[a][1].type==="chunkText"&&(f[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,wM(m,n)),n=t[n],h=!0);else if(i[1]._container){for(a=n,s=void 0;a--;)if(l=m.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(m.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(i[1].end={...m.get(s)[1].start},c=m.slice(s,n),c.unshift(i),m.splice(s,n-s+1,c))}}return Sn(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!h}function wM(e,t){const n=e.get(t)[1],i=e.get(t)[2];let s=t-1;const a=[];let l=n._tokenizer;l||(l=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,f=[],h={};let m,p,v=-1,w=n,S=0,C=0;const E=[C];for(;w;){for(;e.get(++s)[1]!==w;);a.push(s),w._tokenizer||(m=i.sliceStream(w),w.next||m.push(null),p&&l.defineSkip(w.start),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=n;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(C=v+1,E.push(C),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(l.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),v=E.length;v--;){const R=c.slice(E[v],E[v+1]),A=a.pop();f.push([A,A+R.length-1]),e.splice(A,2,R)}for(f.reverse(),v=-1;++v<f.length;)h[S+f[v][0]]=S+f[v][1],S+=f[v][1]-f[v][0]-1;return h}const kM={resolve:bM,tokenize:CM},SM={partial:!0,tokenize:EM};function bM(e){return h1(e),e}function CM(e,t){let n;return i;function i(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?a(c):De(c)?e.check(SM,l,a)(c):(e.consume(c),s)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function EM(e,t,n){const i=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ke(e,a,"linePrefix")}function a(l){if(l===null||De(l))return n(l);const c=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(i.parser.constructs.flow,n,t)(l)}}function p1(e,t,n,i,s,a,l,c,f){const h=f||Number.POSITIVE_INFINITY;let m=0;return p;function p(R){return R===60?(e.enter(i),e.enter(s),e.enter(a),e.consume(R),e.exit(a),v):R===null||R===32||R===41||Xl(R)?n(R):(e.enter(i),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),C(R))}function v(R){return R===62?(e.enter(a),e.consume(R),e.exit(a),e.exit(s),e.exit(i),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),w(R))}function w(R){return R===62?(e.exit("chunkString"),e.exit(c),v(R)):R===null||R===60||De(R)?n(R):(e.consume(R),R===92?S:w)}function S(R){return R===60||R===62||R===92?(e.consume(R),w):w(R)}function C(R){return!m&&(R===null||R===41||rt(R))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(i),t(R)):m<h&&R===40?(e.consume(R),m++,C):R===41?(e.consume(R),m--,C):R===null||R===32||R===40||Xl(R)?n(R):(e.consume(R),R===92?E:C)}function E(R){return R===40||R===41||R===92?(e.consume(R),C):C(R)}}function m1(e,t,n,i,s,a){const l=this;let c=0,f;return h;function h(w){return e.enter(i),e.enter(s),e.consume(w),e.exit(s),e.enter(a),m}function m(w){return c>999||w===null||w===91||w===93&&!f||w===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(w):w===93?(e.exit(a),e.enter(s),e.consume(w),e.exit(s),e.exit(i),t):De(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||De(w)||c++>999?(e.exit("chunkString"),m(w)):(e.consume(w),f||(f=!Ue(w)),w===92?v:p)}function v(w){return w===91||w===92||w===93?(e.consume(w),c++,p):p(w)}}function g1(e,t,n,i,s,a){let l;return c;function c(v){return v===34||v===39||v===40?(e.enter(i),e.enter(s),e.consume(v),e.exit(s),l=v===40?41:v,f):n(v)}function f(v){return v===l?(e.enter(s),e.consume(v),e.exit(s),e.exit(i),t):(e.enter(a),h(v))}function h(v){return v===l?(e.exit(a),f(l)):v===null?n(v):De(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Ke(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===l||v===null||De(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?p:m)}function p(v){return v===l||v===92?(e.consume(v),m):m(v)}}function Ps(e,t){let n;return i;function i(s){return De(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):Ue(s)?Ke(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const TM={name:"definition",tokenize:RM},PM={partial:!0,tokenize:AM};function RM(e,t,n){const i=this;let s;return a;function a(w){return e.enter("definition"),l(w)}function l(w){return m1.call(i,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function c(w){return s=Xn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),f):n(w)}function f(w){return rt(w)?Ps(e,h)(w):h(w)}function h(w){return p1(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function m(w){return e.attempt(PM,p,p)(w)}function p(w){return Ue(w)?Ke(e,v,"whitespace")(w):v(w)}function v(w){return w===null||De(w)?(e.exit("definition"),i.parser.defined.push(s),t(w)):n(w)}}function AM(e,t,n){return i;function i(c){return rt(c)?Ps(e,s)(c):n(c)}function s(c){return g1(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Ue(c)?Ke(e,l,"whitespace")(c):l(c)}function l(c){return c===null||De(c)?t(c):n(c)}}const jM={name:"hardBreakEscape",tokenize:NM};function NM(e,t,n){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return De(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const MM={name:"headingAtx",resolve:IM,tokenize:DM};function IM(e,t){let n=e.length-2,i=3,s,a;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},a={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},Sn(e,i,n-i+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function DM(e,t,n){let i=0;return s;function s(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&i++<6?(e.consume(m),l):m===null||rt(m)?(e.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),f(m)):m===null||De(m)?(e.exit("atxHeading"),t(m)):Ue(m)?Ke(e,c,"whitespace")(m):(e.enter("atxHeadingText"),h(m))}function f(m){return m===35?(e.consume(m),f):(e.exit("atxHeadingSequence"),c(m))}function h(m){return m===null||m===35||rt(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),h)}}const _M=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ov=["pre","script","style","textarea"],LM={concrete:!0,name:"htmlFlow",resolveTo:zM,tokenize:VM},OM={partial:!0,tokenize:$M},FM={partial:!0,tokenize:BM};function zM(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function VM(e,t,n){const i=this;let s,a,l,c,f;return h;function h(M){return m(M)}function m(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),p}function p(M){return M===33?(e.consume(M),v):M===47?(e.consume(M),a=!0,C):M===63?(e.consume(M),s=3,i.interrupt?t:j):tn(M)?(e.consume(M),l=String.fromCharCode(M),E):n(M)}function v(M){return M===45?(e.consume(M),s=2,w):M===91?(e.consume(M),s=5,c=0,S):tn(M)?(e.consume(M),s=4,i.interrupt?t:j):n(M)}function w(M){return M===45?(e.consume(M),i.interrupt?t:j):n(M)}function S(M){const Z="CDATA[";return M===Z.charCodeAt(c++)?(e.consume(M),c===Z.length?i.interrupt?t:V:S):n(M)}function C(M){return tn(M)?(e.consume(M),l=String.fromCharCode(M),E):n(M)}function E(M){if(M===null||M===47||M===62||rt(M)){const Z=M===47,ye=l.toLowerCase();return!Z&&!a&&Ov.includes(ye)?(s=1,i.interrupt?t(M):V(M)):_M.includes(l.toLowerCase())?(s=6,Z?(e.consume(M),R):i.interrupt?t(M):V(M)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(M):a?A(M):T(M))}return M===45||Kt(M)?(e.consume(M),l+=String.fromCharCode(M),E):n(M)}function R(M){return M===62?(e.consume(M),i.interrupt?t:V):n(M)}function A(M){return Ue(M)?(e.consume(M),A):N(M)}function T(M){return M===47?(e.consume(M),N):M===58||M===95||tn(M)?(e.consume(M),P):Ue(M)?(e.consume(M),T):N(M)}function P(M){return M===45||M===46||M===58||M===95||Kt(M)?(e.consume(M),P):O(M)}function O(M){return M===61?(e.consume(M),D):Ue(M)?(e.consume(M),O):T(M)}function D(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),f=M,H):Ue(M)?(e.consume(M),D):B(M)}function H(M){return M===f?(e.consume(M),f=null,_):M===null||De(M)?n(M):(e.consume(M),H)}function B(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||rt(M)?O(M):(e.consume(M),B)}function _(M){return M===47||M===62||Ue(M)?T(M):n(M)}function N(M){return M===62?(e.consume(M),q):n(M)}function q(M){return M===null||De(M)?V(M):Ue(M)?(e.consume(M),q):n(M)}function V(M){return M===45&&s===2?(e.consume(M),ge):M===60&&s===1?(e.consume(M),we):M===62&&s===4?(e.consume(M),F):M===63&&s===3?(e.consume(M),j):M===93&&s===5?(e.consume(M),le):De(M)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(OM,Q,ae)(M)):M===null||De(M)?(e.exit("htmlFlowData"),ae(M)):(e.consume(M),V)}function ae(M){return e.check(FM,J,Q)(M)}function J(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ee}function ee(M){return M===null||De(M)?ae(M):(e.enter("htmlFlowData"),V(M))}function ge(M){return M===45?(e.consume(M),j):V(M)}function we(M){return M===47?(e.consume(M),l="",G):V(M)}function G(M){if(M===62){const Z=l.toLowerCase();return Ov.includes(Z)?(e.consume(M),F):V(M)}return tn(M)&&l.length<8?(e.consume(M),l+=String.fromCharCode(M),G):V(M)}function le(M){return M===93?(e.consume(M),j):V(M)}function j(M){return M===62?(e.consume(M),F):M===45&&s===2?(e.consume(M),j):V(M)}function F(M){return M===null||De(M)?(e.exit("htmlFlowData"),Q(M)):(e.consume(M),F)}function Q(M){return e.exit("htmlFlow"),t(M)}}function BM(e,t,n){const i=this;return s;function s(l){return De(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}function $M(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Xs,t,n)}}const UM={name:"htmlText",tokenize:WM};function WM(e,t,n){const i=this;let s,a,l;return c;function c(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),f}function f(j){return j===33?(e.consume(j),h):j===47?(e.consume(j),O):j===63?(e.consume(j),T):tn(j)?(e.consume(j),B):n(j)}function h(j){return j===45?(e.consume(j),m):j===91?(e.consume(j),a=0,S):tn(j)?(e.consume(j),A):n(j)}function m(j){return j===45?(e.consume(j),w):n(j)}function p(j){return j===null?n(j):j===45?(e.consume(j),v):De(j)?(l=p,we(j)):(e.consume(j),p)}function v(j){return j===45?(e.consume(j),w):p(j)}function w(j){return j===62?ge(j):j===45?v(j):p(j)}function S(j){const F="CDATA[";return j===F.charCodeAt(a++)?(e.consume(j),a===F.length?C:S):n(j)}function C(j){return j===null?n(j):j===93?(e.consume(j),E):De(j)?(l=C,we(j)):(e.consume(j),C)}function E(j){return j===93?(e.consume(j),R):C(j)}function R(j){return j===62?ge(j):j===93?(e.consume(j),R):C(j)}function A(j){return j===null||j===62?ge(j):De(j)?(l=A,we(j)):(e.consume(j),A)}function T(j){return j===null?n(j):j===63?(e.consume(j),P):De(j)?(l=T,we(j)):(e.consume(j),T)}function P(j){return j===62?ge(j):T(j)}function O(j){return tn(j)?(e.consume(j),D):n(j)}function D(j){return j===45||Kt(j)?(e.consume(j),D):H(j)}function H(j){return De(j)?(l=H,we(j)):Ue(j)?(e.consume(j),H):ge(j)}function B(j){return j===45||Kt(j)?(e.consume(j),B):j===47||j===62||rt(j)?_(j):n(j)}function _(j){return j===47?(e.consume(j),ge):j===58||j===95||tn(j)?(e.consume(j),N):De(j)?(l=_,we(j)):Ue(j)?(e.consume(j),_):ge(j)}function N(j){return j===45||j===46||j===58||j===95||Kt(j)?(e.consume(j),N):q(j)}function q(j){return j===61?(e.consume(j),V):De(j)?(l=q,we(j)):Ue(j)?(e.consume(j),q):_(j)}function V(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),s=j,ae):De(j)?(l=V,we(j)):Ue(j)?(e.consume(j),V):(e.consume(j),J)}function ae(j){return j===s?(e.consume(j),s=void 0,ee):j===null?n(j):De(j)?(l=ae,we(j)):(e.consume(j),ae)}function J(j){return j===null||j===34||j===39||j===60||j===61||j===96?n(j):j===47||j===62||rt(j)?_(j):(e.consume(j),J)}function ee(j){return j===47||j===62||rt(j)?_(j):n(j)}function ge(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),t):n(j)}function we(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),G}function G(j){return Ue(j)?Ke(e,le,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):le(j)}function le(j){return e.enter("htmlTextData"),l(j)}}const Fh={name:"labelEnd",resolveAll:XM,resolveTo:YM,tokenize:GM},HM={tokenize:QM},KM={tokenize:JM},qM={tokenize:ZM};function XM(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",t+=s}}return e.length!==n.length&&Sn(e,0,e.length,n),e}function YM(e,t){let n=e.length,i=0,s,a,l,c;for(;n--;)if(s=e[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(l=n);const f={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},m={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",f,t],["enter",h,t]],c=Nn(c,e.slice(a+1,a+i+3)),c=Nn(c,[["enter",m,t]]),c=Nn(c,du(t.parser.constructs.insideSpan.null,e.slice(a+i+4,l-3),t)),c=Nn(c,[["exit",m,t],e[l-2],e[l-1],["exit",h,t]]),c=Nn(c,e.slice(l+1)),c=Nn(c,[["exit",f,t]]),Sn(e,a,e.length,c),e}function GM(e,t,n){const i=this;let s=i.events.length,a,l;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){a=i.events[s][1];break}return c;function c(v){return a?a._inactive?p(v):(l=i.parser.defined.includes(Xn(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),f):n(v)}function f(v){return v===40?e.attempt(HM,m,l?m:p)(v):v===91?e.attempt(KM,m,l?h:p)(v):l?m(v):p(v)}function h(v){return e.attempt(qM,m,p)(v)}function m(v){return t(v)}function p(v){return a._balanced=!0,n(v)}}function QM(e,t,n){return i;function i(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return rt(p)?Ps(e,a)(p):a(p)}function a(p){return p===41?m(p):p1(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return rt(p)?Ps(e,f)(p):m(p)}function c(p){return n(p)}function f(p){return p===34||p===39||p===40?g1(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):m(p)}function h(p){return rt(p)?Ps(e,m)(p):m(p)}function m(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function JM(e,t,n){const i=this;return s;function s(c){return m1.call(i,e,a,l,"reference","referenceMarker","referenceString")(c)}function a(c){return i.parser.defined.includes(Xn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function ZM(e,t,n){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const eI={name:"labelStartImage",resolveAll:Fh.resolveAll,tokenize:tI};function tI(e,t,n){const i=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(c):t(c)}}const nI={name:"labelStartLink",resolveAll:Fh.resolveAll,tokenize:rI};function rI(e,t,n){const i=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(l):t(l)}}const Cf={name:"lineEnding",tokenize:iI};function iI(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ke(e,t,"linePrefix")}}const jl={name:"thematicBreak",tokenize:oI};function oI(e,t,n){let i=0,s;return a;function a(h){return e.enter("thematicBreak"),l(h)}function l(h){return s=h,c(h)}function c(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):i>=3&&(h===null||De(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),i++,f):(e.exit("thematicBreakSequence"),Ue(h)?Ke(e,c,"whitespace")(h):c(h))}}const hn={continuation:{tokenize:uI},exit:fI,name:"list",tokenize:lI},sI={partial:!0,tokenize:dI},aI={partial:!0,tokenize:cI};function lI(e,t,n){const i=this,s=i.events[i.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(w){const S=i.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||w===i.containerState.marker:bd(w)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(jl,n,h)(w):h(w);if(!i.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(w)}return n(w)}function f(w){return bd(w)&&++l<10?(e.consume(w),f):(!i.interrupt||l<2)&&(i.containerState.marker?w===i.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):n(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||w,e.check(Xs,i.interrupt?n:m,e.attempt(sI,v,p))}function m(w){return i.containerState.initialBlankLine=!0,a++,v(w)}function p(w){return Ue(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),v):n(w)}function v(w){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function uI(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Xs,s,a);function s(c){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Ke(e,t,"listItemIndent",i.containerState.size+1)(c)}function a(c){return i.containerState.furtherBlankLines||!Ue(c)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,l(c)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(aI,t,l)(c))}function l(c){return i.containerState._closeFlow=!0,i.interrupt=void 0,Ke(e,e.attempt(hn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function cI(e,t,n){const i=this;return Ke(e,s,"listItemIndent",i.containerState.size+1);function s(a){const l=i.events[i.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===i.containerState.size?t(a):n(a)}}function fI(e){e.exit(this.containerState.type)}function dI(e,t,n){const i=this;return Ke(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const l=i.events[i.events.length-1];return!Ue(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Fv={name:"setextUnderline",resolveTo:hI,tokenize:pI};function hI(e,t){let n=e.length,i,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",l,t]),e.splice(a+1,0,["exit",e[i][1],t]),e[i][1].end={...e[a][1].end}):e[i][1]=l,e.push(["exit",l,t]),e}function pI(e,t,n){const i=this;let s;return a;function a(h){let m=i.events.length,p;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){p=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||p)?(e.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return e.enter("setextHeadingLineSequence"),c(h)}function c(h){return h===s?(e.consume(h),c):(e.exit("setextHeadingLineSequence"),Ue(h)?Ke(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||De(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const mI={tokenize:gI};function gI(e){const t=this,n=e.attempt(Xs,i,e.attempt(this.parser.constructs.flowInitial,s,Ke(e,e.attempt(this.parser.constructs.flow,s,e.attempt(kM,s)),"linePrefix")));return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yI={resolveAll:v1()},vI=y1("string"),xI=y1("text");function y1(e){return{resolveAll:v1(e==="text"?wI:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],a=n.attempt(s,l,c);return l;function l(m){return h(m)?a(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),f}function f(m){return h(m)?(n.exit("data"),a(m)):(n.consume(m),f)}function h(m){if(m===null)return!0;const p=s[m];let v=-1;if(p)for(;++v<p.length;){const w=p[v];if(!w.previous||w.previous.call(i,i.previous))return!0}return!1}}}function v1(e){return t;function t(n,i){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,i):n}}function wI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],s=t.sliceStream(i);let a=s.length,l=-1,c=0,f;for(;a--;){const h=s[a];if(typeof h=="string"){for(l=h.length;h.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(h===-2)f=!0,c++;else if(h!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const h={type:n===e.length||f||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:i.start._bufferIndex+l,_index:i.start._index+a,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const kI={42:hn,43:hn,45:hn,48:hn,49:hn,50:hn,51:hn,52:hn,53:hn,54:hn,55:hn,56:hn,57:hn,62:c1},SI={91:TM},bI={[-2]:bf,[-1]:bf,32:bf},CI={35:MM,42:jl,45:[Fv,jl],60:LM,61:Fv,95:jl,96:Lv,126:Lv},EI={38:d1,92:f1},TI={[-5]:Cf,[-4]:Cf,[-3]:Cf,33:eI,38:d1,42:Ed,60:[nM,UM],91:nI,92:[jM,f1],93:Fh,95:Ed,96:mM},PI={null:[Ed,yI]},RI={null:[42,95]},AI={null:[]},jI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:RI,contentInitial:SI,disable:AI,document:kI,flow:CI,flowInitial:bI,insideSpan:PI,string:EI,text:TI},Symbol.toStringTag,{value:"Module"}));function NI(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let l=[],c=[];const f={attempt:H(O),check:H(D),consume:A,enter:T,exit:P,interrupt:H(D,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:S,parser:e,previous:null,sliceSerialize:v,sliceStream:w,write:p};let m=t.tokenize.call(h,f);return t.resolveAll&&a.push(t),h;function p(q){return l=Nn(l,q),E(),l[l.length-1]!==null?[]:(B(t,0),h.events=du(a,h.events,h),h.events)}function v(q,V){return II(w(q),V)}function w(q){return MI(l,q)}function S(){const{_bufferIndex:q,_index:V,line:ae,column:J,offset:ee}=i;return{_bufferIndex:q,_index:V,line:ae,column:J,offset:ee}}function C(q){s[q.line]=q.column,N()}function E(){let q;for(;i._index<l.length;){const V=l[i._index];if(typeof V=="string")for(q=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===q&&i._bufferIndex<V.length;)R(V.charCodeAt(i._bufferIndex));else R(V)}}function R(q){m=m(q)}function A(q){De(q)?(i.line++,i.column=1,i.offset+=q===-3?2:1,N()):q!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===l[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=q}function T(q,V){const ae=V||{};return ae.type=q,ae.start=S(),h.events.push(["enter",ae,h]),c.push(ae),ae}function P(q){const V=c.pop();return V.end=S(),h.events.push(["exit",V,h]),V}function O(q,V){B(q,V.from)}function D(q,V){V.restore()}function H(q,V){return ae;function ae(J,ee,ge){let we,G,le,j;return Array.isArray(J)?Q(J):"tokenize"in J?Q([J]):F(J);function F(me){return pe;function pe(be){const xe=be!==null&&me[be],Be=be!==null&&me.null,Oe=[...Array.isArray(xe)?xe:xe?[xe]:[],...Array.isArray(Be)?Be:Be?[Be]:[]];return Q(Oe)(be)}}function Q(me){return we=me,G=0,me.length===0?ge:M(me[G])}function M(me){return pe;function pe(be){return j=_(),le=me,me.partial||(h.currentConstruct=me),me.name&&h.parser.constructs.disable.null.includes(me.name)?ye():me.tokenize.call(V?Object.assign(Object.create(h),V):h,f,Z,ye)(be)}}function Z(me){return q(le,j),ee}function ye(me){return j.restore(),++G<we.length?M(we[G]):ge}}}function B(q,V){q.resolveAll&&!a.includes(q)&&a.push(q),q.resolve&&Sn(h.events,V,h.events.length-V,q.resolve(h.events.slice(V),h)),q.resolveTo&&(h.events=q.resolveTo(h.events,h))}function _(){const q=S(),V=h.previous,ae=h.currentConstruct,J=h.events.length,ee=Array.from(c);return{from:J,restore:ge};function ge(){i=q,h.previous=V,h.currentConstruct=ae,h.events.length=J,c=ee,N()}}function N(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function MI(e,t){const n=t.start._index,i=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(i,a)];else{if(l=e.slice(n,s),i>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(i):l.shift()}a>0&&l.push(e[s].slice(0,a))}return l}function II(e,t){let n=-1;const i=[];let s;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
264
264
  `;break}case-3:{l=`\r
265
- `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(a)}s=a===-2,i.push(l)}return i.join("")}function DI(e){const i={constructs:u1([jI,...(e||{}).extensions||[]]),content:s(Y2),defined:[],document:s(Q2),flow:s(mI),lazy:{},string:s(vI),text:s(xI)};return i;function s(a){return l;function l(c){return NI(i,a,c)}}}function _I(e){for(;!h1(e););return e}const zv=/[\0\t\n\r]/g;function LI(){let e=1,t="",n=!0,i;return s;function s(a,l,c){const f=[];let h,m,p,v,w;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),p=0,t="",n&&(a.charCodeAt(0)===65279&&p++,n=void 0);p<a.length;){if(zv.lastIndex=p,h=zv.exec(a),v=h&&h.index!==void 0?h.index:a.length,w=a.charCodeAt(v),!h){t=a.slice(p);break}if(w===10&&p===v&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),p<v&&(f.push(a.slice(p,v)),e+=v-p),w){case 0:{f.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,f.push(-2);e++<m;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}p=v+1}return c&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}function Rs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vv(e.position):"start"in e||"end"in e?Vv(e):"line"in e||"column"in e?Td(e):""}function Td(e){return Bv(e&&e.line)+":"+Bv(e&&e.column)}function Vv(e){return Td(e&&e.start)+"-"+Td(e&&e.end)}function Bv(e){return e&&typeof e=="number"?e:1}const x1={}.hasOwnProperty;function w1(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),OI(n)(_I(DI(n).document().write(LI()(e,t,!0))))}function OI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(bn),autolinkProtocol:_,autolinkEmail:_,atxHeading:a(Mt),blockQuote:a(Be),characterEscape:_,characterReference:_,codeFenced:a(Oe),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Oe,l),codeText:a(Ge,l),codeTextData:_,data:_,codeFlowValue:_,definition:a(ut),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(it),hardBreakEscape:a(Xt),hardBreakTrailing:a(Xt),htmlFlow:a(Je,l),htmlFlowData:_,htmlText:a(Je,l),htmlTextData:_,image:a(zt),label:l,link:a(bn),listItem:a(Yt),listItemValue:v,listOrdered:a(It,p),listUnordered:a(It),paragraph:a(Tt),reference:M,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Mt),strong:a(We),thematicBreak:a(ur)},exit:{atxHeading:f(),atxHeadingSequence:O,autolink:f(),autolinkEmail:xe,autolinkProtocol:be,blockQuote:f(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:me,characterReference:he,codeFenced:f(E),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:N,codeIndented:f(R),codeText:f(ee),codeTextData:N,data:N,definition:f(),definitionDestinationString:P,definitionLabelString:A,definitionTitleString:T,emphasis:f(),hardBreakEscape:f(V),hardBreakTrailing:f(V),htmlFlow:f(ae),htmlFlowData:N,htmlText:f(J),htmlTextData:N,image:f(we),label:le,labelText:G,lineEnding:q,link:f(ge),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:Z,resourceDestinationString:j,resourceTitleString:F,resource:Q,setextHeading:f(B),setextHeadingLineSequence:H,setextHeadingText:D,strong:f(),thematicBreak:f()}};k1(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(X){let ie={type:"root",children:[]};const je={stack:[ie],tokenStack:[],config:t,enter:c,exit:h,buffer:l,resume:m,data:n},Ne=[];let Fe=-1;for(;++Fe<X.length;)if(X[Fe][1].type==="listOrdered"||X[Fe][1].type==="listUnordered")if(X[Fe][0]==="enter")Ne.push(Fe);else{const ot=Ne.pop();Fe=s(X,ot,Fe)}for(Fe=-1;++Fe<X.length;){const ot=t[X[Fe][0]];x1.call(ot,X[Fe][1].type)&&ot[X[Fe][1].type].call(Object.assign({sliceSerialize:X[Fe][2].sliceSerialize},je),X[Fe][1])}if(je.tokenStack.length>0){const ot=je.tokenStack[je.tokenStack.length-1];(ot[1]||$v).call(je,void 0,ot[0])}for(ie.position={start:qr(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:qr(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ie=t.transforms[Fe](ie)||ie;return ie}function s(X,ie,je){let Ne=ie-1,Fe=-1,ot=!1,U,ue,fe,Ae;for(;++Ne<=je;){const Pe=X[Ne];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?Fe++:Fe--,Ae=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(U&&!Ae&&!Fe&&!fe&&(fe=Ne),Ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ae=void 0}if(!Fe&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Fe===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(U){let de=Ne;for(ue=void 0;de--;){const ze=X[de];if(ze[1].type==="lineEnding"||ze[1].type==="lineEndingBlank"){if(ze[0]==="exit")continue;ue&&(X[ue][1].type="lineEndingBlank",ot=!0),ze[1].type="lineEnding",ue=de}else if(!(ze[1].type==="linePrefix"||ze[1].type==="blockQuotePrefix"||ze[1].type==="blockQuotePrefixWhitespace"||ze[1].type==="blockQuoteMarker"||ze[1].type==="listItemIndent"))break}fe&&(!ue||fe<ue)&&(U._spread=!0),U.end=Object.assign({},ue?X[ue][1].start:Pe[1].end),X.splice(ue||Ne,0,["exit",U,Pe[2]]),Ne++,je++}if(Pe[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};U=de,X.splice(Ne,0,["enter",de,Pe[2]]),Ne++,je++,fe=void 0,Ae=!0}}}return X[ie][1]._spread=ot,je}function a(X,ie){return je;function je(Ne){c.call(this,X(Ne),Ne),ie&&ie.call(this,Ne)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(X,ie,je){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([ie,je||void 0]),X.position={start:qr(ie.start),end:void 0}}function f(X){return ie;function ie(je){X&&X.call(this,je),h.call(this,je)}}function h(X,ie){const je=this.stack.pop(),Ne=this.tokenStack.pop();if(Ne)Ne[0].type!==X.type&&(ie?ie.call(this,X,Ne[0]):(Ne[1]||$v).call(this,X,Ne[0]));else throw new Error("Cannot close `"+X.type+"` ("+Rs({start:X.start,end:X.end})+"): it’s not open");je.position.end=qr(X.end)}function m(){return _h(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(X){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function w(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=X}function S(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=X}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X.replace(/(\r?\n|\r)$/g,"")}function A(X){const ie=this.resume(),je=this.stack[this.stack.length-1];je.label=ie,je.identifier=Xn(this.sliceSerialize(X)).toLowerCase()}function T(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.title=X}function P(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.url=X}function O(X){const ie=this.stack[this.stack.length-1];if(!ie.depth){const je=this.sliceSerialize(X).length;ie.depth=je}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function H(X){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function _(X){const je=this.stack[this.stack.length-1].children;let Ne=je[je.length-1];(!Ne||Ne.type!=="text")&&(Ne=Cr(),Ne.position={start:qr(X.start),end:void 0},je.push(Ne)),this.stack.push(Ne)}function N(X){const ie=this.stack.pop();ie.value+=this.sliceSerialize(X),ie.position.end=qr(X.end)}function q(X){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const je=ie.children[ie.children.length-1];je.position.end=qr(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(_.call(this,X),N.call(this,X))}function V(){this.data.atHardBreak=!0}function ae(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X}function J(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X}function ee(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X}function ge(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ie,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function we(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ie,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function G(X){const ie=this.sliceSerialize(X),je=this.stack[this.stack.length-2];je.label=I2(ie),je.identifier=Xn(ie).toLowerCase()}function le(){const X=this.stack[this.stack.length-1],ie=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const Ne=X.children;je.children=Ne}else je.alt=ie}function j(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.url=X}function F(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.title=X}function Q(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function Z(X){const ie=this.resume(),je=this.stack[this.stack.length-1];je.label=ie,je.identifier=Xn(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ye(X){this.data.characterReferenceType=X.type}function me(X){const ie=this.sliceSerialize(X),je=this.data.characterReferenceType;let Ne;je?(Ne=a1(ie,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=Oh(ie);const Fe=this.stack[this.stack.length-1];Fe.value+=Ne}function he(X){const ie=this.stack.pop();ie.position.end=qr(X.end)}function be(X){N.call(this,X);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(X)}function xe(X){N.call(this,X);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(X)}function Be(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function ut(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function Mt(){return{type:"heading",depth:0,children:[]}}function Xt(){return{type:"break"}}function Je(){return{type:"html",value:""}}function zt(){return{type:"image",title:null,url:"",alt:null}}function bn(){return{type:"link",title:null,url:"",children:[]}}function It(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function Yt(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Tt(){return{type:"paragraph",children:[]}}function We(){return{type:"strong",children:[]}}function Cr(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function qr(e){return{line:e.line,column:e.column,offset:e.offset}}function k1(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?k1(e,i):FI(e,i)}}function FI(e,t){let n;for(n in t)if(x1.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function $v(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rs({start:t.start,end:t.end})+") is still open")}const zI={tokenize:HI,partial:!0},S1={tokenize:KI,partial:!0},b1={tokenize:qI,partial:!0},C1={tokenize:XI,partial:!0},VI={tokenize:YI,partial:!0},E1={name:"wwwAutolink",tokenize:UI,previous:P1},T1={name:"protocolAutolink",tokenize:WI,previous:R1},br={name:"emailAutolink",tokenize:$I,previous:A1},ar={};function BI(){return{text:ar}}let ki=48;for(;ki<123;)ar[ki]=br,ki++,ki===58?ki=65:ki===91&&(ki=97);ar[43]=br;ar[45]=br;ar[46]=br;ar[95]=br;ar[72]=[br,T1];ar[104]=[br,T1];ar[87]=[br,E1];ar[119]=[br,E1];function $I(e,t,n){const i=this;let s,a;return l;function l(p){return!Pd(p)||!A1.call(i,i.previous)||zh(i.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return Pd(p)?(e.consume(p),c):p===64?(e.consume(p),f):n(p)}function f(p){return p===46?e.check(VI,m,h)(p):p===45||p===95||Kt(p)?(a=!0,e.consume(p),f):m(p)}function h(p){return e.consume(p),s=!0,f}function m(p){return a&&s&&tn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function UI(e,t,n){const i=this;return s;function s(l){return l!==87&&l!==119||!P1.call(i,i.previous)||zh(i.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(zI,e.attempt(S1,e.attempt(b1,a),n),n)(l))}function a(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function WI(e,t,n){const i=this;let s="",a=!1;return l;function l(p){return(p===72||p===104)&&R1.call(i,i.previous)&&!zh(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(tn(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const v=s.toLowerCase();if(v==="http"||v==="https")return e.consume(p),f}return n(p)}function f(p){return p===47?(e.consume(p),a?h:(a=!0,f)):n(p)}function h(p){return p===null||Xl(p)||rt(p)||Mi(p)||uu(p)?n(p):e.attempt(S1,e.attempt(b1,m),n)(p)}function m(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function HI(e,t,n){let i=0;return s;function s(l){return(l===87||l===119)&&i<3?(i++,e.consume(l),s):l===46&&i===3?(e.consume(l),a):n(l)}function a(l){return l===null?n(l):t(l)}}function KI(e,t,n){let i,s,a;return l;function l(h){return h===46||h===95?e.check(C1,f,c)(h):h===null||rt(h)||Mi(h)||h!==45&&uu(h)?f(h):(a=!0,e.consume(h),l)}function c(h){return h===95?i=!0:(s=i,i=void 0),e.consume(h),l}function f(h){return s||i||!a?n(h):t(h)}}function qI(e,t){let n=0,i=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&i<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(C1,t,a)(l):l===null||rt(l)||Mi(l)?t(l):(e.consume(l),s)}function a(l){return l===41&&i++,e.consume(l),s}}function XI(e,t,n){return i;function i(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),i):c===38?(e.consume(c),a):c===93?(e.consume(c),s):c===60||c===null||rt(c)||Mi(c)?t(c):n(c)}function s(c){return c===null||c===40||c===91||rt(c)||Mi(c)?t(c):i(c)}function a(c){return tn(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),i):tn(c)?(e.consume(c),l):n(c)}}function YI(e,t,n){return i;function i(a){return e.consume(a),s}function s(a){return Kt(a)?n(a):t(a)}}function P1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rt(e)}function R1(e){return!tn(e)}function A1(e){return!(e===47||Pd(e))}function Pd(e){return e===43||e===45||e===46||e===95||Kt(e)}function zh(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const GI={tokenize:iD,partial:!0};function QI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tD,continuation:{tokenize:nD},exit:rD}},text:{91:{name:"gfmFootnoteCall",tokenize:eD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JI,resolveTo:ZI}}}}function JI(e,t,n){const i=this;let s=i.events.length;const a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let l;for(;s--;){const f=i.events[s][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return c;function c(f){if(!l||!l._balanced)return n(f);const h=Xn(i.sliceSerialize({start:l.end,end:i.now()}));return h.codePointAt(0)!==94||!a.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function ZI(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},c=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...c),e}function eD(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a=0,l;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),f}function f(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(a>999||p===93&&!l||p===null||p===91||rt(p))return n(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return s.includes(Xn(i.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return rt(p)||(l=!0),a++,e.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function tD(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a,l=0,c;return f;function f(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(S)}function m(S){if(l>999||S===93&&!c||S===null||S===91||rt(S))return n(S);if(S===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return a=Xn(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return rt(S)||(c=!0),l++,e.consume(S),S===92?p:m}function p(S){return S===91||S===92||S===93?(e.consume(S),l++,m):m(S)}function v(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),s.includes(a)||s.push(a),Ke(e,w,"gfmFootnoteDefinitionWhitespace")):n(S)}function w(S){return t(S)}}function nD(e,t,n){return e.check(Xs,t,e.attempt(GI,t,n))}function rD(e){e.exit("gfmFootnoteDefinition")}function iD(e,t,n){const i=this;return Ke(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const l=i.events[i.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):n(a)}}function oD(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:a,resolveAll:s};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(l,c){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let h=f;for(;h--;)if(l[h][0]==="exit"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[h][1].end.offset-l[h][1].start.offset){l[f][1].type="strikethroughSequence",l[h][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},l[h][1].start),end:Object.assign({},l[f][1].end)},p={type:"strikethroughText",start:Object.assign({},l[h][1].end),end:Object.assign({},l[f][1].start)},v=[["enter",m,c],["enter",l[h][1],c],["exit",l[h][1],c],["enter",p,c]],w=c.parser.constructs.insideSpan.null;w&&Sn(v,v.length,0,du(w,l.slice(h+1,f),c)),Sn(v,v.length,0,[["exit",p,c],["enter",l[f][1],c],["exit",l[f][1],c],["exit",m,c]]),Sn(l,h-1,f-h+3,v),f=h+v.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function a(l,c,f){const h=this.previous,m=this.events;let p=0;return v;function v(S){return h===126&&m[m.length-1][1].type!=="characterEscape"?f(S):(l.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const C=bo(h);if(S===126)return p>1?f(S):(l.consume(S),p++,w);if(p<2&&!n)return f(S);const E=l.exit("strikethroughSequenceTemporary"),R=bo(S);return E._open=!R||R===2&&!!C,E._close=!C||C===2&&!!R,c(S)}}}class sD{constructor(){this.map=[]}add(t,n,i){aD(this,t,n,i)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let s=i.pop();for(;s;){for(const a of s)t.push(a);s=i.pop()}this.map.length=0}}function aD(e,t,n,i){let s=0;if(!(n===0&&i.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...i);return}s+=1}e.map.push([t,n,i])}}function lD(e,t){let n=!1;const i=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=i.length-1;i[a]=i[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function uD(){return{flow:{null:{name:"table",tokenize:cD,resolveAll:fD}}}}function cD(e,t,n){const i=this;let s=0,a=0,l;return c;function c(N){let q=i.events.length-1;for(;q>-1;){const J=i.events[q][1].type;if(J==="lineEnding"||J==="linePrefix")q--;else break}const V=q>-1?i.events[q][1].type:null,ae=V==="tableHead"||V==="tableRow"?D:f;return ae===D&&i.parser.lazy[i.now().line]?n(N):ae(N)}function f(N){return e.enter("tableHead"),e.enter("tableRow"),h(N)}function h(N){return N===124||(l=!0,a+=1),m(N)}function m(N){return N===null?n(N):De(N)?a>1?(a=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),w):n(N):Ue(N)?Ke(e,m,"whitespace")(N):(a+=1,l&&(l=!1,s+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),l=!0,m):(e.enter("data"),p(N)))}function p(N){return N===null||N===124||rt(N)?(e.exit("data"),m(N)):(e.consume(N),N===92?v:p)}function v(N){return N===92||N===124?(e.consume(N),p):p(N)}function w(N){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(N):(e.enter("tableDelimiterRow"),l=!1,Ue(N)?Ke(e,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):S(N))}function S(N){return N===45||N===58?E(N):N===124?(l=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),C):O(N)}function C(N){return Ue(N)?Ke(e,E,"whitespace")(N):E(N)}function E(N){return N===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),R):N===45?(a+=1,R(N)):N===null||De(N)?P(N):O(N)}function R(N){return N===45?(e.enter("tableDelimiterFiller"),A(N)):O(N)}function A(N){return N===45?(e.consume(N),A):N===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(N))}function T(N){return Ue(N)?Ke(e,P,"whitespace")(N):P(N)}function P(N){return N===124?S(N):N===null||De(N)?!l||s!==a?O(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):O(N)}function O(N){return n(N)}function D(N){return e.enter("tableRow"),H(N)}function H(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),H):N===null||De(N)?(e.exit("tableRow"),t(N)):Ue(N)?Ke(e,H,"whitespace")(N):(e.enter("data"),B(N))}function B(N){return N===null||N===124||rt(N)?(e.exit("data"),H(N)):(e.consume(N),N===92?_:B)}function _(N){return N===92||N===124?(e.consume(N),B):B(N)}}function fD(e,t){let n=-1,i=!0,s=0,a=[0,0,0,0],l=[0,0,0,0],c=!1,f=0,h,m,p;const v=new sD;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(c=!1,f!==0&&(Uv(v,t,f,h,m),m=void 0,f=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},v.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,p=void 0,a=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,m={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},v.add(n,0,[["enter",m,t]])),s=S.type==="tableDelimiterRow"?2:m?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],p=fl(v,t,a,s,void 0,p),a=[0,0,0,0]),l[2]=n)):S.type==="tableCellDivider"&&(i?i=!1:(a[1]!==0&&(l[0]=l[1],p=fl(v,t,a,s,void 0,p)),a=l,l=[a[1],n,0,0])):S.type==="tableHead"?(c=!0,f=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(f=n,a[1]!==0?(l[0]=l[1],p=fl(v,t,a,s,n,p)):l[1]!==0&&(p=fl(v,t,l,s,n,p)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&Uv(v,t,f,h,m),v.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=lD(t.events,n))}return e}function fl(e,t,n,i,s,a){const l=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(a.end=Object.assign({},fo(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const f=fo(t.events,n[1]);if(a={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const h=fo(t.events,n[2]),m=fo(t.events,n[3]),p={type:c,start:Object.assign({},h),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",p,t]]),i!==2){const v=t.events[n[2]],w=t.events[n[3]];if(v[1].end=Object.assign({},w[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,C=n[3]-n[2]-1;e.add(S,C,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(a.end=Object.assign({},fo(t.events,s)),e.add(s,0,[["exit",a,t]]),a=void 0),a}function Uv(e,t,n,i,s){const a=[],l=fo(t.events,n);s&&(s.end=Object.assign({},l),a.push(["exit",s,t])),i.end=Object.assign({},l),a.push(["exit",i,t]),e.add(n+1,0,a)}function fo(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const dD={name:"tasklistCheck",tokenize:pD};function hD(){return{text:{91:dD}}}function pD(e,t,n){const i=this;return s;function s(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),a)}function a(f){return rt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(f)}function c(f){return De(f)?t(f):Ue(f)?e.check({tokenize:mD},t,n)(f):n(f)}}function mD(e,t,n){return Ke(e,i,"whitespace");function i(s){return s===null?n(s):t(s)}}function j1(e){return u1([BI(),QI(),oD(e),uD(),hD()])}function N1(e){return typeof e=="string"&&/\.md$/i.test(e.trim())}function gD(e,t){const n=String(e??"").trim().split(/\r?\n/).map(s=>`> ${s}`).join(`
265
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(a)}s=a===-2,i.push(l)}return i.join("")}function DI(e){const i={constructs:u1([jI,...(e||{}).extensions||[]]),content:s(Y2),defined:[],document:s(Q2),flow:s(mI),lazy:{},string:s(vI),text:s(xI)};return i;function s(a){return l;function l(c){return NI(i,a,c)}}}function _I(e){for(;!h1(e););return e}const zv=/[\0\t\n\r]/g;function LI(){let e=1,t="",n=!0,i;return s;function s(a,l,c){const f=[];let h,m,p,v,w;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),p=0,t="",n&&(a.charCodeAt(0)===65279&&p++,n=void 0);p<a.length;){if(zv.lastIndex=p,h=zv.exec(a),v=h&&h.index!==void 0?h.index:a.length,w=a.charCodeAt(v),!h){t=a.slice(p);break}if(w===10&&p===v&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),p<v&&(f.push(a.slice(p,v)),e+=v-p),w){case 0:{f.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,f.push(-2);e++<m;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}p=v+1}return c&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}function Rs(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vv(e.position):"start"in e||"end"in e?Vv(e):"line"in e||"column"in e?Td(e):""}function Td(e){return Bv(e&&e.line)+":"+Bv(e&&e.column)}function Vv(e){return Td(e&&e.start)+"-"+Td(e&&e.end)}function Bv(e){return e&&typeof e=="number"?e:1}const x1={}.hasOwnProperty;function w1(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),OI(n)(_I(DI(n).document().write(LI()(e,t,!0))))}function OI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(bn),autolinkProtocol:_,autolinkEmail:_,atxHeading:a(Mt),blockQuote:a(Be),characterEscape:_,characterReference:_,codeFenced:a(Oe),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Oe,l),codeText:a(Ge,l),codeTextData:_,data:_,codeFlowValue:_,definition:a(ut),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(it),hardBreakEscape:a(Xt),hardBreakTrailing:a(Xt),htmlFlow:a(Je,l),htmlFlowData:_,htmlText:a(Je,l),htmlTextData:_,image:a(zt),label:l,link:a(bn),listItem:a(Yt),listItemValue:v,listOrdered:a(It,p),listUnordered:a(It),paragraph:a(Tt),reference:M,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Mt),strong:a(We),thematicBreak:a(ur)},exit:{atxHeading:f(),atxHeadingSequence:O,autolink:f(),autolinkEmail:xe,autolinkProtocol:be,blockQuote:f(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:me,characterReference:pe,codeFenced:f(E),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:N,codeIndented:f(R),codeText:f(ee),codeTextData:N,data:N,definition:f(),definitionDestinationString:P,definitionLabelString:A,definitionTitleString:T,emphasis:f(),hardBreakEscape:f(V),hardBreakTrailing:f(V),htmlFlow:f(ae),htmlFlowData:N,htmlText:f(J),htmlTextData:N,image:f(we),label:le,labelText:G,lineEnding:q,link:f(ge),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:Z,resourceDestinationString:j,resourceTitleString:F,resource:Q,setextHeading:f(B),setextHeadingLineSequence:H,setextHeadingText:D,strong:f(),thematicBreak:f()}};k1(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(X){let ie={type:"root",children:[]};const je={stack:[ie],tokenStack:[],config:t,enter:c,exit:h,buffer:l,resume:m,data:n},Ne=[];let Fe=-1;for(;++Fe<X.length;)if(X[Fe][1].type==="listOrdered"||X[Fe][1].type==="listUnordered")if(X[Fe][0]==="enter")Ne.push(Fe);else{const ot=Ne.pop();Fe=s(X,ot,Fe)}for(Fe=-1;++Fe<X.length;){const ot=t[X[Fe][0]];x1.call(ot,X[Fe][1].type)&&ot[X[Fe][1].type].call(Object.assign({sliceSerialize:X[Fe][2].sliceSerialize},je),X[Fe][1])}if(je.tokenStack.length>0){const ot=je.tokenStack[je.tokenStack.length-1];(ot[1]||$v).call(je,void 0,ot[0])}for(ie.position={start:qr(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:qr(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ie=t.transforms[Fe](ie)||ie;return ie}function s(X,ie,je){let Ne=ie-1,Fe=-1,ot=!1,U,ue,fe,Ae;for(;++Ne<=je;){const Pe=X[Ne];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?Fe++:Fe--,Ae=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(U&&!Ae&&!Fe&&!fe&&(fe=Ne),Ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ae=void 0}if(!Fe&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||Fe===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(U){let de=Ne;for(ue=void 0;de--;){const ze=X[de];if(ze[1].type==="lineEnding"||ze[1].type==="lineEndingBlank"){if(ze[0]==="exit")continue;ue&&(X[ue][1].type="lineEndingBlank",ot=!0),ze[1].type="lineEnding",ue=de}else if(!(ze[1].type==="linePrefix"||ze[1].type==="blockQuotePrefix"||ze[1].type==="blockQuotePrefixWhitespace"||ze[1].type==="blockQuoteMarker"||ze[1].type==="listItemIndent"))break}fe&&(!ue||fe<ue)&&(U._spread=!0),U.end=Object.assign({},ue?X[ue][1].start:Pe[1].end),X.splice(ue||Ne,0,["exit",U,Pe[2]]),Ne++,je++}if(Pe[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};U=de,X.splice(Ne,0,["enter",de,Pe[2]]),Ne++,je++,fe=void 0,Ae=!0}}}return X[ie][1]._spread=ot,je}function a(X,ie){return je;function je(Ne){c.call(this,X(Ne),Ne),ie&&ie.call(this,Ne)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(X,ie,je){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([ie,je||void 0]),X.position={start:qr(ie.start),end:void 0}}function f(X){return ie;function ie(je){X&&X.call(this,je),h.call(this,je)}}function h(X,ie){const je=this.stack.pop(),Ne=this.tokenStack.pop();if(Ne)Ne[0].type!==X.type&&(ie?ie.call(this,X,Ne[0]):(Ne[1]||$v).call(this,X,Ne[0]));else throw new Error("Cannot close `"+X.type+"` ("+Rs({start:X.start,end:X.end})+"): it’s not open");je.position.end=qr(X.end)}function m(){return _h(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(X){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function w(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=X}function S(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=X}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X.replace(/(\r?\n|\r)$/g,"")}function A(X){const ie=this.resume(),je=this.stack[this.stack.length-1];je.label=ie,je.identifier=Xn(this.sliceSerialize(X)).toLowerCase()}function T(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.title=X}function P(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.url=X}function O(X){const ie=this.stack[this.stack.length-1];if(!ie.depth){const je=this.sliceSerialize(X).length;ie.depth=je}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function H(X){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function _(X){const je=this.stack[this.stack.length-1].children;let Ne=je[je.length-1];(!Ne||Ne.type!=="text")&&(Ne=Cr(),Ne.position={start:qr(X.start),end:void 0},je.push(Ne)),this.stack.push(Ne)}function N(X){const ie=this.stack.pop();ie.value+=this.sliceSerialize(X),ie.position.end=qr(X.end)}function q(X){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const je=ie.children[ie.children.length-1];je.position.end=qr(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(_.call(this,X),N.call(this,X))}function V(){this.data.atHardBreak=!0}function ae(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X}function J(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X}function ee(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.value=X}function ge(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ie,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function we(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=ie,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function G(X){const ie=this.sliceSerialize(X),je=this.stack[this.stack.length-2];je.label=I2(ie),je.identifier=Xn(ie).toLowerCase()}function le(){const X=this.stack[this.stack.length-1],ie=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const Ne=X.children;je.children=Ne}else je.alt=ie}function j(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.url=X}function F(){const X=this.resume(),ie=this.stack[this.stack.length-1];ie.title=X}function Q(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function Z(X){const ie=this.resume(),je=this.stack[this.stack.length-1];je.label=ie,je.identifier=Xn(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ye(X){this.data.characterReferenceType=X.type}function me(X){const ie=this.sliceSerialize(X),je=this.data.characterReferenceType;let Ne;je?(Ne=a1(ie,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=Oh(ie);const Fe=this.stack[this.stack.length-1];Fe.value+=Ne}function pe(X){const ie=this.stack.pop();ie.position.end=qr(X.end)}function be(X){N.call(this,X);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(X)}function xe(X){N.call(this,X);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(X)}function Be(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function ut(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function Mt(){return{type:"heading",depth:0,children:[]}}function Xt(){return{type:"break"}}function Je(){return{type:"html",value:""}}function zt(){return{type:"image",title:null,url:"",alt:null}}function bn(){return{type:"link",title:null,url:"",children:[]}}function It(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function Yt(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Tt(){return{type:"paragraph",children:[]}}function We(){return{type:"strong",children:[]}}function Cr(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function qr(e){return{line:e.line,column:e.column,offset:e.offset}}function k1(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?k1(e,i):FI(e,i)}}function FI(e,t){let n;for(n in t)if(x1.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function $v(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Rs({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Rs({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Rs({start:t.start,end:t.end})+") is still open")}const zI={tokenize:HI,partial:!0},S1={tokenize:KI,partial:!0},b1={tokenize:qI,partial:!0},C1={tokenize:XI,partial:!0},VI={tokenize:YI,partial:!0},E1={name:"wwwAutolink",tokenize:UI,previous:P1},T1={name:"protocolAutolink",tokenize:WI,previous:R1},br={name:"emailAutolink",tokenize:$I,previous:A1},ar={};function BI(){return{text:ar}}let ki=48;for(;ki<123;)ar[ki]=br,ki++,ki===58?ki=65:ki===91&&(ki=97);ar[43]=br;ar[45]=br;ar[46]=br;ar[95]=br;ar[72]=[br,T1];ar[104]=[br,T1];ar[87]=[br,E1];ar[119]=[br,E1];function $I(e,t,n){const i=this;let s,a;return l;function l(p){return!Pd(p)||!A1.call(i,i.previous)||zh(i.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return Pd(p)?(e.consume(p),c):p===64?(e.consume(p),f):n(p)}function f(p){return p===46?e.check(VI,m,h)(p):p===45||p===95||Kt(p)?(a=!0,e.consume(p),f):m(p)}function h(p){return e.consume(p),s=!0,f}function m(p){return a&&s&&tn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function UI(e,t,n){const i=this;return s;function s(l){return l!==87&&l!==119||!P1.call(i,i.previous)||zh(i.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(zI,e.attempt(S1,e.attempt(b1,a),n),n)(l))}function a(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function WI(e,t,n){const i=this;let s="",a=!1;return l;function l(p){return(p===72||p===104)&&R1.call(i,i.previous)&&!zh(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(tn(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const v=s.toLowerCase();if(v==="http"||v==="https")return e.consume(p),f}return n(p)}function f(p){return p===47?(e.consume(p),a?h:(a=!0,f)):n(p)}function h(p){return p===null||Xl(p)||rt(p)||Mi(p)||uu(p)?n(p):e.attempt(S1,e.attempt(b1,m),n)(p)}function m(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function HI(e,t,n){let i=0;return s;function s(l){return(l===87||l===119)&&i<3?(i++,e.consume(l),s):l===46&&i===3?(e.consume(l),a):n(l)}function a(l){return l===null?n(l):t(l)}}function KI(e,t,n){let i,s,a;return l;function l(h){return h===46||h===95?e.check(C1,f,c)(h):h===null||rt(h)||Mi(h)||h!==45&&uu(h)?f(h):(a=!0,e.consume(h),l)}function c(h){return h===95?i=!0:(s=i,i=void 0),e.consume(h),l}function f(h){return s||i||!a?n(h):t(h)}}function qI(e,t){let n=0,i=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&i<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(C1,t,a)(l):l===null||rt(l)||Mi(l)?t(l):(e.consume(l),s)}function a(l){return l===41&&i++,e.consume(l),s}}function XI(e,t,n){return i;function i(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),i):c===38?(e.consume(c),a):c===93?(e.consume(c),s):c===60||c===null||rt(c)||Mi(c)?t(c):n(c)}function s(c){return c===null||c===40||c===91||rt(c)||Mi(c)?t(c):i(c)}function a(c){return tn(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),i):tn(c)?(e.consume(c),l):n(c)}}function YI(e,t,n){return i;function i(a){return e.consume(a),s}function s(a){return Kt(a)?n(a):t(a)}}function P1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||rt(e)}function R1(e){return!tn(e)}function A1(e){return!(e===47||Pd(e))}function Pd(e){return e===43||e===45||e===46||e===95||Kt(e)}function zh(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const GI={tokenize:iD,partial:!0};function QI(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tD,continuation:{tokenize:nD},exit:rD}},text:{91:{name:"gfmFootnoteCall",tokenize:eD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JI,resolveTo:ZI}}}}function JI(e,t,n){const i=this;let s=i.events.length;const a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let l;for(;s--;){const f=i.events[s][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return c;function c(f){if(!l||!l._balanced)return n(f);const h=Xn(i.sliceSerialize({start:l.end,end:i.now()}));return h.codePointAt(0)!==94||!a.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function ZI(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},c=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...c),e}function eD(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a=0,l;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),f}function f(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(a>999||p===93&&!l||p===null||p===91||rt(p))return n(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return s.includes(Xn(i.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return rt(p)||(l=!0),a++,e.consume(p),p===92?m:h}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function tD(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a,l=0,c;return f;function f(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(S)}function m(S){if(l>999||S===93&&!c||S===null||S===91||rt(S))return n(S);if(S===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return a=Xn(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return rt(S)||(c=!0),l++,e.consume(S),S===92?p:m}function p(S){return S===91||S===92||S===93?(e.consume(S),l++,m):m(S)}function v(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),s.includes(a)||s.push(a),Ke(e,w,"gfmFootnoteDefinitionWhitespace")):n(S)}function w(S){return t(S)}}function nD(e,t,n){return e.check(Xs,t,e.attempt(GI,t,n))}function rD(e){e.exit("gfmFootnoteDefinition")}function iD(e,t,n){const i=this;return Ke(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const l=i.events[i.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):n(a)}}function oD(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:a,resolveAll:s};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(l,c){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let h=f;for(;h--;)if(l[h][0]==="exit"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[h][1].end.offset-l[h][1].start.offset){l[f][1].type="strikethroughSequence",l[h][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},l[h][1].start),end:Object.assign({},l[f][1].end)},p={type:"strikethroughText",start:Object.assign({},l[h][1].end),end:Object.assign({},l[f][1].start)},v=[["enter",m,c],["enter",l[h][1],c],["exit",l[h][1],c],["enter",p,c]],w=c.parser.constructs.insideSpan.null;w&&Sn(v,v.length,0,du(w,l.slice(h+1,f),c)),Sn(v,v.length,0,[["exit",p,c],["enter",l[f][1],c],["exit",l[f][1],c],["exit",m,c]]),Sn(l,h-1,f-h+3,v),f=h+v.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function a(l,c,f){const h=this.previous,m=this.events;let p=0;return v;function v(S){return h===126&&m[m.length-1][1].type!=="characterEscape"?f(S):(l.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const C=bo(h);if(S===126)return p>1?f(S):(l.consume(S),p++,w);if(p<2&&!n)return f(S);const E=l.exit("strikethroughSequenceTemporary"),R=bo(S);return E._open=!R||R===2&&!!C,E._close=!C||C===2&&!!R,c(S)}}}class sD{constructor(){this.map=[]}add(t,n,i){aD(this,t,n,i)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let s=i.pop();for(;s;){for(const a of s)t.push(a);s=i.pop()}this.map.length=0}}function aD(e,t,n,i){let s=0;if(!(n===0&&i.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...i);return}s+=1}e.map.push([t,n,i])}}function lD(e,t){let n=!1;const i=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=i.length-1;i[a]=i[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function uD(){return{flow:{null:{name:"table",tokenize:cD,resolveAll:fD}}}}function cD(e,t,n){const i=this;let s=0,a=0,l;return c;function c(N){let q=i.events.length-1;for(;q>-1;){const J=i.events[q][1].type;if(J==="lineEnding"||J==="linePrefix")q--;else break}const V=q>-1?i.events[q][1].type:null,ae=V==="tableHead"||V==="tableRow"?D:f;return ae===D&&i.parser.lazy[i.now().line]?n(N):ae(N)}function f(N){return e.enter("tableHead"),e.enter("tableRow"),h(N)}function h(N){return N===124||(l=!0,a+=1),m(N)}function m(N){return N===null?n(N):De(N)?a>1?(a=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),w):n(N):Ue(N)?Ke(e,m,"whitespace")(N):(a+=1,l&&(l=!1,s+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),l=!0,m):(e.enter("data"),p(N)))}function p(N){return N===null||N===124||rt(N)?(e.exit("data"),m(N)):(e.consume(N),N===92?v:p)}function v(N){return N===92||N===124?(e.consume(N),p):p(N)}function w(N){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(N):(e.enter("tableDelimiterRow"),l=!1,Ue(N)?Ke(e,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):S(N))}function S(N){return N===45||N===58?E(N):N===124?(l=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),C):O(N)}function C(N){return Ue(N)?Ke(e,E,"whitespace")(N):E(N)}function E(N){return N===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),R):N===45?(a+=1,R(N)):N===null||De(N)?P(N):O(N)}function R(N){return N===45?(e.enter("tableDelimiterFiller"),A(N)):O(N)}function A(N){return N===45?(e.consume(N),A):N===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(N))}function T(N){return Ue(N)?Ke(e,P,"whitespace")(N):P(N)}function P(N){return N===124?S(N):N===null||De(N)?!l||s!==a?O(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):O(N)}function O(N){return n(N)}function D(N){return e.enter("tableRow"),H(N)}function H(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),H):N===null||De(N)?(e.exit("tableRow"),t(N)):Ue(N)?Ke(e,H,"whitespace")(N):(e.enter("data"),B(N))}function B(N){return N===null||N===124||rt(N)?(e.exit("data"),H(N)):(e.consume(N),N===92?_:B)}function _(N){return N===92||N===124?(e.consume(N),B):B(N)}}function fD(e,t){let n=-1,i=!0,s=0,a=[0,0,0,0],l=[0,0,0,0],c=!1,f=0,h,m,p;const v=new sD;for(;++n<e.length;){const w=e[n],S=w[1];w[0]==="enter"?S.type==="tableHead"?(c=!1,f!==0&&(Uv(v,t,f,h,m),m=void 0,f=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},v.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,p=void 0,a=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,m={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},v.add(n,0,[["enter",m,t]])),s=S.type==="tableDelimiterRow"?2:m?3:1):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],p=fl(v,t,a,s,void 0,p),a=[0,0,0,0]),l[2]=n)):S.type==="tableCellDivider"&&(i?i=!1:(a[1]!==0&&(l[0]=l[1],p=fl(v,t,a,s,void 0,p)),a=l,l=[a[1],n,0,0])):S.type==="tableHead"?(c=!0,f=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(f=n,a[1]!==0?(l[0]=l[1],p=fl(v,t,a,s,n,p)):l[1]!==0&&(p=fl(v,t,l,s,n,p)),s=0):s&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&Uv(v,t,f,h,m),v.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=lD(t.events,n))}return e}function fl(e,t,n,i,s,a){const l=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(a.end=Object.assign({},fo(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const f=fo(t.events,n[1]);if(a={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const h=fo(t.events,n[2]),m=fo(t.events,n[3]),p={type:c,start:Object.assign({},h),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",p,t]]),i!==2){const v=t.events[n[2]],w=t.events[n[3]];if(v[1].end=Object.assign({},w[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,C=n[3]-n[2]-1;e.add(S,C,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(a.end=Object.assign({},fo(t.events,s)),e.add(s,0,[["exit",a,t]]),a=void 0),a}function Uv(e,t,n,i,s){const a=[],l=fo(t.events,n);s&&(s.end=Object.assign({},l),a.push(["exit",s,t])),i.end=Object.assign({},l),a.push(["exit",i,t]),e.add(n+1,0,a)}function fo(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const dD={name:"tasklistCheck",tokenize:pD};function hD(){return{text:{91:dD}}}function pD(e,t,n){const i=this;return s;function s(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),a)}function a(f){return rt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(f)}function c(f){return De(f)?t(f):Ue(f)?e.check({tokenize:mD},t,n)(f):n(f)}}function mD(e,t,n){return Ke(e,i,"whitespace");function i(s){return s===null?n(s):t(s)}}function j1(e){return u1([BI(),QI(),oD(e),uD(),hD()])}function N1(e){return typeof e=="string"&&/\.md$/i.test(e.trim())}function gD(e,t){const n=String(e??"").trim().split(/\r?\n/).map(s=>`> ${s}`).join(`
266
266
  `),i=String(t??"").trim();return n&&i?`${n}
267
267
 
268
268
  ${i}`:n||i}function yD(e){const t=String(e??""),n=t.lastIndexOf(".");return`${n>0?t.slice(0,n):t}_review.md`}function vD(e,t,n){const i=String(e??""),s=String(t??""),a=Math.max(0,Number(n)||0);if(!s)return 0;let l=0,c=0;for(;c<=i.length;){const f=i.indexOf(s,c);if(f<0||f>=a)return l;l+=1,c=f+Math.max(s.length,1)}return l}function xD(e){return(String(e??"").match(/https?:\/\/[^\s<>()\[\]{}"']+/gi)??[]).map(n=>n.replace(/[.,!?;:]+$/,""))}function Rd(e){return e?.kind!=="file"?null:String(e.mime??"").toLowerCase().startsWith("image/")?"photo":"file"}function wD(e){const t=i=>{const s=Date.parse(String(i??""));return Number.isFinite(s)?s:0},n=new Map;for(const i of e??[]){const s=String(i?.message?.filename||"file"),a=n.get(s)??[];a.push(i),n.set(s,a)}return[...n.entries()].map(([i,s])=>({filename:i,versions:s.sort((a,l)=>t(l.message?.date)-t(a.message?.date))})).sort((i,s)=>t(s.versions[0]?.message?.date)-t(i.versions[0]?.message?.date))}const kD=new Set(["delete","emphasis","inlineCode","link","linkReference","strong"]);function SD(e){const t=w1(e,{extensions:[j1()],mdastExtensions:[l1()]}),n=[],i=[],s=[],a=(c,f)=>{const h=String(c??""),m=f.position?.start?.offset,p=f.position?.end?.offset;if(!h||!Number.isInteger(m)||!Number.isInteger(p))return;const v=e.slice(m,p),w=v.indexOf(h);if(w>=0){for(let C=0;C<h.length;C+=1)n.push(h[C]),i.push(m+w+C+1);return}let S=0;for(const C of h){const E=v.indexOf(C,S),R=E>=0?E:Math.min(S,Math.max(v.length-1,0));n.push(C),i.push(m+R+1),S=R+1}},l=c=>{const f=n.length;if(c.type==="text"||c.type==="inlineCode"||c.type==="code")a(c.value,c);else for(const p of c.children??[])l(p);const h=n.length,m=c.position?.end?.offset;h>f&&kD.has(c.type)&&Number.isInteger(m)&&s.push({visibleEnd:h,rawEnd:m})};return l(t),{text:n.join(""),rawEnds:i,trailingRanges:s}}function bD(e,t,n){let i=-1,s=0;for(let a=0;a<=n;a+=1){if(i=e.indexOf(t,s),i<0)return-1;s=i+Math.max(t.length,1)}return i}function CD(e,t){const n=String(e??""),i=SD(n),s=new Map,a=[];for(const[f,h]of(t??[]).entries()){const m=String(h?.selection??"").trim(),p=String(h?.comment??"").trim().replace(/\s+/g," ").replace(/\]\]/g,"] ]");if(!p)continue;const v=`[[REVIEW COMMENT ${f+1}: ${p}]]`,w=Number.isInteger(h?.occurrence)&&h.occurrence>=0?h.occurrence:0,S=m?bD(i.text,m,w):-1,C=S+m.length;let E=S>=0?i.rawEnds[C-1]:void 0;if(!Number.isInteger(E)){a.push(`[[REVIEW COMMENT ${f+1} — ANCHOR NOT FOUND: ${p}]]`);continue}for(const A of i.trailingRanges)A.visibleEnd===C&&(E=Math.max(E,A.rawEnd));const R=s.get(E)??[];R.push(v),s.set(E,R)}let l=n;const c=[...s.keys()].sort((f,h)=>h-f);for(const f of c)l=`${l.slice(0,f)} ${s.get(f).join(" ")}${l.slice(f)}`;return a.length>0&&(l=`${l.trimEnd()}
269
269
 
270
270
  ${a.join(`
271
271
  `)}
272
- `),l}const ED="",TD="application/octet-stream",PD=/\.([A-Za-z0-9]{1,12})$/;function M1(e){return String(e??"").split(";")[0].trim().toLowerCase()}function I1(e){const t=PD.exec(String(e??"").trim());return t?t[1].toLowerCase():""}function RD(e){const t=I1(e);return t==="html"||t==="htm"}function Ys(e,t){return RD(e)?!0:I1(e)?!1:M1(t)==="text/html"}function Vh(e,t){const n=M1(e);return n==="text/html"||Ys(t,e)?TD:n}const Ad=48e3,AD=Object.freeze([{rec:"audio/webm;codecs=opus",base:"audio/webm",ext:"webm"},{rec:"audio/ogg;codecs=opus",base:"audio/ogg",ext:"ogg"},{rec:"audio/webm",base:"audio/webm",ext:"webm"},{rec:"audio/mp4",base:"audio/mp4",ext:"m4a"}]),D1="x-ours-duration",jD=4e3;function ND(e){return!Number.isFinite(e)||e<=0?null:String(Math.round(e*100)/100)}function MD(e,t){const n=t===null?null:ND(t);return n===null?e:`${e};${D1}=${n}`}function ID(e){if(!e)return null;const t=new RegExp(`${D1}\\s*=\\s*([0-9]*\\.?[0-9]+)`,"i").exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function DD(e,t=jD){return typeof Audio!="function"||typeof URL?.createObjectURL!="function"?Promise.resolve(null):new Promise(n=>{const i=URL.createObjectURL(e),s=new Audio;let a=!1;const l=f=>{a||(a=!0,clearTimeout(c),s.removeAttribute("src"),s.load(),URL.revokeObjectURL(i),n(Number.isFinite(f)&&(f??0)>0?f:null))},c=setTimeout(()=>l(null),t);s.addEventListener("loadedmetadata",()=>{Number.isFinite(s.duration)&&s.duration>0?l(s.duration):s.currentTime=Number.MAX_SAFE_INTEGER},{once:!0}),s.addEventListener("durationchange",()=>{Number.isFinite(s.duration)&&s.duration>0&&l(s.duration)}),s.addEventListener("error",()=>l(null),{once:!0}),s.preload="metadata",s.src=i})}const _1=40,_D=44,L1=.14,LD=.5,OD=e=>e<0?0:e>1?1:e;function O1(e,{floor:t=L1,gamma:n=LD}={}){const i=Math.pow(OD(Number.isFinite(e)?e:0),n);return t+(1-t)*i}function FD(e,t=_1){const n=Math.max(1,Math.floor(t)),i=new Array(n).fill(0);if(!e||e.length===0)return i;const s=e.length/n;for(let a=0;a<n;a++){const l=Math.floor(a*s),c=Math.min(e.length,Math.max(l+1,Math.floor((a+1)*s)));let f=0;for(let h=l;h<c;h++)f+=e[h]*e[h];i[a]=Math.sqrt(f/(c-l))}return i}function zD(e,t={}){const{silenceFloor:n=1e-4}=t,i=e.reduce((s,a)=>a>s?a:s,0);return i>n?e.map(s=>O1(s/i,t)):e.map(()=>L1)}function VD({decay:e=.995,minReference:t=.02}={}){let n=t;return{push(i){const s=Number.isFinite(i)&&i>0?i:0;return n=Math.max(t,n*e,s),O1(s/n)},get reference(){return n}}}function F1(e){return Vh(e.mime,e.filename)}function Bh(e){const[t,n]=k.useState({url:null,size:0,loaded:!1});return k.useEffect(()=>{let i=null,s=!1;n({url:null,size:0,loaded:!1});const a=e.available?Jj(e.id):null;return a?(n({url:a,size:e.size,loaded:!0}),()=>{}):(lu(e.id).then(l=>{if(s)return;if(!l){n({url:null,size:0,loaded:!0});return}const c=URL.createObjectURL(new Blob([l],{type:F1(e)}));i=c,n({url:c,size:l.byteLength,loaded:!0})}),()=>{s=!0,i&&URL.revokeObjectURL(i)})},[e.id,e.available]),t}function $h({label:e}){return y.jsxs("div",{className:"file-offdevice",children:[y.jsx("div",{className:"file-offdevice-ic",children:y.jsx(Se,{name:"inbox",size:16})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:e,children:e}),y.jsx("div",{className:"filecard-sub",children:"Available on your original device"})]})]})}function Wv({rec:e}){if(!e.transcription)return null;const t=e.transcription.text?.trim();return y.jsx("div",{className:"voice-transcript",children:t||`Transcription ${e.transcription.status??"unavailable"}${e.transcription.error_category?` · ${e.transcription.error_category}`:""}`})}function BD({rec:e,receipt:t,receiptless:n,onPreview:i,onFetch:s}){const a=e.dir==="out",l=`bubble file-bubble${a?" me":""}`,c=So(e.mime,e.filename)?"Voice message":"File",f=y.jsxs("div",{className:"bubble-at",children:[ji(e.date),a&&y.jsx(Sd,{receipt:t,content:c,receiptless:n})]});return e.mime.startsWith("image/")?y.jsx($D,{rec:e,cls:l,footer:f,onFetch:s}):So(e.mime,e.filename)?y.jsx(UD,{rec:e,cls:l,footer:f,onFetch:s}):y.jsx(WD,{rec:e,cls:l,footer:f,onPreview:i,onFetch:s})}function Uh({rec:e,onFetch:t}){const[n,i]=k.useState(!1),[s,a]=k.useState(!1);return y.jsxs("div",{className:"file-offdevice",children:[y.jsx("div",{className:"file-offdevice-ic",children:y.jsx(Se,{name:"inbox",size:16})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:e.filename,children:So(e.mime,e.filename)?"Voice message":e.filename}),y.jsx("div",{className:"filecard-sub",children:s?"Could not fetch media":"Available after explicit fetch"})]}),y.jsx("button",{className:"btn sm",disabled:n,onClick:()=>{i(!0),a(!1),(t?.(e.id)??tN(e.id)).catch(()=>a(!0)).finally(()=>i(!1))},children:n?"Fetching…":"Fetch"})]})}function $D({rec:e,cls:t,footer:n,onFetch:i}){const{url:s,loaded:a}=Bh(e);return a&&!s?y.jsxs("div",{className:t+" filecard-bubble file-offdevice-bubble",children:[e.available===!1?y.jsx(Uh,{rec:e,onFetch:i}):y.jsx($h,{label:e.filename&&e.filename!=="file"?e.filename:"Photo"}),n]}):y.jsxs("div",{className:t+" image-bubble",children:[s?y.jsx("a",{href:s,target:"_blank",rel:"noreferrer",title:e.filename,children:y.jsx("img",{src:s,alt:e.filename})}):y.jsx("div",{className:"file-loading",children:"loading…"}),n]})}function UD({rec:e,cls:t,footer:n,onFetch:i}){const{url:s,loaded:a}=Bh(e),l=k.useRef(null),c=k.useRef(null),[f,h]=k.useState(!1),[m,p]=k.useState(0),[v,w]=k.useState(()=>ID(e.mime)),[S,C]=k.useState(!1),[E,R]=k.useState(null);if(k.useEffect(()=>{if(!s)return;let B=!1;const _=typeof window>"u"?void 0:window.AudioContext||window.webkitAudioContext;if(!_)return;const N=new _,q=()=>{try{N.close()?.catch?.(()=>{})}catch{}};return(async()=>{try{const V=await fetch(s).then(J=>J.arrayBuffer()),ae=await N.decodeAudioData(V);if(B)return;R(zD(FD(ae.getChannelData(0),_1)))}catch{}finally{q()}})(),()=>{B=!0,q()}},[s]),a&&!s)return y.jsxs("div",{className:t+" filecard-bubble file-offdevice-bubble",children:[e.available===!1?y.jsx(Uh,{rec:e,onFetch:i}):y.jsx($h,{label:"Voice message"}),n,y.jsx(Wv,{rec:e})]});const A=()=>{const B=l.current;B&&(f?B.pause():B.play())},T=B=>{const _=c.current;if(!_)return 0;const N=_.getBoundingClientRect();return Math.max(0,Math.min(1,(B-N.left)/N.width))},P=B=>{const _=l.current;p(B),_&&v&&isFinite(v)&&(_.currentTime=B*v)},O=B=>{s&&(B.currentTarget.setPointerCapture?.(B.pointerId),C(!0),P(T(B.clientX)))},D=B=>{S&&P(T(B.clientX))},H=B=>{S&&(B.currentTarget.releasePointerCapture?.(B.pointerId),C(!1))};return y.jsxs("div",{className:t+" voice-bubble",children:[y.jsx("button",{className:"voice-play",onClick:A,disabled:!s,title:f?"Pause":"Play",children:y.jsx(Se,{name:f?"pause":"play",size:14})}),y.jsxs("div",{className:"voice-track"+(s?" seekable":"")+(S?" scrubbing":"")+(E?" has-wave":""),ref:c,onPointerDown:O,onPointerMove:D,onPointerUp:H,onPointerCancel:H,role:s?"slider":void 0,"aria-label":s?"Seek":void 0,"aria-valuenow":Math.round(m*100),children:[E?y.jsx("div",{className:"voice-wave","aria-hidden":!0,children:E.map((B,_)=>y.jsx("span",{className:"voice-wave-bar"+(_/E.length<m?" played":""),style:{height:`${Math.round(B*100)}%`}},_))}):y.jsx("div",{className:"voice-track-fill",style:{width:`${m*100}%`}}),s&&y.jsx("span",{className:"voice-track-knob",style:{left:`${m*100}%`}})]}),y.jsx("span",{className:"voice-dur mono",children:v!==null?`${Math.floor(v/60)}:${String(Math.floor(v%60)).padStart(2,"0")}`:"·:··"}),s&&y.jsx("audio",{ref:l,src:s,onPlay:()=>h(!0),onPause:()=>h(!1),onEnded:()=>{h(!1),p(0)},onTimeUpdate:B=>{const _=B.currentTarget;!S&&_.duration>0&&isFinite(_.duration)&&p(_.currentTime/_.duration)},onLoadedMetadata:B=>{const _=B.currentTarget.duration;isFinite(_)&&_>0&&w(_)}}),n,y.jsx(Wv,{rec:e})]})}function WD({rec:e,cls:t,footer:n,onPreview:i,onFetch:s}){const{url:a,size:l,loaded:c}=Bh(e);return c&&!a?y.jsxs("div",{className:t+" filecard-bubble file-offdevice-bubble",children:[e.available===!1?y.jsx(Uh,{rec:e,onFetch:s}):y.jsx($h,{label:e.filename}),n]}):y.jsxs("div",{className:t+" filecard-bubble",children:[y.jsxs("div",{className:"filecard",children:[y.jsx("div",{className:"filecard-ic",children:y.jsx(Se,{name:"copy",size:18})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:e.filename,children:e.filename}),y.jsx("div",{className:"filecard-sub",children:l?ti(l):e.size?ti(e.size):""})]}),N1(e.filename)&&a&&i&&y.jsx("button",{className:"icon-btn",onClick:()=>i(e),title:"Preview markdown",children:y.jsx(Se,{name:"monitor",size:16})}),Ys(e.filename,e.mime)&&a&&i&&y.jsx("button",{className:"icon-btn",onClick:()=>i(e),title:"Preview HTML",children:y.jsx(Se,{name:"monitor",size:16})}),y.jsx("a",{className:"icon-btn"+(a?"":" disabled"),href:a??void 0,download:e.filename,title:"Download",children:y.jsx(Se,{name:"download",size:16})})]}),n]})}function z1(e){const{att:t}=e,[n,i]=k.useState(null);return k.useEffect(()=>{const s=F1({mime:t.mime,filename:t.filename}),a=URL.createObjectURL(new Blob([t.bytes],{type:s}));return i(a),()=>URL.revokeObjectURL(a)},[t]),y.jsxs("div",{className:"attach-preview",children:[t.mime.startsWith("image/")&&n?y.jsx("img",{className:"attach-thumb",src:n,alt:t.filename}):t.voice&&n?y.jsx("audio",{className:"attach-audio",src:n,controls:!0}):y.jsx("div",{className:"filecard-ic",children:y.jsx(Se,{name:"copy",size:16})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:t.filename,children:t.voice?"Voice message":t.filename}),y.jsxs("div",{className:"filecard-sub",children:[ti(t.bytes.length),t.originalSize&&t.originalSize>t.bytes.length?` · optimized from ${ti(t.originalSize)}`:""]})]}),y.jsx("button",{className:"btn primary sm",disabled:e.sending,onClick:e.onSend,children:e.sending?"Sending…":"Send"}),y.jsx("button",{className:"icon-btn",title:"Discard",disabled:e.sending,onClick:e.onDiscard,children:y.jsx(Se,{name:"close"})})]})}const HD={channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},KD=e=>`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,"0")}`,Hv=84,Kv=120,qD=550,XD=Math.floor(ks/(Ad/8)),YD=Math.min(300,XD),GD=_D;function V1(e){const[t,n]=k.useState("idle"),[i,s]=k.useState(0),[a,l]=k.useState([]),[c,f]=k.useState(0),[h,m]=k.useState(0),p=k.useRef("idle"),v=k.useRef(null),w=k.useRef(null),S=k.useRef([]),C=k.useRef("webm"),E=k.useRef("audio/webm"),R=k.useRef(!1),A=k.useRef({x:0,y:0}),T=k.useRef(0),P=k.useRef(!1),O=k.useRef(null),D=k.useRef(null),H=k.useRef(null),B=k.useRef(e.onReady),_=k.useRef(e.onError),N=k.useRef(e.onActiveChange);B.current=e.onReady,_.current=e.onError,N.current=e.onActiveChange;const q=Z=>{p.current=Z,n(Z),N.current?.(Z==="recording"||Z==="locked"||Z==="arming")},V=()=>{D.current!=null&&cancelAnimationFrame(D.current),D.current=null,H.current&&clearInterval(H.current),H.current=null,O.current?.close().catch(()=>{}),O.current=null,w.current?.getTracks().forEach(Z=>Z.stop()),w.current=null},ae=()=>{window.removeEventListener("pointermove",we),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",G)},J=Z=>{R.current=Z;const ye=v.current;ye&&ye.state!=="inactive"?ye.stop():ee(),ae()},ee=()=>{V(),q("idle"),s(0),l([]),f(0),m(0)},ge=()=>{p.current==="recording"&&(ae(),m(0),q("locked"))};function we(Z){if(p.current!=="recording")return;const ye=A.current.y-Z.clientY,me=A.current.x-Z.clientX,he=Math.max(0,Math.min(1,ye/Hv)),be=Math.max(0,Math.min(1,me/Kv));f(he),m(be),ye>=Hv?ge():me>=Kv&&J(!0)}function G(){if(p.current==="arming"){P.current=!0,ae();return}if(p.current!=="recording")return;const Z=Date.now()-T.current<qD;J(Z)}const le=Z=>{e.disabled||p.current!=="idle"||(Z.preventDefault(),A.current={x:Z.clientX,y:Z.clientY},P.current=!1,R.current=!1,S.current=[],f(0),m(0),q("arming"),window.addEventListener("pointermove",we),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",G),j())};async function j(){let Z;try{Z=await navigator.mediaDevices.getUserMedia({audio:HD})}catch{_.current("Microphone unavailable — check the browser permission."),ae(),q("idle");return}if(P.current||p.current==="idle"){Z.getTracks().forEach(he=>he.stop()),q("idle");return}w.current=Z;const ye=AD.find(he=>typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(he.rec));C.current=ye?.ext??"webm",E.current=ye?.base??"audio/webm";const me=ye?new MediaRecorder(Z,{mimeType:ye.rec,audioBitsPerSecond:Ad}):new MediaRecorder(Z,{audioBitsPerSecond:Ad});v.current=me,me.ondataavailable=he=>{he.data.size>0&&S.current.push(he.data)},me.onstop=()=>{if(R.current){ee();return}const be=new Blob(S.current,{type:E.current});Promise.all([be.arrayBuffer(),DD(be)]).then(([xe,Be])=>{if(ee(),xe.byteLength===0)return;const Oe=new Date().toISOString().replace(/[-:]/g,"").replace(/\..+/,"").replace("T","-");B.current({filename:`${B0}${Oe}.${C.current}`,mime:MD(Zj(E.current),Be),bytes:new Uint8Array(xe),voice:!0})})},me.start(),T.current=Date.now(),q("recording"),s(0),H.current=setInterval(()=>{s(he=>{const be=he+1;return be>=YD&&J(!1),be})},1e3),F(Z)}function F(Z){try{const ye=window.AudioContext||window.webkitAudioContext,me=new ye;O.current=me;const he=me.createMediaStreamSource(Z),be=me.createAnalyser();be.fftSize=256,he.connect(be);const xe=new Uint8Array(be.fftSize),Be=VD();let Oe=0;const Ge=ut=>{if(D.current=requestAnimationFrame(Ge),ut-Oe<80)return;Oe=ut,be.getByteTimeDomainData(xe);let it=0;for(let Je=0;Je<xe.length;Je++){const zt=(xe[Je]-128)/128;it+=zt*zt}const Mt=Math.sqrt(it/xe.length),Xt=Be.push(Mt);l(Je=>{const zt=Je.length>=GD?Je.slice(1):Je.slice();return zt.push(Xt),zt})};D.current=requestAnimationFrame(Ge)}catch{}}k.useEffect(()=>()=>{R.current=!0,v.current?.stop(),ae(),V()},[]);const Q=t==="recording"||t==="locked"||t==="arming",M=y.jsx("div",{className:"vr-wave","aria-hidden":!0,children:a.map((Z,ye)=>y.jsx("span",{className:"vr-bar",style:{height:`${Math.round(Z*100)}%`}},ye))});return y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"icon-btn composer-tool vr-mic",title:"Hold to record a voice message",disabled:e.disabled,onPointerDown:le,onContextMenu:Z=>Z.preventDefault(),children:y.jsx(Se,{name:"mic",size:18})}),Q&&y.jsxs("div",{className:"voice-rec-overlay","data-mode":t,children:[t==="recording"&&y.jsxs("div",{className:"vr-lock",style:{"--p":c},"aria-hidden":!0,children:[y.jsx(Se,{name:"lock",size:13}),y.jsx(Se,{name:"chevronDown",size:12})]}),y.jsx("span",{className:"voice-rec-dot"}),y.jsx("span",{className:"vr-time mono",children:KD(i)}),t==="locked"?y.jsxs(y.Fragment,{children:[M,y.jsx("button",{className:"icon-btn vr-trash",title:"Cancel",onClick:()=>J(!0),children:y.jsx(Se,{name:"trash",size:16})}),y.jsxs("button",{className:"btn primary sm vr-stop",onClick:()=>J(!1),children:[y.jsx(Se,{name:"check",size:13}),"Stop"]})]}):y.jsxs("div",{className:"vr-slide",style:{opacity:1-h},children:[M,y.jsx("span",{className:"vr-hint",children:"‹ slide to cancel · slide up to lock"})]})]})]})}const QD="modulepreload",JD=function(e){return"/"+e},qv={},Wh=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let l=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");s=l(n.map(h=>{if(h=JD(h),h in qv)return;qv[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":QD,m||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((w,S)=>{v.addEventListener("load",w),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function a(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})};var ZD=Object.defineProperty,Ao=(e,t)=>ZD(e,"name",{value:t,configurable:!0}),B1=!!(typeof window<"u"&&window.document&&window.document.createElement);function Jr(e,t,{checkForDefaultPrevented:n=!0}={}){return Ao(function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)},"handleEvent")}Ao(Jr,"composeEventHandlers");function e_(e){if(!B1)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ao(e_,"getOwnerWindow");function jd(e){if(!B1)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ao(jd,"getOwnerDocument");function $1(e,t=!1){const{activeElement:n}=jd(e);if(!n?.nodeName)return null;if(U1(n)&&n.contentDocument)return $1(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const s=jd(n).getElementById(i);if(s)return s}}return n}Ao($1,"getActiveElement");function U1(e){return e.tagName==="IFRAME"}Ao(U1,"isFrame");var t_=Object.defineProperty,Hh=(e,t)=>t_(e,"name",{value:t,configurable:!0});function Nd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Hh(Nd,"setRef");function W1(...e){return t=>{let n=!1;const i=e.map(s=>{const a=Nd(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():Nd(e[s],null)}}}}Hh(W1,"composeRefs");function jo(...e){return k.useCallback(W1(...e),e)}Hh(jo,"useComposedRefs");var n_=Object.defineProperty,Mn=(e,t)=>n_(e,"name",{value:t,configurable:!0});function r_(e,t){const n=k.createContext(t);n.displayName=e+"Context";const i=Mn(a=>{const{children:l,...c}=a,f=k.useMemo(()=>c,Object.values(c));return y.jsx(n.Provider,{value:f,children:l})},"Provider");i.displayName=e+"Provider";function s(a,l={}){const{optional:c=!1}=l,f=k.useContext(n);if(f)return f;if(t!==void 0)return t;if(!c)throw new Error(`\`${a}\` must be used within \`${e}\``)}return Mn(s,"useContext"),[i,s]}Mn(r_,"createContext");function H1(e,t=[]){let n=[];function i(a,l){const c=k.createContext(l);c.displayName=a+"Context";const f=n.length;n=[...n,l];const h=Mn(p=>{const{scope:v,children:w,...S}=p,C=v?.[e]?.[f]||c,E=k.useMemo(()=>S,Object.values(S));return y.jsx(C.Provider,{value:E,children:w})},"Provider");h.displayName=a+"Provider";function m(p,v,w={}){const{optional:S=!1}=w,C=v?.[e]?.[f]||c,E=k.useContext(C);if(E)return E;if(l!==void 0)return l;if(!S)throw new Error(`\`${p}\` must be used within \`${a}\``)}return Mn(m,"useContext"),[h,m]}Mn(i,"createContext");const s=Mn(()=>{const a=n.map(l=>k.createContext(l));return Mn(function(c){const f=c?.[e]||a;return k.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])},"useScope")},"createScope");return s.scopeName=e,[i,K1(s,...t)]}Mn(H1,"createContextScope");function K1(...e){const t=e[0];if(e.length===1)return t;const n=Mn(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Mn(function(a){const l=i.reduce((c,{useScope:f,scopeName:h})=>{const p=f(a)[`__scope${h}`];return{...c,...p}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Mn(K1,"composeContextScopes");var ni=globalThis?.document?k.useLayoutEffect:()=>{},i_=Object.defineProperty,o_=(e,t)=>i_(e,"name",{value:t,configurable:!0}),s_=$s[" useId ".trim().toString()]||(()=>{}),a_=0;function Nl(e){const[t,n]=k.useState(s_());return ni(()=>{e||n(i=>i??String(a_++))},[e]),e||(t?`radix-${t}`:"")}o_(Nl,"useId");var l_=Object.defineProperty,u_=(e,t)=>l_(e,"name",{value:t,configurable:!0}),Xv=$s[" useEffectEvent ".trim().toString()],Yv=$s[" useInsertionEffect ".trim().toString()];function q1(e){if(typeof Xv=="function")return Xv(e);const t=k.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Yv=="function"?Yv(()=>{t.current=e}):ni(()=>{t.current=e}),k.useMemo(()=>(...n)=>t.current?.(...n),[])}u_(q1,"useEffectEvent");var c_=Object.defineProperty,Gs=(e,t)=>c_(e,"name",{value:t,configurable:!0}),f_=$s[" useInsertionEffect ".trim().toString()]||ni;function X1({prop:e,defaultProp:t,onChange:n=Gs(()=>{},"onChange"),caller:i}){const[s,a,l]=Y1({defaultProp:t,onChange:n}),c=e!==void 0,f=c?e:s,h=k.useCallback(m=>{if(c){const p=G1(m)?m(e):m;p!==e&&l.current?.(p)}else a(m)},[c,e,a,l]);return[f,h]}Gs(X1,"useControllableState");function Y1({defaultProp:e,onChange:t}){const[n,i]=k.useState(e),s=k.useRef(n),a=k.useRef(t);return f_(()=>{a.current=t},[t]),k.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,i,a]}Gs(Y1,"useUncontrolledState");function G1(e){return typeof e=="function"}Gs(G1,"isFunction");var Gv=Symbol("RADIX:SYNC_STATE");function d_(e,t,n,i){const{prop:s,defaultProp:a,onChange:l,caller:c}=t,f=s!==void 0,h=q1(l),m=[{...n,state:a}];i&&m.push(i);const[p,v]=k.useReducer((E,R)=>{if(R.type===Gv)return{...E,state:R.state};const A=e(E,R);return f&&!Object.is(A.state,E.state)&&h(A.state),A},...m),w=p.state,S=k.useRef(w);k.useEffect(()=>{S.current!==w&&(S.current=w,f||h(w))},[w,S,f]);const C=k.useMemo(()=>s!==void 0?{...p,state:s}:p,[p,s]);return k.useEffect(()=>{f&&!Object.is(s,p.state)&&v({type:Gv,state:s})},[s,p.state,f]),[C,v]}Gs(d_,"useControllableStateReducer");var Q1=Xx(),h_=Object.defineProperty,Yn=(e,t)=>h_(e,"name",{value:t,configurable:!0});function Kh(e){const t=k.forwardRef((n,i)=>{let{children:s,...a}=n,l=null,c=!1;const f=[];Md(s)&&typeof dl=="function"&&(s=dl(s._payload)),k.Children.forEach(s,v=>{if(tk(v)){c=!0;const w=v;let S="child"in w.props?w.props.child:w.props.children;Md(S)&&typeof dl=="function"&&(S=dl(S._payload)),l=m_(w,S),f.push(l?.props?.children)}else f.push(v)}),l?l=k.cloneElement(l,void 0,f):!c&&k.Children.count(s)===1&&k.isValidElement(s)&&(l=s);const h=l?ek(l):void 0,m=jo(i,h);if(!l){if(s||s===0)throw new Error(c?v_(e):y_(e));return s}const p=Z1(a,l.props??{});return l.type!==k.Fragment&&(p.ref=i?m:h),k.cloneElement(l,p)});return t.displayName=`${e}.Slot`,t}Yn(Kh,"createSlot");var J1=Symbol.for("radix.slottable");function p_(e){const t=Yn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=J1,t}Yn(p_,"createSlottable");var m_=Yn((e,t)=>{if("child"in e.props){const n=e.props.child;return k.isValidElement(n)?k.cloneElement(n,void 0,e.props.children(n.props.children)):null}return k.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Z1(e,t){const n={...t};for(const i in t){const s=e[i],a=t[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...c)=>{const f=a(...c);return s(...c),f}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}Yn(Z1,"mergeProps");function ek(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Yn(ek,"getElementRef");function tk(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J1}Yn(tk,"isSlottable");var g_=Symbol.for("react.lazy");function Md(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===g_&&"_payload"in e&&nk(e._payload)}Yn(Md,"isLazyComponent");function nk(e){return typeof e=="object"&&e!==null&&"then"in e}Yn(nk,"isPromiseLike");var y_=Yn(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),v_=Yn(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),dl=$s[" use ".trim().toString()],x_=Object.defineProperty,w_=(e,t)=>x_(e,"name",{value:t,configurable:!0}),k_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ii=k_.reduce((e,t)=>{const n=Kh(`Primitive.${t}`),i=k.forwardRef((s,a)=>{const{asChild:l,...c}=s,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...c,ref:a})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function rk(e,t){e&&Q1.flushSync(()=>e.dispatchEvent(t))}w_(rk,"dispatchDiscreteCustomEvent");var S_=Object.defineProperty,b_=(e,t)=>S_(e,"name",{value:t,configurable:!0});function Co(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>t.current?.(...n),[])}b_(Co,"useCallbackRef");var C_=Object.defineProperty,Nt=(e,t)=>C_(e,"name",{value:t,configurable:!0}),Id="dismissableLayer.update",E_="dismissableLayer.pointerDownOutside",T_="dismissableLayer.focusOutside",Qv,ik=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),P_=k.forwardRef(Nt(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,onDismiss:h,...m}=t,p=k.useContext(ik),[v,w]=k.useState(null),S=v?.ownerDocument??globalThis?.document,[,C]=k.useState({}),E=jo(n,w),R=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),T=A?R.indexOf(A):-1,P=v?R.indexOf(v):-1,O=p.layersWithOutsidePointerEventsDisabled.size>0,D=P>=T,H=k.useRef(!1),B=sk(V=>{l?.(V),f?.(V),V.defaultPrevented||h?.()},{ownerDocument:S,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:H,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:k.useCallback(V=>{if(!(V instanceof Node))return!1;const ae=[...p.branches].some(J=>J.contains(V));return D&&!ae},[p.branches,D])}),_=ak(V=>{if(s&&H.current)return;const ae=V.target;[...p.branches].some(ee=>ee.contains(ae))||(c?.(V),f?.(V),V.defaultPrevented||h?.())},S),N=v?P===R.length-1:!1,q=Co(V=>{V.key==="Escape"&&(a?.(V),!V.defaultPrevented&&h&&(V.preventDefault(),h()))});return k.useEffect(()=>{if(N)return S.addEventListener("keydown",q,{capture:!0}),()=>S.removeEventListener("keydown",q,{capture:!0})},[S,N,q]),k.useEffect(()=>{if(v)return i&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Qv=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),Dd(),()=>{i&&(p.layersWithOutsidePointerEventsDisabled.delete(v),p.layersWithOutsidePointerEventsDisabled.size===0&&(S.body.style.pointerEvents=Qv))}},[v,S,i,p]),k.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),Dd())},[v,p]),k.useEffect(()=>{const V=Nt(()=>C({}),"handleUpdate");return document.addEventListener(Id,V),()=>document.removeEventListener(Id,V)},[]),y.jsx(Ii.div,{...m,ref:E,style:{pointerEvents:O?D?"auto":"none":void 0,...t.style},onFocusCapture:Jr(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Jr(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Jr(t.onPointerDownCapture,B.onPointerDownCapture)})},"DismissableLayer"));function ok(){const e=k.useContext(ik),[t,n]=k.useState(null);return k.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Nt(ok,"useDismissableLayerSurface");var R_=Nt(()=>!0,"IS_TRUE");function sk(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:a,shouldHandlePointerDownOutside:l=R_}=t,c=Co(e),f=k.useRef(!1),h=k.useRef(!1),m=k.useRef(new Map),p=k.useRef(()=>{});return k.useEffect(()=>{function v(){h.current=!1,s.current=!1,m.current.clear()}Nt(v,"resetOutsideInteraction");function w(){return Array.from(m.current.values()).some(Boolean)}Nt(w,"isOutsideInteractionIntercepted");function S(T){if(!h.current)return;const P=T.target;P instanceof Node&&[...a].some(D=>D.contains(P))||m.current.set(T.type,!0),T.type==="click"&&window.setTimeout(()=>{h.current&&p.current()},0)}Nt(S,"handleInteractionCapture");function C(T){h.current&&m.current.set(T.type,!1)}Nt(C,"handleInteractionBubble");const E=Nt(T=>{if(T.target&&!f.current){let P=function(){n.removeEventListener("click",p.current);const D=w();v(),D||qh(E_,c,O,{discrete:!0})};if(Nt(P,"handleAndDispatchPointerDownOutsideEvent"),!l(T.target)){n.removeEventListener("click",p.current),v(),f.current=!1;return}const O={originalEvent:T};h.current=!0,s.current=i&&T.button===0,m.current.clear(),!i||T.button!==0?P():(n.removeEventListener("click",p.current),p.current=P,n.addEventListener("click",p.current,{once:!0}))}else n.removeEventListener("click",p.current),v();f.current=!1},"handlePointerDown"),R=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const T of R)n.addEventListener(T,S,!0),n.addEventListener(T,C);const A=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(A),n.removeEventListener("pointerdown",E),n.removeEventListener("click",p.current);for(const T of R)n.removeEventListener(T,S,!0),n.removeEventListener(T,C)}},[n,c,i,s,a,l]),{onPointerDownCapture:Nt(()=>f.current=!0,"onPointerDownCapture")}}Nt(sk,"usePointerDownOutside");function ak(e,t=globalThis?.document){const n=Co(e),i=k.useRef(!1);return k.useEffect(()=>{const s=Nt(a=>{a.target&&!i.current&&qh(T_,n,{originalEvent:a},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:Nt(()=>i.current=!0,"onFocusCapture"),onBlurCapture:Nt(()=>i.current=!1,"onBlurCapture")}}Nt(ak,"useFocusOutside");function Dd(){const e=new CustomEvent(Id);document.dispatchEvent(e)}Nt(Dd,"dispatchUpdate");function qh(e,t,n,{discrete:i}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),i?rk(s,a):s.dispatchEvent(a)}Nt(qh,"handleAndDispatchCustomEvent");var A_=Object.defineProperty,on=(e,t)=>A_(e,"name",{value:t,configurable:!0}),Ef="focusScope.autoFocusOnMount",Tf="focusScope.autoFocusOnUnmount",Jv={bubbles:!1,cancelable:!0},j_=k.forwardRef(on(function(t,n){const{loop:i=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=t,[f,h]=k.useState(null),m=Co(a),p=Co(l),v=k.useRef(null),w=jo(n,h),S=k.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;k.useEffect(()=>{if(s){let E=function(P){if(S.paused||!f)return;const O=P.target;f.contains(O)?v.current=O:kr(v.current,{select:!0})},R=function(P){if(S.paused||!f)return;const O=P.relatedTarget;O!==null&&(f.contains(O)||kr(v.current,{select:!0}))},A=function(P){if(document.activeElement===document.body)for(const D of P)D.removedNodes.length>0&&kr(f)};on(E,"handleFocusIn"),on(R,"handleFocusOut"),on(A,"handleMutations"),document.addEventListener("focusin",E),document.addEventListener("focusout",R);const T=new MutationObserver(A);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",R),T.disconnect()}}},[s,f,S.paused]),k.useEffect(()=>{if(f){Zv.add(S);const E=document.activeElement;if(!f.contains(E)){const A=new CustomEvent(Ef,Jv);f.addEventListener(Ef,m),f.dispatchEvent(A),A.defaultPrevented||(lk(hk(Xh(f)),{select:!0}),document.activeElement===E&&kr(f))}return()=>{f.removeEventListener(Ef,m),setTimeout(()=>{const A=new CustomEvent(Tf,Jv);f.addEventListener(Tf,p),f.dispatchEvent(A),A.defaultPrevented||kr(E??document.body,{select:!0}),f.removeEventListener(Tf,p),Zv.remove(S)},0)}}},[f,m,p,S]);const C=k.useCallback(E=>{if(!i&&!s||S.paused)return;const R=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,A=document.activeElement;if(R&&A){const T=E.currentTarget,[P,O]=uk(T);P&&O?!E.shiftKey&&A===O?(E.preventDefault(),i&&kr(P,{select:!0})):E.shiftKey&&A===P&&(E.preventDefault(),i&&kr(O,{select:!0})):A===T&&E.preventDefault()}},[i,s,S.paused]);return y.jsx(Ii.div,{tabIndex:-1,...c,ref:w,onKeyDown:C})},"FocusScope"));function lk(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(kr(i,{select:t}),document.activeElement!==n)return}on(lk,"focusFirst");function uk(e){const t=Xh(e),n=_d(t,e),i=_d(t.reverse(),e);return[n,i]}on(uk,"getTabbableEdges");function Xh(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:on(i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}on(Xh,"getTabbableCandidates");function _d(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):ck(i,{upTo:t})))return i}on(_d,"findVisible");function ck(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}on(ck,"isHidden");function fk(e){return e instanceof HTMLInputElement&&"select"in e}on(fk,"isSelectableInput");function kr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fk(e)&&t&&e.select()}}on(kr,"focus");var Zv=dk();function dk(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ld(e,t),e.unshift(t)},remove(t){e=Ld(e,t),e[0]?.resume()}}}on(dk,"createFocusScopesStack");function Ld(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}on(Ld,"arrayRemove");function hk(e){return e.filter(t=>t.tagName!=="A")}on(hk,"removeLinks");var N_=Object.defineProperty,M_=(e,t)=>N_(e,"name",{value:t,configurable:!0}),I_=k.forwardRef(M_(function(t,n){const{container:i,...s}=t,[a,l]=k.useState(!1);ni(()=>l(!0),[]);const c=i||a&&globalThis?.document?.body;return c?Q1.createPortal(y.jsx(Ii.div,{...s,ref:n}),c):null},"Portal")),D_=Object.defineProperty,Sr=(e,t)=>D_(e,"name",{value:t,configurable:!0});function pk(e,t){return k.useReducer((n,i)=>t[n][i]??n,e)}Sr(pk,"useStateMachine");var Yh=Sr(e=>{const{present:t,children:n}=e,i=mk(t),s=typeof n=="function"?n({present:i.isPresent}):k.Children.only(n),a=gk(i.ref,yk(s));return typeof n=="function"||i.isPresent?k.cloneElement(s,{ref:a}):null},"Presence");function mk(e){const[t,n]=k.useState(),i=k.useRef(null),s=k.useRef(e),a=k.useRef("none"),l=k.useRef(void 0),c=e?"mounted":"unmounted",[f,h]=pk(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{f==="mounted"?(a.current=l.current??ho(i.current),l.current=void 0):a.current="none"},[f]),ni(()=>{const m=i.current,p=s.current;if(p!==e){const w=a.current,S=ho(m);e?(l.current=S,h("MOUNT")):S==="none"||m?.display==="none"?h("UNMOUNT"):h(p&&w!==S?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),ni(()=>{if(t){let m;const p=t.ownerDocument.defaultView??window,v=Sr(S=>{const E=ho(i.current).includes(CSS.escape(S.animationName));if(S.target===t&&E&&(h("ANIMATION_END"),!s.current)){const R=t.style.animationFillMode;t.style.animationFillMode="forwards",m=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=R)})}},"handleAnimationEnd"),w=Sr(S=>{S.target===t&&(a.current=ho(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{p.clearTimeout(m),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:k.useCallback(m=>{if(m){const p=getComputedStyle(m);i.current=p,l.current=ho(p)}else i.current=null;n(m)},[])}}Sr(mk,"usePresence");function Od(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Sr(Od,"setRef");function gk(...e){const t=k.useRef(e);return t.current=e,k.useCallback(n=>{const i=t.current;let s=!1;const a=i.map(l=>{const c=Od(l,n);return!s&&typeof c=="function"&&(s=!0),c});if(s)return()=>{for(let l=0;l<a.length;l++){const c=a[l];typeof c=="function"?c():Od(i[l],null)}}},[])}Sr(gk,"useStableComposedRefs");function ho(e){return e?.animationName||"none"}Sr(ho,"getAnimationName");function yk(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Sr(yk,"getElementRef");var __=Object.defineProperty,Gh=(e,t)=>__(e,"name",{value:t,configurable:!0}),hl=0,oo=null;function L_(e){return Qh(),e.children}Gh(L_,"FocusGuards");function Qh(){k.useEffect(()=>{oo||(oo={start:Fd(),end:Fd()});const{start:e,end:t}=oo;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),hl++,()=>{hl===1&&(oo?.start.remove(),oo?.end.remove(),oo=null),hl=Math.max(0,hl-1)}},[])}Gh(Qh,"useFocusGuards");function Fd(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Gh(Fd,"createFocusGuard");var ir=function(){return ir=Object.assign||function(t){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ir.apply(this,arguments)};function vk(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]]);return n}function O_(e,t,n){if(n||arguments.length===2)for(var i=0,s=t.length,a;i<s;i++)(a||!(i in t))&&(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return e.concat(a||Array.prototype.slice.call(t))}var Ml="right-scroll-bar-position",Il="width-before-scroll-bar",F_="with-scroll-bars-hidden",z_="--removed-body-scroll-bar-size";function Pf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function V_(e,t){var n=k.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(i){var s=n.value;s!==i&&(n.value=i,n.callback(i,s))}}}})[0];return n.callback=t,n.facade}var B_=typeof window<"u"?k.useLayoutEffect:k.useEffect,ex=new WeakMap;function $_(e,t){var n=V_(null,function(i){return e.forEach(function(s){return Pf(s,i)})});return B_(function(){var i=ex.get(n);if(i){var s=new Set(i),a=new Set(e),l=n.current;s.forEach(function(c){a.has(c)||Pf(c,null)}),a.forEach(function(c){s.has(c)||Pf(c,l)})}ex.set(n,e)},[e]),n}function U_(e){return e}function W_(e,t){t===void 0&&(t=U_);var n=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,i);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(i=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){i=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(a),l=n}var f=function(){var m=l;l=[],m.forEach(a)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(m){l.push(m),h()},filter:function(m){return l=l.filter(m),n}}}};return s}function H_(e){e===void 0&&(e={});var t=W_(null);return t.options=ir({async:!0,ssr:!1},e),t}var xk=function(e){var t=e.sideCar,n=vk(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return k.createElement(i,ir({},n))};xk.isSideCarExport=!0;function K_(e,t){return e.useMedium(t),xk}var wk=H_(),Rf=function(){},hu=k.forwardRef(function(e,t){var n=k.useRef(null),i=k.useState({onScrollCapture:Rf,onWheelCapture:Rf,onTouchMoveCapture:Rf}),s=i[0],a=i[1],l=e.forwardProps,c=e.children,f=e.className,h=e.removeScrollBar,m=e.enabled,p=e.shards,v=e.sideCar,w=e.noRelative,S=e.noIsolation,C=e.inert,E=e.allowPinchZoom,R=e.as,A=R===void 0?"div":R,T=e.gapMode,P=vk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=v,D=$_([n,t]),H=ir(ir({},P),s);return k.createElement(k.Fragment,null,m&&k.createElement(O,{sideCar:wk,removeScrollBar:h,shards:p,noRelative:w,noIsolation:S,inert:C,setCallbacks:a,allowPinchZoom:!!E,lockRef:n,gapMode:T}),l?k.cloneElement(k.Children.only(c),ir(ir({},H),{ref:D})):k.createElement(A,ir({},H,{className:f,ref:D}),c))});hu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hu.classNames={fullWidth:Il,zeroRight:Ml};var q_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function X_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=q_();return t&&e.setAttribute("nonce",t),e}function Y_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function G_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Q_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=X_())&&(Y_(t,n),G_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},J_=function(){var e=Q_();return function(t,n){k.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kk=function(){var e=J_(),t=function(n){var i=n.styles,s=n.dynamic;return e(i,s),null};return t},Z_={left:0,top:0,right:0,gap:0},Af=function(e){return parseInt(e||"",10)||0},eL=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Af(n),Af(i),Af(s)]},tL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Z_;var t=eL(e),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-n+t[2]-t[0])}},nL=kk(),vo="data-scroll-locked",rL=function(e,t,n,i){var s=e.left,a=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
272
+ `),l}const ED="",TD="application/octet-stream",PD=/\.([A-Za-z0-9]{1,12})$/;function M1(e){return String(e??"").split(";")[0].trim().toLowerCase()}function I1(e){const t=PD.exec(String(e??"").trim());return t?t[1].toLowerCase():""}function RD(e){const t=I1(e);return t==="html"||t==="htm"}function Ys(e,t){return RD(e)?!0:I1(e)?!1:M1(t)==="text/html"}function Vh(e,t){const n=M1(e);return n==="text/html"||Ys(t,e)?TD:n}const Ad=48e3,AD=Object.freeze([{rec:"audio/webm;codecs=opus",base:"audio/webm",ext:"webm"},{rec:"audio/ogg;codecs=opus",base:"audio/ogg",ext:"ogg"},{rec:"audio/webm",base:"audio/webm",ext:"webm"},{rec:"audio/mp4",base:"audio/mp4",ext:"m4a"}]),D1="x-ours-duration",jD=4e3;function ND(e){return!Number.isFinite(e)||e<=0?null:String(Math.round(e*100)/100)}function MD(e,t){const n=t===null?null:ND(t);return n===null?e:`${e};${D1}=${n}`}function ID(e){if(!e)return null;const t=new RegExp(`${D1}\\s*=\\s*([0-9]*\\.?[0-9]+)`,"i").exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function DD(e,t=jD){return typeof Audio!="function"||typeof URL?.createObjectURL!="function"?Promise.resolve(null):new Promise(n=>{const i=URL.createObjectURL(e),s=new Audio;let a=!1;const l=f=>{a||(a=!0,clearTimeout(c),s.removeAttribute("src"),s.load(),URL.revokeObjectURL(i),n(Number.isFinite(f)&&(f??0)>0?f:null))},c=setTimeout(()=>l(null),t);s.addEventListener("loadedmetadata",()=>{Number.isFinite(s.duration)&&s.duration>0?l(s.duration):s.currentTime=Number.MAX_SAFE_INTEGER},{once:!0}),s.addEventListener("durationchange",()=>{Number.isFinite(s.duration)&&s.duration>0&&l(s.duration)}),s.addEventListener("error",()=>l(null),{once:!0}),s.preload="metadata",s.src=i})}const _1=40,_D=44,L1=.14,LD=.5,OD=e=>e<0?0:e>1?1:e;function O1(e,{floor:t=L1,gamma:n=LD}={}){const i=Math.pow(OD(Number.isFinite(e)?e:0),n);return t+(1-t)*i}function FD(e,t=_1){const n=Math.max(1,Math.floor(t)),i=new Array(n).fill(0);if(!e||e.length===0)return i;const s=e.length/n;for(let a=0;a<n;a++){const l=Math.floor(a*s),c=Math.min(e.length,Math.max(l+1,Math.floor((a+1)*s)));let f=0;for(let h=l;h<c;h++)f+=e[h]*e[h];i[a]=Math.sqrt(f/(c-l))}return i}function zD(e,t={}){const{silenceFloor:n=1e-4}=t,i=e.reduce((s,a)=>a>s?a:s,0);return i>n?e.map(s=>O1(s/i,t)):e.map(()=>L1)}function VD({decay:e=.995,minReference:t=.02}={}){let n=t;return{push(i){const s=Number.isFinite(i)&&i>0?i:0;return n=Math.max(t,n*e,s),O1(s/n)},get reference(){return n}}}function F1(e){return Vh(e.mime,e.filename)}function Bh(e){const[t,n]=k.useState({url:null,size:0,loaded:!1});return k.useEffect(()=>{let i=null,s=!1;n({url:null,size:0,loaded:!1});const a=e.available?Jj(e.id):null;return a?(n({url:a,size:e.size,loaded:!0}),()=>{}):(lu(e.id).then(l=>{if(s)return;if(!l){n({url:null,size:0,loaded:!0});return}const c=URL.createObjectURL(new Blob([l],{type:F1(e)}));i=c,n({url:c,size:l.byteLength,loaded:!0})}),()=>{s=!0,i&&URL.revokeObjectURL(i)})},[e.id,e.available]),t}function $h({label:e}){return y.jsxs("div",{className:"file-offdevice",children:[y.jsx("div",{className:"file-offdevice-ic",children:y.jsx(Se,{name:"inbox",size:16})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:e,children:e}),y.jsx("div",{className:"filecard-sub",children:"Available on your original device"})]})]})}function Wv({rec:e}){if(!e.transcription)return null;const t=e.transcription.text?.trim();return y.jsx("div",{className:"voice-transcript",children:t||`Transcription ${e.transcription.status??"unavailable"}${e.transcription.error_category?` · ${e.transcription.error_category}`:""}`})}function BD({rec:e,receipt:t,receiptless:n,onPreview:i,onFetch:s}){const a=e.dir==="out",l=`bubble file-bubble${a?" me":""}`,c=So(e.mime,e.filename)?"Voice message":"File",f=y.jsxs("div",{className:"bubble-at",children:[ji(e.date),a&&y.jsx(Sd,{receipt:t,content:c,receiptless:n})]});return e.mime.startsWith("image/")?y.jsx($D,{rec:e,cls:l,footer:f,onFetch:s}):So(e.mime,e.filename)?y.jsx(UD,{rec:e,cls:l,footer:f,onFetch:s}):y.jsx(WD,{rec:e,cls:l,footer:f,onPreview:i,onFetch:s})}function Uh({rec:e,onFetch:t}){const[n,i]=k.useState(!1),[s,a]=k.useState(!1);return y.jsxs("div",{className:"file-offdevice",children:[y.jsx("div",{className:"file-offdevice-ic",children:y.jsx(Se,{name:"inbox",size:16})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:e.filename,children:So(e.mime,e.filename)?"Voice message":e.filename}),y.jsx("div",{className:"filecard-sub",children:s?"Could not fetch media":"Available after explicit fetch"})]}),y.jsx("button",{className:"btn sm",disabled:n,onClick:()=>{i(!0),a(!1),(t?.(e.id)??tN(e.id)).catch(()=>a(!0)).finally(()=>i(!1))},children:n?"Fetching…":"Fetch"})]})}function $D({rec:e,cls:t,footer:n,onFetch:i}){const{url:s,loaded:a}=Bh(e);return a&&!s?y.jsxs("div",{className:t+" filecard-bubble file-offdevice-bubble",children:[e.available===!1?y.jsx(Uh,{rec:e,onFetch:i}):y.jsx($h,{label:e.filename&&e.filename!=="file"?e.filename:"Photo"}),n]}):y.jsxs("div",{className:t+" image-bubble",children:[s?y.jsx("a",{href:s,target:"_blank",rel:"noreferrer",title:e.filename,children:y.jsx("img",{src:s,alt:e.filename})}):y.jsx("div",{className:"file-loading",children:"loading…"}),n]})}function UD({rec:e,cls:t,footer:n,onFetch:i}){const{url:s,loaded:a}=Bh(e),l=k.useRef(null),c=k.useRef(null),[f,h]=k.useState(!1),[m,p]=k.useState(0),[v,w]=k.useState(()=>ID(e.mime)),[S,C]=k.useState(!1),[E,R]=k.useState(null);if(k.useEffect(()=>{if(!s)return;let B=!1;const _=typeof window>"u"?void 0:window.AudioContext||window.webkitAudioContext;if(!_)return;const N=new _,q=()=>{try{N.close()?.catch?.(()=>{})}catch{}};return(async()=>{try{const V=await fetch(s).then(J=>J.arrayBuffer()),ae=await N.decodeAudioData(V);if(B)return;R(zD(FD(ae.getChannelData(0),_1)))}catch{}finally{q()}})(),()=>{B=!0,q()}},[s]),a&&!s)return y.jsxs("div",{className:t+" filecard-bubble file-offdevice-bubble",children:[e.available===!1?y.jsx(Uh,{rec:e,onFetch:i}):y.jsx($h,{label:"Voice message"}),n,y.jsx(Wv,{rec:e})]});const A=()=>{const B=l.current;B&&(f?B.pause():B.play())},T=B=>{const _=c.current;if(!_)return 0;const N=_.getBoundingClientRect();return Math.max(0,Math.min(1,(B-N.left)/N.width))},P=B=>{const _=l.current;p(B),_&&v&&isFinite(v)&&(_.currentTime=B*v)},O=B=>{s&&(B.currentTarget.setPointerCapture?.(B.pointerId),C(!0),P(T(B.clientX)))},D=B=>{S&&P(T(B.clientX))},H=B=>{S&&(B.currentTarget.releasePointerCapture?.(B.pointerId),C(!1))};return y.jsxs("div",{className:t+" voice-bubble",children:[y.jsx("button",{className:"voice-play",onClick:A,disabled:!s,title:f?"Pause":"Play",children:y.jsx(Se,{name:f?"pause":"play",size:14})}),y.jsxs("div",{className:"voice-track"+(s?" seekable":"")+(S?" scrubbing":"")+(E?" has-wave":""),ref:c,onPointerDown:O,onPointerMove:D,onPointerUp:H,onPointerCancel:H,role:s?"slider":void 0,"aria-label":s?"Seek":void 0,"aria-valuenow":Math.round(m*100),children:[E?y.jsx("div",{className:"voice-wave","aria-hidden":!0,children:E.map((B,_)=>y.jsx("span",{className:"voice-wave-bar"+(_/E.length<m?" played":""),style:{height:`${Math.round(B*100)}%`}},_))}):y.jsx("div",{className:"voice-track-fill",style:{width:`${m*100}%`}}),s&&y.jsx("span",{className:"voice-track-knob",style:{left:`${m*100}%`}})]}),y.jsx("span",{className:"voice-dur mono",children:v!==null?`${Math.floor(v/60)}:${String(Math.floor(v%60)).padStart(2,"0")}`:"·:··"}),s&&y.jsx("audio",{ref:l,src:s,onPlay:()=>h(!0),onPause:()=>h(!1),onEnded:()=>{h(!1),p(0)},onTimeUpdate:B=>{const _=B.currentTarget;!S&&_.duration>0&&isFinite(_.duration)&&p(_.currentTime/_.duration)},onLoadedMetadata:B=>{const _=B.currentTarget.duration;isFinite(_)&&_>0&&w(_)}}),n,y.jsx(Wv,{rec:e})]})}function WD({rec:e,cls:t,footer:n,onPreview:i,onFetch:s}){const{url:a,size:l,loaded:c}=Bh(e);return c&&!a?y.jsxs("div",{className:t+" filecard-bubble file-offdevice-bubble",children:[e.available===!1?y.jsx(Uh,{rec:e,onFetch:s}):y.jsx($h,{label:e.filename}),n]}):y.jsxs("div",{className:t+" filecard-bubble",children:[y.jsxs("div",{className:"filecard",children:[y.jsx("div",{className:"filecard-ic",children:y.jsx(Se,{name:"copy",size:18})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:e.filename,children:e.filename}),y.jsx("div",{className:"filecard-sub",children:l?ti(l):e.size?ti(e.size):""})]}),N1(e.filename)&&a&&i&&y.jsx("button",{className:"icon-btn",onClick:()=>i(e),title:"Preview markdown",children:y.jsx(Se,{name:"monitor",size:16})}),Ys(e.filename,e.mime)&&a&&i&&y.jsx("button",{className:"icon-btn",onClick:()=>i(e),title:"Preview HTML",children:y.jsx(Se,{name:"monitor",size:16})}),y.jsx("a",{className:"icon-btn"+(a?"":" disabled"),href:a??void 0,download:e.filename,title:"Download",children:y.jsx(Se,{name:"download",size:16})})]}),n]})}function z1(e){const{att:t}=e,[n,i]=k.useState(null);return k.useEffect(()=>{const s=F1({mime:t.mime,filename:t.filename}),a=URL.createObjectURL(new Blob([t.bytes],{type:s}));return i(a),()=>URL.revokeObjectURL(a)},[t]),y.jsxs("div",{className:"attach-preview",children:[t.mime.startsWith("image/")&&n?y.jsx("img",{className:"attach-thumb",src:n,alt:t.filename}):t.voice&&n?y.jsx("audio",{className:"attach-audio",src:n,controls:!0}):y.jsx("div",{className:"filecard-ic",children:y.jsx(Se,{name:"copy",size:16})}),y.jsxs("div",{className:"filecard-meta",children:[y.jsx("div",{className:"filecard-name",title:t.filename,children:t.voice?"Voice message":t.filename}),y.jsxs("div",{className:"filecard-sub",children:[ti(t.bytes.length),t.originalSize&&t.originalSize>t.bytes.length?` · optimized from ${ti(t.originalSize)}`:""]})]}),y.jsx("button",{className:"btn primary sm",disabled:e.sending,onClick:e.onSend,children:e.sending?"Sending…":"Send"}),y.jsx("button",{className:"icon-btn",title:"Discard",disabled:e.sending,onClick:e.onDiscard,children:y.jsx(Se,{name:"close"})})]})}const HD={channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},KD=e=>`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,"0")}`,Hv=84,Kv=120,qD=550,XD=Math.floor(ks/(Ad/8)),YD=Math.min(300,XD),GD=_D;function V1(e){const[t,n]=k.useState("idle"),[i,s]=k.useState(0),[a,l]=k.useState([]),[c,f]=k.useState(0),[h,m]=k.useState(0),p=k.useRef("idle"),v=k.useRef(null),w=k.useRef(null),S=k.useRef([]),C=k.useRef("webm"),E=k.useRef("audio/webm"),R=k.useRef(!1),A=k.useRef({x:0,y:0}),T=k.useRef(0),P=k.useRef(!1),O=k.useRef(null),D=k.useRef(null),H=k.useRef(null),B=k.useRef(e.onReady),_=k.useRef(e.onError),N=k.useRef(e.onActiveChange);B.current=e.onReady,_.current=e.onError,N.current=e.onActiveChange;const q=Z=>{p.current=Z,n(Z),N.current?.(Z==="recording"||Z==="locked"||Z==="arming")},V=()=>{D.current!=null&&cancelAnimationFrame(D.current),D.current=null,H.current&&clearInterval(H.current),H.current=null,O.current?.close().catch(()=>{}),O.current=null,w.current?.getTracks().forEach(Z=>Z.stop()),w.current=null},ae=()=>{window.removeEventListener("pointermove",we),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",G)},J=Z=>{R.current=Z;const ye=v.current;ye&&ye.state!=="inactive"?ye.stop():ee(),ae()},ee=()=>{V(),q("idle"),s(0),l([]),f(0),m(0)},ge=()=>{p.current==="recording"&&(ae(),m(0),q("locked"))};function we(Z){if(p.current!=="recording")return;const ye=A.current.y-Z.clientY,me=A.current.x-Z.clientX,pe=Math.max(0,Math.min(1,ye/Hv)),be=Math.max(0,Math.min(1,me/Kv));f(pe),m(be),ye>=Hv?ge():me>=Kv&&J(!0)}function G(){if(p.current==="arming"){P.current=!0,ae();return}if(p.current!=="recording")return;const Z=Date.now()-T.current<qD;J(Z)}const le=Z=>{e.disabled||p.current!=="idle"||(Z.preventDefault(),A.current={x:Z.clientX,y:Z.clientY},P.current=!1,R.current=!1,S.current=[],f(0),m(0),q("arming"),window.addEventListener("pointermove",we),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",G),j())};async function j(){let Z;try{Z=await navigator.mediaDevices.getUserMedia({audio:HD})}catch{_.current("Microphone unavailable — check the browser permission."),ae(),q("idle");return}if(P.current||p.current==="idle"){Z.getTracks().forEach(pe=>pe.stop()),q("idle");return}w.current=Z;const ye=AD.find(pe=>typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(pe.rec));C.current=ye?.ext??"webm",E.current=ye?.base??"audio/webm";const me=ye?new MediaRecorder(Z,{mimeType:ye.rec,audioBitsPerSecond:Ad}):new MediaRecorder(Z,{audioBitsPerSecond:Ad});v.current=me,me.ondataavailable=pe=>{pe.data.size>0&&S.current.push(pe.data)},me.onstop=()=>{if(R.current){ee();return}const be=new Blob(S.current,{type:E.current});Promise.all([be.arrayBuffer(),DD(be)]).then(([xe,Be])=>{if(ee(),xe.byteLength===0)return;const Oe=new Date().toISOString().replace(/[-:]/g,"").replace(/\..+/,"").replace("T","-");B.current({filename:`${B0}${Oe}.${C.current}`,mime:MD(Zj(E.current),Be),bytes:new Uint8Array(xe),voice:!0})})},me.start(),T.current=Date.now(),q("recording"),s(0),H.current=setInterval(()=>{s(pe=>{const be=pe+1;return be>=YD&&J(!1),be})},1e3),F(Z)}function F(Z){try{const ye=window.AudioContext||window.webkitAudioContext,me=new ye;O.current=me;const pe=me.createMediaStreamSource(Z),be=me.createAnalyser();be.fftSize=256,pe.connect(be);const xe=new Uint8Array(be.fftSize),Be=VD();let Oe=0;const Ge=ut=>{if(D.current=requestAnimationFrame(Ge),ut-Oe<80)return;Oe=ut,be.getByteTimeDomainData(xe);let it=0;for(let Je=0;Je<xe.length;Je++){const zt=(xe[Je]-128)/128;it+=zt*zt}const Mt=Math.sqrt(it/xe.length),Xt=Be.push(Mt);l(Je=>{const zt=Je.length>=GD?Je.slice(1):Je.slice();return zt.push(Xt),zt})};D.current=requestAnimationFrame(Ge)}catch{}}k.useEffect(()=>()=>{R.current=!0,v.current?.stop(),ae(),V()},[]);const Q=t==="recording"||t==="locked"||t==="arming",M=y.jsx("div",{className:"vr-wave","aria-hidden":!0,children:a.map((Z,ye)=>y.jsx("span",{className:"vr-bar",style:{height:`${Math.round(Z*100)}%`}},ye))});return y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"icon-btn composer-tool vr-mic",title:"Hold to record a voice message",disabled:e.disabled,onPointerDown:le,onContextMenu:Z=>Z.preventDefault(),children:y.jsx(Se,{name:"mic",size:18})}),Q&&y.jsxs("div",{className:"voice-rec-overlay","data-mode":t,children:[t==="recording"&&y.jsxs("div",{className:"vr-lock",style:{"--p":c},"aria-hidden":!0,children:[y.jsx(Se,{name:"lock",size:13}),y.jsx(Se,{name:"chevronDown",size:12})]}),y.jsx("span",{className:"voice-rec-dot"}),y.jsx("span",{className:"vr-time mono",children:KD(i)}),t==="locked"?y.jsxs(y.Fragment,{children:[M,y.jsx("button",{className:"icon-btn vr-trash",title:"Cancel",onClick:()=>J(!0),children:y.jsx(Se,{name:"trash",size:16})}),y.jsxs("button",{className:"btn primary sm vr-stop",onClick:()=>J(!1),children:[y.jsx(Se,{name:"check",size:13}),"Stop"]})]}):y.jsxs("div",{className:"vr-slide",style:{opacity:1-h},children:[M,y.jsx("span",{className:"vr-hint",children:"‹ slide to cancel · slide up to lock"})]})]})]})}const QD="modulepreload",JD=function(e){return"/"+e},qv={},Wh=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let l=function(h){return Promise.all(h.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");s=l(n.map(h=>{if(h=JD(h),h in qv)return;qv[h]=!0;const m=h.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":QD,m||(v.as="script"),v.crossOrigin="",v.href=h,f&&v.setAttribute("nonce",f),document.head.appendChild(v),m)return new Promise((w,S)=>{v.addEventListener("load",w),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function a(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})};var ZD=Object.defineProperty,Ao=(e,t)=>ZD(e,"name",{value:t,configurable:!0}),B1=!!(typeof window<"u"&&window.document&&window.document.createElement);function Jr(e,t,{checkForDefaultPrevented:n=!0}={}){return Ao(function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)},"handleEvent")}Ao(Jr,"composeEventHandlers");function e_(e){if(!B1)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ao(e_,"getOwnerWindow");function jd(e){if(!B1)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ao(jd,"getOwnerDocument");function $1(e,t=!1){const{activeElement:n}=jd(e);if(!n?.nodeName)return null;if(U1(n)&&n.contentDocument)return $1(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const s=jd(n).getElementById(i);if(s)return s}}return n}Ao($1,"getActiveElement");function U1(e){return e.tagName==="IFRAME"}Ao(U1,"isFrame");var t_=Object.defineProperty,Hh=(e,t)=>t_(e,"name",{value:t,configurable:!0});function Nd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Hh(Nd,"setRef");function W1(...e){return t=>{let n=!1;const i=e.map(s=>{const a=Nd(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():Nd(e[s],null)}}}}Hh(W1,"composeRefs");function jo(...e){return k.useCallback(W1(...e),e)}Hh(jo,"useComposedRefs");var n_=Object.defineProperty,Mn=(e,t)=>n_(e,"name",{value:t,configurable:!0});function r_(e,t){const n=k.createContext(t);n.displayName=e+"Context";const i=Mn(a=>{const{children:l,...c}=a,f=k.useMemo(()=>c,Object.values(c));return y.jsx(n.Provider,{value:f,children:l})},"Provider");i.displayName=e+"Provider";function s(a,l={}){const{optional:c=!1}=l,f=k.useContext(n);if(f)return f;if(t!==void 0)return t;if(!c)throw new Error(`\`${a}\` must be used within \`${e}\``)}return Mn(s,"useContext"),[i,s]}Mn(r_,"createContext");function H1(e,t=[]){let n=[];function i(a,l){const c=k.createContext(l);c.displayName=a+"Context";const f=n.length;n=[...n,l];const h=Mn(p=>{const{scope:v,children:w,...S}=p,C=v?.[e]?.[f]||c,E=k.useMemo(()=>S,Object.values(S));return y.jsx(C.Provider,{value:E,children:w})},"Provider");h.displayName=a+"Provider";function m(p,v,w={}){const{optional:S=!1}=w,C=v?.[e]?.[f]||c,E=k.useContext(C);if(E)return E;if(l!==void 0)return l;if(!S)throw new Error(`\`${p}\` must be used within \`${a}\``)}return Mn(m,"useContext"),[h,m]}Mn(i,"createContext");const s=Mn(()=>{const a=n.map(l=>k.createContext(l));return Mn(function(c){const f=c?.[e]||a;return k.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])},"useScope")},"createScope");return s.scopeName=e,[i,K1(s,...t)]}Mn(H1,"createContextScope");function K1(...e){const t=e[0];if(e.length===1)return t;const n=Mn(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Mn(function(a){const l=i.reduce((c,{useScope:f,scopeName:h})=>{const p=f(a)[`__scope${h}`];return{...c,...p}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Mn(K1,"composeContextScopes");var ni=globalThis?.document?k.useLayoutEffect:()=>{},i_=Object.defineProperty,o_=(e,t)=>i_(e,"name",{value:t,configurable:!0}),s_=$s[" useId ".trim().toString()]||(()=>{}),a_=0;function Nl(e){const[t,n]=k.useState(s_());return ni(()=>{e||n(i=>i??String(a_++))},[e]),e||(t?`radix-${t}`:"")}o_(Nl,"useId");var l_=Object.defineProperty,u_=(e,t)=>l_(e,"name",{value:t,configurable:!0}),Xv=$s[" useEffectEvent ".trim().toString()],Yv=$s[" useInsertionEffect ".trim().toString()];function q1(e){if(typeof Xv=="function")return Xv(e);const t=k.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Yv=="function"?Yv(()=>{t.current=e}):ni(()=>{t.current=e}),k.useMemo(()=>(...n)=>t.current?.(...n),[])}u_(q1,"useEffectEvent");var c_=Object.defineProperty,Gs=(e,t)=>c_(e,"name",{value:t,configurable:!0}),f_=$s[" useInsertionEffect ".trim().toString()]||ni;function X1({prop:e,defaultProp:t,onChange:n=Gs(()=>{},"onChange"),caller:i}){const[s,a,l]=Y1({defaultProp:t,onChange:n}),c=e!==void 0,f=c?e:s,h=k.useCallback(m=>{if(c){const p=G1(m)?m(e):m;p!==e&&l.current?.(p)}else a(m)},[c,e,a,l]);return[f,h]}Gs(X1,"useControllableState");function Y1({defaultProp:e,onChange:t}){const[n,i]=k.useState(e),s=k.useRef(n),a=k.useRef(t);return f_(()=>{a.current=t},[t]),k.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,i,a]}Gs(Y1,"useUncontrolledState");function G1(e){return typeof e=="function"}Gs(G1,"isFunction");var Gv=Symbol("RADIX:SYNC_STATE");function d_(e,t,n,i){const{prop:s,defaultProp:a,onChange:l,caller:c}=t,f=s!==void 0,h=q1(l),m=[{...n,state:a}];i&&m.push(i);const[p,v]=k.useReducer((E,R)=>{if(R.type===Gv)return{...E,state:R.state};const A=e(E,R);return f&&!Object.is(A.state,E.state)&&h(A.state),A},...m),w=p.state,S=k.useRef(w);k.useEffect(()=>{S.current!==w&&(S.current=w,f||h(w))},[w,S,f]);const C=k.useMemo(()=>s!==void 0?{...p,state:s}:p,[p,s]);return k.useEffect(()=>{f&&!Object.is(s,p.state)&&v({type:Gv,state:s})},[s,p.state,f]),[C,v]}Gs(d_,"useControllableStateReducer");var Q1=Xx(),h_=Object.defineProperty,Yn=(e,t)=>h_(e,"name",{value:t,configurable:!0});function Kh(e){const t=k.forwardRef((n,i)=>{let{children:s,...a}=n,l=null,c=!1;const f=[];Md(s)&&typeof dl=="function"&&(s=dl(s._payload)),k.Children.forEach(s,v=>{if(tk(v)){c=!0;const w=v;let S="child"in w.props?w.props.child:w.props.children;Md(S)&&typeof dl=="function"&&(S=dl(S._payload)),l=m_(w,S),f.push(l?.props?.children)}else f.push(v)}),l?l=k.cloneElement(l,void 0,f):!c&&k.Children.count(s)===1&&k.isValidElement(s)&&(l=s);const h=l?ek(l):void 0,m=jo(i,h);if(!l){if(s||s===0)throw new Error(c?v_(e):y_(e));return s}const p=Z1(a,l.props??{});return l.type!==k.Fragment&&(p.ref=i?m:h),k.cloneElement(l,p)});return t.displayName=`${e}.Slot`,t}Yn(Kh,"createSlot");var J1=Symbol.for("radix.slottable");function p_(e){const t=Yn(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=J1,t}Yn(p_,"createSlottable");var m_=Yn((e,t)=>{if("child"in e.props){const n=e.props.child;return k.isValidElement(n)?k.cloneElement(n,void 0,e.props.children(n.props.children)):null}return k.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Z1(e,t){const n={...t};for(const i in t){const s=e[i],a=t[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...c)=>{const f=a(...c);return s(...c),f}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}Yn(Z1,"mergeProps");function ek(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Yn(ek,"getElementRef");function tk(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J1}Yn(tk,"isSlottable");var g_=Symbol.for("react.lazy");function Md(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===g_&&"_payload"in e&&nk(e._payload)}Yn(Md,"isLazyComponent");function nk(e){return typeof e=="object"&&e!==null&&"then"in e}Yn(nk,"isPromiseLike");var y_=Yn(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),v_=Yn(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),dl=$s[" use ".trim().toString()],x_=Object.defineProperty,w_=(e,t)=>x_(e,"name",{value:t,configurable:!0}),k_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ii=k_.reduce((e,t)=>{const n=Kh(`Primitive.${t}`),i=k.forwardRef((s,a)=>{const{asChild:l,...c}=s,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(f,{...c,ref:a})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function rk(e,t){e&&Q1.flushSync(()=>e.dispatchEvent(t))}w_(rk,"dispatchDiscreteCustomEvent");var S_=Object.defineProperty,b_=(e,t)=>S_(e,"name",{value:t,configurable:!0});function Co(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>t.current?.(...n),[])}b_(Co,"useCallbackRef");var C_=Object.defineProperty,Nt=(e,t)=>C_(e,"name",{value:t,configurable:!0}),Id="dismissableLayer.update",E_="dismissableLayer.pointerDownOutside",T_="dismissableLayer.focusOutside",Qv,ik=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),P_=k.forwardRef(Nt(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,onDismiss:h,...m}=t,p=k.useContext(ik),[v,w]=k.useState(null),S=v?.ownerDocument??globalThis?.document,[,C]=k.useState({}),E=jo(n,w),R=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),T=A?R.indexOf(A):-1,P=v?R.indexOf(v):-1,O=p.layersWithOutsidePointerEventsDisabled.size>0,D=P>=T,H=k.useRef(!1),B=sk(V=>{l?.(V),f?.(V),V.defaultPrevented||h?.()},{ownerDocument:S,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:H,dismissableSurfaces:p.dismissableSurfaces,shouldHandlePointerDownOutside:k.useCallback(V=>{if(!(V instanceof Node))return!1;const ae=[...p.branches].some(J=>J.contains(V));return D&&!ae},[p.branches,D])}),_=ak(V=>{if(s&&H.current)return;const ae=V.target;[...p.branches].some(ee=>ee.contains(ae))||(c?.(V),f?.(V),V.defaultPrevented||h?.())},S),N=v?P===R.length-1:!1,q=Co(V=>{V.key==="Escape"&&(a?.(V),!V.defaultPrevented&&h&&(V.preventDefault(),h()))});return k.useEffect(()=>{if(N)return S.addEventListener("keydown",q,{capture:!0}),()=>S.removeEventListener("keydown",q,{capture:!0})},[S,N,q]),k.useEffect(()=>{if(v)return i&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Qv=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),Dd(),()=>{i&&(p.layersWithOutsidePointerEventsDisabled.delete(v),p.layersWithOutsidePointerEventsDisabled.size===0&&(S.body.style.pointerEvents=Qv))}},[v,S,i,p]),k.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),Dd())},[v,p]),k.useEffect(()=>{const V=Nt(()=>C({}),"handleUpdate");return document.addEventListener(Id,V),()=>document.removeEventListener(Id,V)},[]),y.jsx(Ii.div,{...m,ref:E,style:{pointerEvents:O?D?"auto":"none":void 0,...t.style},onFocusCapture:Jr(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Jr(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Jr(t.onPointerDownCapture,B.onPointerDownCapture)})},"DismissableLayer"));function ok(){const e=k.useContext(ik),[t,n]=k.useState(null);return k.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Nt(ok,"useDismissableLayerSurface");var R_=Nt(()=>!0,"IS_TRUE");function sk(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:a,shouldHandlePointerDownOutside:l=R_}=t,c=Co(e),f=k.useRef(!1),h=k.useRef(!1),m=k.useRef(new Map),p=k.useRef(()=>{});return k.useEffect(()=>{function v(){h.current=!1,s.current=!1,m.current.clear()}Nt(v,"resetOutsideInteraction");function w(){return Array.from(m.current.values()).some(Boolean)}Nt(w,"isOutsideInteractionIntercepted");function S(T){if(!h.current)return;const P=T.target;P instanceof Node&&[...a].some(D=>D.contains(P))||m.current.set(T.type,!0),T.type==="click"&&window.setTimeout(()=>{h.current&&p.current()},0)}Nt(S,"handleInteractionCapture");function C(T){h.current&&m.current.set(T.type,!1)}Nt(C,"handleInteractionBubble");const E=Nt(T=>{if(T.target&&!f.current){let P=function(){n.removeEventListener("click",p.current);const D=w();v(),D||qh(E_,c,O,{discrete:!0})};if(Nt(P,"handleAndDispatchPointerDownOutsideEvent"),!l(T.target)){n.removeEventListener("click",p.current),v(),f.current=!1;return}const O={originalEvent:T};h.current=!0,s.current=i&&T.button===0,m.current.clear(),!i||T.button!==0?P():(n.removeEventListener("click",p.current),p.current=P,n.addEventListener("click",p.current,{once:!0}))}else n.removeEventListener("click",p.current),v();f.current=!1},"handlePointerDown"),R=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const T of R)n.addEventListener(T,S,!0),n.addEventListener(T,C);const A=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(A),n.removeEventListener("pointerdown",E),n.removeEventListener("click",p.current);for(const T of R)n.removeEventListener(T,S,!0),n.removeEventListener(T,C)}},[n,c,i,s,a,l]),{onPointerDownCapture:Nt(()=>f.current=!0,"onPointerDownCapture")}}Nt(sk,"usePointerDownOutside");function ak(e,t=globalThis?.document){const n=Co(e),i=k.useRef(!1);return k.useEffect(()=>{const s=Nt(a=>{a.target&&!i.current&&qh(T_,n,{originalEvent:a},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:Nt(()=>i.current=!0,"onFocusCapture"),onBlurCapture:Nt(()=>i.current=!1,"onBlurCapture")}}Nt(ak,"useFocusOutside");function Dd(){const e=new CustomEvent(Id);document.dispatchEvent(e)}Nt(Dd,"dispatchUpdate");function qh(e,t,n,{discrete:i}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),i?rk(s,a):s.dispatchEvent(a)}Nt(qh,"handleAndDispatchCustomEvent");var A_=Object.defineProperty,on=(e,t)=>A_(e,"name",{value:t,configurable:!0}),Ef="focusScope.autoFocusOnMount",Tf="focusScope.autoFocusOnUnmount",Jv={bubbles:!1,cancelable:!0},j_=k.forwardRef(on(function(t,n){const{loop:i=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=t,[f,h]=k.useState(null),m=Co(a),p=Co(l),v=k.useRef(null),w=jo(n,h),S=k.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;k.useEffect(()=>{if(s){let E=function(P){if(S.paused||!f)return;const O=P.target;f.contains(O)?v.current=O:kr(v.current,{select:!0})},R=function(P){if(S.paused||!f)return;const O=P.relatedTarget;O!==null&&(f.contains(O)||kr(v.current,{select:!0}))},A=function(P){if(document.activeElement===document.body)for(const D of P)D.removedNodes.length>0&&kr(f)};on(E,"handleFocusIn"),on(R,"handleFocusOut"),on(A,"handleMutations"),document.addEventListener("focusin",E),document.addEventListener("focusout",R);const T=new MutationObserver(A);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",R),T.disconnect()}}},[s,f,S.paused]),k.useEffect(()=>{if(f){Zv.add(S);const E=document.activeElement;if(!f.contains(E)){const A=new CustomEvent(Ef,Jv);f.addEventListener(Ef,m),f.dispatchEvent(A),A.defaultPrevented||(lk(hk(Xh(f)),{select:!0}),document.activeElement===E&&kr(f))}return()=>{f.removeEventListener(Ef,m),setTimeout(()=>{const A=new CustomEvent(Tf,Jv);f.addEventListener(Tf,p),f.dispatchEvent(A),A.defaultPrevented||kr(E??document.body,{select:!0}),f.removeEventListener(Tf,p),Zv.remove(S)},0)}}},[f,m,p,S]);const C=k.useCallback(E=>{if(!i&&!s||S.paused)return;const R=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,A=document.activeElement;if(R&&A){const T=E.currentTarget,[P,O]=uk(T);P&&O?!E.shiftKey&&A===O?(E.preventDefault(),i&&kr(P,{select:!0})):E.shiftKey&&A===P&&(E.preventDefault(),i&&kr(O,{select:!0})):A===T&&E.preventDefault()}},[i,s,S.paused]);return y.jsx(Ii.div,{tabIndex:-1,...c,ref:w,onKeyDown:C})},"FocusScope"));function lk(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(kr(i,{select:t}),document.activeElement!==n)return}on(lk,"focusFirst");function uk(e){const t=Xh(e),n=_d(t,e),i=_d(t.reverse(),e);return[n,i]}on(uk,"getTabbableEdges");function Xh(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:on(i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}on(Xh,"getTabbableCandidates");function _d(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):ck(i,{upTo:t})))return i}on(_d,"findVisible");function ck(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}on(ck,"isHidden");function fk(e){return e instanceof HTMLInputElement&&"select"in e}on(fk,"isSelectableInput");function kr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fk(e)&&t&&e.select()}}on(kr,"focus");var Zv=dk();function dk(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ld(e,t),e.unshift(t)},remove(t){e=Ld(e,t),e[0]?.resume()}}}on(dk,"createFocusScopesStack");function Ld(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}on(Ld,"arrayRemove");function hk(e){return e.filter(t=>t.tagName!=="A")}on(hk,"removeLinks");var N_=Object.defineProperty,M_=(e,t)=>N_(e,"name",{value:t,configurable:!0}),I_=k.forwardRef(M_(function(t,n){const{container:i,...s}=t,[a,l]=k.useState(!1);ni(()=>l(!0),[]);const c=i||a&&globalThis?.document?.body;return c?Q1.createPortal(y.jsx(Ii.div,{...s,ref:n}),c):null},"Portal")),D_=Object.defineProperty,Sr=(e,t)=>D_(e,"name",{value:t,configurable:!0});function pk(e,t){return k.useReducer((n,i)=>t[n][i]??n,e)}Sr(pk,"useStateMachine");var Yh=Sr(e=>{const{present:t,children:n}=e,i=mk(t),s=typeof n=="function"?n({present:i.isPresent}):k.Children.only(n),a=gk(i.ref,yk(s));return typeof n=="function"||i.isPresent?k.cloneElement(s,{ref:a}):null},"Presence");function mk(e){const[t,n]=k.useState(),i=k.useRef(null),s=k.useRef(e),a=k.useRef("none"),l=k.useRef(void 0),c=e?"mounted":"unmounted",[f,h]=pk(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{f==="mounted"?(a.current=l.current??ho(i.current),l.current=void 0):a.current="none"},[f]),ni(()=>{const m=i.current,p=s.current;if(p!==e){const w=a.current,S=ho(m);e?(l.current=S,h("MOUNT")):S==="none"||m?.display==="none"?h("UNMOUNT"):h(p&&w!==S?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),ni(()=>{if(t){let m;const p=t.ownerDocument.defaultView??window,v=Sr(S=>{const E=ho(i.current).includes(CSS.escape(S.animationName));if(S.target===t&&E&&(h("ANIMATION_END"),!s.current)){const R=t.style.animationFillMode;t.style.animationFillMode="forwards",m=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=R)})}},"handleAnimationEnd"),w=Sr(S=>{S.target===t&&(a.current=ho(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{p.clearTimeout(m),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:k.useCallback(m=>{if(m){const p=getComputedStyle(m);i.current=p,l.current=ho(p)}else i.current=null;n(m)},[])}}Sr(mk,"usePresence");function Od(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Sr(Od,"setRef");function gk(...e){const t=k.useRef(e);return t.current=e,k.useCallback(n=>{const i=t.current;let s=!1;const a=i.map(l=>{const c=Od(l,n);return!s&&typeof c=="function"&&(s=!0),c});if(s)return()=>{for(let l=0;l<a.length;l++){const c=a[l];typeof c=="function"?c():Od(i[l],null)}}},[])}Sr(gk,"useStableComposedRefs");function ho(e){return e?.animationName||"none"}Sr(ho,"getAnimationName");function yk(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Sr(yk,"getElementRef");var __=Object.defineProperty,Gh=(e,t)=>__(e,"name",{value:t,configurable:!0}),hl=0,oo=null;function L_(e){return Qh(),e.children}Gh(L_,"FocusGuards");function Qh(){k.useEffect(()=>{oo||(oo={start:Fd(),end:Fd()});const{start:e,end:t}=oo;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),hl++,()=>{hl===1&&(oo?.start.remove(),oo?.end.remove(),oo=null),hl=Math.max(0,hl-1)}},[])}Gh(Qh,"useFocusGuards");function Fd(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Gh(Fd,"createFocusGuard");var ir=function(){return ir=Object.assign||function(t){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ir.apply(this,arguments)};function vk(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]]);return n}function O_(e,t,n){if(n||arguments.length===2)for(var i=0,s=t.length,a;i<s;i++)(a||!(i in t))&&(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return e.concat(a||Array.prototype.slice.call(t))}var Ml="right-scroll-bar-position",Il="width-before-scroll-bar",F_="with-scroll-bars-hidden",z_="--removed-body-scroll-bar-size";function Pf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function V_(e,t){var n=k.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(i){var s=n.value;s!==i&&(n.value=i,n.callback(i,s))}}}})[0];return n.callback=t,n.facade}var B_=typeof window<"u"?k.useLayoutEffect:k.useEffect,ex=new WeakMap;function $_(e,t){var n=V_(null,function(i){return e.forEach(function(s){return Pf(s,i)})});return B_(function(){var i=ex.get(n);if(i){var s=new Set(i),a=new Set(e),l=n.current;s.forEach(function(c){a.has(c)||Pf(c,null)}),a.forEach(function(c){s.has(c)||Pf(c,l)})}ex.set(n,e)},[e]),n}function U_(e){return e}function W_(e,t){t===void 0&&(t=U_);var n=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,i);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(i=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){i=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(a),l=n}var f=function(){var m=l;l=[],m.forEach(a)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(m){l.push(m),h()},filter:function(m){return l=l.filter(m),n}}}};return s}function H_(e){e===void 0&&(e={});var t=W_(null);return t.options=ir({async:!0,ssr:!1},e),t}var xk=function(e){var t=e.sideCar,n=vk(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return k.createElement(i,ir({},n))};xk.isSideCarExport=!0;function K_(e,t){return e.useMedium(t),xk}var wk=H_(),Rf=function(){},hu=k.forwardRef(function(e,t){var n=k.useRef(null),i=k.useState({onScrollCapture:Rf,onWheelCapture:Rf,onTouchMoveCapture:Rf}),s=i[0],a=i[1],l=e.forwardProps,c=e.children,f=e.className,h=e.removeScrollBar,m=e.enabled,p=e.shards,v=e.sideCar,w=e.noRelative,S=e.noIsolation,C=e.inert,E=e.allowPinchZoom,R=e.as,A=R===void 0?"div":R,T=e.gapMode,P=vk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=v,D=$_([n,t]),H=ir(ir({},P),s);return k.createElement(k.Fragment,null,m&&k.createElement(O,{sideCar:wk,removeScrollBar:h,shards:p,noRelative:w,noIsolation:S,inert:C,setCallbacks:a,allowPinchZoom:!!E,lockRef:n,gapMode:T}),l?k.cloneElement(k.Children.only(c),ir(ir({},H),{ref:D})):k.createElement(A,ir({},H,{className:f,ref:D}),c))});hu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hu.classNames={fullWidth:Il,zeroRight:Ml};var q_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function X_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=q_();return t&&e.setAttribute("nonce",t),e}function Y_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function G_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Q_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=X_())&&(Y_(t,n),G_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},J_=function(){var e=Q_();return function(t,n){k.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kk=function(){var e=J_(),t=function(n){var i=n.styles,s=n.dynamic;return e(i,s),null};return t},Z_={left:0,top:0,right:0,gap:0},Af=function(e){return parseInt(e||"",10)||0},eL=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Af(n),Af(i),Af(s)]},tL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Z_;var t=eL(e),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-n+t[2]-t[0])}},nL=kk(),vo="data-scroll-locked",rL=function(e,t,n,i){var s=e.left,a=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
273
273
  .`.concat(F_,` {
274
274
  overflow: hidden `).concat(i,`;
275
275
  padding-right: `).concat(c,"px ").concat(i,`;
@@ -320,7 +320,7 @@ ${a.join(`
320
320
  `});++i<e.length;)i&&n.push({type:"text",value:`
321
321
  `}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
322
322
  `}),n}function xx(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wx(e,t){const n=iF(e,t),i=n.one(e,void 0),s=nF(n),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
323
- `},s),a}function uF(e,t){return e&&"run"in e?async function(n,i){const s=wx(n,{file:i,...t});await e.run(s,i)}:function(n,i){return wx(n,{file:i,...e||t})}}function kx(e){if(e)throw e}var Df,Sx;function cF(){if(Sx)return Df;Sx=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},a=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var m=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},l=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(e.call(h,m)){if(i)return i(h,m).value}else return;return h[m]};return Df=function f(){var h,m,p,v,w,S,C=arguments[0],E=1,R=arguments.length,A=!1;for(typeof C=="boolean"&&(A=C,C=arguments[1]||{},E=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});E<R;++E)if(h=arguments[E],h!=null)for(m in h)p=c(C,m),v=c(h,m),C!==v&&(A&&v&&(a(v)||(w=s(v)))?(w?(w=!1,S=p&&s(p)?p:[]):S=p&&a(p)?p:{},l(C,{name:m,newValue:f(A,S,v)})):typeof v<"u"&&l(C,{name:m,newValue:v}));return C},Df}var fF=cF();const _f=Jd(fF);function Hd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function dF(){const e=[],t={run:n,use:i};return t;function n(...s){let a=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...s);function c(f,...h){const m=e[++a];let p=-1;if(f){l(f);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,m?hF(m,c)(...h):l(null,...h)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function hF(e,t){let n;return i;function i(...l){const c=e.length>l.length;let f;c&&l.push(s);try{f=e.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return s(m)}c||(f&&f.then&&typeof f.then=="function"?f.then(a,s):f instanceof Error?s(f):a(f))}function s(l,...c){n||(n=!0,t(l,...c))}function a(l){s(null,l)}}const nr={basename:pF,dirname:mF,extname:gF,join:yF,sep:"/"};function pF(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Js(e);let n=0,i=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else i<0&&(a=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let l=-1,c=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else l<0&&(a=!0,l=s+1),c>-1&&(e.codePointAt(s)===t.codePointAt(c--)?c<0&&(i=s):(c=-1,i=l));return n===i?i=l:i<0&&(i=e.length),e.slice(n,i)}function mF(e){if(Js(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function gF(e){Js(e);let t=e.length,n=-1,i=0,s=-1,a=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){i=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===i+1?"":e.slice(s,n)}function yF(...e){let t=-1,n;for(;++t<e.length;)Js(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":vF(n)}function vF(e){Js(e);const t=e.codePointAt(0)===47;let n=xF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xF(e,t){let n="",i=0,s=-1,a=0,l=-1,c,f;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(s===l-1||a===1))if(s!==l-1&&a===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),s=l,a=0;continue}}else if(n.length>0){n="",i=0,s=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),i=l-s-1;s=l,a=0}else c===46&&a>-1?a++:a=-1}return n}function Js(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wF={cwd:kF};function kF(){return"/"}function Kd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function SF(e){if(typeof e=="string")e=new URL(e);else if(!Kd(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return bF(e)}function bF(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Lf=["history","path","basename","stem","extname","dirname"];class rS{constructor(t){let n;t?Kd(t)?n={path:t}:typeof t=="string"||CF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":wF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Lf.length;){const a=Lf[i];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)Lf.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?nr.basename(this.path):void 0}set basename(t){Ff(t,"basename"),Of(t,"basename"),this.path=nr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?nr.dirname(this.path):void 0}set dirname(t){bx(this.basename,"dirname"),this.path=nr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?nr.extname(this.path):void 0}set extname(t){if(Of(t,"extname"),bx(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=nr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Kd(t)&&(t=SF(t)),Ff(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?nr.basename(this.path,this.extname):void 0}set stem(t){Ff(t,"stem"),Of(t,"stem"),this.path=nr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const s=this.message(t,n,i);throw s.fatal=!0,s}info(t,n,i){const s=this.message(t,n,i);return s.fatal=void 0,s}message(t,n,i){const s=new qt(t,n,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Of(e,t){if(e&&e.includes(nr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+nr.sep+"`")}function Ff(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function bx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function CF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const EF=function(e){const i=this.constructor.prototype,s=i[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,i),a},TF={}.hasOwnProperty;class cp extends EF{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=dF()}copy(){const t=new cp;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(_f(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bf("data",this.frozen),this.namespace[t]=n,this):TF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=n.call(t,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=wl(t),i=this.parser||this.Parser;return zf("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),zf("process",this.parser||this.Parser),Vf("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,l){const c=wl(t),f=i.parse(c);i.run(f,c,function(m,p,v){if(m||!p||!v)return h(m);const w=p,S=i.stringify(w,v);AF(S)?v.value=S:v.result=S,h(m,v)});function h(m,p){m||!p?l(m):a?a(p):n(void 0,p)}}}processSync(t){let n=!1,i;return this.freeze(),zf("processSync",this.parser||this.Parser),Vf("processSync",this.compiler||this.Compiler),this.process(t,s),Ex("processSync","process",n),i;function s(a,l){n=!0,kx(a),i=l}}run(t,n,i){Cx(t),this.freeze();const s=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?a(void 0,i):new Promise(a);function a(l,c){const f=wl(n);s.run(t,f,h);function h(m,p,v){const w=p||t;m?c(m):l?l(w):i(void 0,w,v)}}}runSync(t,n){let i=!1,s;return this.run(t,n,a),Ex("runSync","run",i),s;function a(l,c){kx(l),s=c,i=!0}}stringify(t,n){this.freeze();const i=wl(n),s=this.compiler||this.Compiler;return Vf("stringify",s),Cx(t),s(t,i)}use(t,...n){const i=this.attachers,s=this.namespace;if(Bf("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[m,...p]=h;f(m,p)}else l(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function l(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(h.plugins),h.settings&&(s.settings=_f(!0,s.settings,h.settings))}function c(h){let m=-1;if(h!=null)if(Array.isArray(h))for(;++m<h.length;){const p=h[m];a(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,m){let p=-1,v=-1;for(;++p<i.length;)if(i[p][0]===h){v=p;break}if(v===-1)i.push([h,...m]);else if(m.length>0){let[w,...S]=m;const C=i[v][1];Hd(C)&&Hd(w)&&(w=_f(!0,C,w)),i[v]=[h,w,...S]}}}}const PF=new cp().freeze();function zf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Cx(e){if(!Hd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ex(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function wl(e){return RF(e)?e:new rS(e)}function RF(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function AF(e){return typeof e=="string"||jF(e)}function jF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tx=[],Px={allowDangerousHtml:!0},MF=/^(https?|ircs?|mailto|xmpp)$/i,IF=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function iS(e){const t=DF(e),n=_F(e);return LF(t.runSync(t.parse(n),n),e)}function DF(e){const t=e.rehypePlugins||Tx,n=e.remarkPlugins||Tx,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Px}:Px;return PF().use(bO).use(n).use(uF,i).use(t)}function _F(e){const t=e.children||"",n=new rS;return typeof t=="string"&&(n.value=t),n}function LF(e,t){const n=t.allowedElements,i=t.allowElement,s=t.components,a=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,f=t.urlTransform||OF;for(const m of IF)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+NF+m.id,void 0);return Dh(e,h),aO(e,{Fragment:y.Fragment,components:s,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function h(m,p,v){if(m.type==="raw"&&v&&typeof p=="number")return l?v.children.splice(p,1):v.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let w;for(w in If)if(Object.hasOwn(If,w)&&Object.hasOwn(m.properties,w)){const S=m.properties[w],C=If[w];(C===null||C.includes(m.tagName))&&(m.properties[w]=f(String(S||""),w,m))}}if(m.type==="element"){let w=n?!n.includes(m.tagName):a?a.includes(m.tagName):!1;if(!w&&i&&typeof p=="number"&&(w=!i(m,p,v)),w&&v&&typeof p=="number")return c&&m.children?v.children.splice(p,1,...m.children):v.children.splice(p,1),p}}}function OF(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||i!==-1&&t>i||MF.test(e.slice(0,t))?e:""}const FF={};function oS(e){const t=this,n=e||FF,i=t.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),a=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(j1(n)),a.push(l1()),l.push(K2(n))}function Zs(e){const t=k.useRef(null);return k.useEffect(()=>(t.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>{const n=t.current;n?.isConnected&&requestAnimationFrame(()=>n.focus())}),[]),y.jsx(Rk,{open:!0,onOpenChange:n=>{n||e.onClose()},children:y.jsxs(Nk,{children:[y.jsx(Mk,{className:"modal-backdrop"}),y.jsxs(Ik,{id:e.contentId,className:"modal"+(e.wide?" modal-wide":"")+(e.className?` ${e.className}`:""),children:[y.jsxs("div",{className:"modal-head",children:[y.jsxs("div",{children:[y.jsx(_k,{asChild:!0,children:y.jsx("h3",{children:e.title})}),e.description&&y.jsx(Lk,{className:"modal-description",children:e.description})]}),y.jsx(Ok,{asChild:!0,children:y.jsx("button",{className:"icon-btn","aria-label":`Close ${e.title}`,children:y.jsx(Se,{name:"close"})})})]}),e.tabs,y.jsx("div",{className:"modal-body",children:e.children})]})]})})}const zF=.25,VF=8;let Rx=Promise.resolve();function Ax(){return document.documentElement.classList.contains("theme-dark")?"dark":"default"}function BF(){const[e,t]=k.useState(Ax);return k.useEffect(()=>{const n=document.documentElement,i=()=>t(Ax()),s=new MutationObserver(i);return s.observe(n,{attributes:!0,attributeFilter:["class"]}),i(),()=>s.disconnect()},[]),e}function $F(e,t,n){const i=Rx.then(async()=>{const{default:s}=await Wh(async()=>{const{default:a}=await import("./mermaid.core-ZtqQ8zsB.js").then(l=>l.bp);return{default:a}},[]);return s.initialize({startOnLoad:!1,securityLevel:"strict",theme:n,fontFamily:"var(--sans)"}),s.render(e,t)});return Rx=i.then(()=>{},()=>{}),i}function UF(e){return Math.min(VF,Math.max(zF,e))}function WF(e){const t=k.useRef(null),n=k.useRef(null),[i,s]=k.useState(1),[a,l]=k.useState({x:0,y:0}),[c,f]=k.useState(!1),h=()=>{s(1),l({x:0,y:0})},m=(p,v,w)=>{const S=UF(p);if(S===i)return;const C=t.current?.getBoundingClientRect();if(C){const E=(v??C.left+C.width/2)-C.left-C.width/2,R=(w??C.top+C.height/2)-C.top-C.height/2,A=S/i;l(T=>({x:E-A*(E-T.x),y:R-A*(R-T.y)}))}s(S)};return k.useEffect(()=>{const p=v=>{v.key==="+"||v.key==="="?(v.preventDefault(),m(i*1.25)):v.key==="-"?(v.preventDefault(),m(i/1.25)):v.key==="0"&&(v.preventDefault(),h())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)}),y.jsx(Rk,{open:!0,onOpenChange:p=>{p||e.onClose()},children:y.jsxs(Nk,{children:[y.jsx(Mk,{className:"mermaid-fullscreen-backdrop"}),y.jsxs(Ik,{className:"mermaid-fullscreen","data-mermaid-theme":e.theme,"aria-describedby":"mermaid-fullscreen-help",children:[y.jsx(_k,{className:"mermaid-fullscreen-title",children:"Diagram viewer"}),y.jsxs("div",{className:"mermaid-fullscreen-tools",children:[y.jsx("button",{className:"icon-btn","aria-label":"Zoom out",title:"Zoom out (−)",onClick:()=>m(i/1.25),children:y.jsx(Se,{name:"minus"})}),y.jsxs("button",{className:"mermaid-zoom-value",onClick:h,title:"Reset zoom and position",children:[Math.round(i*100),"%"]}),y.jsx("button",{className:"icon-btn","aria-label":"Zoom in",title:"Zoom in (+)",onClick:()=>m(i*1.25),children:y.jsx(Se,{name:"plus"})}),y.jsx(Ok,{asChild:!0,children:y.jsx("button",{className:"icon-btn","aria-label":"Close diagram viewer",title:"Close (Esc)",children:y.jsx(Se,{name:"close"})})})]}),y.jsx("div",{ref:t,className:"mermaid-fullscreen-viewport"+(c?" dragging":""),onWheel:p=>{p.preventDefault(),m(i*Math.exp(-p.deltaY*.0015),p.clientX,p.clientY)},onDoubleClick:p=>m(i*1.5,p.clientX,p.clientY),onPointerDown:p=>{p.button===0&&(n.current={pointerId:p.pointerId,startX:p.clientX,startY:p.clientY,panX:a.x,panY:a.y},p.currentTarget.setPointerCapture(p.pointerId),f(!0))},onPointerMove:p=>{const v=n.current;!v||v.pointerId!==p.pointerId||l({x:v.panX+p.clientX-v.startX,y:v.panY+p.clientY-v.startY})},onPointerUp:p=>{n.current?.pointerId===p.pointerId&&(n.current=null,f(!1),p.currentTarget.releasePointerCapture(p.pointerId))},onPointerCancel:()=>{n.current=null,f(!1)},children:y.jsx("div",{className:"mermaid-fullscreen-canvas",style:{transform:`translate(${a.x}px, ${a.y}px) scale(${i})`},dangerouslySetInnerHTML:{__html:e.svg}})}),y.jsx(Lk,{id:"mermaid-fullscreen-help",className:"mermaid-fullscreen-help",children:"Scroll to zoom · drag to move · double-click to zoom in"})]})]})})}function HF({source:e}){const t=k.useId(),[n,i]=k.useState(""),[s,a]=k.useState(""),[l,c]=k.useState("default"),[f,h]=k.useState(!1),m=BF();return k.useEffect(()=>{let p=!0;const v=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"")}`;return i(""),a(""),$F(v,e,m).then(w=>{p&&(c(m),i(w.svg))}).catch(w=>{p&&a(w instanceof Error?w.message:String(w))}),()=>{p=!1,document.getElementById(`d${v}`)?.remove()}},[t,e,m]),s?y.jsxs("pre",{className:"markdown-mermaid-error",children:["Mermaid error: ",s]}):n?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"markdown-mermaid","data-mermaid-theme":l,children:[y.jsx("button",{className:"icon-btn markdown-mermaid-expand","aria-label":"View diagram fullscreen",title:"View diagram fullscreen",onClick:()=>h(!0),children:y.jsx(Se,{name:"maximize"})}),y.jsx("div",{className:"markdown-mermaid-diagram",dangerouslySetInnerHTML:{__html:n}})]}),f&&y.jsx(WF,{svg:n,theme:l,onClose:()=>h(!1)})]}):y.jsx("div",{className:"markdown-mermaid-loading",children:"Rendering diagram…"})}const KF=k.memo(function(t){return y.jsx("article",{className:"markdown-body",ref:t.contentRef,children:y.jsx(iS,{remarkPlugins:[oS],components:{a:({children:n,...i})=>y.jsx("a",{...i,target:"_blank",rel:"noreferrer",children:n}),code:({className:n,children:i,...s})=>{const a=/language-([\w-]+)/.exec(n??"")?.[1],l=String(i).replace(/\n$/,"");return a==="mermaid"?y.jsx(HF,{source:l}):y.jsx("code",{className:n,...s,children:i})}},children:t.markdown})})});function sS(e){const{rec:t}=e,n=k.useRef(null),[i,s]=k.useState(""),[a,l]=k.useState(null),[c,f]=k.useState("loading"),[h,m]=k.useState(""),[p,v]=k.useState(0),[w,S]=k.useState(""),[C,E]=k.useState(0),[R,A]=k.useState(!1),[T,P]=k.useState(""),[O,D]=k.useState(!1),[H,B]=k.useState(!1),[_,N]=k.useState([]),[q,V]=k.useState(!1),[ae,J]=k.useState(null),[ee,ge]=k.useState(!1),[we,G]=k.useState("");k.useEffect(()=>{let M=!0,Z=null;return f("loading"),lu(t.id).then(ye=>{if(M){if(!ye){f("missing");return}s(new TextDecoder("utf-8").decode(ye)),Z=URL.createObjectURL(new Blob([ye],{type:"text/markdown;charset=utf-8"})),l(Z),f("ready")}}).catch(()=>{M&&f("error")}),()=>{M=!1,Z&&URL.revokeObjectURL(Z)}},[t.id]),k.useEffect(()=>{const M=()=>{const Z=window.getSelection(),ye=n.current;if(!Z||Z.isCollapsed||!ye){m(""),v(0);return}if(!ye.contains(Z.anchorNode)||!ye.contains(Z.focusNode)){m(""),v(0);return}const me=Z.getRangeAt(0),he=Z.toString(),be=he.length-he.trimStart().length,xe=he.trim().slice(0,4e3),Be=document.createRange();Be.selectNodeContents(ye),Be.setEnd(me.startContainer,me.startOffset);const Oe=Be.toString().length+be;m(xe),v(vD(ye.textContent,xe,Oe))};return document.addEventListener("selectionchange",M),()=>document.removeEventListener("selectionchange",M)},[]);const le=()=>{h&&(S(h),E(p),A(!0),G(""))},j=async()=>{if(H){if(!w||!T.trim())return;N(Z=>[...Z,{selection:w,comment:T.trim(),occurrence:C}]),P(""),A(!1),G("Comment added to review");return}const M=gD(w,T);if(!(!M||!T.trim()||O)){D(!0),G("");try{await e.onSendText(M,t.id||void 0),P(""),A(!1),G("Feedback sent")}catch(Z){G(`Send failed: ${String(Z)}`)}finally{D(!1)}}},F=async()=>{if(_.length===0||q)return;const M=CD(i,_);V(!0),G("");try{e.onSendFile?await e.onSendFile({filename:yD(t.filename),mime:"text/markdown",bytes:new TextEncoder().encode(M)},t.id||void 0):await e.onSendText(M,t.id||void 0),N([]),B(!1),G("Review submitted")}catch(Z){G(`Review send failed: ${String(Z)}`)}finally{V(!1)}},Q=async()=>{if(!(!ae||!e.onSendFile||ee)){ge(!0),G("");try{await e.onSendFile(ae,t.id||void 0),J(null),G("Voice feedback sent")}catch(M){G(`Voice send failed: ${String(M)}`)}finally{ge(!1)}}};return y.jsx(Zs,{title:t.filename,description:"Markdown preview · select text to send precise feedback",onClose:e.onClose,wide:!0,className:"markdown-modal",children:y.jsxs("div",{className:"markdown-preview",children:[y.jsxs("div",{className:"markdown-review-toolbar",children:[y.jsxs("button",{className:"btn sm",disabled:!h,onMouseDown:M=>M.preventDefault(),onClick:le,children:[y.jsx(Se,{name:"reply",size:14}),H?"Add review comment":"Quick message",h?` (${h.length})`:""]}),H?y.jsx("button",{className:"btn sm",onClick:()=>{B(!1),N([]),A(!1),G("Review discarded")},children:"Cancel review"}):y.jsxs("button",{className:"btn sm",onClick:()=>{B(!0),N([]),G("Review started — select passages to add comments")},children:[y.jsx(Se,{name:"edit",size:14}),"Start review"]}),a&&y.jsxs("a",{className:"btn sm",href:a,download:t.filename,children:[y.jsx(Se,{name:"download",size:14}),"Download"]}),e.onSendFile&&y.jsx(V1,{disabled:!!ae||ee,onReady:J,onError:G}),y.jsx("span",{className:"markdown-review-hint",children:h?"Selection ready for feedback":"Highlight any passage to comment on it"})]}),R&&y.jsxs("div",{className:"markdown-feedback",children:[y.jsx("blockquote",{children:w}),y.jsx("textarea",{className:"field",rows:3,autoFocus:!0,placeholder:"What should change?",value:T,onChange:M=>P(M.target.value)}),y.jsxs("div",{className:"markdown-feedback-actions",children:[y.jsx("button",{className:"btn sm",onClick:()=>A(!1),children:"Cancel"}),y.jsxs("button",{className:"btn sm primary",disabled:!T.trim()||O,onClick:()=>void j(),children:[y.jsx(Se,{name:"send",size:14}),H?"Add to review":O?"Sending…":"Send feedback"]})]})]}),H&&y.jsxs("div",{className:"markdown-review-draft",children:[y.jsxs("div",{className:"markdown-review-draft-head",children:[y.jsxs("strong",{children:["Review · ",_.length," comment",_.length===1?"":"s"]}),y.jsxs("button",{className:"btn sm primary",disabled:_.length===0||q,onClick:()=>void F(),children:[y.jsx(Se,{name:"send",size:14}),q?"Submitting…":"Submit review"]})]}),_.map((M,Z)=>y.jsxs("div",{className:"markdown-review-comment",children:[y.jsx("span",{children:Z+1}),y.jsxs("div",{children:[y.jsx("blockquote",{children:M.selection}),y.jsx("p",{children:M.comment})]}),y.jsx("button",{className:"icon-btn",title:"Remove comment",onClick:()=>N(ye=>ye.filter((me,he)=>he!==Z)),children:y.jsx(Se,{name:"close",size:14})})]},`${Z}-${M.selection.slice(0,24)}`))]}),ae&&y.jsx(z1,{att:ae,sending:ee,onSend:()=>void Q(),onDiscard:()=>J(null)}),we&&y.jsx("div",{className:"markdown-review-status",role:"status",children:we}),y.jsxs("div",{className:"markdown-preview-scroll",children:[c==="loading"&&y.jsx("div",{className:"markdown-empty",children:"Loading preview…"}),c==="missing"&&y.jsx("div",{className:"markdown-empty",children:"This file is available on the original device only."}),c==="error"&&y.jsx("div",{className:"markdown-empty",children:"The file could not be opened."}),c==="ready"&&y.jsx(KF,{markdown:i,contentRef:n})]})]})})}function aS(e){const{rec:t}=e,[n,i]=k.useState(null),[s,a]=k.useState(0),[l,c]=k.useState(!1),[f,h]=k.useState("loading");return k.useEffect(()=>{let m=!0,p=null;return h("loading"),lu(t.id).then(v=>{if(m){if(!v){h("missing");return}a(v.byteLength),p=URL.createObjectURL(new Blob([v],{type:Vh(t.mime,t.filename)})),i(p),h("ready")}}).catch(()=>{m&&h("error")}),()=>{m=!1,p&&URL.revokeObjectURL(p)}},[t.id,t.mime,t.filename]),y.jsx(Zs,{title:t.filename,description:"Transformed safe preview · external navigation disabled",onClose:e.onClose,wide:!0,className:"markdown-modal html-modal"+(l?" html-modal-fullscreen":""),children:y.jsxs("div",{className:"html-preview",children:[y.jsxs("div",{className:"html-preview-toolbar",children:[y.jsxs("span",{className:"html-preview-shield",children:[y.jsx(Se,{name:"shield",size:14}),"Scripts, forms and network requests are blocked"]}),y.jsxs("span",{className:"html-preview-actions",children:[f==="ready"&&y.jsxs("button",{className:"btn sm",type:"button",title:"View HTML fullscreen","aria-label":"View HTML fullscreen",onClick:()=>c(!0),children:[y.jsx(Se,{name:"maximize",size:14}),"Fullscreen"]}),n&&y.jsxs("a",{className:"btn sm",href:n,download:t.filename,children:[y.jsx(Se,{name:"download",size:14}),"Download original",s?` · ${ti(s)}`:""]})]})]}),y.jsxs("div",{className:"html-preview-frame",children:[f==="loading"&&y.jsx("div",{className:"markdown-empty",children:"Loading preview…"}),f==="missing"&&y.jsx("div",{className:"markdown-empty",children:"This file is available on the original device only."}),f==="error"&&y.jsx("div",{className:"markdown-empty",children:"The file could not be opened."}),f==="ready"&&y.jsx("iframe",{className:"html-preview-iframe",title:`Sandboxed preview of ${t.filename}`,sandbox:ED,referrerPolicy:"no-referrer",src:`/api/html-preview/${encodeURIComponent(t.id)}`},t.id)]})]})})}function lS(e){const t=(n,i)=>{const{key:s}=n;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(s))return;n.preventDefault();const a=e.options.length-1,l=s==="Home"?0:s==="End"?a:s==="ArrowLeft"||s==="ArrowUp"?(i-1+e.options.length)%e.options.length:(i+1)%e.options.length,c=e.options[l];c&&(e.onChange(c.id),document.getElementById(`${e.idPrefix}-${c.id}`)?.focus())};return y.jsx("div",{className:e.className,role:"tablist","aria-label":e.label,children:e.options.map((n,i)=>y.jsxs("button",{id:`${e.idPrefix}-${n.id}`,type:"button",role:"tab","aria-selected":e.value===n.id,"aria-controls":e.panelId,tabIndex:e.value===n.id?0:-1,className:"tab"+(e.value===n.id?" active":""),onClick:()=>e.onChange(n.id),onKeyDown:s=>t(s,i),children:[n.label,n.count===void 0?null:y.jsxs(y.Fragment,{children:[" ",y.jsx("span",{children:n.count})]})]},n.id))})}function qd(e){const{message:t}=e,[n,i]=k.useState(null),[s,a]=k.useState(0),l=$0(t.wireId)??{id:t.wireId,dir:t.dir,filename:t.filename??"file",mime:t.mime??"application/octet-stream",size:s,date:t.date};k.useEffect(()=>{let h=!0,m=null;if(t.wireId)return lu(t.wireId).then(p=>{!h||!p||(a(p.byteLength),m=URL.createObjectURL(new Blob([p],{type:Vh(l.mime,l.filename)})),i(m))}).catch(()=>{}),()=>{h=!1,m&&URL.revokeObjectURL(m)}},[t.wireId,l.mime,l.filename]);const c=Rd(t)==="photo",f=So(l.mime,l.filename);return y.jsxs("div",{className:"shared-media-item"+(c?" shared-photo-item":""),children:[y.jsxs("button",{className:"shared-media-jump",onClick:()=>e.onJump(e.messageKey),children:[c&&n?y.jsx("img",{src:n,alt:l.filename}):y.jsx("span",{className:"shared-media-icon",children:y.jsx(Se,{name:f?"mic":"copy",size:18})}),y.jsxs("span",{className:"shared-media-copy",children:[y.jsx("strong",{children:c?l.filename||"Photo":f?"Voice message":l.filename}),y.jsxs("span",{children:[e.versionLabel?`${e.versionLabel} · `:"",ji(l.date),s?` · ${ti(s)}`:""]})]})]}),y.jsxs("span",{className:"shared-media-actions",children:[N1(l.filename)&&n&&y.jsx("button",{className:"icon-btn",title:"Preview markdown",onClick:()=>e.onPreview(l),children:y.jsx(Se,{name:"monitor",size:16})}),Ys(l.filename,l.mime)&&n&&y.jsx("button",{className:"icon-btn",title:"Preview HTML",onClick:()=>e.onPreview(l),children:y.jsx(Se,{name:"monitor",size:16})}),y.jsx("a",{className:"icon-btn"+(n?"":" disabled"),href:n??void 0,download:l.filename,title:"Download",children:y.jsx(Se,{name:"download",size:16})})]})]})}function qF(e){const[t,n]=k.useState(!1);if(e.versions.length===1){const i=e.versions[0];return y.jsx(qd,{message:i.message,messageKey:i.key,onJump:e.onJump,onPreview:e.onPreview})}return y.jsxs("div",{className:"file-version-stack"+(t?" expanded":""),children:[y.jsxs("button",{className:"file-version-stack-head",onClick:()=>n(i=>!i),children:[y.jsx("span",{className:"shared-media-icon",children:y.jsx(Se,{name:"copy",size:18})}),y.jsxs("span",{className:"shared-media-copy",children:[y.jsx("strong",{children:e.filename}),y.jsxs("span",{children:[e.versions.length," versions · newest ",ji(e.versions[0].message.date)]})]}),y.jsx(Se,{name:t?"chevronDown":"chevron",size:16})]}),t&&y.jsx("div",{className:"file-version-stack-list",children:e.versions.map((i,s)=>y.jsx(qd,{message:i.message,messageKey:i.key,versionLabel:`Version ${e.versions.length-s}`,onJump:e.onJump,onPreview:e.onPreview},i.key))})]})}function XF(e){const[t,n]=k.useState("photo"),i=e.messages.map((h,m)=>({message:h,key:h.wireId||`${h.date}-${(e.indexOffset??0)+m}`})),s=i.filter(({message:h})=>Rd(h)==="photo"),a=i.filter(({message:h})=>Rd(h)==="file"),l=wD(a),c=i.flatMap(({message:h,key:m})=>h.kind==="file"?[]:xD(h.text).map(p=>({url:p,message:h,key:m}))),f=[{id:"photo",label:"Photos",count:s.length},{id:"file",label:"Files",count:a.length},{id:"link",label:"Links",count:c.length}];return y.jsx(Zs,{title:"Shared media",description:"Photos, files, and links from this conversation",onClose:e.onClose,wide:!0,className:"shared-media-modal",tabs:y.jsx(lS,{className:"shared-media-tabs",label:"Shared media type",options:f,value:t,onChange:n,idPrefix:"shared-media-tab",panelId:"shared-media-panel"}),children:y.jsxs("div",{id:"shared-media-panel",role:"tabpanel","aria-labelledby":`shared-media-tab-${t}`,className:"shared-media-list"+(t==="photo"?" photos":""),children:[t==="photo"&&s.map(h=>y.jsx(qd,{message:h.message,messageKey:h.key,onJump:e.onJump,onPreview:e.onPreview},h.key)),t==="file"&&l.map(h=>y.jsx(qF,{filename:h.filename,versions:h.versions,onJump:e.onJump,onPreview:e.onPreview},h.filename)),t==="link"&&c.map((h,m)=>y.jsxs("div",{className:"shared-media-item",children:[y.jsxs("a",{className:"shared-media-jump",href:h.url,target:"_blank",rel:"noreferrer",children:[y.jsx("span",{className:"shared-media-icon",children:y.jsx(Se,{name:"link",size:18})}),y.jsxs("span",{className:"shared-media-copy",children:[y.jsx("strong",{children:h.url}),y.jsx("span",{children:ji(h.message.date)})]})]}),y.jsx("button",{className:"icon-btn",title:"Jump to message",onClick:()=>e.onJump(h.key),children:y.jsx(Se,{name:"reply",size:16})})]},`${h.key}-${h.url}-${m}`)),(t==="photo"&&s.length===0||t==="file"&&a.length===0||t==="link"&&c.length===0)&&y.jsxs("div",{className:"markdown-empty",children:["No ",t==="photo"?"photos":`${t}s`," in this chat yet."]})]})})}const YF=Object.freeze(["image/avif","image/bmp","image/heic","image/heif","image/jpeg","image/jpg","image/png","image/webp"]),GF=/\.(avif|bmp|heic|heif|jpe?g|png|webp)$/i;function uS(e,t=""){return YF.includes(String(e??"").toLowerCase())||GF.test(String(t??""))}function QF(e){return`${(String(e||"photo").trim()||"photo").replace(/\.[^./\\]+$/,"")||"photo"}.jpg`}function JF(e,t,n){const i=Math.max(1,Number(e)||1),s=Math.max(1,Number(t)||1),a=Math.max(1,Number(n)||1),l=Math.min(1,a/Math.max(i,s));return{width:Math.max(1,Math.round(i*l)),height:Math.max(1,Math.round(s*l))}}const ZF=2048,ez=640,tz=.82,nz=[.84,.7,.56,.44],rz=.94;function iz(e){return new Promise((t,n)=>{const i=URL.createObjectURL(e),s=new Image,a=()=>URL.revokeObjectURL(i);s.onload=()=>t({image:s,release:a}),s.onerror=()=>{a(),n(new Error("This browser could not decode the selected image."))},s.src=i})}function oz(e,t){return new Promise((n,i)=>{e.toBlob(s=>s?n(s):i(new Error("This browser could not encode the optimized photo.")),"image/jpeg",t)})}async function sz(e,t){if(!uS(e.type,e.name))throw new Error("This image format cannot be optimized safely in this browser.");const n=Math.max(1,Math.floor(t*rz)),{image:i,release:s}=await iz(e),a=document.createElement("canvas"),l=a.getContext("2d",{alpha:!1});if(!l)throw s(),new Error("Photo optimization is unavailable in this browser.");try{let c=Math.min(ZF,Math.max(i.naturalWidth,i.naturalHeight));for(;c>=ez;){const f=JF(i.naturalWidth,i.naturalHeight,c);a.width=f.width,a.height=f.height,l.fillStyle="#fff",l.fillRect(0,0,a.width,a.height),l.drawImage(i,0,0,a.width,a.height);for(const h of nz){const m=await oz(a,h);if(m.size<=n)return{filename:QF(e.name),mime:"image/jpeg",bytes:new Uint8Array(await m.arrayBuffer()),width:a.width,height:a.height,originalSize:e.size}}c=Math.floor(c*tz)}}finally{s(),a.width=1,a.height=1}throw new Error("The photo is still too large after optimization.")}const az=5e4,lz=new Set(["http:","https:","mailto:"]);function cS(e){if(!(!e||e!==e.trim()||/[\u0000-\u001f\u007f]/u.test(e)))try{const t=new URL(e);return lz.has(t.protocol.toLowerCase())?e:void 0}catch{return}}function fS(e){const t="language-";return e?.startsWith(t)&&e.slice(t.length)||void 0}function uz(e){return e.split(/(\n[ \t]*\n)/).map(t=>{if(/^\n[ \t]*\n$/.test(t))return t;const n=t.split(`
323
+ `},s),a}function uF(e,t){return e&&"run"in e?async function(n,i){const s=wx(n,{file:i,...t});await e.run(s,i)}:function(n,i){return wx(n,{file:i,...e||t})}}function kx(e){if(e)throw e}var Df,Sx;function cF(){if(Sx)return Df;Sx=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},a=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var m=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!m&&!p)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},l=function(h,m){n&&m.name==="__proto__"?n(h,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):h[m.name]=m.newValue},c=function(h,m){if(m==="__proto__")if(e.call(h,m)){if(i)return i(h,m).value}else return;return h[m]};return Df=function f(){var h,m,p,v,w,S,C=arguments[0],E=1,R=arguments.length,A=!1;for(typeof C=="boolean"&&(A=C,C=arguments[1]||{},E=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});E<R;++E)if(h=arguments[E],h!=null)for(m in h)p=c(C,m),v=c(h,m),C!==v&&(A&&v&&(a(v)||(w=s(v)))?(w?(w=!1,S=p&&s(p)?p:[]):S=p&&a(p)?p:{},l(C,{name:m,newValue:f(A,S,v)})):typeof v<"u"&&l(C,{name:m,newValue:v}));return C},Df}var fF=cF();const _f=Jd(fF);function Hd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function dF(){const e=[],t={run:n,use:i};return t;function n(...s){let a=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...s);function c(f,...h){const m=e[++a];let p=-1;if(f){l(f);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,m?hF(m,c)(...h):l(null,...h)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function hF(e,t){let n;return i;function i(...l){const c=e.length>l.length;let f;c&&l.push(s);try{f=e.apply(this,l)}catch(h){const m=h;if(c&&n)throw m;return s(m)}c||(f&&f.then&&typeof f.then=="function"?f.then(a,s):f instanceof Error?s(f):a(f))}function s(l,...c){n||(n=!0,t(l,...c))}function a(l){s(null,l)}}const nr={basename:pF,dirname:mF,extname:gF,join:yF,sep:"/"};function pF(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Js(e);let n=0,i=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else i<0&&(a=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let l=-1,c=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else l<0&&(a=!0,l=s+1),c>-1&&(e.codePointAt(s)===t.codePointAt(c--)?c<0&&(i=s):(c=-1,i=l));return n===i?i=l:i<0&&(i=e.length),e.slice(n,i)}function mF(e){if(Js(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function gF(e){Js(e);let t=e.length,n=-1,i=0,s=-1,a=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){i=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===i+1?"":e.slice(s,n)}function yF(...e){let t=-1,n;for(;++t<e.length;)Js(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":vF(n)}function vF(e){Js(e);const t=e.codePointAt(0)===47;let n=xF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xF(e,t){let n="",i=0,s=-1,a=0,l=-1,c,f;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(s===l-1||a===1))if(s!==l-1&&a===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),s=l,a=0;continue}}else if(n.length>0){n="",i=0,s=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),i=l-s-1;s=l,a=0}else c===46&&a>-1?a++:a=-1}return n}function Js(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wF={cwd:kF};function kF(){return"/"}function Kd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function SF(e){if(typeof e=="string")e=new URL(e);else if(!Kd(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return bF(e)}function bF(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Lf=["history","path","basename","stem","extname","dirname"];class rS{constructor(t){let n;t?Kd(t)?n={path:t}:typeof t=="string"||CF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":wF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Lf.length;){const a=Lf[i];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)Lf.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?nr.basename(this.path):void 0}set basename(t){Ff(t,"basename"),Of(t,"basename"),this.path=nr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?nr.dirname(this.path):void 0}set dirname(t){bx(this.basename,"dirname"),this.path=nr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?nr.extname(this.path):void 0}set extname(t){if(Of(t,"extname"),bx(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=nr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Kd(t)&&(t=SF(t)),Ff(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?nr.basename(this.path,this.extname):void 0}set stem(t){Ff(t,"stem"),Of(t,"stem"),this.path=nr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const s=this.message(t,n,i);throw s.fatal=!0,s}info(t,n,i){const s=this.message(t,n,i);return s.fatal=void 0,s}message(t,n,i){const s=new qt(t,n,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Of(e,t){if(e&&e.includes(nr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+nr.sep+"`")}function Ff(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function bx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function CF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const EF=function(e){const i=this.constructor.prototype,s=i[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,i),a},TF={}.hasOwnProperty;class cp extends EF{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=dF()}copy(){const t=new cp;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(_f(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bf("data",this.frozen),this.namespace[t]=n,this):TF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=n.call(t,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=wl(t),i=this.parser||this.Parser;return zf("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),zf("process",this.parser||this.Parser),Vf("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,l){const c=wl(t),f=i.parse(c);i.run(f,c,function(m,p,v){if(m||!p||!v)return h(m);const w=p,S=i.stringify(w,v);AF(S)?v.value=S:v.result=S,h(m,v)});function h(m,p){m||!p?l(m):a?a(p):n(void 0,p)}}}processSync(t){let n=!1,i;return this.freeze(),zf("processSync",this.parser||this.Parser),Vf("processSync",this.compiler||this.Compiler),this.process(t,s),Ex("processSync","process",n),i;function s(a,l){n=!0,kx(a),i=l}}run(t,n,i){Cx(t),this.freeze();const s=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?a(void 0,i):new Promise(a);function a(l,c){const f=wl(n);s.run(t,f,h);function h(m,p,v){const w=p||t;m?c(m):l?l(w):i(void 0,w,v)}}}runSync(t,n){let i=!1,s;return this.run(t,n,a),Ex("runSync","run",i),s;function a(l,c){kx(l),s=c,i=!0}}stringify(t,n){this.freeze();const i=wl(n),s=this.compiler||this.Compiler;return Vf("stringify",s),Cx(t),s(t,i)}use(t,...n){const i=this.attachers,s=this.namespace;if(Bf("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[m,...p]=h;f(m,p)}else l(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function l(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(h.plugins),h.settings&&(s.settings=_f(!0,s.settings,h.settings))}function c(h){let m=-1;if(h!=null)if(Array.isArray(h))for(;++m<h.length;){const p=h[m];a(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,m){let p=-1,v=-1;for(;++p<i.length;)if(i[p][0]===h){v=p;break}if(v===-1)i.push([h,...m]);else if(m.length>0){let[w,...S]=m;const C=i[v][1];Hd(C)&&Hd(w)&&(w=_f(!0,C,w)),i[v]=[h,w,...S]}}}}const PF=new cp().freeze();function zf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Cx(e){if(!Hd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ex(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function wl(e){return RF(e)?e:new rS(e)}function RF(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function AF(e){return typeof e=="string"||jF(e)}function jF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tx=[],Px={allowDangerousHtml:!0},MF=/^(https?|ircs?|mailto|xmpp)$/i,IF=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function iS(e){const t=DF(e),n=_F(e);return LF(t.runSync(t.parse(n),n),e)}function DF(e){const t=e.rehypePlugins||Tx,n=e.remarkPlugins||Tx,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Px}:Px;return PF().use(bO).use(n).use(uF,i).use(t)}function _F(e){const t=e.children||"",n=new rS;return typeof t=="string"&&(n.value=t),n}function LF(e,t){const n=t.allowedElements,i=t.allowElement,s=t.components,a=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,f=t.urlTransform||OF;for(const m of IF)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+NF+m.id,void 0);return Dh(e,h),aO(e,{Fragment:y.Fragment,components:s,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function h(m,p,v){if(m.type==="raw"&&v&&typeof p=="number")return l?v.children.splice(p,1):v.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let w;for(w in If)if(Object.hasOwn(If,w)&&Object.hasOwn(m.properties,w)){const S=m.properties[w],C=If[w];(C===null||C.includes(m.tagName))&&(m.properties[w]=f(String(S||""),w,m))}}if(m.type==="element"){let w=n?!n.includes(m.tagName):a?a.includes(m.tagName):!1;if(!w&&i&&typeof p=="number"&&(w=!i(m,p,v)),w&&v&&typeof p=="number")return c&&m.children?v.children.splice(p,1,...m.children):v.children.splice(p,1),p}}}function OF(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||i!==-1&&t>i||MF.test(e.slice(0,t))?e:""}const FF={};function oS(e){const t=this,n=e||FF,i=t.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),a=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(j1(n)),a.push(l1()),l.push(K2(n))}function Zs(e){const t=k.useRef(null);return k.useEffect(()=>(t.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>{const n=t.current;n?.isConnected&&requestAnimationFrame(()=>n.focus())}),[]),y.jsx(Rk,{open:!0,onOpenChange:n=>{n||e.onClose()},children:y.jsxs(Nk,{children:[y.jsx(Mk,{className:"modal-backdrop"}),y.jsxs(Ik,{id:e.contentId,className:"modal"+(e.wide?" modal-wide":"")+(e.className?` ${e.className}`:""),children:[y.jsxs("div",{className:"modal-head",children:[y.jsxs("div",{children:[y.jsx(_k,{asChild:!0,children:y.jsx("h3",{children:e.title})}),e.description&&y.jsx(Lk,{className:"modal-description",children:e.description})]}),y.jsx(Ok,{asChild:!0,children:y.jsx("button",{className:"icon-btn","aria-label":`Close ${e.title}`,children:y.jsx(Se,{name:"close"})})})]}),e.tabs,y.jsx("div",{className:"modal-body",children:e.children})]})]})})}const zF=.25,VF=8;let Rx=Promise.resolve();function Ax(){return document.documentElement.classList.contains("theme-dark")?"dark":"default"}function BF(){const[e,t]=k.useState(Ax);return k.useEffect(()=>{const n=document.documentElement,i=()=>t(Ax()),s=new MutationObserver(i);return s.observe(n,{attributes:!0,attributeFilter:["class"]}),i(),()=>s.disconnect()},[]),e}function $F(e,t,n){const i=Rx.then(async()=>{const{default:s}=await Wh(async()=>{const{default:a}=await import("./mermaid.core-Bo5ITjWV.js").then(l=>l.bp);return{default:a}},[]);return s.initialize({startOnLoad:!1,securityLevel:"strict",theme:n,fontFamily:"var(--sans)"}),s.render(e,t)});return Rx=i.then(()=>{},()=>{}),i}function UF(e){return Math.min(VF,Math.max(zF,e))}function WF(e){const t=k.useRef(null),n=k.useRef(null),[i,s]=k.useState(1),[a,l]=k.useState({x:0,y:0}),[c,f]=k.useState(!1),h=()=>{s(1),l({x:0,y:0})},m=(p,v,w)=>{const S=UF(p);if(S===i)return;const C=t.current?.getBoundingClientRect();if(C){const E=(v??C.left+C.width/2)-C.left-C.width/2,R=(w??C.top+C.height/2)-C.top-C.height/2,A=S/i;l(T=>({x:E-A*(E-T.x),y:R-A*(R-T.y)}))}s(S)};return k.useEffect(()=>{const p=v=>{v.key==="+"||v.key==="="?(v.preventDefault(),m(i*1.25)):v.key==="-"?(v.preventDefault(),m(i/1.25)):v.key==="0"&&(v.preventDefault(),h())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)}),y.jsx(Rk,{open:!0,onOpenChange:p=>{p||e.onClose()},children:y.jsxs(Nk,{children:[y.jsx(Mk,{className:"mermaid-fullscreen-backdrop"}),y.jsxs(Ik,{className:"mermaid-fullscreen","data-mermaid-theme":e.theme,"aria-describedby":"mermaid-fullscreen-help",children:[y.jsx(_k,{className:"mermaid-fullscreen-title",children:"Diagram viewer"}),y.jsxs("div",{className:"mermaid-fullscreen-tools",children:[y.jsx("button",{className:"icon-btn","aria-label":"Zoom out",title:"Zoom out (−)",onClick:()=>m(i/1.25),children:y.jsx(Se,{name:"minus"})}),y.jsxs("button",{className:"mermaid-zoom-value",onClick:h,title:"Reset zoom and position",children:[Math.round(i*100),"%"]}),y.jsx("button",{className:"icon-btn","aria-label":"Zoom in",title:"Zoom in (+)",onClick:()=>m(i*1.25),children:y.jsx(Se,{name:"plus"})}),y.jsx(Ok,{asChild:!0,children:y.jsx("button",{className:"icon-btn","aria-label":"Close diagram viewer",title:"Close (Esc)",children:y.jsx(Se,{name:"close"})})})]}),y.jsx("div",{ref:t,className:"mermaid-fullscreen-viewport"+(c?" dragging":""),onWheel:p=>{p.preventDefault(),m(i*Math.exp(-p.deltaY*.0015),p.clientX,p.clientY)},onDoubleClick:p=>m(i*1.5,p.clientX,p.clientY),onPointerDown:p=>{p.button===0&&(n.current={pointerId:p.pointerId,startX:p.clientX,startY:p.clientY,panX:a.x,panY:a.y},p.currentTarget.setPointerCapture(p.pointerId),f(!0))},onPointerMove:p=>{const v=n.current;!v||v.pointerId!==p.pointerId||l({x:v.panX+p.clientX-v.startX,y:v.panY+p.clientY-v.startY})},onPointerUp:p=>{n.current?.pointerId===p.pointerId&&(n.current=null,f(!1),p.currentTarget.releasePointerCapture(p.pointerId))},onPointerCancel:()=>{n.current=null,f(!1)},children:y.jsx("div",{className:"mermaid-fullscreen-canvas",style:{transform:`translate(${a.x}px, ${a.y}px) scale(${i})`},dangerouslySetInnerHTML:{__html:e.svg}})}),y.jsx(Lk,{id:"mermaid-fullscreen-help",className:"mermaid-fullscreen-help",children:"Scroll to zoom · drag to move · double-click to zoom in"})]})]})})}function HF({source:e}){const t=k.useId(),[n,i]=k.useState(""),[s,a]=k.useState(""),[l,c]=k.useState("default"),[f,h]=k.useState(!1),m=BF();return k.useEffect(()=>{let p=!0;const v=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,"")}`;return i(""),a(""),$F(v,e,m).then(w=>{p&&(c(m),i(w.svg))}).catch(w=>{p&&a(w instanceof Error?w.message:String(w))}),()=>{p=!1,document.getElementById(`d${v}`)?.remove()}},[t,e,m]),s?y.jsxs("pre",{className:"markdown-mermaid-error",children:["Mermaid error: ",s]}):n?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"markdown-mermaid","data-mermaid-theme":l,children:[y.jsx("button",{className:"icon-btn markdown-mermaid-expand","aria-label":"View diagram fullscreen",title:"View diagram fullscreen",onClick:()=>h(!0),children:y.jsx(Se,{name:"maximize"})}),y.jsx("div",{className:"markdown-mermaid-diagram",dangerouslySetInnerHTML:{__html:n}})]}),f&&y.jsx(WF,{svg:n,theme:l,onClose:()=>h(!1)})]}):y.jsx("div",{className:"markdown-mermaid-loading",children:"Rendering diagram…"})}const KF=k.memo(function(t){return y.jsx("article",{className:"markdown-body",ref:t.contentRef,children:y.jsx(iS,{remarkPlugins:[oS],components:{a:({children:n,...i})=>y.jsx("a",{...i,target:"_blank",rel:"noreferrer",children:n}),code:({className:n,children:i,...s})=>{const a=/language-([\w-]+)/.exec(n??"")?.[1],l=String(i).replace(/\n$/,"");return a==="mermaid"?y.jsx(HF,{source:l}):y.jsx("code",{className:n,...s,children:i})}},children:t.markdown})})});function sS(e){const{rec:t}=e,n=k.useRef(null),[i,s]=k.useState(""),[a,l]=k.useState(null),[c,f]=k.useState("loading"),[h,m]=k.useState(""),[p,v]=k.useState(0),[w,S]=k.useState(""),[C,E]=k.useState(0),[R,A]=k.useState(!1),[T,P]=k.useState(""),[O,D]=k.useState(!1),[H,B]=k.useState(!1),[_,N]=k.useState([]),[q,V]=k.useState(!1),[ae,J]=k.useState(null),[ee,ge]=k.useState(!1),[we,G]=k.useState("");k.useEffect(()=>{let M=!0,Z=null;return f("loading"),lu(t.id).then(ye=>{if(M){if(!ye){f("missing");return}s(new TextDecoder("utf-8").decode(ye)),Z=URL.createObjectURL(new Blob([ye],{type:"text/markdown;charset=utf-8"})),l(Z),f("ready")}}).catch(()=>{M&&f("error")}),()=>{M=!1,Z&&URL.revokeObjectURL(Z)}},[t.id]),k.useEffect(()=>{const M=()=>{const Z=window.getSelection(),ye=n.current;if(!Z||Z.isCollapsed||!ye){m(""),v(0);return}if(!ye.contains(Z.anchorNode)||!ye.contains(Z.focusNode)){m(""),v(0);return}const me=Z.getRangeAt(0),pe=Z.toString(),be=pe.length-pe.trimStart().length,xe=pe.trim().slice(0,4e3),Be=document.createRange();Be.selectNodeContents(ye),Be.setEnd(me.startContainer,me.startOffset);const Oe=Be.toString().length+be;m(xe),v(vD(ye.textContent,xe,Oe))};return document.addEventListener("selectionchange",M),()=>document.removeEventListener("selectionchange",M)},[]);const le=()=>{h&&(S(h),E(p),A(!0),G(""))},j=async()=>{if(H){if(!w||!T.trim())return;N(Z=>[...Z,{selection:w,comment:T.trim(),occurrence:C}]),P(""),A(!1),G("Comment added to review");return}const M=gD(w,T);if(!(!M||!T.trim()||O)){D(!0),G("");try{await e.onSendText(M,t.id||void 0),P(""),A(!1),G("Feedback sent")}catch(Z){G(`Send failed: ${String(Z)}`)}finally{D(!1)}}},F=async()=>{if(_.length===0||q)return;const M=CD(i,_);V(!0),G("");try{e.onSendFile?await e.onSendFile({filename:yD(t.filename),mime:"text/markdown",bytes:new TextEncoder().encode(M)},t.id||void 0):await e.onSendText(M,t.id||void 0),N([]),B(!1),G("Review submitted")}catch(Z){G(`Review send failed: ${String(Z)}`)}finally{V(!1)}},Q=async()=>{if(!(!ae||!e.onSendFile||ee)){ge(!0),G("");try{await e.onSendFile(ae,t.id||void 0),J(null),G("Voice feedback sent")}catch(M){G(`Voice send failed: ${String(M)}`)}finally{ge(!1)}}};return y.jsx(Zs,{title:t.filename,description:"Markdown preview · select text to send precise feedback",onClose:e.onClose,wide:!0,className:"markdown-modal",children:y.jsxs("div",{className:"markdown-preview",children:[y.jsxs("div",{className:"markdown-review-toolbar",children:[y.jsxs("button",{className:"btn sm",disabled:!h,onMouseDown:M=>M.preventDefault(),onClick:le,children:[y.jsx(Se,{name:"reply",size:14}),H?"Add review comment":"Quick message",h?` (${h.length})`:""]}),H?y.jsx("button",{className:"btn sm",onClick:()=>{B(!1),N([]),A(!1),G("Review discarded")},children:"Cancel review"}):y.jsxs("button",{className:"btn sm",onClick:()=>{B(!0),N([]),G("Review started — select passages to add comments")},children:[y.jsx(Se,{name:"edit",size:14}),"Start review"]}),a&&y.jsxs("a",{className:"btn sm",href:a,download:t.filename,children:[y.jsx(Se,{name:"download",size:14}),"Download"]}),e.onSendFile&&y.jsx(V1,{disabled:!!ae||ee,onReady:J,onError:G}),y.jsx("span",{className:"markdown-review-hint",children:h?"Selection ready for feedback":"Highlight any passage to comment on it"})]}),R&&y.jsxs("div",{className:"markdown-feedback",children:[y.jsx("blockquote",{children:w}),y.jsx("textarea",{className:"field",rows:3,autoFocus:!0,placeholder:"What should change?",value:T,onChange:M=>P(M.target.value)}),y.jsxs("div",{className:"markdown-feedback-actions",children:[y.jsx("button",{className:"btn sm",onClick:()=>A(!1),children:"Cancel"}),y.jsxs("button",{className:"btn sm primary",disabled:!T.trim()||O,onClick:()=>void j(),children:[y.jsx(Se,{name:"send",size:14}),H?"Add to review":O?"Sending…":"Send feedback"]})]})]}),H&&y.jsxs("div",{className:"markdown-review-draft",children:[y.jsxs("div",{className:"markdown-review-draft-head",children:[y.jsxs("strong",{children:["Review · ",_.length," comment",_.length===1?"":"s"]}),y.jsxs("button",{className:"btn sm primary",disabled:_.length===0||q,onClick:()=>void F(),children:[y.jsx(Se,{name:"send",size:14}),q?"Submitting…":"Submit review"]})]}),_.map((M,Z)=>y.jsxs("div",{className:"markdown-review-comment",children:[y.jsx("span",{children:Z+1}),y.jsxs("div",{children:[y.jsx("blockquote",{children:M.selection}),y.jsx("p",{children:M.comment})]}),y.jsx("button",{className:"icon-btn",title:"Remove comment",onClick:()=>N(ye=>ye.filter((me,pe)=>pe!==Z)),children:y.jsx(Se,{name:"close",size:14})})]},`${Z}-${M.selection.slice(0,24)}`))]}),ae&&y.jsx(z1,{att:ae,sending:ee,onSend:()=>void Q(),onDiscard:()=>J(null)}),we&&y.jsx("div",{className:"markdown-review-status",role:"status",children:we}),y.jsxs("div",{className:"markdown-preview-scroll",children:[c==="loading"&&y.jsx("div",{className:"markdown-empty",children:"Loading preview…"}),c==="missing"&&y.jsx("div",{className:"markdown-empty",children:"This file is available on the original device only."}),c==="error"&&y.jsx("div",{className:"markdown-empty",children:"The file could not be opened."}),c==="ready"&&y.jsx(KF,{markdown:i,contentRef:n})]})]})})}function aS(e){const{rec:t}=e,[n,i]=k.useState(null),[s,a]=k.useState(0),[l,c]=k.useState(!1),[f,h]=k.useState("loading");return k.useEffect(()=>{let m=!0,p=null;return h("loading"),lu(t.id).then(v=>{if(m){if(!v){h("missing");return}a(v.byteLength),p=URL.createObjectURL(new Blob([v],{type:Vh(t.mime,t.filename)})),i(p),h("ready")}}).catch(()=>{m&&h("error")}),()=>{m=!1,p&&URL.revokeObjectURL(p)}},[t.id,t.mime,t.filename]),y.jsx(Zs,{title:t.filename,description:"Transformed safe preview · external navigation disabled",onClose:e.onClose,wide:!0,className:"markdown-modal html-modal"+(l?" html-modal-fullscreen":""),children:y.jsxs("div",{className:"html-preview",children:[y.jsxs("div",{className:"html-preview-toolbar",children:[y.jsxs("span",{className:"html-preview-shield",children:[y.jsx(Se,{name:"shield",size:14}),"Scripts, forms and network requests are blocked"]}),y.jsxs("span",{className:"html-preview-actions",children:[f==="ready"&&y.jsxs("button",{className:"btn sm",type:"button",title:"View HTML fullscreen","aria-label":"View HTML fullscreen",onClick:()=>c(!0),children:[y.jsx(Se,{name:"maximize",size:14}),"Fullscreen"]}),n&&y.jsxs("a",{className:"btn sm",href:n,download:t.filename,children:[y.jsx(Se,{name:"download",size:14}),"Download original",s?` · ${ti(s)}`:""]})]})]}),y.jsxs("div",{className:"html-preview-frame",children:[f==="loading"&&y.jsx("div",{className:"markdown-empty",children:"Loading preview…"}),f==="missing"&&y.jsx("div",{className:"markdown-empty",children:"This file is available on the original device only."}),f==="error"&&y.jsx("div",{className:"markdown-empty",children:"The file could not be opened."}),f==="ready"&&y.jsx("iframe",{className:"html-preview-iframe",title:`Sandboxed preview of ${t.filename}`,sandbox:ED,referrerPolicy:"no-referrer",src:`/api/html-preview/${encodeURIComponent(t.id)}`},t.id)]})]})})}function lS(e){const t=(n,i)=>{const{key:s}=n;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(s))return;n.preventDefault();const a=e.options.length-1,l=s==="Home"?0:s==="End"?a:s==="ArrowLeft"||s==="ArrowUp"?(i-1+e.options.length)%e.options.length:(i+1)%e.options.length,c=e.options[l];c&&(e.onChange(c.id),document.getElementById(`${e.idPrefix}-${c.id}`)?.focus())};return y.jsx("div",{className:e.className,role:"tablist","aria-label":e.label,children:e.options.map((n,i)=>y.jsxs("button",{id:`${e.idPrefix}-${n.id}`,type:"button",role:"tab","aria-selected":e.value===n.id,"aria-controls":e.panelId,tabIndex:e.value===n.id?0:-1,className:"tab"+(e.value===n.id?" active":""),onClick:()=>e.onChange(n.id),onKeyDown:s=>t(s,i),children:[n.label,n.count===void 0?null:y.jsxs(y.Fragment,{children:[" ",y.jsx("span",{children:n.count})]})]},n.id))})}function qd(e){const{message:t}=e,[n,i]=k.useState(null),[s,a]=k.useState(0),l=$0(t.wireId)??{id:t.wireId,dir:t.dir,filename:t.filename??"file",mime:t.mime??"application/octet-stream",size:s,date:t.date};k.useEffect(()=>{let h=!0,m=null;if(t.wireId)return lu(t.wireId).then(p=>{!h||!p||(a(p.byteLength),m=URL.createObjectURL(new Blob([p],{type:Vh(l.mime,l.filename)})),i(m))}).catch(()=>{}),()=>{h=!1,m&&URL.revokeObjectURL(m)}},[t.wireId,l.mime,l.filename]);const c=Rd(t)==="photo",f=So(l.mime,l.filename);return y.jsxs("div",{className:"shared-media-item"+(c?" shared-photo-item":""),children:[y.jsxs("button",{className:"shared-media-jump",onClick:()=>e.onJump(e.messageKey),children:[c&&n?y.jsx("img",{src:n,alt:l.filename}):y.jsx("span",{className:"shared-media-icon",children:y.jsx(Se,{name:f?"mic":"copy",size:18})}),y.jsxs("span",{className:"shared-media-copy",children:[y.jsx("strong",{children:c?l.filename||"Photo":f?"Voice message":l.filename}),y.jsxs("span",{children:[e.versionLabel?`${e.versionLabel} · `:"",ji(l.date),s?` · ${ti(s)}`:""]})]})]}),y.jsxs("span",{className:"shared-media-actions",children:[N1(l.filename)&&n&&y.jsx("button",{className:"icon-btn",title:"Preview markdown",onClick:()=>e.onPreview(l),children:y.jsx(Se,{name:"monitor",size:16})}),Ys(l.filename,l.mime)&&n&&y.jsx("button",{className:"icon-btn",title:"Preview HTML",onClick:()=>e.onPreview(l),children:y.jsx(Se,{name:"monitor",size:16})}),y.jsx("a",{className:"icon-btn"+(n?"":" disabled"),href:n??void 0,download:l.filename,title:"Download",children:y.jsx(Se,{name:"download",size:16})})]})]})}function qF(e){const[t,n]=k.useState(!1);if(e.versions.length===1){const i=e.versions[0];return y.jsx(qd,{message:i.message,messageKey:i.key,onJump:e.onJump,onPreview:e.onPreview})}return y.jsxs("div",{className:"file-version-stack"+(t?" expanded":""),children:[y.jsxs("button",{className:"file-version-stack-head",onClick:()=>n(i=>!i),children:[y.jsx("span",{className:"shared-media-icon",children:y.jsx(Se,{name:"copy",size:18})}),y.jsxs("span",{className:"shared-media-copy",children:[y.jsx("strong",{children:e.filename}),y.jsxs("span",{children:[e.versions.length," versions · newest ",ji(e.versions[0].message.date)]})]}),y.jsx(Se,{name:t?"chevronDown":"chevron",size:16})]}),t&&y.jsx("div",{className:"file-version-stack-list",children:e.versions.map((i,s)=>y.jsx(qd,{message:i.message,messageKey:i.key,versionLabel:`Version ${e.versions.length-s}`,onJump:e.onJump,onPreview:e.onPreview},i.key))})]})}function XF(e){const[t,n]=k.useState("photo"),i=e.messages.map((h,m)=>({message:h,key:h.wireId||`${h.date}-${(e.indexOffset??0)+m}`})),s=i.filter(({message:h})=>Rd(h)==="photo"),a=i.filter(({message:h})=>Rd(h)==="file"),l=wD(a),c=i.flatMap(({message:h,key:m})=>h.kind==="file"?[]:xD(h.text).map(p=>({url:p,message:h,key:m}))),f=[{id:"photo",label:"Photos",count:s.length},{id:"file",label:"Files",count:a.length},{id:"link",label:"Links",count:c.length}];return y.jsx(Zs,{title:"Shared media",description:"Photos, files, and links from this conversation",onClose:e.onClose,wide:!0,className:"shared-media-modal",tabs:y.jsx(lS,{className:"shared-media-tabs",label:"Shared media type",options:f,value:t,onChange:n,idPrefix:"shared-media-tab",panelId:"shared-media-panel"}),children:y.jsxs("div",{id:"shared-media-panel",role:"tabpanel","aria-labelledby":`shared-media-tab-${t}`,className:"shared-media-list"+(t==="photo"?" photos":""),children:[t==="photo"&&s.map(h=>y.jsx(qd,{message:h.message,messageKey:h.key,onJump:e.onJump,onPreview:e.onPreview},h.key)),t==="file"&&l.map(h=>y.jsx(qF,{filename:h.filename,versions:h.versions,onJump:e.onJump,onPreview:e.onPreview},h.filename)),t==="link"&&c.map((h,m)=>y.jsxs("div",{className:"shared-media-item",children:[y.jsxs("a",{className:"shared-media-jump",href:h.url,target:"_blank",rel:"noreferrer",children:[y.jsx("span",{className:"shared-media-icon",children:y.jsx(Se,{name:"link",size:18})}),y.jsxs("span",{className:"shared-media-copy",children:[y.jsx("strong",{children:h.url}),y.jsx("span",{children:ji(h.message.date)})]})]}),y.jsx("button",{className:"icon-btn",title:"Jump to message",onClick:()=>e.onJump(h.key),children:y.jsx(Se,{name:"reply",size:16})})]},`${h.key}-${h.url}-${m}`)),(t==="photo"&&s.length===0||t==="file"&&a.length===0||t==="link"&&c.length===0)&&y.jsxs("div",{className:"markdown-empty",children:["No ",t==="photo"?"photos":`${t}s`," in this chat yet."]})]})})}const YF=Object.freeze(["image/avif","image/bmp","image/heic","image/heif","image/jpeg","image/jpg","image/png","image/webp"]),GF=/\.(avif|bmp|heic|heif|jpe?g|png|webp)$/i;function uS(e,t=""){return YF.includes(String(e??"").toLowerCase())||GF.test(String(t??""))}function QF(e){return`${(String(e||"photo").trim()||"photo").replace(/\.[^./\\]+$/,"")||"photo"}.jpg`}function JF(e,t,n){const i=Math.max(1,Number(e)||1),s=Math.max(1,Number(t)||1),a=Math.max(1,Number(n)||1),l=Math.min(1,a/Math.max(i,s));return{width:Math.max(1,Math.round(i*l)),height:Math.max(1,Math.round(s*l))}}const ZF=2048,ez=640,tz=.82,nz=[.84,.7,.56,.44],rz=.94;function iz(e){return new Promise((t,n)=>{const i=URL.createObjectURL(e),s=new Image,a=()=>URL.revokeObjectURL(i);s.onload=()=>t({image:s,release:a}),s.onerror=()=>{a(),n(new Error("This browser could not decode the selected image."))},s.src=i})}function oz(e,t){return new Promise((n,i)=>{e.toBlob(s=>s?n(s):i(new Error("This browser could not encode the optimized photo.")),"image/jpeg",t)})}async function sz(e,t){if(!uS(e.type,e.name))throw new Error("This image format cannot be optimized safely in this browser.");const n=Math.max(1,Math.floor(t*rz)),{image:i,release:s}=await iz(e),a=document.createElement("canvas"),l=a.getContext("2d",{alpha:!1});if(!l)throw s(),new Error("Photo optimization is unavailable in this browser.");try{let c=Math.min(ZF,Math.max(i.naturalWidth,i.naturalHeight));for(;c>=ez;){const f=JF(i.naturalWidth,i.naturalHeight,c);a.width=f.width,a.height=f.height,l.fillStyle="#fff",l.fillRect(0,0,a.width,a.height),l.drawImage(i,0,0,a.width,a.height);for(const h of nz){const m=await oz(a,h);if(m.size<=n)return{filename:QF(e.name),mime:"image/jpeg",bytes:new Uint8Array(await m.arrayBuffer()),width:a.width,height:a.height,originalSize:e.size}}c=Math.floor(c*tz)}}finally{s(),a.width=1,a.height=1}throw new Error("The photo is still too large after optimization.")}const az=5e4,lz=new Set(["http:","https:","mailto:"]);function cS(e){if(!(!e||e!==e.trim()||/[\u0000-\u001f\u007f]/u.test(e)))try{const t=new URL(e);return lz.has(t.protocol.toLowerCase())?e:void 0}catch{return}}function fS(e){const t="language-";return e?.startsWith(t)&&e.slice(t.length)||void 0}function uz(e){return e.split(/(\n[ \t]*\n)/).map(t=>{if(/^\n[ \t]*\n$/.test(t))return t;const n=t.split(`
324
324
  `),i=n.filter(l=>l.trim().length>0);if(i.length===0)return t;const s=i.map(l=>l.match(/^[ \t]+/)?.[0]??"");if(s.some(l=>l.length===0))return t;const a=Math.min(...s.map(l=>l.length));return n.map(l=>l.trim().length>0?l.slice(a):l).join(`
325
- `)}).join("")}function cz({children:e}){const t=k.isValidElement(e)?e:null,n=fS(t?.props.className);return y.jsxs("div",{className:"message-code-block","data-language":n||void 0,children:[n&&y.jsx("div",{className:"message-code-language",children:n}),y.jsx("pre",{children:e})]})}const fz=[oS],dz={a:({node:e,children:t,href:n,...i})=>{const s=cS(n);return s?y.jsx("a",{...i,href:s,target:"_blank",rel:"noopener noreferrer",children:t}):y.jsx("span",{className:"message-link-blocked",children:t})},img:({alt:e})=>y.jsxs("span",{className:"message-image-placeholder",children:["[image: ",e||"remote image blocked","]"]}),pre:cz,code:({node:e,className:t,children:n,...i})=>y.jsx("code",{className:t,"data-language":fS(t),...i,children:n})},jx=k.memo(function({text:t,className:n="bubble-text message-markdown"}){return t.length>az?y.jsx("div",{className:`${n} message-markdown-plaintext`,"data-render-mode":"plaintext",children:t}):y.jsx("div",{className:n,"data-render-mode":"markdown",children:y.jsx(iS,{remarkPlugins:fz,components:dz,urlTransform:i=>cS(i)??"",children:uz(t)})})}),hz=new Set(["type","title","description","default","enum","const","minimum","maximum","minLength","maxLength","pattern","properties","required","items","minItems","maxItems","additionalProperties"]),Nx=6,Mx=64,Ix=256,Dx=256,_x=12,Lx=2048,Ox=64*1024;function dS(e){if(typeof e!="string")return"pattern must be a string";if(e.length>Ix)return`pattern exceeds ${Ix} characters`;if(!e.startsWith("^")||!e.endsWith("$"))return"pattern must be anchored with ^ and $";let t=!1,n=!1;for(let i=0;i<e.length;i++){const s=e[i];if(s==="\\"){if(++i>=e.length)return"pattern has invalid syntax";if(/\d/.test(e[i])||e[i]==="k")return"pattern backreferences are not supported";continue}if(t){s==="]"&&(t=!1);continue}if(s==="["){t=!0;continue}if("()?*+|".includes(s))return"pattern must use only bounded, non-grouped expressions";if(s==="{"){const a=/^\{(\d+)(?:,(\d+))?\}/.exec(e.slice(i));if(!a)return"pattern has an invalid or unbounded repetition";const l=Number(a[1]),c=Number(a[2]??a[1]);if(l>c||c>Dx)return`pattern repetition must not exceed ${Dx}`;if(l!==c){const f=e.slice(i+a[0].length);if(n||f!==""&&f!=="$")return"a variable pattern repetition is supported only once, at the end";n=!0}i+=a[0].length-1}}if(t)return"pattern has invalid syntax";try{new RegExp(e)}catch{return"pattern has invalid syntax"}return null}function Xd(e,t=0,n={value:0}){if(t>Nx)return`Schema depth exceeds ${Nx}`;if(n.value++,n.value>Mx)return`Schema exceeds ${Mx} controls`;const i=Object.keys(e).find(a=>!hz.has(a));if(i)return`Unsupported JSON Schema keyword: ${i}`;if(e.title!==void 0&&typeof e.title!="string")return"title must be a string";if(e.description!==void 0&&typeof e.description!="string")return"description must be a string";if(e.enum!==void 0&&(!Array.isArray(e.enum)||e.enum.length===0))return"enum must be a non-empty array";const s=e.type;if(s===void 0&&e.enum===void 0&&!Object.hasOwn(e,"const"))return"An explicit type, enum, or const is required";if(s!==void 0&&!["object","array","string","number","integer","boolean","null"].includes(String(s)))return`Unsupported JSON Schema type: ${String(s)}`;for(const a of["minimum","maximum"])if(e[a]!==void 0&&(typeof e[a]!="number"||!Number.isFinite(e[a])))return`${a} must be a finite number`;for(const a of["minLength","maxLength","minItems","maxItems"])if(e[a]!==void 0&&(typeof e[a]!="number"||!Number.isInteger(e[a])||e[a]<0))return`${a} must be a non-negative integer`;if((e.minimum!==void 0||e.maximum!==void 0)&&s!=="number"&&s!=="integer")return"minimum/maximum require a numeric type";if((e.minLength!==void 0||e.maxLength!==void 0)&&s!=="string")return"minLength/maxLength require string type";if(e.pattern!==void 0){if(s!=="string")return"pattern requires a string type";const a=dS(e.pattern);if(a)return a}if((e.minItems!==void 0||e.maxItems!==void 0)&&s!=="array")return"minItems/maxItems require array type";if(e.additionalProperties!==void 0){if(s!=="object")return"additionalProperties requires an object type";if(e.additionalProperties===!0)return"additionalProperties: true is not supported";if(e.additionalProperties!==!1)return e.additionalProperties&&typeof e.additionalProperties=="object"&&!Array.isArray(e.additionalProperties)?"Schema-valued additionalProperties is not supported":"additionalProperties must be false"}if(s==="object"){const a=e.properties;if(a!==void 0&&(!a||typeof a!="object"||Array.isArray(a)))return"properties must be an object";if(e.required!==void 0&&(!Array.isArray(e.required)||e.required.some(l=>typeof l!="string")))return"required must be an array of property names";for(const l of Object.values(a??{})){if(!l||typeof l!="object"||Array.isArray(l))return"property schema must be an object";const c=Xd(l,t+1,n);if(c)return c}}return s==="array"&&e.items!==void 0?!e.items||typeof e.items!="object"||Array.isArray(e.items)?"items must be one schema object":Xd(e.items,t+1,n):null}function Jl(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((s,a)=>Jl(s,t[a]));const n=Object.keys(e).sort(),i=Object.keys(t).sort();return n.length===i.length&&n.every((s,a)=>s===i[a]&&Jl(e[s],t[s]))}function pz(e,t){let n=0;const i=(a,l)=>{if(l>_x)return`${t} exceeds depth ${_x}`;if(n++,n>Lx)return`${t} exceeds ${Lx} JSON values`;if(a===null||typeof a!="object")return null;for(const c of Array.isArray(a)?a:Object.values(a)){const f=i(c,l+1);if(f)return f}return null},s=i(e,0);return s||(new TextEncoder().encode(JSON.stringify(e)).byteLength>Ox?`${t} exceeds ${Ox} UTF-8 bytes`:null)}function Yd(e,t,n){if(Object.hasOwn(e,"const")&&!Jl(e.const,t))return`${n} must use the fixed value`;if(Array.isArray(e.enum)&&!e.enum.some(i=>Jl(i,t)))return`${n} is not an allowed value`;if(e.type==="null")return t===null?null:`${n} must be null`;if(e.type==="boolean")return typeof t=="boolean"?null:`${n} must be boolean`;if(e.type==="string"){if(typeof t!="string")return`${n} must be text`;if(typeof e.minLength=="number"&&t.length<e.minLength)return`${n} is too short`;if(typeof e.maxLength=="number"&&t.length>e.maxLength)return`${n} is too long`;if(e.pattern!==void 0){const i=dS(e.pattern);if(i)return`${n} cannot be validated safely: ${i}`;if(!new RegExp(e.pattern).test(t))return`${n} does not match the required format`}return null}if(e.type==="number"||e.type==="integer")return typeof t!="number"||!Number.isFinite(t)?`${n} must be a finite number`:e.type==="integer"&&!Number.isInteger(t)?`${n} must be an integer`:typeof e.minimum=="number"&&t<e.minimum?`${n} is below the minimum`:typeof e.maximum=="number"&&t>e.maximum?`${n} is above the maximum`:null;if(e.type==="array"){if(!Array.isArray(t))return`${n} must be an array`;if(typeof e.minItems=="number"&&t.length<e.minItems)return`${n} has too few items`;if(typeof e.maxItems=="number"&&t.length>e.maxItems)return`${n} has too many items`;if(e.items&&typeof e.items=="object"&&!Array.isArray(e.items))for(let i=0;i<t.length;i++){const s=Yd(e.items,t[i],`${n}[${i}]`);if(s)return s}return null}if(e.type==="object"){if(!t||typeof t!="object"||Array.isArray(t))return`${n} must be an object`;const i=e.properties??{};for(const a of Object.keys(t))if(e.additionalProperties===!1&&!Object.hasOwn(i,a))return`${n}.${a||"(empty key)"} is not declared by the schema`;const s=Array.isArray(e.required)?e.required:[];for(const a of s)if(!Object.hasOwn(t,a))return`${n}.${a||"(empty key)"} is required`;for(const[a,l]of Object.entries(i)){if(!Object.hasOwn(t,a))continue;const c=Yd(l,t[a],`${n}.${a||"(empty key)"}`);if(c)return c}}return null}function Zl(e,t,n="Arguments"){return pz(t,n)??Yd(e,t,n)}function xo(e){if(Object.hasOwn(e,"const"))return e.const;if(e.default!==void 0)return e.default;if(Array.isArray(e.enum)&&e.enum.length)return e.enum[0];if(e.type==="object"){const t=Object.create(null),n=new Set(Array.isArray(e.required)?e.required.filter(i=>typeof i=="string"):[]);for(const[i,s]of Object.entries(e.properties??{})){const a=s;(n.has(i)||a.default!==void 0)&&(t[i]=xo(a))}return t}return e.type==="array"?[]:e.type==="boolean"?!1:e.type==="number"||e.type==="integer"?0:e.type==="null"?null:""}function Fx(e,t){return typeof e.title=="string"&&e.title?e.title:t||"(empty key)"}function zx(e,t,n){const i=Object.create(null);for(const[s,a]of Object.entries(e))i[s]=a;return i[t]=n,i}function mz(e,t){const n=Object.create(null);for(const[i,s]of Object.entries(e))i!==t&&(n[i]=s);return n}function gz(e){const{schema:t,label:n,path:i,value:s,required:a,description:l,onChange:c,onValidityChange:f}=e,h=k.useId().replace(/[^a-zA-Z0-9_-]/g,""),p=`command-array-${i.replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"root"}-${h}-help`,[v,w]=k.useState(()=>JSON.stringify(s,null,2)),[S,C]=k.useState(null),E=k.useRef(JSON.stringify(s));k.useEffect(()=>{const A=JSON.stringify(s);A!==E.current&&(E.current=A,w(JSON.stringify(s,null,2)),C(null),f(i,null))},[f,i,s]),k.useEffect(()=>()=>f(i,null),[f,i]);const R=A=>{w(A);let T;try{T=JSON.parse(A)}catch{const O=`${n} must contain valid JSON`;C(O),f(i,O);return}if(!Array.isArray(T)){const O=`${n} must be a JSON array`;C(O),f(i,O);return}const P=Zl(t,T,n);C(P),f(i,P),E.current=JSON.stringify(T),c(T)};return y.jsxs("label",{className:"command-field",children:[y.jsxs("span",{children:[n,a?" *":""]}),y.jsx("textarea",{value:v,rows:3,"aria-describedby":p,"aria-invalid":S?"true":void 0,onChange:A=>R(A.target.value)}),y.jsx("small",{id:p,children:l??"JSON array"}),S&&y.jsx("span",{className:"command-field-error",role:"alert",children:S})]})}function yz(e){const{schema:t,label:n,path:i,value:s,required:a,description:l,numeric:c,onChange:f,onValidityChange:h}=e,m=Zl(t,s,n);return k.useEffect(()=>(h(i,m),()=>h(i,null)),[m,h,i]),y.jsxs("label",{className:"command-field",children:[y.jsxs("span",{children:[n,a?" *":""]}),y.jsx("input",{type:c?"number":"text",value:String(s??""),min:typeof t.minimum=="number"?t.minimum:void 0,max:typeof t.maximum=="number"?t.maximum:void 0,minLength:typeof t.minLength=="number"?t.minLength:void 0,maxLength:typeof t.maxLength=="number"?t.maxLength:void 0,step:t.type==="integer"?1:c?"any":void 0,required:a,"aria-invalid":m?"true":void 0,onChange:p=>f(c?Number(p.target.value):p.target.value)}),l&&y.jsx("small",{children:l}),m&&y.jsx("span",{className:"command-field-error",role:"alert",children:m})]})}function hS(e){const{schema:t,name:n,path:i,value:s,required:a,onChange:l,onValidityChange:c}=e,f=Fx(t,n),h=typeof t.description=="string"?t.description:void 0;if(Object.hasOwn(t,"const"))return y.jsxs("div",{className:"command-field",children:[y.jsxs("span",{children:[f,a?" *":""]}),y.jsxs("small",{children:["Fixed value: ",JSON.stringify(t.const)]})]});if(Array.isArray(t.enum))return y.jsxs("label",{className:"command-field",children:[y.jsxs("span",{children:[f,a?" *":""]}),y.jsx("select",{value:JSON.stringify(s),onChange:p=>l(JSON.parse(p.target.value)),children:t.enum.map((p,v)=>y.jsx("option",{value:JSON.stringify(p),children:String(p)},v))}),h&&y.jsx("small",{children:h})]});if(t.type==="object"){const p=s&&typeof s=="object"&&!Array.isArray(s)?s:{},v=new Set(Array.isArray(t.required)?t.required.filter(w=>typeof w=="string"):[]);return y.jsxs("fieldset",{className:"command-object",children:[y.jsx("legend",{children:f}),h&&y.jsx("p",{children:h}),Object.entries(t.properties??{}).map(([w,S])=>{const C=S,E=Object.hasOwn(p,w),R=Fx(C,w),A=`${i}.${w||"(empty key)"}`;return!E&&!v.has(w)?y.jsxs("button",{type:"button",className:"linkbtn command-property-add",onClick:()=>l(zx(p,w,xo(C))),children:["Add ",R]},w):y.jsxs("div",{className:"command-property",children:[y.jsx(hS,{schema:C,name:w,path:A,value:E?p[w]:xo(C),required:v.has(w),onValidityChange:c,onChange:T=>l(zx(p,w,T))}),!v.has(w)&&y.jsx("button",{type:"button",className:"linkbtn command-property-remove","aria-label":`Remove ${R}`,onClick:()=>l(mz(p,w)),children:"Remove"})]},w)})]})}if(t.type==="array")return y.jsx(gz,{schema:t,label:f,path:i,value:s,required:a,description:h,onChange:l,onValidityChange:c});if(t.type==="boolean")return y.jsxs("label",{className:"command-check",children:[y.jsx("input",{type:"checkbox",checked:s===!0,onChange:p=>l(p.target.checked)})," ",f]});if(t.type==="null")return y.jsxs("div",{className:"command-field",children:[y.jsx("span",{children:f}),y.jsx("small",{children:"Null value"})]});const m=t.type==="number"||t.type==="integer";return y.jsx(yz,{schema:t,label:f,path:i,value:s,required:a,description:h,numeric:m,onChange:l,onValidityChange:c})}function vz(e){const t=e.catalog.commands.find(T=>T.name===e.initialCommandName)??e.catalog.commands[0],[n,i]=k.useState(t?.name??""),s=e.catalog.commands.find(T=>T.name===n)??t,a=k.useMemo(()=>s?Xd(s.input_schema):null,[s]),[l,c]=k.useState(()=>t?xo(t.input_schema):null),[f,h]=k.useState(""),[m,p]=k.useState("idle"),[v,w]=k.useState({}),S=k.useRef(0),C=k.useCallback((T,P)=>{w(O=>{if(P===null){if(!Object.hasOwn(O,T))return O;const D={...O};return delete D[T],D}return O[T]===P?O:{...O,[T]:P}})},[]),E=T=>{const P=e.catalog.commands.find(O=>O.name===T);i(T),c(P?xo(P.input_schema):null),h(""),p("idle"),w({})},R=T=>{if(T.preventDefault(),!s||a||e.busy)return;const O=Object.values(v)[0]??Zl(s.input_schema,l);if(O){h(`Validation denied: ${O}`),p("error");return}const D=++S.current,H=s,B=l;c(xo(H.input_schema)),w({}),h(`Sending ${H.name}…`),p("pending"),e.onSend(H,B,crypto.randomUUID(),e.catalog.fingerprint).then(_=>{S.current===D&&(_.status==="failed"?(h(`${H.name} was refused before delivery.`),p("error")):_.status==="pending"?(h(`${H.name} delivery is pending.`),p("warning")):_.status==="indeterminate"||!_.wire_id?(h(`${H.name} delivery could not be confirmed.`),p("indeterminate")):(h(`${H.name} sent. Its result will appear in the conversation.`),p("success")))}).catch(()=>{S.current===D&&(h(`${H.name} could not be sent. You can try it again.`),p("error"))})},A=s&&!a?Zl(s.input_schema,l):null;return y.jsxs("form",{className:"command-panel","aria-label":"Send a typed command",onSubmit:R,onKeyDown:T=>{T.key==="Escape"&&e.onClose()},children:[y.jsxs("div",{className:"command-panel-head",children:[y.jsxs("div",{className:"command-panel-recipient",children:[y.jsxs("strong",{children:["Commands for ",e.recipientName]}),y.jsxs("span",{className:"mono",title:e.catalog.recipient_cid,children:[e.catalog.recipient_cid.slice(0,12),"…"]})]}),y.jsx("button",{type:"button",className:"linkbtn",onClick:e.onRefresh,children:"Refresh"}),y.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close commands",onClick:e.onClose,children:"×"})]}),e.catalog.commands.length===0?y.jsx("p",{role:"status",children:"This recipient does not advertise commands."}):y.jsxs(y.Fragment,{children:[y.jsxs("label",{className:"command-field",children:[y.jsx("span",{children:"Command"}),y.jsx("select",{autoFocus:!0,value:n,onChange:T=>E(T.target.value),children:e.catalog.commands.map(T=>y.jsx("option",{value:T.name,children:T.name},T.name))})]}),s?.description&&y.jsx("p",{children:s.description}),a?y.jsxs("div",{className:"banner error",role:"alert",children:["Cannot render this command safely: ",a]}):s&&y.jsx(hS,{schema:s.input_schema,name:"Arguments",path:"Arguments",value:l,onChange:c,onValidityChange:C}),s&&y.jsx("button",{className:"btn primary",disabled:!!a||e.busy||!!A||Object.keys(v).length>0,children:"Send command"}),y.jsx("div",{className:`command-status ${m}`,"data-state":m,role:"status","aria-live":"polite",children:f})]})]})}const Ss={type:"spring",stiffness:430,damping:38,mass:.72},Vx=10,pS=56,xz=18,wz=650;function kz(e,t){return Math.abs(e)<Vx&&Math.abs(t)<Vx?"pending":Math.abs(e)>Math.abs(t)&&e>0?"drag":"reject"}function Sz(e){const t=e.at(-1),n=t?e.slice(0,-1).reverse().find(i=>i.x!==t.x&&t.time-i.time<=100):void 0;return n&&t&&t.time>n.time?(t.x-n.x)/(t.time-n.time)*1e3:0}function bz(e,t){const n=Sz(t);return n>=0&&(e>=pS||e>=xz&&n>=wz)}const Gd="ours.chats.listMode",js="recent";function mS(){try{return globalThis.localStorage}catch{return}}function Cz(e=mS()){try{return e?.getItem(Gd)==="identity"?"identity":js}catch{return js}}function Ez(e,t=mS()){const n=e==="identity"?"identity":js;try{return t?.setItem(Gd,n),t?.getItem(Gd)===n?n:js}catch{return js}}function Bs(e){return typeof e=="string"?e:""}function eu(e,t){const n=Bs(e),i=Bs(t),s=n.normalize().toLowerCase(),a=i.normalize().toLowerCase();return s<a?-1:s>a?1:n<i?-1:n>i?1:0}function Tz(e,t){const n=Hl(Bs(t.activityAt))-Hl(Bs(e.activityAt));if(n!==0)return n;const i=eu(e.name,t.name);return i!==0?i:eu(e.id,t.id)}function Qd(e){return[...e].sort(Tz)}function Bx(e){return e.contacts.length>0?Hl(Bs(e.contacts[0].activityAt)):0}function Pz(e,t){const n=new Map,i=[];for(const a of e){const l=a.root||(t?.[a.id]?a.id:null);if(!l){i.push(a);continue}const c=t?.[l]||{label:l,note:""};let f=n.get(l);f||(f={id:`root:${l}`,rootId:l,label:c.label,note:c.note,contacts:[]},n.set(l,f)),f.contacts.push(a)}const s=[...n.values()].map(a=>({...a,contacts:Qd(a.contacts)}));return i.length>0&&s.push({id:"rootless",rootId:null,label:"Independent identities",note:"People, agents and apps without a verified Human/root group",contacts:Qd(i)}),s.sort((a,l)=>{const c=Bx(l)-Bx(a);if(c!==0)return c;const f=eu(a.label,l.label);return f!==0?f:eu(a.id,l.id)})}const Rz=15e3;function $f(e){const{c:t,active:n,grouped:i}=e,[s,a]=k.useState(!1),l=async(h,m)=>{if(!(!h||s)){a(!0);try{const p=await h();requestAnimationFrame(()=>{p?document.getElementById("chat-list-title")?.focus():m.focus()})}finally{a(!1)}}},c=y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"contact-avatar","aria-hidden":!0,children:t.initials}),y.jsxs("span",{className:"contact-copy",children:[y.jsxs("span",{className:"contact-row-topline",children:[y.jsx("span",{className:"contact-name",children:t.name}),t.when&&y.jsx("span",{className:"contact-time",children:t.when})]}),y.jsxs("span",{className:"contact-row-bottomline",children:[y.jsx("span",{className:"contact-last",children:t.last}),t.status==="pending"&&y.jsx("span",{className:"chip",children:"pending approval"}),!!t.unread&&y.jsx("span",{className:"contact-unread",children:t.unread})]})]}),t.status==="pending"&&y.jsxs("span",{className:"pending-actions",role:"group","aria-label":`Decide whether to accept ${t.name}`,children:[y.jsx("button",{type:"button",className:"linkbtn",disabled:s,onClick:h=>void l(e.onApprove,h.currentTarget),children:"Approve"}),y.jsx("button",{type:"button",className:"linkbtn quiet",disabled:s,onClick:h=>void l(e.onReject,h.currentTarget),children:"Reject"})]}),n&&y.jsx(yo.span,{className:"contact-active-glow",layoutId:"active-contact",transition:Ss})]}),f="contact-row"+(n?" active":"")+(i?" grouped":"")+(t.status==="pending"?" pending":"");return t.status==="pending"?y.jsx("div",{className:f,children:c}):y.jsx(yo.button,{type:"button",className:f,onClick:e.onClick,children:c})}function Az(e){const{contacts:t,roots:n,selected:i}=e,[s,a]=k.useState(""),l=k.useRef(null),c=k.useRef(null),[f,h]=k.useState(()=>Cz()),m=_=>_.name.toLowerCase().includes(s.toLowerCase()),p=t.filter(_=>_.status!=="pending"&&m(_)),v=t.filter(_=>_.status==="pending"&&m(_)),w=Qd(p),S=Pz(p,n),C=p.length===0&&v.length===0,E=_=>{h(Ez(_))},R=[{id:"recent",label:"Recent"},{id:"identity",label:"By identity"}],A=k.useRef(null),T=k.useRef({id:-1,x0:0,y0:0,mode:"idle"}),P=k.useRef(!1),O=(_,N)=>{const q=T.current;if(q.id!==_)return;const V=A.current;if(N&&q.mode==="drag"&&V){const ae=parseFloat(V.style.getPropertyValue("--mode-drag-x"))||0,J=Math.max(0,(V.clientWidth-8)/2);E(ae>=J/2?"identity":"recent"),P.current=!0,window.setTimeout(()=>{P.current=!1},0)}T.current={id:-1,x0:0,y0:0,mode:"idle"},V?.hasPointerCapture?.(_)&&V.releasePointerCapture(_),V?.classList.remove("dragging"),V?.style.removeProperty("--mode-drag-x")},D=_=>{!_.isPrimary||T.current.id!==-1||(T.current={id:_.pointerId,x0:_.clientX,y0:_.clientY,mode:"pending"})},H=_=>{const N=T.current;if(N.id!==_.pointerId||N.mode==="idle")return;const q=_.clientX-N.x0,V=_.clientY-N.y0;if(N.mode==="pending"){if(Math.abs(q)<10&&Math.abs(V)<10)return;if(Math.abs(V)>Math.abs(q)){O(_.pointerId,!1);return}N.mode="drag",_.currentTarget.setPointerCapture?.(_.pointerId),_.currentTarget.classList.add("dragging")}_.preventDefault();const ae=Math.max(0,(_.currentTarget.clientWidth-8)/2),J=f==="identity"?ae:0;_.currentTarget.style.setProperty("--mode-drag-x",`${Math.min(ae,Math.max(0,J+q))}px`)},B=(_,N)=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(_.key))return;_.preventDefault();const V=_.key==="Home"?"recent":_.key==="End"||N==="recent"?"identity":"recent";E(V),document.getElementById(`conversation-list-${V}`)?.focus()};return k.useLayoutEffect(()=>{const _=l.current,N=c.current;if(!_||!N)return;const q=()=>_.style.setProperty("--list-bottom-chrome-height",`${N.getBoundingClientRect().height}px`);q();const V=new ResizeObserver(q);return V.observe(N),()=>{V.disconnect(),_.style.removeProperty("--list-bottom-chrome-height")}},[]),y.jsxs("div",{className:"listcol",ref:l,children:[y.jsxs("div",{className:"listcol-head",children:[y.jsxs("div",{className:"listcol-titlebar",children:[y.jsxs("h2",{id:"chat-list-title",className:"listcol-title messenger-lockup",tabIndex:-1,children:[y.jsx("span",{className:"messenger-brand-ours",children:"Ours"}),y.jsx("span",{className:"messenger-brand-product",children:"messenger"})]}),y.jsxs("div",{className:"listcol-actions",children:[y.jsx("button",{className:"btn icon-btn desktop-invite","aria-label":"Invite",title:"Invite",onClick:e.onInvite,children:y.jsx(Se,{name:"invite",size:18})}),y.jsx("button",{className:"icon-btn","aria-label":"Settings",title:"Settings",onClick:e.onSettings,children:y.jsx(Se,{name:"settings",size:18})})]})]}),y.jsx("div",{ref:A,className:"conversation-list-modes",role:"tablist","aria-label":"Conversation list layout","data-mode":f,onPointerDown:D,onPointerMove:H,onPointerUp:_=>O(_.pointerId,!0),onPointerCancel:_=>O(_.pointerId,!1),onLostPointerCapture:_=>O(_.pointerId,!1),children:R.map(_=>y.jsx("button",{id:`conversation-list-${_.id}`,type:"button",role:"tab","aria-selected":f===_.id,"aria-controls":"conversation-list-panel",tabIndex:f===_.id?0:-1,className:f===_.id?"active":"",onClick:N=>{if(P.current){N.preventDefault();return}E(_.id)},onKeyDown:N=>B(N,_.id),children:_.label},_.id))})]}),y.jsxs("div",{id:"conversation-list-panel",className:"listcol-scroll",role:"tabpanel","aria-labelledby":`conversation-list-${f}`,children:[f==="recent"&&w.length>0&&y.jsx("div",{className:"conversation-group",children:w.map(_=>y.jsx($f,{c:_,active:i===_.id,onClick:()=>e.onSelect(_.id)},_.id))}),f==="identity"&&S.map(_=>y.jsxs("div",{children:[y.jsxs("div",{className:"group-label",title:_.note,children:[_.rootId&&y.jsx(Se,{name:"clusters"}),y.jsx("span",{children:_.label}),_.note&&y.jsxs("span",{className:"gl-note",children:["· ",_.note]})]}),y.jsx("div",{className:"conversation-group",children:_.contacts.map(N=>y.jsx($f,{c:N,grouped:_.rootId!==null,active:i===N.id,onClick:()=>e.onSelect(N.id)},N.id))})]},_.id)),v.length>0&&y.jsxs("div",{children:[y.jsx("div",{className:"group-label",children:y.jsx("span",{children:"Pending"})}),y.jsx("div",{className:"conversation-group",children:v.map(_=>y.jsx($f,{c:_,active:!1,onClick:()=>{},onApprove:()=>e.onApprovePending(_.id.slice(8)),onReject:()=>e.onRejectPending(_.id.slice(8))},_.id))})]}),C&&y.jsx("p",{className:"muted",style:{padding:"14px 10px",fontSize:"0.85rem"},children:"No contacts yet — share an invite to start."})]}),y.jsxs("div",{className:"list-bottom-chrome",ref:c,children:[y.jsxs("div",{className:"search adaptive-search",role:"search",children:[y.jsx("span",{className:"adaptive-search-icon","aria-hidden":!0,children:y.jsx(Se,{name:"search"})}),y.jsx("input",{className:"field",placeholder:"Search people, agents, apps…",value:s,onChange:_=>a(_.target.value),onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),a(""))}})]}),y.jsx("button",{type:"button",className:"icon-btn list-bottom-invite","aria-label":"Invite",title:"Invite",onClick:e.onInvite,children:y.jsx(Se,{name:"invite",size:20})})]})]})}function jz(e){const[t,n]=k.useState(!1),[i,s]=k.useState(e.contact.name),[a,l]=k.useState(!1),[c,f]=k.useState(null),h=k.useRef(!1);k.useEffect(()=>{const p=v=>{v.key!=="Escape"||a||c||t||(v.preventDefault(),e.onBack())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,c,e.onBack,a]);const m=()=>{if(h.current)return;h.current=!0;const p=i.trim();p&&p!==e.contact.name?e.onRename(p):s(e.contact.name),n(!1)};return y.jsxs("div",{className:"detail contact-screen",children:[y.jsxs("div",{className:"detail-head contact-screen-head",children:[y.jsx("button",{type:"button",className:"icon-btn detail-back contact-back","aria-label":"Back to conversation",onClick:e.onBack,children:y.jsx(Se,{name:"back"})}),y.jsx("strong",{children:"Contact"})]}),y.jsxs("div",{className:"contact-screen-scroll",children:[y.jsxs("section",{className:"contact-hero","aria-labelledby":"contact-screen-name",children:[y.jsx("div",{className:"avatar accent contact-avatar-large","aria-hidden":!0,children:e.contact.initials}),t?y.jsx("input",{id:"contact-screen-name",className:"field contact-name-input",value:i,autoFocus:!0,onChange:p=>s(p.target.value),onBlur:m,onKeyDown:p=>{p.key==="Enter"&&m(),p.key==="Escape"&&(h.current=!0,s(e.contact.name),n(!1))}}):y.jsx("h2",{id:"contact-screen-name",children:e.contact.name}),y.jsxs("p",{children:[y.jsx(Se,{name:"lock",size:13})," End-to-end encrypted connection"]})]}),y.jsxs("section",{className:"contact-action-group","aria-label":"Contact actions",children:[y.jsxs("button",{type:"button",onClick:()=>l(!0),children:[y.jsxs("span",{children:[y.jsx(Se,{name:"paperclip"}),"Shared photos, files, and links"]}),y.jsx(Se,{name:"chevron"})]}),y.jsxs("button",{type:"button",onClick:()=>{h.current=!1,s(e.contact.name),n(!0)},children:[y.jsxs("span",{children:[y.jsx(Se,{name:"edit"}),"Rename contact"]}),y.jsx(Se,{name:"chevron"})]})]}),y.jsxs("section",{className:"contact-identity","aria-labelledby":"contact-identity-title",children:[y.jsx("h3",{id:"contact-identity-title",children:"Verified identity"}),e.contact.roleId&&y.jsxs("p",{children:["Role ",y.jsx("strong",{children:e.contact.roleId})," of ",y.jsx("strong",{children:e.contact.rootName})]}),y.jsx("code",{children:e.contact.id}),y.jsxs("button",{type:"button",className:"btn sm",onClick:()=>void navigator.clipboard.writeText(e.contact.id),children:[y.jsx(Se,{name:"copy",size:14}),"Copy identity"]})]}),y.jsxs("button",{type:"button",className:"contact-remove",onClick:e.onRemove,children:[y.jsx(Se,{name:"trash"}),"Remove contact"]})]}),a&&y.jsx(XF,{messages:e.messages,indexOffset:e.indexOffset,onClose:()=>l(!1),onJump:e.onOpenMessage,onPreview:p=>{l(!1),f(p)}}),c&&(Ys(c.filename,c.mime)?y.jsx(aS,{rec:c,onClose:()=>f(null)}):y.jsx(sS,{rec:c,onClose:()=>f(null),onSendText:e.onSendText,onSendFile:e.onSendFile}))]})}const gS=e=>`chat-message-${encodeURIComponent(e)}`,yS=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Uf(e){const{dir:t,canReply:n,onReply:i}=e,s=k.useRef(null),a=k.useRef(null),l=k.useRef(null),c=k.useRef(i);c.current=i;const f=t==="in"?1:-1,h=pS,m=84,p=()=>({id:-1,x0:0,y0:0,mode:"idle",armed:!1,distance:0,samples:[]}),v=k.useRef(p()),w=A=>{const T=a.current,P=l.current,O=yS();if(T&&(T.style.transform=A&&!O?`translateX(${A}px)`:""),P){const D=Math.min(1,Math.abs(A)/h);P.style.opacity=String(D),P.style.transform=O?"scale(1)":`scale(${.5+.5*D})`}},S=(A,T)=>{const P=v.current;if(P.id!==A)return;const O=T&&P.mode==="drag"&&bz(P.distance,P.samples);v.current=p(),a.current?.classList.remove("swiping"),l.current?.classList.remove("armed"),w(0);const D=s.current;D?.hasPointerCapture?.(A)&&D.releasePointerCapture(A),O&&c.current()};k.useEffect(()=>{const A=s.current;if(!A)return;const T=P=>S(P.pointerId,!1);return A.addEventListener("lostpointercapture",T),()=>{A.removeEventListener("lostpointercapture",T);const P=v.current.id;P!==-1&&S(P,!1)}},[]);const C=A=>{const T=A.target,P=window.getSelection?.();!n||!A.isPrimary||A.pointerType==="mouse"||A.pointerType==="pen"&&A.button!==0||v.current.id!==-1||P&&!P.isCollapsed||T.closest('a, button, input, textarea, select, [role="button"], audio, video, img, [draggable="true"], .filecard, .filecard-bubble, .image-bubble, .voice-bubble, .ours-message-file, .attachment')||(v.current={id:A.pointerId,x0:A.clientX,y0:A.clientY,mode:"maybe",armed:!1,distance:0,samples:[{x:A.clientX*f,time:A.timeStamp}]},w(0))},E=A=>{const T=v.current;if(T.id!==A.pointerId||T.mode==="idle")return;const P=A.clientX-T.x0,O=A.clientY-T.y0,D=window.getSelection?.();if(D&&!D.isCollapsed){S(A.pointerId,!1);return}if(T.mode==="maybe"){const q=kz(P*f,O);if(q==="pending")return;if(q==="drag")T.mode="drag",A.currentTarget.setPointerCapture?.(A.pointerId),a.current?.classList.add("swiping");else{T.mode="idle";return}}A.preventDefault();const H=A.timeStamp;T.samples.push({x:A.clientX*f,time:H}),T.samples=T.samples.filter(q=>H-q.time<=120);let B=P*f;B<0&&(B=0),B>h&&(B=h+(B-h)*.35),B=Math.min(B,m),T.distance=B;const _=B*f,N=Math.abs(_)>=h;N!==T.armed&&(T.armed=N,l.current?.classList.toggle("armed",N),N&&navigator.vibrate?.(10)),w(_)},R=A=>{const T=v.current;T.id===A.pointerId&&T.mode==="drag"&&(T.samples.push({x:A.clientX*f,time:A.timeStamp}),T.distance=Math.max(0,(A.clientX-T.x0)*f),T.armed=T.distance>=h),S(A.pointerId,!0)};return y.jsxs("div",{ref:s,className:"msg-row "+(e.rowClass??t),style:n?{touchAction:"pan-y"}:void 0,onPointerDown:C,onPointerMove:E,onPointerUp:R,onPointerCancel:A=>S(A.pointerId,!1),onLostPointerCapture:A=>S(A.pointerId,!1),children:[n&&y.jsx("span",{className:"swipe-cue",ref:l,"aria-hidden":!0,children:y.jsx(Se,{name:"reply",size:16})}),y.jsx("div",{className:"bubble-wrap",ref:a,children:e.children}),e.after]})}const Nz=k.memo(function(t){const{messages:n,optimisticSend:i,sentKeys:s,hiddenEarlier:a,unreadWireId:l,roomLines:c,contactCid:f,contactName:h,onStartReply:m,onPreview:p,onFetchFile:v}=t,w=new Map;for(const P of n)P.wireId&&w.set(P.wireId,P);const S=P=>c.get(P)??null,C=P=>{if(P.dir==="out")return"You";const O=S(P);return O&&O.variant==="chat"?O.author:h},E=P=>{if(P.kind==="file")return P.mime?.startsWith("image/")?"Photo":So(P.mime??"",P.filename??"")?"Voice message":P.filename||"File";const O=S(P);return O?O.text||$j(O):P.text},R=P=>{if(!P.replyTo)return null;const O=w.get(P.replyTo.wireId);return O?{author:C(O),text:E(O)}:{author:"",text:"Original message"}},A=P=>{P.wireId&&m({wireId:P.wireId,author:C(P),text:E(P)})},T=P=>{if(!P)return null;const O=S(P);return O?O.variant==="system"?"room:system":`room:chat:${O.author}${O.role}`:P.dir};return y.jsx(cR,{initial:!1,children:n.map((P,O)=>{const D=P===i?.message?i.key:P.wireId&&s.get(P.wireId)||P.wireId||`${P.date}-${a+O}`,H=gS(P.wireId||D),B=n[O-1],_=n[O+1],N=S(P),q=T(P),V=!!B&&T(B)===q&&q!=="room:system",ae=!!_&&T(_)===q&&q!=="room:system",J=(P.dir==="out"?"out":"in")+(V?" cont-top":"")+(ae?" cont-bot":""),ee=P.wireId?y.jsx("button",{className:"msg-reply",title:"Reply",onClick:()=>A(P),children:y.jsx(Se,{name:"reply",size:15})}):null,ge=P.wireId===l?y.jsx("div",{id:`unread-${H}`,className:"unread-divider",role:"separator",children:y.jsx("span",{children:"Unread messages"})}):null;if(N&&N.variant==="system"){const G=N.presentation??"system";return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:Ss,children:[ge,y.jsxs("div",{className:`room-system room-${G}-card`,role:"note",children:[N.label&&y.jsx("span",{className:"room-system-label",children:N.label}),N.roomName&&y.jsx("strong",{className:"room-card-name",children:N.roomName}),y.jsx(jx,{text:N.text,className:"room-system-text message-markdown"}),!!N.details?.length&&y.jsx("ul",{className:"room-card-details","aria-label":"Room event details",children:N.details.map(le=>y.jsx("li",{children:le},le))}),y.jsxs("span",{className:"room-card-provenance",children:[N.authoredBy&&y.jsx("span",{className:"room-card-author",children:N.authoredBy}),y.jsx("span",{className:"room-system-at",children:ji(P.date)})]})]})]},D)}if(P.kind==="file"){const G=$0(P.wireId)??{id:P.wireId,dir:P.dir,filename:P.filename??"file",mime:P.mime??"application/octet-stream",size:0,date:P.date};return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:12,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.98},transition:Ss,children:[ge,y.jsx(Uf,{dir:P.dir==="out"?"out":"in",rowClass:J,canReply:!!P.wireId,onReply:()=>A(P),after:ee,children:y.jsx("div",{className:`ours-message ours-message-file ours-message--${P.dir}`,children:y.jsx(BD,{rec:G,receipt:P.receipt,receiptless:P.receiptless,onPreview:p,onFetch:v})})})]},D)}if(P.typed){const G=P.typed.kind==="command_result"&&P.replyTo?w.get(P.replyTo.wireId):void 0,le=P.typed.kind==="command_result"&&P.dir==="in"&&P.peerCid===f&&G?.dir==="out"&&G.peerCid===f&&G.typed?.kind==="command",j=P.typed.kind==="command_result"&&!P.typed.outcome.ok?P.typed.outcome.error.toLowerCase():"",F=P.typed.kind==="command"?P.dir==="out"?"Accepted · pending result":"Received command":P.typed.kind==="unknown"?"Safe failure":P.dir==="out"?"Result sent":le?j==="validation_denied"||j==="validation_failed"?"Validation denied":j==="policy_denied"||j==="unauthorized"||j==="forbidden"?"Policy denied":P.typed.outcome.ok?"Completed":"Failed":"Unmatched result · safe failure",Q=P.typed.kind==="command"?P.typed.command:P.typed.kind==="command_result"?`Result for ${le&&G?.typed?.kind==="command"?G.typed.command:"unmatched command"}`:`Unsupported ${P.typed.wire_kind}`,M=P.typed.kind==="command"?P.typed.arguments:P.typed.kind==="command_result"?P.typed.outcome:{safe_failure:P.typed.malformed?"Malformed typed message":"Future typed message preserved"};return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0},transition:Ss,children:[ge,y.jsx(Uf,{dir:P.dir,rowClass:J,canReply:!!P.wireId,onReply:()=>A(P),after:ee,children:y.jsxs("div",{className:`ours-message typed-message ours-message--${P.dir}`,children:[y.jsx("div",{className:"typed-message-kind",children:P.typed.kind==="command"?"Command":P.typed.kind==="command_result"?"Result":"Typed message"}),y.jsx("strong",{children:Q}),y.jsx("div",{className:"typed-message-state",role:"status",children:F}),y.jsx("pre",{children:JSON.stringify(M,null,2)}),y.jsxs("div",{className:"bubble-at",children:[ji(P.date),P.dir==="out"&&y.jsx(Sd,{receipt:P.receipt,receiptless:P.receiptless})]})]})})]},D)}const we=R(P);return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:12,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.98},transition:Ss,children:[ge,y.jsx(Uf,{dir:P.dir==="out"?"out":"in",rowClass:J,canReply:!!P.wireId,onReply:()=>A(P),after:ee,children:y.jsxs("div",{className:`ours-message ours-message--${P.dir}`,children:[we&&y.jsxs("div",{className:"quote",children:[we.author&&y.jsx("span",{className:"quote-author",children:we.author}),y.jsx("span",{className:"quote-text",children:we.text})]}),N&&!V&&y.jsxs(y.Fragment,{children:[N.roomName&&y.jsx("div",{className:"room-message-room",children:N.roomName}),y.jsxs("div",{className:"room-author",children:[y.jsx("span",{className:"room-author-name",children:N.author}),N.role&&y.jsx("span",{className:"room-author-role",children:N.role})]})]}),y.jsx(jx,{text:N?N.text:P.text}),y.jsxs("div",{className:"bubble-at",children:[ji(P.date),P.dir==="out"&&y.jsx(Sd,{receipt:P.receipt,receiptless:P.receiptless})]})]})})]},D)})})});function Mz(e){const{contact:t,messages:n}=e,[i,s]=k.useState(""),[a,l]=k.useState(!1),[c,f]=k.useState(null),[h,m]=k.useState(null),[p,v]=k.useState(null),[w,S]=k.useState(null),[C,E]=k.useState(null),[R,A]=k.useState(!1),[T,P]=k.useState(!1),[O,D]=k.useState(!1),[H,B]=k.useState(null),[_,N]=k.useState(null),[q,V]=k.useState(!1),[ae,J]=k.useState(!1),[ee,ge]=k.useState(!1),[we,G]=k.useState(!1),[le,j]=k.useState(!1),[F,Q]=k.useState(null),[M,Z]=k.useState(null),ye=k.useRef(null),me=k.useRef(null),he=k.useRef(null),be=_?.recipient_cid===t?.id?_:null,Be=/^\/[^\s/]*$/.test(i)&&ee&&!q&&!we&&!le,Oe=Be&&e.onSendCommand?be?.commands.filter(Y=>Y.name.toLowerCase().startsWith(i.slice(1).toLowerCase()))??[]:[],Ge=JSON.stringify([t?.id,be?.fingerprint,i]),ut=F?.key===Ge?Oe.findIndex(Y=>Y.name===F.name):-1,it=k.useRef(null),Mt=k.useRef(null),Xt=k.useRef(null),Je=k.useRef(null),zt=k.useRef(null),bn=k.useRef(null),It=k.useRef(null),Yt=k.useRef(!1),Tt=k.useRef(null),We=k.useRef(!1),[Cr,ur]=k.useState(!1),[X,ie]=k.useState(0),je=k.useRef(null),Ne=k.useRef(!0),Fe=k.useRef(null),ot=k.useRef(0),U=k.useRef(null),ue=k.useRef(new Map),fe=k.useRef(0),Ae=k.useRef(null),Pe=k.useRef(null),de=k.useRef(0),ze=k.useRef(null),Gt=k.useRef("");k.useLayoutEffect(()=>{const Y=zt.current,ce=bn.current,pe=It.current;if(!Y||!ce||!pe)return;let $e=-1,Bt=-1,sn=null;const Pt=()=>{const Dt=Math.round(ce.getBoundingClientRect().height),Cn=Math.round(pe.getBoundingClientRect().height);if(Dt!==$e&&($e=Dt,Y.style.setProperty("--conversation-head-height",`${Dt}px`)),Cn!==Bt){const yt=Ne.current;Bt=Cn,Y.style.setProperty("--conversation-compose-height",`${Cn}px`),yt&&(sn!==null&&cancelAnimationFrame(sn),sn=requestAnimationFrame(()=>{sn=null;const cr=Tt.current;cr&&Ne.current&&(cr.scrollTop=Math.max(0,cr.scrollHeight-cr.clientHeight))}))}};Pt();const On=new ResizeObserver(Pt);return On.observe(ce),On.observe(pe),()=>{On.disconnect(),sn!==null&&cancelAnimationFrame(sn),Y.style.removeProperty("--conversation-head-height"),Y.style.removeProperty("--conversation-compose-height")}},[t?.id]),k.useEffect(()=>{s(""),m(null),v(null),f(null),S(null),E(null),A(!1),P(!1),D(!1),ot.current+=1,B(null),it.current?.abort(),N(null),V(!1),J(!1),Q(null),j(!1),G(!1),ue.current.clear(),Ae.current=null,Pe.current=null},[t?.id]);const Qt=async(Y=!0,ce=!0)=>{if(!t||!e.onLoadCommands)return;it.current?.abort();const pe=new AbortController;it.current=pe,J(!0),ce&&m(null);try{const $e=await e.onLoadCommands(t.id,pe.signal);!pe.signal.aborted&&$e.recipient_cid===t.id?(N($e),$e.commands.length===0?(V(!1),q&&requestAnimationFrame(()=>Je.current?.focus({preventScroll:!0}))):Y&&V(!0)):pe.signal.aborted||(N(null),V(!1),ce&&m("Command discovery was refused because the authenticated recipient changed."))}catch($e){pe.signal.aborted||(N(null),V(!1),ce&&m($e instanceof Wl?`Command discovery failed: ${$e.message}`:"Command discovery failed safely. The recipient may be offline or unsupported."))}finally{it.current===pe&&J(!1)}};k.useEffect(()=>(Qt(!1,!1),()=>it.current?.abort()),[t?.id]);const ht=()=>{V(!1),Mt.current?.focus()},pt=k.useRef(Qt);pt.current=Qt,k.useEffect(()=>{if(!Be||!e.onLoadCommands)return;let Y=!1,ce;const pe=async()=>{await pt.current(!1,!1),Y||(ce=setTimeout(pe,2e3))};return pe(),()=>{Y=!0,clearTimeout(ce),it.current?.abort()}},[Be,t?.id]),k.useEffect(()=>{he.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest",behavior:"instant"})},[ut,Ge]);const Ze=()=>{ye.current=null,Z(null)};k.useLayoutEffect(Ze,[Be,Ge]),k.useLayoutEffect(()=>{me.current!==null&&(Je.current?.setSelectionRange(me.current,me.current),me.current=null)},[i]);const Ln=Y=>{if(!Be||!Oe.some(pe=>pe.name===Y))return;const ce=`/${Y} `;me.current=ce.length,s(ce),Q(null),j(!0),Ze(),Je.current?.focus({preventScroll:!0})};k.useEffect(()=>{if(!p)return;const Y=p.reply?.wireId;n.some(pe=>pe.kind!=="file"&&pe.dir==="out"&&!!pe.wireId&&!p.wireIds.has(pe.wireId)&&pe.text===p.text&&(pe.replyTo?.wireId??void 0)===Y)&&(v(null),m(null),s(pe=>pe===p.draft?"":pe),S(pe=>pe===p.reply?null:pe))},[n,p]);const mn=!!c?.wireId&&n.some(Y=>Y.wireId===c.wireId),Vt=k.useMemo(()=>c&&!mn?[...n,c.message]:n,[n,c,mn]);k.useEffect(()=>{mn&&f(null)},[mn]),k.useLayoutEffect(()=>{const Y=Je.current;if(!Y)return;i.startsWith(Gt.current)||(Y.style.height="0px");const pe=Y.scrollHeight,Bt=`${Math.max(44,Math.min(pe,132))}px`;Y.style.height!==Bt&&(Y.style.height=Bt),Y.style.overflowY=pe>132?"auto":"hidden",Gt.current=i},[i,t?.id]);const _i=Y=>{const ce=Tt.current;if(!ce)return;const pe=Math.max(0,ce.scrollHeight-ce.clientHeight);if(Math.abs(ce.scrollTop-pe)<1){Ae.current=null,Pe.current=null;return}const $e=Y&&!yS();Ae.current=$e?pe:null,Pe.current=$e?ce.scrollTop:null,$e?ce.scrollTo({top:pe,behavior:"smooth"}):ce.scrollTop=pe},Er=()=>{je.current===null&&(je.current=requestAnimationFrame(()=>{je.current=null;const Y=Tt.current;if(!Y)return;const ce=Y.scrollHeight-Y.clientHeight-Y.scrollTop>48;ur(ce),ce||ie(0)}))};k.useLayoutEffect(()=>{if(!t){Fe.current=null,Ne.current=!0,de.current=0;return}const Y=Tt.current;if(!Y)return;const ce=Fe.current!==t.id,pe=de.current,$e=Vt.length!==pe,Bt=Vt.at(-1),sn=Bt?Bt.wireId||`${Bt.date}:${Bt.text}`:null,Pt=ze.current;if(de.current=Vt.length,ze.current=sn,!ce&&!$e&&Ae.current===null&&(Ne.current=Y.scrollHeight-Y.clientHeight-Y.scrollTop<=48),ce||Ne.current)_i($e&&!ce&&Fe.current!==null),Ne.current=!0;else if($e&&Vt.length>pe&&sn!==Pt){const On=Pt===null?-1:Vt.findIndex(Dt=>(Dt.wireId||`${Dt.date}:${Dt.text}`)===Pt);ie(Dt=>Dt+Math.max(1,Vt.length-Math.max(0,On+1)))}Fe.current=t.id,Er()},[t,Vt.length]),k.useLayoutEffect(()=>{if(We.current||!e.unreadOpen||window.location.hash.startsWith("#chat-message-"))return;const Y=Tt.current,ce=document.getElementById(`unread-${gS(e.unreadOpen.wireId)}`);!Y||!ce||(Y.scrollTop=Math.max(0,ce.offsetTop-16),Ne.current=!1,We.current=!0,Er())},[e.unreadOpen,Vt.length]),k.useLayoutEffect(()=>{const Y=window.location.hash;if(!Y.startsWith("#chat-message-"))return;const ce=document.getElementById(Y.slice(1));ce&&(ce.scrollIntoView({block:"center"}),Ne.current=!1)},[t?.id,Vt.length]),k.useLayoutEffect(()=>{const Y=U.current,ce=Tt.current;if(Y===null||!ce)return;const pe=requestAnimationFrame(()=>{U.current===Y&&(ce.scrollTop=Y.top+ce.scrollHeight-Y.height,U.current=null)});return()=>cancelAnimationFrame(pe)},[Vt.length]),k.useEffect(()=>{const Y=Tt.current;if(!Y||typeof ResizeObserver>"u")return;const ce=Y.firstElementChild;if(!ce)return;const pe=new ResizeObserver(()=>{Ne.current&&_i(Ae.current!==null),Er()});return pe.observe(ce),pe.observe(Y),()=>{pe.disconnect(),je.current!==null&&cancelAnimationFrame(je.current)}},[t?.id]);const Mo=async Y=>{const ce=++ot.current;m(null),D(!0);try{if(Y.size>ks&&uS(Y.type,Y.name)){const $e=await sz(Y,ks);if(ce!==ot.current)return;E({filename:$e.filename,mime:$e.mime,bytes:$e.bytes,originalSize:$e.originalSize});return}if(Y.size>ks){m(`"${Y.name}" is ${ti(Y.size)} — files up to ${ti(ks)} can be sent.`);return}const pe=await Y.arrayBuffer();if(ce!==ot.current)return;E({filename:Y.name||"file",mime:Y.type||"application/octet-stream",bytes:new Uint8Array(pe)})}catch(pe){ce===ot.current&&m(`Photo optimization failed: ${pe instanceof Error?pe.message:String(pe)}`)}finally{ce===ot.current&&D(!1)}},oi=()=>{!C||!e.onSendFile||T||(P(!0),e.onSendFile(C,w?.wireId).then(()=>{E(null),S(null)}).catch(Y=>m(`File send failed: ${String(Y)} — it was not delivered.`)).finally(()=>P(!1)))},si=e.onDraftChange;k.useEffect(()=>(si?.(i.trim().length>0||a),()=>si?.(!1)),[i,a,si]);const ai=k.useMemo(()=>{const Y=new Map;for(const ce of Vt)Y.set(ce,ce.kind==="file"?null:ce.dir==="in"?_j(t?.announcedName??"",ce.text):null);return Y},[Vt,t?.announcedName]);if(!t)return e.emptyOverride?y.jsx(y.Fragment,{children:e.emptyOverride}):y.jsx("div",{className:"detail",children:y.jsxs("div",{className:"detail-empty",children:[y.jsx(Se,{name:"chat"}),y.jsxs("div",{children:[y.jsx("div",{style:{fontWeight:650,color:"var(--text-2)"},children:"Select a conversation"}),y.jsx("div",{style:{fontSize:"0.85rem"},children:"Chat with people, agents and apps across ours."})]})]})});const Io=async()=>{const Y=i,ce=Y.trim(),pe=!!p&&Y===p.draft&&(w?.wireId??void 0)===p.reply?.wireId;if(!ce||Yt.current||pe)return;p&&v(null),Yt.current=!0,l(!0),m(null);const $e=w,Bt=$e?.wireId,sn=new AbortController;let Pt=!1,On=0;s(""),S(null);const Dt=`optimistic-${++fe.current}`;f({key:Dt,wireId:null,message:{dir:"out",text:ce,date:new Date().toISOString(),read:!0,wireId:"",replyTo:Bt?{wireId:Bt}:null}});try{const Cn=await Promise.race([e.onSend(ce,Bt,sn.signal),new Promise((yt,cr)=>{On=window.setTimeout(()=>{Pt=!0,sn.abort(),cr(new Error("send timeout"))},Rz)})]);Cn?(ue.current.set(Cn,Dt),f(yt=>yt?.key===Dt?{...yt,wireId:Cn}:yt)):f(yt=>yt?.key===Dt?null:yt),v(null)}catch(Cn){f(null),s(yt=>yt===""?Y:yt),S(yt=>yt===null?$e:yt),Pt||!(Cn instanceof Wl)?(v({draft:Y,text:ce,reply:$e,wireIds:new Set(n.flatMap(yt=>yt.wireId?[yt.wireId]:[]))}),m(`${Pt?"Send timed out":"Send connection was interrupted"} — delivery status is unknown. Check the conversation; edit the draft before sending again.`)):m(`Send failed: ${String(Cn)} — the message was not delivered.`)}finally{window.clearTimeout(On),Yt.current=!1,l(!1)}},Tr=!!p&&i===p.draft&&(w?.wireId??void 0)===p.reply?.wireId;return y.jsxs("div",{className:"detail detail-chat",ref:zt,children:[y.jsx("div",{className:"detail-head",ref:bn,children:y.jsxs("div",{className:"conv-peer",children:[y.jsx("button",{className:"icon-btn detail-back","aria-label":"Back to conversations",onClick:e.onBack,children:y.jsx(Se,{name:"back"})}),y.jsxs("div",{className:"conv-peer-status",children:[y.jsx("span",{className:"conv-peer-name",children:t.name}),e.syncing&&y.jsxs("div",{className:"conv-sync",role:"status","aria-live":"polite",children:[y.jsx("span",{className:"conv-sync-dot","aria-hidden":!0}),e.syncing==="connecting"?"Connecting…":"Updating…"]}),!e.syncing&&y.jsxs("span",{className:"conv-contact-status",children:[y.jsx(Se,{name:"lock",size:11}),"Encrypted connection"]})]}),y.jsx("button",{type:"button",className:"conv-contact-trigger conv-contact-avatar","data-contact-trigger":!0,onClick:e.onOpenContact,disabled:!e.onOpenContact,"aria-label":`Open contact details for ${t.name}`,children:y.jsx("span",{className:"conv-contact-initials","aria-hidden":!0,children:t.initials})})]})}),y.jsx("div",{className:"messages",ref:Tt,tabIndex:-1,"aria-label":"Conversation timeline",onScroll:Y=>{const ce=Y.currentTarget,pe=ce.scrollHeight-ce.clientHeight-ce.scrollTop;if(Ae.current!==null){const $e=Pe.current;if($e===null||ce.scrollTop>=$e-1){Pe.current=ce.scrollTop,pe<=4&&(Ae.current=null,Pe.current=null);return}Ae.current=null,Pe.current=null}Ne.current=pe<=48,Er()},onPointerDown:()=>{Ae.current=null,Pe.current=null},onTouchStart:()=>{Ae.current=null,Pe.current=null},onWheel:()=>{Ae.current=null,Pe.current=null},onDragOver:Y=>{e.onSendFile&&Y.preventDefault()},onDrop:Y=>{if(!e.onSendFile)return;Y.preventDefault();const ce=Y.dataTransfer.files?.[0];ce&&Mo(ce)},children:y.jsxs("div",{className:"messages-inner",children:[y.jsxs("div",{className:"e2e-note",children:[y.jsx(Se,{name:"lock"}),"End-to-end encrypted · the broker only sees ciphertext"]}),(e.hiddenEarlier??0)>0&&e.onLoadEarlier&&y.jsxs("button",{className:"btn sm chat-load-earlier",onClick:()=>{Ne.current=!1;const Y=Tt.current;U.current=Y?{height:Y.scrollHeight,top:Y.scrollTop}:null,e.onLoadEarlier?.()},children:["Load earlier messages (",e.hiddenEarlier," remaining)"]}),y.jsx(Nz,{messages:Vt,optimisticSend:c,sentKeys:ue.current,hiddenEarlier:e.hiddenEarlier??0,unreadWireId:e.unreadOpen?.wireId,roomLines:ai,contactCid:t.id,contactName:t.name,onStartReply:S,onPreview:B,onFetchFile:e.onFetchFile}),y.jsx("div",{className:"thread-end","aria-hidden":!0})]})},t.id),Cr&&y.jsxs("button",{type:"button",className:"jump-latest btn sm","aria-label":X?`Jump to latest, ${X} new messages`:"Jump to latest",onClick:Y=>{const ce=Y.currentTarget===document.activeElement;ie(0),_i(!0),ce&&requestAnimationFrame(()=>Tt.current?.focus({preventScroll:!0}))},children:[y.jsx("span",{children:"Jump to latest"}),!!X&&y.jsx("span",{className:"jump-latest-count","aria-live":"polite",children:X})]}),h&&y.jsxs("div",{className:"banner error",role:"alert",children:[h,h.startsWith("Send failed:")&&y.jsx("span",{className:"banner-actions",children:y.jsx("button",{className:"linkbtn",onClick:()=>void Io(),children:"retry"})})]}),y.jsxs("div",{className:"composer-wrap",ref:It,children:[q&&be&&e.onSendCommand&&y.jsx(vz,{catalog:be,recipientName:t.name,busy:ae,onRefresh:()=>void Qt(!0,!0),onClose:ht,onSend:async(Y,ce,pe,$e)=>{if(!t||t.id!==be.recipient_cid)throw new Error("Recipient changed; refresh commands");return e.onSendCommand(t.id,Y.name,ce,pe,$e)}},`${be.recipient_cid}:${be.fingerprint}`),Oe.length>0&&y.jsx("div",{ref:he,id:"composer-command-suggestions",className:"command-suggestions",role:"listbox","aria-label":"Suggested contact commands",onScroll:Ze,children:Oe.map((Y,ce)=>y.jsxs("div",{id:`composer-command-option-${ce}`,role:"option","aria-selected":ce===ut,className:"command-suggestion","data-pressed":M?.key===Ge&&M.name===Y.name||void 0,onPointerDown:pe=>{!pe.isPrimary||pe.button!==0||(pe.preventDefault(),ye.current={key:Ge,name:Y.name},Z({key:Ge,name:Y.name,pointer:pe.pointerId,x:pe.clientX,y:pe.clientY}))},onPointerMove:pe=>{M?.pointer===pe.pointerId&&Math.hypot(pe.clientX-M.x,pe.clientY-M.y)>10&&Ze()},onPointerUp:()=>Z(null),onPointerCancel:Ze,onPointerLeave:pe=>{pe.buttons!==0&&Ze()},onClick:pe=>{const $e=ye.current;Ze(),(pe.detail===0||$e?.key===Ge&&$e.name===Y.name)&&Ln(Y.name)},children:[y.jsxs("strong",{children:["/",Y.name]}),Y.description&&y.jsx("span",{children:Y.description})]},`${Ge}:${Y.name}`))}),w&&y.jsxs("div",{className:"reply-bar",children:[y.jsx("div",{className:"reply-bar-line"}),y.jsxs("div",{className:"reply-bar-body",children:[y.jsxs("div",{className:"reply-bar-author",children:["Replying to ",w.author]}),y.jsx("div",{className:"reply-bar-text",children:w.text})]}),y.jsx("button",{className:"icon-btn",title:"Cancel reply",onClick:()=>S(null),children:y.jsx(Se,{name:"close",size:16})})]}),C&&y.jsx(z1,{att:C,sending:T,onSend:oi,onDiscard:()=>E(null)}),O&&y.jsx("div",{className:"attachment-processing",role:"status",children:"Optimizing photo for secure delivery…"}),y.jsxs("div",{className:"composer"+(R?" recording":""),children:[e.onLoadCommands&&be&&be.commands.length>0&&y.jsx("button",{ref:Mt,type:"button",className:"icon-btn composer-tool command-trigger",title:"Recipient commands","aria-label":"Recipient commands","aria-expanded":q,disabled:ae,onClick:()=>{q?ht():V(!0)},children:y.jsx(Se,{name:"menu",size:19})}),e.onSendFile&&y.jsxs(y.Fragment,{children:[y.jsx("input",{ref:Xt,type:"file",style:{display:"none"},onChange:Y=>{const ce=Y.target.files?.[0];ce&&Mo(ce),Y.target.value=""}}),y.jsx("button",{className:"icon-btn composer-tool",title:"Attach a file or photo",disabled:T||O||R,onClick:()=>Xt.current?.click(),children:y.jsx(Se,{name:"paperclip",size:18})})]}),y.jsx("textarea",{ref:Je,className:"field",rows:1,placeholder:(w?"Reply to "+w.author:"Message "+t.name)+"…",value:i,"aria-busy":a,"aria-autocomplete":Oe.length?"list":void 0,"aria-controls":Oe.length?"composer-command-suggestions":void 0,"aria-activedescendant":ut>=0?`composer-command-option-${ut}`:void 0,onFocus:()=>ge(!0),onBlur:()=>{ge(!1),Q(null)},onCompositionStart:()=>{G(!0),Q(null)},onCompositionEnd:()=>G(!1),onChange:Y=>{s(Y.target.value),Q(null),j(!1)},onKeyDown:Y=>{if(!(we||Y.nativeEvent.isComposing||Y.keyCode===229)){if(Oe.length&&!Y.shiftKey&&!Y.altKey&&!Y.ctrlKey&&!Y.metaKey){if(Y.key==="ArrowDown"||Y.key==="ArrowUp"){Y.preventDefault();const ce=ut<0?Y.key==="ArrowDown"?0:Oe.length-1:(ut+(Y.key==="ArrowDown"?1:-1)+Oe.length)%Oe.length;Q({key:Ge,name:Oe[ce].name});return}if((Y.key==="Enter"||Y.key==="Tab")&&ut>=0){Y.preventDefault(),Ln(Oe[ut].name);return}if(Y.key==="Escape"){Y.preventDefault(),j(!0),Q(null);return}}Y.key==="Enter"?!(window.matchMedia("(pointer: coarse)").matches||window.innerWidth<=860)&&!Y.shiftKey&&(Y.preventDefault(),Io()):Y.key==="Escape"&&S(null)}}}),e.onSendFile&&!i.trim()&&!C&&!O&&!T?y.jsx(V1,{disabled:T||O||!!C,onReady:Y=>{A(!1),E(Y)},onError:Y=>{A(!1),m(Y)},onActiveChange:A},t.id):y.jsxs("button",{className:"btn primary","aria-label":"Send",onPointerDown:Y=>{Y.button===0&&document.activeElement===Je.current&&Y.preventDefault()},onClick:()=>void Io(),disabled:a||Tr||!i.trim(),title:Tr?"Delivery status unknown — edit before sending again":void 0,children:[y.jsx(Se,{name:"send",size:16}),y.jsx("span",{className:"btn-label",children:"Send"})]})]})]}),H&&(Ys(H.filename,H.mime)?y.jsx(aS,{rec:H,onClose:()=>B(null)}):y.jsx(sS,{rec:H,onClose:()=>B(null),onSendText:e.onSend,onSendFile:e.onSendFile}))]})}const vS=3;function Iz(e,t,n=vS){return[t,...e.filter(i=>i.cid!==t.cid)].slice(0,n)}function Dz(e,t){return e.filter(n=>n.id!==t)}const _z=6e3,Lz=Iz,Oz=Dz;function Fz(){const[e,t]=k.useState([]),n=k.useRef(0),i=k.useCallback((l,c,f)=>{const h=Date.now(),m={id:`${l}:${h}:${n.current++}`,cid:l,name:c,preview:"",at:h};t(p=>Lz(p,m,vS))},[]),s=k.useCallback(l=>t(c=>Oz(c,l)),[]),a=k.useCallback(l=>t(c=>c.filter(f=>f.cid!==l)),[]);return{toasts:e,push:i,dismiss:s,clear:a}}function zz(e){const{item:t,onOpen:n,onDismiss:i}=e,[s,a]=k.useState(!1),[l,c]=k.useState(!1),f=s||l;return k.useEffect(()=>{if(f)return;const h=setTimeout(()=>i(t.id),_z);return()=>clearTimeout(h)},[t.id,f,i]),y.jsxs("div",{className:"banner msg",role:"status",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>c(!0),onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||c(!1)},children:[y.jsxs("button",{className:"msg-open",title:`Open the conversation with ${t.name}`,onClick:()=>n(t.cid),children:[y.jsx("span",{className:"avatar sm accent","aria-hidden":"true",children:wd(t.name)}),y.jsxs("span",{className:"msg-text",children:[y.jsx("strong",{className:"msg-name",children:t.name}),y.jsx("span",{className:"msg-preview",children:t.preview||"New message"})]})]}),y.jsx("button",{className:"icon-btn msg-close",title:"Dismiss","aria-label":`Dismiss the notification from ${t.name}`,onClick:()=>i(t.id),children:y.jsx(Se,{name:"close",size:15})})]})}function Vz(e){return y.jsx(y.Fragment,{children:e.items.map(t=>y.jsx(zz,{item:t,onOpen:e.onOpen,onDismiss:e.onDismiss},t.id))})}function Bz(e){const t=k.useRef(null),{text:n,size:i=240}=e;return k.useEffect(()=>{if(!t.current||!n)return;const s=t.current;Wh(()=>import("./browser-DThvWPee.js").then(a=>a.b),[]).then(a=>{a.toCanvas(s,n,{width:i,margin:2,errorCorrectionLevel:"M",color:{dark:"#000000",light:"#ffffff"}})})},[n,i]),y.jsx("div",{style:{display:"flex",justifyContent:"center",margin:"8px 0"},children:y.jsx("canvas",{ref:t,"data-testid":"qr-canvas","data-invite":n,width:i,height:i,style:{borderRadius:8,border:"1px solid var(--line)",imageRendering:"pixelated"}})})}function $z(e){const t=k.useRef(null),n=k.useRef(null),i=k.useRef(null),s=k.useRef(0),a=k.useRef(!0),[l,c]=k.useState("requesting"),[f,h]=k.useState(""),m=k.useCallback(()=>{s.current&&cancelAnimationFrame(s.current),i.current&&(i.current.getTracks().forEach(w=>w.stop()),i.current=null),t.current&&(t.current.srcObject=null)},[]),p=k.useCallback(w=>{i.current=w;const S=t.current;S.srcObject=w,S.setAttribute("playsinline","true"),S.play();const C=n.current,E=C.getContext("2d"),R=()=>{if(a.current)if(S.readyState>=S.HAVE_ENOUGH_DATA){const A=S.videoWidth||320,T=S.videoHeight||240;C.width=A,C.height=T,E.drawImage(S,0,0,A,T);const P=E.getImageData(0,0,A,T);Wh(()=>import("./jsQR-D4Lkm6eX.js").then(O=>O.j),[]).then(O=>{const D=O.default,H=D(P.data,P.width,P.height,{inversionAttempts:"dontInvert"});if(H&&H.data&&a.current){m(),e.onDecode(H.data);return}a.current&&(s.current=requestAnimationFrame(R))})}else s.current=requestAnimationFrame(R)};s.current=requestAnimationFrame(R)},[m,e]);k.useEffect(()=>{if(a.current=!0,!navigator.mediaDevices?.getUserMedia){c("nocamera");return}return navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}).then(w=>{if(!a.current){w.getTracks().forEach(S=>S.stop());return}c("scanning"),p(w)}).catch(w=>{if(!a.current)return;const S=w.name??"";S==="NotAllowedError"||S==="PermissionDeniedError"?c("denied"):S==="NotFoundError"||S==="DevicesNotFoundError"?c("nocamera"):(c("error"),h(w.message??String(w)))}),()=>{a.current=!1,m()}},[]);const v=()=>{m(),e.onClose()};return y.jsxs("div",{"data-testid":"qr-scanner",style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 0"},children:[(l==="requesting"||l==="scanning")&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.88rem"},children:l==="requesting"?"Requesting camera…":"Point your camera at the QR code."}),y.jsxs("div",{style:{position:"relative",borderRadius:8,overflow:"hidden",background:"#000",minHeight:200},children:[y.jsx("canvas",{ref:n,"data-testid":"scanner-canvas",style:{display:"none"}}),y.jsx("video",{ref:t,"data-testid":"scanner-video",muted:!0,playsInline:!0,style:{width:"100%",display:"block",borderRadius:8}}),l==="scanning"&&y.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsx("div",{style:{width:160,height:160,borderRadius:12,border:"2px solid var(--accent)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.4)"}})})]})]}),l==="denied"&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--text-2)"},children:[y.jsx(Se,{name:"shield",size:16}),y.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:"Camera access denied"})]}),y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.88rem"},children:"Camera permission was denied. To scan QR codes, allow camera access in your browser settings, then try again. Or paste the invite text below instead."})]}),l==="nocamera"&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--text-2)"},children:[y.jsx(Se,{name:"close",size:16}),y.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:"No camera available"})]}),y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.88rem"},children:"No camera was found on this device. Paste the invite text below instead."})]}),l==="error"&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:y.jsxs("p",{style:{margin:0,fontSize:"0.85rem",color:"var(--danger, #e53)"},children:["Camera error: ",f||"unknown error",". Paste the invite text below instead."]})}),y.jsx("button",{className:"btn",style:{justifyContent:"center"},onClick:v,children:l==="scanning"?y.jsxs(y.Fragment,{children:[y.jsx(Se,{name:"close",size:14}),"Cancel scan"]}):y.jsxs(y.Fragment,{children:[y.jsx(Se,{name:"close",size:14}),"Close scanner"]})})]})}function Uz(e){const[t,n]=k.useState("generate"),[i,s]=k.useState("one_time"),[a,l]=k.useState(""),[c,f]=k.useState(null),[h,m]=k.useState("one_time"),[p,v]=k.useState(""),[w,S]=k.useState(""),[C,E]=k.useState(!1),[R,A]=k.useState(null),[T,P]=k.useState(null),[O,D]=k.useState(!1),[H,B]=k.useState(null),_=k.useRef(!1),N=async()=>{if(!_.current){_.current=!0,E(!0),P(null),A(null);try{m(i),f(await e.onCreate(i,i==="one_time"&&a.trim()||void 0))}catch(V){P(V instanceof Error?V.message:String(V))}finally{_.current=!1,E(!1)}}},q=y.jsx(lS,{className:"modal-tabs",label:"Invite mode",options:[{id:"generate",label:"Generate invite"},{id:"accept",label:"Accept invite"}],value:t,onChange:n,idPrefix:"invite-tab",panelId:"invite-panel"});return y.jsx(Zs,{title:t==="generate"?"Invite a contact":"Accept an invite",onClose:()=>{_.current||e.onClose()},tabs:q,children:y.jsxs("div",{id:"invite-panel",role:"tabpanel","aria-labelledby":`invite-tab-${t}`,children:[t==="generate"&&!c&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:13},children:[y.jsxs("p",{className:"muted","data-testid":"invite-identity",style:{margin:0,fontSize:"0.85rem"},children:["Creating as ",y.jsx("strong",{children:e.identity.name})," · ",y.jsxs("span",{className:"mono",children:["@",V0(e.identity.cid)]})]}),y.jsxs("div",{role:"radiogroup","aria-label":"Invite kind",style:{display:"flex",flexDirection:"column",gap:7},children:[y.jsxs("label",{children:[y.jsx("input",{type:"radio",name:"invite-kind",checked:i==="one_time",onChange:()=>s("one_time")})," One person (one time)"]}),y.jsxs("label",{children:[y.jsx("input",{type:"radio",name:"invite-kind",checked:i==="public",onChange:()=>s("public")})," Reusable public invite"]})]}),i==="one_time"?y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.9rem"},children:"Optionally name the person or agent this invite is for."}),y.jsx("input",{className:"field",value:a,onChange:V=>l(V.target.value),placeholder:"Their name (optional), e.g. Bob",maxLength:64})]}):y.jsx("p",{className:"onb-warning","data-testid":"public-invite-warning",style:{margin:0,fontSize:"0.9rem"},children:"Anyone with this invite can connect until you revoke it. It has no expiry and stays valid across server restarts."}),y.jsx("button",{className:"btn primary",style:{justifyContent:"center"},disabled:C,onClick:()=>void N(),children:C?"Generating…":i==="public"?"Create public invite":"Generate invite"}),i==="public"&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.jsx("h4",{style:{margin:0,fontSize:"0.9rem"},children:"Active reusable invites"}),e.invites.filter(V=>V.mode==="public").length===0&&y.jsx("p",{className:"muted",style:{margin:0},children:"None right now."}),e.invites.filter(V=>V.mode==="public").map(V=>y.jsxs("div",{"data-testid":"public-invite-row",style:{padding:"8px 10px",background:"var(--inset)",borderRadius:7},children:[y.jsx("span",{className:"mono",children:V.invite_id}),y.jsxs("p",{className:"muted",children:["Created ",V.created?Kj(V.created):"unknown"," · Active until revoked · No expiry"]}),H===V.invite_id?y.jsxs("span",{children:[y.jsx("button",{className:"btn sm danger",onClick:()=>void e.onRevoke(V.invite_id).then(()=>(B(null),e.onRefresh())).catch(ae=>P(String(ae))),children:"Confirm revoke"})," ",y.jsx("button",{className:"btn sm",onClick:()=>B(null),children:"Keep it"})]}):y.jsx("button",{className:"btn sm",onClick:()=>B(V.invite_id),children:"Revoke"})]},V.invite_id))]}),R&&y.jsx("p",{className:"muted",children:R}),T&&y.jsx("p",{className:"onb-error",children:T})]}),t==="generate"&&c&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"muted","data-testid":h==="public"?"public-result-note":void 0,children:h==="public"?"Shown only on this screen. Copy it now; the text cannot be recovered later. The invite stays active until revoked.":`Send this invite to ${a.trim()||"your contact"}. It can be redeemed once.`}),y.jsx("textarea",{className:"field mono","data-testid":"invite-result-text",readOnly:!0,rows:5,value:c,onFocus:V=>V.currentTarget.select()}),h==="one_time"&&y.jsx(Bz,{text:c}),y.jsxs("button",{className:"btn primary",onClick:()=>void navigator.clipboard.writeText(c).then(()=>A("Copied to clipboard.")),children:[y.jsx(Se,{name:"copy",size:15}),"Copy invite"]}),h==="public"&&y.jsx("button",{className:"btn","data-testid":"done-hide-invite",onClick:()=>{f(null),l(""),e.onRefresh()},children:"Done — hide invite"}),R&&y.jsx("p",{className:"muted",children:R})]}),t==="accept"&&y.jsxs("form",{style:{display:"flex",flexDirection:"column",gap:13},onSubmit:V=>{V.preventDefault(),!(!p.trim()||C)&&(E(!0),P(null),e.onAccept(p.trim(),w.trim()||void 0).then(()=>{A("Invite accepted — the contact will appear once the sender verifies your identity."),v(""),S("")}).catch(ae=>P(String(ae))).finally(()=>E(!1)))},children:[y.jsx("p",{className:"muted",children:"Paste the invite you received, or scan a QR code."}),O?y.jsx($z,{onDecode:V=>{v(V),D(!1)},onClose:()=>D(!1)}):y.jsxs("button",{type:"button",className:"btn",onClick:()=>D(!0),children:[y.jsx(Se,{name:"monitor",size:15}),"Scan QR code"]}),y.jsx("textarea",{className:"field mono","aria-label":"Invite",rows:5,value:p,onChange:V=>v(V.target.value),placeholder:"Paste invite text…"}),y.jsx("input",{className:"field",value:w,onChange:V=>S(V.target.value),placeholder:"Rename them (optional)",maxLength:64}),y.jsx("button",{className:"btn primary",type:"submit",disabled:C||!p.trim(),children:C?"Connecting…":"Add contact"}),R&&y.jsx("p",{className:"muted",children:R}),T&&y.jsx("p",{className:"onb-error",children:T})]})]})})}function Wz(e){const[t,n]=k.useState(e.identity.bio??""),[i,s]=k.useState(!1),[a,l]=k.useState(null),[c,f]=k.useState(e.push.preview),h=LA(),m=!e.workerSupported||e.push.status==="unsupported"?h??"Unavailable — requires a secure browser with service-worker support.":e.push.status==="needs-permission"?h??"Needs permission — allow notifications, then choose Enable or Repair.":e.push.status==="on"?"On — this browser and the server agree on the current Web Push configuration.":e.push.status==="repairing"?"Repairing — checking the browser subscription and server acknowledgement…":e.push.status==="error"?"Repair needed — the browser and server could not confirm the same subscription.":"Off — enable notifications for this browser.";return y.jsxs(Zs,{title:"Settings",onClose:e.onClose,wide:!0,children:[y.jsxs("div",{children:[y.jsx("span",{className:"lbl",children:"Display name"}),y.jsx("input",{className:"field",readOnly:!0,value:e.identity.name})]}),y.jsxs("div",{children:[y.jsx("span",{className:"lbl",children:"Your address"}),y.jsx("input",{className:"field mono",readOnly:!0,value:e.identity.cid,onFocus:p=>p.currentTarget.select()}),y.jsx("p",{className:"muted",children:"Your public address on ours. Share an invite to connect more easily."})]}),y.jsxs("div",{children:[y.jsx("span",{className:"lbl",children:"Public bio"}),y.jsx("textarea",{className:"field",rows:3,value:t,onChange:p=>{n(p.target.value),s(!1),l(null)}}),y.jsx("button",{className:"btn sm",onClick:()=>{l(null),e.onSaveBio(t).then(()=>s(!0)).catch(p=>l(String(p)))},children:i?"Saved":"Save bio"}),a&&y.jsx("p",{className:"onb-error",children:a})]}),y.jsxs("label",{style:{display:"flex",gap:9},children:[y.jsx("input",{type:"checkbox",checked:e.dark,onChange:e.onToggleDark})," Dark mode"]}),y.jsxs("div",{style:{borderTop:"1px solid var(--line)",paddingTop:16},children:[y.jsx("h4",{children:"Notifications"}),y.jsx("p",{className:e.push.status==="needs-permission"||e.push.status==="error"?"onb-error":"muted",children:m}),h&&h!==m&&y.jsx("p",{className:"muted","data-testid":"push-platform-guidance",children:h}),y.jsxs("fieldset",{style:{border:0,padding:0,margin:"12px 0"},children:[y.jsx("legend",{className:"lbl",children:"Lock-screen preview"}),y.jsxs("label",{style:{display:"block",marginTop:7},children:[y.jsx("input",{type:"radio",name:"push-preview",checked:c==="full",onChange:()=>f("full")})," Full — sender and message text or filename"]}),y.jsxs("label",{style:{display:"block",marginTop:7},children:[y.jsx("input",{type:"radio",name:"push-preview",checked:c==="private",onChange:()=>f("private")})," Private — generic content only"]})]}),y.jsx("p",{className:"muted",children:"Full previews can expose sender names, message text, and filenames on the lock screen. The push provider still sees delivery endpoint, timing, and payload size metadata in either mode."}),y.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.push.status==="on"?y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",disabled:e.busy,onClick:()=>void e.onPushAction("disable",c),children:"Disable notifications"}),y.jsx("button",{className:"btn",disabled:e.busy,onClick:()=>void e.onPushAction("repair",c),children:"Repair"}),c!==e.push.preview&&y.jsx("button",{className:"btn primary",disabled:e.busy,onClick:()=>void e.onPushAction("enable",c),children:"Save preview"})]}):y.jsx("button",{className:"btn primary",disabled:e.busy||!e.workerSupported||e.push.status==="unsupported",onClick:()=>void e.onPushAction(e.push.status==="error"||e.push.blocked?"repair":"enable",c),children:e.busy?"Repairing…":e.push.status==="error"||e.push.blocked?"Repair":"Enable notifications"})})]}),y.jsxs("div",{style:{borderTop:"1px solid var(--line)",paddingTop:16},children:[y.jsx("h4",{children:"App status"}),y.jsx("p",{className:"muted",children:e.offline?"Offline — reconnecting. Message and identity data are never cached.":"Online."}),e.onInstall&&y.jsx("button",{className:"btn",onClick:e.onInstall,children:"Install app"}),e.updateAvailable&&y.jsx("button",{className:"btn primary",onClick:e.onReloadUpdate,children:"Reload to update"})]}),y.jsxs("div",{style:{borderTop:"1px solid var(--line)",paddingTop:16},children:[y.jsx("h4",{children:"Build"}),y.jsx("input",{className:"field mono",readOnly:!0,value:e.build?`${e.build.version} · ${e.build.sha}`:"Loading…"})]})]})}function Hz(e,t,n,i,s=6e4){return!t||!t.sha?"current":t.sha===e?(n.remoteSha=null,n.firstMismatchAt=null,"current"):(n.remoteSha=t.sha,(n.firstMismatchAt===null||n.firstMismatchAt===void 0)&&(n.firstMismatchAt=i),n.controllerChanged?"newer-available":i-n.firstMismatchAt>=s?"stuck":"newer-available")}const Kz="bef39eb993947127d466f9647e958255a54ecb06",qz=15*6e4,Xz=6e4,Yz=Hz;async function Gz(){try{const e=await fetch("/version.json",{cache:"no-store"});return e.ok?await e.json():null}catch{return null}}function Qz(e){const t={remoteSha:null,firstMismatchAt:null,controllerChanged:!1},n=()=>{t.controllerChanged=!0};navigator.serviceWorker?.addEventListener("controllerchange",n);let i=!1;const s=async()=>{const f=await Gz(),h=Yz(Kz,f,t,Date.now(),Xz);h==="newer-available"?(e.onUpdateAvailable(),navigator.serviceWorker?.getRegistration().then(m=>m?.update())):h==="stuck"&&!i&&(i=!0,e.onStuck(f.sha))},a=setTimeout(()=>void s(),5e3),l=setInterval(()=>void s(),qz),c=()=>{document.visibilityState==="visible"&&s()};return document.addEventListener("visibilitychange",c),()=>{clearTimeout(a),clearInterval(l),document.removeEventListener("visibilitychange",c),navigator.serviceWorker?.removeEventListener("controllerchange",n)}}async function Jz(e){try{const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(i=>i.unregister()));const n=await caches.keys();await Promise.all(n.map(i=>caches.delete(i)))}catch{}return location.replace(location.pathname+"?v="+encodeURIComponent(e)),new Promise(()=>{})}function Zz(){const e=new URL(location.href);e.searchParams.has("v")&&(e.searchParams.delete("v"),history.replaceState(null,"",e.pathname+e.search+e.hash))}const $x=[0,100,400,1e3,3e3,6e3],Ux=e=>new Promise(t=>setTimeout(t,e)),Wx={delivered:1,read:2},Hx="ours-dark-v3",Kx="#chat-message-",qx=Hl,e4=e=>e instanceof Error&&e.message?e.message:"The request could not be completed.";function xS(e,t){const n=new Map,i=[];for(const s of e?.messages??[]){const a={dir:s.dir,text:s.text,date:s.date,read:s.read,wireId:s.wire_id,replyTo:s.reply_to?{wireId:s.reply_to.wire_id}:null,peerCid:s.peer_cid,receipt:s.receipt??void 0,receiptless:s.dir==="out"&&!s.wire_id,messageKind:s.message_kind,typed:s.typed};s.wire_id?n.set(s.wire_id,a):i.push(a)}for(const s of t){const a=n.get(s.wire_id);n.set(s.wire_id,{dir:s.dir,text:"",date:s.date,read:a?.read??s.dir==="out",wireId:s.wire_id,replyTo:s.reply_to?{wireId:s.reply_to.wire_id}:a?.replyTo??null,kind:"file",filename:s.filename,mime:s.mime,receipt:a?.receipt})}return[...i,...n.values()].sort((s,a)=>{const l=qx(s.date)-qx(a.date);return l===0?s.wireId.localeCompare(a.wireId):l})}function t4(e){const t={};for(const n of Object.values(e.roots??{}))t[n.root_cid]={label:n.root_name,note:"Verified identity"};return t}function n4(e,t){return[...e.contacts.contacts.map(i=>{const s=e.contacts.roots?.[i.container_id],a=wr(e,i.container_id),c=xS(a,t[i.container_id]??[]).at(-1),f=ql(i);return{id:i.container_id,name:f,announcedName:i.name,initials:wd(f),when:c?Hj(c.date):"",activityAt:c?.date??"",last:c?.kind==="file"?eN(c.filename,c.mime):a?.preview??c?.text??"",unread:a?.unread??0,status:"active",root:s?.root_cid??null,sub:s?`role “${s.role_id}” of ${s.root_name}`:"",roleId:s?.role_id??null,rootName:s?.root_name??null,mine:!1,kind:s?"agent":"person"}}),...e.contacts.pending.map(i=>{const s=ql(i);return{id:`pending:${i.container_id}`,name:s,announcedName:i.name,initials:wd(s),when:"",activityAt:"",last:`${i.queued} queued · approval required`,unread:0,status:"pending",root:null,sub:"",roleId:null,rootName:null,mine:!1,kind:"person"}})]}function r4(){return y.jsx(i4,{})}function i4(){const e=k.useRef(jA(yf(window.location.pathname))).current,[t,n]=k.useReducer(dv,e),[i,s]=k.useState(null),a=k.useRef(0),l=k.useRef(null),c=k.useRef(t),f=k.useRef(new TA),h=k.useRef(null),m=k.useRef(new Map),p=k.useRef(new Map),[v,w]=k.useState({}),S=k.useRef(v),[C,E]=k.useState(null),R=k.useRef(new Set),[A,T]=k.useState(null),P=k.useRef(A),O=k.useRef(!1),[D,H]=k.useState([]),[B,_]=k.useState(null),[N,q]=k.useState(()=>localStorage.getItem(Hx)!=="0"),[V,ae]=k.useState(null),[J,ee]=k.useState({supported:!1,offline:!navigator.onLine,updateAvailable:!1,registration:null}),[ge,we]=k.useState({status:"unsupported",preview:"full"}),[G,le]=k.useState(!1),j=k.useRef(!1),[F,Q]=k.useState(()=>window.location.hash.startsWith(Kx)),{toasts:M,push:Z,dismiss:ye,clear:me}=Fz(),he=k.useCallback(U=>{c.current=dv(c.current,U),n(U)},[]),be=k.useCallback(U=>{O.current=U},[]);k.useEffect(()=>{c.current=t},[t]),P.current=A,S.current=v,k.useMemo(()=>(bv(Object.values(v).flat()),null),[v]),k.useEffect(()=>(document.documentElement.classList.toggle("theme-dark",N),()=>document.documentElement.classList.remove("theme-dark")),[N]);const xe=k.useCallback(U=>he({type:"error",message:e4(U)}),[he]),Be=k.useCallback(()=>{const U=c.current;return{visibility:document.visibilityState,appRoute:U.route.name==="chats"?"chats":"other",selectedContactCid:Xr(U),desktopLayout:h.current?.matches??window.innerWidth>=861,mobileDetailOpen:U.mobileDetailOpen,conversationCoveringDialogOpen:P.current!==null}},[]),Oe=k.useCallback(async(U,ue=!0)=>{try{const fe=await Ye.conversation(U);return he({type:"page",contactCid:U,page:fe}),fe}catch(fe){return ue&&xe(fe),null}},[he,xe]),Ge=k.useCallback(async(U,ue=!0)=>{try{const fe=await Ye.files(U);return bv(fe.files),w(Ae=>({...Ae,[U]:fe.files})),fe.files}catch(fe){return ue&&xe(fe),null}},[xe]);k.useEffect(()=>Qz({onUpdateAvailable:()=>ee(U=>({...U,updateAvailable:!0})),onStuck:U=>{Jz(U)}}),[]);const ut=k.useCallback(async()=>{const U=await Ye.contacts();return he({type:"contacts",contacts:{...U,pending:U.pending??[]}}),U},[he]),it=k.useCallback(async()=>{try{const[U,ue,fe]=await Promise.all([Ye.identity(),Ye.contacts(),Ye.buildInfo()]),Ae={...ue,pending:ue.pending??[]};return c.current.identity&&c.current.identity.cid!==U.cid&&(Qj(),S.current={},w({})),he({type:"snapshot",identity:U,contacts:Ae}),_(fe),await Promise.all(Ae.contacts.flatMap(Pe=>[Oe(Pe.container_id,!1),Ge(Pe.container_id,!1)])),Xr(c.current)}catch(U){return xe(U),null}},[he,Ge,Oe,xe]),Mt=k.useCallback(async U=>{await f.current.request(U,async()=>{EA(U,Be())&&(await Ye.markRead(U),await Promise.all([Oe(U),ut()]))}).catch(xe)},[Be,ut,Oe,xe]),Xt=k.useCallback(async U=>{const ue=++a.current;l.current?.abort();const fe=new AbortController;l.current=fe,s(null),me(U),Ge(U,!1);let Ae;try{Ae=await Ye.conversation(U,void 0,fe.signal)}catch(Ze){fe.signal.aborted||xe(Ze);return}if(fe.signal.aborted||ue!==a.current)return;he({type:"page",contactCid:U,page:Ae});const Pe=Ae.unread;let de=[...Ae.messages],ze=Ae.nextBefore;const Gt=new Set,Qt=new Set(de.map(Ze=>Ze.wire_id).filter(Boolean)),ht=()=>de.filter(Ze=>Ze.dir==="in"&&!Ze.read);for(;ht().length<Pe&&ze&&!Gt.has(ze);){Gt.add(ze);let Ze;try{Ze=await Ye.conversation(U,ze,fe.signal)}catch{break}if(fe.signal.aborted||ue!==a.current)return;const Ln=Ze.messages.filter(mn=>!mn.wire_id||!Qt.has(mn.wire_id));if(!Ln.length&&Ze.nextBefore===ze)break;for(const mn of Ln)mn.wire_id&&Qt.add(mn.wire_id);de=[...Ln,...de],he({type:"older_page",contactCid:U,page:Ze,newer:Ae.messages}),ze=Ze.nextBefore}const pt=ht()[0];pt?.wire_id&&ue===a.current&&!fe.signal.aborted&&s({contactCid:U,wireId:pt.wire_id,count:Pe}),await Mt(U)},[me,he,Mt,Ge,xe]),Je=k.useCallback(async(U,ue,fe="page")=>{const Ae=`page:${U}:${fe}`,Pe=(m.current.get(Ae)??0)+1;m.current.set(Ae,Pe);for(const de of $x){if(de&&await Ux(de),m.current.get(Ae)!==Pe)return;const ze=await Oe(U,!1);if(ze&&ue(ze))return}},[Oe]),zt=k.useCallback(async(U,ue)=>{const fe=`file:${U}`,Ae=(m.current.get(fe)??0)+1;m.current.set(fe,Ae);for(const Pe of $x)if(Pe&&await Ux(Pe),m.current.get(fe)!==Ae||(await Ge(U,!1))?.some(ze=>ze.wire_id===ue))return},[Ge]),bn=k.useRef(!1);k.useEffect(()=>{if(!F||!t.loaded)return;const U=decodeURIComponent(window.location.hash.slice(Kx.length)),ue=Xr(c.current);if(!U||!ue){Q(!1);return}if(wr(c.current,ue)?.messages.some(fe=>fe.wire_id===U)){Q(!1);return}bn.current||(bn.current=!0,Je(ue,fe=>fe.messages.some(Ae=>Ae.wire_id===U),`anchor:${U}`).catch(()=>{}).finally(()=>Q(!1)))},[F,Je,t.loaded,t.pages]),k.useMemo(()=>(Gj({url:U=>Object.values(S.current).flat().find(fe=>fe.wire_id===U)?.available?Ye.mediaUrl(U):null,bytes:async U=>{if(!Object.values(S.current).flat().find(Ae=>Ae.wire_id===U)?.available)return null;const fe=await fetch(Ye.mediaUrl(U),{cache:"no-store",credentials:"same-origin"});if(!fe.ok)throw new Error(`Media request failed (HTTP ${fe.status})`);return new Uint8Array(await fe.arrayBuffer())},fetch:async U=>{const ue=Object.values(S.current).flat().find(fe=>fe.wire_id===U);if(!ue)throw new Error("Media record is unavailable");await Ye.fetchFiles([U]),await Ge(ue.contact_id)}}),null),[Ge]),k.useEffect(()=>{let U;IA(fe=>{ee(fe),mv(fe.registration).then(we).catch(()=>we(Ae=>({...Ae,status:"error"})))},{shouldDeferReload:()=>O.current||P.current!==null}).then(fe=>{U=fe}).catch(xe);const ue=fe=>{fe.preventDefault(),ae(fe)};return window.addEventListener("beforeinstallprompt",ue),()=>{U?.(),window.removeEventListener("beforeinstallprompt",ue)}},[xe]),k.useEffect(()=>BA(),[]),k.useEffect(()=>{if(!(!J.registration||ge.status!=="on"))return CA({registration:J.registration,identity:Ye.identity,onEvent:M0})},[ge.status,ge.bindingId,J.registration]),k.useEffect(()=>{const U=()=>we(ue=>({...ue,status:"error"}));return window.addEventListener("ours-push-repair-required",U),()=>window.removeEventListener("ours-push-repair-required",U)},[]),k.useEffect(()=>{window.location.pathname==="/"&&window.history.replaceState(null,"",Kr()),h.current=window.matchMedia("(min-width: 861px)");const U=()=>{const de=yf(window.location.pathname);l.current?.abort(),a.current+=1,s(null),he({type:"route",route:de}),j.current&&de.name==="chats"&&de.contactCid&&(j.current=!1,requestAnimationFrame(()=>document.querySelector("[data-contact-trigger]")?.focus({preventScroll:!0}))),de.name==="chats"&&de.contactCid&&Xt(de.contactCid)},ue=()=>{if(document.visibilityState!=="visible")return;const de=Xr(c.current);de&&Mt(de),L0(),J.registration&&mv(J.registration).then(we).catch(()=>we(ze=>({...ze,status:"error"})))};window.addEventListener("popstate",U),document.addEventListener("visibilitychange",ue);const fe=de=>{const ze=de.type==="sync_required"?`${de.type}:${de.reason}`:de.type==="receipt_received"?`${de.type}:${de.contact_id}:${de.kind}:${de.wire_ids.join(",")}`:`${de.type}:${de.contact_id}:${de.wire_id}`,Gt=Date.now(),Qt=p.current.get(ze)??0;p.current.set(ze,Gt);for(const[ht,pt]of p.current)Gt-pt>6e4&&p.current.delete(ht);Gt-Qt<6e4||(async()=>{if(de.type==="sync_required"){await it();return}if(ut().catch(xe),de.type==="file_received"){await zt(de.contact_id,de.wire_id);const ht=c.current.contacts.contacts.find(pt=>pt.container_id===de.contact_id);Xr(c.current)!==de.contact_id&&ht&&Z(de.contact_id,ql(ht),"New file");return}if(de.type==="message_received"){const ht=c.current.contacts.contacts.find(pt=>pt.container_id===de.contact_id);await Je(de.contact_id,pt=>pt.messages.some(Ze=>Ze.wire_id===de.wire_id),`message:${de.wire_id}`),Xr(c.current)===de.contact_id?await Mt(de.contact_id):ht&&Z(de.contact_id,ql(ht),"New message");return}he({type:"receipt",contactCid:de.contact_id,kind:de.kind,wireIds:de.wire_ids}),await Je(de.contact_id,ht=>de.wire_ids.every(pt=>{const Ze=ht.messages.find(Ln=>Ln.wire_id===pt);return!!Ze?.receipt&&Wx[Ze.receipt]>=Wx[de.kind]}),`receipt:${de.wire_ids.join(",")}`)})().catch(xe)},Ae=wA(fe),Pe=kA(fe,de=>he({type:"connection",connection:de}));return it().then(de=>{de&&Xt(de)}),()=>{Pe(),Ae(),window.removeEventListener("popstate",U),document.removeEventListener("visibilitychange",ue)}},[Je,zt,he,Mt,Xt,Z,ut,it,xe,J.registration]);const It=(U,ue,fe)=>{window.history.pushState({oursMessenger:!0},"",ue),he({type:"route",route:U,mobileDetailOpen:fe})},Yt=async U=>{It({name:"chats",contactCid:U},Kr(U),!0),await Xt(U)},Tt=async U=>{const ue=wr(c.current,U);if(!(!ue?.nextBefore||R.current.has(U))){R.current.add(U),E(U);try{const fe=await Ye.conversation(U,ue.nextBefore);he({type:"older_page",contactCid:U,page:fe,newer:ue.messages})}catch(fe){xe(fe)}finally{R.current.delete(U),E(null)}}},We=Xr(t),Cr=t.contacts.contacts.find(U=>U.container_id===We),ur=k.useMemo(()=>n4(t,v),[t,v]),X=ur.find(U=>U.id===We)??null,ie=We?xS(wr(t,We),v[We]??[]):[],je=t.identity;k.useEffect(()=>{if(!t.loaded)return;const U=yf(window.location.pathname),ue=U.name==="chats"||U.name==="contact"?U.contactCid:null;!ue||t.contacts.contacts.some(fe=>fe.container_id===ue)||(window.history.replaceState({oursMessenger:!0},"",Kr()),i?.contactCid===ue&&(l.current?.abort(),a.current+=1,s(null)))},[t.loaded,t.contacts.contacts,i]);const Ne=t.loaded?We&&!wr(t,We)||F?"updating":t.connection!=="live"?"connecting":null:"connecting",Fe=async(U,ue=ge.preview)=>{if(J.registration){le(!0),we(fe=>({...fe,status:"repairing",preview:ue}));try{we(await(U==="enable"?_0(J.registration,{preview:ue}):U==="repair"?zA(J.registration,ue):VA(J.registration,ge)))}catch(fe){we(Ae=>({...Ae,status:"error"})),xe(fe)}finally{le(!1)}}},ot=()=>{H([]),T("invite"),Ye.invites().then(H).catch(xe)};return t.route.name==="not_found"?y.jsxs("div",{className:"centered-screen",children:[y.jsx("h1",{children:"Page not found"}),y.jsx("button",{className:"btn primary",onClick:()=>It({name:"chats",contactCid:null},Kr()),children:"Open chats"})]}):je?y.jsx("div",{className:N?"theme-dark":"",style:{height:"100%"},children:y.jsxs("div",{className:"app signal-app",children:[y.jsxs("main",{className:"section signal-stage"+(t.mobileDetailOpen?" show-detail":""),children:[y.jsx(Az,{contacts:ur,roots:t4(t.contacts),selected:We,onSelect:U=>{U.startsWith("pending:")||Yt(U)},onInvite:ot,onSettings:()=>T("settings"),onApprovePending:async U=>{try{return await Ye.respondToIntroduction(U,"approve"),await it(),!0}catch(ue){return xe(ue),!1}},onRejectPending:async U=>{try{return await Ye.respondToIntroduction(U,"reject"),await it(),!0}catch(ue){return xe(ue),!1}}}),t.route.name==="contact"&&X?y.jsx(jz,{contact:X,messages:ie,onBack:()=>{j.current=!0,RA(window.history.state)==="back"?window.history.back():(window.history.replaceState({oursMessenger:!0},"",Kr(X.id)),he({type:"route",route:{name:"chats",contactCid:X.id},mobileDetailOpen:!0}),requestAnimationFrame(()=>document.querySelector("[data-contact-trigger]")?.focus({preventScroll:!0})),j.current=!1)},onRename:U=>void Ye.renameContact(X.id,U).then(it).catch(xe),onRemove:()=>{confirm(`Remove “${Cr?.name??"contact"}”?`)&&Ye.removeContact(X.id).then(()=>(window.history.replaceState({oursMessenger:!0},"",Kr()),he({type:"route",route:{name:"chats",contactCid:null},mobileDetailOpen:!1}),it())).catch(xe)},onOpenMessage:U=>{It({name:"chats",contactCid:X.id},Kr(X.id),!0);let ue=12;const fe=()=>{const Ae=document.getElementById(`chat-message-${encodeURIComponent(U)}`),Pe=Ae?.closest(".messages");if((!Ae||!Pe||Pe.clientHeight<=0)&&ue-- >0){requestAnimationFrame(fe);return}if(!Ae||!Pe)return;const de=Ae.getBoundingClientRect(),ze=Pe.getBoundingClientRect(),Gt=Pe.scrollTop+de.top-ze.top-Math.max(0,(Pe.clientHeight-de.height)/2),Qt=Math.max(0,Math.min(Gt,Pe.scrollHeight-Pe.clientHeight));Pe.scrollTo({top:Qt,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})};requestAnimationFrame(fe)},indexOffset:wr(t,X.id)?.hasMore?Math.max(1,(wr(t,X.id)?.total??ie.length)-ie.length):0,onSendText:async(U,ue)=>{const fe=await Ye.send(X.id,U,ue);return await Oe(X.id,!1),fe.wire_id??void 0},onSendFile:async(U,ue)=>{await Ye.sendFile(X.id,new Blob([U.bytes],{type:U.mime}),U.filename,U.mime,ue),await Promise.all([Ge(X.id),Oe(X.id,!1)])}}):y.jsx(Mz,{contact:X,messages:ie,syncing:Ne,unreadOpen:i?.contactCid===We?i:null,hiddenEarlier:wr(t,We??"")?.hasMore?Math.max(1,(wr(t,We??"")?.total??ie.length)-ie.length):0,onLoadEarlier:We&&C!==We?()=>void Tt(We):void 0,onBack:()=>{l.current?.abort(),a.current+=1,s(null),It({name:"chats",contactCid:null},Kr(),!1)},onOpenContact:()=>{We&&It({name:"contact",contactCid:We},PA(We),!0)},onDraftChange:be,onSend:async(U,ue,fe)=>{if(!We)return;const Ae=We,Pe=await Ye.send(Ae,U,ue,fe);return he({type:"sent_message",contactCid:Ae,message:{dir:"out",text:U,date:new Date().toISOString(),read:!0,wire_id:Pe.wire_id??"",receipt:null,reply_to:ue?{wire_id:ue}:null}}),Pe.wire_id?Je(Ae,de=>de.messages.some(ze=>ze.wire_id===Pe.wire_id),`send:${Pe.wire_id}`):ut().catch(xe),Pe.wire_id??void 0},onLoadCommands:async(U,ue)=>Ye.commands(U,ue),onSendCommand:async(U,ue,fe,Ae,Pe,de)=>{const ze=await Ye.sendCommand(U,ue,fe,Ae,Pe,de);return Oe(U,!1),ze},onSendFile:async(U,ue)=>{We&&(await Ye.sendFile(We,new Blob([U.bytes],{type:U.mime}),U.filename,U.mime,ue),await Promise.all([Ge(We),Oe(We,!1)]))},onFetchFile:async U=>{await Ye.fetchFiles([U]),We&&await Ge(We)}},We??"no-conversation")]}),y.jsxs("div",{className:"app-banners",children:[J.offline&&y.jsx("div",{className:"banner warn",role:"status","aria-live":"polite",children:"Offline — reconnecting to the network…"}),t.connection!=="live"&&y.jsx("div",{className:"banner warn",role:"status","aria-live":"polite",children:t.connection==="retrying"?"Live updates interrupted — reconnecting…":"Connecting to live updates…"}),J.updateAvailable&&y.jsxs("div",{className:"banner info",children:[y.jsx("span",{role:"status","aria-live":"polite",children:"A new version is available."}),y.jsx("span",{className:"banner-actions",children:y.jsx("button",{className:"linkbtn",onClick:()=>{J.registration&&hv(J.registration)},children:"Restart now"})})]}),y.jsx(Vz,{items:M,onDismiss:ye,onOpen:U=>void Yt(U)})]}),A==="invite"&&y.jsx(Uz,{identity:je,invites:D,onRefresh:async()=>H(await Ye.invites()),onCreate:async(U,ue)=>(await Ye.createInvite(U,ue)).blob,onAccept:async(U,ue)=>{await Ye.addContact(U,ue),await it()},onRevoke:async U=>{await Ye.revokeInvite(U)},onClose:()=>{T(null),it()}}),A==="settings"&&y.jsx(Wz,{identity:je,push:ge,workerSupported:J.supported,busy:G,offline:J.offline,updateAvailable:J.updateAvailable,build:B,dark:N,onToggleDark:()=>q(U=>(localStorage.setItem(Hx,U?"0":"1"),!U)),onSaveBio:async U=>{await Ye.setBio(U),await it()},onPushAction:Fe,onInstall:V?()=>void V.prompt().then(()=>ae(null)):void 0,onReloadUpdate:()=>{J.registration&&hv(J.registration)},onClose:()=>{P.current=null,T(null),We&&Mt(We)}}),t.error&&y.jsxs("div",{className:"banner error",role:"alert","aria-live":"assertive",children:[t.error,y.jsx("button",{className:"linkbtn",onClick:()=>he({type:"error",message:null}),children:"dismiss"})]})]})}):y.jsx("div",{className:N?"theme-dark":"",style:{height:"100%"},children:y.jsx("div",{className:"centered-screen",children:y.jsx("p",{className:"muted",children:"Loading…"})})})}Zz();const wS=document.getElementById("root");if(!wS)throw new Error("missing #root");vC.createRoot(wS).render(y.jsx(mR,{reducedMotion:"user",children:y.jsx(r4,{})}));export{Wh as _,Jd as g};
326
- //# sourceMappingURL=index-zEjyXfYx.js.map
325
+ `)}).join("")}function cz({children:e}){const t=k.isValidElement(e)?e:null,n=fS(t?.props.className);return y.jsxs("div",{className:"message-code-block","data-language":n||void 0,children:[n&&y.jsx("div",{className:"message-code-language",children:n}),y.jsx("pre",{children:e})]})}const fz=[oS],dz={a:({node:e,children:t,href:n,...i})=>{const s=cS(n);return s?y.jsx("a",{...i,href:s,target:"_blank",rel:"noopener noreferrer",children:t}):y.jsx("span",{className:"message-link-blocked",children:t})},img:({alt:e})=>y.jsxs("span",{className:"message-image-placeholder",children:["[image: ",e||"remote image blocked","]"]}),pre:cz,code:({node:e,className:t,children:n,...i})=>y.jsx("code",{className:t,"data-language":fS(t),...i,children:n})},jx=k.memo(function({text:t,className:n="bubble-text message-markdown"}){return t.length>az?y.jsx("div",{className:`${n} message-markdown-plaintext`,"data-render-mode":"plaintext",children:t}):y.jsx("div",{className:n,"data-render-mode":"markdown",children:y.jsx(iS,{remarkPlugins:fz,components:dz,urlTransform:i=>cS(i)??"",children:uz(t)})})}),hz=new Set(["type","title","description","default","enum","const","minimum","maximum","minLength","maxLength","pattern","properties","required","items","minItems","maxItems","additionalProperties"]),Nx=6,Mx=64,Ix=256,Dx=256,_x=12,Lx=2048,Ox=64*1024;function dS(e){if(typeof e!="string")return"pattern must be a string";if(e.length>Ix)return`pattern exceeds ${Ix} characters`;if(!e.startsWith("^")||!e.endsWith("$"))return"pattern must be anchored with ^ and $";let t=!1,n=!1;for(let i=0;i<e.length;i++){const s=e[i];if(s==="\\"){if(++i>=e.length)return"pattern has invalid syntax";if(/\d/.test(e[i])||e[i]==="k")return"pattern backreferences are not supported";continue}if(t){s==="]"&&(t=!1);continue}if(s==="["){t=!0;continue}if("()?*+|".includes(s))return"pattern must use only bounded, non-grouped expressions";if(s==="{"){const a=/^\{(\d+)(?:,(\d+))?\}/.exec(e.slice(i));if(!a)return"pattern has an invalid or unbounded repetition";const l=Number(a[1]),c=Number(a[2]??a[1]);if(l>c||c>Dx)return`pattern repetition must not exceed ${Dx}`;if(l!==c){const f=e.slice(i+a[0].length);if(n||f!==""&&f!=="$")return"a variable pattern repetition is supported only once, at the end";n=!0}i+=a[0].length-1}}if(t)return"pattern has invalid syntax";try{new RegExp(e)}catch{return"pattern has invalid syntax"}return null}function Xd(e,t=0,n={value:0}){if(t>Nx)return`Schema depth exceeds ${Nx}`;if(n.value++,n.value>Mx)return`Schema exceeds ${Mx} controls`;const i=Object.keys(e).find(a=>!hz.has(a));if(i)return`Unsupported JSON Schema keyword: ${i}`;if(e.title!==void 0&&typeof e.title!="string")return"title must be a string";if(e.description!==void 0&&typeof e.description!="string")return"description must be a string";if(e.enum!==void 0&&(!Array.isArray(e.enum)||e.enum.length===0))return"enum must be a non-empty array";const s=e.type;if(s===void 0&&e.enum===void 0&&!Object.hasOwn(e,"const"))return"An explicit type, enum, or const is required";if(s!==void 0&&!["object","array","string","number","integer","boolean","null"].includes(String(s)))return`Unsupported JSON Schema type: ${String(s)}`;for(const a of["minimum","maximum"])if(e[a]!==void 0&&(typeof e[a]!="number"||!Number.isFinite(e[a])))return`${a} must be a finite number`;for(const a of["minLength","maxLength","minItems","maxItems"])if(e[a]!==void 0&&(typeof e[a]!="number"||!Number.isInteger(e[a])||e[a]<0))return`${a} must be a non-negative integer`;if((e.minimum!==void 0||e.maximum!==void 0)&&s!=="number"&&s!=="integer")return"minimum/maximum require a numeric type";if((e.minLength!==void 0||e.maxLength!==void 0)&&s!=="string")return"minLength/maxLength require string type";if(e.pattern!==void 0){if(s!=="string")return"pattern requires a string type";const a=dS(e.pattern);if(a)return a}if((e.minItems!==void 0||e.maxItems!==void 0)&&s!=="array")return"minItems/maxItems require array type";if(e.additionalProperties!==void 0){if(s!=="object")return"additionalProperties requires an object type";if(e.additionalProperties===!0)return"additionalProperties: true is not supported";if(e.additionalProperties!==!1)return e.additionalProperties&&typeof e.additionalProperties=="object"&&!Array.isArray(e.additionalProperties)?"Schema-valued additionalProperties is not supported":"additionalProperties must be false"}if(s==="object"){const a=e.properties;if(a!==void 0&&(!a||typeof a!="object"||Array.isArray(a)))return"properties must be an object";if(e.required!==void 0&&(!Array.isArray(e.required)||e.required.some(l=>typeof l!="string")))return"required must be an array of property names";for(const l of Object.values(a??{})){if(!l||typeof l!="object"||Array.isArray(l))return"property schema must be an object";const c=Xd(l,t+1,n);if(c)return c}}return s==="array"&&e.items!==void 0?!e.items||typeof e.items!="object"||Array.isArray(e.items)?"items must be one schema object":Xd(e.items,t+1,n):null}function Jl(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((s,a)=>Jl(s,t[a]));const n=Object.keys(e).sort(),i=Object.keys(t).sort();return n.length===i.length&&n.every((s,a)=>s===i[a]&&Jl(e[s],t[s]))}function pz(e,t){let n=0;const i=(a,l)=>{if(l>_x)return`${t} exceeds depth ${_x}`;if(n++,n>Lx)return`${t} exceeds ${Lx} JSON values`;if(a===null||typeof a!="object")return null;for(const c of Array.isArray(a)?a:Object.values(a)){const f=i(c,l+1);if(f)return f}return null},s=i(e,0);return s||(new TextEncoder().encode(JSON.stringify(e)).byteLength>Ox?`${t} exceeds ${Ox} UTF-8 bytes`:null)}function Yd(e,t,n){if(Object.hasOwn(e,"const")&&!Jl(e.const,t))return`${n} must use the fixed value`;if(Array.isArray(e.enum)&&!e.enum.some(i=>Jl(i,t)))return`${n} is not an allowed value`;if(e.type==="null")return t===null?null:`${n} must be null`;if(e.type==="boolean")return typeof t=="boolean"?null:`${n} must be boolean`;if(e.type==="string"){if(typeof t!="string")return`${n} must be text`;if(typeof e.minLength=="number"&&t.length<e.minLength)return`${n} is too short`;if(typeof e.maxLength=="number"&&t.length>e.maxLength)return`${n} is too long`;if(e.pattern!==void 0){const i=dS(e.pattern);if(i)return`${n} cannot be validated safely: ${i}`;if(!new RegExp(e.pattern).test(t))return`${n} does not match the required format`}return null}if(e.type==="number"||e.type==="integer")return typeof t!="number"||!Number.isFinite(t)?`${n} must be a finite number`:e.type==="integer"&&!Number.isInteger(t)?`${n} must be an integer`:typeof e.minimum=="number"&&t<e.minimum?`${n} is below the minimum`:typeof e.maximum=="number"&&t>e.maximum?`${n} is above the maximum`:null;if(e.type==="array"){if(!Array.isArray(t))return`${n} must be an array`;if(typeof e.minItems=="number"&&t.length<e.minItems)return`${n} has too few items`;if(typeof e.maxItems=="number"&&t.length>e.maxItems)return`${n} has too many items`;if(e.items&&typeof e.items=="object"&&!Array.isArray(e.items))for(let i=0;i<t.length;i++){const s=Yd(e.items,t[i],`${n}[${i}]`);if(s)return s}return null}if(e.type==="object"){if(!t||typeof t!="object"||Array.isArray(t))return`${n} must be an object`;const i=e.properties??{};for(const a of Object.keys(t))if(e.additionalProperties===!1&&!Object.hasOwn(i,a))return`${n}.${a||"(empty key)"} is not declared by the schema`;const s=Array.isArray(e.required)?e.required:[];for(const a of s)if(!Object.hasOwn(t,a))return`${n}.${a||"(empty key)"} is required`;for(const[a,l]of Object.entries(i)){if(!Object.hasOwn(t,a))continue;const c=Yd(l,t[a],`${n}.${a||"(empty key)"}`);if(c)return c}}return null}function Zl(e,t,n="Arguments"){return pz(t,n)??Yd(e,t,n)}function xo(e){if(Object.hasOwn(e,"const"))return e.const;if(e.default!==void 0)return e.default;if(Array.isArray(e.enum)&&e.enum.length)return e.enum[0];if(e.type==="object"){const t=Object.create(null),n=new Set(Array.isArray(e.required)?e.required.filter(i=>typeof i=="string"):[]);for(const[i,s]of Object.entries(e.properties??{})){const a=s;(n.has(i)||a.default!==void 0)&&(t[i]=xo(a))}return t}return e.type==="array"?[]:e.type==="boolean"?!1:e.type==="number"||e.type==="integer"?0:e.type==="null"?null:""}function Fx(e,t){return typeof e.title=="string"&&e.title?e.title:t||"(empty key)"}function zx(e,t,n){const i=Object.create(null);for(const[s,a]of Object.entries(e))i[s]=a;return i[t]=n,i}function mz(e,t){const n=Object.create(null);for(const[i,s]of Object.entries(e))i!==t&&(n[i]=s);return n}function gz(e){const{schema:t,label:n,path:i,value:s,required:a,description:l,onChange:c,onValidityChange:f}=e,h=k.useId().replace(/[^a-zA-Z0-9_-]/g,""),p=`command-array-${i.replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"root"}-${h}-help`,[v,w]=k.useState(()=>JSON.stringify(s,null,2)),[S,C]=k.useState(null),E=k.useRef(JSON.stringify(s));k.useEffect(()=>{const A=JSON.stringify(s);A!==E.current&&(E.current=A,w(JSON.stringify(s,null,2)),C(null),f(i,null))},[f,i,s]),k.useEffect(()=>()=>f(i,null),[f,i]);const R=A=>{w(A);let T;try{T=JSON.parse(A)}catch{const O=`${n} must contain valid JSON`;C(O),f(i,O);return}if(!Array.isArray(T)){const O=`${n} must be a JSON array`;C(O),f(i,O);return}const P=Zl(t,T,n);C(P),f(i,P),E.current=JSON.stringify(T),c(T)};return y.jsxs("label",{className:"command-field",children:[y.jsxs("span",{children:[n,a?" *":""]}),y.jsx("textarea",{value:v,rows:3,"aria-describedby":p,"aria-invalid":S?"true":void 0,onChange:A=>R(A.target.value)}),y.jsx("small",{id:p,children:l??"JSON array"}),S&&y.jsx("span",{className:"command-field-error",role:"alert",children:S})]})}function yz(e){const{schema:t,label:n,path:i,value:s,required:a,description:l,numeric:c,onChange:f,onValidityChange:h}=e,m=Zl(t,s,n);return k.useEffect(()=>(h(i,m),()=>h(i,null)),[m,h,i]),y.jsxs("label",{className:"command-field",children:[y.jsxs("span",{children:[n,a?" *":""]}),y.jsx("input",{type:c?"number":"text",value:String(s??""),min:typeof t.minimum=="number"?t.minimum:void 0,max:typeof t.maximum=="number"?t.maximum:void 0,minLength:typeof t.minLength=="number"?t.minLength:void 0,maxLength:typeof t.maxLength=="number"?t.maxLength:void 0,step:t.type==="integer"?1:c?"any":void 0,required:a,"aria-invalid":m?"true":void 0,onChange:p=>f(c?Number(p.target.value):p.target.value)}),l&&y.jsx("small",{children:l}),m&&y.jsx("span",{className:"command-field-error",role:"alert",children:m})]})}function hS(e){const{schema:t,name:n,path:i,value:s,required:a,onChange:l,onValidityChange:c}=e,f=Fx(t,n),h=typeof t.description=="string"?t.description:void 0;if(Object.hasOwn(t,"const"))return y.jsxs("div",{className:"command-field",children:[y.jsxs("span",{children:[f,a?" *":""]}),y.jsxs("small",{children:["Fixed value: ",JSON.stringify(t.const)]})]});if(Array.isArray(t.enum))return y.jsxs("label",{className:"command-field",children:[y.jsxs("span",{children:[f,a?" *":""]}),y.jsx("select",{value:JSON.stringify(s),onChange:p=>l(JSON.parse(p.target.value)),children:t.enum.map((p,v)=>y.jsx("option",{value:JSON.stringify(p),children:String(p)},v))}),h&&y.jsx("small",{children:h})]});if(t.type==="object"){const p=s&&typeof s=="object"&&!Array.isArray(s)?s:{},v=new Set(Array.isArray(t.required)?t.required.filter(w=>typeof w=="string"):[]);return y.jsxs("fieldset",{className:"command-object",children:[y.jsx("legend",{children:f}),h&&y.jsx("p",{children:h}),Object.entries(t.properties??{}).map(([w,S])=>{const C=S,E=Object.hasOwn(p,w),R=Fx(C,w),A=`${i}.${w||"(empty key)"}`;return!E&&!v.has(w)?y.jsxs("button",{type:"button",className:"linkbtn command-property-add",onClick:()=>l(zx(p,w,xo(C))),children:["Add ",R]},w):y.jsxs("div",{className:"command-property",children:[y.jsx(hS,{schema:C,name:w,path:A,value:E?p[w]:xo(C),required:v.has(w),onValidityChange:c,onChange:T=>l(zx(p,w,T))}),!v.has(w)&&y.jsx("button",{type:"button",className:"linkbtn command-property-remove","aria-label":`Remove ${R}`,onClick:()=>l(mz(p,w)),children:"Remove"})]},w)})]})}if(t.type==="array")return y.jsx(gz,{schema:t,label:f,path:i,value:s,required:a,description:h,onChange:l,onValidityChange:c});if(t.type==="boolean")return y.jsxs("label",{className:"command-check",children:[y.jsx("input",{type:"checkbox",checked:s===!0,onChange:p=>l(p.target.checked)})," ",f]});if(t.type==="null")return y.jsxs("div",{className:"command-field",children:[y.jsx("span",{children:f}),y.jsx("small",{children:"Null value"})]});const m=t.type==="number"||t.type==="integer";return y.jsx(yz,{schema:t,label:f,path:i,value:s,required:a,description:h,numeric:m,onChange:l,onValidityChange:c})}function vz(e){const t=e.catalog.commands.find(T=>T.name===e.initialCommandName)??e.catalog.commands[0],[n,i]=k.useState(t?.name??""),s=e.catalog.commands.find(T=>T.name===n)??t,a=k.useMemo(()=>s?Xd(s.input_schema):null,[s]),[l,c]=k.useState(()=>t?xo(t.input_schema):null),[f,h]=k.useState(""),[m,p]=k.useState("idle"),[v,w]=k.useState({}),S=k.useRef(0),C=k.useCallback((T,P)=>{w(O=>{if(P===null){if(!Object.hasOwn(O,T))return O;const D={...O};return delete D[T],D}return O[T]===P?O:{...O,[T]:P}})},[]),E=T=>{const P=e.catalog.commands.find(O=>O.name===T);i(T),c(P?xo(P.input_schema):null),h(""),p("idle"),w({})},R=T=>{if(T.preventDefault(),!s||a||e.busy)return;const O=Object.values(v)[0]??Zl(s.input_schema,l);if(O){h(`Validation denied: ${O}`),p("error");return}const D=++S.current,H=s,B=l;c(xo(H.input_schema)),w({}),h(`Sending ${H.name}…`),p("pending"),e.onSend(H,B,crypto.randomUUID(),e.catalog.fingerprint).then(_=>{S.current===D&&(_.status==="failed"?(h(`${H.name} was refused before delivery.`),p("error")):_.status==="pending"?(h(`${H.name} delivery is pending.`),p("warning")):_.status==="indeterminate"||!_.wire_id?(h(`${H.name} delivery could not be confirmed.`),p("indeterminate")):(h(`${H.name} sent. Its result will appear in the conversation.`),p("success")))}).catch(()=>{S.current===D&&(h(`${H.name} could not be sent. You can try it again.`),p("error"))})},A=s&&!a?Zl(s.input_schema,l):null;return y.jsxs("form",{className:"command-panel","aria-label":"Send a typed command",onSubmit:R,onKeyDown:T=>{T.key==="Escape"&&e.onClose()},children:[y.jsxs("div",{className:"command-panel-head",children:[y.jsxs("div",{className:"command-panel-recipient",children:[y.jsxs("strong",{children:["Commands for ",e.recipientName]}),y.jsxs("span",{className:"mono",title:e.catalog.recipient_cid,children:[e.catalog.recipient_cid.slice(0,12),"…"]})]}),y.jsx("button",{type:"button",className:"linkbtn",onClick:e.onRefresh,children:"Refresh"}),y.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close commands",onClick:e.onClose,children:"×"})]}),e.catalog.commands.length===0?y.jsx("p",{role:"status",children:"This recipient does not advertise commands."}):y.jsxs(y.Fragment,{children:[y.jsxs("label",{className:"command-field",children:[y.jsx("span",{children:"Command"}),y.jsx("select",{autoFocus:!0,value:n,onChange:T=>E(T.target.value),children:e.catalog.commands.map(T=>y.jsx("option",{value:T.name,children:T.name},T.name))})]}),s?.description&&y.jsx("p",{children:s.description}),a?y.jsxs("div",{className:"banner error",role:"alert",children:["Cannot render this command safely: ",a]}):s&&y.jsx(hS,{schema:s.input_schema,name:"Arguments",path:"Arguments",value:l,onChange:c,onValidityChange:C}),s&&y.jsx("button",{className:"btn primary",disabled:!!a||e.busy||!!A||Object.keys(v).length>0,children:"Send command"}),y.jsx("div",{className:`command-status ${m}`,"data-state":m,role:"status","aria-live":"polite",children:f})]})]})}const Ss={type:"spring",stiffness:430,damping:38,mass:.72},Vx=10,pS=56,xz=18,wz=650;function kz(e,t){return Math.abs(e)<Vx&&Math.abs(t)<Vx?"pending":Math.abs(e)>Math.abs(t)&&e>0?"drag":"reject"}function Sz(e){const t=e.at(-1),n=t?e.slice(0,-1).reverse().find(i=>i.x!==t.x&&t.time-i.time<=100):void 0;return n&&t&&t.time>n.time?(t.x-n.x)/(t.time-n.time)*1e3:0}function bz(e,t){const n=Sz(t);return n>=0&&(e>=pS||e>=xz&&n>=wz)}const Gd="ours.chats.listMode",js="recent";function mS(){try{return globalThis.localStorage}catch{return}}function Cz(e=mS()){try{return e?.getItem(Gd)==="identity"?"identity":js}catch{return js}}function Ez(e,t=mS()){const n=e==="identity"?"identity":js;try{return t?.setItem(Gd,n),t?.getItem(Gd)===n?n:js}catch{return js}}function Bs(e){return typeof e=="string"?e:""}function eu(e,t){const n=Bs(e),i=Bs(t),s=n.normalize().toLowerCase(),a=i.normalize().toLowerCase();return s<a?-1:s>a?1:n<i?-1:n>i?1:0}function Tz(e,t){const n=Hl(Bs(t.activityAt))-Hl(Bs(e.activityAt));if(n!==0)return n;const i=eu(e.name,t.name);return i!==0?i:eu(e.id,t.id)}function Qd(e){return[...e].sort(Tz)}function Bx(e){return e.contacts.length>0?Hl(Bs(e.contacts[0].activityAt)):0}function Pz(e,t){const n=new Map,i=[];for(const a of e){const l=a.root||(t?.[a.id]?a.id:null);if(!l){i.push(a);continue}const c=t?.[l]||{label:l,note:""};let f=n.get(l);f||(f={id:`root:${l}`,rootId:l,label:c.label,note:c.note,contacts:[]},n.set(l,f)),f.contacts.push(a)}const s=[...n.values()].map(a=>({...a,contacts:Qd(a.contacts)}));return i.length>0&&s.push({id:"rootless",rootId:null,label:"Independent identities",note:"People, agents and apps without a verified Human/root group",contacts:Qd(i)}),s.sort((a,l)=>{const c=Bx(l)-Bx(a);if(c!==0)return c;const f=eu(a.label,l.label);return f!==0?f:eu(a.id,l.id)})}const Rz=15e3;function $f(e){const{c:t,active:n,grouped:i}=e,[s,a]=k.useState(!1),l=async(h,m)=>{if(!(!h||s)){a(!0);try{const p=await h();requestAnimationFrame(()=>{p?document.getElementById("chat-list-title")?.focus():m.focus()})}finally{a(!1)}}},c=y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"contact-avatar","aria-hidden":!0,children:t.initials}),y.jsxs("span",{className:"contact-copy",children:[y.jsxs("span",{className:"contact-row-topline",children:[y.jsx("span",{className:"contact-name",children:t.name}),t.when&&y.jsx("span",{className:"contact-time",children:t.when})]}),y.jsxs("span",{className:"contact-row-bottomline",children:[y.jsx("span",{className:"contact-last",children:t.last}),t.status==="pending"&&y.jsx("span",{className:"chip",children:"pending approval"}),!!t.unread&&y.jsx("span",{className:"contact-unread",children:t.unread})]})]}),t.status==="pending"&&y.jsxs("span",{className:"pending-actions",role:"group","aria-label":`Decide whether to accept ${t.name}`,children:[y.jsx("button",{type:"button",className:"linkbtn",disabled:s,onClick:h=>void l(e.onApprove,h.currentTarget),children:"Approve"}),y.jsx("button",{type:"button",className:"linkbtn quiet",disabled:s,onClick:h=>void l(e.onReject,h.currentTarget),children:"Reject"})]}),n&&y.jsx(yo.span,{className:"contact-active-glow",layoutId:"active-contact",transition:Ss})]}),f="contact-row"+(n?" active":"")+(i?" grouped":"")+(t.status==="pending"?" pending":"");return t.status==="pending"?y.jsx("div",{className:f,children:c}):y.jsx(yo.button,{type:"button",className:f,onClick:e.onClick,children:c})}function Az(e){const{contacts:t,roots:n,selected:i}=e,[s,a]=k.useState(""),l=k.useRef(null),c=k.useRef(null),[f,h]=k.useState(()=>Cz()),m=_=>_.name.toLowerCase().includes(s.toLowerCase()),p=t.filter(_=>_.status!=="pending"&&m(_)),v=t.filter(_=>_.status==="pending"&&m(_)),w=Qd(p),S=Pz(p,n),C=p.length===0&&v.length===0,E=_=>{h(Ez(_))},R=[{id:"recent",label:"Recent"},{id:"identity",label:"By identity"}],A=k.useRef(null),T=k.useRef({id:-1,x0:0,y0:0,mode:"idle"}),P=k.useRef(!1),O=(_,N)=>{const q=T.current;if(q.id!==_)return;const V=A.current;if(N&&q.mode==="drag"&&V){const ae=parseFloat(V.style.getPropertyValue("--mode-drag-x"))||0,J=Math.max(0,(V.clientWidth-8)/2);E(ae>=J/2?"identity":"recent"),P.current=!0,window.setTimeout(()=>{P.current=!1},0)}T.current={id:-1,x0:0,y0:0,mode:"idle"},V?.hasPointerCapture?.(_)&&V.releasePointerCapture(_),V?.classList.remove("dragging"),V?.style.removeProperty("--mode-drag-x")},D=_=>{!_.isPrimary||T.current.id!==-1||(T.current={id:_.pointerId,x0:_.clientX,y0:_.clientY,mode:"pending"})},H=_=>{const N=T.current;if(N.id!==_.pointerId||N.mode==="idle")return;const q=_.clientX-N.x0,V=_.clientY-N.y0;if(N.mode==="pending"){if(Math.abs(q)<10&&Math.abs(V)<10)return;if(Math.abs(V)>Math.abs(q)){O(_.pointerId,!1);return}N.mode="drag",_.currentTarget.setPointerCapture?.(_.pointerId),_.currentTarget.classList.add("dragging")}_.preventDefault();const ae=Math.max(0,(_.currentTarget.clientWidth-8)/2),J=f==="identity"?ae:0;_.currentTarget.style.setProperty("--mode-drag-x",`${Math.min(ae,Math.max(0,J+q))}px`)},B=(_,N)=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(_.key))return;_.preventDefault();const V=_.key==="Home"?"recent":_.key==="End"||N==="recent"?"identity":"recent";E(V),document.getElementById(`conversation-list-${V}`)?.focus()};return k.useLayoutEffect(()=>{const _=l.current,N=c.current;if(!_||!N)return;const q=()=>_.style.setProperty("--list-bottom-chrome-height",`${N.getBoundingClientRect().height}px`);q();const V=new ResizeObserver(q);return V.observe(N),()=>{V.disconnect(),_.style.removeProperty("--list-bottom-chrome-height")}},[]),y.jsxs("div",{className:"listcol",ref:l,children:[y.jsxs("div",{className:"listcol-head",children:[y.jsxs("div",{className:"listcol-titlebar",children:[y.jsxs("h2",{id:"chat-list-title",className:"listcol-title messenger-lockup",tabIndex:-1,children:[y.jsx("span",{className:"messenger-brand-ours",children:"Ours"}),y.jsx("span",{className:"messenger-brand-product",children:"messenger"})]}),y.jsxs("div",{className:"listcol-actions",children:[y.jsx("button",{className:"btn icon-btn desktop-invite","aria-label":"Invite",title:"Invite",onClick:e.onInvite,children:y.jsx(Se,{name:"invite",size:18})}),y.jsx("button",{className:"icon-btn","aria-label":"Settings",title:"Settings",onClick:e.onSettings,children:y.jsx(Se,{name:"settings",size:18})})]})]}),y.jsx("div",{ref:A,className:"conversation-list-modes",role:"tablist","aria-label":"Conversation list layout","data-mode":f,onPointerDown:D,onPointerMove:H,onPointerUp:_=>O(_.pointerId,!0),onPointerCancel:_=>O(_.pointerId,!1),onLostPointerCapture:_=>O(_.pointerId,!1),children:R.map(_=>y.jsx("button",{id:`conversation-list-${_.id}`,type:"button",role:"tab","aria-selected":f===_.id,"aria-controls":"conversation-list-panel",tabIndex:f===_.id?0:-1,className:f===_.id?"active":"",onClick:N=>{if(P.current){N.preventDefault();return}E(_.id)},onKeyDown:N=>B(N,_.id),children:_.label},_.id))})]}),y.jsxs("div",{id:"conversation-list-panel",className:"listcol-scroll",role:"tabpanel","aria-labelledby":`conversation-list-${f}`,children:[f==="recent"&&w.length>0&&y.jsx("div",{className:"conversation-group",children:w.map(_=>y.jsx($f,{c:_,active:i===_.id,onClick:()=>e.onSelect(_.id)},_.id))}),f==="identity"&&S.map(_=>y.jsxs("div",{children:[y.jsxs("div",{className:"group-label",title:_.note,children:[_.rootId&&y.jsx(Se,{name:"clusters"}),y.jsx("span",{children:_.label}),_.note&&y.jsxs("span",{className:"gl-note",children:["· ",_.note]})]}),y.jsx("div",{className:"conversation-group",children:_.contacts.map(N=>y.jsx($f,{c:N,grouped:_.rootId!==null,active:i===N.id,onClick:()=>e.onSelect(N.id)},N.id))})]},_.id)),v.length>0&&y.jsxs("div",{children:[y.jsx("div",{className:"group-label",children:y.jsx("span",{children:"Pending"})}),y.jsx("div",{className:"conversation-group",children:v.map(_=>y.jsx($f,{c:_,active:!1,onClick:()=>{},onApprove:()=>e.onApprovePending(_.id.slice(8)),onReject:()=>e.onRejectPending(_.id.slice(8))},_.id))})]}),C&&y.jsx("p",{className:"muted",style:{padding:"14px 10px",fontSize:"0.85rem"},children:"No contacts yet — share an invite to start."})]}),y.jsxs("div",{className:"list-bottom-chrome",ref:c,children:[y.jsxs("div",{className:"search adaptive-search",role:"search",children:[y.jsx("span",{className:"adaptive-search-icon","aria-hidden":!0,children:y.jsx(Se,{name:"search"})}),y.jsx("input",{className:"field",placeholder:"Search people, agents, apps…",value:s,onChange:_=>a(_.target.value),onKeyDown:_=>{_.key==="Escape"&&(_.preventDefault(),a(""))}})]}),y.jsx("button",{type:"button",className:"icon-btn list-bottom-invite","aria-label":"Invite",title:"Invite",onClick:e.onInvite,children:y.jsx(Se,{name:"invite",size:20})})]})]})}function jz(e){const[t,n]=k.useState(!1),[i,s]=k.useState(e.contact.name),[a,l]=k.useState(!1),[c,f]=k.useState(null),h=k.useRef(!1);k.useEffect(()=>{const p=v=>{v.key!=="Escape"||a||c||t||(v.preventDefault(),e.onBack())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,c,e.onBack,a]);const m=()=>{if(h.current)return;h.current=!0;const p=i.trim();p&&p!==e.contact.name?e.onRename(p):s(e.contact.name),n(!1)};return y.jsxs("div",{className:"detail contact-screen",children:[y.jsxs("div",{className:"detail-head contact-screen-head",children:[y.jsx("button",{type:"button",className:"icon-btn detail-back contact-back","aria-label":"Back to conversation",onClick:e.onBack,children:y.jsx(Se,{name:"back"})}),y.jsx("strong",{children:"Contact"})]}),y.jsxs("div",{className:"contact-screen-scroll",children:[y.jsxs("section",{className:"contact-hero","aria-labelledby":"contact-screen-name",children:[y.jsx("div",{className:"avatar accent contact-avatar-large","aria-hidden":!0,children:e.contact.initials}),t?y.jsx("input",{id:"contact-screen-name",className:"field contact-name-input",value:i,autoFocus:!0,onChange:p=>s(p.target.value),onBlur:m,onKeyDown:p=>{p.key==="Enter"&&m(),p.key==="Escape"&&(h.current=!0,s(e.contact.name),n(!1))}}):y.jsx("h2",{id:"contact-screen-name",children:e.contact.name}),y.jsxs("p",{children:[y.jsx(Se,{name:"lock",size:13})," End-to-end encrypted connection"]})]}),y.jsxs("section",{className:"contact-action-group","aria-label":"Contact actions",children:[y.jsxs("button",{type:"button",onClick:()=>l(!0),children:[y.jsxs("span",{children:[y.jsx(Se,{name:"paperclip"}),"Shared photos, files, and links"]}),y.jsx(Se,{name:"chevron"})]}),y.jsxs("button",{type:"button",onClick:()=>{h.current=!1,s(e.contact.name),n(!0)},children:[y.jsxs("span",{children:[y.jsx(Se,{name:"edit"}),"Rename contact"]}),y.jsx(Se,{name:"chevron"})]})]}),y.jsxs("section",{className:"contact-identity","aria-labelledby":"contact-identity-title",children:[y.jsx("h3",{id:"contact-identity-title",children:"Verified identity"}),e.contact.roleId&&y.jsxs("p",{children:["Role ",y.jsx("strong",{children:e.contact.roleId})," of ",y.jsx("strong",{children:e.contact.rootName})]}),y.jsx("code",{children:e.contact.id}),y.jsxs("button",{type:"button",className:"btn sm",onClick:()=>void navigator.clipboard.writeText(e.contact.id),children:[y.jsx(Se,{name:"copy",size:14}),"Copy identity"]})]}),y.jsxs("button",{type:"button",className:"contact-remove",onClick:e.onRemove,children:[y.jsx(Se,{name:"trash"}),"Remove contact"]})]}),a&&y.jsx(XF,{messages:e.messages,indexOffset:e.indexOffset,onClose:()=>l(!1),onJump:e.onOpenMessage,onPreview:p=>{l(!1),f(p)}}),c&&(Ys(c.filename,c.mime)?y.jsx(aS,{rec:c,onClose:()=>f(null)}):y.jsx(sS,{rec:c,onClose:()=>f(null),onSendText:e.onSendText,onSendFile:e.onSendFile}))]})}const gS=e=>`chat-message-${encodeURIComponent(e)}`,yS=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Uf(e){const{dir:t,canReply:n,onReply:i}=e,s=k.useRef(null),a=k.useRef(null),l=k.useRef(null),c=k.useRef(i);c.current=i;const f=t==="in"?1:-1,h=pS,m=84,p=()=>({id:-1,x0:0,y0:0,mode:"idle",armed:!1,distance:0,samples:[]}),v=k.useRef(p()),w=A=>{const T=a.current,P=l.current,O=yS();if(T&&(T.style.transform=A&&!O?`translateX(${A}px)`:""),P){const D=Math.min(1,Math.abs(A)/h);P.style.opacity=String(D),P.style.transform=O?"scale(1)":`scale(${.5+.5*D})`}},S=(A,T)=>{const P=v.current;if(P.id!==A)return;const O=T&&P.mode==="drag"&&bz(P.distance,P.samples);v.current=p(),a.current?.classList.remove("swiping"),l.current?.classList.remove("armed"),w(0);const D=s.current;D?.hasPointerCapture?.(A)&&D.releasePointerCapture(A),O&&c.current()};k.useEffect(()=>{const A=s.current;if(!A)return;const T=P=>S(P.pointerId,!1);return A.addEventListener("lostpointercapture",T),()=>{A.removeEventListener("lostpointercapture",T);const P=v.current.id;P!==-1&&S(P,!1)}},[]);const C=A=>{const T=A.target,P=window.getSelection?.();!n||!A.isPrimary||A.pointerType==="mouse"||A.pointerType==="pen"&&A.button!==0||v.current.id!==-1||P&&!P.isCollapsed||T.closest('a, button, input, textarea, select, [role="button"], audio, video, img, [draggable="true"], .filecard, .filecard-bubble, .image-bubble, .voice-bubble, .ours-message-file, .attachment')||(v.current={id:A.pointerId,x0:A.clientX,y0:A.clientY,mode:"maybe",armed:!1,distance:0,samples:[{x:A.clientX*f,time:A.timeStamp}]},w(0))},E=A=>{const T=v.current;if(T.id!==A.pointerId||T.mode==="idle")return;const P=A.clientX-T.x0,O=A.clientY-T.y0,D=window.getSelection?.();if(D&&!D.isCollapsed){S(A.pointerId,!1);return}if(T.mode==="maybe"){const q=kz(P*f,O);if(q==="pending")return;if(q==="drag")T.mode="drag",A.currentTarget.setPointerCapture?.(A.pointerId),a.current?.classList.add("swiping");else{T.mode="idle";return}}A.preventDefault();const H=A.timeStamp;T.samples.push({x:A.clientX*f,time:H}),T.samples=T.samples.filter(q=>H-q.time<=120);let B=P*f;B<0&&(B=0),B>h&&(B=h+(B-h)*.35),B=Math.min(B,m),T.distance=B;const _=B*f,N=Math.abs(_)>=h;N!==T.armed&&(T.armed=N,l.current?.classList.toggle("armed",N),N&&navigator.vibrate?.(10)),w(_)},R=A=>{const T=v.current;T.id===A.pointerId&&T.mode==="drag"&&(T.samples.push({x:A.clientX*f,time:A.timeStamp}),T.distance=Math.max(0,(A.clientX-T.x0)*f),T.armed=T.distance>=h),S(A.pointerId,!0)};return y.jsxs("div",{ref:s,className:"msg-row "+(e.rowClass??t),style:n?{touchAction:"pan-y"}:void 0,onPointerDown:C,onPointerMove:E,onPointerUp:R,onPointerCancel:A=>S(A.pointerId,!1),onLostPointerCapture:A=>S(A.pointerId,!1),children:[n&&y.jsx("span",{className:"swipe-cue",ref:l,"aria-hidden":!0,children:y.jsx(Se,{name:"reply",size:16})}),y.jsx("div",{className:"bubble-wrap",ref:a,children:e.children}),e.after]})}const Nz=k.memo(function(t){const{messages:n,optimisticSend:i,sentKeys:s,hiddenEarlier:a,unreadWireId:l,roomLines:c,contactCid:f,contactName:h,onStartReply:m,onPreview:p,onFetchFile:v}=t,w=new Map;for(const P of n)P.wireId&&w.set(P.wireId,P);const S=P=>c.get(P)??null,C=P=>{if(P.dir==="out")return"You";const O=S(P);return O&&O.variant==="chat"?O.author:h},E=P=>{if(P.kind==="file")return P.mime?.startsWith("image/")?"Photo":So(P.mime??"",P.filename??"")?"Voice message":P.filename||"File";const O=S(P);return O?O.text||$j(O):P.text},R=P=>{if(!P.replyTo)return null;const O=w.get(P.replyTo.wireId);return O?{author:C(O),text:E(O)}:{author:"",text:"Original message"}},A=P=>{P.wireId&&m({wireId:P.wireId,author:C(P),text:E(P)})},T=P=>{if(!P)return null;const O=S(P);return O?O.variant==="system"?"room:system":`room:chat:${O.author}${O.role}`:P.dir};return y.jsx(cR,{initial:!1,children:n.map((P,O)=>{const D=P===i?.message?i.key:P.wireId&&s.get(P.wireId)||P.wireId||`${P.date}-${a+O}`,H=gS(P.wireId||D),B=n[O-1],_=n[O+1],N=S(P),q=T(P),V=!!B&&T(B)===q&&q!=="room:system",ae=!!_&&T(_)===q&&q!=="room:system",J=(P.dir==="out"?"out":"in")+(V?" cont-top":"")+(ae?" cont-bot":""),ee=P.wireId?y.jsx("button",{className:"msg-reply",title:"Reply",onClick:()=>A(P),children:y.jsx(Se,{name:"reply",size:15})}):null,ge=P.wireId===l?y.jsx("div",{id:`unread-${H}`,className:"unread-divider",role:"separator",children:y.jsx("span",{children:"Unread messages"})}):null;if(N&&N.variant==="system"){const G=N.presentation??"system";return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:Ss,children:[ge,y.jsxs("div",{className:`room-system room-${G}-card`,role:"note",children:[N.label&&y.jsx("span",{className:"room-system-label",children:N.label}),N.roomName&&y.jsx("strong",{className:"room-card-name",children:N.roomName}),y.jsx(jx,{text:N.text,className:"room-system-text message-markdown"}),!!N.details?.length&&y.jsx("ul",{className:"room-card-details","aria-label":"Room event details",children:N.details.map(le=>y.jsx("li",{children:le},le))}),y.jsxs("span",{className:"room-card-provenance",children:[N.authoredBy&&y.jsx("span",{className:"room-card-author",children:N.authoredBy}),y.jsx("span",{className:"room-system-at",children:ji(P.date)})]})]})]},D)}if(P.kind==="file"){const G=$0(P.wireId)??{id:P.wireId,dir:P.dir,filename:P.filename??"file",mime:P.mime??"application/octet-stream",size:0,date:P.date};return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:12,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.98},transition:Ss,children:[ge,y.jsx(Uf,{dir:P.dir==="out"?"out":"in",rowClass:J,canReply:!!P.wireId,onReply:()=>A(P),after:ee,children:y.jsx("div",{className:`ours-message ours-message-file ours-message--${P.dir}`,children:y.jsx(BD,{rec:G,receipt:P.receipt,receiptless:P.receiptless,onPreview:p,onFetch:v})})})]},D)}if(P.typed){const G=P.typed.kind==="command_result"&&P.replyTo?w.get(P.replyTo.wireId):void 0,le=P.typed.kind==="command_result"&&P.dir==="in"&&P.peerCid===f&&G?.dir==="out"&&G.peerCid===f&&G.typed?.kind==="command",j=P.typed.kind==="command_result"&&!P.typed.outcome.ok?P.typed.outcome.error.toLowerCase():"",F=P.typed.kind==="command"?P.dir==="out"?"Accepted · pending result":"Received command":P.typed.kind==="unknown"?"Safe failure":P.dir==="out"?"Result sent":le?j==="validation_denied"||j==="validation_failed"?"Validation denied":j==="policy_denied"||j==="unauthorized"||j==="forbidden"?"Policy denied":P.typed.outcome.ok?"Completed":"Failed":"Unmatched result · safe failure",Q=P.typed.kind==="command"?P.typed.command:P.typed.kind==="command_result"?`Result for ${le&&G?.typed?.kind==="command"?G.typed.command:"unmatched command"}`:`Unsupported ${P.typed.wire_kind}`,M=P.typed.kind==="command"?P.typed.arguments:P.typed.kind==="command_result"?P.typed.outcome:{safe_failure:P.typed.malformed?"Malformed typed message":"Future typed message preserved"};return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0},transition:Ss,children:[ge,y.jsx(Uf,{dir:P.dir,rowClass:J,canReply:!!P.wireId,onReply:()=>A(P),after:ee,children:y.jsxs("div",{className:`ours-message typed-message ours-message--${P.dir}`,children:[y.jsx("div",{className:"typed-message-kind",children:P.typed.kind==="command"?"Command":P.typed.kind==="command_result"?"Result":"Typed message"}),y.jsx("strong",{children:Q}),y.jsx("div",{className:"typed-message-state",role:"status",children:F}),y.jsx("pre",{children:JSON.stringify(M,null,2)}),y.jsxs("div",{className:"bubble-at",children:[ji(P.date),P.dir==="out"&&y.jsx(Sd,{receipt:P.receipt,receiptless:P.receiptless})]})]})})]},D)}const we=R(P);return y.jsxs(yo.div,{className:"message-motion",id:H,initial:{opacity:0,y:12,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.98},transition:Ss,children:[ge,y.jsx(Uf,{dir:P.dir==="out"?"out":"in",rowClass:J,canReply:!!P.wireId,onReply:()=>A(P),after:ee,children:y.jsxs("div",{className:`ours-message ours-message--${P.dir}`,children:[we&&y.jsxs("div",{className:"quote",children:[we.author&&y.jsx("span",{className:"quote-author",children:we.author}),y.jsx("span",{className:"quote-text",children:we.text})]}),N&&!V&&y.jsxs(y.Fragment,{children:[N.roomName&&y.jsx("div",{className:"room-message-room",children:N.roomName}),y.jsxs("div",{className:"room-author",children:[y.jsx("span",{className:"room-author-name",children:N.author}),N.role&&y.jsx("span",{className:"room-author-role",children:N.role})]})]}),y.jsx(jx,{text:N?N.text:P.text}),y.jsxs("div",{className:"bubble-at",children:[ji(P.date),P.dir==="out"&&y.jsx(Sd,{receipt:P.receipt,receiptless:P.receiptless})]})]})})]},D)})})});function Mz(e){const{contact:t,messages:n}=e,[i,s]=k.useState(""),[a,l]=k.useState(!1),[c,f]=k.useState(null),[h,m]=k.useState(null),[p,v]=k.useState(null),[w,S]=k.useState(null),[C,E]=k.useState(null),[R,A]=k.useState(!1),[T,P]=k.useState(!1),[O,D]=k.useState(!1),[H,B]=k.useState(null),[_,N]=k.useState(null),[q,V]=k.useState(!1),[ae,J]=k.useState(!1),[ee,ge]=k.useState(!1),[we,G]=k.useState(!1),[le,j]=k.useState(!1),[F,Q]=k.useState(null),[M,Z]=k.useState(null),ye=k.useRef(null),me=k.useRef(null),pe=k.useRef(null),be=_?.recipient_cid===t?.id?_:null,Be=/^\/[^\s/]*$/.test(i)&&ee&&!q&&!we&&!le,Oe=Be&&e.onSendCommand?be?.commands.filter(Y=>Y.name.toLowerCase().startsWith(i.slice(1).toLowerCase()))??[]:[],Ge=JSON.stringify([t?.id,be?.fingerprint,i]),ut=F?.key===Ge?Oe.findIndex(Y=>Y.name===F.name):-1,it=k.useRef(null),Mt=k.useRef(null),Xt=k.useRef(null),Je=k.useRef(null),zt=k.useRef(null),bn=k.useRef(null),It=k.useRef(null),Yt=k.useRef(!1),Tt=k.useRef(null),We=k.useRef(!1),[Cr,ur]=k.useState(!1),[X,ie]=k.useState(0),je=k.useRef(null),Ne=k.useRef(!0),Fe=k.useRef(null),ot=k.useRef(0),U=k.useRef(null),ue=k.useRef(new Map),fe=k.useRef(0),Ae=k.useRef(null),Pe=k.useRef(null),de=k.useRef(0),ze=k.useRef(null),Gt=k.useRef("");k.useLayoutEffect(()=>{const Y=zt.current,ce=bn.current,he=It.current;if(!Y||!ce||!he)return;let $e=-1,Bt=-1,sn=null;const Pt=()=>{const Dt=Math.round(ce.getBoundingClientRect().height),Cn=Math.round(he.getBoundingClientRect().height);if(Dt!==$e&&($e=Dt,Y.style.setProperty("--conversation-head-height",`${Dt}px`)),Cn!==Bt){const yt=Ne.current;Bt=Cn,Y.style.setProperty("--conversation-compose-height",`${Cn}px`),yt&&(sn!==null&&cancelAnimationFrame(sn),sn=requestAnimationFrame(()=>{sn=null;const cr=Tt.current;cr&&Ne.current&&(cr.scrollTop=Math.max(0,cr.scrollHeight-cr.clientHeight))}))}};Pt();const On=new ResizeObserver(Pt);return On.observe(ce),On.observe(he),()=>{On.disconnect(),sn!==null&&cancelAnimationFrame(sn),Y.style.removeProperty("--conversation-head-height"),Y.style.removeProperty("--conversation-compose-height")}},[t?.id]),k.useEffect(()=>{s(""),m(null),v(null),f(null),S(null),E(null),A(!1),P(!1),D(!1),ot.current+=1,B(null),it.current?.abort(),N(null),V(!1),J(!1),Q(null),j(!1),G(!1),ue.current.clear(),Ae.current=null,Pe.current=null},[t?.id]);const Qt=async(Y=!0,ce=!0)=>{if(!t||!e.onLoadCommands)return;it.current?.abort();const he=new AbortController;it.current=he,J(!0),ce&&m(null);try{const $e=await e.onLoadCommands(t.id,he.signal);!he.signal.aborted&&$e.recipient_cid===t.id?(N($e),$e.commands.length===0?(V(!1),q&&requestAnimationFrame(()=>Je.current?.focus({preventScroll:!0}))):Y&&V(!0)):he.signal.aborted||(N(null),V(!1),ce&&m("Command discovery was refused because the authenticated recipient changed."))}catch($e){he.signal.aborted||(N(null),V(!1),ce&&m($e instanceof Wl?`Command discovery failed: ${$e.message}`:"Command discovery failed safely. The recipient may be offline or unsupported."))}finally{it.current===he&&J(!1)}};k.useEffect(()=>(Qt(!1,!1),()=>it.current?.abort()),[t?.id]);const ht=()=>{V(!1),Mt.current?.focus()},pt=k.useRef(Qt);pt.current=Qt,k.useEffect(()=>{if(!Be||!e.onLoadCommands)return;let Y=!1,ce;const he=async()=>{await pt.current(!1,!1),Y||(ce=setTimeout(he,2e3))};return he(),()=>{Y=!0,clearTimeout(ce),it.current?.abort()}},[Be,t?.id]),k.useEffect(()=>{pe.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest",behavior:"instant"})},[ut,Ge]);const Ze=()=>{ye.current=null,Z(null)};k.useLayoutEffect(Ze,[Be,Ge]),k.useLayoutEffect(()=>{me.current!==null&&(Je.current?.setSelectionRange(me.current,me.current),me.current=null)},[i]);const Ln=Y=>{if(!Be||!Oe.some(he=>he.name===Y))return;const ce=`/${Y} `;me.current=ce.length,s(ce),Q(null),j(!0),Ze(),Je.current?.focus({preventScroll:!0})};k.useEffect(()=>{if(!p)return;const Y=p.reply?.wireId;n.some(he=>he.kind!=="file"&&he.dir==="out"&&!!he.wireId&&!p.wireIds.has(he.wireId)&&he.text===p.text&&(he.replyTo?.wireId??void 0)===Y)&&(v(null),m(null),s(he=>he===p.draft?"":he),S(he=>he===p.reply?null:he))},[n,p]);const mn=!!c?.wireId&&n.some(Y=>Y.wireId===c.wireId),Vt=k.useMemo(()=>c&&!mn?[...n,c.message]:n,[n,c,mn]);k.useEffect(()=>{mn&&f(null)},[mn]),k.useLayoutEffect(()=>{const Y=Je.current;if(!Y)return;i.startsWith(Gt.current)||(Y.style.height="0px");const he=Y.scrollHeight,Bt=`${Math.max(44,Math.min(he,132))}px`;Y.style.height!==Bt&&(Y.style.height=Bt),Y.style.overflowY=he>132?"auto":"hidden",Gt.current=i},[i,t?.id]);const _i=Y=>{const ce=Tt.current;if(!ce)return;const he=Math.max(0,ce.scrollHeight-ce.clientHeight);if(Math.abs(ce.scrollTop-he)<1){Ae.current=null,Pe.current=null;return}const $e=Y&&!yS();Ae.current=$e?he:null,Pe.current=$e?ce.scrollTop:null,$e?ce.scrollTo({top:he,behavior:"smooth"}):ce.scrollTop=he},Er=()=>{je.current===null&&(je.current=requestAnimationFrame(()=>{je.current=null;const Y=Tt.current;if(!Y)return;const ce=Y.scrollHeight-Y.clientHeight-Y.scrollTop>48;ur(ce),ce||ie(0)}))};k.useLayoutEffect(()=>{if(!t){Fe.current=null,Ne.current=!0,de.current=0;return}const Y=Tt.current;if(!Y)return;const ce=Fe.current!==t.id,he=de.current,$e=Vt.length!==he,Bt=Vt.at(-1),sn=Bt?Bt.wireId||`${Bt.date}:${Bt.text}`:null,Pt=ze.current;if(de.current=Vt.length,ze.current=sn,!ce&&!$e&&Ae.current===null&&(Ne.current=Y.scrollHeight-Y.clientHeight-Y.scrollTop<=48),ce||Ne.current)_i($e&&!ce&&Fe.current!==null),Ne.current=!0;else if($e&&Vt.length>he&&sn!==Pt){const On=Pt===null?-1:Vt.findIndex(Dt=>(Dt.wireId||`${Dt.date}:${Dt.text}`)===Pt);ie(Dt=>Dt+Math.max(1,Vt.length-Math.max(0,On+1)))}Fe.current=t.id,Er()},[t,Vt.length]),k.useLayoutEffect(()=>{if(We.current||!e.unreadOpen||window.location.hash.startsWith("#chat-message-"))return;const Y=Tt.current,ce=document.getElementById(`unread-${gS(e.unreadOpen.wireId)}`);!Y||!ce||(Y.scrollTop=Math.max(0,ce.offsetTop-16),Ne.current=!1,We.current=!0,Er())},[e.unreadOpen,Vt.length]),k.useLayoutEffect(()=>{const Y=window.location.hash;if(!Y.startsWith("#chat-message-"))return;const ce=document.getElementById(Y.slice(1));ce&&(ce.scrollIntoView({block:"center"}),Ne.current=!1)},[t?.id,Vt.length]),k.useLayoutEffect(()=>{const Y=U.current,ce=Tt.current;if(Y===null||!ce)return;const he=requestAnimationFrame(()=>{U.current===Y&&(ce.scrollTop=Y.top+ce.scrollHeight-Y.height,U.current=null)});return()=>cancelAnimationFrame(he)},[Vt.length]),k.useEffect(()=>{const Y=Tt.current;if(!Y||typeof ResizeObserver>"u")return;const ce=Y.firstElementChild;if(!ce)return;const he=new ResizeObserver(()=>{Ne.current&&_i(Ae.current!==null),Er()});return he.observe(ce),he.observe(Y),()=>{he.disconnect(),je.current!==null&&cancelAnimationFrame(je.current)}},[t?.id]);const Mo=async Y=>{const ce=++ot.current;m(null),D(!0);try{if(Y.size>ks&&uS(Y.type,Y.name)){const $e=await sz(Y,ks);if(ce!==ot.current)return;E({filename:$e.filename,mime:$e.mime,bytes:$e.bytes,originalSize:$e.originalSize});return}if(Y.size>ks){m(`"${Y.name}" is ${ti(Y.size)} — files up to ${ti(ks)} can be sent.`);return}const he=await Y.arrayBuffer();if(ce!==ot.current)return;E({filename:Y.name||"file",mime:Y.type||"application/octet-stream",bytes:new Uint8Array(he)})}catch(he){ce===ot.current&&m(`Photo optimization failed: ${he instanceof Error?he.message:String(he)}`)}finally{ce===ot.current&&D(!1)}},oi=()=>{!C||!e.onSendFile||T||(P(!0),e.onSendFile(C,w?.wireId).then(()=>{E(null),S(null)}).catch(Y=>m(`File send failed: ${String(Y)} — it was not delivered.`)).finally(()=>P(!1)))},si=e.onDraftChange;k.useEffect(()=>(si?.(i.trim().length>0||a),()=>si?.(!1)),[i,a,si]);const ai=k.useMemo(()=>{const Y=new Map;for(const ce of Vt)Y.set(ce,ce.kind==="file"?null:ce.dir==="in"?_j(t?.announcedName??"",ce.text):null);return Y},[Vt,t?.announcedName]);if(!t)return e.emptyOverride?y.jsx(y.Fragment,{children:e.emptyOverride}):y.jsx("div",{className:"detail",children:y.jsxs("div",{className:"detail-empty",children:[y.jsx(Se,{name:"chat"}),y.jsxs("div",{children:[y.jsx("div",{style:{fontWeight:650,color:"var(--text-2)"},children:"Select a conversation"}),y.jsx("div",{style:{fontSize:"0.85rem"},children:"Chat with people, agents and apps across ours."})]})]})});const Io=async()=>{const Y=i,ce=Y.trim(),he=!!p&&Y===p.draft&&(w?.wireId??void 0)===p.reply?.wireId;if(!ce||Yt.current||he)return;p&&v(null),Yt.current=!0,l(!0),m(null);const $e=w,Bt=$e?.wireId,sn=new AbortController;let Pt=!1,On=0;s(""),S(null);const Dt=`optimistic-${++fe.current}`;f({key:Dt,wireId:null,message:{dir:"out",text:ce,date:new Date().toISOString(),read:!0,wireId:"",replyTo:Bt?{wireId:Bt}:null}});try{const Cn=await Promise.race([e.onSend(ce,Bt,sn.signal),new Promise((yt,cr)=>{On=window.setTimeout(()=>{Pt=!0,sn.abort(),cr(new Error("send timeout"))},Rz)})]);Cn?(ue.current.set(Cn,Dt),f(yt=>yt?.key===Dt?{...yt,wireId:Cn}:yt)):f(yt=>yt?.key===Dt?null:yt),v(null)}catch(Cn){f(null),s(yt=>yt===""?Y:yt),S(yt=>yt===null?$e:yt),Pt||!(Cn instanceof Wl)?(v({draft:Y,text:ce,reply:$e,wireIds:new Set(n.flatMap(yt=>yt.wireId?[yt.wireId]:[]))}),m(`${Pt?"Send timed out":"Send connection was interrupted"} — delivery status is unknown. Check the conversation; edit the draft before sending again.`)):m(`Send failed: ${String(Cn)} — the message was not delivered.`)}finally{window.clearTimeout(On),Yt.current=!1,l(!1)}},Tr=!!p&&i===p.draft&&(w?.wireId??void 0)===p.reply?.wireId;return y.jsxs("div",{className:"detail detail-chat",ref:zt,children:[y.jsx("div",{className:"detail-head",ref:bn,children:y.jsxs("div",{className:"conv-peer",children:[y.jsx("button",{className:"icon-btn detail-back","aria-label":"Back to conversations",onClick:e.onBack,children:y.jsx(Se,{name:"back"})}),y.jsxs("div",{className:"conv-peer-status",children:[y.jsx("span",{className:"conv-peer-name",children:t.name}),e.syncing&&y.jsxs("div",{className:"conv-sync",role:"status","aria-live":"polite",children:[y.jsx("span",{className:"conv-sync-dot","aria-hidden":!0}),e.syncing==="connecting"?"Connecting…":"Updating…"]}),!e.syncing&&y.jsxs("span",{className:"conv-contact-status",children:[y.jsx(Se,{name:"lock",size:11}),"Encrypted connection"]})]}),y.jsx("button",{type:"button",className:"conv-contact-trigger conv-contact-avatar","data-contact-trigger":!0,onClick:e.onOpenContact,disabled:!e.onOpenContact,"aria-label":`Open contact details for ${t.name}`,children:y.jsx("span",{className:"conv-contact-initials","aria-hidden":!0,children:t.initials})})]})}),y.jsx("div",{className:"messages",ref:Tt,tabIndex:-1,"aria-label":"Conversation timeline",onScroll:Y=>{const ce=Y.currentTarget,he=ce.scrollHeight-ce.clientHeight-ce.scrollTop;if(Ae.current!==null){const $e=Pe.current;if($e===null||ce.scrollTop>=$e-1){Pe.current=ce.scrollTop,he<=4&&(Ae.current=null,Pe.current=null);return}Ae.current=null,Pe.current=null}Ne.current=he<=48,Er()},onPointerDown:()=>{Ae.current=null,Pe.current=null},onTouchStart:()=>{Ae.current=null,Pe.current=null},onWheel:()=>{Ae.current=null,Pe.current=null},onDragOver:Y=>{e.onSendFile&&Y.preventDefault()},onDrop:Y=>{if(!e.onSendFile)return;Y.preventDefault();const ce=Y.dataTransfer.files?.[0];ce&&Mo(ce)},children:y.jsxs("div",{className:"messages-inner",children:[y.jsxs("div",{className:"e2e-note",children:[y.jsx(Se,{name:"lock"}),"End-to-end encrypted · the broker only sees ciphertext"]}),(e.hiddenEarlier??0)>0&&e.onLoadEarlier&&y.jsxs("button",{className:"btn sm chat-load-earlier",onClick:()=>{Ne.current=!1;const Y=Tt.current;U.current=Y?{height:Y.scrollHeight,top:Y.scrollTop}:null,e.onLoadEarlier?.()},children:["Load earlier messages (",e.hiddenEarlier," remaining)"]}),y.jsx(Nz,{messages:Vt,optimisticSend:c,sentKeys:ue.current,hiddenEarlier:e.hiddenEarlier??0,unreadWireId:e.unreadOpen?.wireId,roomLines:ai,contactCid:t.id,contactName:t.name,onStartReply:S,onPreview:B,onFetchFile:e.onFetchFile}),y.jsx("div",{className:"thread-end","aria-hidden":!0})]})},t.id),Cr&&y.jsxs("button",{type:"button",className:"jump-latest btn sm","aria-label":X?`Jump to latest, ${X} new messages`:"Jump to latest",onClick:Y=>{const ce=Y.currentTarget===document.activeElement;ie(0),_i(!0),ce&&requestAnimationFrame(()=>Tt.current?.focus({preventScroll:!0}))},children:[y.jsx("span",{children:"Jump to latest"}),!!X&&y.jsx("span",{className:"jump-latest-count","aria-live":"polite",children:X})]}),h&&y.jsxs("div",{className:"banner error",role:"alert",children:[h,h.startsWith("Send failed:")&&y.jsx("span",{className:"banner-actions",children:y.jsx("button",{className:"linkbtn",onClick:()=>void Io(),children:"retry"})})]}),y.jsxs("div",{className:"composer-wrap",ref:It,children:[q&&be&&e.onSendCommand&&y.jsx(vz,{catalog:be,recipientName:t.name,busy:ae,onRefresh:()=>void Qt(!0,!0),onClose:ht,onSend:async(Y,ce,he,$e)=>{if(!t||t.id!==be.recipient_cid)throw new Error("Recipient changed; refresh commands");return e.onSendCommand(t.id,Y.name,ce,he,$e)}},`${be.recipient_cid}:${be.fingerprint}`),Oe.length>0&&y.jsx("div",{ref:pe,id:"composer-command-suggestions",className:"command-suggestions",role:"listbox","aria-label":"Suggested contact commands",onScroll:Ze,children:Oe.map((Y,ce)=>y.jsxs("div",{id:`composer-command-option-${ce}`,role:"option","aria-selected":ce===ut,className:"command-suggestion","data-pressed":M?.key===Ge&&M.name===Y.name||void 0,onMouseDown:he=>{he.button===0&&he.preventDefault()},onPointerDown:he=>{!he.isPrimary||he.button!==0||(ye.current={key:Ge,name:Y.name},Z({key:Ge,name:Y.name,pointer:he.pointerId,x:he.clientX,y:he.clientY}))},onPointerMove:he=>{M?.pointer===he.pointerId&&Math.hypot(he.clientX-M.x,he.clientY-M.y)>10&&Ze()},onPointerUp:()=>Z(null),onPointerCancel:Ze,onPointerLeave:he=>{he.buttons!==0&&Ze()},onClick:he=>{const $e=ye.current;Ze(),(he.detail===0||$e?.key===Ge&&$e.name===Y.name)&&Ln(Y.name)},children:[y.jsxs("strong",{children:["/",Y.name]}),Y.description&&y.jsx("span",{children:Y.description})]},`${Ge}:${Y.name}`))}),w&&y.jsxs("div",{className:"reply-bar",children:[y.jsx("div",{className:"reply-bar-line"}),y.jsxs("div",{className:"reply-bar-body",children:[y.jsxs("div",{className:"reply-bar-author",children:["Replying to ",w.author]}),y.jsx("div",{className:"reply-bar-text",children:w.text})]}),y.jsx("button",{className:"icon-btn",title:"Cancel reply",onClick:()=>S(null),children:y.jsx(Se,{name:"close",size:16})})]}),C&&y.jsx(z1,{att:C,sending:T,onSend:oi,onDiscard:()=>E(null)}),O&&y.jsx("div",{className:"attachment-processing",role:"status",children:"Optimizing photo for secure delivery…"}),y.jsxs("div",{className:"composer"+(R?" recording":""),children:[e.onLoadCommands&&be&&be.commands.length>0&&y.jsx("button",{ref:Mt,type:"button",className:"icon-btn composer-tool command-trigger",title:"Recipient commands","aria-label":"Recipient commands","aria-expanded":q,disabled:ae,onClick:()=>{q?ht():V(!0)},children:y.jsx(Se,{name:"menu",size:19})}),e.onSendFile&&y.jsxs(y.Fragment,{children:[y.jsx("input",{ref:Xt,type:"file",style:{display:"none"},onChange:Y=>{const ce=Y.target.files?.[0];ce&&Mo(ce),Y.target.value=""}}),y.jsx("button",{className:"icon-btn composer-tool",title:"Attach a file or photo",disabled:T||O||R,onClick:()=>Xt.current?.click(),children:y.jsx(Se,{name:"paperclip",size:18})})]}),y.jsx("textarea",{ref:Je,className:"field",rows:1,placeholder:(w?"Reply to "+w.author:"Message "+t.name)+"…",value:i,"aria-busy":a,"aria-autocomplete":Oe.length?"list":void 0,"aria-controls":Oe.length?"composer-command-suggestions":void 0,"aria-activedescendant":ut>=0?`composer-command-option-${ut}`:void 0,onFocus:()=>ge(!0),onBlur:()=>{ge(!1),Q(null)},onCompositionStart:()=>{G(!0),Q(null)},onCompositionEnd:()=>G(!1),onChange:Y=>{s(Y.target.value),Q(null),j(!1)},onKeyDown:Y=>{if(!(we||Y.nativeEvent.isComposing||Y.keyCode===229)){if(Oe.length&&!Y.shiftKey&&!Y.altKey&&!Y.ctrlKey&&!Y.metaKey){if(Y.key==="ArrowDown"||Y.key==="ArrowUp"){Y.preventDefault();const ce=ut<0?Y.key==="ArrowDown"?0:Oe.length-1:(ut+(Y.key==="ArrowDown"?1:-1)+Oe.length)%Oe.length;Q({key:Ge,name:Oe[ce].name});return}if((Y.key==="Enter"||Y.key==="Tab")&&ut>=0){Y.preventDefault(),Ln(Oe[ut].name);return}if(Y.key==="Escape"){Y.preventDefault(),j(!0),Q(null);return}}Y.key==="Enter"?!(window.matchMedia("(pointer: coarse)").matches||window.innerWidth<=860)&&!Y.shiftKey&&(Y.preventDefault(),Io()):Y.key==="Escape"&&S(null)}}}),e.onSendFile&&!i.trim()&&!C&&!O&&!T?y.jsx(V1,{disabled:T||O||!!C,onReady:Y=>{A(!1),E(Y)},onError:Y=>{A(!1),m(Y)},onActiveChange:A},t.id):y.jsxs("button",{className:"btn primary","aria-label":"Send",onPointerDown:Y=>{Y.button===0&&document.activeElement===Je.current&&Y.preventDefault()},onClick:()=>void Io(),disabled:a||Tr||!i.trim(),title:Tr?"Delivery status unknown — edit before sending again":void 0,children:[y.jsx(Se,{name:"send",size:16}),y.jsx("span",{className:"btn-label",children:"Send"})]})]})]}),H&&(Ys(H.filename,H.mime)?y.jsx(aS,{rec:H,onClose:()=>B(null)}):y.jsx(sS,{rec:H,onClose:()=>B(null),onSendText:e.onSend,onSendFile:e.onSendFile}))]})}const vS=3;function Iz(e,t,n=vS){return[t,...e.filter(i=>i.cid!==t.cid)].slice(0,n)}function Dz(e,t){return e.filter(n=>n.id!==t)}const _z=6e3,Lz=Iz,Oz=Dz;function Fz(){const[e,t]=k.useState([]),n=k.useRef(0),i=k.useCallback((l,c,f)=>{const h=Date.now(),m={id:`${l}:${h}:${n.current++}`,cid:l,name:c,preview:"",at:h};t(p=>Lz(p,m,vS))},[]),s=k.useCallback(l=>t(c=>Oz(c,l)),[]),a=k.useCallback(l=>t(c=>c.filter(f=>f.cid!==l)),[]);return{toasts:e,push:i,dismiss:s,clear:a}}function zz(e){const{item:t,onOpen:n,onDismiss:i}=e,[s,a]=k.useState(!1),[l,c]=k.useState(!1),f=s||l;return k.useEffect(()=>{if(f)return;const h=setTimeout(()=>i(t.id),_z);return()=>clearTimeout(h)},[t.id,f,i]),y.jsxs("div",{className:"banner msg",role:"status",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>c(!0),onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||c(!1)},children:[y.jsxs("button",{className:"msg-open",title:`Open the conversation with ${t.name}`,onClick:()=>n(t.cid),children:[y.jsx("span",{className:"avatar sm accent","aria-hidden":"true",children:wd(t.name)}),y.jsxs("span",{className:"msg-text",children:[y.jsx("strong",{className:"msg-name",children:t.name}),y.jsx("span",{className:"msg-preview",children:t.preview||"New message"})]})]}),y.jsx("button",{className:"icon-btn msg-close",title:"Dismiss","aria-label":`Dismiss the notification from ${t.name}`,onClick:()=>i(t.id),children:y.jsx(Se,{name:"close",size:15})})]})}function Vz(e){return y.jsx(y.Fragment,{children:e.items.map(t=>y.jsx(zz,{item:t,onOpen:e.onOpen,onDismiss:e.onDismiss},t.id))})}function Bz(e){const t=k.useRef(null),{text:n,size:i=240}=e;return k.useEffect(()=>{if(!t.current||!n)return;const s=t.current;Wh(()=>import("./browser-ByIBVK5q.js").then(a=>a.b),[]).then(a=>{a.toCanvas(s,n,{width:i,margin:2,errorCorrectionLevel:"M",color:{dark:"#000000",light:"#ffffff"}})})},[n,i]),y.jsx("div",{style:{display:"flex",justifyContent:"center",margin:"8px 0"},children:y.jsx("canvas",{ref:t,"data-testid":"qr-canvas","data-invite":n,width:i,height:i,style:{borderRadius:8,border:"1px solid var(--line)",imageRendering:"pixelated"}})})}function $z(e){const t=k.useRef(null),n=k.useRef(null),i=k.useRef(null),s=k.useRef(0),a=k.useRef(!0),[l,c]=k.useState("requesting"),[f,h]=k.useState(""),m=k.useCallback(()=>{s.current&&cancelAnimationFrame(s.current),i.current&&(i.current.getTracks().forEach(w=>w.stop()),i.current=null),t.current&&(t.current.srcObject=null)},[]),p=k.useCallback(w=>{i.current=w;const S=t.current;S.srcObject=w,S.setAttribute("playsinline","true"),S.play();const C=n.current,E=C.getContext("2d"),R=()=>{if(a.current)if(S.readyState>=S.HAVE_ENOUGH_DATA){const A=S.videoWidth||320,T=S.videoHeight||240;C.width=A,C.height=T,E.drawImage(S,0,0,A,T);const P=E.getImageData(0,0,A,T);Wh(()=>import("./jsQR-Ck2KRhtk.js").then(O=>O.j),[]).then(O=>{const D=O.default,H=D(P.data,P.width,P.height,{inversionAttempts:"dontInvert"});if(H&&H.data&&a.current){m(),e.onDecode(H.data);return}a.current&&(s.current=requestAnimationFrame(R))})}else s.current=requestAnimationFrame(R)};s.current=requestAnimationFrame(R)},[m,e]);k.useEffect(()=>{if(a.current=!0,!navigator.mediaDevices?.getUserMedia){c("nocamera");return}return navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}).then(w=>{if(!a.current){w.getTracks().forEach(S=>S.stop());return}c("scanning"),p(w)}).catch(w=>{if(!a.current)return;const S=w.name??"";S==="NotAllowedError"||S==="PermissionDeniedError"?c("denied"):S==="NotFoundError"||S==="DevicesNotFoundError"?c("nocamera"):(c("error"),h(w.message??String(w)))}),()=>{a.current=!1,m()}},[]);const v=()=>{m(),e.onClose()};return y.jsxs("div",{"data-testid":"qr-scanner",style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 0"},children:[(l==="requesting"||l==="scanning")&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.88rem"},children:l==="requesting"?"Requesting camera…":"Point your camera at the QR code."}),y.jsxs("div",{style:{position:"relative",borderRadius:8,overflow:"hidden",background:"#000",minHeight:200},children:[y.jsx("canvas",{ref:n,"data-testid":"scanner-canvas",style:{display:"none"}}),y.jsx("video",{ref:t,"data-testid":"scanner-video",muted:!0,playsInline:!0,style:{width:"100%",display:"block",borderRadius:8}}),l==="scanning"&&y.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsx("div",{style:{width:160,height:160,borderRadius:12,border:"2px solid var(--accent)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.4)"}})})]})]}),l==="denied"&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--text-2)"},children:[y.jsx(Se,{name:"shield",size:16}),y.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:"Camera access denied"})]}),y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.88rem"},children:"Camera permission was denied. To scan QR codes, allow camera access in your browser settings, then try again. Or paste the invite text below instead."})]}),l==="nocamera"&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--text-2)"},children:[y.jsx(Se,{name:"close",size:16}),y.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:"No camera available"})]}),y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.88rem"},children:"No camera was found on this device. Paste the invite text below instead."})]}),l==="error"&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:y.jsxs("p",{style:{margin:0,fontSize:"0.85rem",color:"var(--danger, #e53)"},children:["Camera error: ",f||"unknown error",". Paste the invite text below instead."]})}),y.jsx("button",{className:"btn",style:{justifyContent:"center"},onClick:v,children:l==="scanning"?y.jsxs(y.Fragment,{children:[y.jsx(Se,{name:"close",size:14}),"Cancel scan"]}):y.jsxs(y.Fragment,{children:[y.jsx(Se,{name:"close",size:14}),"Close scanner"]})})]})}function Uz(e){const[t,n]=k.useState("generate"),[i,s]=k.useState("one_time"),[a,l]=k.useState(""),[c,f]=k.useState(null),[h,m]=k.useState("one_time"),[p,v]=k.useState(""),[w,S]=k.useState(""),[C,E]=k.useState(!1),[R,A]=k.useState(null),[T,P]=k.useState(null),[O,D]=k.useState(!1),[H,B]=k.useState(null),_=k.useRef(!1),N=async()=>{if(!_.current){_.current=!0,E(!0),P(null),A(null);try{m(i),f(await e.onCreate(i,i==="one_time"&&a.trim()||void 0))}catch(V){P(V instanceof Error?V.message:String(V))}finally{_.current=!1,E(!1)}}},q=y.jsx(lS,{className:"modal-tabs",label:"Invite mode",options:[{id:"generate",label:"Generate invite"},{id:"accept",label:"Accept invite"}],value:t,onChange:n,idPrefix:"invite-tab",panelId:"invite-panel"});return y.jsx(Zs,{title:t==="generate"?"Invite a contact":"Accept an invite",onClose:()=>{_.current||e.onClose()},tabs:q,children:y.jsxs("div",{id:"invite-panel",role:"tabpanel","aria-labelledby":`invite-tab-${t}`,children:[t==="generate"&&!c&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:13},children:[y.jsxs("p",{className:"muted","data-testid":"invite-identity",style:{margin:0,fontSize:"0.85rem"},children:["Creating as ",y.jsx("strong",{children:e.identity.name})," · ",y.jsxs("span",{className:"mono",children:["@",V0(e.identity.cid)]})]}),y.jsxs("div",{role:"radiogroup","aria-label":"Invite kind",style:{display:"flex",flexDirection:"column",gap:7},children:[y.jsxs("label",{children:[y.jsx("input",{type:"radio",name:"invite-kind",checked:i==="one_time",onChange:()=>s("one_time")})," One person (one time)"]}),y.jsxs("label",{children:[y.jsx("input",{type:"radio",name:"invite-kind",checked:i==="public",onChange:()=>s("public")})," Reusable public invite"]})]}),i==="one_time"?y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"muted",style:{margin:0,fontSize:"0.9rem"},children:"Optionally name the person or agent this invite is for."}),y.jsx("input",{className:"field",value:a,onChange:V=>l(V.target.value),placeholder:"Their name (optional), e.g. Bob",maxLength:64})]}):y.jsx("p",{className:"onb-warning","data-testid":"public-invite-warning",style:{margin:0,fontSize:"0.9rem"},children:"Anyone with this invite can connect until you revoke it. It has no expiry and stays valid across server restarts."}),y.jsx("button",{className:"btn primary",style:{justifyContent:"center"},disabled:C,onClick:()=>void N(),children:C?"Generating…":i==="public"?"Create public invite":"Generate invite"}),i==="public"&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[y.jsx("h4",{style:{margin:0,fontSize:"0.9rem"},children:"Active reusable invites"}),e.invites.filter(V=>V.mode==="public").length===0&&y.jsx("p",{className:"muted",style:{margin:0},children:"None right now."}),e.invites.filter(V=>V.mode==="public").map(V=>y.jsxs("div",{"data-testid":"public-invite-row",style:{padding:"8px 10px",background:"var(--inset)",borderRadius:7},children:[y.jsx("span",{className:"mono",children:V.invite_id}),y.jsxs("p",{className:"muted",children:["Created ",V.created?Kj(V.created):"unknown"," · Active until revoked · No expiry"]}),H===V.invite_id?y.jsxs("span",{children:[y.jsx("button",{className:"btn sm danger",onClick:()=>void e.onRevoke(V.invite_id).then(()=>(B(null),e.onRefresh())).catch(ae=>P(String(ae))),children:"Confirm revoke"})," ",y.jsx("button",{className:"btn sm",onClick:()=>B(null),children:"Keep it"})]}):y.jsx("button",{className:"btn sm",onClick:()=>B(V.invite_id),children:"Revoke"})]},V.invite_id))]}),R&&y.jsx("p",{className:"muted",children:R}),T&&y.jsx("p",{className:"onb-error",children:T})]}),t==="generate"&&c&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"muted","data-testid":h==="public"?"public-result-note":void 0,children:h==="public"?"Shown only on this screen. Copy it now; the text cannot be recovered later. The invite stays active until revoked.":`Send this invite to ${a.trim()||"your contact"}. It can be redeemed once.`}),y.jsx("textarea",{className:"field mono","data-testid":"invite-result-text",readOnly:!0,rows:5,value:c,onFocus:V=>V.currentTarget.select()}),h==="one_time"&&y.jsx(Bz,{text:c}),y.jsxs("button",{className:"btn primary",onClick:()=>void navigator.clipboard.writeText(c).then(()=>A("Copied to clipboard.")),children:[y.jsx(Se,{name:"copy",size:15}),"Copy invite"]}),h==="public"&&y.jsx("button",{className:"btn","data-testid":"done-hide-invite",onClick:()=>{f(null),l(""),e.onRefresh()},children:"Done — hide invite"}),R&&y.jsx("p",{className:"muted",children:R})]}),t==="accept"&&y.jsxs("form",{style:{display:"flex",flexDirection:"column",gap:13},onSubmit:V=>{V.preventDefault(),!(!p.trim()||C)&&(E(!0),P(null),e.onAccept(p.trim(),w.trim()||void 0).then(()=>{A("Invite accepted — the contact will appear once the sender verifies your identity."),v(""),S("")}).catch(ae=>P(String(ae))).finally(()=>E(!1)))},children:[y.jsx("p",{className:"muted",children:"Paste the invite you received, or scan a QR code."}),O?y.jsx($z,{onDecode:V=>{v(V),D(!1)},onClose:()=>D(!1)}):y.jsxs("button",{type:"button",className:"btn",onClick:()=>D(!0),children:[y.jsx(Se,{name:"monitor",size:15}),"Scan QR code"]}),y.jsx("textarea",{className:"field mono","aria-label":"Invite",rows:5,value:p,onChange:V=>v(V.target.value),placeholder:"Paste invite text…"}),y.jsx("input",{className:"field",value:w,onChange:V=>S(V.target.value),placeholder:"Rename them (optional)",maxLength:64}),y.jsx("button",{className:"btn primary",type:"submit",disabled:C||!p.trim(),children:C?"Connecting…":"Add contact"}),R&&y.jsx("p",{className:"muted",children:R}),T&&y.jsx("p",{className:"onb-error",children:T})]})]})})}function Wz(e){const[t,n]=k.useState(e.identity.bio??""),[i,s]=k.useState(!1),[a,l]=k.useState(null),[c,f]=k.useState(e.push.preview),h=LA(),m=!e.workerSupported||e.push.status==="unsupported"?h??"Unavailable — requires a secure browser with service-worker support.":e.push.status==="needs-permission"?h??"Needs permission — allow notifications, then choose Enable or Repair.":e.push.status==="on"?"On — this browser and the server agree on the current Web Push configuration.":e.push.status==="repairing"?"Repairing — checking the browser subscription and server acknowledgement…":e.push.status==="error"?"Repair needed — the browser and server could not confirm the same subscription.":"Off — enable notifications for this browser.";return y.jsxs(Zs,{title:"Settings",onClose:e.onClose,wide:!0,children:[y.jsxs("div",{children:[y.jsx("span",{className:"lbl",children:"Display name"}),y.jsx("input",{className:"field",readOnly:!0,value:e.identity.name})]}),y.jsxs("div",{children:[y.jsx("span",{className:"lbl",children:"Your address"}),y.jsx("input",{className:"field mono",readOnly:!0,value:e.identity.cid,onFocus:p=>p.currentTarget.select()}),y.jsx("p",{className:"muted",children:"Your public address on ours. Share an invite to connect more easily."})]}),y.jsxs("div",{children:[y.jsx("span",{className:"lbl",children:"Public bio"}),y.jsx("textarea",{className:"field",rows:3,value:t,onChange:p=>{n(p.target.value),s(!1),l(null)}}),y.jsx("button",{className:"btn sm",onClick:()=>{l(null),e.onSaveBio(t).then(()=>s(!0)).catch(p=>l(String(p)))},children:i?"Saved":"Save bio"}),a&&y.jsx("p",{className:"onb-error",children:a})]}),y.jsxs("label",{style:{display:"flex",gap:9},children:[y.jsx("input",{type:"checkbox",checked:e.dark,onChange:e.onToggleDark})," Dark mode"]}),y.jsxs("div",{style:{borderTop:"1px solid var(--line)",paddingTop:16},children:[y.jsx("h4",{children:"Notifications"}),y.jsx("p",{className:e.push.status==="needs-permission"||e.push.status==="error"?"onb-error":"muted",children:m}),h&&h!==m&&y.jsx("p",{className:"muted","data-testid":"push-platform-guidance",children:h}),y.jsxs("fieldset",{style:{border:0,padding:0,margin:"12px 0"},children:[y.jsx("legend",{className:"lbl",children:"Lock-screen preview"}),y.jsxs("label",{style:{display:"block",marginTop:7},children:[y.jsx("input",{type:"radio",name:"push-preview",checked:c==="full",onChange:()=>f("full")})," Full — sender and message text or filename"]}),y.jsxs("label",{style:{display:"block",marginTop:7},children:[y.jsx("input",{type:"radio",name:"push-preview",checked:c==="private",onChange:()=>f("private")})," Private — generic content only"]})]}),y.jsx("p",{className:"muted",children:"Full previews can expose sender names, message text, and filenames on the lock screen. The push provider still sees delivery endpoint, timing, and payload size metadata in either mode."}),y.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.push.status==="on"?y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"btn",disabled:e.busy,onClick:()=>void e.onPushAction("disable",c),children:"Disable notifications"}),y.jsx("button",{className:"btn",disabled:e.busy,onClick:()=>void e.onPushAction("repair",c),children:"Repair"}),c!==e.push.preview&&y.jsx("button",{className:"btn primary",disabled:e.busy,onClick:()=>void e.onPushAction("enable",c),children:"Save preview"})]}):y.jsx("button",{className:"btn primary",disabled:e.busy||!e.workerSupported||e.push.status==="unsupported",onClick:()=>void e.onPushAction(e.push.status==="error"||e.push.blocked?"repair":"enable",c),children:e.busy?"Repairing…":e.push.status==="error"||e.push.blocked?"Repair":"Enable notifications"})})]}),y.jsxs("div",{style:{borderTop:"1px solid var(--line)",paddingTop:16},children:[y.jsx("h4",{children:"App status"}),y.jsx("p",{className:"muted",children:e.offline?"Offline — reconnecting. Message and identity data are never cached.":"Online."}),e.onInstall&&y.jsx("button",{className:"btn",onClick:e.onInstall,children:"Install app"}),e.updateAvailable&&y.jsx("button",{className:"btn primary",onClick:e.onReloadUpdate,children:"Reload to update"})]}),y.jsxs("div",{style:{borderTop:"1px solid var(--line)",paddingTop:16},children:[y.jsx("h4",{children:"Build"}),y.jsx("input",{className:"field mono",readOnly:!0,value:e.build?`${e.build.version} · ${e.build.sha}`:"Loading…"})]})]})}function Hz(e,t,n,i,s=6e4){return!t||!t.sha?"current":t.sha===e?(n.remoteSha=null,n.firstMismatchAt=null,"current"):(n.remoteSha=t.sha,(n.firstMismatchAt===null||n.firstMismatchAt===void 0)&&(n.firstMismatchAt=i),n.controllerChanged?"newer-available":i-n.firstMismatchAt>=s?"stuck":"newer-available")}const Kz="afc1c680416b52d2c6a87a3f8f512943e0288d32",qz=15*6e4,Xz=6e4,Yz=Hz;async function Gz(){try{const e=await fetch("/version.json",{cache:"no-store"});return e.ok?await e.json():null}catch{return null}}function Qz(e){const t={remoteSha:null,firstMismatchAt:null,controllerChanged:!1},n=()=>{t.controllerChanged=!0};navigator.serviceWorker?.addEventListener("controllerchange",n);let i=!1;const s=async()=>{const f=await Gz(),h=Yz(Kz,f,t,Date.now(),Xz);h==="newer-available"?(e.onUpdateAvailable(),navigator.serviceWorker?.getRegistration().then(m=>m?.update())):h==="stuck"&&!i&&(i=!0,e.onStuck(f.sha))},a=setTimeout(()=>void s(),5e3),l=setInterval(()=>void s(),qz),c=()=>{document.visibilityState==="visible"&&s()};return document.addEventListener("visibilitychange",c),()=>{clearTimeout(a),clearInterval(l),document.removeEventListener("visibilitychange",c),navigator.serviceWorker?.removeEventListener("controllerchange",n)}}async function Jz(e){try{const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(i=>i.unregister()));const n=await caches.keys();await Promise.all(n.map(i=>caches.delete(i)))}catch{}return location.replace(location.pathname+"?v="+encodeURIComponent(e)),new Promise(()=>{})}function Zz(){const e=new URL(location.href);e.searchParams.has("v")&&(e.searchParams.delete("v"),history.replaceState(null,"",e.pathname+e.search+e.hash))}const $x=[0,100,400,1e3,3e3,6e3],Ux=e=>new Promise(t=>setTimeout(t,e)),Wx={delivered:1,read:2},Hx="ours-dark-v3",Kx="#chat-message-",qx=Hl,e4=e=>e instanceof Error&&e.message?e.message:"The request could not be completed.";function xS(e,t){const n=new Map,i=[];for(const s of e?.messages??[]){const a={dir:s.dir,text:s.text,date:s.date,read:s.read,wireId:s.wire_id,replyTo:s.reply_to?{wireId:s.reply_to.wire_id}:null,peerCid:s.peer_cid,receipt:s.receipt??void 0,receiptless:s.dir==="out"&&!s.wire_id,messageKind:s.message_kind,typed:s.typed};s.wire_id?n.set(s.wire_id,a):i.push(a)}for(const s of t){const a=n.get(s.wire_id);n.set(s.wire_id,{dir:s.dir,text:"",date:s.date,read:a?.read??s.dir==="out",wireId:s.wire_id,replyTo:s.reply_to?{wireId:s.reply_to.wire_id}:a?.replyTo??null,kind:"file",filename:s.filename,mime:s.mime,receipt:a?.receipt})}return[...i,...n.values()].sort((s,a)=>{const l=qx(s.date)-qx(a.date);return l===0?s.wireId.localeCompare(a.wireId):l})}function t4(e){const t={};for(const n of Object.values(e.roots??{}))t[n.root_cid]={label:n.root_name,note:"Verified identity"};return t}function n4(e,t){return[...e.contacts.contacts.map(i=>{const s=e.contacts.roots?.[i.container_id],a=wr(e,i.container_id),c=xS(a,t[i.container_id]??[]).at(-1),f=ql(i);return{id:i.container_id,name:f,announcedName:i.name,initials:wd(f),when:c?Hj(c.date):"",activityAt:c?.date??"",last:c?.kind==="file"?eN(c.filename,c.mime):a?.preview??c?.text??"",unread:a?.unread??0,status:"active",root:s?.root_cid??null,sub:s?`role “${s.role_id}” of ${s.root_name}`:"",roleId:s?.role_id??null,rootName:s?.root_name??null,mine:!1,kind:s?"agent":"person"}}),...e.contacts.pending.map(i=>{const s=ql(i);return{id:`pending:${i.container_id}`,name:s,announcedName:i.name,initials:wd(s),when:"",activityAt:"",last:`${i.queued} queued · approval required`,unread:0,status:"pending",root:null,sub:"",roleId:null,rootName:null,mine:!1,kind:"person"}})]}function r4(){return y.jsx(i4,{})}function i4(){const e=k.useRef(jA(yf(window.location.pathname))).current,[t,n]=k.useReducer(dv,e),[i,s]=k.useState(null),a=k.useRef(0),l=k.useRef(null),c=k.useRef(t),f=k.useRef(new TA),h=k.useRef(null),m=k.useRef(new Map),p=k.useRef(new Map),[v,w]=k.useState({}),S=k.useRef(v),[C,E]=k.useState(null),R=k.useRef(new Set),[A,T]=k.useState(null),P=k.useRef(A),O=k.useRef(!1),[D,H]=k.useState([]),[B,_]=k.useState(null),[N,q]=k.useState(()=>localStorage.getItem(Hx)!=="0"),[V,ae]=k.useState(null),[J,ee]=k.useState({supported:!1,offline:!navigator.onLine,updateAvailable:!1,registration:null}),[ge,we]=k.useState({status:"unsupported",preview:"full"}),[G,le]=k.useState(!1),j=k.useRef(!1),[F,Q]=k.useState(()=>window.location.hash.startsWith(Kx)),{toasts:M,push:Z,dismiss:ye,clear:me}=Fz(),pe=k.useCallback(U=>{c.current=dv(c.current,U),n(U)},[]),be=k.useCallback(U=>{O.current=U},[]);k.useEffect(()=>{c.current=t},[t]),P.current=A,S.current=v,k.useMemo(()=>(bv(Object.values(v).flat()),null),[v]),k.useEffect(()=>(document.documentElement.classList.toggle("theme-dark",N),()=>document.documentElement.classList.remove("theme-dark")),[N]);const xe=k.useCallback(U=>pe({type:"error",message:e4(U)}),[pe]),Be=k.useCallback(()=>{const U=c.current;return{visibility:document.visibilityState,appRoute:U.route.name==="chats"?"chats":"other",selectedContactCid:Xr(U),desktopLayout:h.current?.matches??window.innerWidth>=861,mobileDetailOpen:U.mobileDetailOpen,conversationCoveringDialogOpen:P.current!==null}},[]),Oe=k.useCallback(async(U,ue=!0)=>{try{const fe=await Ye.conversation(U);return pe({type:"page",contactCid:U,page:fe}),fe}catch(fe){return ue&&xe(fe),null}},[pe,xe]),Ge=k.useCallback(async(U,ue=!0)=>{try{const fe=await Ye.files(U);return bv(fe.files),w(Ae=>({...Ae,[U]:fe.files})),fe.files}catch(fe){return ue&&xe(fe),null}},[xe]);k.useEffect(()=>Qz({onUpdateAvailable:()=>ee(U=>({...U,updateAvailable:!0})),onStuck:U=>{Jz(U)}}),[]);const ut=k.useCallback(async()=>{const U=await Ye.contacts();return pe({type:"contacts",contacts:{...U,pending:U.pending??[]}}),U},[pe]),it=k.useCallback(async()=>{try{const[U,ue,fe]=await Promise.all([Ye.identity(),Ye.contacts(),Ye.buildInfo()]),Ae={...ue,pending:ue.pending??[]};return c.current.identity&&c.current.identity.cid!==U.cid&&(Qj(),S.current={},w({})),pe({type:"snapshot",identity:U,contacts:Ae}),_(fe),await Promise.all(Ae.contacts.flatMap(Pe=>[Oe(Pe.container_id,!1),Ge(Pe.container_id,!1)])),Xr(c.current)}catch(U){return xe(U),null}},[pe,Ge,Oe,xe]),Mt=k.useCallback(async U=>{await f.current.request(U,async()=>{EA(U,Be())&&(await Ye.markRead(U),await Promise.all([Oe(U),ut()]))}).catch(xe)},[Be,ut,Oe,xe]),Xt=k.useCallback(async U=>{const ue=++a.current;l.current?.abort();const fe=new AbortController;l.current=fe,s(null),me(U),Ge(U,!1);let Ae;try{Ae=await Ye.conversation(U,void 0,fe.signal)}catch(Ze){fe.signal.aborted||xe(Ze);return}if(fe.signal.aborted||ue!==a.current)return;pe({type:"page",contactCid:U,page:Ae});const Pe=Ae.unread;let de=[...Ae.messages],ze=Ae.nextBefore;const Gt=new Set,Qt=new Set(de.map(Ze=>Ze.wire_id).filter(Boolean)),ht=()=>de.filter(Ze=>Ze.dir==="in"&&!Ze.read);for(;ht().length<Pe&&ze&&!Gt.has(ze);){Gt.add(ze);let Ze;try{Ze=await Ye.conversation(U,ze,fe.signal)}catch{break}if(fe.signal.aborted||ue!==a.current)return;const Ln=Ze.messages.filter(mn=>!mn.wire_id||!Qt.has(mn.wire_id));if(!Ln.length&&Ze.nextBefore===ze)break;for(const mn of Ln)mn.wire_id&&Qt.add(mn.wire_id);de=[...Ln,...de],pe({type:"older_page",contactCid:U,page:Ze,newer:Ae.messages}),ze=Ze.nextBefore}const pt=ht()[0];pt?.wire_id&&ue===a.current&&!fe.signal.aborted&&s({contactCid:U,wireId:pt.wire_id,count:Pe}),await Mt(U)},[me,pe,Mt,Ge,xe]),Je=k.useCallback(async(U,ue,fe="page")=>{const Ae=`page:${U}:${fe}`,Pe=(m.current.get(Ae)??0)+1;m.current.set(Ae,Pe);for(const de of $x){if(de&&await Ux(de),m.current.get(Ae)!==Pe)return;const ze=await Oe(U,!1);if(ze&&ue(ze))return}},[Oe]),zt=k.useCallback(async(U,ue)=>{const fe=`file:${U}`,Ae=(m.current.get(fe)??0)+1;m.current.set(fe,Ae);for(const Pe of $x)if(Pe&&await Ux(Pe),m.current.get(fe)!==Ae||(await Ge(U,!1))?.some(ze=>ze.wire_id===ue))return},[Ge]),bn=k.useRef(!1);k.useEffect(()=>{if(!F||!t.loaded)return;const U=decodeURIComponent(window.location.hash.slice(Kx.length)),ue=Xr(c.current);if(!U||!ue){Q(!1);return}if(wr(c.current,ue)?.messages.some(fe=>fe.wire_id===U)){Q(!1);return}bn.current||(bn.current=!0,Je(ue,fe=>fe.messages.some(Ae=>Ae.wire_id===U),`anchor:${U}`).catch(()=>{}).finally(()=>Q(!1)))},[F,Je,t.loaded,t.pages]),k.useMemo(()=>(Gj({url:U=>Object.values(S.current).flat().find(fe=>fe.wire_id===U)?.available?Ye.mediaUrl(U):null,bytes:async U=>{if(!Object.values(S.current).flat().find(Ae=>Ae.wire_id===U)?.available)return null;const fe=await fetch(Ye.mediaUrl(U),{cache:"no-store",credentials:"same-origin"});if(!fe.ok)throw new Error(`Media request failed (HTTP ${fe.status})`);return new Uint8Array(await fe.arrayBuffer())},fetch:async U=>{const ue=Object.values(S.current).flat().find(fe=>fe.wire_id===U);if(!ue)throw new Error("Media record is unavailable");await Ye.fetchFiles([U]),await Ge(ue.contact_id)}}),null),[Ge]),k.useEffect(()=>{let U;IA(fe=>{ee(fe),mv(fe.registration).then(we).catch(()=>we(Ae=>({...Ae,status:"error"})))},{shouldDeferReload:()=>O.current||P.current!==null}).then(fe=>{U=fe}).catch(xe);const ue=fe=>{fe.preventDefault(),ae(fe)};return window.addEventListener("beforeinstallprompt",ue),()=>{U?.(),window.removeEventListener("beforeinstallprompt",ue)}},[xe]),k.useEffect(()=>BA(),[]),k.useEffect(()=>{if(!(!J.registration||ge.status!=="on"))return CA({registration:J.registration,identity:Ye.identity,onEvent:M0})},[ge.status,ge.bindingId,J.registration]),k.useEffect(()=>{const U=()=>we(ue=>({...ue,status:"error"}));return window.addEventListener("ours-push-repair-required",U),()=>window.removeEventListener("ours-push-repair-required",U)},[]),k.useEffect(()=>{window.location.pathname==="/"&&window.history.replaceState(null,"",Kr()),h.current=window.matchMedia("(min-width: 861px)");const U=()=>{const de=yf(window.location.pathname);l.current?.abort(),a.current+=1,s(null),pe({type:"route",route:de}),j.current&&de.name==="chats"&&de.contactCid&&(j.current=!1,requestAnimationFrame(()=>document.querySelector("[data-contact-trigger]")?.focus({preventScroll:!0}))),de.name==="chats"&&de.contactCid&&Xt(de.contactCid)},ue=()=>{if(document.visibilityState!=="visible")return;const de=Xr(c.current);de&&Mt(de),L0(),J.registration&&mv(J.registration).then(we).catch(()=>we(ze=>({...ze,status:"error"})))};window.addEventListener("popstate",U),document.addEventListener("visibilitychange",ue);const fe=de=>{const ze=de.type==="sync_required"?`${de.type}:${de.reason}`:de.type==="receipt_received"?`${de.type}:${de.contact_id}:${de.kind}:${de.wire_ids.join(",")}`:`${de.type}:${de.contact_id}:${de.wire_id}`,Gt=Date.now(),Qt=p.current.get(ze)??0;p.current.set(ze,Gt);for(const[ht,pt]of p.current)Gt-pt>6e4&&p.current.delete(ht);Gt-Qt<6e4||(async()=>{if(de.type==="sync_required"){await it();return}if(ut().catch(xe),de.type==="file_received"){await zt(de.contact_id,de.wire_id);const ht=c.current.contacts.contacts.find(pt=>pt.container_id===de.contact_id);Xr(c.current)!==de.contact_id&&ht&&Z(de.contact_id,ql(ht),"New file");return}if(de.type==="message_received"){const ht=c.current.contacts.contacts.find(pt=>pt.container_id===de.contact_id);await Je(de.contact_id,pt=>pt.messages.some(Ze=>Ze.wire_id===de.wire_id),`message:${de.wire_id}`),Xr(c.current)===de.contact_id?await Mt(de.contact_id):ht&&Z(de.contact_id,ql(ht),"New message");return}pe({type:"receipt",contactCid:de.contact_id,kind:de.kind,wireIds:de.wire_ids}),await Je(de.contact_id,ht=>de.wire_ids.every(pt=>{const Ze=ht.messages.find(Ln=>Ln.wire_id===pt);return!!Ze?.receipt&&Wx[Ze.receipt]>=Wx[de.kind]}),`receipt:${de.wire_ids.join(",")}`)})().catch(xe)},Ae=wA(fe),Pe=kA(fe,de=>pe({type:"connection",connection:de}));return it().then(de=>{de&&Xt(de)}),()=>{Pe(),Ae(),window.removeEventListener("popstate",U),document.removeEventListener("visibilitychange",ue)}},[Je,zt,pe,Mt,Xt,Z,ut,it,xe,J.registration]);const It=(U,ue,fe)=>{window.history.pushState({oursMessenger:!0},"",ue),pe({type:"route",route:U,mobileDetailOpen:fe})},Yt=async U=>{It({name:"chats",contactCid:U},Kr(U),!0),await Xt(U)},Tt=async U=>{const ue=wr(c.current,U);if(!(!ue?.nextBefore||R.current.has(U))){R.current.add(U),E(U);try{const fe=await Ye.conversation(U,ue.nextBefore);pe({type:"older_page",contactCid:U,page:fe,newer:ue.messages})}catch(fe){xe(fe)}finally{R.current.delete(U),E(null)}}},We=Xr(t),Cr=t.contacts.contacts.find(U=>U.container_id===We),ur=k.useMemo(()=>n4(t,v),[t,v]),X=ur.find(U=>U.id===We)??null,ie=We?xS(wr(t,We),v[We]??[]):[],je=t.identity;k.useEffect(()=>{if(!t.loaded)return;const U=yf(window.location.pathname),ue=U.name==="chats"||U.name==="contact"?U.contactCid:null;!ue||t.contacts.contacts.some(fe=>fe.container_id===ue)||(window.history.replaceState({oursMessenger:!0},"",Kr()),i?.contactCid===ue&&(l.current?.abort(),a.current+=1,s(null)))},[t.loaded,t.contacts.contacts,i]);const Ne=t.loaded?We&&!wr(t,We)||F?"updating":t.connection!=="live"?"connecting":null:"connecting",Fe=async(U,ue=ge.preview)=>{if(J.registration){le(!0),we(fe=>({...fe,status:"repairing",preview:ue}));try{we(await(U==="enable"?_0(J.registration,{preview:ue}):U==="repair"?zA(J.registration,ue):VA(J.registration,ge)))}catch(fe){we(Ae=>({...Ae,status:"error"})),xe(fe)}finally{le(!1)}}},ot=()=>{H([]),T("invite"),Ye.invites().then(H).catch(xe)};return t.route.name==="not_found"?y.jsxs("div",{className:"centered-screen",children:[y.jsx("h1",{children:"Page not found"}),y.jsx("button",{className:"btn primary",onClick:()=>It({name:"chats",contactCid:null},Kr()),children:"Open chats"})]}):je?y.jsx("div",{className:N?"theme-dark":"",style:{height:"100%"},children:y.jsxs("div",{className:"app signal-app",children:[y.jsxs("main",{className:"section signal-stage"+(t.mobileDetailOpen?" show-detail":""),children:[y.jsx(Az,{contacts:ur,roots:t4(t.contacts),selected:We,onSelect:U=>{U.startsWith("pending:")||Yt(U)},onInvite:ot,onSettings:()=>T("settings"),onApprovePending:async U=>{try{return await Ye.respondToIntroduction(U,"approve"),await it(),!0}catch(ue){return xe(ue),!1}},onRejectPending:async U=>{try{return await Ye.respondToIntroduction(U,"reject"),await it(),!0}catch(ue){return xe(ue),!1}}}),t.route.name==="contact"&&X?y.jsx(jz,{contact:X,messages:ie,onBack:()=>{j.current=!0,RA(window.history.state)==="back"?window.history.back():(window.history.replaceState({oursMessenger:!0},"",Kr(X.id)),pe({type:"route",route:{name:"chats",contactCid:X.id},mobileDetailOpen:!0}),requestAnimationFrame(()=>document.querySelector("[data-contact-trigger]")?.focus({preventScroll:!0})),j.current=!1)},onRename:U=>void Ye.renameContact(X.id,U).then(it).catch(xe),onRemove:()=>{confirm(`Remove “${Cr?.name??"contact"}”?`)&&Ye.removeContact(X.id).then(()=>(window.history.replaceState({oursMessenger:!0},"",Kr()),pe({type:"route",route:{name:"chats",contactCid:null},mobileDetailOpen:!1}),it())).catch(xe)},onOpenMessage:U=>{It({name:"chats",contactCid:X.id},Kr(X.id),!0);let ue=12;const fe=()=>{const Ae=document.getElementById(`chat-message-${encodeURIComponent(U)}`),Pe=Ae?.closest(".messages");if((!Ae||!Pe||Pe.clientHeight<=0)&&ue-- >0){requestAnimationFrame(fe);return}if(!Ae||!Pe)return;const de=Ae.getBoundingClientRect(),ze=Pe.getBoundingClientRect(),Gt=Pe.scrollTop+de.top-ze.top-Math.max(0,(Pe.clientHeight-de.height)/2),Qt=Math.max(0,Math.min(Gt,Pe.scrollHeight-Pe.clientHeight));Pe.scrollTo({top:Qt,behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})};requestAnimationFrame(fe)},indexOffset:wr(t,X.id)?.hasMore?Math.max(1,(wr(t,X.id)?.total??ie.length)-ie.length):0,onSendText:async(U,ue)=>{const fe=await Ye.send(X.id,U,ue);return await Oe(X.id,!1),fe.wire_id??void 0},onSendFile:async(U,ue)=>{await Ye.sendFile(X.id,new Blob([U.bytes],{type:U.mime}),U.filename,U.mime,ue),await Promise.all([Ge(X.id),Oe(X.id,!1)])}}):y.jsx(Mz,{contact:X,messages:ie,syncing:Ne,unreadOpen:i?.contactCid===We?i:null,hiddenEarlier:wr(t,We??"")?.hasMore?Math.max(1,(wr(t,We??"")?.total??ie.length)-ie.length):0,onLoadEarlier:We&&C!==We?()=>void Tt(We):void 0,onBack:()=>{l.current?.abort(),a.current+=1,s(null),It({name:"chats",contactCid:null},Kr(),!1)},onOpenContact:()=>{We&&It({name:"contact",contactCid:We},PA(We),!0)},onDraftChange:be,onSend:async(U,ue,fe)=>{if(!We)return;const Ae=We,Pe=await Ye.send(Ae,U,ue,fe);return pe({type:"sent_message",contactCid:Ae,message:{dir:"out",text:U,date:new Date().toISOString(),read:!0,wire_id:Pe.wire_id??"",receipt:null,reply_to:ue?{wire_id:ue}:null}}),Pe.wire_id?Je(Ae,de=>de.messages.some(ze=>ze.wire_id===Pe.wire_id),`send:${Pe.wire_id}`):ut().catch(xe),Pe.wire_id??void 0},onLoadCommands:async(U,ue)=>Ye.commands(U,ue),onSendCommand:async(U,ue,fe,Ae,Pe,de)=>{const ze=await Ye.sendCommand(U,ue,fe,Ae,Pe,de);return Oe(U,!1),ze},onSendFile:async(U,ue)=>{We&&(await Ye.sendFile(We,new Blob([U.bytes],{type:U.mime}),U.filename,U.mime,ue),await Promise.all([Ge(We),Oe(We,!1)]))},onFetchFile:async U=>{await Ye.fetchFiles([U]),We&&await Ge(We)}},We??"no-conversation")]}),y.jsxs("div",{className:"app-banners",children:[J.offline&&y.jsx("div",{className:"banner warn",role:"status","aria-live":"polite",children:"Offline — reconnecting to the network…"}),t.connection!=="live"&&y.jsx("div",{className:"banner warn",role:"status","aria-live":"polite",children:t.connection==="retrying"?"Live updates interrupted — reconnecting…":"Connecting to live updates…"}),J.updateAvailable&&y.jsxs("div",{className:"banner info",children:[y.jsx("span",{role:"status","aria-live":"polite",children:"A new version is available."}),y.jsx("span",{className:"banner-actions",children:y.jsx("button",{className:"linkbtn",onClick:()=>{J.registration&&hv(J.registration)},children:"Restart now"})})]}),y.jsx(Vz,{items:M,onDismiss:ye,onOpen:U=>void Yt(U)})]}),A==="invite"&&y.jsx(Uz,{identity:je,invites:D,onRefresh:async()=>H(await Ye.invites()),onCreate:async(U,ue)=>(await Ye.createInvite(U,ue)).blob,onAccept:async(U,ue)=>{await Ye.addContact(U,ue),await it()},onRevoke:async U=>{await Ye.revokeInvite(U)},onClose:()=>{T(null),it()}}),A==="settings"&&y.jsx(Wz,{identity:je,push:ge,workerSupported:J.supported,busy:G,offline:J.offline,updateAvailable:J.updateAvailable,build:B,dark:N,onToggleDark:()=>q(U=>(localStorage.setItem(Hx,U?"0":"1"),!U)),onSaveBio:async U=>{await Ye.setBio(U),await it()},onPushAction:Fe,onInstall:V?()=>void V.prompt().then(()=>ae(null)):void 0,onReloadUpdate:()=>{J.registration&&hv(J.registration)},onClose:()=>{P.current=null,T(null),We&&Mt(We)}}),t.error&&y.jsxs("div",{className:"banner error",role:"alert","aria-live":"assertive",children:[t.error,y.jsx("button",{className:"linkbtn",onClick:()=>pe({type:"error",message:null}),children:"dismiss"})]})]})}):y.jsx("div",{className:N?"theme-dark":"",style:{height:"100%"},children:y.jsx("div",{className:"centered-screen",children:y.jsx("p",{className:"muted",children:"Loading…"})})})}Zz();const wS=document.getElementById("root");if(!wS)throw new Error("missing #root");vC.createRoot(wS).render(y.jsx(mR,{reducedMotion:"user",children:y.jsx(r4,{})}));export{Wh as _,Jd as g};
326
+ //# sourceMappingURL=index-BWJKsro0.js.map