window._hydroLoad=()=>{
const style = document.createElement('style');
style.textContent = "button:hover{transform:none!important}nav#menu.nav ol.nav__list--secondary{display:flex;flex-wrap:wrap;align-items:center}nav#menu.nav .nav__item.nav__item--vip{display:inline-flex;align-items:center;justify-content:center;gap:5px;padding:6px 14px;margin:0 4px;font-weight:600;font-size:13px;letter-spacing:.02em;line-height:1.2;color:#f9a012;border-radius:9999px;border:none;box-shadow:none;transition:background .18s ease,color .18s ease}nav#menu.nav .nav__item.nav__item--vip:hover{color:#f9a012;background:#fed7aa}nav#menu.nav .nav__item.nav__item--vip:active{background:#fcd34d}nav#menu.nav .nav__item.nav__item--vip:focus-visible{outline:2px solid #f9a012;outline-offset:2px}nav#menu.nav .nav__item.nav__item--vip .nav__vip-crown{flex-shrink:0;display:block;opacity:.95;transition:transform .18s ease,opacity .18s ease}nav#menu.nav .nav__item.nav__item--vip:hover .nav__vip-crown{opacity:1;transform:scale(1.05)}.theme--dark nav#menu.nav .nav__item.nav__item--vip{color:#fde68a;border:none;box-shadow:none}.theme--dark nav#menu.nav .nav__item.nav__item--vip:hover{color:#fef08a;background:#fb923c57}.theme--dark nav#menu.nav .nav__item.nav__item--vip:active{background:#fb923c6b}.theme--dark nav#menu.nav .nav__item.nav__item--vip:focus-visible{outline-color:#fde68a}.divider{height:1px;background-color:#ccc;margin:10px 0;border:none}.menu__link{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vjs-svg-icon{display:inline-block;background-repeat:no-repeat;background-position:center;fill:currentColor;height:1.8em;width:1.8em}.vjs-svg-icon:before{content:none!important}.vjs-svg-icon:hover,.vjs-control:focus .vjs-svg-icon{filter:drop-shadow(0 0 .25em #fff)}.vjs-modal-dialog .vjs-modal-dialog-content,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABUgAAsAAAAAItAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV33Y21hcAAAAYQAAAEJAAAD5p42+VxnbHlmAAACkAAADwwAABdk9R/WHmhlYWQAABGcAAAAKwAAADYn8kSnaGhlYQAAEcgAAAAdAAAAJA+RCL1obXR4AAAR6AAAABMAAAC8Q44AAGxvY2EAABH8AAAAYAAAAGB7SIHGbWF4cAAAElwAAAAfAAAAIAFAAI9uYW1lAAASfAAAASUAAAIK1cf1oHBvc3QAABOkAAABfAAAAnXdFqh1eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGR7xDiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGPHcRdyA4RZgQRADbZCycAAHic7dPXbcMwAEXRK1vuvffem749XAbKV3bjBA6fXsaIgMMLEWoQJaAEFKNnlELyQ4K27zib5PNF6vl8yld+TKr5kH0+cUw0xv00Hwvx2DResUyFKrV4XoMmLdp06NKjz4AhI8ZMmDJjzoIlK9Zs2LJjz4EjJ85cuHLjziPe/0UWL17mf2tqKLz/9jK9f8tXpGCoRdPKhtS0RqFkWvVQNtSKoVYNtWaoddPXEBqG2jQ9XWgZattQO4baNdSeofYNdWCoQ0MdGerYUCeGOjXUmaHODXVhqEtDXRnq2lA3hro11J2h7g31YKhHQz0Z6tlQL4Z6NdSbod4N9WGoT9MfHF6GmhnZLxyDcRMAAAB4nJ1YC1gUV5auc6urCmxEGrq6VRD6ATQP5dHPKK8GRIyoKApoEBUDAiGzGmdUfKNRM4qLZrUZdGKcGN/GZJKd0SyOWTbfbmZ2NxqzM5IxRtNZd78vwYlJdtREoO7sudVNq6PmmxmKqrqPU+eee173P80Bh39Cu9DOEY4DHZBK3i20D/QRLcfxbE5sEVtwLpZzclw4ibFIkSCJUcZ4MBpMnnzwuKNsGWBL5i3qy6kO2dVpvUpKbkAP9fq62rdeGJ+TM/7C1nbIutfuWrWk5ci4zMxxR1qW/N+9JsmCGXj9VKWhFx/6tr/nz78INDm2C9yPF/fDcxLuyKxLBZ1ZBz2QTi+RSkiH5RrDQJ/GgGQadX9m0YSURs7GpSG905Zsk41uj14yul1OtieZ7QUk5GRG/YiS7PYYPSAZNRed9sq3+bOpz00rKb7pe/ZEZvbALxZAHT3AFoH8GXP3rt67QFn40kt8W13FjLTDb48c+fSi5/7h0P4dL5yz7DPtbmgmYxfQA9RL2+EOfTcvdp+1vmuBpvOll1As1S6ak0IvJzC7sKWJFtJgBd2uWcg+0Zyg7dzQfhcjXRgXGZRf5/a4A58IDU777Nl252AUk4m2ByRRjqTNqIDCEJeAnU3iCFwrkrNwXEzg4yFevBwypzxkcX+AIfk3VEKl3XmWbT8788SzvpvFJaiOezL6QyuSr9VNf97csNu0z3LuhR0wATUxZAfVBwVOy+nQFhxYdWaXlXe4HC4zWGWzzsrLDtmhI9pOWOHv7PTT7XybH1Z0+v2d5Abd3kmG+TsH23CS/KwTxx/JkzEwx6jcQOUc42LLwHJ/J93uZ9ygh3HuZGwqsY9dWDHQ58dxNqyqKRQTYdxwTubiOSs3FiMDkq0WSZQgCT0GBDOg2lxOAd1FlPVGs4AKBAcYHHaP2wPkHaivmLF5zYqnIZrvcHx5gN4k/6tchNW1DtdgNL2KrxEkS/kfnIHoVnp1VjmjpTf5r0lTzLj0mdS28tX+XGorU364eMPmnWVl8J36nlKGw3CZhjEiuMw8h8mKvhGD+4/lElBWjAhLJMg6fTw4zPZ8cOmcGQBm2Qxml1nAm13CpYGq1JKUlJJUzQn1PTAO0mgv6VMMpA/DuRfSWEu4lDIxdbAtdWIKvnn2Vk766CWfz9fpY0sH/UpdP50rfszaVpdVRmvIejEdLMk45s4Bu0EWHjeOySmFyZSiMahvZdNSn29peoI/YexYfKQTLeurTXXwEVLeSfInTWHkkMaeUx7sBvOCSTSj3AlcKjfueyS36tCrXDlgRtF0etFq9jhc1kfKuBT/OwMr0F4UUTTh1AN0g20+H/ScPcsIEsYu9d/zN5PmjprPtNwI1ZZcDK6iC97Mcjp2y2aX36f+QbpGHrgRuHlXJ+Zf6PFRL2uQSp8vxHeF2IoRb8Rd2rhMzsNxSRmEuKK4JFnkojhMcx6jzqHzGMGFcW+MhBj0bhf6cowN+45I4LHvwT6fteu7M42wGRI/pxcg6/MZdEvt1U1XaulHFXuLmqov/MukvRVL35/b3ODM1+4aPjtzeK7zmUkV2h3DN54HaQ9GzJvxHRb6Ks2gB81fwqraT+A7GvZJrRLRofU6G0urNL+zFw3v0FaVDFxsKEZW56F31r6ip6vOL+FCObBPuIMRiXld9RaMdLzRIOGhPey2T9vA/35DmZPK9IWaT9d/WgOGMieYqJ/dzjLIhZU118gbysxrNUGefxD6UO/hyNNllpFTOIbx32kSFQctnweV5PxTMHLjRqiAN+fQE9gL+Xy5WB6MOS4GJJuYbDUHhcKDhHGRbLzOpjsjdM1+iwAZLGeieehACX2hhI7SjK/ZUTNrvVje31TxJiFBGYViWFkCn9PMeX9fS6qVbzfCj4fOCTzDnuWy2c4xA7mdNkA3RS9FH2VeqzdCBlixxbzXjvkHU1I8BOYFb1pZvPIHSSIj4svT8xpzcxtXN+ZKyjdDvbz08niiF3PqV9Tn5NST8vg48MTaY8E5xqSSIsWoWHo+LtAzxdH/GDUyp37CBEYfso04F/NlMTcDJUTpECLY0HFGQHImE8xsEUdgnrQlixIvGhJA1BvxpDHGxEMBYFeNOHcBJlSjwe2JcSfbBEsGOPPBHg/6SBBOCsLLw0SpUxod0Z1bFMfLkbQ3UiZxEyd0Dx8t+SRBu18Q9msFbI4e3p1THEfkSEh7kEJ5orR10qTWDvbgPWn5aWvCYyOAjwgXyjJi34uMjo58L25cmRAeQZWI2PA1QQLsPESAH8WGFwZZ4SPoR73BHPzIPMJj9AreBzKUmrH4todT18ANvi1oc3YGjUT/0j+ExUwq8PI9BLaCQIpvewwYu2evAG/Vo/5avPdY7o+BemLLXw3y+AdkzP9bpIxB1wm5EYq8fesHbPEPtm6HrHvtx4jcGPR8fDDpkZBefIjB46QnlUNRltv4Z/pO/J6dxEjhYAtmoMeq+GozvUVvNYOW3m6GCIhoprcfr97B8AcIQYsfD8ljUvGNjvkrpj0ETA48ZMIxCeqsRIsQALE0gi2GB+glSOfbOjW3GSBM9yPq8/rpJXrJDz0BPxV6xdN4uiCGDQed3WhgFkBUZEFsmeyyBpzXrm7UGTBZG8Lh5aubFufk5eUsbrrFGr7McYdbltxa0nKYqRKbQjvikXYkTGM0f2xuyM3Ly21oXnWfvf6I1BmZwfh7EWWIYsg2nHhsDhOnczhJcmI6eBAmy3jZ3RiJmKQR/JA99FcwsfaVbNDDyi1rL9NPj9hfo61wjM6BjzOLijLpeTgk/pL+ip6tfYWupzeOgPny2tcUu9J/9mhxJlgyi985NFRbvCVewXUNXLJaW0RxZqtRYtnfYdcYomXQWdnJHQA3jiEEkeTQWcWxdDP9IvvVWvo2TK553XEMEq+s69/QDU1Q7p0zxwsm9qS379whr8NI2PJqLUyGyfNeX3eFfnJU2U+uHR9cVV1IqgurqwuV44XVp0h2qN55X5XJwtk59yP0IZuHrqBOBIuIYhkcoT6Kx79Pu2HS/IPZIMOqLWs/pteOOk4NPgEb6QAIdAPsyZk5Mwd+wVaHMexJv719W7xCu2l37UG6lvYdBcvHa08p89741zd63phTRGqL5ggo6SlvdbWXzCqsPq78NnSu7wnKy2HNZbVoRCI7UJEOyRj+sPE002tOOY7Qa5fXboFWkLNeqYUSZRocp9XwSUZxcQZ9Hw6LV2pOoVmvHQEDbGIENEG5i6bLgMSM4n8+FNLTtAds99DaWEvgcf4o5SyYe9x+kF6/tGoTPAdRmS/XQIEy//QxKC2oqioAI3tS5auvxCtzT6y6RK8fhChYcwCJaMJhxc0vqSxQ/qmgsrKAlBZUHlauheTpvd9uj5DnLzJct6qfq5fXbYHVIGcfrIVJihbaVLu1wW7Vbs8zK0A8e9Jvb91S9cVMjPrazD6gpfeZTXzYbCFMcppVRsGMpp55OWgx1/3JeAxW1Y7AORgM/m3rWrsdLkQVmEVSU16cX/e7uvkvpqRiQsG06XJ0t64Tf+l0nG1dt025gyOIZlvq5u9KSU1N2TW/rsWnnMRPyTDkctbhvIcNvYIXWyLzdwYLoYesUbaQG4iK2cWO2gdpeUYLqDD0MUTOPhDIGnZEs58yArR86FznuWEsU4YDi2x26dA4klkn8Qa6vhk2QUfX4Jxm/ngX9r7ogn1dmlmwqZmuhxtdg9XN/DEcUgqb+9hMyNansfaQET2mcROCmGEMVqxm5u+h6kN2MOwgqykV2wH9yQG9DvVFU38Pogaf4FVuE62KI/oJ02RDdWW2w5dqQwU/8+N1q1DlvsL863u61KLE7x/o8w0VJQM/Y/SQ3unIrqxueEa1BqT5VFNsO7p39/UC771a77RowpaKe9nvJQIT1Pog5LGx8XblBKmCNGTf3xMogAQvPnz9PYKX/08sVDTG1OKUlOLUgS/UaZtm1NAaYTsl7i9ZQ+L6O4Rl0OGa577LuWvc+C+x96/vYh0lLBuM+7XwI/dTLtdT7v4d6rRTWDnku0IBrqFnZ5bVIqKP8lasJlithWnaLhTsr8qFJBulF/70p4undou36HeTJ5+jv1fCybeQ8nH3+Xv6aENczmOFlab+hqMDg1rLOt12A+tiUFrYDwQ6c3RUJp601nzegTNX6WlYAI2zSUV945F6zU56ZmZVQaWspWcIADxJ9GmljQUnL2p2Dpr5T8H+5KJFu+vqBq8qvyHRzStLHPEO5SPYCV9nZe0yZT2RcH0oHvegSzNEJ0oGWU8iQWM12dgPEugngVceGIwZgPFp0BiT1a0a3R5Rcot7ihfA1J/20v96jX7zmTX9s583H0kwx6WnLd09cXrR9LGroOa9sHNbdyz8wcKk5lqhaVFJZNwmqtw884MXNdvJujpBa3xzuSaZH9sxa06Z7x+HJSduPbdYHv/DgmEhfbehvlmGN7JUkcG78GDM12CeyFFTPNqVeNxC1gzjz+c2nVo63Xxs8rKJWXoBJM0tmEbfGm4qzpoOH3xpzQfyxLzW1gnE9NHo6tol1eMEic4ZVPrjnVi0kqAe2sQ2bgqupScaq8WGlUWgWHI51SKJl/UYT6zccNsCSkBtiVZLsiefuFSDYT3Fi8Zk7EUnmjTRYtsFeuDDJS05MW79M3mr3mla+d8dzac31KTPmBYfFiYSUef48PhPjm9ryZsSGZZkdNvzq0Y9rdNcwDq5Dg5C3QW+7UN64IKptvS3tvHbvu5c9pv1Exau21rc9LIpwpQwUjTq8576yeVDz5+4WZ1nXT43wV60rPLJbDp/UksNrP3iQ2SA63Pst058gOYDbhRnRUw8l/sRt4HbxPzO4WYpInCpuVgSbVh6JXuwnnJngKTTCwaPWmG5Xbhpm1U0Yt3FyBGpGYemPM77p2TD904JjgJ2QFpFLeYpGx8X15Qx1Zk31p5ki9ZLUuXE0lmuJlcakJMVLeFS1iIvrB8drY0aloilakqCZwzwRORtxlgwxS4IThggJd4TDxoiaAIT80fFPGrCPPru+puFn504P/ybr4ihA/6dKASLshEJic7xE8tmzu3KzA7TABBe8y5fNbWo3ilQn/SuFKM16b2l5bOeayqfGhYmhIulU+fVNDdWVv4NMzX10MBHyPR5uhWUu8D9P1VnIMt4nGNgZGBgAOJ/1bf64vltvjJwszOAwAOlmqvINEc/WJyDgQlEAQA+dgnjAHicY2BkYGBnAAGOPgaG//85+hkYGVCBPgBGJwNkAAAAeJxjYGBgYB/EmKMPtxwAhg4B0gAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAe4CLgKKAtAC/ANiA4wDqAPgBDAEsATaBQgFWgXABggGLgZwBqwG9gdOB4oH0ggqCHAIhgicCMgJJAlWCYgJrAnyCkAKdgrkC7J4nGNgZGBg0GdoZmBnAAEmIOYCQgaG/2A+AwAaqwHQAHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkXlT2zAQxf1C4thJAwRajt4HRy8VMwwfSJHXsQZZcnUQ+PYoTtwpM+wf2t9brWZ2n5JBsol58nJcYYAdDDFCijEy5JhgileYYRd72MccBzjEa7zBEY5xglO8xTu8xwd8xCd8xhd8xTec4RwXuMR3/MBP/MJvMPzBFYpk2Cr+OF0fTEgrFI1aHhxN740KDbEmeJpsWZlVj40s+45aLuv9KijlhCXSjLQnu/d/4UH6sWul1mRzFxZeekUuE7z10mg3qMtM1FGQddPSrLQyvJR6OaukItYXDp6pCJrmz0umqkau5pZ2hFmm7m+ImG5W2t0kZoJXUtPhVnYTbbdOBdeCVGqpJe7XKTqSbRK7zbdwXfR0U+SVsStuS3Y76em6+Ic3xYiHUppc04Nn0lMzay3dSxNcp8auDlWlaCi48yetFD7Y9USsx87G45cuop1ZxQUtjLnL4j53FO0a+5X08UXqQ7NQNo92R0XOz7sxWEnxN2TneJI8Acttu4Q=) format(\"woff\");font-weight:400;font-style:normal}.vjs-icon-play,.video-js .vjs-play-control .vjs-icon-placeholder,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{content:\"\\f101\"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-play-circle:before{content:\"\\f102\"}.vjs-icon-pause,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pause:before,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before{content:\"\\f103\"}.vjs-icon-volume-mute,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mute:before,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before{content:\"\\f104\"}.vjs-icon-volume-low,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-low:before,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before{content:\"\\f105\"}.vjs-icon-volume-mid,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-mid:before,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before{content:\"\\f106\"}.vjs-icon-volume-high,.video-js .vjs-mute-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-volume-high:before,.video-js .vjs-mute-control .vjs-icon-placeholder:before{content:\"\\f107\"}.vjs-icon-fullscreen-enter,.video-js .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-enter:before,.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before{content:\"\\f108\"}.vjs-icon-fullscreen-exit,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-fullscreen-exit:before,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before{content:\"\\f109\"}.vjs-icon-spinner{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-spinner:before{content:\"\\f10a\"}.vjs-icon-subtitles,.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-subtitles:before,.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before{content:\"\\f10b\"}.vjs-icon-captions,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-captions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-captions:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-captions-button .vjs-icon-placeholder:before{content:\"\\f10c\"}.vjs-icon-hd{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-hd:before{content:\"\\f10d\"}.vjs-icon-chapters,.video-js .vjs-chapters-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-chapters:before,.video-js .vjs-chapters-button .vjs-icon-placeholder:before{content:\"\\f10e\"}.vjs-icon-downloading{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-downloading:before{content:\"\\f10f\"}.vjs-icon-file-download{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download:before{content:\"\\f110\"}.vjs-icon-file-download-done{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-done:before{content:\"\\f111\"}.vjs-icon-file-download-off{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-file-download-off:before{content:\"\\f112\"}.vjs-icon-share{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-share:before{content:\"\\f113\"}.vjs-icon-cog{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cog:before{content:\"\\f114\"}.vjs-icon-square{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-square:before{content:\"\\f115\"}.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder,.video-js .vjs-volume-level,.video-js .vjs-play-progress{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before,.video-js .vjs-volume-level:before,.video-js .vjs-play-progress:before{content:\"\\f116\"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-outline:before{content:\"\\f117\"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-circle-inner-circle:before{content:\"\\f118\"}.vjs-icon-cancel,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cancel:before,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before{content:\"\\f119\"}.vjs-icon-repeat{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-repeat:before{content:\"\\f11a\"}.vjs-icon-replay,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay:before,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before{content:\"\\f11b\"}.vjs-icon-replay-5,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-5:before,.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before{content:\"\\f11c\"}.vjs-icon-replay-10,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-10:before,.video-js .vjs-skip-backward-10 .vjs-icon-placeholder:before{content:\"\\f11d\"}.vjs-icon-replay-30,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-replay-30:before,.video-js .vjs-skip-backward-30 .vjs-icon-placeholder:before{content:\"\\f11e\"}.vjs-icon-forward-5,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-5:before,.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before{content:\"\\f11f\"}.vjs-icon-forward-10,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-10:before,.video-js .vjs-skip-forward-10 .vjs-icon-placeholder:before{content:\"\\f120\"}.vjs-icon-forward-30,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-forward-30:before,.video-js .vjs-skip-forward-30 .vjs-icon-placeholder:before{content:\"\\f121\"}.vjs-icon-audio,.video-js .vjs-audio-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio:before,.video-js .vjs-audio-button .vjs-icon-placeholder:before{content:\"\\f122\"}.vjs-icon-next-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-next-item:before{content:\"\\f123\"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-previous-item:before{content:\"\\f124\"}.vjs-icon-shuffle{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-shuffle:before{content:\"\\f125\"}.vjs-icon-cast{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-cast:before{content:\"\\f126\"}.vjs-icon-picture-in-picture-enter,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-enter:before,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:\"\\f127\"}.vjs-icon-picture-in-picture-exit,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-picture-in-picture-exit:before,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:\"\\f128\"}.vjs-icon-facebook{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-facebook:before{content:\"\\f129\"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-linkedin:before{content:\"\\f12a\"}.vjs-icon-twitter{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-twitter:before{content:\"\\f12b\"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-tumblr:before{content:\"\\f12c\"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-pinterest:before{content:\"\\f12d\"}.vjs-icon-audio-description,.video-js .vjs-descriptions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:400;font-style:normal}.vjs-icon-audio-description:before,.video-js .vjs-descriptions-button .vjs-icon-placeholder:before{content:\"\\f12e\"}.video-js{display:inline-block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:400;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex=\"-1\"]{outline:none}.video-js *,.video-js *:before,.video-js *:after{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-fluid,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-1-1{width:100%;max-width:100%}.video-js.vjs-fluid:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-1-1:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window,body.vjs-pip-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen,body.vjs-pip-window .video-js{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs),body.vjs-pip-window .video-js{width:100%!important;height:100%!important;padding-top:0!important;display:block}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-pip-container .vjs-pip-text{position:absolute;bottom:10%;font-size:2em;background-color:#000000b3;padding:.5em;text-align:center;width:100%}.vjs-layout-tiny.vjs-pip-container .vjs-pip-text,.vjs-layout-x-small.vjs-pip-container .vjs-pip-text,.vjs-layout-small.vjs-pip-container .vjs-pip-text{bottom:0;font-size:1.4em}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:50%;left:50%;padding:0;margin-top:-.81666em;margin-left:-1.5em;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:#2b333fb3;border-radius:.3em;transition:all .4s}.vjs-big-play-button .vjs-svg-icon{width:1em;height:1em;position:absolute;top:50%;left:50%;line-height:1;transform:translate(-50%,-50%)}.video-js:hover .vjs-big-play-button,.video-js .vjs-big-play-button:focus{border-color:#fff;background-color:#73859f;background-color:#73859f80;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button,.vjs-error .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause:not(.vjs-seeking,.vjs-scrubbing,.vjs-error) .vjs-big-play-button{display:block}.video-js button{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:#000c;background:linear-gradient(180deg,#000c,#fff0);overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{display:flex;justify-content:center;list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover,.js-focus-visible .vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:#73859f80}.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover,.js-focus-visible .vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.vjs-menu li.vjs-selected .vjs-svg-icon,.vjs-menu li.vjs-selected:focus .vjs-svg-icon,.vjs-menu li.vjs-selected:hover .vjs-svg-icon,.js-focus-visible .vjs-menu li.vjs-selected:hover .vjs-svg-icon{fill:#000}.video-js .vjs-menu *:not(.vjs-selected):focus:not(:focus-visible),.js-focus-visible .vjs-menu *:not(.vjs-selected):focus:not(.focus-visible){background:none}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0em;margin-bottom:1.5em;border-top-color:#2b333fb3}.vjs-pip-window .vjs-menu-button-popup .vjs-menu{left:unset;right:1em}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:#2b333fb3;position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu,.vjs-menu-button-popup .vjs-menu.vjs-lock-showing{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline:hover,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline.vjs-slider-active{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline:hover .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline.vjs-slider-active .vjs-menu{display:block;opacity:1}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:#2b333fb3}.video-js:not(.vjs-controls-disabled,.vjs-using-native-controls,.vjs-error) .vjs-control-bar.vjs-lock-showing{display:flex!important}.vjs-has-started .vjs-control-bar,.vjs-audio-only-mode .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar,.vjs-error .vjs-control-bar{display:none!important}.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.vjs-button>.vjs-svg-icon{display:inline-block}.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before,.video-js .vjs-control:focus{text-shadow:0em 0em 1em white}.video-js *:not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-play-progress,.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;line-height:.35em;z-index:1}.vjs-svg-icons-enabled .vjs-play-progress:before{content:none!important}.vjs-play-progress .vjs-svg-icon{position:absolute;top:-.35em;right:-.4em;width:.9em;height:.9em;pointer-events:none;line-height:.15em;z-index:1}.video-js .vjs-load-progress{background:#73859f80}.video-js .vjs-load-progress div{background:#73859fbf}.video-js .vjs-time-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:#000c}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#73859f;background-color:#73859f80}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0em 0em 1em white;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-svg-icons-enabled .vjs-volume-level:before{content:none}.vjs-volume-level .vjs-svg-icon{position:absolute;width:.9em;height:.9em;pointer-events:none;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{line-height:.35em;right:-.5em}.vjs-slider-horizontal .vjs-volume-level .vjs-svg-icon{right:-.3em;transform:translateY(-50%)}.vjs-slider-vertical .vjs-volume-level .vjs-svg-icon{top:-.55em;transform:translate(-50%)}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:#2b333fb3}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:#000c}.vjs-poster{display:inline-block;vertical-align:middle;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster,.vjs-pip-container.vjs-has-started .vjs-poster{display:block}.vjs-poster img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.video-js:not(.vjs-live) .vjs-live-control,.video-js.vjs-liveui .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-svg-icons-enabled .vjs-seek-to-live-control{line-height:0}.vjs-seek-to-live-control .vjs-svg-icon{width:1em;height:1em;pointer-events:none;fill:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-svg-icon{fill:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.vjs-live .vjs-time-control,.vjs-live .vjs-time-divider,.video-js .vjs-current-time,.video-js .vjs-duration{display:none}.vjs-time-divider{display:none;line-height:3em}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.vjs-error .vjs-text-track-display{display:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control,.vjs-pip-window .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control,.vjs-pip-window .vjs-fullscreen-control{display:none}.vjs-playback-rate>.vjs-menu-button,.vjs-playback-rate .vjs-playback-rate-value{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:\"X\";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);opacity:.85;text-align:left;border:.6em solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:5em;height:5em;border-radius:50%;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:flex;justify-content:center;align-items:center;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-error .vjs-loading-spinner{display:none}.vjs-loading-spinner:before,.vjs-loading-spinner:after{content:\"\";position:absolute;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:before,.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after{animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-svg-icon{width:1.5em;height:1.5em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:\"\\f10c\";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-description-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before,.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:\" \\f12e\";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover{width:auto;width:initial}.video-js.vjs-layout-x-small .vjs-progress-control,.video-js.vjs-layout-tiny .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:#2b333fbf;color:#fff;height:70%}.vjs-error .vjs-text-track-settings{display:none}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-font,.vjs-text-track-settings .vjs-track-settings-controls{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display: grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-text-track-settings select{font-size:inherit}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:10px;border:none}.vjs-text-track-settings fieldset span{display:inline-block;padding:0 .6em .8em}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;font-weight:700;font-size:1.2em}.vjs-text-track-settings .vjs-label{margin:0 .5em .5em 0}.vjs-track-settings-controls button:focus,.vjs-track-settings-controls button:active{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f)}.vjs-track-settings-controls button:hover{color:#2b333fbf}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}.vjs-title-bar{background:#000000e6;background:linear-gradient(180deg,#000000e6,#000000b3 60%,#0000);font-size:1.2em;line-height:1.5;transition:opacity .1s;padding:.666em 1.333em 4em;pointer-events:none;position:absolute;top:0;width:100%}.vjs-error .vjs-title-bar{display:none}.vjs-title-bar-title,.vjs-title-bar-description{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vjs-title-bar-title{font-weight:700;margin-bottom:.333em}.vjs-playing.vjs-user-inactive .vjs-title-bar{opacity:0;transition:opacity 1s}.video-js .vjs-skip-forward-5,.video-js .vjs-skip-forward-10,.video-js .vjs-skip-forward-30,.video-js .vjs-skip-backward-5,.video-js .vjs-skip-backward-10,.video-js .vjs-skip-backward-30{cursor:pointer}@media print{.video-js>*:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js *:focus:not(.focus-visible){outline:none}.video-js *:focus:not(:focus-visible){outline:none}#scrollTopBtn{position:fixed;bottom:30px;right:70px;z-index:1000;width:56px;height:56px;border-radius:50%;background-color:#fff;border:none;box-shadow:0 4px 12px #00000026;cursor:pointer;padding:0;opacity:0;visibility:hidden;transform:translateY(20px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease;display:flex;justify-content:center;align-items:center}.theme--dark #scrollTopBtn{background-color:#2c2c2c;box-shadow:0 4px 12px #0006}#scrollTopBtn.visible{opacity:1!important;visibility:visible!important;transform:translateY(0)}#scrollTopBtn:hover{box-shadow:0 6px 16px #0003}.arrow-up{position:relative;width:16px;height:24px;border-top:3px solid #007bff;border-radius:1px}.arrow-up:before{content:\"\";position:absolute;bottom:0;left:50%;transform:translate(-50%);width:3px;height:19px;background-color:#007bff;border-radius:2px}.arrow-up:after{content:\"\";position:absolute;bottom:7px;left:50%;width:10px;height:10px;border-top:3px solid #007bff;border-right:3px solid #007bff;transform-origin:center center;transform:translate(-50%) rotate(-45deg)}.progress-ring{position:absolute;top:0;left:0}.progress-ring__circle,.progress-ring__track{transition:stroke-dashoffset .1s;transform:rotate(-90deg);transform-origin:50% 50%}.progress-ring__track{stroke:#e6e6e6}.theme--dark .progress-ring__track{stroke:#433f3f}.progress-ring__circle{stroke:#007bff;stroke-linecap:round}#theme-toggle .theme-icon-sun svg,#theme-toggle .theme-icon-moon svg{transform:translateY(5px)}.theme-icon-sun,.theme-icon-moon{display:none}html.theme--light .theme-icon-sun,body.theme--light .theme-icon-sun,html.theme--dark .theme-icon-moon,body.theme--dark .theme-icon-moon{display:inline-flex}.btn{transform:none!important}:root{--primary:#ffb84d;--primary-strong:#ff9f0a;--green:#22c55e;--red:#f43f5e;--gray-900:#1f2937;--gray-700:#374151;--gray-600:#4b5563;--gray-500:#6b7280;--border:#e5e7eb;--bg:#f6f7fb;--card:#ffffff}.page{max-width:1100px;margin:22px auto;padding:0 12px}.head{display:flex;align-items:center;justify-content:center;text-align:left;gap:14px;margin-bottom:28px}.head .logo{width:36px;height:36px;border-radius:12px;background:linear-gradient(180deg,#4f67ff 0,#2f3c8f);display:grid;place-items:center;position:relative}.head .logo:after{content:\"\";width:22px;height:22px;background:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23fde047'/%3E%3Cstop offset='100%25' stop-color='%23d97706'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath stroke='url(%23g)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7Zm3 16h14'/%3E%3C/svg%3E\") center/contain no-repeat;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.head-title{font-size:30px;font-weight:600;color:#ffa116}.head-sub{font-size:15px;color:#b18a00;margin-top:12px}.grid{display:grid;grid-template-columns:2fr 1fr;gap:16px}@media (max-width: 980px){.grid{grid-template-columns:1fr}}.card{background:var(--card);border:1px solid var(--border);border-radius:14px;box-shadow:0 6px 18px #1937630f}.card-hd{padding:14px 16px;border-bottom:1px solid var(--border);font-weight:700}.card-bd{padding:14px 16px}.plans{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-bottom:14px}@media (max-width: 960px){.plans{grid-template-columns:1fr 1fr}}.plan{position:relative;border:2px solid #f2f4f8;border-radius:16px;background:var(--card);padding:14px 16px;cursor:pointer;transition:.15s}.plan:hover{border-color:#d9e0ea;transform:translateY(-1px)}.plan.active{border-color:#ffb84d;box-shadow:0 0 0 4px #ffb84d26}.plan .top{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.plan .tag{font-weight:600;font-size:12px;color:#667085;background:#f3f6fb;border:1px solid #e5ebf5;border-radius:999px;padding:3px 8px}.plan .badge{position:absolute;top:-10px;right:12px;background:#3b82f6;color:#fff;border-radius:999px;padding:4px 8px;font-size:12px}.price{font-size:26px;font-weight:600;color:#ff593d}.sub{font-size:12px;color:#8b93a3;margin-top:6px}.aside{margin-bottom:8px}.aside .order-line{display:flex;justify-content:space-between;font-size:13px;color:#6b7280;padding:8px 0;border-bottom:1px dashed #eef1f6}.pay{flex:1;border:1px solid var(--border);border-radius:12px;padding:10px 12px;display:flex;align-items:center;gap:10px;cursor:pointer}.pay input{accent-color:#3b82f6}.pay b{font-size:13px}.order-price{display:flex;align-items:flex-end;gap:8px;margin:12px 0 10px}.order-price .num{font-size:28px;font-weight:600;color:#111}.btn-primary{width:100%;background:var(--primary-strong);color:#fff;border:0;border-radius:10px;padding:12px 16px;font-weight:800;cursor:pointer}.btn-primary:hover{filter:brightness(1.02)}.btn-primary:disabled{background:#9ca3af;cursor:not-allowed;opacity:.6}.table{overflow:hidden;border-radius:14px}.table table{width:100%;border-collapse:separate;border-spacing:0;background:#fff}.table thead th{background:#f8fafc;border-bottom:1px solid var(--border);padding:14px 12px;font-weight:700;text-align:left}.table thead th:nth-child(2),.table thead th:nth-child(3){text-align:center}.table tbody td{padding:14px 12px;border-bottom:1px solid #f1f3f7}.table tbody tr:nth-child(odd) td{background:#fbfcff}.tick{display:inline-block;width:20px;height:20px;border-radius:6px;background:#ecfdf5;border:1px solid #c5f3da;color:var(--green);font-weight:800;text-align:center;line-height:18px}.cross{display:inline-block;width:20px;height:20px;border-radius:6px;background:#fff1f2;border:1px solid #ffd5dc;color:var(--red);font-weight:900;text-align:center;line-height:18px}.banner{background:linear-gradient(180deg,#f7f9fd,#f0f3f9);border:1px solid var(--border);border-radius:16px;padding:24px 22px;margin:22px 0;display:grid;gap:6px}.banner h3{margin:0;font-size:18px;color:#333;text-align:center}.banner p{margin:0;color:#6b7280;text-align:center;font-size:13px}.banner .cta{margin-top:10px;display:flex;justify-content:center}.btn-ghost{background:#fff;border:1px solid #dbe2ee;border-radius:999px;padding:8px 14px;font-weight:700;color:#3b63ff}.faq{margin:26px 0}.faq h3{text-align:center;font-size:20px;margin-bottom:16px}.qa{border-bottom:1px solid var(--border);padding:14px 4px}.qa summary{list-style:none;display:flex;justify-content:space-between;cursor:pointer}.qa summary::-webkit-details-marker{display:none}.qa summary b{color:#333}.qa summary span{color:#9aa1ac}.qa p{margin:10px 0 0;color:#6b7280}.radio-row .pay input[type=radio]{display:none}.radio-row{display:flex;gap:12px;margin-top:8px}.pay{flex:1;border:1px solid #e5e7eb;border-radius:12px;padding:10px 12px;display:flex;align-items:center;gap:10px;cursor:pointer;background:#fff;transition:.15s ease}.pay:not(.selected){filter:grayscale(1);opacity:.55}.pay.selected{filter:none;opacity:1;border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa1f}.steps{display:flex;flex-direction:column;gap:14px;margin-top:12px}.step{display:flex;align-items:flex-start;gap:10px}.step-num,.step-text{opacity:0;transform:translateY(10px)}.step-num{flex-shrink:0;width:28px;height:28px;border-radius:50%;background-color:#3b82f6;color:#fff;font-weight:700;font-size:14px;display:flex;align-items:center;justify-content:center;box-shadow:0 0 4px #3b82f64d}.step-text{color:#374151;font-size:14px;line-height:1.6}@keyframes fadeInUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.steps.tuan-animate .step:nth-child(1) .step-num{animation:fadeInUp .25s ease forwards .05s}.steps.tuan-animate .step:nth-child(2) .step-num{animation:fadeInUp .25s ease forwards .15s}.steps.tuan-animate .step:nth-child(3) .step-num{animation:fadeInUp .25s ease forwards .25s}.steps.tuan-animate .step:nth-child(4) .step-num{animation:fadeInUp .25s ease forwards .35s}.steps.tuan-animate .step:nth-child(5) .step-num{animation:fadeInUp .25s ease forwards .45s}.steps.tuan-animate .step:nth-child(1) .step-text{animation:fadeInUp .25s ease forwards .1s}.steps.tuan-animate .step:nth-child(2) .step-text{animation:fadeInUp .25s ease forwards .2s}.steps.tuan-animate .step:nth-child(3) .step-text{animation:fadeInUp .25s ease forwards .3s}.steps.tuan-animate .step:nth-child(4) .step-text{animation:fadeInUp .25s ease forwards .4s}.steps.tuan-animate .step:nth-child(5) .step-text{animation:fadeInUp .25s ease forwards .5s}#tuanCard{transition:opacity .35s ease,transform .35s ease,visibility 0s linear .35s}#tuanCard.tuan-hide{opacity:0!important;transform:translateY(8px);pointer-events:none;visibility:hidden}#tuanCard.tuan-show{opacity:1!important;transform:translateY(0);pointer-events:auto;visibility:visible;transition:opacity .35s ease,transform .35s ease,visibility 0s}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;display:flex;align-items:center;justify-content:center;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .25s ease}.modal.show{opacity:1;visibility:visible;pointer-events:auto}.modal__dialog{position:relative;background:#fff;border-radius:14px;width:min(520px,92vw);margin:0;padding:18px 18px 16px;box-shadow:0 10px 30px #0000001f;opacity:0;transform:translateY(8px);transition:opacity .25s ease,transform .25s ease}.modal.show .modal__dialog{opacity:1;transform:translateY(0)}.modal__overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#00000073}.modal__close{position:absolute;top:10px;right:12px;border:0;background:transparent;font-size:20px;cursor:pointer;line-height:1}.modal__title{margin:4px 0 12px;font-size:18px;font-weight:800;color:#333;text-align:center}.modal__steps{color:#374151;line-height:1.7;display:grid;gap:8px}.modal__btn{display:block;width:100%;margin-top:14px;border:0;border-radius:10px;padding:12px 16px;background:#3b82f6;color:#fff;font-weight:800;cursor:pointer}.modal__btn:disabled{opacity:.5;cursor:not-allowed}.no-scroll{overflow:hidden}.vip-top-row{display:flex;align-items:stretch;gap:-30px}.vip-top-row>.medium-5{flex:5;display:flex;margin-left:-12px}.vip-top-row>.medium-7{flex:7;display:flex;margin-right:-12px}.vip-top-row .cb-card{flex:1;display:flex;flex-direction:column}.member-status-text{text-align:center;line-height:1.6}.member-status-text .status-main{font-size:1rem;font-weight:600;color:#111827;margin-bottom:4px}.member-status-text .status-sub{font-size:.9rem;color:#6b7280;font-weight:400}.member-status-text{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-height:140px;gap:4px}.faq-card{background:transparent!important;box-shadow:none!important;border:none!important;padding:32px 40px}.faq-title{font-size:26px;font-weight:600;text-align:center;margin-bottom:28px;color:#111827}.faq-item{border-bottom:1px solid #e5e7eb;padding:16px 0}.faq-question{display:flex;justify-content:space-between;align-items:center;font-weight:500;cursor:pointer;font-size:18px;transition:color .2s ease;color:#1f2937}.faq-question:hover{color:#2563eb}.faq-toggle{font-weight:700;font-size:20px;margin-left:10px;color:#6b7280;transition:transform .2s ease}.faq-answer{display:none;margin-top:10px;color:#374151;line-height:1.75;font-size:16px;padding-left:6px}.faq-item.active .faq-answer{display:block}.faq-item.active .faq-toggle{transform:rotate(45deg);color:#2563eb}.faq-more{text-align:center;margin-top:20px}.faq-more a{color:#4b5563;font-size:15px;text-decoration:none}.faq-more a:hover{text-decoration:underline}.faq-answer{max-height:0;overflow:hidden;opacity:0;transition:max-height .35s ease,opacity .35s ease}.faq-item.active .faq-answer{max-height:400px;opacity:1}.theme--dark{--primary:#fbbf24;--primary-strong:#f59e0b;--green:#4ade80;--red:#fb7185;--gray-900:#e5e7eb;--gray-700:#d1d5db;--gray-600:#9ca3af;--gray-500:#6b7280;--border:#374151;--bg:#020617;--card:#1f2430}.theme--dark body{background:var(--bg);color:var(--gray-900)}.theme--dark .page{background:transparent}.theme--dark .head .logo{background:linear-gradient(180deg,#4f46e5 0,#1e293b)}.theme--dark .head .logo:after{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23fef08a'/%3E%3Cstop offset='100%25' stop-color='%23eab308'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath stroke='url(%23g)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7Zm3 16h14'/%3E%3C/svg%3E\");filter:drop-shadow(0 1px 3px rgba(0,0,0,.5))}.theme--dark .head-title{color:#fbbf24}.theme--dark .head-sub{color:#facc15}.theme--dark .card{background:var(--card);border-color:var(--border);box-shadow:0 10px 28px #000000b3}.theme--dark .card-hd{border-bottom-color:var(--border);background:linear-gradient(180deg,#262b36,#1f2430);color:#e5e7eb}.theme--dark .card-bd{background:#181a1f;color:#e5e7eb}.theme--dark .plan{background:#191c21;border-color:#1f2937}.theme--dark .plan:hover{border-color:#334155}.theme--dark .plan.active{border-color:#fbbf24;box-shadow:0 0 0 4px #fbbf2433}.theme--dark .plan .tag{color:#e2d226;background:#111827;border-color:#1f2937}.theme--dark .plan .badge{background:#3b82f6;color:#fff}.theme--dark .price{color:#fb7185}.theme--dark .sub{color:#9ca3af}.theme--dark .aside .order-line{color:#9ca3af;border-bottom-color:#1f2937}.theme--dark .order-price .num{color:#f9fafb}.theme--dark .btn-primary{background:var(--primary-strong);color:#111827}.theme--dark .btn-primary:disabled{background:#4b5563;color:#9ca3af}.theme--dark .pay{background:#020617;border-color:var(--border)}.theme--dark .pay.selected{border-color:#60a5fa;box-shadow:0 0 0 2px #60a5fa40}.theme--dark .table table{background:#020617}.theme--dark .table thead th{background:#0b1120;border-bottom-color:var(--border);color:#e5e7eb}.theme--dark .table tbody td{border-bottom-color:#111827;color:#e5e7eb}.theme--dark .table tbody tr:nth-child(odd) td{background:#0d1120}.theme--dark .tick{background:#052e16;border-color:#15803d;color:#4ade80}.theme--dark .cross{background:#450a0a;border-color:#b91c1c;color:#fecaca}.theme--dark .banner{background:linear-gradient(180deg,#020617,#020617);border-color:var(--border)}.theme--dark .banner h3{color:#e5e7eb}.theme--dark .banner p{color:#9ca3af}.theme--dark .btn-ghost{background:#020617;border-color:#4b5563;color:#e5e7eb}.theme--dark .faq-card{background:transparent!important}.theme--dark .faq-title{color:#e5e7eb}.theme--dark .faq-item{border-bottom-color:var(--border)}.theme--dark .faq-question{color:#e5e7eb}.theme--dark .faq-question:hover{color:#60a5fa}.theme--dark .faq-toggle{color:#9ca3af}.theme--dark .faq-answer{color:#cbd5f5}.theme--dark .faq-item.active .faq-toggle{color:#60a5fa}.theme--dark .faq-more a{color:#9ca3af}.theme--dark .step-text{color:#e5e7eb}.theme--dark .step-num{background-color:#2563eb;color:#f9fafb}.theme--dark #tuanCard{background:#181a1f;border-color:var(--border)}.theme--dark .modal__dialog{background:#020617;color:#e5e7eb;box-shadow:0 16px 40px #000000b3}.theme--dark .modal__title{color:#e5e7eb}.theme--dark .modal__steps{color:#cbd5f5}.theme--dark .modal__btn{background:#3b82f6;color:#f9fafb}.theme--dark .member-status-text .status-main{color:#e5e7eb}.theme--dark .member-status-text .status-sub{color:#9ca3af}.pttag{color:#000}.theme--dark .pttag{color:#faf9e5}.section.transparent{background:transparent!important;border:none!important;box-shadow:none!important}.cb-card{border-radius:14px;overflow:hidden;background:#fff;box-shadow:0 6px 20px #0000000f}.cb-card-header{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:15px 20px 14px;background:linear-gradient(180deg,#fcfdff,#f6f8fb);border-bottom:1px solid rgba(15,23,42,.07)}.cb-card-header-left{display:flex;align-items:center;gap:12px;min-width:0}.cb-card-header-right{display:flex;align-items:center;gap:10px;flex-wrap:nowrap}.cb-card-icon{flex-shrink:0;width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;border-radius:11px;color:#1d6bff;background:linear-gradient(145deg,#2f89ff24,#2f89ff0d);box-shadow:inset 0 1px #ffffffa6}.cb-card-icon svg{width:20px;height:20px;display:block;flex-shrink:0}.cb-card-title{margin:0;font-size:17px;font-weight:600;letter-spacing:-.02em;line-height:1.25;color:#0f172a}.cb-card-more{flex-shrink:0;font-size:13px;font-weight:500;color:#2563eb!important;text-decoration:none;display:inline-flex;align-items:center;gap:4px;padding:6px 10px;margin:0 -4px 0 0;border-radius:8px;transition:color .15s ease,background .15s ease}.cb-card-more:hover{text-decoration:none;color:#1d4ed8!important;background:#2563eb14}.cb-card-select{flex:0 0 auto;width:auto;appearance:none;-webkit-appearance:none;-moz-appearance:none;background:#fff url('data:image/svg+xml;utf8, ') no-repeat right 10px center;background-size:10px;border:1px solid #d0ddf5;border-radius:8px;padding:6px 30px 6px 12px;font-size:14px;cursor:pointer;transition:border-color .25s ease,box-shadow .25s ease}.cb-card-select:hover{border-color:#b6cdfa;box-shadow:0 0 0 2px #2f6fff1a}.cb-card-select:focus{outline:none;border-color:#2f6fff;box-shadow:0 0 0 2px #2f6fff26}.cb-card-body{padding:16px 20px 20px}.cb-card{border-radius:14px;overflow:visible}.cb-card-header{border-top-left-radius:14px;border-top-right-radius:14px;overflow:visible}.cb-card-body{border-bottom-left-radius:14px;border-bottom-right-radius:14px;overflow:hidden}.cb-item-grid{display:grid;grid-template-columns:repeat(9,1fr);gap:14px 5px;padding:6px;max-height:600px;overflow-y:auto}.cb-item-pill{display:inline-flex;align-items:center;justify-content:center;height:36px;padding:0 14px;border-radius:999px;background:#2f89ff;color:#fff;font-size:14px;white-space:nowrap;cursor:pointer;transition:transform .04s ease,background .15s ease,box-shadow .15s ease;user-select:none;box-shadow:0 2px 6px #2f89ff2e}.cb-item-pill:hover{background:#1e6fe0}.cb-item-pill:active{transform:translateY(1px)}.cb-item-pill--icon{display:inline-flex;align-items:center;justify-content:center;min-width:36px;padding:0 10px}.cb-card-actions{display:inline-flex;align-items:center;gap:16px;font-size:14px}.cb-card-action{display:inline-flex;align-items:center;gap:6px;color:#6b7a99;text-decoration:none}.cb-card-action:hover{color:#2f6fff}.cb-tile-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px 16px}.cb-tile{position:relative;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;padding:14px 16px;background:#fff;border:1px solid #cce8d4;border-radius:10px;box-shadow:0 2px 8px #0000000a;cursor:pointer;transition:box-shadow .15s ease,transform .04s ease,border-color .15s ease,background .15s ease}.cb-tile:hover{border-color:#8fd6a5;box-shadow:0 6px 18px #00000014}.cb-tile:active{transform:translateY(1px)}.cb-tile-number{width:24px;height:24px;border-radius:999px;background:#2f89ff;color:#fff;font-size:13px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}.cb-tile-title{font-size:14px;font-weight:600;color:#2b2f36;line-height:1.35;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.cb-tile-meta{display:inline-flex;align-items:center;gap:6px;color:#9aa7bd;font-size:12px;margin-top:6px}.cb-badge{position:absolute;top:10px;right:12px;padding:2px 6px;border-radius:999px;font-size:11px;color:#ff5a5a;background:#ff5a5a1a}.cb-tile--active{background:linear-gradient(90deg,#fff5f5,#fff 40%);border-color:#ffd7d7}.cb-tile--active:before{content:\"\";position:absolute;left:0;top:6px;bottom:6px;width:4px;border-radius:4px;background:linear-gradient(180deg,#ff9f9f,#ff6b6b)}.cb-tile-trailing{color:#9aa7bd;font-size:12px}@media (max-width: 1280px){.cb-tile-grid{grid-template-columns:repeat(3,1fr)}}@media (max-width: 960px){.cb-tile-grid{grid-template-columns:repeat(2,1fr)}}@media (max-width: 560px){.cb-tile-grid{grid-template-columns:1fr}}.cb-media-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px 16px}.cb-media-tile{display:grid;grid-template-columns:64px 1fr;gap:12px;padding:14px 16px;background:#fff;border:1px solid #cce8d4;border-radius:12px;box-shadow:0 2px 8px #0000000a;cursor:pointer;transition:box-shadow .15s ease,transform .04s ease,border-color .15s ease,background .15s ease}.cb-media-tile:hover{border-color:#8fd6a5;box-shadow:0 6px 18px #00000014}.cb-media-tile:active{transform:translateY(1px)}.cb-media-thumb{width:64px;height:64px;border-radius:10px;object-fit:cover;background:#f2f4f8}.cb-media-text{display:flex;flex-direction:column;justify-content:flex-start;align-self:flex-start;min-width:0}.cb-media-title{font-size:14px;font-weight:700;color:#2b2f36;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px}.cb-media-desc{font-size:12px;color:#8a96a9;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}@media (max-width: 1024px){.cb-media-grid{grid-template-columns:repeat(2,1fr)}}@media (max-width: 560px){.cb-media-grid{grid-template-columns:1fr}}.cb-media-tile{position:relative}.cb-media-badge{position:absolute;top:8px;right:10px;padding:2px 8px;border-radius:999px;font-size:11px;line-height:1;font-weight:600;color:#ff5a5a;background:linear-gradient(180deg,#fff2e9,#ffe4d4);border:1px solid #ffc6a7;box-shadow:0 1px 3px #0000000f;pointer-events:none}.cb-photo-single{position:relative;width:100%;max-width:480px;aspect-ratio:4 / 3;border-radius:12px;border:1px solid #dceee1;background:#fff;box-shadow:0 2px 8px #0000000d;overflow:hidden;transition:transform .35s ease,box-shadow .35s ease,border-color .35s ease}.cb-photo-single img{width:100%;height:100%;object-fit:contain;transition:transform .35s ease;transform:scale(1)}.cb-exam-card{display:flex;flex-direction:column;justify-content:flex-start;align-items:center;text-align:center;background:#fff;border:1px solid #dbe7fa;border-radius:10px;padding:10px 10px 5px;box-shadow:0 2px 8px #0000000a;transition:all .25s ease}.cb-exam-card:hover{border-color:#bcd2f7;box-shadow:0 6px 18px #00000014;transform:translateY(-2px)}.cb-exam-title{font-size:14px;font-weight:700;color:#2b2f36;margin-bottom:8px;line-height:1.4;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.cb-exam-links{display:flex;flex-direction:column;gap:6px;width:70%;align-items:flex-start;margin-left:20%}.cb-exam-link{font-size:14px;color:#2f89ff!important;text-decoration:none;transition:color .2s ease;font-weight:600;cursor:pointer}.cb-exam-link:hover{color:#1e6fe0!important;text-decoration:underline}.cb-exam-grid{grid-auto-rows:auto;max-height:260px;overflow-y:auto;padding-right:4px}@media (max-width: 1024px){.cb-exam-grid{grid-template-columns:repeat(2,1fr)}}@media (max-width: 640px){.cb-exam-grid{grid-template-columns:1fr}}:root{--exam-card-h: 120px;--exam-gap: 12px}.cb-exam-grid{display:grid;grid-template-columns:repeat(1,1fr);justify-items:center;gap:10px;overflow-y:auto;overflow-x:hidden;box-sizing:border-box}.cb-exam-card{width:220px;max-width:90%;box-sizing:border-box}.cb-exam-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cb-exam-link{display:inline-block;max-width:92%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cb-card-body--scroll{max-height:260px;overflow-y:auto;padding-right:4px}.cb-card-body--scroll .cb-exam-grid{overflow:visible}.cb-feedback-card{display:flex;flex-direction:column;align-items:center;text-align:center;background:linear-gradient(135deg,#f0fff4,#e6f8ff);backdrop-filter:blur(8px);border:1px solid rgba(190,230,210,.6);padding:24px 16px;box-shadow:0 4px 12px #0000000d;transition:transform .25s ease,box-shadow .25s ease}.cb-feedback-title{font-size:16px;font-weight:700;color:#fff;margin-bottom:8px}.cb-feedback-text{font-size:14px;color:#333;margin-bottom:16px;line-height:1.5}.cb-feedback-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;background:linear-gradient(145deg,#34d058,#28a745);color:#fff;border-radius:999px;padding:10px 20px;font-size:14px;font-weight:600;text-decoration:none;box-shadow:0 4px 10px #28a7454d;transition:all .25s ease}.cb-feedback-btn-icon{flex-shrink:0;opacity:.95}.cb-feedback-btn:hover{background:linear-gradient(145deg,#2eb94d,#1f943c);box-shadow:0 6px 14px #28a74566;transform:scale(1.05)}.cb-feedback-btn{color:#fff!important}.theme--dark .cb-card{background:#1f222a;box-shadow:0 6px 20px #000000b3}.theme--dark .cb-card-header{background:linear-gradient(180deg,#2a2a2e,#1f1f22);border-bottom-color:#ffffff14}.theme--dark .cb-card-icon{color:#d4d4d8;background:linear-gradient(145deg,#ffffff1a,#ffffff0a);box-shadow:inset 0 1px #ffffff14}.theme--dark .cb-card-title{color:#f4f4f5}.theme--dark .cb-card-more{color:#d4d4d8!important}.theme--dark .cb-card-more:hover{color:#fafafa!important;background:#ffffff14}.theme--dark .cb-card-actions,.theme--dark .cb-card-action{color:#a1a1aa}.theme--dark .cb-card-action:hover{color:#e4e4e7}.theme--dark .cb-card-select{background:#2c2c30 url('data:image/svg+xml;utf8, ') no-repeat right 10px center;background-size:10px;border-color:#3f3f46;color:#e4e4e7}.theme--dark .cb-card-select:hover{border-color:#52525b;box-shadow:0 0 0 2px #ffffff0f}.theme--dark .cb-card-select:focus{border-color:#71717a;box-shadow:0 0 0 2px #ffffff1a}.theme--dark .cb-card-body{background:#1f2021}.theme--dark .cb-card-body--scroll{background:#181a1f}.theme--dark .cb-item-pill{background:#2f89ff;box-shadow:0 2px 6px #2f89ff66;color:#f5f7ff}.theme--dark .cb-item-pill:hover{background:#1e6fe0}.theme--dark .cb-tile{background:#22252f;border-color:#395348;box-shadow:0 2px 10px #00000080}.theme--dark .cb-tile:hover{border-color:#4fa36f;box-shadow:0 6px 20px #000000b3}.theme--dark .cb-tile-number{background:#2f89ff;color:#f5f7ff}.theme--dark .cb-tile-title{color:#f1f5ff}.theme--dark .cb-tile-meta{color:#7c8aa4}.theme--dark .cb-tile--active{background:linear-gradient(90deg,#3a2527,#22252f 40%);border-color:#d87c80}.theme--dark .cb-tile--active:before{background:linear-gradient(180deg,#ff9f9f,#ff6b6b)}.theme--dark .cb-badge{color:#ff9b9b;background:#ff5a5a2e}.theme--dark .cb-media-tile{background:#323334;border-color:#395348;box-shadow:0 2px 10px #00000080}.theme--dark .cb-media-tile:hover{border-color:#4fa36f;box-shadow:0 6px 20px #000000b3}.theme--dark .cb-media-thumb{background:#2b2f36}.theme--dark .cb-media-title{color:#f1f5ff}.theme--dark .cb-media-desc{color:#a0aec0}.theme--dark .cb-media-badge{color:#ffb38a;background:linear-gradient(180deg,#3a2920,#41271f);border-color:#804f37}.theme--dark .cb-photo-single{background:#181a1f;border-color:#36443a;box-shadow:0 2px 10px #0009}.theme--dark .cb-photo-single img{transform:scale(1)}.theme--dark .cb-exam-card{background:#323334;border-color:#3c4b68;box-shadow:0 2px 10px #00000080}.theme--dark .cb-exam-card:hover{border-color:#50648c;box-shadow:0 6px 20px #000000bf}.theme--dark .cb-exam-title{color:#f1f5ff}.theme--dark .cb-exam-link{color:#7aa2ff!important}.theme--dark .cb-exam-link:hover{color:#a5bfff!important}.theme--dark .cb-feedback-card{background:linear-gradient(135deg,#15231b,#111a22);border:1px solid rgba(100,160,130,.7);box-shadow:0 4px 16px #000000b3}.theme--dark .cb-feedback-title{color:#fff}.theme--dark .cb-feedback-text{color:#d0d7e2}.theme--dark .cb-feedback-btn{background:linear-gradient(145deg,#34d058,#28a745);color:#fff!important;box-shadow:0 4px 12px #28a7458c}.theme--dark .cb-feedback-btn:hover{background:linear-gradient(145deg,#2eb94d,#1f943c);box-shadow:0 6px 16px #28a745bf}.theme--dark .section.transparent{background:transparent!important;border:none!important;box-shadow:none!important}.cb-book-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px;justify-items:center;padding:10px}.cb-book-card{display:flex;flex-direction:column;align-items:center;gap:8px;padding:8px;max-width:150px;background:#fff;border:1px solid #cce8d4;border-radius:12px;box-shadow:0 2px 8px #0000000a;cursor:pointer;text-decoration:none;transition:box-shadow .15s ease,transform .04s ease,border-color .15s ease}.cb-book-card:hover{border-color:#8fd6a5;box-shadow:0 6px 18px #00000014}.cb-book-card:active{transform:translateY(0)}.cb-book-cover{width:100%;height:auto;max-width:160px;max-height:180px;object-fit:contain;border-radius:8px;background:#f2f4f8;box-shadow:0 4px 12px #0000001a}.cb-book-title{width:100%;text-align:center;font-size:12px;font-weight:700;color:#2b2f36;line-height:1.4;word-wrap:break-word}.theme--dark .cb-book-card{background:#22252f;border-color:#395348;box-shadow:0 2px 10px #00000080}.theme--dark .cb-book-card:hover{border-color:#4fa36f;box-shadow:0 6px 20px #000000b3}.theme--dark .cb-book-cover{background:#2b2f36}.theme--dark .cb-book-title{color:#f1f5ff}@media (max-width: 768px){.cb-book-grid{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}}@media (max-width: 480px){.cb-book-grid{grid-template-columns:1fr}}.cb-card.fav-card{padding-bottom:0;margin-bottom:0}.cb-card-body.fav-body{max-height:320px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;margin-top:0;padding:0!important}.fav-list{display:grid;gap:0;padding-bottom:0;margin-bottom:0}.fav-row{display:grid;grid-template-columns:1.6fr 1.2fr 1fr max-content;align-items:center;background:transparent;border:.5px solid rgba(107,114,128,.25);margin:0;border-radius:8px;transition:border-color .25s ease,box-shadow .25s ease}.fav-row:hover{border-color:#2563eb99;box-shadow:0 0 6px #2563eb59}.fav-row>*{padding:12px 14px;min-width:0}.fav-row{align-items:stretch;grid-template-columns:1.6fr 1.2fr 1fr max-content}.fav-row>*{padding:12px 14px;min-width:0;display:flex;align-items:center}.fav-row>*+*{border-left:1px solid rgba(107,114,128,.25)}.fav-title{white-space:nowrap}.fav-title a{color:#111827;font-weight:600;text-decoration:none}.fav-title a:hover{text-decoration:underline!important}.fav-title .fav-problem-link{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.fav-title .fav-record-link{flex-shrink:0;margin-left:auto;padding-left:4px}.fav-title .fav-record-link:hover{border-bottom:1px solid currentColor}.fav-tags{display:flex;flex-wrap:wrap;gap:6px}.fav-chip{display:inline-flex;align-items:center;font-size:12px;line-height:1;padding:6px 8px;border-radius:999px;background:#f3f4f6;color:#374151;white-space:nowrap;cursor:pointer;transition:background .2s}.fav-chip:hover{background:#e5edff}.fav-company{color:#374151;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;gap:6px}.fav-diff{align-self:stretch;justify-self:stretch;display:flex;justify-content:center;align-items:center}.fav-diff-block{font-size:12px;padding:6px 10px;border-radius:8px;font-weight:700;border:1px solid rgba(107,114,128,.25);line-height:1;white-space:nowrap;text-align:center}.diff-easy{background:#e8f7ec;color:#0f7b32}.diff-medium{background:#fff4e5;color:#b45309}.diff-hard{background:#fee2e2;color:#b91c1c}@media (max-width: 640px){.fav-row{grid-template-columns:1fr max-content;grid-template-areas:\"title diff\" \"tags company\"}.fav-title{grid-area:title}.fav-tags{grid-area:tags}.fav-company{grid-area:company}.fav-diff{grid-area:diff;place-self:center}.fav-row>*{padding:12px}.fav-row>*{border-left:none}.fav-title{border-right:1px solid rgba(107,114,128,.25)}}.tip-box{position:relative;display:inline-block;isolation:isolate}.tip-box>i{font-size:18px;line-height:1;vertical-align:-2px}.tip-content{position:absolute;bottom:130%;left:50%;transform:translate(-50%);background:#fff;border:1px solid #e5e7eb;border-radius:8px;padding:10px;width:180px;text-align:center;box-shadow:0 6px 20px #00000014;opacity:0;pointer-events:none;transition:opacity .2s ease,transform .2s ease;z-index:9999}.tip-content:after{content:\"\";position:absolute;top:100%;left:50%;transform:translate(-50%);border:6px solid transparent;border-top-color:#fff}.tip-content img{width:100%;border-radius:6px;margin-bottom:6px}.tip-content p{margin:0;font-size:13px;color:#333}.fav-tip-line{display:inline-flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px}.fav-tip-star{width:14px;height:14px;flex-shrink:0;color:#f59e0b}.tip-box:hover .tip-content{opacity:1;pointer-events:auto;transform:translate(-50%,-6px)}.tip-box{position:relative;display:inline-block}.tip-content{z-index:9999}.fav-empty{text-align:center;color:#6b7280;font-size:15px;padding:40px 0;background:#fff;border-radius:8px;border:1px dashed #d1d5db}.theme--dark .cb-card.fav-card{background:#151821;box-shadow:0 6px 20px #000000b3}.theme--dark .cb-card-body.fav-body{background:#18181b}.theme--dark .fav-row{background:transparent;border-color:#94a3b859}.theme--dark .fav-row:hover{border-color:#60a5facc;box-shadow:0 0 8px #2563eb80}.theme--dark .fav-row>*+*{border-left-color:#94a3b859}.theme--dark .fav-title a{color:#e5e7ff}.theme--dark .fav-title a:hover{text-decoration:underline!important}.theme--dark .fav-title .fav-record-link{color:#93c5fd}.theme--dark .fav-chip{background:#1f2933;color:#e5e7f5}.theme--dark .fav-chip:hover{background:#1d3358}.theme--dark .fav-company{color:#cbd5f5}.theme--dark .fav-diff-block{border-color:#94a3b880}.theme--dark .tip-content{background:#111827;border-color:#374151;box-shadow:0 8px 24px #000000bf}.theme--dark .tip-content:after{border-top-color:#111827}.theme--dark .tip-content p{color:#e5e7f5}.theme--dark .tip-content img{background:#111827}.theme--dark .fav-empty{background:#111827;color:#9ca3af;border-color:#374151}.objective-problem-root{position:relative}.objective-pager-card{background:#fff;border-radius:10px;border:1px solid #eaeaea;box-shadow:0 1px 3px #0000000a;overflow:hidden;margin-bottom:12px}.objective-pager-viewport{position:relative;padding:20px 22px 8px;background:#fff}.objective-pager-viewport .objective-page{font-size:15px;line-height:1.75;color:#333}.objective-pager-viewport .objective-page p,.objective-pager-viewport .objective-page li{font-size:15px;line-height:1.75}.objective-pager-viewport .objective-page ul,.objective-pager-viewport .objective-page ol{margin:.45em 0 .65em;padding-left:1.25em}.objective-problem-root ul:has(>li input[type=radio]),.objective-problem-root ul:has(>li input[type=checkbox]),.objective-problem-root ol:has(>li input[type=radio]),.objective-problem-root ol:has(>li input[type=checkbox]){list-style:none;padding-left:0;margin:8px 0 20px;display:flex;flex-direction:column;gap:8px}.objective-problem-root li:has(input[type=radio]),.objective-problem-root li:has(input[type=checkbox]){display:flex!important;flex-direction:row!important;align-items:flex-start;gap:10px;padding:11px 14px;border:2px solid #f0f0f0;border-radius:10px;cursor:pointer;transition:border-color .15s,background .15s;font-size:15px;line-height:1.6;color:#262626;margin:0}.objective-problem-root li:has(input[type=radio]):hover,.objective-problem-root li:has(input[type=checkbox]):hover{border-color:#91d5ff;background:#e6f7ff}.objective-problem-root li:has(input[type=radio]:checked),.objective-problem-root li:has(input[type=checkbox]:checked){border-color:#1890ff;background:#e6f7ff}.objective-problem-root li:has(input[type=radio]) input,.objective-problem-root li:has(input[type=checkbox]) input{flex-shrink:0;width:16px;height:16px;margin-top:4px;cursor:pointer}.objective-problem-root li:has(input[type=radio]) label,.objective-problem-root li:has(input[type=checkbox]) label{display:flex!important;flex-direction:row!important;align-items:flex-start;gap:10px;flex:1;min-width:0;cursor:pointer;font-size:15px;line-height:1.6;margin:0}.objective-problem-root li:has(input[type=radio]) label input,.objective-problem-root li:has(input[type=checkbox]) label input{margin-top:4px}.objective-problem-root li:has(input) label.radiobox{border:none!important;padding:0!important;margin:0!important;box-shadow:none!important}.objective-problem-root label.radiobox{display:flex!important;flex-direction:row!important;align-items:flex-start;gap:10px;padding:11px 14px;border:2px solid #f0f0f0;border-radius:10px;cursor:pointer;transition:border-color .15s,background .15s;font-size:15px;line-height:1.6;color:#262626;margin:6px 0;box-sizing:border-box}.objective-problem-root label.radiobox:hover{border-color:#91d5ff;background:#e6f7ff}.objective-problem-root label.radiobox:has(input:checked){border-color:#1890ff;background:#e6f7ff}.objective-problem-root label.radiobox input[type=radio],.objective-problem-root label.radiobox input[type=checkbox]{flex-shrink:0;width:16px;height:16px;margin-top:4px;cursor:pointer}.objective-problem-root label.radiobox .markdown-body{flex:1;min-width:0}.objective-pager-toolbar{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;padding:12px 16px 16px;border-top:1px solid #eee;background:#fafafa}.objective-pager-nav{display:inline-flex;align-items:center;flex-wrap:wrap;gap:8px 12px}.objective-pager-counter{font-size:13px;font-weight:500;color:#888;min-width:3.5em;text-align:center;user-select:none}.objective-pager-btn{display:inline-flex;align-items:center;justify-content:center;padding:6px 14px;border-radius:6px;font-size:13px;font-weight:500;border:1px solid #ddd;background:#fff;color:#444;cursor:pointer;transition:background .12s,border-color .12s,color .12s,opacity .12s}.objective-pager-btn:hover:not(:disabled){background:#f5f5f5;border-color:#ccc}.objective-pager-btn--accent{color:#1677ff;border-color:#91caff;background:#fff}.objective-pager-btn--accent:hover:not(:disabled){background:#e6f4ff;border-color:#1677ff}.objective-pager-btn:disabled{opacity:.4;cursor:not-allowed}.objective-page{display:none;animation:objective-page-in .22s ease-out}.objective-page.is-active{display:block}@keyframes objective-page-in{0%{opacity:0}to{opacity:1}}.theme--dark .objective-pager-card{background:#161b22;border-color:#30363d;box-shadow:none}.theme--dark .objective-pager-viewport{background:#161b22}.theme--dark .objective-pager-viewport .objective-page{color:#c9d1d9}.theme--dark .objective-pager-toolbar{background:#0d1117;border-top-color:#30363d}.theme--dark .objective-pager-counter{color:#8b949e}.theme--dark .objective-pager-btn{background:#21262d;border-color:#30363d;color:#c9d1d9}.theme--dark .objective-pager-btn:hover:not(:disabled){background:#30363d;border-color:#484f58}.theme--dark .objective-pager-btn--accent{color:#58a6ff;border-color:#388bfd;background:#161b22}.theme--dark .objective-pager-btn--accent:hover:not(:disabled){background:#1c2a3a}.theme--dark .objective-problem-root li:has(input[type=radio]),.theme--dark .objective-problem-root li:has(input[type=checkbox]){border-color:#30363d;color:#c9d1d9}.theme--dark .objective-problem-root li:has(input[type=radio]):hover,.theme--dark .objective-problem-root li:has(input[type=checkbox]):hover{border-color:#388bfd;background:#1c2a3a}.theme--dark .objective-problem-root li:has(input[type=radio]:checked),.theme--dark .objective-problem-root li:has(input[type=checkbox]:checked){border-color:#388bfd;background:#1c3a4f}.theme--dark .objective-problem-root label.radiobox{border-color:#30363d;color:#c9d1d9}.theme--dark .objective-problem-root label.radiobox:hover{border-color:#388bfd;background:#1c2a3a}.theme--dark .objective-problem-root label.radiobox:has(input:checked){border-color:#388bfd;background:#1c3a4f}#rightSidebarCol .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered),#scratchpad .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered),.scratchpad-container .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered){border-color:#d9d9d9!important;background:#f5f5f5!important;color:#8c8c8c!important;box-shadow:none!important}#rightSidebarCol .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered) .id,#scratchpad .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered) .id,.scratchpad-container .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered) .id{color:#8c8c8c!important}#rightSidebarCol .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered,#scratchpad .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered,.scratchpad-container .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered{border-color:#69c0ff!important;background:#e6f7ff!important;color:#1890ff!important}#rightSidebarCol .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered .id,#scratchpad .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered .id,.scratchpad-container .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered .id{color:#1890ff!important}.theme--dark #rightSidebarCol .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered),.theme--dark #scratchpad .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered),.theme--dark .scratchpad-container .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered){border-color:#30363d!important;background:#21262d!important;color:#8b949e!important}.theme--dark #rightSidebarCol .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered) .id,.theme--dark #scratchpad .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered) .id,.theme--dark .scratchpad-container .contest-problems a[href^=\"#p\"]:not(.objective-sidebar-q--answered) .id{color:#8b949e!important}.theme--dark #rightSidebarCol .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered,.theme--dark #scratchpad .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered,.theme--dark .scratchpad-container .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered{border-color:#388bfd!important;background:#1c2a3a!important;color:#58a6ff!important}.theme--dark #rightSidebarCol .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered .id,.theme--dark #scratchpad .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered .id,.theme--dark .scratchpad-container .contest-problems a[href^=\"#p\"].objective-sidebar-q--answered .id{color:#58a6ff!important}button:hover{transform:scale(1.1)}button:hover .tooltip{opacity:1}.row[data-sticky-parent]{display:flex;align-items:flex-start;flex-wrap:nowrap}.row[data-sticky-parent]>.columns{float:none;min-width:0}#mainCol,.row[data-sticky-parent]>.medium-9.columns{flex:0 0 75%;max-width:75%}#rightSidebarCol{flex:0 0 25%;max-width:25%;overflow:hidden;transform:translate(0);opacity:1;pointer-events:auto;transition:transform .28s ease,opacity .28s ease,flex-basis .28s ease,max-width .28s ease}body.pset-drawer-open #rightSidebarCol{transform:translate(120%);opacity:0;pointer-events:none;flex-basis:0;max-width:0}.pset-drawer{position:sticky;top:12px;max-height:calc(100vh - 24px);background:#fff;border:none;border-radius:10px;box-shadow:0 1px 4px #0000000f,0 0 0 1px #0000000a;display:flex;flex-direction:column;overflow:hidden}:root{--pset-w: clamp(220px, 24vw, 320px)}.pset-col{will-change:transform;flex:0 0 0;max-width:0;transform:translate(-120%);opacity:0;pointer-events:none;transition:transform .28s ease,opacity .28s ease,flex-basis .28s ease,max-width .28s ease}body.pset-drawer-open .pset-col{flex:0 0 var(--pset-w);max-width:var(--pset-w);transform:translate(0);opacity:1;pointer-events:auto}.pset-drawer__header{display:flex;justify-content:space-between;align-items:center;padding:10px 14px 8px;border-bottom:1px solid #f0f0f0;background:#fafafa;position:sticky;top:0;z-index:1}.pset-drawer__header h3{font-size:13px;font-weight:700;color:#262626;line-height:1.35;margin:0}.pset-drawer__header h5{margin:0;font-size:13px;font-weight:600;color:#595959;line-height:1.35;flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pset-drawer__close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:6px;border:none;background:transparent;color:#8c8c8c;font-size:16px;line-height:1;cursor:pointer;flex-shrink:0;transition:background .15s ease,color .15s ease}.pset-drawer__close:hover{background:#f0f0f0;color:#262626}.pset-list,#psetFlatList{padding:4px 0;flex-grow:1;min-height:0;overflow-y:auto;overflow-x:hidden}.pset-ul{list-style:none;margin:0;padding:0}.pset-item{padding:8px 14px;border-bottom:1px solid #f5f5f5;transition:background .12s ease}.pset-item:hover{background:#f9fafb}.pset-item--ac{background:#f6ffed}.pset-item--ac:hover{background:#edfce5}.pset-item--active{background:#e6f4ff;border-left:2px solid #1677ff;padding-left:12px}.pset-item__main{display:flex;align-items:center;gap:6px}.pset-item__title{flex:1 1 auto;font-weight:500;font-size:13px;line-height:1.35;color:#262626;max-width:220px;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:none}.pset-item__title:hover{color:#0958d9}.pset-item__dif{font-weight:600;font-size:11px;flex:0 0 auto;white-space:nowrap;line-height:1;padding:1px 6px;border-radius:999px}.dif-easy{color:#389e0d;background:#f6ffed}.dif-medium{color:#d48806;background:#fff7e6}.dif-hard{color:#cf1322;background:#fff1f0}.dif-none{color:#8c8c8c}.green-button{padding:10px 16px;font-size:15px;margin-left:8px;border:1px solid #d1d5da;border-radius:6px;background:#fff;color:#24292e;font-weight:500;cursor:pointer;transition:background-color .2s ease,border-color .2s ease,color .2s ease}.green-button:hover{background:#f6f8fa;border-color:#d1d5da}.green-button:active{background:#f3f4f6;border-color:#d1d5da}.pset-search-row{width:100%;padding:8px 12px;border-bottom:1px solid #f0f0f0;background:#fafafa}.pset-search{display:flex;align-items:center;background:#fff;border:1px solid #e8e8e8;border-radius:6px;padding:5px 8px;transition:border-color .15s ease}.pset-search:focus-within{border-color:#91caff}.pset-search input{flex:1;border:none;outline:none;font-size:12px;color:#262626}.pset-search input::placeholder{color:#bfbfbf}.pset-drawer .section .section__header.clearfix{display:flex;align-items:center;gap:3px;justify-content:center;padding:8px 14px 6px;margin:0;border-bottom:1px solid #f0f0f0;background:transparent}.pset-drawer .section .section__header.clearfix>*{min-width:0}.pset-drawer .section .section__header.clearfix>.float-left{float:none;flex:1 1 auto}.pset-drawer .section .section__header.clearfix .mysection__title{margin:0;text-align:center}.mysection__title{flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;font-size:12px;font-weight:600;color:#595959}.pset-item--focus{background:#e6f4ff;border-left:2px solid #1677ff;padding-left:12px;transition:background .2s ease}@media (max-width: 480px){.pset-item__title{font-size:11px}}.view-mode-toggle{background:#fff;border:1px solid #e5e7eb;border-radius:6px;padding:8px 12px;cursor:pointer;font-size:16px;transition:all .2s;display:inline-flex;align-items:center;justify-content:center;min-width:40px;height:38px;color:#666;margin-left:8px;vertical-align:middle}.view-mode-toggle:hover{background:#f9fafb;border-color:#d1d5db;color:#333;transform:translateY(-2px);box-shadow:0 2px 8px #0000001a}.view-mode-toggle .icon-list{font-style:normal}.pset-filter-row{width:100%;padding:8px 12px;border-bottom:1px solid #f0f0f0;background:#fafafa}.pset-filter-group{display:flex;flex-direction:column;gap:8px}.pset-filter-select-row{display:flex;gap:8px}.pset-filter-select-row>.pset-select{flex:1;min-width:0}.pset-select{width:100%;padding:5px 8px;border:1px solid #e8e8e8;border-radius:6px;background:#fff;font-size:12px;cursor:pointer;transition:border-color .15s ease;color:#262626}.pset-select:hover{border-color:#d9d9d9}.pset-select:focus{outline:none;border-color:#91caff}.pset-checkbox-label{display:flex;align-items:center;gap:5px;font-size:13px;padding:4px 0;color:#333}.pset-checkbox-label>label{cursor:pointer;font-weight:400;margin:0}.pset-checkbox{cursor:pointer;width:16px;height:16px;margin:0}.pset-list::-webkit-scrollbar,#psetFlatList.pset-list::-webkit-scrollbar{width:5px}.pset-list::-webkit-scrollbar-track,#psetFlatList.pset-list::-webkit-scrollbar-track{background:transparent}.pset-list::-webkit-scrollbar-thumb,#psetFlatList.pset-list::-webkit-scrollbar-thumb{background:#d9d9d9;border-radius:3px}.pset-list::-webkit-scrollbar-thumb:hover,#psetFlatList.pset-list::-webkit-scrollbar-thumb:hover{background:#bfbfbf}@media (max-width: 480px){.pset-filter-group{gap:6px}.pset-select,.pset-checkbox-label{font-size:12px}}.theme--dark .pset-drawer{background:#1f1f1f;box-shadow:0 2px 10px #00000059}.theme--dark .pset-drawer__header,.theme--dark .pset-search-row,.theme--dark .pset-filter-row{background:#252525;border-bottom-color:#333;color:#e8e8e8}.theme--dark .pset-drawer__header h3{color:#e8e8e8}.theme--dark .pset-drawer__header h5{color:#bfbfbf}.theme--dark .pset-drawer__close{color:#6b6b6b}.theme--dark .pset-drawer__close:hover{background:#333;color:#e8e8e8}.theme--dark .pset-item{border-bottom-color:#2a2a2a}.theme--dark .pset-item:hover{background:#262626}.theme--dark .pset-item--ac{background:#162312}.theme--dark .pset-item--ac:hover{background:#1a2c14}.theme--dark .pset-item--ac .pset-item__title{color:#95de64}.theme--dark .pset-item--ac .pset-item__title:hover{color:#b7eb8f}.theme--dark .pset-item--active,.theme--dark .pset-item--focus{background:#111d2c;border-left-color:#1677ff}.theme--dark .pset-item__title{color:#d9d9d9}.theme--dark .pset-item__title:hover{color:#69b1ff}.theme--dark .dif-easy{color:#95de64;background:#162312}.theme--dark .dif-medium{color:#ffc53d;background:#2b2111}.theme--dark .dif-hard{color:#ff7875;background:#2a1215}.theme--dark .dif-none{color:#6b6b6b;background:transparent}.theme--dark .pset-drawer .section .section__header.clearfix{border-bottom-color:#333}.theme--dark .mysection__title{color:#bfbfbf}.theme--dark .green-button{background:#21262d;border-color:#30363d;color:#c9d1d9}.theme--dark .green-button:hover{background:#30363d;border-color:#484f58;color:#fff}.theme--dark .green-button:active{background:#1c2128;border-color:#30363d}.theme--dark .pset-search{background:#1a1a1a;border-color:#333}.theme--dark .pset-search:focus-within{border-color:#3c89e8}.theme--dark .pset-search input{background:transparent;color:#e8e8e8}.theme--dark .pset-search input::placeholder{color:#555}.theme--dark .view-mode-toggle{background:#3c3c3c;border-color:#555;color:#ccc;box-shadow:none}.theme--dark .view-mode-toggle:hover{background:#4a4a4a;border-color:#666;color:#fff;box-shadow:0 2px 8px #0000004d}.theme--dark .pset-select{background:#1a1a1a;border-color:#333;color:#d9d9d9}.theme--dark .pset-select:hover{border-color:#444}.theme--dark .pset-select:focus{border-color:#3c89e8}.theme--dark .pset-checkbox-label,.theme--dark .pset-checkbox-label>label{color:#ccc}.theme--dark .pset-checkbox{accent-color:#22c55e;color-scheme:dark}.theme--dark .pset-list::-webkit-scrollbar-track,.theme--dark #psetFlatList.pset-list::-webkit-scrollbar-track{background:#1f1f1f}.theme--dark .pset-list::-webkit-scrollbar-thumb,.theme--dark #psetFlatList.pset-list::-webkit-scrollbar-thumb{background:#3a3a3a}.theme--dark .pset-list::-webkit-scrollbar-thumb:hover,.theme--dark #psetFlatList.pset-list::-webkit-scrollbar-thumb:hover{background:#555}.pd-header-card.section,.pd-main-card.section,#rightSidebarCol .section.side{background:#fff;border-radius:10px;box-shadow:0 1px 4px #0000000f,0 0 0 1px #0000000a;margin-bottom:12px;overflow:hidden;border:none}.pd-header-card .section__header{padding:12px 16px 10px;margin:0;border-bottom:1px solid #f0f0f0}.pd-header-card .section__title{font-size:16px;font-weight:700;color:#1a1a1a;line-height:1.3;letter-spacing:-.01em;margin:0;gap:8px}.pd-header-card .section__title>div:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;gap:6px;display:flex;align-items:center}.pd-header-card .problem-nav-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:7px;flex-shrink:0;background:#f5f5f5;color:#595959;border:none;cursor:pointer;transition:background .15s ease,color .15s ease;padding:0}.pd-header-card .problem-nav-btn svg{width:20px;height:20px}.pd-header-card .problem-nav-btn:hover:not(:disabled){background:#e6f7ff;color:#1890ff}.pd-header-card .problem-nav-btn:disabled{cursor:not-allowed}.pd-header-card .section__body{padding:10px 16px 12px;margin:0;display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.pd-header-card ul.problem__tags{display:flex;flex-wrap:wrap;gap:6px 8px;margin:0!important;padding:0;list-style:none;align-items:center;flex:1 1 100%;width:100%}.pd-header-card ul.problem__tags>.problem__tags-nested{display:contents}.pd-header-card .problem__tag-item.bp6-tag{box-sizing:border-box;align-items:center;gap:3px;padding:2px 9px;border-radius:999px;font-size:11px;font-weight:500;line-height:1.45;min-height:auto;border:none;box-shadow:none;text-decoration:none;background:#f5f5f5;color:#595959}.hasjs .pd-header-card .problem__tag-item.bp6-tag:not(.hasjs--hide){display:inline-flex}.nojs .pd-header-card .problem__tag-item.bp6-tag{display:inline-flex}.pd-header-card a.problem__tag-item.bp6-tag:hover{filter:brightness(.96)}.pd-header-card .problem__tag-item.bp6-tag.icon-stopwatch{background:#f1f5f9;color:#475569}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--tried{background:#e6f4ff;color:#0958d9}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ac{background:#f6ffed;color:#389e0d}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--diff{background:#fff7e6;color:#d48806}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company{background:#f9f0ff;color:#531dab}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company .problem__tag-item__link{color:#391085;font-weight:600;text-decoration:none}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company .problem__tag-item__link:hover{text-decoration:underline}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ref{background:#e6fffb;color:#08979c}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle{background:#f6ffed;color:#389e0d;cursor:pointer}.pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle:hover{background:#d9f7be;color:#237804}.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-0{background:#fff0f6;color:#c41d7f}.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-1{background:#e6f4ff;color:#0958d9}.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-2{background:#f6ffed;color:#237804}.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-3{background:#fff7e6;color:#ad6800}.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-4{background:#f9f0ff;color:#531dab}.pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-5{background:#e6fffb;color:#006d75}.pd-header-card .section__body>.green-button{margin:0;border-radius:7px;font-size:12px;padding:6px 12px;border-color:#e8e8e8;line-height:1.35}.pd-header-card .section__tools.contest-problems{margin-top:6px;padding-top:6px;border-top:1px solid #f5f5f5}.pd-main-card .problem-content-container{background:transparent}.pd-main-card .problem-content,body.mode--scratchpad .scratchpad__problem .problem-content{min-width:0;display:flex;flex-direction:column}.pd-main-card .problem-content .section__header,body.mode--scratchpad .scratchpad__problem .problem-content .section__header{padding:10px 16px;margin:0;border-bottom:1px solid #f0f0f0;background:#fafafa}.pd-main-card .problem-content .section__title,body.mode--scratchpad .scratchpad__problem .problem-content .section__title{font-size:16px;font-weight:700;color:#1a1a1a;line-height:1.35;letter-spacing:-.01em;margin:0;overflow-wrap:anywhere;word-break:break-word;white-space:normal}.pd-main-card .section__tab-container,body.mode--scratchpad .scratchpad__problem .section__tab-container{background:#fff;border-bottom:none}.pd-main-card .section__tab-header-wrapper,body.mode--scratchpad .scratchpad__problem .section__tab-header-wrapper{padding:0}.pd-main-card ul.section__tab-header.flex-row,body.mode--scratchpad .scratchpad__problem ul.section__tab-header.flex-row{display:flex;flex-wrap:wrap;align-items:center;gap:0;padding:0 12px;margin:0;list-style:none;border-bottom:1px solid #e8e8e8}.pd-main-card .section__tab-header-item,body.mode--scratchpad .scratchpad__problem .section__tab-header-item{display:inline-flex;align-items:center;justify-content:center;padding:6px 12px;margin:0;border:none;border-top:2px solid transparent;border-radius:0;font-size:13px;font-weight:500;line-height:1.4;color:#595959;text-decoration:none!important;background:transparent;cursor:pointer;transition:color .12s ease,border-color .12s ease}.pd-main-card .section__tab-header-item:hover,body.mode--scratchpad .scratchpad__problem .section__tab-header-item:hover{background:transparent;border-top-color:#bbb;color:#0958d9}.pd-main-card .section__tab-header-item.tab--active,body.mode--scratchpad .scratchpad__problem .section__tab-header-item.tab--active{background:transparent;border-top-color:#1677ff;color:#0958d9;font-weight:600}#rightSidebarCol .section.side .section__header{padding:10px 14px 8px;margin:0;border-bottom:1px solid #f0f0f0;background:#fafafa}#rightSidebarCol .section.side .section__title{font-size:13px;font-weight:700;color:#262626;line-height:1.35;margin:0}#rightSidebarCol .section.side>div:not(.section__header){padding:4px 6px 8px}#rightSidebarCol ol.menu{list-style:none;padding:0;margin:0 -6px;width:calc(100% + 12px)}#rightSidebarCol .menu .menu__item{margin:2px 0}#rightSidebarCol .menu .menu__item>form{margin:0;display:block}#rightSidebarCol .menu__link,#rightSidebarCol button.menu__link{display:block;width:100%;box-sizing:border-box;border:none;border-left:none;border-radius:6px;padding:8px 16px;text-align:left;text-decoration:none;color:inherit;transition:background .12s ease,color .12s ease}#rightSidebarCol button.menu__link{font:inherit;line-height:inherit;background:transparent;cursor:pointer}#rightSidebarCol .menu__link .icon{display:inline-block;vertical-align:-.2em;margin-right:6px}#rightSidebarCol .menu__link:hover,#rightSidebarCol button.menu__link:hover{background:#f5f5f5;border:none;border-left:none}#rightSidebarCol .menu__link.active,#rightSidebarCol button.menu__link.active{background:#e6f4ff;color:#0958d9;border:none;border-left:none}#rightSidebarCol .menu__seperator{margin:6px 16px;background:#f0f0f0}nav#menu.nav.slideout-menu{box-sizing:border-box;background:#fff;box-shadow:0 1px 4px #0000000f,0 0 0 1px #0000000a;border-radius:0 0 10px 10px;margin-bottom:12px}nav#menu.nav .nav__item{border-radius:6px;transition:background .12s ease,color .12s ease}nav#menu.nav .nav__list-item{margin-left:2px;margin-right:2px}nav#menu.nav .nav__item:hover{background:#f5f5f5}.theme--dark .pd-header-card.section,.theme--dark .pd-main-card.section,.theme--dark #rightSidebarCol .section.side{background:#1f1f1f;box-shadow:0 2px 10px #00000059}.theme--dark .pd-main-card .problem-content .section__header,.theme--dark body.mode--scratchpad .scratchpad__problem .problem-content .section__header{border-bottom-color:#333;background:#252525}.theme--dark .pd-main-card .problem-content .section__title,.theme--dark body.mode--scratchpad .scratchpad__problem .problem-content .section__title{color:#f0f0f0}.theme--dark .pd-main-card .section__tab-container,.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-container{background:#1f1f1f;border-bottom-color:#333}.theme--dark .pd-main-card ul.section__tab-header.flex-row,.theme--dark body.mode--scratchpad .scratchpad__problem ul.section__tab-header.flex-row{border-bottom-color:#333}.theme--dark .pd-main-card .section__tab-header-item,.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-header-item{background:transparent;border-color:transparent;color:#bfbfbf}.theme--dark .pd-main-card .section__tab-header-item:hover,.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-header-item:hover{background:transparent;border-top-color:#555;color:#69b1ff}.theme--dark .pd-main-card .section__tab-header-item.tab--active,.theme--dark body.mode--scratchpad .scratchpad__problem .section__tab-header-item.tab--active{background:transparent;border-top-color:#1677ff;color:#69b1ff;font-weight:600}.theme--dark #rightSidebarCol .section.side .section__header{background:#252525;border-bottom-color:#333}.theme--dark #rightSidebarCol .section.side .section__title{color:#e8e8e8}.theme--dark #rightSidebarCol .menu__link:hover,.theme--dark #rightSidebarCol button.menu__link:hover{background:#2a2a2a;border:none;border-left:none}.theme--dark #rightSidebarCol .menu__link.active,.theme--dark #rightSidebarCol button.menu__link.active{background:#111d2c;color:#69b1ff;border:none;border-left:none}.theme--dark #rightSidebarCol .menu__seperator{background:#333}.theme--dark nav#menu.nav.slideout-menu{background:#1a1a1a;box-shadow:0 2px 10px #00000059}.theme--dark nav#menu.nav .nav__item:hover{background:#2a2a2a}.theme--dark .pd-header-card .section__header{border-bottom-color:#333}.theme--dark .pd-header-card .section__tools.contest-problems{border-top-color:#333}.theme--dark .pd-header-card .section__title{color:#f0f0f0}.theme--dark .pd-header-card .problem-nav-btn{background:#2a2a2a;color:#bfbfbf}.theme--dark .pd-header-card .problem-nav-btn:hover:not(:disabled){background:#111d2c;color:#69b1ff}.theme--dark .pd-header-card .problem__tag-item.bp6-tag{background:#2a2a2a;color:#d0d0d0}.theme--dark .pd-header-card a.problem__tag-item.bp6-tag:hover{filter:brightness(1.12)}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.icon-stopwatch{background:#1e293b;color:#cbd5e1}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--tried{background:#111d2c;color:#69b1ff}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ac{background:#162312;color:#95de64}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--diff{background:#2b2111;color:#ffc53d}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company{background:#1f1533;color:#d3adf7}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--company .problem__tag-item__link{color:#efdbff}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--ref{background:#112123;color:#5cdbd3}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle{background:#162312;color:#95de64}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.problem__tag-item--alg-toggle:hover{background:#1f3312;color:#b7eb8f}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-0{background:#291321;color:#ffadd2}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-1{background:#111d2c;color:#8dc5ff}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-2{background:#162312;color:#95de64}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-3{background:#2b2111;color:#ffd666}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-4{background:#1f1533;color:#d3adf7}.theme--dark .pd-header-card .problem__tag-item.bp6-tag.pd-tag-hue-5{background:#112123;color:#5cdbd3}.theme--dark .pd-header-card .section__body>.green-button{background:#2a2a2a;border-color:#444;color:#e0e0e0}.theme--dark .pd-header-card .section__body>.green-button:hover{background:#333;border-color:#555}body.mode--scratchpad .scratchpad-container{background:#f0f2f5}body.mode--scratchpad .scratchpad__toolbar{background:#fafafa;border-bottom:1px solid #f0f0f0;box-shadow:0 1px #0000000a;padding:8px 12px}body.mode--scratchpad .scratchpad__toolbar__button.enabled:hover{color:#0958d9;background:#f5f5f5}body.mode--scratchpad .scratchpad__toolbar__split{background:#e8e8e8}body.mode--scratchpad .scratchpad__panel-title{background:#fafafa!important;color:#262626!important;border-bottom:1px solid #f0f0f0;font-weight:600;line-height:2rem}body.mode--scratchpad .scratchpad__panel-button{color:#595959!important;opacity:1}body.mode--scratchpad .scratchpad__panel-button:hover{color:#1677ff!important}body.mode--scratchpad .scratchpad__tablist div{border-radius:8px;margin:.35rem 0;transition:background .12s ease,color .12s ease,fill .12s ease}body.mode--scratchpad .scratchpad__tablist div:hover{background:#f5f5f5;fill:#1677ff!important;color:#1677ff!important}body.mode--scratchpad .scratchpad__data-input{border-left-color:#91caff!important;background:#fff!important;color:#262626}body.mode--scratchpad .scratchpad__data-input:focus{border-left-color:#1677ff!important;background:#fff!important}body.mode--scratchpad .scratchpad__problem{background:#fff}body.mode--scratchpad .scratchpad__records__table .col--detail{border-right-color:#f0f0f0}.theme--dark body.mode--scratchpad .scratchpad-container{background:#141414}.theme--dark body.mode--scratchpad .scratchpad__toolbar{background:#252525;border-bottom-color:#333;box-shadow:none}.theme--dark body.mode--scratchpad .scratchpad__toolbar__button.enabled:hover{color:#69b1ff;background:#2a2a2a}.theme--dark body.mode--scratchpad .scratchpad__toolbar__split{background:#444}.theme--dark body.mode--scratchpad .scratchpad__panel-title{background:#252525!important;color:#e8e8e8!important;border-bottom-color:#333}.theme--dark body.mode--scratchpad .scratchpad__panel-button{color:#bfbfbf!important}.theme--dark body.mode--scratchpad .scratchpad__panel-button:hover{color:#69b1ff!important}.theme--dark body.mode--scratchpad .scratchpad__tablist div:hover{background:#2a2a2a;fill:#69b1ff!important;color:#69b1ff!important}.theme--dark body.mode--scratchpad .scratchpad__tablist div.scratchpad__tab-active{background:#111d2c;border-left-color:#69b1ff!important;fill:#69b1ff!important;color:#69b1ff!important}.theme--dark body.mode--scratchpad .scratchpad__data-input{border-left-color:#3c89e8!important;background:#1f1f1f!important;color:#e8e8e8!important}.theme--dark body.mode--scratchpad .scratchpad__data-input:focus{border-left-color:#69b1ff!important;background:#1a1a1a!important}.theme--dark body.mode--scratchpad .scratchpad__problem{background:#1f1f1f}.theme--dark body.mode--scratchpad .scratchpad__records__table .col--detail{border-right-color:#333}html.page--problem_ide,html.page--problem_ide body{overflow:hidden!important;height:100%;margin:0}.page--problem_ide .footer{display:none!important}.problem-ide-page-loader{position:fixed;z-index:100000;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fffffff5;transition:opacity .35s ease,visibility .35s ease}.theme--dark .problem-ide-page-loader{background:#111111eb}.problem-ide-page-loader__spinner{width:44px;height:44px;border:3px solid rgba(24,144,255,.2);border-top-color:#1890ff;border-radius:50%;animation:problem-ide-page-spin .75s linear infinite}@keyframes problem-ide-page-spin{to{transform:rotate(360deg)}}.problem-ide-page-loader.problem-ide-page-loader--hidden{opacity:0;visibility:hidden;pointer-events:none}.problem-ide-root.problem-ide-root--boot{visibility:hidden}.problem-ide-root.problem-ide-root--ready{visibility:visible}.problem-ide-root{display:flex;flex-direction:row;height:calc(100vh - 60px);overflow:hidden;background:#f0f2f5;position:fixed;top:60px;left:0;right:0;bottom:0}.problem-ide-root .row{padding:0;margin:0}.problem-ide-left ul.section__tab-header.flex-row{gap:0;padding:0 12px;border-bottom:1px solid #e8e8e8}.problem-ide-left .section__tab-header-item{padding:6px 12px;font-size:12px;line-height:1.3;border:none;border-top:2px solid transparent;border-radius:0;background:transparent}.problem-ide-left .section__tab-header-item:hover{background:transparent;border-color:transparent;border-top-color:#bbb;color:#0958d9}.problem-ide-left .section__tab-header-item.tab--active{background:transparent;border-color:transparent;border-top-color:#1677ff;color:#0958d9;font-weight:600}.theme--dark .problem-ide-left ul.section__tab-header.flex-row{border-bottom-color:#333}.theme--dark .problem-ide-left .section__tab-header-item{background:transparent;border-color:transparent}.theme--dark .problem-ide-left .section__tab-header-item:hover{border-top-color:#555;color:#69b1ff}.theme--dark .problem-ide-left .section__tab-header-item.tab--active{border-top-color:#1677ff;color:#69b1ff}.problem-ide-left{flex:0 0 50%;min-width:320px;max-width:65%;display:flex;flex-direction:column;background:#fff;overflow:hidden;position:relative;z-index:1}.problem-ide-left__header{flex-shrink:0;display:flex;align-items:center;gap:10px;height:42px;padding:0 16px;background:#fafbfc;border-bottom:1px solid #e8eaed;font-size:13px}.problem-ide-back{display:inline-flex;align-items:center;gap:4px;color:#1890ff;font-weight:500;text-decoration:none;white-space:nowrap;transition:color .15s}.problem-ide-back:hover{color:#40a9ff;text-decoration:none}.problem-ide-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:#262626;font-size:14px}.problem-ide-left__main{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.problem-ide-left__tabs{flex-shrink:0}.problem-ide-left__scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 20px 32px;-webkit-overflow-scrolling:touch}.problem-ide-left__scroll::-webkit-scrollbar{width:6px}.problem-ide-left__scroll::-webkit-scrollbar-thumb{background:#0000001f;border-radius:3px}.problem-ide-gutter{flex:0 0 5px;background:#e0e3e8;cursor:col-resize;position:relative;z-index:10;transition:background .15s}.problem-ide-gutter:hover,.problem-ide-gutter.dragging{background:#1890ff}.problem-ide-gutter:after{content:\"\";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;height:24px;border-left:1px solid rgba(0,0,0,.15);border-right:1px solid rgba(0,0,0,.15)}.problem-ide-right{flex:1 1 0%;min-width:380px;display:flex;flex-direction:column;background:#1e1e1e;overflow:hidden}.problem-ide-toolbar{flex-shrink:0;display:flex;align-items:center;gap:10px;height:42px;padding:0 14px;background:#fafbfc;border-bottom:1px solid #e8eaed;position:relative;z-index:5}.problem-ide-toolbar__label{color:#666;font-size:12px;white-space:nowrap}.problem-ide-select{min-width:100px;max-width:160px;height:28px;padding:0 28px 0 10px;border-radius:4px;border:1px solid #d9d9d9;background:#fff url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E\") no-repeat right 8px center;background-size:10px 6px;color:#333;font-size:13px;appearance:none;-webkit-appearance:none;cursor:pointer;outline:none}.problem-ide-select:hover{border-color:#1890ff}.problem-ide-select:focus{border-color:#1890ff;box-shadow:0 0 0 2px #1890ff26}.problem-ide-toolbar__spacer{flex:1}.problem-ide-timer{position:relative;display:flex;align-items:center;margin-left:2px;padding-left:10px;border-left:1px solid #e8eaed}.problem-ide-timer__display{font-variant-numeric:tabular-nums;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:15px;font-weight:700;color:#141414;min-width:5.4em;letter-spacing:.04em}.problem-ide-timer__display.problem-ide-timer__trigger{display:inline-flex;align-items:center;justify-content:center;margin:0;padding:2px 12px;border:1px solid #d4d8e0;border-radius:8px;background:linear-gradient(180deg,#fafbfc,#fafcff);cursor:pointer;line-height:1.2;box-sizing:border-box;box-shadow:inset 0 1px #ffffffe6,0 1px 2px #0000000f;-webkit-appearance:none;appearance:none}.problem-ide-timer__display.problem-ide-timer__trigger:hover{border-color:#1890ff;background:linear-gradient(180deg,#fff,#f0f7ff);box-shadow:inset 0 1px #fffffff2,0 1px 3px #1890ff1f}.problem-ide-timer__display.problem-ide-timer__trigger:focus-visible{outline:2px solid #1890ff;outline-offset:1px}.problem-ide-timer__display--low{color:#d4380d}.problem-ide-timer__display--done{color:#cf1322}.problem-ide-timer-panel{--timer-accent: #1890ff;--timer-accent-soft: rgba(24, 144, 255, .12);--timer-surface: #fff;--timer-muted: #8c8c8c;--timer-line: rgba(0, 0, 0, .06);position:absolute;left:0;top:calc(100% + 6px);min-width:256px;max-width:min(320px,calc(100vw - 24px));padding:0;background:var(--timer-surface);border:1px solid #e8eaed;border-radius:8px;box-shadow:0 4px 16px #00000014;z-index:120;color:#262626;font-size:13px;isolation:isolate;overflow:hidden;backdrop-filter:none}.problem-ide-timer-panel:before{content:\"\";position:absolute;inset:0 0 auto 0;height:2px;background:#e8eaed;pointer-events:none}.problem-ide-timer-panel__shell{display:flex;flex-direction:column;gap:12px;padding:14px}.problem-ide-timer-panel__actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.problem-ide-timer-panel__btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;height:28px;min-height:28px;padding:0 12px;margin:0;border-radius:4px;font-size:12px;font-weight:400;cursor:pointer;border:1px solid #d9d9d9;background:#fff;color:#555;transition:border-color .15s ease,color .15s ease,background .15s ease}.problem-ide-timer-panel__btn:focus-visible{outline:2px solid var(--timer-accent);outline-offset:1px}.problem-ide-timer-panel__btn--primary{background:#1890ff;border-color:#1890ff;color:#fff}.problem-ide-timer-panel__btn--primary:hover{background:#40a9ff;border-color:#40a9ff;color:#fff}.problem-ide-timer-panel__btn--ghost:hover{border-color:#1890ff;color:#1890ff}.problem-ide-timer-panel__btn--accent{background:#1890ff;border-color:#1890ff;color:#fff}.problem-ide-timer-panel__btn--accent:hover{background:#40a9ff;border-color:#40a9ff;color:#fff}.problem-ide-timer-panel__btn--block{width:100%}.problem-ide-timer-panel__block{display:flex;flex-direction:column;gap:8px}.problem-ide-timer-panel__block--timer-mode .problem-ide-timer-panel__block-label{color:#5c5c5c}.problem-ide-timer-panel__block-label{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--timer-muted)}.problem-ide-timer-panel__segmented{display:grid;grid-template-columns:1fr 1fr;padding:3px;gap:3px;border-radius:6px;background:#e8e8e8;border:1px solid #cfcfcf;box-shadow:inset 0 1px #ffffff8c,0 1px 2px #0000000d}.problem-ide-timer-panel__segment{position:relative;z-index:0;min-height:32px;padding:0 10px;margin:0;border:none;border-radius:4px;background:transparent;color:#525252;font-size:13px;font-weight:500;cursor:pointer;transition:background .12s ease,color .12s ease,box-shadow .12s ease}.problem-ide-timer-panel__segment:hover{color:#262626}.problem-ide-timer-panel__segment--active{z-index:1;color:#1890ff;background:#fff;box-shadow:0 1px 2px #00000014,0 0 0 1px #1890ff38}.problem-ide-timer-panel__countdown-section{display:flex;flex-direction:column;gap:12px}.problem-ide-timer-panel__countdown-section[hidden]{display:none!important}.problem-ide-timer-panel__time-grid{display:grid;grid-template-columns:1fr min-content 1fr;align-items:end;gap:0 10px}.problem-ide-timer-panel__cell{display:flex;flex-direction:column;gap:6px;min-width:0;cursor:pointer}.problem-ide-timer-panel__cell-cap{font-size:12px;font-weight:500;color:#8c8c8c}.problem-ide-timer-panel__time-sep{justify-self:center;align-self:end;margin-bottom:9px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:1.35rem;font-weight:300;line-height:1;color:#d0d0d0;user-select:none}.problem-ide-timer-panel__num{width:100%;min-width:0;height:40px;padding:0 8px;border:1px solid #e0e3e8;border-radius:10px;background:linear-gradient(180deg,#fafbfc,#fff);color:#262626;text-align:center;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums;box-sizing:border-box;box-shadow:inset 0 1px 2px #0000000a;transition:border-color .15s ease,box-shadow .15s ease}.problem-ide-timer-panel__num:hover{border-color:#cfd4dc}.problem-ide-timer-panel__num:focus{border-color:var(--timer-accent);outline:none;box-shadow:inset 0 1px 2px #0000000a,0 0 0 3px var(--timer-accent-soft)}.problem-ide-timer-panel__hint{margin:0;padding:8px 10px;font-size:12px;line-height:1.5;color:#8c8c8c;background:#00000006;border:1px solid var(--timer-line);border-radius:8px}.problem-ide-timer-panel__hint strong{color:#595959;font-weight:600}@media (prefers-reduced-motion: reduce){.problem-ide-timer-panel__btn,.problem-ide-timer-panel__segment,.problem-ide-timer-panel__num{transition:none}}.problem-ide-mode-tag{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:4px;font-size:11px;font-weight:600;letter-spacing:.3px;white-space:nowrap;line-height:22px;user-select:none}.problem-ide-mode-tag--acm{background:#e6f7ff;color:#1890ff;border:1px solid #91d5ff}.problem-ide-mode-tag--core{background:#f6ffed;color:#52c41a;border:1px solid #b7eb8f}.theme--dark .problem-ide-mode-tag--acm{background:#111d2c;color:#3c9ae8;border-color:#15395b}.theme--dark .problem-ide-mode-tag--core{background:#162312;color:#6abe39;border-color:#274916}.problem-ide-mode-tag--spj{background:#fff7e6;color:#d46b08;border:1px solid #ffd591}.theme--dark .problem-ide-mode-tag--spj{background:#2b1d11;color:#d89614;border-color:#593815}.pretest-spj-notice{display:flex;flex-direction:column;gap:4px;margin-top:12px;padding:10px 14px;border-radius:6px;background:#fffbe6;border:1px solid #ffe58f;font-size:13px;line-height:1.5;color:#614700}.pretest-spj-notice strong{font-size:13px}.pretest-spj-notice span{color:#8c6e00}.theme--dark .pretest-spj-notice{background:#2b2111;border-color:#594214;color:#d8bd14}.theme--dark .pretest-spj-notice span{color:#bfa730}.problem-ide-reset-btn{font-size:12px;color:#fa8c16;border-color:#ffd591;background:#fff7e6;transition:all .15s}.problem-ide-reset-btn:hover{color:#d46b08;border-color:#fa8c16;background:#fff1cc}.theme--dark .problem-ide-reset-btn{background:#2b2111;border-color:#594214;color:#d89614}.theme--dark .problem-ide-reset-btn:hover{border-color:#d89614;color:#e8b339;background:#3b2e14}.problem-ide-toolbar__btn{height:28px;padding:0 12px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#555;font-size:12px;cursor:pointer;transition:all .15s}.problem-ide-toolbar__btn:hover{border-color:#1890ff;color:#1890ff}.problem-ide-settings{position:absolute;right:14px;top:calc(100% + 4px);padding:14px 16px;background:#fff;border:1px solid #e8eaed;border-radius:8px;box-shadow:0 6px 20px #0000001f;display:flex;flex-direction:column;gap:10px;color:#333;font-size:13px;z-index:100}.problem-ide-settings--hidden{display:none!important}.problem-ide-settings label{display:flex;align-items:center;gap:8px;cursor:pointer}.problem-ide-settings input[type=number]{width:56px;height:26px;padding:0 6px;border:1px solid #d9d9d9;border-radius:4px;background:#fff;color:#333;text-align:center}.problem-ide-settings__select{height:26px;padding:0 24px 0 8px;border:1px solid #d9d9d9;border-radius:4px;background:#fff url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E\") no-repeat right 6px center;background-size:10px 6px;color:#333;font-size:12px;appearance:none;-webkit-appearance:none;cursor:pointer;outline:none;max-width:90px}.problem-ide-settings__select:hover{border-color:#1890ff}.problem-ide-settings__select:focus{border-color:#1890ff;box-shadow:0 0 0 2px #1890ff26}.problem-ide-editor-wrap{flex:1 1 auto;min-height:120px;position:relative}.problem-ide-monaco{position:absolute;top:0;right:0;bottom:0;left:0}.problem-ide-drawer{flex-shrink:0;display:flex;flex-direction:column;border-top:2px solid #e0e3e8;height:220px;min-height:80px;max-height:60%;box-sizing:border-box;transition:height .2s ease}.problem-ide-drawer--collapsed{height:40px!important;min-height:40px!important;overflow:hidden}.problem-ide-drawer--collapsed .problem-ide-drawer__body,.problem-ide-drawer--collapsed .problem-ide-drawer__resize{display:none}.problem-ide-drawer--collapsed .problem-ide-drawer__chevron{transform:rotate(180deg)}.problem-ide-drawer--resizing{transition:none!important}.problem-ide-drawer__bar{flex-shrink:0;display:flex;align-items:center;height:38px;padding:0 14px;background:#fafbfc;border-bottom:1px solid #e8eaed;gap:6px}.problem-ide-drawer__toggle{display:inline-flex;align-items:center;gap:4px;background:none;border:none;color:#666;font-size:12px;cursor:pointer;padding:4px 0}.problem-ide-drawer__toggle:hover{color:#1890ff}.problem-ide-drawer__chevron{display:inline-block;transition:transform .2s ease;font-size:10px}.problem-ide-drawer__bar-spacer{flex:1}.problem-ide-btn{height:28px;padding:0 20px;border-radius:4px;border:none;font-size:13px;font-weight:500;cursor:pointer;transition:all .15s;display:inline-flex;align-items:center;gap:4px}.problem-ide-btn--run{background:#1890ff;color:#fff}.problem-ide-btn--run:hover{background:#40a9ff}.problem-ide-btn--run:active{background:#096dd9}.problem-ide-btn--run:disabled{opacity:.5;cursor:not-allowed}.problem-ide-btn--submit{background:#52c41a;color:#fff}.problem-ide-btn--submit:hover{background:#73d13d}.problem-ide-btn--submit:active{background:#389e0d}.problem-ide-btn--submit:disabled{opacity:.5;cursor:not-allowed}.problem-ide-cooldown-toast{position:fixed;top:70px;left:50%;transform:translate(-50%);z-index:100001;box-sizing:border-box;max-width:min(560px,calc(100vw - 32px));padding:7px 24px;border-radius:9999px;font-size:13px;line-height:1.35;font-weight:500;text-align:center;color:#0f172a;background:linear-gradient(180deg,#fffffffa,#f1f5f9fa);border:1px solid rgba(24,144,255,.22);box-shadow:0 0 0 1px #1890ff14,0 12px 40px #0f172a24;backdrop-filter:blur(10px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .35s ease}.problem-ide-cooldown-toast__text{display:block}.problem-ide-cooldown-toast__link{color:#fda922!important;font-weight:600;text-decoration:none}.problem-ide-cooldown-toast__link:hover{text-decoration:underline}.problem-ide-cooldown-toast--visible{opacity:1;visibility:visible;pointer-events:auto}.problem-ide-cooldown-toast--visible.problem-ide-cooldown-toast--hiding{opacity:0;pointer-events:none}.problem-ide-cooldown-toast--multiline{border-radius:12px;max-width:min(720px,calc(100vw - 32px));padding:12px 20px;text-align:left}.problem-ide-cooldown-toast--multiline .problem-ide-cooldown-toast__text{line-height:1.55}.theme--dark .problem-ide-cooldown-toast{color:#e2e8f0;background:linear-gradient(180deg,#1e293bf5,#0f172af5);border-color:#38bdf847;box-shadow:0 0 0 1px #38bdf81a,0 14px 44px #00000073}.theme--dark .problem-ide-cooldown-toast__link{color:#38bdf8}.problem-ide-drawer__body{flex:1;min-height:0;display:flex;flex-direction:column;background:#fff;overflow:hidden}.problem-ide-tabs{flex-shrink:0;display:flex;gap:0;background:#fafbfc;border-bottom:1px solid #e8eaed}.problem-ide-tab{padding:8px 20px;border:none;border-bottom:2px solid transparent;background:transparent;color:#888;cursor:pointer;font-size:13px;transition:all .12s}.problem-ide-tab:hover{color:#333}.problem-ide-tab--active{color:#1890ff;border-bottom-color:#1890ff;font-weight:500}.problem-ide-panel{flex:1;min-height:0;overflow:auto;padding:12px 14px}.problem-ide-label{display:block;font-size:11px;color:#888;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}.problem-ide-label--mt{margin-top:8px}.problem-ide-panel[hidden]{display:none!important}.problem-ide-panel--run{display:flex;flex-direction:column}.problem-ide-cases-bar{display:flex;align-items:center;gap:4px;margin-bottom:8px;flex-shrink:0}.problem-ide-cases-tabs{display:flex;gap:4px;flex-wrap:wrap;flex:1;min-width:0}.problem-ide-cases-actions{display:flex;align-items:center;gap:4px;flex-shrink:0}.problem-ide-case-fill{padding:3px 10px;border:1px solid #d9d9d9;border-radius:4px;background:#fafafa;color:#666;font-size:12px;line-height:1.3;cursor:pointer;transition:all .15s;white-space:nowrap}.problem-ide-case-fill:hover{border-color:#1890ff;color:#1890ff}.problem-ide-case-tab{position:relative;display:inline-flex;align-items:center;gap:2px;padding:3px 10px;border:1px solid #d9d9d9;border-radius:4px;background:#fafafa;color:#666;font-size:12px;cursor:pointer;transition:all .15s;white-space:nowrap}.problem-ide-case-tab:hover{border-color:#1890ff;color:#1890ff}.problem-ide-case-tab--active{background:#e6f7ff;border-color:#1890ff;color:#1890ff;font-weight:500}.problem-ide-case-del{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;margin-left:2px;border-radius:50%;font-size:12px;line-height:1;color:#999;transition:all .15s}.problem-ide-case-del:hover{background:#ff4d4f;color:#fff}.problem-ide-case-add{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:1px dashed #d9d9d9;border-radius:4px;background:transparent;color:#999;font-size:16px;cursor:pointer;transition:all .15s;flex-shrink:0}.problem-ide-case-add:hover{border-color:#1890ff;color:#1890ff}.problem-ide-run-cols{display:flex;gap:10px;flex:1;min-height:0}.problem-ide-run-col{flex:1;min-width:0;display:flex;flex-direction:column}.problem-ide-textarea--fill{flex:1;min-height:40px;resize:none}.pretest-multi-results{display:flex;flex-direction:column;gap:10px}.pretest-case-result{border:1px solid #e8eaed;border-radius:6px;overflow:hidden}.pretest-case-header{display:flex;align-items:center;gap:8px;padding:6px 12px;background:#fafbfc;border-bottom:1px solid #e8eaed}.pretest-case-title{font-size:13px;font-weight:500;color:#333}.pretest-case-body{padding:8px 12px}.problem-ide-textarea{width:100%;box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:13px;line-height:1.5;padding:8px 10px;border-radius:4px;border:1px solid #d9d9d9;background:#fff;color:#333;resize:vertical;outline:none;transition:border-color .15s}.problem-ide-textarea:focus{border-color:#1890ff}.problem-ide-output{min-height:48px;overflow:auto;padding:8px 10px;margin:0;border-radius:4px;border:1px solid #d9d9d9;background:#fafafa;color:#222;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:13px;line-height:1.5;white-space:pre-wrap;word-break:break-word}.problem-ide-output:empty:before{content:\"\\6682\\65e0\\8f93\\51fa\";color:#bbb}.problem-ide-status-row{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:8px 0 4px}.problem-ide-status-row .problem-ide-status{padding:0}.problem-ide-submit-result-ai-btn{flex-shrink:0}.problem-ide-submit-result-ai-btn[hidden]{display:none!important}.problem-ide-status{font-size:13px;font-weight:500}.problem-ide-status--ok{color:#52c41a}.problem-ide-status--err{color:#f5222d}.problem-ide-status--pending{color:#faad14}.problem-ide-drawer__resize{flex-shrink:0;height:4px;cursor:row-resize;background:transparent;position:relative;z-index:2;transition:background .15s}.problem-ide-drawer__resize:hover,.problem-ide-drawer__resize.dragging{background:#1890ff}.result-detail{white-space:normal}.result-summary{display:flex;align-items:center;gap:12px;margin-bottom:10px;flex-wrap:wrap}.result-badge{display:inline-block;padding:2px 10px;border-radius:4px;font-weight:600;font-size:13px}.result-badge--ac{background:#f6ffed;color:#52c41a;border:1px solid #b7eb8f}.result-badge--err{background:#fff2f0;color:#f5222d;border:1px solid #ffa39e}.result-meta{color:#666;font-size:12px}.result-compiler{margin:8px 0;padding:8px 10px;background:#fff7e6;border:1px solid #ffe58f;border-radius:4px}.result-compiler pre{margin:0;white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;color:#333}.result-cases{width:100%;border-collapse:collapse;font-size:12px;margin-top:8px}.result-cases th,.result-cases td{padding:6px 10px;text-align:left;border-bottom:1px solid #f0f0f0}.result-cases th{background:#fafafa;color:#888;font-weight:500}.result-ac{color:#52c41a;font-weight:500}.result-err{color:#f5222d;font-weight:500}.result-case-preview-btn{-webkit-appearance:none;appearance:none;border:1px solid #d9d9d9;background:#fff;color:#1890ff;font-size:12px;padding:2px 10px;border-radius:4px;cursor:pointer}.result-case-preview-btn:hover{border-color:#1890ff;background:#e6f7ff}.pretest-compare{display:flex;gap:12px}.pretest-section{flex:1;min-width:0}.pretest-section__label{font-size:11px;color:#888;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}.pretest-pre{margin:0;padding:8px 10px;border-radius:4px;border:1px solid #d9d9d9;background:#fafafa;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:13px;line-height:1.5;white-space:pre-wrap;word-break:break-word;min-height:36px;max-height:160px;overflow:auto}.pretest-case-meta{margin-left:auto;font-size:11px;color:#999;white-space:nowrap}.pretest-error-hint{margin-bottom:8px;padding:6px 10px;border-radius:4px;background:#fff2f0;border:1px solid #ffccc7;color:#cf1322;font-size:12px;line-height:1.5}.pretest-error-block{margin-bottom:8px;padding:8px 10px;border-radius:4px;background:#fff7e6;border:1px solid #ffe58f}.pretest-error-block--stderr{background:#fff2f0;border-color:#ffccc7}.pretest-error-block__label{font-size:11px;color:#d48806;font-weight:500;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}.pretest-error-block--stderr .pretest-error-block__label{color:#cf1322}.pretest-error-block__pre{margin:0;white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;line-height:1.5;color:#333;max-height:200px;overflow:auto}.problem-ide-panel[data-panel=history]{padding:0}.problem-ide-history{min-height:60px}.history-loading,.history-empty{padding:20px;text-align:center;color:#999;font-size:13px}.history-table{width:100%;border-collapse:collapse;font-size:12px}.history-table th,.history-table td{padding:8px 10px;text-align:left;border-bottom:1px solid #f0f0f0}.history-table th{background:#fafafa;color:#888;font-weight:500;position:sticky;top:0;z-index:1}.history-row:hover{background:#f5f5f5;cursor:pointer}.history-hint{padding:8px 14px;background:#e6f7ff;border-bottom:1px solid #91d5ff;color:#1890ff;font-size:12px;line-height:1.5}.theme--dark .problem-ide-root{background:#111}.theme--dark .problem-ide-left{background:#1a1a1a;color:#ddd}.theme--dark .problem-ide-left__header{background:#222;border-bottom-color:#333}.theme--dark .problem-ide-title{color:#e0e0e0}.theme--dark .problem-ide-left__scroll::-webkit-scrollbar-thumb{background:#ffffff26}.theme--dark .problem-ide-gutter{background:#333}.theme--dark .problem-ide-toolbar{background:#252526;border-bottom-color:#3c3c3c}.theme--dark .problem-ide-toolbar__label{color:#999}.theme--dark .problem-ide-select{background-color:#333;border-color:#505050;color:#e0e0e0;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E\")}.theme--dark .problem-ide-toolbar__btn{background:#333;border-color:#505050;color:#ccc}.theme--dark .problem-ide-toolbar__btn:hover{border-color:#1890ff;color:#fff}.theme--dark .problem-ide-timer{border-left-color:#3c3c3c}.theme--dark .problem-ide-timer__display{color:#f0f0f0;font-size:15px;font-weight:700}.theme--dark .problem-ide-timer__display.problem-ide-timer__trigger{border-color:#5a5a5a;background:linear-gradient(180deg,#3a3a3c,#2d2d30);box-shadow:inset 0 1px #ffffff14,0 1px 2px #00000059}.theme--dark .problem-ide-timer__display.problem-ide-timer__trigger:hover{border-color:#1890ff;background:linear-gradient(180deg,#3d4248,#2f343a);box-shadow:inset 0 1px #ffffff1a,0 1px 3px #1890ff33}.theme--dark .problem-ide-timer__display--low{color:#e89a3c}.theme--dark .problem-ide-timer__display--done{color:#ff6b6b}.theme--dark .problem-ide-timer-panel{--timer-surface: #2d2d2d;--timer-muted: #9a9a9a;--timer-line: rgba(255, 255, 255, .08);background:var(--timer-surface);border-color:#444;color:#e8e8e8;box-shadow:0 6px 20px #00000073}.theme--dark .problem-ide-timer-panel:before{background:#444}.theme--dark .problem-ide-timer-panel__block-label{color:#888}.theme--dark .problem-ide-timer-panel__block--timer-mode .problem-ide-timer-panel__block-label{color:#c6c6c6}.theme--dark .problem-ide-timer-panel__segmented{background:#1a1a1b;border-color:#4a4a4a;box-shadow:inset 0 1px #ffffff0d,0 1px 2px #00000040}.theme--dark .problem-ide-timer-panel__segment{color:#b8b8b8}.theme--dark .problem-ide-timer-panel__segment:hover{color:#f0f0f0}.theme--dark .problem-ide-timer-panel__segment--active{color:#69c0ff;background:#2d2d30;box-shadow:0 1px 3px #00000059,0 0 0 1px #69c0ff47}.theme--dark .problem-ide-timer-panel__btn{background:#333;border-color:#505050;color:#ccc}.theme--dark .problem-ide-timer-panel__btn:hover{border-color:#1890ff;color:#fff}.theme--dark .problem-ide-timer-panel__btn--primary,.theme--dark .problem-ide-timer-panel__btn--accent{background:#1890ff;border-color:#1890ff;color:#fff}.theme--dark .problem-ide-timer-panel__btn--primary:hover,.theme--dark .problem-ide-timer-panel__btn--accent:hover{background:#40a9ff;border-color:#40a9ff;color:#fff}.theme--dark .problem-ide-timer-panel__btn--ghost:hover{color:#fff}.theme--dark .problem-ide-timer-panel__cell-cap{color:#888}.theme--dark .problem-ide-timer-panel__time-sep{color:#555}.theme--dark .problem-ide-timer-panel__num{background:linear-gradient(180deg,#222,#2a2a2a);border-color:#444;color:#f0f0f0;box-shadow:inset 0 1px 2px #00000040}.theme--dark .problem-ide-timer-panel__num:hover{border-color:#555}.theme--dark .problem-ide-timer-panel__hint{color:#9a9a9a;background:#0003;border-color:#ffffff0f}.theme--dark .problem-ide-timer-panel__hint strong{color:#ccc}.theme--dark .problem-ide-settings{background:#2d2d2d;border-color:#444;color:#ddd;box-shadow:0 6px 20px #00000073}.theme--dark .problem-ide-settings input[type=number]{background:#1e1e1e;border-color:#555;color:#eee}.theme--dark .problem-ide-settings__select{background-color:#1e1e1e;border-color:#555;color:#eee;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E\")}.theme--dark .problem-ide-drawer{border-top-color:#3c3c3c}.theme--dark .problem-ide-drawer__bar{background:#252526;border-bottom-color:#3c3c3c}.theme--dark .problem-ide-drawer__toggle{color:#aaa}.theme--dark .problem-ide-drawer__toggle:hover{color:#fff}.theme--dark .problem-ide-drawer__body{background:#1e1e1e}.theme--dark .problem-ide-tabs{background:#252526;border-bottom-color:#3c3c3c}.theme--dark .problem-ide-tab{color:#888}.theme--dark .problem-ide-tab:hover{color:#ccc}.theme--dark .problem-ide-tab--active{color:#fff;border-bottom-color:#1890ff}.theme--dark .problem-ide-panel{color:#ddd}.theme--dark .problem-ide-label{color:#888}.theme--dark .problem-ide-textarea{background:#141414;border-color:#3c3c3c;color:#e0e0e0}.theme--dark .problem-ide-output{background:#141414;border-color:#3c3c3c;color:#b5e853}.theme--dark .problem-ide-output:empty:before{color:#555}.theme--dark .problem-ide-drawer__resize:hover,.theme--dark .problem-ide-drawer__resize.dragging{background:#1890ff}.theme--dark .result-badge--ac{background:#162312;color:#52c41a;border-color:#274916}.theme--dark .result-badge--err{background:#2a1215;color:#f5222d;border-color:#431418}.theme--dark .result-meta{color:#999}.theme--dark .result-compiler{background:#2b2111;border-color:#594214}.theme--dark .result-compiler pre{color:#ddd}.theme--dark .result-cases th{background:#1a1a1a}.theme--dark .result-cases td{border-bottom-color:#333}.theme--dark .result-case-preview-btn{background:#21262d;border-color:#30363d;color:#58a6ff}.theme--dark .result-case-preview-btn:hover{border-color:#58a6ff;background:#0c1929}.theme--dark .pretest-section__label{color:#888}.theme--dark .pretest-pre{background:#141414;border-color:#3c3c3c;color:#e0e0e0}.theme--dark .problem-ide-case-tab{background:#2d2d2d;border-color:#444;color:#aaa}.theme--dark .problem-ide-case-tab:hover{border-color:#1890ff;color:#69b1ff}.theme--dark .problem-ide-case-tab--active{background:#111d2c;border-color:#1890ff;color:#69b1ff}.theme--dark .problem-ide-case-del{color:#666}.theme--dark .problem-ide-case-del:hover{background:#ff4d4f;color:#fff}.theme--dark .problem-ide-case-add{border-color:#444;color:#666}.theme--dark .problem-ide-case-add:hover{border-color:#1890ff;color:#69b1ff}.theme--dark .problem-ide-case-fill{background:#2d2d2d;border-color:#444;color:#aaa}.theme--dark .problem-ide-case-fill:hover{border-color:#1890ff;color:#69b1ff}.theme--dark .pretest-case-result{border-color:#333}.theme--dark .pretest-case-header{background:#1a1a1a;border-bottom-color:#333}.theme--dark .pretest-case-title{color:#ddd}.theme--dark .pretest-case-body{background:#1e1e1e}.theme--dark .pretest-case-meta{color:#666}.theme--dark .pretest-error-hint{background:#2a1215;border-color:#431418;color:#d32029}.theme--dark .pretest-error-block{background:#2b2111;border-color:#594214}.theme--dark .pretest-error-block--stderr{background:#2a1215;border-color:#431418}.theme--dark .pretest-error-block__label{color:#d89614}.theme--dark .pretest-error-block--stderr .pretest-error-block__label{color:#d32029}.theme--dark .pretest-error-block__pre{color:#ddd}.theme--dark .history-table th{background:#1a1a1a}.theme--dark .history-table td{border-bottom-color:#333}.theme--dark .history-row:hover{background:#252525}.theme--dark .history-hint{background:#111d2c;border-bottom-color:#15395b;color:#3c9ae8}.history-ai-cell{text-align:center}.history-ai-btn{display:inline-flex;align-items:center;gap:4px;padding:4px 14px;font-size:12px;font-weight:500;color:#fff;background:linear-gradient(135deg,#ffa116,#f80);border:none;border-radius:14px;cursor:pointer;transition:all .2s ease;box-shadow:0 2px 6px #ffa1164d;white-space:nowrap;line-height:1.4}.history-ai-btn:hover{background:linear-gradient(135deg,#f80,#e67a00);box-shadow:0 3px 10px #f806;transform:translateY(-1px)}.history-ai-btn:active{transform:translateY(0);box-shadow:0 1px 4px #ff88004d}.history-ai-btn__ico{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.history-ai-btn__ico svg{display:block}.theme--dark .history-ai-btn{background:linear-gradient(135deg,#d89614,#b37a00);box-shadow:0 2px 6px #d8961440}.theme--dark .history-ai-btn:hover{background:linear-gradient(135deg,#e8b339,#d89614);box-shadow:0 3px 10px #d8961459}.ai-analysis-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:9998;opacity:0;transition:opacity .3s ease}.ai-analysis-overlay.active{opacity:1}.ai-analysis-dialog{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(.92);width:92%;max-width:1400px;height:86vh;max-height:820px;background:#fff;border-radius:18px;box-shadow:0 0 0 1px #0000000a,0 8px 24px #00000014,0 24px 64px #00000024;z-index:10001;display:flex;flex-direction:column;opacity:0;transition:all .35s cubic-bezier(.22,.61,.36,1);overflow:hidden}.ai-analysis-dialog.active{opacity:1;transform:translate(-50%,-50%) scale(1)}.ai-analysis-header{display:flex;align-items:center;padding:14px 20px;background:linear-gradient(135deg,#fafbfc,#f5f6f8);border-bottom:1px solid #eaecef;flex-shrink:0;gap:12px}.ai-analysis-header-left{display:flex;align-items:center;gap:8px;flex-shrink:0}.ai-analysis-header-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;color:#f59e0b;flex-shrink:0}.ai-analysis-header-icon svg{width:100%;height:100%;display:block}.ai-analysis-header-title{font-size:15px;font-weight:700;color:#1a1a1a;letter-spacing:-.2px}.ai-analysis-header-tags{display:flex;align-items:center;gap:6px;flex:1;min-width:0;flex-wrap:wrap}.ai-analysis-tag{display:inline-flex;align-items:center;padding:2px 10px;border-radius:10px;font-size:11px;font-weight:600;line-height:1.6;white-space:nowrap}.ai-analysis-tag--ac{background:#ecfdf3;color:#16a34a}.ai-analysis-tag--partial{background:#fffbeb;color:#d97706}.ai-analysis-tag--err{background:#fef2f2;color:#dc2626}.ai-analysis-tag--score{background:#f0f5ff;color:#3b82f6}.ai-analysis-tag--lang{background:#f5f3ff;color:#7c3aed}.ai-analysis-tag--time{background:#f8fafc;color:#64748b}.ai-analysis-close{width:30px;height:30px;border:none;background:transparent;border-radius:8px;color:#94a3b8;cursor:pointer;transition:all .15s;display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-left:auto}.ai-analysis-close:hover{background:#0000000f;color:#334155}.ai-analysis-body{flex:1;min-height:0;display:flex;flex-direction:row;gap:0;overflow:hidden}.ai-analysis-section-header{display:flex;align-items:center;gap:6px;padding:10px 16px;font-size:12px;font-weight:600;color:#64748b;text-transform:uppercase;letter-spacing:.5px;border-bottom:1px solid #f0f0f0;flex-shrink:0;background:#fafbfc}.ai-analysis-section-icon{color:#94a3b8;flex-shrink:0}.ai-analysis-code-section{flex:3;display:flex;flex-direction:column;min-width:0;border-right:1px solid #eaecef}.ai-analysis-code-container{flex:1;background:#fafbfc;overflow:auto;padding:16px 20px}.ai-analysis-code-container pre{margin:0;font-family:SF Mono,Cascadia Code,Fira Code,Consolas,Monaco,Ubuntu Mono,monospace;font-size:13px;line-height:1.7;tab-size:4}.ai-analysis-code-container code{color:#24292f;white-space:pre}.ai-analysis-code-container::-webkit-scrollbar{width:6px;height:6px}.ai-analysis-code-container::-webkit-scrollbar-track{background:transparent}.ai-analysis-code-container::-webkit-scrollbar-thumb{background:#0000001f;border-radius:3px}.ai-analysis-code-container::-webkit-scrollbar-thumb:hover{background:#0003}.ai-analysis-code-container pre[class*=language-],.ai-analysis-code-container code[class*=language-]{background:transparent!important;color:#24292f!important;font-family:SF Mono,Cascadia Code,Fira Code,Consolas,monospace!important}.ai-analysis-code-container .token{color:#24292f!important}.ai-analysis-code-container .token.keyword{color:#cf222e!important}.ai-analysis-code-container .token.string{color:#0a3069!important}.ai-analysis-code-container .token.comment{color:#6e7781!important;font-style:italic}.ai-analysis-code-container .token.function{color:#8250df!important}.ai-analysis-code-container .token.number{color:#0550ae!important}.ai-analysis-code-container .token.operator{color:#24292f!important}.ai-analysis-code-container .token.class-name{color:#953800!important}.ai-analysis-code-container .token.builtin{color:#0550ae!important}.ai-analysis-code-container .token.punctuation{color:#24292f!important}.ai-analysis-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:32px;text-align:center}.ai-analysis-quota-bar{flex-shrink:0;padding:8px 14px 10px;border-bottom:1px solid #fde68a;background:linear-gradient(180deg,#fffbeb,#fff7ed);font-size:13px;color:#57534e;text-align:center;line-height:1.55}.ai-analysis-quota-bar__num{font-weight:700;color:#92400e}.ai-analysis-quota-bar__vip-link{color:#f97316!important;font-weight:700;text-decoration:none}.ai-analysis-quota-bar__vip-link:hover{text-decoration:underline;color:#ea580c}.ai-analysis-quota-bar__vip-link strong{font-weight:700}.ai-analysis-ask-btn:disabled{opacity:.45;cursor:not-allowed;transform:none;box-shadow:none}.ai-analysis-ask-btn:disabled:hover{transform:none;filter:none}.ai-analysis-ask-btn{display:inline-flex;align-items:center;gap:8px;padding:10px 28px;font-size:14px;font-weight:600;color:#fff;background:linear-gradient(135deg,#f59e0b,#f97316);border:none;border-radius:10px;cursor:pointer;transition:all .2s ease;box-shadow:0 4px 14px #f973164d;margin-top:4px}.ai-analysis-ask-btn:hover{background:linear-gradient(135deg,#f97316,#ea580c);box-shadow:0 6px 20px #f9731666;transform:translateY(-1px)}.ai-analysis-ask-btn:active{transform:translateY(0);box-shadow:0 2px 8px #f973164d}.ai-analysis-ask-btn .ai-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0}.ai-analysis-ask-btn .ai-icon svg{width:100%;height:100%;display:block}.ai-analysis-loading{position:relative;min-height:200px}.ai-analysis-loading>*:not(.ai-analysis-spinner){display:none!important}.ai-analysis-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:36px;height:36px;border:3px solid rgba(249,115,22,.15);border-top-color:#f97316;border-radius:50%;animation:ai-spin .7s linear infinite}@keyframes ai-spin{to{transform:translate(-50%,-50%) rotate(360deg)}}.theme--dark .ai-analysis-dialog{background:#0d1117;box-shadow:0 0 0 1px #ffffff0f,0 8px 24px #0000004d,0 24px 64px #0006}.theme--dark .ai-analysis-header{background:linear-gradient(135deg,#161b22,#1c2128);border-bottom-color:#21262d}.theme--dark .ai-analysis-header-title{color:#e6edf3}.theme--dark .ai-analysis-header-icon{color:#fbbf24}.theme--dark .ai-analysis-tag--ac{background:#0a2e1c;color:#3fb950}.theme--dark .ai-analysis-tag--partial{background:#2d1f04;color:#d29922}.theme--dark .ai-analysis-tag--err{background:#2d0a0a;color:#f85149}.theme--dark .ai-analysis-tag--score{background:#0c1929;color:#58a6ff}.theme--dark .ai-analysis-tag--lang{background:#1c0f30;color:#bc8cff}.theme--dark .ai-analysis-tag--time{background:#161b22;color:#6e7681}.theme--dark .ai-analysis-close{color:#484f58}.theme--dark .ai-analysis-close:hover{background:#ffffff14;color:#c9d1d9}.theme--dark .ai-analysis-section-header{background:#161b22;border-bottom-color:#21262d;color:#6e7681}.theme--dark .ai-analysis-section-icon{color:#484f58}.theme--dark .ai-analysis-code-section{border-right-color:#21262d}.theme--dark .ai-analysis-code-container{background:#0d1117}.theme--dark .ai-analysis-code-container code{color:#e6edf3}.theme--dark .ai-analysis-code-container::-webkit-scrollbar-thumb{background:#ffffff1a}.theme--dark .ai-analysis-code-container::-webkit-scrollbar-thumb:hover{background:#ffffff2e}.theme--dark .ai-analysis-code-container pre[class*=language-],.theme--dark .ai-analysis-code-container code[class*=language-]{background:transparent!important;color:#e6edf3!important}.theme--dark .ai-analysis-code-container .token{color:#e6edf3!important}.theme--dark .ai-analysis-code-container .token.keyword{color:#ff7b72!important}.theme--dark .ai-analysis-code-container .token.string{color:#a5d6ff!important}.theme--dark .ai-analysis-code-container .token.comment{color:#8b949e!important;font-style:italic}.theme--dark .ai-analysis-code-container .token.function{color:#d2a8ff!important}.theme--dark .ai-analysis-code-container .token.number{color:#79c0ff!important}.theme--dark .ai-analysis-code-container .token.operator{color:#e6edf3!important}.theme--dark .ai-analysis-code-container .token.class-name{color:#ffa657!important}.theme--dark .ai-analysis-code-container .token.builtin{color:#79c0ff!important}.theme--dark .ai-analysis-code-container .token.punctuation{color:#8b949e!important}.theme--dark .ai-analysis-quota-bar{border-bottom-color:#422006;background:linear-gradient(180deg,#2d1f04,#1c1410);color:#d6d3d1}.theme--dark .ai-analysis-quota-bar__num{color:#fdba74}.theme--dark .ai-analysis-quota-bar__vip-link{color:#fb923c}.theme--dark .ai-analysis-quota-bar__vip-link:hover{color:#fdba74}.problem-ide-ai-result{padding:20px 0}.problem-ide-ai-result__summary{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center;margin-bottom:18px;padding:12px 14px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc;color:#475569;font-size:14px}.problem-ide-ai-result__badge{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;background:linear-gradient(135deg,#f59e0b,#f97316);color:#fff;font-weight:600}.problem-ide-ai-result__content>:first-child{margin-top:0}.problem-ide-ai-result__content>:last-child{margin-bottom:0}.problem-ide-ai-result__content.markdown-body .code-toolbar .toolbar{display:flex!important;align-items:center;justify-content:flex-end;padding:6px 8px 0;margin:0;border:none;background:transparent}.problem-ide-ai-result__content .code-toolbar{position:relative;margin:16px 0;border:1px solid #d0d7de;border-radius:8px;overflow:hidden;background:#f6f8fa}.theme--dark .problem-ide-ai-result__content .code-toolbar{border-color:#30363d;background:#161b22}.ai-analysis-apply-toast{position:fixed;right:24px;bottom:24px;z-index:100001;width:min(360px,calc(100vw - 32px));padding:16px;border-radius:16px;background:linear-gradient(180deg,#fffbebfa,#fffffffa);border:1px solid rgba(249,115,22,.28);box-shadow:0 0 0 1px #fbbf242e,0 20px 48px #0f172a38;backdrop-filter:blur(10px);animation:ai-apply-toast-pop .22s ease-out}.ai-analysis-apply-toast__title{font-size:16px;font-weight:700;color:#c2410c;margin-bottom:8px}.ai-analysis-apply-toast__message{color:#334155;font-size:14px;line-height:1.6;margin-bottom:8px}.ai-analysis-apply-toast__actions{display:flex;gap:10px}.ai-analysis-apply-toast__reject,.ai-analysis-apply-toast__confirm{display:inline-flex;align-items:center;justify-content:center;flex:1 1 0;height:40px;padding:0 16px;border-radius:10px;font-size:14px;font-weight:700;cursor:pointer}.ai-analysis-apply-toast__reject{border:1px solid rgba(148,163,184,.45);background:#ffffffd1;color:#475569;box-shadow:inset 0 1px #ffffff80}.ai-analysis-apply-toast__confirm{border:none;background:linear-gradient(135deg,#f59e0b,#f97316);color:#fff;box-shadow:0 10px 24px #f9731647}.ai-analysis-apply-toast__reject:hover{background:#fffffff5;border-color:#64748b8c}.ai-analysis-apply-toast__confirm:hover{filter:brightness(1.06)}.ai-analysis-apply-toast__reject:active,.ai-analysis-apply-toast__confirm:active{transform:translateY(1px)}@keyframes ai-apply-toast-pop{0%{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}.theme--dark .problem-ide-ai-result__summary{background:#161b22;border-color:#30363d;color:#8b949e}.theme--dark .ai-analysis-apply-toast{background:linear-gradient(180deg,#361f08f5,#161b22f5);border-color:#f9731659;box-shadow:0 0 0 1px #fbbf241f,0 18px 40px #00000059}.theme--dark .ai-analysis-apply-toast__title{color:#fdba74}.theme--dark .ai-analysis-apply-toast__message{color:#c9d1d9}.theme--dark .ai-analysis-apply-toast__reject{background:#1e293bb8;border-color:#94a3b847;color:#cbd5e1;box-shadow:none}.theme--dark .ai-analysis-apply-toast__reject:hover{background:#334155e0;border-color:#94a3b866}@media (max-width: 1024px){.ai-analysis-dialog{width:95%;height:90vh}.ai-analysis-body{flex-direction:column}.ai-analysis-code-section{flex:none;max-height:40%;border-right:none;border-bottom:1px solid #eaecef}.theme--dark .ai-analysis-code-section{border-bottom-color:#21262d}.ai-analysis-ai-section{flex:1;min-height:200px}}@keyframes ai-confirm-fade-in{0%{opacity:0}to{opacity:1}}@keyframes ai-confirm-fade-out{0%{opacity:1}to{opacity:0}}@keyframes ai-confirm-zoom-in{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}@keyframes ai-confirm-zoom-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}.ai-confirm-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:99999;opacity:0}.ai-confirm-dialog{width:420px;max-width:90vw;background:#fff;border-radius:12px;box-shadow:0 8px 20px #00000029;padding:24px 32px 20px;box-sizing:border-box;opacity:0;transform:scale(.9)}.ai-confirm-enter-mask{animation:ai-confirm-fade-in .22s forwards}.ai-confirm-enter-dialog{animation:ai-confirm-zoom-in .22s forwards}.ai-confirm-leave-mask{animation:ai-confirm-fade-out .18s forwards}.ai-confirm-leave-dialog{animation:ai-confirm-zoom-out .18s forwards}.ai-confirm-header{display:flex;align-items:center;margin-bottom:16px}.ai-confirm-icon{width:36px;height:36px;border-radius:50%;background-color:#00b578;display:flex;align-items:center;justify-content:center;margin-right:12px;flex-shrink:0;color:#fff;font-size:22px}.ai-confirm-title{font-size:18px;font-weight:600;color:#333}.ai-confirm-content{font-size:14px;color:#666;line-height:1.6;margin-bottom:24px}.ai-confirm-footer{display:flex;justify-content:flex-end;gap:12px}.ai-confirm-btn{min-width:80px;height:32px;padding:0 14px;border-radius:4px;border:1px solid transparent;font-size:14px;cursor:pointer}.ai-confirm-btn:active{transform:translateY(1px)}.ai-confirm-btn:hover{filter:brightness(1.05)}.ai-confirm-btn-cancel{background:#f5f5f5;border-color:#d9d9d9;color:#333}.ai-confirm-btn-cancel:hover{background:#e0e0e0;border-color:#bfbfbf}.ai-confirm-btn-confirm{background:#4caf50;border-color:#4caf50;color:#fff}.ai-confirm-btn-confirm:hover{background:#45a049;border-color:#45a049}.theme--dark .ai-confirm-dialog{background:#161b22;box-shadow:0 8px 20px #0006}.theme--dark .ai-confirm-title{color:#c9d1d9}.theme--dark .ai-confirm-content{color:#8b949e}.theme--dark .ai-confirm-btn-cancel{background:#21262d;border-color:#30363d;color:#c9d1d9}.theme--dark .ai-confirm-btn-cancel:hover{background:#30363d;border-color:#484f58}.problem-ide-left .pd-note-card{background:#fff;padding:0;border-radius:12px;box-shadow:0 2px 8px #0000000f;margin:0 auto 16px;max-width:900px;overflow:hidden;position:relative}.problem-ide-left .pd-note-body{padding:18px 22px;min-height:120px;position:relative}.problem-ide-left .pd-note-main-slot{min-height:80px}.problem-ide-left .pd-note-preview{min-height:48px}.problem-ide-left .pd-note-preview .markdown-body{font-size:14px;line-height:1.7}.problem-ide-left .pd-note-view-empty{color:#bfbfbf;font-size:13px;text-align:center;padding:20px 0}.problem-ide-left .pd-note-editor{width:100%;min-height:140px;max-height:400px;border:1px solid #e8e8e8;border-radius:8px;padding:12px;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:13px;line-height:1.6;resize:vertical;outline:none;background:#fafafa;color:#262626;box-sizing:border-box}.problem-ide-left .pd-note-editor:focus{border-color:#1890ff;background:#fff}.problem-ide-left .pd-note-edit-meta{display:flex;justify-content:flex-end;margin-top:8px}.problem-ide-left .pd-note-draft-preview-inner{min-height:48px}.problem-ide-left .pd-note-draft-preview-inner .markdown-body{font-size:14px;line-height:1.7}.problem-ide-left .pd-note-live-preview-empty{color:#bfbfbf;font-size:13px;padding:16px 8px;text-align:center}.theme--dark .problem-ide-left .pd-note-live-preview-empty{color:#484f58}.problem-ide-left .pd-note-char-count{font-size:11px;color:#bfbfbf}.problem-ide-left .pd-note-action-row{display:flex;justify-content:flex-end;align-items:center;gap:10px;flex-wrap:wrap;margin-top:14px;padding-top:4px}.problem-ide-left .pd-note-primary-btn{padding:8px 22px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;transition:all .15s}.problem-ide-left .pd-note-primary-btn:disabled{opacity:.55;cursor:not-allowed;transform:none}.problem-ide-left .pd-note-btn--edit{background:#fff;color:#1890ff;border:2px solid #1890ff}.problem-ide-left .pd-note-btn--edit:hover{background:#e6f7ff}.problem-ide-left .pd-note-btn--save{border:none;background:linear-gradient(135deg,#35b2ff,#1182eb);color:#fff;box-shadow:0 2px 8px #35b2ff40}.problem-ide-left .pd-note-btn--save:hover:not(:disabled){opacity:.92;transform:translateY(-1px)}.theme--dark .problem-ide-left .pd-note-card{background:#21262d;box-shadow:0 2px 8px #0000004d}.theme--dark .problem-ide-left .pd-note-editor{background:#161b22;border-color:#30363d;color:#c9d1d9}.theme--dark .problem-ide-left .pd-note-editor:focus{border-color:#58a6ff;background:#0d1117}.theme--dark .problem-ide-left .pd-note-view-empty,.theme--dark .problem-ide-left .pd-note-char-count{color:#484f58}.theme--dark .problem-ide-left .pd-note-btn--edit{background:#21262d;color:#58a6ff;border-color:#58a6ff}.theme--dark .problem-ide-left .pd-note-btn--edit:hover{background:#1c3a4f}@media (max-width: 768px){.problem-ide-root{flex-direction:column;position:static;height:auto;min-height:100vh}.problem-ide-left{flex:none;max-width:100%;height:45vh;min-height:200px}.problem-ide-gutter{flex:0 0 5px;cursor:row-resize}.problem-ide-right{min-width:unset;flex:1;min-height:300px}.pretest-compare{flex-direction:column}.ai-analysis-apply-toast{right:16px;bottom:16px;width:calc(100vw - 32px)}}.ai-analysis-ai-section{flex:2;display:flex;flex-direction:column;min-width:0;min-height:0}.ai-analysis-ai-container{flex:1;min-height:0;background:#fafbfc;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;position:relative;overflow:hidden;border-radius:10px;border:1px solid #e5e7eb}.ai-analysis-ai-container .record-ai-stream-panel{width:100%}.record-ai-stream-html-root{contain:layout paint;min-height:1em}.ai-analysis-ai-container .record-ai-stream-panel.is-result{scrollbar-gutter:stable}.theme--dark .ai-analysis-ai-container{background:#0d1117;border-color:#21262d}html,body{overflow-x:hidden}.code-media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(max(260px,calc((100% - 50px) / 3)),1fr));gap:25px}.code-media-tile{position:relative;cursor:pointer;border-radius:12px;background-color:#fff;box-shadow:0 4px 12px #00000014;transition:transform .3s ease,box-shadow .3s ease;display:flex;align-items:center;max-width:100%;box-sizing:border-box;overflow:hidden}.code-media-tile:hover{transform:translateY(-3px) scale(1.01);box-shadow:0 8px 20px #0000001f;z-index:10}.code-tooltip{position:fixed;max-width:min(360px,90vw);background:#505050f2;color:#fff;padding:14px 16px;border-radius:10px;box-shadow:0 6px 18px #0000002e;font-size:.95em;line-height:1.6;z-index:9999;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .3s ease,visibility .15s ease}.code-tooltip .tooltip-title{font-weight:700;font-size:1.05em;margin-bottom:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.code-tooltip .tooltip-body{font-size:.92em;color:#eee;white-space:normal;word-break:break-word}.code-media-search-bar{display:flex;align-items:center;gap:12px;margin-bottom:16px;flex-wrap:wrap}.code-media-search-bar input[type=text]{flex:1;min-width:180px;padding:6px 10px;border-radius:6px;border:1px solid #ddd;font-size:.95em;box-sizing:border-box}.code-media-search-bar .owned-filter{display:flex;align-items:center;font-size:.9em;color:#444;user-select:none;cursor:pointer}.code-media-search-bar .owned-filter input[type=checkbox]{margin-right:6px}@media (max-width: 600px){.code-media-grid{gap:16px}}.code-media-thumb{width:140px;height:140px;object-fit:cover;border-radius:12px 0 0 12px;flex-shrink:0}.code-media-text{padding:20px;flex:1;min-width:0}.code-media-title{font-weight:700;font-size:1.2em;color:#111;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:8px}.code-media-desc{font-size:.9em;color:#666;height:3.6em;line-height:1.8;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;line-clamp:2}.code-media-badges{position:absolute;top:6px;right:6px;display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.code-media-badge{background-color:#28a745;color:#fff;padding:4px 10px;border-radius:15px;font-size:.8em;font-weight:700;white-space:nowrap}.code-media-badge-owned{background-color:#007bff}.code-media-wrapper{width:100%;box-sizing:border-box;padding:0 10px}.theme--dark .code-media-tile{background:#1e1e1e;box-shadow:0 4px 12px #00000073}.theme--dark .code-media-tile:hover{box-shadow:0 8px 20px #ffffff14}.theme--dark .code-media-title{color:#fafafa}.theme--dark .code-media-desc{color:#cfcfcf}.theme--dark .code-tooltip{background:#282828f5;color:#f2f2f2;box-shadow:0 6px 18px #000c}.theme--dark .code-tooltip .tooltip-body{color:#dcdcdc}.theme--dark .code-media-search-bar input[type=text]{background:#1a1a1a;color:#e6e6e6;border:1px solid #444}.theme--dark .code-media-search-bar input[type=text]::placeholder{color:#777}.theme--dark .owned-filter{color:#dcdcdc}.theme--dark .owned-filter input[type=checkbox]{filter:brightness(.85)}.theme--dark .code-media-wrapper,.theme--dark .page.section.transparent,.theme--dark .code-node-body{background-color:transparent}.theme--dark .code-tooltip{border:1px solid rgba(255,255,255,.08)}.practice-body{padding:10px 12px 12px!important}.cb-card.practice-card>.cb-card-body{overflow:visible}.practice-home-section{display:flex;flex-direction:column;gap:14px;margin-bottom:20px}.practice-group-tip-banner{position:relative;overflow:hidden;padding:16px 20px;border-radius:14px;background:linear-gradient(135deg,#2f89ff,#1e6fe0)}.practice-group-tip-banner__blob{position:absolute;border-radius:50%;background:#ffffff1a}.practice-group-tip-banner__blob--1{right:-20px;top:-20px;width:80px;height:80px}.practice-group-tip-banner__blob--2{right:30px;bottom:-30px;width:60px;height:60px;background:#ffffff14}.practice-group-tip-banner__inner{position:relative;z-index:1;display:flex;align-items:flex-start;gap:12px}.practice-group-tip-banner__icon{flex-shrink:0;margin-top:2px;animation:practice-group-tip-pulse 2s infinite}@keyframes practice-group-tip-pulse{0%,to{transform:scale(1)}50%{transform:scale(1.1)}}.practice-group-tip-banner__text{flex:1;min-width:0}.practice-group-tip-banner__title{font-size:15px;color:#fff;font-weight:600;line-height:1.5;margin-bottom:4px}.practice-group-tip-banner__sub{font-size:13px;color:#ffffffe6;line-height:1.6}.practice-group-tip-banner__actions{display:flex;align-items:center;gap:8px;flex-shrink:0;margin-left:8px}.practice-group-tip-banner__dismiss{cursor:pointer;font-size:22px;color:#ffffffb3;padding:4px;line-height:1;transition:color .2s;flex-shrink:0}.practice-group-tip-banner__dismiss:hover{color:#fff}.practice-guest{max-width:520px}.practice-guest-hint{margin:14px 0 0;font-size:13px;line-height:1.55;color:#5c6b86}.practice-guest-hint a{font-weight:600;color:#1677ff;text-decoration:none}.practice-guest-hint a:hover{text-decoration:underline}.practice-card-header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.practice-panel-stack{width:100%}.practice-panel[hidden]{display:none!important}.practice-view-switch{--switch-index: 0;position:relative;display:inline-grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:center;padding:4px;min-width:212px;border-radius:999px;background:#eef2f7;box-shadow:inset 0 0 0 1px #0f172a0f}.practice-view-switch:before{content:\"\";position:absolute;top:4px;bottom:4px;left:4px;width:calc(50% - 4px);border-radius:999px;background:#fff;box-shadow:0 4px 14px #0f172a1f;transform:translate(calc(var(--switch-index) * 100%));transition:transform .22s ease,background .22s ease,box-shadow .22s ease}.practice-view-switch[data-active-view=favorites]{--switch-index: 1}.practice-view-switch-btn{position:relative;z-index:1;border:none;background:transparent;border-radius:999px;padding:7px 14px;font-size:13px;font-weight:700;color:#5c6b86;cursor:pointer;transition:color .18s ease}.practice-view-switch-btn:hover,.practice-view-switch-btn:focus-visible{color:#24324d;outline:none}.practice-view-switch-btn--active{color:#1677ff}.practice-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(200px,34%);grid-template-rows:auto minmax(156px,1fr) auto auto;gap:8px 10px;align-items:stretch;min-height:264px}.practice-cell--heatmap{grid-column:1;grid-row:1 / 3;min-width:0;display:flex;flex-direction:column}.practice-cell--daily{grid-column:2;grid-row:1;min-width:0}.practice-cell--wordcloud{grid-column:2;grid-row:2;min-width:0;min-height:0;display:flex;flex-direction:column}.practice-cell--favorites{grid-column:1 / -1;grid-row:3;min-width:0}.practice-cell--recent{grid-column:1 / -1;grid-row:4}.practice-section--heatmap{flex:1;display:flex;flex-direction:column;min-height:0}.practice-section--heatmap .practice-heatmap-wrap{flex:1;min-height:0}.practice-section--wordcloud{flex:1;display:flex;flex-direction:column;min-height:0}.practice-wordcloud-outer{position:relative;flex:1;display:flex;flex-direction:column;min-height:0;width:100%}.practice-wordcloud-help{position:absolute;top:5px;right:5px;z-index:4;width:12px;height:12px;margin:0;padding:0;border:none;border-radius:50%;font-size:11px;font-weight:500;line-height:1;color:#5c6b86;background:#ffffffeb;box-shadow:0 0 0 1px #0f172a14;cursor:help;display:inline-flex;align-items:center;justify-content:center;transition:color .15s ease,background .15s ease,box-shadow .15s ease}.practice-wordcloud-help:hover,.practice-wordcloud-help:focus-visible{color:#24324d;background:#fff;box-shadow:0 0 0 1px #0f172a1f,0 2px 8px #0000000f;outline:none}@media (max-width: 640px){.practice-card-header{align-items:stretch}.practice-view-switch{width:100%;min-width:0}.practice-layout{grid-template-columns:1fr;grid-template-rows:auto;min-height:0}.practice-cell--heatmap,.practice-cell--daily,.practice-cell--wordcloud,.practice-cell--favorites,.practice-cell--recent{grid-column:1;grid-row:auto}.practice-wordcloud-outer .practice-wordcloud{min-height:148px}}.practice-section-label{display:inline-flex;align-items:center;gap:6px;font-size:14px;font-weight:800;letter-spacing:.01em;color:#24324d;margin-bottom:8px;user-select:none}.practice-label-icon{display:inline-flex;align-items:center;justify-content:center;width:15px;height:15px;color:#24324d;flex-shrink:0}.practice-label-icon svg{width:100%;height:100%;display:block}.practice-daily-card{display:flex;flex-direction:column;background:#f7f8fa;border:1px solid #e8eaed;border-radius:10px;padding:14px 16px;color:inherit;transition:box-shadow .18s ease,border-color .18s ease;height:100%;box-sizing:border-box}.practice-daily-card:hover{border-color:#d0d7e0;box-shadow:0 4px 14px #0000000f}.practice-daily-card-main{display:block;flex:1 1 auto;min-height:0;min-width:0;text-decoration:none!important;color:inherit}.practice-daily-card-main:hover{text-decoration:none!important}.practice-daily-card-label-hit{display:inline-flex;align-items:center;gap:6px;flex-shrink:0;min-width:0;text-decoration:none!important;color:inherit}.practice-daily-card-label-hit:hover{text-decoration:none!important}.practice-daily-card-ring-link{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;margin-left:4px;text-decoration:none!important;color:inherit}.practice-daily-card-ring-link:hover{text-decoration:none!important}.practice-daily-company-pill,.practice-daily-company-pill.practice-daily-company-pill--static{display:inline-flex;align-items:center;max-width:min(168px,46%);flex-shrink:1;min-width:0;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600;line-height:1.35;background:#f9f0ff;color:#531dab;border:1px solid rgba(83,29,171,.12);text-decoration:none!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}a.practice-daily-company-pill{color:#391085}a.practice-daily-company-pill:hover{background:#f3e8ff;border-color:#531dab38;text-decoration:none!important}.practice-daily-card--empty{cursor:default}.practice-daily-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}.practice-daily-card-head-left{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;min-width:0;flex:1}.practice-daily-card-icon{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;color:#1677ff;flex-shrink:0}.practice-daily-card-icon svg{width:100%;height:100%;display:block}.practice-daily-card-label{font-size:14px;font-weight:700;color:#1677ff;letter-spacing:.02em}.practice-daily-card-ring{width:22px;height:22px;border-radius:50%;border:2px solid #e4e6eb;flex-shrink:0;box-sizing:border-box}.practice-daily-card-body{min-width:0}.practice-daily-card-title{font-size:15px;font-weight:600;color:#1f1f1f;line-height:1.35;display:block;width:100%;max-width:100%;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.practice-daily-card-title--muted{color:#8b95a8;font-weight:500}.practice-daily-card-ring--passed{border-color:#22c55e;background:#22c55e;position:relative}.practice-daily-card-ring--passed:after{content:\"\";position:absolute;left:50%;top:45%;width:5px;height:9px;border:solid #fff;border-width:0 2px 2px 0;transform:translate(-50%,-50%) rotate(45deg);box-sizing:border-box}.practice-heatmap-wrap{overflow-x:auto;overflow-y:hidden;width:100%;min-height:0;flex:1;display:flex;flex-direction:column;-webkit-overflow-scrolling:touch}.practice-heatmap{display:flex;flex-direction:column;gap:0;flex:1;min-height:0;min-width:0}.heatmap-months{display:flex;align-items:flex-end;gap:0;margin-bottom:2px}.heatmap-month-label{font-size:11px;font-weight:600;color:#5c6b86;text-align:center;user-select:none;white-space:nowrap;line-height:1.15;overflow:visible;flex-shrink:0}.heatmap-grid{display:grid;grid-auto-flow:row;grid-template-rows:repeat(7,auto);gap:3px}.heatmap-cell{width:14px;height:14px;border-radius:6px;background:#ebedf0;transition:background .15s ease;position:relative}.heatmap-cell:hover{outline:1px solid #959da5;outline-offset:-1px}.heatmap-cell[data-count=\"0\"]{background:#ebedf0}.heatmap-cell.level-1{background:#9be9a8}.heatmap-cell.level-2{background:#40c463}.heatmap-cell.level-3{background:#30a14e}.heatmap-cell.level-4{background:#216e39}.heatmap-cell[title]{cursor:default}.practice-wordcloud-outer .practice-wordcloud{position:relative;flex:1;width:100%;min-height:152px;overflow:hidden;border-radius:8px;background:#f7f8fa;border:1px solid #e8eaed}.wordcloud-word{position:absolute;white-space:nowrap;font-weight:700;line-height:1.1;cursor:default;user-select:none;letter-spacing:.02em}.wordcloud-empty{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;font-size:12px;color:#9aa7bd;padding:12px;text-align:center}.practice-section--favorites{border-radius:12px;padding:1px 2px 2px;min-width:0}.practice-section--favorites-empty{padding-bottom:12px}.practice-favorites-page{min-height:264px}.practice-favorites-page .practice-section--favorites{height:100%;display:flex;flex-direction:column}.practice-fav-head{display:flex;align-items:center;justify-content:space-between;gap:8px 12px;flex-wrap:wrap;margin-bottom:6px}.practice-fav-head-main{display:inline-flex;align-items:center;gap:8px;min-width:0}.practice-section-label--fav{margin-bottom:0;font-size:13px}.practice-fav-count{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:999px;background:#eef4ff;border:1px solid #d6e4ff;color:#1677ff;font-size:11px;font-weight:700;line-height:1}.practice-fav-filters{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.practice-fav-filter-field{position:relative;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:8px;margin:0;padding:2px 4px 2px 10px;min-height:30px;box-sizing:border-box;border-radius:999px;background:#fff;border:1px solid #e6ebf2}.practice-fav-filter-label{display:inline-flex;align-items:center;flex:0 0 auto;margin:0;font-size:11px;font-weight:700;color:#7a879d;line-height:1;white-space:nowrap;cursor:pointer}.practice-fav-dd{position:relative;flex:1 1 auto;min-width:0;max-width:148px}.practice-fav-dd-trigger{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;min-height:24px;padding:2px 22px 2px 0;margin:0;border:none;border-radius:999px;background-color:transparent;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c6b86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right 2px center;background-size:12px;font-size:12px;font-weight:600;line-height:1.25;color:#24324d;text-align:left;cursor:pointer;outline:none}.practice-fav-dd-trigger:hover,.practice-fav-dd-trigger:focus-visible{color:#1677ff}.practice-fav-dd-trigger--open{color:#1677ff}.practice-fav-dd-panel{position:absolute;z-index:200;top:calc(100% + 6px);left:0;right:0;min-width:max(100%,148px);max-height:240px;overflow-y:auto;overflow-x:hidden;padding:6px;margin:0;list-style:none;border-radius:12px;border:1px solid #e0e6ef;background:#fff;box-shadow:0 10px 28px #0f172a1f,0 0 0 1px #0f172a0a;box-sizing:border-box;-webkit-overflow-scrolling:touch}.practice-fav-dd-option{display:block;width:100%;margin:0;padding:8px 10px;border:none;border-radius:8px;background:transparent;font-size:12px;font-weight:600;color:#24324d;text-align:left;cursor:pointer;transition:background .12s ease,color .12s ease}.practice-fav-dd-option:hover,.practice-fav-dd-option:focus-visible{outline:none;background:#f0f7ff;color:#1677ff}.practice-fav-dd-option--active{background:#e8f3ff;color:#0958d9}.practice-fav-select-sr{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;opacity:0;pointer-events:none}.practice-fav-scroll{max-height:200px;overflow-y:auto;overflow-x:hidden;border-radius:10px;background:linear-gradient(180deg,#fff,#fcfdff);border:1px solid #eceef2;padding:10px 10px 12px}.practice-favorites-page .practice-fav-scroll{flex:1;max-height:420px}.practice-fav-filter-empty{font-size:12px;color:#8b95a8;text-align:center;padding:16px 12px}.practice-fav-list{display:flex;flex-direction:column;gap:12px}.practice-fav-row{display:flex;flex-direction:row;align-items:flex-start;gap:12px 16px;padding:14px 16px 16px;border:1px solid #edf1f6;border-radius:12px;background:#fbfcfe;transition:border-color .16s ease,box-shadow .16s ease,background .16s ease}.practice-fav-row:hover{background:#fff;border-color:#dbe4f0;box-shadow:0 4px 14px #0f172a0d}.practice-fav-title-area{flex:1;min-width:0;display:flex;align-items:center;gap:8px}.practice-fav-right{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:6px 8px;max-width:min(56%,360px);flex-shrink:0}.practice-fav-title{font-size:14px;font-weight:700;color:#1f1f1f;text-decoration:none!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.practice-fav-title:hover{color:#1677ff}.practice-fav-record{flex-shrink:0;line-height:0;opacity:.78}.practice-fav-record:hover{opacity:1}.practice-fav-chip{font-size:11px;font-weight:600;padding:4px 10px;border-radius:999px;background:#eef2f7;color:#3d4f6f;border:1px solid #dce3ed;line-height:1.35}.practice-fav-chip--user{background:#e6f4ff;color:#0958d9;border-color:#91caff}.practice-fav-chip--alg{background:#e6fffb;color:#006d75;border:1px solid #87e8de}.practice-fav-company{display:inline-flex;flex-wrap:wrap;gap:4px 6px;align-items:center;max-width:100%}.practice-fav-co-chip{font-size:11px;font-weight:600;padding:3px 8px;border-radius:6px;background:#f9f0ff;color:#531dab;text-decoration:none!important;border:1px solid rgba(83,29,171,.12);max-width:72px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.practice-fav-co-chip:hover{background:#f3e8ff}.practice-fav-diff{font-size:11px;font-weight:700;padding:3px 9px;border-radius:6px;flex-shrink:0}.practice-fav-diff--easy{background:#f6ffed;color:#389e0d;border:1px solid #b7eb8f}.practice-fav-diff--medium{background:#fffbe6;color:#d48806;border:1px solid #ffe58f}.practice-fav-diff--hard{background:#fff2f0;color:#cf1322;border:1px solid #ffccc7}.practice-fav-empty-hint{margin:4px 0 0;font-size:12px;line-height:1.55;color:#8b95a8}.practice-fav-pagination{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px 14px;margin-top:8px;padding-top:8px;border-top:1px solid #eceef2}.practice-fav-page-btn{border:1px solid #d9dee8;background:#fff;border-radius:8px;padding:5px 14px;font-size:12px;font-weight:700;color:#24324d;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease}.practice-fav-page-btn:hover:not(:disabled){border-color:#1677ff;color:#1677ff;background:#f0f7ff}.practice-fav-page-btn:disabled{opacity:.45;cursor:not-allowed}.practice-fav-page-indicator{font-size:12px;font-weight:600;color:#5c6b86;user-select:none}@media (max-width: 640px){.practice-fav-head{align-items:stretch}.practice-fav-head-main{justify-content:space-between;width:100%}.practice-fav-filters{width:100%}.practice-fav-filter-field{flex:1 1 calc(50% - 3px);min-width:0;justify-content:space-between}.practice-fav-dd{min-width:0;max-width:none;width:100%}.practice-fav-dd-panel{left:0;right:auto;min-width:min(100vw - 32px,280px)}.practice-fav-row{flex-direction:column;align-items:stretch;gap:12px}.practice-fav-right{max-width:none;justify-content:flex-start}}.practice-section--recent .practice-section-label{margin-bottom:6px}.practice-section--recent .practice-ps-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px}.practice-section--recent .practice-ps-chip{display:flex;align-items:center;justify-content:flex-start;gap:10px;padding:12px 16px;min-height:48px;background:#f7f8fa;border:1px solid #e8eaed;border-radius:10px;font-size:14px;font-weight:600;color:#24324d!important;text-decoration:none!important;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease;width:100%;max-width:none;box-sizing:border-box}.practice-section--recent .practice-ps-chip:hover{background:#f0f2f5;border-color:#d0d7e0;box-shadow:0 2px 10px #0000000f}.practice-section--recent .practice-ps-icon{width:28px;height:28px;border-radius:6px;object-fit:cover;flex-shrink:0}.practice-ps-icon--default{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;flex-shrink:0;background:linear-gradient(145deg,#eceff3,#e2e6ec);color:#5c6b86}.practice-ps-icon--default svg{display:block}.practice-section--recent .practice-ps-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.theme--dark .practice-daily-card{background:#252a34;border-color:#353d4d}.theme--dark .practice-daily-card:hover{border-color:#455066;box-shadow:0 4px 16px #00000040}.theme--dark .practice-daily-card-label{color:#38bdf8}.theme--dark .practice-daily-card-title{color:#e8edf5}.theme--dark .practice-daily-card-title--muted{color:#7c8aa4}.theme--dark .practice-daily-card-ring{border-color:#3d4758}.theme--dark .practice-daily-card-ring--passed{border-color:#22c55e;background:#22c55e}.theme--dark .practice-daily-company-pill,.theme--dark .practice-daily-company-pill.practice-daily-company-pill--static{background:#1f1533;color:#d3adf7;border-color:#d3adf72e}.theme--dark a.practice-daily-company-pill{color:#efdbff}.theme--dark a.practice-daily-company-pill:hover{background:#2a1f42;border-color:#efdbff47}.theme--dark .practice-section-label{color:#d1dae8}.theme--dark .heatmap-month-label{color:#9aa8c4}.theme--dark .practice-ps-icon--default{background:linear-gradient(145deg,#323845,#2a303a);color:#9aa8c4}.theme--dark .practice-wordcloud-outer .practice-wordcloud{background:#252a34;border-color:#353d4d}.theme--dark .practice-wordcloud-help{color:#9aa8c4;background:#252a34eb;box-shadow:0 0 0 1px #ffffff14}.theme--dark .practice-wordcloud-help:hover,.theme--dark .practice-wordcloud-help:focus-visible{color:#e8edf5;background:#2c3340;box-shadow:0 0 0 1px #ffffff1f,0 2px 10px #00000040}.theme--dark .wordcloud-empty{color:#7c8aa4}.theme--dark .heatmap-cell[data-count=\"0\"],.theme--dark .heatmap-cell{background:#2d333b}.theme--dark .heatmap-cell.level-1{background:#0e4429}.theme--dark .heatmap-cell.level-2{background:#006d32}.theme--dark .heatmap-cell.level-3{background:#26a641}.theme--dark .heatmap-cell.level-4{background:#39d353}.theme--dark .practice-section--recent .practice-ps-chip{background:#323334;border-color:#395348;color:#d1dae8!important}.theme--dark .practice-section--recent .practice-ps-chip:hover{background:#323334;border-color:#395348;box-shadow:0 4px 16px #00000040}.theme--dark .practice-fav-count{background:#1677ff1f;border-color:#69b1ff33;color:#7cc4ff}.theme--dark .practice-fav-filter-field{background:#1c212b;border-color:#353d4d}.theme--dark .practice-fav-filter-label{color:#9aa8c4}.theme--dark .practice-fav-pagination{border-top-color:#353d4d}.theme--dark .practice-fav-page-btn{background:#1c212b;border-color:#3d4758;color:#d1dae8}.theme--dark .practice-fav-page-btn:hover:not(:disabled){border-color:#69b1ff;color:#7cc4ff;background:#111d2c}.theme--dark .practice-fav-page-indicator{color:#9aa8c4}.theme--dark .practice-view-switch{background:#1c212b;box-shadow:inset 0 0 0 1px #ffffff14}.theme--dark .practice-view-switch:before{background:#2c3340;box-shadow:0 4px 14px #00000042}.theme--dark .practice-view-switch-btn{color:#9aa8c4}.theme--dark .practice-view-switch-btn:hover,.theme--dark .practice-view-switch-btn:focus-visible{color:#e8edf5}.theme--dark .practice-view-switch-btn--active{color:#7cc4ff}.theme--dark .practice-fav-dd-trigger{color:#d1dae8;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa8c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E\")}.theme--dark .practice-fav-dd-trigger:hover,.theme--dark .practice-fav-dd-trigger:focus-visible,.theme--dark .practice-fav-dd-trigger--open{color:#7cc4ff}.theme--dark .practice-fav-dd-panel{background:#1c212b;border-color:#3d4758;box-shadow:0 12px 32px #00000059,0 0 0 1px #ffffff0f}.theme--dark .practice-fav-dd-option{color:#d1dae8}.theme--dark .practice-fav-dd-option:hover,.theme--dark .practice-fav-dd-option:focus-visible{background:#243047;color:#7cc4ff}.theme--dark .practice-fav-dd-option--active{background:#111d2c;color:#69b1ff}.theme--dark .practice-fav-scroll{background:linear-gradient(180deg,#171819,#242625);border-color:#353d4d}.theme--dark .practice-fav-row{background:#323334;border-color:#395348}.theme--dark .practice-fav-row:hover{background:#323334;border-color:#43506a;box-shadow:0 6px 16px #0000003d}.theme--dark .practice-fav-title{color:#e8edf5}.theme--dark .practice-fav-chip{background:#2d333b;color:#c5cedd;border-color:#3d4758}.theme--dark .practice-fav-chip--user{background:#111d2c;color:#69b1ff;border-color:#15395b}.theme--dark .practice-fav-chip--alg{background:#002329;color:#5cdbd3;border-color:#006d75}.theme--dark .practice-fav-co-chip{background:#1f1533;color:#d3adf7;border-color:#d3adf72e}.theme--dark .practice-fav-filter-empty,.theme--dark .practice-fav-empty-hint{color:#7c8aa4}\n";
document.head.appendChild(style);
(()=>{var Yd=Object.create;var Aa=Object.defineProperty;var Vd=Object.getOwnPropertyDescriptor;var Jd=Object.getOwnPropertyNames;var Kd=Object.getPrototypeOf,Qd=Object.prototype.hasOwnProperty;var Gd=(i,t,e)=>t in i?Aa(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Xd=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var Zd=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jd(t))!Qd.call(i,o)&&o!==e&&Aa(i,o,{get:()=>t[o],enumerable:!(n=Vd(t,o))||n.enumerable});return i};var ae=(i,t,e)=>(e=i!=null?Yd(Kd(i)):{},Zd(t||!i||!i.__esModule?Aa(e,"default",{value:i,enumerable:!0}):e,i));var p=(i,t,e)=>Gd(i,typeof t!="symbol"?t+"":t,e);var re=Xd((Zf,pl)=>{pl.exports=window.HydroExports});var Ko=ae(re()),ei=ae(re()),fn=ae(re()),gt=ae(re()),Ze=ae(re());function ml(i=""){let t=i;if(!t)return"";try{let e=JSON.parse(t);e[UserContext.viewLang]?t=e[UserContext.viewLang]:e[UserContext.viewLang.split(/_-/)[0]]?t=e[UserContext.viewLang.split(/_-/)[0]]:t=e[Object.keys(e)[0]]}catch(e){}return t}function fl(){let i=document.createElement("div");document.body.appendChild(i);let t=i.attachShadow({mode:"open"});t.innerHTML=`
`;let e=t.querySelector("#ai_chat");window.AI_CHAT_MOUNT=e,window.AI_CHAT_MOUNT_PORTAL=t.querySelector("#ai_chat_mount_portal");let n=document.createElement("script");n.src=`/assets/${UiContext.aiAssets.js}`,document.body.appendChild(n)}function ep(){let i=null;function t(){i||(i=document.createElement("div"),i.className="marker marker__toolbar marker__action",i.style.fontSize="24px",i.style.position="fixed",i.style.zIndex="1000",i.textContent="AI \u7B54\u7591",document.body.appendChild(i))}function e(){i&&(i.style.display="none",i.classList.remove("open"))}function n(o,r,a){t(),i.style.display="block",i.style.left=`${o+10}px`,i.style.top=`${r}px`,i.classList.add("open"),i.onclick=()=>{console.log(a),window.startChat(`\u9898\u76EE\u4E2D\u7684 "${a}" \u662F\u4EC0\u4E48\u610F\u601D\uFF1F`),e()}}document.addEventListener("mouseup",()=>{let o=window.getSelection();if(o.rangeCount===0)return;let r=o.getRangeAt(0);if(r.collapsed)return;let a=o.toString().trim();if(!a)return;let s=r.commonAncestorContainer;if(s.nodeType===3&&(s=s.parentNode),!(s instanceof Element)||!s.closest("[data-marker-enabled]"))return;let l=r.getBoundingClientRect();n(l.right,l.top,a)}),document.addEventListener("mousedown",o=>{i&&o.target!==i&&e()})}(0,ei.addPage)(new ei.NamedPage(["problem_detail"],async()=>{var i,t,e,n;!((i=UiContext.aiFeatures)!=null&&i.aiChat)||!UiContext.aiAssets||(Object.assign(window,{prependMessage:UiContext.aiChat.problem.prepend.replace("{problem}",ml((t=UiContext==null?void 0:UiContext.pdoc)==null?void 0:t.content)),AI_CHAT_SUGGESTIONS:UiContext.aiChat.problem.choices,AI_CHAT_STORAGE_KEY:`problem-${UiContext.pdoc.domainId}-${UiContext.pdoc.docId}`}),fl(),(n=(e=UiContext.aiChat)==null?void 0:e.problem)!=null&&n.selectText&&ep())}));(0,ei.addPage)(new ei.NamedPage(["problem_solution"],async()=>{var t,e,n;if(!((t=UiContext.aiFeatures)!=null&&t.aiChat)||!UiContext.aiAssets||!((n=(e=UiContext.aiChat)==null?void 0:e.solution)!=null&&n.enabled))return;let i=await ei.request.post("",{operation:"get_ai"});i.ps&&(Object.assign(window,{prependMessage:UiContext.aiChat.solution.prepend.replace("{problem}",ml(i.pdoc.content)).replace("{solution}",i.ps),AI_CHAT_SUGGESTIONS:UiContext.aiChat.solution.choices,AI_CHAT_STORAGE_KEY:`solution-${i.pdoc.domainId}-${i.pdoc.docId}`}),fl())}));(0,fn.addPage)(new fn.NamedPage("problem_detail",()=>{var e;if(UiContext.tdoc||!((e=UiContext.aiFeatures)!=null&&e.translate))return;function i(n){return/^[ -~—\n\r\t]+$/.test(n)}function t(){let n=(0,fn.$)('[name="problem-sidebar__open-scratchpad"]').parent().parent();(0,fn.$)(``).appendTo(n);let o=!1;(0,fn.$)(document).on("click",'[name="ai_translate"]',async()=>{o||(o=!0,fn.Notification.info("AI \u7FFB\u8BD1\u4E2D\uFF0C\u8FD9\u53EF\u80FD\u9700\u8981\u4E00\u5206\u949F\uFF0C\u8BF7\u7A0D\u5019..."),await fn.request.post("",{operation:"translate"}),window.location.href=`${window.location.href}?lang=zh`)})}try{if(JSON.parse(UiContext.pdoc.content).zh)return}catch(n){console.log(i(UiContext.pdoc.content)),i(UiContext.pdoc.content)&&t();return}t()}));var Zn={},Ia=!1;function ul(){new gt.InfoDialog({$body:gt.tpl`
`}).open()}(0,gt.addPage)(new gt.NamedPage("record_detail",()=>{var t;if((0,gt.$)(document).find(".section__title pass").length||!(0,gt.$)(document).find('[href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2F%3Fdownload%3Dtrue"]').length||!UserContext._id||!((t=UiContext.aiFeatures)!=null&&t.askai)&&!UiContext.askAi)return;let i=(0,gt.$)('');i.append(''),i.prependTo((0,gt.$)("dl.large.horizontal").parent().parent()),i.on("click",async()=>{if(Ia)return;Zn.final&&ul(),Ia=!0,gt.Notification.info("AI \u601D\u8003\u4E2D\uFF0C\u8FD9\u53EF\u80FD\u9700\u8981\u4E00\u5206\u949F\uFF0C\u8BF7\u7A0D\u5019...");let e=await gt.request.post("",{operation:"ask_ai"});if(Ia=!1,Zn=e,Zn.final&&(Zn.md||(Zn.message=await fetch("/markdown",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:Zn.message})}).then(n=>n.text())),gt.Notification.info("AI \u601D\u8003\u5B8C\u6210")),Zn.final===!1){gt.Notification.info("AI \u8FD8\u5728\u601D\u8003\uFF0C\u8BF7\u4E0D\u8981\u91CD\u590D\u70B9\u51FB");return}ul()}),(0,gt.$)(document).on("vjContentNew",e=>{(0,gt.$)(e).find(".section__title pass").length&&i.remove()})}));(0,Ze.addPage)(new Ze.AutoloadPage("wechat_login",async()=>{let i=(0,Ze.$)('[href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Foauth%2Fwechat%2Flogin"]'),t=(0,Ze.$)('[name="platform"][value="wechat"]'),e=n=>async o=>{if(n==="link"&&(0,Ze.$)(o.target.closest("form")).find('input[value="unlink_account"]').length)return;o.preventDefault();let{url:r,state:a}=await(n==="auth"?Ze.request.get("/oauth/wechat/login"):Ze.request.post("",{operation:"link_account",platform:"wechat"})),s=new Ze.InfoDialog({$body:(0,Ze.tpl)(Ko.React.createElement("div",{className:"text-center"},Ko.React.createElement("h2",null,(0,Ze.i18n)("Scan the QR code to login")),Ko.React.createElement("img",{src:r,width:"200",height:"200"}))),$action:Ze.tpl`${(0,Ze.i18n)("Cancel")} `}),l=setInterval(async()=>{let{ok:c,needUsername:u}=await Ze.request.get(`/wechat/check_scan?state=${a}`);if(c){if(s.close(),u&&n==="auth")for(;;){let d=await(0,Ze.prompt)((0,Ze.i18n)("Please set username"),{username:{type:"text",required:!0,autofocus:!0}});if(d!=null&&d.username){let{ok:h}=await Ze.request.post(`/wechat/check_scan?state=${a}`,{username:d.username});if(!h)await(0,Ze.alert)((0,Ze.i18n)("Username already exists"));else break}}window.location.href=`/oauth/wechat/callback?state=${a}`}},1e3);await s.open(),clearInterval(l)};i.on("click",e("auth")),t.on("click",e("link"))}));var ot=ae(re());function tp(){return/\/shore-share\/[a-f0-9]{24}(\/|$)/i.test(window.location.pathname)}function gl(){return(window.location.pathname.replace(/\/+$/,"")||"/").endsWith("/shore-share")}function np(i){let t=new URL(i,window.location.origin);return t.searchParams.set("signup","ok"),t.hash="shore-join-hint",t.pathname+t.search+t.hash}var bl="shoreShareJoinedSids";function vl(){try{let i=window.sessionStorage.getItem(bl);if(!i)return new Set;let t=JSON.parse(i);if(!Array.isArray(t))return new Set;let e=t.map(n=>String(n||"").trim()).filter(Boolean);return new Set(e)}catch(i){return new Set}}function ip(i){try{window.sessionStorage.setItem(bl,JSON.stringify(Array.from(i)))}catch(t){}}function op(i){if(!i)return;let t=vl();t.add(i),ip(t)}function yl(i,t){if(!i.length)return;let e=i.find(".shore-signup-btn").first();if(e.length&&(e.prop("disabled",!0),e.removeAttr("data-action"),e.text("\u5DF2\u62A5\u540D")),Number.isFinite(t)){let n=i.find(".shore-signup-count").first();n.length&&n.text(String(t))}}function rp(){if(!gl())return;let i=vl();i.size&&(0,ot.$)(".shore-card").each(function(){let t=(0,ot.$)(this),e=String(t.data("sid")||"");!e||!i.has(e)||yl(t)})}function ap(i){let t=Date.now(),e=i-t;if(!Number.isFinite(i))return"";if(e<=0)return"\u5DF2\u5F00\u59CB";let n=Math.floor(e/6e4),o=Math.floor(n/(24*60)),r=Math.floor(n%(24*60)/60),a=n%60;return o>0?`\u8DDD\u79BB\u5F00\u59CB ${o}\u5929${r}\u5C0F\u65F6`:r>0?`\u8DDD\u79BB\u5F00\u59CB ${r}\u5C0F\u65F6${a}\u5206\u949F`:`\u8DDD\u79BB\u5F00\u59CB ${Math.max(1,a)}\u5206\u949F`}function hl(){document.querySelectorAll(".shore-countdown[data-event-ts]").forEach(t=>{let e=t.getAttribute("data-event-ts")||"",n=Number(e),o=ap(n);o&&(t.textContent=o,o==="\u5DF2\u5F00\u59CB"&&t.classList.add("shore-card-warn"))})}(0,ot.addPage)(new ot.NamedPage(["shore_share_list","shore_share_detail"],async()=>{hl(),window.setInterval(hl,6e4),rp(),(0,ot.$)("#shore-join-hint").length&&new URLSearchParams(window.location.search).get("signup")==="ok"&&(ot.Notification.success("\u62A5\u540D\u6210\u529F\uFF01\u8BF7\u5728\u672C\u9875\u300C\u8FDB\u7FA4\u65B9\u5F0F\u300D\u4E2D\u67E5\u770B\u4E8C\u7EF4\u7801\u3002"),requestAnimationFrame(()=>{let e=document.getElementById("shore-join-hint");e&&e.scrollIntoView({behavior:"smooth",block:"start"})})),(0,ot.$)("#shore-toggle-qr-btn").on("click",function(){let t=(0,ot.$)("#shore-inline-qr-wrap"),e=(0,ot.$)(this);t.prop("hidden")===!1?(t.prop("hidden",!0),e.text("\u663E\u793A\u5FAE\u4FE1\u7FA4\u4E8C\u7EF4\u7801"),e.attr("aria-expanded","false")):(t.prop("hidden",!1),e.text("\u9690\u85CF\u5FAE\u4FE1\u7FA4\u4E8C\u7EF4\u7801"),e.attr("aria-expanded","true"))}),(0,ot.$)(".shore-card").on("click",function(t){if((0,ot.$)(t.target).closest(".shore-signup-btn, .shore-replay-btn, .shore-replay-gate-btn").length)return;let n=(0,ot.$)(this).data("detail-href");n&&(window.location.href=String(n))}),(0,ot.$)(".shore-replay-gate-btn").on("click",function(t){t.stopPropagation();let n=(0,ot.$)(this).data("action");if(n==="login"){window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Flogin";return}if(n==="vip"){window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Fvip";return}}),(0,ot.$)(".shore-signup-btn").on("click",function(t){t.stopPropagation();let e=(0,ot.$)(this),n=e.data("action");if(n==="login"){window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Flogin";return}if(n==="vip"){window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Fvip";return}if(e.prop("disabled"))return;let o=e.data("signup-url");if(!o)return;e.prop("disabled",!0);let r=String(e.text()||"").trim();e.text("\u62A5\u540D\u4E2D..."),(async()=>{var s,l,c;let a=!1;try{let u=await ot.request.post(String(o),{}),d=(s=u==null?void 0:u.data)!=null?s:u;if(d!=null&&d.ok){let v=e.closest(".shore-card"),w=String(e.data("sid")||v.data("sid")||"");if(yl(v,d.signupCount),op(w),a=!0,tp()){ot.Notification.success("\u62A5\u540D\u6210\u529F\uFF01\u8BF7\u5728\u672C\u9875\u300C\u8FDB\u7FA4\u65B9\u5F0F\u300D\u4E2D\u67E5\u770B\u4E8C\u7EF4\u7801\u3002"),window.location.href=`${window.location.pathname}?signup=ok#shore-join-hint`;return}if(gl()){let k=v.length?String(v.data("detail-href")||""):"";if(k){window.location.href=np(k);return}}ot.Notification.success("\u62A5\u540D\u6210\u529F");return}let h=typeof(d==null?void 0:d.message)=="string"&&d.message.trim()?d.message.trim():"\u62A5\u540D\u5931\u8D25";ot.Notification.error(h)}catch(u){let d=u,h=((c=(l=d==null?void 0:d.response)==null?void 0:l.data)==null?void 0:c.message)||(u instanceof Error?u.message:"")||"\u62A5\u540D\u5931\u8D25";ot.Notification.error(h)}finally{a||(e.prop("disabled",!1),e.text(r||"\u62A5\u540D"))}})()})}));var ti=ae(re()),Ha=5e3,sp=5;function xl(i){return i.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}(0,ti.addPage)(new ti.NamedPage(["problem_detail","problem_ide"],async()=>{var l,c;let i=document.getElementById("pd-problem-note-root");if(!i)return;let t=window.UiContext||{},e=String((c=(l=t.problemId)!=null?l:t.problemNumId)!=null?c:"");if(!e)return;let n=!1,o="",r="";function a(){let u=document.getElementById("pd-note-pane-saved"),d=document.getElementById("pd-note-pane-editor"),h=document.getElementById("pd-note-pane-draft"),v=document.getElementById("pd-note-view-pane"),w=document.getElementById("pd-note-draft-preview-inner"),k=document.getElementById("pd-note-editor"),L=document.getElementById("pd-note-char-count"),H=document.getElementById("pd-note-save-btn"),_=document.getElementById("pd-note-toggle-btn"),M=null,A=0,D=!1,$=!0;function q(){M&&(clearInterval(M),M=null)}function K(){L.textContent=`${k.value.length} / ${Ha}`}function ee(){r?v.innerHTML=`${r}
`:o?v.innerHTML=`${xl(o)}
`:v.innerHTML='\u6682\u65E0\u7B14\u8BB0\uFF0C\u70B9\u51FB\u300C\u7F16\u8F91\u300D\u5F00\u59CB\u7F16\u5199
'}function R(G){u.style.display=G==="saved"?"":"none",d.style.display=G==="editor"?"":"none",h.style.display=G==="draft"?"":"none"}function N(){q(),A++,D=!1,$=!0,R("saved"),H.style.display="none",_.style.display="",_.textContent="\u7F16\u8F91",_.classList.remove("pd-note-btn--save"),_.classList.add("pd-note-btn--edit"),_.disabled=!1}function Y(){q(),N(),_.disabled=!0;let G=sp;_.textContent=`${G}s \u540E\u53EF\u7F16\u8F91`,M=setInterval(()=>{G--,G<=0?(q(),_.disabled=!1,_.textContent="\u7F16\u8F91"):_.textContent=`${G}s \u540E\u53EF\u7F16\u8F91`},1e3)}function te(){H.style.display="",_.style.display="",_.classList.remove("pd-note-btn--save"),_.classList.add("pd-note-btn--edit"),_.disabled=!1,$?(_.textContent="\u9884\u89C8",R("editor")):(_.textContent="\u7F16\u8F91",R("draft"))}function ve(){q(),A++,D=!0,$=!0,k.value=o,K(),H.textContent="\u4FDD\u5B58",H.disabled=!1,te(),k.focus()}function ne(){w.innerHTML='\u6682\u65E0\u5185\u5BB9\u53EF\u9884\u89C8
'}async function pe(){let G=++A,Ee=k.value;if(!Ee.trim()){ne();return}if(Ee===o&&r){w.innerHTML=`${r}
`;return}try{let Je=await ti.request.post("/api/problem/note/preview",{pid:e,content:Ee});if(G!==A)return;if(Je.error){w.innerHTML=`${xl(String(Je.error))}
`;return}let J=Je.contentHtml||"";w.innerHTML=J?`${J}
`:'\uFF08\u7A7A\u5185\u5BB9\uFF09
'}catch(Je){if(G!==A)return;w.innerHTML='\u9884\u89C8\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5
'}}k.addEventListener("input",K),_.addEventListener("click",async()=>{if(!D){ve();return}$?($=!1,te(),await pe()):($=!0,te())}),H.addEventListener("click",async()=>{H.disabled=!0;let G=H.textContent;H.textContent="\u4FDD\u5B58\u4E2D...";try{let Ee=await ti.request.post("/api/problem/note/save",{pid:e,content:k.value});if(Ee.error){alert(Ee.error),H.disabled=!1,H.textContent=G||"\u4FDD\u5B58";return}if(!Ee.success){H.disabled=!1,H.textContent=G||"\u4FDD\u5B58";return}o=k.value,r=Ee.contentHtml||"",ee(),H.textContent="\u4FDD\u5B58",H.disabled=!1,Y()}catch(Ee){H.disabled=!1,H.textContent=G||"\u4FDD\u5B58"}}),(async()=>{try{let G=await ti.request.get(`/api/problem/note?pid=${encodeURIComponent(e)}`);if(G.error){v.innerHTML='\u7B14\u8BB0\u52A0\u8F7D\u5931\u8D25
';return}o=G.content||"",r=G.contentHtml||"",ee(),N()}catch(G){v.innerHTML='\u7B14\u8BB0\u52A0\u8F7D\u5931\u8D25
'}})()}function s(){n||(n=!0,i.innerHTML=`
\u4FDD\u5B58
\u7F16\u8F91
`,a())}window.addEventListener("pd-problem-note:tab-shown",()=>s()),setTimeout(()=>{if(window.location.hash.replace(/^#/,"")!=="myNote")return;let u=document.querySelector('.section__tab-header-item[data-type="myNote"]');u&&u.classList.contains("tab--active")&&s()},0)}));var gi=ae(re()),wl="/api/problem/star/save",Pa=3,Tl=6;function kl(i){if(!i)return[];try{let t=JSON.parse(i);return Array.isArray(t)?t.map(e=>String(e)):[]}catch(t){return[]}}function Qo(i){let t=[],e=new Set;for(let n of i){let o=String(n||"").trim().slice(0,Tl);if(!o)continue;let r=o.toLowerCase();if(!e.has(r)&&(e.add(r),t.push(o),t.length>=Pa))break}return t}(0,gi.addPage)(new gi.NamedPage(["problem_detail"],()=>{let i=document.getElementById("pd-star-root"),t=document.getElementById("pd-star-dialog"),e=document.getElementById("pd-star-trigger");if(!i||!t||!e)return;t.parentElement!==document.body&&document.body.appendChild(t);let n=String(i.getAttribute("data-pid")||"");if(!n)return;let o=document.getElementById("pd-star-tags-chips"),r=document.getElementById("pd-star-tag-input"),a=document.getElementById("pd-star-tags-count"),s=document.getElementById("pd-star-dialog-cancel"),l=document.getElementById("pd-star-dialog-confirm"),c=document.getElementById("pd-star-dialog-unstar"),u=document.getElementById("pd-star-dialog-title"),d=document.getElementById("pd-star-overlay-dismiss");if(!o||!r||!a||!s||!l||!c||!u||!d)return;let h=Qo(kl(i.getAttribute("data-initial-tags"))),v=i.getAttribute("data-starred")==="1";function w(A){A.key==="Escape"&&t.style.display!=="none"&&(A.preventDefault(),A.stopPropagation(),H())}function k(){o.innerHTML="";for(let A of h){let D=document.createElement("span");D.className="pd-star-tag-chip",D.dataset.tag=A;let $=document.createElement("span");$.textContent=A;let q=document.createElement("button");q.type="button",q.className="pd-star-tag-remove",q.setAttribute("aria-label","\u79FB\u9664"),q.textContent="\xD7",q.addEventListener("click",K=>{K.preventDefault(),h=h.filter(ee=>ee!==A),k()}),D.appendChild($),D.appendChild(q),o.appendChild(D)}a.textContent=String(h.length)}function L(){h=Qo(kl(i.getAttribute("data-initial-tags"))),v=i.getAttribute("data-starred")==="1",v?(u.textContent="\u7F16\u8F91\u6536\u85CF\u6807\u7B7E",c.style.display=""):(u.textContent="\u6536\u85CF\u9898\u76EE",c.style.display="none"),k(),r.value="",document.removeEventListener("keydown",w,!0),t.style.display="flex",t.setAttribute("aria-hidden","false"),document.addEventListener("keydown",w,!0),r.focus()}function H(){t.style.display="none",t.setAttribute("aria-hidden","true"),document.removeEventListener("keydown",w,!0)}function _(A){A?e.classList.add("activated"):e.classList.remove("activated"),i.setAttribute("data-starred",A?"1":"0"),v=A}function M(A){let D=document.getElementById("pd-alg-tags-block");if(!D)return;let $=D.querySelector(".pd-alg-tag-rest");D.querySelectorAll(".pd-user-star-tag").forEach(K=>K.remove());let q=document.createDocumentFragment();for(let K of A){let ee=document.createElement("span");ee.className="bp6-tag bp6-large bp6-minimal problem__tag-item tags hasjs--hide problem__tag-item--user-star pd-user-star-tag",ee.textContent=K,q.appendChild(ee)}$?D.insertBefore(q,$):D.appendChild(q)}d.addEventListener("click",()=>H()),e.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation(),L()}),r.addEventListener("keydown",A=>{var K,ee;if(A.key!=="Enter")return;A.preventDefault();let $=r.value.trim().slice(0,Tl);if(!$)return;if(h.length>=Pa){(ee=(K=window.Notification)==null?void 0:K.error)==null||ee.call(K,`\u6700\u591A ${Pa} \u4E2A\u6807\u7B7E`);return}let q=$.toLowerCase();if(h.some(R=>R.toLowerCase()===q)){r.value="";return}h=[...h,$],r.value="",k()}),s.addEventListener("click",()=>H()),c.addEventListener("click",async()=>{l.disabled=!0,c.disabled=!0;try{let A=await gi.request.post(wl,{pid:n,star:!1,tags:[]});if(A.error){alert(A.error);return}_(!1),h=[],i.setAttribute("data-initial-tags","[]"),M([]),H()}catch(A){alert("\u7F51\u7EDC\u9519\u8BEF\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{l.disabled=!1,c.disabled=!1}}),l.addEventListener("click",async()=>{let D=Qo(h);l.disabled=!0,c.disabled=!0;try{let $=await gi.request.post(wl,{pid:n,star:!0,tags:D});if($.error){alert($.error);return}_(!0);let q=Array.isArray($.tags)?Qo($.tags):D;h=q,i.setAttribute("data-initial-tags",JSON.stringify(q)),M(q),H()}catch($){alert("\u7F51\u7EDC\u9519\u8BEF\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}finally{l.disabled=!1,c.disabled=!1}})}));var ni=ae(re());(0,ni.addPage)(new ni.AutoloadPage("theme-toggle",async()=>{let i=(0,ni.$)("#theme-toggle"),t=(0,ni.$)(".theme-icon-sun"),e=(0,ni.$)(".theme-icon-moon"),n=()=>{var c;let s=document.documentElement;if(s.classList.contains("theme--dark"))return"dark";if(s.classList.contains("theme--light"))return"light";let l=(c=window.UserContext)==null?void 0:c.theme;return l==="dark"||l==="light"?l:"light"},o=s=>{s==="dark"?(t.hide(),e.show()):(t.show(),e.hide())},r=s=>{let l=document.documentElement,c=document.body;l.classList.remove("theme--light","theme--dark"),c.classList.remove("theme--light","theme--dark"),l.classList.add(`theme--${s}`),c.classList.add(`theme--${s}`),window.UserContext=window.UserContext||{},window.UserContext.theme=s,o(s)};r(n());async function a(s,l,c){let u=document.createElement("div");u.style.cssText=`
position: fixed;
inset: 0;
pointer-events: none;
z-index: 9999;
overflow: hidden;
`;let d=document.createElement("div"),h=Math.hypot(Math.max(s,window.innerWidth-s),Math.max(l,window.innerHeight-l));d.style.cssText=`
position: absolute;
border-radius: 50%;
transform: translate(-50%, -50%);
left: ${s}px;
top: ${l}px;
width: 0;
height: 0;
background: ${c==="dark"?"#121212":"#ffffff"};
transition: width 0.6s ease-out, height 0.6s ease-out;
`,u.appendChild(d),document.body.appendChild(u),await new Promise(v=>{requestAnimationFrame(()=>{d.style.width=`${h*2}px`,d.style.height=`${h*2}px`,setTimeout(v,600)})}),document.body.removeChild(u)}i.on("click",async s=>{var h,v;s.preventDefault();let c=n()==="dark"?"light":"dark",u=(h=s.clientX)!=null?h:window.innerWidth/2,d=(v=s.clientY)!=null?v:window.innerHeight/2;await a(u,d,c),r(c),fetch(`/set_theme/${c}`,{method:"GET",credentials:"include"}).catch(()=>{})})}));var Go=ae(re()),lp=new Set(["6767ee58e6094f31964d7d93","675d3cec3d0417fd41fa3f26","6747bf908288afbdeff4a6c1"]);(0,Go.addPage)(new Go.NamedPage(["course"],async()=>{window.toPsetOrUrl=function(i){if(/^https?:\/\//i.test(i)){window.open(i,"_blank");return}if(lp.has(i)){window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Falg";return}let e="/pset/"+encodeURIComponent(i);window.location.href=e}}));var kt=ae(re());(0,kt.addPage)(new kt.NamedPage(["problem_set"],async()=>{function i(t,e){var n=t.prop("checked"),o=e.val().trim();let r=(0,kt.$)(".ps-header.ps-card");for(let s of r){s=(0,kt.$)(s);var a=s.find("#have").text().indexOf("\u5DF2\u62E5\u6709")!==-1;let c=s.find("#name").text();(!n||a)&&c.indexOf(o)!==-1?s.show():s.hide()}}(0,kt.$)(document).ready(async function(){let t=(0,kt.$)(".search-header .primary.button"),e=(0,kt.$)("[name='search']"),n=(0,kt.$)("[name='haveBtn']");t.on("click",function(){i(n,e)}),n.on("change",function(){i(n,e)})})}));(0,kt.addPage)(new kt.NamedPage(["course"],async()=>{function i(t,e){var n=t.prop("checked"),o=e.val().trim();let r=(0,kt.$)(".ps-header.ps-card");for(let s of r){s=(0,kt.$)(s);var a=s.find("#have").text().indexOf("\u5DF2\u62E5\u6709")!==-1;let c=s.find("#name").text();(!n||a)&&c.indexOf(o)!==-1?s.show():s.hide()}}(0,kt.$)(document).ready(async function(){let t=(0,kt.$)(".search-header .primary.button"),e=(0,kt.$)("[name='search']"),n=(0,kt.$)("[name='haveBtn']");t.on("click",function(){i(n,e)}),n.on("change",function(){i(n,e)})})}));var he=ae(re());function cp(i){return i==="expand"?"expanded":"collapsed"}async function Da(i,t){let e=i.find('[name="training__section__expand"]'),n=i.find('[name="training__section__collapse"]');if(i.is(`.${t}, .animating`))return;i.addClass("animating");let o=i.find(".training__section__detail");t==="expanded"?await(0,he.slideDown)(o,300,{opacity:0},{opacity:1}):await(0,he.slideUp)(o,300,{opacity:1},{opacity:0}),i.addClass(t),i.removeClass(t==="expanded"?"collapsed":"expanded"),i.removeClass("animating"),t==="expanded"?(e.hide(),n.show()):(e.show(),n.hide())}async function Cl(i,t){let e=(0,he.$)(i.currentTarget).closest(".training__section");await Da(e,cp(t))}async function dp(i){let t=(0,he.$)(i.currentTarget).attr("href"),e=(0,he.$)(t).closest(".training__section");await Da(e,"expanded")}async function El(){let i=window.location.hash;if(i.startsWith("#node-")){let t=(0,he.$)(i).closest(".training__section");await Da(t,"expanded")}}async function pp(i){let t=(0,he.$)(i.currentTarget).attr("id"),e=(0,he.$)(".menu"),n=(0,he.$)(".message");t==="pdocs_tab"?(n.hide(),e.show()):(n.show(),e.hide())}async function up(i){(0,he.$)(i.currentTarget).prop("checked")?(0,he.$)(".problem__tag-link").show():(0,he.$)(".problem__tag-link").hide()}function mp(i){try{return new URL(i),!0}catch(t){return!1}}async function fp(i){if(i.target.parentElement.id!=="problem_link")return;i.preventDefault();let e=i.target.href.split("/").pop(),{data:n}=await he.request.get("/api/problem/detail",{domainId:"system",pid:e}),o=n;mp(o)&&window.open(o,"_blank"),window.open(i.target.href,"_blank")}(0,he.addPage)(new he.NamedPage(["problem_set_detail"],async()=>{(0,he.$)("a").click(t=>{fp(t)}),(0,he.$)(".problem__tag-link").removeAttr("href"),(0,he.$)(".problem__tag-link").hide(),(0,he.$)("#showTagsCheckbox").click(t=>up(t)),(0,he.$)(document).on("click",'[name="training__section__expand"]',t=>Cl(t,"expand")),(0,he.$)(document).on("click",'[name="training__section__collapse"]',t=>Cl(t,"collapse")),(0,he.$)(document).on("click","#menu-item-problem_set_detail > ul > li > a",t=>dp(t)),window.addEventListener("hashchange",El),(0,he.$)(El),(0,he.$)(document).on("click",".section__tab-header-item",t=>pp(t));function i(t){let e=["profile","pdocs","usage"];for(let n of e)n==t?((0,he.$)(`#${t}_tab`).addClass("tab--active"),(0,he.$)(`#${t}`).show()):((0,he.$)(`#${n}_tab`).removeClass("tab--active"),(0,he.$)(`#${n}`).hide())}(0,he.$)(document).ready(async function(){let t=["profile","pdocs","usage"];for(let o of t)(0,he.$)(`#${o}_tab`).click(function(){i(o)});(0,he.$)("#edit").click(function(){window.location.href=window.location.origin+`/pset/edit/${window.location.href.split("/").pop()}`}),i("profile");let e=(0,he.$)("#buy_separately");e.click(async function(){if(window.UserContext._id===0)return new he.InfoDialog({$body:he.tpl`
`}).open().then(async()=>{window.location.href=window.location.origin+"/login"});{let o=e.data("psid"),{qrcode_url:r}=await he.request.post(window.location.href,{psid:o,action:"buy_separately"});if(r){if(await new he.ConfirmDialog({$body:he.tpl`
微信扫码购买
`}).open()!=="yes")return;window.location.reload()}}});let n=(0,he.$)("#buy_group");n.click(async function(){if(window.UserContext._id===0)return new he.InfoDialog({$body:he.tpl`
`}).open().then(async()=>{window.location.href=window.location.origin+"/login"});{let o=n.data("gid");window.location.href=window.location.origin+"/buy/vip/"+o;return}})})}));var Un=ae(re());(0,Un.addPage)(new Un.NamedPage(["problem_set_edit"],async()=>{let i=document.getElementById("abbreviation-input"),t=document.getElementById("abbreviation-indicator"),e=document.querySelector('form[method="post"]');if(!i||!e||!t)return;let n=null,o="",r=e.querySelector('input[name="psid"]');r&&(o=r.value);async function a(u){if(!u||u.trim()==="")return!1;try{return(await Un.request.post("/pset/check/abbreviation",{abbreviation:u.trim(),psid:o||void 0})).count>0}catch(d){return console.error("\u68C0\u67E5 abbreviation \u5931\u8D25:",d),!1}}function s(u){if(t)switch(u){case"required":t.innerHTML='* ';break;case"exists":t.innerHTML='\u5DF2\u5B58\u5728 ';break;case"ok":t.innerHTML='\u2713 ';break;case"none":t.innerHTML="";break}}function l(){n&&clearTimeout(n),n=setTimeout(async()=>{let u=i.value.trim();if(u==="")s("required");else{let d=await a(u);s(d?"exists":"ok")}},500)}i.addEventListener("input",l),i.addEventListener("blur",l);let c=async u=>{let d=u.submitter;if(d&&d.name==="deletePs")return!0;u.preventDefault();let h=i.value.trim();if(h==="")return Un.Notification.error("\u7B80\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),s("required"),!1;if(await a(h))return Un.Notification.error("\u8BE5\u7B80\u79F0\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4F7F\u7528\u5176\u4ED6\u7B80\u79F0"),s("exists"),!1;e.removeEventListener("submit",c),e.submit()};e.addEventListener("submit",c)}));var Ke=ae(re());(0,Ke.addPage)(new Ke.NamedPage(["problem_set_edit"],()=>{if(window.location.href.indexOf("pset")!==-1){(0,Ke.$)("#overview").remove(),(0,Ke.$)("#overview_btn").remove(),(0,Ke.$)("#create_btn").addClass("active"),(0,Ke.$)("#create").addClass("active"),(0,Ke.$)("#create_btn").text("\u7F16\u8F91\u9898\u5E93");return}(0,Ke.$)(".moveup").on("click",async t=>{let e=(0,Ke.$)(t.target).data("psid"),o=(0,Ke.$)(t.target).closest(".overview-item");if(!e||e.length!==24){console.error("Invalid psid:",e),Ke.Notification.error((0,Ke.i18n)("\u65E0\u6548\u7684psid"));return}let r=Ke.request.post("/pset_move",{psid:e,direction:"up"}),a=o.prev(".overview-item");a.length?(o.insertBefore(a),Ke.Notification.success("\u4E0A\u79FB\u6210\u529F")):Ke.Notification.error("\u5DF2\u7ECF\u662F\u7B2C\u4E00\u4E2A\u4E86")}),(0,Ke.$)(".movedown").on("click",async t=>{let e=(0,Ke.$)(t.target).data("psid"),o=(0,Ke.$)(t.target).closest(".overview-item");if(!e||e.length!==24){console.error("Invalid psid:",e),Ke.Notification.error((0,Ke.i18n)("\u65E0\u6548\u7684psid"));return}let r=Ke.request.post("/pset_move",{psid:e,direction:"down"}),a=o.next(".overview-item");a.length?(o.insertAfter(a),Ke.Notification.success("\u4E0B\u79FB\u6210\u529F")):Ke.Notification.error("\u5DF2\u7ECF\u662F\u6700\u540E\u4E00\u4E2A\u4E86")})}));var Ae=ae(re());function hp(){let i=Ae._.map((0,Ae.$)('.domain-users tbody [type="checkbox"]:checked'),t=>(0,Ae.$)(t).closest("tr").attr("data-uid"));return i.length===0?(Ae.Notification.error((0,Ae.i18n)("Please select at least one user to perform this operation.")),null):i}async function gp(){let i=hp();if(!(i===null||await new Ae.ConfirmDialog({$body:Ae.tpl`
${(0,Ae.i18n)("Confirm removing the selected users?")}
`}).open()!=="yes"))try{await Ae.request.post("",{event:"del_users",uids:i,psid:window.location.pathname.split("/").pop()}),Ae.Notification.success("\u7528\u6237\u5DF2\u4ECE\u9898\u5E93\u79FB\u9664"),await(0,Ae.delay)(600),window.location.reload()}catch(e){Ae.Notification.error(e.message)}}(0,Ae.addPage)(new Ae.NamedPage(["problem_set_edit"],()=>{(0,Ae.$)('button[name="remove_selected"]').on("click",gp),(0,Ae.$)('button[name="add_user"]').on("click",async()=>{if(await new Ae.ConfirmDialog({$body:Ae.tpl`
`}).open()!=="yes")return;let t=(0,Ae.$)("#add_user_uid").val();if(!t){Ae.Notification.error((0,Ae.i18n)("\u8BF7\u8F93\u5165\u7528\u6237uid"));return}try{let e=await Ae.request.post("",{event:"add_user",uid:t,psid:window.location.pathname.split("/").pop()});e.code!==0?Ae.Notification.error(e.message):(Ae.Notification.success("\u7528\u6237\u5DF2\u6DFB\u52A0\u5230\u9898\u5E93"),await(0,Ae.delay)(600),window.location.reload())}catch(e){Ae.Notification.error(e.message)}})}));var ii=ae(re());var bp={cpp:"C++",c:"C",python:"Python",java:"Java",javascript:"JavaScript",go:"Go"},_l="official-solution-language-preference";function po(i){if(!i)return"";let t=i.toLowerCase().trim();return t==="c++"||t==="cpp"?"cpp":t}function vp(i){try{let t=po(i);t&&localStorage.setItem(_l,t)}catch(t){console.warn("\u4FDD\u5B58\u8BED\u8A00\u504F\u597D\u5931\u8D25:",t)}}function yp(){try{let i=localStorage.getItem(_l);return i?po(i):null}catch(i){return console.warn("\u8BFB\u53D6\u8BED\u8A00\u504F\u597D\u5931\u8D25:",i),null}}function Ll(i,t){return po(i)===po(t)}function Ml(i){let t=i.querySelectorAll(".language-switcher"),e=[],n=t[0];n&&n.querySelectorAll("pre").forEach(s=>{let l=s.querySelector("code"),c=Array.from((l==null?void 0:l.classList)||[]).find(d=>d.startsWith("language-")),u=c?c.replace("language-",""):"";if(u){let d=po(u);e.includes(d)||e.push(d)}});let o=yp(),r=o&&e.includes(o)?o:null;t.forEach(a=>{let s=a;if(s.dataset.switcherInited==="1")return;s.dataset.switcherInited="1";let l=a.querySelectorAll("pre"),c=l.length===1;if(l.length===0)return;let u=document.createElement("div");u.className="language-switcher-tabs";let d=0;r&&!c&&l.forEach((w,k)=>{let L=w.querySelector("code"),H=Array.from((L==null?void 0:L.classList)||[]).find(M=>M.startsWith("language-")),_=H?H.replace("language-",""):"";Ll(_,r)&&(d=k)}),l.forEach((w,k)=>{w.classList.add("language-switcher-panel");let L=w.querySelector("code"),H=Array.from((L==null?void 0:L.classList)||[]).find(A=>A.startsWith("language-")),_=H?H.replace("language-",""):`Code ${k+1}`,M=document.createElement("button");M.className="language-switcher-tab",M.textContent=bp[_.toLowerCase()]||_,M.dataset.languageSwitcherLang=_,M.dataset.languageSwitcherIndex=k.toString(),c?(M.classList.add("disabled"),M.disabled=!0):M.addEventListener("click",A=>{vp(_),document.querySelectorAll(".language-switcher").forEach(D=>{let $=D.querySelectorAll("pre"),q=D.querySelectorAll(".language-switcher-tab"),K=-1;q.forEach((ee,R)=>{Ll(ee.dataset.languageSwitcherLang||"",_)&&(K=R)}),K!==-1&&($.forEach((ee,R)=>{ee.classList.toggle("is-active",R===K)}),q.forEach((ee,R)=>{ee.classList.toggle("active",R===K)}))})}),u.appendChild(M)});let h=document.createElement("div");h.className="language-switcher-tabs-container",h.appendChild(u),a.insertBefore(h,a.firstChild),l.forEach((w,k)=>{w.classList.toggle("is-active",k===d)});let v=u.children[d];v&&v.classList.add("active")})}function Sl(){let i=document.getElementById("content-textSol");if(!i||i.dataset.languageSwitcherInited==="1")return;i.querySelectorAll(".code-switcher").forEach(e=>{e.classList.remove("code-switcher"),e.classList.add("language-switcher")}),Ml(i),i.dataset.languageSwitcherInited="1"}(0,ii.addPage)(new ii.NamedPage(["problem_detail","problem_ide"],async()=>{await new Promise(o=>setTimeout(o,100)),(0,ii.$)(".tab--active").attr("data-type")==="textSol"&&Sl(),(0,ii.$)(document).on("click","[data-type]",async o=>{(0,ii.$)(o.target).attr("data-type")==="textSol"&&(await new Promise(a=>setTimeout(a,50)),Sl())});let t=history.pushState,e=history.replaceState,n=o=>{if(!o||typeof o!="string")return o;try{let r=o.startsWith("http")?new URL(o):new URL(o,window.location.origin);if(r.searchParams.has("lang"))return r.searchParams.delete("lang"),o.startsWith("http")?r.toString():r.pathname+r.search+r.hash}catch(r){console.warn("CodeSwitchSection: URL \u89E3\u6790\u5931\u8D25",r)}return o};history.pushState=function(...o){return o[2]&&(o[2]=n(o[2])),t.apply(history,o)},history.replaceState=function(...o){return o[2]&&(o[2]=n(o[2])),e.apply(history,o)},window.addEventListener("popstate",()=>{let o=new URL(window.location.href);o.searchParams.has("lang")&&(o.searchParams.delete("lang"),window.history.replaceState({},"",o.toString()))})}));var oi=ae(re());var $a=0,Ba=class{constructor(){p(this,"container",null);p(this,"tocList",null);p(this,"items",[]);p(this,"activeId","");p(this,"isVisible",!1);p(this,"scrollHandler",null);p(this,"resizeHandler",null);p(this,"fixedTop",null);p(this,"scrollThreshold",null);this.init()}init(){(0,oi.$)(document).on("click","[data-type]",()=>{setTimeout(()=>this.checkAndUpdate(),100)}),(0,oi.$)(document).on("click",'[name="problem-sidebar__open-scratchpad"]',()=>{this.isVisible&&this.hideWithAnimation(()=>{this.hide()})}),window.addEventListener("pset-drawer-opened",()=>{this.isVisible&&this.hide()}),window.addEventListener("pset-drawer-closed",()=>{this.checkAndUpdate()}),setTimeout(()=>{this.checkAndUpdate()},200)}checkAndUpdate(){var l;if(document.querySelector(".split-view-view.allotment-module_splitViewView__MGZ6O.split-view-view-visible")!==null){this.isVisible&&this.hideWithAnimation(()=>{this.hide()});return}if(((l=window.UiContext)==null?void 0:l.have)!==!0){this.isVisible&&this.hideWithAnimation(()=>{this.hide()});return}if(document.body.classList.contains("pset-drawer-open")){this.isVisible&&this.hideWithAnimation(()=>{this.hide()});return}let o=(0,oi.$)(".tab--active").attr("data-type"),r=document.getElementById("content-textSol"),a=r?window.getComputedStyle(r).display:"none";o==="textSol"&&r&&(a!=="none"&&a!=="")?(this.isVisible||(this.show(),this.showWithAnimation()),this.updateTOC()):this.isVisible&&this.hideWithAnimation(()=>{this.hide()})}show(){let t=document.getElementById("rightSidebarCol");$a=t.offsetTop+t.offsetHeight,this.container=document.createElement("div"),this.container.className="solution-toc-container hide",this.container.innerHTML=`
`,this.tocList=this.container.querySelector(".solution-toc-list"),document.body.appendChild(this.container),this.isVisible=!0,this.calculateScrollThreshold(),this.setupScrollHandlers()}hide(){this.container&&(this.container.remove(),this.container=null,this.tocList=null,this.items=[],this.isVisible=!1,this.fixedTop=null,this.scrollThreshold=null,this.removeScrollHandlers())}destroy(){this.editModeCheckInterval&&(clearInterval(this.editModeCheckInterval),this.editModeCheckInterval=null),this.hide()}updateTOC(){let t=document.getElementById("content-textSol");if(!t||!this.tocList)return;this.items=[],this.tocList.innerHTML="";let e=t.querySelectorAll("h1, h2, h3, h4, h5, h6"),n=[];if(e.forEach(o=>{var l;let r=o,a=parseInt(o.tagName.substring(1)),s=((l=r.textContent)==null?void 0:l.trim())||"";s&&n.push({element:r,level:a,text:s})}),n.length===0){this.isVisible&&this.hideWithAnimation(()=>{this.hide()});return}n.forEach((o,r)=>{let{element:a,level:s,text:l}=o,c=`solution-heading-${r}`;a.id=c;let u={id:c,text:l,level:s,element:a};this.items.push(u);let d=document.createElement("li");d.className=`solution-toc-item solution-toc-item-level-${s}`,d.dataset.headingId=c;let h=document.createElement("a");h.className="solution-toc-link",h.textContent=l,h.style.cursor="pointer",h.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),this.scrollToHeading(a)}),d.appendChild(h),this.tocList.appendChild(d)}),this.updateActiveItem(),this.adjustPosition()}scrollToHeading(t){let e=t.getBoundingClientRect(),o=(window.pageYOffset||document.documentElement.scrollTop)+e.top-80;window.scrollTo({top:o,behavior:"smooth"}),setTimeout(()=>{this.updateActiveItem()},100)}updateActiveItem(){if(!this.tocList||this.items.length===0)return;let t=window.pageYOffset||document.documentElement.scrollTop,e=window.innerHeight,n=100,o="";for(let r=this.items.length-1;r>=0;r--){let a=this.items[r],s=a.element.getBoundingClientRect();if(t+s.top<=t+n){o=a.id;break}}if(!o&&this.items.length>0&&(o=this.items[0].id),o!==this.activeId){this.activeId=o,this.tocList.querySelectorAll(".solution-toc-item").forEach(a=>{a.classList.remove("active")});let r=this.tocList.querySelector(`.solution-toc-item[data-heading-id="${o}"]`);r&&(r.classList.add("active"),this.scrollActiveItemIntoView(r))}}scrollActiveItemIntoView(t){if(!this.container)return;let e=this.container.querySelector(".solution-toc-nav");if(!e)return;let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=o.top-n.top+e.scrollTop,a=r+o.height,s=e.scrollTop,l=e.clientHeight;rs+l&&e.scrollTo({top:a-l+8,behavior:"smooth"})}setupScrollHandlers(){this.scrollHandler=()=>{this.isVisible&&(this.updateActiveItem(),this.adjustPosition())},this.resizeHandler=()=>{this.isVisible&&this.adjustPosition()},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.resizeHandler,{passive:!0}),this.adjustPosition()}logContainerPosition(){if(!this.container)return;let t=this.container.getBoundingClientRect(),e=window.pageYOffset||document.documentElement.scrollTop,n=e+t.top;console.log("[SolutionTOC] \u76EE\u5F55\u4F4D\u7F6E:",{\u8DDD\u79BB\u9875\u9762\u9876\u90E8:`${n.toFixed(2)}px`,\u8DDD\u79BB\u89C6\u53E3\u9876\u90E8:`${t.top.toFixed(2)}px`,\u5F53\u524D\u6EDA\u52A8\u4F4D\u7F6E:`${e.toFixed(2)}px`,\u5BB9\u5668\u9AD8\u5EA6:`${t.height.toFixed(2)}px`,\u5B9A\u4F4D\u6A21\u5F0F:e<=300?"absolute (\u8DDF\u968F\u6EDA\u52A8)":"fixed (\u56FA\u5B9A\u89C6\u53E3)"})}removeScrollHandlers(){this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null)}adjustPosition(){if(!this.container)return;let t=window.pageYOffset||document.documentElement.scrollTop,e=document.querySelector(".section--problem-sidebar");if(!e){let a=document.getElementById("rightSidebarCol");if(!a)return;let s=a.getBoundingClientRect();this.updatePosition(s.left,s.width,t);return}let n=e.getBoundingClientRect(),o=n.left,r=n.width;this.updatePosition(o,r,t)}updatePosition(t,e,n){var r;if(!this.container)return;let o=(r=this.scrollThreshold)!=null?r:280;if(n<=o)this.container.style.position="absolute",this.container.style.left=`${t}px`,this.container.style.top=`${$a}px`,this.container.style.width=`${e}px`,this.fixedTop=null;else{if(this.fixedTop===null){let a=this.container.getBoundingClientRect();this.fixedTop=a.top}this.container.style.position="fixed",this.container.style.left=`${t}px`,this.container.style.top=`${this.fixedTop}px`,this.container.style.width=`${e}px`}}showWithAnimation(){this.container&&this.container.classList.contains("hide")&&(this.container.style.display="block",requestAnimationFrame(()=>{this.container&&this.container.classList.remove("hide")}))}hideWithAnimation(t){if(!this.container){t&&t();return}if(this.container.classList.contains("hide")){t&&t();return}this.container.classList.add("hide"),setTimeout(()=>{t&&t()},150)}calculateScrollThreshold(){if(!this.container)return;let t=this.container.offsetHeight||350,e=window.innerHeight,o=$a+t/2-e/2;this.scrollThreshold=Math.max(0,o)}getScrollThreshold(){var t;return(t=this.scrollThreshold)!=null?t:280}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}};(0,oi.addPage)(new oi.NamedPage(["problem_detail"],()=>{new Ba}));var bt=ae(re());function xp(i){try{let n=((i.includes("://")?new URL(i):{pathname:i}).pathname||i).split("/").filter(r=>r),o=n.indexOf("p");return o!==-1&&on);return e[e.length-1]||""}}(0,bt.addPage)(new bt.NamedPage(["problem_detail"],async()=>{let i=xp(window.location.href),{solutionSet:t}=await bt.request.post(`/p/${i}/checksol`)}));(0,bt.addPage)(new bt.NamedPage(["vip_solution"],async()=>{(0,bt.$)(document).ready(function(){(0,bt.$)("#p2psetDialog").appendTo("body")}),(0,bt.$)("#vip_btn").click(function(){let i=(0,bt.$)("#p2psetDialog");i.css("display")==="none"?(i.css("display","flex"),(0,bt.$)(".footer").hide()):i.css("display","none")}),(0,bt.$)("#remove_p2pset").click(function(){(0,bt.$)("#p2psetDialog").css("display","none")}),(0,bt.$)(".dialog").click(function(i){(0,bt.$)("#p2psetDialog").css("display")!=="none"&&i.target===i.currentTarget&&(0,bt.$)(this).css("display","none")}),(0,bt.$)(document).on("keydown",i=>{i.keyCode===27&&(0,bt.$)("#p2psetDialog").css("display","none")})}));var St=ae(re());function uo(i){i&&((0,St.$)(".problem_content").hide(),(0,St.$)(`#content-${i}`).show(),(0,St.$)(".tab--active").removeClass("tab--active"),(0,St.$)(`.section__tab-header-item[data-type="${i}"]`).first().addClass("tab--active"))}async function wp(i){let t=i.target;if(t.closest(".code-switcher")||t.classList.contains("code-switcher-tab"))return;i.preventDefault();let n=(0,St.$)(i.target).closest("[data-type]").attr("data-type");uo(n),n==="myNote"&&window.dispatchEvent(new CustomEvent("pd-problem-note:tab-shown")),setTimeout(()=>{let o=new URL(window.location.href);o.searchParams.has("lang")&&(o.searchParams.delete("lang"),window.history.replaceState({},"",o.toString()))},0)}(0,St.addPage)(new St.NamedPage(["problem_detail"],async()=>{let i=window.location.hash.replace(/^#/,"");if(i==="myNote"&&(0,St.$)('.section__tab-header-item[data-type="myNote"]').length)uo("myNote"),window.dispatchEvent(new CustomEvent("pd-problem-note:tab-shown"));else if(i==="videoSol"&&(0,St.$)('.section__tab-header-item[data-type="videoSol"]').length)uo("videoSol");else{let t=(0,St.$)(".tab--active").attr("data-type");t&&(0,St.$)(`#content-${t}`).show()}(0,St.$)("[data-type]").on("click",t=>wp(t)),window.addEventListener("hashchange",()=>{let t=window.location.hash.replace(/^#/,"");t==="myNote"&&(0,St.$)('.section__tab-header-item[data-type="myNote"]').length?(uo("myNote"),window.dispatchEvent(new CustomEvent("pd-problem-note:tab-shown"))):t==="videoSol"&&(0,St.$)('.section__tab-header-item[data-type="videoSol"]').length&&uo("videoSol")})}));var Dn=ae(re());function kp(){let i=document.createElement("style");i.textContent=`
.cursor {
animation: blink 1.0s infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
`,document.head.appendChild(i);let t=(0,Dn.$)("#homepage_bulletin div"),e=t.text();t.text(""),t.css("visibility","visible"),t.append('| ');let n=[...e],o=0,r=setInterval(()=>{o{(0,Dn.$)(".cursor").css({animation:"none",transition:"opacity 0.5s"}).fadeOut(300,function(){(0,Dn.$)(this).remove()})},2e3))},100)}(0,Dn.addPage)(new Dn.NamedPage(["homepage"],async()=>{(0,Dn.$)(document).ready(i=>{kp()})}));var Qe=ae(re());function Tp(){let i=Qe._.map((0,Qe.$)('tbody [data-checkbox-group="problem"]:checked'),t=>(0,Qe.$)(t).closest("tr").attr("data-pid"));return i.length===0?(Qe.Notification.error((0,Qe.i18n)("Please select at least one problem to perform this operation.")),null):i}async function Cp(){let t=Tp().join(",");if((0,Qe.$)(Qe.tpl`
${(0,Qe.i18n)("ChangeTag")}
`).appendTo(document.body),await new Qe.ActionDialog({$body:(0,Qe.$)(".dialog__body--problem-changetag > div")}).open()!=="ok")return;let n=(0,Qe.$)('[name="target_tag"]').val();n&&(await Qe.request.get(`${window.location.origin}/change_tag?pids=${t}&domainId=${window.UiContext.domain._id}&targetTag=${n}`),Qe.Notification.success((0,Qe.i18n)("\u6539\u53D8\u6807\u7B7E\u6210\u529F")),await(0,Qe.delay)(500),window.location.reload())}(0,Qe.addPage)(new Qe.NamedPage(["problem_main"],async()=>{(0,Qe.$)('[name="change_tag"]').click(async()=>{await Cp()})}));var Qt=ae(re());var jl={cpp:"C++",c:"C",python:"Python",java:"Java",javascript:"JavaScript",go:"Go"};async function Al(i){if(navigator.clipboard&&navigator.clipboard.writeText)try{return await navigator.clipboard.writeText(i),!0}catch(t){console.warn("Clipboard API \u5931\u8D25\uFF0C\u5C1D\u8BD5\u964D\u7EA7\u65B9\u6848",t)}try{let t=document.createElement("textarea");t.value=i,t.style.position="fixed",t.style.left="-9999px",t.style.top="-9999px",document.body.appendChild(t),t.select(),t.setSelectionRange(0,i.length);let e=document.execCommand("copy");return document.body.removeChild(t),e}catch(t){return console.error("\u6240\u6709\u590D\u5236\u65B9\u6CD5\u90FD\u5931\u8D25\u4E86",t),!1}}function Na(i){let t=document.createElement("button");return t.className="code-copy-btn",t.textContent="\u590D\u5236",t.addEventListener("click",async()=>{let e=i.textContent||"";await Al(e)?(t.classList.add("copied"),t.textContent="\u5DF2\u590D\u5236",setTimeout(()=>{t.classList.remove("copied"),t.textContent="\u590D\u5236"},2e3)):(t.textContent="\u590D\u5236\u5931\u8D25",setTimeout(()=>{t.textContent="\u590D\u5236"},2e3))}),t}function Ep(i){i.querySelectorAll("pre").forEach(e=>{var d,h;if(e.closest(".code-switcher")||e.dataset.standaloneInited==="1")return;e.dataset.standaloneInited="1";let n=e.querySelector("code");if(!n)return;let o=Array.from(n.classList).find(v=>v.startsWith("language-"));console.log("infoClass:",o);let r=o?o.replace("language-",""):"";if(console.log("lang:",r),!r||["cpp","python","java"].includes(r.toLowerCase())===!1){e.classList.remove("line-numbers");let v=document.createElement("div");v.className="simple-code-block",v.style.position="relative",(d=e.parentNode)==null||d.insertBefore(v,e),v.appendChild(e);let w=Na(n);w.style.top="8px",w.style.right="8px",v.appendChild(w);return}let a=document.createElement("div");a.className="code-switcher",(h=e.parentNode)==null||h.insertBefore(a,e),a.appendChild(e),e.classList.add("code-panel","is-active");let s=document.createElement("div");s.className="code-switcher-tabs-container";let l=document.createElement("div");l.className="code-switcher-tabs";let c=document.createElement("button");c.className="code-switcher-tab active disabled",c.textContent=jl[r.toLowerCase()]||r,c.disabled=!0,l.appendChild(c),s.appendChild(l);let u=Na(n);a.insertBefore(s,a.firstChild),a.appendChild(u)})}function Xo(i){i.querySelectorAll(".code-switcher").forEach(e=>{var u,d;let n=e;if(n.dataset.switcherInited==="1")return;n.dataset.switcherInited="1";let o=e.querySelectorAll("pre"),r=o.length===1,a=document.createElement("div");a.className="code-switcher-tabs";let s=(u=o[0])==null?void 0:u.querySelector("code");if(!s)return;let l=Na(s);l.addEventListener("click",async h=>{h.stopPropagation();let v=e.querySelector("pre.is-active"),w=v==null?void 0:v.querySelector("code");if(w){let k=w.textContent||"";await Al(k)&&(l.classList.add("copied"),l.textContent="\u5DF2\u590D\u5236",setTimeout(()=>{l.classList.remove("copied"),l.textContent="\u590D\u5236\u4EE3\u7801"},2e3))}},{capture:!0}),o.forEach((h,v)=>{h.classList.add("code-panel");let w=h.querySelector("code"),k=Array.from((w==null?void 0:w.classList)||[]).find(_=>_.startsWith("language-")),L=k?k.replace("language-",""):`Code ${v+1}`,H=document.createElement("button");H.className="code-switcher-tab",H.textContent=jl[L.toLowerCase()]||L,H.dataset.lang=L,H.dataset.index=v.toString(),r?(H.classList.add("disabled"),H.disabled=!0):H.addEventListener("click",_=>{document.querySelectorAll(".code-switcher").forEach(M=>{let A=M.querySelectorAll("pre"),D=M.querySelectorAll(".code-switcher-tab"),$=-1;D.forEach((q,K)=>{q.dataset.lang===L&&($=K)}),$!==-1&&(A.forEach((q,K)=>{q.classList.toggle("is-active",K===$)}),D.forEach((q,K)=>{q.classList.toggle("active",K===$)}))}),setTimeout(()=>{let M=new URL(window.location.href);M.searchParams.has("lang")&&(M.searchParams.delete("lang"),window.history.replaceState({},"",M.toString()))},0);try{if(document.querySelector(".inner-scratchpad")){let A=new CustomEvent("hot100:codeLanguageChanged",{detail:{lang:L},bubbles:!1,cancelable:!0});setTimeout(()=>{try{window.dispatchEvent(A)}catch(D){console.warn("CodeSwitcher: \u89E6\u53D1\u8BED\u8A00\u5207\u6362\u4E8B\u4EF6\u5931\u8D25",D)}},0)}}catch(M){console.warn("CodeSwitcher: \u51C6\u5907\u89E6\u53D1\u8BED\u8A00\u5207\u6362\u4E8B\u4EF6\u65F6\u51FA\u9519",M)}}),a.appendChild(H)});let c=document.createElement("div");c.className="code-switcher-tabs-container",c.appendChild(a),e.insertBefore(c,e.firstChild),e.appendChild(l),o.forEach((h,v)=>{h.classList.toggle("is-active",v===0)}),(d=a.firstChild)==null||d.classList.add("active")}),Ep(i)}var Gl=ae(re());var Zo=class{constructor(){p(this,"lockCounts",new WeakMap);p(this,"onUnlockCallbacks",()=>{})}setOnUnlockCallback(t){this.onUnlockCallbacks=t}lock(t){(Array.isArray(t)?t:[t]).forEach(n=>{if(!n)return;let o=this.lockCounts.get(n)||0;this.lockCounts.set(n,o+1),"disabled"in n&&(n.disabled=!0),n.classList.add("locked")})}unlock(t){(Array.isArray(t)?t:[t]).forEach(n=>{if(!n)return;let o=this.lockCounts.get(n)||0,r=Math.max(0,o-1);this.lockCounts.set(n,r),r===0&&("disabled"in n&&(n.disabled=!1),n.classList.remove("locked"))})}getLockCount(t){return this.lockCounts.get(t)||0}forceUnlock(t){(Array.isArray(t)?t:[t]).forEach(n=>{n&&(this.lockCounts.set(n,0),"disabled"in n&&(n.disabled=!1),n.classList.remove("locked"))})}};var tr=ae(re());function Lp(i,t){let e={ok:!0};if(i=i.trim(),i[0]!=="["||i[i.length-1]!=="]")return e.ok=!1,e.errorInfo="\u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u6570\u7EC4\uFF0C\u6570\u7EC4\u5E94\u5F53\u7528\u4E2D\u62EC\u53F7\u62EC\u8D77\u6765",e;if(/\n/.test(i))return e.ok=!1,e.errorInfo="\u4E00\u7EF4\u6570\u7EC4\u5185\u90E8\u4E0D\u5141\u8BB8\u6709\u6362\u884C",e;let n=i.slice(1,i.length-1).replace(/\s+/g,""),o=n.length===0?[]:n.split(",");for(let r=0;r0&&n===""?null:(n!==""&&t.push(n),t)}function Il(i){let t=i.trim();if(t[0]!=="["||t[t.length-1]!=="]")return-1;let e=t.slice(1,t.length-1).replace(/\s+/g,"");if(e.length===0)return 0;let n=Hl(e);return n===null?-1:n.length}function Fa(i,t,e,n=!1,o=!1,r=null){var u;let a={ok:!0};if(i=i.trim(),i[0]!=="["||i[i.length-1]!=="]")return a.ok=!1,a.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u6570\u7EC4\uFF0C\u6570\u7EC4\u5E94\u5F53\u7528\u4E2D\u62EC\u53F7\u62EC\u8D77\u6765`,a;if(e===1)return Lp(i,t);let s=i.slice(1,i.length-1).replace(/\s+/g,"");if(s.length===0)return a;let l=Hl(s);if(l===null)return a.ok=!1,a.errorInfo=`\u4E0D\u5408\u6CD5\u7684 ${t} \u6570\u7EC4\uFF0C\u5B58\u5728\u591A\u4F59\u9017\u53F7\u6216\u62EC\u53F7\u4E0D\u5339\u914D`,a;let c=l.length;if(o){if(n=!0,r===null)r=c;else if(c!==r)return a.ok=!1,a.errorInfo=`\u4E0D\u5408\u6CD5\u7684 ${t} \u6570\u7EC4\uFF1A\u6BCF\u4E00\u7EF4\u957F\u5EA6\u5FC5\u987B\u76F8\u7B49`,a}if(n&&l.length>0){let d=Il(l[0]);if(d===-1)return a.ok=!1,a.errorInfo=`\u4E0D\u5408\u6CD5\u7684 ${t} \u6570\u7EC4`,a;for(let h=1;h1)return e.ok=!1,e.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u4E8C\u53C9\u6811\uFF1A\u6839\u8282\u70B9\u4E3A null \u65F6\u4E0D\u80FD\u518D\u6709\u5176\u4ED6\u8282\u70B9`,e;for(let r=0;r0){let s=Math.floor((r-1)/2);if(o[s]==="null")return e.ok=!1,e.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u4E8C\u53C9\u6811\uFF1A\u7B2C ${r+1} \u4E2A\u4F4D\u7F6E\u7684\u8282\u70B9\u7684\u7236\u8282\u70B9\u4E3A\u7A7A`,e}}return e}function Ra(i,t){let e={ok:!0},n=!1;for(let[o,r]of t)if(i>=o&&i<=r){n=!0;break}if(!n){e.ok=!1;let o=t.map(([r,a])=>r===a?`${r}`:`[${r}, ${a}]`).join(", ");e.errorInfo=`\u503C ${i} \u4E0D\u5728\u5141\u8BB8\u7684\u8303\u56F4\u5185: ${o}`}return e}function Mp(i,t){let e=[];try{let n=i.trim();for(let o=0;o2&&n.substring(1,n.indexOf("]")).trim()!==""&&r++,e.push(r),o0){let l=n.indexOf("[",1);if(l===-1)break;let c=1,u=!1;for(let d=l+1;ds){n.ok=!1;let c=r===0?"\u7B2C\u4E00\u7EF4":r===1?"\u7B2C\u4E8C\u7EF4":`\u7B2C${r+1}\u7EF4`;return a===s?n.errorInfo=`${c}\u957F\u5EA6\u5FC5\u987B\u662F ${a}\uFF0C\u5B9E\u9645\u957F\u5EA6\u4E3A ${l}`:n.errorInfo=`${c}\u957F\u5EA6\u5FC5\u987B\u5728 [${a}, ${s}] \u8303\u56F4\u5185\uFF0C\u5B9E\u9645\u957F\u5EA6\u4E3A ${l}`,n}}return n}function jp(i,t,e){let n={ok:!0};try{let o=JSON.parse(i),r=a=>{if(Array.isArray(a))for(let s of a){let l=r(s);if(!l.ok)return l}else{let s;if(t==="Int")s=parseInt(a);else if(t==="Float")s=parseFloat(a);else return{ok:!0};let l=Ra(s,e);if(!l.ok)return l}return{ok:!0}};return r(o)}catch(o){return n}}function mo(i,t,e){i=i.trim();let n={ok:!0};if(t==="Int"){if(!/^-?\d+$/.test(i))return n.ok=!1,n.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u6574\u6570`,n;if(e&&e.length>0){let o=parseInt(i),r=Ra(o,e);if(!r.ok)return r}}else if(t==="Float"){if(!/^-?\d+(\.\d+)?$/.test(i))return n.ok=!1,n.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u6D6E\u70B9\u6570`,n;if(e&&e.length>0){let o=parseFloat(i),r=Ra(o,e);if(!r.ok)return r}}else if(t==="String"){if(!/^".*"$/.test(i))return n.ok=!1,n.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u5B57\u7B26\u4E32\uFF0C\u5B57\u7B26\u4E32\u5E94\u5F53\u7528\u53CC\u5F15\u53F7\u62EC\u8D77\u6765`,n}else t==="Boolean"&&i!=="true"&&i!=="false"&&(n.ok=!1,n.errorInfo=`${i} \u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u7684\u5E03\u5C14\u503C\uFF0C\u5E94\u5F53\u662Ftrue\u6216false`);return n}function Ap(i,t,e,n,o,r,a){if(t==="Single")return mo(i,e,r);if(t.startsWith("Array_")||t==="LinkedList"){let s=parseInt(t.split("_")[1]),l=Fa(i,e,s,n,o);if(!l.ok)return l;if(a&&a.length>0){let c=Sp(i,s,a);if(!c.ok)return c}if(r&&r.length>0&&(e==="Int"||e==="Float")){let c=jp(i,e,r);if(!c.ok)return c}return{ok:!0}}else if(t==="Tree")return Pl(i,e);return{ok:!0}}function Ip(i,t){let e={ok:!0,caseIdx:0};return i.map(n=>n.trim()).forEach((n,o)=>{var a,s;if(n==="")return e.ok=!1,e.paramIdx=o,e.errorInfo="\u4E0D\u80FD\u4E3A\u7A7A\u884C\uFF01",e;if(/\n/.test(n)&&(t[0].paramInstances[o].structure==="Single"||t[0].paramInstances[o].structure==="Array_1"))return e.ok=!1,e.paramIdx=o,e.errorInfo="\u5185\u90E8\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\u6362\u884C\uFF01",e;if(/^\s+|\s+$/.test(n)&&t[0].paramInstances[o].structure==="Single"&&t[0].paramInstances[o].elementType!=="String")return e.ok=!1,e.paramIdx=o,e.errorInfo="\u5185\u90E8\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\u7A7A\u683C\uFF01",e;if(!t[0].paramInstances[o].structure||!t[0].paramInstances[o].elementType)throw new Error("\u81EA\u6D4B\u7528\u4F8B\u53C2\u6570\u4FE1\u606F\u4E0D\u5B8C\u6574\uFF0C\u65E0\u6CD5\u68C0\u67E5\uFF01");let r=Ap(n,t[0].paramInstances[o].structure,t[0].paramInstances[o].elementType,(a=t[0].paramInstances[o].isSameLength)!=null?a:!0,(s=t[0].paramInstances[o].isStrictSquare)!=null?s:!1,t[0].paramInstances[o].range,t[0].paramInstances[o].lengthRange);if(!r.ok)return e.ok=!1,e.paramIdx=o,e.errorInfo=r.errorInfo,e}),e}var qa={checkInput:Ip};var er={STATUS_ACCEPTED:"\u2713 \u5B8C\u5168\u901A\u8FC7",STATUS_WRONG_ANSWER:"\u7B54\u6848\u9519\u8BEF",STATUS_TIME_LIMIT_EXCEEDED:"\u65F6\u95F4\u8D85\u9650",STATUS_MEMORY_LIMIT_EXCEEDED:"\u5185\u5B58\u8D85\u9650",STATUS_OUTPUT_LIMIT_EXCEEDED:"\u8F93\u51FA\u8D85\u9650",STATUS_RUNTIME_ERROR:"\u8FD0\u884C\u9519\u8BEF",STATUS_COMPILE_ERROR:"\u7F16\u8BD1\u9519\u8BEF",STATUS_SYSTEM_ERROR:"\u7CFB\u7EDF\u9519\u8BEF"},za={STATUS_ACCEPTED:"\u7A0B\u5E8F\u8F93\u51FA\u6B63\u5E38\uFF0C\u65E0\u9519\u8BEF\u4FE1\u606F\u3002",STATUS_WRONG_ANSWER:"\u8BF7\u68C0\u67E5\u8F93\u51FA\u683C\u5F0F\u4EE5\u53CA\u903B\u8F91\u6B63\u786E\u6027\u3002",STATUS_TIME_LIMIT_EXCEEDED:"\u8BF7\u4F18\u5316\u7B97\u6CD5\uFF0C\u51CF\u5C11\u4E0D\u5FC5\u8981\u7684\u8BA1\u7B97\u4EE5\u53CA\u68C0\u67E5\u6B7B\u5FAA\u73AF\u3002",STATUS_MEMORY_LIMIT_EXCEEDED:"\u8BF7\u4F18\u5316\u6570\u636E\u7ED3\u6784\u6216\u51CF\u5C11\u5185\u5B58\u5F00\u8F9F\u3002",STATUS_OUTPUT_LIMIT_EXCEEDED:"\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u65E0\u9650\u8F93\u51FA\u7684\u60C5\u51B5\u3002",STATUS_RUNTIME_ERROR:"\u8BF7\u68C0\u67E5\u4EE3\u7801\u662F\u5426\u6709\u975E\u6CD5\u64CD\u4F5C\uFF0C\u5982\u9664\u96F6\u3001\u6570\u7EC4\u8D8A\u754C\u7B49\u3002",STATUS_SYSTEM_ERROR:"\u7CFB\u7EDF\u51FA\u73B0\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u6216\u8054\u7CFB\u7BA1\u7406\u5458\u3002",STATUS_COMPILE_ERROR:"\u8BF7\u6839\u636E\u7F16\u8BD1\u4FE1\u606F\u4FEE\u6539\u4EE3\u7801\u540E\u91CD\u8BD5:"},Wn=new Set(["STATUS_ACCEPTED","STATUS_WRONG_ANSWER","STATUS_TIME_LIMIT_EXCEEDED","STATUS_MEMORY_LIMIT_EXCEEDED","STATUS_OUTPUT_LIMIT_EXCEEDED","STATUS_RUNTIME_ERROR","STATUS_COMPILE_ERROR","STATUS_SYSTEM_ERROR"]);var nr=class{constructor(t){this.opts=t;p(this,"ws",null);p(this,"docId",null);p(this,"submitType",null);p(this,"STATUS",{});p(this,"testDataNum",0);p(this,"templateCode",null);p(this,"stdRunner",null);p(this,"submitRid",null);p(this,"mode","leetcode");p(this,"testCaseInstances",[]);p(this,"currentTestCaseInstances",[]);p(this,"currentTestCaseResults",[]);p(this,"userResult",null);p(this,"stdResult",null);p(this,"info",null);p(this,"reconnectAttempts",0);p(this,"maxReconnectAttempts",5);p(this,"reconnectDelay",2e3);p(this,"todoFinalMsg",{});p(this,"processedRids",new Set);p(this,"availableLangKeys",[]);p(this,"reconnectTimer",null)}async init(){try{this.info=await this.fetchIDEInfo(this.opts.pid)}catch(t){throw t}this.docId=this.info.docId,this.STATUS=this.info.STATUS,this.testDataNum=this.info.testDataNum,this.templateCode=this.info.templateCode,this.mode=this.info.mode||"acm",this.availableLangKeys=this.info.availableLangKeys||[],this.testCaseInstances=this.info.testCaseInstances,this.currentTestCaseInstances=JSON.parse(JSON.stringify(this.testCaseInstances)),this.stdRunner={langKey:this.info.stdLang,code:this.info.stdCode};try{await this.initWebSocket()}catch(t){throw t}return this.info}getTemplateCode(){return this.templateCode}getTestCaseInstances(){return this.testCaseInstances}getDocId(){return this.docId}getTestCaseResults(){return this.currentTestCaseResults}handleTodoFinalMsg(t){let e=this.todoFinalMsg[t];e&&(this.handleWebSocketMessage(e),delete this.todoFinalMsg[t])}async runStdCode(t){if(!this.stdRunner)throw new Error("\u672A\u914D\u7F6E stdRunner\uFF0C\u65E0\u6CD5\u8BA1\u7B97\u9884\u671F\u8F93\u51FA");let{langKey:e,code:n}=this.stdRunner;if(this.availableLangKeys.includes(e)==!1)throw new Error(`\u6807\u51C6\u7B54\u6848\u8BED\u8A00 ${e} \u4E0D\u88AB\u652F\u6301`);let o=`/p/${this.opts.pid}/submit`,r={lang:e,code:n,pretest:!0,input:t.trim()},a=await tr.request.post(o,r);this.stdRunner.rid=a.rid,this.handleTodoFinalMsg(this.stdRunner.rid||"")}async runCode(t,e,n,o){var l,c;if(!this.docId)throw new Error("\u8BC4\u6D4B\u673A \u672A\u521D\u59CB\u5316\u5B8C\u6210");if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket \u672A\u8FDE\u63A5");if(this.availableLangKeys.includes(e)==!1)throw new Error(`\u6807\u51C6\u7B54\u6848\u8BED\u8A00 ${e} \u4E0D\u88AB\u652F\u6301`);let r={lang:e,code:t,pretest:n==="pretest"};if(n==="pretest"){if(!o)throw new Error("EmptyInput");let u=o[0].paramInstances.map(d=>d.value.trim()||"").join(`
`);if(this.mode=="leetcode"){let d=qa.checkInput(u.split(`
`),o);if(!d.ok)throw(c=(l=this.opts).onSelfTestInputFormatError)==null||c.call(l,d),new Error("ErrorInput")}r.input=u,this.currentTestCaseInstances=JSON.parse(JSON.stringify(o))}let a=`/p/${this.opts.pid}/submit`;this.submitType=n,this.userResult=null,this.stdResult=null,this.submitRid=null,this.processedRids.clear(),this.stdRunner&&(this.stdRunner.rid=void 0);let s=await tr.request.post(a,r);this.submitRid=s.rid,this.handleTodoFinalMsg(this.submitRid||"")}async fetchIDEInfo(t){let e=await tr.request.get("/IDEInfo",{pid:t});if(!e.docId||!e.STATUS||!e.testDataNum||!e.mode)throw new Error("\u4EE3\u7801\u7F16\u8F91\u5668\u65E0\u6CD5\u83B7\u53D6\u6570\u636E");if(e.mode=="leetcode"&&(!e.stdCode||!e.stdLang))throw new Error("\u4EE3\u7801\u7F16\u8F91\u5668\u65E0\u6CD5\u83B7\u53D6\u6570\u636E");return e}isConnected(){return this.ws!==null&&this.ws.readyState===WebSocket.OPEN}scheduleReconnect(){if(this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectAttempts>=this.maxReconnectAttempts){this.opts.onError&&this.opts.onError(new Error("\u8FDE\u63A5\u5931\u8D25\u6B21\u6570\u8FC7\u591A\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5"));return}this.reconnectAttempts++;let t=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1),3e4);this.reconnectTimer=window.setTimeout(()=>{this.reconnect()},t)}async reconnect(){this.ws&&this.ws.readyState===WebSocket.OPEN||await this.initWebSocket()}handleWebSocketMessage(t){let e=t.rdoc||{},n=e._id,o=this.STATUS[e.status];return Wn.has(o)&&this.processedRids.has(n)?!0:n===this.submitRid&&this.submitRid?(this.handleUserWebSocketMessage(t),Wn.has(o)&&this.processedRids.add(n),!0):this.submitType=="pretest"&&this.stdRunner&&n===this.stdRunner.rid?(this.handleStdWebSocketMessage(t),Wn.has(o)&&this.processedRids.add(n),!0):!1}getWsUrl(t){let e=this.opts.wsPrefix;return e&&(e.startsWith("ws://")||e.startsWith("wss://"))?e+t:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/${t}`}async initWebSocket(){let{domainId:t,userId:e}=this.opts,n=`record-conn?pretest=1&uidOrName=${e}&pid=${this.opts.pid}&domainId=${t}`,o=this.getWsUrl(n);try{this.ws=new WebSocket(o)}catch(r){throw new Error(`WebSocket \u8FDE\u63A5\u5931\u8D25 (${o}): ${r.message}`)}this.ws.onopen=()=>{var r,a;this.reconnectAttempts=0,(a=(r=this.opts).onConnect)==null||a.call(r)},this.ws.onmessage=r=>{var l;let a=r.data;if(a==="ping"){(l=this.ws)==null||l.send("pong");return}let s=JSON.parse(a);if(!this.handleWebSocketMessage(s)){let c=s.rdoc||{};Wn.has(this.STATUS[c.status])&&(this.todoFinalMsg[s.rdoc._id]=s)}},this.ws.onclose=()=>{var r,a;this.ws=null,(a=(r=this.opts).onDisconnect)==null||a.call(r),this.scheduleReconnect()},this.ws.onerror=r=>{var a,s;(s=(a=this.opts).onError)==null||s.call(a,r)}}handleStdWebSocketMessage(t){var o,r,a,s;let e=t.rdoc||{},n=this.STATUS[e.status];if(Wn.has(n))if(n==="STATUS_ACCEPTED"){let l=(((r=(o=e.testCases)==null?void 0:o[0])==null?void 0:r.message)||"").trim();this.stdResult={completed:!0,output:l},this.tryProcessResults()}else{let l=new Error(`\u6807\u51C6\u7B54\u6848\u8FD0\u884C\u5931\u8D25\uFF0C\u72B6\u6001\uFF1A${n}`);(s=(a=this.opts).onError)==null||s.call(a,l),this.stdResult={completed:!0,output:"\u6807\u51C6\u7B54\u6848\u8FD0\u884C\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u5854\u5B50\u54E5\uFF01"},this.tryProcessResults()}}handleUserWebSocketMessage(t){var r,a,s,l;let e=t.rdoc||{},n=0;this.submitType==="submit"&&e.testCases&&this.testDataNum>0&&(n=Math.floor(e.testCases.length/this.testDataNum*100));let o=this.STATUS[e.status]||null;if(e.compilerText&&e.compilerText.trim().length>0&&(o="STATUS_COMPILE_ERROR"),o==="STATUS_COMPILING"||o==="STATUS_JUDGING"){if(this.mode==="leetcode"&&this.submitType==="pretest"&&!this.stdResult){let u=this.currentTestCaseInstances[0].paramInstances.map(d=>d.value.trim()||"").join(`
`);this.runStdCode(u).catch(d=>{var h,v;(v=(h=this.opts).onError)==null||v.call(h,d),this.stdResult={completed:!0,output:""},this.tryProcessResults()})}let c={statusName:o,submitType:this.submitType,rdoc:e,targetProgress:n};(a=(r=this.opts).onStatusUpdate)==null||a.call(r,c)}else if(Wn.has(o||"")){let c="";this.submitType=="pretest"&&(c=(((l=(s=e.testCases)==null?void 0:s[0])==null?void 0:l.message)||"").trim()),this.userResult={completed:!0,output:c,statusName:o||"",rdoc:e},this.tryProcessResults()}}tryProcessResults(){var t,e,n,o;if(this.submitType==="submit"){(t=this.userResult)!=null&&t.completed&&this.finalizeResult();return}this.submitType==="pretest"&&(this.mode==="leetcode"?(e=this.userResult)!=null&&e.completed&&((n=this.stdResult)!=null&&n.completed)&&this.finalizeResult():(o=this.userResult)!=null&&o.completed&&this.finalizeResult())}finalizeResult(){var r,a,s,l,c;if(!this.userResult){console.error("finalizeResult: \u7528\u6237\u7ED3\u679C\u7F3A\u5931");return}let{statusName:t,rdoc:e}=this.userResult,n=0;this.submitType==="submit"&&e.testCases&&this.testDataNum>0&&(n=Math.floor(e.testCases.length/this.testDataNum*100));let o={statusName:t,submitType:this.submitType,rdoc:e,targetProgress:n};if(this.submitType==="pretest"){let u="";this.mode==="leetcode"?u=((r=this.stdResult)==null?void 0:r.output)||"":u=this.currentTestCaseInstances[0].expectedOutput||"";let d=this.userResult.output;u=u.split(`
`).map(h=>h.trim()).join(`
`),d=d.split(`
`).map(h=>h.trim()).join(`
`),this.currentTestCaseResults=JSON.parse(JSON.stringify(this.currentTestCaseInstances)),this.currentTestCaseResults[0]={...this.currentTestCaseResults[0],accepted:u===d,actualOutput:d,expectedOutput:u},o.testCaseResults=this.currentTestCaseResults}else o.targetProgress=100;(s=(a=this.opts).onStatusUpdate)==null||s.call(a,o),(c=(l=this.opts).onResult)==null||c.call(l,o),this.userResult=null,this.stdResult=null,this.submitRid=null,this.processedRids.clear()}dispose(){this.ws&&(this.ws.close(),this.ws=null),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}};function Oa(i,t,e=!1){let n=i?`/p/${i}`:"";return`
\u4EE3\u7801\u7F16\u8F91\u5668
\u2715
\u4EE3\u7801\u6846\u5DF2\u7A97\u53E3\u5316\uFF0C\u70B9\u51FB\u5DE5\u5177\u680F\u6309\u94AE\u8FD8\u539F
\u7528\u4F8B\u81EA\u6D4B
\u8FD0\u884C\u7ED3\u679C
${e?`
\u95EE\u95EEAI
`:""}
\u70B9\u51FB"\u8FD0\u884C\u4EE3\u7801"\u67E5\u770B\u7ED3\u679C
${e?`
\u63D0\u4EA4\u8BB0\u5F55\uFF08\u4E0D\u542B\u81EA\u6D4B\uFF09
`:""}
`}var ir=ae(re());var or=class{constructor(t){p(this,"isFloating",!1);p(this,"originalParent",null);p(this,"isDragging",!1);p(this,"dragStartX",0);p(this,"dragStartY",0);p(this,"windowStartX",0);p(this,"windowStartY",0);p(this,"isResizing",!1);p(this,"resizeDirection","");p(this,"resizeStartX",0);p(this,"resizeStartY",0);p(this,"resizeStartWidth",0);p(this,"resizeStartHeight",0);p(this,"resizeStartLeft",0);p(this,"resizeStartTop",0);p(this,"resizeHandlesInitialized",!1);p(this,"config");p(this,"storageKey");p(this,"hiddenElements",[]);this.config=t,this.storageKey=t.storageKey||"floating_window_size",this.init()}init(){this.initDragEvents(),this.config.floatButton&&this.config.floatButton.addEventListener("click",()=>{this.toggle()}),this.config.closeButton&&this.config.closeButton.addEventListener("click",t=>{t.stopPropagation(),this.close()})}toggle(){this.isFloating?this.close():this.enter()}enter(){var l;let{floatingContainer:t,floatingContent:e,contentElement:n,placeholderElement:o,floatButton:r,onEnterFloat:a}=this.config;if(!n||!t||!o||!e){ir.Notification.error("\u627E\u4E0D\u5230\u5FC5\u8981\u7684 DOM \u5143\u7D20");return}t.parentElement!==document.body&&document.body.appendChild(t),this.originalParent=n.parentElement,o.style.display="flex",o.style.height=n.offsetHeight+"px",(l=this.originalParent)==null||l.insertBefore(o,n),e.appendChild(n),this.hideElementsInOriginalParent();let s=this.getSavedWindowSize();t.style.display="flex",t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.maxWidth="",t.style.transform="translate(-50%, -50%)",t.style.left="50%",t.style.top="50%",n.style.flex="1",n.style.height="100%",n.style.minHeight="0",n.style.border="none",n.style.borderRadius="0",this.initResizeHandles(),r&&(r.querySelector(".icon").textContent="\u26F6",r.setAttribute("title","\u8FD8\u539F\u4EE3\u7801\u6846")),this.isFloating=!0,a&&setTimeout(()=>a(),100),ir.Notification.success("\u7A97\u53E3\u5316\u6210\u529F")}exit(){let{floatingContainer:t,contentElement:e,placeholderElement:n,floatButton:o,onExitFloat:r}=this.config;!e||!t||!n||!this.originalParent||(e.style.flex="",e.style.height="",e.style.minHeight="",e.style.border="",e.style.borderRadius="",this.originalParent.insertBefore(e,n),this.showHiddenElements(),n.style.display="none",t.style.display="none",o&&(o.querySelector(".icon").textContent="\u26F6",o.setAttribute("title","\u7A97\u53E3\u5316\u4EE3\u7801\u6846")),this.isFloating=!1,r&&setTimeout(()=>r(),100),ir.Notification.success("\u5DF2\u8FD8\u539F"))}close(){let{floatingContainer:t}=this.config;!t||!this.isFloating||(t.style.transition="opacity 0.2s ease-out",t.style.opacity="0",setTimeout(()=>{this.exit(),t.style.transition="",t.style.opacity=""},200))}initDragEvents(){let{dragHandle:t,floatingContainer:e}=this.config;t.addEventListener("mousedown",n=>{this.isDragging=!0,this.dragStartX=n.clientX,this.dragStartY=n.clientY;let o=e.getBoundingClientRect();this.windowStartX=o.left,this.windowStartY=o.top,e.style.transform="none",e.style.left=this.windowStartX+"px",e.style.top=this.windowStartY+"px",t.style.cursor="grabbing",n.preventDefault()}),document.addEventListener("mousemove",n=>{if(!this.isDragging||!e)return;let o=n.clientX-this.dragStartX,r=n.clientY-this.dragStartY,a=this.windowStartX+o,s=this.windowStartY+r,l=100,c=window.innerWidth-l,u=l-e.offsetWidth,d=window.innerHeight-l,h=50,v=Math.max(u,Math.min(a,c)),w=Math.max(h,Math.min(s,d));e.style.left=v+"px",e.style.top=w+"px"}),document.addEventListener("mouseup",()=>{if(this.isDragging){this.isDragging=!1,t.style.cursor="move";let n=e.getBoundingClientRect();this.saveWindowSize({width:n.width,height:n.height})}})}initResizeHandles(){if(this.resizeHandlesInitialized)return;this.resizeHandlesInitialized=!0;let{floatingContainer:t}=this.config;[{class:"resize-handle-left",cursor:"ew-resize",direction:"left"},{class:"resize-handle-right",cursor:"ew-resize",direction:"right"},{class:"resize-handle-bottom",cursor:"ns-resize",direction:"bottom"},{class:"resize-handle-bottom-left",cursor:"nesw-resize",direction:"bottom-left"},{class:"resize-handle-bottom-right",cursor:"nwse-resize",direction:"bottom-right"}].forEach(({class:n,cursor:o,direction:r})=>{let a=document.createElement("div");a.className=n,a.style.cursor=o,t.appendChild(a),a.addEventListener("mousedown",s=>{this.isResizing=!0,this.resizeDirection=r,this.resizeStartX=s.clientX,this.resizeStartY=s.clientY;let l=t.getBoundingClientRect();this.resizeStartWidth=l.width,this.resizeStartHeight=l.height,this.resizeStartLeft=l.left,this.resizeStartTop=l.top,t.style.transform="none",t.style.left=this.resizeStartLeft+"px",t.style.top=this.resizeStartTop+"px",s.preventDefault(),s.stopPropagation()})}),document.addEventListener("mousemove",n=>{if(!this.isResizing||!t)return;let o=n.clientX-this.resizeStartX,r=n.clientY-this.resizeStartY,a=this.calculateMinWidth(),s=300,l=this.resizeStartWidth,c=this.resizeStartHeight,u=this.resizeStartLeft;this.resizeDirection.includes("left")&&(l=Math.max(a,this.resizeStartWidth-o),u=this.resizeStartLeft+(this.resizeStartWidth-l)),this.resizeDirection.includes("right")&&(l=Math.max(a,this.resizeStartWidth+o)),this.resizeDirection.includes("bottom")&&(c=Math.max(s,this.resizeStartHeight+r)),t.style.width=l+"px",t.style.height=c+"px",t.style.maxWidth="none",this.resizeDirection.includes("left")&&(t.style.left=u+"px"),this.config.onResize&&(this.resizeDirection.includes("left")||this.resizeDirection.includes("right"))&&this.config.onResize()}),document.addEventListener("mouseup",()=>{this.isResizing&&(this.isResizing=!1,this.resizeDirection="")})}calculateMinWidth(){let t=this.config.floatingContainer.querySelector(".editor-toolbar");if(!t)return 600;let e=t.querySelectorAll(":scope > *"),n=0;e.forEach(r=>{let a=window.getComputedStyle(r);n+=r.offsetWidth,n+=parseFloat(a.marginLeft||"0"),n+=parseFloat(a.marginRight||"0")});let o=window.getComputedStyle(t);return n+=parseFloat(o.paddingLeft||"0"),n+=parseFloat(o.paddingRight||"0"),Math.ceil(n)+20}hideElementsInOriginalParent(){if(!this.originalParent)return;let t=[this.originalParent.querySelector("#singleModeLink"),this.originalParent.querySelector("#floatWindowBtn")];this.hiddenElements=[],t.forEach(e=>{e&&window.getComputedStyle(e).display!=="none"&&(this.hiddenElements.push(e),e.style.display="none")})}showHiddenElements(){this.hiddenElements.forEach(t=>{t.style.display=""}),this.hiddenElements=[]}saveWindowSize(t){localStorage.setItem(this.storageKey,JSON.stringify(t))}getSavedWindowSize(){let t=localStorage.getItem(this.storageKey);return t?JSON.parse(t):{width:900,height:window.innerHeight*.6}}getIsFloating(){return this.isFloating}destroy(){this.isFloating&&this.exit()}};var Wa=ae(re());var Hp=[{name:"iostream",desc:"\u6807\u51C6\u8F93\u5165\u8F93\u51FA\u6D41"},{name:"vector",desc:"\u52A8\u6001\u6570\u7EC4\u5BB9\u5668"},{name:"algorithm",desc:"\u7B97\u6CD5\u5E93"},{name:"string",desc:"\u5B57\u7B26\u4E32\u5E93"},{name:"map",desc:"\u6620\u5C04\u5BB9\u5668"},{name:"set",desc:"\u96C6\u5408\u5BB9\u5668"},{name:"unordered_map",desc:"\u54C8\u5E0C\u6620\u5C04\u5BB9\u5668"},{name:"unordered_set",desc:"\u54C8\u5E0C\u96C6\u5408\u5BB9\u5668"},{name:"queue",desc:"\u961F\u5217\u5BB9\u5668"},{name:"stack",desc:"\u6808\u5BB9\u5668"},{name:"deque",desc:"\u53CC\u7AEF\u961F\u5217"},{name:"list",desc:"\u94FE\u8868\u5BB9\u5668"},{name:"bitset",desc:"\u4F4D\u96C6\u5408"},{name:"cmath",desc:"\u6570\u5B66\u51FD\u6570\u5E93"},{name:"climits",desc:"\u6574\u6570\u7C7B\u578B\u9650\u5236"},{name:"cstring",desc:"C \u5B57\u7B26\u4E32\u5904\u7406"},{name:"utility",desc:"pair \u7B49\u5B9E\u7528\u5DE5\u5177"},{name:"numeric",desc:"\u6570\u503C\u7B97\u6CD5"},{name:"functional",desc:"\u51FD\u6570\u5BF9\u8C61"},{name:"memory",desc:"\u667A\u80FD\u6307\u9488"},{name:"iomanip",desc:"\u8F93\u5165\u8F93\u51FA\u683C\u5F0F\u63A7\u5236"}],Dl=[{label:"vector",insertText:"vector",desc:"\u52A8\u6001\u6570\u7EC4"},{label:"map",insertText:"map",desc:"\u6709\u5E8F\u6620\u5C04"},{label:"unordered_map",insertText:"unordered_map",desc:"\u54C8\u5E0C\u6620\u5C04"},{label:"set",insertText:"set",desc:"\u6709\u5E8F\u96C6\u5408"},{label:"unordered_set",insertText:"unordered_set",desc:"\u54C8\u5E0C\u96C6\u5408"},{label:"queue",insertText:"queue",desc:"\u961F\u5217"},{label:"stack",insertText:"stack",desc:"\u6808"},{label:"priority_queue",insertText:"priority_queue",desc:"\u4F18\u5148\u961F\u5217"},{label:"deque",insertText:"deque",desc:"\u53CC\u7AEF\u961F\u5217"},{label:"list",insertText:"list",desc:"\u53CC\u5411\u94FE\u8868"},{label:"pair",insertText:"pair",desc:"\u952E\u503C\u5BF9"}],$l=[{label:"sort",insertText:"sort",desc:"\u6392\u5E8F"},{label:"reverse",insertText:"reverse",desc:"\u53CD\u8F6C"},{label:"unique",insertText:"unique",desc:"\u53BB\u91CD"},{label:"lower_bound",insertText:"lower_bound",desc:"\u4E8C\u5206\u67E5\u627E\u4E0B\u754C"},{label:"upper_bound",insertText:"upper_bound",desc:"\u4E8C\u5206\u67E5\u627E\u4E0A\u754C"},{label:"binary_search",insertText:"binary_search",desc:"\u4E8C\u5206\u67E5\u627E"},{label:"find",insertText:"find",desc:"\u67E5\u627E\u5143\u7D20"},{label:"count",insertText:"count",desc:"\u8BA1\u6570"},{label:"accumulate",insertText:"accumulate",desc:"\u7D2F\u52A0\u6C42\u548C"},{label:"max_element",insertText:"max_element",desc:"\u6700\u5927\u5143\u7D20"},{label:"min_element",insertText:"min_element",desc:"\u6700\u5C0F\u5143\u7D20"},{label:"next_permutation",insertText:"next_permutation",desc:"\u4E0B\u4E00\u4E2A\u6392\u5217"},{label:"fill",insertText:"fill",desc:"\u586B\u5145"}],Pp=[{label:"for",insertText:"for",desc:"for \u5FAA\u73AF"},{label:"while",insertText:"while",desc:"while \u5FAA\u73AF"},{label:"if",insertText:"if",desc:"if \u8BED\u53E5"},{label:"else",insertText:"else",desc:"else \u8BED\u53E5"},{label:"switch",insertText:"switch",desc:"switch \u8BED\u53E5"},{label:"case",insertText:"case",desc:"case \u5206\u652F"},{label:"using",insertText:"using",desc:"using \u58F0\u660E"},{label:"namespace",insertText:"namespace",desc:"\u547D\u540D\u7A7A\u95F4"},{label:"typedef",insertText:"typedef",desc:"\u7C7B\u578B\u522B\u540D"},{label:"sizeof",insertText:"sizeof",desc:"\u83B7\u53D6\u7C7B\u578B\u5927\u5C0F"},{label:"return",insertText:"return",desc:"\u8FD4\u56DE\u8BED\u53E5"},{label:"break",insertText:"break",desc:"\u8DF3\u51FA\u5FAA\u73AF"},{label:"continue",insertText:"continue",desc:"\u7EE7\u7EED\u4E0B\u4E00\u8F6E\u5FAA\u73AF"},{label:"include",insertText:"#include",desc:"#include \u9884\u5904\u7406\u6307\u4EE4"},{label:"define",insertText:"#define",desc:"#define \u5B8F\u5B9A\u4E49"}];function Bl(i){i.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["#","<",":",".",">"],provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},s=t.getLineContent(e.lineNumber).substring(0,e.column-1),l=o.word.toLowerCase();return s.includes("#include")&&Hp.forEach(u=>{let d=`<${u.name}>`;(!l||u.name.toLowerCase().startsWith(l))&&n.push({label:d,kind:i.languages.CompletionItemKind.Module,insertText:d,filterText:u.name,range:r,documentation:u.desc,detail:"\u6807\u51C6\u5E93\u5934\u6587\u4EF6"})}),s.endsWith("std::")&&(Dl.forEach(d=>{(!l||d.label.toLowerCase().startsWith(l))&&n.push({label:d.label,kind:i.languages.CompletionItemKind.Class,insertText:d.insertText,filterText:d.label,range:r,documentation:d.desc,detail:"STL \u5BB9\u5668"})}),$l.forEach(d=>{(!l||d.label.toLowerCase().startsWith(l))&&n.push({label:d.label,kind:i.languages.CompletionItemKind.Function,insertText:d.insertText,filterText:d.label,range:r,documentation:d.desc,detail:"STL \u7B97\u6CD5"})}),[{label:"cout",insertText:"cout",desc:"\u6807\u51C6\u8F93\u51FA"},{label:"cin",insertText:"cin",desc:"\u6807\u51C6\u8F93\u5165"},{label:"endl",insertText:"endl",desc:"\u6362\u884C"},{label:"string",insertText:"string",desc:"\u5B57\u7B26\u4E32"},{label:"to_string",insertText:"to_string",desc:"\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32"},{label:"stoi",insertText:"stoi",desc:"\u5B57\u7B26\u4E32\u8F6C\u6574\u6570"},{label:"swap",insertText:"swap",desc:"\u4EA4\u6362"},{label:"max",insertText:"max",desc:"\u53D6\u6700\u5927\u503C"},{label:"min",insertText:"min",desc:"\u53D6\u6700\u5C0F\u503C"}].forEach(d=>{(!l||d.label.toLowerCase().startsWith(l))&&n.push({label:d.label,kind:i.languages.CompletionItemKind.Function,insertText:d.insertText,filterText:d.label,range:r,documentation:d.desc,detail:"STL \u51FD\u6570"})})),Pp.forEach(u=>{(!l||u.label.toLowerCase().startsWith(l))&&n.push({label:u.label,kind:i.languages.CompletionItemKind.Keyword,insertText:u.insertText,filterText:u.label,range:r,documentation:u.desc,detail:"\u5173\u952E\u5B57"})}),s.endsWith("std::")||(Dl.forEach(u=>{(!l||u.label.toLowerCase().startsWith(l))&&n.push({label:u.label,kind:i.languages.CompletionItemKind.Class,insertText:u.insertText,filterText:u.label,range:r,documentation:u.desc,detail:"STL \u5BB9\u5668"})}),$l.forEach(u=>{(!l||u.label.toLowerCase().startsWith(l))&&n.push({label:u.label,kind:i.languages.CompletionItemKind.Function,insertText:u.insertText,filterText:u.label,range:r,documentation:u.desc,detail:"STL \u7B97\u6CD5"})})),[{label:"int",insertText:"int",desc:"32\u4F4D\u6574\u6570"},{label:"long",insertText:"long",desc:"\u957F\u6574\u6570"},{label:"long long",insertText:"long long",desc:"64\u4F4D\u6574\u6570"},{label:"double",insertText:"double",desc:"\u53CC\u7CBE\u5EA6\u6D6E\u70B9\u6570"},{label:"float",insertText:"float",desc:"\u5355\u7CBE\u5EA6\u6D6E\u70B9\u6570"},{label:"char",insertText:"char",desc:"\u5B57\u7B26"},{label:"bool",insertText:"bool",desc:"\u5E03\u5C14\u503C"},{label:"string",insertText:"string",desc:"\u5B57\u7B26\u4E32"},{label:"auto",insertText:"auto",desc:"\u81EA\u52A8\u7C7B\u578B\u63A8\u5BFC"},{label:"const",insertText:"const",desc:"\u5E38\u91CF"},{label:"unsigned",insertText:"unsigned",desc:"\u65E0\u7B26\u53F7\u7C7B\u578B"},{label:"void",insertText:"void",desc:"\u7A7A\u7C7B\u578B"}].forEach(u=>{(!l||u.label.toLowerCase().startsWith(l))&&n.push({label:u.label,kind:i.languages.CompletionItemKind.Keyword,insertText:u.insertText,filterText:u.label,range:r,documentation:u.desc,detail:"\u57FA\u7840\u7C7B\u578B"})}),{suggestions:n}}})}function Nl(i){i.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},a=t.getValue(),s=o.word.toLowerCase(),l=a.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,""),c=[/\b(?:int|long\s+long|long|double|float|char|bool|unsigned\s+int|unsigned)\s+(\w+)/g,/\bstring\s+(\w+)/g,/\bauto\s+(\w+)/g,/\b(?:vector|map|set|unordered_map|unordered_set|queue|stack|deque|list|pair|priority_queue)<[^>]+>\s+(\w+)/g,/\bfor\s*\(\s*(?:int|auto|auto&|auto\s+&)\s+(\w+)/g,/\b(?:int|long\s+long|long|double|float|char|bool|string|unsigned\s+int|unsigned)\s*&\s*(\w+)/g,/\b(?:vector|map|set|unordered_map|unordered_set|queue|stack|deque|list|pair|priority_queue)<[^>]+>\s*&\s*(\w+)/g,/\(\s*(?:int|long\s+long|long|double|float|char|bool|string|unsigned)\s+(\w+)/g,/,\s*(?:int|long\s+long|long|double|float|char|bool|string|unsigned)\s+(\w+)/g,/\bconst\s+(?:int|long\s+long|long|double|float|char|bool|string|unsigned)\s*&?\s*(\w+)/g,/\bconst\s+(?:vector|map|set|unordered_map|unordered_set|queue|stack|deque|list|pair|priority_queue)<[^>]+>\s*&?\s*(\w+)/g],u=new Set;return c.forEach(d=>{let h;for(;(h=d.exec(l))!==null;){let v=h[1];v&&v!==o.word&&!["if","else","while","for","return","break","continue","class","public","private","protected"].includes(v)&&u.add(v)}}),u.forEach(d=>{(!s||d.toLowerCase().startsWith(s))&&n.push({label:d,kind:i.languages.CompletionItemKind.Variable,insertText:d,filterText:d,range:r,detail:"\u5DF2\u5B9A\u4E49\u7684\u53D8\u91CF",sortText:"0"+d})}),{suggestions:n}}})}var Dp=[{name:"java.util.*",desc:"Java \u5DE5\u5177\u7C7B\u5E93"},{name:"java.util.List",desc:"List \u63A5\u53E3"},{name:"java.util.ArrayList",desc:"ArrayList \u7C7B"},{name:"java.util.LinkedList",desc:"LinkedList \u7C7B"},{name:"java.util.Map",desc:"Map \u63A5\u53E3"},{name:"java.util.HashMap",desc:"HashMap \u7C7B"},{name:"java.util.TreeMap",desc:"TreeMap \u7C7B"},{name:"java.util.Set",desc:"Set \u63A5\u53E3"},{name:"java.util.HashSet",desc:"HashSet \u7C7B"},{name:"java.util.TreeSet",desc:"TreeSet \u7C7B"},{name:"java.util.Queue",desc:"Queue \u63A5\u53E3"},{name:"java.util.Stack",desc:"Stack \u7C7B"},{name:"java.util.Arrays",desc:"Arrays \u5DE5\u5177\u7C7B"},{name:"java.util.Collections",desc:"Collections \u5DE5\u5177\u7C7B"},{name:"java.util.stream.*",desc:"Stream API"},{name:"java.io.*",desc:"IO \u7C7B\u5E93"},{name:"java.math.BigInteger",desc:"BigInteger \u7C7B"},{name:"java.math.BigDecimal",desc:"BigDecimal \u7C7B"}],$p=[{label:"ArrayList",insertText:"ArrayList",desc:"\u52A8\u6001\u6570\u7EC4"},{label:"LinkedList",insertText:"LinkedList",desc:"\u94FE\u8868"},{label:"HashMap",insertText:"HashMap",desc:"\u54C8\u5E0C\u6620\u5C04"},{label:"TreeMap",insertText:"TreeMap",desc:"\u6811\u6620\u5C04"},{label:"HashSet",insertText:"HashSet",desc:"\u54C8\u5E0C\u96C6\u5408"},{label:"TreeSet",insertText:"TreeSet",desc:"\u6811\u96C6\u5408"},{label:"LinkedHashMap",insertText:"LinkedHashMap",desc:"\u6709\u5E8F\u54C8\u5E0C\u6620\u5C04"},{label:"LinkedHashSet",insertText:"LinkedHashSet",desc:"\u6709\u5E8F\u54C8\u5E0C\u96C6\u5408"},{label:"PriorityQueue",insertText:"PriorityQueue",desc:"\u4F18\u5148\u961F\u5217"},{label:"ArrayDeque",insertText:"ArrayDeque",desc:"\u53CC\u7AEF\u961F\u5217"},{label:"Stack",insertText:"Stack",desc:"\u6808"}],Bp=[{label:"add",insertText:"add",desc:"\u6DFB\u52A0\u5143\u7D20"},{label:"remove",insertText:"remove",desc:"\u79FB\u9664\u5143\u7D20"},{label:"get",insertText:"get",desc:"\u83B7\u53D6\u5143\u7D20"},{label:"set",insertText:"set",desc:"\u8BBE\u7F6E\u5143\u7D20"},{label:"size",insertText:"size",desc:"\u83B7\u53D6\u5927\u5C0F"},{label:"isEmpty",insertText:"isEmpty",desc:"\u5224\u65AD\u662F\u5426\u4E3A\u7A7A"},{label:"contains",insertText:"contains",desc:"\u5224\u65AD\u662F\u5426\u5305\u542B"},{label:"clear",insertText:"clear",desc:"\u6E05\u7A7A"},{label:"indexOf",insertText:"indexOf",desc:"\u67E5\u627E\u7D22\u5F15"},{label:"toArray",insertText:"toArray",desc:"\u8F6C\u6362\u4E3A\u6570\u7EC4"},{label:"toString",insertText:"toString",desc:"\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32"},{label:"equals",insertText:"equals",desc:"\u5224\u65AD\u76F8\u7B49"},{label:"hashCode",insertText:"hashCode",desc:"\u83B7\u53D6\u54C8\u5E0C\u7801"},{label:"compareTo",insertText:"compareTo",desc:"\u6BD4\u8F83"}],Np=[{label:"public",insertText:"public",desc:"\u516C\u5171\u8BBF\u95EE\u4FEE\u9970\u7B26"},{label:"private",insertText:"private",desc:"\u79C1\u6709\u8BBF\u95EE\u4FEE\u9970\u7B26"},{label:"protected",insertText:"protected",desc:"\u53D7\u4FDD\u62A4\u8BBF\u95EE\u4FEE\u9970\u7B26"},{label:"class",insertText:"class",desc:"\u7C7B"},{label:"interface",insertText:"interface",desc:"\u63A5\u53E3"},{label:"extends",insertText:"extends",desc:"\u7EE7\u627F"},{label:"implements",insertText:"implements",desc:"\u5B9E\u73B0\u63A5\u53E3"},{label:"static",insertText:"static",desc:"\u9759\u6001"},{label:"final",insertText:"final",desc:"\u6700\u7EC8/\u5E38\u91CF"},{label:"void",insertText:"void",desc:"\u7A7A\u8FD4\u56DE\u7C7B\u578B"},{label:"return",insertText:"return",desc:"\u8FD4\u56DE"},{label:"new",insertText:"new",desc:"\u521B\u5EFA\u5BF9\u8C61"},{label:"this",insertText:"this",desc:"\u5F53\u524D\u5BF9\u8C61"},{label:"super",insertText:"super",desc:"\u7236\u7C7B"},{label:"null",insertText:"null",desc:"\u7A7A\u5F15\u7528"},{label:"true",insertText:"true",desc:"\u5E03\u5C14\u771F"},{label:"false",insertText:"false",desc:"\u5E03\u5C14\u5047"},{label:"if",insertText:"if",desc:"if \u8BED\u53E5"},{label:"else",insertText:"else",desc:"else \u8BED\u53E5"},{label:"for",insertText:"for",desc:"for \u5FAA\u73AF"},{label:"while",insertText:"while",desc:"while \u5FAA\u73AF"},{label:"do",insertText:"do",desc:"do-while \u5FAA\u73AF"},{label:"switch",insertText:"switch",desc:"switch \u8BED\u53E5"},{label:"case",insertText:"case",desc:"case \u5206\u652F"},{label:"break",insertText:"break",desc:"\u8DF3\u51FA"},{label:"continue",insertText:"continue",desc:"\u7EE7\u7EED"},{label:"try",insertText:"try",desc:"\u5F02\u5E38\u5904\u7406"},{label:"catch",insertText:"catch",desc:"\u6355\u83B7\u5F02\u5E38"},{label:"finally",insertText:"finally",desc:"\u6700\u7EC8\u6267\u884C"},{label:"throw",insertText:"throw",desc:"\u629B\u51FA\u5F02\u5E38"},{label:"throws",insertText:"throws",desc:"\u58F0\u660E\u5F02\u5E38"},{label:"import",insertText:"import",desc:"\u5BFC\u5165"},{label:"package",insertText:"package",desc:"\u5305"}],Fp=[{label:"int",insertText:"int",desc:"\u6574\u6570\u7C7B\u578B"},{label:"long",insertText:"long",desc:"\u957F\u6574\u6570\u7C7B\u578B"},{label:"double",insertText:"double",desc:"\u53CC\u7CBE\u5EA6\u6D6E\u70B9\u6570"},{label:"float",insertText:"float",desc:"\u5355\u7CBE\u5EA6\u6D6E\u70B9\u6570"},{label:"boolean",insertText:"boolean",desc:"\u5E03\u5C14\u7C7B\u578B"},{label:"char",insertText:"char",desc:"\u5B57\u7B26\u7C7B\u578B"},{label:"byte",insertText:"byte",desc:"\u5B57\u8282\u7C7B\u578B"},{label:"short",insertText:"short",desc:"\u77ED\u6574\u6570\u7C7B\u578B"},{label:"String",insertText:"String",desc:"\u5B57\u7B26\u4E32\u7C7B\u578B"},{label:"Integer",insertText:"Integer",desc:"\u6574\u6570\u5305\u88C5\u7C7B"},{label:"Long",insertText:"Long",desc:"\u957F\u6574\u6570\u5305\u88C5\u7C7B"},{label:"Double",insertText:"Double",desc:"\u53CC\u7CBE\u5EA6\u5305\u88C5\u7C7B"},{label:"Float",insertText:"Float",desc:"\u5355\u7CBE\u5EA6\u5305\u88C5\u7C7B"},{label:"Boolean",insertText:"Boolean",desc:"\u5E03\u5C14\u5305\u88C5\u7C7B"},{label:"Character",insertText:"Character",desc:"\u5B57\u7B26\u5305\u88C5\u7C7B"},{label:"Object",insertText:"Object",desc:"\u5BF9\u8C61\u57FA\u7C7B"},{label:"List",insertText:"List",desc:"\u5217\u8868\u63A5\u53E3"},{label:"Map",insertText:"Map",desc:"\u6620\u5C04\u63A5\u53E3"},{label:"Set",insertText:"Set",desc:"\u96C6\u5408\u63A5\u53E3"},{label:"Queue",insertText:"Queue",desc:"\u961F\u5217\u63A5\u53E3"}];function Fl(i){i.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," ","("],provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},s=t.getLineContent(e.lineNumber).substring(0,e.column-1),l=o.word.toLowerCase();return s.includes("import")&&Dp.forEach(c=>{(!l||c.name.toLowerCase().startsWith(l))&&n.push({label:c.name,kind:i.languages.CompletionItemKind.Module,insertText:c.name,filterText:c.name,range:r,documentation:c.desc,detail:"Java \u5305\u5BFC\u5165"})}),$p.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Class,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Java \u96C6\u5408\u7C7B"})}),Bp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Method,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Java \u65B9\u6CD5"})}),Np.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Keyword,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Java \u5173\u952E\u5B57"})}),Fp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Class,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Java \u7C7B\u578B"})}),{suggestions:n}}})}function Rl(i){i.languages.registerCompletionItemProvider("java",{provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},a=t.getValue(),s=o.word.toLowerCase(),l=a.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,""),c=new Set;[/\b(?:int|long|double|float|boolean|char|byte|short|String)\s+(\w+)/g,/\b(?:List|ArrayList|LinkedList|Map|HashMap|TreeMap|Set|HashSet|TreeSet|Queue|Stack|PriorityQueue|ArrayDeque)<[^>]+>\s+(\w+)/g,/\b[A-Z]\w*\s+(\w+)\s*[;=]/g].forEach(w=>{let k;for(;(k=w.exec(l))!==null;){let L=k[1];L&&!Ua(L)&&L!==o.word&&c.add(L)}});let d=/=\s*(\w+)/g,h;for(;(h=d.exec(l))!==null;){let w=h[1];w&&!Ua(w)&&isNaN(Number(w))&&w!==o.word&&c.add(w)}let v=/(\w+)(?:\.|\.get\(|\.set\(|\[)/g;for(;(h=v.exec(l))!==null;){let w=h[1];w&&!Ua(w)&&w!==o.word&&c.add(w)}return c.forEach(w=>{(!s||w.toLowerCase().startsWith(s))&&n.push({label:w,kind:i.languages.CompletionItemKind.Variable,insertText:w,filterText:w,range:r,detail:"\u5DF2\u8BC6\u522B\u7684\u6807\u8BC6\u7B26",sortText:"0"+w})}),{suggestions:n}}})}function Ua(i){return["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","true","false","null","String","Integer","Long","Double","Float","Boolean","Character","List","ArrayList","Map","HashMap","Set","HashSet","Object"].includes(i)}var Rp=[{name:"os",desc:"\u64CD\u4F5C\u7CFB\u7EDF\u63A5\u53E3"},{name:"sys",desc:"\u7CFB\u7EDF\u76F8\u5173\u53C2\u6570\u548C\u51FD\u6570"},{name:"math",desc:"\u6570\u5B66\u51FD\u6570"},{name:"random",desc:"\u968F\u673A\u6570\u751F\u6210"},{name:"datetime",desc:"\u65E5\u671F\u548C\u65F6\u95F4"},{name:"re",desc:"\u6B63\u5219\u8868\u8FBE\u5F0F"},{name:"json",desc:"JSON \u7F16\u7801\u548C\u89E3\u7801"},{name:"collections",desc:"\u5BB9\u5668\u6570\u636E\u7C7B\u578B"},{name:"itertools",desc:"\u8FED\u4EE3\u5668\u51FD\u6570"},{name:"functools",desc:"\u51FD\u6570\u5DE5\u5177"},{name:"typing",desc:"\u7C7B\u578B\u63D0\u793A"},{name:"pathlib",desc:"\u9762\u5411\u5BF9\u8C61\u7684\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u5F84"},{name:"copy",desc:"\u6D45\u62F7\u8D1D\u548C\u6DF1\u62F7\u8D1D"},{name:"time",desc:"\u65F6\u95F4\u8BBF\u95EE\u548C\u8F6C\u6362"},{name:"heapq",desc:"\u5806\u961F\u5217\u7B97\u6CD5"},{name:"bisect",desc:"\u6570\u7EC4\u4E8C\u5206\u67E5\u627E\u7B97\u6CD5"},{name:"string",desc:"\u5B57\u7B26\u4E32\u5E38\u91CF\u548C\u5DE5\u5177"},{name:"decimal",desc:"\u5341\u8FDB\u5236\u6D6E\u70B9\u8FD0\u7B97"},{name:"fractions",desc:"\u6709\u7406\u6570"}],qp=[{label:"int",insertText:"int",desc:"\u6574\u6570\u7C7B\u578B"},{label:"float",insertText:"float",desc:"\u6D6E\u70B9\u6570\u7C7B\u578B"},{label:"str",insertText:"str",desc:"\u5B57\u7B26\u4E32\u7C7B\u578B"},{label:"bool",insertText:"bool",desc:"\u5E03\u5C14\u7C7B\u578B"},{label:"list",insertText:"list",desc:"\u5217\u8868\u7C7B\u578B"},{label:"tuple",insertText:"tuple",desc:"\u5143\u7EC4\u7C7B\u578B"},{label:"dict",insertText:"dict",desc:"\u5B57\u5178\u7C7B\u578B"},{label:"set",insertText:"set",desc:"\u96C6\u5408\u7C7B\u578B"},{label:"frozenset",insertText:"frozenset",desc:"\u4E0D\u53EF\u53D8\u96C6\u5408"},{label:"bytes",insertText:"bytes",desc:"\u5B57\u8282\u7C7B\u578B"},{label:"bytearray",insertText:"bytearray",desc:"\u5B57\u8282\u6570\u7EC4"},{label:"range",insertText:"range",desc:"\u8303\u56F4\u5BF9\u8C61"},{label:"complex",insertText:"complex",desc:"\u590D\u6570\u7C7B\u578B"},{label:"None",insertText:"None",desc:"\u7A7A\u503C"},{label:"True",insertText:"True",desc:"\u5E03\u5C14\u771F"},{label:"False",insertText:"False",desc:"\u5E03\u5C14\u5047"}],zp=[{label:"print",insertText:"print",desc:"\u6253\u5370\u8F93\u51FA"},{label:"input",insertText:"input",desc:"\u83B7\u53D6\u7528\u6237\u8F93\u5165"},{label:"len",insertText:"len",desc:"\u83B7\u53D6\u957F\u5EA6"},{label:"range",insertText:"range",desc:"\u751F\u6210\u5E8F\u5217"},{label:"enumerate",insertText:"enumerate",desc:"\u679A\u4E3E\u8FED\u4EE3"},{label:"zip",insertText:"zip",desc:"\u6253\u5305\u8FED\u4EE3\u5668"},{label:"map",insertText:"map",desc:"\u6620\u5C04\u51FD\u6570"},{label:"filter",insertText:"filter",desc:"\u8FC7\u6EE4\u51FD\u6570"},{label:"sorted",insertText:"sorted",desc:"\u6392\u5E8F"},{label:"reversed",insertText:"reversed",desc:"\u53CD\u8F6C"},{label:"sum",insertText:"sum",desc:"\u6C42\u548C"},{label:"max",insertText:"max",desc:"\u6700\u5927\u503C"},{label:"min",insertText:"min",desc:"\u6700\u5C0F\u503C"},{label:"abs",insertText:"abs",desc:"\u7EDD\u5BF9\u503C"},{label:"all",insertText:"all",desc:"\u5168\u90E8\u4E3A\u771F"},{label:"any",insertText:"any",desc:"\u4EFB\u4E00\u4E3A\u771F"},{label:"isinstance",insertText:"isinstance",desc:"\u7C7B\u578B\u68C0\u67E5"},{label:"issubclass",insertText:"issubclass",desc:"\u5B50\u7C7B\u68C0\u67E5"},{label:"type",insertText:"type",desc:"\u83B7\u53D6\u7C7B\u578B"},{label:"id",insertText:"id",desc:"\u83B7\u53D6\u5BF9\u8C61 ID"},{label:"hash",insertText:"hash",desc:"\u83B7\u53D6\u54C8\u5E0C\u503C"},{label:"open",insertText:"open",desc:"\u6253\u5F00\u6587\u4EF6"},{label:"round",insertText:"round",desc:"\u56DB\u820D\u4E94\u5165"},{label:"pow",insertText:"pow",desc:"\u5E42\u8FD0\u7B97"},{label:"divmod",insertText:"divmod",desc:"\u9664\u6CD5\u548C\u53D6\u4F59"}],Op=[{label:"def",insertText:"def",desc:"\u5B9A\u4E49\u51FD\u6570"},{label:"class",insertText:"class",desc:"\u5B9A\u4E49\u7C7B"},{label:"if",insertText:"if",desc:"if \u8BED\u53E5"},{label:"elif",insertText:"elif",desc:"elif \u8BED\u53E5"},{label:"else",insertText:"else",desc:"else \u8BED\u53E5"},{label:"for",insertText:"for",desc:"for \u5FAA\u73AF"},{label:"while",insertText:"while",desc:"while \u5FAA\u73AF"},{label:"break",insertText:"break",desc:"\u8DF3\u51FA\u5FAA\u73AF"},{label:"continue",insertText:"continue",desc:"\u7EE7\u7EED\u5FAA\u73AF"},{label:"return",insertText:"return",desc:"\u8FD4\u56DE\u503C"},{label:"yield",insertText:"yield",desc:"\u751F\u6210\u5668"},{label:"import",insertText:"import",desc:"\u5BFC\u5165\u6A21\u5757"},{label:"from",insertText:"from",desc:"\u4ECE\u6A21\u5757\u5BFC\u5165"},{label:"as",insertText:"as",desc:"\u522B\u540D"},{label:"with",insertText:"with",desc:"\u4E0A\u4E0B\u6587\u7BA1\u7406\u5668"},{label:"try",insertText:"try",desc:"\u5F02\u5E38\u5904\u7406"},{label:"except",insertText:"except",desc:"\u6355\u83B7\u5F02\u5E38"},{label:"finally",insertText:"finally",desc:"\u6700\u7EC8\u6267\u884C"},{label:"raise",insertText:"raise",desc:"\u629B\u51FA\u5F02\u5E38"},{label:"assert",insertText:"assert",desc:"\u65AD\u8A00"},{label:"pass",insertText:"pass",desc:"\u7A7A\u8BED\u53E5"},{label:"lambda",insertText:"lambda",desc:"\u533F\u540D\u51FD\u6570"},{label:"global",insertText:"global",desc:"\u5168\u5C40\u53D8\u91CF"},{label:"nonlocal",insertText:"nonlocal",desc:"\u975E\u5C40\u90E8\u53D8\u91CF"},{label:"del",insertText:"del",desc:"\u5220\u9664"},{label:"in",insertText:"in",desc:"\u6210\u5458\u8FD0\u7B97\u7B26"},{label:"is",insertText:"is",desc:"\u8EAB\u4EFD\u8FD0\u7B97\u7B26"},{label:"not",insertText:"not",desc:"\u903B\u8F91\u975E"},{label:"and",insertText:"and",desc:"\u903B\u8F91\u4E0E"},{label:"or",insertText:"or",desc:"\u903B\u8F91\u6216"}],Up=[{label:"append",insertText:"append",desc:"\u5217\u8868\uFF1A\u6DFB\u52A0\u5143\u7D20"},{label:"extend",insertText:"extend",desc:"\u5217\u8868\uFF1A\u6269\u5C55\u5217\u8868"},{label:"insert",insertText:"insert",desc:"\u5217\u8868\uFF1A\u63D2\u5165\u5143\u7D20"},{label:"remove",insertText:"remove",desc:"\u5217\u8868\uFF1A\u79FB\u9664\u5143\u7D20"},{label:"pop",insertText:"pop",desc:"\u5217\u8868/\u5B57\u5178\uFF1A\u5F39\u51FA\u5143\u7D20"},{label:"clear",insertText:"clear",desc:"\u5217\u8868/\u5B57\u5178/\u96C6\u5408\uFF1A\u6E05\u7A7A"},{label:"index",insertText:"index",desc:"\u5217\u8868/\u5B57\u7B26\u4E32\uFF1A\u67E5\u627E\u7D22\u5F15"},{label:"count",insertText:"count",desc:"\u5217\u8868/\u5B57\u7B26\u4E32\uFF1A\u8BA1\u6570"},{label:"sort",insertText:"sort",desc:"\u5217\u8868\uFF1A\u6392\u5E8F"},{label:"reverse",insertText:"reverse",desc:"\u5217\u8868\uFF1A\u53CD\u8F6C"},{label:"keys",insertText:"keys",desc:"\u5B57\u5178\uFF1A\u83B7\u53D6\u952E"},{label:"values",insertText:"values",desc:"\u5B57\u5178\uFF1A\u83B7\u53D6\u503C"},{label:"items",insertText:"items",desc:"\u5B57\u5178\uFF1A\u83B7\u53D6\u952E\u503C\u5BF9"},{label:"get",insertText:"get",desc:"\u5B57\u5178\uFF1A\u5B89\u5168\u83B7\u53D6\u503C"},{label:"update",insertText:"update",desc:"\u5B57\u5178\uFF1A\u66F4\u65B0"},{label:"setdefault",insertText:"setdefault",desc:"\u5B57\u5178\uFF1A\u8BBE\u7F6E\u9ED8\u8BA4\u503C"},{label:"split",insertText:"split",desc:"\u5B57\u7B26\u4E32\uFF1A\u5206\u5272"},{label:"join",insertText:"join",desc:"\u5B57\u7B26\u4E32\uFF1A\u8FDE\u63A5"},{label:"strip",insertText:"strip",desc:"\u5B57\u7B26\u4E32\uFF1A\u53BB\u9664\u7A7A\u767D"},{label:"replace",insertText:"replace",desc:"\u5B57\u7B26\u4E32\uFF1A\u66FF\u6362"},{label:"upper",insertText:"upper",desc:"\u5B57\u7B26\u4E32\uFF1A\u8F6C\u5927\u5199"},{label:"lower",insertText:"lower",desc:"\u5B57\u7B26\u4E32\uFF1A\u8F6C\u5C0F\u5199"},{label:"startswith",insertText:"startswith",desc:"\u5B57\u7B26\u4E32\uFF1A\u68C0\u67E5\u524D\u7F00"},{label:"endswith",insertText:"endswith",desc:"\u5B57\u7B26\u4E32\uFF1A\u68C0\u67E5\u540E\u7F00"},{label:"find",insertText:"find",desc:"\u5B57\u7B26\u4E32\uFF1A\u67E5\u627E"},{label:"format",insertText:"format",desc:"\u5B57\u7B26\u4E32\uFF1A\u683C\u5F0F\u5316"},{label:"add",insertText:"add",desc:"\u96C6\u5408\uFF1A\u6DFB\u52A0\u5143\u7D20"},{label:"discard",insertText:"discard",desc:"\u96C6\u5408\uFF1A\u79FB\u9664\u5143\u7D20"},{label:"union",insertText:"union",desc:"\u96C6\u5408\uFF1A\u5E76\u96C6"},{label:"intersection",insertText:"intersection",desc:"\u96C6\u5408\uFF1A\u4EA4\u96C6"},{label:"difference",insertText:"difference",desc:"\u96C6\u5408\uFF1A\u5DEE\u96C6"}];function zl(i){i.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "],provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},s=t.getLineContent(e.lineNumber).substring(0,e.column-1),l=o.word.toLowerCase();return(s.includes("import")||s.includes("from"))&&Rp.forEach(c=>{(!l||c.name.toLowerCase().startsWith(l))&&n.push({label:c.name,kind:i.languages.CompletionItemKind.Module,insertText:c.name,filterText:c.name,range:r,documentation:c.desc,detail:"Python \u6A21\u5757"})}),qp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Class,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Python \u7C7B\u578B"})}),zp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Function,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Python \u5185\u7F6E\u51FD\u6570"})}),Op.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Keyword,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Python \u5173\u952E\u5B57"})}),Up.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Method,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"Python \u65B9\u6CD5"})}),{suggestions:n}}})}function Ol(i){i.languages.registerCompletionItemProvider("python",{provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},s=t.getValue().replace(/#.*$/gm,""),l=new Set,c=o.word.toLowerCase();[/^(\w+)\s*=/gm,/def\s+\w+\s*\(([^)]*)\)/g,/for\s+(\w+)\s+in/g,/with\s+[^:]+\s+as\s+(\w+)/g,/self\.(\w+)/g].forEach(v=>{let w;for(;(w=v.exec(s))!==null;){let k=[];w[1]&&(w[1].includes(",")?k=w[1].split(",").map(L=>L.trim().split("=")[0].trim()):k=[w[1].trim()]),k.forEach(L=>{L&&!ql(L)&&L!==o.word&&(!c||L.toLowerCase().startsWith(c))&&l.add(L)})}});let d=/(\w+)(?:\.|\.append\(|\.get\(|\[)/g,h;for(;(h=d.exec(s))!==null;){let v=h[1];v&&!ql(v)&&v!==o.word&&(!c||v.toLowerCase().startsWith(c))&&l.add(v)}return l.forEach(v=>{n.push({label:v,kind:i.languages.CompletionItemKind.Variable,insertText:v,filterText:v,range:r,detail:"\u5DF2\u8BC6\u522B\u7684\u6807\u8BC6\u7B26",sortText:"0"+v})}),{suggestions:n}}})}function ql(i){return["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","int","float","str","bool","list","tuple","dict","set","print","len","range","enumerate","zip","map","filter"].includes(i)}var Wp=[{name:"fmt",desc:"\u683C\u5F0F\u5316 I/O"},{name:"os",desc:"\u64CD\u4F5C\u7CFB\u7EDF\u63A5\u53E3"},{name:"io",desc:"\u57FA\u672C I/O \u63A5\u53E3"},{name:"bufio",desc:"\u5E26\u7F13\u51B2 I/O"},{name:"strconv",desc:"\u5B57\u7B26\u4E32\u4E0E\u57FA\u672C\u7C7B\u578B\u8F6C\u6362"},{name:"strings",desc:"\u5B57\u7B26\u4E32\u64CD\u4F5C"},{name:"math",desc:"\u6570\u5B66\u51FD\u6570"},{name:"math/rand",desc:"\u968F\u673A\u6570\u751F\u6210"},{name:"sort",desc:"\u6392\u5E8F\u4E0E\u641C\u7D22"},{name:"time",desc:"\u65F6\u95F4\u5904\u7406"},{name:"context",desc:"\u4E0A\u4E0B\u6587\u63A7\u5236"},{name:"sync",desc:"\u5E76\u53D1\u540C\u6B65\u539F\u8BED"},{name:"net",desc:"\u7F51\u7EDC\u63A5\u53E3"},{name:"net/http",desc:"HTTP \u5BA2\u6237\u7AEF\u4E0E\u670D\u52A1\u5668"},{name:"encoding/json",desc:"JSON \u7F16\u89E3\u7801"},{name:"log",desc:"\u65E5\u5FD7\u8BB0\u5F55"}],Yp=[{label:"func",insertText:"func",desc:"\u51FD\u6570\u58F0\u660E"},{label:"package",insertText:"package",desc:"\u5305\u58F0\u660E"},{label:"import",insertText:"import",desc:"\u5BFC\u5165\u5305"},{label:"var",insertText:"var",desc:"\u53D8\u91CF\u58F0\u660E"},{label:"const",insertText:"const",desc:"\u5E38\u91CF\u58F0\u660E"},{label:"type",insertText:"type",desc:"\u7C7B\u578B\u58F0\u660E"},{label:"struct",insertText:"struct",desc:"\u7ED3\u6784\u4F53"},{label:"interface",insertText:"interface",desc:"\u63A5\u53E3"},{label:"go",insertText:"go",desc:"\u542F\u52A8\u534F\u7A0B"},{label:"defer",insertText:"defer",desc:"\u5EF6\u8FDF\u8C03\u7528"},{label:"return",insertText:"return",desc:"\u8FD4\u56DE\u8BED\u53E5"},{label:"if",insertText:"if",desc:"\u6761\u4EF6\u8BED\u53E5"},{label:"else",insertText:"else",desc:"\u6761\u4EF6\u8BED\u53E5"},{label:"for",insertText:"for",desc:"\u5FAA\u73AF"},{label:"range",insertText:"range",desc:"\u904D\u5386"},{label:"switch",insertText:"switch",desc:"\u5206\u652F\u8BED\u53E5"},{label:"case",insertText:"case",desc:"\u5206\u652F"},{label:"default",insertText:"default",desc:"\u9ED8\u8BA4\u5206\u652F"},{label:"break",insertText:"break",desc:"\u8DF3\u51FA\u5FAA\u73AF/\u5206\u652F"},{label:"continue",insertText:"continue",desc:"\u7EE7\u7EED\u4E0B\u4E00\u8F6E\u5FAA\u73AF"},{label:"fallthrough",insertText:"fallthrough",desc:"\u7EE7\u7EED\u4E0B\u4E00\u4E2A case"},{label:"select",insertText:"select",desc:"\u591A\u8DEF channel \u9009\u62E9"}],Vp=[{label:"int",insertText:"int",desc:"\u6574\u578B\uFF08\u5E73\u53F0\u76F8\u5173\u5927\u5C0F\uFF09"},{label:"int8",insertText:"int8",desc:"8 \u4F4D\u6709\u7B26\u53F7\u6574\u6570"},{label:"int16",insertText:"int16",desc:"16 \u4F4D\u6709\u7B26\u53F7\u6574\u6570"},{label:"int32",insertText:"int32",desc:"32 \u4F4D\u6709\u7B26\u53F7\u6574\u6570"},{label:"int64",insertText:"int64",desc:"64 \u4F4D\u6709\u7B26\u53F7\u6574\u6570"},{label:"uint",insertText:"uint",desc:"\u65E0\u7B26\u53F7\u6574\u6570\uFF08\u5E73\u53F0\u76F8\u5173\u5927\u5C0F\uFF09"},{label:"uint8",insertText:"uint8",desc:"8 \u4F4D\u65E0\u7B26\u53F7\u6574\u6570\uFF08byte\uFF09"},{label:"uint16",insertText:"uint16",desc:"16 \u4F4D\u65E0\u7B26\u53F7\u6574\u6570"},{label:"uint32",insertText:"uint32",desc:"32 \u4F4D\u65E0\u7B26\u53F7\u6574\u6570"},{label:"uint64",insertText:"uint64",desc:"64 \u4F4D\u65E0\u7B26\u53F7\u6574\u6570"},{label:"byte",insertText:"byte",desc:"uint8 \u522B\u540D"},{label:"rune",insertText:"rune",desc:"int32 \u522B\u540D\uFF0C\u8868\u793A Unicode \u7801\u70B9"},{label:"float32",insertText:"float32",desc:"32 \u4F4D\u6D6E\u70B9\u6570"},{label:"float64",insertText:"float64",desc:"64 \u4F4D\u6D6E\u70B9\u6570"},{label:"complex64",insertText:"complex64",desc:"\u590D\u6570\uFF08float32 \u5B9E\u90E8\u548C\u865A\u90E8\uFF09"},{label:"complex128",insertText:"complex128",desc:"\u590D\u6570\uFF08float64 \u5B9E\u90E8\u548C\u865A\u90E8\uFF09"},{label:"string",insertText:"string",desc:"\u5B57\u7B26\u4E32"},{label:"bool",insertText:"bool",desc:"\u5E03\u5C14\u7C7B\u578B"},{label:"error",insertText:"error",desc:"\u9519\u8BEF\u63A5\u53E3\u7C7B\u578B"}],Jp=[{label:"len",insertText:"len",desc:"\u8FD4\u56DE\u957F\u5EA6"},{label:"cap",insertText:"cap",desc:"\u8FD4\u56DE\u5BB9\u91CF"},{label:"make",insertText:"make",desc:"\u5206\u914D\u5207\u7247\u3001map\u3001chan"},{label:"new",insertText:"new",desc:"\u5206\u914D\u96F6\u503C\u5BF9\u8C61\u6307\u9488"},{label:"append",insertText:"append",desc:"\u5411\u5207\u7247\u8FFD\u52A0\u5143\u7D20"},{label:"copy",insertText:"copy",desc:"\u5207\u7247\u62F7\u8D1D"},{label:"delete",insertText:"delete",desc:"\u5220\u9664 map \u952E\u503C"},{label:"panic",insertText:"panic",desc:"\u5F15\u53D1\u6050\u614C"},{label:"recover",insertText:"recover",desc:"\u6062\u590D panic"},{label:"close",insertText:"close",desc:"\u5173\u95ED channel"},{label:"complex",insertText:"complex",desc:"\u6784\u9020\u590D\u6570"},{label:"real",insertText:"real",desc:"\u53D6\u590D\u6570\u5B9E\u90E8"},{label:"imag",insertText:"imag",desc:"\u53D6\u590D\u6570\u865A\u90E8"}],Kp=[{label:"Print",insertText:"Print",desc:"\u6253\u5370"},{label:"Println",insertText:"Println",desc:"\u6253\u5370\u5E76\u6362\u884C"},{label:"Printf",insertText:"Printf",desc:"\u683C\u5F0F\u5316\u6253\u5370"},{label:"Sprint",insertText:"Sprint",desc:"\u8FD4\u56DE\u683C\u5F0F\u5316\u5B57\u7B26\u4E32"},{label:"Sprintf",insertText:"Sprintf",desc:"\u8FD4\u56DE\u683C\u5F0F\u5316\u5B57\u7B26\u4E32"},{label:"Fprint",insertText:"Fprint",desc:"\u5199\u5165\u5230 io.Writer"},{label:"Fprintf",insertText:"Fprintf",desc:"\u683C\u5F0F\u5316\u5199\u5165 io.Writer"}];function Ul(i){i.languages.registerCompletionItemProvider("go",{triggerCharacters:[".",'"',":"," "],provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},a=t.getLineContent(e.lineNumber),s=a.substring(0,e.column-1),l=(o.word||"").toLowerCase();return/\bimport\b/.test(a)&&Wp.forEach(c=>{(!l||c.name.toLowerCase().startsWith(l))&&n.push({label:c.name,kind:i.languages.CompletionItemKind.Module,insertText:c.name,filterText:c.name,range:r,documentation:c.desc,detail:"\u6807\u51C6\u5E93\u5305"})}),s.endsWith("fmt.")&&Kp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Function,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"fmt \u5305\u51FD\u6570"})}),Yp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Keyword,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"\u5173\u952E\u5B57"})}),Vp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Keyword,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"\u57FA\u7840\u7C7B\u578B"})}),Jp.forEach(c=>{(!l||c.label.toLowerCase().startsWith(l))&&n.push({label:c.label,kind:i.languages.CompletionItemKind.Function,insertText:c.insertText,filterText:c.label,range:r,documentation:c.desc,detail:"\u5185\u5EFA\u51FD\u6570"})}),{suggestions:n}}})}function Wl(i){i.languages.registerCompletionItemProvider("go",{provideCompletionItems:(t,e)=>{let n=[],o=t.getWordUntilPosition(e),r={startLineNumber:e.lineNumber,endLineNumber:e.lineNumber,startColumn:o.startColumn,endColumn:o.endColumn},a=t.getValue(),s=(o.word||"").toLowerCase(),l=a.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,""),c=new Set;return[/\bvar\s+(\w+)/g,/\bvar\s+\w+\s*,\s*(\w+)/g,/(\w+)\s*:=/g,/(?:^|[^\w])(\w+)\s*,\s*(\w+)\s*:=/gm,/for\s+(\w+)\s*,\s*(\w+)\s*:=\s*range/g,/for\s+_\s*,\s*(\w+)\s*:=\s*range/g,/for\s+(\w+)\s*:=\s*range/g,/func\s+\w+\s*\(\s*(\w+)\s+\w+/g,/,\s*(\w+)\s+\w+/g,/func\s*\(\s*(\w+)\s+[*]?\w+\s*\)/g].forEach(d=>{let h;for(;(h=d.exec(l))!==null;)for(let v=1;v{(!s||d.toLowerCase().startsWith(s))&&n.push({label:d,kind:i.languages.CompletionItemKind.Variable,insertText:d,filterText:d,range:r,detail:"\u5DF2\u5B9A\u4E49\u7684\u53D8\u91CF",sortText:"0"+d})}),{suggestions:n}}})}function Yl(i){i.languages.setMonarchTokensProvider("cpp",{defaultToken:"",tokenPostfix:".cpp",keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","continue","decltype","default","delete","do","double","dynamic_cast","else","enum","explicit","export","extern","false","final","float","for","friend","goto","if","inline","int","long","mutable","namespace","new","noexcept","nullptr","operator","override","private","protected","public","register","reinterpret_cast","return","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","while"],typeKeywords:["vector","string","map","set","unordered_map","unordered_set","list","deque","queue","stack","priority_queue","pair","array","forward_list","multimap","multiset","bitset","unique_ptr","shared_ptr","weak_ptr","int8_t","int16_t","int32_t","int64_t","uint8_t","uint16_t","uint32_t","uint64_t","size_t","ptrdiff_t","nullptr_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],symbols:/[=>","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],symbols:/[=>>","&^","+=","-=","*=","/=","%=","&=","|=","^=","<<=",">>=","&^=","&&","||","<-","++","--","==","<",">","=","!","!=","<=",">=",":=","...","(",")","[","]","{","}",",",";",".",":"],symbols:/[=>{let r=setTimeout(()=>{l(),o(new Error(`\u52A0\u8F7D\u8D85\u65F6 (${e}ms): ${t}`))},e),a=`${t}/loader.js`,s=document.createElement("script");s.src=a;let l=()=>{clearTimeout(r),s.onload=null,s.onerror=null};s.onload=()=>{if(!window.require){l(),o(new Error("window.require \u672A\u5B9A\u4E49"));return}try{window.require.config({paths:{vs:t}}),window.require(["vs/editor/editor.main"],()=>{l(),window.monaco?(window.monaco.languages.typescript.javascriptDefaults.setCompilerOptions({target:window.monaco.languages.typescript.ScriptTarget.ES2020,allowNonTsExtensions:!0,moduleResolution:window.monaco.languages.typescript.ModuleResolutionKind.NodeJs,module:window.monaco.languages.typescript.ModuleKind.CommonJS,noEmit:!0,esModuleInterop:!0,allowJs:!0,checkJs:!1}),window.monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1,diagnosticCodesToIgnore:[1108]}),window.monaco.languages.typescript.javascriptDefaults.setEagerModelSync(!0),n(window.monaco)):o(new Error("Monaco Editor \u52A0\u8F7D\u540E window.monaco \u672A\u5B9A\u4E49"))},c=>{l(),o(new Error(`Monaco Editor Main \u52A0\u8F7D\u5931\u8D25: ${c.message||c}`))})}catch(c){l(),o(c)}},s.onerror=()=>{l(),o(new Error(`Script \u52A0\u8F7D\u5931\u8D25: ${a}`))},document.head.appendChild(s)})}async init(){if(!this.isInitialized){this.injectSuggestWidgetStyles();try{if(!this.container)throw new Error("\u7F16\u8F91\u5668\u5BB9\u5668\u4E0D\u5B58\u5728");let t=await this.loadMonaco();if(Yl(t),Bl(t),Fl(t),zl(t),Ul(t),Nl(t),Rl(t),Ol(t),Wl(t),this.editor=t.editor.create(this.container,{value:this.config.value||"",language:this.config.language||"cpp",theme:this.config.theme,fontSize:this.config.fontSize,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,suggestOnTriggerCharacters:!0,quickSuggestions:!0,wordBasedSuggestions:!0,tabCompletion:"on",suggest:{showAbove:!1,showIcons:!0,showStatusBar:!0,previewMode:"prefix",insertMode:"replace"},...this.config.monacoOptions}),!this.editor)throw new Error("Monaco \u7F16\u8F91\u5668\u5B9E\u4F8B\u521B\u5EFA\u5931\u8D25");this.editor.onDidChangeModelContent(()=>{this.handleContentChange()}),this.isInitialized=!0}catch(t){throw console.error("Monaco Editor \u521D\u59CB\u5316\u5931\u8D25:",t),Wa.Notification.error(`\u7F16\u8F91\u5668\u52A0\u8F7D\u5931\u8D25: ${t.message}`),t}}}injectSuggestWidgetStyles(){let t="monaco-suggest-widget-fix";if(document.getElementById(t))return;let e=document.createElement("style");e.id=t,e.textContent=`
/* \u2B50 \u4E0D\u4F7F\u7528 fixed\uFF0C\u4F7F\u7528 absolute */
.monaco-editor .suggest-widget {
z-index: 100000 !important;
}
/* \u786E\u4FDD\u7F16\u8F91\u5668\u5BB9\u5668\u53EF\u4EE5\u6EA2\u51FA */
.monaco-editor {
position: relative;
z-index: 1;
}
/* \u786E\u4FDD\u6709\u8DB3\u591F\u7A7A\u95F4 */
.monaco-editor .suggest-widget .monaco-list {
max-height: 400px;
}
/* \u5173\u952E\uFF1A\u8BA9\u6240\u6709\u7236\u5BB9\u5668\u5141\u8BB8\u6EA2\u51FA */
.monaco-editor,
#monacoEditor,
.code-editor-container,
.editor-wrapper,
.bottom-panel,
.code-panel {
overflow: visible !important;
}
/* \u4F46\u662F\u7F16\u8F91\u5668\u5185\u5BB9\u533A\u57DF\u672C\u8EAB\u9700\u8981\u6EDA\u52A8 */
.monaco-editor .monaco-scrollable-element > .scrollbar {
overflow: auto !important;
}
`,document.head.appendChild(e)}handleContentChange(){this.config.autoSave&&(this.autoSaveTimer!==null&&clearTimeout(this.autoSaveTimer),this.autoSaveTimer=setTimeout(()=>{let t=this.getValue(),e=this.getLanguage();this.changeCallbacks.forEach(n=>{n(t,e)}),this.autoSaveTimer=null},this.config.autoSaveDelay))}getValue(){return this.editor?this.editor.getValue():""}setValue(t){this.editor&&this.editor.setValue(t)}getLanguage(){if(!this.editor)return"";let t=this.editor.getModel();return t?t.getLanguageId():""}setLanguage(t,e=!0){if(!this.editor)return;let n=this.editor.getModel();n&&(window.monaco.editor.setModelLanguage(n,t),e&&Wa.Notification.info(`\u5DF2\u5207\u6362\u5230 ${t}`))}setTheme(t){this.editor&&window.monaco.editor.setTheme(t)}syncThemeWithPage(){let t=document.body.classList.contains("theme--dark");this.setTheme(t?"vs-dark":"vs")}layout(){this.editor&&this.editor.layout()}getEditor(){return this.editor}isReady(){return this.isInitialized&&this.editor!==null}onChange(t){this.changeCallbacks.push(t)}offChange(t){let e=this.changeCallbacks.indexOf(t);e>-1&&this.changeCallbacks.splice(e,1)}focus(){this.editor&&this.editor.focus()}setReadonly(t){this.editor&&this.editor.updateOptions({readOnly:t})}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},this.editor&&t.monacoOptions&&this.editor.updateOptions(t.monacoOptions)}dispose(){this.autoSaveTimer!==null&&(clearTimeout(this.autoSaveTimer),this.autoSaveTimer=null),this.editor&&(this.editor.dispose(),this.editor=null),this.changeCallbacks=[],this.isInitialized=!1}};p(fo,"DEFAULT_CDN_URLS",["https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs","https://unpkg.com/monaco-editor@0.54.0/min/vs","https://cdn.bootcdn.net/ajax/libs/monaco-editor/0.53.0/min/vs","https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.54.0/min/vs","https://lib.baomitu.com/monaco-editor/0.54.0/min/vs"]);var rr=fo;var ar=class{constructor(t){p(this,"storagePrefix");p(this,"docId");p(this,"LANGUAGE_KEY");this.storagePrefix=t.storagePrefix||"hot100",this.docId=t.docId,this.LANGUAGE_KEY=`${this.storagePrefix}_selected_language`}getCodeKey(t){return`${this.storagePrefix}_user_code_${this.docId}_${t}`}saveCode(t,e){try{let n=this.getCodeKey(t);localStorage.setItem(n,e)}catch(n){console.error("\u4FDD\u5B58\u4EE3\u7801\u5931\u8D25:",n)}}getCode(t){try{let e=this.getCodeKey(t);return localStorage.getItem(e)}catch(e){return console.error("\u8BFB\u53D6\u4EE3\u7801\u5931\u8D25:",e),null}}saveLanguage(t){try{localStorage.setItem(this.LANGUAGE_KEY,t)}catch(e){console.error("\u4FDD\u5B58\u8BED\u8A00\u504F\u597D\u5931\u8D25:",e)}}getLanguage(){try{return localStorage.getItem(this.LANGUAGE_KEY)}catch(t){return console.error("\u8BFB\u53D6\u8BED\u8A00\u504F\u597D\u5931\u8D25:",t),null}}deleteCode(t){try{let e=this.getCodeKey(t);localStorage.removeItem(e)}catch(e){console.error("\u5220\u9664\u4EE3\u7801\u5931\u8D25:",e)}}clearAllCode(){try{["cpp","python","java","javascript","go"].forEach(e=>{this.deleteCode(e)})}catch(t){console.error("\u6E05\u7A7A\u4EE3\u7801\u5931\u8D25:",t)}}clearAll(){try{this.clearAllCode(),localStorage.removeItem(this.LANGUAGE_KEY)}catch(t){console.error("\u6E05\u7A7A\u6240\u6709\u6570\u636E\u5931\u8D25:",t)}}hasCode(t){let e=this.getCode(t);return e!==null&&e.trim()!==""}getSavedLanguages(){return["cpp","python","java","javascript","go"].filter(e=>this.hasCode(e))}};function lr(i){return i.startsWith("cc")?"C++":i.startsWith("py")?"Python3":i==="java"?"Java":i==="js"?"JavaScript":i==="go"?"Go":i}var sr=class{constructor(t){p(this,"config");p(this,"selector",null);p(this,"editorManager",null);p(this,"storageManager",null);p(this,"changeCallbacks",[]);p(this,"currentLangKey");p(this,"availableLangKeys",[]);this.config={...t},this.availableLangKeys=t.availableLangKeys,this.currentLangKey=this.availableLangKeys[0],this.selector=t.selector||null,this.editorManager=t.editorManager||null,this.storageManager=t.storageManager||null}getMonacoLanguage(t){return t.startsWith("cc")?"cpp":t.startsWith("py")?"python":t==="java"?"java":t==="js"?"javascript":t==="go"?"go":""}getDisplayName(t){return t.startsWith("cc")?"C++":t.startsWith("py")?"Python":t==="java"?"Java":t==="js"?"JavaScript":t==="go"?"Go":t}async getAvailableLangKey(){return this.availableLangKeys}setEditorManager(t){this.editorManager=t}setStorageManager(t){this.storageManager=t}setSelector(t){this.selector=t,this.initSelector()}initSelector(){this.selector&&this.selector.addEventListener("change",t=>{this.handleSelectorChange(t)})}handleSelectorChange(t){let o=t.target.selectedOptions[0].getAttribute("data-lang-key")||"";this.getMonacoLanguage(o)&&this.switchLanguage(o)}switchLanguage(t){let e=this.getMonacoLanguage(t);this.storageManager&&this.storageManager.saveLanguage(e),this.editorManager&&this.editorManager.setLanguage(e,!1),this.loadCodeForLanguage(e),this.currentLangKey=t,this.changeCallbacks.forEach(n=>{n(e,t)})}loadCodeForLanguage(t){if(!this.editorManager||!this.storageManager)return;let n=this.storageManager.getCode(t)||this.getTemplate(t)||"";this.editorManager.setValue(n)}getCurrentLanguage(){var t;return((t=this.editorManager)==null?void 0:t.getLanguage())||""}getCurrentLanguageKey(){return this.currentLangKey}getLanguageKey(t){for(let e of this.availableLangKeys)if(this.getMonacoLanguage(e)===t)return e;return""}getTemplate(t){var e;return((e=this.config.templates)==null?void 0:e[t])||""}setTemplates(t){this.config.templates=t}getAllowedLanguages(){return this.availableLangKeys}setAvailableLangKeys(t){this.availableLangKeys=JSON.parse(JSON.stringify(t))}getAvailableEditorLangs(){let t=[];for(let e of this.availableLangKeys)t.push(this.getMonacoLanguage(e));return t}getLangKeyFromTabLang(t){let e="";t=="c++"||t=="cpp"?e="cc":t=="python"?e="py":t=="java"?e="java":t=="javascript"?e="js":t=="go"&&(e="go");for(let n of this.availableLangKeys)if(n.startsWith(e))return n;return""}syncExternalLanguageChange(t){let e=this.getLangKeyFromTabLang(t);!e||!this.getMonacoLanguage(e)||(this.selector&&this.selector.querySelectorAll("option").forEach(r=>{r.selected=r.getAttribute("data-lang-key")===e}),this.switchLanguage(e))}init(){var n;let t=(n=this.storageManager)==null?void 0:n.getLanguage(),e="";t&&this.getAvailableEditorLangs().indexOf(t)!==-1?e=t:this.config.defaultLanguage&&this.getAvailableEditorLangs().indexOf(this.config.defaultLanguage)!==-1?e=this.config.defaultLanguage:e=this.getAvailableEditorLangs()[0],this.selector&&this.selector.querySelectorAll("option").forEach(r=>{let a=r.value;r.selected=a===e}),this.currentLangKey=this.getLanguageKey(e)}dispose(){this.changeCallbacks=[],this.selector=null,this.editorManager=null,this.storageManager=null}};var zt=class{static open(t={}){let{title:e="\u64CD\u4F5C\u786E\u8BA4",message:n="\u60A8\u5C06\u653E\u5F03\u6240\u6709\u66F4\u6539\u5E76\u521D\u59CB\u5316\u4EE3\u7801\uFF01",confirmText:o="\u786E\u8BA4",cancelText:r="\u53D6\u6D88",showCancel:a=!0,showIcon:s=!0}=t;return new Promise(l=>{let c=document.createElement("div");c.className="confirm-dialog-mask";let u=document.createElement("div");u.className="confirm-dialog",u.innerHTML=`
${n}
`,c.appendChild(u),document.body.appendChild(c),requestAnimationFrame(()=>{c.classList.add("confirm-enter-mask"),u.classList.add("confirm-enter-dialog")});let d=u.querySelector(".confirm-dialog-btn-confirm"),h=u.querySelector(".confirm-dialog-btn-cancel"),v=w=>{c.classList.remove("confirm-enter-mask"),u.classList.remove("confirm-enter-dialog"),c.classList.add("confirm-leave-mask"),u.classList.add("confirm-leave-dialog");let k=()=>{c.parentNode&&c.parentNode.removeChild(c),l(w)};u.addEventListener("animationend",k,{once:!0})};u.addEventListener("click",w=>w.stopPropagation()),c.addEventListener("click",()=>v(!1)),d&&d.addEventListener("click",()=>v(!0)),h&&h.addEventListener("click",()=>v(!1))})}};var ho=class{constructor(t){p(this,"root");p(this,"animationFrameId",null);p(this,"currentProgress",0);p(this,"loadingOverlays",new Map);p(this,"runBtn",null);p(this,"submitBtn",null);p(this,"onSwitchTabCallback",null);this.root=t.root,this.runBtn=this.root.querySelector("#runBtn"),this.submitBtn=this.root.querySelector("#submitBtn"),this.onSwitchTabCallback=t.onSwitchTabCallback||null}initTabs(){let t=this.root.querySelectorAll(".tab-btn"),e=this.root.querySelectorAll(".tab-panel");t.forEach(n=>{n.addEventListener("click",()=>{var r;let o=n.getAttribute("data-tab");t.forEach(a=>a.classList.remove("active")),e.forEach(a=>a.classList.remove("active")),n.classList.add("active"),(r=this.root.querySelector(`#${o}Panel`))==null||r.classList.add("active"),this.onSwitchTabCallback&&o&&this.onSwitchTabCallback(o)})})}switchToTab(t){let e=this.root.querySelector(`.tab-btn[data-tab="${t}"]`);e&&e.click()}initResizer(t){let{container:e,resizer:n,topPanel:o,bottomPanel:r,minTopHeight:a=200,minBottomHeight:s=100,onResize:l}=t;if(!n||!o||!r)throw console.warn("Resizer\u521D\u59CB\u5316\u5931\u8D25\uFF1A\u7F3A\u5C11\u5FC5\u8981\u5143\u7D20"),new Error("Resizer\u521D\u59CB\u5316\u5931\u8D25\uFF1A\u7F3A\u5C11\u5FC5\u8981\u5143\u7D20");let c=!1,u=0,d=0,h=0,v=L=>{c=!0,u=L.clientY,d=o.offsetHeight,h=r.offsetHeight,e.classList.add("resizing"),n.classList.add("resizing"),L.preventDefault()},w=L=>{if(!c)return;let H=L.clientY-u,_=d+H,M=h-H;_>=a&&M>=s&&(o.style.height=`${_}px`,r.style.height=`${M}px`,l==null||l())},k=()=>{c&&(c=!1,e.classList.remove("resizing"),n.classList.remove("resizing"))};return n.addEventListener("mousedown",v),document.addEventListener("mousemove",w),document.addEventListener("mouseup",k),()=>{n.removeEventListener("mousedown",v),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",k)}}startCountdown(t){let{button:e,seconds:n,textTemplate:o,onComplete:r}=t,a=e.innerHTML,s=n;e.innerHTML=o(s);let l=setInterval(()=>{s--,s>0?e.innerHTML=o(s):(clearInterval(l),e.innerHTML=a,r&&r())},1e3);return l}async showConfirm(t){return zt.open({title:t.title,message:t.message,confirmText:t.confirmText||"\u786E\u8BA4",cancelText:t.cancelText||"\u53D6\u6D88"})}animateProgress(t,e,n){if(this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.currentProgress===0&&t===100){n&&n();return}let o=this.currentProgress,r=t-o,a=300,s=Date.now(),l=()=>{let c=Date.now()-s,u=Math.min(c/a,1),d=1-Math.pow(1-u,2);this.currentProgress=Math.floor(o+r*d),e(this.currentProgress),u<1?this.animationFrameId=requestAnimationFrame(l):(this.currentProgress=t,this.animationFrameId=null,n&&n())};l()}resetProgress(){this.currentProgress=0,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}getCurrentProgress(){return this.currentProgress}showLoadingOverlay(t={}){let{message:e="\u52A0\u8F7D\u4E2D...",spinner:n=!0,target:o=this.root}=t;this.hideLoadingOverlay(o);let r=document.createElement("div");r.className="ui-loading-overlay";let a=document.createElement("div");if(a.className="ui-loading-content",n){let c=document.createElement("div");c.className="ui-loading-spinner",a.appendChild(c)}let s=document.createElement("div");s.className="ui-loading-text",s.textContent=e,a.appendChild(s),r.appendChild(a),window.getComputedStyle(o).position==="static"&&(o.style.position="relative"),o.appendChild(r),this.loadingOverlays.set(o,r),requestAnimationFrame(()=>{r.classList.add("visible")})}updateLoadingMessage(t,e=this.root){let n=this.loadingOverlays.get(e);if(!n)return;let o=n.querySelector(".ui-loading-text");o&&(o.textContent=t)}hideLoadingOverlay(t=this.root){let e=this.loadingOverlays.get(t);e&&(e.classList.remove("visible"),setTimeout(()=>{e&&e.parentNode&&e.parentNode.removeChild(e),this.loadingOverlays.delete(t)},300))}hideAllLoadingOverlays(){Array.from(this.loadingOverlays.keys()).forEach(e=>this.hideLoadingOverlay(e))}dispose(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.hideAllLoadingOverlays(),this.currentProgress=0}};var cr=null;var Vl=[],Ya="acm";function dr(i){i.style.height="auto",i.style.height=i.scrollHeight+"px"}function Qp(i){return i.length?i.map((t,e)=>`
\u7528\u4F8B ${e+1}
`).join(""):'\u6682\u65E0\u9884\u7F6E\u7528\u4F8B '}function Gp(i,t,e=!1){return i.map((n,o)=>{var s,l,c,u;let r="";if(t=="leetcode")r=n.paramInstances.map((d,h)=>{let v=d.name||`param${h}`,w=d.value||"";return`
${v} =
`}).join("");else{let d=n.paramInstances.map(v=>v.value).join(`
`).trim();r=`
`}let a="";if(e){let d=n==null?void 0:n.hasOwnProperty("actualOutput"),h=n==null?void 0:n.hasOwnProperty("expectedOutput");d&&(a+=`
\u4F60\u7684\u8F93\u51FA\uFF1A
`),h&&(a+=`
\u9884\u671F\u8F93\u51FA\uFF1A
`)}return`
`}).join("")}function Xp(i,t,e){let n=i.querySelectorAll(".test-case-body"),o=JSON.parse(JSON.stringify(e));return n.forEach(r=>{let a=parseInt(r.getAttribute("data-case-index")||"0");if(t=="leetcode")r.querySelectorAll(".test-param-textarea").forEach(s=>{o[a].paramInstances.forEach((l,c)=>{s.getAttribute("data-param-name")===l.name&&(l.value=s.value)})});else{let s=r.querySelector('.test-param-textarea[data-param-name="input"]');if(s){let c=s.value.trim().split(`
`);o[a].paramInstances=c.map(u=>({value:u}))}let l=r.querySelector(".test-output .test-param-textarea");l&&(o[a].expectedOutput=l.value.trim())}}),o}function Zp(i,t,e,n,o){let r=i.querySelector(".testcase-tabs"),a=i.querySelector(".test-case-bodies");if(!r||!a){console.error("\u6E32\u67D3\u6D4B\u8BD5\u7528\u4F8B\u9762\u677F\u5931\u8D25\uFF1A\u7F3A\u5C11\u5FC5\u8981\u7684\u5BB9\u5668\u5143\u7D20");return}Vl=JSON.parse(JSON.stringify(e)),r.innerHTML=Qp(e),a.innerHTML=Gp(e,t,o);let s=a.querySelectorAll(".test-param-textarea");n||a.querySelectorAll(".test-param-textarea").forEach(c=>{c.setAttribute("readonly","true"),c.classList.add("readonly")}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{s.forEach(l=>{dr(l),l.hasAttribute("readonly")||l.addEventListener("input",()=>dr(l))})})})}function Va({panel:i,mode:t,testCaseResults:e,canModifyInput:n,showOutput:o,enableResetTestCaseBtn:r=!1}){let a=i.querySelector(".testcase-tabs"),s=i.querySelector(".test-case-bodies");if(!a||!s)throw new Error("\u521D\u59CB\u5316\u6D4B\u8BD5\u7528\u4F8B\u9762\u677F\u5931\u8D25\uFF1A\u7F3A\u5C11\u5FC5\u8981\u7684\u5BB9\u5668\u5143\u7D20");Ya=t,Zp(i,t,e,n,o);let l=a.querySelectorAll(".testcase-tab"),c=s.querySelectorAll(".test-case-body");l.forEach(u=>{u.addEventListener("click",()=>{let d=u.getAttribute("data-case-index");l.forEach(h=>h.classList.remove("active")),u.classList.add("active"),c.forEach(h=>{h.getAttribute("data-case-index")===d?(h.classList.add("active"),requestAnimationFrame(()=>{h.querySelectorAll(".test-param-textarea").forEach(w=>dr(w))})):h.classList.remove("active")})})}),r&&iu(i)}function eu(i,t,e){Va({panel:i,mode:t,testCaseResults:e,canModifyInput:!0,showOutput:t=="acm",enableResetTestCaseBtn:!0})}function tu(i,t,e){Va({panel:i,mode:t,testCaseResults:e,canModifyInput:!1,showOutput:!0})}function nu(i){Va({panel:i,mode:Ya,testCaseResults:Vl,canModifyInput:!0,showOutput:Ya=="acm",enableResetTestCaseBtn:!0})}function iu(i){let t=i.querySelector(".reset-testcase-btn");if(!t){console.warn("\u672A\u627E\u5230\u91CD\u7F6E\u6D4B\u8BD5\u6837\u4F8B\u6309\u94AE\uFF0C\u8DF3\u8FC7\u521D\u59CB\u5316");return}cr&&t.removeEventListener("click",cr),cr=async()=>{zt.open({title:"\u91CD\u7F6E\u786E\u8BA4",message:"\u786E\u8BA4\u8981\u91CD\u7F6E\u6240\u6709\u6D4B\u8BD5\u6837\u4F8B\u4E3A\u521D\u59CB\u503C\u5417\uFF1F\u5F53\u524D\u7684\u4FEE\u6539\u5C06\u4F1A\u4E22\u5931\u3002",confirmText:"\u786E\u8BA4\u91CD\u7F6E",cancelText:"\u53D6\u6D88"}).then(e=>{if(e)nu(i);else return})},t.addEventListener("click",cr)}function ou(){let i=document.querySelector("#testPanel");if(i){let t=i.querySelector(".test-case-body.active");if(t){let e=t.querySelectorAll(".test-param-textarea");console.log("onSwitchTab: Resizing textareas in active test case body"),e.forEach(n=>dr(n))}}}var go={initSelfTestPanel:eu,initResultTestPanel:tu,getCurrentTestCaseInstances:Xp,onSwitchTab:ou};function Hi(){return`
.reviewmodal {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.4);
z-index: 10001;
}
/* \u6DFB\u52A0\u6DE1\u51FA\u7C7B */
.reviewmodal.is-closing {
animation: fadeOut .2s ease forwards;
}
.reviewmodal.is-closing .reviewmodal__content {
animation: slideOut .2s ease forwards;
}
.reviewmodal__content {
background: #fff;
border-radius: 10px;
width: 90%;
max-width: 700px;
max-height: 80vh;
padding: 20px;
box-shadow: 0 10px 30px rgba(0,0,0,.25);
overflow: hidden; /* \u2B50 \u6539\u4E3A hidden\uFF0C\u4E0D\u663E\u793A\u6EDA\u52A8\u6761 */
position: relative;
animation: fadeIn .2s ease;
display: flex; /* \u2B50 \u6DFB\u52A0 flex \u5E03\u5C40 */
flex-direction: column; /* \u2B50 \u5782\u76F4\u65B9\u5411 */
}
.reviewmodal__close {
position: absolute;
top: 10px;
right: 14px;
font-size: 22px;
cursor: pointer;
color: #555;
}
.reviewmodal__close:hover {
transform: scale(1.1);
background: #f5f5f5;
}
/* \u6309\u94AE\u72B6\u6001\u5BB9\u5668\u4E0E\u56FE\u6807 */
.btn-status {
display: inline-flex;
align-items: center;
min-width: 16px;
margin-left: 6px;
vertical-align: middle;
}
.btn-spinner {
width: 12px;
height: 12px;
border: 2px solid rgba(0,0,0,.18);
border-top-color: #409eff;
border-radius: 50%;
animation: spin .7s linear infinite;
display: inline-block;
}
.btn-check {
display: inline-block;
line-height: 1;
font-size: 14px;
color: #16a34a;
}
/* \u5F39\u7A97\u5185\u5BB9\u533A\u57DF */
.reviewmodal__body {
min-height: 140px;
}
.reviewmodal__body.is-loading {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
text-align: center;
}
.reviewmodal__body.is-loading > *:not(.spinner):not(.loading-text) {
display: none !important;
}
.reviewmodal__body.is-result {
display: block;
text-align: left;
}
.loading-text {
margin: 0;
font-size: 1.4rem;
line-height: 1.6;
}
/* \u5F39\u7A97\u91CC\u7684\u8F6C\u5708\u52A8\u753B */
.spinner {
width: 18px;
height: 18px;
border: 3px solid rgba(0,0,0,.15);
border-top-color: #409eff;
border-radius: 50%;
animation: spin .8s linear infinite;
flex: 0 0 auto;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@keyframes blink {
0%, 50% { opacity: 1; }
51%, 100% { opacity: 0; }
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
/* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes slideOut {
from { opacity: 1; transform: translateY(0); }
to { opacity: 0; transform: translateY(10px); }
}
@media (prefers-reduced-motion: reduce) {
.reviewmodal__content { animation: none; }
.spinner, .btn-spinner { animation: none; }
}
/* \u63D0\u4EA4\u8BB0\u5F55\u9875\u4FA7\u680F\uFF1A\u4E0E problem_ide AI \u9650\u989D\u6761\u4E00\u81F4 */
.record-detail-ai-sidebar .ai-analysis-quota-bar {
flex-shrink: 0;
padding: 8px 12px 10px;
border-bottom: 1px solid #fde68a;
background: linear-gradient(180deg, #fffbeb, #fff7ed);
font-size: 12px;
color: #57534e;
text-align: center;
line-height: 1.55;
}
.record-detail-ai-sidebar .ai-analysis-quota-bar__num {
font-weight: 700;
color: #92400e;
}
.record-detail-ai-sidebar .ai-analysis-quota-bar__vip-link {
color: #f97316 !important;
font-weight: 700;
text-decoration: none;
}
.record-detail-ai-sidebar .ai-analysis-quota-bar__vip-link:hover {
text-decoration: underline;
color: #ea580c;
}
.record-detail-ai-sidebar .menu__link[disabled],
.record-detail-ai-sidebar .menu__link[aria-disabled="true"] {
opacity: 0.45;
cursor: not-allowed;
pointer-events: none;
}
.theme--dark .record-detail-ai-sidebar .ai-analysis-quota-bar {
border-bottom-color: #422006;
background: linear-gradient(180deg, #2d1f04, #1c1410);
color: #d6d3d1;
}
.theme--dark .record-detail-ai-sidebar .ai-analysis-quota-bar__num {
color: #fdba74;
}
.theme--dark .record-detail-ai-sidebar .ai-analysis-quota-bar__vip-link {
color: #fb923c;
}
.theme--dark .record-detail-ai-sidebar .ai-analysis-quota-bar__vip-link:hover {
color: #fdba74;
}
/* \u63D0\u4EA4\u8BB0\u5F55 SSE \u5206\u6790\u5F39\u7A97\uFF08\u9009\u62E9\u9898\u5F0F\u6D41\u5F0F Markdown\uFF09 */
.reviewmodal__content--record-ai {
max-width: 820px;
width: 92%;
max-height: 88vh;
display: flex;
flex-direction: column;
}
.reviewmodal__content--record-ai .reviewmodal__body.is-result {
max-height: min(72vh, 640px);
overflow: auto;
text-align: left;
}
.reviewmodal__ai-live {
min-height: 3em;
}
/* \u5D4C\u5165\u5728\u7EBF IDE / \u4EE3\u7801\u7B14\u8BB0\u4FA7\u680F\uFF1A\u4E0E\u63D0\u4EA4\u8BB0\u5F55\u5F39\u7A97\u5185\u7ED3\u679C\u533A\u4E00\u81F4 */
.record-ai-stream-panel.is-loading {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
min-height: 160px;
padding: 16px;
text-align: center;
flex: 1;
box-sizing: border-box;
}
.record-ai-stream-panel.is-loading .loading-text {
margin: 0;
font-size: 1.05rem;
color: #57534e;
}
.record-ai-stream-panel.is-result {
flex: 1;
min-height: 0;
overflow: auto;
max-height: min(60vh, 520px);
padding: 12px 10px 16px 4px;
text-align: left;
box-sizing: border-box;
border-radius: 8px;
background: #fafafa;
border: 1px solid #e5e7eb;
}
.theme--dark .record-ai-stream-panel.is-loading .loading-text {
color: #a8a29e;
}
.theme--dark .record-ai-stream-panel.is-result {
background: #0d1117;
border-color: #21262d;
}
.record-detail-ai-quota.ai-analysis-quota-bar {
border-radius: 8px 8px 0 0;
margin-bottom: 0;
}
`}var ru="/codenote-api/record-ai-analysis/stream";function En(i){let t=Number(i);return t===30||t===10||t===5||Number.isFinite(t)&&t>0?t:5}var Ka=30;function Pi(i,t){var o;let e=En(i),n=(o=t==null?void 0:t.vipClass)!=null?o:"ai-analysis-quota-bar__vip-link";return e\u5F00\u901A\u4F1A\u5458 \u53EF\u4EAB\u6BCF\u65E5 ${Ka} \u6B21`:"\uFF0C\u989D\u5EA6\u660E\u65E5\u5237\u65B0"}function Di(i){let t=En(i);return t<=5?'\u4ECA\u65E5 AI \u6B21\u6570\u5DF2\u7528\u5B8C\uFF08\u975E\u4F1A\u5458\u6BCF\u65E5 5 \u6B21\uFF09\u3002\u5F00\u901A\u4F1A\u5458 \u53EF\u4EAB\u6BCF\u65E5 30 \u6B21\uFF0C\u660E\u65E5\u5237\u65B0\u3002':t\u5F00\u901A\u4F1A\u5458 \u53EF\u4EAB\u6BCF\u65E5 30 \u6B21\uFF0C\u660E\u65E5\u5237\u65B0\u3002`:"\u4ECA\u65E5 AI \u6B21\u6570\u5DF2\u7528\u5B8C\uFF08\u4F1A\u5458\u6BCF\u65E5 30 \u6B21\uFF09\uFF0C\u660E\u65E5\u5237\u65B0\u3002"}function Jl(i){var o;let t=[],e=i.split(`
`),n=(o=e.pop())!=null?o:"";for(let r of e)for(let a of r.split(`
`)){let s=a.trim();if(s.startsWith("data: "))try{t.push(JSON.parse(s.slice(6)))}catch(l){}}return{events:t,rest:n}}function pr(i){return String(i||"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}var Kl="record-ai-code-block-styles",bo="record-ai-stream-md";function ur(){if(document.getElementById(Kl))return;let i=document.createElement("style");i.id=Kl;let t=bo;i.textContent=`
/* ---------- \u4EE3\u7801\u5757\u5916\u58F3 + \u590D\u5236\uFF08\u5BF9\u9F50\u4EE3\u7801\u7B14\u8BB0\u9898\u9762\u4EE3\u7801\u5757\u89C2\u611F\uFF09 ---------- */
.${t} .record-ai-code-block {
margin: 16px 0;
border: 1px solid #e5e7eb;
border-radius: 8px;
overflow: hidden;
background: #f3f4f6;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.theme--dark .${t} .record-ai-code-block {
border-color: #30363d;
background: #21262d;
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.${t} .record-ai-code-block__toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 8px 12px;
border-bottom: 1px solid #e5e7eb;
background: #e5e7eb;
font-size: 12px;
line-height: 1.3;
}
.theme--dark .${t} .record-ai-code-block__toolbar {
border-bottom-color: #30363d;
background: #2d333b;
}
.${t} .record-ai-code-block__lang {
font-weight: 600;
color: #4b5563;
letter-spacing: 0.02em;
font-family: 'Consolas', 'Monaco', 'Courier New', ui-monospace, monospace;
}
.theme--dark .${t} .record-ai-code-block__lang {
color: #adbac7;
}
.${t} .record-ai-code-block__copy {
flex-shrink: 0;
margin: 0;
padding: 5px 12px;
border: 1px solid #d1d5db;
border-radius: 6px;
background: #fff;
color: #1f2937;
font-size: 12px;
font-weight: 600;
cursor: pointer;
line-height: 1.25;
}
.${t} .record-ai-code-block__copy:hover {
background: #f9fafb;
border-color: #9ca3af;
}
.${t} .record-ai-code-block__copy:focus-visible {
outline: 2px solid #2563eb;
outline-offset: 1px;
}
.theme--dark .${t} .record-ai-code-block__copy {
border-color: #444c56;
background: #373e47;
color: #e6edf3;
}
.theme--dark .${t} .record-ai-code-block__copy:hover {
background: #444c56;
border-color: #636c76;
}
/* \u4EE3\u7801\u533A\uFF1A\u4E0E codenote markdown-body.css \u4E00\u81F4 #282828 + \u6D45\u7070\u5B57 */
.${t} .record-ai-code-block pre {
margin: 0 !important;
padding: 0 !important;
border: none !important;
border-radius: 0 !important;
background: #282828 !important;
box-shadow: none !important;
overflow: hidden;
}
.${t} .record-ai-code-block pre code {
display: block;
padding: 16px !important;
margin: 0 !important;
font-size: 14px !important;
line-height: 1.5 !important;
color: #e5e7eb !important;
background: transparent !important;
border-radius: 0 !important;
overflow-x: auto;
font-family: 'Consolas', 'Monaco', 'Courier New', ui-monospace, monospace !important;
tab-size: 4;
}
.${t} .record-ai-code-block pre code::-webkit-scrollbar { height: 8px; }
.${t} .record-ai-code-block pre code::-webkit-scrollbar-track {
background: #2d2d2d;
border-radius: 4px;
}
.${t} .record-ai-code-block pre code::-webkit-scrollbar-thumb {
background: #555;
border-radius: 4px;
}
.${t} .record-ai-code-block pre code::-webkit-scrollbar-thumb:hover { background: #666; }
/* \u6D41\u5F0F\u9636\u6BB5\u5E38\u89C1\u7ED3\u6784\uFF1Amarkdown-body \u76F4\u63A5\u5B50\u7EA7 pre\uFF08\u4E0E\u4EE3\u7801\u7B14\u8BB0\u5757\u4E00\u81F4\uFF09 */
.${t}.markdown-body > pre,
.${t} .markdown-body > pre {
margin: 16px 0;
background: #282828 !important;
border-radius: 8px !important;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
.${t}.markdown-body > pre > code,
.${t} .markdown-body > pre > code {
display: block;
background: #282828 !important;
color: #e5e7eb !important;
padding: 16px !important;
font-size: 14px !important;
line-height: 1.5 !important;
}
/* ---------- \u4EAE\u8272\uFF1A\u6B63\u6587 ---------- */
.${t}.markdown-body,
.${t} .markdown-body {
color: #24292f;
}
.${t}.markdown-body h1,
.${t}.markdown-body h2,
.${t}.markdown-body h3,
.${t} .markdown-body h1,
.${t} .markdown-body h2,
.${t} .markdown-body h3 {
color: #1f2937;
}
/* ---------- \u6697\u8272\u4E3B\u9898\uFF1A\u6B63\u6587\uFF08\u5BF9\u9F50 codenote markdown-body \u6697\u8272\u6BB5\uFF09 ---------- */
.theme--dark .${t}.markdown-body,
.theme--dark .${t} .markdown-body {
color: #c9d1d9;
}
.theme--dark .${t}.markdown-body h1,
.theme--dark .${t}.markdown-body h2,
.theme--dark .${t}.markdown-body h3,
.theme--dark .${t}.markdown-body h4,
.theme--dark .${t}.markdown-body h5,
.theme--dark .${t}.markdown-body h6,
.theme--dark .${t} .markdown-body h1,
.theme--dark .${t} .markdown-body h2,
.theme--dark .${t} .markdown-body h3,
.theme--dark .${t} .markdown-body h4,
.theme--dark .${t} .markdown-body h5,
.theme--dark .${t} .markdown-body h6 {
color: #c9d1d9;
}
.theme--dark .${t}.markdown-body p,
.theme--dark .${t}.markdown-body li,
.theme--dark .${t} .markdown-body p,
.theme--dark .${t} .markdown-body li {
color: #c9d1d9;
}
.theme--dark .${t}.markdown-body a,
.theme--dark .${t} .markdown-body a {
color: #58a6ff;
}
.theme--dark .${t}.markdown-body a:hover,
.theme--dark .${t} .markdown-body a:hover {
color: #79b8ff;
}
.theme--dark .${t}.markdown-body code:not(pre code),
.theme--dark .${t} .markdown-body code:not(pre code) {
background: #21262d;
color: #ffa116;
}
.theme--dark .${t}.markdown-body blockquote,
.theme--dark .${t} .markdown-body blockquote {
color: #8b949e;
border-left-color: #30363d;
}
.theme--dark .${t}.markdown-body hr,
.theme--dark .${t} .markdown-body hr {
border-top-color: #30363d;
background-color: #30363d;
}
.theme--dark .${t}.markdown-body th,
.theme--dark .${t}.markdown-body td,
.theme--dark .${t} .markdown-body th,
.theme--dark .${t} .markdown-body td {
border-color: #30363d;
}
.theme--dark .${t}.markdown-body th,
.theme--dark .${t} .markdown-body th {
background: #21262d;
}
.theme--dark .${t}.markdown-body tbody,
.theme--dark .${t} .markdown-body tbody {
background-color: #161b22;
}
.theme--dark .${t}.markdown-body strong,
.theme--dark .${t} .markdown-body strong {
color: #e6edf3;
}
`,document.head.appendChild(i)}var au={cpp:"C++",c:"C",python:"Python",py:"Python",java:"Java",javascript:"JavaScript",js:"JavaScript",typescript:"TypeScript",ts:"TypeScript",go:"Go",rust:"Rust",rs:"Rust",kotlin:"Kotlin",swift:"Swift",sql:"SQL",bash:"Bash",sh:"Shell",shell:"Shell",yaml:"YAML",yml:"YAML",json:"JSON",html:"HTML",css:"CSS",xml:"XML",markdown:"Markdown",md:"Markdown",text:"Text",plaintext:"Text"};function su(i){let e=String(i.className||"").match(/\blanguage-([a-z0-9+#-]+)\b/i);if(!e)return"\u4EE3\u7801";let n=e[1].toLowerCase();return au[n]||n.replace(/^[a-z]/,o=>o.toUpperCase())}async function lu(i){var t;if((t=navigator.clipboard)!=null&&t.writeText)try{return await navigator.clipboard.writeText(i),!0}catch(e){}try{let e=document.createElement("textarea");e.value=i,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.select();let n=document.execCommand("copy");return e.remove(),n}catch(e){return!1}}function Qa(i){if(!i)return;let t=i.querySelectorAll("pre");for(let e=0;e{var h;let d=(h=r.textContent)!=null?h:"";(async()=>{let v=await lu(d),w=u.textContent;u.textContent=v?"\u5DF2\u590D\u5236":"\u590D\u5236\u5931\u8D25",setTimeout(()=>{u.textContent=w},v?1600:2200)})()}),l.appendChild(c),l.appendChild(u),s.appendChild(l),a.insertBefore(s,n),s.appendChild(n)}}function $i(){if(!document.querySelector('link[data-record-ai-md="1"]')){let i=document.createElement("link");i.rel="stylesheet",i.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Falgcourse%2Fgithub-markdown.min.css%3Fv%3D1.0.0",i.setAttribute("data-record-ai-md","1"),document.head.appendChild(i)}ur()}function cu(i){let t=i.parentElement;for(;t&&t!==document.documentElement;){let n=window.getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}function Ja(i,t){let e=cu(i),n=e?e.scrollTop:0,o=e?e.scrollHeight:0,r=e?e.clientHeight:0,a=e?o-n-r<56:!0;if(i.innerHTML=t,!e)return;let s=e.scrollHeight;a?e.scrollTop=s:e.scrollTop=n+(s-o)}async function Bi(i,t,e){t.className=`markdown-body reviewmodal__ai-live ${bo}`,t.style.cssText="min-height:4em;line-height:1.55;",ur();try{let n=await fetch(ru,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({rid:i}),signal:e==null?void 0:e.signal});if((n.headers.get("content-type")||"").includes("application/json")){let M=(await n.json()).error||"\u8BF7\u6C42\u5931\u8D25";return t.innerHTML=`${pr(M)}
`,{ok:!1,error:M,aiQuota:null}}if(!n.ok||!n.body){let _=n.statusText||"\u8BF7\u6C42\u5931\u8D25";return t.innerHTML=`${pr(_)}
`,{ok:!1,error:_,aiQuota:null}}t.innerHTML="";let r=document.createElement("div");r.className="record-ai-stream-html-root",t.appendChild(r);let a=n.body.getReader(),s=new TextDecoder,l="",c=null,u=null,d=null,h=null,v=!0,w=()=>{if(h!==null&&(clearTimeout(h),h=null),d===null)return;let _=d;d=null,Ja(r,_)},k=_=>{if(d=_,v){v=!1,w();return}h!==null&&clearTimeout(h),h=setTimeout(w,85)},L=()=>{h!==null&&(clearTimeout(h),h=null),d!==null&&(Ja(r,d),d=null)},H=_=>{let M;for(let A of _){let D=A;D.type==="html"&&typeof D.html=="string"?M=D.html:D.type==="done"?c=D:D.type==="error"&&(u=String(D.error||"\u5206\u6790\u5931\u8D25"))}M!==void 0&&k(M)};for(;;){let{done:_,value:M}=await a.read();if(_)break;l+=s.decode(M,{stream:!0});let{events:A,rest:D}=Jl(l);l=D,H(A)}return H(Jl(`${l}
`).events),L(),u?(t.innerHTML=`${pr(u)}
`,{ok:!1,error:u,aiQuota:null}):c!=null&&c.contentHtml&&typeof c.contentHtml=="string"?(Ja(t,`${c.contentHtml}
`),Qa(t),{ok:!0,contentHtml:c.contentHtml,aiQuota:c.aiQuota||null}):(t.innerHTML='\u5206\u6790\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5
',{ok:!1,error:"\u5206\u6790\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5",aiQuota:null})}catch(n){if((n&&typeof n=="object"&&"name"in n?String(n.name):"")==="AbortError")return{ok:!1,error:"",aiQuota:null};let r=n instanceof Error?n.message:String(n);return t.innerHTML=`${pr(r)}
`,{ok:!1,error:r,aiQuota:null}}}function du(i){return String(i||"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}var mr=class{constructor(t){p(this,"submission");p(this,"submissionPageUrl");p(this,"onAskAI");p(this,"dialog",null);p(this,"overlay",null);p(this,"aiAnalysisQuotaRef",null);p(this,"abortController",null);p(this,"isStreaming",!1);p(this,"isClosing",!1);var n;this.submission=t.submission,this.submissionPageUrl=t.submissionPageUrl,this.onAskAI=t.onAskAI;let e=(n=window.UiContext)==null?void 0:n.recordDetailAiAnalysisQuota;e!=null&&e.limited&&(this.aiAnalysisQuotaRef={limited:!0,remaining:Number(e.remaining)||0,dailyLimit:En(e.dailyLimit)})}ensureStyles(){if(document.getElementById("record-ai-reviewmodal-styles"))return;let t=document.createElement("style");t.id="record-ai-reviewmodal-styles",t.textContent=Hi(),document.head.appendChild(t),$i()}renderQuotaBar(){var r,a;let t=(r=this.dialog)==null?void 0:r.querySelector("#recordDetailAiQuotaBar");if(!t)return;if(!((a=this.aiAnalysisQuotaRef)!=null&&a.limited)){t.hidden=!0,t.innerHTML="";return}t.hidden=!1;let e=this.aiAnalysisQuotaRef.remaining,n=this.aiAnalysisQuotaRef.dailyLimit,o=Pi(n);t.innerHTML=`\u4ECA\u65E5 AI\uFF1A${e} / ${n} \u6B21${o}
`}applyAiQuotaFromApi(t){var e;(e=t==null?void 0:t.aiQuota)!=null&&e.limited&&(this.aiAnalysisQuotaRef={limited:!0,remaining:Number(t.aiQuota.remaining)||0,dailyLimit:En(t.aiQuota.dailyLimit)})}showLimitedDialog(){var r,a;this.ensureStyles();let t=document.createElement("div");t.className="reviewmodal";let e=Di((r=this.aiAnalysisQuotaRef)==null?void 0:r.dailyLimit);t.innerHTML=`
`,document.body.appendChild(t);let n=t.querySelector("#codenoteAiLimitMsg");n&&(n.innerHTML=e);let o=()=>{t.classList.add("is-closing"),setTimeout(()=>t.remove(),200)};(a=t.querySelector(".reviewmodal__close"))==null||a.addEventListener("click",o),t.addEventListener("click",s=>{s.target===t&&o()})}show(){var t;if((t=this.aiAnalysisQuotaRef)!=null&&t.limited&&this.aiAnalysisQuotaRef.remaining<=0){this.ensureStyles(),this.showLimitedDialog();return}this.ensureStyles(),this.createDialog(),this.attachEventListeners(),document.body.appendChild(this.overlay),document.body.appendChild(this.dialog),requestAnimationFrame(()=>{var e,n;(e=this.overlay)==null||e.classList.add("active"),(n=this.dialog)==null||n.classList.add("active")}),document.body.style.overflow="hidden",this.renderQuotaBar(),this.runAiStream()}async close(){var t,e,n;if(!this.isClosing){if(this.isStreaming){if(this.isClosing=!0,!await zt.open({title:"\u64CD\u4F5C\u786E\u8BA4",message:"AI \u6B63\u5728\u8F93\u51FA\u4E2D\uFF0C\u786E\u5B9A\u8981\u5173\u95ED\u5417\uFF1F"})){this.isClosing=!1;return}(t=this.abortController)==null||t.abort()}(e=this.overlay)==null||e.classList.remove("active"),(n=this.dialog)==null||n.classList.remove("active"),setTimeout(()=>{var o,r;(o=this.overlay)==null||o.remove(),(r=this.dialog)==null||r.remove(),document.body.style.overflow="",this.dialog=null,this.overlay=null,this.isClosing=!1},300)}}async runAiStream(){var s,l,c;let t=(s=this.dialog)==null?void 0:s.querySelector("#recordAiStreamRoot"),e=this.submission.rid;if(!t)return;let n="recordAiStreamLive";t.classList.remove("is-loading"),t.classList.add("is-result"),t.innerHTML=`
`;let o=t.querySelector(`#${n}`);if(!o)return;this.abortController=new AbortController,this.isStreaming=!0;let r=await Bi(e,o,{signal:this.abortController.signal});if(this.isStreaming=!1,this.abortController=null,r.ok){r.aiQuota&&this.applyAiQuotaFromApi({aiQuota:r.aiQuota}),this.renderQuotaBar();return}let a=(l=r.error)!=null?l:"";a&&((c=this.aiAnalysisQuotaRef)!=null&&c.limited&&/次数已用完|403/.test(a)&&(this.aiAnalysisQuotaRef={...this.aiAnalysisQuotaRef,remaining:0}),t.classList.remove("is-result"),t.classList.add("is-loading"),t.innerHTML=`${du(a)}
`,this.renderQuotaBar())}createDialog(){this.overlay=document.createElement("div"),this.overlay.className="record-detail-overlay",this.dialog=document.createElement("div"),this.dialog.className="record-detail-dialog";let t=this.getStatusInfo(),e=this.formatTime();this.dialog.innerHTML=`
\u4EE3\u7801 AI \u5206\u6790
\u6B63\u5728\u8FDE\u63A5 AI \u5206\u6790\u670D\u52A1\u2026
`;let n=window.Prism,o=this.dialog.querySelector(".record-detail-code-container");n&&o&&n.highlightAllUnder(o)}attachEventListeners(){var t,e;!this.dialog||!this.overlay||((t=this.dialog.querySelector(".record-detail-close"))==null||t.addEventListener("click",()=>void this.close()),this.overlay.addEventListener("click",()=>void this.close()),this.dialog.addEventListener("click",n=>n.stopPropagation()),(e=this.dialog.querySelector(".record-detail-left"))==null||e.addEventListener("click",()=>{let n=this.submissionPageUrl.replace("{rid}",this.submission.rid);window.open(n,"_blank")}))}getStatusInfo(){return this.submission.score===100?{text:"\u2713 \u5B8C\u5168\u901A\u8FC7",class:"accepted"}:this.submission.score===0?{text:this.getStatusText(this.submission.statusText),class:"error"}:{text:`\u90E8\u5206\u901A\u8FC7 (${this.submission.score}%)`,class:"partial"}}getStatusText(t){return{Waiting:"\u7B49\u5F85\u4E2D",Judging:"\u8BC4\u6D4B\u4E2D",Compiling:"\u7F16\u8BD1\u4E2D","Compile Error":"\u7F16\u8BD1\u9519\u8BEF","System Error":"\u7CFB\u7EDF\u9519\u8BEF",Canceled:"\u5DF2\u53D6\u6D88","Unknown Error":"\u672A\u77E5\u9519\u8BEF",Accepted:"\u2713 \u5B8C\u5168\u901A\u8FC7","Wrong Answer":"\u7B54\u6848\u9519\u8BEF","Time Limit Exceeded":"\u65F6\u95F4\u8D85\u9650","Memory Limit Exceeded":"\u5185\u5B58\u8D85\u9650","Runtime Error":"\u8FD0\u884C\u9519\u8BEF","Format Error":"\u683C\u5F0F\u9519\u8BEF"}[t]||t}formatTime(){let t=new Date(this.submission.timestamp);return`${t.getMonth()+1}/${t.getDate()} ${t.getHours()}:${t.getMinutes().toString().padStart(2,"0")}`}};var fr=class{constructor(t){p(this,"container");p(this,"uiManager");p(this,"storageKey");p(this,"submissionPageUrl");p(this,"onFetchSubmissions");p(this,"submissions",[]);p(this,"aiRecords",new Map);p(this,"submissionsList",null);p(this,"autoUpdateTimer",null);this.container=t.container,this.uiManager=t.uiManager,this.storageKey=t.storageKey||"hot100_ai_records",this.submissionPageUrl=t.submissionPageUrl||"/record/{rid}",this.onFetchSubmissions=t.onFetchSubmissions,this.loadAIRecords()}async init(){this.submissionsList=this.container.querySelector("#aiSubmissionsList"),await this.loadSubmissions(),this.renderSubmissionsList(),this.startAutoUpdate()}startAutoUpdate(){this.autoUpdateTimer!==null&&clearInterval(this.autoUpdateTimer),this.autoUpdateTimer=window.setInterval(()=>{this.renderSubmissionsList()},3e4)}loadAIRecords(){try{let t=localStorage.getItem(this.storageKey);t&&JSON.parse(t).forEach(n=>{this.aiRecords.set(n.rid,n)})}catch(t){console.error("\u52A0\u8F7DAI\u8BB0\u5F55\u5931\u8D25:",t)}}async loadSubmissions(){try{this.submissions=await this.onFetchSubmissions()}catch(t){console.error("\u52A0\u8F7D\u63D0\u4EA4\u8BB0\u5F55\u5931\u8D25:",t),this.submissions=[]}}renderSubmissionsList(){if(!this.submissionsList)return;if(this.submissions.length===0){this.submissionsList.innerHTML=`
\u6682\u65E0\u63D0\u4EA4\u8BB0\u5F55
\u5B8C\u6210\u4EE3\u7801\u63D0\u4EA4\u540E\u53EF\u5728\u6B64\u67E5\u770B
`;return}let t=Date.now();this.submissionsList.innerHTML=this.submissions.map(e=>{let o=!!this.aiRecords.get(e.rid),r=this.formatTimeDisplay(e.timestamp,t),a=this.getStatusInfo(e);return`
${e.score}\u5206
${a.text}
${o?'\u2713 ':""}
${lr(e.language)||"\u672A\u77E5\u8BED\u8A00"}
${r}
`}).join(""),this.submissionsList.querySelectorAll(".ai-submission-item").forEach(e=>{e.addEventListener("click",()=>{let n=e.getAttribute("data-rid");n&&this.handleSubmissionClick(n)})})}formatTimeDisplay(t,e){if(e-t<3e4)return"\u521A\u521A";let o=new Date(t);return`${o.getMonth()+1}/${o.getDate()} ${o.getHours()}:${o.getMinutes().toString().padStart(2,"0")}`}getStatusInfo(t){return t.score===100?{text:"\u2713 \u5B8C\u5168\u901A\u8FC7",class:"accepted"}:t.score===0?{text:this.getStatusText(t.statusText),class:"error"}:{text:`\u90E8\u5206\u901A\u8FC7 (${t.score}%)`,class:"partial"}}getStatusText(t){return{Waiting:"\u7B49\u5F85\u4E2D",Judging:"\u8BC4\u6D4B\u4E2D",Compiling:"\u7F16\u8BD1\u4E2D","Compile Error":"\u7F16\u8BD1\u9519\u8BEF","System Error":"\u7CFB\u7EDF\u9519\u8BEF",Canceled:"\u5DF2\u53D6\u6D88","Unknown Error":"\u672A\u77E5\u9519\u8BEF",Accepted:"\u2713 \u5B8C\u5168\u901A\u8FC7","Wrong Answer":"\u7B54\u6848\u9519\u8BEF","Time Limit Exceeded":"\u65F6\u95F4\u8D85\u9650","Memory Limit Exceeded":"\u5185\u5B58\u8D85\u9650","Runtime Error":"\u8FD0\u884C\u9519\u8BEF","Format Error":"\u683C\u5F0F\u9519\u8BEF"}[t]||t}handleSubmissionClick(t){let e=this.submissions.find(o=>o.rid===t);if(!e)return;new mr({submission:e,submissionPageUrl:this.submissionPageUrl}).show()}async refresh(){await this.loadSubmissions(),this.renderSubmissionsList()}dispose(){this.autoUpdateTimer!==null&&(clearInterval(this.autoUpdateTimer),this.autoUpdateTimer=null)}};var Ql=5,hr=class{constructor(t){p(this,"root");p(this,"pid");p(this,"enableAI");p(this,"lockManager");p(this,"editorManager",null);p(this,"codeStorageManager",null);p(this,"floatingWindowManager",null);p(this,"uiManager",null);p(this,"languageManager",null);p(this,"askAIManager",null);p(this,"judgeClient",null);p(this,"testCaseInstances",[]);p(this,"templateCode",null);p(this,"currentMode","leetcode");p(this,"isDisconnect",!1);p(this,"testPanel");p(this,"testPanelTabBtn");p(this,"resultPanel");p(this,"resultTime");p(this,"resultStatus");p(this,"submitBtn");p(this,"runBtn");p(this,"outputPanel");p(this,"testCaseListInResultPanel");p(this,"aiPanel");p(this,"aiPanelTabBtn");p(this,"resizerCleanup",null);p(this,"runCode",async()=>{});this.root=t,this.pid=t.getAttribute("data-pid")||"",this.enableAI=t.getAttribute("data-enable-ai")==="true",this.lockManager=new Zo}onSwitchTab(t){t=="test"&&go.onSwitchTab()}async init(){var t;this.root.innerHTML=Oa(this.pid,"",this.enableAI);try{this.uiManager=new ho({root:this.root,onSwitchTabCallback:this.onSwitchTab.bind(this)}),this.uiManager.showLoadingOverlay({message:"\u7F16\u8F91\u5668\u521D\u59CB\u5316\u4E2D...",spinner:!0}),this.codeStorageManager=new ar({storagePrefix:"hot100",docId:this.pid}),this.languageManager=new sr({storageManager:this.codeStorageManager,availableLangKeys:[]}),this.uiManager.updateLoadingMessage("\u8FDE\u63A5\u670D\u52A1\u5668\u4E2D..."),this.judgeClient=new nr({pid:this.pid,domainId:UiContext.domain._id,userId:UserContext._id,wsPrefix:UiContext.ws_prefix,onConnect:()=>{var r;this.isDisconnect&&(this.isDisconnect=!1,(r=this.uiManager)==null||r.hideLoadingOverlay())},onDisconnect:()=>{var r;this.isDisconnect||(r=this.uiManager)==null||r.showLoadingOverlay({message:"\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u6B63\u5728\u91CD\u8FDE...",spinner:!0}),this.isDisconnect=!0},onError:r=>{},onStatusUpdate:r=>this.handleJudgeStatusUpdate(r),onResult:r=>this.handleJudgeResult(r),onSelfTestInputFormatError:r=>this.handleSelfTestInputFormatError(r)});let e=await this.judgeClient.init();this.templateCode=e.templateCode,this.testCaseInstances=e.testCaseInstances,this.currentMode=e.mode,this.languageManager.setAvailableLangKeys(e.availableLangKeys),this.uiManager.updateLoadingMessage("\u52A0\u8F7D\u7F16\u8F91\u5668..."),this.languageManager.setTemplates(this.templateCode||{});let n=await this.languageManager.getAvailableLangKey(),o=Object.keys(n).map(r=>{var d,h,v;let a=n[r],s=(d=this.languageManager)==null?void 0:d.getDisplayName(a),l=(h=this.languageManager)==null?void 0:h.getMonacoLanguage(a),c=(v=this.codeStorageManager)==null?void 0:v.getLanguage();return`${s} `}).join("");this.root.innerHTML=Oa(this.pid,o,this.enableAI),this.uiManager=new ho({root:this.root,onSwitchTabCallback:this.onSwitchTab.bind(this)}),this.uiManager.showLoadingOverlay({message:"\u521D\u59CB\u5316\u7EC4\u4EF6...",spinner:!0});try{await this.initEditor()}catch(r){throw new Error(r.message)}this.languageManager&&this.editorManager&&(this.languageManager.setEditorManager(this.editorManager),this.languageManager.init()),this.initTabs(),go.initSelfTestPanel(this.testPanel,this.currentMode,this.testCaseInstances),this.initLanguageSelector(),this.initFloatWindowButton(),this.initRunCodeButton(),this.initResetButton(),this.initEditorResizer(),this.enableAI&&this.initAskAI(),this.uiManager.hideLoadingOverlay()}catch(e){(t=this.uiManager)==null||t.hideLoadingOverlay(),this.root.innerHTML=`
\u26A0\uFE0F
\u7F16\u8F91\u5668\u521D\u59CB\u5316\u5931\u8D25: ${e.message}
\u91CD\u65B0\u52A0\u8F7D
`,console.error("IDE \u521D\u59CB\u5316\u5931\u8D25:",e)}}async initEditor(){var t,e,n,o,r;try{let a=this.root.querySelector("#monacoEditor");if(!a){console.error("\u627E\u4E0D\u5230\u7F16\u8F91\u5668\u5BB9\u5668");return}let s=(t=this.codeStorageManager)==null?void 0:t.getLanguage(),l="";((e=this.languageManager)==null?void 0:e.getAvailableEditorLangs().indexOf(s||""))===-1?l=((n=this.languageManager)==null?void 0:n.getAvailableEditorLangs()[0])||"":l=s||((o=this.languageManager)==null?void 0:o.getAvailableEditorLangs()[0])||"";let c=(r=this.codeStorageManager)==null?void 0:r.getCode(l),u=c||this.templateCode&&this.templateCode[l]||"";this.editorManager=new rr({container:a,value:u,language:l,autoSave:!0,autoSaveDelay:500}),await this.editorManager.init(),this.editorManager.syncThemeWithPage(),this.initThemeObserver(),this.editorManager.onChange((d,h)=>{var v;(v=this.codeStorageManager)==null||v.saveCode(h,d)})}catch(a){console.error(a)}}initTabs(){var t;(t=this.uiManager)==null||t.initTabs(),this.resultPanel=this.root.querySelector("#resultPanel"),this.resultTime=this.resultPanel.querySelector(".result-time"),this.resultStatus=this.resultPanel.querySelector(".result-status"),this.outputPanel=this.resultPanel.querySelector(".result-output"),this.testCaseListInResultPanel=this.resultPanel.querySelector(".test-case-list"),this.testPanel=this.root.querySelector("#testPanel"),this.testPanelTabBtn=this.root.querySelector('.tab-btn[data-tab="test"]')}initLanguageSelector(){var e;let t=this.root.querySelector("#languageSelect");t&&((e=this.languageManager)==null||e.setSelector(t),window.addEventListener("hot100:codeLanguageChanged",n=>{var a;let r=n.detail.lang;r&&((a=this.languageManager)==null||a.syncExternalLanguageChange(r))}))}initThemeObserver(){new MutationObserver(e=>{e.forEach(n=>{var o;n.type==="attributes"&&n.attributeName==="class"&&((o=this.editorManager)==null||o.syncThemeWithPage())})}).observe(document.body,{attributes:!0,attributeFilter:["class"]})}resetEditorToTemplate(){if(!this.editorManager||!this.codeStorageManager||!this.languageManager){console.error("\u7F16\u8F91\u5668\u5C1A\u672A\u521D\u59CB\u5316");return}if(!this.templateCode){console.error("\u6682\u65E0\u6A21\u677F\u4EE3\u7801");return}let t=this.languageManager.getCurrentLanguage(),e=this.templateCode[t]||"";this.editorManager.setValue(e),this.codeStorageManager.saveCode(t,e)}initResetButton(){let t=this.root.querySelector("#resetCodeBtn");t&&t.addEventListener("click",async()=>{var n;await((n=this.uiManager)==null?void 0:n.showConfirm({title:"\u64CD\u4F5C\u786E\u8BA4",message:"\u60A8\u5C06\u653E\u5F03\u6240\u6709\u66F4\u6539\u5E76\u521D\u59CB\u5316\u4EE3\u7801\uFF01",confirmText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88"}))&&this.resetEditorToTemplate()})}initRunCodeButton(){this.runBtn=this.root.querySelector("#runBtn"),this.submitBtn=this.root.querySelector("#submitBtn");let t=()=>{if(!this.judgeClient)throw new Error("\u8BC4\u6D4B\u673A\u672A\u6B63\u786E\u521D\u59CB\u5316");if(!this.editorManager)throw new Error("\u7F16\u8F91\u5668\u672A\u6B63\u786E\u521D\u59CB\u5316");let n=this.editorManager.getValue();if(!n||n.trim()==="")throw new Error("\u4EE3\u7801\u4E0D\u80FD\u4E3A\u7A7A")},e=()=>{var n,o;(n=this.uiManager)==null||n.startCountdown({button:this.runBtn,seconds:Ql,textTemplate:r=>`\u25B6 \u8FD0\u884C\u4EE3\u7801 (${r}s)`,onComplete:()=>{this.lockManager.unlock([this.runBtn,this.testPanelTabBtn,this.aiPanelTabBtn])}}),(o=this.uiManager)==null||o.startCountdown({button:this.submitBtn,seconds:Ql,textTemplate:r=>`\u2713 \u63D0\u4EA4 (${r}s)`,onComplete:()=>{this.lockManager.unlock(this.submitBtn)}})};this.runCode=async n=>{var o;try{t()}catch(r){console.error(r.message);return}this.lockManager.lock([this.runBtn,this.submitBtn,this.testPanelTabBtn,this.aiPanelTabBtn]),e(),(o=this.uiManager)==null||o.switchToTab("result"),this.outputPanel.style.display="none",this.testCaseListInResultPanel.style.display="none",this.resultTime.textContent="",this.resultStatus.innerHTML='\u8BC4\u6D4B\u4E2D ',this.resultStatus.className="result-status running";try{let r=this.editorManager.getValue(),a=this.languageManager.getCurrentLanguageKey();this.lockManager.lock([this.runBtn,this.submitBtn,this.testPanelTabBtn,this.aiPanelTabBtn]),n==="pretest"?await this.judgeClient.runCode(r,a,n,go.getCurrentTestCaseInstances(this.testPanel,this.currentMode,this.testCaseInstances)):await this.judgeClient.runCode(r,a,n)}catch(r){throw console.error("\u63D0\u4EA4\u5931\u8D25: "+r.message),r}},this.submitBtn.addEventListener("click",async()=>{await this.runCode("submit")}),this.runBtn.addEventListener("click",async()=>{await this.runCode("pretest")})}handleJudgeStatusUpdate(t){var l;let{statusName:e,submitType:n,targetProgress:o}=t,r=this.root.querySelector(".result-status"),a=this.root.querySelector("#outputContent"),s=this.root.querySelector(".result-time");if(!r||!a||!s||!this.outputPanel){console.error("\u7ED3\u679C\u663E\u793A\u533A\u57DF\u4E22\u5931");return}switch(e){case"STATUS_JUDGING":n==="submit"&&((l=this.uiManager)==null||l.animateProgress(o,c=>{let u=r.firstChild;u&&u.nodeType===Node.TEXT_NODE&&(u.textContent=`\u8BC4\u6D4B\u4E2D (${c}%)`)}));break}}handleJudgeResult(t){var a,s;let{statusName:e,submitType:n,rdoc:o,testCaseResults:r}=t;if(!e){console.error("\u8BC4\u6D4B\u7ED3\u679C\u72B6\u6001\u7F3A\u5931");return}if(Wn.has(e)===!1){this.resultStatus.innerHTML=e,this.resultStatus.className="result-status error";let l=this.root.querySelector("#outputContent");l.textContent="\u65E0\u6CD5\u5904\u7406\u8BE5\u8BC4\u6D4B\u72B6\u6001\uFF0C\u8BF7\u8054\u7CFB\u5854\u5B50\u54E5\u5904\u7406\uFF01",this.outputPanel.style.display="",console.error("\u65E0\u6CD5\u5904\u7406\u7684\u8BC4\u6D4B\u72B6\u6001:",e)}else if(e==="STATUS_COMPILE_ERROR"||e==="STATUS_SYSTEM_ERROR"){this.resultStatus.innerHTML=er[e],this.resultStatus.className="result-status error";let l=this.root.querySelector("#outputContent");l.textContent=za[e]+`
`+(o.compilerTexts||" \u65E0\u7F16\u8BD1\u4FE1\u606F"),this.outputPanel.style.display=""}else if(n==="pretest"){if(!r||r.length===0)throw console.error("\u81EA\u6D4B\u7ED3\u679C\u7F3A\u5931"),new Error("\u81EA\u6D4B\u7ED3\u679C\u7F3A\u5931");r[0].accepted?(this.resultStatus.innerHTML="\u2713 \u81EA\u6D4B\u901A\u8FC7",this.resultStatus.className="result-status accepted"):(e==="STATUS_ACCEPTED"?this.resultStatus.innerHTML="\u7B54\u6848\u9519\u8BEF":this.resultStatus.innerHTML=er[e],this.resultStatus.className="result-status error"),this.resultTime.textContent=`\u8017\u65F6: ${Math.floor(o.time)} ms`,go.initResultTestPanel(this.resultPanel,this.currentMode,r),this.testCaseListInResultPanel.style.display=""}else(a=this.uiManager)==null||a.animateProgress(100,l=>{let c=this.resultStatus.firstChild;c&&c.nodeType===Node.TEXT_NODE&&(c.textContent=`\u8BC4\u6D4B\u4E2D (${l}%)`)},()=>{this.resultStatus.innerHTML=er[e],e!=="STATUS_ACCEPTED"&&(this.resultStatus.innerHTML+=` \u901A\u8FC7\u7387:${o.score}%`),this.resultStatus.className=`result-status ${e==="STATUS_ACCEPTED"?"accepted":"error"}`,this.resultTime.textContent=`\u8017\u65F6: ${Math.floor(o.time)} ms`;let l=this.root.querySelector("#outputContent");l.textContent=za[e],this.outputPanel.style.display=""});(s=this.askAIManager)==null||s.refresh(),this.lockManager.unlock([this.runBtn,this.submitBtn,this.testPanelTabBtn,this.aiPanelTabBtn])}handleSelfTestInputFormatError(t){var a,s;let e=this.root.querySelector(".result-status"),n=this.root.querySelector(".result-time"),o=this.root.querySelector("#outputContent"),r=this.root.querySelector(".result-output");if(!e||!o||!r||!n){console.error("\u7ED3\u679C\u663E\u793A\u533A\u57DF\u4E22\u5931");return}(a=this.uiManager)==null||a.switchToTab("result"),this.testCaseListInResultPanel.style.display="none",e.innerHTML="\u81EA\u6D4B\u7528\u4F8B\u975E\u6709\u6548\u503C",e.className="result-status error",n.textContent="",o.textContent=`\u7B2C${((s=t.caseIdx)!=null?s:0)+1}\u7EC4\u81EA\u6D4B\u6837\u4F8B | \u53C2\u6570 ${this.testCaseInstances[0].paramInstances[t.paramIdx||0].name} \u9519\u8BEF\uFF1A
${t.errorInfo}`,r.style.display="",this.lockManager.unlock([this.runBtn,this.submitBtn,this.testPanelTabBtn,this.aiPanelTabBtn])}initEditorResizer(){var r;let t=this.root.querySelector(".code-editor-container"),e=this.root.querySelector(".editor-resizer"),n=this.root.querySelector(".editor-wrapper"),o=this.root.querySelector(".bottom-panel");!e||!n||!o||(this.resizerCleanup&&this.resizerCleanup(),this.resizerCleanup=((r=this.uiManager)==null?void 0:r.initResizer({container:t,resizer:e,topPanel:n,bottomPanel:o,minTopHeight:200,minBottomHeight:10,onResize:()=>{this.editorManager&&this.editorManager.layout()}}))||null)}initFloatWindowButton(){let t=this.root.querySelector("#floatingCodeEditor"),e=this.root.querySelector("#floatingContent"),n=this.root.querySelector("#floatingDragHandle"),o=this.root.querySelector("#codeEditorContainer"),r=this.root.querySelector("#codeEditorPlaceholder"),a=this.root.querySelector("#floatWindowBtn"),s=this.root.querySelector("#floatingCloseBtn");if(!t||!e||!n||!o||!r){console.error("\u7A97\u53E3\u5316\u6240\u9700 DOM \u5143\u7D20\u672A\u627E\u5230");return}this.floatingWindowManager=new or({floatingContainer:t,floatingContent:e,dragHandle:n,contentElement:o,placeholderElement:r,floatButton:a,closeButton:s,onEnterFloat:()=>{var l;(l=this.editorManager)==null||l.layout()},onExitFloat:()=>{var l;(l=this.editorManager)==null||l.layout()},onResize:()=>{this.editorManager&&this.editorManager.layout()},storageKey:"hot100_floating_window_size"})}initAskAI(){this.aiPanel=this.root.querySelector("#aiPanel"),!(!this.aiPanel||!this.uiManager)&&(this.aiPanelTabBtn=this.root.querySelector('.tab-btn[data-tab="ai"]'),this.askAIManager=new fr({container:this.aiPanel,uiManager:this.uiManager,storageKey:`hot100_ai_records_${this.pid}`,submissionPageUrl:"/record/{rid}",onFetchSubmissions:async()=>{try{let t=await Gl.request.get(`/codenote-api/submissions/${this.pid}`);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return!t.ok||!t.submissions?(console.error("\u83B7\u53D6\u63D0\u4EA4\u8BB0\u5F55\u5931\u8D25:",t.error),[]):t.submissions}catch(t){return console.error("\u83B7\u53D6\u63D0\u4EA4\u8BB0\u5F55\u5931\u8D25:",t),[]}}}),this.askAIManager.init())}dispose(){this.judgeClient&&this.judgeClient.dispose(),this.editorManager&&this.editorManager.dispose(),this.floatingWindowManager&&this.floatingWindowManager.destroy(),this.uiManager&&this.uiManager.dispose(),this.languageManager&&this.languageManager.dispose(),this.askAIManager&&this.askAIManager.dispose(),this.resizerCleanup&&this.resizerCleanup(),this.judgeClient=null,this.editorManager=null,this.floatingWindowManager=null,this.uiManager=null,this.languageManager=null,this.askAIManager=null,this.codeStorageManager=null,this.resizerCleanup=null}};function Xl(){document.querySelectorAll(".contact-btn").forEach(t=>{if(t.dataset.initialized==="true")return;let e=t.dataset.title||"\u8054\u7CFB\u6211",n=t.dataset.img||"",o=t.querySelector(".contact-text");o&&(o.textContent=e);let r=t.querySelector(".qrcode-img");r&&n&&(r.src=n,r.alt=`${e}\u4E8C\u7EF4\u7801`,r.onerror=function(){console.error(`\u8054\u7CFB\u6309\u94AE\u4E8C\u7EF4\u7801\u56FE\u7247\u52A0\u8F7D\u5931\u8D25: ${n}`);let a=t.querySelector(".qrcode-popup");a&&(a.innerHTML='\u56FE\u7247\u52A0\u8F7D\u5931\u8D25
')}),t.dataset.initialized="true",t.addEventListener("click",function(a){a.preventDefault()})})}function pu(i){if(i.closest(".md-img-wrap"))return;let t=i.parentNode;if(!t)return;let e=document.createElement("span");e.className="md-img-wrap";let n=document.createElement("span");n.className="md-img-skeleton",n.setAttribute("aria-hidden","true"),t.insertBefore(e,i),e.appendChild(i),e.appendChild(n);let o=()=>{e.classList.add("is-loaded")},r=()=>{e.classList.add("is-loaded","is-error")};i.complete?i.naturalWidth>0?o():r():(i.addEventListener("load",o,{once:!0}),i.addEventListener("error",r,{once:!0}))}function Zl(i){i.querySelectorAll("img").forEach(e=>{let n=e;pu(n),n.classList.add("viewer-trigger"),n.addEventListener("click",()=>{Ga(n)})})}function Ga(i){let t=document.createElement("div");t.className="image-viewer-overlay";let e=document.createElement("div");e.className="image-viewer-container";let n=document.createElement("img");n.src=i.src,n.alt=i.alt,n.className="image-viewer-img";let o=1,r=0,a=0;n.onload=()=>{r=n.offsetWidth,a=n.offsetHeight};function s(){if(r===0||a===0)return 5;let d=window.innerWidth,h=window.innerHeight,v=d/r,w=h/a;return Math.min(v,w,5)}function l(){n.style.transform=`scale(${o})`}t.addEventListener("wheel",d=>{d.preventDefault();let h=d.deltaY>0?.9:1.1,v=o*h,w=s();o=Math.min(Math.max(.5,v),w),l(),o>1?n.classList.add("is-zoomed"):n.classList.remove("is-zoomed")}),t.addEventListener("click",()=>{u()});let c=d=>{d.key==="Escape"&&u()};document.addEventListener("keydown",c);function u(){document.removeEventListener("keydown",c),t.remove()}e.appendChild(n),t.appendChild(e),document.body.appendChild(t)}function ec(){document.querySelectorAll(".hover-image-trigger").forEach(t=>{let e=t.querySelector(".hover-image-popup"),n=t.querySelector("img");n&&t.addEventListener("click",o=>{e&&(o.target===e||e.contains(o.target))||Ga(n)})})}var bi=class{constructor(t){p(this,"root");p(this,"options");p(this,"ideManager",null);var e,n,o,r;this.root=t.root,this.options={mdHTML:t.mdHTML,root:t.root,enableCodeSwitcher:(e=t.enableCodeSwitcher)!=null?e:!0,enableInnerIDE:(n=t.enableInnerIDE)!=null?n:!0,innerIdeGuestLocked:(o=t.innerIdeGuestLocked)!=null?o:!1,onEnhanceComplete:(r=t.onEnhanceComplete)!=null?r:()=>{}}}addLineNumbers(){this.root.querySelectorAll("pre code").forEach(t=>{let e=t.parentElement;e&&e.classList.add("line-numbers")})}applyPrismHighlight(){window.Prism&&window.Prism.highlightAll()}initCodeSwitchers(){this.options.enableCodeSwitcher&&Xo(this.root)}initImageViewer(){Zl(this.root)}initContactBtn(){Xl()}initHoverImages(){ec()}mountInnerIdeGuestLock(t){t.style.position="relative";let e=document.createElement("div");e.className="codenote-ide-guest-lock",e.setAttribute("role","presentation"),e.style.cssText=["position:absolute","inset:0","z-index:50","display:flex","flex-direction:column","align-items:center","justify-content:center","gap:14px","padding:24px","box-sizing:border-box","background:rgba(248,250,252,0.92)","backdrop-filter:blur(6px)","border-radius:8px","border:1px solid rgba(0,0,0,0.06)","pointer-events:auto"].join(";"),e.innerHTML=`
\u5728\u7EBF\u7F16\u8F91\u5668\u9700\u767B\u5F55\u540E\u4F7F\u7528
\u53BB\u767B\u5F55
`;let n=e.querySelector(".codenote-ide-guest-lock__login");n==null||n.addEventListener("click",()=>{let o=document.getElementsByName("nav_login")[0];o&&o.click()}),t.appendChild(e)}async initInnerIDE(){if(!this.options.enableInnerIDE||!this.root)return;let t=this.root.querySelector(".inner-scratchpad");if(t){if(this.options.innerIdeGuestLocked){this.mountInnerIdeGuestLock(t);return}this.ideManager=new hr(t),await this.ideManager.init()}}async render(){var t,e;try{this.root.innerHTML=this.options.mdHTML,this.addLineNumbers(),this.applyPrismHighlight(),this.initImageViewer(),this.initCodeSwitchers(),this.initContactBtn(),this.initHoverImages(),await this.initInnerIDE(),(e=(t=this.options).onEnhanceComplete)==null||e.call(t,this.root,this.options)}catch(n){throw console.error("Markdown \u589E\u5F3A\u5931\u8D25:",n),n}}async update(t){this.destroy(),this.options.mdHTML=t,await this.render()}getRoot(){return this.root}destroy(){this.ideManager&&(this.ideManager.dispose(),this.ideManager=null),this.root.innerHTML=""}};var Za=ae(re());var Xa=/^[a-fA-F0-9]{24}$/,ri=class ri{constructor(t){p(this,"psid");p(this,"hidden",!1);p(this,"lastSyncAt",0);p(this,"pendingSyncTimer",null);p(this,"scrollDebounceTimer",null);p(this,"displayRefreshTimer",null);p(this,"syncInFlight",!1);p(this,"onPointerDown",()=>this.scheduleSyncFromActivity());p(this,"onKeyDown",()=>this.scheduleSyncFromActivity());p(this,"onScrollOrWheel",()=>{this.scrollDebounceTimer&&window.clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=window.setTimeout(()=>{this.scrollDebounceTimer=null,this.scheduleSyncFromActivity()},ri.SCROLL_DEBOUNCE_MS)});p(this,"onVisibilityChange",()=>{document.visibilityState==="visible"&&(this.scheduleSyncFromActivity(),this.fetchOnlineCountOnly())});this.psid=t}onlineCountUrl(t){let e=`/codenote-api/online-count/${encodeURIComponent(this.psid)}`;return t?`${e}?touch=1`:e}async syncPresenceToServer(){if(!(this.syncInFlight||!Xa.test(this.psid))){this.syncInFlight=!0;try{let t=await Za.request.get(this.onlineCountUrl(!0));this.lastSyncAt=Date.now(),this.updateDisplay(t.onlineCount)}catch(t){console.error("\u6D3B\u8DC3\u540C\u6B65\u5931\u8D25:",t)}finally{this.syncInFlight=!1}}}scheduleSyncFromActivity(){let e=Date.now()-this.lastSyncAt,n=Math.max(0,ri.SYNC_MIN_INTERVAL_MS-e);if(n===0){this.syncPresenceToServer();return}this.pendingSyncTimer===null&&(this.pendingSyncTimer=window.setTimeout(()=>{this.pendingSyncTimer=null,this.syncPresenceToServer()},n))}async fetchOnlineCountOnly(){if(Xa.test(this.psid))try{let t=await Za.request.get(this.onlineCountUrl(!1));this.updateDisplay(t.onlineCount)}catch(t){console.error("\u62C9\u53D6\u5728\u7EBF\u4EBA\u6570\u5931\u8D25:",t)}}updateDisplay(t){let e=typeof t=="number"?t:Number(t);if(!Number.isFinite(e)||e<0)return;let n=String(Math.floor(e)),o=document.getElementById("online-count"),r=document.getElementById("online-users");o&&(o.textContent=n),r&&(r.setAttribute("data-count",n),!this.hidden&&r.style.display==="none"&&(r.style.display=""))}hide(){let t=document.getElementById("online-users");t&&(t.style.display="none",this.hidden=!0)}show(){let t=document.getElementById("online-users");t&&(t.style.display="",this.hidden=!1)}start(){Xa.test(this.psid)&&(document.addEventListener("pointerdown",this.onPointerDown,!0),document.addEventListener("keydown",this.onKeyDown,!0),window.addEventListener("scroll",this.onScrollOrWheel,{passive:!0,capture:!0}),window.addEventListener("wheel",this.onScrollOrWheel,{passive:!0,capture:!0}),document.addEventListener("visibilitychange",this.onVisibilityChange),this.fetchOnlineCountOnly(),this.displayRefreshTimer=window.setInterval(()=>{document.visibilityState==="visible"&&this.fetchOnlineCountOnly()},ri.DISPLAY_REFRESH_MS))}stop(){document.removeEventListener("pointerdown",this.onPointerDown,!0),document.removeEventListener("keydown",this.onKeyDown,!0),window.removeEventListener("scroll",this.onScrollOrWheel,!0),window.removeEventListener("wheel",this.onScrollOrWheel,!0),document.removeEventListener("visibilitychange",this.onVisibilityChange),this.pendingSyncTimer!==null&&(window.clearTimeout(this.pendingSyncTimer),this.pendingSyncTimer=null),this.scrollDebounceTimer!==null&&(window.clearTimeout(this.scrollDebounceTimer),this.scrollDebounceTimer=null),this.displayRefreshTimer!==null&&(window.clearInterval(this.displayRefreshTimer),this.displayRefreshTimer=null)}};p(ri,"SYNC_MIN_INTERVAL_MS",25e3),p(ri,"DISPLAY_REFRESH_MS",45e3),p(ri,"SCROLL_DEBOUNCE_MS",450);var gr=ri;var vi=ae(re());var et=ae(re());var br=[2,3,9,6755],Ni=3e3,tc=20;var nc=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#ff9800","#ff5722","#795548"];function uu(i){return nc[i%nc.length]}function mu(i){return i.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function ic(i){let t=es(i.uname.charAt(0).toUpperCase()),e=uu(i.uid);return i.avatar?``:``}function fu(i){let t=Date.now()-new Date(i).getTime(),e=Math.floor(t/1e3);if(e<60)return"\u521A\u521A";let n=Math.floor(e/60);if(n<60)return`${n}\u5206\u949F\u524D`;let o=Math.floor(n/60);if(o<24)return`${o}\u5C0F\u65F6\u524D`;let r=Math.floor(o/24);if(r<30)return`${r}\u5929\u524D`;let a=Math.floor(r/30);return a<12?`${a}\u4E2A\u6708\u524D`:`${Math.floor(r/365)}\u5E74\u524D`}function hu(i,t){return br.includes(t)?!0:i.isAuthor}function ts(i){if(!i)return;let t=window.Prism;t!=null&&t.highlightAllUnder&&t.highlightAllUnder(i),Xo(i)}function vo(i,t,e,n=!1){let o=document.createElement("div");if(o.className=`comment-item${i.pinned?" comment-pinned":""}`,o.dataset.commentId=i._id,i.status===1)return o.innerHTML=`
`,o;let r=br.includes(t),a=hu(i,t),s=br.includes(i.uid),l=t<=0,c="";i.replyToUname&&(c=``);let u=s?'':"",d=i.pinned?'':"",h="";i.reviewStatus===0&&i.isAuthor?h='':i.reviewStatus===2&&i.isAuthor&&(h=``),o.innerHTML=`
`;let v=o.querySelector(".comment-content");if(v&&ts(v),o.querySelectorAll(".comment-action-btn").forEach(w=>{w.addEventListener("click",k=>{k.preventDefault();let L=w.dataset.action,H=i.parentId||i._id;switch(L){case"like":e.onVote(i._id,1);break;case"dislike":e.onVote(i._id,-1);break;case"reply":e.onReply(i._id,i.uid,i.uname,H);break;case"delete":e.onDelete(i._id);break;case"pin":e.onPin(i._id,!i.pinned);break;case"ban":e.onBan(i.uid,i.uname);break}})}),!n&&i.replies&&i.replies.length>0){let w=document.createElement("div");if(w.className="comment-replies",i.replies.forEach(k=>{w.appendChild(vo(k,t,e,!0))}),i.replyCount>i.replies.length){let k=document.createElement("button");k.className="comment-expand-replies",k.innerHTML=`\u67E5\u770B\u5168\u90E8 ${i.replyCount} \u6761\u56DE\u590D `,k.addEventListener("click",()=>e.onExpandReplies(i._id)),w.appendChild(k)}o.querySelector(".comment-item-main").after(w)}return o}function ns(i,t,e,n,o,r=!0){let a=i.querySelector(".like-btn"),s=i.querySelector(".dislike-btn");if(!a||!s)return;let l=n,c=o,u=t;return e===t?(u=0,t===1?l--:c--):(e===1?l--:e===-1&&c--,t===1?l++:c++),a.classList.toggle("liked",u===1),a.querySelector("i").className=u===1?"fas fa-thumbs-up":"far fa-thumbs-up",a.querySelector(".like-count").textContent=l?String(l):"",s.classList.toggle("disliked",u===-1),s.querySelector("i").className=u===-1?"fas fa-thumbs-down":"far fa-thumbs-down",s.querySelector(".dislike-count").textContent=r&&c?String(c):"",{myVote:u,likeCount:l,dislikeCount:c}}function es(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}var vr=class{constructor(t,e){p(this,"container");p(this,"options");p(this,"comments",[]);p(this,"sort","hot");p(this,"page",1);p(this,"total",0);p(this,"hasMore",!1);p(this,"loading",!1);p(this,"headerEl",null);p(this,"listEl",null);p(this,"loadMoreEl",null);p(this,"inputAreaEl",null);this.container=t,this.options=e}async load(){this.page=1,this.comments=[],this.renderStructure(),this.showLoading();try{let t=await this.fetchComments();return this.comments=t.comments,this.total=t.total,this.hasMore=t.hasMore,this.renderComments(),this.updateHeader(),{canComment:t.canComment,banStatus:t.banStatus}}catch(t){return this.showError(),null}}async loadMore(){if(!(this.loading||!this.hasMore)){this.page++,this.loading=!0,this.updateLoadMoreButton(!0);try{let t=await this.fetchComments();this.comments.push(...t.comments),this.hasMore=t.hasMore,t.comments.forEach(e=>{var n;(n=this.listEl)==null||n.appendChild(this.createCommentEl(e))}),this.updateLoadMoreButton(!1)}catch(t){this.page--,this.updateLoadMoreButton(!1),et.Notification.error("\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}finally{this.loading=!1}}}async expandReplies(t){try{let e=new URLSearchParams({parentId:t,sort:"hot",page:"1",pageSize:"100"}),n=await et.request.get(`/codenote-api/comments/${this.options.psid}/${this.options.pid}?${e}`);if(n.error){et.Notification.error(n.error);return}let o=this.container.querySelector(`[data-comment-id="${t}"]`);if(!o)return;let r=o.querySelector(".comment-replies");r||(r=document.createElement("div"),r.className="comment-replies",o.querySelector(".comment-item-main").after(r)),r.innerHTML="";let a=this.getCallbacks();(n.comments||[]).forEach(l=>{r.appendChild(vo(l,this.options.currentUid,a,!0))});let s=this.comments.findIndex(l=>l._id===t);s>=0&&(this.comments[s].replies=n.comments)}catch(e){et.Notification.error("\u52A0\u8F7D\u56DE\u590D\u5931\u8D25")}}addCommentToList(t,e){if(e){let n=this.comments.findIndex(r=>r._id===e);n>=0&&(this.comments[n].replies||(this.comments[n].replies=[]),this.comments[n].replies.push(t),this.comments[n].replyCount++);let o=this.container.querySelector(`[data-comment-id="${e}"]`);if(o){let r=o.querySelector(".comment-replies");r||(r=document.createElement("div"),r.className="comment-replies",o.querySelector(".comment-item-main").after(r));let a=this.getCallbacks(),s=vo(t,this.options.currentUid,a,!0),l=r.querySelector(".comment-expand-replies");l&&l.remove(),r.appendChild(s)}}else{if(this.comments.unshift(t),this.total++,this.listEl){let n=this.createCommentEl(t);this.listEl.insertBefore(n,this.listEl.firstChild)}this.updateHeader()}}getInlineInputContainer(t){let e=this.container.querySelector(`[data-comment-id="${t}"]`);if(!e)return null;let n=e.querySelector(".comment-inline-input");if(!n){n=document.createElement("div"),n.className="comment-inline-input";let o=e.querySelector(".comment-replies");o?o.after(n):e.querySelector(".comment-item-main").after(n)}return n}removeInlineInputContainer(){let t=this.container.querySelector(".comment-inline-input");t&&t.remove()}updateOptions(t){Object.assign(this.options,t)}clear(){this.comments=[],this.container.innerHTML=""}async fetchComments(){let t=new URLSearchParams({sort:this.sort,page:String(this.page),pageSize:String(tc)}),e=await et.request.get(`/codenote-api/comments/${this.options.psid}/${this.options.pid}?${t}`);if(e.error)throw new Error(e.error);return e}getInputArea(){return this.inputAreaEl}renderStructure(){let t=this.inputAreaEl;this.container.innerHTML=`
`,this.headerEl=this.container.querySelector(".comment-list-header"),this.listEl=this.container.querySelector(".comment-list"),this.loadMoreEl=this.container.querySelector(".comment-list-footer"),t?(this.container.querySelector(".comment-input-area").replaceWith(t),this.inputAreaEl=t):this.inputAreaEl=this.container.querySelector(".comment-input-area")}updateHeader(){this.headerEl&&(this.headerEl.innerHTML=`
`,this.headerEl.querySelectorAll(".comment-sort-btn").forEach(t=>{t.addEventListener("click",()=>{let e=t.dataset.sort;e!==this.sort&&(this.sort=e,this.load())})}))}renderComments(){var t;if(!(!this.listEl||!this.loadMoreEl)){if(this.listEl.innerHTML="",this.comments.length===0){this.listEl.innerHTML=`
`,this.loadMoreEl.innerHTML="";return}this.comments.forEach(e=>{this.listEl.appendChild(this.createCommentEl(e))}),this.hasMore?(this.loadMoreEl.innerHTML='',(t=this.loadMoreEl.querySelector(".comment-load-more"))==null||t.addEventListener("click",()=>this.loadMore())):this.loadMoreEl.innerHTML=""}}createCommentEl(t){return vo(t,this.options.currentUid,this.getCallbacks())}getCallbacks(){return{onVote:(t,e)=>this.handleVote(t,e),onReply:(t,e,n,o)=>this.options.onReply(t,e,n,o),onDelete:t=>this.handleDelete(t),onPin:(t,e)=>this.handlePin(t,e),onBan:(t,e)=>this.handleBan(t,e),onExpandReplies:t=>this.expandReplies(t)}}async handleVote(t,e){let n=this.findComment(t);if(!n)return;let o=this.container.querySelector(`[data-comment-id="${t}"]`);if(!o)return;let r=n.myVote,a=ns(o,e,r,n.likeCount,n.dislikeCount,n.showDislikeCount);a&&(n.myVote=a.myVote,n.likeCount=a.likeCount,n.dislikeCount=a.dislikeCount);try{await et.request.post(`/codenote-api/comments/vote/${t}`,{vote:e})}catch(s){a&&(n.myVote=r,ns(o,r,a.myVote,a.likeCount,a.dislikeCount,n.showDislikeCount))}}async handleDelete(t){if(await zt.open({title:"\u5220\u9664\u8BC4\u8BBA",message:"\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u6761\u8BC4\u8BBA\u5417\uFF1F",confirmText:"\u5220\u9664"}))try{let n=await et.request.post(`/codenote-api/comments/delete/${t}`,{});if(n.error){et.Notification.error(n.error);return}let o=this.findComment(t),r=o&&!o.parentId,a=this.container.querySelector(`[data-comment-id="${t}"]`);if(r&&a)a.remove(),this.comments=this.comments.filter(s=>s._id!==t),this.total--,this.updateHeader();else if(a){let s=a.querySelector(".comment-body");s&&(s.innerHTML='')}et.Notification.success("\u8BC4\u8BBA\u5DF2\u5220\u9664")}catch(n){et.Notification.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}}async handlePin(t,e){try{let n=await et.request.post(`/codenote-api/comments/pin/${t}`,{pinned:e});if(n.error){et.Notification.error(n.error);return}et.Notification.success(e?"\u5DF2\u7F6E\u9876":"\u5DF2\u53D6\u6D88\u7F6E\u9876"),await this.load()}catch(n){et.Notification.error("\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}}async handleBan(t,e){try{let n=await et.request.get(`/codenote-api/comments/ban/check/${t}`);if(n.error){et.Notification.error(n.error);return}n.banned?await this.showUnbanDialog(t,e,n.reason,n.expiresAt):await this.showBanDialog(t,e)}catch(n){et.Notification.error("\u67E5\u8BE2\u7528\u6237\u5C01\u7981\u72B6\u6001\u5931\u8D25")}}async showBanDialog(t,e){let n=await new Promise(o=>{let r=document.createElement("div");r.className="confirm-dialog-mask";let a=document.createElement("div");a.className="confirm-dialog",a.innerHTML=`
`,r.appendChild(a),document.body.appendChild(r),requestAnimationFrame(()=>{r.classList.add("confirm-enter-mask"),a.classList.add("confirm-enter-dialog")});let s=l=>{r.classList.remove("confirm-enter-mask"),a.classList.remove("confirm-enter-dialog"),r.classList.add("confirm-leave-mask"),a.classList.add("confirm-leave-dialog"),a.addEventListener("animationend",()=>{r.parentNode&&r.parentNode.removeChild(r),o(l)},{once:!0})};a.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("click",()=>s(null)),a.querySelector(".confirm-dialog-btn-cancel").addEventListener("click",()=>s(null)),a.querySelector(".confirm-dialog-btn-confirm").addEventListener("click",()=>{let l=a.querySelector(".ban-duration-select").value,c=a.querySelector(".ban-reason-input").value.trim();s({reason:c||"\u7BA1\u7406\u5458\u5C01\u7981",duration:l?Number(l):null})})});if(n)try{let o=await et.request.post("/codenote-api/comments/ban",{uid:t,reason:n.reason,duration:n.duration});if(o.error){et.Notification.error(`\u5C01\u7981\u5931\u8D25\uFF1A${o.error}`);return}let r=n.duration?`${n.duration} \u5929`:"\u6C38\u4E45";et.Notification.success(`\u5DF2\u5C01\u7981\u7528\u6237\u300C${e}\u300D\uFF08${r}\uFF09\uFF0C\u539F\u56E0\uFF1A${n.reason}`)}catch(o){et.Notification.error(`\u5C01\u7981\u7528\u6237\u300C${e}\u300D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5`)}}async showUnbanDialog(t,e,n,o){let r=`\u7528\u6237\u300C${this.escapeHtml(e)}\u300D\u5F53\u524D\u5DF2\u88AB\u5C01\u7981`;if(n&&(r+=` \u5C01\u7981\u539F\u56E0\uFF1A${this.escapeHtml(n)}`),o?r+=` \u5230\u671F\u65F6\u95F4\uFF1A${new Date(o).toLocaleString("zh-CN")}`:r+=" \u5C01\u7981\u65F6\u957F\uFF1A\u6C38\u4E45",r+=" \u662F\u5426\u89E3\u9664\u8BE5\u7528\u6237\u7684\u5C01\u7981\uFF1F",!!await zt.open({title:"\u89E3\u5C01\u7528\u6237",message:r,confirmText:"\u89E3\u5C01",showIcon:!1}))try{let s=await et.request.post(`/codenote-api/comments/unban/${t}`,{});if(s.error){et.Notification.error(`\u89E3\u5C01\u5931\u8D25\uFF1A${s.error}`);return}et.Notification.success(`\u5DF2\u89E3\u9664\u7528\u6237\u300C${e}\u300D\u7684\u5C01\u7981`)}catch(s){et.Notification.error(`\u89E3\u5C01\u7528\u6237\u300C${e}\u300D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5`)}}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}findComment(t){for(let e of this.comments){if(e._id===t)return e;if(e.replies){let n=e.replies.find(o=>o._id===t);if(n)return n}}return null}showLoading(){this.listEl&&(this.listEl.innerHTML=`
${[1,2,3].map(()=>`
`).join("")}`)}showError(){var t;this.listEl&&(this.listEl.innerHTML=`
`,(t=this.listEl.querySelector(".comment-error-retry"))==null||t.addEventListener("click",()=>this.load()))}updateLoadMoreButton(t){if(!this.loadMoreEl)return;let e=this.loadMoreEl.querySelector(".comment-load-more");e&&(e.disabled=t,e.textContent=t?"\u52A0\u8F7D\u4E2D...":"\u52A0\u8F7D\u66F4\u591A\u8BC4\u8BBA"),this.hasMore||(this.loadMoreEl.innerHTML="")}};var oc=ae(re());var yr=class{constructor(t,e){p(this,"container");p(this,"originalContainer");p(this,"options");p(this,"mode","edit");p(this,"replyState",null);p(this,"textarea",null);p(this,"submitting",!1);p(this,"content","");p(this,"inlineReplyMode",!1);this.container=t,this.originalContainer=t,this.options=e,this.render()}updatePermission(t,e,n,o,r){this.options.canComment=t,this.options.isBanned=e,this.options.banReason=n,this.options.banExpiresAt=o,r!==void 0&&(this.options.isGuest=r),this.render()}setReply(t,e,n){var o;this.replyState={parentId:t,replyToUid:e,replyToUname:n},this.inlineReplyMode=!0,this.render(),(o=this.textarea)==null||o.focus(),this.container.scrollIntoView({behavior:"smooth",block:"nearest"})}cancelReply(){this.replyState=null,this.inlineReplyMode=!1,this.returnToOriginalPosition(),this.render()}clear(){this.replyState=null,this.inlineReplyMode=!1,this.mode="edit",this.content="",this.returnToOriginalPosition(),this.render()}moveToElement(t){this.textarea&&(this.content=this.textarea.value),this.originalContainer.innerHTML="",this.container=t,this.render()}returnToOriginalPosition(){if(this.container===this.originalContainer)return;this.textarea&&(this.content=this.textarea.value);let t=this.container;this.container=this.originalContainer,t.classList.contains("comment-inline-input")&&t.remove()}render(){if(this.options.isBanned){let n="\u60A8\u5DF2\u88AB\u7981\u6B62\u53D1\u8A00";this.options.banReason&&(n+=`\uFF0C\u539F\u56E0\uFF1A${this.options.banReason}`),this.options.banExpiresAt?n+=`\u89E3\u5C01\u65F6\u95F4\uFF1A${new Date(this.options.banExpiresAt).toLocaleString("zh-CN")} `:n+='\u5C01\u7981\u7C7B\u578B\uFF1A\u6C38\u4E45\u5C01\u7981 ',this.container.innerHTML=`
`;return}if(!this.options.canComment){if(this.options.isGuest){this.container.innerHTML=`
`;let n=this.container.querySelector(".comment-guest-login-btn");n==null||n.addEventListener("click",()=>{let o=document.getElementsByName("nav_login")[0];o&&o.click()})}else this.container.innerHTML=`
`;return}this.textarea&&(this.content=this.textarea.value);let t=this.content,e=this.replyState?``:"";if(this.container.innerHTML=`
`,this.textarea=this.container.querySelector(".comment-textarea"),this.bindEvents(t),this.mode==="preview"&&t.trim())this.renderPreview(t);else if(this.mode==="preview"){let n=this.container.querySelector(".comment-preview");n&&(n.innerHTML='')}}bindEvents(t){this.container.querySelectorAll(".comment-input-tab").forEach(o=>{o.addEventListener("click",()=>{let r=o.dataset.mode;r!==this.mode&&(this.mode=r,this.render())})}),this.textarea&&this.textarea.addEventListener("input",()=>{var o;this.content=((o=this.textarea)==null?void 0:o.value)||"",this.updateCharCount(),this.updateSubmitButton()});let e=this.container.querySelector(".comment-submit-btn");e==null||e.addEventListener("click",()=>this.handleSubmit());let n=this.container.querySelector(".cancel-reply");n==null||n.addEventListener("click",()=>this.cancelReply())}updateCharCount(){var n;let t=((n=this.textarea)==null?void 0:n.value.length)||0,e=this.container.querySelector(".comment-char-count");e&&(e.textContent=`${t}/${Ni}`,e.className="comment-char-count",t>Ni*.9&&e.classList.add("warning"),t>=Ni&&e.classList.add("error"))}updateSubmitButton(){var e;let t=this.container.querySelector(".comment-submit-btn");t&&(t.disabled=!((e=this.textarea)!=null&&e.value.trim())||this.submitting)}async handleSubmit(){var e,n;this.textarea&&(this.content=this.textarea.value);let t=this.content.trim();if(!(!t||this.submitting)){this.submitting=!0,this.updateSubmitButton();try{await this.options.onSubmit(t,((e=this.replyState)==null?void 0:e.parentId)||null,((n=this.replyState)==null?void 0:n.replyToUid)||null),this.submitting=!1,this.replyState=null,this.inlineReplyMode=!1,this.mode="edit",this.content="",this.returnToOriginalPosition(),this.render()}catch(o){this.submitting=!1,this.render()}}}async renderPreview(t){let e=this.container.querySelector(".comment-preview");if(e)try{let n=await oc.request.post("/codenote-api/markdownRender",{content:t});e.innerHTML=n.html||'',ts(e)}catch(n){e.innerHTML=''}}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}};var xr=class{constructor(t){p(this,"container");p(this,"currentUid");p(this,"psid","");p(this,"pid","");p(this,"enableComment",!1);p(this,"canComment",!1);p(this,"isBanned",!1);p(this,"banReason","");p(this,"banExpiresAt","");p(this,"commentList",null);p(this,"commentInput",null);p(this,"inputContainer",null);p(this,"listContainer",null);this.container=t.container,this.currentUid=t.currentUid}async reload(t,e,n,o,r,a){var c,u,d;if(this.pid=t,this.psid=e,this.enableComment=n,!n||r||a){this.hide();return}this.show(),this.canComment=o,this.renderContainers();let s=this.currentUid<=0;this.commentList=new vr(this.listContainer,{psid:e,pid:t,currentUid:this.currentUid,onReply:(h,v,w,k)=>{var L;this.moveInputToComment(k),(L=this.commentInput)==null||L.setReply(k,v,w)}});let l=await this.commentList.load();l&&(this.canComment=l.canComment,this.isBanned=((c=l.banStatus)==null?void 0:c.banned)||!1,this.banReason=((u=l.banStatus)==null?void 0:u.reason)||"",this.banExpiresAt=((d=l.banStatus)==null?void 0:d.expiresAt)||""),this.inputContainer=this.commentList.getInputArea(),this.commentInput=new yr(this.inputContainer,{canComment:this.canComment,isGuest:s,isBanned:this.isBanned,banReason:this.banReason,banExpiresAt:this.banExpiresAt,onSubmit:async(h,v,w)=>{await this.submitComment(h,v,w)}})}updateUid(t){this.currentUid=t}hide(){this.container.style.display="none",this.commentList=null,this.commentInput=null}show(){this.container.style.display=""}destroy(){this.commentList=null,this.commentInput=null,this.container.innerHTML="",this.container.style.display="none"}renderContainers(){this.container.innerHTML=`
`,this.listContainer=this.container.querySelector(".comment-list-area")}moveInputToComment(t){if(!this.commentList||!this.commentInput)return;this.commentInput.returnToOriginalPosition(),this.commentList.removeInlineInputContainer();let e=this.commentList.getInlineInputContainer(t);e&&this.commentInput.moveToElement(e)}async submitComment(t,e,n){var o,r,a,s;try{let l=await vi.request.post(`/codenote-api/comments/${this.psid}/${this.pid}`,{content:t,parentId:e||"",replyToUid:n||""});if(l.error)throw vi.Notification.error(l.error),new Error(l.error);if(l.success&&l.comment&&((o=this.commentList)==null||o.addCommentToList(l.comment,e),(r=this.commentInput)==null||r.clear(),l.comment.reviewStatus===0?vi.Notification.success("\u8BC4\u8BBA\u5DF2\u63D0\u4EA4\uFF0C\u6B63\u5728\u5BA1\u6838\u4E2D\uFF0C\u5BA1\u6838\u901A\u8FC7\u524D\u4EC5\u60A8\u81EA\u5DF1\u53EF\u89C1"):vi.Notification.success("\u8BC4\u8BBA\u53D1\u8868\u6210\u529F"),!e)){let c=this.container.querySelector(".comment-item");c==null||c.scrollIntoView({behavior:"smooth",block:"nearest"})}}catch(l){throw!((a=l.message)!=null&&a.includes("\u5DF2\u88AB\u7981\u6B62"))&&!((s=l.message)!=null&&s.includes("\u9891\u7E41"))||vi.Notification.error(l.message),l}}};var yo=null,Gt=!1,Yn=null,Fi=0,Vn="",kr="",wo="",Jn="",ai="",yi="learning",wr=!1,ko=[],is=null,sn=null,To=null,Er=!1,dc=!1,rs=!1,jt=null,pc="codenote_sidebar_collapsed",uc="codenote_mode",gu="codenote_toc_expanded_",mc="(max-width: 1299px)";function Tr(){try{return window.matchMedia(mc).matches}catch(i){return!1}}function fc(i){let t=document.querySelector(".page-layout"),e=document.getElementById("right-toc-drawer-btn"),n=document.getElementById("right-toc-drawer-backdrop");t&&(t.classList.toggle("right-toc-drawer-open",i),e&&e.setAttribute("aria-expanded",i?"true":"false"),n&&n.setAttribute("aria-hidden",i?"false":"true"),document.body.style.overflow=i?"hidden":"")}function xo(){fc(!1)}function bu(){let i=document.getElementById("right-toc-drawer-btn"),t=document.getElementById("right-toc-drawer-backdrop"),e=document.querySelector(".page-layout"),n=document.getElementById("right-toc");if(!i||!e)return;i.addEventListener("click",()=>{let a=!e.classList.contains("right-toc-drawer-open");fc(a)}),t==null||t.addEventListener("click",()=>{xo()}),document.addEventListener("keydown",a=>{a.key==="Escape"&&xo()}),n==null||n.addEventListener("click",a=>{Tr()&&a.target.closest(".toc-list a")&&xo()});let o=window.matchMedia(mc),r=()=>{Tr()||xo()};typeof o.addEventListener=="function"?o.addEventListener("change",r):o.addListener(r)}function hc(){return`${gu}${Vn||"default"}`}function vu(){try{let i=localStorage.getItem(hc());if(!i)return new Set;let t=JSON.parse(i);return new Set(t)}catch(i){return console.warn("\u65E0\u6CD5\u8BFB\u53D6\u76EE\u5F55\u5C55\u5F00\u72B6\u6001:",i),new Set}}function yu(i){try{localStorage.setItem(hc(),JSON.stringify(Array.from(i)))}catch(t){console.warn("\u65E0\u6CD5\u4FDD\u5B58\u76EE\u5F55\u5C55\u5F00\u72B6\u6001:",t)}}function gc(i){try{localStorage.setItem(pc,i?"true":"false")}catch(t){console.warn("\u65E0\u6CD5\u4FDD\u5B58\u4FA7\u8FB9\u680F\u72B6\u6001:",t)}}function xu(){try{return localStorage.getItem(pc)==="true"}catch(i){return console.warn("\u65E0\u6CD5\u8BFB\u53D6\u4FA7\u8FB9\u680F\u72B6\u6001:",i),!1}}function wu(i){try{localStorage.setItem(uc,i)}catch(t){console.warn("\u65E0\u6CD5\u4FDD\u5B58\u6A21\u5F0F\u504F\u597D:",t)}}function ku(){try{return localStorage.getItem(uc)==="practice"?"practice":"learning"}catch(i){return console.warn("\u65E0\u6CD5\u8BFB\u53D6\u6A21\u5F0F\u504F\u597D:",i),"learning"}}function Tu(){let i=document.getElementById("sidebar"),t=document.getElementById("sidebar-toggle");if(!i||!t)return;let e=xu();if(window.innerWidth>1200)if(e){i.classList.add("collapsed");let o=t.querySelector("i");o&&(o.classList.remove("fa-chevron-left"),o.classList.add("fa-chevron-right"))}else{i.classList.remove("collapsed");let o=t.querySelector("i");o&&(o.classList.remove("fa-chevron-right"),o.classList.add("fa-chevron-left"))}}function rc(i){Gt=i;let t=document.getElementById("markdown-body"),e=document.querySelector(".right-toc"),n=document.getElementById("sidebar");i?(xo(),t&&(t.innerHTML=`
\u52A0\u8F7D\u4E2D...
`,t.style.pointerEvents="none"),e&&(e.style.pointerEvents="none"),Yn&&(Yn.style.pointerEvents="none")):(t&&(t.style.pointerEvents=""),e&&(e.style.pointerEvents=""),n&&(n.style.pointerEvents=""),Yn&&(Yn.style.pointerEvents=""))}function Cu(i){let t=document.getElementById("markdown-body");if(!t)return;let e=t.querySelector(".read-limit-mask");if(e&&e.remove(),!i)return;let n=800,o=t.scrollHeight,r=Math.min(o-140,n),a=document.createElement("div");a.className="read-limit-mask",Object.assign(a.style,{position:"absolute",left:"0",right:"0",top:`${r}px`,bottom:"0",display:"flex",justifyContent:"center",alignItems:"center",paddingTop:"80px",pointerEvents:"none",zIndex:10});let s=document.createElement("div");s.style.pointerEvents="auto",s.innerHTML=`
\u67E5\u770B\u5168\u6587
`,a.appendChild(s);let l=window.getComputedStyle(t).position;(l==="static"||!l)&&(t.style.position="relative"),t.appendChild(a);let c=a.querySelector("#unlcok-codenote-btn");c&&(Fi==0?c.addEventListener("click",()=>{let u=document.getElementsByName("nav_login")[0];u&&u.click()}):c.addEventListener("click",()=>{zt.open({title:"\u89E3\u9501\u5168\u6587",message:"\u4EE3\u7801\u7B14\u8BB0\u8FD8\u5728\u514D\u8D39\u5185\u6D4B\u9636\u6BB5\uFF0C\u5F00\u901A\u8054\u7CFB\u5854\u5B50\u54E5\u5373\u53EF",showIcon:!1})}))}function os(i,t){let e=t;for(;e&&e!==i;){if(window.getComputedStyle(e).display==="none")return!1;e=e.parentElement}return!0}function Eu(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch(t){return i}}function ac(i){return i.trim().replace(/\s+/g," ")}function Lu(i,t){let e=t.replace(/^#/,"").trim();if(!e)return null;let n=Eu(e),o=i.querySelectorAll("h1,h2");for(let a of o){let s=a;if(os(i,s)&&s.id&&(s.id===e||s.id===n))return s}let r=ac(n);if(!r)return null;for(let a of o){let s=a;if(!os(i,s))continue;if(ac(s.textContent||"")===r)return s}return null}function bc(i,t="smooth"){let e=i.offsetTop-80;window.scrollTo({top:Math.max(0,e),behavior:t})}function vc(i,t="smooth"){let e=i.getBoundingClientRect().top+window.scrollY-80;window.scrollTo({top:Math.max(0,e),behavior:t})}function as(){return Er&&!rs&&!wr}function yc(i="smooth"){let t=document.getElementById("markdown-body");if(!t)return;let e=(window.location.hash||"").replace(/^#/,"").trim();if(!e){window.scrollTo({top:0,behavior:i});return}if(e==="comment-section"&&as()){let o=document.getElementById("comment-section");if(o&&window.getComputedStyle(o).display!=="none"){vc(o,i),requestAnimationFrame(()=>jt==null?void 0:jt());return}}let n=Lu(t,e);n?(bc(n,i),requestAnimationFrame(()=>jt==null?void 0:jt())):window.scrollTo({top:0,behavior:i})}function sc(i){if(!i)return;let e=`${window.location.pathname+window.location.search}#${i}`;window.history.replaceState(window.history.state||{psid:Vn,pid:ai||null},"",e)}function _u(i,t="preserve"){let e=i===Jn?`/codenote/${Vn}`:`/codenote/${Vn}/${i}`,n=t==="preserve"&&window.location.hash||"";window.history.pushState({psid:Vn,pid:i||null},"",e+n)}function Mu(){window.addEventListener("popstate",async i=>{if(i.state){let{pid:t}=i.state;t?await Cr(t,{urlFragmentMode:"preserve"}):await Cr(Jn,{urlFragmentMode:"preserve"})}})}function Su(){window.addEventListener("hashchange",()=>{Gt||yc("smooth")})}function ju(){let i=document.getElementById("sidebar"),t=document.getElementById("sidebar-toggle");!i||!t||t.addEventListener("click",()=>{if(Gt)return;if(window.innerWidth<=1200){let n=i.classList.toggle("open"),o=t.querySelector("i");if(!o)return;n?(o.classList.remove("fa-chevron-right"),o.classList.add("fa-chevron-left")):(o.classList.remove("fa-chevron-left"),o.classList.add("fa-chevron-right"))}else{i.classList.remove("open");let n=i.classList.toggle("collapsed");gc(n);let o=t.querySelector("i");if(!o)return;n?(o.classList.remove("fa-chevron-left"),o.classList.add("fa-chevron-right")):(o.classList.remove("fa-chevron-right"),o.classList.add("fa-chevron-left"))}})}function xc(i,t){let e=document.querySelector(".right-toc .toc-list");if(!e)return;e.innerHTML="";let n=i.querySelectorAll("h1,h2"),o=document.querySelector(".right-toc"),r=o==null?void 0:o.querySelector(".toc-title");if(r&&(r.textContent=t),o&&o.style.removeProperty("display"),n.forEach((s,l)=>{if(!os(i,s))return;let c=s.tagName.toLowerCase(),u=s.textContent||"";s.id||(s.id=`heading-${l}`);let d=document.createElement("li"),h=document.createElement("a");h.href=`#${s.id}`,h.textContent=u,h.className=`toc-${c}`,h.addEventListener("click",v=>{if(Gt)return;v.preventDefault();let w=document.getElementById(s.id);w&&(bc(w,"smooth"),sc(s.id),requestAnimationFrame(()=>jt==null?void 0:jt()))}),d.appendChild(h),e.appendChild(d)}),as()){let s=document.createElement("li"),l=document.createElement("a");l.href="#comment-section",l.textContent="\u8BC4\u8BBA\u533A",l.className="toc-h2 toc-comments",l.addEventListener("click",c=>{if(Gt)return;c.preventDefault();let u=document.getElementById("comment-section");u&&window.getComputedStyle(u).display!=="none"&&(vc(u,"smooth"),sc("comment-section"),requestAnimationFrame(()=>jt==null?void 0:jt()))}),s.appendChild(l),e.appendChild(s)}let a=document.getElementById("right-toc-shell");a&&a.classList.toggle("right-toc--empty",e.children.length===0),Tc()}function wc(){jt&&window.removeEventListener("scroll",jt),jt=function(){if(Gt)return;if(Tr()){let a=document.querySelector(".page-layout");if(a&&!a.classList.contains("right-toc-drawer-open"))return}let i=document.querySelectorAll(".right-toc .toc-list a"),t=!!document.querySelector(".right-toc .toc-list a.toc-comments"),e=document.querySelectorAll(".markdown-body h1, .markdown-body h2"),n=[],o=document.getElementById("markdown-body");if(e.forEach(a=>{let s=a,l=!0;for(;s&&s!==o;){if(window.getComputedStyle(s).display==="none"){l=!1;break}s=s.parentElement}l&&n.push(a)}),n.length===0&&!t)return;let r="";if(n.forEach(a=>{let s=a.offsetTop-100;window.pageYOffset>=s&&(r=a.id)}),t&&as()){let a=document.getElementById("comment-section");if(a&&window.getComputedStyle(a).display!=="none"){let s=a.getBoundingClientRect().top+window.scrollY-120;window.pageYOffset>=s&&(r="comment-section")}}i.forEach(a=>{a.classList.remove("active"),a.getAttribute("href")==="#"+r&&a.classList.add("active")})},window.addEventListener("scroll",jt),jt()}function Au(){let i=document.querySelectorAll("#toc-container > li"),t=vu();i.forEach(e=>{let n=e.querySelector(":scope > .toc-item"),o=e.querySelector(":scope > .toc-nav");if(n&&o){let a=(n.getAttribute("href")||"").replace(/^#/,"");if(e.__categoryId=a,t.has(a)){e.classList.add("expanded"),n.classList.add("expanded");let s=n.querySelector(".fa-chevron-right, .fa-chevron-down");s&&(s.classList.remove("fa-chevron-right"),s.classList.add("fa-chevron-down"))}n.addEventListener("click",s=>{if(Gt)return;s.preventDefault(),s.stopPropagation();let l=e.classList.toggle("expanded");n.classList.toggle("expanded");let c=n.querySelector(".fa-chevron-right, .fa-chevron-down");c&&(l?(c.classList.remove("fa-chevron-right"),c.classList.add("fa-chevron-down")):(c.classList.remove("fa-chevron-down"),c.classList.add("fa-chevron-right"))),l?t.add(a):t.delete(a),yu(t)})}})}function Iu(){window.toggleSidebar=function(){if(Gt)return;let i=document.getElementById("sidebar");if(!i)return;let t=window.innerWidth,e=document.getElementById("sidebar-toggle");if(t<=1200){let n=i.classList.toggle("open"),o=e.querySelector("i");if(!o)return;n?(o.classList.remove("fa-chevron-right"),o.classList.add("fa-chevron-left")):(o.classList.remove("fa-chevron-left"),o.classList.add("fa-chevron-right"))}else{i.classList.toggle("collapsed");let n=i.classList.contains("collapsed");gc(n);let o=e==null?void 0:e.querySelector("i");o&&(n?(o.classList.remove("fa-chevron-left"),o.classList.add("fa-chevron-right")):(o.classList.remove("fa-chevron-right"),o.classList.add("fa-chevron-left")))}}}async function Hu(i){let t=await Qt.request.post(`/codenote/${Vn}`,{pid:i,abbreviation:Vn}),e;return typeof t.mdHTML=="string"?e={learning:t.mdHTML,practice:t.mdHTML}:e=t.mdHTML,{mdHTML:e,title:t.title,isReadLimited:t.isReadLimited||!1,uid:t.uid,enableComment:t.enableComment!==!1,canComment:t.canComment||!1,isIntroPage:t.isIntroPage||!1,viewCount:typeof t.viewCount=="number"?t.viewCount:0,innerIdeGuestLocked:t.innerIdeGuestLocked===!0}}function Pu(i,t,e){let n=document.getElementById("doc-problem-heading"),o=document.getElementById("doc-problem-title"),r=document.getElementById("doc-problem-view-count");if(!(!n||!o||!r)){if(i===Jn){n.classList.add("doc-header-problem--hidden");return}n.classList.remove("doc-header-problem--hidden"),o.textContent=t||"",r.textContent=String(e)}}function Du(i){var d;let{pid:t,title:e,isReadLimited:n,viewCount:o=0,urlFragmentMode:r="preserve"}=i;ai=t,kr=e,wr=n||!1,Pu(t,e,o);let a=ko.length>1;if(!wr&&a&&setTimeout(()=>{ai===Jn?Yn&&Yn.classList.remove("visible"):Yn&&Yn.classList.add("visible")},200),document.querySelectorAll(".toc-item").forEach(h=>h.classList.remove("active")),t===Jn){let h=document.querySelector('.toc-item[data-type="intro"]');h&&h.classList.add("active"),sn==null||sn.hide()}else{let h=document.querySelector(`.toc-item[data-pid="${t}"]`);h&&h.classList.add("active"),sn==null||sn.show()}let l=document.getElementById("markdown-body");l&&(xc(l,e||"\u76EE\u5F55"),wc()),Cu(n||!1),Bu();let c=r==="clear"?"":window.location.hash||"";c&&c.length>1?requestAnimationFrame(()=>{requestAnimationFrame(()=>{yc("smooth")})}):window.scrollTo({top:0,behavior:"smooth"}),window.innerWidth<=1200&&((d=document.getElementById("sidebar"))==null||d.classList.remove("open")),_u(t,r),Cc(),To&&To.reload(t,wo,Er,dc,rs,wr);let u=new CustomEvent("codenote:noteChanged",{detail:{pid:t,title:e,isIntro:t===Jn,isReadLimited:!!n}});window.dispatchEvent(u)}async function Cr(i,t){var n;if(Gt)return;let e=(n=t==null?void 0:t.urlFragmentMode)!=null?n:"preserve";rc(!0);try{yo&&(yo.destroy(),yo=null);let o=await Hu(i);if(!o){Qt.Notification.error("\u65E0\u6CD5\u52A0\u8F7D\u9898\u76EE\u5185\u5BB9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01");return}is=o.mdHTML,Fi=o.uid,Er=o.enableComment,dc=o.canComment,rs=o.isIntroPage,To&&To.updateUid(Fi);let r=is.learning,a=document.getElementById("markdown-body");yo=new bi({mdHTML:r,root:a,innerIdeGuestLocked:o.innerIdeGuestLocked,onEnhanceComplete:s=>{yi==="practice"&&document.querySelectorAll("[data-solution-content]").forEach(c=>{c.style.display="none"}),Du({pid:i,title:o.title,isReadLimited:o.isReadLimited,viewCount:o.isIntroPage?0:o.viewCount,urlFragmentMode:e})}}),await yo.render()}catch(o){console.error("\u52A0\u8F7D\u9898\u76EE\u5931\u8D25:",o),Qt.Notification.error("\u52A0\u8F7D\u9898\u76EE\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}finally{rc(!1)}}function $u(){document.querySelectorAll(".toc-item").forEach(t=>{t.addEventListener("click",async function(e){if(e.preventDefault(),Gt)return;let n=this.closest("li");if(n==null?void 0:n.querySelector(":scope > .toc-nav"))return;let r=this.dataset.pid;if(this.classList.contains("active"))return;let a=new CustomEvent("codenote:before:notechange",{detail:{pid:r}});window.dispatchEvent(a),await Cr(r||Jn,{urlFragmentMode:"clear"})})})}function Bu(){let i=document.getElementById("edit-article-link"),t=document.getElementById("view-problem-set-link"),e=document.getElementById("view-problem-link");t&&(t.href=`/pset/${wo}`),e&&(e.href=`/p/${ai}`),i&&(i.href=`/markdown_edit?pid=${ai}`)}function Nu(){let i=document.getElementById("mode-learning"),t=document.getElementById("mode-practice");if(!i||!t){console.warn("\u6A21\u5F0F\u5207\u6362\u6309\u94AE\u672A\u627E\u5230");return}ko.length!=1&&(kc(yi),i.addEventListener("click",async()=>{yi==="learning"||Gt||await lc("learning")}),t.addEventListener("click",async()=>{yi==="practice"||Gt||await lc("practice")}))}async function lc(i){if(Gt)return;if(!is){Qt.Notification.error("\u65E0\u6CD5\u5207\u6362\u6A21\u5F0F\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5");return}yi=i,wu(i),kc(i);let t=document.querySelectorAll("[data-solution-content]");i==="practice"?t.forEach(n=>{n.style.display="none"}):t.forEach(n=>{n.style.display=""});let e=document.getElementById("markdown-body");e&&(xc(e,kr||"\u76EE\u5F55"),wc())}function kc(i){let t=document.getElementById("mode-learning"),e=document.getElementById("mode-practice"),n=document.querySelector(".mode-slider");!t||!e||!n||(i==="learning"?(t.classList.add("active"),e.classList.remove("active"),n.style.transform="translateX(0)"):(t.classList.remove("active"),e.classList.add("active"),n.style.transform="translateX(100%)"))}function cc(){let i=document.querySelector(".sidebar-fixed"),t=document.querySelector(".content-container"),e=document.getElementById("sidebar-toggle");if(!i||!t)return;let o=t.getBoundingClientRect().left,s=Math.max(Math.min(320,o),200);i.style.width=`${s}px`,e.style.left=`${s-17}px`}function Tc(){let i=document.querySelector(".right-toc");if(i){if(Tr()){i.style.removeProperty("top");return}requestAnimationFrame(()=>{let t=window.innerHeight,e=i.offsetHeight,n=80,o=t-n,r=n+(o-e)/2;i.style.top=`${Math.max(r,n+20)}px`})}}function Cc(){let i=document.getElementById("markdown-body");if(!i)return;i.querySelectorAll("a").forEach(e=>{let n=e.getAttribute("href")||"";if(!n)return;let o=document.querySelector(`.toc-item[data-pid="${n}"]`);o&&e.addEventListener("click",async r=>{var s,l;if(r.preventDefault(),Gt)return;let a=(l=(s=o.closest("li"))==null?void 0:s.parentElement)==null?void 0:l.closest("li");if(a&&!a.classList.contains("expanded")){let c=a.querySelector(":scope > .toc-item");c&&(c.click(),await new Promise(u=>setTimeout(u,100)))}o.click()})})}function Fu(){var a,s,l,c;let i=document.querySelector(".page-layout"),t=((a=i==null?void 0:i.getAttribute("data-ps-name"))==null?void 0:a.trim())||"";t||(t=((l=(s=document.querySelector(".toc-header-line2"))==null?void 0:s.textContent)==null?void 0:l.trim())||""),t||(t="\u4EE3\u7801\u7B14\u8BB0");let e=document.getElementById("doc-problem-title"),n=((c=e==null?void 0:e.textContent)==null?void 0:c.trim())||"",o=kr&&kr.trim()||n||document.title,r=window.location.href;return`\u3010${t}\uFF1A${o}\u3011
${r}`}function Ru(){let i=document.getElementById("codenote-share-btn");i&&i.addEventListener("click",async()=>{var e;let t=Fu();try{if((e=navigator.clipboard)!=null&&e.writeText){await navigator.clipboard.writeText(t),Qt.Notification.success("\u5206\u4EAB\u5185\u5BB9\u5DF2\u590D\u5236");return}}catch(n){}try{let n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),Qt.Notification.success("\u5206\u4EAB\u5185\u5BB9\u5DF2\u590D\u5236")}catch(n){Qt.Notification.error("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u4ECE\u5730\u5740\u680F\u624B\u52A8\u590D\u5236\u94FE\u63A5")}})}(0,Qt.addPage)(new Qt.NamedPage(["codenote"],async()=>{Yn=document.getElementById("mode-switcher");let i=document.querySelector(".page-layout"),t=document.querySelector('.toc-item[data-type="intro"]'),e=window.location.pathname.split("/").filter(a=>a);Vn=e[1]||"";let n=e[2]||"";if(Jn=(t==null?void 0:t.dataset.pid)||"",wo=(i==null?void 0:i.getAttribute("data-psid"))||"",ai=n||Jn,Fi=parseInt((i==null?void 0:i.getAttribute("data-uid"))||"0",10),Er=(i==null?void 0:i.getAttribute("data-enable-comment"))==="true",!ai){Qt.Notification.error("\u65E0\u6CD5\u52A0\u8F7D\u9898\u5E93\u6570\u636E");return}try{ko=JSON.parse(i==null?void 0:i.getAttribute("data-modes"))}catch(a){throw console.error("\u65E0\u6CD5\u89E3\u6790\u6A21\u5F0F\u8BBE\u7F6E:",a),a}Fi>0&&/^[a-fA-F0-9]{24}$/.test(wo)&&(sn==null||sn.stop(),sn=new gr(wo),sn.start());let o=document.getElementById("comment-section");o&&(To=new xr({container:o,currentUid:Fi})),ko.length>1?yi=ku():yi=ko[0],await Cr(ai,{urlFragmentMode:"preserve"}),cc(),window.addEventListener("resize",()=>{cc(),Tc()}),Au(),bu(),$u(),ju(),Iu(),Tu(),Mu(),Nu(),Cc(),Ru(),window.history.replaceState({psid:Vn,pid:n||null},"",window.location.pathname+window.location.search+window.location.hash),Su();let r=new CustomEvent("hot100:documentLoaded");window.dispatchEvent(r),window.addEventListener("beforeunload",()=>{sn&&sn.stop()})}));var Lt=ae(re());var ss=class{constructor(t,e){p(this,"$textarea");p(this,"$editorRoot");p(this,"$previewWrapper");p(this,"$preview");p(this,"$cmContent");p(this,"previewElement");p(this,"markdownEnhancer",null);p(this,"lastText","");p(this,"timer",null);p(this,"isScrolling",!1);p(this,"scrollTimeout",null);p(this,"isRendering",!1);p(this,"customRenderReady",!1);p(this,"name");p(this,"enableSave");var n;this.$textarea=(0,Lt.$)(t),this.name=this.$textarea.attr("name")||"unnamed",this.enableSave=(n=e==null?void 0:e.enableSave)!=null?n:!1}async initialize(){return new Promise(t=>{this.waitForEditor(()=>{this.setupEditor(),t()})})}waitForEditor(t){if(this.$editorRoot=this.$textarea.closest(".section__body").find(".md-editor").first(),this.$previewWrapper=this.$editorRoot.find(".md-editor-preview-wrapper").first(),this.$preview=this.$previewWrapper.find(".md-editor-preview").first(),this.$cmContent=this.$editorRoot.find(".cm-content").first(),this.previewElement=this.$preview.get(0),!this.$editorRoot.length||!this.$previewWrapper.length||!this.$preview.length){setTimeout(()=>this.waitForEditor(t),200);return}t()}setupEditor(){console.log(`[MarkdownEditor] Initializing editor: ${this.name}`),this.$preview.html('\u6B63\u5728\u52A0\u8F7D\u81EA\u5B9A\u4E49\u9884\u89C8...
'),this.$preview.css({"min-height":"200px",transition:"none"}),this.markdownEnhancer=new bi({mdHTML:"",root:this.previewElement}),this.customRenderReady=!0,this.interceptNativePreview();let t=String(this.$textarea.val()||"").trim();t&&(this.lastText=t,this.renderPreview(t)),this.enableSave&&this.initSaveButton(),this.$previewWrapper.on("scroll",()=>{this.isScrolling=!0,this.scrollTimeout&&window.clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.isScrolling=!1},150)}),this.$textarea.on("input change",()=>this.scheduleUpdate())}getMarkdown(){return String(this.$textarea.val()||"")}async renderPreview(t){var n;if(!this.markdownEnhancer||this.isRendering)return;this.isRendering=!0;let e=((n=this.previewElement)==null?void 0:n.scrollTop)||0;try{let o=await Lt.request.post("/codenote-api/markdownRender",{content:t});if(o.error)throw new Error(o.error);this.$preview.html(o.html),await this.markdownEnhancer.update(o.html),this.previewElement&&(this.previewElement.scrollTop=e)}catch(o){console.error(`[MarkdownEditor:${this.name}] preview render failed`,o),this.$preview.html('\u9884\u89C8\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002
')}finally{this.isRendering=!1}}scheduleUpdate(){let t=this.getMarkdown();if(t!==this.lastText){if(console.log(`[MarkdownEditor:${this.name}] Scheduling update`),this.isScrolling){this.timer&&window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>this.scheduleUpdate(),500);return}this.lastText=t,this.timer&&window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.renderPreview(t)},500)}}initSaveButton(){let t=this.$editorRoot.find(".md-editor-toolbar-right").first();if(t.length){let e=(0,Lt.$)(`
\u{1F4BE}
`);t.append(e),e.on("click",async()=>{let n=this.getMarkdown();try{await Lt.request.post("",{[this.name]:n.trim()}).then(o=>{if(o.error)throw Lt.Notification.error("\u4FDD\u5B58\u5931\u8D25: "+o.error),new Error(o.error);Lt.Notification.success("\u4FDD\u5B58\u6210\u529F")})}catch(o){Lt.Notification.error("\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}})}}interceptNativePreview(){(0,Lt.$)(document).on("vjContentNew",".md-editor-preview",t=>{if(this.customRenderReady&&Lt.$.contains(this.$editorRoot.get(0),t.target))return t.stopImmediatePropagation(),t.preventDefault(),!1}),this.previewElement&&new MutationObserver(e=>{if(this.customRenderReady){for(let n of e)if(n.type==="childList"&&!this.isRendering){let o=this.getMarkdown();o&&o!==this.lastText&&this.scheduleUpdate()}}}).observe(this.previewElement,{childList:!0,subtree:!1,characterData:!1})}destroy(){this.timer&&window.clearTimeout(this.timer),this.scrollTimeout&&window.clearTimeout(this.scrollTimeout),this.$textarea.off("input change"),this.$previewWrapper.off("scroll")}},ls=class{constructor(){p(this,"editors",new Map)}async initializeAll(){let t=(0,Lt.$)("textarea[data-markdown]");if(console.log(`[MarkdownEditorManager] Found ${t.length} markdown textareas`),!t.length){console.error("[MarkdownEditorManager] No markdown textareas found");return}let o=!!new URLSearchParams(window.location.search).get("pid"),r=[];t.each((a,s)=>{let c=(0,Lt.$)(s).attr("name")||`editor-${this.editors.size}`,u=new ss(s,{enableSave:o});this.editors.set(c,u),r.push(u.initialize())}),await Promise.all(r),console.log(`[MarkdownEditorManager] Initialized ${this.editors.size} editors`)}getEditor(t){return this.editors.get(t)}destroyAll(){this.editors.forEach(t=>t.destroy()),this.editors.clear()}};(0,Lt.addPage)(new Lt.NamedPage(["markdown_edit"],async()=>{await new ls().initializeAll()}));var xi=ae(re());function qu(){let i=document.getElementById("scrollTopBtn"),t=document.querySelector(".progress-ring__circle");if(!i||!t)return()=>{};let e=t.r.baseVal.value,n=2*Math.PI*e;t.style.strokeDasharray=`${n} ${n}`,t.style.strokeDashoffset=`${n}`;let o=s=>{let l=n-s/100*n;t.style.strokeDashoffset=`${l}`},r=()=>{let s=document.documentElement.scrollHeight,l=document.documentElement.clientHeight,c=window.scrollY||document.documentElement.scrollTop,u=s-l;if(u>0){let d=c/u*100;o(d),c>200?i.classList.add("visible"):i.classList.remove("visible")}else i.classList.remove("visible"),o(0)},a=()=>{window.scrollTo({top:0,behavior:"smooth"})};return window.addEventListener("scroll",r),i.addEventListener("click",a),r(),()=>{window.removeEventListener("scroll",r),i.removeEventListener("click",a)}}(0,xi.addPage)(new xi.NamedPage(["problem_detail","problem_set_detail","codenote","vip_solution","homepage"],async()=>{try{let i=(0,xi.$)(`
`);(0,xi.$)(document.body).append(i),qu()}catch(i){console.error("\u7F51\u9875\u7F6E\u9876\u5931\u8D25:",i)}}));var Lr=ae(re());function zu(i,t){let e=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;for(;e&&e.parentElement!==i;)e=e.parentElement;return e?Array.prototype.indexOf.call(i.children,e):-1}function Ou(i){let t=document.createElement("div");t.className="objective-page";for(let e of i)t.appendChild(e);return t}function Uu(i){let t=[...i.childNodes],e=[],n=[];for(let o of t){if(o.nodeType!==Node.ELEMENT_NODE)continue;let r=o;r.tagName==="HR"?(n.length&&(e.push(n),n=[]),r.remove()):n.push(r)}return n.length&&e.push(n),e.length<=1?null:e.map(o=>Ou(o))}function Wu(i){let t=[...i.querySelectorAll("fieldset")];if(t.length<=1)return null;let e=[];for(let n of t){let o=document.createElement("div");o.className="objective-page",n.parentNode.insertBefore(o,n),o.appendChild(n),e.push(o)}return e}function Yu(i,t,e,n){let o=t;for(;o>n+1;){let a=i.children[o-1].querySelectorAll('input[type="radio"], input[type="checkbox"]');if(a.length===0){o-=1;continue}if([...a].some(l=>l.name!==e))break;o-=1}return o}function Vu(i){var s;let t=[...i.querySelectorAll('input[type="radio"], input[type="checkbox"]')].filter(l=>l.name);if(t.length===0)return null;let e=[],n=new Set;for(let l of t)n.has(l.name)||(n.add(l.name),e.push(l.name));if(e.length<=1)return null;let o=[],r=-1;for(let l=0;lv.name===c),d=1/0,h=-1;for(let v of u){let w=zu(i,v);if(w<0)return null;d=Math.min(d,w),h=Math.max(h,w)}if(d===1/0)return null;d=Yu(i,d,c,r),o.push({start:d,end:h}),r=h}let a=[];for(let l=o.length-1;l>=0;l--){let{start:c,end:u}=o[l],d=document.createElement("div");d.className="objective-page";let h=u-c+1;for(let v=0;v1)return t;let e=Uu(i);if(e&&e.length>1)return e;let n=Vu(i);return n&&n.length>1?n:null}function Ju(i){if(i.children.length===1){let t=i.children[0],e=Ec(t);if(e&&e.length>1)return t.replaceWith(...e),e}return Ec(i)}function Ku(i,t){let e=0,n=t.length,o=document.createElement("div");o.className="objective-pager-card";let r=document.createElement("div");r.className="objective-pager-toolbar",r.setAttribute("role","navigation"),r.setAttribute("aria-label","\u5BA2\u89C2\u9898\u5206\u9875");let a=document.createElement("div");a.className="objective-pager-nav";let s=document.createElement("button");s.type="button",s.className="objective-pager-btn",s.textContent="\u4E0A\u4E00\u9898",s.setAttribute("aria-label","\u4E0A\u4E00\u9898");let l=document.createElement("span");l.className="objective-pager-counter";let c=document.createElement("button");c.type="button",c.className="objective-pager-btn objective-pager-btn--accent",c.textContent="\u4E0B\u4E00\u9898",c.setAttribute("aria-label","\u4E0B\u4E00\u9898"),a.appendChild(s),a.appendChild(l),a.appendChild(c),r.appendChild(a);let u=document.createElement("div");u.className="objective-pager-viewport",t.forEach((M,A)=>{M.classList.toggle("is-active",A===0),u.appendChild(M)}),o.appendChild(u),o.appendChild(r);let d=()=>{t.forEach((M,A)=>{M.classList.toggle("is-active",A===e)}),l.textContent=`${e+1} / ${n}`,s.disabled=e<=0,c.disabled=e>=n-1},h=M=>{e=Math.max(0,Math.min(n-1,M)),d()};s.addEventListener("click",()=>{e>0&&h(e-1)}),c.addEventListener("click",()=>{e{let D=()=>{if(/^#p\d+$/.test(window.location.hash))try{history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}catch(q){}},$=()=>{D(),(window.scrollX!==M||window.scrollY!==A)&&window.scrollTo(M,A)};$(),requestAnimationFrame($),requestAnimationFrame(()=>requestAnimationFrame($)),queueMicrotask($),window.setTimeout($,0),window.setTimeout($,32),window.setTimeout($,120)},w=M=>{if(!document.querySelector('.objective-problem-root[data-objective-pager-init="1"]')||!M)return null;let A=M.closest('a[href^="#p"]');if(!A||!A.closest(".contest-problems"))return null;let D=A.getAttribute("href"),$=D&&/^#p(\d+)$/.exec(D);if(!$)return null;let q=parseInt($[1],10);return!Number.isFinite(q)||q<1||q>n?null:{a:A,num:q}},k=(M,A,D)=>{h(D-1),v(M,A)},L=M=>{if(M.button!==0)return;let A=w(M.target);if(!A)return;let D=window.scrollX,$=window.scrollY;M.preventDefault(),M.stopPropagation(),k(D,$,A.num)},H=M=>{w(M.target)&&(M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation())};document.addEventListener("mousedown",L,!0),document.addEventListener("click",H,!0);let _=M=>{if(M.altKey||M.ctrlKey||M.metaKey)return;let A=M.target;A&&(A.tagName==="INPUT"||A.tagName==="TEXTAREA"||A.isContentEditable)||(M.key==="ArrowLeft"&&e>0?(M.preventDefault(),h(e-1)):M.key==="ArrowRight"&&e{window.removeEventListener("keydown",_),document.removeEventListener("mousedown",L,!0),document.removeEventListener("click",H,!0)}}function Qu(){let i=[];return document.querySelectorAll(".objective-problem-root").forEach(e=>{if(e.dataset.objectivePagerInit==="1")return;let n=e;if(!n.childNodes.length)return;let o=Ju(n);!o||o.length<=1||(e.dataset.objectivePagerInit="1",i.push(Ku(e,o)))}),()=>{i.forEach(e=>e())}}function Gu(i){let t=new Set([`${i}`]);i>=1&&i<=9&&t.add(`0${i}`);for(let e of t){if(document.querySelector(`input.objective-input[name="${e}"]:checked, input[type="radio"][name="${e}"]:checked, input[type="checkbox"][name="${e}"]:checked`))return!0;let n=document.querySelector(`input.objective-input[name="${e}"]:not([type="radio"]):not([type="checkbox"])`);if(n&&n.value.trim()!=="")return!0;let o=document.querySelector(`textarea.objective-input[name="${e}"]`);if(o&&o.value.trim()!=="")return!0}return!1}function Lc(){let i=document.querySelectorAll('.contest-problems a[href^="#p"]');if(i.length)for(let t of i){let e=t.getAttribute("href"),n=e&&/^#p(\d+)$/.exec(e);if(!n)continue;let o=parseInt(n[1],10);Number.isFinite(o)&&t.classList.toggle("objective-sidebar-q--answered",Gu(o))}}function Xu(){let i=null,t=()=>{i!=null&&window.clearTimeout(i),i=window.setTimeout(()=>{i=null,document.querySelector('.contest-problems a[href^="#p"]')&&Lc()},80)},e=()=>t();document.addEventListener("change",e,!0),document.addEventListener("input",e,!0);let n=new MutationObserver(t);n.observe(document.body,{childList:!0,subtree:!0}),t();let o=window.setInterval(()=>{document.querySelector('.contest-problems a[href^="#p"]')&&Lc()},2500);return()=>{document.removeEventListener("change",e,!0),document.removeEventListener("input",e,!0),n.disconnect(),window.clearInterval(o),i!=null&&window.clearTimeout(i)}}(0,Lr.addPage)(new Lr.NamedPage(["problem_detail","contest_detail_problem","homework_detail_problem"],()=>{let i=Qu(),t=Xu();return()=>{i(),t()}}));var _r=ae(re()),Zu="pd-floating-tab",em="pd-floating-tab--visible";function tm(){let i=document.querySelector(".pd-main-card .section__tab-container");if(!i||!i.querySelector(".section__tab-header-item"))return null;let t=i.closest(".pd-main-card"),e=document.createElement("div");e.className=Zu,e.setAttribute("aria-hidden","true");let n=()=>{let w=i.cloneNode(!0);w.removeAttribute("id"),w.querySelectorAll("[id]").forEach(k=>k.removeAttribute("id")),e.replaceChildren(w),o()},o=()=>{e.querySelectorAll(".section__tab-header-item").forEach(w=>{let k=w.getAttribute("data-type");k&&w.addEventListener("click",L=>{L.preventDefault();let H=i.querySelector(`.section__tab-header-item[data-type="${k}"]`);H&&H.click(),window.scrollTo({top:0,behavior:"smooth"})})})},r=()=>{let w=i.querySelectorAll(".section__tab-header-item"),k=e.querySelectorAll(".section__tab-header-item");w.length===k.length&&w.forEach((L,H)=>{let _=k[H];_&&_.classList.toggle("tab--active",L.classList.contains("tab--active"))})},a=()=>{let w=i.getBoundingClientRect();e.style.left=`${Math.round(w.left)}px`,e.style.width=`${Math.round(w.width)}px`},s=()=>{let w=i.getBoundingClientRect(),k=(t!=null?t:i).getBoundingClientRect(),L=w.top<0&&k.bottom>0;e.classList.toggle(em,L)},l=()=>{a(),s()};n(),r(),document.body.appendChild(e),l();let c=()=>{s()},u=()=>{l()};window.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",u);let d=null;typeof ResizeObserver<"u"&&(d=new ResizeObserver(()=>{l()}),d.observe(i),t&&d.observe(t),d.observe(document.body));let h=new MutationObserver(()=>{r()});i.querySelectorAll(".section__tab-header-item").forEach(w=>h.observe(w,{attributes:!0,attributeFilter:["class"]}));let v=new MutationObserver(()=>{n(),r(),i.querySelectorAll(".section__tab-header-item").forEach(w=>h.observe(w,{attributes:!0,attributeFilter:["class"]}))});return v.observe(i,{childList:!0,subtree:!0}),()=>{window.removeEventListener("scroll",c),window.removeEventListener("resize",u),d==null||d.disconnect(),h.disconnect(),v.disconnect(),e.remove()}}(0,_r.addPage)(new _r.NamedPage(["problem_detail"],()=>{let i=null,t=(e=0)=>{i=tm(),!i&&(e>=10||window.setTimeout(()=>t(e+1),120))};return t(),()=>{i==null||i(),i=null}}));var vt=ae(re());var ce=ae(re());function Mr(i){return i.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}var nm=[2,3,4,6];function Sc(i){return nm.includes(i)}function jr(i,t){let e=i==null?void 0:i.id;if(e!=null&&e!==""){let n=Number(e);if(Number.isFinite(n))return n}return t+1}function jc(){if(document.getElementById("record-case-preview-ai-confirm-style"))return;let i=document.createElement("style");i.id="record-case-preview-ai-confirm-style",i.textContent=`
@keyframes cp-ai-confirm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cp-ai-confirm-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes cp-ai-confirm-zoom-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes cp-ai-confirm-zoom-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.9); } }
.cp-ai-confirm-mask {
position: fixed; inset: 0;
background: rgba(0, 0, 0, 0.5);
display: flex; align-items: center; justify-content: center;
z-index: 100000;
opacity: 0;
}
.cp-ai-confirm-dialog {
width: 420px; max-width: 90vw;
background: #fff;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
padding: 24px 32px 20px;
box-sizing: border-box;
opacity: 0; transform: scale(0.9);
}
.cp-ai-confirm-enter-mask { animation: cp-ai-confirm-fade-in .22s forwards; }
.cp-ai-confirm-enter-dialog { animation: cp-ai-confirm-zoom-in .22s forwards; }
.cp-ai-confirm-leave-mask { animation: cp-ai-confirm-fade-out .18s forwards; }
.cp-ai-confirm-leave-dialog { animation: cp-ai-confirm-zoom-out .18s forwards; }
.cp-ai-confirm-header { display: flex; align-items: center; margin-bottom: 16px; }
.cp-ai-confirm-icon {
width: 36px; height: 36px;
border-radius: 50%;
background-color: #00b578;
display: flex; align-items: center; justify-content: center;
margin-right: 12px; flex-shrink: 0;
color: #fff; font-size: 22px;
}
.cp-ai-confirm-title { font-size: 18px; font-weight: 600; color: #333; }
.cp-ai-confirm-content { font-size: 14px; color: #666; line-height: 1.6; margin-bottom: 24px; }
.cp-ai-confirm-content .cp-ai-confirm-highlight { color: #ef4444; font-weight: 600; }
.cp-ai-confirm-footer { display: flex; justify-content: flex-end; gap: 12px; }
.cp-ai-confirm-btn {
min-width: 80px; height: 32px; padding: 0 14px;
border-radius: 4px; border: 1px solid transparent;
font-size: 14px; cursor: pointer;
}
.cp-ai-confirm-btn:active { transform: translateY(1px); }
.cp-ai-confirm-btn:hover { filter: brightness(1.05); }
.cp-ai-confirm-btn-cancel {
background: #f5f5f5; border-color: #d9d9d9; color: #333;
}
.cp-ai-confirm-btn-cancel:hover { background: #e0e0e0; border-color: #bfbfbf; }
.cp-ai-confirm-btn-confirm {
background: #4CAF50; border-color: #4CAF50; color: #fff;
}
.cp-ai-confirm-btn-confirm:hover { background: #45a049; border-color: #45a049; }
.theme--dark .cp-ai-confirm-dialog {
background: #161b22; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.theme--dark .cp-ai-confirm-title { color: #c9d1d9; }
.theme--dark .cp-ai-confirm-content { color: #8b949e; }
.theme--dark .cp-ai-confirm-btn-cancel {
background: #21262d; border-color: #30363d; color: #c9d1d9;
}
.theme--dark .cp-ai-confirm-btn-cancel:hover { background: #30363d; border-color: #484f58; }
`,document.head.appendChild(i)}function Ac(i,t){return jc(),new Promise(e=>{var a,s;let n=document.createElement("div");n.className="cp-ai-confirm-mask";let o=document.createElement("div");o.className="cp-ai-confirm-dialog",o.innerHTML=`
${t}
`,n.appendChild(o),document.body.appendChild(n),requestAnimationFrame(()=>{n.classList.add("cp-ai-confirm-enter-mask"),o.classList.add("cp-ai-confirm-enter-dialog")});let r=l=>{n.classList.remove("cp-ai-confirm-enter-mask"),o.classList.remove("cp-ai-confirm-enter-dialog"),n.classList.add("cp-ai-confirm-leave-mask"),o.classList.add("cp-ai-confirm-leave-dialog"),o.addEventListener("animationend",()=>{n.remove(),e(l)},{once:!0})};o.addEventListener("click",l=>l.stopPropagation()),n.addEventListener("click",()=>r(!1)),(a=o.querySelector(".cp-ai-confirm-btn-confirm"))==null||a.addEventListener("click",()=>r(!0)),(s=o.querySelector(".cp-ai-confirm-btn-cancel"))==null||s.addEventListener("click",()=>r(!1))})}async function im(i){try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(i),ce.Notification.success((0,ce.i18n)("Copied"));return}let t=document.createElement("textarea");t.value=i,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();try{await navigator.clipboard.writeText(t.value),ce.Notification.success((0,ce.i18n)("Copied"))}catch(e){document.execCommand("copy")?ce.Notification.success((0,ce.i18n)("Copied")):ce.Notification.error((0,ce.i18n)("Copy failed"))}finally{document.body.removeChild(t)}}catch(t){ce.Notification.error((0,ce.i18n)("Copy failed"))}}(function(){if(document.getElementById("xmodal-style"))return;let t=document.createElement("style");t.id="xmodal-style",t.textContent=`
.xmodal-root {
position: fixed; inset: 0; z-index: 999;
opacity: 0; visibility: hidden; pointer-events: none;
transition: opacity .50s ease, visibility 0s linear .50s;
}
.xmodal-root.is-open {
opacity: 1; visibility: visible; pointer-events: auto;
transition: opacity .50s ease;
}
.xmodal-mask { opacity: 0; transition: opacity .50s ease; }
.xmodal-root.is-open .xmodal-mask { opacity: 1; }
.xmodal-panel {
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
padding: 24px; pointer-events: none;
}
.xmodal {
pointer-events: auto; width: 100%; max-width: 640px; background: #fff; color: #111827;
border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); overflow: hidden;
transform: translateY(6px); opacity: 0; transition: transform .50s ease, opacity .50s ease;
}
@media (prefers-reduced-motion: reduce) {
.xmodal-root, .xmodal, .xmodal-mask { transition: none !important; }
}
.xmodal-root.is-open .xmodal { transform: translateY(0); opacity: 1; }
.xmodal__header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; border-bottom: 1px solid #e5e7eb; background:#f9fafb; }
.xmodal__title { font-weight: 600; }
.xmodal__close { border: none; background: transparent; width: 48px; height: 48px; border-radius: 8px; cursor: pointer; font-size: 36px; }
.xmodal__close:hover { background: #f3f4f6; }
.xmodal__content { padding: 16px; max-height: calc(100vh - 200px); overflow: auto; }
.xmodal__footer { display:flex; justify-content:flex-end; gap:8px; padding: 12px 16px; border-top: 1px solid #f3f4f6; background:#fff; }
.xbtn { appearance:none; border:1px solid #e5e7eb; background:#fff; padding:8px 12px; border-radius:8px; cursor:pointer; }
.xbtn--primary { background:#111827; color:#fff; border-color:#111827; }
.xbtn:disabled { opacity:.6; cursor:not-allowed; }
body.xmodal-open, html.xmodal-open { overflow: hidden; }
.preview-loading {
width: 100%;
height: 360px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #6b7280;
gap: 16px;
}
.preview-spinner {
width: 40px; height: 40px;
border: 3px solid #e5e7eb;
border-top-color: #111827;
border-radius: 50%;
animation: preview-spin .8s linear infinite;
}
@keyframes preview-spin { to { transform: rotate(360deg); } }
.preview-error {
width: 100%;
height: 360px;
display: flex;
align-items: center;
justify-content: center;
color: #ef4444;
font-weight: 500;
}
`,document.head.appendChild(t)})();var Sr=class{constructor(t){p(this,"$root");p(this,"$mask");p(this,"$panel");p(this,"$box");p(this,"$content");p(this,"$footer");p(this,"$close");p(this,"resolve");p(this,"onClose");p(this,"closeOnEsc");p(this,"closeOnMask");let{$body:e,title:n,width:o,maxWidth:r,closeOnEsc:a=!0,closeOnMask:s=!0,onClose:l,buttons:c=[],panelClass:u,boxClass:d,contentClass:h}=t||{};this.closeOnEsc=a,this.closeOnMask=s,this.onClose=l,this.$root=(0,ce.$)('
'),this.$mask=(0,ce.$)('
'),this.$panel=(0,ce.$)('
'),u&&this.$panel.addClass(u),this.$box=(0,ce.$)('
'),d&&this.$box.addClass(d),o&&(this.$box[0].style.width=o),r&&(this.$box[0].style.maxWidth=r);let v=(0,ce.$)(`
`);this.$close=v.find(".xmodal__close"),this.$content=(0,ce.$)('
'),h&&this.$content.addClass(h),e&&this.$content.append(e),this.$footer=(0,ce.$)(''),c.length?c.forEach(w=>{let k=(0,ce.$)(`${w.text} `);w.autofocus&&k.attr("autofocus","autofocus"),k.on("click",()=>this.close(w.value)),this.$footer.append(k)}):this.$footer.hide(),this.$box.append(v,this.$content,this.$footer),this.$panel.append(this.$box),this.$root.append(this.$mask,this.$panel),this.$close.on("click",()=>this.close(void 0)),this.$mask.on("click",w=>{if(!this.closeOnMask){w.preventDefault();return}this.close(void 0)}),(0,ce.$)(document).on("keydown.xmodal",w=>{if(w.key==="Escape"||w.keyCode===27){if(!this.closeOnEsc){w.preventDefault();return}this.close(void 0)}if(w.key==="Tab"){let k=this.$root.find('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])').filter(":visible");if(!k.length)return;let L=k[0],H=k[k.length-1],_=document.activeElement;w.shiftKey&&_===L?(H.focus(),w.preventDefault()):!w.shiftKey&&_===H&&(L.focus(),w.preventDefault())}})}open(){return new Promise(t=>{this.resolve=t,document.body.appendChild(this.$root[0]),document.body.classList.add("xmodal-open"),document.documentElement.classList.add("xmodal-open"),requestAnimationFrame(()=>this.$root.addClass("is-open")),setTimeout(()=>{var e,n;return(n=(e=this.$box.find("[autofocus]").get(0))==null?void 0:e.focus)==null?void 0:n.call(e)},0)})}close(t){this.$root.removeClass("is-open"),setTimeout(()=>{var e,n;try{this.$root.remove()}catch(o){}document.body.classList.remove("xmodal-open"),document.documentElement.classList.remove("xmodal-open"),(e=this.onClose)==null||e.call(this),(n=this.resolve)==null||n.call(this,t),(0,ce.$)(document).off("keydown.xmodal")},520)}};async function Ic({$body:i,title:t}){return await new Sr({$body:i,title:t,closeOnEsc:!0,closeOnMask:!0,buttons:[{text:(0,ce.i18n)("OK"),className:"xbtn--primary",value:"ok",autofocus:!0}]}).open()}var om="/vip";function rm(){return`
\u6B21\u6570\u5DF2\u7528\u5C3D
\u4ECA\u65E5\u6B21\u6570\u5DF2\u7528\u5C3D\u3002
\u52A0\u5165\u4F1A\u5458 \u53EF\u4EAB\u53D7\u6BCF\u65E5 30 \u6B21\u6570\u636E\u9884\u89C8\u3002
`}async function _c(){await Ic({$body:(0,ce.$)(rm()),title:(0,ce.i18n)("Notice")})}function Mc(i,t,e,n){return(0,ce.$)(`
${e||(0,ce.i18n)("(Empty)")}
`)}async function am(i,t,e,n){let o=(t==null?void 0:t[`${i}.in`])||null,r=(t==null?void 0:t[`${i}.out`])||null,a=!0,s=new AbortController,l=s.signal,c=n!=null&&n.onAddToSelfTest?'\u52A0\u5165\u81EA\u6D4B\u7528\u4F8B ':"",u=(n==null?void 0:n.hideRemainingCount)===!0?"":`
\u4ECA\u65E5\u5269\u4F59\u6B21\u6570: ${e}
?
`,d=(0,ce.$)(`
\u6B63\u5728\u52A0\u8F7D\u6570\u636E...
`),h=document.createElement("style");h.textContent=`
/* \u89C6\u53E3\u5185\u5B8C\u6574\u663E\u793A\uFF1A\u6807\u9898 + \u53EF\u6EDA\u52A8\u5185\u5BB9\u533A + \u56FA\u5B9A\u5E95\u680F */
.xmodal-panel--case-preview {
padding: 8px !important;
align-items: stretch !important;
}
.xmodal--case-preview {
display: flex !important;
flex-direction: column;
/* \u4E0E\u4EC5 max-height \u4E0D\u540C\uFF1A\u5360\u6EE1\u9762\u677F\u62C9\u4F38\u9AD8\u5EA6\uFF0C\u5B50\u9879 flex:1 \u624D\u80FD\u5F97\u5230\u786E\u5B9A\u5269\u4F59\u9AD8\u5EA6\uFF0C\u5185\u90E8\u4EE3\u7801\u533A\u624D\u4F1A\u51FA\u73B0\u6EDA\u52A8 */
height: 100%;
max-height: min(calc(100vh - 16px), calc(100dvh - 16px)) !important;
min-height: 0;
width: min(1120px, calc(100vw - 16px)) !important;
overflow: hidden !important;
box-sizing: border-box;
}
.xmodal--case-preview .xmodal__header { flex-shrink: 0; }
.xmodal__content--case-preview {
flex: 1 1 0% !important;
min-height: 0 !important;
max-height: none !important;
overflow: hidden !important;
display: flex !important;
flex-direction: column !important;
padding: 0 !important;
}
.preview-dialog {
width: 100%;
max-width: 1120px;
display: flex;
flex-direction: column;
flex: 1 1 0%;
min-height: 0;
}
.preview-dialog__header {
display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center;
gap:8px 12px; padding:10px 12px; border-bottom:1px solid #e5e7eb;
flex-shrink: 0;
}
.preview-dialog__title { font-size: 15px; }
.preview-dialog__content {
display:flex; flex-wrap:wrap; gap:12px; padding:12px; box-sizing:border-box;
flex: 1 1 0%;
min-height: 0;
overflow: hidden;
align-items: stretch;
align-content: stretch;
}
.preview-dialog .preview-loading {
width: 100%;
min-height: 120px;
height: auto;
max-height: min(360px, 42vh);
margin: 0 auto;
}
.preview-dialog .preview-error {
width: 100%;
min-height: 100px;
height: auto;
max-height: min(360px, 42vh);
}
.preview-pane {
flex: 1 1 calc(50% - 8px);
min-width: min(100%, 240px);
min-height: 0;
align-self: stretch;
border:1px solid #e5e7eb; border-radius:8px; background:#fff;
box-shadow:0 2px 10px rgba(0,0,0,.04); display:flex; flex-direction:column; overflow:hidden;
}
.preview-pane__content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.preview-pane__header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-bottom:1px solid #f3f4f6; background:#f9fafb; flex-shrink:0; }
.preview-pane__title { display:flex; flex-direction:column; gap:2px; min-width:0; }
.preview-pane__title-text { font-weight:600; font-size:14px; }
.preview-pane__filename { color:#6b7280; font-size:11px; word-break: break-all; }
.preview-pane__code-container {
position:relative; width:100%; flex:1 1 0%;
min-height: 0;
/* \u5BBD\u5C4F\u4E0B\u4E5F\u9700\u660E\u786E\u4E0A\u9650\uFF08\u7A84\u5C4F\u65AD\u70B9\u91CC\u53E6\u6709 max-height\uFF09\uFF1B\u5426\u5219\u5B50\u9879\u4F1A\u968F pre \u6491\u6EE1\u7236\u7EA7\uFF0C\u53EA\u6709\u653E\u5927\u89E6\u53D1\u65AD\u70B9\u540E\u624D\u6709\u6EDA\u52A8 */
max-height: min(1000px, 500vh, calc(100dvh - 240px), calc(100vh - 240px));
overflow-x: auto;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
scrollbar-width: thin;
scrollbar-color: rgba(255,255,255,.35) rgba(0,0,0,.25);
box-sizing:border-box; background:#0b1020; border-top:1px solid #3e4045ff;
}
.preview-pane__code { margin:0; padding:10px 12px; color:#c4c9d4ff; background:transparent;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: clamp(12px, 2.8vw, 15px); line-height:1.55; white-space: pre; min-width: max-content; }
.preview-pane__code-container::-webkit-scrollbar { width: 8px; height: 8px; }
.preview-pane__code-container::-webkit-scrollbar-thumb {
background: rgba(255,255,255,.22); border-radius: 4px;
}
.preview-pane__code-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); }
.preview-pane__code-container::-webkit-scrollbar-track { background: rgba(0,0,0,.2); }
.btn--small { padding:6px 10px; font-size:12px; }
.btn--copy { display:inline-flex; align-items:center; gap:6px; flex-shrink:0; }
.preview-dialog__footer {
flex-shrink: 0;
padding:10px 12px; border-top:1px solid #e5e7eb; font-size:13px; color:#6b7280; background:#fff;
}
.preview-dialog__footer-inner { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; }
.preview-dialog__footer-note { flex:1 1 200px; line-height:1.45; }
.preview-dialog__btn-add-selftest {
flex-shrink:0; appearance:none; border:none; cursor:pointer;
padding:8px 14px; border-radius:8px; font-size:13px; font-weight:500;
background:#111827; color:#fff;
}
.preview-dialog__btn-add-selftest:disabled { opacity:.45; cursor:not-allowed; }
.preview-dialog__btn-add-selftest:hover:not(:disabled) { filter:brightness(1.08); }
.preview-dialog__remaining { display:flex; align-items:center; flex-wrap:wrap; gap:4px; font-size:13px; }
.hint-icon { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; border-radius:50%; border:1px solid #9ca3af; color:#6b7280; font-size:12px; line-height:1; cursor:help; }
@media (max-width: 720px) {
.xmodal-panel--case-preview { padding: 4px !important; }
.xmodal--case-preview { max-height: min(calc(100vh - 8px), calc(100dvh - 8px)) !important; width: calc(100vw - 8px) !important; }
.preview-dialog__content {
flex-direction: column; flex-wrap: nowrap; padding: 8px; gap: 10px;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.preview-pane { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 160px; }
.preview-pane__code-container { flex: 1 1 auto; max-height: min(320px, 42vh); }
.preview-dialog .preview-loading, .preview-dialog .preview-error { max-height: min(240px, 35vh); }
}
@media (max-height: 520px) {
.preview-pane__code-container { max-height: min(200px, 28vh); }
.preview-dialog__footer { font-size: 12px; padding: 8px 10px; }
}
`,document.head.appendChild(h);let v=new Sr({$body:d,title:"\u6D4B\u8BD5\u6570\u636E\u9884\u89C8",maxWidth:"1120px",closeOnEsc:!1,closeOnMask:!1,panelClass:"xmodal-panel--case-preview",boxClass:"xmodal--case-preview",contentClass:"xmodal__content--case-preview",onClose:()=>{s.abort();try{document.head.removeChild(h)}catch(_){}}}),w=async _=>{if(!_)return{raw:"",display:(0,ce.i18n)("(No file)")};try{let M=await fetch(_,{credentials:"include",signal:l});if(!M.ok)throw new Error(`HTTP ${M.status}`);let A=await M.text();return{raw:A,display:A.length?A:(0,ce.i18n)("(Empty)")}}catch(M){if(M.name==="AbortError")throw M;return{raw:"",display:(0,ce.i18n)("(Failed to load)")}}},k="",L="",H=async()=>{try{let[_,M]=await Promise.all([w(o),w(r)]);k=_.raw,L=M.raw,d.find(".preview-dialog__content").empty().append(Mc("\u6807\u51C6\u8F93\u5165",o?`${i}.in`:null,_.display,"left"),Mc("\u6807\u51C6\u8F93\u51FA",r?`${i}.out`:null,M.display,"right")),a=!1;let D=d.find(".preview-dialog__btn-add-selftest");if(D.length&&(n!=null&&n.onAddToSelfTest)){let $=k.length>0||L.length>0;D.prop("disabled",!$)}}catch(_){if(_.name==="AbortError")return;d.find(".preview-dialog__content").html('\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002
'),a=!1}};d.on("click",".preview-dialog__btn-add-selftest",async function(){if(!(!(n!=null&&n.onAddToSelfTest)||this.disabled)){if(!k.length&&!L.length){ce.Notification.info("\u6CA1\u6709\u53EF\u5199\u5165\u7684\u6807\u51C6\u8F93\u5165\u6216\u8F93\u51FA");return}try{await n.onAddToSelfTest({input:k,expected:L})}catch(_){ce.Notification.error("\u5199\u5165\u81EA\u6D4B\u5931\u8D25")}}}),v.$close.off("click").on("click",async()=>{a?(s.abort(),v.close(),ce.Notification.info((0,ce.i18n)("\u5DF2\u505C\u6B62\u52A0\u8F7D"))):await Ac("\u5173\u95ED\u9884\u89C8",Mr((0,ce.i18n)("\u60A8\u786E\u5B9A\u8981\u5173\u95ED\u6B64\u9884\u89C8\u5417\uFF1F")))&&v.close()}),(0,ce.$)(document).off("click.copydata").on("click.copydata",".btn--copy",async _=>{let M=(0,ce.$)(_.currentTarget),A=M.html(),D=M.attr("data-copy"),$=(0,ce.$)(`#${D}`).text();M.html(' ...'),M[0].style.background="#6b7280",await im($),setTimeout(()=>{M.html(A),M[0].style.background=""},1e3)}),H(),await v.open()}function sm(){return{id:window.UserContext._id,role:window.UserContext.role}}async function Ar(i,t="",e){var d;if(jc(),!Number.isFinite(i)){ce.Notification.error((0,ce.i18n)("Unknown case id."));return}let{id:n,role:o}=sm();if(n==null){ce.Notification.error((0,ce.i18n)("Please login."));return}let r=await ce.request.get(t,{event:"getDownloadTimes",uid:n,role:o,fid:i}),{canDownloadCases:a,downloadTimes:s}=r,l=r.alreadyViewedThisCase===!0;if(!a){await Ic({$body:(0,ce.$)(`
Access Denied
\u60A8\u65E0\u6CD5\u67E5\u770B\u6570\u636E\uFF0C\u8BF7\u5148\u8D2D\u4E70\u8BE5\u9898\u6240\u5C5E\u9898\u5E93\uFF01
`),title:(0,ce.i18n)("Warning")});return}if(s<=0&&!l){await _c();return}if(!l){let h=`
\u786E\u5B9A\u8981\u67E5\u770B\u7B2C ${Mr(String(i))} \u7EC4\u6570\u636E\u5417\uFF1F
\u4ECA\u65E5\u8FD8\u5269 ${Mr(String(s))} \u6B21\u673A\u4F1A
`;if(!await Ac("\u67E5\u770B\u6D4B\u8BD5\u6570\u636E",h))return}let c=await ce.request.get(t,{event:"viewCase",fid:i,uid:n,role:o});if(!(c!=null&&c.ok)){let h=c==null?void 0:c.code,v=String((c==null?void 0:c.message)||"");if(h==="case_preview_quota_exhausted"||v==="No remaining view quota"){await _c();return}ce.Notification.error((c==null?void 0:c.message)||(0,ce.i18n)("View denied"));return}let u=c.consumedQuota===!1;await am(i,c.links||{},(d=c.remaining)!=null?d:s-1,{...e,hideRemainingCount:u})}var Hc="problem_ide_fontsize_v1",Pc="problem_ide_dark_v1",Dc="problem_ide_split_v1",$c="problem_ide_drawer_h_v1",Uc={cc:["cc","c++","cpp","g++","cc.cc11","cc.cc14o2","cc.cc14","cc.cc11o2"],cpp:["cc","c++","cpp","g++","cc.cc11","cc.cc14o2","cc.cc14","cc.cc11o2"],c:["c"],py:["py","py.py3"],java:["java"],go:["go","golang"],js:["js","javascript","node"],ts:["ts","typescript"],rs:["rust"],cs:["csharp","c#"]};function lm(i,t){let e=Uc[t];if(!e)return!1;let n=i.toLowerCase();return e.some(o=>n===o||n.startsWith(`${o}.`)||n.startsWith(`${o}_`))}function cm(i){let t={};for(let e of i){let n=e.match(/^user\.(\w+)$/i);n&&(t[n[1].toLowerCase()]=e)}return t}var fs={};for(let[i,t]of Object.entries(Uc))for(let e of t)fs[e]||(fs[e]=i);function dm(i,t){for(let[n,o]of Object.entries(t))if(lm(i,n))return o;let e=i.toLowerCase();for(let[n,o]of Object.entries(fs))if(e===n||e.startsWith(`${n}.`)||e.startsWith(`${n}_`))return`user.${o}`;return null}function pm(i){var e,n;let t=(e=window.__problemIdeConfig)==null?void 0:e.core_templates;return!t||typeof t!="object"?null:(n=t[i])!=null?n:null}function Bc(i,t){if(!t)return;if(Object.prototype.hasOwnProperty.call(i,t)){let n=i[t];if(n!=null&&String(n).trim()!=="")return String(n)}let e=t.toLowerCase();for(let n of Object.keys(i))if(n.toLowerCase()===e){let o=i[n];if(o!=null&&String(o).trim()!=="")return String(o)}}var um=["_","*","default","global","all","code","template","snippet","body"];function mm(i){let t=i.trim();return t?/^[a-z]{2,4}\.[a-z0-9]+$/i.test(t)?!0:/^(cc|c\+\+|cpp|g\+\+|py|python|java|js|ts|go|rust|rs|cs|csharp|kt|php|rb)\b/i.test(t):!1}function cs(i,t){var h,v,w,k;if(t==null)return;if(typeof t=="string")return t.trim()===""?void 0:t;if(typeof t!="object"||Array.isArray(t))return;let e=t,n=[],o=L=>{L&&!n.includes(L)&&n.push(L)};o(i);let r=i.indexOf(".");r>0&&o(i.slice(0,r));let a=i.toLowerCase(),s=i.replace(/\./g,"_");s!==i&&o(s),a.startsWith("py")&&(o("py"),o("python"),o("python3"),o("py3"),o("py2"),o("python2"),o("pypy3"),o("py_pypy3"),o("py_py3")),(a.startsWith("cc")||a.includes("cpp")||a==="c++"||a==="g++")&&(o("cc"),o("cpp"),o("c++"),o("g++"),o("cxx")),(a.startsWith("js")||a.includes("node"))&&(o("js"),o("javascript"),o("node"),o("nodejs")),a.startsWith("ts")&&(o("ts"),o("typescript")),a.startsWith("java")&&o("java"),a.startsWith("kt")&&(o("kt"),o("kotlin")),(a.startsWith("rs")||a.includes("rust"))&&(o("rs"),o("rust")),a.startsWith("go")&&(o("go"),o("golang")),(a.startsWith("cs")||a.includes("csharp"))&&(o("cs"),o("csharp"),o("c#"));for(let L of n){let H=Bc(e,L);if(H!=null)return H}for(let L of um){let H=Bc(e,L);if(H!=null)return H}let l=Object.entries(e).filter(([,L])=>L!=null&&String(L).trim()!=="");if(l.length===0)return;if(l.length===1||new Set(l.map(([,L])=>String(L))).size===1)return String(l[0][1]);let u=i.toLowerCase(),d=(v=(h=i.split(/[._]/)[0])==null?void 0:h.toLowerCase())!=null?v:u;l.sort((L,H)=>H[0].length-L[0].length);for(let[L,H]of l){let _=L.toLowerCase(),M=(k=(w=L.split(/[._]/)[0])==null?void 0:w.toLowerCase())!=null?k:_;if(_===u||u.startsWith(`${_}.`)||_.startsWith(`${u}.`)||d.length>=2&&M.length>=2&&(d===M||u.startsWith(`${M}.`)||_.startsWith(`${d}.`)))return String(H)}if(!l.some(([L])=>mm(L)))return l.sort((L,H)=>L[0].localeCompare(H[0])),String(l[0][1])}function fm(i){return i==null?!1:typeof i=="string"?i.trim()!=="":typeof i!="object"||Array.isArray(i)?!1:Object.values(i).some(t=>t!=null&&String(t).trim()!=="")}function Ir(i,t){let e=String(t.docId),n=`/p/${e}`,o=[[/\{\{\s*pid\s*\}\}/gi,t.pid],[/\{\{\s*title\s*\}\}/gi,t.title],[/\{\{\s*docId\s*\}\}/gi,e],[/\{\{\s*did\s*\}\}/gi,e],[/\{\{\s*id\s*\}\}/gi,t.pid],[/\{\{\s*input\s*\}\}/gi,t.sampleInput],[/\{\{\s*output\s*\}\}/gi,t.sampleOutput],[/\{\{\s*input1\s*\}\}/gi,t.sampleInput],[/\{\{\s*output1\s*\}\}/gi,t.sampleOutput],[/\{\{\s*sample_input\s*\}\}/gi,t.sampleInput],[/\{\{\s*sample_output\s*\}\}/gi,t.sampleOutput],[/\{\{\s*sampleInput\s*\}\}/gi,t.sampleInput],[/\{\{\s*sampleOutput\s*\}\}/gi,t.sampleOutput],[/\{\{\s*url\s*\}\}/gi,n],[/%pid%/gi,t.pid],[/%title%/gi,t.title],[/%docId%/gi,e],[/\$PID\$/gi,t.pid],[/\$TITLE\$/gi,t.title],[/\{pid\}/gi,t.pid],[/\{title\}/gi,t.title],[/\{docId\}/gi,e]],r=i;for(let[a,s]of o)r=r.replace(a,()=>s);return r}var si={0:"WAITING",1:"ACCEPTED",2:"WRONG_ANSWER",3:"TIME_LIMIT_EXCEEDED",4:"MEMORY_LIMIT_EXCEEDED",5:"OUTPUT_LIMIT_EXCEEDED",6:"RUNTIME_ERROR",7:"COMPILE_ERROR",8:"SYSTEM_ERROR",9:"CANCELED",10:"ETC",11:"HACKED",20:"JUDGING",21:"COMPILING",22:"FETCHED"},Co=new Set([1,2,3,4,5,6,7,8,9,10,11]),Nc=new Set([0,20,21,22]),li={ACCEPTED:"\u901A\u8FC7",WRONG_ANSWER:"\u7B54\u6848\u9519\u8BEF",TIME_LIMIT_EXCEEDED:"\u65F6\u95F4\u8D85\u9650",MEMORY_LIMIT_EXCEEDED:"\u5185\u5B58\u8D85\u9650",OUTPUT_LIMIT_EXCEEDED:"\u8F93\u51FA\u8D85\u9650",RUNTIME_ERROR:"\u8FD0\u884C\u9519\u8BEF",COMPILE_ERROR:"\u7F16\u8BD1\u9519\u8BEF",SYSTEM_ERROR:"\u7CFB\u7EDF\u9519\u8BEF",CANCELED:"\u5DF2\u53D6\u6D88",JUDGING:"\u8BC4\u6D4B\u4E2D\u2026",COMPILING:"\u7F16\u8BD1\u4E2D\u2026",WAITING:"\u7B49\u5F85\u4E2D\u2026",FETCHED:"\u6570\u636E\u83B7\u53D6\u4E2D\u2026",ETC:"\u672A\u77E5\u9519\u8BEF",HACKED:"\u88AB Hack"},ds={vs:{label:"Light",base:"vs",inherit:!0,rules:[],colors:{}},"vs-dark":{label:"Dark",base:"vs-dark",inherit:!0,rules:[],colors:{}},"hc-black":{label:"High Contrast",base:"hc-black",inherit:!0,rules:[],colors:{}},monokai:{label:"Monokai",base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"75715E",fontStyle:"italic"},{token:"string",foreground:"E6DB74"},{token:"keyword",foreground:"F92672"},{token:"number",foreground:"AE81FF"},{token:"type",foreground:"66D9EF",fontStyle:"italic"},{token:"function",foreground:"A6E22E"},{token:"variable",foreground:"F8F8F2"},{token:"constant",foreground:"AE81FF"},{token:"operator",foreground:"F92672"},{token:"tag",foreground:"F92672"},{token:"attribute.name",foreground:"A6E22E"},{token:"attribute.value",foreground:"E6DB74"},{token:"delimiter",foreground:"F8F8F2"}],colors:{"editor.background":"#272822","editor.foreground":"#F8F8F2","editorCursor.foreground":"#F8F8F0","editor.selectionBackground":"#49483E","editor.lineHighlightBackground":"#3E3D32","editorLineNumber.foreground":"#90908A","editorLineNumber.activeForeground":"#C2C2BF"}},"one-dark":{label:"One Dark",base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"5C6370",fontStyle:"italic"},{token:"string",foreground:"98C379"},{token:"keyword",foreground:"C678DD"},{token:"number",foreground:"D19A66"},{token:"type",foreground:"E5C07B"},{token:"function",foreground:"61AFEF"},{token:"variable",foreground:"E06C75"},{token:"constant",foreground:"D19A66"},{token:"operator",foreground:"56B6C2"},{token:"tag",foreground:"E06C75"},{token:"attribute.name",foreground:"D19A66"},{token:"attribute.value",foreground:"98C379"},{token:"delimiter",foreground:"ABB2BF"}],colors:{"editor.background":"#282C34","editor.foreground":"#ABB2BF","editorCursor.foreground":"#528BFF","editor.selectionBackground":"#3E4451","editor.lineHighlightBackground":"#2C313C","editorLineNumber.foreground":"#495162","editorLineNumber.activeForeground":"#ABB2BF"}},"github-dark":{label:"GitHub Dark",base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"8B949E",fontStyle:"italic"},{token:"string",foreground:"A5D6FF"},{token:"keyword",foreground:"FF7B72"},{token:"number",foreground:"79C0FF"},{token:"type",foreground:"FFA657"},{token:"function",foreground:"D2A8FF"},{token:"variable",foreground:"FFA657"},{token:"constant",foreground:"79C0FF"},{token:"operator",foreground:"FF7B72"},{token:"tag",foreground:"7EE787"},{token:"attribute.name",foreground:"79C0FF"},{token:"attribute.value",foreground:"A5D6FF"},{token:"delimiter",foreground:"C9D1D9"}],colors:{"editor.background":"#0D1117","editor.foreground":"#C9D1D9","editorCursor.foreground":"#58A6FF","editor.selectionBackground":"#264F78","editor.lineHighlightBackground":"#161B22","editorLineNumber.foreground":"#484F58","editorLineNumber.activeForeground":"#C9D1D9"}},dracula:{label:"Dracula",base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"6272A4",fontStyle:"italic"},{token:"string",foreground:"F1FA8C"},{token:"keyword",foreground:"FF79C6"},{token:"number",foreground:"BD93F9"},{token:"type",foreground:"8BE9FD",fontStyle:"italic"},{token:"function",foreground:"50FA7B"},{token:"variable",foreground:"F8F8F2"},{token:"constant",foreground:"BD93F9"},{token:"operator",foreground:"FF79C6"},{token:"tag",foreground:"FF79C6"},{token:"attribute.name",foreground:"50FA7B"},{token:"attribute.value",foreground:"F1FA8C"},{token:"delimiter",foreground:"F8F8F2"}],colors:{"editor.background":"#282A36","editor.foreground":"#F8F8F2","editorCursor.foreground":"#F8F8F0","editor.selectionBackground":"#44475A","editor.lineHighlightBackground":"#44475A75","editorLineNumber.foreground":"#6272A4","editorLineNumber.activeForeground":"#F8F8F2"}},nord:{label:"Nord",base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"616E88",fontStyle:"italic"},{token:"string",foreground:"A3BE8C"},{token:"keyword",foreground:"81A1C1"},{token:"number",foreground:"B48EAD"},{token:"type",foreground:"8FBCBB"},{token:"function",foreground:"88C0D0"},{token:"variable",foreground:"D8DEE9"},{token:"constant",foreground:"B48EAD"},{token:"operator",foreground:"81A1C1"},{token:"tag",foreground:"81A1C1"},{token:"attribute.name",foreground:"8FBCBB"},{token:"attribute.value",foreground:"A3BE8C"},{token:"delimiter",foreground:"ECEFF4"}],colors:{"editor.background":"#2E3440","editor.foreground":"#D8DEE9","editorCursor.foreground":"#D8DEE9","editor.selectionBackground":"#434C5E","editor.lineHighlightBackground":"#3B4252","editorLineNumber.foreground":"#4C566A","editorLineNumber.activeForeground":"#D8DEE9"}},"solarized-dark":{label:"Solarized Dark",base:"vs-dark",inherit:!0,rules:[{token:"comment",foreground:"586E75",fontStyle:"italic"},{token:"string",foreground:"2AA198"},{token:"keyword",foreground:"859900"},{token:"number",foreground:"D33682"},{token:"type",foreground:"B58900"},{token:"function",foreground:"268BD2"},{token:"variable",foreground:"839496"},{token:"constant",foreground:"CB4B16"},{token:"operator",foreground:"859900"},{token:"tag",foreground:"268BD2"},{token:"attribute.name",foreground:"93A1A1"},{token:"attribute.value",foreground:"2AA198"},{token:"delimiter",foreground:"839496"}],colors:{"editor.background":"#002B36","editor.foreground":"#839496","editorCursor.foreground":"#839496","editor.selectionBackground":"#073642","editor.lineHighlightBackground":"#073642","editorLineNumber.foreground":"#586E75","editorLineNumber.activeForeground":"#839496"}},"github-light":{label:"GitHub Light",base:"vs",inherit:!0,rules:[{token:"comment",foreground:"6A737D",fontStyle:"italic"},{token:"string",foreground:"032F62"},{token:"keyword",foreground:"D73A49"},{token:"number",foreground:"005CC5"},{token:"type",foreground:"E36209"},{token:"function",foreground:"6F42C1"},{token:"variable",foreground:"E36209"},{token:"constant",foreground:"005CC5"},{token:"operator",foreground:"D73A49"},{token:"tag",foreground:"22863A"},{token:"attribute.name",foreground:"005CC5"},{token:"attribute.value",foreground:"032F62"},{token:"delimiter",foreground:"24292E"}],colors:{"editor.background":"#FFFFFF","editor.foreground":"#24292E","editorCursor.foreground":"#044289","editor.selectionBackground":"#C8C8FA","editor.lineHighlightBackground":"#F6F8FA","editorLineNumber.foreground":"#BABBBD","editorLineNumber.activeForeground":"#24292E"}},"solarized-light":{label:"Solarized Light",base:"vs",inherit:!0,rules:[{token:"comment",foreground:"93A1A1",fontStyle:"italic"},{token:"string",foreground:"2AA198"},{token:"keyword",foreground:"859900"},{token:"number",foreground:"D33682"},{token:"type",foreground:"B58900"},{token:"function",foreground:"268BD2"},{token:"variable",foreground:"657B83"},{token:"constant",foreground:"CB4B16"},{token:"operator",foreground:"859900"},{token:"tag",foreground:"268BD2"},{token:"attribute.name",foreground:"657B83"},{token:"attribute.value",foreground:"2AA198"},{token:"delimiter",foreground:"657B83"}],colors:{"editor.background":"#FDF6E3","editor.foreground":"#657B83","editorCursor.foreground":"#657B83","editor.selectionBackground":"#EEE8D5","editor.lineHighlightBackground":"#EEE8D5","editorLineNumber.foreground":"#93A1A1","editorLineNumber.activeForeground":"#657B83"}}};function hm(){return typeof UiContext<"u"&&UiContext.ws_prefix?UiContext.ws_prefix:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/`}var Fc=1e4;async function Rc(i,t,e){let n,o=new Error(`${e}\u8D85\u65F6\uFF08${Math.round(t/1e3)}s\uFF09\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u7A0D\u540E\u91CD\u8BD5`),r=new Promise((a,s)=>{n=setTimeout(()=>s(o),t)});try{return await Promise.race([i,r])}finally{n&&clearTimeout(n)}}function Ln(i,t,e){e&&Object.keys(e).length?console.error(`[problem_ide] ${i}`,e,t):console.error(`[problem_ide] ${i}`,t),t instanceof Error&&t.stack&&console.error(t.stack)}function qc(i){var t;if(i instanceof Error)return(t=i.stack)!=null?t:`${i.name}: ${i.message}`;if(typeof i=="object"&&i!==null)try{return JSON.stringify(i,null,2)}catch(e){return String(i)}return String(i)}function gm(){return new Promise((i,t)=>{let e=window;if(e.monaco){i(e.monaco);return}let n=["https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs","https://cdn.bootcdn.net/ajax/libs/monaco-editor/0.53.0/min/vs"],o=0,r=()=>{let a=n[o],s=document.createElement("script");s.src=`${a}/loader.js`,s.onload=()=>{try{e.require.config({paths:{vs:a}}),e.require(["vs/editor/editor.main"],()=>{e.monaco?i(e.monaco):t(new Error("Monaco not defined"))})}catch(l){t(l)}},s.onerror=()=>{o++,oWc(i,o);(0,vt.$)(document).on("click",".problem-ide-left .section__tab-header-item",o=>{o.preventDefault();let r=(0,vt.$)(o.currentTarget).attr("data-type");r&&(t(r),r==="myNote"&&window.dispatchEvent(new CustomEvent("pd-problem-note:tab-shown")))});let e=i.find(".section__tab-header-item.tab--active").first();if(e.length||(e=i.find(".section__tab-header-item").first()),e.length){let o=e.attr("data-type");o&&t(o)}let n=()=>{window.location.hash.replace(/^#/,"")!=="myNote"||!i.find('.section__tab-header-item[data-type="myNote"]').length||(t("myNote"),window.dispatchEvent(new CustomEvent("pd-problem-note:tab-shown")))};n(),window.addEventListener("hashchange",n)}function km(i,t,e){let n=0,o=0,r=t.parentElement,a=c=>{let u=c.clientX-n,d=r.getBoundingClientRect().width,h=Math.max(280,Math.min(d*.65,o+u));t.style.flex=`0 0 ${h/d*100}%`,localStorage.setItem(Dc,String(h/d*100)),e()},s=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s),i.classList.remove("dragging"),document.body.style.cursor="",document.body.style.userSelect=""};i.addEventListener("mousedown",c=>{c.preventDefault(),n=c.clientX,o=t.getBoundingClientRect().width,i.classList.add("dragging"),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",a),document.addEventListener("mouseup",s)});let l=localStorage.getItem(Dc);if(l){let c=parseFloat(l);c>=20&&c<=70&&(t.style.flex=`0 0 ${c}%`)}}function Tm(i){try{if(/%[0-9A-Fa-f]{2}/.test(i))return decodeURIComponent(i)}catch(t){}return i}function ps(i){let t=Tm(i.trim());if(!t)return i.trim();let n=t.replace(/^\.\/+/,"").split("/").filter(Boolean);return n.length===0?t:n[n.length-1]}function Cm(i){let t=UiContext.problemNumId,e=t!=null?String(t):UiContext.problemId!=null&&/^\d+$/.test(String(UiContext.problemId))?String(UiContext.problemId):"";if(!e)return;let n=(a,s)=>{let l=a.getAttribute(s);if(!l||!l.startsWith("file://"))return;let c=l.slice(7);if(c.startsWith("/"))return;let u=c.split("?")[0],d=ps(u),h=encodeURIComponent(d),v=new URLSearchParams;if(c.includes("?")){let w=c.slice(c.indexOf("?")+1);new URLSearchParams(w).forEach((k,L)=>{v.set(L,k)})}v.has("type")||v.set("type","additional_file"),a.setAttribute(s,`/p/${e}/file/${h}?${v.toString()}`)},o=(a,s)=>{let l=a.getAttribute(s);if(!l||l.startsWith("/")||l.startsWith("http://")||l.startsWith("https://")||l.startsWith("data:")||l.startsWith("file:"))return;let c=l.match(/^(?:\.\/)?(?:p\/)?(\d+)\/file\/([^?]+)(\?[\s\S]*)?$/i);if(!c)return;let u=c[1],d=c[2],h=c[3]||"",v=ps(d);a.setAttribute(s,`/p/${u}/file/${encodeURIComponent(v)}${h}`)},r=(a,s)=>{let l=a.getAttribute(s);if(!l||!l.startsWith("/p/"))return;let c=l.includes("?")?l.slice(l.indexOf("?")):"",d=l.split("?")[0].match(/^\/p\/(\d+)\/file\/(.+)$/);if(!d)return;let h=d[2],v;try{v=decodeURIComponent(h)}catch(k){return}if(!v.includes("/")&&!v.startsWith("."))return;let w=ps(v);w!==v&&a.setAttribute(s,`/p/${d[1]}/file/${encodeURIComponent(w)}${c}`)};i.querySelectorAll("img[src], source[src], a[href]").forEach(a=>{let s=a.tagName==="A"?"href":"src";n(a,s),o(a,s),r(a,s)})}function Eo(){let i=new Set,t=e=>{e instanceof HTMLElement&&i.add(e)};t(document.getElementById("problemIdeRoot")),t(document.querySelector(".scratchpad__problem")),document.querySelectorAll(".problem-content").forEach(e=>t(e)),i.size===0&&t(document.body),i.forEach(e=>Cm(e))}function Oc(i){return i.replace(/\r\n/g,`
`).replace(/\n$/,"")}function us(i){let t=[],e=i.querySelectorAll("pre code");e.length?e.forEach(o=>{var r;t.push(Oc((r=o.textContent)!=null?r:""))}):i.querySelectorAll("pre").forEach(o=>{var r;o.querySelector("pre")||t.push(Oc((r=o.textContent)!=null?r:""))});let n=[];for(let o=0;o+1{var el,tl,nl,il,ol,rl,al,sl,ll,cl;let i=document.getElementById("problemIdePageLoader"),t=document.getElementById("problemIdeRoot"),e=()=>{t&&(t.classList.remove("problem-ide-root--boot"),t.classList.add("problem-ide-root--ready")),i&&(i.classList.add("problem-ide-page-loader--hidden"),i.setAttribute("aria-busy","false"),window.setTimeout(()=>i.remove(),400))},n=document.getElementById("problemIdeLang"),o=document.getElementById("problemIdeMonaco"),r=document.getElementById("problemIdeRunBtn"),a=document.getElementById("problemIdeSubmitBtn"),s=document.getElementById("problemIdeInput"),l=document.getElementById("problemIdeExpected"),c=document.getElementById("problemIdeOutput"),u=document.getElementById("problemIdeStatus"),d=document.getElementById("problemIdeSubmitResultAiBtn"),h=document.getElementById("problemIdeSettingsBtn"),v=document.getElementById("problemIdeSettingsPanel"),w=document.getElementById("problemIdeFontSize"),k=document.getElementById("problemIdeThemeSelect"),L=document.getElementById("problemIdeDrawer"),H=document.getElementById("problemIdeDrawerToggle"),_=document.getElementById("problemIdeDrawerResize"),M=document.getElementById("problemIdeHistory"),A=document.getElementById("problemIdeLeft"),D=document.getElementById("problemIdeGutter");if(!n||!o||!r||!a||!s||!c){e();return}let $=window.__problemIdeLangRange;if(!$||typeof $!="object"||!Object.keys($).length){e();return}wm((0,vt.$)(".problem-ide-left")),Eo(),window.setTimeout(Eo,0),window.setTimeout(Eo,120),window.setTimeout(Eo,600);let q=null,K=new MutationObserver(()=>{q!=null&&window.clearTimeout(q),q=window.setTimeout(()=>{Eo(),q=null},80)});K.observe(document.body,{childList:!0,subtree:!0}),window.setTimeout(()=>K.disconnect(),1e4);let ee=Object.keys($);n.innerHTML="";for(let b of ee){let y=document.createElement("option");y.value=b,y.textContent=$[b]||b,n.appendChild(y)}let R=UiContext.problemId||UiContext.problemNumId||"",N=b=>`problem_ide_code_${R}_${b}`,Y=`problem_ide_lang_${R}`,te=`problem_ide_input_${R}`,ve=`problem_ide_expected_${R}`,ne=`problem_ide_cases_${R}`,pe=5,G=ms(),Ee=(G?us(G):[])[0],Je={pid:String((tl=(el=UiContext.problemId)!=null?el:UiContext.problemNumId)!=null?tl:R),title:typeof((nl=UiContext.pdoc)==null?void 0:nl.title)=="string"?UiContext.pdoc.title:"",docId:(rl=(ol=UiContext.problemNumId)!=null?ol:(il=UiContext.pdoc)==null?void 0:il.docId)!=null?rl:"",sampleInput:(al=Ee==null?void 0:Ee.input)!=null?al:"",sampleOutput:(sl=Ee==null?void 0:Ee.expected)!=null?sl:""},J=window.__problemIdeConfig||((ll=UiContext.pdoc)==null?void 0:ll.config)||{},U=null,Se=J.ai_analysis_quota;Se!=null&&Se.limited&&(U={limited:!0,remaining:Number(Se.remaining)||0,dailyLimit:En(Se.dailyLimit)});let je=()=>{window.__problemIdeConfig||(window.__problemIdeConfig={}),window.__problemIdeConfig.ai_analysis_quota=U?{...U}:null},ke=b=>{var y;(y=b==null?void 0:b.aiQuota)!=null&&y.limited&&(U={limited:!0,remaining:Number(b.aiQuota.remaining)||0,dailyLimit:En(b.aiQuota.dailyLimit)},je())},Me=b=>{let y=b==null?void 0:b.querySelector("#aiAnalysisQuotaBar");if(!y)return;if(!(U!=null&&U.limited)){y.hidden=!0,y.innerHTML="";return}y.hidden=!1;let S=U.remaining,I=U.dailyLimit,B=Pi(I);y.innerHTML=`\u4ECA\u65E5 AI\uFF1A${S} / ${I} \u6B21${B}
`},rt=Array.isArray(J.user_extra_files)?J.user_extra_files:[],$e=rt.some(b=>/^compile\.sh$/i.test(b)),It=$e?cm(rt):{};function _t(b){if(!$e)return null;let y=dm(b,It);if(!y)return null;let S=pm(y);return S==null?null:Ir(S,Je)}let vn=localStorage.getItem(Y),Tt=vn&&ee.includes(vn)?vn:UiContext.codeLang&&ee.includes(UiContext.codeLang)?UiContext.codeLang:ee[0];n.value=Tt;let pt;try{pt=await gm()}catch(b){Ln("Monaco \u52A0\u8F7D\u5931\u8D25",b),e();return}let nn=b=>{let y=b.toLowerCase();return y.includes("python")||y.startsWith("py")?"python":y.startsWith("java")&&!y.includes("script")?"java":y.includes("node")||y.includes("javascript")||y.startsWith("js")?"javascript":y.includes("typescript")||y.startsWith("ts")?"typescript":y.startsWith("go")||y==="golang"?"go":y.includes("rust")?"rust":y.includes("c#")||y.includes("csharp")?"csharp":"cpp"},on=localStorage.getItem(N(Tt)),Bn="";if(on==null&&UiContext.codeTemplate&&!$e){let b=cs(Tt,UiContext.codeTemplate);b!=null&&(Bn=Ir(b,Je))}let eo=on==null&&$e&&(cl=_t(Tt))!=null?cl:"",_i=on!=null?on:$e?eo:Bn,me=[];try{let b=localStorage.getItem(ne);b&&(me=JSON.parse(b))}catch(b){}me.length||(me=[{input:localStorage.getItem(te)||"",expected:localStorage.getItem(ve)||""}]);let Nn=`problem_ide_samples_autofill_v1_${R}`,to=me.some(b=>b.input.trim()||b.expected.trim());if(!localStorage.getItem(Nn)&&!to){let b=ms(),y=(b?us(b):[]).filter(S=>S.input.trim().length>0||S.expected.trim().length>0);y.length&&(me=y.slice(0,pe)),localStorage.setItem(Nn,"1")}let mt=0,Ct=()=>{me[mt]={input:s.value,expected:(l==null?void 0:l.value)||""},localStorage.setItem(ne,JSON.stringify(me))},Sn=document.getElementById("problemIdeCaseTabs"),rn=document.getElementById("problemIdeCaseAdd"),jn=document.getElementById("problemIdeCaseFillSamples"),Ht=()=>{Sn&&(Sn.innerHTML="",me.forEach((b,y)=>{let S=document.createElement("button");if(S.type="button",S.className=`problem-ide-case-tab${y===mt?" problem-ide-case-tab--active":""}`,S.textContent=`\u7528\u4F8B ${y+1}`,me.length>1){let I=document.createElement("span");I.className="problem-ide-case-del",I.textContent="\xD7",I.addEventListener("click",B=>{B.stopPropagation(),Si(y)}),S.appendChild(I)}S.addEventListener("click",()=>Mi(y)),Sn.appendChild(S)}),rn&&(rn.style.display=me.length>=pe?"none":""))},Mi=b=>{Ct(),mt=b,s.value=me[b].input,l&&(l.value=me[b].expected),Ht()},Fn=()=>{me.length>=pe||(Ct(),me.push({input:"",expected:""}),mt=me.length-1,s.value="",l&&(l.value=""),Ht(),Ct())},Si=b=>{me.length<=1||(Ct(),me.splice(b,1),mt>=me.length?mt=me.length-1:mt>b&&mt--,s.value=me[mt].input,l&&(l.value=me[mt].expected),Ht(),Ct())},pi=()=>{Ct();let b=ms(),y=(b?us(b):[]).filter(I=>I.input.trim().length>0||I.expected.trim().length>0);if(!y.length){window.alert("\u672A\u4ECE\u9898\u9762\u8BC6\u522B\u5230\u6837\u4F8B\uFF08\u9700 ``` \u4EE3\u7801\u5757\uFF0C\u4E14\u6309\u8F93\u5165/\u8F93\u51FA\u4EA4\u66FF\u6392\u5217\uFF09\u3002");return}let S=Math.min(y.length,pe);for(;me.length=me.length&&(mt=me.length-1),s.value=me[mt].input,l&&(l.value=me[mt].expected),Ht(),Ct()};Ht(),s.value=me[0].input,l&&(l.value=me[0].expected),rn&&rn.addEventListener("click",Fn),jn&&jn.addEventListener("click",pi);let no=b=>{Ct();let y=me.length>=pe,S;y?(S=pe-1,me[S]={input:b.input,expected:b.expected}):(me.push({input:b.input,expected:b.expected}),S=me.length-1),mt=S,s.value=me[S].input,l&&(l.value=me[S].expected),Ht(),Ct(),vt.Notification.success(y?`\u5DF2\u8986\u76D6\u7B2C ${pe} \u7EC4\u81EA\u6D4B\u7528\u4F8B`:`\u5DF2\u65B0\u589E\u7B2C ${S+1} \u7EC4\u81EA\u6D4B\u7528\u4F8B`)};c.addEventListener("click",b=>{var X;let S=b.target.closest(".result-case-preview-btn");if(!S||!c.contains(S))return;b.preventDefault();let I=S.getAttribute("data-fid"),B=S.getAttribute("data-rid")||"",Q=I?parseInt(I,10):NaN;if(!B||!Number.isFinite(Q))return;let z=((X=UiContext.getRecordDetailUrl)==null?void 0:X.replace("%7Brid%7D",B).replace("{rid}",B))||`/record/${B}`;Ar(Q,z,{onAddToSelfTest:no})});let ui=localStorage.getItem(Hc),mi=ui?Math.min(28,Math.max(10,parseInt(ui,10)||14)):14;w&&(w.value=String(mi));for(let[b,y]of Object.entries(ds))(y.rules.length||Object.keys(y.colors).length)&&pt.editor.defineTheme(b,{base:y.base,inherit:y.inherit,rules:y.rules,colors:y.colors});let ji=Object.keys(ds);if(k){k.innerHTML="";for(let[b,y]of Object.entries(ds)){let S=document.createElement("option");S.value=b,S.textContent=y.label,k.appendChild(S)}}let Re=localStorage.getItem(Pc)||"";Re==="1"?Re="vs-dark":(Re==="0"||!ji.includes(Re))&&(Re="vs");let Xn=Re;k&&(k.value=Xn);let Be;try{let b=pt.editor.createModel(_i,nn(Tt));Be=pt.editor.create(o,{model:b,theme:Xn,fontSize:mi,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},lineNumbersMinChars:3,renderLineHighlight:"line"})}catch(b){Ln("\u7F16\u8F91\u5668\u521D\u59CB\u5316\u5931\u8D25",b),e();return}if(A&&D&&km(D,A,()=>Be.layout()),L&&_){let b=0,y=0,S=Q=>{let z=b-Q.clientY,X=window.innerHeight*.6,Z=Math.max(80,Math.min(X,y+z));L.style.height=`${Z}px`,localStorage.setItem($c,String(Z)),Be.layout()},I=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",I),_.classList.remove("dragging"),L.classList.remove("problem-ide-drawer--resizing"),document.body.style.cursor="",document.body.style.userSelect=""};_.addEventListener("mousedown",Q=>{L.classList.contains("problem-ide-drawer--collapsed")||(Q.preventDefault(),b=Q.clientY,y=L.getBoundingClientRect().height,_.classList.add("dragging"),L.classList.add("problem-ide-drawer--resizing"),document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",S),document.addEventListener("mouseup",I))});let B=localStorage.getItem($c);if(B){let Q=parseInt(B,10);Q>=80&&Q<=600&&(L.style.height=`${Q}px`)}}Be.layout(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Be.layout(),e()})});let Bt=document.getElementById("problemIdeModeTag"),cn=document.getElementById("problemIdeResetCodeBtn"),Nt=(typeof J.checker_type=="string"?J.checker_type:"")==="testlib";Bt&&(Bt.style.display="",$e?(Bt.textContent="\u6838\u5FC3\u4EE3\u7801\u6A21\u5F0F",Bt.className="problem-ide-mode-tag problem-ide-mode-tag--core"):(Bt.textContent="ACM \u6A21\u5F0F",Bt.className="problem-ide-mode-tag problem-ide-mode-tag--acm"));let Rn=document.getElementById("problemIdeSpjTag");Rn&&(Nt?(Rn.style.display="",Rn.textContent="Special Judge",Rn.className="problem-ide-mode-tag problem-ide-mode-tag--spj"):Rn.style.display="none");let io=UiContext.codeTemplate,m=!$e&&fm(io);cn&&($e||m)&&(cn.style.display="",cn.title=$e?"\u91CD\u7F6E\u4E3A\u9898\u76EE\u521D\u59CB\u4EE3\u7801\u6A21\u677F":"\u91CD\u7F6E\u4E3A\u4E2A\u4EBA\u4EE3\u7801\u6A21\u677F");let f=b=>`problem_ide_core_init_${R}_${b}`;function T(b,y=!1){if(!$e)return;let S=localStorage.getItem(N(b)),I=S!=null&&S.trim()!=="";if(!y&&I&&localStorage.getItem(f(b)))return;let B=_t(b);if(B==null)return;let Q=Be.getModel();Be.setModel(pt.editor.createModel(B,nn(b))),Q==null||Q.dispose(),localStorage.setItem(N(b),B),localStorage.setItem(f(b),"1")}function j(){if(!$e)return;let b=n.value;if(!window.confirm("\u786E\u5B9A\u8981\u5C06\u4EE3\u7801\u91CD\u7F6E\u4E3A\u521D\u59CB\u6A21\u677F\u5417\uFF1F\u5F53\u524D\u4EE3\u7801\u5C06\u88AB\u8986\u76D6\u3002"))return;let y=_t(b);if(y==null){window.alert("\u672A\u627E\u5230\u8BE5\u8BED\u8A00\u7684\u521D\u59CB\u4EE3\u7801\u6A21\u677F\uFF08\u53EF\u80FD\u8BE5\u8BED\u8A00\u672A\u914D\u7F6E user.* \u6587\u4EF6\uFF09\u3002");return}let S=Be.getModel();Be.setModel(pt.editor.createModel(y,nn(b))),S==null||S.dispose(),localStorage.setItem(N(b),y)}function F(){if($e)return;let b=n.value,y=cs(b,UiContext.codeTemplate);if(y==null||!String(y).trim()){window.alert("\u5F53\u524D\u8BED\u8A00\u672A\u8BBE\u7F6E\u4E2A\u4EBA\u4EE3\u7801\u6A21\u677F\u3002");return}if(!window.confirm("\u786E\u5B9A\u8981\u5C06\u4EE3\u7801\u91CD\u7F6E\u4E3A\u504F\u597D\u8BBE\u7F6E\u4E2D\u7684\u4EE3\u7801\u6A21\u677F\u5417\uFF1F\u5F53\u524D\u4EE3\u7801\u5C06\u88AB\u8986\u76D6\u3002"))return;let S=Ir(String(y),Je),I=Be.getModel();Be.setModel(pt.editor.createModel(S,nn(b))),I==null||I.dispose(),localStorage.setItem(N(b),S)}cn&&cn.addEventListener("click",()=>{$e?j():F()});let W=b=>{var Q;localStorage.setItem(N(n.dataset.currentLang||Tt),Be.getValue());let y=localStorage.getItem(N(b));(y==null||y.trim()==="")&&$e&&(y=(Q=_t(b))!=null?Q:"",y&&(localStorage.setItem(N(b),y),localStorage.setItem(f(b),"1")));let S=$e?void 0:cs(b,UiContext.codeTemplate),I=S!=null&&String(S).trim()!==""?Ir(S,Je):"";y=y!=null?y:I;let B=Be.getModel();Be.setModel(pt.editor.createModel(y,nn(b))),B==null||B.dispose(),n.dataset.currentLang=b,localStorage.setItem(Y,b)};n.dataset.currentLang=Tt,n.addEventListener("change",()=>W(n.value)),T(Tt);let g=(b,y)=>{let S=n.dataset.currentLang||n.value||Tt,I=ee.includes(b)?b:S;if(S===I){let B=Be.getModel();Be.setModel(pt.editor.createModel(y,nn(I))),B==null||B.dispose(),n.value=I,n.dataset.currentLang=I,localStorage.setItem(Y,I),localStorage.setItem(N(I),y),Be.focus();return}localStorage.setItem(N(I),y),n.value=I,W(I),Be.focus()},x=null;Be.onDidChangeModelContent(()=>{x&&clearTimeout(x),x=setTimeout(()=>{localStorage.setItem(N(n.value),Be.getValue())},500)}),s.addEventListener("input",()=>Ct()),l&&l.addEventListener("input",()=>Ct());let E=document.getElementById("problemIdeTimerWrap"),C=document.getElementById("problemIdeTimerPanel"),P=document.getElementById("problemIdeTimerDisplay"),O=document.getElementById("problemIdeTimerStartPauseBtn"),ie=document.getElementById("problemIdeTimerResetBtn"),oe=document.getElementById("problemIdeTimerModeSegStop"),ye=document.getElementById("problemIdeTimerModeSegCd"),Ge=document.getElementById("problemIdeTimerCountdownSection"),We=document.getElementById("problemIdeTimerCountdownFields"),st=document.getElementById("problemIdeTimerHours"),lt=document.getElementById("problemIdeTimerMinutes"),Ft=document.getElementById("problemIdeTimerApplyDurationBtn"),Mt=()=>{v==null||v.classList.add("problem-ide-settings--hidden"),C==null||C.classList.add("problem-ide-settings--hidden"),P instanceof HTMLButtonElement&&P.setAttribute("aria-expanded","false")};if(h&&v&&(v.classList.add("problem-ide-settings--hidden"),h.addEventListener("click",b=>{b.stopPropagation(),C==null||C.classList.add("problem-ide-settings--hidden"),v.classList.toggle("problem-ide-settings--hidden")}),v.addEventListener("click",b=>b.stopPropagation())),document.addEventListener("click",Mt),E&&C&&P instanceof HTMLButtonElement&&O&&ie&&oe&&ye&&Ge&&We&&st&<&&Ft){let b=P;C.classList.add("problem-ide-settings--hidden"),b.addEventListener("click",ue=>{ue.stopPropagation(),v==null||v.classList.add("problem-ide-settings--hidden"),C.classList.toggle("problem-ide-settings--hidden");let Fe=!C.classList.contains("problem-ide-settings--hidden");b.setAttribute("aria-expanded",Fe?"true":"false")}),C.addEventListener("click",ue=>ue.stopPropagation());let y="problem_ide_timer_state_v1",S=`problem_ide_timer_prefs_${R}`,I=ue=>ue<10?`0${ue}`:String(ue),B=ue=>{let Fe=Math.max(0,Math.floor(ue)),we=Math.floor(Fe/3600),Cn=Math.floor(Fe%3600/60),Kt=Fe%60;return`${we}:${I(Cn)}:${I(Kt)}`},Q=(ue,Fe,we)=>Math.min(we,Math.max(Fe,ue)),z="stopwatch",X=30*60,Z=X,Ye=0,le=null,se=null,Te=null,be=null,He=()=>{try{let ue=Q(parseInt(st.value,10)||0,0,10),Fe=Q(parseInt(lt.value,10)||0,0,59);ue===10&&(Fe=Math.min(Fe,59));let we={v:1,mode:z,hours:ue,minutes:Fe,countdownConfiguredSec:X,countdownRemainingSec:Z,stopwatchAccumMs:Ye,stopwatchRunStart:le,countdownDeadline:se};localStorage.setItem(y,JSON.stringify(we))}catch(ue){}},ct=()=>{be!=null&&window.clearTimeout(be),be=window.setTimeout(()=>{be=null,He()},400)},Ve=()=>{be!=null&&(window.clearTimeout(be),be=null),He()},Rt=()=>{let ue=(Fe,we)=>{let Cn=Q(Math.floor(Fe),0,10),Kt=Q(Math.floor(we),0,59);Cn===10&&(Kt=Math.min(Kt,59)),st.value=String(Cn),lt.value=String(Kt),X=Math.max(1,Cn*3600+Kt*60)};try{let Fe=localStorage.getItem(y);if(Fe){let we=JSON.parse(Fe);(we.mode==="stopwatch"||we.mode==="countdown")&&(z=we.mode);let Cn=Q(Math.floor(Number(we.hours)||0),0,10),Kt=Q(Math.floor(Number(we.minutes)||0),0,59);Cn===10&&(Kt=Math.min(Kt,59)),ue(Cn,Kt),typeof we.countdownConfiguredSec=="number"&&Number.isFinite(we.countdownConfiguredSec)&&(X=Math.max(1,Math.floor(we.countdownConfiguredSec))),typeof we.countdownRemainingSec=="number"&&Number.isFinite(we.countdownRemainingSec)&&(Z=Math.max(0,Math.floor(we.countdownRemainingSec))),typeof we.stopwatchAccumMs=="number"&&Number.isFinite(we.stopwatchAccumMs)&&(Ye=Math.max(0,Math.floor(we.stopwatchAccumMs))),le=typeof we.stopwatchRunStart=="number"&&Number.isFinite(we.stopwatchRunStart)?we.stopwatchRunStart:null,z==="countdown"&&typeof we.countdownDeadline=="number"&&Number.isFinite(we.countdownDeadline)?Date.now()>=we.countdownDeadline?(Z=0,se=null):se=we.countdownDeadline:se=null,z==="stopwatch"&&(se=null),z==="countdown"&&(le=null);return}}catch(Fe){}try{let Fe=localStorage.getItem(S);if(!Fe)return;let we=JSON.parse(Fe);(we.mode==="stopwatch"||we.mode==="countdown")&&(z=we.mode);let Cn=Q(Math.floor(Number(we.hours)||0),0,10),Kt=Q(Math.floor(Number(we.minutes)||0),0,59);Cn===10&&(Kt=Math.min(Kt,59)),ue(Cn,Kt),z==="countdown"&&(Z=X),He()}catch(Fe){}},qt=()=>{Ge.hidden=z!=="countdown"},Vt=()=>{let ue=z==="stopwatch";oe==null||oe.classList.toggle("problem-ide-timer-panel__segment--active",ue),ye==null||ye.classList.toggle("problem-ide-timer-panel__segment--active",!ue),oe==null||oe.setAttribute("aria-selected",ue?"true":"false"),ye==null||ye.setAttribute("aria-selected",ue?"false":"true")},Jt=ue=>{if(z===ue)return;ut(),z=ue,Ye=0,le=null;let Fe=Q(parseInt(st.value,10)||0,0,10),we=Q(parseInt(lt.value,10)||0,0,59);Fe===10&&(we=Math.min(we,59)),X=Math.max(1,Fe*3600+we*60),Z=X,se=null,qt(),Vt(),He(),Pn()},ht=()=>{Te!=null&&(clearInterval(Te),Te=null)},un=()=>{le!=null&&(Ye+=Date.now()-le,le=null)},mn=()=>{se!=null&&(Z=Math.max(0,Math.ceil((se-Date.now())/1e3)),se=null)},ut=()=>{un(),mn(),ht()},Pe=()=>{let ue=le!=null?Date.now()-le:0;return Math.floor((Ye+ue)/1e3)},at=()=>se!=null?Math.max(0,Math.ceil((se-Date.now())/1e3)):Z,dt=()=>le!=null||se!=null,Jo=0,Pn=()=>{let ue=0;z==="stopwatch"?ue=Pe():ue=at();let Fe=B(ue);b.textContent=Fe;let we=z==="stopwatch"?"\u6B63\u8BA1\u65F6":"\u5012\u8BA1\u65F6";b.title=`${we} ${Fe} \u2014 \u70B9\u51FB\u6253\u5F00\u8BBE\u7F6E`,b.setAttribute("aria-label",`${we}\uFF0C${Fe}`),b.classList.remove("problem-ide-timer__display--low","problem-ide-timer__display--done"),z==="countdown"&&(ue<=0&&!dt()?b.classList.add("problem-ide-timer__display--done"):ue>0&&ue<=60&&b.classList.add("problem-ide-timer__display--low")),O.textContent=dt()?"\u6682\u505C":"\u5F00\u59CB"},Wd=()=>{if(z==="countdown"&&se!=null&&Math.ceil((se-Date.now())/1e3)<=0){Z=0,se=null,ht(),Pn(),He();return}Pn(),dt()&&Date.now()-Jo>=900&&(Jo=Date.now(),He())},ja=()=>{Te==null&&(Te=setInterval(Wd,250))};O.addEventListener("click",()=>{let ue=!1;if(z==="stopwatch")le!=null?(un(),ht()):(le=Date.now(),ja(),ue=!0);else{if(Z<=0){window.alert("\u5012\u8BA1\u65F6\u5DF2\u7ED3\u675F\uFF0C\u8BF7\u5148\u91CD\u7F6E\u6216\u5E94\u7528\u65F6\u957F\u3002");return}se!=null?(mn(),ht()):(se=Date.now()+Z*1e3,ja(),ue=!0)}Pn(),He(),ue&&(C.classList.add("problem-ide-settings--hidden"),b.setAttribute("aria-expanded","false"))}),ie.addEventListener("click",()=>{ut(),z==="stopwatch"?(Ye=0,le=null):(Z=X,se=null),Pn(),He()}),oe==null||oe.addEventListener("click",ue=>{ue.stopPropagation(),Jt("stopwatch")}),ye==null||ye.addEventListener("click",ue=>{ue.stopPropagation(),Jt("countdown")});let dl=()=>{let ue=Q(parseInt(st.value,10)||0,0,10),Fe=Q(parseInt(lt.value,10)||0,0,59);ue===10&&(Fe=Math.min(Fe,59)),st.value=String(ue),lt.value=String(Fe);let we=ue*3600+Fe*60;return Math.max(0,we)};Ft.addEventListener("click",()=>{let ue=dl();if(ue<=0){window.alert("\u8BF7\u8BBE\u7F6E\u5927\u4E8E 0 \u7684\u65F6\u957F\uFF08\u6700\u957F 10 \u5C0F\u65F6 59 \u5206\u949F\uFF09\u3002");return}ut(),z="countdown",X=ue,Z=ue,se=null,Vt(),qt(),He(),Pn()}),[st,lt].forEach(ue=>{ue.addEventListener("change",()=>{dl(),ct()})}),Rt(),Vt(),qt(),dt()&&ja(),Pn(),window.addEventListener("pagehide",Ve),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ve()})}w&&w.addEventListener("change",()=>{let b=Math.min(28,Math.max(10,parseInt(w.value,10)||14));Be.updateOptions({fontSize:b}),localStorage.setItem(Hc,String(b))}),k&&k.addEventListener("change",()=>{let b=k.value;pt.editor.setTheme(b),localStorage.setItem(Pc,b)}),L&&H&&H.addEventListener("click",()=>{L.classList.toggle("problem-ide-drawer--collapsed"),Be.layout()});let dn=!1,An=!1,an=null,Ut=(b,y)=>{var S;document.querySelectorAll(".problem-ide-tab").forEach(I=>I.classList.remove("problem-ide-tab--active")),(S=document.querySelector(`.problem-ide-tab[data-tab="${b}"]`))==null||S.classList.add("problem-ide-tab--active"),document.querySelectorAll(".problem-ide-panel").forEach(I=>{I.hidden=I.dataset.panel!==b}),b==="result"&&!An&&!(y!=null&&y.skipLatestSubmitHydrate)&&(dn?An=!0:an&&(An=!0,an()))};document.querySelectorAll(".problem-ide-tab").forEach(b=>{b.addEventListener("click",()=>{let y=b.dataset.tab;y&&(Ut(y),y==="history"&&Ys())})});let yn=null,Ne=()=>{d&&(d.hidden=!0),yn=null},Oe=b=>{var S;if(!d||!(b!=null&&b._id)){Ne();return}let y=typeof b.status=="number"&&Number.isFinite(b.status)?b.status:parseInt(String((S=b.status)!=null?S:""),10);if(!Number.isNaN(y)&&y===1){Ne();return}yn={rid:String(b._id),rdoc:b},d.hidden=!1},_e=(b,y)=>{u&&(u.textContent=b,u.className=`problem-ide-status problem-ide-status--${y}`)},xn=(b,y,S)=>{b.disabled=y,b.textContent=y?"...":S},nt=UiContext.ideShortCooldown?2:5,xt=b=>b<=0?nt:nt+(b-1)*1,qe=null,Et=!1,In=!1,wn=b=>{let y=null,S=null,I=3e3,B=()=>{y&&(clearTimeout(y),y=null)},Q=le=>{S&&(le.removeEventListener("transitionend",S),S=null)},z=le=>{Q(le),le.classList.remove("problem-ide-cooldown-toast--visible","problem-ide-cooldown-toast--hiding"),le.setAttribute("aria-hidden","true")},X=le=>{Q(le);let se=Te=>{Te.target!==le||Te.propertyName!=="opacity"||z(le)};S=se,le.addEventListener("transitionend",se),le.classList.add("problem-ide-cooldown-toast--hiding")},Z=(le,se)=>{B(),y=setTimeout(()=>{y=null,X(le)},se)};return{show:le=>{var be;let se=document.getElementById(b);if(!(se instanceof HTMLElement))return;let Te=se.querySelector(".problem-ide-cooldown-toast__text");(le==null?void 0:le.innerHTML)!=null&&Te instanceof HTMLElement&&(Te.innerHTML=le.innerHTML),B(),Q(se),se.classList.remove("problem-ide-cooldown-toast--hiding"),se.classList.add("problem-ide-cooldown-toast--visible"),se.setAttribute("aria-hidden","false"),I=(be=le==null?void 0:le.dismissMs)!=null?be:3e3,se.dataset.ideTopToastBound||(se.dataset.ideTopToastBound="1",se.addEventListener("mouseenter",()=>{B(),Q(se),se.classList.remove("problem-ide-cooldown-toast--hiding")}),se.addEventListener("mouseleave",()=>{se.classList.contains("problem-ide-cooldown-toast--visible")&&Z(se,I)})),Z(se,I)}}},ka=wn("problemIdeCooldownUpgradeToast"),hi=wn("problemIdeSubmitPermissionToast"),oo=()=>{ka.show()},qn=()=>!!(qe&&!UiContext.ideShortCooldown),Hn=()=>{qe&&UiContext.ideShortCooldown||(r.disabled=Et||In,a.disabled=In||Et,!Et&&!qe&&(r.textContent="\u25B6 \u81EA\u6D4B\u8FD0\u884C"),!In&&!qe&&(a.textContent="\u63D0\u4EA4"))},Ai=b=>{qe&&clearInterval(qe);let y=b;UiContext.ideShortCooldown&&(r.disabled=!0,a.disabled=!0);let S=()=>{Et||(r.textContent=`\u25B6 \u81EA\u6D4B\u8FD0\u884C (${y}s)`),In||(a.textContent=`\u63D0\u4EA4 (${y}s)`)};S(),qe=setInterval(()=>{y--,y>0?S():(clearInterval(qe),qe=null,Hn())},1e3),UiContext.ideShortCooldown||Hn()},kn=(b,y,S)=>{if(b===r?Et=!1:In=!1,S!=null&&S>0){Ai(S);return}if(qe){b.textContent=y;return}b.textContent=y,Hn()},Tn=()=>{L!=null&&L.classList.contains("problem-ide-drawer--collapsed")&&(L.classList.remove("problem-ide-drawer--collapsed"),Be.layout())},fe=b=>b.replace(/&/g,"&").replace(//g,">"),Ta=async b=>{var y;if((y=navigator.clipboard)!=null&&y.writeText)try{return await navigator.clipboard.writeText(b),!0}catch(S){}try{let S=document.createElement("textarea");S.value=b,S.style.position="fixed",S.style.left="-9999px",document.body.appendChild(S),S.select();let I=document.execCommand("copy");return document.body.removeChild(S),I}catch(S){return!1}},Ca=b=>{var Q,z;let y=b.querySelector(".problem-ide-ai-result__content");if(!y)return;let S=X=>X.tagName!=="PRE"||X.closest(".code-toolbar")?!1:X.dataset.testid==="shiki-container"||X.id==="shiki-container"?!0:!!X.querySelector(":scope > span.languageLabel, :scope > span#language-label"),I=()=>{let X=[];return y.querySelectorAll("pre").forEach(Z=>{S(Z)&&X.push(Z)}),X},B=I();for(let X=0;X<12&&B.length;X++){for(let Z of B){let Ye=Z.querySelector(":scope > span.languageLabel, :scope > span#language-label"),le=((Ye==null?void 0:Ye.textContent)||"").trim()||"code",se=[...Z.children].find(Pe=>Pe.tagName==="DIV"),Te="";if(se)Te=se.innerHTML;else{let Pe=Z.nextElementSibling;(Pe==null?void 0:Pe.tagName)==="DIV"&&(Te=Pe.innerHTML,Pe.remove())}let be=Z.previousElementSibling;if(be){let Pe=[...be.querySelectorAll("button")].find(dt=>/^(copy|复制)$/i.test((dt.textContent||"").trim())),at=[...be.querySelectorAll("span")].filter(dt=>!dt.closest("button")).map(dt=>(dt.textContent||"").trim()).find(Boolean)||"";if(Pe&&at)le=at,be.remove();else if(Pe){let dt=be.querySelector("span");dt&&((Q=dt.textContent)==null?void 0:Q.trim().toLowerCase())===le.toLowerCase()&&be.remove()}}let He=le.replace(/\s+/g,"-").toLowerCase();if(!Te.trim()){let Pe=Z.cloneNode(!0);Pe.querySelectorAll("span.languageLabel, span#language-label").forEach(at=>at.remove()),Te=`${fe(((z=Pe.textContent)==null?void 0:z.trim())||"")} `}let ct=document.createElement("div");ct.innerHTML=Te.trim(),ct.querySelectorAll("span.languageLabel, span#language-label").forEach(Pe=>Pe.remove());let Ve="",Rt=He,qt=ct.querySelector("pre > code");if(qt){let at=(qt.className||"").match(/language-([\w-]+)/i);at&&(Rt=at[1].replace(/\s+/g,"-").toLowerCase()),Ve=qt.innerHTML}else{let Pe=ct.querySelector(":scope > code");if(Pe){let dt=(Pe.className||"").match(/language-([\w-]+)/i);dt&&(Rt=dt[1].replace(/\s+/g,"-").toLowerCase()),Ve=Pe.innerHTML}else Ve=ct.innerHTML}let Vt=document.createElement("div");Vt.className="code-toolbar";let Jt=document.createElement("pre");Jt.className=`syntax-hl language-${fe(Rt)}`,Jt.setAttribute("tabindex","0");let ht=document.createElement("code");ht.className=`language-${fe(Rt)}`,ht.innerHTML=Ve;let un=document.createElement("div");un.className="toolbar";let mn=document.createElement("div");mn.className="toolbar-item";let ut=document.createElement("a");ut.href="#",ut.textContent="\u590D\u5236",ut.addEventListener("click",async Pe=>{var Pn;Pe.preventDefault();let at=((Pn=ht.textContent)!=null?Pn:"").replace(/\u00a0/g," "),dt=await Ta(at),Jo=ut.textContent;ut.textContent=dt?"\u5DF2\u590D\u5236":"\u590D\u5236\u5931\u8D25",window.setTimeout(()=>{ut.textContent=Jo||"\u590D\u5236"},2e3)}),mn.appendChild(ut),un.appendChild(mn),Jt.appendChild(ht),Vt.append(Jt,un),Z.replaceWith(Vt)}B=I()}y.querySelectorAll("button").forEach(X=>{X.closest(".code-toolbar")||X.closest(".record-ai-code-block")||/^(copy|复制)$/i.test((X.textContent||"").trim())&&X.remove()}),y.classList.add(bo),ur(),Qa(y)},ro=null,Id=b=>`
AI\u5206\u6790\u7ED3\u679C
\u72B6\u6001\uFF1A${fe(b.statusLabel)}
\u5F97\u5206\uFF1A${fe(b.score)}
\u8BED\u8A00\uFF1A${fe(b.langLabel)}
\u63D0\u4EA4\u65F6\u95F4\uFF1A${fe(b.timeStr)}
${b.analysisHtml||"
\u6682\u65E0 AI \u5206\u6790\u7ED3\u679C\u3002
"}
`,Ea=()=>{ro==null||ro.remove(),ro=null},Hd=async b=>{let y=xm(zc,bm);y&&(y.className="problem_content problem-ide-ai-result-panel",y.dataset.rid=b.rid,y.innerHTML=Id(b),Ca(y),Wc((0,vt.$)(".problem-ide-left"),zc),b.code&&g(b.langKey,b.code),Ea(),await Ma({force:!0}))},Pd=b=>{var S,I;Ea();let y=document.createElement("div");y.className="ai-analysis-apply-toast",y.innerHTML=`
AI\u5206\u6790\u5DF2\u5B8C\u6210
\u5C06 AI \u5206\u6790\u7ED3\u679C\u653E\u5165\u9898\u9762\u533A\u57DF\uFF0C\u5E76\u5C06\u4EE3\u7801\u91CD\u7F6E\u4E3A\u8FD9\u6B21\u63D0\u4EA4\u3002
\u6682\u4E0D\u5E94\u7528
\u786E\u8BA4\u5E94\u7528
`,(S=y.querySelector(".ai-analysis-apply-toast__reject"))==null||S.addEventListener("click",()=>{Ea()}),(I=y.querySelector(".ai-analysis-apply-toast__confirm"))==null||I.addEventListener("click",()=>{Hd(b)}),document.body.appendChild(y),ro=y},Os=b=>b.split(/\r?\n/).map(y=>y.replace(/[ \t]+$/,"")).join(`
`).replace(/[\r\n]+$/,""),La=b=>{var Ye,le;let y=String((Ye=b._id)!=null?Ye:""),S=typeof b.status=="number"?b.status:parseInt(b.status,10),I=si[S]||`STATUS_${S}`,B=li[I]||I,Q=S===1,z='';z+='
',z+=`${fe(B)} `;let X=[];b.score!=null&&X.push(`\u5206\u6570: ${b.score}`),b.time!=null&&X.push(`\u7528\u65F6: ${b.time}ms`),b.memory!=null&&X.push(`\u5185\u5B58: ${(b.memory/1024).toFixed(1)}MB`),X.length&&(z+=`${X.join(" | ")} `),z+="
";let Z=b.compilerText||b.compilerTexts;if(Z){let se=Array.isArray(Z)?Z.filter(Boolean).join(`
`):String(Z);se.trim()&&(z+=`
`)}if((le=b.testCases)!=null&&le.length){let se=b.testCases.map((Te,be)=>({tc:Te,i:be}));se.sort((Te,be)=>jr(Te.tc,Te.i)-jr(be.tc,be.i)),z+='
# \u72B6\u6001 \u7528\u65F6 \u5185\u5B58 \u5206\u6570 \u6D4B\u8BD5\u6570\u636E ',se.forEach(({tc:Te,i:be})=>{let He=typeof Te.status=="number"?Te.status:parseInt(Te.status,10),ct=si[He]||"UNKNOWN",Ve=li[ct]||ct,Rt=He===1,qt=jr(Te,be),Vt=!!y&&Sc(He);z+=`${qt} `,z+=`${fe(Ve)} `,z+=`${Te.time!=null?Te.time+"ms":"-"} `,z+=`${Te.memory!=null?(Te.memory/1024).toFixed(1)+"MB":"-"} `,z+=`${Te.score!=null?Te.score:"-"} `,Vt?z+=`\u9884\u89C8 `:z+="\u2014 ",z+=" "}),z+="
"}z+="
",c.innerHTML=z},wt=null,it=null,ao=!1,Wt=null,so=!1,_a=!1,Us=()=>{if(document.getElementById("record-ai-reviewmodal-styles"))return;let b=document.createElement("style");b.id="record-ai-reviewmodal-styles",b.textContent=Hi(),document.head.appendChild(b),$i()},Dd=()=>{var B;let b=Di(U==null?void 0:U.dailyLimit),y=document.createElement("div");y.className="reviewmodal",y.innerHTML=`
`,document.body.appendChild(y);let S=y.querySelector("#problemIdeAiLimitMsg");S&&(S.innerHTML=b);let I=()=>{y.classList.add("is-closing"),setTimeout(()=>y.remove(),200)};(B=y.querySelector(".reviewmodal__close"))==null||B.addEventListener("click",I),y.addEventListener("click",Q=>{Q.target===y&&I()})},$d=(b,y)=>new Promise(S=>{var z,X;let I=document.createElement("div");I.className="ai-confirm-mask";let B=document.createElement("div");B.className="ai-confirm-dialog",B.innerHTML=`
${fe(y)}
`,I.appendChild(B),document.body.appendChild(I),requestAnimationFrame(()=>{I.classList.add("ai-confirm-enter-mask"),B.classList.add("ai-confirm-enter-dialog")});let Q=Z=>{I.classList.remove("ai-confirm-enter-mask"),B.classList.remove("ai-confirm-enter-dialog"),I.classList.add("ai-confirm-leave-mask"),B.classList.add("ai-confirm-leave-dialog"),B.addEventListener("animationend",()=>{I.remove(),S(Z)},{once:!0})};B.addEventListener("click",Z=>Z.stopPropagation()),I.addEventListener("click",()=>Q(!1)),(z=B.querySelector(".ai-confirm-btn-confirm"))==null||z.addEventListener("click",()=>Q(!0)),(X=B.querySelector(".ai-confirm-btn-cancel"))==null||X.addEventListener("click",()=>Q(!1))}),Ma=async b=>{if(!so){if(ao&&!(b!=null&&b.force)){if(so=!0,!await $d("\u64CD\u4F5C\u786E\u8BA4","AI \u6B63\u5728\u8F93\u51FA\u4E2D\uFF0C\u786E\u5B9A\u8981\u5173\u95ED\u5417\uFF1F")){so=!1;return}Wt==null||Wt.abort()}wt==null||wt.classList.remove("active"),it==null||it.classList.remove("active"),setTimeout(()=>{Wt==null||Wt.abort(),Wt=null,wt==null||wt.remove(),it==null||it.remove(),wt=null,it=null,ao=!1,so=!1,document.body.style.overflow=""},300)}},Bd=()=>{try{Wt==null||Wt.abort(),Wt=null,document.body.style.overflow="",wt==null||wt.remove(),it==null||it.remove()}catch(b){}wt=null,it=null,ao=!1},Ws=async(b,y)=>{var I,B,Q,z,X,Z;if(wt||it||_a||so)return;if(U!=null&&U.limited&&U.remaining<=0){Us(),Dd();return}_a=!0;let S=!1;try{Us();let Ye=typeof y.status=="number"?y.status:parseInt(y.status,10),le=si[Ye]||`STATUS_${Ye}`,se=li[le]||le,Te=$[y.lang]||y.lang||"\u672A\u77E5\u8BED\u8A00",be=(I=y.score)!=null?I:"-",He=y.judgeAt?new Date(y.judgeAt).toLocaleString("zh-CN"):"-",ct={rid:b,code:"",langKey:String(y.lang||""),langLabel:String(Te),statusLabel:se,score:String(be),timeStr:He},Ve="";try{let Pe=((B=UiContext.getRecordDetailUrl)==null?void 0:B.replace("%7Brid%7D",b).replace("{rid}",b))||`/record/${b}`,at=await vt.request.get(Pe);Ve=((Q=at==null?void 0:at.rdoc)==null?void 0:Q.code)||"",ct.code=Ve}catch(Pe){}let Rt=nn(y.lang||"");wt=document.createElement("div"),wt.className="ai-analysis-overlay";let Vt=Ye===1?"ac":be!=="-"&&Number(be)>0?"partial":"err";it=document.createElement("div"),it.className="ai-analysis-dialog",it.innerHTML=`
${fe(Ve||"(\u65E0\u6CD5\u52A0\u8F7D\u4EE3\u7801)")}
\u6B63\u5728\u8FDE\u63A5 AI \u5206\u6790\u670D\u52A1\u2026
`,window.Prism&&window.Prism.highlightAllUnder(it),Me(it),document.body.appendChild(wt),document.body.appendChild(it),S=!0,document.body.style.overflow="hidden",requestAnimationFrame(()=>{wt==null||wt.classList.add("active"),it==null||it.classList.add("active")}),(z=it.querySelector(".ai-analysis-close"))==null||z.addEventListener("click",()=>{Ma()}),wt.addEventListener("click",()=>{Ma()}),it.addEventListener("click",Pe=>Pe.stopPropagation());let Jt=it.querySelector("#aiAnalysisContainer"),ht=it.querySelector("#recordAiStreamRoot");if(!Jt||!ht)throw new Error("AI \u5BF9\u8BDD\u6846\u7ED3\u6784\u5F02\u5E38");let un="recordAiStreamLive";ht.classList.remove("is-loading"),ht.classList.add("is-result"),ht.innerHTML=`
`;let mn=ht.querySelector(`#${un}`);if(!mn)throw new Error("AI \u6D41\u6302\u8F7D\u70B9\u7F3A\u5931");Wt=new AbortController,ao=!0;let ut=await Bi(b,mn,{signal:Wt.signal});if(ao=!1,Wt=null,ut.ok)ut.aiQuota&&ke({aiQuota:ut.aiQuota}),Me(it),Pd({...ct,analysisHtml:(X=ut.contentHtml)!=null?X:""});else{let Pe=(Z=ut.error)!=null?Z:"";if(!Pe)return;U!=null&&U.limited&&/次数已用完|403/.test(Pe)&&(U={...U,remaining:0},je()),ht.classList.remove("is-result"),ht.classList.add("is-loading"),ht.innerHTML=` ${fe(Pe)}
`}}catch(Ye){S&&Bd(),Ln("\u6253\u5F00 AI \u5206\u6790\u5931\u8D25",Ye)}finally{_a=!1}},Ys=async()=>{var b;if(!(!M||!UiContext.getSubmissionsUrl)){M.innerHTML='\u52A0\u8F7D\u4E2D\u2026
';try{let S=(await vt.request.get(UiContext.getSubmissionsUrl)).rdocs||[];if(!S.length){M.innerHTML='\u6682\u65E0\u63D0\u4EA4\u8BB0\u5F55
';return}let I='';I+="\u63D0\u4EA4\u65F6\u95F4 \u72B6\u6001 \u5206\u6570 \u7528\u65F6 \u5185\u5B58 \u8BED\u8A00 AI\u5206\u6790 ",I+=" ";for(let B of S){let Q=si[B.status]||`STATUS_${B.status}`,z=li[Q]||Q,X=B.status===1,Z=B.judgeAt?new Date(B.judgeAt).toLocaleString("zh-CN"):"-",Ye=Co.has(B.status);I+=``,I+=`${fe(Z)} `,I+=`${fe(z)} `,I+=`${(b=B.score)!=null?b:"-"} `,I+=`${B.time!=null?B.time+"ms":"-"} `,I+=`${B.memory!=null?(B.memory/1024).toFixed(1)+"MB":"-"} `,I+=`${fe($[B.lang]||B.lang||"-")} `,I+=`${Ye?` AI\u5206\u6790 `:"-"} `,I+=" "}I+="
",M.innerHTML=I,M.querySelectorAll(".history-row").forEach(B=>{B.addEventListener("click",Q=>{var Z;if(Q.target.closest(".history-ai-btn"))return;let z=B.dataset.rid;if(!z)return;let X=((Z=UiContext.getRecordDetailUrl)==null?void 0:Z.replace("%7Brid%7D",z).replace("{rid}",z))||`/record/${z}`;window.open(X,"_blank")})}),M.querySelectorAll(".history-ai-btn").forEach(B=>{B.addEventListener("click",Q=>{Q.stopPropagation();let z=B.dataset.rid;if(!z)return;let X=S.find(Z=>String(Z._id)===String(z));X&&Ws(z,X)})})}catch(y){Ln("\u63D0\u4EA4\u5386\u53F2\u52A0\u8F7D\u5931\u8D25",y);let S=y instanceof Error?y.message:String(y);M.innerHTML=`\u52A0\u8F7D\u5931\u8D25: ${fe(S)}
`}}},ft=null,Vs=0,Nd=6e3,Yt=new Map,Ii=[],pn=0,zn=null,lo=null,Wo=null,co=()=>{Wo&&(clearTimeout(Wo),Wo=null)},Js=(b=2e4)=>{co(),Wo=setTimeout(()=>{if(Yt.size>0){let y=Ii.filter(I=>I!=null).length,S=[...Yt.keys()];Ln("\u8BC4\u6D4B WebSocket \u8D85\u65F6\uFF08\u81EA\u6D4B\uFF09",new Error(`\u5DF2\u5B8C\u6210 ${y}/${pn}\uFF0C\u4ECD\u5728\u7B49\u5F85\u5176\u4F59\u7ED3\u679C`),{pendingRids:S,wsReadyState:ft==null?void 0:ft.readyState}),_e(`\u8BC4\u6D4B\u8D85\u65F6 (${y}/${pn})`,"err"),c.textContent=`\u957F\u65F6\u95F4\u672A\u6536\u5230\u5168\u90E8\u8BC4\u6D4B\u7ED3\u679C\uFF0C\u53EF\u80FD\u662F\u7F51\u7EDC\u95EE\u9898\u6216\u8BC4\u6D4B\u961F\u5217\u7E41\u5FD9\u3002
--- \u6392\u969C\u4FE1\u606F ---
\u5F85\u5B8C\u6210 rid: ${S.join(", ")||"(\u65E0)"}
WebSocket readyState: ${ft==null?"null":ft.readyState}
`,Yt.clear(),kn(r,"\u25B6 \u8FD0\u884C",xt(pn))}if(zn){let y=zn;Ln("\u8BC4\u6D4B WebSocket \u8D85\u65F6\uFF08\u6B63\u5F0F\u63D0\u4EA4\uFF09",new Error(`rid=${y} \u957F\u65F6\u95F4\u65E0\u7EC8\u6001\u63A8\u9001`),{rid:y,wsReadyState:ft==null?void 0:ft.readyState}),_e("\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5","err"),c.textContent=`\u957F\u65F6\u95F4\u672A\u6536\u5230\u8BC4\u6D4B\u7ED3\u679C\uFF0C\u53EF\u80FD\u662F\u7F51\u7EDC\u95EE\u9898\u6216\u8BC4\u6D4B\u961F\u5217\u7E41\u5FD9\u3002
--- \u6392\u969C\u4FE1\u606F ---
submit rid: ${y}
WebSocket readyState: ${ft==null?"null":ft.readyState}
`,zn=null,lo=null,Ne(),kn(a,"\u63D0\u4EA4",nt)}},b)},Ks={2:"\u7A0B\u5E8F\u8F93\u51FA\u4E0E\u9884\u671F\u7B54\u6848\u4E0D\u4E00\u81F4",3:"\u7A0B\u5E8F\u8FD0\u884C\u8D85\u51FA\u65F6\u95F4\u9650\u5236\uFF0C\u8BF7\u4F18\u5316\u7B97\u6CD5\u590D\u6742\u5EA6",4:"\u7A0B\u5E8F\u8FD0\u884C\u8D85\u51FA\u5185\u5B58\u9650\u5236\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u5B58\u5728\u5185\u5B58\u6CC4\u6F0F\u6216\u6570\u636E\u7ED3\u6784\u8FC7\u5927",5:"\u7A0B\u5E8F\u8F93\u51FA\u6570\u636E\u8FC7\u591A\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u6B7B\u5FAA\u73AF\u8F93\u51FA",6:"\u7A0B\u5E8F\u8FD0\u884C\u65F6\u5F02\u5E38\u9000\u51FA\uFF08\u5E38\u89C1\u539F\u56E0\uFF1A\u6BB5\u9519\u8BEF\u3001\u9664\u96F6\u9519\u8BEF\u3001\u6570\u7EC4\u8D8A\u754C\u3001\u6808\u6EA2\u51FA\u3001\u7A7A\u6307\u9488\u7B49\uFF09",7:"\u4EE3\u7801\u7F16\u8BD1\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8BED\u6CD5",8:"\u8BC4\u6D4B\u7CFB\u7EDF\u5185\u90E8\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",9:"\u8BC4\u6D4B\u5DF2\u53D6\u6D88"},Fd=()=>{var S,I,B,Q,z;Ne(),Ct();let b=!0,y="";Nt&&(y+='\u26A0 \u672C\u9898\u4E3A Special Judge \u9898\u76EE \u81EA\u6D4B\u8FD0\u884C\u4EC5\u6267\u884C\u60A8\u7684\u7A0B\u5E8F\uFF0C\u4E0D\u4F1A\u8C03\u7528\u8BC4\u6D4B\u5668\uFF08checker\uFF09\u8FDB\u884C\u5224\u5B9A\u3002\u8BF7\u81EA\u884C\u68C0\u67E5\u8F93\u51FA\u662F\u5426\u7B26\u5408\u9898\u76EE\u8981\u6C42\u3002\u6700\u7EC8\u7ED3\u679C\u4EE5\u63D0\u4EA4\u8BC4\u6D4B\u4E3A\u51C6\u3002
'),y+='`,b=!1;continue}let le=typeof Z.status=="number"?Z.status:parseInt(Z.status,10),se=si[le]||`STATUS_${le}`,Te=li[se]||se,be=le===1,He=(...at)=>{for(let dt of at){if(typeof dt=="string"&&dt.trim())return dt.trim();if(Array.isArray(dt))return dt.filter(Boolean).join(`
`).trim()}return""},ct=He(Z.compilerText,Z.compilerTexts),Ve=(S=Z.testCases)==null?void 0:S[0],Rt=(Ve==null?void 0:Ve.message)!=null?String(Ve.message):"",qt=He(Ve==null?void 0:Ve.stderr),Vt=Rt||"(\u65E0\u8F93\u51FA)",Jt=(I=Ye==null?void 0:Ye.expected)==null?void 0:I.trim(),ht=Os(Rt)===Os((B=Ye==null?void 0:Ye.expected)!=null?B:""),un=(Q=Ve==null?void 0:Ve.time)!=null?Q:Z.time,mn=(z=Ve==null?void 0:Ve.memory)!=null?z:Z.memory;if(y+='",y+='
',!be&&Ks[le]&&(y+=`
${fe(Ks[le])}
`);let Pe=!!(ct||qt);if(ct&&(y+=`
\u7F16\u8BD1\u4FE1\u606F
${fe(ct)} `),qt&&(y+=`
\u6807\u51C6\u9519\u8BEF (stderr)
${fe(qt)} `),!be&&!Pe){let at=He(Z.progress,Z.message,Z.content);at&&(y+=`
\u9519\u8BEF\u8BE6\u60C5
${fe(at)} `)}le===7&&!Rt?ct||(y+='
\u7F16\u8BD1\u4FE1\u606F
\u7F16\u8BD1\u5931\u8D25\uFF0C\u8BE6\u7EC6\u4FE1\u606F\u672A\u8FD4\u56DE\u3002\u8BF7\u6253\u5F00\u6D4F\u89C8\u5668\u63A7\u5236\u53F0(F12)\u67E5\u770B [pretest] \u65E5\u5FD7\u83B7\u53D6\u5B8C\u6574\u6570\u636E\u3002 '):Jt?(y+='
',y+=`
\u5B9E\u9645\u8F93\u51FA
${fe(Vt)} `,y+=`
\u9884\u671F\u8F93\u51FA
${fe(Jt)} `,y+="
"):y+=`
`,y+="
"}y+="",c.innerHTML=y,Nt?_e(b?"\u5168\u90E8\u901A\u8FC7 \u2713":"\u81EA\u6D4B\u5DF2\u5B8C\u6210\uFF08SPJ \u4EE5\u9898\u9762\u4E0E\u63D0\u4EA4\u8BC4\u6D4B\u4E3A\u51C6\uFF09",b?"ok":"pending"):_e(b?"\u5168\u90E8\u901A\u8FC7 \u2713":"\u5B58\u5728\u672A\u901A\u8FC7\u7684\u7528\u4F8B \u2717",b?"ok":"err")},Rd=b=>{if(!b||!b._id)return;let y=b._id,S=typeof b.status=="number"?b.status:parseInt(b.status,10),I=si[S]||`STATUS_${S}`,B=li[I]||I;if(Yt.has(y)){let Q=Yt.get(y);if(Nc.has(S)){let z=Ii.filter(X=>X!=null).length;_e(`\u7528\u4F8B ${Q+1}: ${B} (${z}/${pn})`,"pending");return}if(Co.has(S)){Yt.delete(y),Ii[Q]=b;let z=Ii.filter(X=>X!=null).length;z===pn?(co(),Fd(),kn(r,"\u25B6 \u8FD0\u884C",xt(pn))):_e(`\u5DF2\u5B8C\u6210 ${z}/${pn} \u4E2A\u7528\u4F8B`,"pending")}return}if(zn&&y===zn){if(Nc.has(S)){_e(B,"pending");return}Co.has(S)&&(co(),lo=String(y),La(b),_e(B,S===1?"ok":"err"),Oe(b),zn=null,kn(a,"\u63D0\u4EA4",nt),Ys());return}if(lo&&String(y)===lo&&Co.has(S)&&!Yt.has(y)){co();let Q=typeof b.status=="number"?b.status:parseInt(String(b.status),10),z=si[Q]||`STATUS_${Q}`,X=li[z]||z;La(b),_e(X,Q===1?"ok":"err"),Oe(b)}};d&&d.addEventListener("click",b=>{b.preventDefault();let y=yn;y&&Ws(y.rid,y.rdoc)});let Sa=null,Qs=1e3,qd=15e3,Yo=Qs,zd=!0,Od=()=>{Sa||(Sa=setTimeout(()=>{Sa=null,Vo()},Yo),Yo=Math.min(Yo*2,qd))},Vo=()=>{if(ft){if(ft.readyState===WebSocket.OPEN)return;if(ft.readyState===WebSocket.CONNECTING){if(Date.now()-Vs{ft===y&&(Yo=Qs)},y.onmessage=S=>{if(ft===y){if(S.data==="ping"){try{y.send("pong")}catch(I){}return}try{let I=JSON.parse(S.data),B=I.rdoc||I;Rd(B)}catch(I){console.warn("[problem_ide] ws message parse error",I,S.data)}}},y.onerror=S=>{console.warn("[problem_ide] ws error",S)},y.onclose=()=>{ft===y&&(ft=null);let S=Yt.size>0||zn;(zd||S)&&Od()}}catch(y){return}};Vo(),an=async()=>{var b,y;if(UiContext.getSubmissionsUrl)try{let I=(await vt.request.get(UiContext.getSubmissionsUrl)).rdocs||[];if(!I.length)return;let B=be=>{var Ve;let He=(Ve=be.judgeAt)!=null?Ve:be.judgedAt;if(He==null)return 0;let ct=new Date(He).getTime();return Number.isNaN(ct)?0:ct},Q=be=>typeof be.status=="number"?be.status:parseInt(String(be.status),10),z=null;for(let be of I){if(!Co.has(Q(be)))continue;if(!z){z=be;continue}let He=B(be),ct=B(z);(He>ct||He===ct&&String(be._id)>String(z._id))&&(z=be)}if(!z)return;let X=String((b=z._id)!=null?b:"");if(!X)return;let Z=z;if(!(Array.isArray(z.testCases)&&z.testCases.length>0)){let be=((y=UiContext.getRecordDetailUrl)==null?void 0:y.replace("%7Brid%7D",X).replace("{rid}",X))||`/record/${X}`;try{let He=await vt.request.get(be);He!=null&&He.rdoc&&(Z=He.rdoc)}catch(He){}}if(Et||In||Yt.size>0||zn||dn)return;Tn(),La(Z);let le=typeof Z.status=="number"?Z.status:parseInt(Z.status,10),se=si[le]||`STATUS_${le}`,Te=li[se]||se;_e(Te,le===1?"ok":"err")}catch(S){Ln("\u8FD0\u884C\u7ED3\u679C\u9875/\u56DE\u586B\u6700\u8FD1\u4E00\u6B21\u63D0\u4EA4\u5931\u8D25",S)}};let On=J.ide_submit_psets||[],Gs=b=>b instanceof Error&&/403|Forbidden/i.test(b.message),Xs=()=>{let b=fe;if(On.length===1){let y=On[0],S=`\u8BF7\u5148\u8D2D\u4E70\u9898\u5E93\u300A${b(y.name)}\u300B\uFF1A\u8FDB\u5165\u9898\u5E93\u9996\u9875 \uFF0C\u70B9\u51FB\u300C\u7ACB\u5373\u8D2D\u4E70\u300D\u6309\u94AE\u3002`,I=y.extraPay?'\u8BE5\u9898\u4E3A\u5355\u72EC\u4ED8\u8D39 \u5185\u5BB9\uFF0C\u9700\u8D2D\u4E70\u672C\u9898\u5E93\u540E\u65B9\u53EF\u63D0\u4EA4/\u81EA\u6D4B\uFF1B\u5F00\u901A\u4F1A\u5458 \u65E0\u6CD5\u66FF\u4EE3\u672C\u9898\u5E93\u3002':'\u6216\u5F00\u901A\u4F1A\u5458 \uFF0C\u53EF\u89E3\u9501\u5E73\u53F0\u5185\u6240\u6709\u4ED8\u8D39\u9898\u5E93\uFF08\u542B\u672C\u9898\uFF09\u3002';return`${S} ${I}`}if(On.length>1){let y=On.map(B=>`${b(B.name)} `).join("\u3001"),I=On.some(B=>!B.extraPay)?'\u4E5F\u53EF\u5F00\u901A\u4F1A\u5458 \u89E3\u9501\u6240\u6709\u4ED8\u8D39\u9898\u5E93\uFF1B\u6807\u6CE8\u4E3A\u5355\u72EC\u4ED8\u8D39\u7684\u9898\u5E93\u4ECD\u9700\u5355\u72EC\u8D2D\u4E70\u3002':'\u4EE5\u4E0A\u5747\u4E3A\u5355\u72EC\u4ED8\u8D39\u9898\u5E93\uFF0C\u8BF7\u5206\u522B\u8D2D\u4E70\uFF1B\u4F1A\u5458\u8BF4\u660E \u4EE5\u8D2D\u4E70\u9875\u4E3A\u51C6\u3002';return`\u63D0\u4EA4\u6216\u81EA\u6D4B\u9700\u8981\u9898\u5E93\u6743\u9650\u3002\u672C\u9898\u5173\u8054\u4EE5\u4E0B\u4ED8\u8D39\u9898\u5E93\uFF1A${y}\u3002\u8BF7\u5206\u522B\u8FDB\u5165\u5BF9\u5E94\u9898\u5E93\u9996\u9875\uFF0C\u70B9\u51FB\u300C\u7ACB\u5373\u8D2D\u4E70\u300D\u6309\u94AE\u3002${I}`}return'\u63D0\u4EA4\u6216\u81EA\u6D4B\u9700\u8981\u9898\u5E93\u6743\u9650\u3002\u8BF7\u8FDB\u5165\u5BF9\u5E94\u9898\u5E93\u9996\u9875\uFF0C\u70B9\u51FB\u300C\u7ACB\u5373\u8D2D\u4E70\u300D\uFF1B\u82E5\u4E3A\u5E73\u53F0\u4ED8\u8D39\u9898\u5E93\uFF0C\u4E5F\u53EF\u5F00\u901A\u4F1A\u5458 \u89E3\u9501\u6240\u6709\u4ED8\u8D39\u5185\u5BB9\u3002'},Ud=()=>{if(On.length===1){let b=On[0];return`\u6743\u9650\u4E0D\u8DB3\uFF1A\u8BF7\u8D2D\u4E70\u9898\u5E93\u300C${b.name}\u300D\uFF08\u8FDB\u5165\u9898\u5E93\u9996\u9875\u70B9\u51FB\u300C\u7ACB\u5373\u8D2D\u4E70\u300D\uFF09${b.extraPay?"\uFF08\u672C\u9898\u5E93\u4E3A\u5355\u72EC\u4ED8\u8D39\uFF09":"\uFF0C\u6216\u5F00\u901A\u4F1A\u5458\u89E3\u9501\u6240\u6709\u4ED8\u8D39\u9898\u5E93"}\u3002`}return On.length>1?`\u6743\u9650\u4E0D\u8DB3\uFF1A\u8BF7\u5148\u8D2D\u4E70\u4E0B\u5217\u9898\u5E93\u4E4B\u4E00\uFF08\u8FDB\u5165\u9898\u5E93\u9996\u9875\u70B9\u51FB\u300C\u7ACB\u5373\u8D2D\u4E70\u300D\uFF09\uFF1A${On.map(y=>`\u300C${y.name}\u300D`).join("\u3001")}`:"\u6743\u9650\u4E0D\u8DB3\uFF1A\u8BF7\u8D2D\u4E70\u5BF9\u5E94\u4ED8\u8D39\u9898\u5E93\uFF08\u9898\u5E93\u9996\u9875\u70B9\u51FB\u300C\u7ACB\u5373\u8D2D\u4E70\u300D\uFF09\uFF0C\u6216\u5F00\u901A\u4F1A\u5458\u89E3\u9501\u6240\u6709\u4ED8\u8D39\u9898\u5E93\u3002"},Zs=b=>{if(!(b instanceof Error))return String(b);let y=b.message;return/403|Forbidden/i.test(y)?Ud():y.includes("429")?"\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5":y.includes("413")?"\u4EE3\u7801\u8FC7\u957F\uFF0C\u8BF7\u7CBE\u7B80\u540E\u91CD\u8BD5":y.includes("Failed to fetch")||y.includes("NetworkError")?"\u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC":y};r.addEventListener("click",async()=>{var y;if(!UiContext.postSubmitUrl)return;if(qn()){oo();return}if(r.disabled)return;let b=Be.getValue();if(!b.trim()){Ut("result",{skipLatestSubmitHydrate:!0}),Tn(),_e("\u8BF7\u5148\u8F93\u5165\u4EE3\u7801","err"),c.textContent="";return}Ct(),dn=!0,Ne(),Et=!0,xn(r,!0,"..."),Hn(),Ut("result"),Tn(),Yt.clear(),pn=me.length,Ii=new Array(me.length).fill(null),_e(`\u8FD0\u884C ${me.length} \u4E2A\u7528\u4F8B\u2026`,"pending"),c.textContent="";try{let S=null;for(let I=0;I0)_e(`\u7B49\u5F85\u8BC4\u6D4B\u7ED3\u679C\uFF08${Yt.size} \u4E2A\u7528\u4F8B\uFF09\u2026`,"pending"),Js(6e4+(pn-1)*3e4);else{Ln("\u81EA\u6D4B/\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE rid",new Error("no rid in response"),{lastResponse:S!=null?S:void 0,caseCount:me.length});let I=S!=null?JSON.stringify(S,null,2):"(\u65E0\u54CD\u5E94\u4F53)";_e("\u5F02\u5E38\u54CD\u5E94","err"),c.textContent=`\u670D\u52A1\u5668\u672A\u8FD4\u56DE\u8BC4\u6D4B\u4EFB\u52A1 id\uFF08rid\uFF09\uFF0C\u65E0\u6CD5\u901A\u8FC7 WebSocket \u62C9\u53D6\u7ED3\u679C\u3002
--- \u539F\u59CB\u54CD\u5E94 ---
`+I,kn(r,"\u25B6 \u8FD0\u884C",xt(pn))}}catch(S){Yt.clear(),co(),Ln("\u81EA\u6D4B/HTTP \u6216\u5904\u7406\u5F02\u5E38",S,{url:UiContext.postSubmitUrl});let I=Zs(S);Gs(S)&&hi.show({innerHTML:Xs(),dismissMs:5500}),c.textContent=`${I}
--- \u8BE6\u60C5 ---
${qc(S)}`,_e("\u8BF7\u6C42\u5931\u8D25","err"),kn(r,"\u25B6 \u8FD0\u884C",xt(pn))}}),a.addEventListener("click",async()=>{var y;if(!UiContext.postSubmitUrl)return;if(qn()){oo();return}if(a.disabled)return;let b=Be.getValue();if(!b.trim()){Ut("result",{skipLatestSubmitHydrate:!0}),Tn(),_e("\u8BF7\u5148\u8F93\u5165\u4EE3\u7801","err"),c.textContent="";return}dn=!0,Ne(),In=!0,xn(a,!0,"..."),Hn(),Ut("result"),Tn(),_e("\u63D0\u4EA4\u4E2D\u2026","pending"),c.innerHTML="";try{let S={lang:n.value,code:b,pretest:!1};(y=UiContext.tdoc)!=null&&y.docId&&(S.tid=UiContext.tdoc.docId);let I=await Rc(vt.request.post(UiContext.postSubmitUrl,S),Fc,"\u63D0\u4EA4\u8BF7\u6C42"),B=I.rid||void 0;B?(lo=null,zn=B,Vo(),Js(),_e("\u8BC4\u6D4B\u4E2D\u2026","pending")):(Ln("\u6B63\u5F0F\u63D0\u4EA4/\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE rid",new Error("no rid in response"),{res:I}),Ne(),_e("\u63D0\u4EA4\u5931\u8D25","err"),c.textContent=`\u670D\u52A1\u5668\u672A\u8FD4\u56DE\u8BC4\u6D4B\u4EFB\u52A1 id\uFF08rid\uFF09\u3002
--- \u539F\u59CB\u54CD\u5E94 ---
`+JSON.stringify(I,null,2),kn(a,"\u63D0\u4EA4",nt))}catch(S){Ln("\u6B63\u5F0F\u63D0\u4EA4/HTTP \u6216\u5904\u7406\u5F02\u5E38",S,{url:UiContext.postSubmitUrl});let I=Zs(S);Gs(S)&&hi.show({innerHTML:Xs(),dismissMs:5500}),c.textContent=`${I}
--- \u8BE6\u60C5 ---
${qc(S)}`,Ne(),_e("\u8BF7\u6C42\u5931\u8D25","err"),kn(a,"\u63D0\u4EA4",nt)}}),(0,vt.$)(window).on("resize",()=>Be.layout())}));var Hr=ae(re()),hs="data-pset-drawer-js";function Em(i){let t=i===""||i===void 0?Number.NaN:typeof i=="number"?i:parseFloat(String(i));return Number.isFinite(t)&&t>=1&&t<=3?{cls:"easy",tag:"\u7B80\u5355"}:Number.isFinite(t)&&t>=4&&t<=6?{cls:"medium",tag:"\u4E2D\u7B49"}:Number.isFinite(t)?{cls:"hard",tag:"\u56F0\u96BE"}:{cls:"none",tag:""}}function Lm(i){let t=document.createElement("textarea");return t.innerHTML=i,t.value}function _m(){var Y,te,ve;let i=document.getElementById("psetCol"),t=window,e={};if(t.__psetDrawerPayload)e=t.__psetDrawerPayload;else{let ne=document.getElementById("pset-drawer-payload");if(!ne){if(!i)return;console.warn("[pset-drawer] mount skipped: no payload source");return}let pe=((Y=ne.textContent)==null?void 0:Y.trim())||((te=ne.innerHTML)==null?void 0:te.trim())||"{}",G=Lm(pe).replace(/:\s*,/g,": null,").replace(/:\s*}/g,": null}");try{e=JSON.parse(G)}catch(Ee){console.error("[pset-drawer] JSON parse failed:",Ee,`
raw:`,G.slice(0,500)),e={}}}if(!i){console.warn("[pset-drawer] mount skipped: no #psetCol");return}i.removeAttribute(hs),(ve=i.querySelector("#psetDrawer"))==null||ve.remove();let n=document.createElement("aside");n.id="psetDrawer",n.className="pset-drawer",n.setAttribute("aria-hidden","true");let o=document.createElement("div");o.className="pset-drawer__header";let r=document.createElement("h3");r.textContent="\u9898\u5E93\u5217\u8868";let a=document.createElement("button");a.id="psetClose",a.className="pset-drawer__close",a.title="\u5173\u95ED",a.type="button",a.textContent="\xD7",o.append(r,a);let s=document.createElement("div");s.className="pset-drawer__header";let l=document.createElement("h5");l.textContent=e.psName||"",s.appendChild(l);let c=document.createElement("div");c.className="pset-controls-container";let u=document.createElement("div");u.className="pset-search-row";let d=document.createElement("div");d.className="pset-search";let h=document.createElement("input");h.id="psetSearch",h.type="text",h.placeholder="\u641C\u7D22\u9898\u76EE\u2026",h.setAttribute("aria-label","\u641C\u7D22\u9898\u76EE"),d.appendChild(h),u.appendChild(d);let v=document.createElement("div");v.className="pset-filter-row",v.style.display="none";let w=document.createElement("div");w.className="pset-filter-group";let k=document.createElement("div");k.className="pset-filter-select-row";let L=document.createElement("select");L.id="sortSelect",L.className="pset-select",L.title="\u6392\u5E8F\u65B9\u5F0F";let H=[["section","\u7AE0\u8282\u987A\u5E8F"],["diff-asc","\u96BE\u5EA6\uFF1A\u4F4E\u2192\u9AD8"],["diff-desc","\u96BE\u5EA6\uFF1A\u9AD8\u2192\u4F4E"]];for(let[ne,pe]of H){let G=document.createElement("option");G.value=ne,G.textContent=pe,L.appendChild(G)}let _=document.createElement("select");_.id="algoFilterSelect",_.className="pset-select",_.title="\u6309\u6807\u7B7E\u7B5B\u9009";let M=document.createElement("option");M.value="",M.textContent="\u5168\u90E8\u6807\u7B7E",_.appendChild(M);for(let ne of e.allTags||[]){let pe=document.createElement("option");pe.value=ne,pe.textContent=ne,_.appendChild(pe)}k.append(L,_);let A=document.createElement("div");A.className="pset-checkbox-label";let D=document.createElement("input");D.type="checkbox",D.id="unsolvedFilter",D.className="pset-checkbox";let $=document.createElement("label");$.htmlFor="unsolvedFilter",$.textContent="\u4EC5\u672A\u901A\u8FC7",A.append(D,$),w.append(k,A),v.appendChild(w),c.append(u,v);let q=document.createElement("div");q.id="psetList",q.className="pset-list";let K=e.groups||[],ee=e.currentPid,R=e.tid||null,N=ne=>{let pe=`/p/${ne}`;return R?`${pe}?tid=${encodeURIComponent(String(R))}`:pe};if(K.length===0){let ne=document.createElement("div");ne.className="pset-empty",ne.textContent="\u672A\u68C0\u6D4B\u5230\u5F53\u524D\u9898\u76EE\u7684\u9898\u5E93\u4E0A\u4E0B\u6587\u3002",q.appendChild(ne)}else for(let ne of K){let pe=document.createElement("div");pe.className="section";let G=document.createElement("div");G.className="section__header clearfix";let Ee=document.createElement("div");Ee.className="float-left";let Je=document.createElement("h4");Je.setAttribute("data-heading",""),Je.id=`node-${ne.nid}`,Je.className="mysection__title";let J=ne.title||"";Je.textContent=(J?J.split(`
`)[0]:"")||`Section ${ne.nid}`,Ee.appendChild(Je),G.appendChild(Ee);let U=document.createElement("div");U.className="section__body no-padding";let Se=ne.items||[];if(Se.length===0){let je=document.createElement("div");je.className="pset-empty",je.textContent="\u672C\u8282\u6682\u65E0\u9898\u76EE\u3002",U.appendChild(je)}else{let je=document.createElement("ul");je.className="pset-ul";for(let ke of Se){let Me=document.createElement("li"),rt=["pset-item"];ke.accepted&&rt.push("pset-item--ac"),String(ke.pid)===String(ee)&&rt.push("pset-item--active"),Me.className=rt.join(" "),Me.dataset.tags=(ke.tags||[]).join(",");let $e=ke.difficulty;Me.dataset.difficulty=$e===void 0||$e===""?"":String($e),Me.dataset.section=String(ne.nid);let It=document.createElement("div");It.className="pset-item__main";let _t=document.createElement("a");_t.className="pset-item__title",_t.href=ke.href||N(ke.pid),_t.textContent=ke.title||`#${ke.pid}`;let{cls:vn,tag:Tt}=Em(ke.difficulty),pt=document.createElement("span");pt.className=`pset-item__dif${vn!=="none"?` dif-${vn}`:""}`,pt.textContent=Tt,It.append(_t,pt),Me.appendChild(It),je.appendChild(Me)}U.appendChild(je)}pe.append(G,U),q.appendChild(pe)}n.append(o,s,c,q),i.appendChild(n),console.log("[pset-drawer] mounted, groups:",K.length,"items:",K.reduce((ne,pe)=>{var G;return ne+(((G=pe.items)==null?void 0:G.length)||0)},0))}function Mm(i,t){var a,s;let e=(a=t==null?void 0:t.maxTries)!=null?a:100,n=(s=t==null?void 0:t.intervalMs)!=null?s:50,o=0,r=()=>{let l=document.getElementById("psetCol"),c=document.getElementById("psetToggleBtn"),u=document.getElementById("knowledgeToggleBtn"),d=document.getElementById("rightSidebarCol"),h=!!window.__psetDrawerPayload||!!document.getElementById("pset-drawer-payload");if(l&&c&&u&&d&&h){i();return}o+=1,orequestAnimationFrame(r))}function Sm(){let i=document.getElementById("psetCol"),t=document.getElementById("psetToggleBtn"),e=document.getElementById("knowledgeToggleBtn"),n=document.getElementById("psetClose"),o=document.getElementById("rightSidebarCol"),r=document.getElementById("psetList"),a=document.getElementById("psetSearch"),s=document.querySelector(".pset-filter-row"),l=document.getElementById("sortSelect"),c=document.getElementById("algoFilterSelect"),u=document.getElementById("unsolvedFilter"),d=document.getElementById("psetSearchClear");if(!i||!t||!e||!o||!r||i.getAttribute(hs)==="1")return;let h="pset_view_mode",v=localStorage.getItem(h)||"sectioned",w=[],k=null,L=[],H=[],_=-1,M=null,A=!0;function D(){return v==="flat"&&k!=null?k:r}function $(J,U){var je;let Se=U.offsetTop-J.clientHeight/2+U.clientHeight/2;(je=J.scrollTo)==null||je.call(J,{top:Se,behavior:"smooth"})}function q(){var Se;let J=D();if(!J)return;let U=J.querySelector(".pset-item.pset-item--active");if(!U&&v==="sectioned"){let je=(Se=r.querySelector(".pset-item.pset-item--active"))==null?void 0:Se.closest(".section");je&&(U=je.querySelector(".section__header"))}U&&$(J,U)}let K=()=>document.body.classList.contains("pset-drawer-open"),ee=()=>{document.body.classList.add("pset-drawer-open"),i.setAttribute("aria-hidden","false"),o.setAttribute("aria-hidden","true"),requestAnimationFrame(q),window.dispatchEvent(new CustomEvent("pset-drawer-opened"))},R=()=>{document.body.classList.remove("pset-drawer-open"),i.setAttribute("aria-hidden","true"),o.setAttribute("aria-hidden","false"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("pset-drawer-closed"))},330)};function N(){let J=D();J==null||J.querySelectorAll(".pset-item--focus").forEach(U=>U.classList.remove("pset-item--focus")),M&&window.clearTimeout(M),M=null}function Y(){let J=D();if(!J)return;let U=v==="sectioned";if(L=[...Array.from(J.querySelectorAll(".pset-item")).map(ke=>{var Me,rt;return{el:ke,title:(((Me=ke.querySelector(".pset-item__title"))==null?void 0:Me.textContent)||"").trim(),titleLower:(((rt=ke.querySelector(".pset-item__title"))==null?void 0:rt.textContent)||"").trim().toLowerCase()}})],U){let ke=Array.from(r.querySelectorAll(".mysection__title")).map(Me=>({el:Me.closest(".section__header"),title:(Me.textContent||"").trim(),titleLower:(Me.textContent||"").trim().toLowerCase()}));L.push(...ke)}}function te(J,U=!1){let Se=D();if(!Se)return;let je=J.trim().toLowerCase();if(N(),!je){H=[],_=-1;return}if((H.length===0||!U)&&(H=L.filter(Me=>Me.titleLower.includes(je)).map(Me=>Me.el)),!H.length){_=-1;return}_=U?(_+1)%H.length:0;let ke=H[_];$(Se,ke),ke.classList.add("pset-item--focus"),M=window.setTimeout(()=>ke.classList.remove("pset-item--focus"),1500)}function ve(){w=Array.from(r.querySelectorAll(".pset-item")).map((U,Se)=>{var Me;let je=U.dataset.difficulty||"",ke=je!==""&&Number.isFinite(parseFloat(je))?parseFloat(je):null;return{el:U,title:(((Me=U.querySelector(".pset-item__title"))==null?void 0:Me.textContent)||"").trim(),tags:(U.dataset.tags||"").split(",").filter(Boolean).map(rt=>rt.trim()),difficulty:ke,accepted:U.classList.contains("pset-item--ac"),origIndex:Se}})}function ne(){let J=((c==null?void 0:c.value)||"").trim(),U=(u==null?void 0:u.checked)||!1,Se=w.filter(ke=>{let Me=!J||ke.tags.some($e=>$e.toLowerCase()===J.toLowerCase()),rt=!U||!ke.accepted;return Me&&rt}),je=(l==null?void 0:l.value)||"diff-asc";return Se.sort((ke,Me)=>{if(je==="section")return ke.origIndex-Me.origIndex;let rt=ke.difficulty,$e=Me.difficulty;return rt===null&&$e===null?ke.origIndex-Me.origIndex:rt===null?1:$e===null?-1:je==="diff-desc"?$e-rt||ke.origIndex-Me.origIndex:rt-$e||ke.origIndex-Me.origIndex}),Se}function pe(){if(!k){k=document.createElement("div"),k.id="psetFlatList",k.className="pset-list";let Se=document.createElement("ul");Se.className="pset-ul",k.appendChild(Se),r.insertAdjacentElement("afterend",k)}let J=ne(),U=k.querySelector(".pset-ul");if(U.innerHTML="",J.length===0)U.innerHTML='\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u9898\u76EE\u3002
';else{let Se=document.createDocumentFragment();J.forEach(je=>Se.appendChild(je.el.cloneNode(!0))),U.appendChild(Se)}}function G(){v="sectioned",localStorage.setItem(h,v),r.style.display="",k&&(k.style.display="none"),s&&(s.style.display="none"),Y()}function Ee(){if(v="flat",localStorage.setItem(h,v),l&&l.value==="section"&&(l.value="diff-asc"),A&&c){let J=r.querySelector(".pset-item.pset-item--active");if(J){let U=(J.dataset.tags||"").split(",").map(Se=>Se.trim()).filter(Boolean);if(U.length>0){let Se=Array.from(c.options).map(ke=>ke.value),je=U.find(ke=>Se.includes(ke));je&&(c.value=je)}}A=!1}s&&(s.style.display="flex"),pe(),k&&(k.style.display=""),r.style.display="none",Y()}s&&(s.style.display="none"),R(),t.addEventListener("click",()=>{let J=K();J&&v==="sectioned"?R():(G(),J?requestAnimationFrame(q):ee())}),e.addEventListener("click",()=>{let J=K();J&&v==="flat"?R():(Ee(),J?requestAnimationFrame(q):ee())}),n==null||n.addEventListener("click",R),document.addEventListener("keydown",J=>{J.key==="Escape"&&K()&&R()}),a==null||a.addEventListener("input",()=>te(a.value,!1)),a==null||a.addEventListener("keydown",J=>{J.key==="Enter"?(J.preventDefault(),te(a.value,!0)):J.key==="Escape"&&a&&(a.value="",N(),H=[],_=-1)}),d==null||d.addEventListener("click",()=>{a&&(a.value="",a.focus(),N(),H=[],_=-1)}),r.addEventListener("click",J=>{let U=J.target.closest(".section__header");U&&r.contains(U)&&$(r,U)}),ve(),v==="flat"?Ee():G();let Je=()=>{v==="flat"&&(pe(),Y())};[l,c,u].forEach(J=>J==null?void 0:J.addEventListener("change",Je)),i.setAttribute(hs,"1")}(0,Hr.addPage)(new Hr.NamedPage(["problem_detail","contest_detail_problem"],async()=>{try{Mm(()=>{_m(),Sm()})}catch(i){console.error("\u521D\u59CB\u5316 pset-drawer \u5931\u8D25:",i)}}));var Le=ae(re()),jm=7*1e3,Am=2e3,gs=-1,vs="",Lo=[],Im=5,wi=null,_o=null,Pr=null,bs=!1,Dr=null,Hm=1e4;function $r(){let i=(0,Le.$)("#wechatLogin");return i.length>0&&i.is(":visible")}function Br(){Pr&&(clearInterval(Pr),Pr=null)}function Pm(){Br(),Pr=setInterval(()=>{if(!$r()){Br();return}ki({force:!0})},jm)}function Nr(i=!1){wi&&(clearInterval(wi),wi=null),_o&&(clearTimeout(_o),_o=null),i&&(Lo=[])}function Dm(i){Nr(),$r()&&(wi=setInterval(async()=>{if(!$r()){Nr(!0);return}let t=new Set,e=[];for(let n of[vs,...Lo])n&&!t.has(n)&&(t.add(n),e.push(n));if(e.length)for(let n of e){let{ok:o}=await Le.request.get(`/wechat/check_scan?state=${encodeURIComponent(n)}`);if(o){window.location.href=`/oauth/wechat/callback?state=${encodeURIComponent(n)}`;return}}},1e3),_o=setTimeout(()=>{_o=null,wi&&(clearInterval(wi),wi=null)},i))}function xs(){Dr&&(clearTimeout(Dr),Dr=null)}function Yc(){let i=(0,Le.$)("#qrcode");if(!i.length||(0,Le.$)("#wechat-qr-load-hint").length)return;let t=(0,Le.$)('
'),e=(0,Le.$)(`${(0,Le.i18n)("WechatQrRetry")} `);i.after(e),i.after(t),(0,Le.$)("#wechat-qr-retry").on("click",()=>{ki({force:!0})})}function Vc(i){xs(),Yc(),(0,Le.$)("#wechat-qr-load-hint").text(i).show(),(0,Le.$)("#wechat-qr-retry").show()}function ys(){xs(),(0,Le.$)("#wechat-qr-load-hint").hide().empty(),(0,Le.$)("#wechat-qr-retry").hide()}function $m(){let i=(0,Le.$)("#qrcode");!i.length||i.data("wechatQrBound")||(i.data("wechatQrBound",!0),Yc(),i.on("load.wechatqr",()=>{ys()}),i.on("error.wechatqr",()=>{Vc((0,Le.i18n)("WechatQrImageLoadFailed")),Le.Notification.warn((0,Le.i18n)("WechatQrImageLoadFailed"))}))}async function ki(i={}){var n;let t=(n=i.force)!=null?n:!1;if(!$r()){Br(),Nr(!0);return}let e=Date.now();if(!(!t&&gs!==-1&&e-gs{let l=a[0];l!=null&&l.src&&(!l.complete||l.naturalWidth===0)&&Vc((0,Le.i18n)("WechatQrLoadTimeout"))},Hm);let s=vs;if(vs=o,s&&s!==o)for(Lo.push(s);Lo.length>Im;)Lo.shift();Dm(6e5),gs=Date.now(),Pm()}catch(o){Le.Notification.error("\u83B7\u53D6\u4E8C\u7EF4\u7801\u5931\u8D25")}finally{bs=!1}}}(0,Le.addPage)(new Le.NamedPage(["user_login"],async()=>{(0,Le.$)(".dialog--signin").remove(),setTimeout(()=>{ki({force:!0})},100),(0,Le.$)(document).on("click","#wechatButton",async()=>{ki({force:!0})})}));(0,Le.addPage)(new Le.AutoloadPage(["signinDialogPage"],async()=>{console.log("Signin dialog page loaded"),(0,Le.$)(".nav__item--round").remove();let i=(0,Le.$)('a[href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Fp"]');i.length&&i.attr("href","/pset");let t=(0,Le.$)(".dialog--signin[data-wechat-login-signin]");t.length>1&&t.slice(1).remove(),t.length&&(0,Le.$)(".dialog--signin").not("[data-wechat-login-signin]").remove();let e=(0,Le.$)(".dialog--signin");e.on("vjDomDialogShow",()=>{setTimeout(()=>{ki({force:!0})},100)}),e.on("vjDomDialogHidden",()=>{Br(),Nr(!0)}),(0,Le.$)(document).on("click",".wechat-button",async()=>{setTimeout(()=>void ki({force:!0}),100)}),(0,Le.$)(document).on("click","#refresh",async()=>{try{await ki({force:!0})}catch(n){console.error("Error fetching QR code:",n)}})}));var De=ae(re());function Bm(){let i=De._.map((0,De.$)('tbody [data-checkbox-group="problem"]:checked'),t=>(0,De.$)(t).closest("tr").attr("data-pid"));return i.length===0?(De.Notification.error((0,De.i18n)("Please select at least one problem to perform this operation.")),null):i}async function Jc(i){let e=Bm().join(",");await De.request.get(`${window.location.origin}/limit_problems?pids=${e}&read_limit=${i}`),i?De.Notification.success((0,De.i18n)("LimitProblemTip")):De.Notification.success((0,De.i18n)("UnLimitProblemTip"))}(0,De.addPage)(new De.NamedPage(["problem_main"],async()=>{(0,De.$)('[name="limit_selected_problems"]').click(async()=>{await Jc(!0)}),(0,De.$)('[name="unlimit_selected_problems"]').click(async()=>{await Jc(!1)})}));(0,De.addPage)(new De.NamedPage(["problem_detail"],async i=>{(0,De.$)(document).ready(function(){(0,De.$)("#p2psetDialog").appendTo("body")}),(0,De.$)("#vip_btn").click(function(){let t=(0,De.$)("#p2psetDialog");t.css("display")==="none"?(t.css("display","flex"),(0,De.$)(".footer").hide()):t.css("display","none")}),(0,De.$)("#remove_p2pset").click(function(){(0,De.$)("#p2psetDialog").css("display","none")}),(0,De.$)(".dialog").click(function(t){(0,De.$)("#p2psetDialog").css("display")!=="none"&&t.target===t.currentTarget&&(0,De.$)(this).css("display","none")}),(0,De.$)(document).on("keydown",t=>{t.keyCode===27&&(0,De.$)("#p2psetDialog").css("display","none")})}));var tt=ae(re());var Fr=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],ci={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(i){return typeof console<"u"&&console.warn(i)},getWeek:function(i){var t=new Date(i.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var e=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-e.getTime())/864e5-3+(e.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:" ",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:" ",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1};var Rr={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(i){var t=i%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},qr=Rr;var Pt=function(i,t){return t===void 0&&(t=2),("000"+i).slice(t*-1)},Xt=function(i){return i===!0?1:0};function ws(i,t){var e;return function(){var n=this,o=arguments;clearTimeout(e),e=setTimeout(function(){return i.apply(n,o)},t)}}var zr=function(i){return i instanceof Array?i:[i]};function Dt(i,t,e){if(e===!0)return i.classList.add(t);i.classList.remove(t)}function ze(i,t,e){var n=window.document.createElement(i);return t=t||"",e=e||"",n.className=t,e!==void 0&&(n.textContent=e),n}function Mo(i){for(;i.firstChild;)i.removeChild(i.firstChild)}function ks(i,t){if(t(i))return i;if(i.parentNode)return ks(i.parentNode,t)}function So(i,t){var e=ze("div","numInputWrapper"),n=ze("input","numInput "+i),o=ze("span","arrowUp"),r=ze("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?n.type="number":(n.type="text",n.pattern="\\d*"),t!==void 0)for(var a in t)n.setAttribute(a,t[a]);return e.appendChild(n),e.appendChild(o),e.appendChild(r),e}function Zt(i){try{if(typeof i.composedPath=="function"){var t=i.composedPath();return t[0]}return i.target}catch(e){return i.target}}var Ts=function(){},jo=function(i,t,e){return e.months[t?"shorthand":"longhand"][i]},Kc={D:Ts,F:function(i,t,e){i.setMonth(e.months.longhand.indexOf(t))},G:function(i,t){i.setHours((i.getHours()>=12?12:0)+parseFloat(t))},H:function(i,t){i.setHours(parseFloat(t))},J:function(i,t){i.setDate(parseFloat(t))},K:function(i,t,e){i.setHours(i.getHours()%12+12*Xt(new RegExp(e.amPM[1],"i").test(t)))},M:function(i,t,e){i.setMonth(e.months.shorthand.indexOf(t))},S:function(i,t){i.setSeconds(parseFloat(t))},U:function(i,t){return new Date(parseFloat(t)*1e3)},W:function(i,t,e){var n=parseInt(t),o=new Date(i.getFullYear(),0,2+(n-1)*7,0,0,0,0);return o.setDate(o.getDate()-o.getDay()+e.firstDayOfWeek),o},Y:function(i,t){i.setFullYear(parseFloat(t))},Z:function(i,t){return new Date(t)},d:function(i,t){i.setDate(parseFloat(t))},h:function(i,t){i.setHours((i.getHours()>=12?12:0)+parseFloat(t))},i:function(i,t){i.setMinutes(parseFloat(t))},j:function(i,t){i.setDate(parseFloat(t))},l:Ts,m:function(i,t){i.setMonth(parseFloat(t)-1)},n:function(i,t){i.setMonth(parseFloat(t)-1)},s:function(i,t){i.setSeconds(parseFloat(t))},u:function(i,t){return new Date(parseFloat(t))},w:Ts,y:function(i,t){i.setFullYear(2e3+parseFloat(t))}},Kn={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},Ri={Z:function(i){return i.toISOString()},D:function(i,t,e){return t.weekdays.shorthand[Ri.w(i,t,e)]},F:function(i,t,e){return jo(Ri.n(i,t,e)-1,!1,t)},G:function(i,t,e){return Pt(Ri.h(i,t,e))},H:function(i){return Pt(i.getHours())},J:function(i,t){return t.ordinal!==void 0?i.getDate()+t.ordinal(i.getDate()):i.getDate()},K:function(i,t){return t.amPM[Xt(i.getHours()>11)]},M:function(i,t){return jo(i.getMonth(),!0,t)},S:function(i){return Pt(i.getSeconds())},U:function(i){return i.getTime()/1e3},W:function(i,t,e){return e.getWeek(i)},Y:function(i){return Pt(i.getFullYear(),4)},d:function(i){return Pt(i.getDate())},h:function(i){return i.getHours()%12?i.getHours()%12:12},i:function(i){return Pt(i.getMinutes())},j:function(i){return i.getDate()},l:function(i,t){return t.weekdays.longhand[i.getDay()]},m:function(i){return Pt(i.getMonth()+1)},n:function(i){return i.getMonth()+1},s:function(i){return i.getSeconds()},u:function(i){return i.getTime()},w:function(i){return i.getDay()},y:function(i){return String(i.getFullYear()).substring(2)}};var Cs=function(i){var t=i.config,e=t===void 0?ci:t,n=i.l10n,o=n===void 0?Rr:n,r=i.isMobile,a=r===void 0?!1:r;return function(s,l,c){var u=c||o;return e.formatDate!==void 0&&!a?e.formatDate(s,l,u):l.split("").map(function(d,h,v){return Ri[d]&&v[h-1]!=="\\"?Ri[d](s,u,e):d!=="\\"?d:""}).join("")}},Or=function(i){var t=i.config,e=t===void 0?ci:t,n=i.l10n,o=n===void 0?Rr:n;return function(r,a,s,l){if(!(r!==0&&!r)){var c=l||o,u,d=r;if(r instanceof Date)u=new Date(r.getTime());else if(typeof r!="string"&&r.toFixed!==void 0)u=new Date(r);else if(typeof r=="string"){var h=a||(e||ci).dateFormat,v=String(r).trim();if(v==="today")u=new Date,s=!0;else if(e&&e.parseDate)u=e.parseDate(r,h);else if(/Z$/.test(v)||/GMT$/.test(v))u=new Date(r);else{for(var w=void 0,k=[],L=0,H=0,_="";LMath.min(t,e)&&i=0?new Date:new Date(e.config.minDate.getTime()),T=Wr(e.config);f.setHours(T.hours,T.minutes,T.seconds,f.getMilliseconds()),e.selectedDates=[f],e.latestSelectedDateObj=f}m!==void 0&&m.type!=="blur"&&io(m);var j=e._input.value;d(),Nt(),e._input.value!==j&&e._debouncedChange()}function c(m,f){return m%12+12*Xt(f===e.l10n.amPM[1])}function u(m){switch(m%24){case 0:case 12:return 12;default:return m%12}}function d(){if(!(e.hourElement===void 0||e.minuteElement===void 0)){var m=(parseInt(e.hourElement.value.slice(-2),10)||0)%24,f=(parseInt(e.minuteElement.value,10)||0)%60,T=e.secondElement!==void 0?(parseInt(e.secondElement.value,10)||0)%60:0;e.amPM!==void 0&&(m=c(m,e.amPM.textContent));var j=e.config.minTime!==void 0||e.config.minDate&&e.minDateHasTime&&e.latestSelectedDateObj&&en(e.latestSelectedDateObj,e.config.minDate,!0)===0,F=e.config.maxTime!==void 0||e.config.maxDate&&e.maxDateHasTime&&e.latestSelectedDateObj&&en(e.latestSelectedDateObj,e.config.maxDate,!0)===0;if(e.config.maxTime!==void 0&&e.config.minTime!==void 0&&e.config.minTime>e.config.maxTime){var W=Ur(e.config.minTime.getHours(),e.config.minTime.getMinutes(),e.config.minTime.getSeconds()),g=Ur(e.config.maxTime.getHours(),e.config.maxTime.getMinutes(),e.config.maxTime.getSeconds()),x=Ur(m,f,T);if(x>g&&x=12)]),e.secondElement!==void 0&&(e.secondElement.value=Pt(T)))}function w(m){var f=Zt(m),T=parseInt(f.value)+(m.delta||0);(T/1e3>1||m.key==="Enter"&&!/[^\d]/.test(T.toString()))&&$e(T)}function k(m,f,T,j){if(f instanceof Array)return f.forEach(function(F){return k(m,F,T,j)});if(m instanceof Array)return m.forEach(function(F){return k(F,f,T,j)});m.addEventListener(f,T,j),e._handlers.push({remove:function(){return m.removeEventListener(f,T,j)}})}function L(){Re("onChange")}function H(){if(e.config.wrap&&["open","close","toggle","clear"].forEach(function(T){Array.prototype.forEach.call(e.element.querySelectorAll("[data-"+T+"]"),function(j){return k(j,"click",e[T])})}),e.isMobile){mi();return}var m=ws(nn,50);if(e._debouncedChange=ws(L,Nm),e.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&k(e.daysContainer,"mouseover",function(T){e.config.mode==="range"&&pt(Zt(T))}),k(e._input,"keydown",Tt),e.calendarContainer!==void 0&&k(e.calendarContainer,"keydown",Tt),!e.config.inline&&!e.config.static&&k(window,"resize",m),window.ontouchstart!==void 0?k(window.document,"touchstart",rt):k(window.document,"mousedown",rt),k(window.document,"focus",rt,{capture:!0}),e.config.clickOpens===!0&&(k(e._input,"focus",e.open),k(e._input,"click",e.open)),e.daysContainer!==void 0&&(k(e.monthNav,"click",Rn),k(e.monthNav,["keyup","increment"],w),k(e.daysContainer,"click",rn)),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0){var f=function(T){return Zt(T).select()};k(e.timeContainer,["increment"],l),k(e.timeContainer,"blur",l,{capture:!0}),k(e.timeContainer,"click",M),k([e.hourElement,e.minuteElement],["focus","click"],f),e.secondElement!==void 0&&k(e.secondElement,"focus",function(){return e.secondElement&&e.secondElement.select()}),e.amPM!==void 0&&k(e.amPM,"click",function(T){l(T)})}e.config.allowInput&&k(e._input,"blur",vn)}function _(m,f){var T=m!==void 0?e.parseDate(m):e.latestSelectedDateObj||(e.config.minDate&&e.config.minDate>e.now?e.config.minDate:e.config.maxDate&&e.config.maxDate1),e.calendarContainer.appendChild(m);var F=e.config.appendTo!==void 0&&e.config.appendTo.nodeType!==void 0;if((e.config.inline||e.config.static)&&(e.calendarContainer.classList.add(e.config.inline?"inline":"static"),e.config.inline&&(!F&&e.element.parentNode?e.element.parentNode.insertBefore(e.calendarContainer,e._input.nextSibling):e.config.appendTo!==void 0&&e.config.appendTo.appendChild(e.calendarContainer)),e.config.static)){var W=ze("div","flatpickr-wrapper");e.element.parentNode&&e.element.parentNode.insertBefore(W,e.element),W.appendChild(e.element),e.altInput&&W.appendChild(e.altInput),W.appendChild(e.calendarContainer)}!e.config.static&&!e.config.inline&&(e.config.appendTo!==void 0?e.config.appendTo:window.document.body).appendChild(e.calendarContainer)}function $(m,f,T,j){var F=It(f,!0),W=ze("span",m,f.getDate().toString());return W.dateObj=f,W.$i=j,W.setAttribute("aria-label",e.formatDate(f,e.config.ariaDateFormat)),m.indexOf("hidden")===-1&&en(f,e.now)===0&&(e.todayDateElem=W,W.classList.add("today"),W.setAttribute("aria-current","date")),F?(W.tabIndex=-1,Be(f)&&(W.classList.add("selected"),e.selectedDateElem=W,e.config.mode==="range"&&(Dt(W,"startRange",e.selectedDates[0]&&en(f,e.selectedDates[0],!0)===0),Dt(W,"endRange",e.selectedDates[1]&&en(f,e.selectedDates[1],!0)===0),m==="nextMonthDay"&&W.classList.add("inRange")))):W.classList.add("flatpickr-disabled"),e.config.mode==="range"&&Bt(f)&&!Be(f)&&W.classList.add("inRange"),e.weekNumbers&&e.config.showMonths===1&&m!=="prevMonthDay"&&j%7===6&&e.weekNumbers.insertAdjacentHTML("beforeend",""+e.config.getWeek(f)+" "),Re("onDayCreate",W),W}function q(m){m.focus(),e.config.mode==="range"&&pt(m)}function K(m){for(var f=m>0?0:e.config.showMonths-1,T=m>0?e.config.showMonths:-1,j=f;j!=T;j+=m)for(var F=e.daysContainer.children[j],W=m>0?0:F.children.length-1,g=m>0?F.children.length:-1,x=W;x!=g;x+=m){var E=F.children[x];if(E.className.indexOf("hidden")===-1&&It(E.dateObj))return E}}function ee(m,f){for(var T=m.className.indexOf("Month")===-1?m.dateObj.getMonth():e.currentMonth,j=f>0?e.config.showMonths:-1,F=f>0?1:-1,W=T-e.currentMonth;W!=j;W+=F)for(var g=e.daysContainer.children[W],x=T-e.currentMonth===W?m.$i+f:f<0?g.children.length-1:0,E=g.children.length,C=x;C>=0&&C0?E:-1);C+=F){var P=g.children[C];if(P.className.indexOf("hidden")===-1&&It(P.dateObj)&&Math.abs(m.$i-C)>=Math.abs(f))return q(P)}e.changeMonth(F),R(K(F),0)}function R(m,f){var T=r(),j=_t(T||document.body),F=m!==void 0?m:j?T:e.selectedDateElem!==void 0&&_t(e.selectedDateElem)?e.selectedDateElem:e.todayDateElem!==void 0&&_t(e.todayDateElem)?e.todayDateElem:K(f>0?1:-1);F===void 0?e._input.focus():j?ee(F,f):q(F)}function N(m,f){for(var T=(new Date(m,f,1).getDay()-e.l10n.firstDayOfWeek+7)%7,j=e.utils.getDaysInMonth((f-1+12)%12,m),F=e.utils.getDaysInMonth(f,m),W=window.document.createDocumentFragment(),g=e.config.showMonths>1,x=g?"prevMonthDay hidden":"prevMonthDay",E=g?"nextMonthDay hidden":"nextMonthDay",C=j+1-T,P=0;C<=j;C++,P++)W.appendChild($("flatpickr-day "+x,new Date(m,f-1,C),C,P));for(C=1;C<=F;C++,P++)W.appendChild($("flatpickr-day",new Date(m,f,C),C,P));for(var O=F+1;O<=42-T&&(e.config.showMonths===1||P%7!==0);O++,P++)W.appendChild($("flatpickr-day "+E,new Date(m,f+1,O%F),O,P));var ie=ze("div","dayContainer");return ie.appendChild(W),ie}function Y(){if(e.daysContainer!==void 0){Mo(e.daysContainer),e.weekNumbers&&Mo(e.weekNumbers);for(var m=document.createDocumentFragment(),f=0;f1||e.config.monthSelectorType!=="dropdown")){var m=function(j){return e.config.minDate!==void 0&&e.currentYear===e.config.minDate.getFullYear()&&je.config.maxDate.getMonth())};e.monthsDropdownContainer.tabIndex=-1,e.monthsDropdownContainer.innerHTML="";for(var f=0;f<12;f++)if(m(f)){var T=ze("option","flatpickr-monthDropdown-month");T.value=new Date(e.currentYear,f).getMonth().toString(),T.textContent=jo(f,e.config.shorthandCurrentMonth,e.l10n),T.tabIndex=-1,e.currentMonth===f&&(T.selected=!0),e.monthsDropdownContainer.appendChild(T)}}}function ve(){var m=ze("div","flatpickr-month"),f=window.document.createDocumentFragment(),T;e.config.showMonths>1||e.config.monthSelectorType==="static"?T=ze("span","cur-month"):(e.monthsDropdownContainer=ze("select","flatpickr-monthDropdown-months"),e.monthsDropdownContainer.setAttribute("aria-label",e.l10n.monthAriaLabel),k(e.monthsDropdownContainer,"change",function(g){var x=Zt(g),E=parseInt(x.value,10);e.changeMonth(E-e.currentMonth),Re("onMonthChange")}),te(),T=e.monthsDropdownContainer);var j=So("cur-year",{tabindex:"-1"}),F=j.getElementsByTagName("input")[0];F.setAttribute("aria-label",e.l10n.yearAriaLabel),e.config.minDate&&F.setAttribute("min",e.config.minDate.getFullYear().toString()),e.config.maxDate&&(F.setAttribute("max",e.config.maxDate.getFullYear().toString()),F.disabled=!!e.config.minDate&&e.config.minDate.getFullYear()===e.config.maxDate.getFullYear());var W=ze("div","flatpickr-current-month");return W.appendChild(T),W.appendChild(j),f.appendChild(W),m.appendChild(f),{container:m,yearElement:F,monthElement:T}}function ne(){Mo(e.monthNav),e.monthNav.appendChild(e.prevMonthNav),e.config.showMonths&&(e.yearElements=[],e.monthElements=[]);for(var m=e.config.showMonths;m--;){var f=ve();e.yearElements.push(f.yearElement),e.monthElements.push(f.monthElement),e.monthNav.appendChild(f.container)}e.monthNav.appendChild(e.nextMonthNav)}function pe(){return e.monthNav=ze("div","flatpickr-months"),e.yearElements=[],e.monthElements=[],e.prevMonthNav=ze("span","flatpickr-prev-month"),e.prevMonthNav.innerHTML=e.config.prevArrow,e.nextMonthNav=ze("span","flatpickr-next-month"),e.nextMonthNav.innerHTML=e.config.nextArrow,ne(),Object.defineProperty(e,"_hidePrevMonthArrow",{get:function(){return e.__hidePrevMonthArrow},set:function(m){e.__hidePrevMonthArrow!==m&&(Dt(e.prevMonthNav,"flatpickr-disabled",m),e.__hidePrevMonthArrow=m)}}),Object.defineProperty(e,"_hideNextMonthArrow",{get:function(){return e.__hideNextMonthArrow},set:function(m){e.__hideNextMonthArrow!==m&&(Dt(e.nextMonthNav,"flatpickr-disabled",m),e.__hideNextMonthArrow=m)}}),e.currentYearElement=e.yearElements[0],cn(),e.monthNav}function G(){e.calendarContainer.classList.add("hasTime"),e.config.noCalendar&&e.calendarContainer.classList.add("noCalendar");var m=Wr(e.config);e.timeContainer=ze("div","flatpickr-time"),e.timeContainer.tabIndex=-1;var f=ze("span","flatpickr-time-separator",":"),T=So("flatpickr-hour",{"aria-label":e.l10n.hourAriaLabel});e.hourElement=T.getElementsByTagName("input")[0];var j=So("flatpickr-minute",{"aria-label":e.l10n.minuteAriaLabel});if(e.minuteElement=j.getElementsByTagName("input")[0],e.hourElement.tabIndex=e.minuteElement.tabIndex=-1,e.hourElement.value=Pt(e.latestSelectedDateObj?e.latestSelectedDateObj.getHours():e.config.time_24hr?m.hours:u(m.hours)),e.minuteElement.value=Pt(e.latestSelectedDateObj?e.latestSelectedDateObj.getMinutes():m.minutes),e.hourElement.setAttribute("step",e.config.hourIncrement.toString()),e.minuteElement.setAttribute("step",e.config.minuteIncrement.toString()),e.hourElement.setAttribute("min",e.config.time_24hr?"0":"1"),e.hourElement.setAttribute("max",e.config.time_24hr?"23":"12"),e.hourElement.setAttribute("maxlength","2"),e.minuteElement.setAttribute("min","0"),e.minuteElement.setAttribute("max","59"),e.minuteElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(T),e.timeContainer.appendChild(f),e.timeContainer.appendChild(j),e.config.time_24hr&&e.timeContainer.classList.add("time24hr"),e.config.enableSeconds){e.timeContainer.classList.add("hasSeconds");var F=So("flatpickr-second");e.secondElement=F.getElementsByTagName("input")[0],e.secondElement.value=Pt(e.latestSelectedDateObj?e.latestSelectedDateObj.getSeconds():m.seconds),e.secondElement.setAttribute("step",e.minuteElement.getAttribute("step")),e.secondElement.setAttribute("min","0"),e.secondElement.setAttribute("max","59"),e.secondElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(ze("span","flatpickr-time-separator",":")),e.timeContainer.appendChild(F)}return e.config.time_24hr||(e.amPM=ze("span","flatpickr-am-pm",e.l10n.amPM[Xt((e.latestSelectedDateObj?e.hourElement.value:e.config.defaultHour)>11)]),e.amPM.title=e.l10n.toggleTitle,e.amPM.tabIndex=-1,e.timeContainer.appendChild(e.amPM)),e.timeContainer}function Ee(){e.weekdayContainer?Mo(e.weekdayContainer):e.weekdayContainer=ze("div","flatpickr-weekdays");for(var m=e.config.showMonths;m--;){var f=ze("div","flatpickr-weekdaycontainer");e.weekdayContainer.appendChild(f)}return Je(),e.weekdayContainer}function Je(){if(e.weekdayContainer){var m=e.l10n.firstDayOfWeek,f=Zc(e.l10n.weekdays.shorthand);m>0&&m
`+f.join("")+`
`}}function J(){e.calendarContainer.classList.add("hasWeeks");var m=ze("div","flatpickr-weekwrapper");m.appendChild(ze("span","flatpickr-weekday",e.l10n.weekAbbreviation));var f=ze("div","flatpickr-weeks");return m.appendChild(f),{weekWrapper:m,weekNumbers:f}}function U(m,f){f===void 0&&(f=!0);var T=f?m:m-e.currentMonth;T<0&&e._hidePrevMonthArrow===!0||T>0&&e._hideNextMonthArrow===!0||(e.currentMonth+=T,(e.currentMonth<0||e.currentMonth>11)&&(e.currentYear+=e.currentMonth>11?1:-1,e.currentMonth=(e.currentMonth+12)%12,Re("onYearChange"),te()),Y(),Re("onMonthChange"),cn())}function Se(m,f){if(m===void 0&&(m=!0),f===void 0&&(f=!0),e.input.value="",e.altInput!==void 0&&(e.altInput.value=""),e.mobileInput!==void 0&&(e.mobileInput.value=""),e.selectedDates=[],e.latestSelectedDateObj=void 0,f===!0&&(e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth()),e.config.enableTime===!0){var T=Wr(e.config),j=T.hours,F=T.minutes,W=T.seconds;v(j,F,W)}e.redraw(),m&&Re("onChange")}function je(){e.isOpen=!1,e.isMobile||(e.calendarContainer!==void 0&&e.calendarContainer.classList.remove("open"),e._input!==void 0&&e._input.classList.remove("active")),Re("onClose")}function ke(){e.config!==void 0&&Re("onDestroy");for(var m=e._handlers.length;m--;)e._handlers[m].remove();if(e._handlers=[],e.mobileInput)e.mobileInput.parentNode&&e.mobileInput.parentNode.removeChild(e.mobileInput),e.mobileInput=void 0;else if(e.calendarContainer&&e.calendarContainer.parentNode)if(e.config.static&&e.calendarContainer.parentNode){var f=e.calendarContainer.parentNode;if(f.lastChild&&f.removeChild(f.lastChild),f.parentNode){for(;f.firstChild;)f.parentNode.insertBefore(f.firstChild,f);f.parentNode.removeChild(f)}}else e.calendarContainer.parentNode.removeChild(e.calendarContainer);e.altInput&&(e.input.type="text",e.altInput.parentNode&&e.altInput.parentNode.removeChild(e.altInput),delete e.altInput),e.input&&(e.input.type=e.input._type,e.input.classList.remove("flatpickr-input"),e.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(T){try{delete e[T]}catch(j){}})}function Me(m){return e.calendarContainer.contains(m)}function rt(m){if(e.isOpen&&!e.config.inline){var f=Zt(m),T=Me(f),j=f===e.input||f===e.altInput||e.element.contains(f)||m.path&&m.path.indexOf&&(~m.path.indexOf(e.input)||~m.path.indexOf(e.altInput)),F=!j&&!T&&!Me(m.relatedTarget),W=!e.config.ignoredFocusElements.some(function(g){return g.contains(f)});F&&W&&(e.config.allowInput&&e.setDate(e._input.value,!1,e.config.altInput?e.config.altFormat:e.config.dateFormat),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0&&e.input.value!==""&&e.input.value!==void 0&&l(),e.close(),e.config&&e.config.mode==="range"&&e.selectedDates.length===1&&e.clear(!1))}}function $e(m){if(!(!m||e.config.minDate&&me.config.maxDate.getFullYear())){var f=m,T=e.currentYear!==f;e.currentYear=f||e.currentYear,e.config.maxDate&&e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth=Math.min(e.config.maxDate.getMonth(),e.currentMonth):e.config.minDate&&e.currentYear===e.config.minDate.getFullYear()&&(e.currentMonth=Math.max(e.config.minDate.getMonth(),e.currentMonth)),T&&(e.redraw(),Re("onYearChange"),te())}}function It(m,f){var T;f===void 0&&(f=!0);var j=e.parseDate(m,void 0,f);if(e.config.minDate&&j&&en(j,e.config.minDate,f!==void 0?f:!e.minDateHasTime)<0||e.config.maxDate&&j&&en(j,e.config.maxDate,f!==void 0?f:!e.maxDateHasTime)>0)return!1;if(!e.config.enable&&e.config.disable.length===0)return!0;if(j===void 0)return!1;for(var F=!!e.config.enable,W=(T=e.config.enable)!==null&&T!==void 0?T:e.config.disable,g=0,x=void 0;g=x.from.getTime()&&j.getTime()<=x.to.getTime())return F}return!F}function _t(m){return e.daysContainer!==void 0?m.className.indexOf("hidden")===-1&&m.className.indexOf("flatpickr-disabled")===-1&&e.daysContainer.contains(m):!1}function vn(m){var f=m.target===e._input,T=e._input.value.trimEnd()!==fi();f&&T&&!(m.relatedTarget&&Me(m.relatedTarget))&&e.setDate(e._input.value,!0,m.target===e.altInput?e.config.altFormat:e.config.dateFormat)}function Tt(m){var f=Zt(m),T=e.config.wrap?i.contains(f):f===e._input,j=e.config.allowInput,F=e.isOpen&&(!j||!T),W=e.config.inline&&T&&!j;if(m.keyCode===13&&T){if(j)return e.setDate(e._input.value,!0,f===e.altInput?e.config.altFormat:e.config.dateFormat),e.close(),f.blur();e.open()}else if(Me(f)||F||W){var g=!!e.timeContainer&&e.timeContainer.contains(f);switch(m.keyCode){case 13:g?(m.preventDefault(),l(),Sn()):rn(m);break;case 27:m.preventDefault(),Sn();break;case 8:case 46:T&&!e.config.allowInput&&(m.preventDefault(),e.clear());break;case 37:case 39:if(!g&&!T){m.preventDefault();var x=r();if(e.daysContainer!==void 0&&(j===!1||x&&_t(x))){var E=m.keyCode===39?1:-1;m.ctrlKey?(m.stopPropagation(),U(E),R(K(1),0)):R(void 0,E)}}else e.hourElement&&e.hourElement.focus();break;case 38:case 40:m.preventDefault();var C=m.keyCode===40?1:-1;e.daysContainer&&f.$i!==void 0||f===e.input||f===e.altInput?m.ctrlKey?(m.stopPropagation(),$e(e.currentYear-C),R(K(1),0)):g||R(void 0,C*7):f===e.currentYearElement?$e(e.currentYear-C):e.config.enableTime&&(!g&&e.hourElement&&e.hourElement.focus(),l(m),e._debouncedChange());break;case 9:if(g){var P=[e.hourElement,e.minuteElement,e.secondElement,e.amPM].concat(e.pluginElements).filter(function(oe){return oe}),O=P.indexOf(f);if(O!==-1){var ie=P[O+(m.shiftKey?-1:1)];m.preventDefault(),(ie||e._input).focus()}}else!e.config.noCalendar&&e.daysContainer&&e.daysContainer.contains(f)&&m.shiftKey&&(m.preventDefault(),e._input.focus());break;default:break}}if(e.amPM!==void 0&&f===e.amPM)switch(m.key){case e.l10n.amPM[0].charAt(0):case e.l10n.amPM[0].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[0],d(),Nt();break;case e.l10n.amPM[1].charAt(0):case e.l10n.amPM[1].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[1],d(),Nt();break}(T||Me(f))&&Re("onKeyDown",m)}function pt(m,f){if(f===void 0&&(f="flatpickr-day"),!(e.selectedDates.length!==1||m&&(!m.classList.contains(f)||m.classList.contains("flatpickr-disabled")))){for(var T=m?m.dateObj.getTime():e.days.firstElementChild.dateObj.getTime(),j=e.parseDate(e.selectedDates[0],void 0,!0).getTime(),F=Math.min(T,e.selectedDates[0].getTime()),W=Math.max(T,e.selectedDates[0].getTime()),g=!1,x=0,E=0,C=F;CF&&Cx)?x=C:C>j&&(!E||C ."+f));P.forEach(function(O){var ie=O.dateObj,oe=ie.getTime(),ye=x>0&&oe0&&oe>E;if(ye){O.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Ge){O.classList.remove(Ge)});return}else if(g&&!ye)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Ge){O.classList.remove(Ge)}),m!==void 0&&(m.classList.add(T<=e.selectedDates[0].getTime()?"startRange":"endRange"),jT&&oe===j&&O.classList.add("endRange"),oe>=x&&(E===0||oe<=E)&&Qc(oe,j,T)&&O.classList.add("inRange"))})}}function nn(){e.isOpen&&!e.config.static&&!e.config.inline&&Nn()}function on(m,f){if(f===void 0&&(f=e._positionElement),e.isMobile===!0){if(m){m.preventDefault();var T=Zt(m);T&&T.blur()}e.mobileInput!==void 0&&(e.mobileInput.focus(),e.mobileInput.click()),Re("onOpen");return}else if(e._input.disabled||e.config.inline)return;var j=e.isOpen;e.isOpen=!0,j||(e.calendarContainer.classList.add("open"),e._input.classList.add("active"),Re("onOpen"),Nn(f)),e.config.enableTime===!0&&e.config.noCalendar===!0&&e.config.allowInput===!1&&(m===void 0||!e.timeContainer.contains(m.relatedTarget))&&setTimeout(function(){return e.hourElement.select()},50)}function Bn(m){return function(f){var T=e.config["_"+m+"Date"]=e.parseDate(f,e.config.dateFormat),j=e.config["_"+(m==="min"?"max":"min")+"Date"];T!==void 0&&(e[m==="min"?"minDateHasTime":"maxDateHasTime"]=T.getHours()>0||T.getMinutes()>0||T.getSeconds()>0),e.selectedDates&&(e.selectedDates=e.selectedDates.filter(function(F){return It(F)}),!e.selectedDates.length&&m==="min"&&h(T),Nt()),e.daysContainer&&(Ct(),T!==void 0?e.currentYearElement[m]=T.getFullYear().toString():e.currentYearElement.removeAttribute(m),e.currentYearElement.disabled=!!j&&T!==void 0&&j.getFullYear()===T.getFullYear())}}function eo(){var m=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],f=$t($t({},JSON.parse(JSON.stringify(i.dataset||{}))),t),T={};e.config.parseDate=f.parseDate,e.config.formatDate=f.formatDate,Object.defineProperty(e.config,"enable",{get:function(){return e.config._enable},set:function(P){e.config._enable=Si(P)}}),Object.defineProperty(e.config,"disable",{get:function(){return e.config._disable},set:function(P){e.config._disable=Si(P)}});var j=f.mode==="time";if(!f.dateFormat&&(f.enableTime||j)){var F=yt.defaultConfig.dateFormat||ci.dateFormat;T.dateFormat=f.noCalendar||j?"H:i"+(f.enableSeconds?":S":""):F+" H:i"+(f.enableSeconds?":S":"")}if(f.altInput&&(f.enableTime||j)&&!f.altFormat){var W=yt.defaultConfig.altFormat||ci.altFormat;T.altFormat=f.noCalendar||j?"h:i"+(f.enableSeconds?":S K":" K"):W+(" h:i"+(f.enableSeconds?":S":"")+" K")}Object.defineProperty(e.config,"minDate",{get:function(){return e.config._minDate},set:Bn("min")}),Object.defineProperty(e.config,"maxDate",{get:function(){return e.config._maxDate},set:Bn("max")});var g=function(P){return function(O){e.config[P==="min"?"_minTime":"_maxTime"]=e.parseDate(O,"H:i:S")}};Object.defineProperty(e.config,"minTime",{get:function(){return e.config._minTime},set:g("min")}),Object.defineProperty(e.config,"maxTime",{get:function(){return e.config._maxTime},set:g("max")}),f.mode==="time"&&(e.config.noCalendar=!0,e.config.enableTime=!0),Object.assign(e.config,T,f);for(var x=0;x-1?e.config[C]=zr(E[C]).map(a).concat(e.config[C]):typeof f[C]>"u"&&(e.config[C]=E[C])}f.altInputClass||(e.config.altInputClass=_i().className+" "+e.config.altInputClass),Re("onParseConfig")}function _i(){return e.config.wrap?i.querySelector("[data-input]"):i}function me(){typeof e.config.locale!="object"&&typeof yt.l10ns[e.config.locale]>"u"&&e.config.errorHandler(new Error("flatpickr: invalid locale "+e.config.locale)),e.l10n=$t($t({},yt.l10ns.default),typeof e.config.locale=="object"?e.config.locale:e.config.locale!=="default"?yt.l10ns[e.config.locale]:void 0),Kn.D="("+e.l10n.weekdays.shorthand.join("|")+")",Kn.l="("+e.l10n.weekdays.longhand.join("|")+")",Kn.M="("+e.l10n.months.shorthand.join("|")+")",Kn.F="("+e.l10n.months.longhand.join("|")+")",Kn.K="("+e.l10n.amPM[0]+"|"+e.l10n.amPM[1]+"|"+e.l10n.amPM[0].toLowerCase()+"|"+e.l10n.amPM[1].toLowerCase()+")";var m=$t($t({},t),JSON.parse(JSON.stringify(i.dataset||{})));m.time_24hr===void 0&&yt.defaultConfig.time_24hr===void 0&&(e.config.time_24hr=e.l10n.time_24hr),e.formatDate=Cs(e),e.parseDate=Or({config:e.config,l10n:e.l10n})}function Nn(m){if(typeof e.config.position=="function")return void e.config.position(e,m);if(e.calendarContainer!==void 0){Re("onPreCalendarPosition");var f=m||e._positionElement,T=Array.prototype.reduce.call(e.calendarContainer.children,function(Ut,yn){return Ut+yn.offsetHeight},0),j=e.calendarContainer.offsetWidth,F=e.config.position.split(" "),W=F[0],g=F.length>1?F[1]:null,x=f.getBoundingClientRect(),E=window.innerHeight-x.bottom,C=W==="above"||W!=="below"&&ET,P=window.pageYOffset+x.top+(C?-T-2:f.offsetHeight+2);if(Dt(e.calendarContainer,"arrowTop",!C),Dt(e.calendarContainer,"arrowBottom",C),!e.config.inline){var O=window.pageXOffset+x.left,ie=!1,oe=!1;g==="center"?(O-=(j-x.width)/2,ie=!0):g==="right"&&(O-=j-x.width,oe=!0),Dt(e.calendarContainer,"arrowLeft",!ie&&!oe),Dt(e.calendarContainer,"arrowCenter",ie),Dt(e.calendarContainer,"arrowRight",oe);var ye=window.document.body.offsetWidth-(window.pageXOffset+x.right),Ge=O+j>window.document.body.offsetWidth,We=ye+j>window.document.body.offsetWidth;if(Dt(e.calendarContainer,"rightMost",Ge),!e.config.static)if(e.calendarContainer.style.top=P+"px",!Ge)e.calendarContainer.style.left=O+"px",e.calendarContainer.style.right="auto";else if(!We)e.calendarContainer.style.left="auto",e.calendarContainer.style.right=ye+"px";else{var st=to();if(st===void 0)return;var lt=window.document.body.offsetWidth,Ft=Math.max(0,lt/2-j/2),Mt=".flatpickr-calendar.centerMost:before",dn=".flatpickr-calendar.centerMost:after",An=st.cssRules.length,an="{left:"+x.left+"px;right:auto;}";Dt(e.calendarContainer,"rightMost",!1),Dt(e.calendarContainer,"centerMost",!0),st.insertRule(Mt+","+dn+an,An),e.calendarContainer.style.left=Ft+"px",e.calendarContainer.style.right="auto"}}}}function to(){for(var m=null,f=0;fe.currentMonth+e.config.showMonths-1)&&e.config.mode!=="range";if(e.selectedDateElem=j,e.config.mode==="single")e.selectedDates=[F];else if(e.config.mode==="multiple"){var g=Be(F);g?e.selectedDates.splice(parseInt(g),1):e.selectedDates.push(F)}else e.config.mode==="range"&&(e.selectedDates.length===2&&e.clear(!1,!1),e.latestSelectedDateObj=F,e.selectedDates.push(F),en(F,e.selectedDates[0],!0)!==0&&e.selectedDates.sort(function(P,O){return P.getTime()-O.getTime()}));if(d(),W){var x=e.currentYear!==F.getFullYear();e.currentYear=F.getFullYear(),e.currentMonth=F.getMonth(),x&&(Re("onYearChange"),te()),Re("onMonthChange")}if(cn(),Y(),Nt(),!W&&e.config.mode!=="range"&&e.config.showMonths===1?q(j):e.selectedDateElem!==void 0&&e.hourElement===void 0&&e.selectedDateElem&&e.selectedDateElem.focus(),e.hourElement!==void 0&&e.hourElement!==void 0&&e.hourElement.focus(),e.config.closeOnSelect){var E=e.config.mode==="single"&&!e.config.enableTime,C=e.config.mode==="range"&&e.selectedDates.length===2&&!e.config.enableTime;(E||C)&&Sn()}L()}}var jn={locale:[me,Je],showMonths:[ne,s,Ee],minDate:[_],maxDate:[_],positionElement:[ui],clickOpens:[function(){e.config.clickOpens===!0?(k(e._input,"focus",e.open),k(e._input,"click",e.open)):(e._input.removeEventListener("focus",e.open),e._input.removeEventListener("click",e.open))}]};function Ht(m,f){if(m!==null&&typeof m=="object"){Object.assign(e.config,m);for(var T in m)jn[T]!==void 0&&jn[T].forEach(function(j){return j()})}else e.config[m]=f,jn[m]!==void 0?jn[m].forEach(function(j){return j()}):Fr.indexOf(m)>-1&&(e.config[m]=zr(f));e.redraw(),Nt(!0)}function Mi(m,f){var T=[];if(m instanceof Array)T=m.map(function(j){return e.parseDate(j,f)});else if(m instanceof Date||typeof m=="number")T=[e.parseDate(m,f)];else if(typeof m=="string")switch(e.config.mode){case"single":case"time":T=[e.parseDate(m,f)];break;case"multiple":T=m.split(e.config.conjunction).map(function(j){return e.parseDate(j,f)});break;case"range":T=m.split(e.l10n.rangeSeparator).map(function(j){return e.parseDate(j,f)});break;default:break}else e.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(m)));e.selectedDates=e.config.allowInvalidPreload?T:T.filter(function(j){return j instanceof Date&&It(j,!1)}),e.config.mode==="range"&&e.selectedDates.sort(function(j,F){return j.getTime()-F.getTime()})}function Fn(m,f,T){if(f===void 0&&(f=!1),T===void 0&&(T=e.config.dateFormat),m!==0&&!m||m instanceof Array&&m.length===0)return e.clear(f);Mi(m,T),e.latestSelectedDateObj=e.selectedDates[e.selectedDates.length-1],e.redraw(),_(void 0,f),h(),e.selectedDates.length===0&&e.clear(!1),Nt(f),f&&Re("onChange")}function Si(m){return m.slice().map(function(f){return typeof f=="string"||typeof f=="number"||f instanceof Date?e.parseDate(f,void 0,!0):f&&typeof f=="object"&&f.from&&f.to?{from:e.parseDate(f.from,void 0),to:e.parseDate(f.to,void 0)}:f}).filter(function(f){return f})}function pi(){e.selectedDates=[],e.now=e.parseDate(e.config.now)||new Date;var m=e.config.defaultDate||((e.input.nodeName==="INPUT"||e.input.nodeName==="TEXTAREA")&&e.input.placeholder&&e.input.value===e.input.placeholder?null:e.input.value);m&&Mi(m,e.config.dateFormat),e._initialDate=e.selectedDates.length>0?e.selectedDates[0]:e.config.minDate&&e.config.minDate.getTime()>e.now.getTime()?e.config.minDate:e.config.maxDate&&e.config.maxDate.getTime()0&&(e.latestSelectedDateObj=e.selectedDates[0]),e.config.minTime!==void 0&&(e.config.minTime=e.parseDate(e.config.minTime,"H:i")),e.config.maxTime!==void 0&&(e.config.maxTime=e.parseDate(e.config.maxTime,"H:i")),e.minDateHasTime=!!e.config.minDate&&(e.config.minDate.getHours()>0||e.config.minDate.getMinutes()>0||e.config.minDate.getSeconds()>0),e.maxDateHasTime=!!e.config.maxDate&&(e.config.maxDate.getHours()>0||e.config.maxDate.getMinutes()>0||e.config.maxDate.getSeconds()>0)}function no(){if(e.input=_i(),!e.input){e.config.errorHandler(new Error("Invalid input element specified"));return}e.input._type=e.input.type,e.input.type="text",e.input.classList.add("flatpickr-input"),e._input=e.input,e.config.altInput&&(e.altInput=ze(e.input.nodeName,e.config.altInputClass),e._input=e.altInput,e.altInput.placeholder=e.input.placeholder,e.altInput.disabled=e.input.disabled,e.altInput.required=e.input.required,e.altInput.tabIndex=e.input.tabIndex,e.altInput.type="text",e.input.setAttribute("type","hidden"),!e.config.static&&e.input.parentNode&&e.input.parentNode.insertBefore(e.altInput,e.input.nextSibling)),e.config.allowInput||e._input.setAttribute("readonly","readonly"),ui()}function ui(){e._positionElement=e.config.positionElement||e._input}function mi(){var m=e.config.enableTime?e.config.noCalendar?"time":"datetime-local":"date";e.mobileInput=ze("input",e.input.className+" flatpickr-mobile"),e.mobileInput.tabIndex=1,e.mobileInput.type=m,e.mobileInput.disabled=e.input.disabled,e.mobileInput.required=e.input.required,e.mobileInput.placeholder=e.input.placeholder,e.mobileFormatStr=m==="datetime-local"?"Y-m-d\\TH:i:S":m==="date"?"Y-m-d":"H:i:S",e.selectedDates.length>0&&(e.mobileInput.defaultValue=e.mobileInput.value=e.formatDate(e.selectedDates[0],e.mobileFormatStr)),e.config.minDate&&(e.mobileInput.min=e.formatDate(e.config.minDate,"Y-m-d")),e.config.maxDate&&(e.mobileInput.max=e.formatDate(e.config.maxDate,"Y-m-d")),e.input.getAttribute("step")&&(e.mobileInput.step=String(e.input.getAttribute("step"))),e.input.type="hidden",e.altInput!==void 0&&(e.altInput.type="hidden");try{e.input.parentNode&&e.input.parentNode.insertBefore(e.mobileInput,e.input.nextSibling)}catch(f){}k(e.mobileInput,"change",function(f){e.setDate(Zt(f).value,!1,e.mobileFormatStr),Re("onChange"),Re("onClose")})}function ji(m){if(e.isOpen===!0)return e.close();e.open(m)}function Re(m,f){if(e.config!==void 0){var T=e.config[m];if(T!==void 0&&T.length>0)for(var j=0;T[j]&&j=0&&en(m,e.selectedDates[1])<=0}function cn(){e.config.noCalendar||e.isMobile||!e.monthNav||(e.yearElements.forEach(function(m,f){var T=new Date(e.currentYear,e.currentMonth,1);T.setMonth(e.currentMonth+f),e.config.showMonths>1||e.config.monthSelectorType==="static"?e.monthElements[f].textContent=jo(T.getMonth(),e.config.shorthandCurrentMonth,e.l10n)+" ":e.monthsDropdownContainer.value=T.getMonth().toString(),m.value=T.getFullYear().toString()}),e._hidePrevMonthArrow=e.config.minDate!==void 0&&(e.currentYear===e.config.minDate.getFullYear()?e.currentMonth<=e.config.minDate.getMonth():e.currentYeare.config.maxDate.getMonth():e.currentYear>e.config.maxDate.getFullYear()))}function fi(m){var f=m||(e.config.altInput?e.config.altFormat:e.config.dateFormat);return e.selectedDates.map(function(T){return e.formatDate(T,f)}).filter(function(T,j,F){return e.config.mode!=="range"||e.config.enableTime||F.indexOf(T)===j}).join(e.config.mode!=="range"?e.config.conjunction:e.l10n.rangeSeparator)}function Nt(m){m===void 0&&(m=!0),e.mobileInput!==void 0&&e.mobileFormatStr&&(e.mobileInput.value=e.latestSelectedDateObj!==void 0?e.formatDate(e.latestSelectedDateObj,e.mobileFormatStr):""),e.input.value=fi(e.config.dateFormat),e.altInput!==void 0&&(e.altInput.value=fi(e.config.altFormat)),m!==!1&&Re("onValueUpdate")}function Rn(m){var f=Zt(m),T=e.prevMonthNav.contains(f),j=e.nextMonthNav.contains(f);T||j?U(T?-1:1):e.yearElements.indexOf(f)>=0?f.select():f.classList.contains("arrowUp")?e.changeYear(e.currentYear+1):f.classList.contains("arrowDown")&&e.changeYear(e.currentYear-1)}function io(m){m.preventDefault();var f=m.type==="keydown",T=Zt(m),j=T;e.amPM!==void 0&&T===e.amPM&&(e.amPM.textContent=e.l10n.amPM[Xt(e.amPM.textContent===e.l10n.amPM[0])]);var F=parseFloat(j.getAttribute("min")),W=parseFloat(j.getAttribute("max")),g=parseFloat(j.getAttribute("step")),x=parseInt(j.value,10),E=m.delta||(f?m.which===38?1:-1:0),C=x+g*E;if(typeof j.value<"u"&&j.value.length===2){var P=j===e.hourElement,O=j===e.minuteElement;CW&&(C=j===e.hourElement?C-W-Xt(!e.amPM):F,O&&A(void 0,1,e.hourElement)),e.amPM&&P&&(g===1?C+x===23:Math.abs(C-x)>g)&&(e.amPM.textContent=e.l10n.amPM[Xt(e.amPM.textContent===e.l10n.amPM[0])]),j.value=Pt(C)}}return o(),e}function qi(i,t){for(var e=Array.prototype.slice.call(i).filter(function(a){return a instanceof HTMLElement}),n=[],o=0;o{i.length>0&&(Yr=i[0].getTime(),console.log("\u9009\u4E2D\u7684\u65F6\u95F4\u6233\uFF08\u6BEB\u79D2\uFF09:",Yr))}});async function Rm(i){let t=parseInt((0,tt.$)("#uid").val());if(!t){tt.Notification.error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684uid");return}let e=await tt.request.post("",{action:"postGetNameByUid",uid:t});e?(0,tt.$)("#name_by_uid").val(e):(0,tt.$)("#name_by_uid").val("\u7528\u6237\u4E0D\u5B58\u5728")}async function qm(i){let t=(0,tt.$)("#uname").val(),e=(0,tt.$)("#password").val();if(!t){tt.Notification.error("\u8BF7\u8F93\u5165\u7528\u6237\u540D");return}if(!e){tt.Notification.error("\u8BF7\u8F93\u5165\u5BC6\u7801");return}let n=await tt.request.post("",{action:"postSetPassword",uname:t,password:e});n.status?tt.Notification.success(n.message):tt.Notification.error(n.message)}async function zm(i){console.log("click",Yr);let t=(0,tt.$)("#minutes").val();if(!t){tt.Notification.error("\u8BF7\u8F93\u5165\u5206\u949F\u6570");return}if(!/^\d+$/.test(t)){tt.Notification.error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u5206\u949F\u6570");return}let e=await tt.request.post("",{action:"postSearchOrder",selectedStartTimeTimestamp:Yr,minutes:t});(0,tt.$)("#order").val(e)}(0,tt.addPage)(new tt.NamedPage(["reset_password_manage"],async()=>{(0,tt.$)("#search_name").click(i=>Rm(i)),(0,tt.$)("#set_password").click(i=>qm(i)),(0,tt.$)("#search_order").click(i=>zm(i))}));var ge=ae(re()),Ao=null,Gn=null,Qn=null;function Om(i=5){let t=(0,ge.$)("#todoDialog .acknowledge-button");if(t.length===0)return;let e=t.data("baseLabel");e||(e=(t.text()||"").replace(/\s*(\d+)|\s*\(\d+\)/g,""),e=e.trim()||(0,ge.i18n)("\u786E\u8BA4"),t.data("baseLabel",e)),Qn&&(clearInterval(Qn),Qn=null),t.prop("disabled",!0).addClass("disabled");let n=i,o=r=>t.text(`${e}\uFF08${r}\uFF09`);o(n),Qn=window.setInterval(()=>{n-=1,n>0?o(n):(clearInterval(Qn),Qn=null,t.prop("disabled",!1).removeClass("disabled"),t.text(e))},1e3)}function Es(){let i=(0,ge.$)("#todoDialog .acknowledge-button");if(i.length===0)return;Qn&&(clearInterval(Qn),Qn=null);let t=i.data("baseLabel")||(0,ge.i18n)("\u786E\u8BA4");i.prop("disabled",!1).removeClass("disabled").text(t)}async function td(i){let{data:t}=await ge.request.post("/api/markdownRender/endpoint",{content:i.content});(0,ge.$)("#todo-content").html(t),(0,ge.$)("#todoDialog").css("display","flex"),(0,ge.$)("#todoDialog-content").animate({opacity:1},300,function(){}),i.isImportant===!0&&i.status==="unread"?Om(5):Es()}async function nd(i){Gn=(0,ge.$)(i.currentTarget.closest(".todo-item")),Ao=Gn.data("uuid");let t=await ge.request.post("/api/todo/endpoint",{uuid:Ao,action:"get"});if(!t.status){ge.Notification.error((0,ge.i18n)(t.message));return}await td(t.data)}async function Um(){(0,ge.$)("#todoDialog-content").animate({opacity:0},200,function(){(0,ge.$)("#todoDialog").css("display","none"),Es()});let i=await ge.request.post("/api/todo/endpoint",{uuid:Ao,action:"read"});if(!i.status){ge.Notification.error((0,ge.i18n)(i.message));return}if(Gn===null){window.location.reload();return}let t=Gn.outerHeight(!0);Gn.animate({height:0,padding:0,margin:0,opacity:0},200,function(){let e=(0,ge.$)("#todo_section"),n=e.height()-t;e.animate({height:n},200,function(){Gn.remove(),ge.Notification.success((0,ge.i18n)("\u5DF2\u8BFB\u4E00\u6761\u5F85\u529E\u4E8B\u9879")),setTimeout(()=>{(0,ge.$)(".todo-item").length===0&&e.animate({height:0,padding:0,margin:0},200,function(){})},100)})})}async function id(){var t;let i=(0,ge.$)(".todo-item");for(let e of i.toArray()){let n=(0,ge.$)(e),o=n.data("uuid");if(o)try{let r=await ge.request.post("/api/todo/endpoint",{uuid:o,action:"get"});if(!r.status)continue;let a=r.data;if((((t=a==null?void 0:a.doc)==null?void 0:t.isImportant)===!0||(a==null?void 0:a.isImportant)===!0)&&a.status==="unread"){Gn=n,Ao=o,await td(a);break}}catch(r){continue}}}(0,ge.addPage)(new ge.NamedPage(["homepage"],async()=>{(0,ge.$)(document).ready(function(){(0,ge.$)("#todoDialog").appendTo("body"),(0,ge.$)(".todo-item__view-btn").on("click",i=>nd(i)),(0,ge.$)("#todoDialog").on("click",".acknowledge-button",Um),id()})}));async function Wm(){(0,ge.$)("#todoDialog-content").animate({opacity:0},200,function(){(0,ge.$)("#todoDialog").css("display","none"),Es()});let i=await ge.request.post("/api/todo/endpoint",{uuid:Ao,action:"read"});if(!i.status){ge.Notification.error((0,ge.i18n)(i.message));return}if(Gn===null){window.location.reload();return}Gn.find(".status-unread").removeClass("status-unread").addClass("status-read"),ge.Notification.success((0,ge.i18n)("\u5DF2\u8BFB\u4E00\u6761\u5F85\u529E\u4E8B\u9879"))}(0,ge.addPage)(new ge.NamedPage(["todo_page"],async()=>{(0,ge.$)(document).ready(function(){(0,ge.$)("#todoDialog").appendTo("body"),(0,ge.$)(".todo-item__view-btn").on("click",i=>nd(i)),(0,ge.$)("#todoDialog").on("click",".acknowledge-button",Wm),id()})}));var de=ae(re());function Ym(){let i=(0,de.$)(".plan");i.each(function(){(0,de.$)(this).on("click",function(){i.removeClass("active"),(0,de.$)(this).addClass("active");let t=(0,de.$)(this).find('input[type="radio"]');t.length&&t.prop("checked",!0);let e=(0,de.$)(this).attr("name")==="groupPlan",n=(0,de.$)('span[name="vip_type"]'),o=(0,de.$)('span[name="vip_price"]');n.length&&n.text(e?"\u62FC\u56E2 \u6C38\u4E45\u4F1A\u5458":"\u6C38\u4E45\u4F1A\u5458"),o.length&&o.text(e?"\xA5199":"\xA5256")})})}function Vm(){let i=(0,de.$)(".radio-row");if(!i.length)return;let t=i.find(".pay"),e=(0,de.$)(".order-line:nth-of-type(2) span:last-child");function n(o){if(t.each(function(){let r=this===o[0];(0,de.$)(this).toggleClass("selected",r);let a=(0,de.$)(this).find('input[type="radio"]');a.length&&a.prop("checked",r)}),e.length){let r=o.find("b").text().trim()||"";e.text(" "+r+" ")}}t.each(function(){(0,de.$)(this).on("click",function(){(0,de.$)(this).data("disabled")==="true"||(0,de.$)(this).hasClass("disabled")||n((0,de.$)(this))})})}function Jm(){let i=(0,de.$)("#tuanCard"),t=(0,de.$)("#tuanSteps"),e=(0,de.$)(".plan");if(!i.length||!e.length)return;function n(){i.prop("hidden")&&(i.prop("hidden",!1),i.css({opacity:"",transform:"",transition:""}),i.css({opacity:0,transform:"translateY(10px)",transition:"opacity 0.4s ease, transform 0.4s ease"}),requestAnimationFrame(()=>{i.css({opacity:1,transform:"translateY(0)"})}),t.length&&(t.removeClass("tuan-animate"),t[0].offsetWidth,t.addClass("tuan-animate")))}function o(){i.length&&(i.prop("hidden")||(i.removeClass("tuan-show"),t.length&&t.removeClass("tuan-animate"),i.css({transition:"opacity 0.4s ease, transform 0.4s ease",opacity:"1",transform:"translateY(0)"}),requestAnimationFrame(()=>{i.css({opacity:"0",transform:"translateY(8px)"})}),setTimeout(()=>{i.prop("hidden",!0),i.css({transition:"",transform:"",opacity:""})},400)))}e.each(function(){(0,de.$)(this).on("click",function(){((0,de.$)(this).find(".tag").text().replace(/\s+/g,"")||"").includes("\u62FC\u56E2")?n():o()})})}function Km(){let i="/buy/vip/m5",t="/buy/vip/s4",e=(0,de.$)("#tuanModal"),n=(0,de.$)("#normalPlanModal");if(!e.length)return;let o=e.find(".modal__dialog"),r=e.find(".modal__steps"),a=(0,de.$)("#tuanAckBtn"),s=(0,de.$)("#openTuanModal"),l=null;function c(){let v=(0,de.$)(".plan.active");if(!(v.length&&v.attr("name")==="groupPlan")){d();return}e.addClass("show"),(0,de.$)("body").addClass("no-scroll"),r.css("animation","none"),r[0].offsetWidth,r.css("animation","");let k=3;a.prop("disabled",!0),a.text(`\u6211\u5DF2\u77E5\u6653\u62FC\u56E2\u6D41\u7A0B (${k})`),clearInterval(l),l=setInterval(()=>{k-=1,k>0?a.text(`\u6211\u5DF2\u77E5\u6653\u62FC\u56E2\u6D41\u7A0B (${k})`):(a.text("\u6211\u5DF2\u77E5\u6653\u62FC\u56E2\u6D41\u7A0B,\u53BB\u5F00\u901A"),a.prop("disabled",!1),clearInterval(l))},1e3)}function u(){clearInterval(l),e.removeClass("show"),(0,de.$)("body").removeClass("no-scroll"),a.prop("disabled",!0),a.text("\u6211\u5DF2\u77E5\u6653\u62FC\u56E2\u6D41\u7A0B (3)")}async function d(){let v=(0,de.$)("#normalPlanQRImg"),w=v.parent(),k=(0,de.$)("#confirmNormalPayBtn");n.addClass("show"),n.attr("aria-hidden","false"),document.body.style.overflow="hidden";let L=n.find(".modal__dialog");L.css({opacity:"0",transform:"translateY(8px)"}),requestAnimationFrame(()=>{L.css({transition:"opacity .25s ease, transform .25s ease",opacity:"1",transform:"translateY(0)"})}),v.hide(),k.prop("disabled",!0),w.append(`
`);try{let M=await(await fetch("/buy/vip/s4")).text(),D=new DOMParser().parseFromString(M,"text/html"),$=D.querySelector(".image"),q=D.querySelector("#pay_button");if($&&q){let K=$.getAttribute("src"),ee=q.getAttribute("data-out_trade_no"),R=q.getAttribute("data-uid"),N=new Image;N.onload=()=>{w.find(".qrcode-loading").remove(),v.attr("src",K),v.fadeIn(300),k.data("out_trade_no",ee),k.data("uid",R),k.prop("disabled",!1)},N.onerror=()=>{w.find(".qrcode-loading").html(`
\u26A0\uFE0F
\u4E8C\u7EF4\u7801\u52A0\u8F7D\u5931\u8D25
\u8BF7\u5173\u95ED\u5F39\u7A97\u91CD\u8BD5
`)},N.src=K}else throw new Error("\u65E0\u6CD5\u89E3\u6790\u4E8C\u7EF4\u7801\u4FE1\u606F")}catch(_){console.error("\u83B7\u53D6\u652F\u4ED8\u4E8C\u7EF4\u7801\u5931\u8D25:",_),w.find(".qrcode-loading").html(`
\u26A0\uFE0F
\u83B7\u53D6\u652F\u4ED8\u4FE1\u606F\u5931\u8D25
\u524D\u5F80\u652F\u4ED8\u9875\u9762
`),de.Notification.error("\u83B7\u53D6\u652F\u4ED8\u4E8C\u7EF4\u7801\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}}function h(){n.find(".modal__dialog").css({transition:"opacity .2s ease, transform .2s ease",opacity:"0",transform:"translateY(8px)"}),setTimeout(()=>{n.removeClass("show"),n.attr("aria-hidden","true"),document.body.style.overflow=""},200)}s.length&&s.on("click",c),e.on("click",function(v){let w=(0,de.$)(v.target);(w.data("close")==="modal"||w.hasClass("modal__close"))&&u()}),n.on("click",function(v){let w=(0,de.$)(v.target);(w.data("close")==="modal"||w.hasClass("modal__close"))&&h()}),(0,de.$)(document).on("keydown",function(v){v.key==="Escape"&&(e.hasClass("show")&&u(),n.hasClass("show")&&h())}),a.on("click",function(){a.prop("disabled")||(window.location.href=i)}),(0,de.$)("#confirmNormalPayBtn").on("click",async function(){let v=(0,de.$)(this).data("uid"),w=(0,de.$)(this).data("out_trade_no");if(!w){de.Notification.error("\u8BA2\u5355\u4FE1\u606F\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5");return}try{let L=(await de.request.post("/buy/vip/s4",{uid:parseInt(v),out_trade_no:w})).data;L.ok?(de.Notification.success(L.tips||"\u652F\u4ED8\u6210\u529F"),setTimeout(()=>{window.location.reload()},1500)):de.Notification.error(L.tips||"\u652F\u4ED8\u672A\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}catch(k){console.error("\u786E\u8BA4\u652F\u4ED8\u5931\u8D25:",k),de.Notification.error("\u786E\u8BA4\u652F\u4ED8\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}})}function Qm(){let i=(0,de.$)("#toWeChatBtn"),t=(0,de.$)("#wechatVerifyModal");if(!i.length||!t.length)return;let e=t.find(".modal__dialog"),n=t.find('[data-close="modal"]');function o(){t.addClass("show"),t.attr("aria-hidden","false"),document.body.style.overflow="hidden",e.css({opacity:"0",transform:"translateY(8px)"}),requestAnimationFrame(()=>{e.css({transition:"opacity .25s ease, transform .25s ease",opacity:"1",transform:"translateY(0)"})})}function r(){e.css({transition:"opacity .2s ease, transform .2s ease",opacity:"0",transform:"translateY(8px)"}),setTimeout(()=>{t.removeClass("show"),t.attr("aria-hidden","true"),document.body.style.overflow=""},200)}i.on("click",o),n.each(function(){(0,de.$)(this).on("click",r)}),t.on("click",function(a){(0,de.$)(a.target).hasClass("modal__overlay")&&r()}),(0,de.$)(document).on("keydown",function(a){a.key==="Escape"&&t.hasClass("show")&&r()})}function Gm(){(0,de.$)(".faq-item").each(function(){let t=(0,de.$)(this);t.find(".faq-question").on("click",function(){t.toggleClass("active")})})}(0,de.addPage)(new de.NamedPage(["vip"],async()=>{document.querySelectorAll("button").forEach(i=>{i.setAttribute("style","transform:none !important;")}),Ym(),Vm(),Jm(),Km(),Qm(),Gm()}));var hn=ae(re());(0,hn.addPage)(new hn.NamedPage(["problem_detail"],async i=>{(0,hn.$)(document).ready(function(){(0,hn.$)("#myDialog").appendTo("body")}),(0,hn.$)("#advertisement").click(function(){let t=(0,hn.$)("#myDialog");t.css("display")==="none"?(t.css("display","flex"),(0,hn.$)(".footer").hide()):t.css("display","none")}),(0,hn.$)("#remove_adv").click(function(){(0,hn.$)("#myDialog").css("display","none")})}));var tn=ae(re());function Xm(){if(document.getElementById("record-checkdata-tooltip"))return;let i=document.createElement("style");i.id="record-checkdata-tooltip-style",i.textContent=`
#record-checkdata-tooltip {
position: fixed;
z-index: 99999;
max-width: min(260px, calc(100vw - 16px));
padding: 8px 12px;
font-size: 13px;
line-height: 1.45;
color: #f9fafb;
background: #111827;
border-radius: 8px;
box-shadow: 0 8px 24px rgba(0,0,0,.22);
pointer-events: none;
white-space: normal;
text-align: center;
visibility: hidden;
}
`,document.head.appendChild(i);let t=document.createElement("div");t.id="record-checkdata-tooltip",t.setAttribute("role","tooltip"),document.body.appendChild(t)}function Zm(i){Xm();let t=document.getElementById("record-checkdata-tooltip");if(!t)return;let e=i.getAttribute("data-tip")||i.getAttribute("title")||"";t.textContent=e,t.style.visibility="visible",t.style.left="-9999px",t.style.top="0px";let n=t.offsetWidth,o=t.offsetHeight,r=i.getBoundingClientRect(),a=8,s=r.right-n,l=r.top-o-a;swindow.innerWidth-a&&(s=window.innerWidth-a-n),l window.innerHeight-a&&(l=window.innerHeight-a-o),t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(l)}px`}function Ls(){let i=document.getElementById("record-checkdata-tooltip");i&&(i.style.visibility="hidden",i.textContent="")}(0,tn.addPage)(new tn.NamedPage(["record_detail"],()=>{let i=()=>{(0,tn.$)(document).off("mouseenter.recordCaseTip mouseleave.recordCaseTip").on("mouseenter.recordCaseTip","td.checkdata",function(){Zm(this)}).on("mouseleave.recordCaseTip","td.checkdata",Ls),(0,tn.$)(window).off("scroll.recordCaseTip resize.recordCaseTip").on("scroll.recordCaseTip resize.recordCaseTip",Ls),(0,tn.$)(document).off("pjax:complete.recordCaseTip").on("pjax:complete.recordCaseTip",Ls),(0,tn.$)(document).off("click.case-preview").on("click.case-preview","td.checkdata",async function(){let e=((0,tn.$)(this).attr("name")||"").match(/checkdata_(\d+)/),n=e?parseInt(e[1],10):NaN;if(!Number.isFinite(n))return tn.Notification.error((0,tn.i18n)("Unknown case id."));await Ar(n,"")})};requestAnimationFrame(()=>requestAnimationFrame(i))}));var Ce=ae(re()),_s=[],Vr={};async function ef(){let i=window.location.pathname.split("/"),t=i[i.length-1];return console.log(t),await Ce.request.post("/api/ps/endpoint",{pid:t,operation:"get_by_pid"})}async function tf(i){return await Ce.request.post("/api/ps/endpoint",{psid:i,operation:"get_by_psid"})}async function nf(i,t){let e=await Ce.request.post("/api/ps/endpoint",{psid:i,pid:t,operation:"delete"});e.success?Ce.Notification.success(`\u6210\u529F\u4ECE${i}\u4E2D\u5220\u9664${t}`):Ce.Notification.error(`\u4ECE${i}\u4E2D\u5220\u9664${t}\u5931\u8D25 : ${e.error}`)}async function od(){let i=await ef();_s=[];let t=(0,Ce.$)("#insertPsDialog .option-list");t.empty();for(let n of i){let o=n.psid,r=n.name,a=(0,Ce.$)(`
${r}
\u5220\u9664
\u8FDB\u5165
`);t.append(a)}let e=window.location.pathname.split("/").pop();(0,Ce.$)(".into_ps-btn").click(n=>rd((0,Ce.$)(n.target).parent().data("psid"))),(0,Ce.$)(".delete-btn").click(n=>nf((0,Ce.$)(n.target).parent().data("psid"),e))}async function rd(i){let t=await tf(i),e=t.dag;_s.push(t.name),Vr.ps=t;let n=(0,Ce.$)("#insertPsDialog .option-list");n.empty();for(let r=0;r
${a.title}
\u8FDB\u5165
`);n.append(s)}let o=(0,Ce.$)(`
\u8FD4\u56DE
\u8FD4\u56DE
`);n.prepend(o),(0,Ce.$)(".back-btn").click(r=>od()),(0,Ce.$)(".into_node-btn").click(r=>of(r,e))}async function of(i,t){let e=Number((0,Ce.$)(i.target).data("id")),n=await Ce.request.get("/api/problem/getByPids",{pids:t[e].pids.join(" ")});_s.push(t[e].title),Vr[e]=e;let o=(0,Ce.$)("#insertPsDialog .option-list");o.empty();for(let s=0;s
${l.title}
\u2191
\u2193
`);o.append(c)}let r=(0,Ce.$)(`
\u8FD4\u56DE
\u8FD4\u56DE
`);o.prepend(r);let a=(0,Ce.$)(`
\u63D2\u5165
\u63D2\u5165\u5230\u8FD9
`);o.append(a),console.log(Vr),(0,Ce.$)(".back-btn").click(()=>rd(Vr.ps.psid))}async function rf(){let i=(0,Ce.$)("#insertPsDialog");i.css("display")==="none"?(i.css("display","flex"),(0,Ce.$)(".footer").hide(),od()):i.css("display","none")}(0,Ce.addPage)(new Ce.NamedPage(["problem_detail"],async i=>{(0,Ce.$)(document).ready(function(){(0,Ce.$)("#insertPsDialog").appendTo("body")}),(0,Ce.$)("#insert_problem_set").click(rf),(0,Ce.$)("#remove_insertPs").click(function(){(0,Ce.$)("#insertPsDialog").css("display","none")}),(0,Ce.$)(".dialog").click(function(t){(0,Ce.$)("#insertPsDialog").css("display")!=="none"&&t.target===t.currentTarget&&(0,Ce.$)(this).css("display","none")}),(0,Ce.$)(document).on("keydown",t=>{t.keyCode===27&&(0,Ce.$)("#insertPsDialog").css("display","none")})}));var xe=ae(re());(0,xe.addPage)(new xe.NamedPage(["vip_pay"],async()=>{let i=(0,xe.$)("#pay_button");i&&i.click(async()=>{let o=i.data("uid"),r=i.data("out_trade_no"),s=(await xe.request.post("",{uid:o,out_trade_no:r})).data;console.log(s),s!=null&&s.redirect&&(window.location.href=window.location.origin+(s==null?void 0:s.redirect)),s!=null&&s.group_ok?xe.Notification.success(s.group_ok):s!=null&&s.group_id?window.location.href=window.location.href+"/"+s.group_id:s!=null&&s.redirect_group_id&&(window.location.href=window.location.origin+(s==null?void 0:s.redirect_group_id)),s!=null&&s.tips&&xe.Notification.success(s.tips)});let t=(0,xe.$)("#delete_group");t&&t.click(async()=>{if(await new xe.ConfirmDialog({$body:xe.tpl`
您确认删除拼团吗?删除后您和团员的付款费用将会退回,并可以重新开启或加入新的拼团!
`}).open()!=="yes")return;let a=window.location.href.split("/").pop(),{ok:s}=await xe.request.get(`/delg/${a}`);s?(xe.Notification.success("\u6210\u529F\u5220\u9664\u62FC\u56E2\uFF01"),window.location.href=window.location.origin+"/vip"):await new xe.InfoDialog({$body:xe.tpl`
`}).open()});function e(){let r=(0,xe.$)("#end_time_tips").data("endtime"),a=new Date().getTime(),s=r-a,l=Math.floor(s/1e3%60),c=Math.floor(s/(1e3*60)%60),u=Math.floor(s/(1e3*60*60)%24);try{document.getElementById("rest_time").innerHTML=`${u}\u5C0F\u65F6 ${c}\u5206\u949F ${l}\u79D2`}catch(d){}}let n=(0,xe.$)("#pay_container");(0,xe.$)(document).ready(async function(){if(window.UserContext._id===0)return new xe.InfoDialog({$body:xe.tpl`
`}).open().then(async()=>{window.location.href=window.location.origin+"/login"});var o=n.data("tips"),r=n.data("tips_group_id"),a=n.data("tips_answer_no"),s=n.data("generate_by_input");if(console.log(r),o)if(s)new xe.ConfirmDialog({$body:xe.tpl`
`}).open().then(async c=>{console.log(c);let u=(0,xe.$)('input[name="input_price"]').val(),{data:d}=await xe.request.get(`/buy/generate/${u}`,{sections:UiContext.sections});if(d!=null&&d.out_trade_no)(0,xe.$)(".image").attr("src",d.url),n.data("out_trade_no",d.out_trade_no),(0,xe.$)("#pay_button").data("out_trade_no",d.out_trade_no),(0,xe.$)("#price").text(u);else{xe.Notification.error("\u751F\u6210\u8BA2\u5355\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u8F93\u5165\u89C4\u8303\uFF0C\u5982\u679C\u662F\u7CFB\u7EDF\u95EE\u9898\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01");let h=await new xe.ConfirmDialog({$body:xe.tpl`
生成订单失败,请检查是否输入规范,如果是系统问题请联系管理员!
`}).open();window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2F"}},async c=>{xe.Notification.error("\u751F\u6210\u8BA2\u5355\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u8F93\u5165\u89C4\u8303\uFF0C\u5982\u679C\u662F\u7CFB\u7EDF\u95EE\u9898\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01");let u=await new xe.ConfirmDialog({$body:xe.tpl`
生成订单失败,请检查是否输入规范,如果是系统问题请联系管理员!
`}).open();window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2F"});else{if(await new xe.ConfirmDialog({$body:xe.tpl`
`}).open()!=="yes"){a&&(window.location.href=window.location.origin+a);return}r&&(window.location.href=window.location.origin+r)}(0,xe.$)("#end_time_tips")&&setInterval(e,1e3)})}));var Jr=ae(re());(0,Jr.addPage)(new Jr.AutoloadPage("top_progress_bar",()=>{let i="hydro-top-progress-bar",t="hydro-top-progress-style";function e(){if(document.getElementById(t))return;let r=document.createElement("style");r.id=t,r.textContent=`
#${i} {
position: fixed;
top: 0;
left: 0;
height: 3px;
width: 0;
background: #66b3ff; /* \u6D45\u84DD\u8272 */
z-index: 9999;
transition: width 0.2s ease-out, opacity 0.2s ease-out;
}
`,document.head.appendChild(r)}function n(){e();let r=document.getElementById(i);r||(r=document.createElement("div"),r.id=i,document.body.appendChild(r)),r.style.opacity="1",r.style.width="0",requestAnimationFrame(()=>{r&&(r.style.width="50%",window.setTimeout(()=>{!r||r.style.opacity==="0"||(r.style.width="99%")},500))})}function o(){let r=document.getElementById(i);r&&(r.style.width="100%",window.setTimeout(()=>{r&&(r.style.opacity="0",window.setTimeout(()=>{r.remove()},200))},150))}window.addEventListener("topProgress:start",()=>{n()}),window.addEventListener("topProgress:done",()=>{o()}),window.addEventListener("codenote:before:notechange",()=>{n()}),window.addEventListener("codenote:noteChanged",()=>{o()}),window.TopProgressBar={showProgress:n,hideProgress:o}}));var _n=ae(re());(0,_n.addPage)(new _n.NamedPage(["problem_create","problem_edit"],async()=>{let i=(0,_n.$)('input[name="ai_alg_tags"]'),t=(0,_n.$)('input[name="pid"]');if(!i.length||!t.length)return;let e=i.closest(".columns");if(!e.length)return;let n=(0,_n.$)('
AI\u751F\u6210\u6807\u7B7E ').addClass("button primary").css({width:"100%"}),o=(0,_n.$)("
").addClass("medium-3 columns form__item end").append("
").append(n);e.after(o),n.on("click",async r=>{r.preventDefault();let a=t.val();if(!a){alert("\u8BF7\u5148\u4FDD\u5B58\u9898\u76EE\u4EE5\u751F\u6210PID\uFF0C\u7136\u540E\u518D\u4F7F\u7528\u6B64\u529F\u80FD\u3002");return}let s=n.text();n.prop("disabled",!0).text("\u751F\u6210\u4E2D...");try{let l=await _n.request.post("/ai/tag_single_problem",{pid:a});if(l.status===!0&&Array.isArray(l.tags)&&l.tags.length>0)i.val(l.tags.join(",")),n.text("\u751F\u6210\u6210\u529F!");else throw new Error(l.message||"AI\u672A\u80FD\u751F\u6210\u6807\u7B7E\uFF0C\u8FD4\u56DE\u7ED3\u679C\u4E3A\u7A7A\u3002")}catch(l){console.error("AI\u751F\u6210\u6807\u7B7E\u5931\u8D25:",l),alert(`\u64CD\u4F5C\u5931\u8D25: ${l.message}`),n.text("\u91CD\u8BD5")}finally{setTimeout(()=>{n.text(s).prop("disabled",!1)},2e3)}})}));var Mn=ae(re());var Ms=class{constructor(){p(this,"$sidebarBtn",null);p(this,"$sidebarBtnStatus",null);p(this,"dialog",null);p(this,"chatStatus","init");p(this,"isClosing",!1);p(this,"aiContainer",null);p(this,"rid","");p(this,"aiAnalysisQuotaRef",null);p(this,"abortController",null)}injectSidebarAskAIBtn(){(0,Mn.$)("div.section.side").first().prepend(`
`)}renderRecordDetailQuotaBar(){var r;let t=document.getElementById("recordDetailAiQuotaBar");if(!t)return;if(!((r=this.aiAnalysisQuotaRef)!=null&&r.limited)){t.hidden=!0,t.innerHTML="";return}t.hidden=!1;let e=this.aiAnalysisQuotaRef.remaining,n=this.aiAnalysisQuotaRef.dailyLimit,o=Pi(n);t.innerHTML=`
\u4ECA\u65E5 AI\uFF1A${e} / ${n} \u6B21${o}
`}updateRecordDetailAskBtnQuotaUi(){var t,e;if((t=this.$sidebarBtn)!=null&&t.length){if(!((e=this.aiAnalysisQuotaRef)!=null&&e.limited)){this.$sidebarBtn.prop("disabled",!1),this.$sidebarBtn.removeAttr("aria-disabled"),this.$sidebarBtn.removeAttr("title");return}this.aiAnalysisQuotaRef.remaining<=0?(this.$sidebarBtn.prop("disabled",!0),this.$sidebarBtn.attr("aria-disabled","true"),this.$sidebarBtn.attr("title","\u4ECA\u65E5 AI \u6B21\u6570\u5DF2\u7528\u5B8C")):(this.$sidebarBtn.prop("disabled",!1),this.$sidebarBtn.removeAttr("aria-disabled"),this.$sidebarBtn.removeAttr("title"))}}applyAiQuotaFromApi(t){var e;(e=t==null?void 0:t.aiQuota)!=null&&e.limited&&(this.aiAnalysisQuotaRef={limited:!0,remaining:Number(t.aiQuota.remaining)||0,dailyLimit:En(t.aiQuota.dailyLimit)})}renderButtonState(){var t,e;if(!(!((t=this.$sidebarBtnStatus)!=null&&t.length)||!((e=this.$sidebarBtn)!=null&&e.length)))switch(this.$sidebarBtnStatus.empty(),this.chatStatus){case"streaming":this.$sidebarBtn.attr("aria-busy","true"),this.$sidebarBtnStatus.html('
');break;case"complete":this.$sidebarBtn.removeAttr("aria-busy"),this.$sidebarBtnStatus.html('
\u2714 ');break;default:this.$sidebarBtn.removeAttr("aria-busy");break}}showLimitedDialog(){var o;let t=(0,Mn.$)(`
`);(0,Mn.$)("body").append(t),t.show();let e=Di((o=this.aiAnalysisQuotaRef)==null?void 0:o.dailyLimit);t.find("#recordDetailAiLimitDialogMsg").html(e);let n=()=>{t.addClass("is-closing"),setTimeout(()=>t.remove(),200)};t.find(".reviewmodal__close").on("click",n)}async close(){var t,e;if(!this.isClosing){if(this.chatStatus==="streaming"){if(this.isClosing=!0,!await zt.open({title:"\u64CD\u4F5C\u786E\u8BA4",message:"AI \u6B63\u5728\u8F93\u51FA\u4E2D\uFF0C\u786E\u5B9A\u8981\u5173\u95ED\u5417\uFF1F"})){this.isClosing=!1;return}(t=this.abortController)==null||t.abort()}this.chatStatus!=="complete"&&(this.chatStatus="init",this.renderButtonState()),(e=this.dialog)==null||e.addClass("is-closing"),setTimeout(()=>{var n;(n=this.dialog)==null||n.remove(),this.dialog=null,this.aiContainer=null},200),this.isClosing=!1}}getRidFromUrl(){return window.location.pathname.split("/").pop()||""}async runRecordAiStream(){var o,r;if(!this.aiContainer)return;this.chatStatus="streaming",this.renderButtonState(),this.aiContainer.classList.remove("is-loading"),this.aiContainer.classList.add("is-result");let t="recordAiStreamLive";this.aiContainer.innerHTML=`
`;let e=this.aiContainer.querySelector(`#${t}`);if(!e)return;this.abortController=new AbortController;let n=await Bi(this.rid,e,{signal:this.abortController.signal});if(this.abortController=null,n.ok)n.aiQuota&&this.applyAiQuotaFromApi({aiQuota:n.aiQuota}),this.chatStatus="complete";else{let a=(o=n.error)!=null?o:"";a?((r=this.aiAnalysisQuotaRef)!=null&&r.limited&&/次数已用完|403/.test(a)&&(this.aiAnalysisQuotaRef={...this.aiAnalysisQuotaRef,remaining:0}),this.chatStatus="error"):this.chatStatus="init"}this.renderRecordDetailQuotaBar(),this.updateRecordDetailAskBtnQuotaUi(),this.renderButtonState()}show(){this.rid=this.getRidFromUrl(),this.chatStatus="init",this.dialog=(0,Mn.$)(`
×
\u4EE3\u7801 AI \u5206\u6790
\u6B63\u5728\u8FDE\u63A5 AI \u5206\u6790\u670D\u52A1\u2026
`),(0,Mn.$)("body").append(this.dialog),this.dialog.show(),this.dialog.find(".reviewmodal__close").on("click",()=>void this.close()),this.aiContainer=this.dialog.find(".reviewmodal__body")[0],this.runRecordAiStream()}init(){var n;this.injectSidebarAskAIBtn();let t=document.createElement("style");t.textContent=Hi(),document.head.appendChild(t),$i(),this.$sidebarBtn=(0,Mn.$)("#recordDetailAskAiBtn"),this.$sidebarBtnStatus=this.$sidebarBtn.find(".btn-status");let e=(n=window.UiContext)==null?void 0:n.recordDetailAiAnalysisQuota;e!=null&&e.limited?this.aiAnalysisQuotaRef={limited:!0,remaining:Number(e.remaining)||0,dailyLimit:En(e.dailyLimit)}:this.aiAnalysisQuotaRef=null,this.renderRecordDetailQuotaBar(),this.updateRecordDetailAskBtnQuotaUi(),this.renderButtonState(),this.$sidebarBtn.off("click.ai").on("click.ai",o=>{var r;if(o.preventDefault(),(r=this.aiAnalysisQuotaRef)!=null&&r.limited&&this.aiAnalysisQuotaRef.remaining<=0){this.showLimitedDialog();return}this.show()})}};(0,Mn.addPage)(new Mn.NamedPage(["record_detail"],async()=>{if((window.UiContext||{}).recordDetailAskAiAllowed!==!0)return;new Ms().init()}));var ta=ae(re());var Io=class{constructor(t,e){p(this,"id","knowledge");p(this,"name","\u77E5\u8BC6\u70B9");p(this,"selectedTopics",new Set);p(this,"allTopics",[]);p(this,"allAlgTags",[]);p(this,"originalNodes",[]);p(this,"problemTagsMap",new Map);p(this,"videosol_dict",{});p(this,"videosol_icon_dict",{});p(this,"currentPsid","");p(this,"filterWrapper",null);p(this,"tagClickHandler",null);p(this,"radioChangeHandler",null);p(this,"problemListFilterManager",null);p(this,"isExpanded",!1);p(this,"lastConstructedNodes",null);p(this,"sortOrder","difficulty-asc");this.currentPsid=t,this.filterWrapper=document.getElementById("filter-section-wrapper"),e&&(this.problemListFilterManager=e)}setFilterManager(t){this.problemListFilterManager=t}setAllAlgTags(t){this.allAlgTags=t,t&&t.length>0&&(this.allTopics=t,this.loadFilterState())}setOriginalData(t){this.originalNodes=t.nodes,t.problemTagsMap instanceof Map?this.problemTagsMap=t.problemTagsMap:(this.problemTagsMap=new Map,Object.entries(t.problemTagsMap).forEach(([e,n])=>{this.problemTagsMap.set(Number(e),n)})),this.videosol_dict=t.videosol_dict||{},this.videosol_icon_dict=t.videosol_icon_dict||{}}init(t){this.originalNodes=t,this.allAlgTags&&this.allAlgTags.length>0?this.allTopics=this.allAlgTags:this.allTopics=[],this.loadFilterState()}getSelectedTopics(){return this.selectedTopics}getFilterStorageKey(){var e;let t=(e=window.UserContext)==null?void 0:e._id;return!t||t===0?null:`algcourse_filter_uid_${t}_psid_${this.currentPsid}`}saveFilterState(){let t=this.getFilterStorageKey();t&&localStorage.setItem(t,JSON.stringify({selectedTopics:Array.from(this.selectedTopics),sortOrder:this.sortOrder}))}loadFilterState(){let t=this.getFilterStorageKey();if(t&&localStorage.getItem(t)){let e=localStorage.getItem(t);try{let n=JSON.parse(e),o;Array.isArray(n)?o=n:(o=n.selectedTopics||[],this.sortOrder=n.sortOrder||"difficulty-asc");let r=o.filter(a=>this.allTopics.includes(a));if(r.length>0){this.selectedTopics=new Set(r);return}}catch(n){console.error("\u52A0\u8F7D\u7B5B\u9009\u72B6\u6001\u5931\u8D25:",n)}}else this.selectedTopics=new Set(this.allTopics),this.sortOrder="difficulty-asc",this.saveFilterState()}updateRadioButtons(){let t=document.querySelector('input[name="filter-all"][value="all"]'),e=document.querySelector('input[name="filter-all"][value="none"]');!t||!e||(this.selectedTopics.size===this.allTopics.length?t.checked=!0:this.selectedTopics.size===0?e.checked=!0:(t.checked=!1,e.checked=!1))}areNodesEqual(t,e){if(t.length!==e.length)return!1;for(let n=0;n
l.docId||l.pid).filter(l=>l!=null)),s=new Set((r.problems||[]).map(l=>l.docId||l.pid).filter(l=>l!=null));if(a.size!==s.size)return!1;for(let l of a)if(!s.has(l))return!1}return!0}async filterProblemList(t=!1,e=!1){if(!this.problemListFilterManager)return;if(!this.originalNodes||this.originalNodes.length===0||this.problemTagsMap.size===0){console.warn("KnowledgeFilter: \u539F\u59CB\u6570\u636E\u672A\u8BBE\u7F6E\uFF0C\u65E0\u6CD5\u7B5B\u9009");return}if(this.selectedTopics.size===0){if(!t&&this.lastConstructedNodes&&this.lastConstructedNodes.length===0){this.problemListFilterManager.setEmptyStateText("\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u77E5\u8BC6\u70B9\u6807\u7B7E");return}this.lastConstructedNodes=[],e&&await this.problemListFilterManager.fadeOut(),this.problemListFilterManager.setEmptyStateText("\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u77E5\u8BC6\u70B9\u6807\u7B7E"),this.problemListFilterManager.update([],{},this.problemTagsMap,e,this.videosol_icon_dict),this.problemListFilterManager.showProblemTags(!1),this.problemListFilterManager.showProblemNodeTitle(!1);return}let n=new Map,o=new Map,r=new Map;for(let s of this.originalNodes)if(!(!s.problems||!Array.isArray(s.problems)))for(let l of s.problems){let c=l.docId||l.pid;if(!c)continue;let u=this.problemTagsMap.get(c)||[],d=new Set;for(let h of this.selectedTopics)u.includes(h)&&d.add(h);if(d.size===0)for(let h of this.selectedTopics)u.find(w=>w.toLowerCase().trim()===h.toLowerCase().trim())&&d.add(h);d.size>0&&(n.set(c,l),o.set(c,d),r.set(c,s.title))}if(n.size===0){if(!t&&this.lastConstructedNodes&&this.lastConstructedNodes.length===0){this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE");return}this.lastConstructedNodes=[],e&&await this.problemListFilterManager.fadeOut(),this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE"),this.problemListFilterManager.update([],{},this.problemTagsMap,e,this.videosol_icon_dict),this.problemListFilterManager.showProblemTags(!1),this.problemListFilterManager.showProblemNodeTitle(!1);return}let a=[];for(let s of this.allAlgTags){if(!this.selectedTopics.has(s))continue;let l=[];for(let[c,u]of o.entries())if(u.has(s)){let d=n.get(c);if(d){let h=r.get(c);if(h){let v={...d,originalNodeTitle:h};l.push(v)}else l.push(d)}}if(l.length>0){let c=this.sortProblems(l),u=c.filter(h=>h.isDone).length,d=c.length;a.push({id:`knowledge_${s}`,title:s,problems:c,progress:{done:u,total:d,percentage:d>0?Math.round(u/d*100):0}})}}this.sortOrder==="chapter"&&this.sortNodesByChapterOrder(a),!(!t&&this.lastConstructedNodes&&this.areNodesEqual(a,this.lastConstructedNodes))&&(this.lastConstructedNodes=a,e&&await this.problemListFilterManager.fadeOut(),this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE"),this.problemListFilterManager.update(a,this.videosol_dict,this.problemTagsMap,e,this.videosol_icon_dict),this.problemListFilterManager.showProblemTags(!1),this.problemListFilterManager.showProblemNodeTitle(!0))}getProblemOrderMap(){let t=new Map,e=0;for(let n of this.originalNodes)if(n.problems&&Array.isArray(n.problems))for(let o of n.problems)o.docId&&t.set(o.docId,e++);return t}sortProblems(t){let e=[...t];if(this.sortOrder==="chapter"){let n=this.getProblemOrderMap();return e.sort((o,r)=>{var l,c;let a=(l=n.get(o.docId))!=null?l:Number.MAX_SAFE_INTEGER,s=(c=n.get(r.docId))!=null?c:Number.MAX_SAFE_INTEGER;return a-s})}else{if(this.sortOrder==="difficulty-asc")return e.sort((n,o)=>{let r=n.difficulty||0,a=o.difficulty||0;return r-a});if(this.sortOrder==="difficulty-desc")return e.sort((n,o)=>{let r=n.difficulty||0;return(o.difficulty||0)-r})}return e}sortNodesByChapterOrder(t){let e=this.getProblemOrderMap();t.sort((n,o)=>{var c,u,d,h;let r=(c=n.problems)==null?void 0:c[0],a=(u=o.problems)==null?void 0:u[0];if(!r||!a)return 0;let s=(d=e.get(r.docId))!=null?d:Number.MAX_SAFE_INTEGER,l=(h=e.get(a.docId))!=null?h:Number.MAX_SAFE_INTEGER;return s-l})}applySortToNodes(t){for(let e of t)e.problems&&Array.isArray(e.problems)&&(e.problems=this.sortProblems(e.problems));this.sortOrder==="chapter"&&this.sortNodesByChapterOrder(t)}toggleExpand(){this.isExpanded=!this.isExpanded,this.updateExpandButton()}updateExpandButton(){var n,o;let t=(n=this.filterWrapper)==null?void 0:n.querySelector("#filter-tags"),e=(o=this.filterWrapper)==null?void 0:o.querySelector(".filter-expand-button");!t||!e||(this.isExpanded?(t.classList.add("expanded"),t.classList.remove("collapsed"),e.innerHTML=`
\u6536\u8D77
`):(t.classList.add("collapsed"),t.classList.remove("expanded"),e.innerHTML=`
\u5C55\u5F00
`))}shouldShowExpandButton(){var r;let t=(r=this.filterWrapper)==null?void 0:r.querySelector("#filter-tags");if(!t)return!1;let e=t.classList.contains("collapsed");t.classList.remove("collapsed","expanded");let n=t.scrollHeight;return e?t.classList.add("collapsed"):t.classList.add("expanded"),n>132}updateExpandButtonVisibility(){var n;let t=(n=this.filterWrapper)==null?void 0:n.querySelector(".filter-expand-button");if(!t)return;let e=this.shouldShowExpandButton();t.style.display=e?"flex":"none"}render(){let t=this.selectedTopics.size===this.allTopics.length,e=this.selectedTopics.size===0;return`
\u7AE0\u8282\u987A\u5E8F
\u96BE\u5EA6\uFF1A\u4F4E\u2192\u9AD8
\u96BE\u5EA6\uFF1A\u9AD8\u2192\u4F4E
\u5168\u9009
\u5168\u4E0D\u9009
`}bindEvents(){!this.filterWrapper&&(this.filterWrapper=document.getElementById("filter-section-wrapper"),!this.filterWrapper)||(this.unbindEvents(),this.tagClickHandler=t=>{let e=t.target;if(e.closest(".filter-expand-button")){t.stopPropagation(),this.toggleExpand();return}let o=e.closest(".filter-tag");if(!o)return;let r=o.getAttribute("data-topic");r&&(this.selectedTopics.has(r)?(this.selectedTopics.delete(r),o.classList.remove("selected")):(this.selectedTopics.add(r),o.classList.add("selected")),this.saveFilterState(),this.updateRadioButtons(),this.filterProblemList().catch(a=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",a)}))},this.radioChangeHandler=t=>{var r;let e=t.target;if(e.id==="knowledge-filter-sort"){let a=e.value;this.sortOrder!==a&&(this.sortOrder=a,this.saveFilterState(),this.lastConstructedNodes&&this.lastConstructedNodes.length>0?(this.applySortToNodes(this.lastConstructedNodes),(r=this.problemListFilterManager)==null||r.update(this.lastConstructedNodes,this.videosol_dict,this.problemTagsMap,!1,this.videosol_icon_dict)):this.filterProblemList().catch(s=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",s)}));return}if(e.name!=="filter-all")return;let n=e.value;n==="all"?this.selectedTopics=new Set(this.allTopics):this.selectedTopics.clear(),this.filterWrapper.querySelectorAll(".filter-tag").forEach(a=>{n==="all"?a.classList.add("selected"):a.classList.remove("selected")}),this.saveFilterState(),this.filterProblemList().catch(a=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",a)})},this.filterWrapper.addEventListener("click",this.tagClickHandler),this.filterWrapper.addEventListener("change",this.radioChangeHandler))}unbindEvents(){this.filterWrapper&&this.tagClickHandler&&(this.filterWrapper.removeEventListener("click",this.tagClickHandler),this.tagClickHandler=null),this.filterWrapper&&this.radioChangeHandler&&(this.filterWrapper.removeEventListener("change",this.radioChangeHandler),this.radioChangeHandler=null)}async show(t=!1){requestAnimationFrame(()=>{this.updateExpandButton(),setTimeout(()=>{this.updateExpandButtonVisibility()},0),this.filterProblemList(!0,t).catch(e=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",e)})})}async hide(t=!1){t&&this.problemListFilterManager&&(await this.problemListFilterManager.fadeOut(),this.problemListFilterManager.showProblemNodeTitle(!1))}showLoading(){}update(t){this.init(t)}renderAndBind(){requestAnimationFrame(()=>{this.bindEvents(),this.updateExpandButton(),setTimeout(()=>{this.updateExpandButtonVisibility()},0),this.filterProblemList().catch(t=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",t)})})}};var Ho=class{constructor(t,e){p(this,"id","nodeTitle");p(this,"name","\u77E5\u8BC6\u70B9");p(this,"selectedTopics",new Set);p(this,"allTopics",[]);p(this,"originalNodes",[]);p(this,"videosol_dict",{});p(this,"videosol_icon_dict",{});p(this,"problemTagsMap",new Map);p(this,"currentPsid","");p(this,"filterWrapper",null);p(this,"tagClickHandler",null);p(this,"radioChangeHandler",null);p(this,"problemListFilterManager",null);p(this,"isExpanded",!1);p(this,"lastFilteredNodes",null);this.currentPsid=t,this.filterWrapper=document.getElementById("filter-section-wrapper"),e&&(this.problemListFilterManager=e)}setFilterManager(t){this.problemListFilterManager=t}setOriginalData(t){this.originalNodes=t.nodes,this.videosol_dict=t.videosol_dict||{},this.videosol_icon_dict=t.videosol_icon_dict||{},t.problemTagsMap&&(t.problemTagsMap instanceof Map?this.problemTagsMap=t.problemTagsMap:(this.problemTagsMap=new Map,Object.entries(t.problemTagsMap).forEach(([e,n])=>{this.problemTagsMap.set(Number(e),n)})))}init(t){if(this.originalNodes=t,this.problemListFilterManager){let e=this.problemListFilterManager.getAvailableTopics();this.allTopics=e.length>0?e:t.map(n=>n.title)}else this.allTopics=t.map(e=>e.title);this.loadFilterState()}getSelectedTopics(){return this.selectedTopics}getFilterStorageKey(){var e;let t=(e=window.UserContext)==null?void 0:e._id;return!t||t===0?null:`algcourse_filter_uid_${t}_psid_${this.currentPsid}`}saveFilterState(){let t=this.getFilterStorageKey();if(t){let e={selectedTopics:Array.from(this.selectedTopics)};localStorage.setItem(t,JSON.stringify(e))}}loadFilterState(){let t=this.getFilterStorageKey();if(t&&localStorage.getItem(t)){let e=localStorage.getItem(t);try{let n=JSON.parse(e),o;Array.isArray(n)?o=n:o=(n==null?void 0:n.selectedTopics)||[];let r=o.filter(a=>this.allTopics.includes(a));if(r.length>0){this.selectedTopics=new Set(r);return}}catch(n){console.error("\u52A0\u8F7D\u7B5B\u9009\u72B6\u6001\u5931\u8D25:",n)}}this.selectedTopics=new Set(this.allTopics),this.saveFilterState()}updateRadioButtons(){let t=document.querySelector('input[name="filter-all"][value="all"]'),e=document.querySelector('input[name="filter-all"][value="none"]');!t||!e||(this.selectedTopics.size===this.allTopics.length?t.checked=!0:this.selectedTopics.size===0?e.checked=!0:(t.checked=!1,e.checked=!1))}areNodesEqual(t,e){if(t.length!==e.length)return!1;for(let n=0;nl.docId||l.pid).filter(l=>l!=null)),s=new Set((r.problems||[]).map(l=>l.docId||l.pid).filter(l=>l!=null));if(a.size!==s.size)return!1;for(let l of a)if(!s.has(l))return!1}return!0}async filterProblemList(t=!1,e=!1){if(!this.problemListFilterManager)return;if(!this.originalNodes||this.originalNodes.length===0){console.warn("NodeTitleFilter: \u539F\u59CB\u6570\u636E\u672A\u8BBE\u7F6E\uFF0C\u65E0\u6CD5\u7B5B\u9009");return}if(this.selectedTopics.size===0){if(!t&&this.lastFilteredNodes&&this.lastFilteredNodes.length===0){this.problemListFilterManager.setEmptyStateText("\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u77E5\u8BC6\u70B9\u6807\u7B7E");return}this.lastFilteredNodes=[],this.problemListFilterManager.setEmptyStateText("\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u77E5\u8BC6\u70B9\u6807\u7B7E"),this.problemListFilterManager.update([],{},this.problemTagsMap,e,this.videosol_icon_dict),this.problemListFilterManager.showProblemTags(!1);return}let n=this.originalNodes.filter(o=>this.selectedTopics.has(o.title));if(n.length===0){if(!t&&this.lastFilteredNodes&&this.lastFilteredNodes.length===0){this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE");return}this.lastFilteredNodes=[],this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE"),this.problemListFilterManager.update([],{},this.problemTagsMap,e,this.videosol_icon_dict),this.problemListFilterManager.showProblemTags(!1);return}!t&&this.lastFilteredNodes&&this.areNodesEqual(n,this.lastFilteredNodes)||(this.lastFilteredNodes=n,this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE"),this.problemListFilterManager.update(n,this.videosol_dict,this.problemTagsMap,e,this.videosol_icon_dict),this.problemListFilterManager.showProblemTags(!1))}toggleExpand(){this.isExpanded=!this.isExpanded,this.updateExpandButton()}updateExpandButton(){var n,o;let t=(n=this.filterWrapper)==null?void 0:n.querySelector("#filter-tags"),e=(o=this.filterWrapper)==null?void 0:o.querySelector(".filter-expand-button");!t||!e||(this.isExpanded?(t.classList.add("expanded"),t.classList.remove("collapsed"),e.innerHTML=`
\u6536\u8D77
`):(t.classList.add("collapsed"),t.classList.remove("expanded"),e.innerHTML=`
\u5C55\u5F00
`))}shouldShowExpandButton(){var r;let t=(r=this.filterWrapper)==null?void 0:r.querySelector("#filter-tags");if(!t)return!1;let e=t.classList.contains("collapsed");t.classList.remove("collapsed","expanded");let n=t.scrollHeight;return e?t.classList.add("collapsed"):t.classList.add("expanded"),n>132}updateExpandButtonVisibility(){var n;let t=(n=this.filterWrapper)==null?void 0:n.querySelector(".filter-expand-button");if(!t)return;let e=this.shouldShowExpandButton();t.style.display=e?"flex":"none"}render(){let t=this.selectedTopics.size===this.allTopics.length,e=this.selectedTopics.size===0;return`
\u5168\u9009
\u5168\u4E0D\u9009
`}bindEvents(){!this.filterWrapper&&(this.filterWrapper=document.getElementById("filter-section-wrapper"),!this.filterWrapper)||(this.unbindEvents(),this.tagClickHandler=t=>{let e=t.target;if(e.closest(".filter-expand-button")){t.stopPropagation(),this.toggleExpand();return}let o=e.closest(".filter-tag");if(!o)return;let r=o.getAttribute("data-topic");r&&(this.selectedTopics.has(r)?(this.selectedTopics.delete(r),o.classList.remove("selected")):(this.selectedTopics.add(r),o.classList.add("selected")),this.saveFilterState(),this.updateRadioButtons(),this.filterProblemList().catch(a=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",a)}))},this.radioChangeHandler=t=>{let e=t.target;if(e.name!=="filter-all")return;let n=e.value;n==="all"?this.selectedTopics=new Set(this.allTopics):this.selectedTopics.clear(),this.filterWrapper.querySelectorAll(".filter-tag").forEach(r=>{n==="all"?r.classList.add("selected"):r.classList.remove("selected")}),this.saveFilterState(),this.filterProblemList().catch(r=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",r)})},this.filterWrapper.addEventListener("click",this.tagClickHandler),this.filterWrapper.addEventListener("change",this.radioChangeHandler))}unbindEvents(){this.filterWrapper&&this.tagClickHandler&&(this.filterWrapper.removeEventListener("click",this.tagClickHandler),this.tagClickHandler=null),this.filterWrapper&&this.radioChangeHandler&&(this.filterWrapper.removeEventListener("change",this.radioChangeHandler),this.radioChangeHandler=null)}async show(t=!1){requestAnimationFrame(()=>{this.updateExpandButton(),setTimeout(()=>{this.updateExpandButtonVisibility()},0),this.filterProblemList(!0,t).catch(e=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",e)})})}async hide(t=!1){t&&this.problemListFilterManager&&await this.problemListFilterManager.fadeOut()}showLoading(){}update(t){this.init(t)}renderAndBind(){requestAnimationFrame(()=>{this.bindEvents(),this.updateExpandButton(),setTimeout(()=>{this.updateExpandButtonVisibility()},0),this.filterProblemList().catch(t=>{console.error("\u7B5B\u9009\u9898\u76EE\u5217\u8868\u5931\u8D25:",t)})})}};var Po=class{constructor(t,e){p(this,"id","favorite");p(this,"name","\u6536\u85CF");p(this,"filterWrapper",null);p(this,"problemListFilterManager",null);p(this,"currentPsid","");p(this,"favoriteNodes",[]);p(this,"favoriteVideosol_dict",{});p(this,"favoriteVideosol_icon_dict",{});p(this,"favoriteProblemTagsMap",new Map);this.currentPsid=t,this.filterWrapper=document.getElementById("filter-section-wrapper"),e&&(this.problemListFilterManager=e)}setFilterManager(t){this.problemListFilterManager=t}setPsid(t){this.currentPsid=t}render(){return`
\u70B9\u51FB\u9898\u76EE\u6807\u9898\u5DE6\u8FB9\u7684
\u8FDB\u884C\u6536\u85CF
`}bindEvents(){}unbindEvents(){}async show(t=!1){let e=null,n=!1;e=setTimeout(()=>{!n&&this.problemListFilterManager&&(this.problemListFilterManager.showLoading(),n=!0)},300);try{await this.loadFavoriteProblems(t)}finally{e&&(clearTimeout(e),e=null)}}async hide(t=!1){this.problemListFilterManager&&this.problemListFilterManager.showProblemNodeTitle(!1),t&&this.problemListFilterManager&&(await this.problemListFilterManager.fadeOut(),this.problemListFilterManager.showProblemTags(!1))}showLoading(){}update(){}async loadFavoriteProblems(t=!1){var e;if(!this.problemListFilterManager){console.warn("ProblemListFilterManager \u672A\u8BBE\u7F6E\uFF0C\u65E0\u6CD5\u52A0\u8F7D\u6536\u85CF\u9898\u76EE");return}try{let n=((e=document.getElementById("language"))==null?void 0:e.value)||"C++",o=this.currentPsid?`/alg/starred?psid=${encodeURIComponent(this.currentPsid)}`:`/alg/starred?lang=${encodeURIComponent(n)}`,a=await(await fetch(o)).json();if(a.node&&a.node.problems.length>0){let s=new Map;a.problemTagsMap&&Object.entries(a.problemTagsMap).forEach(([l,c])=>{s.set(Number(l),c)}),this.favoriteNodes=[a.node],this.favoriteVideosol_dict=a.videosol_dict||{},this.favoriteVideosol_icon_dict=a.videosol_icon_dict||{},this.favoriteProblemTagsMap=s,this.problemListFilterManager.update(this.favoriteNodes,this.favoriteVideosol_dict,this.favoriteProblemTagsMap,t,this.favoriteVideosol_icon_dict),this.problemListFilterManager.showProblemTags(!0),this.problemListFilterManager.showProblemNodeTitle(!1)}else this.favoriteNodes=[],this.favoriteVideosol_dict={},this.favoriteVideosol_icon_dict={},this.favoriteProblemTagsMap=new Map,this.problemListFilterManager.setEmptyStateText("\u60A8\u76EE\u524D\u6CA1\u6709\u6536\u85CF\u7684\u9898\u76EE"),this.problemListFilterManager.update([],{},void 0,t,{}),this.problemListFilterManager.showProblemTags(!1),this.problemListFilterManager.showProblemNodeTitle(!1)}catch(n){console.error("\u52A0\u8F7D\u6536\u85CF\u9898\u76EE\u5931\u8D25:",n),this.favoriteNodes=[],this.favoriteVideosol_dict={},this.favoriteVideosol_icon_dict={},this.favoriteProblemTagsMap=new Map,this.problemListFilterManager.setEmptyStateText("\u60A8\u76EE\u524D\u6CA1\u6709\u6536\u85CF\u7684\u9898\u76EE"),this.problemListFilterManager.update([],{},void 0,!0,{}),this.problemListFilterManager.showProblemNodeTitle(!1)}}};var af="673c82a4d67fed3f6531c8e1",Ss="AI",Kr=class{constructor(t,e){p(this,"id","calendar");p(this,"name","\u573A\u6B21");p(this,"filterWrapper",null);p(this,"problemListFilterManager",null);p(this,"currentPsid","");p(this,"originalNodes",[]);p(this,"videosol_dict",{});p(this,"videosol_icon_dict",{});p(this,"problemTagsMap",new Map);p(this,"currentYear",new Date().getFullYear());p(this,"currentMonth",new Date().getMonth()+1);p(this,"selectedDate",null);p(this,"nodesByDate",new Map);p(this,"selectedSeasons",new Set(["summer","autumn"]));p(this,"selectedAiDirections",new Set(["ai","nonAi"]));p(this,"showAlgorithmTags",!1);p(this,"yearChangeHandler",null);p(this,"monthChangeHandler",null);p(this,"todayClickHandler",null);p(this,"calendarClickHandler",null);p(this,"seasonTagClickHandler",null);this.currentPsid=t,this.filterWrapper=document.getElementById("filter-section-wrapper"),e&&(this.problemListFilterManager=e);let n=new Date;this.currentYear=n.getFullYear(),this.currentMonth=n.getMonth()+1}setFilterManager(t){this.problemListFilterManager=t}setPsid(t){this.currentPsid=t}setOriginalData(t){this.originalNodes=t.nodes,this.videosol_dict=t.videosol_dict||{},this.videosol_icon_dict=t.videosol_icon_dict||{},t.problemTagsMap&&(t.problemTagsMap instanceof Map?this.problemTagsMap=t.problemTagsMap:(this.problemTagsMap=new Map,Object.entries(t.problemTagsMap).forEach(([e,n])=>{this.problemTagsMap.set(Number(e),n)}))),this.parseAndGroupNodesByDate()}init(t){this.originalNodes=t,this.parseAndGroupNodesByDate()}parseDateFromTitle(t){if(!t)return null;let e=String(t).replace(/号/g,"\u65E5"),n=/(\d{4})\s*年\s*(\d{1,2})\s*月\s*(\d{1,2})\s*(?:日|号)/,o=e.match(n);if(o){let s=parseInt(o[1],10),l=parseInt(o[2],10),c=parseInt(o[3],10);if(this.isValidDate(s,l,c)){let u=new Date(s,l-1,c);return{year:s,month:l,day:c,date:u}}}let r=/(\d{4})[.\-/](\d{1,2})[.\-/](\d{1,2})/,a=e.match(r);if(a){let s=parseInt(a[1],10),l=parseInt(a[2],10),c=parseInt(a[3],10);if(this.isValidDate(s,l,c)){let u=new Date(s,l-1,c);return{year:s,month:l,day:c,date:u}}}return null}isValidDate(t,e,n){if(t<1900||t>2100||e<1||e>12||n<1||n>31)return!1;let o=new Date(t,e-1,n);return o.getFullYear()===t&&o.getMonth()===e-1&&o.getDate()===n}parseAndGroupNodesByDate(){this.nodesByDate.clear(),this.originalNodes.forEach(t=>{let e=this.parseDateFromTitle(t.title);if(e){t.date=e.date;let n=`${e.year}-${String(e.month).padStart(2,"0")}-${String(e.day).padStart(2,"0")}`;this.nodesByDate.has(n)||this.nodesByDate.set(n,[]),this.nodesByDate.get(n).push(t)}})}getDateKey(t){let e=t.getFullYear(),n=t.getMonth()+1,o=t.getDate();return`${e}-${String(n).padStart(2,"0")}-${String(o).padStart(2,"0")}`}getStorageKey(){var e;let t=(e=window.UserContext)==null?void 0:e._id;return!t||t===0?null:`calendar_filter_uid_${t}_psid_${this.currentPsid}`}saveState(){let t=this.getStorageKey();if(!t)return;let e={year:this.currentYear,month:this.currentMonth,selectedDate:this.selectedDate?this.getDateKey(this.selectedDate):null,selectedSeasons:Array.from(this.selectedSeasons),showAlgorithmTags:this.showAlgorithmTags};this.isAiDirectionPool()&&(e.selectedAiDirections=Array.from(this.selectedAiDirections));try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.error("\u4FDD\u5B58\u65E5\u5386\u72B6\u6001\u5931\u8D25:",n)}}restoreState(){let t=this.getStorageKey();if(!t)return!1;try{let e=localStorage.getItem(t);if(!e)return!1;let n=JSON.parse(e);if(n.year&&n.month){let o=parseInt(n.year,10),r=parseInt(n.month,10);o>=1900&&o<=2100&&r>=1&&r<=12&&(this.currentYear=o,this.currentMonth=r)}if(n.selectedDate){let[o,r,a]=n.selectedDate.split("-").map(Number);this.isValidDate(o,r,a)&&(this.selectedDate=new Date(o,r-1,a))}if(n.selectedSeasons&&Array.isArray(n.selectedSeasons)?this.selectedSeasons=new Set(n.selectedSeasons):this.selectedSeasons=new Set(["summer","autumn"]),typeof n.showAlgorithmTags=="boolean"?this.showAlgorithmTags=n.showAlgorithmTags:this.showAlgorithmTags=!1,this.isAiDirectionPool()){let o=n.selectedAiDirections;Array.isArray(o)&&o.length>0?this.selectedAiDirections=new Set(o):this.selectedAiDirections=new Set(["ai","nonAi"])}else this.selectedAiDirections=new Set(["ai","nonAi"]);return this.selectedDate!==null}catch(e){return console.error("\u6062\u590D\u65E5\u5386\u72B6\u6001\u5931\u8D25:",e),!1}}getNodeCountForDate(t){let e=this.getDateKey(t),n=this.nodesByDate.get(e)||[];if(this.selectedSeasons.size===0)return 0;let o=n.filter(r=>{if(!r.date)return!1;let a=r.date.getMonth()+1;return!!(this.selectedSeasons.has("summer")&&a>=3&&a<=7||this.selectedSeasons.has("autumn")&&(a>=8||a<=2))});return this.applyAiDirectionFilter(o).length}getNodesForDate(t){let e=this.getDateKey(t);return this.nodesByDate.get(e)||[]}filterNodesBySeason(){if(this.selectedSeasons.size===0)return[];let t=[];for(let e of this.originalNodes){if(!e.date)continue;let n=e.date.getMonth()+1;if(this.selectedSeasons.has("summer")&&n>=3&&n<=7){t.push(e);continue}if(this.selectedSeasons.has("autumn")&&(n>=8||n<=2)){t.push(e);continue}}return t}isAiDirectionPool(){return this.currentPsid===af}nodeIsAiDirectionByTitle(t){var n;let e=String((n=t==null?void 0:t.title)!=null?n:"");return e.includes("\u975EAI")?!1:e.includes(Ss)}applyAiDirectionFilter(t){return this.isAiDirectionPool()?this.selectedAiDirections.size===0?[]:t.filter(e=>{let n=this.nodeIsAiDirectionByTitle(e);return!!(n&&this.selectedAiDirections.has("ai")||!n&&this.selectedAiDirections.has("nonAi"))}):t}render(){return`
${this.renderCalendarContent()}
`}renderCalendarContent(){let t=["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u65E5"],e=this.generateCalendarDays(),n=[],o=new Date().getFullYear();for(let a=2022;a<=o;a++)n.push(a);let r=[];for(let a=1;a<=12;a++)r.push(a);return`
${t.map(a=>`
${a}
`).join("")}
${e.map(a=>this.renderCalendarDay(a)).join("")}
`}generateCalendarDays(){let t=[],e=new Date(this.currentYear,this.currentMonth-1,1),n=new Date(this.currentYear,this.currentMonth,0),o=e.getDay();o=o===0?6:o-1;let r=new Date(this.currentYear,this.currentMonth-1,0);for(let s=o-1;s>=0;s--){let l=new Date(this.currentYear,this.currentMonth-2,r.getDate()-s);t.push({date:l,isCurrentMonth:!1})}for(let s=1;s<=n.getDate();s++){let l=new Date(this.currentYear,this.currentMonth-1,s);t.push({date:l,isCurrentMonth:!0})}let a=42-t.length;for(let s=1;s<=a;s++){let l=new Date(this.currentYear,this.currentMonth,s);t.push({date:l,isCurrentMonth:!1})}return t}getGreenIntensityLevel(t){return t<=0?0:t>=5?5:t}isDarkMode(){return document.body.classList.contains("theme--dark")}getGreenBackgroundColor(t){if(this.isDarkMode())switch(t){case 0:return"#30363d";case 1:return"#0e4429";case 2:return"#006d32";case 3:return"#26a641";case 4:return"#39d353";case 5:return"#39d353";default:return"#30363d"}else switch(t){case 0:return"#ffffff";case 1:return"#c6e48b";case 2:return"#7bc96f";case 3:return"#239a3b";case 4:return"#196127";case 5:return"#196127";default:return"#ffffff"}}renderCalendarDay(t){let e=t.date.getDate(),n=t.isCurrentMonth?this.getNodeCountForDate(t.date):0,o=this.getDateKey(t.date),r=this.selectedDate&&this.getDateKey(this.selectedDate)===o,a=t.isCurrentMonth?this.getGreenIntensityLevel(n):0,s=this.getGreenBackgroundColor(a);return`
`}bindEvents(){if(!this.filterWrapper&&(this.filterWrapper=document.getElementById("filter-section-wrapper"),!this.filterWrapper))return;this.unbindEvents(),this.yearChangeHandler=o=>{let r=o.target;this.currentYear=parseInt(r.value,10),this.refreshCalendar(),this.saveState()},this.monthChangeHandler=o=>{let r=o.target;this.currentMonth=parseInt(r.value,10),this.refreshCalendar(),this.saveState()},this.todayClickHandler=o=>{o.preventDefault();let r=new Date;this.selectedDate=null,this.currentYear=r.getFullYear(),this.currentMonth=r.getMonth()+1,this.selectedSeasons=new Set(["summer","autumn"]),this.selectedAiDirections=new Set(["ai","nonAi"]),this.showAlgorithmTags=!1,this.problemListFilterManager&&this.problemListFilterManager.showProblemTags(!1),this.refreshCalendar(),this.filterNodesBySeasonOnly(),this.saveState()},this.calendarClickHandler=o=>{let a=o.target.closest(".calendar-day");if(!a)return;let s=a.getAttribute("data-date");if(!s)return;let[l,c,u]=s.split("-").map(Number),d=new Date(l,c-1,u);d.getFullYear()===this.currentYear&&d.getMonth()===this.currentMonth-1?this.selectDate(d):(this.currentYear=d.getFullYear(),this.currentMonth=d.getMonth()+1,this.refreshCalendar(),setTimeout(()=>{this.selectDate(d)},50))};let t=this.filterWrapper.querySelector("#calendar-year-select"),e=this.filterWrapper.querySelector("#calendar-month-select"),n=this.filterWrapper.querySelector("#calendar-today-btn");t&&t.addEventListener("change",this.yearChangeHandler),e&&e.addEventListener("change",this.monthChangeHandler),n&&n.addEventListener("click",this.todayClickHandler),this.filterWrapper&&this.filterWrapper.addEventListener("click",this.calendarClickHandler),this.seasonTagClickHandler=o=>{let r=o.target,a=r.closest(".filter-tag[data-algorithm-tag]");if(a){this.showAlgorithmTags=!this.showAlgorithmTags,this.showAlgorithmTags?a.classList.add("selected"):a.classList.remove("selected"),this.problemListFilterManager&&this.problemListFilterManager.showProblemTags(this.showAlgorithmTags),this.saveState();return}let s=r.closest(".filter-tag[data-ai-direction]");if(s&&this.isAiDirectionPool()){let u=s.getAttribute("data-ai-direction");if(!u)return;this.selectedAiDirections.has(u)?this.selectedAiDirections.delete(u):this.selectedAiDirections.add(u),this.selectedAiDirections.has(u)?s.classList.add("selected"):s.classList.remove("selected"),this.refreshCalendar(),this.selectedDate?setTimeout(()=>{this.filterNodesByDate(this.selectedDate)},50):setTimeout(()=>{this.filterNodesBySeasonOnly()},50),this.saveState();return}let l=r.closest(".filter-tag[data-season]");if(!l)return;let c=l.getAttribute("data-season");c&&(this.selectedSeasons.has(c)?this.selectedSeasons.delete(c):this.selectedSeasons.add(c),this.selectedSeasons.has(c)?l.classList.add("selected"):l.classList.remove("selected"),this.refreshCalendar(),this.selectedDate?setTimeout(()=>{this.filterNodesByDate(this.selectedDate)},50):setTimeout(()=>{this.filterNodesBySeasonOnly()},50),this.saveState())},this.filterWrapper&&this.filterWrapper.addEventListener("click",this.seasonTagClickHandler)}unbindEvents(){if(!this.filterWrapper)return;let t=this.filterWrapper.querySelector("#calendar-year-select"),e=this.filterWrapper.querySelector("#calendar-month-select"),n=this.filterWrapper.querySelector("#calendar-today-btn");t&&this.yearChangeHandler&&t.removeEventListener("change",this.yearChangeHandler),e&&this.monthChangeHandler&&e.removeEventListener("change",this.monthChangeHandler),n&&this.todayClickHandler&&n.removeEventListener("click",this.todayClickHandler),this.filterWrapper&&this.calendarClickHandler&&this.filterWrapper.removeEventListener("click",this.calendarClickHandler),this.filterWrapper&&this.seasonTagClickHandler&&this.filterWrapper.removeEventListener("click",this.seasonTagClickHandler),this.yearChangeHandler=null,this.monthChangeHandler=null,this.todayClickHandler=null,this.calendarClickHandler=null,this.seasonTagClickHandler=null}refreshCalendar(){if(!this.filterWrapper)return;let t=this.selectedDate?this.getDateKey(this.selectedDate):null,e=this.filterWrapper.querySelector(".filter-calendar-content");if(e&&(e.innerHTML=this.renderCalendarContent()),t){let n=this.filterWrapper.querySelector(`.calendar-day[data-date="${t}"]`);n&&n.classList.add("selected")}this.bindEvents()}selectDate(t){this.selectedDate&&this.getDateKey(this.selectedDate)===this.getDateKey(t)||(this.selectedDate=t,this.filterWrapper&&this.filterWrapper.querySelectorAll(".calendar-day").forEach(n=>{n.getAttribute("data-date")===this.getDateKey(t)?n.classList.add("selected"):n.classList.remove("selected")}),this.filterNodesByDate(t),this.saveState())}filterNodesByDate(t,e=!1){if(!this.problemListFilterManager)return;let n=this.getNodesForDate(t),o=this.filterNodesBySeason(),r=n.filter(a=>o.some(s=>s.title===a.title||s.id===a.id));r=this.applyAiDirectionFilter(r),r.length>0?this.problemListFilterManager.update(r,this.videosol_dict,this.problemTagsMap,e,this.videosol_icon_dict):(this.problemListFilterManager.setEmptyStateText("\u8BE5\u65E5\u671F\u6CA1\u6709\u573A\u6B21"),this.problemListFilterManager.update([],{},void 0,e,this.videosol_icon_dict))}filterNodesBySeasonOnly(t=!1){if(!this.problemListFilterManager)return;let e=this.applyAiDirectionFilter(this.filterNodesBySeason());e.length>0?this.problemListFilterManager.update(e,this.videosol_dict,this.problemTagsMap,t,this.videosol_icon_dict):(this.problemListFilterManager.setEmptyStateText("\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE"),this.problemListFilterManager.update([],{},void 0,t,this.videosol_icon_dict))}async show(t=!1){let e=this.restoreState();this.refreshCalendar(),this.problemListFilterManager&&this.problemListFilterManager.showProblemTags(this.showAlgorithmTags),e&&this.selectedDate?setTimeout(()=>{this.filterNodesByDate(this.selectedDate,t)},50):this.problemListFilterManager&&(t&&await this.problemListFilterManager.fadeOut(),this.filterNodesBySeasonOnly(t))}async hide(t=!1){t&&this.problemListFilterManager&&(await this.problemListFilterManager.fadeOut(),this.problemListFilterManager&&this.problemListFilterManager.showProblemTags(!1)),this.saveState(),this.selectedDate=null}showLoading(){}update(){this.parseAndGroupNodesByDate(),this.refreshCalendar()}getSelectedDate(){return this.selectedDate}};var Ti=class{constructor(t){p(this,"modules",new Map);p(this,"moduleOrder",[]);p(this,"activeModuleId",null);p(this,"isTabSwitching",!1);p(this,"filterWrapper",null);p(this,"tabClickHandler",null);p(this,"config");p(this,"knowledgeFilter");p(this,"nodeTitleFilter");p(this,"favoriteFilter");p(this,"calendarFilter");p(this,"problemListFilterManager");p(this,"moduleNames",new Map);this.config=t,this.filterWrapper=document.getElementById("filter-section-wrapper"),this.problemListFilterManager=t.problemListFilterManager;let e=t.moduleNames||{};this.moduleNames.set("nodeTitle",e.nodeTitle||"\u8282\u70B9\u540D"),this.moduleNames.set("knowledge",e.knowledge||"\u77E5\u8BC6\u70B9"),this.moduleNames.set("favorite",e.favorite||"\u6536\u85CF"),this.moduleNames.set("calendar",e.calendar||"\u573A\u6B21"),this.knowledgeFilter=new Io(t.psid,t.problemListFilterManager),this.nodeTitleFilter=new Ho(t.psid,t.problemListFilterManager),this.favoriteFilter=new Po(t.psid,t.problemListFilterManager),this.calendarFilter=new Kr(t.psid,t.problemListFilterManager),this.modules.set("nodeTitle",this.nodeTitleFilter),this.modules.set("knowledge",this.knowledgeFilter),this.modules.set("favorite",this.favoriteFilter),this.modules.set("calendar",this.calendarFilter),this.configureModules(t.modules),t.defaultActiveModule?this.moduleOrder.includes(t.defaultActiveModule)?this.activeModuleId=t.defaultActiveModule:(console.warn(`\u6307\u5B9A\u7684\u9ED8\u8BA4\u6A21\u5757 ${t.defaultActiveModule} \u672A\u542F\u7528\uFF0C\u4F7F\u7528\u7B2C\u4E00\u4E2A\u542F\u7528\u7684\u6A21\u5757`),this.activeModuleId=this.moduleOrder[0]||null):this.activeModuleId=this.moduleOrder[0]||null,this.moduleOrder.length===0&&console.warn("TopicFilter: \u6CA1\u6709\u542F\u7528\u4EFB\u4F55\u6A21\u5757\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E")}configureModules(t){if(!t||t.length===0){this.moduleOrder=[];return}let e=t.filter(o=>o.enabled!==!1);e.sort((o,r)=>{let a=o.order!==void 0?o.order:1/0,s=r.order!==void 0?r.order:1/0;return a!==s?a-s:t.indexOf(o)-t.indexOf(r)});let n=e.map(o=>o.id).filter(o=>this.modules.has(o));e.forEach(o=>{o.name&&this.moduleNames.set(o.id,o.name)}),this.moduleOrder=n}setNodeTitleFilterData(t){this.nodeTitleFilter.setOriginalData(t)}setAllAlgTags(t){this.knowledgeFilter.setAllAlgTags(t)}setKnowledgeFilterData(t){this.knowledgeFilter.setOriginalData(t)}setCalendarFilterData(t){this.calendarFilter.setOriginalData(t)}setFilterManager(t){this.problemListFilterManager=t,this.knowledgeFilter.setFilterManager(t),this.nodeTitleFilter.setFilterManager(t),this.favoriteFilter.setFilterManager(t),this.calendarFilter.setFilterManager(t)}getActiveTab(){return this.activeModuleId||""}getSelectedTopics(){return this.activeModuleId==="knowledge"?this.knowledgeFilter.getSelectedTopics():this.activeModuleId==="nodeTitle"?this.nodeTitleFilter.getSelectedTopics():this.knowledgeFilter.getSelectedTopics()}init(t,e){this.config.psid=e,this.favoriteFilter.setPsid(e),this.calendarFilter.setPsid(e),this.knowledgeFilter.init(t),this.nodeTitleFilter.init(t),this.calendarFilter.init(t)}generateFilterHTML(){let t=this.activeModuleId?this.modules.get(this.activeModuleId):null,e=t?t.render():"";return`
${this.moduleOrder.map(o=>{let r=this.modules.get(o);if(!r)return"";let a=o===this.activeModuleId,s=this.moduleNames.get(o)||r.name;return`
${s}
`}).join("")}
${e}
`}bindFilterEvents(){if(!this.filterWrapper&&(this.filterWrapper=document.getElementById("filter-section-wrapper"),!this.filterWrapper))return;this.unbindFilterEvents(),this.tabClickHandler=e=>{let o=e.target.closest(".filter-tab");if(o){if(e.stopPropagation(),this.isTabSwitching)return;let r=o.getAttribute("data-tab");r&&r!==this.activeModuleId&&this.switchModule(r)}},this.filterWrapper.addEventListener("click",this.tabClickHandler);let t=this.activeModuleId?this.modules.get(this.activeModuleId):null;t&&t.bindEvents()}unbindFilterEvents(){this.filterWrapper&&this.tabClickHandler&&(this.filterWrapper.removeEventListener("click",this.tabClickHandler),this.tabClickHandler=null),this.modules.forEach(t=>{t.unbindEvents()})}disableTabButtons(){if(!this.filterWrapper)return;this.filterWrapper.querySelectorAll(".filter-tab").forEach(e=>{e.style.pointerEvents="none",e.style.opacity="0.6",e.style.cursor="not-allowed"})}enableTabButtons(){if(!this.filterWrapper)return;this.filterWrapper.querySelectorAll(".filter-tab").forEach(e=>{e.style.pointerEvents="auto",e.style.opacity="1",e.style.cursor="pointer"})}async switchModule(t){if(!this.modules.has(t)){console.warn(`\u6A21\u5757 ${t} \u4E0D\u5B58\u5728`);return}this.isTabSwitching=!0,this.disableTabButtons();let e=this.activeModuleId?this.modules.get(this.activeModuleId):null,n=this.modules.get(t);if(n){if(e){let o=e.hide(!0);o instanceof Promise&&await o,e.unbindEvents()}this.activeModuleId=t,this.filterWrapper&&(this.filterWrapper.innerHTML=this.generateFilterHTML(),this.isTabSwitching&&this.disableTabButtons(),this.bindFilterEvents());try{let o=n.show(!0);o instanceof Promise&&await o,await new Promise(r=>setTimeout(r,320))}finally{this.isTabSwitching=!1,this.enableTabButtons()}}}renderAndBind(){requestAnimationFrame(()=>{this.bindFilterEvents();let t=this.activeModuleId?this.modules.get(this.activeModuleId):null;t&&t.show()})}showFilterLoading(){this.unbindFilterEvents();let t=document.getElementById("filter-section-wrapper");t&&(this.filterWrapper=t,t.innerHTML=`
`)}update(t,e){let n=document.getElementById("filter-section-wrapper");n&&(this.unbindFilterEvents(),this.filterWrapper=n,n.style.opacity="0",this.init(t,e),n.innerHTML=this.generateFilterHTML(),requestAnimationFrame(()=>{n.style.transition="opacity 0.3s",n.style.opacity="1",this.renderAndBind()}))}registerModule(t,e,n){if(this.modules.set(t.id,t),n&&this.moduleNames.set(t.id,n),e){let o=this.moduleOrder.indexOf(t.id);if(o>=0&&this.moduleOrder.splice(o,1),e.enabled!==!1){let r=this.moduleOrder.findIndex(a=>{var l;let s=(l=this.config.modules)==null?void 0:l.find(c=>c.id===a);return s&&(s.order||0)>(e.order||0)});r>=0?this.moduleOrder.splice(r,0,t.id):this.moduleOrder.push(t.id)}}else this.moduleOrder.includes(t.id)||this.moduleOrder.push(t.id)}unregisterModule(t){let e=this.modules.get(t);e&&(e.unbindEvents(),this.modules.delete(t),this.moduleOrder=this.moduleOrder.filter(n=>n!==t),this.activeModuleId===t&&this.moduleOrder.length>0&&(this.activeModuleId=this.moduleOrder[0]))}};var js=class{constructor(t){p(this,"problemList");this.problemList=t}filterByTopics(t){this.problemList.filterByTopics(t)}resetFilter(){this.problemList.resetFilter()}getAvailableTopics(){return this.problemList.getAvailableTopics()}hideProblem(t,e){this.problemList.hideProblem(t,e)}showProblemTags(t){this.problemList.showProblemTags(t)}showProblemNodeTitle(t){this.problemList.showProblemNodeTitle(t)}fadeOut(){return this.problemList.fadeOut()}async fadeOutAndUpdate(t,e,n,o=!0,r){return this.problemList.fadeOutAndUpdate(t,e,n,o,r)}update(t,e,n,o=!0,r){this.problemList.update(t,e,n,o,r)}setEmptyStateText(t){this.problemList.setEmptyStateText(t)}showLoading(){this.problemList.showLoading()}};function sf(i){var e;let t=new Set;for(let n of i)if(!(!n.problems||!Array.isArray(n.problems)))for(let o of n.problems){let r=(e=o.docId)!=null?e:o.pid;if(r==null||r==="")continue;let a=typeof r=="number"?r:Number(r);Number.isNaN(a)||t.add(a)}return t}var zi=class{constructor(t){p(this,"nodes",[]);p(this,"videosol_dict",{});p(this,"videosol_icon_dict",{});p(this,"container",null);p(this,"filterManager");p(this,"problemTags",new Map);p(this,"showTags",!1);p(this,"pidToNodeTitle",new Map);p(this,"showNodeTitle",!1);p(this,"showDifficulty",!0);p(this,"emptyStateText","\u5F53\u524D\u7B5B\u9009\u6761\u4EF6\u4E0B\u65E0\u53EF\u7528\u9898\u76EE");p(this,"tabManager",null);p(this,"TAB_ID","problemList");p(this,"onVisibleProblemsChange");this.container=document.getElementById("problemList"),this.filterManager=new js(this),t&&t.showDifficulty!==void 0&&(this.showDifficulty=t.showDifficulty)}setTabManager(t){this.tabManager=t}getFilterManager(){return this.filterManager}setOnVisibleProblemsChange(t){this.onVisibleProblemsChange=t}filterByTopics(t){var o;let e=(o=this.container)==null?void 0:o.querySelectorAll(".topic-group");if(!e)return;let n=!1;e.forEach((r,a)=>{let s=this.nodes[a];s&&t.has(s.title)?(r.style.display="block",n=!0):r.style.display="none"}),!n&&this.nodes.length>0?this.showEmptyState():this.hideEmptyState()}showEmptyState(){if(!this.container)return;let t=this.container.querySelector(".problem-list-empty");t||(t=document.createElement("div"),t.className="topic-group problem-list-empty",this.container.appendChild(t));let e=t;e.innerHTML=`
`,e.style.display="block"}hideEmptyState(){if(!this.container)return;let t=this.container.querySelector(".problem-list-empty");t&&(t.style.display="none")}resetFilter(){var e;let t=(e=this.container)==null?void 0:e.querySelectorAll(".topic-group");t&&(t.forEach(n=>{n.style.display="block"}),this.hideEmptyState())}getAvailableTopics(){return this.nodes.map(t=>t.title)}hideProblem(t,e){var o;let n=(o=this.container)==null?void 0:o.querySelector(`.topic-group[data-node-id="${t}"] .problem-item[data-doc-id="${e}"]`);n&&(n.style.display="none")}setEmptyStateText(t){var n;this.emptyStateText=t;let e=(n=this.container)==null?void 0:n.querySelector(".problem-list-empty");if(e){let o=e.querySelector(".empty-text");o&&(o.textContent=t)}}showProblemTags(t){this.showTags=t,this.container&&this.container.querySelectorAll(".problem-tags").forEach(n=>{n.style.display=t?"flex":"none"})}showProblemNodeTitle(t){this.showNodeTitle=t,this.container&&this.container.querySelectorAll(".problem-node-title-wrapper").forEach(n=>{n.style.display=t?"inline-block":"none"})}truncateNodeTitle(t){return t?t.length<=11?t:t.substring(0,11)+"...":""}shouldShowVideoIcon(t){if(this.videosol_icon_dict&&Object.prototype.hasOwnProperty.call(this.videosol_icon_dict,t))return!!this.videosol_icon_dict[t];let e=this.videosol_dict[t];return typeof e=="string"&&e.length>0}isBilibiliVideoUrl(t){let e=t.trim();if(!e)return!1;try{let o=new URL(e,window.location.origin).hostname.toLowerCase();return o.includes("bilibili.com")||o.includes("bilibili.cn")||o==="b23.tv"||o.endsWith(".b23.tv")}catch(n){return!1}}bindVideoIconEvents(){if(!this.container)return;this.container.querySelectorAll(".problem-video-icon").forEach(e=>{e.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation();let o=e,r=(o.getAttribute("data-video-url")||"").trim(),a=(o.getAttribute("data-pid")||"").trim();if(a){if(!r){window.location.assign(`/p/${encodeURIComponent(a)}#videoSol`);return}this.isBilibiliVideoUrl(r)?window.open(r,"_blank","noopener,noreferrer"):window.location.assign(`/p/${encodeURIComponent(a)}#videoSol`)}})})}calculatePidToNodeTitleMap(){this.pidToNodeTitle.clear(),this.nodes.forEach(t=>{t.problems&&Array.isArray(t.problems)&&t.problems.forEach(e=>{if(e.pid){let n=e.originalNodeTitle||t.title;this.pidToNodeTitle.set(e.pid,n)}})})}setProblemTags(t,e){this.problemTags.set(t,e)}setProblemTagsBatch(t){this.problemTags=t}show(){if(!this.container)return;let t=document.querySelector(".problems-section");if(!t)return;let e=t.querySelector(".course-tab-content.active");e&&e.id!=="problemList"?(e.classList.add("fade-out"),setTimeout(()=>{t.querySelectorAll(".course-tab-content").forEach(n=>{n.classList.remove("active","fade-out")}),this.container.classList.add("active")},300)):e||this.container.classList.add("active")}hide(){this.container&&this.container.classList.remove("active")}getContainer(){return this.container}getDifficultyClass(t){return t>=1&&t<=3?"easy":t>=4&&t<=6?"medium":t>=7&&t<=10?"hard":"unknown"}getDifficultyText(t){return t>=1&&t<=3?"\u7B80\u5355":t>=4&&t<=6?"\u4E2D\u7B49":t>=7&&t<=10?"\u56F0\u96BE":"\u672A\u77E5"}escapeHtmlAttr(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}generateHTML(){if(this.nodes.length===0)return`
`;let t="";return this.nodes.forEach(e=>{t+=`
${e.problems.map(n=>{var l;let o=(this.problemTags.get(n.docId)||[]).slice(0,3),r=n.titleExternalUrl,a=r||`/p/${n.pid}`,s=r?'target="_blank" rel="noopener noreferrer"':"";return`
`}).join("")}
`}),t}showLoading(){let t=document.getElementById("problemList");t&&(t.innerHTML=`
\u6B63\u5728\u52A0\u8F7D\u9898\u76EE\u5217\u8868...
`)}render(t,e,n){let o=document.getElementById("problemList");o&&(this.nodes=t,this.videosol_dict=e||{},this.videosol_icon_dict=n||{},this.calculatePidToNodeTitleMap(),o.innerHTML=this.generateHTML())}fadeOut(){return new Promise(t=>{if(!this.container){t();return}let e=[];this.container.querySelectorAll(".topic-group").forEach(o=>{let r=o;window.getComputedStyle(r).display!=="none"&&e.push(r)}),e.length>0?e.forEach(o=>{o.style.transition="opacity 0.15s ease, transform 0.15s ease",o.style.opacity="0",o.style.transform="translateY(20px)"}):(this.container.style.transition="opacity 0.15s ease, transform 0.15s ease",this.container.style.opacity="0",this.container.style.transform="translateY(20px)"),setTimeout(()=>{t()},150)})}async fadeOutAndUpdate(t,e,n,o=!0,r){await this.fadeOut(),this.update(t,e,n,o,r)}update(t,e,n,o=!0,r){var l;let a=document.getElementById("problemList");if(!a)return;this.nodes=t,this.videosol_dict=e||{},this.videosol_icon_dict=r||{},this.calculatePidToNodeTitleMap(),n&&(this.problemTags=n),o?(this.hide(),a.innerHTML=this.generateHTML(),this.bindVideoIconEvents(),setTimeout(()=>{this.show(),setTimeout(()=>{this.tabManager&&this.tabManager.getActiveTabId()!==this.TAB_ID&&this.tabManager.switchTab(this.TAB_ID)},300)},10)):(a.style.transition="none",a.innerHTML=this.generateHTML(),this.bindVideoIconEvents(),a.style.opacity="1",a.style.transform="translateY(0)",requestAnimationFrame(()=>{a.style.transition="",this.show(),setTimeout(()=>{this.tabManager&&this.tabManager.getActiveTabId()!==this.TAB_ID&&this.tabManager.switchTab(this.TAB_ID)},300)}));let s=sf(t);(l=this.onVisibleProblemsChange)==null||l.call(this,{docIds:s,nodeCount:t.length})}};var Oi=class{constructor(t={}){p(this,"mask");p(this,"dialog");p(this,"options");p(this,"resolveFunc");this.options={width:"480px",showMask:!0,maskClosable:!1,zIndex:999,...t},this.mask=document.createElement("div"),this.mask.className="base-dialog-mask",this.dialog=document.createElement("div"),this.dialog.className="base-dialog"}getBaseStyles(){return`
`}open(){return new Promise(t=>{this.resolveFunc=t,this.dialog.innerHTML=this.getBaseStyles()+this.renderContent(),this.mask.appendChild(this.dialog),document.body.appendChild(this.mask),requestAnimationFrame(()=>{this.mask.classList.add("show")}),this.bindEvents(),this.options.maskClosable&&this.mask.addEventListener("click",()=>this.close(null)),this.dialog.addEventListener("click",e=>e.stopPropagation())})}close(t){this.mask.classList.remove("show"),setTimeout(()=>{this.mask.parentNode&&this.mask.parentNode.removeChild(this.mask),this.resolveFunc&&this.resolveFunc(t)},300)}};function gn(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}var Qr=class i extends Oi{constructor(e){var n;super({...e,width:"760px",maskClosable:!1});p(this,"qrcodeUrl");p(this,"message");p(this,"confirmText");p(this,"cancelText");p(this,"loadingText");p(this,"isLoading",!1);p(this,"price");p(this,"courseTitle");p(this,"courseSubtitle");p(this,"vipPageUrl");p(this,"payTarget");this.qrcodeUrl=e.qrcodeUrl,this.message=e.message||"\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801\u5B8C\u6210\u652F\u4ED8",this.confirmText=e.confirmText||"\u5DF2\u5B8C\u6210\u652F\u4ED8",this.cancelText=e.cancelText||"\u53D6\u6D88",this.loadingText=e.loadingText||"\u6B63\u5728\u751F\u6210\u4E8C\u7EF4\u7801...",this.price=e.price,this.payTarget=(n=e.payTarget)!=null?n:"problemset",this.courseTitle=e.courseTitle||(this.payTarget==="course"?"\u672C\u8BFE\u7A0B":"\u672C\u9898\u5E93"),this.courseSubtitle=e.courseSubtitle||"",this.vipPageUrl=e.vipPageUrl||`${typeof window<"u"?window.location.origin:""}/vip`,this.isLoading=this.qrcodeUrl instanceof Promise,this.dialog.classList.add("purchase-dialog-skin")}renderContent(){var w;let e=(w=this.options.title)==null?void 0:w.trim(),n=this.payTarget==="course"?"\u8D2D\u4E70\u8BFE\u7A0B":"\u8D2D\u4E70\u9898\u5E93",o=e||n,r=gn(this.courseTitle),a=gn(this.courseSubtitle),s=gn(this.message),l=gn(this.vipPageUrl),c=typeof window<"u"?window.location.origin:"",u=gn(`${c}/pset`),d=gn(`${c}/alg`),h=gn(`${c}/shore-share`),v=this.courseSubtitle?`${a}
`:"";return`
\u5FAE\u4FE1\u652F\u4ED8
${r}
${v}
${this.price!==void 0?`
\uFFE5${this.price}
`:""}
\u4E8C\u7EF4\u7801\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
\u52A0\u5165\u4F1A\u5458
\u5F00\u901A CodeFun2000 \u4F1A\u5458\uFF0C\u4E00\u7AD9\u89E3\u9501\u6240\u6709
\u82E5\u60A8\u8BA1\u5212\u591A\u5BB6\u516C\u53F8\u7684\u7B14\u8BD5/\u9762\u8BD5\uFF0C\u5347\u7EA7\u4F1A\u5458\u6BD4\u591A\u6B21\u5355\u72EC\u8D2D\u8BFE\u66F4\u5212\u7B97 \uFF1B\u5EFA\u8BAE\u5148\u4E86\u89E3\u6743\u76CA\u518D\u51B3\u5B9A\u3002
\u8FDB\u5165\u4F1A\u5458\u4ECB\u7ECD\u9875
\u2192
`}bindEvents(){let e=this.dialog.querySelector(".purchase-confirm-btn"),n=this.dialog.querySelector(".purchase-cancel-btn");e.addEventListener("click",()=>this.close(!0)),n.addEventListener("click",()=>this.close(!1)),this.qrcodeUrl instanceof Promise?this.loadQrcode():this.showQrcode(this.qrcodeUrl)}async loadQrcode(){let e=this.dialog.querySelector(".purchase-qrcode"),n=this.dialog.querySelector(".purchase-loading"),o=this.dialog.querySelector(".purchase-error");try{let r=await this.qrcodeUrl;this.showQrcode(r)}catch(r){console.error("\u52A0\u8F7D\u4E8C\u7EF4\u7801\u5931\u8D25:",r),n.classList.add("hidden"),o.classList.add("show")}}showQrcode(e){let n=this.dialog.querySelector(".purchase-qrcode"),o=this.dialog.querySelector(".purchase-loading");n.src=e,n.classList.add("loaded"),o&&o.classList.add("hidden")}static open(e){return new i(e).open()}};var sd=ae(re());var lf=`
`,cf=`
${lf}
\u5206\u5B50\u4E3A\u5F53\u524D\u9898\u76EE\u5217\u8868\u7B5B\u9009\u8303\u56F4\u5185\u5DF2\u901A\u8FC7\u7684\u9898\u76EE\u6570\uFF0C\u5206\u6BCD\u4E3A\u8BE5\u8303\u56F4\u5185\u7684\u9898\u76EE\u603B\u6570\uFF08\u540C\u4E00\u9898\u76EE\u53EA\u8BA1\u4E00\u6B21\uFF09\u3002\u5207\u6362\u53F3\u4FA7\u6807\u7B7E\u3001\u8282\u70B9\u3001\u573A\u6B21\u6216\u6536\u85CF\u7B49\u7B5B\u9009\u65F6\uFF0C\u7EDF\u8BA1\u8303\u56F4\u4E0E\u6570\u5B57\u4F1A\u540C\u6B65\u53D8\u5316\u3002
`,ad="__lp_plain_btn_style_injected__";function df(){if(window[ad])return;let i=document.createElement("style");i.textContent=`
.lp-plain-btn {
display: inline-block;
padding: 6px 14px;
font-size: 13px;
line-height: 1.4;
color: #1890ff !important;
background: #fff;
border: 1px solid #1890ff !important;
border-radius: 6px;
text-decoration: none;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
text-align: center;
}
/* :hover \u5FC5\u987B\u4E0E\u9ED8\u8BA4\u8272\u7684 !important \u540C\u7EA7\uFF0C\u5426\u5219\u4ECD\u4E3A\u84DD\u5B57+\u84DD\u5E95\u5BFC\u81F4\u6587\u5B57\u4E0D\u53EF\u89C1 */
.lp-plain-btn:hover,
.lp-plain-btn:focus-visible {
color: #fff !important;
background: #1890ff !important;
border-color: #1890ff !important;
}
.theme--dark .lp-plain-btn {
background: transparent;
color: #4dabf7 !important;
border-color: #4dabf7 !important;
}
.theme--dark .lp-plain-btn:hover,
.theme--dark .lp-plain-btn:focus-visible {
background: #4dabf7 !important;
color: #fff !important;
border-color: #4dabf7 !important;
}
`,document.head.appendChild(i),window[ad]=!0}var Ui=class{constructor(t,e="problemset"){p(this,"currentPsid","");p(this,"currentPrice",0);p(this,"quickLinks",[]);p(this,"payDialogTarget");this.currentPsid=t,this.payDialogTarget=e,df()}setQuickLinks(t){this.quickLinks=t}addQuickLink(t){this.quickLinks.push(t)}removeQuickLink(t){this.quickLinks.splice(t,1)}clearQuickLinks(){this.quickLinks=[]}refreshQuickLinks(){let t=document.querySelector(".learning-progress-links");t&&(t.innerHTML=this.renderQuickLinksInner())}renderQuickLinksInner(){return this.quickLinks.map(t=>`${t.label} `).join("")}renderQuickLinksHTML(){return this.quickLinks.length?`${this.renderQuickLinksInner()}
`:""}updatePsid(t){this.currentPsid=t}updatePrice(t){this.currentPrice=t}showLoading(){let t=document.getElementById("badge-section");t&&(t.innerHTML=`
`)}generatePurchasedHTML(t,e,n){return`
\u5B66\u4E60\u8FDB\u5EA6
${cf}
${t} \u4E13\u9898 \xB7 ${e} \u9898
${n}
/ ${e} \u9898\u5DF2\u5B8C\u6210
${this.renderQuickLinksHTML()}
`}generateUnpurchasedHTML(t,e){return`
\u5F00\u59CB\u5B66\u4E60
${t} \u4E2A\u4E13\u9898 \u5171 ${e} \u9053\u9898
\u5B8C\u6210\u8D2D\u4E70\u540E\u5373\u53EF\u5F00\u59CB\u5B66\u4E60
\u5728\u7EBF\u5237\u9898\u6D4B\u8BC4
\u6587\u5B57\u9898\u89E3
\u89C6\u9891\u9898\u89E3
\u4E13\u7528\u7B54\u7591\u7FA4
${this.renderQuickLinksHTML()}
`}update(t,e,n,o,r,a){r!==void 0&&(this.currentPrice=r);let s=document.getElementById("badge-section");if(s){if(s.style.opacity="0",t)s.innerHTML=this.generatePurchasedHTML(e,n,o);else if(s.innerHTML=this.generateUnpurchasedHTML(e,n),a){let l=document.getElementById("buy-button");l&&l.addEventListener("click",a)}requestAnimationFrame(()=>{s.style.transition="opacity 0.3s",s.style.opacity="1",this.bindBuyButton()})}}updateProgress(t,e,n){let o=document.getElementById("badge-section"),r=o==null?void 0:o.querySelector(".problem-count");r&&(r.textContent=`${t} \u4E13\u9898 \xB7 ${e} \u9898`);let a=o==null?void 0:o.querySelector(".learning-progress-count");a&&(a.textContent=String(n));let s=a==null?void 0:a.nextElementSibling;s&&(s.textContent=`/ ${e} \u9898\u5DF2\u5B8C\u6210`)}getCourseSummaryForPayDialog(){var n,o,r,a,s;let t=((o=(n=document.querySelector(".page-title"))==null?void 0:n.textContent)==null?void 0:o.trim())||"\u672C\u9898\u5E93 / \u8BFE\u7A0B",e=((a=(r=document.querySelector(".page-subtitle"))==null?void 0:r.textContent)==null?void 0:a.replace(/\s+/g," ").trim())||"";if(!e){let l=document.querySelector(".badge-section .problem-count"),c=(s=l==null?void 0:l.textContent)==null?void 0:s.trim();c&&(e=c)}return{title:t,subtitle:e}}async handleBuyButtonClick(t){if(t.preventDefault(),window.UserContext._id===0){let a=document.getElementsByName("nav_login")[0];a&&a.click();return}let{title:n,subtitle:o}=this.getCourseSummaryForPayDialog();await Qr.open({payTarget:this.payDialogTarget,qrcodeUrl:(async()=>(await sd.request.post(`/pset/${this.currentPsid}`,{psid:this.currentPsid,action:"buy_separately"})).qrcode_url)(),message:"\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801\u5B8C\u6210\u652F\u4ED8",confirmText:"\u5DF2\u5B8C\u6210\u652F\u4ED8",cancelText:"\u53D6\u6D88",loadingText:"\u6B63\u5728\u751F\u6210\u652F\u4ED8\u4E8C\u7EF4\u7801...",price:this.currentPrice,courseTitle:n,courseSubtitle:o,vipPageUrl:`${window.location.origin}/vip`})&&window.location.reload()}bindBuyButton(){let t=document.getElementById("buy-button");t&&t.addEventListener("click",e=>this.handleBuyButtonClick(e))}};var Wi=class{constructor(){p(this,"container",null);this.container=document.getElementById("overview")}show(){if(!this.container)return;let t=document.querySelector(".problems-section");if(!t)return;let e=t.querySelector(".course-tab-content.active");e&&e.id!=="overview"?(e.classList.add("fade-out"),setTimeout(()=>{t.querySelectorAll(".course-tab-content").forEach(n=>{n.classList.remove("active","fade-out")}),this.container.classList.add("active")},300)):e||this.container.classList.add("active")}hide(){this.container&&this.container.classList.remove("active")}getContainer(){return this.container}showLoading(){let t=document.querySelector("#overview .overview-content");t&&(t.classList.add("loading-skeleton"),t.innerHTML=`
`)}update(t){let e=document.querySelector("#overview .overview-content");e&&t&&(e.classList.remove("loading-skeleton"),e.style.opacity="0",e.innerHTML=t,requestAnimationFrame(()=>{e.style.transition="opacity 0.2s",e.style.opacity="1"}))}};var Yi=class{constructor(){p(this,"container",null);p(this,"topNDefault",12);p(this,"solvedTopNDefault",8);this.container=document.getElementById("analysis")}show(){this.container&&this.container.classList.add("active")}hide(){this.container&&this.container.classList.remove("active")}getContainer(){return this.container}showLoading(){this.container&&(this.container.innerHTML=`
\u6B63\u5728\u52A0\u8F7D\u7EDF\u8BA1\u6570\u636E...
${Array.from({length:8}).map(()=>`
`).join("")}
`)}update(t){var N;if(!this.container)return;let e=t.problemTagsMap,n=t.allAlgTags,o=(N=t.topN)!=null?N:this.topNDefault,r=t.nodes,a=t.donePids,s=t.totalProblems;if(!e||e.size===0){this.renderEmpty("\u5F53\u524D\u9898\u5E93\u6682\u65E0\u53EF\u7528\u6807\u7B7E\u6570\u636E");return}let l=new Map;for(let Y of e.values())if(!(!Y||Y.length===0))for(let te of Y)te&&l.set(te,(l.get(te)||0)+1);if(l.size===0){this.renderEmpty("\u5F53\u524D\u9898\u5E93\u6682\u65E0\u53EF\u7528\u6807\u7B7E\u6570\u636E");return}let c=Array.from(l.values()).reduce((Y,te)=>Y+te,0),u=new Map;n&&Array.isArray(n)&&n.forEach((Y,te)=>u.set(Y,te));let d=Array.from(l.entries()).sort((Y,te)=>{var pe,G;let ve=Y[1],ne=te[1];return ne!==ve?ne-ve:((pe=u.get(Y[0]))!=null?pe:Number.MAX_SAFE_INTEGER)-((G=u.get(te[0]))!=null?G:Number.MAX_SAFE_INTEGER)}),h=d.slice(0,o),w=d.slice(o).reduce((Y,[,te])=>Y+te,0),k=Math.max(...h.map(([,Y])=>Y),w);this.container.innerHTML="";let L=document.createElement("div");L.className="topic-group analysis-card";let H=document.createElement("div");H.className="topic-header";let _=document.createElement("div");_.className="topic-icon",_.style.background="transparent",_.style.width="auto",_.innerHTML=' ';let M=document.createElement("h2");M.className="topic-title",M.textContent="\u7B97\u6CD5\u6807\u7B7E\u9898\u76EE\u5206\u5E03";let A=document.createElement("span");A.className="topic-count",A.textContent=`\u603B\u8BA1 ${c} \u6B21\u6807\u6CE8`,H.appendChild(_),H.appendChild(M),H.appendChild(A);let D=document.createElement("div");D.className="analysis-body";let $=document.createElement("div");$.className="analysis-subtitle",$.textContent="\u7EDF\u8BA1\u53E3\u5F84\uFF1A\u6BCF\u9898\u7684\u591A\u4E2A\u6807\u7B7E\u5C06\u5206\u522B\u8BA1\u6570";let q=document.createElement("div");q.className="analysis-bars";let K=(Y,te)=>{let ve=document.createElement("div");ve.className="analysis-bar-item";let ne=document.createElement("div");ne.className="analysis-bar-value",ne.textContent=String(te);let pe=document.createElement("div");pe.className="analysis-bar-track";let G=document.createElement("div");G.className="analysis-bar";let Ee=k>0?te/k:0;G.style.height=`${Math.max(0,Math.round(Ee*1e3)/10)}%`,pe.appendChild(G);let Je=document.createElement("div");Je.className="analysis-bar-label",Je.textContent=Y,ve.appendChild(ne),ve.appendChild(pe),ve.appendChild(Je),q.appendChild(ve)};h.forEach(([Y,te])=>K(Y,te)),w>0&&K("\u5176\u4ED6",w);let ee=document.createElement("div");ee.className="analysis-hint",ee.textContent=`\u5C55\u793A Top ${o}\uFF0C\u5176\u4F59\u5408\u5E76\u4E3A\u201C\u5176\u4ED6\u201D\u3002`,L.appendChild(H),D.appendChild($),D.appendChild(q),D.appendChild(ee);let R=this.buildSolvedSection({nodes:r,donePids:a,problemTagsMap:e,totalProblems:s});R&&D.appendChild(R),L.appendChild(D),this.container.appendChild(L)}buildSolvedSection(t){let{nodes:e,donePids:n,totalProblems:o,problemTagsMap:r}=t,a=this.collectSolvedProblems(e,n);if(!a)return null;let{solvedCount:s,totalCount:l,solvedDocIds:c}=a,u=o&&o>0?o:l,d=u>0?s/u:0,h=document.createElement("div");h.className="analysis-solved";let v=document.createElement("div");v.className="analysis-divider",h.appendChild(v);let w=document.createElement("div");w.className="analysis-section-title",w.textContent="\u6211\u7684\u505A\u9898\u60C5\u51B5",h.appendChild(w);let k=document.createElement("div");k.className="analysis-metrics",k.innerHTML=`
\u5B8C\u6210\u7387
${Math.round(d*1e3)/10}%
`,h.appendChild(k);let L=new Map;for(let R of c){let N=r.get(R)||[];for(let Y of N)Y&&L.set(Y,(L.get(Y)||0)+1)}let H=document.createElement("div");if(H.className="analysis-subtitle",H.textContent="\u5DF2\u89E3\u51B3\u9898\u76EE\u7684\u6807\u7B7E\u5206\u5E03\uFF08\u6309\u9898\u76EE\u6807\u7B7E\u8BA1\u6570\uFF09",h.appendChild(H),L.size===0){let R=document.createElement("div");return R.className="analysis-empty",R.textContent="\u6682\u65E0\u5DF2\u89E3\u51B3\u9898\u76EE\u7684\u6807\u7B7E\u6570\u636E",h.appendChild(R),h}let _=Array.from(L.entries()).sort((R,N)=>N[1]-R[1]),M=this.solvedTopNDefault,A=_.slice(0,M),D=_.slice(M).reduce((R,[,N])=>R+N,0),$=Math.max(...A.map(([,R])=>R),D),q=document.createElement("div");q.className="analysis-bars analysis-bars--compact";let K=(R,N)=>{let Y=document.createElement("div");Y.className="analysis-bar-item";let te=document.createElement("div");te.className="analysis-bar-value",te.textContent=String(N);let ve=document.createElement("div");ve.className="analysis-bar-track";let ne=document.createElement("div");ne.className="analysis-bar";let pe=$>0?N/$:0;ne.style.height=`${Math.max(0,Math.round(pe*1e3)/10)}%`,ve.appendChild(ne);let G=document.createElement("div");G.className="analysis-bar-label",G.textContent=R,Y.appendChild(te),Y.appendChild(ve),Y.appendChild(G),q.appendChild(Y)};A.forEach(([R,N])=>K(R,N)),D>0&&K("\u5176\u4ED6",D),h.appendChild(q);let ee=document.createElement("div");return ee.className="analysis-hint",ee.textContent=`\u5C55\u793A Top ${M}\uFF0C\u5176\u4F59\u5408\u5E76\u4E3A\u201C\u5176\u4ED6\u201D\u3002`,h.appendChild(ee),h}collectSolvedProblems(t,e){if(!t||!Array.isArray(t)||t.length===0)return null;let n=new Set;Array.isArray(e)&&e.forEach(s=>{s!=null&&n.add(String(s))});let o=0,r=0,a=new Set;return t.forEach(s=>{let l=s==null?void 0:s.problems;Array.isArray(l)&&l.forEach(c=>{if(!c)return;let u=c.pid,d=c.docId;o+=1,(!!c.isDone||u!==void 0&&n.has(String(u)))&&(r+=1,typeof d=="number"&&a.add(d))})}),{solvedCount:r,totalCount:o,solvedDocIds:a}}renderEmpty(t){this.container&&(this.container.innerHTML=`
`)}};var As=ae(re());var Gr=class i extends Oi{constructor(e){super({...e,width:"480px",maskClosable:!1});p(this,"selectedLanguage",null);p(this,"languages");p(this,"message");p(this,"confirmText");this.languages=e.languages||["C++","Python","Java"],this.message=e.message||"\u8BF7\u9009\u62E9\u60A8\u8981\u5B66\u4E60\u7684\u7F16\u7A0B\u8BED\u8A00",this.confirmText=e.confirmText||"\u5F00\u59CB\u5B66\u4E60"}renderContent(){return`
${this.message}
${this.languages.map(e=>`
${e}
`).join("")}
`}bindEvents(){let e=this.dialog.querySelector(".language-confirm-btn"),n=this.dialog.querySelectorAll(".language-option");n.forEach(o=>{o.addEventListener("click",()=>{n.forEach(r=>r.classList.remove("selected")),o.classList.add("selected"),this.selectedLanguage=o.getAttribute("data-language"),e.disabled=!1})}),e.addEventListener("click",()=>{this.selectedLanguage&&this.close(this.selectedLanguage)})}static open(e){return new i(e).open()}};var Vi=class{constructor(t={}){p(this,"languageChangeCallback",null);p(this,"currentPsid","");p(this,"have",!1);p(this,"config");p(this,"languages",["C++","Python","Java"]);p(this,"languageOptions",[]);p(this,"useLanguageSelector",!1);let e=t.languageSelector;e&&e.enabled?(this.useLanguageSelector=!0,this.languageOptions=e.options||[],this.languages=this.languageOptions.map(n=>n.name)):(this.useLanguageSelector=!1,this.languages=t.languages||["C++","Python","Java"]),this.config={showShareButton:t.showShareButton!==!1,showLanguageSelector:(e==null?void 0:e.enabled)!==!1&&t.showLanguageSelector!==!1,languages:this.languages,languageSelector:e},this.renderRightActions(),this.initShareButton(),this.initLanguageSelector()}setLanguageChangeCallback(t){this.languageChangeCallback=t}setCurrentPsid(t){this.currentPsid=t}setHave(t){this.have=t}renderRightActions(){var e,n;let t=document.getElementById("header-right-actions");if(t){if(t.innerHTML="",this.config.showLanguageSelector){let o=document.createElement("div");o.className="language-selector";let r=((e=this.config.languageSelector)==null?void 0:e.label)||"\u8BED\u8A00\u9009\u62E9\uFF1A",a=((n=this.config.languageSelector)==null?void 0:n.placeholder)||"\u8BF7\u9009\u62E9\u8BED\u8A00";o.innerHTML=`
${r}
${a}
${this.languages.map(s=>`${s} `).join("")}
`,t.appendChild(o)}if(this.config.showShareButton){let o=document.createElement("button");o.className="share-button",o.title="\u5206\u4EAB\u94FE\u63A5",o.innerHTML=`
`,t.appendChild(o)}}}initShareButton(){if(!this.config.showShareButton)return;let t=document.querySelector(".share-button");t&&t.addEventListener("click",()=>{this.shareLink()}),window.shareLink=()=>this.shareLink()}initLanguageSelector(){if(!this.config.showLanguageSelector)return;let t=document.getElementById("language");t&&t.addEventListener("change",e=>{let n=e.target;n.value&&this.changeLanguage(n.value)}),window.changeLanguage=e=>this.changeLanguage(e)}getStorageKey(){var e;let t=(e=window.UserContext)==null?void 0:e._id;return!t||t===0?null:`algcourse_language_uid_${t}`}checkAndShowLanguageDialog(){let t=this.getStorageKey();if(!t){let n=document.getElementById("language");n&&(n.value="Python",this.changeLanguage("Python"));return}let e=localStorage.getItem(t);if(e){let n=document.getElementById("language");n&&n.value!==e&&(n.value=e,this.changeLanguage(e));return}Gr.open({title:"\u9009\u62E9\u5B66\u4E60\u8BED\u8A00",message:"\u8BF7\u9009\u62E9\u60A8\u8981\u5B66\u4E60\u7684\u7F16\u7A0B\u8BED\u8A00\uFF0C\u540E\u7EED\u53EF\u5728\u53F3\u4E0A\u89D2\u5207\u6362",languages:["C++","Python","Java"],confirmText:"\u5F00\u59CB\u5B66\u4E60"}).then(n=>{localStorage.setItem(t,n);let o=document.getElementById("language");o&&o.value!==n&&(o.value=n,this.changeLanguage(n))})}async changeLanguage(t){let e=this.getStorageKey();if(e&&localStorage.setItem(e,t),!document.getElementById("problemList")){console.warn("[Header] changeLanguage: problemList \u5143\u7D20\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}try{this.languageChangeCallback&&this.languageChangeCallback.onLanguageChangeStart();let o;if(this.useLanguageSelector&&this.languageOptions.length>0){let a=this.languageOptions.find(c=>c.name===t);if(!a){console.error("[Header] changeLanguage: \u672A\u627E\u5230\u5BF9\u5E94\u7684\u8BED\u8A00\u9009\u9879",{language:t,availableOptions:this.languageOptions}),this.languageChangeCallback&&this.languageChangeCallback.onLanguageChangeError(new Error("\u672A\u627E\u5230\u5BF9\u5E94\u7684\u8BED\u8A00\u9009\u9879"));return}let s=`/problemset/data?psid=${encodeURIComponent(a.psid)}`,[l]=await Promise.all([As.request.get(s),new Promise(c=>setTimeout(c,200))]);o=l}else{let a=`/alg/data?lang=${encodeURIComponent(t)}`,[s]=await Promise.all([As.request.get(a),new Promise(l=>setTimeout(l,200))]);o=s}if(o.error){console.error("[Header] changeLanguage: \u83B7\u53D6\u6570\u636E\u5931\u8D25",{error:o.error}),this.languageChangeCallback&&this.languageChangeCallback.onLanguageChangeError(o.error);return}o.psid&&(this.currentPsid=o.psid),this.have=o.have,o.ps?this.update(o.ps.name,o.ps.picture_url,o.ps.introduction):console.warn("[Header] changeLanguage: data.ps \u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u5934\u90E8\u66F4\u65B0"),this.languageChangeCallback&&this.languageChangeCallback.onLanguageChangeComplete(o);let r=document.getElementById("language");if(r){let a=r.querySelector('option[value=""]');a&&a.remove()}}catch(o){console.error("[Header] changeLanguage: \u5F02\u5E38\u6355\u83B7",{error:o,errorMessage:o instanceof Error?o.message:String(o),errorStack:o instanceof Error?o.stack:void 0}),this.languageChangeCallback&&this.languageChangeCallback.onLanguageChangeError(o)}}shareLink(){let t=window.location.href;navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then(()=>{this.showToast()}).catch(e=>{this.fallbackCopy(t)}):this.fallbackCopy(t)}fallbackCopy(t){let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),this.showToast()}catch(n){console.error("\u590D\u5236\u5931\u8D25:",n)}document.body.removeChild(e)}showToast(){let t=document.getElementById("copyToast");t&&(t.classList.add("show"),setTimeout(()=>{t.classList.remove("show")},2e3))}updateTitle(t){let e=document.querySelector(".page-title");if(e){let n=e.closest(".header-title-section");n&&n.querySelectorAll(".skeleton-line").forEach(r=>r.remove()),e.innerHTML="",e.textContent=t}}updateSubtitle(t){let e=document.querySelector(".page-subtitle");if(e){let n=e.closest(".header-title-section");n&&n.querySelectorAll(".skeleton-line").forEach(r=>r.remove()),e.innerHTML="",e.textContent=t}}updateImage(t){let e=document.querySelector(".header-image-loading"),n=document.querySelector(".header-image");if(n)if(t){e&&(e.style.display="none"),n.style.display="block",n.style.opacity="0",n.style.transition="opacity 0.3s";let o=new Image;o.onload=()=>{n.src=t,n.alt="",n.style.opacity="1"},o.onerror=()=>{n.style.opacity="1"},o.src=t}else e&&(e.style.display="block"),n.style.display="none"}update(t,e,n){this.updateTitle(t),this.updateImage(e),n!==void 0&&this.updateSubtitle(n)}updateEditButton(){let t=document.querySelector(".edit-button");t&&this.currentPsid&&(t.href=`/pset/edit/${this.currentPsid}`)}};var Ji=class{constructor(){p(this,"tabs",new Map);p(this,"activeTabId",null);p(this,"tabsContainer",null);p(this,"contentContainer",null);this.tabsContainer=document.querySelector(".sidebar-tabs"),this.contentContainer=document.querySelector(".problems-section")}registerTab(t){this.tabs.has(t.id)&&console.warn(`\u9009\u9879\u5361 ${t.id} \u5DF2\u5B58\u5728\uFF0C\u5C06\u88AB\u8986\u76D6`),this.tabs.set(t.id,t),this.activeTabId===null?this.activeTabId=t.id:t.defaultActive&&(this.activeTabId=t.id)}switchTab(t){if(!this.tabs.has(t)){console.warn(`\u9009\u9879\u5361 ${t} \u4E0D\u5B58\u5728`);return}if(this.activeTabId===t)return;let e=this.activeTabId?this.tabs.get(this.activeTabId):null,n=this.tabs.get(t);n&&(e&&e.content.hide(),n.content.show(),this.updateTabButtons(t),this.activeTabId=t)}render(){if(!this.tabsContainer||!this.contentContainer){console.warn("\u9009\u9879\u5361\u5BB9\u5668\u672A\u627E\u5230\uFF0C\u8BF7\u786E\u4FDD HTML \u4E2D\u5B58\u5728 .sidebar-tabs \u548C .problems-section");return}if(this.tabsContainer.innerHTML="",this.contentContainer.querySelectorAll(".course-tab-content").forEach(t=>{t.classList.remove("active","fade-out")}),this.tabs.forEach((t,e)=>{let n=document.createElement("button");n.className="sidebar-tab",n.textContent=t.label,n.dataset.tabId=e,e===this.activeTabId&&n.classList.add("active"),n.addEventListener("click",()=>{this.switchTab(e)}),this.tabsContainer.appendChild(n)}),this.activeTabId){let t=this.tabs.get(this.activeTabId);t&&t.content.show()}window.switchTab=t=>{this.switchTab(t)}}updateTabButtons(t){if(!this.tabsContainer)return;this.tabsContainer.querySelectorAll(".sidebar-tab").forEach(n=>{n.dataset.tabId===t?n.classList.add("active"):n.classList.remove("active")})}getActiveTabId(){return this.activeTabId}getTabs(){return Array.from(this.tabs.values())}getManager(){return{switchTab:t=>this.switchTab(t),getActiveTabId:()=>this.getActiveTabId()}}};var ld=ae(re());var Ki=class{constructor(t){p(this,"container",null);p(this,"psid","");this.container=document.getElementById(t)}setPsid(t){this.psid=t}async load(){if(!(!this.container||!this.psid))try{this.showLoading();let t=`/api_ps/weekly_ranking?psid=${encodeURIComponent(this.psid)}`,e=await ld.request.get(t);e&&e.ranking?this.render(e.ranking):this.showError("\u52A0\u8F7D\u5468\u699C\u6570\u636E\u5931\u8D25")}catch(t){console.error("\u52A0\u8F7D\u5468\u699C\u6570\u636E\u5931\u8D25:",t),this.showError("\u52A0\u8F7D\u5468\u699C\u6570\u636E\u5931\u8D25")}}render(t){if(!this.container)return;if(t.length===0){this.container.innerHTML=`
\u6682\u65E0\u5468\u699C\u6570\u636E
`;return}let e=t.map((n,o)=>{let r=o+1,a=n.avatar||"//dn-qiniu-avatar.qbox.me/avatar/";return`
${r}
${n.uname}
\u5B8C\u6210 ${n.solvedCount} \u9898
`}).join("");this.container.innerHTML=`
\u5468\u699C
\u6309\u672C\u5468\u5B8C\u6210\u9898\u76EE\u6570\u8BA1\u7B97\u6392\u540D\uFF0C\u6BCF3\u4E2A\u5C0F\u65F6\u66F4\u65B0\u4E00\u6B21\u699C\u5355
${e}
`}showLoading(){this.container&&(this.container.innerHTML=`
`)}showError(t){this.container&&(this.container.innerHTML=`
`)}};var Do="",$o=!1,Xr,Qi,Bo,Zr,ea,$n,Gi,Is,cd=new Set;function pf(i){let t=new Set;if(!i||!Array.isArray(i))return t;for(let e of i){let n=typeof e=="number"?e:Number(e);Number.isNaN(n)||t.add(n)}return t}(0,ta.addPage)(new ta.NamedPage(["algcourse"],async()=>{var e;let i=document.querySelector("[data-initial-psid]");i&&(Do=i.getAttribute("data-initial-psid")||""),$n=new Vi({showShareButton:!0,showLanguageSelector:!0,languages:["C++","Python","Java"]}),Qi=new zi,Zr=new Wi,ea=new Yi,Bo=new Ui(Do,"course"),Is=new Ki("weekly-ranking-section"),Xr=new Ti({psid:Do,problemListFilterManager:Qi.getFilterManager(),modules:[{id:"nodeTitle",enabled:!0,order:1,name:"\u77E5\u8BC6\u70B9"},{id:"favorite",enabled:!0,order:2}],defaultActiveModule:"nodeTitle"}),Gi=new Ji,Qi.setTabManager(Gi.getManager()),Qi.setOnVisibleProblemsChange(({docIds:n,nodeCount:o})=>{if(!$o)return;let r=0;for(let a of n)cd.has(a)&&r++;Bo.updateProgress(o,n.size,r)}),Gi.registerTab({id:"problemList",label:"\u9898\u76EE\u5217\u8868",content:Qi,defaultActive:!0}),Gi.registerTab({id:"overview",label:"\u8BFE\u7A0B\u4ECB\u7ECD",content:Zr}),Gi.registerTab({id:"analysis",label:"\u6570\u636E\u5206\u6790",content:ea}),Gi.render();let t={onLanguageChangeStart:()=>{Qi.showLoading(),Zr.showLoading(),ea.showLoading(),Bo.showLoading(),Xr.showFilterLoading()},onLanguageChangeComplete:n=>{var r,a;n.psid&&(Do=n.psid,$n.setCurrentPsid(n.psid),Bo.updatePsid(n.psid),Is.setPsid(n.psid),Is.load()),$o=n.have,$n.setHave(n.have),cd=pf(n.donePids);let o=new Map;n.problemTagsMap&&Object.entries(n.problemTagsMap).forEach(([s,l])=>{o.set(Number(s),l)}),ea.update({problemTagsMap:o,allAlgTags:n.allAlgTags,nodes:n.nodes,donePids:n.donePids,totalProblems:n.totalProblems}),$n.update(n.ps.name,n.ps.picture_url,n.ps.introduction),$n.updateEditButton(),mf(!!n.isPending,!!n.have,n.psid,(r=n.ps)==null?void 0:r.price),Xr.setNodeTitleFilterData({nodes:n.nodes,videosol_dict:n.videosol_dict||{},videosol_icon_dict:n.videosol_icon_dict||{},problemTagsMap:o}),Zr.update(n.ps.profileRendered),Bo.update($o,n.ps.dagLength,n.totalProblems,((a=n.donePids)==null?void 0:a.length)||0,n.ps.price),Xr.update(n.nodes,n.psid)},onLanguageChangeError:n=>{console.error("\u8BED\u8A00\u5207\u6362\u9519\u8BEF:",n)}};$n.setLanguageChangeCallback(t),$n.setCurrentPsid(Do),$n.updateEditButton(),$o=((e=document.querySelector(".main-content"))==null?void 0:e.getAttribute("data-have"))==="True",$n.setHave($o),$n.checkAndShowLanguageDialog(),ff()}));function uf(i){let t=typeof i=="number"?i:Number(i);return!Number.isNaN(t)&&t>=.1}function mf(i,t,e,n){let o=document.querySelector(".header-buy-section");o&&(i?(o.innerHTML=`
\u7ACB\u5373\u6838\u9500
`,o.style.display="block"):!t&&uf(n)?(o.innerHTML=`
\u7ACB\u5373\u8D2D\u4E70
`,o.style.display="block"):(o.innerHTML="",o.style.display="none"))}var Hs=null,Ps=class{constructor(){p(this,"mask");p(this,"dialog");p(this,"vcode","");this.mask=document.createElement("div"),this.mask.className="wechat-verify-mask",this.dialog=document.createElement("div"),this.dialog.className="wechat-verify-dialog"}setVcode(t){this.vcode=t}open(){this.dialog.innerHTML=this.getStyles()+this.renderContent(),this.mask.appendChild(this.dialog),document.body.appendChild(this.mask),requestAnimationFrame(()=>{this.mask.classList.add("show")}),this.bindEvents(),this.dialog.addEventListener("click",t=>t.stopPropagation())}close(){this.mask.classList.remove("show"),setTimeout(()=>{this.mask.parentNode&&this.mask.parentNode.removeChild(this.mask)},300)}getStyles(){return`
`}renderContent(){return`
\xD7
\u8054\u7CFB\u5854\u5B50\u54E5\u6838\u9500
\u6DFB\u52A0\u5854\u5B50\u54E5\u5FAE\u4FE1\uFF08wx:codingyes\uFF09
\u51FA\u793A\u60A8\u7684\u6838\u9500\u7801\uFF1A${this.vcode||""}
\u5373\u53EF\u5B8C\u6210\u9898\u5E93\u6838\u9500
`}bindEvents(){let t=this.dialog.querySelector(".wechat-verify-close");t&&t.addEventListener("click",()=>this.close()),this.mask.addEventListener("click",()=>this.close());let e=n=>{n.key==="Escape"&&(this.close(),document.removeEventListener("keydown",e))};document.addEventListener("keydown",e)}};function ff(){document.addEventListener("click",i=>{let t=i.target;if(t&&t.id==="verify-button"){i.preventDefault(),i.stopPropagation();let n=(window.UiContext||{}).vcode||"";Hs=new Ps,Hs.setVcode(n),Hs.open()}})}var ia=ae(re());function dd(i){let t=new Set;if(!i||!Array.isArray(i))return t;for(let e of i){let n=typeof e=="number"?e:Number(e);Number.isNaN(n)||t.add(n)}return t}var na=class{constructor(){p(this,"psid","");p(this,"have",!1);p(this,"pageConfig",{});p(this,"donePidsSet",new Set);p(this,"header",null);p(this,"problemList",null);p(this,"overview",null);p(this,"analysis",null);p(this,"learningProgress",null);p(this,"weeklyRanking",null);p(this,"topicFilter",null);p(this,"tabManager",null)}async init(t){this.psid=t.psid||"",this.have=t.have||!1,this.pageConfig=t.pageConfig||{},this.initHeader(),this.initProblemList(),this.initOverview(),this.initAnalysis(),this.initLearningProgress(),this.initWeeklyRanking(),this.initTopicFilter(),this.initTabManager(),this.wireLearningProgressToProblemList(),t.ps&&this.updatePage(t)}initHeader(){let t=this.pageConfig.header||{},e=t.languageSelector,n=(e==null?void 0:e.enabled)!==!1&&((e==null?void 0:e.enabled)||t.showLanguageSelector)||!1;this.header=new Vi({showShareButton:t.showShareButton!==!1,showLanguageSelector:n,languages:t.languages||[],languageSelector:e}),this.header.setCurrentPsid(this.psid),this.header.setHave(this.have),n&&(e!=null&&e.options)&&this.setupLanguageChangeCallback()}setupLanguageChangeCallback(){if(!this.header)return;let t={onLanguageChangeStart:()=>{this.problemList&&this.problemList.showLoading(),this.overview&&this.overview.showLoading(),this.analysis&&this.analysis.showLoading(),this.learningProgress&&this.learningProgress.showLoading(),this.topicFilter&&this.topicFilter.showFilterLoading()},onLanguageChangeComplete:e=>{var n,o,r,a;try{e.psid&&(this.psid=e.psid,this.header&&this.header.setCurrentPsid(e.psid),this.learningProgress&&this.learningProgress.updatePsid(e.psid),this.weeklyRanking&&(this.weeklyRanking.setPsid(e.psid),this.weeklyRanking.load())),this.have=e.have||!1,this.header&&this.header.setHave(this.have),this.donePidsSet=dd(e.donePids);let s=new Map;if(e.problemTagsMap&&Object.entries(e.problemTagsMap).forEach(([u,d])=>{s.set(Number(u),d)}),this.analysis&&this.analysis.update({problemTagsMap:s,allAlgTags:e.allAlgTags,nodes:e.nodes,donePids:e.donePids,totalProblems:e.totalProblems}),this.header&&e.ps){let u=e.ps.name||"",d=e.ps.picture_url||"",h=e.ps.introduction||"";this.header.update(u,d,h),this.header.updateEditButton()}else console.warn("[ProblemSetPage] onLanguageChangeComplete: \u8DF3\u8FC7 Header \u66F4\u65B0",{hasHeader:!!this.header,hasPs:!!e.ps});let c=(this.pageConfig.header||{}).languageSelector;if(this.topicFilter&&e.nodes&&e.nodes.length>0){let u=e.videosol_dict||{},d=e.videosol_icon_dict||{};((this.pageConfig.topicFilter||{}).modules||[]).forEach(w=>{w.id==="calendar"&&w.enabled!==!1?this.topicFilter.setCalendarFilterData({nodes:e.nodes,problemTagsMap:s,videosol_dict:u,videosol_icon_dict:d}):w.id==="knowledge"&&w.enabled!==!1?this.topicFilter.setKnowledgeFilterData({nodes:e.nodes,problemTagsMap:s,videosol_dict:u,videosol_icon_dict:d}):w.id==="nodeTitle"&&w.enabled!==!1&&this.topicFilter.setNodeTitleFilterData({nodes:e.nodes,problemTagsMap:s,videosol_dict:u,videosol_icon_dict:d})}),this.topicFilter.update(e.nodes,e.psid)}else console.warn("[ProblemSetPage] onLanguageChangeComplete: \u8DF3\u8FC7 TopicFilter \u66F4\u65B0",{hasTopicFilter:!!this.topicFilter,hasNodes:!!e.nodes,nodesLength:(n=e.nodes)==null?void 0:n.length});this.overview&&((o=e.ps)!=null&&o.profileRendered)&&this.overview.update(e.ps.profileRendered),this.learningProgress&&((r=e.ps)==null?void 0:r.dagLength)!==void 0&&this.learningProgress.update(this.have,e.ps.dagLength,e.totalProblems||0,((a=e.donePids)==null?void 0:a.length)||0,e.ps.price||0),this.weeklyRanking&&e.psid&&(this.weeklyRanking.setPsid(e.psid),this.weeklyRanking.load())}catch(s){throw console.error("[ProblemSetPage] onLanguageChangeComplete: \u5904\u7406\u6570\u636E\u65F6\u53D1\u751F\u9519\u8BEF",{error:s,errorMessage:s instanceof Error?s.message:String(s),errorStack:s instanceof Error?s.stack:void 0}),s}},onLanguageChangeError:e=>{console.error("[ProblemSetPage] onLanguageChangeError: \u8BED\u8A00\u5207\u6362\u9519\u8BEF",{error:e,errorMessage:e instanceof Error?e.message:String(e),errorStack:e instanceof Error?e.stack:void 0})}};this.header.setLanguageChangeCallback(t)}initProblemList(){let t=this.pageConfig.problemList||{};this.problemList=new zi({showDifficulty:t.showDifficulty!==!1})}initOverview(){this.overview=new Wi}initAnalysis(){this.analysis=new Yi}initLearningProgress(){var t,e;if(((t=this.pageConfig.learningProgress)==null?void 0:t.enabled)!==!1){this.learningProgress=new Ui(this.psid,"problemset");let n=(e=this.pageConfig.learningProgress)==null?void 0:e.quickLinks;n&&n.length>0&&this.learningProgress.setQuickLinks(n)}}wireLearningProgressToProblemList(){!this.problemList||!this.learningProgress||this.problemList.setOnVisibleProblemsChange(({docIds:t,nodeCount:e})=>{if(!this.have||!this.learningProgress)return;let n=0;for(let o of t)this.donePidsSet.has(o)&&n++;this.learningProgress.updateProgress(e,t.size,n)})}initWeeklyRanking(){var t;((t=this.pageConfig.weeklyRanking)==null?void 0:t.enabled)!==!1&&(this.weeklyRanking=new Ki("weekly-ranking-section"),this.psid&&(this.weeklyRanking.setPsid(this.psid),this.weeklyRanking.load()))}initTopicFilter(){var o;if(!this.problemList)return;let t=this.pageConfig.topicFilter||{},e=t.modules||[],n=t.defaultActiveModule||((o=e[0])==null?void 0:o.id)||null;this.topicFilter=new Ti({psid:this.psid,problemListFilterManager:this.problemList.getFilterManager(),modules:e,defaultActiveModule:n,moduleNames:t.moduleNames})}initTabManager(){var n;this.tabManager=new Ji,this.problemList&&this.problemList.setTabManager(this.tabManager.getManager());let t=((n=this.pageConfig.tabs)==null?void 0:n.tabs)||[],e=t.some(o=>o.id==="analysis");t.forEach(o=>{let r=null;o.id==="problemList"&&this.problemList?r=this.problemList:o.id==="overview"&&this.overview?r=this.overview:o.id==="analysis"&&this.analysis&&(r=this.analysis),r&&this.tabManager.registerTab({id:o.id,label:o.label,content:r,defaultActive:o.defaultActive||!1})}),t.length===0?(this.problemList&&this.tabManager.registerTab({id:"problemList",label:"\u9898\u76EE\u5217\u8868",content:this.problemList,defaultActive:!0}),this.overview&&this.tabManager.registerTab({id:"overview",label:"\u9898\u5E93\u4ECB\u7ECD",content:this.overview}),this.analysis&&this.tabManager.registerTab({id:"analysis",label:"\u6570\u636E\u5206\u6790",content:this.analysis})):!e&&this.analysis&&this.tabManager.registerTab({id:"analysis",label:"\u6570\u636E\u5206\u6790",content:this.analysis}),this.tabManager.render()}updatePage(t){var n;if(!t.ps)return;this.donePidsSet=dd(t.donePids),this.header&&(this.header.update(t.ps.name||"",t.ps.picture_url||"",t.ps.introduction||""),this.header.updateEditButton());let e=new Map;if(t.problemTagsMap&&Object.entries(t.problemTagsMap).forEach(([o,r])=>{e.set(Number(o),r)}),this.analysis&&this.analysis.update({problemTagsMap:e,allAlgTags:t.allAlgTags,nodes:t.nodes,donePids:t.donePids,totalProblems:t.totalProblems}),this.topicFilter&&t.nodes&&t.nodes.length>0){let o=t.videosol_dict||{},r=t.videosol_icon_dict||{};t.allAlgTags&&Array.isArray(t.allAlgTags)&&t.allAlgTags.length>0&&this.topicFilter.setAllAlgTags(t.allAlgTags),((this.pageConfig.topicFilter||{}).modules||[]).forEach(l=>{l.id==="calendar"&&l.enabled!==!1?this.topicFilter.setCalendarFilterData({nodes:t.nodes,problemTagsMap:e,videosol_dict:o,videosol_icon_dict:r}):l.id==="knowledge"&&l.enabled!==!1?this.topicFilter.setKnowledgeFilterData({nodes:t.nodes,problemTagsMap:e,videosol_dict:o,videosol_icon_dict:r}):l.id==="nodeTitle"&&l.enabled!==!1&&this.topicFilter.setNodeTitleFilterData({nodes:t.nodes,problemTagsMap:e,videosol_dict:o,videosol_icon_dict:r})}),this.topicFilter.update(t.nodes,t.psid||this.psid)}if(this.overview&&t.ps.profile){let o=t.ps.profileRendered||t.ps.profile;this.overview.update(o)}this.learningProgress&&t.ps.dagLength!==void 0&&this.learningProgress.update(this.have,t.ps.dagLength,t.totalProblems||0,((n=t.donePids)==null?void 0:n.length)||0,t.ps.price||0),this.weeklyRanking&&this.psid&&(this.weeklyRanking.setPsid(this.psid),this.weeklyRanking.load())}getHeader(){return this.header}getProblemList(){return this.problemList}getTopicFilter(){return this.topicFilter}getTabManager(){return this.tabManager}};var pd=null;(0,ia.addPage)(new ia.NamedPage(["problemset"],async()=>{let i=window.UiContext||{};pd=new na,await pd.init({psid:i.psid||"",have:i.have||!1,ps:i.ps,nodes:i.nodes,donePids:i.donePids,totalProblems:i.totalProblems,videosol_dict:i.videosol_dict,videosol_icon_dict:i.videosol_icon_dict,problemTagsMap:i.problemTagsMap,allAlgTags:i.allAlgTags,pageConfig:i.pageConfig}),hf()}));var Ds=null,$s=class{constructor(){p(this,"mask");p(this,"dialog");p(this,"vcode","");this.mask=document.createElement("div"),this.mask.className="wechat-verify-mask",this.dialog=document.createElement("div"),this.dialog.className="wechat-verify-dialog"}setVcode(t){this.vcode=t}open(){this.dialog.innerHTML=this.getStyles()+this.renderContent(),this.mask.appendChild(this.dialog),document.body.appendChild(this.mask),requestAnimationFrame(()=>{this.mask.classList.add("show")}),this.bindEvents(),this.dialog.addEventListener("click",t=>t.stopPropagation())}close(){this.mask.classList.remove("show"),setTimeout(()=>{this.mask.parentNode&&this.mask.parentNode.removeChild(this.mask)},300)}getStyles(){return`
`}renderContent(){return`
\xD7
\u8054\u7CFB\u5854\u5B50\u54E5\u6838\u9500
\u6DFB\u52A0\u5854\u5B50\u54E5\u5FAE\u4FE1\uFF08wx:codingyes\uFF09
\u51FA\u793A\u60A8\u7684\u6838\u9500\u7801\uFF1A${this.vcode||""}
\u5373\u53EF\u5B8C\u6210\u9898\u5E93\u6838\u9500
`}bindEvents(){let t=this.dialog.querySelector(".wechat-verify-close");t&&t.addEventListener("click",()=>this.close()),this.mask.addEventListener("click",()=>this.close());let e=n=>{n.key==="Escape"&&(this.close(),document.removeEventListener("keydown",e))};document.addEventListener("keydown",e)}};function hf(){document.addEventListener("click",i=>{let t=i.target;if(t&&t.id==="verify-button"){i.preventDefault(),i.stopPropagation();let n=(window.UiContext||{}).vcode||"";Ds=new $s,Ds.setVcode(n),Ds.open()}})}var Ot=ae(re());(0,Ot.addPage)(new Ot.NamedPage(["choice_practice"],async()=>{var T,j,F,W;let i=window.UiContext||{},t=i.psid||"",e=i.tag1List||[],n=!!i.isChoiceAdmin,o=!!i.hasAccess;function r(){var x;let g=Number((x=window.UserContext)==null?void 0:x._id);return!g||!t?null:`cp_choice_ai_cduntil_${t}_${g}`}function a(){let g=r();if(!g)return null;try{let x=sessionStorage.getItem(g);if(!x)return null;let E=Number(x);return!Number.isFinite(E)||E<=Date.now()?null:E}catch(x){return null}}function s(g,x){let E=g!=null&&Number.isFinite(Number(g))&&Number(g)>Date.now()?Number(g):null,C=x!=null&&Number.isFinite(Number(x))&&Number(x)>Date.now()?Number(x):null;return E==null?C:C==null?E:Math.max(E,C)}function l(g){let x=r();if(x)try{g!=null&&Number.isFinite(g)&&g>Date.now()?sessionStorage.setItem(x,String(g)):sessionStorage.removeItem(x)}catch(E){}}let c=((T=i.choiceAi)==null?void 0:T.cooldownUntilMs)!=null?Number(i.choiceAi.cooldownUntilMs):null,u=s(c,a()),d={canUse:!!(i.choiceAi&&i.choiceAi.canUse),dailyLimit:((j=i.choiceAi)==null?void 0:j.dailyLimit)!=null?Number(i.choiceAi.dailyLimit):null,remaining:((F=i.choiceAi)==null?void 0:F.remaining)!=null?Number(i.choiceAi.remaining):null,cooldownWaitSec:u!=null?Math.max(0,Math.ceil((u-Date.now())/1e3)):Number((W=i.choiceAi)==null?void 0:W.cooldownWaitSec)||0,cooldownUntilMs:u};l(d.cooldownUntilMs);function h(){return d.cooldownUntilMs==null?!1:Date.now()=d.cooldownUntilMs?(d.cooldownUntilMs=null,d.cooldownWaitSec=0,l(null)):d.cooldownWaitSec=Math.max(0,Math.ceil((d.cooldownUntilMs-Date.now())/1e3))),Bt(),M()}function D(){_(),A(),k=setInterval(A,1e3)}let $=o||n,q=5e3,K="",ee="",R=!1,N=[],Y=[],te=new Map,ve=[],ne=[],pe="",G=-1,Ee=new Set,Je=document.getElementById("cp-home"),J=document.getElementById("cp-practice"),U=document.getElementById("cp-question-area"),Se=document.getElementById("cp-qgrid"),je=document.getElementById("cp-grid-count"),ke=document.getElementById("cp-back-nav"),Me=ke.getAttribute("data-href")||"/",rt=`
`;function $e(g){if(typeof g.qid=="number"&&Number.isFinite(g.qid))return{text:String(g.qid),title:`\u9898\u53F7 ${g.qid}`};let x=g._id||"";return x?{text:x.length>10?`\u2026${x.slice(-8)}`:x,title:`\u65E0\u9898\u53F7\u5B57\u6BB5\uFF0C_id=${x}`}:{text:"?",title:"\u65E0\u9898\u53F7"}}function It(){K?ke.title="\u8FD4\u56DE\u77E5\u8BC6\u70B9\u9009\u62E9":ke.title="\u8FD4\u56DE\u9898\u5E93"}function _t(){let g={tag1:null,qid:null,id:null,n:null};try{let x=window.location.hash.replace(/^#/,"").trim();if(!x)return g;let E=new URLSearchParams(x),C=E.get("tag1"),P=E.get("qid"),O=P!=null&&P!==""&&Number.isFinite(Number(P))?Number(P):null,ie=E.get("id"),oe=E.get("n"),ye=oe!=null&&oe!==""&&Number.isFinite(Number(oe))?Math.floor(Number(oe)):null;return{tag1:C&&C.trim()?C.trim():null,qid:O!=null&&Number.isFinite(O)?O:null,id:ie&&ie.trim()?ie.trim():null,n:ye!=null&&ye>0?ye:null}}catch(x){return g}}function vn(g){if(g.qid!=null){let x=N.findIndex(E=>typeof E.qid=="number"&&Number.isFinite(E.qid)&&E.qid===g.qid);if(x>=0)return x}if(g.id){let x=N.findIndex(E=>E._id===g.id);if(x>=0)return x}if(g.n!=null){for(let x=0;x=0&&G{let g=_t();if(!g.tag1){K&&nn();return}if(K===g.tag1&&N.length>0){let x=vn(g);x>=0&&x!==G&&Ht(x);return}Bn(g.tag1,{qid:g.qid,id:g.id,n:g.n})}),document.querySelectorAll(".cp-cat-card").forEach(g=>{g.addEventListener("click",()=>{let x=g.dataset.tag1||"";x&&Bn(x)})});async function Bn(g,x){var E,C,P;if(g)if(K=g,G=-1,R=!1,Je.style.display="none",J.style.display="",It(),U.innerHTML=rt,await mt(),Y.length>0){let O=-1;if(x){let ie=vn({qid:(E=x.qid)!=null?E:null,id:(C=x.id)!=null?C:null,n:(P=x.n)!=null?P:null});ie>=0&&(O=ie)}if(O<0){let ie=Y.find(oe=>N[oe].status==="unattempted");O=ie!=null?ie:Y[0]}Ht(O)}else U.innerHTML='\u8BE5\u5206\u7C7B\u6682\u65E0\u9898\u76EE
',pt()}ke.addEventListener("click",()=>{K?nn():window.location.href=Me}),document.getElementById("cp-expand-all").addEventListener("click",()=>jn(!0)),document.getElementById("cp-collapse-all").addEventListener("click",()=>jn(!1)),document.querySelectorAll("#cp-type-filter .cp-sb-chip").forEach(g=>{g.addEventListener("click",()=>{document.querySelectorAll("#cp-type-filter .cp-sb-chip").forEach(x=>x.classList.remove("active")),g.classList.add("active")})});function eo(){let g=document.querySelector('#cp-type-filter input[name="cp-type"]:checked');return g?g.value:""}function _i(){let g=document.querySelector('#cp-status-filter input[name="cp-status"]:checked');return g?g.value:""}function me(){pe=_i(),Y=[];for(let g=0;g{g.addEventListener("click",()=>{document.querySelectorAll("#cp-status-filter .cp-sb-chip").forEach(E=>E.classList.remove("active")),g.classList.add("active");let x=g.querySelector("input");x&&(x.checked=!0),me()})});function to(){let g=document.getElementById("cp-diff-min"),x=document.getElementById("cp-diff-max"),E=g!=null&&g.value?Number(g.value):0,C=x!=null&&x.value?Number(x.value):0;if(!E&&!C)return[];let P=E||1,O=C||10,ie=[];for(let oe=Math.min(P,O);oe<=Math.max(P,O);oe++)ie.push(oe);return ie}document.getElementById("cp-apply-filter").addEventListener("click",async()=>{let g=document.getElementById("cp-apply-filter");if(g.disabled=!0,g.textContent="\u52A0\u8F7D\u4E2D...",await mt(),g.disabled=!1,g.textContent="\u5E94\u7528\u7B5B\u9009",Y.length>0){let x=Y.find(E=>N[E].status==="unattempted");Ht(x!=null?x:Y[0])}else U.innerHTML='\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u9898\u76EE
'}),document.getElementById("cp-reset-filter").addEventListener("click",async()=>{document.querySelectorAll("#cp-type-filter .cp-sb-chip").forEach(oe=>oe.classList.remove("active"));let x=document.querySelector('#cp-type-filter .cp-sb-chip[data-val=""]');x&&x.classList.add("active");let E=document.querySelector('#cp-type-filter input[value=""]');E&&(E.checked=!0),document.querySelectorAll("#cp-status-filter .cp-sb-chip").forEach(oe=>oe.classList.remove("active"));let P=document.querySelector('#cp-status-filter .cp-sb-chip[data-val=""]');P&&P.classList.add("active");let O=document.querySelector('#cp-status-filter input[value=""]');O&&(O.checked=!0),document.getElementById("cp-diff-min").value="",document.getElementById("cp-diff-max").value="";let ie=document.getElementById("cp-apply-filter");if(ie.disabled=!0,ie.textContent="\u52A0\u8F7D\u4E2D...",await mt(),ie.disabled=!1,ie.textContent="\u5E94\u7528\u7B5B\u9009",Y.length>0){let oe=Y.find(ye=>N[ye].status==="unattempted");Ht(oe!=null?oe:Y[0])}else U.innerHTML='\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u9898\u76EE
'});async function mt(){if(!K){N=[],Y=[],te=new Map,ve=[],je.textContent="0 \u9898",rn();return}let g=new URLSearchParams;g.set("psid",t),g.set("tag1",K);let x=eo();x&&g.set("type",x);let E=to();E.length&&g.set("difficulty",E.join(","));try{let C=await Ot.request.get(`/api/choice/list?${g.toString()}`);N=C.questions||[],ne=C.tag2Order||[]}catch(C){N=[],ne=[]}Ct(),me()}function Ct(){te=new Map,ve=[];let g=new Map;for(let E=0;EC-P);if(ne.length>0){let E=new Map;for(let C=0;C{let O=E.has(C.tag2)?E.get(C.tag2):1/0,ie=E.has(P.tag2)?E.get(P.tag2):1/0;return O!==ie?O-ie:C.indices[0]-P.indices[0]})}else ve.sort((E,C)=>E.indices[0]-C.indices[0]);let x=0;for(let E of ve)for(let C of E.indices)x++,te.set(C,x)}function Sn(){return G<0||G>=N.length?"":N[G].tag2||""}function rn(){let g=new Set(Y),x=ve.length>1||ve.length===1&&ve[0].tag2,E=Sn(),C="";for(let P of ve){let O=P.indices.filter(Ge=>g.has(Ge));if(O.length===0)continue;let ie=P.tag2||"\u672A\u5206\u7C7B",oe=E===P.tag2,ye=Ee.has(ie);if(x){let Ge=ye?"\u25B6":"\u25BC";C+=`${oe?"":`${Ge} `}${f(ie)}${oe?' \u5F53\u524D ':""}
`}if(!ye||oe){C+='';for(let Ge of O){let We=N[Ge],st=te.get(Ge)||Ge+1,lt=typeof We.qid=="number"&&Number.isFinite(We.qid)?` \xB7 \u9898\u53F7 ${We.qid}`:"",Ft=`\u7B2C ${st} \u9898${lt}`,Mt=["cp-qcell"];We.status==="correct"?Mt.push("correct"):We.status==="wrong"&&Mt.push("wrong"),Ge===G&&Mt.push("current"),We.favorited&&Mt.push("favorited"),C+=`
${st}
`}C+="
"}}Se.innerHTML=C,je.textContent=`${Y.length} \u9898`,Se.querySelectorAll(".cp-qcell").forEach(P=>{P.addEventListener("click",()=>{let O=Number(P.dataset.idx);Ht(O)})}),Se.querySelectorAll(".cp-qgrid-group-collapsible").forEach(P=>{P.addEventListener("click",()=>{let O=P.dataset.groupKey||"";Ee.has(O)?Ee.delete(O):Ee.add(O),rn()})})}function jn(g){let x=Sn()||"\u672A\u5206\u7C7B";for(let E of ve){let C=E.tag2||"\u672A\u5206\u7C7B";C!==x&&(g?Ee.delete(C):Ee.add(C))}rn()}async function Ht(g){if(g<0||g>=N.length)return;G=g,R=!1,rn();let x=N[g];U.innerHTML=rt;try{let E=new URLSearchParams;E.set("psid",t),E.set("questionId",x._id);let C=await Ot.request.get(`/api/choice/next?${E.toString()}`);if(!C.question){U.innerHTML='\u9898\u76EE\u52A0\u8F7D\u5931\u8D25
';return}Mi(C.question,g)}catch(E){U.innerHTML='\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5
'}}function Mi(g,x){ee=g._id,R=!1;let E=g.type==="multi",C=E?"checkbox":"radio",P=N[x],O=$e({_id:String(g._id||P&&P._id||""),qid:g.qid!=null?g.qid:P&&P.qid!=null?P.qid:null}),ie=g.tag1&&g.tag2?`${f(g.tag1)}-${f(g.tag2)} `:g.tag1?`${f(g.tag1)} `:g.tag2?`${f(g.tag2)} `:"",oe=[`#${f(O.text)} `,`${E?"\u591A\u9009":"\u5355\u9009"} `,`\u96BE\u5EA6 ${g.difficulty} `,g.source?`${f(g.source)} `:"",ie].filter(Boolean).join(""),ye=g.optionsHtml||[],Ge=(g.options||[]).map((nt,xt)=>{let qe=String.fromCharCode(65+xt),In=(nt||"").replace(/^[A-Z]\.\s*/,""),wn=ye[xt]?m(ye[xt]):f(In);return`${qe}. ${wn} `}).join(""),We=Nn(),st=We.indexOf(x),lt=st>0?We[st-1]:-1,Ft=st>=0&&st=0,dn=Ft>=0,An=n&&g._id?`\u7F16\u8F91\u672C\u9898 `:"",an=x>=0&&x ',yn=' ',Ne=x>=0&&x
${g.contentHtml||f(g.content)}
${Ge}
\u2190 \u4E0A\u4E00\u9898
\u63D0\u4EA4\u7B54\u6848
\u4E0B\u4E00\u9898 \u2192
${An}
\u67E5\u770B\u9898\u89E3?${_e}
`,document.querySelectorAll("#cp-options .cp-option").forEach(nt=>{nt.addEventListener("click",xt=>{if(R)return;xt.preventDefault();let qe=nt.querySelector("input");C==="radio"?(document.querySelectorAll("#cp-options .cp-option input").forEach(Et=>{Et.checked=!1}),qe.checked=!0,document.querySelectorAll("#cp-options .cp-option").forEach(Et=>Et.classList.remove("selected"))):qe.checked=!qe.checked,nt.classList.toggle("selected",qe.checked)})}),document.getElementById("cp-submit-btn").addEventListener("click",()=>Rn(x)),document.getElementById("cp-prev-btn").addEventListener("click",()=>{Mt&&Ht(lt)}),document.getElementById("cp-next-btn").addEventListener("click",()=>{dn&&Ht(Ft)});let xn=document.getElementById("cp-solution-hint");if(xn&&Ne){let nt=()=>{$?Nt(x):Fn()};xn.addEventListener("click",nt),xn.addEventListener("keydown",xt=>{(xt.key==="Enter"||xt.key===" ")&&(xt.preventDefault(),nt())})}document.getElementById("cp-fav-btn").addEventListener("click",async()=>{let nt=document.getElementById("cp-fav-btn");nt.classList.add("cp-fav-loading");try{let xt=await Ot.request.post("/api/choice/favorite",{questionId:ee,psid:t});if(xt.success){let qe=!!xt.favorited;x>=0&&x
{let x=document.createElement("div");x.style.cssText="position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:9999;display:flex;align-items:center;justify-content:center;";let E=document.createElement("div");E.style.cssText="background:#fff;border-radius:16px;padding:28px;width:400px;max-width:90vw;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,0.3);",E.innerHTML=`
\u8D2D\u4E70\u8BFE\u7A0B
\u6B63\u5728\u751F\u6210\u4E8C\u7EF4\u7801...
\u5FAE\u4FE1\u626B\u7801\u8D2D\u4E70
\u652F\u4ED8\u5B8C\u6210\u540E\u8BF7\u70B9\u51FB"\u5DF2\u5B8C\u6210\u652F\u4ED8"\u6309\u94AE
\u4E8C\u7EF4\u7801\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
\u53D6\u6D88
\u5DF2\u5B8C\u6210\u652F\u4ED8
`,x.appendChild(E),document.body.appendChild(x),(async()=>{try{let P=(await Ot.request.post(`/pset/${t}`,{psid:t,action:"buy_separately"})).qrcode_url,O=E.querySelector(".cp-purchase-loading"),ie=E.querySelector(".cp-purchase-qrcode");O&&(O.style.display="none"),ie&&(ie.src=P,ie.style.display="block")}catch(C){let P=E.querySelector(".cp-purchase-loading"),O=E.querySelector(".cp-purchase-error");P&&(P.style.display="none"),O&&(O.style.display="block")}})(),E.querySelector(".cp-purchase-cancel").addEventListener("click",()=>{document.body.removeChild(x),g(!1)}),E.querySelector(".cp-purchase-confirm").addEventListener("click",()=>{document.body.removeChild(x),g(!0)}),x.addEventListener("click",C=>{C.target===x&&(document.body.removeChild(x),g(!1))})})}let pi="/vip";function no(g){return/会员专属/.test(g)||/每日\s*50\s*次/.test(g)}function ui(){return`\u60A8\u4ECA\u65E5\u7684 AI \u5206\u6790\u6B21\u6570\u5DF2\u7528\u5B8C\uFF08\u975E\u4F1A\u5458\u6BCF\u65E5 5 \u6B21\uFF09\u3002\u52A0\u5165\u4F1A\u5458 \u540E\uFF0C\u5F53\u65E5\u5DF2\u7528\u6B21\u6570\u4F1A\u6E05\u96F6\uFF0C\u5E76\u4EAB\u6BCF\u65E5 50 \u6B21\uFF1B\u4E4B\u540E\u6309\u81EA\u7136\u65E5\u5237\u65B0\u989D\u5EA6\u3002`}function mi(g){var oe;let x=g&&g.trim()?g.trim():"",C=(x?no(x):d.dailyLimit===50)?f(x||v()):ui(),P=document.createElement("div");P.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:10000;display:flex;align-items:center;justify-content:center;padding:16px;";let O=document.createElement("div");O.style.cssText="background:#fff;border-radius:14px;padding:24px 26px;max-width:400px;width:100%;box-shadow:0 16px 48px rgba(0,0,0,0.2);";let ie=()=>{P.parentNode&&P.parentNode.removeChild(P)};O.innerHTML=`
\u4ECA\u65E5\u9009\u62E9\u9898 AI \u5206\u6790\u6B21\u6570\u5DF2\u7528\u5B8C
${C}
`,P.appendChild(O),document.body.appendChild(P),(oe=O.querySelector(".cp-ai-quota-close"))==null||oe.addEventListener("click",ie),P.addEventListener("click",ye=>{ye.target===P&&ie()})}function ji(g){let x=String(g.error||"");!!g.choiceAiQuotaExhausted||/次数已用完|额度已全部用完|额度已用尽/.test(x)?mi(x||void 0):alert(x||"\u64CD\u4F5C\u5931\u8D25")}async function Re(){if(Date.now()0?`\u672C\u9898\u5206\u6790\u51B7\u5374\uFF1A${x} \u79D2`:"";if(g.textContent="",d.dailyLimit==null){g.textContent=E?`\u7CFB\u7EDF\u7BA1\u7406\u5458 \xB7 \u6B21\u6570\u4E0D\u9650 \xB7 ${E}`:"\u7CFB\u7EDF\u7BA1\u7406\u5458 \xB7 \u6B21\u6570\u4E0D\u9650";return}let C=(O=d.remaining)!=null?O:0,P=d.dailyLimit;if(g.appendChild(document.createTextNode(`\u4ECA\u65E5\u5269\u4F59 ${C} / ${P} \u6B21`)),C<=0&&P===5){g.appendChild(document.createTextNode(" \xB7 "));let ie=document.createElement("a");ie.href=pi,ie.rel="noopener",ie.className="cp-ai-meta-vip-link",ie.textContent="\u52A0\u5165\u4F1A\u5458",g.appendChild(ie),g.appendChild(document.createTextNode("\u6BCF\u65E5\u53EF\u4EAB 50 \u6B21"))}else C<=0&&P===50&&g.appendChild(document.createTextNode(" \xB7 \u660E\u65E5\u5237\u65B0\u989D\u5EA6"));E&&g.appendChild(document.createTextNode(` \xB7 ${E}`))}async function cn(g){_(),H=!1;let x=document.getElementById("cp-note-container");x&&x.remove();let E=document.createElement("div");E.id="cp-note-container";let C=o||n,P=d.canUse;E.innerHTML=`
\u6211\u7684\u7B14\u8BB0
\u5199\u7B14\u8BB0
AI\u5206\u6790
${C?"":`
\u5F00\u901A\u9898\u5E93/\u4F1A\u5458\u5373\u53EF\u4F7F\u7528
`}
${P?`
AI \u5206\u6790\u672C\u9898
\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\uFF0C\u7531\u5927\u6A21\u578B\u5BF9\u672C\u9898\u77E5\u8BC6\u70B9\u4E0E\u9009\u9879\u8FDB\u884C\u89E3\u6790\u3002
\u5206\u6790\u7ED3\u679C\u4EC5\u4F9B\u53C2\u8003\uFF0CAI \u4E5F\u53EF\u80FD\u72AF\u9519\uFF1B
`:`
\u62E5\u5F00\u901A\u9898\u5E93/\u4F1A\u5458\u5373\u53EF\u4F7F\u7528
`}
`;let O=U.querySelector(".cp-question-card");O?O.after(E):U.appendChild(E);let ie=document.getElementById("cp-note-stack"),oe=document.getElementById("cp-ai-pane"),ye=document.getElementById("cp-note-view-pane"),Ge=document.getElementById("cp-note-edit-pane"),We=document.getElementById("cp-note-editor"),st=document.getElementById("cp-note-char-count"),lt=document.getElementById("cp-note-save-btn"),Ft="",Mt="";function dn(){We&&st&&(st.textContent=`${We.value.length} / ${q}`)}if(!C){let Ne=document.getElementById("cp-note-purchase-btn");Ne&&Ne.addEventListener("click",()=>Fn())}let An=document.getElementById("cp-ai-purchase-btn");An&&An.addEventListener("click",()=>Fn());let an=E.querySelectorAll(".cp-note-tab");if(an.forEach(Ne=>{Ne.addEventListener("click",async()=>{let Oe=Ne.dataset.tab;an.forEach(_e=>_e.classList.remove("active")),Ne.classList.add("active"),Oe==="ai"?(ie.style.display="none",oe.style.display="flex",await Re(),Bt(),M(),D()):(_(),ie.style.display="",oe.style.display="none",Oe==="view"?(Ge.style.display="none",ye.style.display=""):Oe==="edit"&&(ye.style.display="none",Ge.style.display="",We&&C&&(We.value=Ft,dn(),We.focus())))})}),P){Bt(),M();let Ne=document.getElementById("cp-ai-analyze-btn"),Oe=document.getElementById("cp-ai-result"),_e=document.getElementById("cp-ai-placeholder"),xn="\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\uFF0C\u7531\u5927\u6A21\u578B\u5BF9\u672C\u9898\u77E5\u8BC6\u70B9\u4E0E\u9009\u9879\u8FDB\u884C\u89E3\u6790\u3002";Ne==null||Ne.addEventListener("click",async nt=>{if(!Ne||L||h()){nt.preventDefault();return}if(d.dailyLimit!=null&&d.remaining!=null&&d.remaining<=0){nt.preventDefault(),mi();return}L=!0,_e&&(_e.style.display="",_e.textContent="\u6B63\u5728\u5206\u6790\u4E2D\uFF0C\u8BF7\u7A0D\u5019\u2026"),M();try{_e&&(_e.style.display="none"),Oe&&(Oe.style.display="",Oe.innerHTML='
');let qe=Oe==null?void 0:Oe.querySelector(".cp-ai-stream-live"),Et=await fetch("/api/choice/ai-analysis/stream",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({questionId:g,psid:t})});if((Et.headers.get("content-type")||"").includes("application/json")){let wn=await Et.json();wn.error&&(wn.cooldownUntilMs!=null&&(d.cooldownUntilMs=s(Number(wn.cooldownUntilMs),d.cooldownUntilMs),d.cooldownWaitSec=d.cooldownUntilMs!=null?Math.max(0,Math.ceil((d.cooldownUntilMs-Date.now())/1e3)):0,l(d.cooldownUntilMs)),ji(wn)),Oe&&(Oe.style.display="none")}else if(!Et.ok||!Et.body)alert("\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),Oe&&(Oe.style.display="none");else{let wn=Et.body.getReader(),ka=new TextDecoder,hi="",oo="",qn=null,Hn=null,Ai=null,kn=Tn=>{for(let fe of Tn)fe.type==="html"&&qe&&typeof fe.html=="string"?qe.innerHTML=fe.html:fe.type==="delta"&&qe?(oo+=typeof fe.delta=="string"?fe.delta:"",qe.textContent=oo):fe.type==="done"?qn=fe:fe.type==="error"&&(Hn=String(fe.error||"\u5206\u6790\u5931\u8D25"),fe.cooldownUntilMs!=null&&(Ai=Number(fe.cooldownUntilMs)))};for(;;){let{done:Tn,value:fe}=await wn.read();if(Tn)break;hi+=ka.decode(fe,{stream:!0});let{events:Ta,rest:Ca}=Be(hi);hi=Ca,kn(Ta)}if(kn(Be(`${hi}
`).events),Hn)Ai!=null&&Number.isFinite(Ai)&&(d.cooldownUntilMs=s(Ai,d.cooldownUntilMs),d.cooldownWaitSec=d.cooldownUntilMs!=null?Math.max(0,Math.ceil((d.cooldownUntilMs-Date.now())/1e3)):0,l(d.cooldownUntilMs)),ji({error:Hn,choiceAiQuotaExhausted:/次数已用完|额度已全部用完|额度已用尽/.test(Hn)}),Oe&&(Oe.style.display="none");else if(qn&&qn.contentHtml){let Tn=qn.fromCache?'\u672C\u6B21\u4E3A 24 \u5C0F\u65F6\u5185\u7F13\u5B58\u7ED3\u679C\uFF0C\u672A\u6D88\u8017\u4ECA\u65E5\u6B21\u6570\u3001\u672A\u8C03\u7528\u5927\u6A21\u578B\u3002
':"";Oe&&(Oe.innerHTML=`${qn.contentHtml}
${Tn}`),H=!0,Xn(qn),Bt()}else alert("\u5206\u6790\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5"),Oe&&(Oe.style.display="none")}}catch(qe){alert("\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),Oe&&(Oe.style.display="none")}finally{if(L=!1,_e){_e.textContent=xn;let qe=Oe&&Oe.style.display!=="none";_e.style.display=qe?"none":""}M()}})}if(!C||!We||!st||!lt)return;We.addEventListener("input",dn);let Ut=!1;lt.addEventListener("click",async()=>{if(Ut)return;lt.disabled=!0,lt.textContent="\u4FDD\u5B58\u4E2D...";try{let _e=await Ot.request.post("/api/choice/note/save",{questionId:g,psid:t,content:We.value});if(_e.error)alert(_e.error);else if(_e.success){Ft=We.value,Mt=_e.contentHtml||"",yn(),an.forEach(nt=>nt.classList.remove("active"));let xn=E.querySelector('.cp-note-tab[data-tab="view"]');xn&&xn.classList.add("active"),ie.style.display="",oe.style.display="none",Ge.style.display="none",ye.style.display=""}}catch(_e){}Ut=!0,lt.disabled=!0;let Ne=5;lt.textContent=`${Ne}s \u540E\u53EF\u4FDD\u5B58`;let Oe=setInterval(()=>{Ne--,Ne<=0?(clearInterval(Oe),Ut=!1,lt.disabled=!1,lt.textContent="\u4FDD\u5B58\u7B14\u8BB0"):lt.textContent=`${Ne}s \u540E\u53EF\u4FDD\u5B58`},1e3)});function yn(){Mt?ye.innerHTML=`${Mt}
`:Ft?ye.innerHTML=`${f(Ft)}
`:ye.innerHTML='\u6682\u65E0\u7B14\u8BB0\uFF0C\u70B9\u51FB"\u5199\u7B14\u8BB0"\u5F00\u59CB\u8BB0\u5F55\u5427
'}try{let Ne=await Ot.request.get(`/api/choice/note?questionId=${g}`);Ft=Ne.content||"",Mt=Ne.contentHtml||"",yn()}catch(Ne){ye.innerHTML='\u7B14\u8BB0\u52A0\u8F7D\u5931\u8D25
'}}function fi(g,x,E){E.updateListStatus&&x>=0&&x{let Ge=ye.getAttribute("data-letter"),We=ye.querySelector("input");E.userLetters&&(We.checked=E.userLetters.includes(Ge),ye.classList.toggle("selected",We.checked)),ye.style.pointerEvents="none",g.correctAnswer.includes(Ge)?ye.classList.add("correct"):We.checked&&ye.classList.add("wrong")});let C=document.getElementById("cp-result-area"),P=g.correct?'\u2713 \u56DE\u7B54\u6B63\u786E\uFF01
':`\u2717 \u56DE\u7B54\u9519\u8BEF\uFF0C\u6B63\u786E\u7B54\u6848\uFF1A${g.correctAnswer.join(", ")}
`;g.solutionHtml?P+=`\u9898\u89E3
${g.solutionHtml}
`:g.solutionAccessDenied&&(P+=`
\u9898\u89E3
\u5F00\u901A\u9898\u5E93/\u4F1A\u5458\u5373\u53EF\u67E5\u770B\u9898\u89E3
`),C.innerHTML=P;let O=document.getElementById("cp-solution-lock-btn");O&&O.addEventListener("click",()=>Fn());let ie=document.getElementById("cp-submit-btn");ie&&(ie.style.display="none");let oe=document.getElementById("cp-solution-hint");oe&&(oe.style.display="none")}async function Nt(g){if(!$){Fn();return}let x=document.getElementById("cp-solution-hint");if(!(!x||!x.classList.contains("cp-solution-hint-ready"))){x.classList.add("cp-solution-hint-loading");try{let E=await Ot.request.get(`/api/choice/solution-reveal?questionId=${encodeURIComponent(ee)}`);if(E.error){alert(E.error);return}R=!0;let C=Array.isArray(E.userAnswer)?E.userAnswer:[];fi(E,g,{userLetters:C,updateListStatus:!1})}catch(E){alert("\u52A0\u8F7D\u9898\u89E3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}finally{x.classList.remove("cp-solution-hint-loading")}}}async function Rn(g){if(R)return;let x=[];if(document.querySelectorAll('#cp-options input[name="cp-answer"]:checked').forEach(C=>{x.push(C.value)}),x.length===0)return;R=!0;let E=document.getElementById("cp-submit-btn");E.setAttribute("disabled","true"),E.textContent="\u63D0\u4EA4\u4E2D...";try{let C=await Ot.request.post("/api/choice/submit",{questionId:ee,answer:x});if(C.error){E.removeAttribute("disabled"),E.textContent="\u63D0\u4EA4\u7B54\u6848",R=!1,alert(C.error);return}fi(C,g,{updateListStatus:!0}),io()}catch(C){E.removeAttribute("disabled"),E.textContent="\u63D0\u4EA4\u7B54\u6848",R=!1}}async function io(){try{let g=await Ot.request.get(`/api/choice/stats?psid=${t}`),x=String(g.total||0),E=String(g.correct||0),C=(g.accuracy||0)+"%";document.getElementById("cp-stats-total").textContent=x,document.getElementById("cp-stats-correct").textContent=E,document.getElementById("cp-stats-accuracy").textContent=C,document.getElementById("cp-sb-stats-total").textContent=x,document.getElementById("cp-sb-stats-correct").textContent=E,document.getElementById("cp-sb-stats-accuracy").textContent=C}catch(g){}}function m(g){let x=document.createElement("div");x.innerHTML=g;let C=document.createTreeWalker(x,NodeFilter.SHOW_TEXT,null).nextNode();return C&&C.textContent&&(C.textContent=C.textContent.replace(/^[A-Z]\.\s*/,"")),x.innerHTML}function f(g){let x=document.createElement("div");return x.textContent=g,x.innerHTML}}));var Ue=ae(re());var Ie=ae(re());var oa=ae(re()),ra=2e4,Xi=5,No=10;function di(i){try{let t=new Date(i),n=Date.now()-t.getTime();return n<6e4?"\u521A\u521A":n<36e5?`${Math.floor(n/6e4)}\u5206\u949F\u524D`:n<864e5?`${Math.floor(n/36e5)}\u5C0F\u65F6\u524D`:n<2592e6?`${Math.floor(n/864e5)}\u5929\u524D`:t.toLocaleDateString("zh-CN")}catch(t){return i}}function At(i){let t=document.createElement("div");return t.textContent=i,t.innerHTML}function aa(i){return i!=null&&i.length?i.map(t=>`${At(t)} `).join(""):""}function ud(i){return i!=null&&i.length?i.map(t=>`${At(t)} `).join(""):""}var Ci=' ',Ei=' ';async function sa(){var t;let i=(0,oa.$)("#forum-notif-unread-badge");if(i.length)try{let e=await oa.request.get("/api/forum/notifications/unread-count"),n=(t=e.data)!=null?t:e,o=Number(n.unreadCount)||0;o>0?i.text(o>99?"99+":String(o)).show():i.hide().text("")}catch(e){i.hide().text("")}}var gf="/api/forum/markdown-preview",ln=ra,bf=["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F605}","\u{1F602}","\u{1F923}","\u{1F60A}","\u{1F607}","\u{1F642}","\u{1F609}","\u{1F60D}","\u{1F970}","\u{1F618}","\u{1F60B}","\u{1F61B}","\u{1F914}","\u{1F60E}","\u{1F973}","\u{1F62D}","\u{1F624}","\u{1F62E}","\u{1F644}","\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u{1F525}","\u2728","\u{1F4AF}","\u2764\uFE0F","\u{1F9E1}","\u{1F494}","\u{1F389}","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4A1}","\u{1F4CC}","\u{1F3AF}","\u{1F3C6}","\u{1F381}","\u{1F431}","\u{1F436}","\u{1F98A}","\u{1F438}","\u{1F308}","\u2600\uFE0F","\u{1F319}","\u26A1","\u2615","\u{1F340}","\u{1F338}","\u{1F339}","\u{1F349}","\u{1F355}","\u{1F382}","\u{1F3AE}"];function vf(i){let t=(i.find(".forum-compose-title-input").val()||"").trim(),e=(i.find(".forum-compose-content-input").val()||"").trim(),n=(i.find(".forum-compose-board-select").val()||"").trim(),o=Bs(i);return{title:t,content:e,boardKey:n,tags:o}}function gd(i){let t=i.find(".forum-compose-content-input")[0];return t instanceof HTMLTextAreaElement?t:null}function bd(i){i.value.length>ln&&(i.value=i.value.slice(0,ln),Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ln} \u5B57`))}function Fo(i,t){var l,c;let e=(l=i.selectionStart)!=null?l:0,n=(c=i.selectionEnd)!=null?c:0,o=i.value,r=n-e,a=ln-o.length+r;if(t.length>a)return Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ln} \u5B57`),!1;i.value=o.slice(0,e)+t+o.slice(n);let s=e+t.length;return i.setSelectionRange(s,s),i.focus(),!0}function Zi(i,t,e,n){var h,v;let o=(h=i.selectionStart)!=null?h:0,r=(v=i.selectionEnd)!=null?v:0,a=i.value,s=a.slice(o,r),l=s||n,c=t+l+e,u=r-o,d=ln-a.length+u;if(c.length>d){Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ln} \u5B57`);return}if(i.value=a.slice(0,o)+c+a.slice(r),!s)i.setSelectionRange(o+t.length,o+t.length+l.length);else{let w=o+c.length;i.setSelectionRange(w,w)}i.focus()}function md(i,t){var u,d;let e=i.value,n=(u=i.selectionStart)!=null?u:0,o=(d=i.selectionEnd)!=null?d:0;n>o&&([n,o]=[o,n]);let r=e.lastIndexOf(`
`,n-1)+1,a=e.indexOf(`
`,o);a===-1&&(a=e.length);let l=e.slice(r,a).split(`
`).map(t).join(`
`),c=e.slice(0,r)+l+e.slice(a);if(c.length>ln){Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ln} \u5B57`);return}i.value=c,i.setSelectionRange(r,r+l.length),i.focus()}function fd(i,t){var h;let e=i.value,n=(h=i.selectionStart)!=null?h:0,o=e.lastIndexOf(`
`,n-1)+1,r=e.indexOf(`
`,n),a=r===-1?e.length:r,l=e.slice(o,a).replace(/^#{1,6}\s+/,""),c=`${t} ${l}`,u=e.slice(0,o)+c+e.slice(a);if(u.length>ln){Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ln} \u5B57`);return}i.value=u;let d=o+c.length;i.setSelectionRange(d,d),i.focus()}function yf(i){var l,c;let t=(l=i.selectionStart)!=null?l:0,e=(c=i.selectionEnd)!=null?c:0,n=i.value,o=n.slice(t,e),r,a;o.length>0?(r=`
\`\`\`
${o}
\`\`\`
`,a=t+r.length):(r="\n```\n\n```\n",a=t+5);let s=ln-n.length+(e-t);if(r.length>s){Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ln} \u5B57`);return}i.value=n.slice(0,t)+r+n.slice(e),i.setSelectionRange(a,a),i.focus()}var xf=`
| \u52171 | \u52172 |
| --- | --- |
| | |
`;function la(i,t){let e=gd(i);if(e){switch(t){case"bold":Zi(e,"**","**","\u7C97\u4F53");break;case"italic":Zi(e,"*","*","\u659C\u4F53");break;case"strike":Zi(e,"~~","~~","\u5220\u9664\u7EBF");break;case"code":Zi(e,"`","`","code");break;case"h2":fd(e,"##");break;case"h3":fd(e,"###");break;case"quote":md(e,n=>!n.trim()||/^>\s?/.test(n)?n:`> ${n}`);break;case"ul":md(e,n=>!n.trim()||/^(-|\*)\s/.test(n)?n:`- ${n}`);break;case"ol":Fo(e,`
1. \u7B2C\u4E00\u9879
2. \u7B2C\u4E8C\u9879
3. \u7B2C\u4E09\u9879
`);break;case"task":Fo(e,`
- [ ] \u5F85\u529E
- [ ]
`);break;case"link":Zi(e,"[","](https://)","\u94FE\u63A5\u6587\u5B57");break;case"image":Zi(e,"","\u63CF\u8FF0");break;case"fence":yf(e);break;case"hr":Fo(e,`
---
`);break;case"table":Fo(e,xf);break;default:break}bd(e)}}function vd(i){let t=i.find(".forum-compose-emoji-panel");t.children().length||bf.forEach(e=>{let n=(0,Ie.$)(' ');n.text(e),n.attr("data-emoji",e),t.append(n)})}function yd(i){let t=i.data("forumEmojiNs");t&&(0,Ie.$)(document).off(`click.${t}`),i.removeData("forumEmojiNs")}function Ro(i){i.find(".forum-compose-emoji-panel").hide(),yd(i)}function hd(i){let t=i.find(".forum-compose-emoji-panel");vd(i);let e=i.data("forumEmojiNs");e&&(0,Ie.$)(document).off(`click.${e}`);let n=!t.is(":visible");if(t.toggle(n),n){let o=`fe_${Math.random().toString(36).slice(2)}`;i.data("forumEmojiNs",o),window.setTimeout(()=>{(0,Ie.$)(document).one(`click.${o}`,r=>{(0,Ie.$)(r.target).closest(".forum-compose-emoji-wrap").length||Ro(i)})},0)}else yd(i)}function wf(i){vd(i),i.off("click.forumMdTool").on("click.forumMdTool","[data-md-tool]",function(e){let n=String((0,Ie.$)(this).data("md-tool")||"");if(n==="emoji"){e.preventDefault(),e.stopPropagation(),hd(i);return}e.preventDefault(),Ro(i),la(i,n)}),i.off("click.forumMdEmojiCell").on("click.forumMdEmojiCell",".forum-compose-emoji-cell",function(e){e.preventDefault(),e.stopPropagation();let n=String((0,Ie.$)(this).data("emoji")||(0,Ie.$)(this).text()||""),o=gd(i);o&&n&&Fo(o,n)&&bd(o),Ro(i)}),i.find(".forum-compose-content-input").off("keydown.forumMdKeys").on("keydown.forumMdKeys",e=>{if(e.target instanceof HTMLTextAreaElement){if(e.altKey&&!e.ctrlKey&&!e.metaKey&&String(e.key).toLowerCase()==="e"){e.preventDefault(),hd(i);return}if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){let o=String(e.key).toLowerCase();if(o==="b"){e.preventDefault(),la(i,"bold");return}if(o==="i"){e.preventDefault(),la(i,"italic");return}if(o==="k"){e.preventDefault(),la(i,"link");return}}}})}function kf(i){if(!Array.isArray(i))return[];let t=[],e=new Set;for(let n of i){if(typeof n!="string")continue;let o=n.trim().slice(0,No);if(!o)continue;let r=o.toLowerCase();if(!e.has(r)&&(e.add(r),t.push(o),t.length>=Xi))break}return t}function Bs(i){let t=[];return i.find(".forum-compose-tag-chip").each((e,n)=>{let o=String((0,Ie.$)(n).attr("data-tag")||"").trim();o&&t.push(o)}),t}function qo(i,t){let e=i.find(".forum-compose-tags-chips");e.empty();for(let n of t){let o=(0,Ie.$)(' ');o.attr("data-tag",n),o.append((0,Ie.$)(' ').text(n));let r=(0,Ie.$)('× ');o.append(r),e.append(o)}i.find(".forum-compose-tags-count").text(String(t.length))}function xd(i){let t=[];try{t=JSON.parse(i.attr("data-initial-tags")||"[]")}catch(e){t=[]}qo(i,kf(t))}function Tf(i){xd(i);let t=i.find(".forum-compose-tag-input"),e=n=>{let o=n.trim().slice(0,No);if(!o)return;let r=Bs(i);if(r.length>=Xi){Ie.Notification.error(`\u6700\u591A ${Xi} \u4E2A\u6807\u7B7E`);return}let a=o.toLowerCase();if(r.some(s=>s.toLowerCase()===a)){t.val("");return}qo(i,[...r,o]),t.val("")};t.off("keydown.forumTags").on("keydown.forumTags",n=>{n.key==="Enter"&&(n.preventDefault(),e(t.val()))}),i.find(".forum-compose-tags-chips").off("click.forumTags").on("click.forumTags",".forum-compose-tag-remove",n=>{n.preventDefault();let o=(0,Ie.$)(n.target).closest(".forum-compose-tag-chip"),r=String(o.attr("data-tag")||"").trim(),a=Bs(i).filter(s=>s!==r);qo(i,a)})}async function Cf(i,t){var n;let e=i.find(".forum-compose-preview");if(!t.trim()){e.html('\u6682\u65E0\u5185\u5BB9 ');return}e.html('\u6E32\u67D3\u4E2D...
');try{let o=await Ie.request.post(gf,{content:t}),r=(n=o.data)!=null?n:o,a=typeof r.html=="string"?r.html:"";e.html(a||'\u6682\u65E0\u5185\u5BB9 ')}catch(o){e.html('\u9884\u89C8\u52A0\u8F7D\u5931\u8D25 ')}}function ca(i,t){let e=i.find(".forum-compose-md-tab"),n=i.find(".forum-compose-md-pane");e.removeClass("active"),e.filter(`[data-md-tab="${t}"]`).addClass("active"),n.hide(),i.find(`.forum-compose-md-pane--${t}`).show()}function da(i,t){let e=i.find(".forum-post-compose");if(!e.length)return;let n=e.attr("data-compose-mode")||"create";Tf(e),wf(e),e.find(".forum-compose-md-tab").on("click",function(){if(String((0,Ie.$)(this).data("md-tab")||"edit")==="preview"){let r=e.find(".forum-compose-content-input").val()||"";ca(e,"preview"),Cf(e,r)}else ca(e,"edit")}),e.find(".forum-compose-cancel-btn").on("click",()=>{ca(e,"edit"),e.find(".forum-compose-preview").html('\u5207\u6362\u5230\u300C\u9884\u89C8\u300D\u67E5\u770B\u6E32\u67D3\u6548\u679C '),Ro(e),n==="create"?(qo(e,[]),e.find(".forum-compose-tag-input").val("")):(xd(e),e.find(".forum-compose-tag-input").val("")),t.onCancel()}),e.find(".forum-compose-submit-btn").on("click",async()=>{var l,c,u,d,h;let{title:o,content:r,boardKey:a,tags:s}=vf(e);if(!o){Ie.Notification.error("\u8BF7\u8F93\u5165\u6807\u9898");return}if(!r){Ie.Notification.error("\u8BF7\u8F93\u5165\u5185\u5BB9");return}if(r.length>ra){Ie.Notification.error(`\u6B63\u6587\u4E0D\u8D85\u8FC7 ${ra} \u5B57`);return}if(s.length>Xi){Ie.Notification.error(`\u6700\u591A ${Xi} \u4E2A\u6807\u7B7E`);return}for(let v of s)if(v.length>No){Ie.Notification.error(`\u6BCF\u4E2A\u6807\u7B7E\u4E0D\u8D85\u8FC7 ${No} \u5B57`);return}try{if(n==="create"){let v=await Ie.request.post("/api/forum/posts",{title:o,content:r,boardKey:a,tags:s}),w=(l=v.data)!=null?l:v;w.ok&&(Ie.Notification.success(w.reviewStatus===1?"\u53D1\u5E03\u6210\u529F":"\u5DF2\u63D0\u4EA4\uFF0C\u7B49\u5F85\u5BA1\u6838"),e.find(".forum-compose-title-input").val(""),e.find(".forum-compose-content-input").val(""),qo(e,[]),e.find(".forum-compose-tag-input").val(""),Ro(e),ca(e,"edit"),e.find(".forum-compose-preview").html('\u5207\u6362\u5230\u300C\u9884\u89C8\u300D\u67E5\u770B\u6E32\u67D3\u6548\u679C '),i.hide(),await((c=t.onAfterCreateSuccess)==null?void 0:c.call(t)))}else{let v=i.attr("data-post-id");if(!v){Ie.Notification.error("\u7F3A\u5C11\u5E16\u5B50 ID");return}if(i.attr("data-edit-require-confirm")==="true"){let L=Number.parseInt(String((u=i.attr("data-edit-remaining"))!=null?u:""),10),H=Number.parseInt(String((d=i.attr("data-edit-max"))!=null?d:""),10)||3;if(!Number.isFinite(L)||L<=0){Ie.Notification.error("\u4ECA\u65E5\u4FEE\u6539\u6B21\u6570\u5DF2\u7528\u5B8C\uFF0C\u8BF7\u660E\u5929\u518D\u8BD5");return}let _=`\u786E\u5B9A\u4FDD\u5B58\u4FEE\u6539\uFF1F
\u4ECA\u65E5\u672C\u5E16\u5B50\u8FD8\u53EF\u4FDD\u5B58\u4FEE\u6539 ${L} \u6B21\uFF08\u6BCF\u65E5\u6700\u591A ${H} \u6B21\uFF09\u3002`;if(!window.confirm(_))return}let w=await Ie.request.post(`/api/forum/posts/${v}/edit`,{title:o,content:r,boardKey:a,tags:s}),k=(h=w.data)!=null?h:w;k.ok&&(Ie.Notification.success(k.reviewStatus===1?"\u4FEE\u6539\u6210\u529F":"\u5DF2\u63D0\u4EA4\u4FEE\u6539\uFF0C\u7B49\u5F85\u5BA1\u6838"),window.location.reload())}}catch(v){Ie.Notification.error((v==null?void 0:v.message)||(n==="create"?"\u53D1\u5E03\u5931\u8D25":"\u4FEE\u6539\u5931\u8D25"))}})}var Ef=10,Lf=10,ma="",wd="latest",Li=1,ua=!1,Ns=!1,pa=null,fa=!1;function _f(i){var c,u,d;let t=((c=i.author)==null?void 0:c.avatar)||"/user/avatar/guest/s",e=((u=i.author)==null?void 0:u.uname)||"\u533F\u540D\u7528\u6237",n=i.boardName||(i.boardKey==="general"?"\u7EFC\u5408\u8BA8\u8BBA":i.boardKey),o=i.excerpt||"",r=i.reviewStatus===0?'\u5BA1\u6838\u4E2D ':i.reviewStatus===2?`\u5DF2\u62D2\u7EDD `:"",a=i.reviewStatus===0?"\u5BA1\u6838\u4E2D":i.reviewStatus===2?"\u5DF2\u62D2\u7EDD":"\u5DF2\u901A\u8FC7",s=i.updatedAt||i.createdAt,l=fa?``:"";return`
${At(i.title)}${r}
${o?`
${At(o)}
`:""}
${l}
`}async function zo(i=!1){var e;if(ua)return;ua=!0;let t=Li===1?Ef:Lf;try{let n={sort:wd,page:String(Li),pageSize:String(t)};ma&&(n.boardKey=ma),fa&&(n.mine="1");let o=await Ue.request.get("/api/forum/posts",n),r=(e=o.data)!=null?e:o,a=r.posts||[];Ns=!!r.hasMore;let s=(0,Ue.$)("#forum-post-list"),l=s.find(".forum-loading"),c=(0,Ue.$)("#forum-empty");i||s.empty(),l.remove(),a.length===0&&Li===1?c.show():(c.hide(),a.forEach(u=>{s.append(_f(u))})),Mf()}catch(n){Ue.Notification.error((n==null?void 0:n.message)||"\u52A0\u8F7D\u5931\u8D25")}finally{ua=!1}}function Mf(){let i=(0,Ue.$)("#forum-scroll-sentinel");if(i.length){if(pa&&pa.disconnect(),!Ns){i.hide();return}i.show(),pa=new IntersectionObserver(t=>{var e;(e=t[0])!=null&&e.isIntersecting&&Ns&&!ua&&(Li++,zo(!0))},{rootMargin:"200px"}),pa.observe(i[0])}}(0,Ue.addPage)(new Ue.NamedPage(["forum_list","forum_board","forum_my_posts"],async()=>{let i=window.location.pathname.match(/\/forum\/board\/([^/]+)/);i&&(ma=i[1]),fa=(0,Ue.$)("#forum-list-page-root").attr("data-mine-mode")==="true",await Promise.all([zo(),sa()]),fa||da((0,Ue.$)("#forum-new-post-form"),{onCancel:()=>{(0,Ue.$)("#forum-new-post-form").hide()},onAfterCreateSuccess:async()=>{Li=1,await zo()}}),(0,Ue.$)(document).on("click",".forum-tab",function(){(0,Ue.$)(".forum-tab").removeClass("active"),(0,Ue.$)(this).addClass("active"),ma=(0,Ue.$)(this).data("board")||"",Li=1,zo()}),(0,Ue.$)(document).on("click",".forum-sort-tabs .forum-sort-btn",function(){(0,Ue.$)(".forum-sort-tabs .forum-sort-btn").removeClass("active"),(0,Ue.$)(this).addClass("active"),wd=(0,Ue.$)(this).data("sort")||"latest",Li=1,zo()}),(0,Ue.$)("#forum-new-post-btn").on("click",()=>{(0,Ue.$)("#forum-new-post-form").toggle()}),(0,Ue.$)(document).on("click",".forum-stat-like",async function(t){var o;t.stopPropagation();let e=(0,Ue.$)(this);if(e.hasClass("busy"))return;let n=e.data("post-id");if(n){e.addClass("busy");try{let r=await Ue.request.post(`/api/forum/posts/${n}/like`,{}),a=(o=r.data)!=null?o:r,s=!!a.liked,l=Number(a.likeCount)||0;e.toggleClass("liked",s),e.find(".forum-like-svg").replaceWith(s?Ei:Ci),e.find("em").text(l)}catch(r){Ue.Notification.error((r==null?void 0:r.message)||"\u64CD\u4F5C\u5931\u8D25")}finally{e.removeClass("busy")}}}),(0,Ue.$)(document).on("click",".forum-post-card",function(){let t=(0,Ue.$)(this).data("post-id");t&&(window.location.href=`/forum/p/${t}`)})}));var Xe=ae(re());var Rs="all",Oo=1,Fs=!1;function Sf(i){var r,a;let t=((r=i.triggerUser)==null?void 0:r.avatar)||"/user/avatar/guest/s",e=((a=i.triggerUser)==null?void 0:a.uname)||"\u7528\u6237",n=i.type==="reply"?"\u56DE\u590D\u4E86\u4F60\u7684\u8BC4\u8BBA":"\u8BC4\u8BBA\u4E86\u4F60\u7684\u5E16\u5B50";return`
${At(e)} ${n}
${di(i.createdAt)}
`}async function ha(i=!1){var t;if(!Fs){Fs=!0;try{let e={page:String(Oo)};Rs==="unread"&&(e.unreadOnly="true");let n=await Xe.request.get("/api/forum/notifications",e),o=(t=n.data)!=null?t:n,r=o.notifications||[],a=(0,Xe.$)("#forum-notif-list"),s=(0,Xe.$)("#forum-notif-empty"),l=(0,Xe.$)("#forum-notif-load-more");i||a.empty(),r.length===0&&Oo===1?(s.show(),l.hide()):(s.hide(),r.forEach(c=>{a.append(Sf(c))}),o.hasMore?l.show():l.hide())}catch(e){Xe.Notification.error((e==null?void 0:e.message)||"\u52A0\u8F7D\u5931\u8D25")}finally{Fs=!1}}}(0,Xe.addPage)(new Xe.NamedPage(["forum_notifications"],async()=>{await ha(),(0,Xe.$)(document).on("click",".forum-notif-filter .forum-sort-btn",function(){(0,Xe.$)(".forum-notif-filter .forum-sort-btn").removeClass("active"),(0,Xe.$)(this).addClass("active"),Rs=(0,Xe.$)(this).data("filter")||"all",Oo=1,ha()}),(0,Xe.$)("#forum-notif-load-more-btn").on("click",()=>{Oo++,ha(!0)}),(0,Xe.$)("#forum-notif-read-all").on("click",async()=>{try{await Xe.request.post("/api/forum/notifications/read-all",{}),Rs==="unread"?(Oo=1,await ha()):(0,Xe.$)(".forum-notif-item.unread").removeClass("unread"),Xe.Notification.success("\u5DF2\u5168\u90E8\u6807\u8BB0\u4E3A\u5DF2\u8BFB")}catch(i){Xe.Notification.error((i==null?void 0:i.message)||"\u64CD\u4F5C\u5931\u8D25")}}),(0,Xe.$)(document).on("click",".forum-notif-item",async function(){let i=(0,Xe.$)(this).data("notif-id"),t=(0,Xe.$)(this).data("post-id"),e=(0,Xe.$)(this).data("comment-id");if((0,Xe.$)(this).hasClass("unread"))try{await Xe.request.post(`/api/forum/notifications/${i}/read`,{})}catch(n){}if(t){let n=e?`#forum-comment-${e}`:"";window.location.href=`/forum/p/${t}${n}`}})}));var V=ae(re());var kd="latest",ba=1,qs=!1,bn=null;function Td(){var n;let i=decodeURIComponent(window.location.hash||"");if(!i.startsWith("#forum-comment-"))return!1;let t=(0,V.$)(i);if(!t.length)return!1;(0,V.$)(".forum-comment-target").removeClass("forum-comment-target"),t.addClass("forum-comment-target");let e=(n=t.offset())==null?void 0:n.top;return typeof e=="number"&&window.scrollTo({top:Math.max(e-120,0),behavior:"smooth"}),window.setTimeout(()=>{t.removeClass("forum-comment-target")},2500),!0}function Uo(i,t=!1,e){var L,H,_,M,A;let n=((L=i.author)==null?void 0:L.avatar)||"/user/avatar/guest/s",o=((H=i.author)==null?void 0:H.uname)||"\u533F\u540D\u7528\u6237",r=t?"forum-reply-item":"forum-comment-item",a=(0,V.$)("#forum-comment-section").data("logged-in"),s=(0,V.$)("#forum-comment-section").data("is-admin"),l=a===!0||a==="true",c=Number((0,V.$)("#forum-comment-section").data("current-uid"))||0,u=s===!0||s==="true",d=i.uid===c||u,h=((_=i.reviewStatus)!=null?_:1)===1,v=i.reviewStatus===0?'\u5BA1\u6838\u4E2D ':i.reviewStatus===2?`\u5DF2\u62D2\u7EDD `:"",w=t&&i.replyToUname&&i.replyToUid&&e&&i.replyToUid!==e?``:"",k="";if(!t&&i.replies&&i.replies.length>0){let D=i.replies.map(q=>Uo(q,!0,i.uid)).join(""),$=(i.replyCount||0)>(((M=i.replies)==null?void 0:M.length)||0)?`\u67E5\u770B\u5168\u90E8 ${i.replyCount} \u6761\u56DE\u590D `:"";k=`${D}${$}
`}else!t&&(i.replyCount||0)>0&&(!i.replies||i.replies.length===0)&&(k=`
\u67E5\u770B ${i.replyCount} \u6761\u56DE\u590D
`);return`
`}function zs(){return String((0,V.$)("#forum-comment-section").data("post-id")||"")}function Cd(){let i=(0,V.$)("#forum-comment-compose"),t=(0,V.$)("#forum-comment-compose-home");i.length&&t.length&&t.append(i)}function Ed(i){let t=(0,V.$)("#forum-comment-compose"),e=(0,V.$)(`.forum-comment-item[data-comment-id="${i}"], .forum-reply-item[data-comment-id="${i}"]`).first();if(!t.length||!e.length)return!1;let n=e.children(".forum-inline-reply-slot");return n.length?(n.append(t),!0):!1}function jf(i,t){let e=i.children(".forum-expand-replies-btn");e.length?e.before(t):i.append(t)}function Af(i,t){let e=(0,V.$)(`.forum-comment-item[data-comment-id="${t}"]`).first();if(!e.length)return!1;let n=Number(e.data("uid"))||void 0,o=Uo(i,!0,n),r=(0,V.$)(`.forum-replies-wrap[data-parent-id="${t}"]`).first();return r.length||(e.append(`
`),r=(0,V.$)(`.forum-replies-wrap[data-parent-id="${t}"]`).first()),jf(r,o),!0}async function ga(i=!1){var e;if(qs)return;qs=!0;let t=zs();try{let n=await V.request.get(`/api/forum/posts/${t}/comments`,{sort:kd,page:String(ba)}),o=(e=n.data)!=null?e:n,r=o.comments||[],a=(0,V.$)("#forum-comment-list"),s=(0,V.$)("#forum-comment-load-more");i?a.find(".forum-loading").remove():(Cd(),a.empty()),r.length===0&&ba===1?(a.html('\u6682\u65E0\u8BC4\u8BBA
'),s.hide()):(r.forEach(l=>{a.append(Uo(l))}),o.hasMore?s.show():s.hide()),!i&&bn&&(Ed(bn.targetCommentId)||va()),i||Td()}catch(n){V.Notification.error((n==null?void 0:n.message)||"\u52A0\u8F7D\u8BC4\u8BBA\u5931\u8D25")}finally{qs=!1}}async function If(){var n;let i=zs(),t=((0,V.$)("#forum-comment-input").val()||"").trim();if(!t){V.Notification.error("\u8BF7\u8F93\u5165\u8BC4\u8BBA\u5185\u5BB9");return}let e={content:t};bn&&(e.parentId=bn.topParentId,e.replyToUid=bn.uid);try{let o=await V.request.post(`/api/forum/posts/${i}/comments/create`,e),r=(n=o.data)!=null?n:o;if(r.ok&&r.comment){if(bn)Af(r.comment,bn.topParentId)||await ga();else{let a=(0,V.$)("#forum-comment-list");a.find(".forum-loading").remove(),a.prepend(Uo(r.comment))}(0,V.$)("#forum-comment-input").val(""),va(),V.Notification.success(r.reviewStatus===1?"\u8BC4\u8BBA\u6210\u529F":"\u8BC4\u8BBA\u5DF2\u63D0\u4EA4\uFF0C\u7B49\u5F85\u5BA1\u6838")}}catch(o){V.Notification.error((o==null?void 0:o.message)||"\u8BC4\u8BBA\u5931\u8D25")}}function Hf(i,t,e,n){bn={topParentId:i,targetCommentId:t,uid:e,uname:n};let o=(0,V.$)("#forum-comment-reply-hint");o.text(`\u56DE\u590D ${n}`).show(),o.append(' \u53D6\u6D88 '),Ed(t),(0,V.$)("#forum-comment-input").focus()}function va(){bn=null,Cd(),(0,V.$)("#forum-comment-reply-hint").hide().empty()}function Pf(){let i=(0,V.$)(".forum-article-title").first().text().trim()||document.title,t=window.location.href;return`\u3010\u5854\u5B50\u54E5\u7684\u5708\u5B50\uFF1A${i}\u3011
${t}`}async function Df(){var t;let i=Pf();try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(i),!0}catch(e){}try{let e=document.createElement("textarea");return e.value=i,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),!0}catch(e){return!1}}(0,V.addPage)(new V.NamedPage(["forum_post_detail"],async()=>{let i=(0,V.$)(".forum-article-time"),t=String(i.data("time")||i.text()||"");t&&i.text(di(t)),await Promise.all([ga(),sa()]);let e=(0,V.$)("#forum-edit-form");e.length&&da(e,{onCancel:()=>{e.slideUp(200),(0,V.$)(".forum-article-body").show()}}),(0,V.$)("#forum-post-share-btn").on("click",async()=>{await Df()?V.Notification.success("\u5206\u4EAB\u5185\u5BB9\u5DF2\u590D\u5236"):V.Notification.error("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u4ECE\u5730\u5740\u680F\u624B\u52A8\u590D\u5236\u94FE\u63A5")}),(0,V.$)("#forum-post-like-btn").on("click",async function(){var r;let n=(0,V.$)(this),o=n.data("post-id");try{let a=await V.request.post(`/api/forum/posts/${o}/like`,{}),s=(r=a.data)!=null?r:a;s.ok&&(n.toggleClass("liked",s.liked),n.find(".forum-like-svg").replaceWith(s.liked?Ei:Ci),n.find(".forum-like-count").text(s.likeCount))}catch(a){V.Notification.error((a==null?void 0:a.message)||"\u64CD\u4F5C\u5931\u8D25")}}),(0,V.$)("#forum-post-delete-btn").on("click",async function(){var o;if(!confirm("\u786E\u5B9A\u5220\u9664\u6B64\u5E16\u5B50\uFF1F"))return;let n=(0,V.$)(this).data("post-id");try{let r=await V.request.post(`/api/forum/posts/${n}/delete`,{});((o=r.data)!=null?o:r).ok&&(V.Notification.success("\u5E16\u5B50\u5DF2\u5220\u9664"),window.location.href="proxy.php?url=https%3A%2F%2Fcodefun2000.com%2Fforum")}catch(r){V.Notification.error((r==null?void 0:r.message)||"\u5220\u9664\u5931\u8D25")}}),(0,V.$)("#forum-post-edit-btn").on("click",function(){let n=(0,V.$)("#forum-edit-form"),o=(0,V.$)(".forum-article-body");n.is(":visible")?(n.slideUp(200),o.show()):(n.slideDown(200),o.hide())}),(0,V.$)(document).on("click",".forum-comment-sort .forum-sort-btn",function(){(0,V.$)(".forum-comment-sort .forum-sort-btn").removeClass("active"),(0,V.$)(this).addClass("active"),kd=(0,V.$)(this).data("sort")||"latest",ba=1,ga()}),(0,V.$)("#forum-comment-submit").on("click",()=>If()),(0,V.$)("#forum-comment-load-more-btn").on("click",()=>{ba++,ga(!0)}),(0,V.$)(document).on("click",".forum-comment-reply-btn",function(){let n=(0,V.$)(this),o=n.closest(".forum-comment-item, .forum-reply-item"),r=String(n.data("comment-id")||""),a=String(o.data("parent-id")||""),s=Number(n.data("uid"))||0,l=String(n.data("uname")||"");Hf(a||r,r,s,l)}),(0,V.$)(document).on("click","#forum-cancel-reply",()=>va()),(0,V.$)(document).on("click",".forum-comment-like-btn",async function(){var r;let n=(0,V.$)(this),o=n.data("comment-id");try{let a=await V.request.post(`/api/forum/comments/${o}/like`,{}),s=(r=a.data)!=null?r:a;s.ok&&(n.toggleClass("liked",s.liked),n.find(".forum-like-svg").replaceWith(s.liked?Ei:Ci),n.find(".forum-comment-like-count").text(s.likeCount))}catch(a){V.Notification.error((a==null?void 0:a.message)||"\u64CD\u4F5C\u5931\u8D25")}}),(0,V.$)(document).on("click",".forum-comment-delete-btn",async function(){var r;if(!confirm("\u786E\u5B9A\u5220\u9664\u6B64\u8BC4\u8BBA\uFF1F"))return;let n=(0,V.$)(this),o=n.data("comment-id");bn&&(bn.targetCommentId===o||bn.topParentId===o)&&va();try{let a=await V.request.post(`/api/forum/comments/${o}/delete`,{});((r=a.data)!=null?r:a).ok&&(n.closest(".forum-comment-item, .forum-reply-item").fadeOut(300,function(){(0,V.$)(this).remove()}),V.Notification.success("\u5DF2\u5220\u9664"))}catch(a){V.Notification.error((a==null?void 0:a.message)||"\u5220\u9664\u5931\u8D25")}}),(0,V.$)(document).on("click",".forum-expand-replies-btn",async function(){var a;let n=(0,V.$)(this),o=n.data("comment-id"),r=n.closest(".forum-replies-wrap");n.text("\u52A0\u8F7D\u4E2D..."),n.prop("disabled",!0);try{let s=await V.request.get(`/api/forum/posts/${zs()}/comments`,{parentId:o,page:"1"}),l=(a=s.data)!=null?a:s,c=l.comments||[],u=Number(r.data("parent-uid"))||void 0;r.find(".forum-reply-item").remove(),n.before(c.map(d=>Uo(d,!0,u)).join("")),l.hasMore?(n.text("\u52A0\u8F7D\u66F4\u591A\u56DE\u590D"),n.prop("disabled",!1)):n.remove(),Td()}catch(s){n.text("\u52A0\u8F7D\u5931\u8D25\uFF0C\u70B9\u51FB\u91CD\u8BD5"),n.prop("disabled",!1)}})}));var wa=ae(re());var $f=["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],Ld=24;function jd(){let i=document.getElementById("practice-heatmap");if(!i)return;let t=i.getAttribute("data-heatmap"),e=i.getAttribute("data-start");if(!t||!e)return;let n;try{n=JSON.parse(t)}catch(_){return}let o=new Date;o.setHours(0,0,0,0);let r=new Date(e+"T00:00:00"),a=new Date(r);a.setDate(a.getDate()-a.getDay());let s=[],l=new Date(a);for(;l<=o;){let _=l.getFullYear(),M=String(l.getMonth()+1).padStart(2,"0"),A=String(l.getDate()).padStart(2,"0"),D=`${_}-${M}-${A}`;s.push({date:new Date(l),dateStr:D,count:n[D]||0}),l.setDate(l.getDate()+1)}let c=Math.ceil(s.length/7);if(c<=0)return;let u=3,d=i.parentElement;if(!d)return;let h=[],v=-1;for(let _=0;_{let _=d.clientWidth;_<60&&(_=d.getBoundingClientRect().width),_<60&&(_=340);let M=Math.floor((_-(c-1)*u)/c),A=Math.max(8,M),D=d.clientHeight||0;if(D>Ld+7*8+6*u){let ee=D-Ld,R=Math.floor((ee-6*u)/7);A=Math.max(8,Math.min(M,R))}A=Math.max(8,A-1);let $=A+u;i.innerHTML="";let q=document.createElement("div");q.className="heatmap-months";for(let ee=0;ee=10?N.classList.add("level-4"):te>=5?N.classList.add("level-3"):te>=2?N.classList.add("level-2"):te>=1&&N.classList.add("level-1"),N.title=`${Y.dateStr}: ${te} \u6B21\u63D0\u4EA4`}else N.style.visibility="hidden";K.appendChild(N)}i.appendChild(q),i.appendChild(K)},L=null,H=()=>{L&&clearTimeout(L),L=setTimeout(()=>{L=null,k()},60)};if(requestAnimationFrame(()=>{requestAnimationFrame(k)}),typeof ResizeObserver<"u"){let _="__practiceHeatmapRO",M=d[_];M&&M.disconnect();let A=new ResizeObserver(()=>H());d[_]=A,A.observe(d)}}function Bf(i,t,e){return!(i.right+et.right||i.bottom+et.bottom)}function Nf(i,t,e,n,o){let r=document.createElement("span");r.textContent=t,r.style.cssText=["position:absolute","left:-9999px","top:0",`font-size:${e}px`,"font-weight:700","font-family:inherit","white-space:nowrap",`color:${n}`,`transform:rotate(${o}deg)`,"visibility:hidden","pointer-events:none"].join(";"),i.appendChild(r);let a=r.getBoundingClientRect();return i.removeChild(r),{w:Math.ceil(a.width),h:Math.ceil(a.height)}}function Ff(){return document.documentElement.classList.contains("theme--dark")||document.body.classList.contains("theme--dark")}function _d(i,t,e){let n=t>0?i/t:0;return e?`hsl(214, 75%, ${Math.round(86-n*26)}%)`:`hsl(214, 72%, ${Math.round(52-n*18)}%)`}function Ad(){let i=document.getElementById("practice-wordcloud");if(!i)return;let t=i.getAttribute("data-has-tags"),e=i.getAttribute("data-tags"),n=s=>{i.innerHTML="";let l=document.createElement("div");l.className="wordcloud-empty",l.textContent=s,i.appendChild(l)};if(t!=="1"){n("\u6682\u65E0\u7B97\u6CD5\u6807\u7B7E\u6570\u636E");return}if(!e){n("\u6682\u65E0\u7B97\u6CD5\u6807\u7B7E\u6570\u636E");return}let o;try{o=JSON.parse(e)}catch(s){n("\u6682\u65E0\u7B97\u6CD5\u6807\u7B7E\u6570\u636E");return}let r=Object.entries(o).sort((s,l)=>l[1]-s[1]);if(!r.length){n("\u6682\u65E0\u7B97\u6CD5\u6807\u7B7E\u6570\u636E");return}let a=()=>{i.innerHTML="";let s=i.clientWidth||280,l=i.clientHeight||152,c=6,u=s/2,d=l/2,h=Ff(),v=r.slice(0,20),w=v.map(([,A])=>A),k=Math.max(...w),L=Math.min(...w),H=A=>{if(k===L)return 18;let D=(A-L)/(k-L);return Math.round(13+D*15)},_=[],M=Math.max(1,v.length-1);v.forEach(([A,D],$)=>{let q=H(D),K=$%7===2?6:$%5===1?-5:0,ee=_d($,M,h),{w:R,h:N}=Nf(i,A,q,ee,K);if(R=Math.min(R,s-c*2),R<8)return;let Y=!1;for(let te=0;te<700;te++){let ve=te*.31,ne=4+Math.pow(te,.55)*2.4,pe=u+Math.cos(ve)*ne-R/2,G=d+Math.sin(ve)*ne-N/2;pe=Math.max(c,Math.min(pe,s-c-R)),G=Math.max(c,Math.min(G,l-c-N));let Ee={left:pe,top:G,right:pe+R,bottom:G+N},Je=3;if(_.some(U=>Bf(Ee,U,Je)))continue;let J=document.createElement("span");J.className="wordcloud-word",J.textContent=A,J.title=`${A}\uFF1A${D} \u9898`,J.style.left=`${pe}px`,J.style.top=`${G}px`,J.style.fontSize=`${q}px`,J.style.color=ee,K!==0&&(J.style.transform=`rotate(${K}deg)`),J.style.transformOrigin="center center",i.appendChild(J),_.push(Ee),Y=!0;break}if(!Y&&$<8){let te=c+$%3*(s/3.5),ve=c+Math.floor($/3)*26,ne=document.createElement("span");ne.className="wordcloud-word",ne.textContent=A.length>10?`${A.slice(0,9)}\u2026`:A,ne.title=`${A}\uFF1A${D} \u9898`,ne.style.left=`${te}px`,ne.style.top=`${ve}px`,ne.style.fontSize=`${Math.min(q,14)}px`,ne.style.color=_d($,M,h),i.appendChild(ne),_.push({left:te,top:ve,right:te+80,bottom:ve+24})}}),_.length||n("\u6682\u65E0\u7B97\u6CD5\u6807\u7B7E\u6570\u636E")};requestAnimationFrame(()=>{requestAnimationFrame(a)})}function xa(){document.querySelectorAll(".practice-fav-dd-panel").forEach(i=>{let t=i;t.hidden=!0;let e=t.closest("[data-practice-fav-dd]"),n=e==null?void 0:e.querySelector(".practice-fav-dd-trigger");n==null||n.setAttribute("aria-expanded","false"),n==null||n.classList.remove("practice-fav-dd-trigger--open")})}var Md=!1;function Rf(){Md||(Md=!0,document.addEventListener("click",()=>{xa()}),document.addEventListener("keydown",i=>{i.key==="Escape"&&xa()}))}function qf(i,t){i.textContent="",Array.from(t.options).forEach((e,n)=>{let o=document.createElement("button");o.type="button",o.setAttribute("role","option"),o.className="practice-fav-dd-option",n===t.selectedIndex&&o.classList.add("practice-fav-dd-option--active"),o.dataset.value=e.value,o.setAttribute("aria-selected",n===t.selectedIndex?"true":"false"),o.textContent=e.textContent||e.value,i.appendChild(o)})}function zf(i,t){let e=t.options[t.selectedIndex];i.textContent=(e?e.textContent||e.value:"").trim()}function Of(i){if(i.dataset.practiceFavDdInited)return;i.dataset.practiceFavDdInited="1";let t=i.querySelector("select.practice-fav-select-sr"),e=i.querySelector(".practice-fav-dd-trigger"),n=i.querySelector(".practice-fav-dd-panel");if(!t||!e||!n)return;let o=()=>{qf(n,t),zf(e,t)};o(),i.__favDdRebuild=o,e.addEventListener("click",r=>{r.stopPropagation();let a=!n.hidden;xa(),!a&&(o(),n.hidden=!1,e.setAttribute("aria-expanded","true"),e.classList.add("practice-fav-dd-trigger--open"))}),n.addEventListener("click",r=>{var s;let a=r.target.closest(".practice-fav-dd-option");a&&(r.stopPropagation(),t.value=(s=a.dataset.value)!=null?s:"",t.dispatchEvent(new Event("change",{bubbles:!0})),o(),n.hidden=!0,e.setAttribute("aria-expanded","false"),e.classList.remove("practice-fav-dd-trigger--open"))}),t.addEventListener("change",()=>{o()})}function Uf(){Rf(),document.querySelectorAll("[data-practice-fav-dd]").forEach(i=>{Of(i)})}function Wf(i){var e;if(!i)return;let t=i.closest("[data-practice-fav-dd]");(e=t==null?void 0:t.__favDdRebuild)==null||e.call(t)}function Yf(){let i=document.querySelector(".practice-view-switch");if(!i)return;let t=Array.from(i.querySelectorAll(".practice-view-switch-btn")),e=Array.from(document.querySelectorAll("[data-practice-view-panel]"));if(!t.length||!e.length)return;let n=o=>{i.setAttribute("data-active-view",o),t.forEach(r=>{let a=r.dataset.practiceViewTarget===o;r.classList.toggle("practice-view-switch-btn--active",a),r.setAttribute("aria-selected",a?"true":"false"),r.tabIndex=a?0:-1}),e.forEach(r=>{let a=r.dataset.practiceViewPanel===o;r.classList.toggle("practice-panel--active",a),r.hidden=!a}),o!=="favorites"&&xa(),o==="dashboard"&&requestAnimationFrame(()=>{jd(),Ad()})};t.forEach(o=>{o.addEventListener("click",()=>{let r=o.dataset.practiceViewTarget;r&&n(r)})}),n(i.getAttribute("data-active-view")||"dashboard")}function ya(){let i=document.getElementById("practice-fav-list");if(!i)return;let t=document.getElementById("practice-fav-knowledge"),e=document.getElementById("practice-fav-company"),n=document.getElementById("practice-fav-filter-empty"),o=i.querySelectorAll(".practice-fav-row"),r=t&&t.value!==""?t.value.trim().toLowerCase():"",a=e&&e.value!==""?e.value.trim().toLowerCase():"",s=0;o.forEach(l=>{var k;let c=(((k=l.querySelector(".practice-fav-company"))==null?void 0:k.textContent)||"").trim().toLowerCase(),u=l.querySelectorAll(".practice-fav-chip--user, .practice-fav-chip--alg"),d=Array.from(u).map(L=>{var H;return((H=L.textContent)==null?void 0:H.trim().toLowerCase())||""}),h=!a||c.includes(a),v=!r||d.some(L=>L===r||L.includes(r)),w=h&&v;l.style.display=w?"":"none",w&&s++}),n&&(n.style.display=s===0?"":"none")}function Vf(){let i=document.getElementById("practice-fav-knowledge"),t=document.getElementById("practice-fav-company");document.getElementById("practice-fav-list")&&(i==null||i.addEventListener("change",ya),t==null||t.addEventListener("change",ya),ya())}function Jf(i){return i==="easy"?"\u7B80":i==="medium"?"\u4E2D":"\u96BE"}function Sd(i,t,e){if(!i)return;let n=i.value;i.innerHTML="";let o=document.createElement("option");o.value="",o.textContent=e,i.appendChild(o);for(let a of t){let s=document.createElement("option");s.value=a,s.textContent=a,i.appendChild(s)}let r=Array.from(i.options).some(a=>a.value===n);i.value=r?n:"",Wf(i)}function Kf(i){let t=document.createElement("div");t.className="practice-fav-row";let e=document.createElement("div");e.className="practice-fav-title-area";let n=document.createElement("a");if(n.className="practice-fav-title",n.href=`/p/${i.pid}`,n.target="_blank",n.rel="noopener noreferrer",n.textContent=`${i.pid} ${i.title}`,e.appendChild(n),i.recordHref){let s=document.createElement("a");s.href=i.recordHref,s.className="practice-fav-record",s.title="\u6700\u8FD1\u63D0\u4EA4";let l=document.createElement("span");l.className=`icon record-status--icon ${i.recordIconClass||""}`.trim(),s.appendChild(l),e.appendChild(s)}t.appendChild(e);let o=document.createElement("div");o.className="practice-fav-right";for(let s of i.user_star_tags||[]){let l=document.createElement("span");l.className="practice-fav-chip practice-fav-chip--user",l.textContent=s,o.appendChild(l)}for(let s of i.ai_alg_tags||[]){let l=document.createElement("span");l.className="practice-fav-chip practice-fav-chip--alg",l.textContent=s,o.appendChild(l)}let r=i.ps_info||[];if(r.length){let s=document.createElement("div");s.className="practice-fav-company";for(let l of r){let c=document.createElement("a");c.className="practice-fav-co-chip",c.href=`/pset/${l.psid}`,c.textContent=l.company_tag,s.appendChild(c)}o.appendChild(s)}let a=document.createElement("span");return a.className=`practice-fav-diff practice-fav-diff--${i.difficulty}`,a.textContent=Jf(i.difficulty),o.appendChild(a),t.appendChild(o),t}function Qf(){var e;let i=document.querySelector(".practice-fav-pagination"),t=(e=i==null?void 0:i.getAttribute("data-practice-fav-api"))==null?void 0:e.trim();!i||!t||i.addEventListener("click",async n=>{var l;let o=n.target.closest("[data-practice-fav-page-link]");if(!o||o.disabled)return;n.preventDefault();let r=o.getAttribute("data-practice-fav-page-link");if(r===null)return;let a=parseInt(r,10);if(!Number.isFinite(a)||a<1)return;i.querySelectorAll("[data-practice-fav-page-link]").forEach(c=>{c.disabled=!0});try{let c=await fetch(`${t}?page=${encodeURIComponent(String(a))}`,{credentials:"same-origin",headers:{Accept:"application/json"}}),u=await c.json();if(!c.ok||!u.ok)throw new Error(u.message||`HTTP ${c.status}`);let d=document.getElementById("practice-fav-list");if(d){d.textContent="";for(let _ of u.items)d.appendChild(Kf(_))}let h=document.querySelector(".practice-fav-count");h&&(h.textContent=`\u5171 ${u.total} \u9898`);let v=i.querySelector(".practice-fav-page-indicator");v&&(v.textContent=`\u7B2C ${u.page} / ${u.totalPages} \u9875\uFF08\u6BCF\u9875 ${u.pageSize} \u9898\uFF09`),Sd(document.getElementById("practice-fav-knowledge"),u.knowledgeTags||[],"\u5168\u90E8\u6807\u7B7E"),Sd(document.getElementById("practice-fav-company"),u.companyTags||[],"\u5168\u90E8\u516C\u53F8");let w=i.querySelectorAll("[data-practice-fav-page-link]"),k=w[0],L=w[1];k&&L&&(k.setAttribute("data-practice-fav-page-link",String(u.page-1)),L.setAttribute("data-practice-fav-page-link",String(u.page+1)),k.disabled=u.page<=1,L.disabled=u.page>=u.totalPages);let H=new URL(window.location.href);u.page<=1?H.searchParams.delete("practice_fav_page"):H.searchParams.set("practice_fav_page",String(u.page)),history.replaceState(null,"",H.toString()),ya()}catch(c){console.error("[HomepagePractice] favorites page:",c)}finally{let c=i.querySelector(".practice-fav-page-indicator"),u=(l=c==null?void 0:c.textContent)==null?void 0:l.match(/第 (\d+) \/ (\d+)/),d=u?parseInt(u[1],10):1,h=u?parseInt(u[2],10):1,v=i.querySelectorAll("[data-practice-fav-page-link]");v[0]&&(v[0].disabled=d<=1),v[1]&&(v[1].disabled=d>=h)}})}(0,wa.addPage)(new wa.NamedPage(["homepage"],()=>{Yf(),jd(),Ad(),Uf(),Vf(),Qf()}));window.lazyloadMetadata={"lang-en.js":"4a60129a","lang-ko.js":"b144b64b","lang-zh.js":"c0c622a7","lang-zh_TW.js":"6099eaf5","entry.js":"5e0d9b3e"};window.LANGS={bash:{display:"Bash",code_file:"foo.sh",execute:"/bin/bash foo.sh",highlight:"bash",monaco:"bash",time_limit_rate:1,memory_limit_rate:1,key:"bash",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},c:{compile:"/usr/bin/gcc -std=c99 -o foo foo.c -lm",highlight:"c",monaco:"c",display:"C",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.c",execute:"/w/foo",key:"c",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},cc:{compile:"/usr/bin/g++ -std=c++14 -o foo foo.cc -lm -I/include",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",display:"C++",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc98":{compile:"/usr/bin/g++ -std=c++98 -o foo foo.cc -lm -I/include",display:"C++98",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc98",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc98o2":{compile:"/usr/bin/g++ -std=c++98 -o foo foo.cc -lm -O2 -I/include",display:"C++98(O2)",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc98o2",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc11":{compile:"/usr/bin/g++ -std=c++11 -o foo foo.cc -lm -I/include",display:"C++11",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc11",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc11o2":{compile:"/usr/bin/g++ -std=c++11 -o foo foo.cc -lm -O2 -I/include",display:"C++11(O2)",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc11o2",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc14":{display:"C++14",compile:"/usr/bin/g++ -std=c++14 -o foo foo.cc -lm -I/include",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc14",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc14o2":{compile:"/usr/bin/g++ -std=c++14 -o foo foo.cc -lm -O2 -I/include",display:"C++14(O2)",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc14o2",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc17":{compile:"/usr/bin/g++ -std=c++17 -o foo foo.cc -lm -I/include",display:"C++17",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc17",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"cc.cc17o2":{compile:"/usr/bin/g++ -std=c++17 -o foo foo.cc -lm -O2 -I/include",display:"C++17(O2)",code_file:"foo.cc",highlight:"cpp",monaco:"cpp",time_limit_rate:1,memory_limit_rate:1,execute:"/w/foo",key:"cc.cc17o2",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},pas:{compile:"/usr/bin/fpc -O2 -o/w/foo foo.pas",highlight:"pascal",display:"Pascal",monaco:"pascal",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.pas",execute:"/w/foo",key:"pas",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},java:{compile:'/usr/bin/bash -c "javac -d /w -encoding utf8 ./Main.java && jar cvf Main.jar *.class >/dev/null"',code_file:"Main.java",target:"Main.jar",execute:"/usr/bin/java -Xlog:disable -Xss256m -Xmx512m -XX:+UseG1GC -cp Main.jar Main",time_limit_rate:2,highlight:"java astyle-java",monaco:"java",display:"Java",compile_time_limit:3e4,memory_limit_rate:1,key:"java",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},py:{compile:`/usr/bin/python -c "import py_compile; py_compile.compile('/w/foo.py', '/w/foo', doraise=True)"`,code_file:"foo.py",execute:"/usr/bin/python foo",highlight:"python",time_limit_rate:2,display:"Python",monaco:"python",memory_limit_rate:1,key:"py",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"py.py2":{display:"Python 2",compile:`/usr/bin/python -c "import py_compile; py_compile.compile('/w/foo.py', '/w/foo', doraise=True)"`,code_file:"foo.py",execute:"/usr/bin/python foo",highlight:"python",time_limit_rate:2,monaco:"python",memory_limit_rate:1,key:"py.py2",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"py.py3":{compile:`/usr/bin/python3 -c "import py_compile; py_compile.compile('/w/foo.py', '/w/foo', doraise=True)"`,execute:"/usr/bin/python3 foo",display:"Python 3",code_file:"foo.py",highlight:"python",time_limit_rate:2,monaco:"python",memory_limit_rate:1,key:"py.py3",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},"py.pypy3":{compile:`/bin/bash -c "/usr/bin/pypy3 -c \\"import py_compile; py_compile.compile('/w/foo.py', '/w/foo', doraise=True)\\" && mv foo.py foo"`,execute:"/bin/bash -c 'mv foo foo.py && /usr/bin/pypy3 -B foo.py'",display:"PyPy3",code_file:"foo.py",highlight:"python",time_limit_rate:2,monaco:"python",memory_limit_rate:1,key:"py.pypy3",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},php:{execute:"/usr/bin/php foo.php",display:"PHP",highlight:"php",monaco:"php",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.php",key:"php",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},rs:{compile:"/usr/bin/rustc -O -o /w/foo /w/foo.rs",highlight:"rust",display:"Rust",monaco:"rust",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.rs",execute:"/w/foo",key:"rs",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},hs:{compile:"/usr/bin/ghc -O -outputdir /tmp -o foo foo.hs",highlight:"haskell",display:"Haskell",monaco:"haskell",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.hs",execute:"/w/foo",key:"hs",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},js:{execute:"/usr/bin/node /w/foo.js",highlight:"javascript",time_limit_rate:2,display:"Javascript (JSC)",monaco:"javascript",memory_limit_rate:1,code_file:"foo.js",key:"js",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},go:{compile:"env GOMAXPROCS=1 /usr/bin/go build -o foo foo.go",display:"Golang",time_limit_rate:4,compile_time_limit:3e4,highlight:"go",monaco:"go",memory_limit_rate:1,code_file:"foo.go",execute:"/w/foo",key:"go",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},rb:{execute:"/usr/bin/ruby foo.rb",highlight:"ruby",display:"Ruby",monaco:"ruby",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.rb",key:"rb",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}},cs:{compile:"/usr/bin/mcs -optimize+ -out:/w/foo /w/foo.cs",execute:"/usr/bin/mono foo",highlight:"csharp",monaco:"csharp",display:"C#",time_limit_rate:1,memory_limit_rate:1,code_file:"foo.cs",key:"cs",remote:!1,hidden:!1,disabled:!1,isBinary:!1,validAs:{}}};})();
};