From 0923d5515e52971050cc111cbadcdacb46cab5f1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:41:42 +0100 Subject: [PATCH] chore(deps): bump artalk from 2.8.4 to 2.8.5 (#1255) Co-authored-by: GitHub --- assets/lib/artalk/Artalk.css | 2 +- assets/lib/artalk/Artalk.js | 4 ++-- assets/lib/artalk/ArtalkLite.css | 2 +- assets/lib/artalk/ArtalkLite.js | 2 +- dependencies.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/lib/artalk/Artalk.css b/assets/lib/artalk/Artalk.css index 37f9a8f04..dbfea5209 100644 --- a/assets/lib/artalk/Artalk.css +++ b/assets/lib/artalk/Artalk.css @@ -1 +1 @@ -@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:#0083ff33}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}.atk-comment>.atk-main>.atk-header .atk-verified-icon{height:1.4em;width:1.4em;background-repeat:no-repeat;background-position:center;background-size:contain;display:block;background-image:url('data:image/svg+xml,')}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-word}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:5px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:25px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:10px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{text-align:right}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{float:initial;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:60px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor.editor-traveling{margin-top:5px;margin-bottom:10px}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;row-gap:5px;justify-content:space-between;padding:5px;flex-wrap:wrap}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-state-wrap{margin-right:5px}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-plug-btn-wrap{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;row-gap:5px}.atk-main-editor>.atk-bottom .atk-plug-btn{display:flex;justify-content:center;place-items:center;padding:0 10px;line-height:30px;height:30px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;word-break:keep-all}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:5px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{display:flex;justify-content:center;place-items:center;color:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn i:not(:first-child){margin-left:4px}.atk-main-editor>.atk-bottom .atk-state-btn{z-index:2;height:30px;padding:0 0 0 10px;font-size:14px;position:relative;display:flex;flex-direction:row;justify-content:center;place-items:center;background:var(--at-color-bg-grey-transl);cursor:pointer;overflow:hidden;border-radius:3px}.atk-main-editor>.atk-bottom .atk-state-btn:hover .atk-cancel{background:#0000000a}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-state-btn{padding:0}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{display:none}}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 8px 0 2px;max-width:8em}.atk-main-editor>.atk-bottom .atk-state-btn .atk-cancel{display:flex;justify-content:center;place-items:center;padding:0 10px;font-weight:700;height:100%;background:#00000005}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;min-width:7.3em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-send-btn{min-width:6em}}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px;font-size:22px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover :after{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-icon:after{display:block;content:"";width:1em;height:1em;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del:after{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-yes:after,.atk-icon-check:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-close-slim:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-arrow-left:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-icon-no:after,.atk-icon-close:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close:after{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:#0000004d}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} +@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #fff;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:#0083ff33}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}.atk-comment>.atk-main>.atk-header .atk-verified-icon{height:1.4em;width:1.4em;background-repeat:no-repeat;background-position:center;background-size:contain;display:block;background-image:url('data:image/svg+xml,')}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-word}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:5px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:25px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:10px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{text-align:right}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{float:initial;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:60px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor.editor-traveling{margin-top:5px;margin-bottom:10px}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;row-gap:5px;justify-content:space-between;padding:5px;flex-wrap:wrap}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-state-wrap{margin-right:5px}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-plug-btn-wrap{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;row-gap:5px}.atk-main-editor>.atk-bottom .atk-plug-btn{display:flex;justify-content:center;place-items:center;padding:0 10px;line-height:30px;height:30px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;word-break:keep-all}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:5px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{display:flex;justify-content:center;place-items:center;color:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn i:not(:first-child){margin-left:4px}.atk-main-editor>.atk-bottom .atk-state-btn{z-index:2;height:30px;padding:0 0 0 10px;font-size:14px;position:relative;display:flex;flex-direction:row;justify-content:center;place-items:center;background:var(--at-color-bg-grey-transl);cursor:pointer;overflow:hidden;border-radius:3px}.atk-main-editor>.atk-bottom .atk-state-btn:hover .atk-cancel{background:#0000000a}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-state-btn{padding:0}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{display:none}}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 8px 0 2px;max-width:8em}.atk-main-editor>.atk-bottom .atk-state-btn .atk-cancel{display:flex;justify-content:center;place-items:center;padding:0 10px;font-weight:700;height:100%;background:#00000005}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;min-width:7.3em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-send-btn{min-width:6em}}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px;font-size:22px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover :after{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-icon:after{display:block;content:"";width:1em;height:1em;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del:after{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-yes:after,.atk-icon-check:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-close-slim:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-arrow-left:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-icon-no:after,.atk-icon-close:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-version-check-notice{background:var(--at-color-bg-grey);border-radius:6px;padding:10px 20px;margin-bottom:10px;font-size:14px}.atk-version-check-notice .atk-info{color:var(--at-color-meta)}.atk-version-check-notice .atk-ignore-btn{cursor:pointer;float:right}.atk-version-check-notice .atk-ignore-btn:hover{opacity:.8}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close:after{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:#0000004d}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} diff --git a/assets/lib/artalk/Artalk.js b/assets/lib/artalk/Artalk.js index 3f57fb1a1..59a454c72 100644 --- a/assets/lib/artalk/Artalk.js +++ b/assets/lib/artalk/Artalk.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Artalk={})}(this,(function(e){"use strict";var t,n,s,i,r=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,d=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&d(e,n,t[n]);if(l)for(var n of l(t))h.call(t,n)&&d(e,n,t[n]);return e},p=(e,t)=>o(e,a(t)),g=(e,t,n)=>(d(e,"symbol"!=typeof t?t+"":t,n),n),m=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},f=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n),k=(e,t,n)=>new Promise(((s,i)=>{var r=e=>{try{a(n.next(e))}catch(t){i(t)}},o=e=>{try{a(n.throw(e))}catch(t){i(t)}},a=e=>e.done?s(e.value):Promise.resolve(e.value).then(r,o);a((n=n.apply(e,t)).next())}));class y{constructor(e={}){g(this,"baseUrl","/api/v2"),g(this,"securityData",null),g(this,"securityWorker"),g(this,"abortControllers",new Map),g(this,"customFetch",((...e)=>fetch(...e))),g(this,"baseApiParams",{credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"}),g(this,"setSecurityData",(e=>{this.securityData=e})),g(this,"contentFormatters",{"application/json":e=>null===e||"object"!=typeof e&&"string"!=typeof e?e:JSON.stringify(e),"text/plain":e=>null!==e&&"string"!=typeof e?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce(((t,n)=>{const s=e[n];return t.append(n,s instanceof Blob?s:"object"==typeof s&&null!==s?JSON.stringify(s):`${s}`),t}),new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)}),g(this,"createAbortSignal",(e=>{if(this.abortControllers.has(e)){const t=this.abortControllers.get(e);return t?t.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal})),g(this,"abortRequest",(e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))})),g(this,"request",(e=>k(this,null,(function*(){var t=e,{body:n,secure:s,path:i,type:r,query:o,format:a,baseUrl:d,cancelToken:g}=t,m=((e,t)=>{var n={};for(var s in e)c.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&l)for(var s of l(e))t.indexOf(s)<0&&h.call(e,s)&&(n[s]=e[s]);return n})(t,["body","secure","path","type","query","format","baseUrl","cancelToken"]);const f=("boolean"==typeof s?s:this.baseApiParams.secure)&&this.securityWorker&&(yield this.securityWorker(this.securityData))||{},y=this.mergeRequestParams(m,f),v=o&&this.toQueryString(o),$=this.contentFormatters[r||"application/json"],b=a||y.format;return this.customFetch(`${d||this.baseUrl||""}${i}${v?`?${v}`:""}`,p(u({},y),{headers:u(u({},y.headers||{}),r&&"multipart/form-data"!==r?{"Content-Type":r}:{}),signal:(g?this.createAbortSignal(g):y.signal)||null,body:null==n?null:$(n)})).then((e=>k(this,null,(function*(){const t=e;t.data=null,t.error=null;const n=b?yield e[b]().then((e=>(t.ok?t.data=e:t.error=e,t))).catch((e=>(t.error=e,t))):t;if(g&&this.abortControllers.delete(g),!e.ok)throw n;return n}))))})))),Object.assign(this,e)}encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent("number"==typeof t?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map((e=>this.encodeQueryParam(t,e))).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter((e=>void 0!==t[e])).map((e=>Array.isArray(t[e])?this.addArrayQueryParam(t,e):this.addQueryParam(t,e))).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}mergeRequestParams(e,t){return p(u(u(u({},this.baseApiParams),e),t||{}),{headers:u(u(u({},this.baseApiParams.headers||{}),e.headers||{}),t&&t.headers||{})})}} +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Artalk={})}(this,(function(e){"use strict";var t,n,s,i,r=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,h=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&h(e,n,t[n]);if(l)for(var n of l(t))d.call(t,n)&&h(e,n,t[n]);return e},p=(e,t)=>o(e,a(t)),g=(e,t,n)=>(h(e,"symbol"!=typeof t?t+"":t,n),n),m=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},f=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n),k=(e,t,n)=>new Promise(((s,i)=>{var r=e=>{try{a(n.next(e))}catch(t){i(t)}},o=e=>{try{a(n.throw(e))}catch(t){i(t)}},a=e=>e.done?s(e.value):Promise.resolve(e.value).then(r,o);a((n=n.apply(e,t)).next())}));class y{constructor(e={}){g(this,"baseUrl","/api/v2"),g(this,"securityData",null),g(this,"securityWorker"),g(this,"abortControllers",new Map),g(this,"customFetch",((...e)=>fetch(...e))),g(this,"baseApiParams",{credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"}),g(this,"setSecurityData",(e=>{this.securityData=e})),g(this,"contentFormatters",{"application/json":e=>null===e||"object"!=typeof e&&"string"!=typeof e?e:JSON.stringify(e),"text/plain":e=>null!==e&&"string"!=typeof e?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce(((t,n)=>{const s=e[n];return t.append(n,s instanceof Blob?s:"object"==typeof s&&null!==s?JSON.stringify(s):`${s}`),t}),new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)}),g(this,"createAbortSignal",(e=>{if(this.abortControllers.has(e)){const t=this.abortControllers.get(e);return t?t.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal})),g(this,"abortRequest",(e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))})),g(this,"request",(e=>k(this,null,(function*(){var t=e,{body:n,secure:s,path:i,type:r,query:o,format:a,baseUrl:h,cancelToken:g}=t,m=((e,t)=>{var n={};for(var s in e)c.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&l)for(var s of l(e))t.indexOf(s)<0&&d.call(e,s)&&(n[s]=e[s]);return n})(t,["body","secure","path","type","query","format","baseUrl","cancelToken"]);const f=("boolean"==typeof s?s:this.baseApiParams.secure)&&this.securityWorker&&(yield this.securityWorker(this.securityData))||{},y=this.mergeRequestParams(m,f),v=o&&this.toQueryString(o),$=this.contentFormatters[r||"application/json"],b=a||y.format;return this.customFetch(`${h||this.baseUrl||""}${i}${v?`?${v}`:""}`,p(u({},y),{headers:u(u({},y.headers||{}),r&&"multipart/form-data"!==r?{"Content-Type":r}:{}),signal:(g?this.createAbortSignal(g):y.signal)||null,body:null==n?null:$(n)})).then((e=>k(this,null,(function*(){const t=e;t.data=null,t.error=null;const n=b?yield e[b]().then((e=>(t.ok?t.data=e:t.error=e,t))).catch((e=>(t.error=e,t))):t;if(g&&this.abortControllers.delete(g),!e.ok)throw n;return n}))))})))),Object.assign(this,e)}encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent("number"==typeof t?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map((e=>this.encodeQueryParam(t,e))).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter((e=>void 0!==t[e])).map((e=>Array.isArray(t[e])?this.addArrayQueryParam(t,e):this.addQueryParam(t,e))).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}mergeRequestParams(e,t){return p(u(u(u({},this.baseApiParams),e),t||{}),{headers:u(u(u({},this.baseApiParams.headers||{}),e.headers||{}),t&&t.headers||{})})}} /** * @title Artalk API * @version 2.0 @@ -7,5 +7,5 @@ * @contact API Support (https://artalk.js.org) * * Artalk is a modern comment system based on Golang. - */let v=class extends y{constructor(){super(...arguments),g(this,"cache",{flushCache:(e={})=>this.request(u({path:"/cache/flush",method:"POST",secure:!0,format:"json"},e)),warmUpCache:(e={})=>this.request(u({path:"/cache/warm_up",method:"POST",secure:!0,format:"json"},e))}),g(this,"captcha",{getCaptcha:(e={})=>this.request(u({path:"/captcha",method:"GET",format:"json"},e)),getCaptchaStatus:(e={})=>this.request(u({path:"/captcha/status",method:"GET",format:"json"},e)),verifyCaptcha:(e,t={})=>this.request(u({path:"/captcha/verify",method:"POST",body:e,type:"application/json",format:"json"},t))}),g(this,"comments",{getComments:(e,t={})=>this.request(u({path:"/comments",method:"GET",query:e,secure:!0,type:"application/json",format:"json"},t)),createComment:(e,t={})=>this.request(u({path:"/comments",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),getComment:(e,t={})=>this.request(u({path:`/comments/${e}`,method:"GET",type:"application/json",format:"json"},t)),updateComment:(e,t,n={})=>this.request(u({path:`/comments/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deleteComment:(e,t={})=>this.request(u({path:`/comments/${e}`,method:"DELETE",secure:!0,format:"json"},t))}),g(this,"conf",{conf:(e={})=>this.request(u({path:"/conf",method:"GET",format:"json"},e)),getDomain:(e,t={})=>this.request(u({path:"/conf/domain",method:"GET",query:e,format:"json"},t))}),g(this,"notifies",{getNotifies:(e,t={})=>this.request(u({path:"/notifies",method:"GET",query:e,type:"application/json",format:"json"},t)),markAllNotifyRead:(e,t={})=>this.request(u({path:"/notifies/read",method:"POST",body:e,type:"application/json",format:"json"},t)),markNotifyRead:(e,t,n={})=>this.request(u({path:`/notifies/${e}/${t}`,method:"POST",format:"json"},n))}),g(this,"pages",{getPages:(e,t={})=>this.request(u({path:"/pages",method:"GET",query:e,secure:!0,type:"application/json",format:"json"},t)),fetchAllPages:(e,t={})=>this.request(u({path:"/pages/fetch",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),getPageFetchStatus:(e={})=>this.request(u({path:"/pages/fetch/status",method:"GET",secure:!0,format:"json"},e)),logPv:(e,t={})=>this.request(u({path:"/pages/pv",method:"POST",body:e,type:"application/json",format:"json"},t)),updatePage:(e,t,n={})=>this.request(u({path:`/pages/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deletePage:(e,t={})=>this.request(u({path:`/pages/${e}`,method:"DELETE",secure:!0,format:"json"},t)),fetchPage:(e,t={})=>this.request(u({path:`/pages/${e}/fetch`,method:"POST",secure:!0,type:"application/json",format:"json"},t))}),g(this,"sendEmail",{sendEmail:(e,t={})=>this.request(u({path:"/send_email",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t))}),g(this,"settings",{getSettings:(e={})=>this.request(u({path:"/settings",method:"GET",secure:!0,format:"json"},e)),applySettings:(e,t={})=>this.request(u({path:"/settings",method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},t)),getSettingsTemplate:(e,t={})=>this.request(u({path:`/settings/template/${e}`,method:"GET",secure:!0,format:"json"},t))}),g(this,"sites",{getSites:(e={})=>this.request(u({path:"/sites",method:"GET",secure:!0,format:"json"},e)),createSite:(e,t={})=>this.request(u({path:"/sites",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),updateSite:(e,t,n={})=>this.request(u({path:`/sites/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deleteSite:(e,t={})=>this.request(u({path:`/sites/${e}`,method:"DELETE",secure:!0,format:"json"},t))}),g(this,"stats",{getStats:(e,t,n={})=>this.request(u({path:`/stats/${e}`,method:"GET",query:t,type:"application/json",format:"json"},n))}),g(this,"transfer",{exportArtrans:(e={})=>this.request(u({path:"/transfer/export",method:"GET",secure:!0,format:"json"},e)),importArtrans:(e,t={})=>this.request(u({path:"/transfer/import",method:"POST",body:e,secure:!0,type:"application/json"},t)),uploadArtrans:(e,t={})=>this.request(u({path:"/transfer/upload",method:"POST",body:e,secure:!0,type:"multipart/form-data",format:"json"},t))}),g(this,"upload",{upload:(e,t={})=>this.request(u({path:"/upload",method:"POST",body:e,secure:!0,type:"multipart/form-data",format:"json"},t))}),g(this,"user",{getUser:(e,t={})=>this.request(u({path:"/user",method:"GET",query:e,secure:!0,format:"json"},t)),login:(e,t={})=>this.request(u({path:"/user/access_token",method:"POST",body:e,type:"application/json",format:"json"},t)),getUserStatus:(e,t={})=>this.request(u({path:"/user/status",method:"GET",query:e,secure:!0,format:"json"},t))}),g(this,"users",{createUser:(e,t={})=>this.request(u({path:"/users",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),updateUser:(e,t,n={})=>this.request(u({path:`/users/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deleteUser:(e,t={})=>this.request(u({path:`/users/${e}`,method:"DELETE",secure:!0,format:"json"},t)),getUsers:(e,t,n={})=>this.request(u({path:`/users/${e}`,method:"GET",query:t,secure:!0,type:"application/json",format:"json"},n))}),g(this,"version",{getVersion:(e={})=>this.request(u({path:"/version",method:"GET",format:"json"},e))}),g(this,"votes",{syncVotes:(e={})=>this.request(u({path:"/votes/sync",method:"POST",secure:!0,format:"json"},e)),vote:(e,t,n,s={})=>this.request(u({path:`/votes/${e}/${t}`,method:"POST",body:n,type:"application/json",format:"json"},s))})}};var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;nk(this,null,(function*(){const s=e.getApiToken&&e.getApiToken(),i=new Headers(u({Authorization:s?`Bearer ${s}`:""},null==n?void 0:n.headers));i.get("Authorization")||i.delete("Authorization");const r=yield fetch(t,p(u({},n),{headers:i}));if(!r.ok){const s=(yield r.json().catch((()=>{})))||{};let i=!1;if(e.handlers&&(yield e.handlers.get().reduce(((e,t)=>k(this,null,(function*(){yield e,!0===s[t.action]&&(yield t.handler(s),i=!0)}))),Promise.resolve())),i)return w(e,t,n);throw function(e,t){const n=new x;return n.message=t.msg||t.message||"fetch error",n.code=e,n.data=t,console.error(n),n}(r.status,s)}return r}));class x extends Error{constructor(){super(...arguments),g(this,"code",0),g(this,"message","fetch error"),g(this,"data")}}class C extends v{constructor(e){super({baseUrl:e.baseURL,customFetch:(t,n)=>w(e,t,n)}),g(this,"_opts"),this._opts=e}getUserFields(){const e=this._opts.userInfo;if((null==e?void 0:e.name)&&(null==e?void 0:e.email))return{name:e.name,email:e.email}}}function E(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let S={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function T(e){S=e}const A=/[&<>"']/,L=new RegExp(A.source,"g"),R=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,P=new RegExp(R.source,"g"),M={"&":"&","<":"<",">":">",'"':""","'":"'"},O=e=>M[e];function I(e,t){if(t){if(A.test(e))return e.replace(L,O)}else if(R.test(e))return e.replace(P,O);return e}const _=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const U=/(^|[^\[])\^/g;function q(e,t){let n="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(U,"$1"),n=n.replace(e,i),s},getRegex:()=>new RegExp(n,t)};return s}function B(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(t){return null}return e}const j={exec:()=>null};function D(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,i=t;for(;--i>=0&&"\\"===n[i];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:F(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=F(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=F(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="",a="",l=!1;for(;e;){let n=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,a=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,a=s.slice(h),h+=t[1].length);let d=!1;if(!s&&/^ *$/.test(c)&&(o+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),i.test(c))break;if(r.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())a+="\n"+c.slice(h);else{if(d)break;if(s.search(/[^ ]/)>=4)break;if(i.test(s))break;if(r.test(s))break;if(n.test(s))break;a+="\n"+c}d||c.trim()||(d=!0),o+=l+"\n",e=e.substring(l.length+1),s=c.slice(h)}}i.loose||(l?i.loose=!0:/\n *\n *$/.test(o)&&(l=!0));let u,p=null;this.options.gfm&&(p=/^\[[ xX]\] /.exec(a),p&&(u="[ ] "!==p[0],a=a.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:o,task:!!p,checked:u,loose:!1,text:a,tokens:[]}),i.raw+=o}i.items[i.items.length-1].raw=o.trimEnd(),i.items[i.items.length-1].text=a.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=D(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const e of s)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of n)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of i)r.rows.push(D(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:I(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=F(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),W(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return W(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let i,r,o=n,a=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=l.exec(t));){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(r=[...i].length,s[3]||s[4]){o+=r;continue}if((s[5]||s[6])&&n%3&&!((n+r)%3)){a+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o+a);const t=[...s[0]][0].length,l=e.slice(0,n+s.index+t+r);if(Math.min(n,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=I(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=I(t[1]),n="mailto:"+e):(e=I(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var t,n;let s;if(s=this.rules.inline.url.exec(e)){let e,i;if("@"===s[2])e=I(s[0]),i="mailto:"+e;else{let r;do{r=s[0],s[0]=null!=(n=null==(t=this.rules.inline._backpedal.exec(s[0]))?void 0:t[0])?n:""}while(r!==s[0]);e=I(s[0]),i="www."===s[1]?"http://"+s[0]:s[0]}return{type:"link",raw:s[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:I(t[0]),{type:"text",raw:t[0],text:e}}}}const z=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,H=/(?:[*+-]|\d{1,9}[.)])/,Q=q(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,H).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),V=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,G=/(?!\s*\])(?:\\.|[^\[\]\\])+/,K=q(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",G).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Z=q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,H).getRegex(),Y="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",X=/|$))/,J=q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",X).replace("tag",Y).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ee=q(V).replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex(),te={blockquote:q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ee).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:K,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:z,html:J,lheading:Q,list:Z,newline:/^(?: *(?:\n|$))+/,paragraph:ee,table:j,text:/^[^\n]+/},ne=q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex(),se=p(u({},te),{table:ne,paragraph:q(V).replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ne).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex()}),ie=p(u({},te),{html:q("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",X).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q(V).replace("hr",z).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Q).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),re=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,oe=/^( {2,}|\\)\n(?!\s*$)/,ae="\\p{P}\\p{S}",le=q(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ae).getRegex(),ce=q(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ae).getRegex(),he=q("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ae).getRegex(),de=q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ae).getRegex(),ue=q(/\\([punct])/,"gu").replace(/punct/g,ae).getRegex(),pe=q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ge=q(X).replace("(?:--\x3e|$)","--\x3e").getRegex(),me=q("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ge).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fe=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ke=q(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",fe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ye=q(/^!?\[(label)\]\[(ref)\]/).replace("label",fe).replace("ref",G).getRegex(),ve=q(/^!?\[(ref)\](?:\[\])?/).replace("ref",G).getRegex(),$e={_backpedal:j,anyPunctuation:ue,autolink:pe,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:oe,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:j,emStrongLDelim:ce,emStrongRDelimAst:he,emStrongRDelimUnd:de,escape:re,link:ke,nolink:ve,punctuation:le,reflink:ye,reflinkSearch:q("reflink|nolink(?!\\()","g").replace("reflink",ye).replace("nolink",ve).getRegex(),tag:me,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(i=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i)))s=t[t.length-1],r&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),r=i.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,i,r,o,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),o=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class Te{constructor(e){g(this,"options"),this.options=e||S}code(e,t,n){var s;const i=null==(s=(t||"").match(/^\S*/))?void 0:s[0];return e=e.replace(/\n$/,"")+"\n",i?'
'+(n?e:I(e,!0))+"
\n":"
"+(n?e:I(e,!0))+"
\n"}blockquote(e){return`
\n${e}
\n`}html(e,t){return e}heading(e,t,n){return`${e}\n`}hr(){return"
\n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e,t,n){return`
  • ${e}
  • \n`}checkbox(e){return"'}paragraph(e){return`

    ${e}

    \n`}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
    \n"}tablerow(e){return`\n${e}\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
    "}del(e){return`${e}`}link(e,t,n){const s=B(e);if(null===s)return n;let i='
    ",i}image(e,t,n){const s=B(e);if(null===s)return n;let i=`${n}"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")));continue}case"code":{const e=i;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=i;let t="",s="";for(let n=0;n0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(t.tokens,r),o+=this.renderer.listitem(a,i,!!s)}n+=this.renderer.list(o,t,s);continue}case"html":{const e=i;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=i;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=i,o=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1{const o=u({},r),a=u(u({},this.defaults),o);!0===this.defaults.async&&!1===o.async&&(a.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),a.async=!0);const l=f(this,s,i).call(this,!!a.silent,!!a.async);if(null==n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then((t=>e(t,a))).then((e=>a.hooks?a.hooks.processAllTokens(e):e)).then((e=>a.walkTokens?Promise.all(this.walkTokens(e,a.walkTokens)).then((()=>e)):e)).then((e=>t(e,a))).then((e=>a.hooks?a.hooks.postprocess(e):e)).catch(l);try{a.hooks&&(n=a.hooks.preprocess(n));let s=e(n,a);a.hooks&&(s=a.hooks.processAllTokens(s)),a.walkTokens&&this.walkTokens(s,a.walkTokens);let i=t(s,a);return a.hooks&&(i=a.hooks.postprocess(i)),i}catch(c){return l(c)}}},s=new WeakSet,i=function(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

    An error occurred:

    "+I(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}};const Pe=new class{constructor(...e){m(this,t),m(this,s),g(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),g(this,"options",this.setOptions),g(this,"parse",f(this,t,n).call(this,Se.lex,Le.parse)),g(this,"parseInline",f(this,t,n).call(this,Se.lexInline,Le.parseInline)),g(this,"Parser",Le),g(this,"Renderer",Te),g(this,"TextRenderer",Ae),g(this,"Lexer",Se),g(this,"Tokenizer",N),g(this,"Hooks",Re),this.use(...e)}walkTokens(e,t){var n,s;let i=[];for(const r of e)switch(i=i.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const n of e.header)i=i.concat(this.walkTokens(n.tokens,t));for(const n of e.rows)for(const e of n)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=r;(null==(s=null==(n=this.defaults.extensions)?void 0:n.childTokens)?void 0:s[e.type])?this.defaults.extensions.childTokens[e.type].forEach((n=>{const s=e[n].flat(1/0);i=i.concat(this.walkTokens(s,t))})):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n=u({},e);if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new Te(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if("options"===n)continue;const s=n,i=e.renderer[s],r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new N(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const s=n,i=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Re;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const s=n,i=e.hooks[s],r=t[s];Re.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>r.call(t,e)));const n=i.call(t,e);return r.call(t,n)}:t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults=u(u({},this.defaults),n)})),this}setOptions(e){return this.defaults=u(u({},this.defaults),e),this}lexer(e,t){return Se.lex(e,null!=t?t:this.defaults)}parser(e,t){return Le.parse(e,null!=t?t:this.defaults)}};function Me(e,t){return Pe.parse(e,t)}Me.options=Me.setOptions=function(e){return Pe.setOptions(e),Me.defaults=Pe.defaults,T(Me.defaults),Me},Me.getDefaults=E,Me.defaults=S,Me.use=function(...e){return Pe.use(...e),Me.defaults=Pe.defaults,T(Me.defaults),Me},Me.walkTokens=function(e,t){return Pe.walkTokens(e,t)},Me.parseInline=Pe.parseInline,Me.Parser=Le,Me.parser=Le.parse,Me.Renderer=Te,Me.TextRenderer=Ae,Me.Lexer=Se,Me.lexer=Se.lex,Me.Tokenizer=N,Me.Hooks=Re,Me.parse=Me,Me.options,Me.setOptions,Me.use,Me.walkTokens,Me.parseInline,Le.parse,Se.lex;var Oe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ie={"&":"&","<":"<",">":">",""":'"',"'":"'"},_e=/(&|<|>|"|')/g,Ue=/[&<>"']/g;function qe(e){return Oe[e]}function Be(e){return Ie[e]}function je(e){return null==e?"":String(e).replace(Ue,qe)}function De(e){return null==e?"":String(e).replace(_e,Be)}je.options=De.options={};var Fe={encode:je,escape:je,decode:De,unescape:De,version:"1.0.0-browser"};var We=function e(t){for(var n,s,i=Array.prototype.slice.call(arguments,1);i.length;)for(s in n=i.shift())n.hasOwnProperty(s)&&("[object Object]"===Object.prototype.toString.call(t[s])?t[s]=e(t[s],n[s]):t[s]=n[s]);return t},Ne=function(e){return"string"==typeof e?e.toLowerCase():e};function ze(e,t){return e[t]=!0,e}var He=function(e){return e.reduce(ze,{})},Qe={uris:He(["background","base","cite","href","longdesc","src","usemap"])},Ve={voids:He(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},Ge=Fe,Ke=Ne,Ze=Ve,Ye=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,Xe=/^<\s*\/\s*([\w:-]+)[^>]*>/,Je=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,et=/^=0&&(t.comment&&t.comment(e.substring(4,s)),e=e.substring(s+3),n=!1):tt.test(e)?o(Xe,l):et.test(e)&&o(Ye,a);var s;!function(){if(!n)return;var s,i=e.indexOf("<");i>=0?(s=e.substring(0,i),e=e.substring(i)):(s=e,e="");t.chars&&t.chars(s)}()}();var s=e===i;i=e,s&&(e="")}function o(t,s){var i=e.match(t);i&&(e=e.substring(i[0].length),i[0].replace(t,s),n=!1)}function a(e,n,i,r){var o={},a=Ke(n),l=Ze.voids[a]||!!r;i.replace(Je,(function(e,t,n,s,i){o[t]=void 0===n&&void 0===s&&void 0===i?void 0:Ge.decode(n||s||i||"")})),l||s.push(a),t.start&&t.start(a,o,l)}function l(e,n){var i,r=0,o=Ke(n);if(o)for(r=s.length-1;r>=0&&s[r]!==o;r--);if(r>=0){for(i=s.length-1;i>=r;i--)t.end&&t.end(s[i]);s.length=r}}l()},lt=function(e,t){var n,s=t||{};return a(),{start:function(e,t,o){var a=st(e);if(n.ignoring)return void r(a);if(-1===(s.allowedTags||[]).indexOf(a))return void r(a);if(s.filter&&!s.filter({tag:a,attrs:t}))return void r(a);i("<"),i(a),Object.keys(t).forEach((function(e){var n=t[e],r=(s.allowedClasses||{})[a]||[],o=(s.allowedAttributes||{})[a]||[],l=st(e);("class"===l&&-1===o.indexOf(l)?(n=n.split(" ").filter((function(e){return r&&-1!==r.indexOf(e)})).join(" ").trim()).length:-1!==o.indexOf(l)&&(!0!==it.uris[l]||function(e){var t=e[0];if("#"===t||"/"===t)return!0;var n=e.indexOf(":");if(-1===n)return!0;var i=e.indexOf("?");if(-1!==i&&n>i)return!0;var r=e.indexOf("#");return-1!==r&&n>r||s.allowedSchemes.some(o);function o(t){return 0===e.indexOf(t+":")}}(n)))&&(i(" "),i(e),"string"==typeof n&&(i('="'),i(nt.encode(n)),i('"')))})),i(o?"/>":">")},end:function(e){var t=st(e);-1!==(s.allowedTags||[]).indexOf(t)&&!1===n.ignoring?(i("")):o(t)},chars:function(e){!1===n.ignoring&&i(s.transformText?s.transformText(e):e)}};function i(t){e.push(t)}function r(e){rt.voids[e]||(!1===n.ignoring?n={ignoring:e,depth:1}:n.ignoring===e&&n.depth++)}function o(e){n.ignoring===e&&--n.depth<=0&&a()}function a(){n={ignoring:!1,depth:0}}},ct={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function ht(e,t,n){var s=[],i=!0===n?t:ot({},ct,t),r=lt(s,i);return at(e,r),s.join("")}ht.defaults=ct;const dt=b(ht),ut={allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:e=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([t,n])=>{e.tag===t&&e.attrs.class&&!n.test(e.attrs.class)&&delete e.attrs.class})),"span"===e.tag&&e.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(e.attrs.style)&&delete e.attrs.style,!0)};function pt(e){return dt(e,ut)}var gt={exports:{}};gt.exports=function(){function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e((function(e){var t=e.exports=function(){return new RegExp("(?:"+t.line().source+")|(?:"+t.block().source+")","gm")};t.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},t.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function s(e){return''+e+""}return function(e,i){void 0===i&&(i={});var r=i.colors;void 0===r&&(r=n);var o=0,a={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+t+"";return o=++o%r.length,l}))}}();const mt=b(gt.exports);function ft(e){return mt(e)}function kt(){const e=new Me.Renderer;return e.link=yt(e,e.link),e.code=vt(),e}const yt=(e,t)=>(n,s,i)=>{const r=null==n?void 0:n.startsWith(`${window.location.protocol}//${window.location.hostname}`);return t.call(e,n,s,i).replace(/^
    (e,t)=>{const n=t||"plaintext";let s=e;return window.hljs?n&&window.hljs.getLanguage(n)&&(s=window.hljs.highlight(n,e).value):s=ft(e),`
    \n${s.replace(/&/g,"&")}\n
    `};let $t,bt=[];const wt={gfm:!0,breaks:!0,async:!1};function xt(){return $t}function Ct(e){var t;let n=null==(t=xt())?void 0:t.parse(e);n||(n=function(e){return e.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((e,t)=>`
    ${ft(t)}
    `)).replace(/!\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`${t}`)).replace(/\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`
    ${t}`)).replace(/\n/g,"
    ")}(e));let s=pt(n);return bt.forEach((e=>{"function"==typeof e&&(s=e(s))})),s}function Et(...e){const t=e=>e&&"object"==typeof e&&e.constructor===Object;return e.reduce(((e,n)=>(Object.keys(null!=n?n:{}).forEach((s=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=e[s],r=n[s];Array.isArray(i)&&Array.isArray(r)?e[s]=i.concat(...r):t(i)&&t(r)?e[s]=Et(i,r):e[s]=r})),e)),{})}class St{constructor(e){g(this,"loading",!1),g(this,"listLastFetch"),g(this,"comments",[]),g(this,"notifies",[]),g(this,"page"),this.events=e}getLoading(){return this.loading}setLoading(e){this.loading=e}getListLastFetch(){return this.listLastFetch}setListLastFetch(e){this.listLastFetch=e}getComments(){return this.comments}fetchComments(e){this.events.trigger("list-fetch",e)}findComment(e){return this.comments.find((t=>t.id===e))}clearComments(){this.comments=[],this.events.trigger("list-loaded",this.comments)}loadComments(e){this.events.trigger("list-load",e),this.comments.push(...e),this.events.trigger("list-loaded",this.comments)}insertComment(e){this.comments.push(e),this.events.trigger("comment-inserted",e),this.events.trigger("list-loaded",this.comments)}updateComment(e){this.comments=this.comments.map((t=>t.id===e.id?e:t)),this.events.trigger("comment-updated",e),this.events.trigger("list-loaded",this.comments)}deleteComment(e){const t=this.comments.find((t=>t.id===e));if(!t)throw new Error(`Comment ${e} not found`);this.comments=this.comments.filter((t=>t.id!==e)),this.events.trigger("comment-deleted",t),this.events.trigger("list-loaded",this.comments)}getNotifies(){return this.notifies}updateNotifies(e){this.notifies=e,this.events.trigger("notifies-updated",this.notifies)}getPage(){return this.page}updatePage(e){this.page=e,this.events.trigger("page-loaded",e)}}const Tt={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",uploadImage:"Upload Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",emailVerified:"Email has been verified",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly",updateMsg:"Please update Artalk {name} to get the full experience",currentVersion:"Current Version",ignore:"Ignore",open:"Open",openName:"Open {name}"},At="ArtalkI18n";function Lt(e=""){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild||t}function Rt(e){const t=document.createElement("div");t.innerText=e;return t.innerHTML}function Pt(e){const t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function Mt(e,t){const n=e=>{const t=e.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,s=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+s,left:t.left+n}},s=n(e);if(!t)return s;const i=n(t);return{top:s.top-i.top,left:s.left-i.left}}function Ot(e,t){let n=e.toString();for(;n.lengthe)){try{const n=e.getTime(),s=(new Date).getTime()-n,i=Math.floor(s/864e5);if(0===i){const e=s%864e5,n=Math.floor(e/36e5);if(0===n){const n=e%36e5,s=Math.floor(n/6e4);if(0===s){const e=n%6e4,s=Math.round(e/1e3);return s<10?t("now"):`${s} ${t("seconds")}`}return`${s} ${t("minutes")}`}return`${n} ${t("hours")}`}return i<0?t("now"):i<8?`${i} ${t("days")}`:function(e){const t=Ot(e.getDate(),2),n=Ot(e.getMonth()+1,2);return`${Ot(e.getFullYear(),2)}-${n}-${t}`}(e)}catch(n){return console.error(n)," - "}}function _t(){return k(this,null,(function*(){const e=navigator.userAgent;if(!navigator.userAgentData||!navigator.userAgentData.getHighEntropyValues)return e;const t=navigator.userAgentData;let n=null;try{n=yield t.getHighEntropyValues(["platformVersion"])}catch(i){return console.error(i),e}const s=Number(n.platformVersion.split(".")[0]);return"Windows"===t.platform&&s>=13?e.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===t.platform&&s>=11?e.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):e}))}function Ut(e){let t;try{t=new URL(e)}catch(n){return!1}return"http:"===t.protocol||"https:"===t.protocol}function qt(e){return t=e.base,n=e.path,`${t.replace(/\/$/,"")}/${n.replace(/^\//,"")}`;var t,n}const Bt={en:Tt,"en-US":Tt,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送",save:"保存",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",uploadImage:"上传图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",emailVerified:"邮箱已验证",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止",updateMsg:"请更新 Artalk {name} 以获得完整体验",currentVersion:"当前版本",ignore:"忽略",open:"打开",openName:"打开{name}"}};function jt(e){return e=e.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((e,t,n)=>t.toLowerCase()+(n||"").toUpperCase())),Bt[e]?Bt[e]:window[At]&&window[At][e]?window[At][e]:Bt.en}let Dt="en",Ft=jt(Dt);function Wt(e){e!==Dt&&(Dt=e,Ft="string"==typeof e?jt(e):e)}function Nt(e,t={}){let n=(null==Ft?void 0:Ft[e])||e;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((e,n)=>t[n]||"")),Rt(n)}class zt{constructor(){g(this,"events",[])}on(e,t,n={}){this.events.push(u({name:e,handler:t},n))}off(e,t){t&&(this.events=this.events.filter((n=>!(n.name===e&&n.handler===t))))}trigger(e,t){this.events.slice(0).filter((t=>t.name===e&&"function"==typeof t.handler)).forEach((n=>{n.once&&this.off(e,n.handler),n.handler(t)}))}}const Ht={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"en"};function Qt(e,t=!1){const n=t?Et(Ht,e):e;if(n.el&&"string"==typeof n.el)try{const e=document.querySelector(n.el);if(!e)throw Error(`Target element "${n.el}" was not found.`);n.el=e}catch(s){throw console.error(s),new Error("Please check your Artalk `el` config.")}return""===n.pageKey&&(n.pageKey=`${window.location.pathname}`),""===n.pageTitle&&(n.pageTitle=`${document.title}`),n.server&&(n.server=n.server.replace(/\/$/,"").replace(/\/api\/?$/,"")),"auto"===n.locale&&(n.locale=navigator.language),"auto"===n.flatMode&&(n.flatMode=window.matchMedia("(max-width: 768px)").matches),"number"==typeof n.nestMax&&Number(n.nestMax)<=1&&(n.flatMode=!0),n}function Vt(e,t){return{baseURL:`${e.server}/api/v2`,siteName:e.site||"",pageKey:e.pageKey||"",pageTitle:e.pageTitle||"",timeout:e.reqTimeout,getApiToken:()=>null==t?void 0:t.get("user").getData().token,userInfo:(null==t?void 0:t.get("user").checkHasBasicUserInfo())?{name:null==t?void 0:t.get("user").getData().nick,email:null==t?void 0:t.get("user").getData().email}:void 0,handlers:null==t?void 0:t.getApiHandlers()}}function Gt(e,t,n){let s=null;const i=()=>{const i=(()=>{const n=e.getConf(),s={};return t.forEach((e=>{s[e]=n[e]})),s})();var r,o;(null==s||(r=s,o=i,!(JSON.stringify(r)===JSON.stringify(o))))&&(s=i,n(i))};e.on("mounted",i),e.on("updated",i)}class Kt{constructor(e){g(this,"conf"),g(this,"data"),g(this,"$root"),g(this,"events",new zt),g(this,"mounted",!1),g(this,"apiHandlers",null),g(this,"getCommentList",this.getCommentNodes),g(this,"getCommentDataList",this.getComments),this.conf=e,this.$root=e.el,this.$root.classList.add("artalk"),this.$root.innerHTML="",this.data=new St(this.events),this.on("mounted",(()=>{this.mounted=!0}))}inject(e,t){this[e]=t}get(e){return this[e]}getApi(){return new C(Vt(this.conf,this))}getApiHandlers(){return this.apiHandlers||(this.apiHandlers=function(e){const t=function(){const e=[];return{add:(t,n)=>{e.push({action:t,handler:n})},get:()=>e}}();return t.add("need_captcha",(t=>e.checkCaptcha(t))),t.add("need_login",(()=>e.checkAdmin({}))),t}(this)),this.apiHandlers}getData(){return this.data}replyComment(e,t){this.editor.setReply(e,t)}editComment(e,t){this.editor.setEditComment(e,t)}fetch(e){this.data.fetchComments(e)}reload(){this.data.fetchComments({offset:0})}listGotoFirst(){this.events.trigger("list-goto-first")}getCommentNodes(){return this.list.getCommentNodes()}getComments(){return this.data.getComments()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(e,t){this.editor.showNotify(e,t)}editorResetState(){this.editor.resetState()}showSidebar(e){this.sidebarLayer.show(e)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(e){return this.checkerLauncher.checkAdmin(e)}checkCaptcha(e){return this.checkerLauncher.checkCaptcha(e)}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}trigger(e,t){this.events.trigger(e,t)}$t(e,t={}){return Nt(e,t)}setDarkMode(e){this.updateConf({darkMode:e})}updateConf(e){this.conf=Et(this.conf,Qt(e,!1)),this.mounted&&this.events.trigger("updated",this.conf)}getConf(){return this.conf}getEl(){return this.$root}getMarked(){return xt()}watchConf(e,t){Gt(this,e,t)}}class Zt{constructor(e){g(this,"$el"),g(this,"$content"),g(this,"$actions"),this.$el=Lt('
    \n
    \n
    \n
    \n
    \n
    '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(e)}setYes(e){const t=Lt(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}setNo(e){const t=Lt(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}onBtnClick(e){return t=>{const n=e(t.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function Yt(e,t){let n=e.querySelector(":scope > .atk-loading");n||(n=Lt(''),(null==t?void 0:t.transparentBg)&&(n.style.background="transparent"),e.appendChild(n)),n.style.display="";const s=n.querySelector(".atk-loading-spinner");s&&(s.style.display="none",window.setTimeout((()=>{s.isConnected&&(s.style.display="")}),500))}function Xt(e){const t=e.querySelector(":scope > .atk-loading");t&&(t.style.display="none")}function Jt(e,t){e?Yt(t):Xt(t)}function en(e,t=!0,n){let s;if(n){const t=n.getBoundingClientRect();s=e.getBoundingClientRect().top-t.top+n.scrollTop-n.clientHeight/2+e.clientHeight/2}else{const t=e.getBoundingClientRect();s=t.top+window.scrollY-(window.innerHeight/2-t.height/2)}const i={top:s,left:0,behavior:"instant"};n?n.scroll(i):window.scroll(i)}function tn(e,t){!function(e,t,n="in"){e.classList.add(`atk-fade-${n}`);const s=()=>{e.classList.remove(`atk-fade-${n}`),e.removeEventListener("animationend",s),t&&t()};e.addEventListener("animationend",s)}(e,t,"in")}function nn(e,t,n='Artalk Error'){let s=e.querySelector(".atk-error-layer");if(null===t)return void(null!==s&&s.remove());s||(s=Lt(`
    ${n}
    `),e.appendChild(s));const i=s.querySelector(".atk-error-text");i.innerHTML="",null!==t&&(t instanceof HTMLElement?i.appendChild(t):i.innerText=t)}function sn(e){const t=Lt('
    '),n=Lt('');n.style.display="none",Yt(t,{transparentBg:!0}),n.src=e.getOpts().getCaptchaIframeURL(),n.onload=()=>{n.style.display="",Xt(t)},t.append(n);const s=Lt('
    ');t.append(s),e.hideInteractInput();let i=!1;return function t(){return k(this,null,(function*(){var n;if(yield(n=1e3,new Promise((e=>{window.setTimeout((()=>{e(null)}),n)}))),i)return;let s=!1;try{s=(yield e.getApi().captcha.getCaptchaStatus()).data.is_pass}catch(r){s=!1}s?e.triggerSuccess():t()}))}(),s.onclick=()=>{i=!0,e.cancel()},t}const rn={request:(e,t)=>e.getApi().captcha.verifyCaptcha({value:t}),body:e=>e.get("iframe")?sn(e):function(e){const t=Lt(`${Nt("captchaCheck")}`);return t.querySelector(".atk-captcha-img").onclick=()=>{const n=t.querySelector(".atk-captcha-img");e.getApi().captcha.getCaptcha().then((e=>{n.setAttribute("src",e.data.img_data)})).catch((e=>{console.error("Failed to get captcha image ",e)}))},t}(e),onSuccess(e,t,n,s){e.set("val",n)},onError(e,t,n,s){s.querySelector(".atk-captcha-img").click(),s.querySelector('input[type="text"]').value=""}},on={inputType:"password",request(e,t){return k(this,null,(function*(){return(yield e.getApi().user.login({name:e.getUser().getData().nick,email:e.getUser().getData().email,password:t})).data}))},body:e=>Lt(`${Nt("adminCheck")}`),onSuccess(e,t,n,s){e.getUser().update({isAdmin:!0,token:t.token}),e.getOpts().onReload()},onError(e,t,n,s){}};function an(e){return t=>new Promise(((n,s)=>{const i=t.onCancel;t.onCancel=()=>{i&&i(),s(new Error("user canceled the checker"))};const r=t.onSuccess;t.onSuccess=()=>{r&&r(),n()},e(t)}))}class ln{constructor(e){g(this,"checkCaptcha",an((e=>{this.fire(rn,e,(t=>{t.set("img_data",e.img_data),t.set("iframe",e.iframe)}))}))),g(this,"checkAdmin",an((e=>{this.fire(on,e)}))),this.opts=e}fire(e,t,n){const s=this.opts.getCtx().get("layerManager").create(`checker-${(new Date).getTime()}`);s.show();const i=()=>{s.destroy()},r={};let o=!1;const a={set:(e,t)=>{r[e]=t},get:e=>r[e],getOpts:()=>this.opts,getUser:()=>this.opts.getCtx().get("user"),getApi:()=>this.opts.getApi(),hideInteractInput:()=>{o=!0},triggerSuccess:()=>{i(),e.onSuccess&&e.onSuccess(a,"","",l),t.onSuccess&&t.onSuccess()},cancel:()=>{i(),t.onCancel&&t.onCancel()}};n&&n(a);const l=Lt();l.appendChild(e.body(a));const c=Lt(``);let h;l.appendChild(c),setTimeout((()=>c.focus()),80),c.onkeyup=e=>{"Enter"!==e.key&&13!==e.keyCode||(e.preventDefault(),s.getEl().querySelector('button[data-action="confirm"]').click())};const d=new Zt(l);d.setYes((n=>{const s=c.value.trim();h||(h=n.innerText);const r=()=>{n.innerText=h||"",n.classList.remove("error")};return n.innerText=`${Nt("loading")}...`,e.request(a,s).then((n=>{i(),e.onSuccess&&e.onSuccess(a,n,s,l),t.onSuccess&&t.onSuccess()})).catch((t=>{var i;i=String(t.message||String(t)),n.innerText=i,n.classList.add("error"),e.onError&&e.onError(a,t,s,l);const o=setTimeout((()=>r()),3e3);c.onfocus=()=>{r(),clearTimeout(o)}})),!1})),d.setNo((()=>(i(),t.onCancel&&t.onCancel(),!1))),o&&(c.style.display="none",d.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),s.getEl().append(d.$el),t.onMount&&t.onMount(d.$el)}}class cn{constructor(e){g(this,"$el"),this.ctx=e}get conf(){return this.ctx.conf}getEl(){return this.$el}}const hn={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$bottomLeft:".atk-bottom-left",$stateWrap:".atk-state-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class dn{constructor(e){this.kit=e}useBtn(e="
    "){return this.$btn=Lt(`${e}`),this.$btn}usePanel(e="
    "){return this.$panel=Lt(e),this.$panel}useContentTransformer(e){this.contentTransformer=e}usePanelShow(e){this.kit.useEvents().on("panel-show",(t=>{t===this&&e()}))}usePanelHide(e){this.kit.useEvents().on("panel-hide",(t=>{t===this&&e()}))}useEditorStateEffect(e,t){this.editorStateEffectWhen=e,this.editorStateEffect=t}}class un extends dn{constructor(){super(...arguments),g(this,"isMoved",!1)}move(e){if(this.isMoved)return;this.isMoved=!0;const t=this.kit.useUI().$el;t.after(Lt('
    '));const n=Lt("
    ");e.after(n),n.replaceWith(t),t.classList.add("atk-fade-in"),t.classList.add("editor-traveling")}back(){var e;this.isMoved&&(this.isMoved=!1,null==(e=this.kit.useGlobalCtx().$root.querySelector(".atk-editor-travel-placeholder"))||e.replaceWith(this.kit.useUI().$el),this.kit.useUI().$el.classList.remove("editor-traveling"))}}class pn{constructor(e){g(this,"stateCurt","normal"),g(this,"stateUnmountFn",null),this.editor=e}get(){return this.stateCurt}switch(e,t){var n,s,i,r,o;if(this.stateUnmountFn&&(this.stateUnmountFn(),this.stateUnmountFn=null,null==(s=null==(n=this.editor.getPlugs())?void 0:n.get(un))||s.back()),"normal"!==e&&t){let n=t.$comment;this.editor.conf.flatMode||(n=n.querySelector(".atk-footer")),null==(r=null==(i=this.editor.getPlugs())?void 0:i.get(un))||r.move(n);const s=this.editor.ctx.conf.scrollRelativeTo&&this.editor.ctx.conf.scrollRelativeTo();en(this.editor.getUI().$el,!0,s);const a=null==(o=this.editor.getPlugs())?void 0:o.getPlugs().find((t=>t.editorStateEffectWhen===e));a&&a.editorStateEffect&&(this.stateUnmountFn=a.editorStateEffect(t.comment))}this.stateCurt=e}}class gn extends cn{constructor(e){super(e),g(this,"ui"),g(this,"state"),this.ui=function(){const e=Lt('
    \n
    \n \n \n \n
    \n
    \n \n
    \n \n
    \n
    \n \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n'),t={$el:e};return Object.entries(hn).forEach((([n,s])=>{t[n]=e.querySelector(s)})),t}(),this.$el=this.ui.$el,this.state=new pn(this)}getUI(){return this.ui}getPlugs(){return this.ctx.get("editorPlugs")}getState(){return this.state.get()}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}getContentFinal(){let e=this.getContentRaw();const t=this.getPlugs();return t&&(e=t.getTransformedContent(e)),e}getContentRaw(){return this.ui.$textarea.value||""}getContentMarked(){return Ct(this.getContentFinal())}setContent(e){var t;this.ui.$textarea.value=e,null==(t=this.getPlugs())||t.getEvents().trigger("content-updated",e)}insertContent(e){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=e,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const t=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,s=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,t)+e+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=t+e.length,this.ui.$textarea.selectionEnd=t+e.length,this.ui.$textarea.scrollTop=s}else this.ui.$textarea.focus(),this.ui.$textarea.value+=e}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.resetState()}resetState(){this.state.switch("normal")}setReply(e,t){this.state.switch("reply",{comment:e,$comment:t})}setEditComment(e,t){this.state.switch("edit",{comment:e,$comment:t})}showNotify(e,t){!function(e,t,n){const s=Lt(`
    `);s.querySelector(".atk-notify-content").innerHTML=Rt(t).replace("\n","
    "),e.appendChild(s);const i=()=>{s.classList.add("atk-fade-out"),setTimeout((()=>{s.remove()}),200)};let r;r=window.setTimeout((()=>{i()}),3e3),s.addEventListener("click",(()=>{i(),window.clearTimeout(r)}))}(this.ui.$notifyWrap,e,t)}showLoading(){Yt(this.ui.$el)}hideLoading(){Xt(this.ui.$el)}submit(){const e=()=>this.ctx.trigger("editor-submit");this.ctx.conf.beforeSubmit?this.ctx.conf.beforeSubmit(this,e):e()}}class mn extends cn{constructor(e){super(e),g(this,"layer"),g(this,"$header"),g(this,"$closeBtn"),g(this,"$iframeWrap"),g(this,"$iframe"),g(this,"refreshOnShow",!0),g(this,"animTimer"),this.$el=Lt('
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.refreshOnShow=!0}))}show(){return k(this,arguments,(function*(e={}){if(this.$el.style.transform="",this.initLayer(),this.layer.show(),this.refreshOnShow)this.refreshOnShow=!1,this.$iframeWrap.innerHTML="",this.$iframe=this.createIframe(e.view),this.$iframeWrap.append(this.$iframe);else{const e=this.$iframe,t=e.src;this.conf.darkMode!==t.includes("darkMode=1")&&this.iframeLoad(e,this.conf.darkMode?t.concat("&darkMode=1"):t.replace("&darkMode=1",""))}this.authCheck({onSuccess:()=>this.show(e)}),this.animTimer=setTimeout((()=>{this.animTimer=void 0,this.$el.style.transform="translate(0, 0)",setTimeout((()=>{this.ctx.getData().updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}),100)}))}hide(){var e;null==(e=this.layer)||e.hide()}authCheck(e){return k(this,null,(function*(){const t=(yield this.ctx.getApi().user.getUserStatus(u({},this.ctx.getApi().getUserFields()))).data;t.is_admin&&!t.is_login&&(this.refreshOnShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{e.onSuccess()}),500)},onCancel:()=>{this.hide()}}),this.hide())}))}initLayer(){this.layer||(this.layer=this.ctx.get("layerManager").create("sidebar",this.$el),this.layer.setOnAfterHide((()=>{this.ctx.editorResetState(),this.animTimer&&clearTimeout(this.animTimer),this.$el.style.transform="",this.ctx.trigger("sidebar-hide")})))}createIframe(e){const t=Lt(''),n=qt({base:this.ctx.conf.server,path:"/sidebar/"}),s={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(this.ctx.get("user").getData()),time:+new Date};e&&(s.view=e),this.conf.darkMode&&(s.darkMode="1");const i=new URLSearchParams(s);return this.iframeLoad(t,`${n}?${i.toString()}`),t}iframeLoad(e,t){e.src=t,Yt(this.$iframeWrap),e.onload=()=>{Xt(this.$iframeWrap)}}}const fn=e=>({import:t=>{(function(e,t="DATE_DESC",n=2){const s=[];e.filter((e=>0===e.rid)).forEach((t=>{const i={id:t.id,comment:t,children:[],level:1};i.parent=i,s.push(i),function t(s){const i=e.filter((e=>e.rid===s.id));0!==i.length&&(s.level>=n&&(s=s.parent),i.forEach((e=>{const n={id:e.id,comment:e,children:[],parent:s,level:s.level+1};s.children.push(n),t(n)})))}(i)}));const i=(n,s)=>{let i=n.id-s.id;return"DATE_ASC"===t?i=+new Date(n.comment.date)-+new Date(s.comment.date):"DATE_DESC"===t?i=+new Date(s.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===t?i=e.indexOf(n.comment)-e.indexOf(s.comment):"VOTE_UP_DESC"===t&&(i=s.comment.vote_up-n.comment.vote_up),i};return function e(t){t.forEach((t=>{t.children=t.children.sort(i),e(t.children)}))}(s),s})(t,e.nestSortBy,e.nestMax).forEach((t=>{var n;const s=e.createCommentNode(t.comment);null==(n=e.$commentsWrap)||n.appendChild(s.getEl()),s.getRender().playFadeAnim();const i=(t,n)=>{n.children.forEach((n=>{const s=n.comment,r=e.createCommentNode(s,t.getData());t.putChild(r),i(r,n)}))};i(s,t),s.getRender().checkHeightLimit()}))},insert:(t,n)=>{var s;const i=e.createCommentNode(t,n);if(0===t.rid)null==(s=e.$commentsWrap)||s.prepend(i.getEl());else{const n=e.findCommentNode(t.rid);n&&(n.putChild(i,"DATE_ASC"===e.nestSortBy?"append":"prepend"),i.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()})))}i.getRender().checkHeightLimit(),i.scrollIntoView(),i.getRender().playFadeAnim()}});function kn(e,t,n,s){n.is_collapsed&&(n.is_allow_reply=!1);const i=e.createCommentNode(n,s);if(n.visible){const n=i.getEl(),s=e.$commentsWrap;"append"===t&&(null==s||s.append(n)),"prepend"===t&&(null==s||s.prepend(n)),i.getRender().playFadeAnim()}return i.getRender().checkHeightLimit(),i}class yn{constructor(e){this.options=e}getStrategy(){return this.options.flatMode?(e=this.options,{import:t=>{t.forEach((n=>{const s=0===n.rid?void 0:t.find((e=>e.id===n.rid));kn(e,"append",n,s)}))},insert:(t,n)=>{kn(e,"prepend",t,n).scrollIntoView()}}):fn(this.options);var e}import(e){this.getStrategy().import(e)}insert(e,t){this.getStrategy().insert(e,t)}}function vn(e,t){t.forEach((({el:t,max:n,imgContains:s})=>{const i=()=>{t&&(e.scrollable?function(e){if(!e.el)return;if(e.el.classList.contains(wn))return;e.el.classList.add(wn),e.el.style.height=`${e.maxHeight}px`}({el:t,maxHeight:n}):function(e){if(!e.el)return;if(!e.maxHeight)return;if(e.el.classList.contains($n))return;e.el.classList.add($n),e.el.style.height=`${e.maxHeight}px`,e.el.style.overflow="hidden";const t=Lt(`
    ${Nt("readMore")}`);t.onclick=t=>{t.stopPropagation(),bn(e.el),e.postBtnClick&&e.postBtnClick(t)},e.el.append(t)}({el:t,maxHeight:n,postBtnClick:e.postExpandBtnClick}))},r=()=>{t&&function(e){return parseFloat(getComputedStyle(e,null).height.replace("px",""))}(t)>n&&i()};r(),s&&t&&function(e,t){if(!e)return;const n=e.getElementsByTagName("img");if(!n.length)return;let s=n.length;for(let i=0;i{s--,0===s&&t()})),0===s&&t()}(t,(()=>r()))}))}const $n="atk-height-limit";function bn(e){e&&e.classList.contains($n)&&(e.classList.remove($n),Array.from(e.children).forEach((e=>{e.classList.contains("atk-height-limit-btn")&&e.remove()})),e.style.height="",e.style.overflow="")}const wn="atk-height-limit-scroll";function xn(e){if(e.$headerNick=e.$el.querySelector(".atk-nick"),e.data.link){const t=Lt('');t.innerText=e.data.nick,t.href=Ut(e.data.link)?e.data.link:`https://${e.data.link}`,e.$headerNick.append(t)}else e.$headerNick.innerText=e.data.nick}function Cn(e){e.$headerBadgeWrap=e.$el.querySelector(".atk-badge-wrap"),e.$headerBadgeWrap.innerHTML="";const t=e.data.badge_name,n=e.data.badge_color;if(t){const s=Lt('');s.innerText=t.replace("管理员",Nt("admin")),s.style.backgroundColor=n||"",e.$headerBadgeWrap.append(s)}else if(e.data.is_verified){const t=Lt(``);e.$headerBadgeWrap.append(t)}if(e.data.is_pinned){const t=Lt(`${Nt("pin")}`);e.$headerBadgeWrap.append(t)}}function En(e){const t=e.$el.querySelector(".atk-date");t.innerText=e.comment.getDateFormatted(),t.setAttribute("data-atk-comment-date",String(+new Date(e.data.date)))}function Sn(e){if(!e.opts.uaBadge&&!e.data.ip_region)return;let t=e.$header.querySelector("atk-ua-wrap");if(t||(t=Lt(''),e.$header.append(t)),t.innerHTML="",e.data.ip_region){const n=Lt('');n.innerText=e.data.ip_region,t.append(n)}if(e.opts.uaBadge){const{browser:n,os:s}=e.comment.getUserUA();if(String(n).trim()){const e=Lt('');e.innerText=n,t.append(e)}if(String(s).trim()){const e=Lt('');e.innerText=s,t.append(e)}}}class Tn{constructor(e){g(this,"opts"),g(this,"$el"),g(this,"isLoading",!1),g(this,"msgRecTimer"),g(this,"msgRecTimerFunc"),g(this,"isConfirming",!1),g(this,"confirmRecTimer"),this.$el=Lt(''),this.opts="object"!=typeof e?{text:e}:e,this.$el.innerText=this.getText(),this.opts.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(e){return e.append(this.$el),this}getText(){return"string"==typeof this.opts.text?this.opts.text:this.opts.text()}setClick(e){this.$el.onclick=t=>{if(t.stopPropagation(),!this.isLoading){if(this.opts.confirm&&!this.isMessaging){const e=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.opts.confirmText||Nt("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>e()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),e()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();e()}}}updateText(e){e&&(this.opts.text=e),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(e,t){this.isLoading!==e&&(this.isLoading=e,e?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=t||`${Nt("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(e){this.setMsg(e,"atk-btn-error")}setWarn(e){this.setMsg(e,"atk-btn-warn")}setSuccess(e){this.setMsg(e,"atk-btn-success")}setMsg(e,t,n,s){this.setLoading(!1),t&&this.$el.classList.add(t),this.$el.innerText=e,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),t&&this.$el.classList.remove(t),s&&s()}),n||2500)}setMsgRecTimer(e,t){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=e,this.msgRecTimer=window.setTimeout((()=>{e(),this.clearMsgRecTimer()}),t)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function An(e){e.opts.vote&&(e.voteBtnUp=new Tn((()=>`${Nt("voteUp")} (${e.data.vote_up||0})`)).appendTo(e.$actions),e.voteBtnUp.setClick((()=>{e.comment.getActions().vote("up")})),e.opts.voteDown&&(e.voteBtnDown=new Tn((()=>`${Nt("voteDown")} (${e.data.vote_down||0})`)).appendTo(e.$actions),e.voteBtnDown.setClick((()=>{e.comment.getActions().vote("down")}))))}function Ln(e){if(!e.data.is_allow_reply)return;const t=Lt(`${Nt("reply")}`);e.$actions.append(t),t.addEventListener("click",(t=>{t.stopPropagation(),e.opts.replyComment(e.data,e.$el)}))}function Rn(e){const t=new Tn({text:()=>e.data.is_collapsed?Nt("expand"):Nt("collapse"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("collapsed",t)}))}function Pn(e){const t=new Tn({text:()=>e.data.is_pending?Nt("pending"):Nt("approved"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pending",t)}))}function Mn(e){const t=new Tn({text:()=>e.data.is_pinned?Nt("unpin"):Nt("pin"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pinned",t)}))}function On(e){const t=new Tn({text:Nt("edit"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.opts.editComment(e.data,e.$el)}))}function In(e){const t=new Tn({text:Nt("delete"),confirm:!0,confirmText:Nt("deleteConfirm"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminDelete(t)}))}const _n={Avatar:function(e){const t=e.$el.querySelector(".atk-avatar"),n=Lt(""),s=e.opts.avatarURLBuilder;if(n.src=s?s(e.data):e.comment.getGravatarURL(),e.data.link){const s=Lt('');s.href=Ut(e.data.link)?e.data.link:`https://${e.data.link}`,s.append(n),t.append(s)}else t.append(n)},Header:function(e){Object.entries({renderNick:xn,renderVerifyBadge:Cn,renderDate:En,renderUABadge:Sn}).forEach((([t,n])=>{n(e)}))},Content:function(e){if(!e.data.is_collapsed)return e.$content.innerHTML=e.comment.getContentMarked(),void e.$content.classList.remove("atk-hide","atk-collapsed");e.$content.classList.add("atk-hide","atk-type-collapsed");const t=Lt(`\n
    \n ${Nt("collapsedMsg")}\n ${Nt("expand")}\n
    `);e.$body.insertAdjacentElement("beforeend",t);const n=t.querySelector(".atk-show-btn");n.addEventListener("click",(t=>{t.stopPropagation(),e.$content.classList.contains("atk-hide")?(e.$content.innerHTML=e.comment.getContentMarked(),e.$content.classList.remove("atk-hide"),tn(e.$content),n.innerText=Nt("collapse")):(e.$content.innerHTML="",e.$content.classList.add("atk-hide"),n.innerText=Nt("expand"))}))},ReplyAt:function(e){e.opts.flatMode||0===e.data.rid||e.opts.replyTo&&(e.$replyAt=Lt(''),e.$replyAt.querySelector(".atk-nick").innerText=`${e.opts.replyTo.nick}`,e.$replyAt.onclick=()=>{e.comment.getActions().goToReplyComment()},e.$headerBadgeWrap.insertAdjacentElement("afterend",e.$replyAt))},ReplyTo:function(e){if(!e.opts.flatMode)return;if(!e.opts.replyTo)return;e.$replyTo=Lt(`\n
    \n
    ${Nt("reply")} :
    \n
    \n
    `);const t=e.$replyTo.querySelector(".atk-nick");t.innerText=`@${e.opts.replyTo.nick}`,t.onclick=()=>{e.comment.getActions().goToReplyComment()};let n=Ct(e.opts.replyTo.content);e.opts.replyTo.is_collapsed&&(n=`[${Nt("collapsed")}]`),e.$replyTo.querySelector(".atk-content").innerHTML=n,e.$body.prepend(e.$replyTo)},Pending:function(e){if(!e.data.is_pending)return;const t=Lt(`
    ${Nt("pendingMsg")}
    `);e.$body.prepend(t)},Actions:function(e){Object.entries({renderVote:An,renderReply:Ln,renderCollapse:Rn,renderModerator:Pn,renderPin:Mn,renderEdit:On,renderDel:In}).forEach((([t,n])=>{n(e)}))}};class Un{constructor(e){g(this,"comment"),g(this,"$el"),g(this,"$main"),g(this,"$header"),g(this,"$headerNick"),g(this,"$headerBadgeWrap"),g(this,"$body"),g(this,"$content"),g(this,"$childrenWrap"),g(this,"$actions"),g(this,"voteBtnUp"),g(this,"voteBtnDown"),g(this,"$replyTo"),g(this,"$replyAt"),this.comment=e}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}render(){var e;return this.$el=Lt('
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),e=this,Object.entries(_n).forEach((([t,n])=>{n(e)})),this.$childrenWrap&&this.$main.append(this.$childrenWrap),this.$el}checkHeightLimit(){const e=this.opts.heightLimit;if(!e||!e.content||!e.children)return;const t=e.content,n=e.children;vn({postExpandBtnClick:()=>{const e=this.comment.getChildren();1===e.length&&bn(e[0].getRender().$content)},scrollable:e.scrollable},[{el:this.$content,max:t,imgContains:!0},{el:this.$replyTo,max:t,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&bn(this.$childrenWrap)}playFadeAnim(){tn(this.comment.getRender().$el)}playFadeAnimForBody(){tn(this.comment.getRender().$body)}playFlashAnim(){this.$el.classList.remove("atk-flash-once"),window.setTimeout((()=>{this.$el.classList.add("atk-flash-once")}),150)}getChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=Lt('
    '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}setUnread(e){e?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(e){e?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(e){this.setOpenable(!0),this.$el.onclick=t=>{t.stopPropagation(),window.open(e)}}setOpenAction(e){this.setOpenable(!0),this.$el.onclick=t=>{t.stopPropagation(),e()}}}class qn{constructor(e){g(this,"comment"),this.comment=e}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}getApi(){return this.comment.getOpts().getApi()}vote(e){const t="up"===e?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.getApi().votes.vote(`comment_${e}`,this.data.id,u({},this.getApi().getUserFields())).then((e=>{var t,n;this.data.vote_up=e.data.up,this.data.vote_down=e.data.down,null==(t=this.comment.getRender().voteBtnUp)||t.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((e=>{null==t||t.setError(Nt("voteFail")),console.log(e)}))}adminEdit(e,t){if(t.isLoading)return;t.setLoading(!0,`${Nt("editing")}...`);const n=u({},this.data);"collapsed"===e?n.is_collapsed=!n.is_collapsed:"pending"===e?n.is_pending=!n.is_pending:"pinned"===e&&(n.is_pinned=!n.is_pinned),this.getApi().comments.updateComment(this.data.id,u({},n)).then((e=>{t.setLoading(!1),this.comment.setData(e.data)})).catch((e=>{console.error(e),t.setError(Nt("editFail"))}))}adminDelete(e){e.isLoading||(e.setLoading(!0,`${Nt("deleting")}...`),this.getApi().comments.deleteComment(this.data.id).then((()=>{e.setLoading(!1),this.opts.onDelete&&this.opts.onDelete(this.comment)})).catch((t=>{console.error(t),e.setError(Nt("deleteFail"))})))}goToReplyComment(){const e=window.location.hash,t=`#atk-comment-${this.data.rid}`;window.location.hash=t,t===e&&window.dispatchEvent(new Event("hashchange"))}}class Bn{constructor(e,t){g(this,"$el"),g(this,"renderInstance"),g(this,"actionInstance"),g(this,"data"),g(this,"opts"),g(this,"parent"),g(this,"children",[]),g(this,"nestCurt"),this.opts=t,this.data=u({},e),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new qn(this),this.renderInstance=new Un(this)}render(){const e=this.renderInstance.render();this.$el&&this.$el.replaceWith(e),this.$el=e,this.opts.onAfterRender&&this.opts.onAfterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(e){this.data=e,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(e,t="append"){e.parent=this,e.nestCurt=this.nestCurt+1,this.children.push(e);const n=this.getChildrenWrapEl(),s=e.getEl();"append"===t?n.append(s):"prepend"===t&&n.prepend(s),e.getRender().playFadeAnim(),e.getRender().checkHeightLimit()}getChildrenWrapEl(){return this.nestCurt>=this.opts.nestMax?this.parent.getChildrenWrapEl():this.getRender().getChildrenWrap()}getParents(){const e=[];let t=this.parent;for(;t;)e.push(t),t=t.getParent();return e}getEl(){if(!this.$el)throw new Error("comment element not initialized before `getEl()`");return this.$el}focus(){if(!this.$el)throw new Error("comment element not initialized before `focus()`");this.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()})),this.scrollIntoView(),this.getRender().playFlashAnim()}scrollIntoView(){this.$el&&en(this.$el,!1,this.opts.scrollRelativeTo&&this.opts.scrollRelativeTo())}remove(){var e;null==(e=this.$el)||e.remove()}getGravatarURL(){return`${(e={mirror:this.opts.gravatar.mirror,params:this.opts.gravatar.params,emailMD5:this.data.email_encrypted}).mirror.replace(/\/$/,"")}/${e.emailMD5}?${e.params.replace(/^\?/,"")}`;var e}getContentMarked(){return Ct(this.data.content)}getDateFormatted(){return It(new Date(this.data.date),Nt)}getUserUA(){const e=function(e){const t=window||{},n=navigator||{},s=String(e||n.userAgent),i={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},r={Trident:s.includes("Trident")||s.includes("NET CLR"),Presto:s.includes("Presto"),WebKit:s.includes("AppleWebKit"),Gecko:s.includes("Gecko/")},o={Safari:s.includes("Safari"),Chrome:s.includes("Chrome")||s.includes("CriOS"),IE:s.includes("MSIE")||s.includes("Trident"),Edge:s.includes("Edge")||s.includes("Edg"),Firefox:s.includes("Firefox")||s.includes("FxiOS"),"Firefox Focus":s.includes("Focus"),Chromium:s.includes("Chromium"),Opera:s.includes("Opera")||s.includes("OPR"),Vivaldi:s.includes("Vivaldi"),Yandex:s.includes("YaBrowser"),Kindle:s.includes("Kindle")||s.includes("Silk/"),360:s.includes("360EE")||s.includes("360SE"),UC:s.includes("UC")||s.includes(" UBrowser"),QQBrowser:s.includes("QQBrowser"),QQ:s.includes("QQ/"),Baidu:s.includes("Baidu")||s.includes("BIDUBrowser"),Maxthon:s.includes("Maxthon"),Sogou:s.includes("MetaSr")||s.includes("Sogou"),LBBROWSER:s.includes("LBBROWSER"),"2345Explorer":s.includes("2345Explorer"),TheWorld:s.includes("TheWorld"),MIUI:s.includes("MiuiBrowser"),Quark:s.includes("Quark"),Qiyu:s.includes("Qiyu"),Wechat:s.includes("MicroMessenger"),Taobao:s.includes("AliApp(TB"),Alipay:s.includes("AliApp(AP"),Weibo:s.includes("Weibo"),Douban:s.includes("com.douban.frodo"),Suning:s.includes("SNEBUY-APP"),iQiYi:s.includes("IqiyiApp")},a={Windows:s.includes("Windows"),Linux:s.includes("Linux")||s.includes("X11"),macOS:s.includes("Macintosh"),Android:s.includes("Android")||s.includes("Adr"),Ubuntu:s.includes("Ubuntu"),FreeBSD:s.includes("FreeBSD"),Debian:s.includes("Debian"),"Windows Phone":s.includes("IEMobile")||s.includes("Windows Phone"),BlackBerry:s.includes("BlackBerry")||s.includes("RIM"),MeeGo:s.includes("MeeGo"),Symbian:s.includes("Symbian"),iOS:s.includes("like Mac OS X"),"Chrome OS":s.includes("CrOS"),WebOS:s.includes("hpwOS")},l={Mobile:s.includes("Mobi")||s.includes("iPh")||s.includes("480"),Tablet:s.includes("Tablet")||s.includes("Pad")||s.includes("Nexus 7")};l.Mobile?l.Mobile=!s.includes("iPad"):o.Chrome&&s.includes("Edg")?(o.Chrome=!1,o.Edge=!0):t.showModalDialog&&t.chrome&&(o.Chrome=!1,o[360]=!0),i.device="PC",i.language=(()=>{const e=(n.browserLanguage||n.language).split("-");return e[1]&&(e[1]=e[1].toUpperCase()),e.join("_")})();const c={engine:r,browser:o,os:a,device:l};Object.entries(c).forEach((([e,t])=>{Object.entries(t).forEach((([t,n])=>{!0===n&&(i[e]=t)}))}));const h={Windows:()=>{const e=s.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[e]||e},Android:()=>s.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>s.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>s.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>s.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>s.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>s.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};i.osVersion="",h[i.os]&&(i.osVersion=h[i.os](),i.osVersion===s&&(i.osVersion=""));const d={Safari:()=>s.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>s.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>s.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>s.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>s.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>s.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>s.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>s.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>s.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>s.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>s.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>s.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>s.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>s.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>s.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>s.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>s.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>s.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>s.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>s.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>s.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>s.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>s.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>s.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>s.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>s.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>s.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>s.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>s.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return i.version="",d[i.browser]&&(i.version=d[i.browser](),i.version===s&&(i.version="")),i.version.indexOf(".")&&(i.version=i.version.substring(0,i.version.indexOf("."))),"iOS"===i.os&&s.includes("iPad")?i.os="iPadOS":"Edge"!==i.browser||s.includes("Edg")?"MIUI"===i.browser?i.os="Android":"Chrome"===i.browser&&Number(i.version)>27||"Opera"===i.browser&&Number(i.version)>12||"Yandex"===i.browser?i.engine="Blink":void 0===i.browser&&(i.browser="Unknow App"):i.engine="EdgeHTML",i}(this.data.ua);return{browser:`${e.browser} ${e.version}`,os:`${e.os} ${e.osVersion}`}}getOpts(){return this.opts}}class jn{constructor(e){g(this,"opts"),g(this,"$el"),g(this,"$loading"),g(this,"$text"),g(this,"offset",0),g(this,"total",0),g(this,"origText","Load More"),this.opts=e,this.origText=this.opts.text||this.origText,this.$el=Lt(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.opts.pageSize}click(){this.hasMore&&this.opts.onClick(this.offset+this.opts.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(e){this.$loading.style.display=e?"":"none",this.$text.style.display=e?"none":""}showErr(e){this.setLoading(!1),this.$text.innerText=e,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(e,t){this.offset=e,this.total=t,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}class Dn{constructor(){g(this,"instance"),g(this,"onReachedBottom",null),g(this,"opt")}create(e){return this.opt=e,this.instance=new jn({pageSize:e.pageSize,onClick:t=>k(this,null,(function*(){e.ctx.fetch({offset:t})})),text:Nt("loadMore")}),e.readMoreAutoLoad&&(this.onReachedBottom=()=>{this.instance.hasMore&&!this.opt.ctx.getData().getLoading()&&this.instance.click()},this.opt.ctx.on("list-reach-bottom",this.onReachedBottom)),this.instance.$el}setLoading(e){this.instance.setLoading(e)}update(e,t){this.instance.update(e,t)}showErr(e){this.instance.showErr(e)}next(){this.instance.click()}getHasMore(){return this.instance.hasMore}getIsClearComments(e){return 0===e.offset}dispose(){this.onReachedBottom&&this.opt.ctx.off("list-reach-bottom",this.onReachedBottom),this.instance.$el.remove()}}class Fn{constructor(e,t){g(this,"opts"),g(this,"total"),g(this,"$el"),g(this,"$input"),g(this,"inputTimer"),g(this,"$prevBtn"),g(this,"$nextBtn"),g(this,"page",1),this.total=e,this.opts=t,this.$el=Lt('
    \n
    \n
    \n \n
    \n \n
    \n \n
    \n
    \n
    '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=e=>this.keydown(e),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.opts.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(e,t){this.page=Math.ceil(e/this.pageSize)+1,this.total=t,this.setInput(this.page),this.checkDisabled()}setInput(e){this.$input.value=`${e}`}input(e=!1){window.clearTimeout(this.inputTimer);const t=this.$input.value.trim(),n=()=>{if(""===t)return void this.setInput(this.page);let e=Number(t);Number.isNaN(e)||e<1?this.setInput(this.page):(e>this.maxPage&&(this.setInput(this.maxPage),e=this.maxPage),this.change(e))};e?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const e=this.page-1;e<1||this.change(e)}next(){const e=this.page+1;e>this.maxPage||this.change(e)}getHasMore(){return this.page+1<=this.maxPage}change(e){this.page=e,this.opts.onChange(this.offset),this.setInput(e),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(e){const t=e.keyCode||e.which;if(38===t){const e=Number(this.$input.value)+1;if(e>this.maxPage)return;this.setInput(e),this.input()}else if(40===t){const e=Number(this.$input.value)-1;if(e<1)return;this.setInput(e),this.input()}else 13===t&&this.input(!0)}setLoading(e){e?Yt(this.$el):Xt(this.$el)}}class Wn{constructor(){g(this,"instance")}create(e){return this.instance=new Fn(e.total,{pageSize:e.pageSize,onChange:t=>k(this,null,(function*(){e.ctx.editorResetState(),e.ctx.fetch({offset:t,onSuccess:()=>{e.ctx.listGotoFirst()}})}))}),this.instance.$el}setLoading(e){this.instance.setLoading(e)}update(e,t){this.instance.update(e,t)}next(){this.instance.next()}getHasMore(){return this.instance.getHasMore()}getIsClearComments(){return!0}dispose(){this.instance.$el.remove()}}function Nn(e){const t=e.getData().getListLastFetch(),n={offset:0,total:0};return t?(n.offset=t.params.offset,t.data&&(n.total=t.params.flatMode?t.data.count:t.data.roots_count),n):n}const zn=e=>{let t=null;e.watchConf(["pagination","locale"],(n=>{const s=e.get("list");t&&t.dispose(),t=function(e){return e.pagination.readMore?new Dn:new Wn}(n);const{offset:i,total:r}=Nn(e),o=t.create({ctx:e,pageSize:n.pagination.pageSize,total:r,readMoreAutoLoad:n.pagination.autoLoad});s.$commentsWrap.after(o),null==t||t.update(i,r)})),e.on("list-loaded",(n=>{const{offset:s,total:i}=Nn(e);null==t||t.update(s,i)})),e.on("list-fetch",(n=>{e.getData().getComments().length>0&&(null==t?void 0:t.getIsClearComments(n))&&e.getData().clearComments()})),e.on("list-failed",(()=>{var e;null==(e=null==t?void 0:t.showErr)||e.call(t,Nt("loadFail"))})),e.on("list-fetch",(e=>{null==t||t.setLoading(!0)})),e.on("list-fetched",(({params:e})=>{null==t||t.setLoading(!1)}))};class Hn extends cn{constructor(e){super(e),g(this,"$commentsWrap"),g(this,"commentNodes",[]),this.$el=Lt('
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n'),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),zn(e),this.initCrudEvents()}getCommentsWrapEl(){return this.$commentsWrap}getCommentNodes(){return this.commentNodes}getListLayout({forceFlatMode:e}={}){return new yn({$commentsWrap:this.$commentsWrap,nestSortBy:this.ctx.conf.nestSort,nestMax:this.ctx.conf.nestMax,flatMode:"boolean"==typeof e?e:this.ctx.conf.flatMode,createCommentNode:(t,n)=>{const s=function(e,t,n,s){const i=new Bn(t,{onAfterRender:()=>{e.trigger("comment-rendered",i)},onDelete:t=>{e.getData().deleteComment(t.getID())},replyTo:n,flatMode:"boolean"==typeof(null==s?void 0:s.forceFlatMode)?null==s?void 0:s.forceFlatMode:e.conf.flatMode,gravatar:e.conf.gravatar,nestMax:e.conf.nestMax,heightLimit:e.conf.heightLimit,avatarURLBuilder:e.conf.avatarURLBuilder,scrollRelativeTo:e.conf.scrollRelativeTo,vote:e.conf.vote,voteDown:e.conf.voteDown,uaBadge:e.conf.uaBadge,getApi:()=>e.getApi(),replyComment:(t,n)=>e.replyComment(t,n),editComment:(t,n)=>e.editComment(t,n)});return i.render(),i}(this.ctx,t,n,{forceFlatMode:e});return this.commentNodes.push(s),s},findCommentNode:e=>this.commentNodes.find((t=>t.getID()===e))})}initCrudEvents(){this.ctx.on("list-load",(e=>{this.getListLayout().import(e)})),this.ctx.on("list-loaded",(e=>{0===e.length&&(this.commentNodes=[],this.$commentsWrap.innerHTML="")})),this.ctx.on("comment-inserted",(e=>{this.getListLayout().insert(e)})),this.ctx.on("comment-deleted",(e=>{const t=this.commentNodes.find((t=>t.getID()===e.id));t?(t.remove(),this.commentNodes=this.commentNodes.filter((t=>t.getID()!==e.id))):console.error(`comment node id=${e.id} not found`)})),this.ctx.on("comment-updated",(e=>{const t=this.commentNodes.find((t=>t.getID()===e.id));t&&t.setData(e)}))}}let Qn,Vn;function Gn(){return{init(){Qn=document.body.style.overflow,Vn=document.body.style.paddingRight},unlock(){document.body.style.overflow=Qn,document.body.style.paddingRight=Vn},lock(){document.body.style.overflow="hidden";const e=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const e=document.createElement("p");e.style.width="100%",e.style.height="200px";const t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);const n=e.offsetWidth;t.style.overflow="scroll";let s=e.offsetWidth;return n===s&&(s=t.clientWidth),document.body.removeChild(t),n-s}()+e||0}px`}}}class Kn{constructor(e,t){g(this,"allowMaskClose",!0),g(this,"onAfterHide"),this.$el=e,this.opts=t}setOnAfterHide(e){this.onAfterHide=e}setAllowMaskClose(e){this.allowMaskClose=e}getAllowMaskClose(){return this.allowMaskClose}getEl(){return this.$el}show(){this.opts.onShow(),this.$el.style.display=""}hide(){return k(this,null,(function*(){this.opts.onHide(),this.$el.style.display="none",this.onAfterHide&&this.onAfterHide()}))}destroy(){return k(this,null,(function*(){this.opts.onHide(),this.$el.remove(),this.onAfterHide&&this.onAfterHide()}))}}class Zn{constructor(){g(this,"$wrap"),g(this,"$mask"),g(this,"items",[]),this.$wrap=Lt(''),this.$mask=this.$wrap.querySelector(".atk-layer-mask")}createItem(e,t){(t=t||this.createItemElement(e)).setAttribute("data-layer-name",e),this.$wrap.appendChild(t);const n=new Kn(t,{onHide:()=>this.hideWrap(t),onShow:()=>this.showWrap()});return this.getMask().addEventListener("click",(()=>{n.getAllowMaskClose()&&n.hide()})),this.items.push(n),n}createItemElement(e){const t=document.createElement("div");return t.classList.add("atk-layer-item"),t.style.display="none",this.$wrap.appendChild(t),t}getWrap(){return this.$wrap}getMask(){return this.$mask}showWrap(){this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),Gn().lock()}hideWrap(e){this.items.map((e=>e.getEl())).filter((t=>t!==e&&t.isConnected&&"none"!==t.style.display)).length>0||(this.$wrap.style.display="none",Gn().unlock())}}class Yn{constructor(e){g(this,"wrap"),this.wrap=new Zn,document.body.appendChild(this.wrap.getWrap()),e.on("unmounted",(()=>{this.wrap.getWrap().remove()})),Gn().init()}getEl(){return this.wrap.getWrap()}create(e,t){return this.wrap.createItem(e,t)}}const Xn="ArtalkUser";class Jn{constructor(e){g(this,"data"),this.opts=e;const t=JSON.parse(window.localStorage.getItem(Xn)||"{}");this.data={nick:t.nick||"",email:t.email||"",link:t.link||"",token:t.token||"",isAdmin:t.isAdmin||!1}}getData(){return this.data}update(e={}){Object.entries(e).forEach((([e,t])=>{this.data[e]=t})),window.localStorage.setItem(Xn,JSON.stringify(this.data)),this.opts.onUserChanged&&this.opts.onUserChanged(this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}}const es={i18n(e){Wt(e.conf.locale),e.watchConf(["locale"],(e=>{Wt(e.locale)}))},user:e=>new Jn({onUserChanged:t=>{e.trigger("user-changed",t)}}),layerManager:e=>new Yn(e),checkerLauncher:e=>new ln({getCtx:()=>e,getApi:()=>e.getApi(),onReload:()=>e.reload(),getCaptchaIframeURL:()=>`${e.conf.server}/api/v2/captcha/?t=${+new Date}`}),editor(e){const t=new gn(e);return e.$root.appendChild(t.$el),t},list(e){const t=new Hn(e);return e.$root.appendChild(t.$el),t},sidebarLayer:e=>new mn(e),editorPlugs(){}};function ts(e){return k(this,null,(function*(){e.countEl&&document.querySelector(e.countEl)&&ns(e,{query:"page_comment",numEl:e.countEl});const t=e.pvAdd&&e.pageKey?{[e.pageKey]:(yield e.getApi().pages.logPv({page_key:e.pageKey,page_title:e.pageTitle,site_name:e.siteName})).data.pv}:void 0;e.pvEl&&document.querySelector(e.pvEl)&&ns(e,{query:"page_pv",numEl:e.pvEl,data:t})}))}function ns(e,t){return k(this,null,(function*(){let n=t.data||{},s=Array.from(document.querySelectorAll(t.numEl)).map((t=>t.getAttribute("data-page-key")||e.pageKey)).filter((e=>e&&"number"!=typeof n[e]));if(s=[...new Set(s)],s.length>0){const i=(yield e.getApi().stats.getStats(t.query,{page_keys:s.join(","),site_name:e.siteName})).data.data;n=u(u({},n),i)}const i=e.pageKey?n[e.pageKey]:0;!function(e,t,n){document.querySelectorAll(e).forEach((e=>{const s=e.getAttribute("data-page-key"),i=Number(s?t[s]:n);e.innerHTML=`${i}`}))}(t.numEl,n,i)}))}function ss(e){const t=Lt('

    ');if(t.querySelector(".error-message").innerText=`${Nt("listLoadFailMsg")}\n${e.errMsg}`,e.retryFn){const n=Lt(`${Nt("listRetry")}`);n.onclick=()=>e.retryFn&&e.retryFn(),t.appendChild(n)}if(e.onOpenSidebar){const n=Lt(` | ${Nt("openName",{name:Nt("ctrlCenter")})}`);t.appendChild(n),n.onclick=()=>e.onOpenSidebar&&e.onOpenSidebar()}nn(e.$err,t)}const is="ArtalkContent";class rs{constructor(e){this.kit=e}reqAdd(){return k(this,null,(function*(){return(yield this.kit.useApi().comments.createComment(u({},yield this.getSubmitAddParams()))).data}))}getSubmitAddParams(){return k(this,null,(function*(){const{nick:e,email:t,link:n}=this.kit.useUser().getData(),s=this.kit.useConf();return{content:this.kit.useEditor().getContentFinal(),name:e,email:t,link:n,rid:0,page_key:s.pageKey,page_title:s.pageTitle,site_name:s.site,ua:yield _t()}}))}postSubmitAdd(e){this.kit.useGlobalCtx().getData().insertComment(e)}}class os extends dn{constructor(e){super(e),g(this,"customs",[]),g(this,"defaultPreset"),this.defaultPreset=new rs(this.kit);const t=()=>this.do();this.kit.useMounted((()=>{this.kit.useGlobalCtx().on("editor-submit",t)})),this.kit.useUnmounted((()=>{this.kit.useGlobalCtx().off("editor-submit",t)}))}registerCustom(e){this.customs.push(e)}do(){return k(this,null,(function*(){if(""===this.kit.useEditor().getContentFinal().trim())return void this.kit.useEditor().focus();const e=this.customs.find((e=>e.activeCond()));this.kit.useEditor().showLoading();try{let t;(null==e?void 0:e.pre)&&e.pre(),t=(null==e?void 0:e.req)?yield e.req():yield this.defaultPreset.reqAdd(),(null==e?void 0:e.post)?e.post(t):this.defaultPreset.postSubmitAdd(t)}catch(t){return console.error(t),void this.kit.useEditor().showNotify(`${Nt("commentFail")}: ${t.message||String(t)}`,"e")}finally{this.kit.useEditor().hideLoading()}this.kit.useEditor().reset(),this.kit.useGlobalCtx().trigger("editor-submitted")}))}}class as extends dn{constructor(e){super(e),g(this,"emoticons",[]),g(this,"loadingTask",null),g(this,"$grpWrap"),g(this,"$grpSwitcher"),g(this,"isListLoaded",!1),g(this,"isImgLoaded",!1),this.kit.useMounted((()=>{this.usePanel('
    '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.useContentTransformer((e=>this.transEmoticonImageText(e))),this.usePanelShow((()=>{(()=>{k(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()})),this.usePanelHide((()=>{this.$panel.parentElement.style.height=""})),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}loadEmoticonsData(){return k(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>k(this,null,(function*(){Yt(this.$panel),this.emoticons=yield this.handleData(this.kit.useConf().emoticons),Xt(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(e){return k(this,null,(function*(){if(!Array.isArray(e)&&["object","string"].includes(typeof e)&&(e=[e]),!Array.isArray(e))return nn(this.$panel,`[${Nt("emoticon")}] Data must be of Array/Object/String type`),Xt(this.$panel),[];const t=t=>{"object"==typeof t&&(t.name&&e.find((e=>e.name===t.name))||e.push(t))},n=e=>k(this,null,(function*(){yield Promise.all(e.map(((e,s)=>k(this,null,(function*(){if("object"!=typeof e||Array.isArray(e)){if(Array.isArray(e))yield n(e);else if("string"==typeof e){const s=yield this.remoteLoad(e);Array.isArray(s)?yield n(s):"object"==typeof s&&t(s)}}else t(e)})))))}));return yield n(e),e.forEach((e=>{if(this.isOwOFormat(e)){this.convertOwO(e).forEach((e=>{t(e)}))}else Array.isArray(e)&&e.forEach((e=>{t(e)}))})),e=e.filter((e=>"object"==typeof e&&!Array.isArray(e)&&!!e&&!!e.name)),this.solveNullKey(e),this.solveSameKey(e),e}))}remoteLoad(e){return k(this,null,(function*(){if(!e)return[];try{const t=yield fetch(e);return yield t.json()}catch(t){return Xt(this.$panel),console.error("[Emoticons] Load Failed:",t),nn(this.$panel,`[${Nt("emoticon")}] ${Nt("loadFail")}: ${String(t)}`),[]}}))}solveNullKey(e){e.forEach((e=>{e.items.forEach(((t,n)=>{t.key||(t.key=`${e.name} ${n+1}`)}))}))}solveSameKey(e){const t={};e.forEach((e=>{e.items.forEach((e=>{e.key&&""!==String(e.key).trim()&&(t[e.key]?t[e.key]++:t[e.key]=1,t[e.key]>1&&(e.key=`${e.key} ${t[e.key]}`))}))}))}isOwOFormat(e){try{return"object"==typeof e&&!!Object.values(e).length&&Array.isArray(Object.keys(Object.values(e)[0].container))&&Object.keys(Object.values(e)[0].container[0]).includes("icon")}catch(t){return!1}}convertOwO(e){const t=[];return Object.entries(e).forEach((([e,n])=>{const s={name:e,type:n.type,items:[]};n.container.forEach(((t,n)=>{const i=t.icon;if(/<(img|IMG)/.test(i)){const e=/src=["'](.*?)["']/.exec(i);e&&e.length>1&&(t.icon=e[1])}s.items.push({key:t.text||`${e} ${n+1}`,val:t.icon})})),t.push(s)})),t}initEmoticonsList(){this.$grpWrap=Lt('
    '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((e,t)=>{const n=Lt('');this.$grpWrap.append(n),n.setAttribute("data-index",String(t)),n.setAttribute("data-grp-name",e.name),n.setAttribute("data-type",e.type),e.items.forEach((t=>{const s=Lt('');if(n.append(s),t.key&&!new RegExp(`^(${e.name})?\\s?[0-9]+$`).test(t.key)&&s.setAttribute("title",t.key),"image"===e.type){const e=document.createElement("img");e.src=t.val,e.alt=t.key,s.append(e)}else s.innerText=t.val;s.onclick=()=>{"image"===e.type?this.kit.useEditor().insertContent(`:[${t.key}]`):this.kit.useEditor().insertContent(t.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=Lt('
    '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((e,t)=>{const n=Lt("");n.innerText=e.name,n.setAttribute("data-index",String(t)),n.onclick=()=>this.openGrp(t),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(e){var t,n,s;Array.from(this.$grpWrap.children).forEach((t=>{const n=t;n.getAttribute("data-index")!==String(e)?n.style.display="none":n.style.display=""})),null==(t=this.$grpSwitcher)||t.querySelectorAll("span.active").forEach((e=>e.classList.remove("active"))),null==(s=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${e}"]`))||s.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(e){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((t=>{"image"===t.type&&Object.entries(t.items).forEach((([t,n])=>{e=e.split(`:[${n.key}]`).join(``)}))})),e):e}}const ls=["png","jpg","jpeg","gif","bmp","svg","webp"];class cs extends dn{constructor(e){super(e),g(this,"$imgUploadInput"),this.kit.useMounted((()=>this.init())),this.initDragImg()}init(){this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=ls.map((e=>`.${e}`)).join(",");const e=this.useBtn(``);e.after(this.$imgUploadInput),e.onclick=()=>{const e=this.$imgUploadInput;e.onchange=()=>{(()=>{k(this,null,(function*(){if(!e.files||0===e.files.length)return;const t=e.files[0];this.uploadImg(t)}))})()},e.click()},this.kit.useConf().imgUpload||this.$btn.setAttribute("atk-only-admin-show","")}initDragImg(){const e=e=>{if(e)for(let t=0;t{e.stopPropagation(),e.preventDefault()},n=t=>{var n;const s=null==(n=t.dataTransfer)?void 0:n.files;(null==s?void 0:s.length)&&(t.preventDefault(),e(s))},s=t=>{var n;const s=null==(n=t.clipboardData)?void 0:n.files;(null==s?void 0:s.length)&&(t.preventDefault(),e(s))};this.kit.useMounted((()=>{this.kit.useUI().$textarea.addEventListener("dragover",t),this.kit.useUI().$textarea.addEventListener("drop",n),this.kit.useUI().$textarea.addEventListener("paste",s)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("dragover",t),this.kit.useUI().$textarea.removeEventListener("drop",n),this.kit.useUI().$textarea.removeEventListener("paste",s)}))}uploadImg(e){return k(this,null,(function*(){const t=/[^.]+$/.exec(e.name);if(!t||!ls.includes(t[0]))return;if(!this.kit.useUser().checkHasBasicUserInfo())return void this.kit.useEditor().showNotify(Nt("uploadLoginMsg"),"w");let n="\n";""===this.kit.useUI().$textarea.value.trim()&&(n="");const s=`${n}![](Uploading ${e.name}...)`;let i;this.kit.useEditor().insertContent(s);try{const t=this.kit.useConf().imgUploader;i=t?{public_url:yield t(e)}:(yield this.kit.useApi().upload.upload({file:e})).data}catch(r){console.error(r),this.kit.useEditor().showNotify(`${Nt("uploadFail")}: ${r.message}`,"e")}if(i&&i.public_url){let e=i.public_url;Ut(e)||(e=qt({base:this.kit.useConf().server,path:e})),this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(s,`${n}![](${e})`))}else this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(s,""))}))}}class hs extends dn{constructor(e){super(e),g(this,"isPlugPanelShow",!1),this.kit.useMounted((()=>{this.usePanel('
    '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.kit.useEvents().on("content-updated",(e=>{this.isPlugPanelShow&&this.updateContent()})),this.usePanelShow((()=>{this.isPlugPanelShow=!0,this.updateContent()})),this.usePanelHide((()=>{this.isPlugPanelShow=!1}))}updateContent(){this.$panel.innerHTML=this.kit.useEditor().getContentMarked()}}const ds=[class extends dn{constructor(e){super(e);const t=()=>{this.save()};this.kit.useMounted((()=>{const e=window.localStorage.getItem(is)||"";""!==e.trim()&&(this.kit.useEditor().showNotify(Nt("restoredMsg"),"i"),this.kit.useEditor().setContent(e)),this.kit.useEvents().on("content-updated",t)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("content-updated",t)}))}save(){window.localStorage.setItem(is,this.kit.useEditor().getContentRaw().trim())}},class extends dn{get $inputs(){return this.kit.useEditor().getHeaderInputEls()}constructor(e){super(e);const t={},n={},s=(e,t,n)=>()=>{this.kit.useEvents().trigger(e,{field:n,$input:t})};this.kit.useMounted((()=>{Object.entries(this.$inputs).forEach((([e,i])=>{i.addEventListener("input",t[e]=s("header-input",i,e)),i.addEventListener("change",n[e]=s("header-change",i,e))}))})),this.kit.useUnmounted((()=>{Object.entries(this.$inputs).forEach((([e,s])=>{s.removeEventListener("input",t[e]),s.removeEventListener("change",n[e])}))}))}},class extends dn{constructor(e){super(e),g(this,"query",{timer:null,abortFn:null});const t=({$input:e,field:t})=>{"edit"!==this.kit.useEditor().getState()&&(this.kit.useUser().update({[t]:e.value.trim()}),"nick"!==t&&"email"!==t||this.fetchUserInfo())};this.kit.useMounted((()=>{Object.entries(this.kit.useEditor().getHeaderInputEls()).forEach((([e,t])=>{t.placeholder=`${Nt(e)}`,t.value=this.kit.useUser().getData()[e]||""})),this.kit.useEvents().on("header-input",t)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-input",t)}))}fetchUserInfo(){this.kit.useUser().logout(),this.query.timer&&window.clearTimeout(this.query.timer),this.query.abortFn&&this.query.abortFn(),this.query.timer=window.setTimeout((()=>{this.query.timer=null;const e=this.kit.useApi(),t="getUserCancelToken";this.query.abortFn=()=>e.abortRequest(t),e.user.getUser(u({},e.getUserFields()),{cancelToken:t}).then((e=>this.onUserInfoFetched(e.data))).catch((e=>{})).finally((()=>{this.query.abortFn=null}))}),400)}onUserInfoFetched(e){var t;e.is_login||this.kit.useUser().logout(),this.kit.useGlobalCtx().getData().updateNotifies(e.notifies),this.kit.useUser().checkHasBasicUserInfo()&&!e.is_login&&(null==(t=e.user)?void 0:t.is_admin)&&this.kit.useGlobalCtx().checkAdmin({onSuccess:()=>{}}),e.user&&e.user.link&&(this.kit.useUI().$link.value=e.user.link,this.kit.useUser().update({link:e.user.link}))}},class extends dn{constructor(e){super(e);const t=({field:e})=>{"link"===e&&this.onLinkInputChange()};this.kit.useMounted((()=>{this.kit.useEvents().on("header-change",t)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-change",t)}))}onLinkInputChange(){const e=this.kit.useUI().$link.value.trim();e&&!/^(http|https):\/\//.test(e)&&(this.kit.useUI().$link.value=`https://${e}`,this.kit.useUser().update({link:this.kit.useUI().$link.value}))}},class extends dn{constructor(e){super(e);const t=e=>this.onKeydown(e),n=()=>this.onInput();this.kit.useMounted((()=>{this.kit.useUI().$textarea.placeholder=this.kit.useConf().placeholder||Nt("placeholder"),this.kit.useUI().$textarea.addEventListener("keydown",t),this.kit.useUI().$textarea.addEventListener("input",n)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("keydown",t),this.kit.useUI().$textarea.removeEventListener("input",n)})),this.kit.useEvents().on("content-updated",(()=>{window.setTimeout((()=>{this.adaptiveHeightByContent()}),80)}))}onKeydown(e){9===(e.keyCode||e.which)&&(e.preventDefault(),this.kit.useEditor().insertContent("\t"))}onInput(){this.kit.useEvents().trigger("content-updated",this.kit.useEditor().getContentRaw())}adaptiveHeightByContent(){const e=this.kit.useUI().$textarea.offsetHeight-this.kit.useUI().$textarea.clientHeight;this.kit.useUI().$textarea.style.height="0px",this.kit.useUI().$textarea.style.height=`${this.kit.useUI().$textarea.scrollHeight+e}px`}},os,class extends dn{constructor(e){super(e);const t=()=>{this.kit.useEditor().submit()};this.kit.useMounted((()=>{this.kit.useUI().$submitBtn.innerText=this.kit.useConf().sendBtn||Nt("send"),this.kit.useUI().$submitBtn.addEventListener("click",t)})),this.kit.useUnmounted((()=>{this.kit.useUI().$submitBtn.removeEventListener("click",t)}))}},un,class extends dn{constructor(e){super(e),g(this,"comment"),this.useEditorStateEffect("reply",(e=>(this.setReply(e),()=>{this.cancelReply()}))),this.kit.useEvents().on("mounted",(()=>{const e=this.kit.useDeps(os);if(!e)throw Error("SubmitPlug not initialized");const t=new rs(this.kit);e.registerCustom({activeCond:()=>!!this.comment,req:()=>k(this,null,(function*(){if(!this.comment)throw new Error("reply comment cannot be empty");return(yield this.kit.useApi().comments.createComment(p(u({},yield t.getSubmitAddParams()),{rid:this.comment.id,page_key:this.comment.page_key,page_title:void 0,site_name:this.comment.site_name}))).data})),post:e=>{const n=this.kit.useConf();e.page_key!==n.pageKey&&window.open(`${e.page_url}#atk-comment-${e.id}`),t.postSubmitAdd(e)}})}))}setReply(e){const t=this.kit.useUI();if(!t.$sendReplyBtn){const n=Lt(`${Nt("reply")} `);n.querySelector(".atk-text").innerText=`@${e.nick}`,n.addEventListener("click",(()=>{this.kit.useEditor().resetState()})),t.$stateWrap.append(n),t.$sendReplyBtn=n}this.comment=e,t.$textarea.focus()}cancelReply(){if(!this.comment)return;const e=this.kit.useUI();e.$sendReplyBtn&&(e.$sendReplyBtn.remove(),e.$sendReplyBtn=void 0),this.comment=void 0}},class extends dn{constructor(e){super(e),g(this,"comment"),g(this,"originalSubmitBtnText","Send"),this.useEditorStateEffect("edit",(e=>(this.edit(e),()=>{this.cancelEdit()}))),this.kit.useMounted((()=>{const e=this.kit.useDeps(os);if(!e)throw Error("SubmitPlug not initialized");e.registerCustom({activeCond:()=>!!this.comment,req:()=>k(this,null,(function*(){const e={content:this.kit.useEditor().getContentFinal(),nick:this.kit.useUI().$nick.value,email:this.kit.useUI().$email.value,link:this.kit.useUI().$link.value},t=this.comment;return(yield this.kit.useApi().comments.updateComment(t.id,u(u({},t),e))).data})),post:e=>{this.kit.useGlobalCtx().getData().updateComment(e)}})}))}edit(e){const t=this.kit.useUI();if(!t.$editCancelBtn){const e=Lt(`${Nt("editCancel")}`);e.onclick=()=>{this.kit.useEditor().resetState()},t.$stateWrap.append(e),t.$editCancelBtn=e}this.comment=e,t.$header.style.display="none",t.$nick.value=e.nick||"",t.$email.value=e.email||"",t.$link.value=e.link||"",this.kit.useEditor().setContent(e.content),t.$textarea.focus(),this.updateSubmitBtnText(Nt("save"))}cancelEdit(){if(!this.comment)return;const e=this.kit.useUI();e.$editCancelBtn&&(e.$editCancelBtn.remove(),e.$editCancelBtn=void 0),this.comment=void 0;const{nick:t,email:n,link:s}=this.kit.useUser().getData();e.$nick.value=t,e.$email.value=n,e.$link.value=s,this.kit.useEditor().setContent(""),this.restoreSubmitBtnText(),e.$header.style.display=""}updateSubmitBtnText(e){this.originalSubmitBtnText=this.kit.useUI().$submitBtn.innerText,this.kit.useUI().$submitBtn.innerText=e}restoreSubmitBtnText(){this.kit.useUI().$submitBtn.innerText=this.originalSubmitBtnText}},class extends dn{constructor(e){super(e);const t=()=>this.open(),n=()=>this.close();this.kit.useMounted((()=>{this.kit.useEvents().on("editor-open",t),this.kit.useEvents().on("editor-close",n)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("editor-open",t),this.kit.useEvents().off("editor-close",n)}))}open(){var e;null==(e=this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed"))||e.remove(),this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""}close(){this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed")||this.kit.useUI().$textareaWrap.prepend(Lt(`
    ${Nt("onlyAdminCanReply")}
    `)),this.kit.useUser().getData().isAdmin?(this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""):(this.kit.useUI().$textarea.style.display="none",this.kit.useEvents().trigger("panel-close"),this.kit.useUI().$bottom.style.display="none")}},as,cs,hs];class us{constructor(e){this.plugs=e}useEditor(){return this.plugs.editor}useGlobalCtx(){return this.plugs.editor.ctx}useConf(){return this.plugs.editor.ctx.conf}useApi(){return this.plugs.editor.ctx.getApi()}useUser(){return this.plugs.editor.ctx.get("user")}useUI(){return this.plugs.editor.getUI()}useEvents(){return this.plugs.getEvents()}useMounted(e){this.useEvents().on("mounted",e)}useUnmounted(e){this.useEvents().on("unmounted",e)}useDeps(e){return this.plugs.get(e)}}class ps{constructor(e){g(this,"plugs",[]),g(this,"openedPlug",null),g(this,"events",new zt),this.editor=e;let t=!1;this.editor.ctx.watchConf(["imgUpload","emoticons","preview","editorTravel","locale"],(e=>{t&&this.getEvents().trigger("unmounted"),this.clear(),function(e){const t=new Map;return t.set(cs,e.imgUpload),t.set(as,e.emoticons),t.set(hs,e.preview),t.set(un,e.editorTravel),ds.filter((e=>!t.has(e)||!!t.get(e)))}(e).forEach((e=>{const t=new us(this);this.plugs.push(new e(t))})),this.getEvents().trigger("mounted"),t=!0,this.loadPluginUI()})),this.events.on("panel-close",(()=>this.closePlugPanel()))}getPlugs(){return this.plugs}getEvents(){return this.events}clear(){this.plugs=[],this.events=new zt,this.openedPlug&&this.closePlugPanel()}loadPluginUI(){this.editor.getUI().$plugPanelWrap.innerHTML="",this.editor.getUI().$plugPanelWrap.style.display="none",this.editor.getUI().$plugBtnWrap.innerHTML="",this.plugs.forEach((e=>this.loadPluginItem(e)))}loadPluginItem(e){const t=e.$btn;if(!t)return;this.editor.getUI().$plugBtnWrap.appendChild(t),!t.onclick&&(t.onclick=()=>{this.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((e=>e.classList.remove("active"))),e!==this.openedPlug?(this.openPlugPanel(e),t.classList.add("active")):this.closePlugPanel()});const n=e.$panel;n&&(n.style.display="none",this.editor.getUI().$plugPanelWrap.appendChild(n))}get(e){return this.plugs.find((t=>t instanceof e))}openPlugPanel(e){this.plugs.forEach((t=>{const n=t.$panel;n&&(t===e?(n.style.display="",this.events.trigger("panel-show",e)):(n.style.display="none",this.events.trigger("panel-hide",e)))})),this.editor.getUI().$plugPanelWrap.style.display="",this.openedPlug=e}closePlugPanel(){this.openedPlug&&(this.editor.getUI().$plugPanelWrap.style.display="none",this.events.trigger("panel-hide",this.openedPlug),this.openedPlug=null)}getTransformedContent(e){let t=e;return this.plugs.forEach((e=>{e.contentTransformer&&(t=e.contentTransformer(t))})),t}}const gs="2.8.4";let ms=!1;let fs;function ks(e,t){const n="atk-dark-mode";e.forEach((e=>{t?e.classList.add(n):e.classList.remove(n)}))}const ys=[...[e=>{!function(){try{if(!Me.name)return}catch(e){return}Me.setOptions(u({renderer:kt()},wt)),$t=Me}(),e.on("updated",(e=>{var t;e.markedReplacers&&(t=e.markedReplacers,bt=t)}))},e=>{const t=e.get("editor"),n=new ps(t);e.inject("editorPlugs",n)},e=>{const t=()=>{var t;t=e.get("user").getData().isAdmin,function(e){const t=[];e.$root.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e)));const n=document.querySelector(".atk-sidebar");return n&&n.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e))),t}({$root:e.$root}).forEach((e=>{t?e.classList.remove("atk-hide"):e.classList.add("atk-hide")}))};e.on("list-loaded",(()=>{t()})),e.on("user-changed",(e=>{t()}))},...[e=>{e.on("list-fetch",(t=>{if(e.getData().getLoading())return;e.getData().setLoading(!0);const n=u({offset:0,limit:e.conf.pagination.pageSize,flatMode:e.conf.flatMode,paramsModifier:e.conf.listFetchParamsModifier},t);e.getData().setListLastFetch({params:n});const s={limit:n.limit,offset:n.offset,flat_mode:n.flatMode,page_key:e.getConf().pageKey,site_name:e.getConf().site};n.paramsModifier&&n.paramsModifier(s),e.getApi().comments.getComments(u(u({},s),e.getApi().getUserFields())).then((({data:t})=>{e.getData().setListLastFetch({params:n,data:t}),e.getData().loadComments(t.comments),e.getData().updatePage(t.page),n.onSuccess&&n.onSuccess(t),e.trigger("list-fetched",{params:n,data:t})})).catch((t=>{const s={msg:t.msg||String(t),data:t.data};throw n.onError&&n.onError(s),e.trigger("list-failed",s),e.trigger("list-fetched",{params:n,error:s}),t})).finally((()=>{e.getData().setLoading(!1)}))}))},e=>{e.on("list-fetch",(t=>{const n=e.get("list");0===t.offset&&Jt(!0,n.$el)})),e.on("list-fetched",(()=>{Jt(!1,e.get("list").$el)}))},e=>{e.on("comment-rendered",(t=>{if(!0===e.conf.listUnreadHighlight){const n=e.getData().getNotifies(),s=n.find((e=>e.comment_id===t.getID()));s?(t.getRender().setUnread(!0),t.getRender().setOpenAction((()=>{window.open(s.read_link),e.getData().updateNotifies(n.filter((e=>e.comment_id!==t.getID())))}))):t.getRender().setUnread(!1)}})),e.on("list-goto",(t=>{const n=Pt("atk_notify_key");n&&e.getApi().notifies.markNotifyRead(t,n).then((()=>{e.getData().updateNotifies(e.getData().getNotifies().filter((e=>e.comment_id!==t)))}))}))},e=>{let t;e.on("mounted",(()=>{const n=e.get("list");t=n.$el.querySelector('[data-action="admin-close-comment"]'),t.addEventListener("click",(()=>{const t=e.getData().getPage();if(!t)throw new Error("Page data not found");t.admin_only=!t.admin_only,function(e,t){e.editorShowLoading(),e.getApi().pages.updatePage(t.id,t).then((({data:t})=>{e.getData().updatePage(t)})).catch((t=>{e.editorShowNotify(`${Nt("editFail")}: ${t.message||String(t)}`,"e")})).finally((()=>{e.editorHideLoading()}))}(e,t)}))})),e.on("page-loaded",(n=>{var s,i;const r=e.get("editor");!0===(null==n?void 0:n.admin_only)?(null==(s=r.getPlugs())||s.getEvents().trigger("editor-close"),t&&(t.innerText=Nt("openComment"))):(null==(i=r.getPlugs())||i.getEvents().trigger("editor-open"),t&&(t.innerText=Nt("closeComment")))})),e.on("list-loaded",(t=>{e.editorResetState()}))},e=>{e.on("list-loaded",(()=>{(()=>{var t,n;const s=e.get("list").$el.querySelector(".atk-comment-count .atk-text");if(!s)return;const i=Rt(Nt("counter",{count:`${Number(null==(n=null==(t=e.getData().getListLastFetch())?void 0:t.data)?void 0:n.count)||0}`}));s.innerHTML=i.replace(/(\d+)/,'$1')})()})),e.on("comment-inserted",(()=>{const t=e.getData().getListLastFetch();(null==t?void 0:t.data)&&(t.data.count+=1)})),e.on("comment-deleted",(()=>{const t=e.getData().getListLastFetch();(null==t?void 0:t.data)&&(t.data.count-=1)}))},e=>{let t=null;const n=()=>{if(!t)return;const n=e.get("user").getData();if(n.nick&&n.email){t.classList.remove("atk-hide");const e=t.querySelector(".atk-text");e&&(e.innerText=n.isAdmin?Nt("ctrlCenter"):Nt("msgCenter"))}else t.classList.add("atk-hide")};e.watchConf(["locale"],(s=>{const i=e.get("list");t=i.$el.querySelector('[data-action="open-sidebar"]'),t&&(t.onclick=()=>{e.showSidebar()},n())})),e.on("user-changed",(e=>{n()}))},e=>{let t=null;e.on("mounted",(()=>{const n=e.get("list");t=n.$el.querySelector(".atk-unread-badge")})),e.on("notifies-updated",(e=>{var n;n=e.length||0,t&&(n>0?(t.innerText=`${Number(n||0)}`,t.style.display="block"):t.style.display="none")}))},e=>{const t=t=>{e.conf.listFetchParamsModifier=t,e.reload()},n=e=>{!function(e){const{$dropdownWrap:t,dropdownList:n}=e;if(t.querySelector(".atk-dropdown"))return;t.classList.add("atk-dropdown-wrap"),t.append(Lt(''));let s=0;const i=(e,t,n,i)=>{i(),s=e,r.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),t.classList.add("active"),r.style.display="none",setTimeout((()=>{r.style.display=""}),80)},r=Lt('
      ');n.forEach(((e,t)=>{const n=e[0],o=e[1],a=Lt('
    • '),l=a.querySelector("span");l.innerText=n,l.onclick=()=>{i(t,a,n,o)},r.append(a),t===s&&a.classList.add("active")})),t.append(r)}({$dropdownWrap:e,dropdownList:[[Nt("sortLatest"),()=>{t((e=>{e.sort_by="date_desc"}))}],[Nt("sortBest"),()=>{t((e=>{e.sort_by="vote"}))}],[Nt("sortOldest"),()=>{t((e=>{e.sort_by="date_asc"}))}],[Nt("sortAuthor"),()=>{t((e=>{e.view_only_admin=!0}))}]]})};e.watchConf(["listSort","locale"],(t=>{const s=e.get("list").$el.querySelector(".atk-comment-count");s&&(t.listSort?n(s):function(e){var t,n;const{$dropdownWrap:s}=e;s.classList.remove("atk-dropdown-wrap"),null==(t=s.querySelector(".atk-arrow-down-icon"))||t.remove(),null==(n=s.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:s}))}))},e=>{let t=0;const n=({locker:n})=>{const s=function(){const e=window.location.hash.match(/#atk-comment-([0-9]+)/);let t=e&&e[1]&&!Number.isNaN(parseFloat(e[1]))?parseFloat(e[1]):null;t||(t=Number(Pt("atk_comment")));return t||null}();s&&(n&&t===s||(t=s,e.trigger("list-goto",s)))},s=()=>n({locker:!1}),i=()=>n({locker:!0});e.on("mounted",(()=>{window.addEventListener("hashchange",s),e.on("list-loaded",i)})),e.on("unmounted",(()=>{window.removeEventListener("hashchange",s),e.off("list-loaded",i)}))},e=>{e.on("list-goto",(t=>k(this,null,(function*(){let n=e.getCommentNodes().find((e=>e.getID()===t));if(!n){const s=(yield e.getApi().comments.getComment(t)).data;e.get("list").getListLayout({forceFlatMode:!0}).insert(s.comment,s.reply_comment),n=e.getCommentNodes().find((e=>e.getID()===t))}n&&n.focus()}))))},e=>{e.on("list-loaded",(t=>{const n=e.get("list"),s=t.length<=0;let i=n.getCommentsWrapEl().querySelector(".atk-list-no-comment");s?i||(i=Lt('
      '),i.innerHTML=pt(n.ctx.conf.noComment||n.ctx.$t("noComment")),n.getCommentsWrapEl().appendChild(i)):null==i||i.remove()}))},e=>{e.on("mounted",(()=>{const t=e.get("list").$el.querySelector(".atk-copyright");t&&(t.innerHTML=`Powered By Artalk`)}))},e=>{let t=null;e.on("mounted",(()=>{t=window.setInterval((()=>{e.get("list").$el.querySelectorAll("[data-atk-comment-date]").forEach((t=>{const n=t.getAttribute("data-atk-comment-date");t.innerText=It(new Date(Number(n)),e.$t)}))}),3e4)})),e.on("unmounted",(()=>{t&&window.clearInterval(t)}))},e=>{e.on("list-fetch",(()=>{nn(e.get("list").$el,null)})),e.on("list-failed",(t=>{ss({$err:e.get("list").$el,errMsg:t.msg,errData:t.data,retryFn:()=>e.fetch({offset:0})})}))},e=>{let t=null;const n=()=>{null==t||t.disconnect(),t=null};e.on("list-loaded",(()=>{n();const s=e.get("list").getCommentsWrapEl().childNodes,i=s.length>2?s[s.length-2]:null;i&&("IntersectionObserver"in window?(s=>{const i=e.conf.scrollRelativeTo&&e.conf.scrollRelativeTo()||null;t=new IntersectionObserver((([t])=>{t.isIntersecting&&(n(),e.trigger("list-reach-bottom"))}),{threshold:.9,root:i}),t.observe(s)})(i):console.warn("IntersectionObserver api not supported"))})),e.on("unmounted",(()=>{n()}))},e=>{const t=()=>{const t=e.get("list"),n=e.conf.scrollRelativeTo&&e.conf.scrollRelativeTo();(n||window).scroll({top:Mt(t.$el,n).top,left:0})};e.on("mounted",(()=>{e.on("list-goto-first",t)})),e.on("unmounted",(()=>{e.off("list-goto-first",t)}))}],e=>{e.on("list-fetch",(t=>{if(0!==t.offset)return;const n=e.getApi().getUserFields();n&&e.getApi().notifies.getNotifies(n).then((t=>{e.getData().updateNotifies(t.data.notifies)}))}))},e=>{e.watchConf(["site","pageKey","pageTitle","countEl","pvEl"],(t=>{ts({getApi:()=>e.getApi(),siteName:t.site,pageKey:t.pageKey,pageTitle:t.pageTitle,countEl:t.countEl,pvEl:t.pvEl,pvAdd:"boolean"!=typeof e.conf.pvAdd||e.conf.pvAdd})}))},e=>{e.watchConf(["apiVersion","versionCheck"],(t=>{const n=e.get("list");t.apiVersion&&t.versionCheck&&!ms&&function(e,t,n){const s=function(e,t){const n=e.split("."),s=t.split(".");for(let i=0;i<3;i++){const e=Number(n[i]),t=Number(s[i]);if(e>t)return 1;if(t>e)return-1;if(!Number.isNaN(e)&&Number.isNaN(t))return 1;if(Number.isNaN(e)&&!Number.isNaN(t))return-1}return 0}(t,n);if(0===s)return;const i=Lt(`
      ${Nt("updateMsg",{name:Nt(s<0?"frontend":"backend")})}

      ${Nt("currentVersion")}: ${Nt("frontend")} ${t} / ${Nt("backend")} ${n}

      `),r=Lt(`${Nt("ignore")}`);r.onclick=()=>{nn(e.$el.parentElement,null),ms=!0,e.ctx.fetch({offset:0})},i.append(r),nn(e.$el.parentElement,i,'Artalk Warn')}(n,gs,t.apiVersion)}))},e=>{let t;const n=n=>{const s=[e.$root,e.get("layerManager").getEl()];fs||(fs=window.matchMedia("(prefers-color-scheme: dark)")),"auto"===n?(t||(t=e=>ks(s,e.matches),fs.addEventListener("change",t)),ks(s,fs.matches)):(t&&(fs.removeEventListener("change",t),t=void 0),ks(s,n))};e.watchConf(["darkMode"],(e=>n(e.darkMode))),e.on("created",(()=>n(e.conf.darkMode))),e.on("unmounted",(()=>{t&&(null==fs||fs.removeEventListener("change",t)),t=void 0}))}]];function vs(e){return k(this,null,(function*(){var t;const n=[],s=t=>{t.forEach((t=>{"function"!=typeof t||n.includes(t)||(t(e),n.push(t))}))};s(ys);const{data:i}=yield e.getApi().conf.conf().catch((t=>{throw function(e,t){var n;let s="";if(null==(n=t.data)?void 0:n.err_no_site){const t={create_name:e.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};s=`sites|${JSON.stringify(t)}`}ss({$err:e.get("list").$el,errMsg:t.msg||String(t),errData:t.data,retryFn:()=>vs(e),onOpenSidebar:e.get("user").getData().isAdmin?()=>e.showSidebar({view:s}):void 0})}(e,t),t}));let r={apiVersion:null==(t=i.version)?void 0:t.version};if(e.conf.useBackendConf){if(!i.frontend_conf)throw new Error("The remote backend does not respond to the frontend conf, but `useBackendConf` conf is enabled");r=u(u({},r),function(e){const t=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(e).forEach((n=>{t.includes(n)&&delete e[n]})),e.emoticons&&"string"==typeof e.emoticons&&(e.emoticons=e.emoticons.trim(),e.emoticons.startsWith("[")||e.emoticons.startsWith("{")?e.emoticons=JSON.parse(e.emoticons):"false"===e.emoticons&&(e.emoticons=!1)),e}(i.frontend_conf))}e.conf.remoteConfModifier&&e.conf.remoteConfModifier(r),r.pluginURLs&&(yield function(e,t){return k(this,null,(function*(){if(!e||!Array.isArray(e))return[];const n=[];return e.forEach((e=>{/^(http|https):\/\//.test(e)||(e=`${t.replace(/\/$/,"")}/${e.replace(/^\//,"")}`),n.push(new Promise(((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const s=document.createElement("script");s.src=e,document.head.appendChild(s),s.onload=()=>t(),s.onerror=e=>n(e)})))})),yield Promise.all(n),Object.values(window.ArtalkPlugins||{})}))}(r.pluginURLs,e.conf.server).then((e=>{s(e)})).catch((e=>{console.error("Failed to load plugin",e)}))),e.trigger("created"),e.updateConf(r),e.trigger("mounted"),e.conf.remoteConfModifier||e.fetch({offset:0})}))}class $s{constructor(e){g(this,"ctx");const t=Qt(e,!0);this.ctx=new Kt(t),Object.entries(es).forEach((([e,t])=>{const n=t(this.ctx);n&&this.ctx.inject(e,n)})),vs(this.ctx)}getConf(){return this.ctx.getConf()}getEl(){return this.ctx.$root}update(e){return this.ctx.updateConf(e),this}reload(){this.ctx.reload()}destroy(){for(this.ctx.trigger("unmounted");this.ctx.$root.firstChild;)this.ctx.$root.removeChild(this.ctx.$root.firstChild)}on(e,t){this.ctx.on(e,t)}off(e,t){this.ctx.off(e,t)}trigger(e,t){this.ctx.trigger(e,t)}setDarkMode(e){this.ctx.setDarkMode(e)}static init(e){return new $s(e)}static use(e){ys.includes(e)||ys.push(e)}static loadCountWidget(e){const t=Qt(e,!0);ts({getApi:()=>new C(Vt(t)),siteName:t.site,countEl:t.countEl,pvEl:t.pvEl,pvAdd:!1})}get $root(){return this.ctx.$root}get conf(){return this.ctx.getConf()}}const bs=$s.init,ws=$s.use,xs=$s.loadCountWidget;e.default=$s,e.init=bs,e.loadCountWidget=xs,e.use=ws,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); + */let v=class extends y{constructor(){super(...arguments),g(this,"cache",{flushCache:(e={})=>this.request(u({path:"/cache/flush",method:"POST",secure:!0,format:"json"},e)),warmUpCache:(e={})=>this.request(u({path:"/cache/warm_up",method:"POST",secure:!0,format:"json"},e))}),g(this,"captcha",{getCaptcha:(e={})=>this.request(u({path:"/captcha",method:"GET",format:"json"},e)),getCaptchaStatus:(e={})=>this.request(u({path:"/captcha/status",method:"GET",format:"json"},e)),verifyCaptcha:(e,t={})=>this.request(u({path:"/captcha/verify",method:"POST",body:e,type:"application/json",format:"json"},t))}),g(this,"comments",{getComments:(e,t={})=>this.request(u({path:"/comments",method:"GET",query:e,secure:!0,type:"application/json",format:"json"},t)),createComment:(e,t={})=>this.request(u({path:"/comments",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),getComment:(e,t={})=>this.request(u({path:`/comments/${e}`,method:"GET",type:"application/json",format:"json"},t)),updateComment:(e,t,n={})=>this.request(u({path:`/comments/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deleteComment:(e,t={})=>this.request(u({path:`/comments/${e}`,method:"DELETE",secure:!0,format:"json"},t))}),g(this,"conf",{conf:(e={})=>this.request(u({path:"/conf",method:"GET",format:"json"},e)),getDomain:(e,t={})=>this.request(u({path:"/conf/domain",method:"GET",query:e,format:"json"},t))}),g(this,"notifies",{getNotifies:(e,t={})=>this.request(u({path:"/notifies",method:"GET",query:e,type:"application/json",format:"json"},t)),markAllNotifyRead:(e,t={})=>this.request(u({path:"/notifies/read",method:"POST",body:e,type:"application/json",format:"json"},t)),markNotifyRead:(e,t,n={})=>this.request(u({path:`/notifies/${e}/${t}`,method:"POST",format:"json"},n))}),g(this,"pages",{getPages:(e,t={})=>this.request(u({path:"/pages",method:"GET",query:e,secure:!0,type:"application/json",format:"json"},t)),fetchAllPages:(e,t={})=>this.request(u({path:"/pages/fetch",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),getPageFetchStatus:(e={})=>this.request(u({path:"/pages/fetch/status",method:"GET",secure:!0,format:"json"},e)),logPv:(e,t={})=>this.request(u({path:"/pages/pv",method:"POST",body:e,type:"application/json",format:"json"},t)),updatePage:(e,t,n={})=>this.request(u({path:`/pages/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deletePage:(e,t={})=>this.request(u({path:`/pages/${e}`,method:"DELETE",secure:!0,format:"json"},t)),fetchPage:(e,t={})=>this.request(u({path:`/pages/${e}/fetch`,method:"POST",secure:!0,type:"application/json",format:"json"},t))}),g(this,"sendEmail",{sendEmail:(e,t={})=>this.request(u({path:"/send_email",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t))}),g(this,"settings",{getSettings:(e={})=>this.request(u({path:"/settings",method:"GET",secure:!0,format:"json"},e)),applySettings:(e,t={})=>this.request(u({path:"/settings",method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},t)),getSettingsTemplate:(e,t={})=>this.request(u({path:`/settings/template/${e}`,method:"GET",secure:!0,format:"json"},t))}),g(this,"sites",{getSites:(e={})=>this.request(u({path:"/sites",method:"GET",secure:!0,format:"json"},e)),createSite:(e,t={})=>this.request(u({path:"/sites",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),updateSite:(e,t,n={})=>this.request(u({path:`/sites/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deleteSite:(e,t={})=>this.request(u({path:`/sites/${e}`,method:"DELETE",secure:!0,format:"json"},t))}),g(this,"stats",{getStats:(e,t,n={})=>this.request(u({path:`/stats/${e}`,method:"GET",query:t,type:"application/json",format:"json"},n))}),g(this,"transfer",{exportArtrans:(e={})=>this.request(u({path:"/transfer/export",method:"GET",secure:!0,format:"json"},e)),importArtrans:(e,t={})=>this.request(u({path:"/transfer/import",method:"POST",body:e,secure:!0,type:"application/json"},t)),uploadArtrans:(e,t={})=>this.request(u({path:"/transfer/upload",method:"POST",body:e,secure:!0,type:"multipart/form-data",format:"json"},t))}),g(this,"upload",{upload:(e,t={})=>this.request(u({path:"/upload",method:"POST",body:e,secure:!0,type:"multipart/form-data",format:"json"},t))}),g(this,"user",{getUser:(e,t={})=>this.request(u({path:"/user",method:"GET",query:e,secure:!0,format:"json"},t)),login:(e,t={})=>this.request(u({path:"/user/access_token",method:"POST",body:e,type:"application/json",format:"json"},t)),getUserStatus:(e,t={})=>this.request(u({path:"/user/status",method:"GET",query:e,secure:!0,format:"json"},t))}),g(this,"users",{createUser:(e,t={})=>this.request(u({path:"/users",method:"POST",body:e,secure:!0,type:"application/json",format:"json"},t)),updateUser:(e,t,n={})=>this.request(u({path:`/users/${e}`,method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},n)),deleteUser:(e,t={})=>this.request(u({path:`/users/${e}`,method:"DELETE",secure:!0,format:"json"},t)),getUsers:(e,t,n={})=>this.request(u({path:`/users/${e}`,method:"GET",query:t,secure:!0,type:"application/json",format:"json"},n))}),g(this,"version",{getVersion:(e={})=>this.request(u({path:"/version",method:"GET",format:"json"},e))}),g(this,"votes",{syncVotes:(e={})=>this.request(u({path:"/votes/sync",method:"POST",secure:!0,format:"json"},e)),vote:(e,t,n,s={})=>this.request(u({path:`/votes/${e}/${t}`,method:"POST",body:n,type:"application/json",format:"json"},s))})}};var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}!function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;nk(this,null,(function*(){const s=e.getApiToken&&e.getApiToken(),i=new Headers(u({Authorization:s?`Bearer ${s}`:""},null==n?void 0:n.headers));i.get("Authorization")||i.delete("Authorization");const r=yield fetch(t,p(u({},n),{headers:i}));if(!r.ok){const s=(yield r.json().catch((()=>{})))||{};let i=!1;if(e.handlers&&(yield e.handlers.get().reduce(((e,t)=>k(this,null,(function*(){yield e,!0===s[t.action]&&(yield t.handler(s),i=!0)}))),Promise.resolve())),i)return w(e,t,n);throw function(e,t){const n=new x;return n.message=t.msg||t.message||"fetch error",n.code=e,n.data=t,console.error(n),n}(r.status,s)}return r}));class x extends Error{constructor(){super(...arguments),g(this,"code",0),g(this,"message","fetch error"),g(this,"data")}}class C extends v{constructor(e){super({baseUrl:e.baseURL,customFetch:(t,n)=>w(e,t,n)}),g(this,"_opts"),this._opts=e}getUserFields(){const e=this._opts.userInfo;if((null==e?void 0:e.name)&&(null==e?void 0:e.email))return{name:e.name,email:e.email}}}function E(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let S={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function T(e){S=e}const A=/[&<>"']/,L=new RegExp(A.source,"g"),R=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,P=new RegExp(R.source,"g"),M={"&":"&","<":"<",">":">",'"':""","'":"'"},O=e=>M[e];function I(e,t){if(t){if(A.test(e))return e.replace(L,O)}else if(R.test(e))return e.replace(P,O);return e}const _=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const U=/(^|[^\[])\^/g;function q(e,t){let n="string"==typeof e?e:e.source;t=t||"";const s={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(U,"$1"),n=n.replace(e,i),s},getRegex:()=>new RegExp(n,t)};return s}function B(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(t){return null}return e}const j={exec:()=>null};function D(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,i=t;for(;--i>=0&&"\\"===n[i];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:F(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=F(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=F(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,i={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="",a="",l=!1;for(;e;){let n=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],d=0;this.options.pedantic?(d=2,a=s.trimStart()):(d=t[2].search(/[^ ]/),d=d>4?1:d,a=s.slice(d),d+=t[1].length);let h=!1;if(!s&&/^ *$/.test(c)&&(o+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),i=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),i.test(c))break;if(r.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=d||!c.trim())a+="\n"+c.slice(d);else{if(h)break;if(s.search(/[^ ]/)>=4)break;if(i.test(s))break;if(r.test(s))break;if(n.test(s))break;a+="\n"+c}h||c.trim()||(h=!0),o+=l+"\n",e=e.substring(l.length+1),s=c.slice(d)}}i.loose||(l?i.loose=!0:/\n *\n *$/.test(o)&&(l=!0));let u,p=null;this.options.gfm&&(p=/^\[[ xX]\] /.exec(a),p&&(u="[ ] "!==p[0],a=a.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:o,task:!!p,checked:u,loose:!1,text:a,tokens:[]}),i.raw+=o}i.items[i.items.length-1].raw=o.trimEnd(),i.items[i.items.length-1].text=a.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=D(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const e of s)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of n)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of i)r.rows.push(D(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:I(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=F(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),N(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return N(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let i,r,o=n,a=0;const l="*"===s[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=l.exec(t));){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(r=[...i].length,s[3]||s[4]){o+=r;continue}if((s[5]||s[6])&&n%3&&!((n+r)%3)){a+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o+a);const t=[...s[0]][0].length,l=e.slice(0,n+s.index+t+r);if(Math.min(n,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=I(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=I(t[1]),n="mailto:"+e):(e=I(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var t,n;let s;if(s=this.rules.inline.url.exec(e)){let e,i;if("@"===s[2])e=I(s[0]),i="mailto:"+e;else{let r;do{r=s[0],s[0]=null!=(n=null==(t=this.rules.inline._backpedal.exec(s[0]))?void 0:t[0])?n:""}while(r!==s[0]);e=I(s[0]),i="www."===s[1]?"http://"+s[0]:s[0]}return{type:"link",raw:s[0],text:e,href:i,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:I(t[0]),{type:"text",raw:t[0],text:e}}}}const z=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,H=/(?:[*+-]|\d{1,9}[.)])/,Q=q(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,H).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),V=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,G=/(?!\s*\])(?:\\.|[^\[\]\\])+/,K=q(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",G).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Z=q(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,H).getRegex(),Y="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",X=/|$))/,J=q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",X).replace("tag",Y).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ee=q(V).replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex(),te={blockquote:q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ee).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:K,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:z,html:J,lheading:Q,list:Z,newline:/^(?: *(?:\n|$))+/,paragraph:ee,table:j,text:/^[^\n]+/},ne=q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex(),se=p(u({},te),{table:ne,paragraph:q(V).replace("hr",z).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ne).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Y).getRegex()}),ie=p(u({},te),{html:q("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",X).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q(V).replace("hr",z).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Q).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),re=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,oe=/^( {2,}|\\)\n(?!\s*$)/,ae="\\p{P}\\p{S}",le=q(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ae).getRegex(),ce=q(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ae).getRegex(),de=q("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ae).getRegex(),he=q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ae).getRegex(),ue=q(/\\([punct])/,"gu").replace(/punct/g,ae).getRegex(),pe=q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ge=q(X).replace("(?:--\x3e|$)","--\x3e").getRegex(),me=q("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ge).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),fe=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ke=q(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",fe).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ye=q(/^!?\[(label)\]\[(ref)\]/).replace("label",fe).replace("ref",G).getRegex(),ve=q(/^!?\[(ref)\](?:\[\])?/).replace("ref",G).getRegex(),$e={_backpedal:j,anyPunctuation:ue,autolink:pe,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:oe,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:j,emStrongLDelim:ce,emStrongRDelimAst:de,emStrongRDelimUnd:he,escape:re,link:ke,nolink:ve,punctuation:le,reflink:ye,reflinkSearch:q("reflink|nolink(?!\\()","g").replace("reflink",ye).replace("nolink",ve).getRegex(),tag:me,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(i=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i)))s=t[t.length-1],r&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),r=i.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,i,r,o,a,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),o=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class Te{constructor(e){g(this,"options"),this.options=e||S}code(e,t,n){var s;const i=null==(s=(t||"").match(/^\S*/))?void 0:s[0];return e=e.replace(/\n$/,"")+"\n",i?'
      '+(n?e:I(e,!0))+"
      \n":"
      "+(n?e:I(e,!0))+"
      \n"}blockquote(e){return`
      \n${e}
      \n`}html(e,t){return e}heading(e,t,n){return`${e}\n`}hr(){return"
      \n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e,t,n){return`
    • ${e}
    • \n`}checkbox(e){return"'}paragraph(e){return`

      ${e}

      \n`}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
      \n"}tablerow(e){return`\n${e}\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
      "}del(e){return`${e}`}link(e,t,n){const s=B(e);if(null===s)return n;let i='
      ",i}image(e,t,n){const s=B(e);if(null===s)return n;let i=`${n}"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")));continue}case"code":{const e=i;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=i;let t="",s="";for(let n=0;n0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(t.tokens,r),o+=this.renderer.listitem(a,i,!!s)}n+=this.renderer.list(o,t,s);continue}case"html":{const e=i;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=i;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=i,o=r.tokens?this.parseInline(r.tokens):r.text;for(;s+1{const o=u({},r),a=u(u({},this.defaults),o);!0===this.defaults.async&&!1===o.async&&(a.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),a.async=!0);const l=f(this,s,i).call(this,!!a.silent,!!a.async);if(null==n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then((t=>e(t,a))).then((e=>a.hooks?a.hooks.processAllTokens(e):e)).then((e=>a.walkTokens?Promise.all(this.walkTokens(e,a.walkTokens)).then((()=>e)):e)).then((e=>t(e,a))).then((e=>a.hooks?a.hooks.postprocess(e):e)).catch(l);try{a.hooks&&(n=a.hooks.preprocess(n));let s=e(n,a);a.hooks&&(s=a.hooks.processAllTokens(s)),a.walkTokens&&this.walkTokens(s,a.walkTokens);let i=t(s,a);return a.hooks&&(i=a.hooks.postprocess(i)),i}catch(c){return l(c)}}},s=new WeakSet,i=function(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

      An error occurred:

      "+I(n.message+"",!0)+"
      ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}};const Pe=new class{constructor(...e){m(this,t),m(this,s),g(this,"defaults",{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}),g(this,"options",this.setOptions),g(this,"parse",f(this,t,n).call(this,Se.lex,Le.parse)),g(this,"parseInline",f(this,t,n).call(this,Se.lexInline,Le.parseInline)),g(this,"Parser",Le),g(this,"Renderer",Te),g(this,"TextRenderer",Ae),g(this,"Lexer",Se),g(this,"Tokenizer",W),g(this,"Hooks",Re),this.use(...e)}walkTokens(e,t){var n,s;let i=[];for(const r of e)switch(i=i.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const n of e.header)i=i.concat(this.walkTokens(n.tokens,t));for(const n of e.rows)for(const e of n)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=r;(null==(s=null==(n=this.defaults.extensions)?void 0:n.childTokens)?void 0:s[e.type])?this.defaults.extensions.childTokens[e.type].forEach((n=>{const s=e[n].flat(1/0);i=i.concat(this.walkTokens(s,t))})):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n=u({},e);if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new Te(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if("options"===n)continue;const s=n,i=e.renderer[s],r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new W(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const s=n,i=e.tokenizer[s],r=t[s];t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Re;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const s=n,i=e.hooks[s],r=t[s];Re.passThroughHooks.has(n)?t[s]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>r.call(t,e)));const n=i.call(t,e);return r.call(t,n)}:t[s]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults=u(u({},this.defaults),n)})),this}setOptions(e){return this.defaults=u(u({},this.defaults),e),this}lexer(e,t){return Se.lex(e,null!=t?t:this.defaults)}parser(e,t){return Le.parse(e,null!=t?t:this.defaults)}};function Me(e,t){return Pe.parse(e,t)}Me.options=Me.setOptions=function(e){return Pe.setOptions(e),Me.defaults=Pe.defaults,T(Me.defaults),Me},Me.getDefaults=E,Me.defaults=S,Me.use=function(...e){return Pe.use(...e),Me.defaults=Pe.defaults,T(Me.defaults),Me},Me.walkTokens=function(e,t){return Pe.walkTokens(e,t)},Me.parseInline=Pe.parseInline,Me.Parser=Le,Me.parser=Le.parse,Me.Renderer=Te,Me.TextRenderer=Ae,Me.Lexer=Se,Me.lexer=Se.lex,Me.Tokenizer=W,Me.Hooks=Re,Me.parse=Me,Me.options,Me.setOptions,Me.use,Me.walkTokens,Me.parseInline,Le.parse,Se.lex;var Oe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ie={"&":"&","<":"<",">":">",""":'"',"'":"'"},_e=/(&|<|>|"|')/g,Ue=/[&<>"']/g;function qe(e){return Oe[e]}function Be(e){return Ie[e]}function je(e){return null==e?"":String(e).replace(Ue,qe)}function De(e){return null==e?"":String(e).replace(_e,Be)}je.options=De.options={};var Fe={encode:je,escape:je,decode:De,unescape:De,version:"1.0.0-browser"};var Ne=function e(t){for(var n,s,i=Array.prototype.slice.call(arguments,1);i.length;)for(s in n=i.shift())n.hasOwnProperty(s)&&("[object Object]"===Object.prototype.toString.call(t[s])?t[s]=e(t[s],n[s]):t[s]=n[s]);return t},We=function(e){return"string"==typeof e?e.toLowerCase():e};function ze(e,t){return e[t]=!0,e}var He=function(e){return e.reduce(ze,{})},Qe={uris:He(["background","base","cite","href","longdesc","src","usemap"])},Ve={voids:He(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},Ge=Fe,Ke=We,Ze=Ve,Ye=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,Xe=/^<\s*\/\s*([\w:-]+)[^>]*>/,Je=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,et=/^=0&&(t.comment&&t.comment(e.substring(4,s)),e=e.substring(s+3),n=!1):tt.test(e)?o(Xe,l):et.test(e)&&o(Ye,a);var s;!function(){if(!n)return;var s,i=e.indexOf("<");i>=0?(s=e.substring(0,i),e=e.substring(i)):(s=e,e="");t.chars&&t.chars(s)}()}();var s=e===i;i=e,s&&(e="")}function o(t,s){var i=e.match(t);i&&(e=e.substring(i[0].length),i[0].replace(t,s),n=!1)}function a(e,n,i,r){var o={},a=Ke(n),l=Ze.voids[a]||!!r;i.replace(Je,(function(e,t,n,s,i){o[t]=void 0===n&&void 0===s&&void 0===i?void 0:Ge.decode(n||s||i||"")})),l||s.push(a),t.start&&t.start(a,o,l)}function l(e,n){var i,r=0,o=Ke(n);if(o)for(r=s.length-1;r>=0&&s[r]!==o;r--);if(r>=0){for(i=s.length-1;i>=r;i--)t.end&&t.end(s[i]);s.length=r}}l()},lt=function(e,t){var n,s=t||{};return a(),{start:function(e,t,o){var a=st(e);if(n.ignoring)return void r(a);if(-1===(s.allowedTags||[]).indexOf(a))return void r(a);if(s.filter&&!s.filter({tag:a,attrs:t}))return void r(a);i("<"),i(a),Object.keys(t).forEach((function(e){var n=t[e],r=(s.allowedClasses||{})[a]||[],o=(s.allowedAttributes||{})[a]||[],l=st(e);("class"===l&&-1===o.indexOf(l)?(n=n.split(" ").filter((function(e){return r&&-1!==r.indexOf(e)})).join(" ").trim()).length:-1!==o.indexOf(l)&&(!0!==it.uris[l]||function(e){var t=e[0];if("#"===t||"/"===t)return!0;var n=e.indexOf(":");if(-1===n)return!0;var i=e.indexOf("?");if(-1!==i&&n>i)return!0;var r=e.indexOf("#");return-1!==r&&n>r||s.allowedSchemes.some(o);function o(t){return 0===e.indexOf(t+":")}}(n)))&&(i(" "),i(e),"string"==typeof n&&(i('="'),i(nt.encode(n)),i('"')))})),i(o?"/>":">")},end:function(e){var t=st(e);-1!==(s.allowedTags||[]).indexOf(t)&&!1===n.ignoring?(i("")):o(t)},chars:function(e){!1===n.ignoring&&i(s.transformText?s.transformText(e):e)}};function i(t){e.push(t)}function r(e){rt.voids[e]||(!1===n.ignoring?n={ignoring:e,depth:1}:n.ignoring===e&&n.depth++)}function o(e){n.ignoring===e&&--n.depth<=0&&a()}function a(){n={ignoring:!1,depth:0}}},ct={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function dt(e,t,n){var s=[],i=!0===n?t:ot({},ct,t),r=lt(s,i);return at(e,r),s.join("")}dt.defaults=ct;const ht=b(dt),ut={allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:e=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([t,n])=>{e.tag===t&&e.attrs.class&&!n.test(e.attrs.class)&&delete e.attrs.class})),"span"===e.tag&&e.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(e.attrs.style)&&delete e.attrs.style,!0)};function pt(e){return ht(e,ut)}var gt={exports:{}};gt.exports=function(){function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e((function(e){var t=e.exports=function(){return new RegExp("(?:"+t.line().source+")|(?:"+t.block().source+")","gm")};t.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},t.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function s(e){return''+e+""}return function(e,i){void 0===i&&(i={});var r=i.colors;void 0===r&&(r=n);var o=0,a={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+t+"
      ";return o=++o%r.length,l}))}}();const mt=b(gt.exports);function ft(e){return mt(e)}function kt(){const e=new Me.Renderer;return e.link=yt(e,e.link),e.code=vt(),e}const yt=(e,t)=>(n,s,i)=>{const r=null==n?void 0:n.startsWith(`${window.location.protocol}//${window.location.hostname}`);return t.call(e,n,s,i).replace(/^(e,t)=>{const n=t||"plaintext";let s=e;return window.hljs?n&&window.hljs.getLanguage(n)&&(s=window.hljs.highlight(n,e).value):s=ft(e),`
      \n${s.replace(/&/g,"&")}\n
      `};let $t,bt=[];const wt={gfm:!0,breaks:!0,async:!1};function xt(){return $t}function Ct(e){var t;let n=null==(t=xt())?void 0:t.parse(e);n||(n=function(e){return e.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((e,t)=>`
      ${ft(t)}
      `)).replace(/!\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`${t}`)).replace(/\[(.*?)\]\((.*?)\)/g,((e,t,n)=>`
      ${t}`)).replace(/\n/g,"
      ")}(e));let s=pt(n);return bt.forEach((e=>{"function"==typeof e&&(s=e(s))})),s}function Et(...e){const t=e=>e&&"object"==typeof e&&e.constructor===Object;return e.reduce(((e,n)=>(Object.keys(null!=n?n:{}).forEach((s=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=e[s],r=n[s];Array.isArray(i)&&Array.isArray(r)?e[s]=i.concat(...r):t(i)&&t(r)?e[s]=Et(i,r):e[s]=r})),e)),{})}class St{constructor(e){g(this,"loading",!1),g(this,"listLastFetch"),g(this,"comments",[]),g(this,"notifies",[]),g(this,"page"),this.events=e}getLoading(){return this.loading}setLoading(e){this.loading=e}getListLastFetch(){return this.listLastFetch}setListLastFetch(e){this.listLastFetch=e}getComments(){return this.comments}fetchComments(e){this.events.trigger("list-fetch",e)}findComment(e){return this.comments.find((t=>t.id===e))}clearComments(){this.comments=[],this.events.trigger("list-loaded",this.comments)}loadComments(e){this.events.trigger("list-load",e),this.comments.push(...e),this.events.trigger("list-loaded",this.comments)}insertComment(e){this.comments.push(e),this.events.trigger("comment-inserted",e),this.events.trigger("list-loaded",this.comments)}updateComment(e){this.comments=this.comments.map((t=>t.id===e.id?e:t)),this.events.trigger("comment-updated",e),this.events.trigger("list-loaded",this.comments)}deleteComment(e){const t=this.comments.find((t=>t.id===e));if(!t)throw new Error(`Comment ${e} not found`);this.comments=this.comments.filter((t=>t.id!==e)),this.events.trigger("comment-deleted",t),this.events.trigger("list-loaded",this.comments)}getNotifies(){return this.notifies}updateNotifies(e){this.notifies=e,this.events.trigger("notifies-updated",this.notifies)}getPage(){return this.page}updatePage(e){this.page=e,this.events.trigger("page-loaded",e)}}const Tt={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",uploadImage:"Upload Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",emailVerified:"Email has been verified",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly",updateMsg:"Please update Artalk {name} to get the best experience!",currentVersion:"Current Version",ignore:"Ignore",open:"Open",openName:"Open {name}"},At="ArtalkI18n";function Lt(e=""){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstElementChild||t}function Rt(e){const t=document.createElement("div");t.innerText=e;return t.innerHTML}function Pt(e){const t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))}function Mt(e,t){const n=e=>{const t=e.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,s=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+s,left:t.left+n}},s=n(e);if(!t)return s;const i=n(t);return{top:s.top-i.top,left:s.left-i.left}}function Ot(e,t){let n=e.toString();for(;n.lengthe)){try{const n=e.getTime(),s=(new Date).getTime()-n,i=Math.floor(s/864e5);if(0===i){const e=s%864e5,n=Math.floor(e/36e5);if(0===n){const n=e%36e5,s=Math.floor(n/6e4);if(0===s){const e=n%6e4,s=Math.round(e/1e3);return s<10?t("now"):`${s} ${t("seconds")}`}return`${s} ${t("minutes")}`}return`${n} ${t("hours")}`}return i<0?t("now"):i<8?`${i} ${t("days")}`:function(e){const t=Ot(e.getDate(),2),n=Ot(e.getMonth()+1,2);return`${Ot(e.getFullYear(),2)}-${n}-${t}`}(e)}catch(n){return console.error(n)," - "}}function _t(){return k(this,null,(function*(){const e=navigator.userAgent;if(!navigator.userAgentData||!navigator.userAgentData.getHighEntropyValues)return e;const t=navigator.userAgentData;let n=null;try{n=yield t.getHighEntropyValues(["platformVersion"])}catch(i){return console.error(i),e}const s=Number(n.platformVersion.split(".")[0]);return"Windows"===t.platform&&s>=13?e.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===t.platform&&s>=11?e.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):e}))}function Ut(e){let t;try{t=new URL(e)}catch(n){return!1}return"http:"===t.protocol||"https:"===t.protocol}function qt(e){return t=e.base,n=e.path,`${t.replace(/\/$/,"")}/${n.replace(/^\//,"")}`;var t,n}const Bt={en:Tt,"en-US":Tt,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送",save:"保存",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",uploadImage:"上传图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",emailVerified:"邮箱已验证",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止",updateMsg:"请更新 Artalk {name} 以获得更好的体验!",currentVersion:"当前版本",ignore:"忽略",open:"打开",openName:"打开{name}"}};function jt(e){return e=e.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((e,t,n)=>t.toLowerCase()+(n||"").toUpperCase())),Bt[e]?Bt[e]:window[At]&&window[At][e]?window[At][e]:Bt.en}let Dt="en",Ft=jt(Dt);function Nt(e){e!==Dt&&(Dt=e,Ft="string"==typeof e?jt(e):e)}function Wt(e,t={}){let n=(null==Ft?void 0:Ft[e])||e;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((e,n)=>t[n]||"")),Rt(n)}class zt{constructor(){g(this,"events",[])}on(e,t,n={}){this.events.push(u({name:e,handler:t},n))}off(e,t){t&&(this.events=this.events.filter((n=>!(n.name===e&&n.handler===t))))}trigger(e,t){this.events.slice(0).filter((t=>t.name===e&&"function"==typeof t.handler)).forEach((n=>{n.once&&this.off(e,n.handler),n.handler(t)}))}}const Ht={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"en"};function Qt(e,t=!1){const n=t?Et(Ht,e):e;if(n.el&&"string"==typeof n.el)try{const e=document.querySelector(n.el);if(!e)throw Error(`Target element "${n.el}" was not found.`);n.el=e}catch(s){throw console.error(s),new Error("Please check your Artalk `el` config.")}return""===n.pageKey&&(n.pageKey=`${window.location.pathname}`),""===n.pageTitle&&(n.pageTitle=`${document.title}`),n.server&&(n.server=n.server.replace(/\/$/,"").replace(/\/api\/?$/,"")),"auto"===n.locale&&(n.locale=navigator.language),"auto"===n.flatMode&&(n.flatMode=window.matchMedia("(max-width: 768px)").matches),"number"==typeof n.nestMax&&Number(n.nestMax)<=1&&(n.flatMode=!0),n}function Vt(e,t){return{baseURL:`${e.server}/api/v2`,siteName:e.site||"",pageKey:e.pageKey||"",pageTitle:e.pageTitle||"",timeout:e.reqTimeout,getApiToken:()=>null==t?void 0:t.get("user").getData().token,userInfo:(null==t?void 0:t.get("user").checkHasBasicUserInfo())?{name:null==t?void 0:t.get("user").getData().nick,email:null==t?void 0:t.get("user").getData().email}:void 0,handlers:null==t?void 0:t.getApiHandlers()}}function Gt(e,t,n){let s=null;const i=()=>{const i=(()=>{const n=e.getConf(),s={};return t.forEach((e=>{s[e]=n[e]})),s})();var r,o;(null==s||(r=s,o=i,!(JSON.stringify(r)===JSON.stringify(o))))&&(s=i,n(i))};e.on("mounted",i),e.on("updated",i)}class Kt{constructor(e){g(this,"conf"),g(this,"data"),g(this,"$root"),g(this,"events",new zt),g(this,"mounted",!1),g(this,"apiHandlers",null),g(this,"getCommentList",this.getCommentNodes),g(this,"getCommentDataList",this.getComments),this.conf=e,this.$root=e.el,this.$root.classList.add("artalk"),this.$root.innerHTML="",this.data=new St(this.events),this.on("mounted",(()=>{this.mounted=!0}))}inject(e,t){this[e]=t}get(e){return this[e]}getApi(){return new C(Vt(this.conf,this))}getApiHandlers(){return this.apiHandlers||(this.apiHandlers=function(e){const t=function(){const e=[];return{add:(t,n)=>{e.push({action:t,handler:n})},get:()=>e}}();return t.add("need_captcha",(t=>e.checkCaptcha(t))),t.add("need_login",(()=>e.checkAdmin({}))),t}(this)),this.apiHandlers}getData(){return this.data}replyComment(e,t){this.editor.setReply(e,t)}editComment(e,t){this.editor.setEditComment(e,t)}fetch(e){this.data.fetchComments(e)}reload(){this.data.fetchComments({offset:0})}listGotoFirst(){this.events.trigger("list-goto-first")}getCommentNodes(){return this.list.getCommentNodes()}getComments(){return this.data.getComments()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(e,t){this.editor.showNotify(e,t)}editorResetState(){this.editor.resetState()}showSidebar(e){this.sidebarLayer.show(e)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(e){return this.checkerLauncher.checkAdmin(e)}checkCaptcha(e){return this.checkerLauncher.checkCaptcha(e)}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}trigger(e,t){this.events.trigger(e,t)}$t(e,t={}){return Wt(e,t)}setDarkMode(e){this.updateConf({darkMode:e})}updateConf(e){this.conf=Et(this.conf,Qt(e,!1)),this.mounted&&this.events.trigger("updated",this.conf)}getConf(){return this.conf}getEl(){return this.$root}getMarked(){return xt()}watchConf(e,t){Gt(this,e,t)}}class Zt{constructor(e){g(this,"$el"),g(this,"$content"),g(this,"$actions"),this.$el=Lt('
      \n
      \n
      \n
      \n
      \n
      '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(e)}setYes(e){const t=Lt(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}setNo(e){const t=Lt(``);return t.onclick=this.onBtnClick(e),this.$actions.appendChild(t),this}onBtnClick(e){return t=>{const n=e(t.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function Yt(e,t){let n=e.querySelector(":scope > .atk-loading");n||(n=Lt(''),(null==t?void 0:t.transparentBg)&&(n.style.background="transparent"),e.appendChild(n)),n.style.display="";const s=n.querySelector(".atk-loading-spinner");s&&(s.style.display="none",window.setTimeout((()=>{s.isConnected&&(s.style.display="")}),500))}function Xt(e){const t=e.querySelector(":scope > .atk-loading");t&&(t.style.display="none")}function Jt(e,t){e?Yt(t):Xt(t)}function en(e,t=!0,n){let s;if(n){const t=n.getBoundingClientRect();s=e.getBoundingClientRect().top-t.top+n.scrollTop-n.clientHeight/2+e.clientHeight/2}else{const t=e.getBoundingClientRect();s=t.top+window.scrollY-(window.innerHeight/2-t.height/2)}const i={top:s,left:0,behavior:"instant"};n?n.scroll(i):window.scroll(i)}function tn(e,t){!function(e,t,n="in"){e.classList.add(`atk-fade-${n}`);const s=()=>{e.classList.remove(`atk-fade-${n}`),e.removeEventListener("animationend",s),t&&t()};e.addEventListener("animationend",s)}(e,t,"in")}function nn(e,t,n='Artalk Error'){let s=e.querySelector(".atk-error-layer");if(null===t)return void(null!==s&&s.remove());s||(s=Lt(`
      ${n}
      `),e.appendChild(s));const i=s.querySelector(".atk-error-text");i.innerHTML="",null!==t&&(t instanceof HTMLElement?i.appendChild(t):i.innerText=t)}function sn(e){const t=Lt('
      '),n=Lt('');n.style.display="none",Yt(t,{transparentBg:!0}),n.src=e.getOpts().getCaptchaIframeURL(),n.onload=()=>{n.style.display="",Xt(t)},t.append(n);const s=Lt('
      ');t.append(s),e.hideInteractInput();let i=!1;return function t(){return k(this,null,(function*(){var n;if(yield(n=1e3,new Promise((e=>{window.setTimeout((()=>{e(null)}),n)}))),i)return;let s=!1;try{s=(yield e.getApi().captcha.getCaptchaStatus()).data.is_pass}catch(r){s=!1}s?e.triggerSuccess():t()}))}(),s.onclick=()=>{i=!0,e.cancel()},t}const rn={request:(e,t)=>e.getApi().captcha.verifyCaptcha({value:t}),body:e=>e.get("iframe")?sn(e):function(e){const t=Lt(`${Wt("captchaCheck")}`);return t.querySelector(".atk-captcha-img").onclick=()=>{const n=t.querySelector(".atk-captcha-img");e.getApi().captcha.getCaptcha().then((e=>{n.setAttribute("src",e.data.img_data)})).catch((e=>{console.error("Failed to get captcha image ",e)}))},t}(e),onSuccess(e,t,n,s){e.set("val",n)},onError(e,t,n,s){s.querySelector(".atk-captcha-img").click(),s.querySelector('input[type="text"]').value=""}},on={inputType:"password",request(e,t){return k(this,null,(function*(){return(yield e.getApi().user.login({name:e.getUser().getData().nick,email:e.getUser().getData().email,password:t})).data}))},body:e=>Lt(`${Wt("adminCheck")}`),onSuccess(e,t,n,s){e.getUser().update({isAdmin:!0,token:t.token}),e.getOpts().onReload()},onError(e,t,n,s){}};function an(e){return t=>new Promise(((n,s)=>{const i=t.onCancel;t.onCancel=()=>{i&&i(),s(new Error("user canceled the checker"))};const r=t.onSuccess;t.onSuccess=()=>{r&&r(),n()},e(t)}))}class ln{constructor(e){g(this,"checkCaptcha",an((e=>{this.fire(rn,e,(t=>{t.set("img_data",e.img_data),t.set("iframe",e.iframe)}))}))),g(this,"checkAdmin",an((e=>{this.fire(on,e)}))),this.opts=e}fire(e,t,n){const s=this.opts.getCtx().get("layerManager").create(`checker-${(new Date).getTime()}`);s.show();const i=()=>{s.destroy()},r={};let o=!1;const a={set:(e,t)=>{r[e]=t},get:e=>r[e],getOpts:()=>this.opts,getUser:()=>this.opts.getCtx().get("user"),getApi:()=>this.opts.getApi(),hideInteractInput:()=>{o=!0},triggerSuccess:()=>{i(),e.onSuccess&&e.onSuccess(a,"","",l),t.onSuccess&&t.onSuccess()},cancel:()=>{i(),t.onCancel&&t.onCancel()}};n&&n(a);const l=Lt();l.appendChild(e.body(a));const c=Lt(``);let d;l.appendChild(c),setTimeout((()=>c.focus()),80),c.onkeyup=e=>{"Enter"!==e.key&&13!==e.keyCode||(e.preventDefault(),s.getEl().querySelector('button[data-action="confirm"]').click())};const h=new Zt(l);h.setYes((n=>{const s=c.value.trim();d||(d=n.innerText);const r=()=>{n.innerText=d||"",n.classList.remove("error")};return n.innerText=`${Wt("loading")}...`,e.request(a,s).then((n=>{i(),e.onSuccess&&e.onSuccess(a,n,s,l),t.onSuccess&&t.onSuccess()})).catch((t=>{var i;i=String(t.message||String(t)),n.innerText=i,n.classList.add("error"),e.onError&&e.onError(a,t,s,l);const o=setTimeout((()=>r()),3e3);c.onfocus=()=>{r(),clearTimeout(o)}})),!1})),h.setNo((()=>(i(),t.onCancel&&t.onCancel(),!1))),o&&(c.style.display="none",h.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),s.getEl().append(h.$el),t.onMount&&t.onMount(h.$el)}}class cn{constructor(e){g(this,"$el"),this.ctx=e}get conf(){return this.ctx.conf}getEl(){return this.$el}}const dn={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$bottomLeft:".atk-bottom-left",$stateWrap:".atk-state-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class hn{constructor(e){this.kit=e}useBtn(e="
      "){return this.$btn=Lt(`${e}`),this.$btn}usePanel(e="
      "){return this.$panel=Lt(e),this.$panel}useContentTransformer(e){this.contentTransformer=e}usePanelShow(e){this.kit.useEvents().on("panel-show",(t=>{t===this&&e()}))}usePanelHide(e){this.kit.useEvents().on("panel-hide",(t=>{t===this&&e()}))}useEditorStateEffect(e,t){this.editorStateEffectWhen=e,this.editorStateEffect=t}}class un extends hn{constructor(){super(...arguments),g(this,"isMoved",!1)}move(e){if(this.isMoved)return;this.isMoved=!0;const t=this.kit.useUI().$el;t.after(Lt('
      '));const n=Lt("
      ");e.after(n),n.replaceWith(t),t.classList.add("atk-fade-in"),t.classList.add("editor-traveling")}back(){var e;this.isMoved&&(this.isMoved=!1,null==(e=this.kit.useGlobalCtx().$root.querySelector(".atk-editor-travel-placeholder"))||e.replaceWith(this.kit.useUI().$el),this.kit.useUI().$el.classList.remove("editor-traveling"))}}class pn{constructor(e){g(this,"stateCurt","normal"),g(this,"stateUnmountFn",null),this.editor=e}get(){return this.stateCurt}switch(e,t){var n,s,i,r,o;if(this.stateUnmountFn&&(this.stateUnmountFn(),this.stateUnmountFn=null,null==(s=null==(n=this.editor.getPlugs())?void 0:n.get(un))||s.back()),"normal"!==e&&t){let n=t.$comment;this.editor.conf.flatMode||(n=n.querySelector(".atk-footer")),null==(r=null==(i=this.editor.getPlugs())?void 0:i.get(un))||r.move(n);const s=this.editor.ctx.conf.scrollRelativeTo&&this.editor.ctx.conf.scrollRelativeTo();en(this.editor.getUI().$el,!0,s);const a=null==(o=this.editor.getPlugs())?void 0:o.getPlugs().find((t=>t.editorStateEffectWhen===e));a&&a.editorStateEffect&&(this.stateUnmountFn=a.editorStateEffect(t.comment))}this.stateCurt=e}}class gn extends cn{constructor(e){super(e),g(this,"ui"),g(this,"state"),this.ui=function(){const e=Lt('
      \n
      \n \n \n \n
      \n
      \n \n
      \n \n
      \n
      \n \n \n
      \n
      \n \n
      \n
      \n
      \n
      \n'),t={$el:e};return Object.entries(dn).forEach((([n,s])=>{t[n]=e.querySelector(s)})),t}(),this.$el=this.ui.$el,this.state=new pn(this)}getUI(){return this.ui}getPlugs(){return this.ctx.get("editorPlugs")}getState(){return this.state.get()}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}getContentFinal(){let e=this.getContentRaw();const t=this.getPlugs();return t&&(e=t.getTransformedContent(e)),e}getContentRaw(){return this.ui.$textarea.value||""}getContentMarked(){return Ct(this.getContentFinal())}setContent(e){var t;this.ui.$textarea.value=e,null==(t=this.getPlugs())||t.getEvents().trigger("content-updated",e)}insertContent(e){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=e,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const t=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,s=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,t)+e+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=t+e.length,this.ui.$textarea.selectionEnd=t+e.length,this.ui.$textarea.scrollTop=s}else this.ui.$textarea.focus(),this.ui.$textarea.value+=e}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.resetState()}resetState(){this.state.switch("normal")}setReply(e,t){this.state.switch("reply",{comment:e,$comment:t})}setEditComment(e,t){this.state.switch("edit",{comment:e,$comment:t})}showNotify(e,t){!function(e,t,n){const s=Lt(`
      `);s.querySelector(".atk-notify-content").innerHTML=Rt(t).replace("\n","
      "),e.appendChild(s);const i=()=>{s.classList.add("atk-fade-out"),setTimeout((()=>{s.remove()}),200)};let r;r=window.setTimeout((()=>{i()}),3e3),s.addEventListener("click",(()=>{i(),window.clearTimeout(r)}))}(this.ui.$notifyWrap,e,t)}showLoading(){Yt(this.ui.$el)}hideLoading(){Xt(this.ui.$el)}submit(){const e=()=>this.ctx.trigger("editor-submit");this.ctx.conf.beforeSubmit?this.ctx.conf.beforeSubmit(this,e):e()}}class mn extends cn{constructor(e){super(e),g(this,"layer"),g(this,"$header"),g(this,"$closeBtn"),g(this,"$iframeWrap"),g(this,"$iframe"),g(this,"refreshOnShow",!0),g(this,"animTimer"),this.$el=Lt('
      \n
      \n
      \n
      \n \n
      \n
      \n
      \n
      \n
      \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.refreshOnShow=!0}))}show(){return k(this,arguments,(function*(e={}){if(this.$el.style.transform="",this.initLayer(),this.layer.show(),this.refreshOnShow)this.refreshOnShow=!1,this.$iframeWrap.innerHTML="",this.$iframe=this.createIframe(e.view),this.$iframeWrap.append(this.$iframe);else{const e=this.$iframe,t=e.src;this.conf.darkMode!==t.includes("darkMode=1")&&this.iframeLoad(e,this.conf.darkMode?t.concat("&darkMode=1"):t.replace("&darkMode=1",""))}this.authCheck({onSuccess:()=>this.show(e)}),this.animTimer=setTimeout((()=>{this.animTimer=void 0,this.$el.style.transform="translate(0, 0)",setTimeout((()=>{this.ctx.getData().updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}),100)}))}hide(){var e;null==(e=this.layer)||e.hide()}authCheck(e){return k(this,null,(function*(){const t=(yield this.ctx.getApi().user.getUserStatus(u({},this.ctx.getApi().getUserFields()))).data;t.is_admin&&!t.is_login&&(this.refreshOnShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{e.onSuccess()}),500)},onCancel:()=>{this.hide()}}),this.hide())}))}initLayer(){this.layer||(this.layer=this.ctx.get("layerManager").create("sidebar",this.$el),this.layer.setOnAfterHide((()=>{this.ctx.editorResetState(),this.animTimer&&clearTimeout(this.animTimer),this.$el.style.transform="",this.ctx.trigger("sidebar-hide")})))}createIframe(e){const t=Lt(''),n=qt({base:this.ctx.conf.server,path:"/sidebar/"}),s={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(this.ctx.get("user").getData()),time:+new Date};e&&(s.view=e),this.conf.darkMode&&(s.darkMode="1");const i=new URLSearchParams(s);return this.iframeLoad(t,`${n}?${i.toString()}`),t}iframeLoad(e,t){e.src=t,Yt(this.$iframeWrap),e.onload=()=>{Xt(this.$iframeWrap)}}}const fn=e=>({import:t=>{(function(e,t="DATE_DESC",n=2){const s=[];e.filter((e=>0===e.rid)).forEach((t=>{const i={id:t.id,comment:t,children:[],level:1};i.parent=i,s.push(i),function t(s){const i=e.filter((e=>e.rid===s.id));0!==i.length&&(s.level>=n&&(s=s.parent),i.forEach((e=>{const n={id:e.id,comment:e,children:[],parent:s,level:s.level+1};s.children.push(n),t(n)})))}(i)}));const i=(n,s)=>{let i=n.id-s.id;return"DATE_ASC"===t?i=+new Date(n.comment.date)-+new Date(s.comment.date):"DATE_DESC"===t?i=+new Date(s.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===t?i=e.indexOf(n.comment)-e.indexOf(s.comment):"VOTE_UP_DESC"===t&&(i=s.comment.vote_up-n.comment.vote_up),i};return function e(t){t.forEach((t=>{t.children=t.children.sort(i),e(t.children)}))}(s),s})(t,e.nestSortBy,e.nestMax).forEach((n=>{var s;const i=e.createCommentNode(n.comment);null==(s=e.$commentsWrap)||s.appendChild(i.getEl()),i.getRender().playFadeAnim();const r=(n,s)=>{s.children.forEach((s=>{const i=t.find((e=>e.id===s.comment.rid)),o=s.comment,a=e.createCommentNode(o,i);n.putChild(a),r(a,s)}))};r(i,n),i.getRender().checkHeightLimit()}))},insert:(t,n)=>{var s;const i=e.createCommentNode(t,n);if(0===t.rid)null==(s=e.$commentsWrap)||s.prepend(i.getEl());else{const n=e.findCommentNode(t.rid);n&&(n.putChild(i,"DATE_ASC"===e.nestSortBy?"append":"prepend"),i.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()})))}i.getRender().checkHeightLimit(),i.scrollIntoView(),i.getRender().playFadeAnim()}});function kn(e,t,n,s){n.is_collapsed&&(n.is_allow_reply=!1);const i=e.createCommentNode(n,s);if(n.visible){const n=i.getEl(),s=e.$commentsWrap;"append"===t&&(null==s||s.append(n)),"prepend"===t&&(null==s||s.prepend(n)),i.getRender().playFadeAnim()}return i.getRender().checkHeightLimit(),i}class yn{constructor(e){this.options=e}getStrategy(){return this.options.flatMode?(e=this.options,{import:t=>{t.forEach((n=>{const s=0===n.rid?void 0:t.find((e=>e.id===n.rid));kn(e,"append",n,s)}))},insert:(t,n)=>{kn(e,"prepend",t,n).scrollIntoView()}}):fn(this.options);var e}import(e){this.getStrategy().import(e)}insert(e,t){this.getStrategy().insert(e,t)}}function vn(e,t){t.forEach((({el:t,max:n,imgContains:s})=>{const i=()=>{t&&(e.scrollable?function(e){if(!e.el)return;if(e.el.classList.contains(wn))return;e.el.classList.add(wn),e.el.style.height=`${e.maxHeight}px`}({el:t,maxHeight:n}):function(e){if(!e.el)return;if(!e.maxHeight)return;if(e.el.classList.contains($n))return;e.el.classList.add($n),e.el.style.height=`${e.maxHeight}px`,e.el.style.overflow="hidden";const t=Lt(`
      ${Wt("readMore")}`);t.onclick=t=>{t.stopPropagation(),bn(e.el),e.postBtnClick&&e.postBtnClick(t)},e.el.append(t)}({el:t,maxHeight:n,postBtnClick:e.postExpandBtnClick}))},r=()=>{t&&function(e){return parseFloat(getComputedStyle(e,null).height.replace("px",""))}(t)>n&&i()};r(),s&&t&&function(e,t){if(!e)return;const n=e.getElementsByTagName("img");if(!n.length)return;let s=n.length;for(let i=0;i{s--,0===s&&t()})),0===s&&t()}(t,(()=>r()))}))}const $n="atk-height-limit";function bn(e){e&&e.classList.contains($n)&&(e.classList.remove($n),Array.from(e.children).forEach((e=>{e.classList.contains("atk-height-limit-btn")&&e.remove()})),e.style.height="",e.style.overflow="")}const wn="atk-height-limit-scroll";function xn(e){if(e.$headerNick=e.$el.querySelector(".atk-nick"),e.data.link){const t=Lt('');t.innerText=e.data.nick,t.href=Ut(e.data.link)?e.data.link:`https://${e.data.link}`,e.$headerNick.append(t)}else e.$headerNick.innerText=e.data.nick}function Cn(e){e.$headerBadgeWrap=e.$el.querySelector(".atk-badge-wrap"),e.$headerBadgeWrap.innerHTML="";const t=e.data.badge_name,n=e.data.badge_color;if(t){const s=Lt('');s.innerText=t.replace("管理员",Wt("admin")),s.style.backgroundColor=n||"",e.$headerBadgeWrap.append(s)}else if(e.data.is_verified){const t=Lt(``);e.$headerBadgeWrap.append(t)}if(e.data.is_pinned){const t=Lt(`${Wt("pin")}`);e.$headerBadgeWrap.append(t)}}function En(e){const t=e.$el.querySelector(".atk-date");t.innerText=e.comment.getDateFormatted(),t.setAttribute("data-atk-comment-date",String(+new Date(e.data.date)))}function Sn(e){if(!e.opts.uaBadge&&!e.data.ip_region)return;let t=e.$header.querySelector("atk-ua-wrap");if(t||(t=Lt(''),e.$header.append(t)),t.innerHTML="",e.data.ip_region){const n=Lt('');n.innerText=e.data.ip_region,t.append(n)}if(e.opts.uaBadge){const{browser:n,os:s}=e.comment.getUserUA();if(String(n).trim()){const e=Lt('');e.innerText=n,t.append(e)}if(String(s).trim()){const e=Lt('');e.innerText=s,t.append(e)}}}class Tn{constructor(e){g(this,"opts"),g(this,"$el"),g(this,"isLoading",!1),g(this,"msgRecTimer"),g(this,"msgRecTimerFunc"),g(this,"isConfirming",!1),g(this,"confirmRecTimer"),this.$el=Lt(''),this.opts="object"!=typeof e?{text:e}:e,this.$el.innerText=this.getText(),this.opts.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(e){return e.append(this.$el),this}getText(){return"string"==typeof this.opts.text?this.opts.text:this.opts.text()}setClick(e){this.$el.onclick=t=>{if(t.stopPropagation(),!this.isLoading){if(this.opts.confirm&&!this.isMessaging){const e=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.opts.confirmText||Wt("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>e()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),e()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();e()}}}updateText(e){e&&(this.opts.text=e),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(e,t){this.isLoading!==e&&(this.isLoading=e,e?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=t||`${Wt("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(e){this.setMsg(e,"atk-btn-error")}setWarn(e){this.setMsg(e,"atk-btn-warn")}setSuccess(e){this.setMsg(e,"atk-btn-success")}setMsg(e,t,n,s){this.setLoading(!1),t&&this.$el.classList.add(t),this.$el.innerText=e,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),t&&this.$el.classList.remove(t),s&&s()}),n||2500)}setMsgRecTimer(e,t){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=e,this.msgRecTimer=window.setTimeout((()=>{e(),this.clearMsgRecTimer()}),t)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function An(e){e.opts.vote&&(e.voteBtnUp=new Tn((()=>`${Wt("voteUp")} (${e.data.vote_up||0})`)).appendTo(e.$actions),e.voteBtnUp.setClick((()=>{e.comment.getActions().vote("up")})),e.opts.voteDown&&(e.voteBtnDown=new Tn((()=>`${Wt("voteDown")} (${e.data.vote_down||0})`)).appendTo(e.$actions),e.voteBtnDown.setClick((()=>{e.comment.getActions().vote("down")}))))}function Ln(e){if(!e.data.is_allow_reply)return;const t=Lt(`${Wt("reply")}`);e.$actions.append(t),t.addEventListener("click",(t=>{t.stopPropagation(),e.opts.replyComment(e.data,e.$el)}))}function Rn(e){const t=new Tn({text:()=>e.data.is_collapsed?Wt("expand"):Wt("collapse"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("collapsed",t)}))}function Pn(e){const t=new Tn({text:()=>e.data.is_pending?Wt("pending"):Wt("approved"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pending",t)}))}function Mn(e){const t=new Tn({text:()=>e.data.is_pinned?Wt("unpin"):Wt("pin"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminEdit("pinned",t)}))}function On(e){const t=new Tn({text:Wt("edit"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.opts.editComment(e.data,e.$el)}))}function In(e){const t=new Tn({text:Wt("delete"),confirm:!0,confirmText:Wt("deleteConfirm"),adminOnly:!0});t.appendTo(e.$actions),t.setClick((()=>{e.comment.getActions().adminDelete(t)}))}const _n={Avatar:function(e){const t=e.$el.querySelector(".atk-avatar"),n=Lt(""),s=e.opts.avatarURLBuilder;if(n.src=s?s(e.data):e.comment.getGravatarURL(),e.data.link){const s=Lt('');s.href=Ut(e.data.link)?e.data.link:`https://${e.data.link}`,s.append(n),t.append(s)}else t.append(n)},Header:function(e){Object.entries({renderNick:xn,renderVerifyBadge:Cn,renderDate:En,renderUABadge:Sn}).forEach((([t,n])=>{n(e)}))},Content:function(e){if(!e.data.is_collapsed)return e.$content.innerHTML=e.comment.getContentMarked(),void e.$content.classList.remove("atk-hide","atk-collapsed");e.$content.classList.add("atk-hide","atk-type-collapsed");const t=Lt(`\n
      \n ${Wt("collapsedMsg")}\n ${Wt("expand")}\n
      `);e.$body.insertAdjacentElement("beforeend",t);const n=t.querySelector(".atk-show-btn");n.addEventListener("click",(t=>{t.stopPropagation(),e.$content.classList.contains("atk-hide")?(e.$content.innerHTML=e.comment.getContentMarked(),e.$content.classList.remove("atk-hide"),tn(e.$content),n.innerText=Wt("collapse")):(e.$content.innerHTML="",e.$content.classList.add("atk-hide"),n.innerText=Wt("expand"))}))},ReplyAt:function(e){e.opts.flatMode||0===e.data.rid||e.opts.replyTo&&(e.$replyAt=Lt(''),e.$replyAt.querySelector(".atk-nick").innerText=`${e.opts.replyTo.nick}`,e.$replyAt.onclick=()=>{e.comment.getActions().goToReplyComment()},e.$headerBadgeWrap.insertAdjacentElement("afterend",e.$replyAt))},ReplyTo:function(e){if(!e.opts.flatMode)return;if(!e.opts.replyTo)return;e.$replyTo=Lt(`\n
      \n
      ${Wt("reply")} :
      \n
      \n
      `);const t=e.$replyTo.querySelector(".atk-nick");t.innerText=`@${e.opts.replyTo.nick}`,t.onclick=()=>{e.comment.getActions().goToReplyComment()};let n=Ct(e.opts.replyTo.content);e.opts.replyTo.is_collapsed&&(n=`[${Wt("collapsed")}]`),e.$replyTo.querySelector(".atk-content").innerHTML=n,e.$body.prepend(e.$replyTo)},Pending:function(e){if(!e.data.is_pending)return;const t=Lt(`
      ${Wt("pendingMsg")}
      `);e.$body.prepend(t)},Actions:function(e){Object.entries({renderVote:An,renderReply:Ln,renderCollapse:Rn,renderModerator:Pn,renderPin:Mn,renderEdit:On,renderDel:In}).forEach((([t,n])=>{n(e)}))}};class Un{constructor(e){g(this,"comment"),g(this,"$el"),g(this,"$main"),g(this,"$header"),g(this,"$headerNick"),g(this,"$headerBadgeWrap"),g(this,"$body"),g(this,"$content"),g(this,"$childrenWrap"),g(this,"$actions"),g(this,"voteBtnUp"),g(this,"voteBtnDown"),g(this,"$replyTo"),g(this,"$replyAt"),this.comment=e}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}render(){var e;return this.$el=Lt('
      \n
      \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n
      \n \n
      \n
      \n
      \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),e=this,Object.entries(_n).forEach((([t,n])=>{n(e)})),this.$childrenWrap&&this.$main.append(this.$childrenWrap),this.$el}checkHeightLimit(){const e=this.opts.heightLimit;if(!e||!e.content||!e.children)return;const t=e.content,n=e.children;vn({postExpandBtnClick:()=>{const e=this.comment.getChildren();1===e.length&&bn(e[0].getRender().$content)},scrollable:e.scrollable},[{el:this.$content,max:t,imgContains:!0},{el:this.$replyTo,max:t,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&bn(this.$childrenWrap)}playFadeAnim(){tn(this.comment.getRender().$el)}playFadeAnimForBody(){tn(this.comment.getRender().$body)}playFlashAnim(){this.$el.classList.remove("atk-flash-once"),window.setTimeout((()=>{this.$el.classList.add("atk-flash-once")}),150)}getChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=Lt('
      '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}setUnread(e){e?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(e){e?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(e){this.setOpenable(!0),this.$el.onclick=t=>{t.stopPropagation(),window.open(e)}}setOpenAction(e){this.setOpenable(!0),this.$el.onclick=t=>{t.stopPropagation(),e()}}}class qn{constructor(e){g(this,"comment"),this.comment=e}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}getApi(){return this.comment.getOpts().getApi()}vote(e){const t="up"===e?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.getApi().votes.vote(`comment_${e}`,this.data.id,u({},this.getApi().getUserFields())).then((e=>{var t,n;this.data.vote_up=e.data.up,this.data.vote_down=e.data.down,null==(t=this.comment.getRender().voteBtnUp)||t.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((e=>{null==t||t.setError(Wt("voteFail")),console.log(e)}))}adminEdit(e,t){if(t.isLoading)return;t.setLoading(!0,`${Wt("editing")}...`);const n=u({},this.data);"collapsed"===e?n.is_collapsed=!n.is_collapsed:"pending"===e?n.is_pending=!n.is_pending:"pinned"===e&&(n.is_pinned=!n.is_pinned),this.getApi().comments.updateComment(this.data.id,u({},n)).then((e=>{t.setLoading(!1),this.comment.setData(e.data)})).catch((e=>{console.error(e),t.setError(Wt("editFail"))}))}adminDelete(e){e.isLoading||(e.setLoading(!0,`${Wt("deleting")}...`),this.getApi().comments.deleteComment(this.data.id).then((()=>{e.setLoading(!1),this.opts.onDelete&&this.opts.onDelete(this.comment)})).catch((t=>{console.error(t),e.setError(Wt("deleteFail"))})))}goToReplyComment(){const e=window.location.hash,t=`#atk-comment-${this.data.rid}`;window.location.hash=t,t===e&&window.dispatchEvent(new Event("hashchange"))}}class Bn{constructor(e,t){g(this,"$el"),g(this,"renderInstance"),g(this,"actionInstance"),g(this,"data"),g(this,"opts"),g(this,"parent"),g(this,"children",[]),g(this,"nestCurt"),this.opts=t,this.data=u({},e),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new qn(this),this.renderInstance=new Un(this)}render(){const e=this.renderInstance.render();this.$el&&this.$el.replaceWith(e),this.$el=e,this.opts.onAfterRender&&this.opts.onAfterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(e){this.data=e,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(e,t="append"){e.parent=this,e.nestCurt=this.nestCurt+1,this.children.push(e);const n=this.getChildrenWrapEl(),s=e.getEl();"append"===t?n.append(s):"prepend"===t&&n.prepend(s),e.getRender().playFadeAnim(),e.getRender().checkHeightLimit()}getChildrenWrapEl(){return this.nestCurt>=this.opts.nestMax?this.parent.getChildrenWrapEl():this.getRender().getChildrenWrap()}getParents(){const e=[];let t=this.parent;for(;t;)e.push(t),t=t.getParent();return e}getEl(){if(!this.$el)throw new Error("comment element not initialized before `getEl()`");return this.$el}focus(){if(!this.$el)throw new Error("comment element not initialized before `focus()`");this.getParents().forEach((e=>{e.getRender().heightLimitRemoveForChildren()})),this.scrollIntoView(),this.getRender().playFlashAnim()}scrollIntoView(){this.$el&&en(this.$el,!1,this.opts.scrollRelativeTo&&this.opts.scrollRelativeTo())}remove(){var e;null==(e=this.$el)||e.remove()}getGravatarURL(){return`${(e={mirror:this.opts.gravatar.mirror,params:this.opts.gravatar.params,emailMD5:this.data.email_encrypted}).mirror.replace(/\/$/,"")}/${e.emailMD5}?${e.params.replace(/^\?/,"")}`;var e}getContentMarked(){return Ct(this.data.content)}getDateFormatted(){return It(new Date(this.data.date),Wt)}getUserUA(){const e=function(e){const t=window||{},n=navigator||{},s=String(e||n.userAgent),i={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},r={Trident:s.includes("Trident")||s.includes("NET CLR"),Presto:s.includes("Presto"),WebKit:s.includes("AppleWebKit"),Gecko:s.includes("Gecko/")},o={Safari:s.includes("Safari"),Chrome:s.includes("Chrome")||s.includes("CriOS"),IE:s.includes("MSIE")||s.includes("Trident"),Edge:s.includes("Edge")||s.includes("Edg"),Firefox:s.includes("Firefox")||s.includes("FxiOS"),"Firefox Focus":s.includes("Focus"),Chromium:s.includes("Chromium"),Opera:s.includes("Opera")||s.includes("OPR"),Vivaldi:s.includes("Vivaldi"),Yandex:s.includes("YaBrowser"),Kindle:s.includes("Kindle")||s.includes("Silk/"),360:s.includes("360EE")||s.includes("360SE"),UC:s.includes("UC")||s.includes(" UBrowser"),QQBrowser:s.includes("QQBrowser"),QQ:s.includes("QQ/"),Baidu:s.includes("Baidu")||s.includes("BIDUBrowser"),Maxthon:s.includes("Maxthon"),Sogou:s.includes("MetaSr")||s.includes("Sogou"),LBBROWSER:s.includes("LBBROWSER"),"2345Explorer":s.includes("2345Explorer"),TheWorld:s.includes("TheWorld"),MIUI:s.includes("MiuiBrowser"),Quark:s.includes("Quark"),Qiyu:s.includes("Qiyu"),Wechat:s.includes("MicroMessenger"),Taobao:s.includes("AliApp(TB"),Alipay:s.includes("AliApp(AP"),Weibo:s.includes("Weibo"),Douban:s.includes("com.douban.frodo"),Suning:s.includes("SNEBUY-APP"),iQiYi:s.includes("IqiyiApp")},a={Windows:s.includes("Windows"),Linux:s.includes("Linux")||s.includes("X11"),macOS:s.includes("Macintosh"),Android:s.includes("Android")||s.includes("Adr"),Ubuntu:s.includes("Ubuntu"),FreeBSD:s.includes("FreeBSD"),Debian:s.includes("Debian"),"Windows Phone":s.includes("IEMobile")||s.includes("Windows Phone"),BlackBerry:s.includes("BlackBerry")||s.includes("RIM"),MeeGo:s.includes("MeeGo"),Symbian:s.includes("Symbian"),iOS:s.includes("like Mac OS X"),"Chrome OS":s.includes("CrOS"),WebOS:s.includes("hpwOS")},l={Mobile:s.includes("Mobi")||s.includes("iPh")||s.includes("480"),Tablet:s.includes("Tablet")||s.includes("Pad")||s.includes("Nexus 7")};l.Mobile?l.Mobile=!s.includes("iPad"):o.Chrome&&s.includes("Edg")?(o.Chrome=!1,o.Edge=!0):t.showModalDialog&&t.chrome&&(o.Chrome=!1,o[360]=!0),i.device="PC",i.language=(()=>{const e=(n.browserLanguage||n.language).split("-");return e[1]&&(e[1]=e[1].toUpperCase()),e.join("_")})();const c={engine:r,browser:o,os:a,device:l};Object.entries(c).forEach((([e,t])=>{Object.entries(t).forEach((([t,n])=>{!0===n&&(i[e]=t)}))}));const d={Windows:()=>{const e=s.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[e]||e},Android:()=>s.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>s.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>s.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>s.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>s.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>s.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};i.osVersion="",d[i.os]&&(i.osVersion=d[i.os](),i.osVersion===s&&(i.osVersion=""));const h={Safari:()=>s.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>s.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>s.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>s.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>s.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>s.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>s.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>s.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>s.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>s.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>s.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>s.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>s.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>s.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>s.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>s.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>s.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>s.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>s.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>s.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>s.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>s.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>s.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>s.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>s.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>s.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>s.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>s.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>s.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return i.version="",h[i.browser]&&(i.version=h[i.browser](),i.version===s&&(i.version="")),i.version.indexOf(".")&&(i.version=i.version.substring(0,i.version.indexOf("."))),"iOS"===i.os&&s.includes("iPad")?i.os="iPadOS":"Edge"!==i.browser||s.includes("Edg")?"MIUI"===i.browser?i.os="Android":"Chrome"===i.browser&&Number(i.version)>27||"Opera"===i.browser&&Number(i.version)>12||"Yandex"===i.browser?i.engine="Blink":void 0===i.browser&&(i.browser="Unknow App"):i.engine="EdgeHTML",i}(this.data.ua);return{browser:`${e.browser} ${e.version}`,os:`${e.os} ${e.osVersion}`}}getOpts(){return this.opts}}class jn{constructor(e){g(this,"opts"),g(this,"$el"),g(this,"$loading"),g(this,"$text"),g(this,"offset",0),g(this,"total",0),g(this,"origText","Load More"),this.opts=e,this.origText=this.opts.text||this.origText,this.$el=Lt(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.opts.pageSize}click(){this.hasMore&&this.opts.onClick(this.offset+this.opts.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(e){this.$loading.style.display=e?"":"none",this.$text.style.display=e?"none":""}showErr(e){this.setLoading(!1),this.$text.innerText=e,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(e,t){this.offset=e,this.total=t,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}class Dn{constructor(){g(this,"instance"),g(this,"onReachedBottom",null),g(this,"opt")}create(e){return this.opt=e,this.instance=new jn({pageSize:e.pageSize,onClick:t=>k(this,null,(function*(){e.ctx.fetch({offset:t})})),text:Wt("loadMore")}),e.readMoreAutoLoad&&(this.onReachedBottom=()=>{this.instance.hasMore&&!this.opt.ctx.getData().getLoading()&&this.instance.click()},this.opt.ctx.on("list-reach-bottom",this.onReachedBottom)),this.instance.$el}setLoading(e){this.instance.setLoading(e)}update(e,t){this.instance.update(e,t)}showErr(e){this.instance.showErr(e)}next(){this.instance.click()}getHasMore(){return this.instance.hasMore}getIsClearComments(e){return 0===e.offset}dispose(){this.onReachedBottom&&this.opt.ctx.off("list-reach-bottom",this.onReachedBottom),this.instance.$el.remove()}}class Fn{constructor(e,t){g(this,"opts"),g(this,"total"),g(this,"$el"),g(this,"$input"),g(this,"inputTimer"),g(this,"$prevBtn"),g(this,"$nextBtn"),g(this,"page",1),this.total=e,this.opts=t,this.$el=Lt('
      \n
      \n
      \n \n
      \n \n
      \n \n
      \n
      \n
      '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=e=>this.keydown(e),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.opts.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(e,t){this.page=Math.ceil(e/this.pageSize)+1,this.total=t,this.setInput(this.page),this.checkDisabled()}setInput(e){this.$input.value=`${e}`}input(e=!1){window.clearTimeout(this.inputTimer);const t=this.$input.value.trim(),n=()=>{if(""===t)return void this.setInput(this.page);let e=Number(t);Number.isNaN(e)||e<1?this.setInput(this.page):(e>this.maxPage&&(this.setInput(this.maxPage),e=this.maxPage),this.change(e))};e?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const e=this.page-1;e<1||this.change(e)}next(){const e=this.page+1;e>this.maxPage||this.change(e)}getHasMore(){return this.page+1<=this.maxPage}change(e){this.page=e,this.opts.onChange(this.offset),this.setInput(e),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(e){const t=e.keyCode||e.which;if(38===t){const e=Number(this.$input.value)+1;if(e>this.maxPage)return;this.setInput(e),this.input()}else if(40===t){const e=Number(this.$input.value)-1;if(e<1)return;this.setInput(e),this.input()}else 13===t&&this.input(!0)}setLoading(e){e?Yt(this.$el):Xt(this.$el)}}class Nn{constructor(){g(this,"instance")}create(e){return this.instance=new Fn(e.total,{pageSize:e.pageSize,onChange:t=>k(this,null,(function*(){e.ctx.editorResetState(),e.ctx.fetch({offset:t,onSuccess:()=>{e.ctx.listGotoFirst()}})}))}),this.instance.$el}setLoading(e){this.instance.setLoading(e)}update(e,t){this.instance.update(e,t)}next(){this.instance.next()}getHasMore(){return this.instance.getHasMore()}getIsClearComments(){return!0}dispose(){this.instance.$el.remove()}}function Wn(e){const t=e.getData().getListLastFetch(),n={offset:0,total:0};return t?(n.offset=t.params.offset,t.data&&(n.total=t.params.flatMode?t.data.count:t.data.roots_count),n):n}const zn=e=>{let t=null;e.watchConf(["pagination","locale"],(n=>{const s=e.get("list");t&&t.dispose(),t=function(e){return e.pagination.readMore?new Dn:new Nn}(n);const{offset:i,total:r}=Wn(e),o=t.create({ctx:e,pageSize:n.pagination.pageSize,total:r,readMoreAutoLoad:n.pagination.autoLoad});s.$commentsWrap.after(o),null==t||t.update(i,r)})),e.on("list-loaded",(n=>{const{offset:s,total:i}=Wn(e);null==t||t.update(s,i)})),e.on("list-fetch",(n=>{e.getData().getComments().length>0&&(null==t?void 0:t.getIsClearComments(n))&&e.getData().clearComments()})),e.on("list-failed",(()=>{var e;null==(e=null==t?void 0:t.showErr)||e.call(t,Wt("loadFail"))})),e.on("list-fetch",(e=>{null==t||t.setLoading(!0)})),e.on("list-fetched",(({params:e})=>{null==t||t.setLoading(!1)}))};class Hn extends cn{constructor(e){super(e),g(this,"$commentsWrap"),g(this,"commentNodes",[]),this.$el=Lt('
      \n
      \n
      \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n \n
      \n'),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),zn(e),this.initCrudEvents()}getCommentsWrapEl(){return this.$commentsWrap}getCommentNodes(){return this.commentNodes}getListLayout({forceFlatMode:e}={}){return new yn({$commentsWrap:this.$commentsWrap,nestSortBy:this.ctx.conf.nestSort,nestMax:this.ctx.conf.nestMax,flatMode:"boolean"==typeof e?e:this.ctx.conf.flatMode,createCommentNode:(t,n)=>{const s=function(e,t,n,s){const i=new Bn(t,{onAfterRender:()=>{e.trigger("comment-rendered",i)},onDelete:t=>{e.getData().deleteComment(t.getID())},replyTo:n,flatMode:"boolean"==typeof(null==s?void 0:s.forceFlatMode)?null==s?void 0:s.forceFlatMode:e.conf.flatMode,gravatar:e.conf.gravatar,nestMax:e.conf.nestMax,heightLimit:e.conf.heightLimit,avatarURLBuilder:e.conf.avatarURLBuilder,scrollRelativeTo:e.conf.scrollRelativeTo,vote:e.conf.vote,voteDown:e.conf.voteDown,uaBadge:e.conf.uaBadge,getApi:()=>e.getApi(),replyComment:(t,n)=>e.replyComment(t,n),editComment:(t,n)=>e.editComment(t,n)});return i.render(),i}(this.ctx,t,n,{forceFlatMode:e});return this.commentNodes.push(s),s},findCommentNode:e=>this.commentNodes.find((t=>t.getID()===e))})}initCrudEvents(){this.ctx.on("list-load",(e=>{this.getListLayout().import(e)})),this.ctx.on("list-loaded",(e=>{0===e.length&&(this.commentNodes=[],this.$commentsWrap.innerHTML="")})),this.ctx.on("comment-inserted",(e=>{var t;const n=e.rid?null==(t=this.commentNodes.find((t=>t.getID()===e.rid)))?void 0:t.getData():void 0;this.getListLayout().insert(e,n)})),this.ctx.on("comment-deleted",(e=>{const t=this.commentNodes.find((t=>t.getID()===e.id));t?(t.remove(),this.commentNodes=this.commentNodes.filter((t=>t.getID()!==e.id))):console.error(`comment node id=${e.id} not found`)})),this.ctx.on("comment-updated",(e=>{const t=this.commentNodes.find((t=>t.getID()===e.id));t&&t.setData(e)}))}}let Qn,Vn;function Gn(){return{init(){Qn=document.body.style.overflow,Vn=document.body.style.paddingRight},unlock(){document.body.style.overflow=Qn,document.body.style.paddingRight=Vn},lock(){document.body.style.overflow="hidden";const e=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const e=document.createElement("p");e.style.width="100%",e.style.height="200px";const t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);const n=e.offsetWidth;t.style.overflow="scroll";let s=e.offsetWidth;return n===s&&(s=t.clientWidth),document.body.removeChild(t),n-s}()+e||0}px`}}}class Kn{constructor(e,t){g(this,"allowMaskClose",!0),g(this,"onAfterHide"),this.$el=e,this.opts=t}setOnAfterHide(e){this.onAfterHide=e}setAllowMaskClose(e){this.allowMaskClose=e}getAllowMaskClose(){return this.allowMaskClose}getEl(){return this.$el}show(){this.opts.onShow(),this.$el.style.display=""}hide(){return k(this,null,(function*(){this.opts.onHide(),this.$el.style.display="none",this.onAfterHide&&this.onAfterHide()}))}destroy(){return k(this,null,(function*(){this.opts.onHide(),this.$el.remove(),this.onAfterHide&&this.onAfterHide()}))}}class Zn{constructor(){g(this,"$wrap"),g(this,"$mask"),g(this,"items",[]),this.$wrap=Lt(''),this.$mask=this.$wrap.querySelector(".atk-layer-mask")}createItem(e,t){(t=t||this.createItemElement(e)).setAttribute("data-layer-name",e),this.$wrap.appendChild(t);const n=new Kn(t,{onHide:()=>this.hideWrap(t),onShow:()=>this.showWrap()});return this.getMask().addEventListener("click",(()=>{n.getAllowMaskClose()&&n.hide()})),this.items.push(n),n}createItemElement(e){const t=document.createElement("div");return t.classList.add("atk-layer-item"),t.style.display="none",this.$wrap.appendChild(t),t}getWrap(){return this.$wrap}getMask(){return this.$mask}showWrap(){this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),Gn().lock()}hideWrap(e){this.items.map((e=>e.getEl())).filter((t=>t!==e&&t.isConnected&&"none"!==t.style.display)).length>0||(this.$wrap.style.display="none",Gn().unlock())}}class Yn{constructor(e){g(this,"wrap"),this.wrap=new Zn,document.body.appendChild(this.wrap.getWrap()),e.on("unmounted",(()=>{this.wrap.getWrap().remove()})),Gn().init()}getEl(){return this.wrap.getWrap()}create(e,t){return this.wrap.createItem(e,t)}}const Xn="ArtalkUser";class Jn{constructor(e){g(this,"data"),this.opts=e;const t=JSON.parse(window.localStorage.getItem(Xn)||"{}");this.data={nick:t.nick||"",email:t.email||"",link:t.link||"",token:t.token||"",isAdmin:t.isAdmin||!1}}getData(){return this.data}update(e={}){Object.entries(e).forEach((([e,t])=>{this.data[e]=t})),window.localStorage.setItem(Xn,JSON.stringify(this.data)),this.opts.onUserChanged&&this.opts.onUserChanged(this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}}const es={i18n(e){Nt(e.conf.locale),e.watchConf(["locale"],(e=>{Nt(e.locale)}))},user:e=>new Jn({onUserChanged:t=>{e.trigger("user-changed",t)}}),layerManager:e=>new Yn(e),checkerLauncher:e=>new ln({getCtx:()=>e,getApi:()=>e.getApi(),onReload:()=>e.reload(),getCaptchaIframeURL:()=>`${e.conf.server}/api/v2/captcha/?t=${+new Date}`}),editor(e){const t=new gn(e);return e.$root.appendChild(t.$el),t},list(e){const t=new Hn(e);return e.$root.appendChild(t.$el),t},sidebarLayer:e=>new mn(e),editorPlugs(){}};function ts(e){return k(this,null,(function*(){e.countEl&&document.querySelector(e.countEl)&&ns(e,{query:"page_comment",numEl:e.countEl});const t=e.pvAdd&&e.pageKey?{[e.pageKey]:(yield e.getApi().pages.logPv({page_key:e.pageKey,page_title:e.pageTitle,site_name:e.siteName})).data.pv}:void 0;e.pvEl&&document.querySelector(e.pvEl)&&ns(e,{query:"page_pv",numEl:e.pvEl,data:t})}))}function ns(e,t){return k(this,null,(function*(){let n=t.data||{},s=Array.from(document.querySelectorAll(t.numEl)).map((t=>t.getAttribute("data-page-key")||e.pageKey)).filter((e=>e&&"number"!=typeof n[e]));if(s=[...new Set(s)],s.length>0){const i=(yield e.getApi().stats.getStats(t.query,{page_keys:s.join(","),site_name:e.siteName})).data.data;n=u(u({},n),i)}const i=e.pageKey?n[e.pageKey]:0;!function(e,t,n){document.querySelectorAll(e).forEach((e=>{const s=e.getAttribute("data-page-key"),i=Number(s?t[s]:n);e.innerHTML=`${i}`}))}(t.numEl,n,i)}))}function ss(e){const t=Lt('

      ');if(t.querySelector(".error-message").innerText=`${Wt("listLoadFailMsg")}\n${e.errMsg}`,e.retryFn){const n=Lt(`${Wt("listRetry")}`);n.onclick=()=>e.retryFn&&e.retryFn(),t.appendChild(n)}if(e.onOpenSidebar){const n=Lt(` | ${Wt("openName",{name:Wt("ctrlCenter")})}`);t.appendChild(n),n.onclick=()=>e.onOpenSidebar&&e.onOpenSidebar()}nn(e.$err,t)}const is="ArtalkContent";class rs{constructor(e){this.kit=e}reqAdd(){return k(this,null,(function*(){return(yield this.kit.useApi().comments.createComment(u({},yield this.getSubmitAddParams()))).data}))}getSubmitAddParams(){return k(this,null,(function*(){const{nick:e,email:t,link:n}=this.kit.useUser().getData(),s=this.kit.useConf();return{content:this.kit.useEditor().getContentFinal(),name:e,email:t,link:n,rid:0,page_key:s.pageKey,page_title:s.pageTitle,site_name:s.site,ua:yield _t()}}))}postSubmitAdd(e){this.kit.useGlobalCtx().getData().insertComment(e)}}class os extends hn{constructor(e){super(e),g(this,"customs",[]),g(this,"defaultPreset"),this.defaultPreset=new rs(this.kit);const t=()=>this.do();this.kit.useMounted((()=>{this.kit.useGlobalCtx().on("editor-submit",t)})),this.kit.useUnmounted((()=>{this.kit.useGlobalCtx().off("editor-submit",t)}))}registerCustom(e){this.customs.push(e)}do(){return k(this,null,(function*(){if(""===this.kit.useEditor().getContentFinal().trim())return void this.kit.useEditor().focus();const e=this.customs.find((e=>e.activeCond()));this.kit.useEditor().showLoading();try{let t;(null==e?void 0:e.pre)&&e.pre(),t=(null==e?void 0:e.req)?yield e.req():yield this.defaultPreset.reqAdd(),(null==e?void 0:e.post)?e.post(t):this.defaultPreset.postSubmitAdd(t)}catch(t){return console.error(t),void this.kit.useEditor().showNotify(`${Wt("commentFail")}: ${t.message||String(t)}`,"e")}finally{this.kit.useEditor().hideLoading()}this.kit.useEditor().reset(),this.kit.useGlobalCtx().trigger("editor-submitted")}))}}class as extends hn{constructor(e){super(e),g(this,"emoticons",[]),g(this,"loadingTask",null),g(this,"$grpWrap"),g(this,"$grpSwitcher"),g(this,"isListLoaded",!1),g(this,"isImgLoaded",!1),this.kit.useMounted((()=>{this.usePanel('
      '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.useContentTransformer((e=>this.transEmoticonImageText(e))),this.usePanelShow((()=>{(()=>{k(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()})),this.usePanelHide((()=>{this.$panel.parentElement.style.height=""})),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}loadEmoticonsData(){return k(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>k(this,null,(function*(){Yt(this.$panel),this.emoticons=yield this.handleData(this.kit.useConf().emoticons),Xt(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(e){return k(this,null,(function*(){if(!Array.isArray(e)&&["object","string"].includes(typeof e)&&(e=[e]),!Array.isArray(e))return nn(this.$panel,`[${Wt("emoticon")}] Data must be of Array/Object/String type`),Xt(this.$panel),[];const t=t=>{"object"==typeof t&&(t.name&&e.find((e=>e.name===t.name))||e.push(t))},n=e=>k(this,null,(function*(){yield Promise.all(e.map(((e,s)=>k(this,null,(function*(){if("object"!=typeof e||Array.isArray(e)){if(Array.isArray(e))yield n(e);else if("string"==typeof e){const s=yield this.remoteLoad(e);Array.isArray(s)?yield n(s):"object"==typeof s&&t(s)}}else t(e)})))))}));return yield n(e),e.forEach((e=>{if(this.isOwOFormat(e)){this.convertOwO(e).forEach((e=>{t(e)}))}else Array.isArray(e)&&e.forEach((e=>{t(e)}))})),e=e.filter((e=>"object"==typeof e&&!Array.isArray(e)&&!!e&&!!e.name)),this.solveNullKey(e),this.solveSameKey(e),e}))}remoteLoad(e){return k(this,null,(function*(){if(!e)return[];try{const t=yield fetch(e);return yield t.json()}catch(t){return Xt(this.$panel),console.error("[Emoticons] Load Failed:",t),nn(this.$panel,`[${Wt("emoticon")}] ${Wt("loadFail")}: ${String(t)}`),[]}}))}solveNullKey(e){e.forEach((e=>{e.items.forEach(((t,n)=>{t.key||(t.key=`${e.name} ${n+1}`)}))}))}solveSameKey(e){const t={};e.forEach((e=>{e.items.forEach((e=>{e.key&&""!==String(e.key).trim()&&(t[e.key]?t[e.key]++:t[e.key]=1,t[e.key]>1&&(e.key=`${e.key} ${t[e.key]}`))}))}))}isOwOFormat(e){try{return"object"==typeof e&&!!Object.values(e).length&&Array.isArray(Object.keys(Object.values(e)[0].container))&&Object.keys(Object.values(e)[0].container[0]).includes("icon")}catch(t){return!1}}convertOwO(e){const t=[];return Object.entries(e).forEach((([e,n])=>{const s={name:e,type:n.type,items:[]};n.container.forEach(((t,n)=>{const i=t.icon;if(/<(img|IMG)/.test(i)){const e=/src=["'](.*?)["']/.exec(i);e&&e.length>1&&(t.icon=e[1])}s.items.push({key:t.text||`${e} ${n+1}`,val:t.icon})})),t.push(s)})),t}initEmoticonsList(){this.$grpWrap=Lt('
      '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((e,t)=>{const n=Lt('');this.$grpWrap.append(n),n.setAttribute("data-index",String(t)),n.setAttribute("data-grp-name",e.name),n.setAttribute("data-type",e.type),e.items.forEach((t=>{const s=Lt('');if(n.append(s),t.key&&!new RegExp(`^(${e.name})?\\s?[0-9]+$`).test(t.key)&&s.setAttribute("title",t.key),"image"===e.type){const e=document.createElement("img");e.src=t.val,e.alt=t.key,s.append(e)}else s.innerText=t.val;s.onclick=()=>{"image"===e.type?this.kit.useEditor().insertContent(`:[${t.key}]`):this.kit.useEditor().insertContent(t.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=Lt('
      '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((e,t)=>{const n=Lt("");n.innerText=e.name,n.setAttribute("data-index",String(t)),n.onclick=()=>this.openGrp(t),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(e){var t,n,s;Array.from(this.$grpWrap.children).forEach((t=>{const n=t;n.getAttribute("data-index")!==String(e)?n.style.display="none":n.style.display=""})),null==(t=this.$grpSwitcher)||t.querySelectorAll("span.active").forEach((e=>e.classList.remove("active"))),null==(s=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${e}"]`))||s.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(e){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((t=>{"image"===t.type&&Object.entries(t.items).forEach((([t,n])=>{e=e.split(`:[${n.key}]`).join(``)}))})),e):e}}const ls=["png","jpg","jpeg","gif","bmp","svg","webp"];class cs extends hn{constructor(e){super(e),g(this,"$imgUploadInput"),this.kit.useMounted((()=>this.init())),this.initDragImg()}init(){this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=ls.map((e=>`.${e}`)).join(",");const e=this.useBtn(``);e.after(this.$imgUploadInput),e.onclick=()=>{const e=this.$imgUploadInput;e.onchange=()=>{(()=>{k(this,null,(function*(){if(!e.files||0===e.files.length)return;const t=e.files[0];this.uploadImg(t)}))})()},e.click()},this.kit.useConf().imgUpload||this.$btn.setAttribute("atk-only-admin-show","")}initDragImg(){const e=e=>{if(e)for(let t=0;t{e.stopPropagation(),e.preventDefault()},n=t=>{var n;const s=null==(n=t.dataTransfer)?void 0:n.files;(null==s?void 0:s.length)&&(t.preventDefault(),e(s))},s=t=>{var n;const s=null==(n=t.clipboardData)?void 0:n.files;(null==s?void 0:s.length)&&(t.preventDefault(),e(s))};this.kit.useMounted((()=>{this.kit.useUI().$textarea.addEventListener("dragover",t),this.kit.useUI().$textarea.addEventListener("drop",n),this.kit.useUI().$textarea.addEventListener("paste",s)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("dragover",t),this.kit.useUI().$textarea.removeEventListener("drop",n),this.kit.useUI().$textarea.removeEventListener("paste",s)}))}uploadImg(e){return k(this,null,(function*(){const t=/[^.]+$/.exec(e.name);if(!t||!ls.includes(String(t[0]).toLowerCase()))return;if(!this.kit.useUser().checkHasBasicUserInfo())return void this.kit.useEditor().showNotify(Wt("uploadLoginMsg"),"w");let n="\n";""===this.kit.useUI().$textarea.value.trim()&&(n="");const s=`${n}![](Uploading ${e.name}...)`;let i;this.kit.useEditor().insertContent(s);try{const t=this.kit.useConf().imgUploader;i=t?{public_url:yield t(e)}:(yield this.kit.useApi().upload.upload({file:e})).data}catch(r){console.error(r),this.kit.useEditor().showNotify(`${Wt("uploadFail")}: ${r.message}`,"e")}if(i&&i.public_url){let e=i.public_url;Ut(e)||(e=qt({base:this.kit.useConf().server,path:e})),this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(s,`${n}![](${e})`))}else this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(s,""))}))}}class ds extends hn{constructor(e){super(e),g(this,"isPlugPanelShow",!1),this.kit.useMounted((()=>{this.usePanel('
      '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.kit.useEvents().on("content-updated",(e=>{this.isPlugPanelShow&&this.updateContent()})),this.usePanelShow((()=>{this.isPlugPanelShow=!0,this.updateContent()})),this.usePanelHide((()=>{this.isPlugPanelShow=!1}))}updateContent(){this.$panel.innerHTML=this.kit.useEditor().getContentMarked()}}const hs=[class extends hn{constructor(e){super(e);const t=()=>{this.save()};this.kit.useMounted((()=>{const e=window.localStorage.getItem(is)||"";""!==e.trim()&&(this.kit.useEditor().showNotify(Wt("restoredMsg"),"i"),this.kit.useEditor().setContent(e)),this.kit.useEvents().on("content-updated",t)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("content-updated",t)}))}save(){window.localStorage.setItem(is,this.kit.useEditor().getContentRaw().trim())}},class extends hn{get $inputs(){return this.kit.useEditor().getHeaderInputEls()}constructor(e){super(e);const t={},n={},s=(e,t,n)=>()=>{this.kit.useEvents().trigger(e,{field:n,$input:t})};this.kit.useMounted((()=>{Object.entries(this.$inputs).forEach((([e,i])=>{i.addEventListener("input",t[e]=s("header-input",i,e)),i.addEventListener("change",n[e]=s("header-change",i,e))}))})),this.kit.useUnmounted((()=>{Object.entries(this.$inputs).forEach((([e,s])=>{s.removeEventListener("input",t[e]),s.removeEventListener("change",n[e])}))}))}},class extends hn{constructor(e){super(e),g(this,"query",{timer:null,abortFn:null});const t=({$input:e,field:t})=>{"edit"!==this.kit.useEditor().getState()&&(this.kit.useUser().update({[t]:e.value.trim()}),"nick"!==t&&"email"!==t||this.fetchUserInfo())};this.kit.useMounted((()=>{Object.entries(this.kit.useEditor().getHeaderInputEls()).forEach((([e,t])=>{t.placeholder=`${Wt(e)}`,t.value=this.kit.useUser().getData()[e]||""})),this.kit.useEvents().on("header-input",t)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-input",t)}))}fetchUserInfo(){this.kit.useUser().logout(),this.query.timer&&window.clearTimeout(this.query.timer),this.query.abortFn&&this.query.abortFn(),this.query.timer=window.setTimeout((()=>{this.query.timer=null;const e=this.kit.useApi(),t="getUserCancelToken";this.query.abortFn=()=>e.abortRequest(t),e.user.getUser(u({},e.getUserFields()),{cancelToken:t}).then((e=>this.onUserInfoFetched(e.data))).catch((e=>{})).finally((()=>{this.query.abortFn=null}))}),400)}onUserInfoFetched(e){var t;e.is_login||this.kit.useUser().logout(),this.kit.useGlobalCtx().getData().updateNotifies(e.notifies),this.kit.useUser().checkHasBasicUserInfo()&&!e.is_login&&(null==(t=e.user)?void 0:t.is_admin)&&this.kit.useGlobalCtx().checkAdmin({onSuccess:()=>{}}),e.user&&e.user.link&&(this.kit.useUI().$link.value=e.user.link,this.kit.useUser().update({link:e.user.link}))}},class extends hn{constructor(e){super(e);const t=({field:e})=>{"link"===e&&this.onLinkInputChange()};this.kit.useMounted((()=>{this.kit.useEvents().on("header-change",t)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-change",t)}))}onLinkInputChange(){const e=this.kit.useUI().$link.value.trim();e&&!/^(http|https):\/\//.test(e)&&(this.kit.useUI().$link.value=`https://${e}`,this.kit.useUser().update({link:this.kit.useUI().$link.value}))}},class extends hn{constructor(e){super(e);const t=e=>this.onKeydown(e),n=()=>this.onInput();this.kit.useMounted((()=>{this.kit.useUI().$textarea.placeholder=this.kit.useConf().placeholder||Wt("placeholder"),this.kit.useUI().$textarea.addEventListener("keydown",t),this.kit.useUI().$textarea.addEventListener("input",n)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("keydown",t),this.kit.useUI().$textarea.removeEventListener("input",n)})),this.kit.useEvents().on("content-updated",(()=>{window.setTimeout((()=>{this.adaptiveHeightByContent()}),80)}))}onKeydown(e){9===(e.keyCode||e.which)&&(e.preventDefault(),this.kit.useEditor().insertContent("\t"))}onInput(){this.kit.useEvents().trigger("content-updated",this.kit.useEditor().getContentRaw())}adaptiveHeightByContent(){const e=this.kit.useUI().$textarea.offsetHeight-this.kit.useUI().$textarea.clientHeight;this.kit.useUI().$textarea.style.height="0px",this.kit.useUI().$textarea.style.height=`${this.kit.useUI().$textarea.scrollHeight+e}px`}},os,class extends hn{constructor(e){super(e);const t=()=>{this.kit.useEditor().submit()};this.kit.useMounted((()=>{this.kit.useUI().$submitBtn.innerText=this.kit.useConf().sendBtn||Wt("send"),this.kit.useUI().$submitBtn.addEventListener("click",t)})),this.kit.useUnmounted((()=>{this.kit.useUI().$submitBtn.removeEventListener("click",t)}))}},un,class extends hn{constructor(e){super(e),g(this,"comment"),this.useEditorStateEffect("reply",(e=>(this.setReply(e),()=>{this.cancelReply()}))),this.kit.useEvents().on("mounted",(()=>{const e=this.kit.useDeps(os);if(!e)throw Error("SubmitPlug not initialized");const t=new rs(this.kit);e.registerCustom({activeCond:()=>!!this.comment,req:()=>k(this,null,(function*(){if(!this.comment)throw new Error("reply comment cannot be empty");return(yield this.kit.useApi().comments.createComment(p(u({},yield t.getSubmitAddParams()),{rid:this.comment.id,page_key:this.comment.page_key,page_title:void 0,site_name:this.comment.site_name}))).data})),post:e=>{const n=this.kit.useConf();e.page_key!==n.pageKey&&window.open(`${e.page_url}#atk-comment-${e.id}`),t.postSubmitAdd(e)}})}))}setReply(e){const t=this.kit.useUI();if(!t.$sendReplyBtn){const n=Lt(`${Wt("reply")} `);n.querySelector(".atk-text").innerText=`@${e.nick}`,n.addEventListener("click",(()=>{this.kit.useEditor().resetState()})),t.$stateWrap.append(n),t.$sendReplyBtn=n}this.comment=e,t.$textarea.focus()}cancelReply(){if(!this.comment)return;const e=this.kit.useUI();e.$sendReplyBtn&&(e.$sendReplyBtn.remove(),e.$sendReplyBtn=void 0),this.comment=void 0}},class extends hn{constructor(e){super(e),g(this,"comment"),g(this,"originalSubmitBtnText","Send"),this.useEditorStateEffect("edit",(e=>(this.edit(e),()=>{this.cancelEdit()}))),this.kit.useMounted((()=>{const e=this.kit.useDeps(os);if(!e)throw Error("SubmitPlug not initialized");e.registerCustom({activeCond:()=>!!this.comment,req:()=>k(this,null,(function*(){const e={content:this.kit.useEditor().getContentFinal(),nick:this.kit.useUI().$nick.value,email:this.kit.useUI().$email.value,link:this.kit.useUI().$link.value},t=this.comment;return(yield this.kit.useApi().comments.updateComment(t.id,u(u({},t),e))).data})),post:e=>{this.kit.useGlobalCtx().getData().updateComment(e)}})}))}edit(e){const t=this.kit.useUI();if(!t.$editCancelBtn){const e=Lt(`${Wt("editCancel")}`);e.onclick=()=>{this.kit.useEditor().resetState()},t.$stateWrap.append(e),t.$editCancelBtn=e}this.comment=e,t.$header.style.display="none",t.$nick.value=e.nick||"",t.$email.value=e.email||"",t.$link.value=e.link||"",this.kit.useEditor().setContent(e.content),t.$textarea.focus(),this.updateSubmitBtnText(Wt("save"))}cancelEdit(){if(!this.comment)return;const e=this.kit.useUI();e.$editCancelBtn&&(e.$editCancelBtn.remove(),e.$editCancelBtn=void 0),this.comment=void 0;const{nick:t,email:n,link:s}=this.kit.useUser().getData();e.$nick.value=t,e.$email.value=n,e.$link.value=s,this.kit.useEditor().setContent(""),this.restoreSubmitBtnText(),e.$header.style.display=""}updateSubmitBtnText(e){this.originalSubmitBtnText=this.kit.useUI().$submitBtn.innerText,this.kit.useUI().$submitBtn.innerText=e}restoreSubmitBtnText(){this.kit.useUI().$submitBtn.innerText=this.originalSubmitBtnText}},class extends hn{constructor(e){super(e);const t=()=>this.open(),n=()=>this.close();this.kit.useMounted((()=>{this.kit.useEvents().on("editor-open",t),this.kit.useEvents().on("editor-close",n)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("editor-open",t),this.kit.useEvents().off("editor-close",n)}))}open(){var e;null==(e=this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed"))||e.remove(),this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""}close(){this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed")||this.kit.useUI().$textareaWrap.prepend(Lt(`
      ${Wt("onlyAdminCanReply")}
      `)),this.kit.useUser().getData().isAdmin?(this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""):(this.kit.useUI().$textarea.style.display="none",this.kit.useEvents().trigger("panel-close"),this.kit.useUI().$bottom.style.display="none")}},as,cs,ds];class us{constructor(e){this.plugs=e}useEditor(){return this.plugs.editor}useGlobalCtx(){return this.plugs.editor.ctx}useConf(){return this.plugs.editor.ctx.conf}useApi(){return this.plugs.editor.ctx.getApi()}useUser(){return this.plugs.editor.ctx.get("user")}useUI(){return this.plugs.editor.getUI()}useEvents(){return this.plugs.getEvents()}useMounted(e){this.useEvents().on("mounted",e)}useUnmounted(e){this.useEvents().on("unmounted",e)}useDeps(e){return this.plugs.get(e)}}class ps{constructor(e){g(this,"plugs",[]),g(this,"openedPlug",null),g(this,"events",new zt),this.editor=e;let t=!1;this.editor.ctx.watchConf(["imgUpload","emoticons","preview","editorTravel","locale"],(e=>{t&&this.getEvents().trigger("unmounted"),this.clear(),function(e){const t=new Map;return t.set(cs,e.imgUpload),t.set(as,e.emoticons),t.set(ds,e.preview),t.set(un,e.editorTravel),hs.filter((e=>!t.has(e)||!!t.get(e)))}(e).forEach((e=>{const t=new us(this);this.plugs.push(new e(t))})),this.getEvents().trigger("mounted"),t=!0,this.loadPluginUI()})),this.events.on("panel-close",(()=>this.closePlugPanel()))}getPlugs(){return this.plugs}getEvents(){return this.events}clear(){this.plugs=[],this.events=new zt,this.openedPlug&&this.closePlugPanel()}loadPluginUI(){this.editor.getUI().$plugPanelWrap.innerHTML="",this.editor.getUI().$plugPanelWrap.style.display="none",this.editor.getUI().$plugBtnWrap.innerHTML="",this.plugs.forEach((e=>this.loadPluginItem(e)))}loadPluginItem(e){const t=e.$btn;if(!t)return;this.editor.getUI().$plugBtnWrap.appendChild(t),!t.onclick&&(t.onclick=()=>{this.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((e=>e.classList.remove("active"))),e!==this.openedPlug?(this.openPlugPanel(e),t.classList.add("active")):this.closePlugPanel()});const n=e.$panel;n&&(n.style.display="none",this.editor.getUI().$plugPanelWrap.appendChild(n))}get(e){return this.plugs.find((t=>t instanceof e))}openPlugPanel(e){this.plugs.forEach((t=>{const n=t.$panel;n&&(t===e?(n.style.display="",this.events.trigger("panel-show",e)):(n.style.display="none",this.events.trigger("panel-hide",e)))})),this.editor.getUI().$plugPanelWrap.style.display="",this.openedPlug=e}closePlugPanel(){this.openedPlug&&(this.editor.getUI().$plugPanelWrap.style.display="none",this.events.trigger("panel-hide",this.openedPlug),this.openedPlug=null)}getTransformedContent(e){let t=e;return this.plugs.forEach((e=>{e.contentTransformer&&(t=e.contentTransformer(t))})),t}}const gs="2.8.5";let ms=!1;let fs;function ks(e,t){const n="atk-dark-mode";e.forEach((e=>{t?e.classList.add(n):e.classList.remove(n)}))}const ys=[...[e=>{!function(){try{if(!Me.name)return}catch(e){return}Me.setOptions(u({renderer:kt()},wt)),$t=Me}(),e.on("updated",(e=>{var t;e.markedReplacers&&(t=e.markedReplacers,bt=t)}))},e=>{const t=e.get("editor"),n=new ps(t);e.inject("editorPlugs",n)},e=>{const t=()=>{var t;t=e.get("user").getData().isAdmin,function(e){const t=[];e.$root.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e)));const n=document.querySelector(".atk-sidebar");return n&&n.querySelectorAll("[atk-only-admin-show]").forEach((e=>t.push(e))),t}({$root:e.$root}).forEach((e=>{t?e.classList.remove("atk-hide"):e.classList.add("atk-hide")}))};e.on("list-loaded",(()=>{t()})),e.on("user-changed",(e=>{t()}))},...[e=>{e.on("list-fetch",(t=>{if(e.getData().getLoading())return;e.getData().setLoading(!0);const n=u({offset:0,limit:e.conf.pagination.pageSize,flatMode:e.conf.flatMode,paramsModifier:e.conf.listFetchParamsModifier},t);e.getData().setListLastFetch({params:n});const s={limit:n.limit,offset:n.offset,flat_mode:n.flatMode,page_key:e.getConf().pageKey,site_name:e.getConf().site};n.paramsModifier&&n.paramsModifier(s),e.getApi().comments.getComments(u(u({},s),e.getApi().getUserFields())).then((({data:t})=>{e.getData().setListLastFetch({params:n,data:t}),e.getData().loadComments(t.comments),e.getData().updatePage(t.page),n.onSuccess&&n.onSuccess(t),e.trigger("list-fetched",{params:n,data:t})})).catch((t=>{const s={msg:t.msg||String(t),data:t.data};throw n.onError&&n.onError(s),e.trigger("list-failed",s),e.trigger("list-fetched",{params:n,error:s}),t})).finally((()=>{e.getData().setLoading(!1)}))}))},e=>{e.on("list-fetch",(t=>{const n=e.get("list");0===t.offset&&Jt(!0,n.$el)})),e.on("list-fetched",(()=>{Jt(!1,e.get("list").$el)}))},e=>{e.on("comment-rendered",(t=>{if(!0===e.conf.listUnreadHighlight){const n=e.getData().getNotifies(),s=n.find((e=>e.comment_id===t.getID()));s?(t.getRender().setUnread(!0),t.getRender().setOpenAction((()=>{window.open(s.read_link),e.getData().updateNotifies(n.filter((e=>e.comment_id!==t.getID())))}))):t.getRender().setUnread(!1)}})),e.on("list-goto",(t=>{const n=Pt("atk_notify_key");n&&e.getApi().notifies.markNotifyRead(t,n).then((()=>{e.getData().updateNotifies(e.getData().getNotifies().filter((e=>e.comment_id!==t)))}))}))},e=>{let t;e.on("mounted",(()=>{const n=e.get("list");t=n.$el.querySelector('[data-action="admin-close-comment"]'),t.addEventListener("click",(()=>{const t=e.getData().getPage();if(!t)throw new Error("Page data not found");t.admin_only=!t.admin_only,function(e,t){e.editorShowLoading(),e.getApi().pages.updatePage(t.id,t).then((({data:t})=>{e.getData().updatePage(t)})).catch((t=>{e.editorShowNotify(`${Wt("editFail")}: ${t.message||String(t)}`,"e")})).finally((()=>{e.editorHideLoading()}))}(e,t)}))})),e.on("page-loaded",(n=>{var s,i;const r=e.get("editor");!0===(null==n?void 0:n.admin_only)?(null==(s=r.getPlugs())||s.getEvents().trigger("editor-close"),t&&(t.innerText=Wt("openComment"))):(null==(i=r.getPlugs())||i.getEvents().trigger("editor-open"),t&&(t.innerText=Wt("closeComment")))})),e.on("list-loaded",(t=>{e.editorResetState()}))},e=>{e.on("list-loaded",(()=>{(()=>{var t,n;const s=e.get("list").$el.querySelector(".atk-comment-count .atk-text");if(!s)return;const i=Rt(Wt("counter",{count:`${Number(null==(n=null==(t=e.getData().getListLastFetch())?void 0:t.data)?void 0:n.count)||0}`}));s.innerHTML=i.replace(/(\d+)/,'$1')})()})),e.on("comment-inserted",(()=>{const t=e.getData().getListLastFetch();(null==t?void 0:t.data)&&(t.data.count+=1)})),e.on("comment-deleted",(()=>{const t=e.getData().getListLastFetch();(null==t?void 0:t.data)&&(t.data.count-=1)}))},e=>{let t=null;const n=()=>{if(!t)return;const n=e.get("user").getData();if(n.nick&&n.email){t.classList.remove("atk-hide");const e=t.querySelector(".atk-text");e&&(e.innerText=n.isAdmin?Wt("ctrlCenter"):Wt("msgCenter"))}else t.classList.add("atk-hide")};e.watchConf(["locale"],(s=>{const i=e.get("list");t=i.$el.querySelector('[data-action="open-sidebar"]'),t&&(t.onclick=()=>{e.showSidebar()},n())})),e.on("user-changed",(e=>{n()}))},e=>{let t=null;e.on("mounted",(()=>{const n=e.get("list");t=n.$el.querySelector(".atk-unread-badge")})),e.on("notifies-updated",(e=>{var n;n=e.length||0,t&&(n>0?(t.innerText=`${Number(n||0)}`,t.style.display="block"):t.style.display="none")}))},e=>{const t=t=>{e.conf.listFetchParamsModifier=t,e.reload()},n=e=>{!function(e){const{$dropdownWrap:t,dropdownList:n}=e;if(t.querySelector(".atk-dropdown"))return;t.classList.add("atk-dropdown-wrap"),t.append(Lt(''));let s=0;const i=(e,t,n,i)=>{i(),s=e,r.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),t.classList.add("active"),r.style.display="none",setTimeout((()=>{r.style.display=""}),80)},r=Lt('
        ');n.forEach(((e,t)=>{const n=e[0],o=e[1],a=Lt('
      • '),l=a.querySelector("span");l.innerText=n,l.onclick=()=>{i(t,a,n,o)},r.append(a),t===s&&a.classList.add("active")})),t.append(r)}({$dropdownWrap:e,dropdownList:[[Wt("sortLatest"),()=>{t((e=>{e.sort_by="date_desc"}))}],[Wt("sortBest"),()=>{t((e=>{e.sort_by="vote"}))}],[Wt("sortOldest"),()=>{t((e=>{e.sort_by="date_asc"}))}],[Wt("sortAuthor"),()=>{t((e=>{e.view_only_admin=!0}))}]]})};e.watchConf(["listSort","locale"],(t=>{const s=e.get("list").$el.querySelector(".atk-comment-count");s&&(t.listSort?n(s):function(e){var t,n;const{$dropdownWrap:s}=e;s.classList.remove("atk-dropdown-wrap"),null==(t=s.querySelector(".atk-arrow-down-icon"))||t.remove(),null==(n=s.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:s}))}))},e=>{let t=0;const n=({locker:n})=>{const s=function(){const e=window.location.hash.match(/#atk-comment-([0-9]+)/);let t=e&&e[1]&&!Number.isNaN(parseFloat(e[1]))?parseFloat(e[1]):null;t||(t=Number(Pt("atk_comment")));return t||null}();s&&(n&&t===s||(t=s,e.trigger("list-goto",s)))},s=()=>n({locker:!1}),i=()=>n({locker:!0});e.on("mounted",(()=>{window.addEventListener("hashchange",s),e.on("list-loaded",i)})),e.on("unmounted",(()=>{window.removeEventListener("hashchange",s),e.off("list-loaded",i)}))},e=>{e.on("list-goto",(t=>k(this,null,(function*(){let n=e.getCommentNodes().find((e=>e.getID()===t));if(!n){const s=(yield e.getApi().comments.getComment(t)).data;e.get("list").getListLayout({forceFlatMode:!0}).insert(s.comment,s.reply_comment),n=e.getCommentNodes().find((e=>e.getID()===t))}n&&n.focus()}))))},e=>{e.on("list-loaded",(t=>{const n=e.get("list"),s=t.length<=0;let i=n.getCommentsWrapEl().querySelector(".atk-list-no-comment");s?i||(i=Lt('
        '),i.innerHTML=pt(n.ctx.conf.noComment||n.ctx.$t("noComment")),n.getCommentsWrapEl().appendChild(i)):null==i||i.remove()}))},e=>{e.on("mounted",(()=>{const t=e.get("list").$el.querySelector(".atk-copyright");t&&(t.innerHTML=`Powered By Artalk`)}))},e=>{let t=null;e.on("mounted",(()=>{t=window.setInterval((()=>{e.get("list").$el.querySelectorAll("[data-atk-comment-date]").forEach((t=>{const n=t.getAttribute("data-atk-comment-date");t.innerText=It(new Date(Number(n)),e.$t)}))}),3e4)})),e.on("unmounted",(()=>{t&&window.clearInterval(t)}))},e=>{e.on("list-fetch",(()=>{nn(e.get("list").$el,null)})),e.on("list-failed",(t=>{ss({$err:e.get("list").$el,errMsg:t.msg,errData:t.data,retryFn:()=>e.fetch({offset:0})})}))},e=>{let t=null;const n=()=>{null==t||t.disconnect(),t=null};e.on("list-loaded",(()=>{n();const s=e.get("list").getCommentsWrapEl().childNodes,i=s.length>2?s[s.length-2]:null;i&&("IntersectionObserver"in window?(s=>{const i=e.conf.scrollRelativeTo&&e.conf.scrollRelativeTo()||null;t=new IntersectionObserver((([t])=>{t.isIntersecting&&(n(),e.trigger("list-reach-bottom"))}),{threshold:.9,root:i}),t.observe(s)})(i):console.warn("IntersectionObserver api not supported"))})),e.on("unmounted",(()=>{n()}))},e=>{const t=()=>{const t=e.get("list"),n=e.conf.scrollRelativeTo&&e.conf.scrollRelativeTo();(n||window).scroll({top:Mt(t.$el,n).top,left:0})};e.on("mounted",(()=>{e.on("list-goto-first",t)})),e.on("unmounted",(()=>{e.off("list-goto-first",t)}))}],e=>{e.on("list-fetch",(t=>{if(0!==t.offset)return;const n=e.getApi().getUserFields();n&&e.getApi().notifies.getNotifies(n).then((t=>{e.getData().updateNotifies(t.data.notifies)}))}))},e=>{e.watchConf(["site","pageKey","pageTitle","countEl","pvEl"],(t=>{ts({getApi:()=>e.getApi(),siteName:t.site,pageKey:t.pageKey,pageTitle:t.pageTitle,countEl:t.countEl,pvEl:t.pvEl,pvAdd:"boolean"!=typeof e.conf.pvAdd||e.conf.pvAdd})}))},e=>{e.watchConf(["apiVersion","versionCheck"],(t=>{const n=e.get("list");t.apiVersion&&t.versionCheck&&!ms&&function(e,t,n){const s=function(e,t){const n=e.split("."),s=t.split(".");for(let i=0;i<3;i++){const e=Number(n[i]),t=Number(s[i]);if(e>t)return 1;if(t>e)return-1;if(!Number.isNaN(e)&&Number.isNaN(t))return 1;if(Number.isNaN(e)&&!Number.isNaN(t))return-1}return 0}(t,n);if(0===s)return;const i=Lt(`
        ${Wt("updateMsg",{name:Wt(s<0?"frontend":"backend")})} ${Wt("currentVersion")}: ${Wt("frontend")} ${t} / ${Wt("backend")} ${n}
        `),r=Lt(`${Wt("ignore")}`);r.onclick=()=>{i.remove(),ms=!0},i.append(r),e.$el.parentElement.prepend(i)}(n,gs,t.apiVersion)}))},e=>{let t;const n=n=>{const s=[e.$root,e.get("layerManager").getEl()];fs||(fs=window.matchMedia("(prefers-color-scheme: dark)")),"auto"===n?(t||(t=e=>ks(s,e.matches),fs.addEventListener("change",t)),ks(s,fs.matches)):(t&&(fs.removeEventListener("change",t),t=void 0),ks(s,n))};e.watchConf(["darkMode"],(e=>n(e.darkMode))),e.on("created",(()=>n(e.conf.darkMode))),e.on("unmounted",(()=>{t&&(null==fs||fs.removeEventListener("change",t)),t=void 0}))}]];function vs(e){return k(this,null,(function*(){var t;const n=[],s=t=>{t.forEach((t=>{"function"!=typeof t||n.includes(t)||(t(e),n.push(t))}))};s(ys);const{data:i}=yield e.getApi().conf.conf().catch((t=>{throw function(e,t){var n;let s="";if(null==(n=t.data)?void 0:n.err_no_site){const t={create_name:e.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};s=`sites|${JSON.stringify(t)}`}ss({$err:e.get("list").$el,errMsg:t.msg||String(t),errData:t.data,retryFn:()=>vs(e),onOpenSidebar:e.get("user").getData().isAdmin?()=>e.showSidebar({view:s}):void 0})}(e,t),t}));let r={apiVersion:null==(t=i.version)?void 0:t.version};if(e.conf.useBackendConf){if(!i.frontend_conf)throw new Error("The remote backend does not respond to the frontend conf, but `useBackendConf` conf is enabled");r=u(u({},r),function(e){const t=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(e).forEach((n=>{t.includes(n)&&delete e[n]})),e.emoticons&&"string"==typeof e.emoticons&&(e.emoticons=e.emoticons.trim(),e.emoticons.startsWith("[")||e.emoticons.startsWith("{")?e.emoticons=JSON.parse(e.emoticons):"false"===e.emoticons&&(e.emoticons=!1)),e}(i.frontend_conf))}e.conf.remoteConfModifier&&e.conf.remoteConfModifier(r),r.pluginURLs&&(yield function(e,t){return k(this,null,(function*(){if(!e||!Array.isArray(e))return[];const n=[];return e.forEach((e=>{/^(http|https):\/\//.test(e)||(e=`${t.replace(/\/$/,"")}/${e.replace(/^\//,"")}`),n.push(new Promise(((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const s=document.createElement("script");s.src=e,document.head.appendChild(s),s.onload=()=>t(),s.onerror=e=>n(e)})))})),yield Promise.all(n),Object.values(window.ArtalkPlugins||{})}))}(r.pluginURLs,e.conf.server).then((e=>{s(e)})).catch((e=>{console.error("Failed to load plugin",e)}))),e.trigger("created"),e.updateConf(r),e.trigger("mounted"),e.conf.remoteConfModifier||e.fetch({offset:0})}))}class $s{constructor(e){g(this,"ctx");const t=Qt(e,!0);this.ctx=new Kt(t),Object.entries(es).forEach((([e,t])=>{const n=t(this.ctx);n&&this.ctx.inject(e,n)})),vs(this.ctx)}getConf(){return this.ctx.getConf()}getEl(){return this.ctx.$root}update(e){return this.ctx.updateConf(e),this}reload(){this.ctx.reload()}destroy(){for(this.ctx.trigger("unmounted");this.ctx.$root.firstChild;)this.ctx.$root.removeChild(this.ctx.$root.firstChild)}on(e,t){this.ctx.on(e,t)}off(e,t){this.ctx.off(e,t)}trigger(e,t){this.ctx.trigger(e,t)}setDarkMode(e){this.ctx.setDarkMode(e)}static init(e){return new $s(e)}static use(e){ys.includes(e)||ys.push(e)}static loadCountWidget(e){const t=Qt(e,!0);ts({getApi:()=>new C(Vt(t)),siteName:t.site,countEl:t.countEl,pvEl:t.pvEl,pvAdd:!1})}get $root(){return this.ctx.$root}get conf(){return this.ctx.getConf()}}const bs=$s.init,ws=$s.use,xs=$s.loadCountWidget;e.default=$s,e.init=bs,e.loadCountWidget=xs,e.use=ws,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); //# sourceMappingURL=Artalk.js.map diff --git a/assets/lib/artalk/ArtalkLite.css b/assets/lib/artalk/ArtalkLite.css index 37f9a8f04..dbfea5209 100644 --- a/assets/lib/artalk/ArtalkLite.css +++ b/assets/lib/artalk/ArtalkLite.css @@ -1 +1 @@ -@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #FFF;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:#0083ff33}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}.atk-comment>.atk-main>.atk-header .atk-verified-icon{height:1.4em;width:1.4em;background-repeat:no-repeat;background-position:center;background-size:contain;display:block;background-image:url('data:image/svg+xml,')}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-word}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:5px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:25px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:10px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{text-align:right}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{float:initial;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:60px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor.editor-traveling{margin-top:5px;margin-bottom:10px}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;row-gap:5px;justify-content:space-between;padding:5px;flex-wrap:wrap}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-state-wrap{margin-right:5px}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-plug-btn-wrap{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;row-gap:5px}.atk-main-editor>.atk-bottom .atk-plug-btn{display:flex;justify-content:center;place-items:center;padding:0 10px;line-height:30px;height:30px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;word-break:keep-all}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:5px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{display:flex;justify-content:center;place-items:center;color:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn i:not(:first-child){margin-left:4px}.atk-main-editor>.atk-bottom .atk-state-btn{z-index:2;height:30px;padding:0 0 0 10px;font-size:14px;position:relative;display:flex;flex-direction:row;justify-content:center;place-items:center;background:var(--at-color-bg-grey-transl);cursor:pointer;overflow:hidden;border-radius:3px}.atk-main-editor>.atk-bottom .atk-state-btn:hover .atk-cancel{background:#0000000a}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-state-btn{padding:0}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{display:none}}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 8px 0 2px;max-width:8em}.atk-main-editor>.atk-bottom .atk-state-btn .atk-cancel{display:flex;justify-content:center;place-items:center;padding:0 10px;font-weight:700;height:100%;background:#00000005}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;min-width:7.3em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-send-btn{min-width:6em}}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px;font-size:22px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover :after{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-icon:after{display:block;content:"";width:1em;height:1em;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del:after{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-yes:after,.atk-icon-check:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-close-slim:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-arrow-left:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-icon-no:after,.atk-icon-close:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close:after{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:#0000004d}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} +@charset "UTF-8";.artalk,.atk-layer-wrap{--at-color-font: #2a2e2e;--at-color-deep: #2a2e2e;--at-color-sub: #757575;--at-color-grey: #747474;--at-color-meta: #697182;--at-color-border: #eceff2;--at-color-light: #4285f4;--at-color-bg: #fff;--at-color-bg-transl: rgba(255, 255, 255, .94);--at-color-bg-grey: #f3f4f5;--at-color-bg-grey-transl: rgba(244, 244, 244, .75);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(255, 255, 255))}.artalk.atk-dark-mode,.atk-layer-wrap.atk-dark-mode{--at-color-font: #fff;--at-color-deep: #e7e7e7;--at-color-sub: #e7e7e7;--at-color-grey: #fff;--at-color-meta: #fff;--at-color-border: #2d3235;--at-color-light: #687a86;--at-color-bg: #1e2224;--at-color-bg-transl: rgba(30, 34, 36, .95);--at-color-bg-grey: #46494e;--at-color-bg-grey-transl: rgba(8, 8, 8, .95);--at-color-bg-light: rgba(29, 161, 242, .1);--at-color-main: #0083ff;--at-color-red: #ff5652;--at-color-pink: #fa5a57;--at-color-yellow: #ff7c37;--at-color-green: #4caf50;--at-color-gradient: linear-gradient(180deg, transparent, rgba(30, 34, 36, 1))}.atk-comment-wrap{overflow:hidden;position:relative;border-bottom:1px solid transparent}.atk-comment-wrap.atk-flash-once{animation:atkFlashOnce 1s ease-in-out 0s}@keyframes atkFlashOnce{0%{background:#0083ff33}to{background:transparent}}.atk-comment-wrap.atk-unread:before{content:" ";position:absolute;left:0;top:10%;width:3px;height:80%;background:var(--at-color-main)}.atk-comment-wrap.atk-openable{cursor:pointer}.atk-comment-wrap.atk-openable:hover{background:var(--at-color-bg-grey)}.atk-comment-wrap.atk-openable .atk-height-limit:after{background:transparent!important}.atk-comment-wrap:last-child{border-bottom:none}.atk-comment{display:block;padding:10px}.atk-comment>.atk-avatar{display:block;padding:2px 0;float:left}.atk-comment>.atk-avatar img{width:50px;height:50px;border-radius:3px}.atk-comment>.atk-main{display:block;margin-left:63px}.atk-comment>.atk-main>.atk-header{line-height:1.5;font-size:13px;margin-bottom:.5em;overflow:hidden;position:relative;display:flex;flex-wrap:wrap;align-items:center}.atk-comment>.atk-main>.atk-header .atk-item{display:flex;align-items:center;margin-top:2px;margin-bottom:2px;color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-header .atk-item:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-item.atk-nick,.atk-comment>.atk-main>.atk-header .atk-item.atk-nick a{font-size:14px;color:var(--at-color-main);text-decoration:none}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at{margin-left:2px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-arrow:before{content:"";vertical-align:middle;transform:rotate(90deg);border-bottom:4px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;display:inline-block;margin-top:-1px}.atk-comment>.atk-main>.atk-header .atk-item.atk-reply-at>.atk-nick{color:var(--at-color-main);cursor:pointer;margin-left:6px}.atk-comment>.atk-main>.atk-header .badge,.atk-comment>.atk-main>.atk-header .atk-ua,.atk-comment>.atk-main>.atk-header .atk-pinned-badge,.atk-comment>.atk-main>.atk-header .atk-region-badge,.atk-comment>.atk-main>.atk-header .atk-badge{display:inline-block;color:var(--at-color-meta);background:var(--at-color-bg-grey);padding:0 6px;line-height:17px;border-radius:3px}.atk-comment>.atk-main>.atk-header .badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-ua:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-pinned-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-region-badge:not(:last-child),.atk-comment>.atk-main>.atk-header .atk-badge:not(:last-child){margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge-wrap>*:last-child{margin-right:6px}.atk-comment>.atk-main>.atk-header .atk-badge{color:#fff}.atk-comment>.atk-main>.atk-header .atk-pinned-badge{color:#fff;background:#f44336}.atk-comment>.atk-main>.atk-header .atk-verified-icon{height:1.4em;width:1.4em;background-repeat:no-repeat;background-position:center;background-size:contain;display:block;background-image:url('data:image/svg+xml,')}@media only screen and (max-width: 768px){.atk-comment>.atk-main>.atk-header .atk-ua-wrap{display:block}}.atk-comment>.atk-main>.atk-body{display:block;overflow:hidden;position:relative}.atk-comment>.atk-main>.atk-body img{max-width:100%}.atk-comment>.atk-main>.atk-body>.atk-content{word-break:break-word}.atk-comment>.atk-main>.atk-body>.atk-content.atk-type-collapsed{border:3px solid var(--at-color-bg-grey);border-bottom:0;padding:5px 10px;border-radius:6px 6px 0 0;margin-bottom:-5px}.atk-comment>.atk-main>.atk-body>.atk-content>*:first-child{margin-top:0}.atk-comment>.atk-main>.atk-body>.atk-content>*:last-child{margin-bottom:0}.atk-comment>.atk-main>.atk-body>.atk-content .atk-height-limit-btn{bottom:5px}.atk-comment>.atk-main>.atk-body>.atk-pending{color:var(--at-color-meta);margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-left:4px solid #f44336}.atk-comment>.atk-main>.atk-body>.atk-reply-to{padding:5px 15px;border-left:3px solid var(--at-color-border);margin-bottom:10px;position:relative;margin-top:10px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta{font-size:15px}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-meta .atk-nick{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-body>.atk-reply-to .atk-content{margin-top:5px}.atk-comment>.atk-main>.atk-body>.atk-collapsed{margin:3px 0;font-size:13px;padding:10px 18px;display:block;background:var(--at-color-bg-grey);border-radius:6px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-text{color:var(--at-color-meta)}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn{color:var(--at-color-main);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:3px}.atk-comment>.atk-main>.atk-body>.atk-collapsed .atk-show-btn:hover{color:var(--at-color-main)}.atk-comment>.atk-main>.atk-footer{margin-top:5px}.atk-comment>.atk-main>.atk-footer .atk-actions{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.atk-comment>.atk-main>.atk-footer .atk-actions>span{color:var(--at-color-meta);font-size:13px;line-height:25px;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error,.atk-comment>.atk-main>.atk-footer .atk-actions>span.atk-error:hover{color:var(--at-color-red)}.atk-comment>.atk-main>.atk-footer .atk-actions>span:not(:last-child):not(.atk-hide){margin-right:16px}.atk-comment>.atk-main>.atk-footer .atk-actions>span:hover{color:var(--at-color-deep)}.atk-comment .atk-height-limit:after{position:absolute;z-index:1;display:block;overflow:hidden;width:100%;content:" ";bottom:0;height:80px;background:var(--at-color-gradient)}.atk-comment .atk-height-limit-btn{z-index:2;position:absolute;left:50%;bottom:10px;transform:translate(-50%);cursor:pointer;border:1px solid var(--at-color-border);border-radius:6px;background:var(--at-color-bg);padding:1px 20px;font-size:15px;color:var(--at-color-meta);-webkit-user-select:none;-moz-user-select:none;user-select:none}.atk-comment .atk-height-limit-btn:hover{background:var(--at-color-bg-grey)}.atk-comment .atk-height-limit .atk-height-limit .atk-height-limit-btn{display:none}.atk-comment .atk-height-limit-scroll{margin-top:10px;overflow-y:auto;background:linear-gradient(var(--at-color-bg) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-bg) calc(100% - 1px) 1px) center bottom,linear-gradient(var(--at-color-border) 1px,transparent 1px calc(100% - 1px)) center top,linear-gradient(transparent calc(100% - 1px),var(--at-color-border) calc(100% - 1px) 1px) center bottom;background-repeat:no-repeat;background-color:transparent;background-size:100% 1px,100% 1px,100% 1px,100% 1px;background-attachment:local,local,scroll,scroll}.atk-comment-children>.atk-comment-wrap{margin-top:10px;border-left:1px dashed transparent;border-bottom-color:transparent}.atk-comment-children>.atk-comment-wrap:not(:last-child){margin-bottom:10px}.atk-comment-children>.atk-comment-wrap>.atk-comment{padding:0}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-avatar img{width:36px;height:36px}.atk-comment-children>.atk-comment-wrap>.atk-comment>.atk-main{margin-left:47px}.artalk>.atk-list{position:relative}.artalk>.atk-list>.atk-list-header{display:flex;flex-direction:row;padding:10px 17px}.artalk>.atk-list>.atk-list-header .atk-text{display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap{position:relative;cursor:pointer}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-arrow-down-icon{cursor:pointer;vertical-align:middle;border-top:5px solid var(--at-color-grey);border-left:3px solid transparent;border-right:3px solid transparent;margin-top:-1px;margin-left:.8rem;display:inline-block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap:hover .atk-dropdown{display:block}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown{z-index:3;display:none;height:auto!important;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;width:100%;background-color:var(--at-color-bg);padding:.6rem 0;border:1px solid var(--at-color-border);text-align:center;border-radius:6px;white-space:nowrap;margin:0;list-style:none}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{display:block;line-height:2rem;position:relative;border-bottom:none;font-weight:400;padding:0 1.5rem}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item span:hover,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a:hover{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item.active span,.artalk>.atk-list>.atk-list-header .atk-dropdown-wrap .atk-dropdown-item a{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-comment-count{font-size:15px}.artalk>.atk-list>.atk-list-header .atk-comment-count .atk-comment-count-num{font-size:22px;margin-right:4px}.artalk>.atk-list>.atk-list-header .atk-right-action{display:flex;flex:1;flex-direction:row;align-items:center;justify-content:flex-end}.artalk>.atk-list>.atk-list-header .atk-right-action>span{font-size:14px;color:var(--at-color-meta);cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative}.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on,.artalk>.atk-list>.atk-list-header .atk-right-action>span.atk-on *{color:var(--at-color-main)}.artalk>.atk-list>.atk-list-header .atk-right-action>span:not(:last-child):not(.atk-hide){margin-right:10px;padding-right:10px}.artalk>.atk-list>.atk-list-header .atk-right-action>span .atk-unread-badge{position:absolute;top:-5px;left:-6px;color:#fff;background:var(--at-color-pink);text-align:center;min-width:16px;height:16px;padding:0 3px;border-radius:8px;line-height:16px;font-size:12px}.artalk>.atk-list>.atk-list-body{min-height:150px}.artalk>.atk-list>.atk-list-footer{text-align:right}@media only screen and (max-width: 768px){.artalk>.atk-list>.atk-list-footer{float:initial;text-align:center}}.artalk>.atk-list>.atk-list-footer .atk-copyright{display:block;font-size:12px;color:var(--at-color-meta);padding-right:15px}.artalk>.atk-list>.atk-list-footer .atk-copyright a{color:var(--at-color-main);text-decoration:none}.atk-list-no-comment{height:150px;display:flex;font-size:19px;justify-content:center;align-items:center;word-break:break-word;text-align:center}.atk-list-read-more{border-top:1px dashed var(--at-color-border);margin-top:28px;padding-bottom:25px}@media only screen and (max-width: 768px){.atk-list-read-more{padding-bottom:10px}}.atk-list-read-more.atk-err .atk-text{color:var(--at-color-red)!important}.atk-list-read-more .atk-list-read-more-inner{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 15px;font-size:14px;border-radius:6px;border:1px solid transparent;display:flex;height:30px;flex-direction:row;place-content:center;align-items:center;width:120px;margin:-15px auto 0;background:var(--at-color-bg);border-color:var(--at-color-border)}.atk-list-read-more .atk-list-read-more-inner>.atk-loading-icon{height:15px;width:15px}.atk-list-read-more .atk-list-read-more-inner>.atk-text{color:var(--at-color-meta)}.atk-list-read-more .atk-list-read-more-inner:hover{background:var(--at-color-bg-grey)}.atk-pagination{display:flex;flex-direction:row;justify-content:center;padding:10px 0;position:relative}.atk-pagination>.atk-btn,.atk-pagination>.atk-input{height:30px;border:1px solid var(--at-color-border);border-radius:3px;padding:0 5px;text-align:center;background:var(--at-color-bg)}.atk-pagination>.atk-btn{-webkit-user-select:none;-moz-user-select:none;user-select:none;width:60px;cursor:pointer;display:flex;justify-content:center;align-items:center}.atk-pagination>.atk-btn:hover{background:var(--at-color-bg-grey)}.atk-pagination>.atk-btn.atk-disabled{color:var(--at-color-sub)}.atk-pagination>.atk-btn.atk-disabled:hover{cursor:default;background:initial}.atk-pagination>.atk-input{background:transparent;color:var(--at-color-font);font-size:18px;width:60px;outline:none}.atk-pagination>.atk-input:focus{border-color:var(--at-color-main)}.atk-pagination>*:not(:last-child){margin-right:10px}.atk-main-editor{position:relative;overflow:hidden;background:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:6px;margin-bottom:10px}@media only screen and (max-width: 768px){.atk-main-editor{margin-bottom:7px}}.atk-main-editor.editor-traveling{margin-top:5px;margin-bottom:10px}.atk-main-editor>.atk-header{display:flex;flex-direction:row;padding:10px 14px 0}.atk-main-editor>.atk-header input{flex:1;width:100%;font-size:14px;background:transparent;border:2px solid transparent;border-radius:3px;padding:6px 5px;resize:none;outline:none}.atk-main-editor>.atk-header input:not(:last-child){margin-right:2px}.atk-main-editor>.atk-textarea-wrap{position:relative}.atk-main-editor>.atk-textarea-wrap>.atk-textarea{display:block;overflow:hidden;color:var(--at-color-font);font-size:15px;background-color:var(--at-color-bg);border:2px solid transparent;border-radius:3px;width:100%;min-height:120px;margin-top:2px;padding:10px 20px;resize:none;word-wrap:break-word;outline:none}.atk-main-editor>.atk-textarea-wrap>.atk-comment-closed{pointer-events:none;color:var(--at-color-meta);font-size:12px;background-color:var(--at-color-bg);border-top:1px solid var(--at-color-border);padding:5px 15px;margin-top:10px}.atk-main-editor>.atk-plug-panel-wrap{position:relative;height:180px;width:100%;overflow:hidden;border-top:1px solid var(--at-color-border);animation:.3s both atkFadeIn;transition:.2s height ease-in-out}.atk-main-editor>.atk-bottom{display:flex;flex-direction:row;row-gap:5px;justify-content:space-between;padding:5px;flex-wrap:wrap}.atk-main-editor>.atk-bottom>.atk-item{display:flex;flex-direction:row;align-items:center}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-state-wrap{margin-right:5px}.atk-main-editor>.atk-bottom>.atk-bottom-left>.atk-plug-btn-wrap{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;row-gap:5px}.atk-main-editor>.atk-bottom .atk-plug-btn{display:flex;justify-content:center;place-items:center;padding:0 10px;line-height:30px;height:30px;cursor:pointer;color:var(--at-color-grey);font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;word-break:keep-all}.atk-main-editor>.atk-bottom .atk-plug-btn:not(:last-child){margin-right:5px}.atk-main-editor>.atk-bottom .atk-plug-btn:hover{background:var(--at-color-bg-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn.active{color:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn.active svg.markdown path{fill:var(--at-color-main)}.atk-main-editor>.atk-bottom .atk-plug-btn i{display:flex;justify-content:center;place-items:center;color:var(--at-color-grey)}.atk-main-editor>.atk-bottom .atk-plug-btn i:not(:first-child){margin-left:4px}.atk-main-editor>.atk-bottom .atk-state-btn{z-index:2;height:30px;padding:0 0 0 10px;font-size:14px;position:relative;display:flex;flex-direction:row;justify-content:center;place-items:center;background:var(--at-color-bg-grey-transl);cursor:pointer;overflow:hidden;border-radius:3px}.atk-main-editor>.atk-bottom .atk-state-btn:hover .atk-cancel{background:#0000000a}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-state-btn{padding:0}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{display:none}}.atk-main-editor>.atk-bottom .atk-state-btn .atk-text-wrap{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 8px 0 2px;max-width:8em}.atk-main-editor>.atk-bottom .atk-state-btn .atk-cancel{display:flex;justify-content:center;place-items:center;padding:0 10px;font-weight:700;height:100%;background:#00000005}.atk-main-editor>.atk-bottom .atk-send-btn{background:var(--at-color-main);color:#fff;font-size:14px;border:none;margin:0;height:30px;min-width:7.3em;cursor:pointer;transition:opacity .3s ease-in-out;outline:none;border-radius:3px}@media only screen and (max-width: 768px){.atk-main-editor>.atk-bottom .atk-send-btn{min-width:6em}}.atk-main-editor>.atk-bottom .atk-send-btn:active{opacity:.9}.atk-main-editor>.atk-notify-wrap{z-index:3;position:absolute;right:-2px;bottom:40px;width:225px;opacity:.83}.atk-sidebar-layer{position:fixed;z-index:99999;top:0;right:0;width:430px;height:100%;background:var(--at-color-bg);transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms;transform:translate(430px)}@media only screen and (max-width: 430px){.atk-sidebar-layer{width:100%}}.atk-sidebar-layer .atk-sidebar-inner{position:relative;height:100%}.atk-sidebar-layer .atk-sidebar-header{position:absolute;top:0;right:0;display:flex;flex-direction:row;align-items:center;z-index:99999}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close{display:flex;flex-direction:column;width:60px;height:60px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px;font-size:22px}.atk-sidebar-layer .atk-sidebar-header .atk-sidebar-close:hover :after{background-color:#e81123e6}.atk-sidebar-layer .atk-sidebar-iframe-wrap{height:100%;position:relative}.atk-sidebar-layer .atk-sidebar-iframe-wrap iframe{border:0;width:100%;height:100%}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert{z-index:9999;top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;background:var(--at-color-bg);padding:40px 30px;width:80%;text-align:center;border-radius:4px}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-title{font-size:1.4em;margin-bottom:20px;color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text{color:var(--at-color-font)}.atk-sidebar-layer .atk-sidebar-iframe-wrap .atk-err-alert .atk-text span{cursor:pointer;color:var(--at-color-main)}.artalk{position:relative;width:100%;min-height:200px}.artalk,.atk-layer-wrap{color:var(--at-color-font);word-wrap:break-word;word-break:break-word}.artalk *,.atk-layer-wrap *{box-sizing:border-box}.artalk input,.artalk textarea,.artalk button,.artalk optgroup,.artalk select,.atk-layer-wrap input,.atk-layer-wrap textarea,.atk-layer-wrap button,.atk-layer-wrap optgroup,.atk-layer-wrap select{font-family:inherit;color:inherit;font-size:inherit}.artalk code,.atk-layer-wrap code{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif;margin:0 .05em;padding:0 .4em;display:inline-block;vertical-align:middle;font-size:.9em;background-color:var(--at-color-bg-grey);color:var(--at-color-font);border-radius:2px}.artalk pre,.atk-layer-wrap pre{margin:10px 0 0;padding:0;line-height:0}.artalk pre code,.atk-layer-wrap pre code{line-height:1.6em;display:block;padding:10px 15px;white-space:pre-wrap!important;background-color:var(--at-color-bg-grey);color:var(--at-color-font);margin:0}.artalk pre code *,.atk-layer-wrap pre code *{font-family:source code pro,Consolas,Monaco,Menlo,sans-serif}.artalk a,.atk-layer-wrap a{color:var(--at-color-main);text-decoration:none}.artalk blockquote,.atk-layer-wrap blockquote{position:static;margin:10px 0;padding:10px 20px;background:var(--at-color-bg-grey);border-left:4px solid #687a86;color:var(--at-color-font)}.artalk p:first-child,.atk-layer-wrap p:first-child{margin-top:0}.artalk p:last-child,.atk-layer-wrap p:last-child{margin-bottom:0}.artalk img,.atk-layer-wrap img{max-width:100%}.artalk table,.atk-layer-wrap table{width:100%;border-collapse:collapse;border-spacing:0;margin-bottom:1.5em;font-size:.96em}.artalk td,.artalk th,.atk-layer-wrap td,.atk-layer-wrap th{text-align:left;padding:4px 8px 4px 10px;border:1px solid var(--at-color-border)}.artalk td,.atk-layer-wrap td{vertical-align:top}.artalk tr:nth-child(2n),.atk-layer-wrap tr:nth-child(2n){background-color:var(--at-color-bg-grey)}.artalk ul,.atk-layer-wrap ul{list-style:disc}.artalk ol,.atk-layer-wrap ol{list-style:decimal}.artalk li+li,.atk-layer-wrap li+li{margin-top:8px}.artalk li>ol,.artalk li>ul,.atk-layer-wrap li>ol,.atk-layer-wrap li>ul{margin:8px 0 0}.atk-hide{display:none!important}.atk-full-layer,.atk-layer-dialog-wrap,.atk-error-layer,.atk-loading{width:100%;height:100%;position:absolute;top:0;left:0;background:var(--at-color-bg);z-index:4;align-items:center;justify-content:center;flex-flow:column;display:flex}.atk-loading-spinner{position:relative;width:50px;height:50px}.atk-loading-spinner svg{animation:atkRotate 2s linear infinite;transform-origin:center center;width:100%;height:100%;position:absolute;top:0;left:0}.atk-loading-spinner svg circle{stroke-dasharray:1,200;stroke-dashoffset:0;animation:atkDash 1.5s ease-in-out infinite,atkColor 6s ease-in-out infinite;stroke-linecap:round}@keyframes atkRotate{to{transform:rotate(360deg)}}@keyframes atkDash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes atkColor{0%,to{stroke:#ff5652}40%{stroke:#2196f3}66%{stroke:#32c787}80%,90%{stroke:#ffc107}}@keyframes atkLoadingIconRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-loading-icon{width:18px;height:18px;box-sizing:border-box;border:solid 1px transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;animation:atkLoadingIconRotate .4s linear infinite}.atk-fade-in{animation:atkFadeIn both .3s}.atk-fade-out{animation:atkFadeOut both .2s}.atk-rotate{animation:atkRotate 2s linear infinite}@keyframes atkFadeIn{0%{opacity:0}to{opacity:1}}@keyframes atkFadeOut{to{opacity:0}}@keyframes atkRotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.atk-icon:after{display:block;content:"";width:1em;height:1em;background-color:var(--at-color-deep);background-size:contain;background-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:contain;mask-size:contain}.atk-icon-sync:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.99133 4.87635C2.22512 7.64257 2.22512 12.1275 4.99133 14.8937C6.04677 15.9491 7.3524 16.6019 8.71732 16.8519' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M14.4179 15.4815L15.0072 14.8922C17.7734 12.126 17.7734 7.64107 15.0072 4.87486C13.9518 3.81942 12.6461 3.16668 11.2812 2.91664' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M6.17106 4.99252L5.58181 4.40327L4.99255 3.81401H6.17106V4.99252Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M13.8299 15.0084L14.4192 15.5976L15.0084 16.1869H13.8299V15.0084Z' fill='%23C4C4C4' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-del:after{background-color:var(--at-color-red)!important;-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.29167 5.04166L4.81251 5.04166M4.81251 5.04166L4.81251 18.3333C4.81251 18.5865 5.01771 18.7917 5.27084 18.7917L16.7292 18.7917C16.9823 18.7917 17.1875 18.5865 17.1875 18.3333V5.04166M4.81251 5.04166L7.33334 5.04166M17.1875 5.04166L19.7083 5.04166M17.1875 5.04166L14.6667 5.04166M7.33334 5.04166V3.20833L14.6667 3.20833V5.04166M7.33334 5.04166L14.6667 5.04166' stroke='%23D06565' stroke-width='2'/%3E%3Cpath d='M9.16667 8.25V15.125M12.8333 8.25V15.125' stroke='%23D06565' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-edit:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.70618 4.08515L12.6081 7.06376M1.00041 13.021L11.7376 2L14.6392 4.97861L3.90274 16H1L1.00041 13.021Z' stroke='%234E5969' stroke-width='1.5'/%3E%3C/svg%3E")}.atk-icon-yes:after,.atk-icon-check:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.7071 5.75533L9.92197 17.5404L3.29285 10.9113' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-plus:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.08331 10H17.9166' stroke='%234E5969' stroke-width='2'/%3E%3Cpath d='M10 2.08334L10 17.9167' stroke='%234E5969' stroke-width='2'/%3E%3C/svg%3E")}.atk-icon-close-slim:after{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='25' viewBox='0 0 25 25' fill='none'%3E%3Cpath d='M19.8657 5.13431L12.5 12.5L5.13431 19.8657' stroke='%234E5969'/%3E%3Cpath d='M5.13431 5.13432L12.5 12.5L19.8657 19.8657' stroke='%234E5969'/%3E%3C/svg%3E")}.atk-icon-arrow-left:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-icon-no:after,.atk-icon-close:after{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}.atk-error-layer{background-color:var(--at-color-bg-transl)}.atk-error-layer .atk-error-title{color:var(--at-color-red)}.atk-error-layer .atk-warn-title{color:var(--at-color-yellow)}.atk-error-layer .atk-error-title,.atk-error-layer .atk-warn-title{display:inline-block;padding:0 15px;margin-bottom:20px;font-size:20px;letter-spacing:-.5px}.atk-error-layer .atk-error-text{text-align:center;padding:0 20px}.atk-error-layer .atk-error-text *{color:var(--at-color-deep)}.atk-error-layer .atk-error-text a{color:var(--at-color-meta)}.atk-version-check-notice{background:var(--at-color-bg-grey);border-radius:6px;padding:10px 20px;margin-bottom:10px;font-size:14px}.atk-version-check-notice .atk-info{color:var(--at-color-meta)}.atk-version-check-notice .atk-ignore-btn{cursor:pointer;float:right}.atk-version-check-notice .atk-ignore-btn:hover{opacity:.8}.atk-layer-dialog-wrap{background-color:var(--at-color-bg-transl)}.atk-layer-dialog-wrap>.atk-layer-dialog{width:25%}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content .atk-captcha-img{cursor:pointer;width:170px;height:auto;margin-right:10px;padding-right:10px;border-right:1px solid var(--at-color-border);vertical-align:bottom}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-content input{width:100%;line-height:34px;background-color:var(--at-color-bg);border:1px solid var(--at-color-border);border-radius:3px;outline:none;padding:0 6px;display:block;margin-top:10px;margin-bottom:5px;text-align:center}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions{display:flex;flex-direction:row}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button{flex:1;display:block;cursor:pointer;border:1px solid var(--at-color-main);background:transparent;color:var(--at-color-main);border-radius:3px;padding:0 15px;line-height:30px;outline:none}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:active{color:#fff;background:var(--at-color-main)}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button:not(:last-child){margin-right:5px}.atk-layer-dialog-wrap>.atk-layer-dialog>.atk-layer-dialog-actions button.error{color:#fff;background:#ff5652;border-color:#ff5652}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap{position:fixed;z-index:999998;left:0;top:0;height:100vh;width:100vw}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap>iframe{width:100%;height:100%;border:0}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn{z-index:999999;position:fixed;top:20px;right:20px;display:flex;flex-direction:column;width:50px;height:50px;align-items:center;place-content:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;margin-left:10px}.atk-layer-dialog-wrap>.atk-layer-dialog .atk-checker-iframe-wrap .atk-close-btn:hover .atk-icon-close:after{background-color:#e81123e6}@media only screen and (max-width: 768px){.atk-layer-dialog-wrap>.atk-layer-dialog{width:90%!important}}.atk-notify{display:block;overflow:hidden;background-color:#2c2c2c;color:#fff;border-radius:3px;cursor:pointer;font-size:14px;padding:5px 15px}.atk-notify:not(:last-child){margin-bottom:3px}.atk-notify .atk-notify-content{color:#fff}.atk-layer-wrap .atk-layer-mask{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998;background:#0000004d}.atk-layer-wrap .atk-layer-item{position:fixed;z-index:99999;top:0;right:0;width:100%;height:100%}.atk-common-action-btn.atk-btn-confirm,.atk-common-action-btn.atk-btn-warn{color:var(--at-color-yellow)!important}.atk-common-action-btn.atk-btn-error{color:var(--at-color-red)!important}.atk-common-action-btn.atk-btn-success{color:var(--at-color-green)!important}img[atk-emoticon]{max-height:60px;display:initial}.atk-slim-scrollbar::-webkit-scrollbar,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active,.atk-editor-plug-emoticons>.atk-grp-wrap::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-emoticons{height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp{display:flex;flex-wrap:wrap;flex-direction:row;padding:5px 10px 35px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp[data-type=image]>.atk-item{height:63px;width:63px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item{display:flex;align-items:center;justify-content:center;padding:5px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:3px;font-size:15px;min-width:35px;margin:2px}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item>img{max-height:100%;width:auto}.atk-editor-plug-emoticons>.atk-grp-wrap>.atk-grp>.atk-item:hover{background:var(--at-color-bg-grey)}.atk-editor-plug-emoticons>.atk-grp-switcher{position:absolute;bottom:0;left:0;width:100%;background:var(--at-color-bg-transl);height:30px;border-top:1px solid var(--at-color-border);border-bottom:1px solid var(--at-color-border)}.atk-editor-plug-emoticons>.atk-grp-switcher>span{-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:0 10px;line-height:30px;float:left;display:block;cursor:pointer;font-size:14px}.atk-editor-plug-emoticons>.atk-grp-switcher>span:hover,.atk-editor-plug-emoticons>.atk-grp-switcher>span.active{background:var(--at-color-bg-grey)}.atk-slim-scrollbar::-webkit-scrollbar{width:4px;height:4px;background:transparent}.atk-slim-scrollbar::-webkit-scrollbar-thumb,.atk-slim-scrollbar::-webkit-scrollbar-thumb:window-inactive{background:#5656564d}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:hover{background:#414a52c4}.atk-slim-scrollbar::-webkit-scrollbar-thumb:vertical:active{background:#292f35c4}.atk-editor-plug-preview{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding:10px 15px} diff --git a/assets/lib/artalk/ArtalkLite.js b/assets/lib/artalk/ArtalkLite.js index 38d0f512f..dfb5078f3 100644 --- a/assets/lib/artalk/ArtalkLite.js +++ b/assets/lib/artalk/ArtalkLite.js @@ -7,5 +7,5 @@ * @contact API Support (https://artalk.js.org) * * Artalk is a modern comment system based on Golang. - */let m=class extends p{constructor(){super(...arguments),h(this,"cache",{flushCache:(t={})=>this.request(c({path:"/cache/flush",method:"POST",secure:!0,format:"json"},t)),warmUpCache:(t={})=>this.request(c({path:"/cache/warm_up",method:"POST",secure:!0,format:"json"},t))}),h(this,"captcha",{getCaptcha:(t={})=>this.request(c({path:"/captcha",method:"GET",format:"json"},t)),getCaptchaStatus:(t={})=>this.request(c({path:"/captcha/status",method:"GET",format:"json"},t)),verifyCaptcha:(t,e={})=>this.request(c({path:"/captcha/verify",method:"POST",body:t,type:"application/json",format:"json"},e))}),h(this,"comments",{getComments:(t,e={})=>this.request(c({path:"/comments",method:"GET",query:t,secure:!0,type:"application/json",format:"json"},e)),createComment:(t,e={})=>this.request(c({path:"/comments",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),getComment:(t,e={})=>this.request(c({path:`/comments/${t}`,method:"GET",type:"application/json",format:"json"},e)),updateComment:(t,e,n={})=>this.request(c({path:`/comments/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deleteComment:(t,e={})=>this.request(c({path:`/comments/${t}`,method:"DELETE",secure:!0,format:"json"},e))}),h(this,"conf",{conf:(t={})=>this.request(c({path:"/conf",method:"GET",format:"json"},t)),getDomain:(t,e={})=>this.request(c({path:"/conf/domain",method:"GET",query:t,format:"json"},e))}),h(this,"notifies",{getNotifies:(t,e={})=>this.request(c({path:"/notifies",method:"GET",query:t,type:"application/json",format:"json"},e)),markAllNotifyRead:(t,e={})=>this.request(c({path:"/notifies/read",method:"POST",body:t,type:"application/json",format:"json"},e)),markNotifyRead:(t,e,n={})=>this.request(c({path:`/notifies/${t}/${e}`,method:"POST",format:"json"},n))}),h(this,"pages",{getPages:(t,e={})=>this.request(c({path:"/pages",method:"GET",query:t,secure:!0,type:"application/json",format:"json"},e)),fetchAllPages:(t,e={})=>this.request(c({path:"/pages/fetch",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),getPageFetchStatus:(t={})=>this.request(c({path:"/pages/fetch/status",method:"GET",secure:!0,format:"json"},t)),logPv:(t,e={})=>this.request(c({path:"/pages/pv",method:"POST",body:t,type:"application/json",format:"json"},e)),updatePage:(t,e,n={})=>this.request(c({path:`/pages/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deletePage:(t,e={})=>this.request(c({path:`/pages/${t}`,method:"DELETE",secure:!0,format:"json"},e)),fetchPage:(t,e={})=>this.request(c({path:`/pages/${t}/fetch`,method:"POST",secure:!0,type:"application/json",format:"json"},e))}),h(this,"sendEmail",{sendEmail:(t,e={})=>this.request(c({path:"/send_email",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e))}),h(this,"settings",{getSettings:(t={})=>this.request(c({path:"/settings",method:"GET",secure:!0,format:"json"},t)),applySettings:(t,e={})=>this.request(c({path:"/settings",method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},e)),getSettingsTemplate:(t,e={})=>this.request(c({path:`/settings/template/${t}`,method:"GET",secure:!0,format:"json"},e))}),h(this,"sites",{getSites:(t={})=>this.request(c({path:"/sites",method:"GET",secure:!0,format:"json"},t)),createSite:(t,e={})=>this.request(c({path:"/sites",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),updateSite:(t,e,n={})=>this.request(c({path:`/sites/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deleteSite:(t,e={})=>this.request(c({path:`/sites/${t}`,method:"DELETE",secure:!0,format:"json"},e))}),h(this,"stats",{getStats:(t,e,n={})=>this.request(c({path:`/stats/${t}`,method:"GET",query:e,type:"application/json",format:"json"},n))}),h(this,"transfer",{exportArtrans:(t={})=>this.request(c({path:"/transfer/export",method:"GET",secure:!0,format:"json"},t)),importArtrans:(t,e={})=>this.request(c({path:"/transfer/import",method:"POST",body:t,secure:!0,type:"application/json"},e)),uploadArtrans:(t,e={})=>this.request(c({path:"/transfer/upload",method:"POST",body:t,secure:!0,type:"multipart/form-data",format:"json"},e))}),h(this,"upload",{upload:(t,e={})=>this.request(c({path:"/upload",method:"POST",body:t,secure:!0,type:"multipart/form-data",format:"json"},e))}),h(this,"user",{getUser:(t,e={})=>this.request(c({path:"/user",method:"GET",query:t,secure:!0,format:"json"},e)),login:(t,e={})=>this.request(c({path:"/user/access_token",method:"POST",body:t,type:"application/json",format:"json"},e)),getUserStatus:(t,e={})=>this.request(c({path:"/user/status",method:"GET",query:t,secure:!0,format:"json"},e))}),h(this,"users",{createUser:(t,e={})=>this.request(c({path:"/users",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),updateUser:(t,e,n={})=>this.request(c({path:`/users/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deleteUser:(t,e={})=>this.request(c({path:`/users/${t}`,method:"DELETE",secure:!0,format:"json"},e)),getUsers:(t,e,n={})=>this.request(c({path:`/users/${t}`,method:"GET",query:e,secure:!0,type:"application/json",format:"json"},n))}),h(this,"version",{getVersion:(t={})=>this.request(c({path:"/version",method:"GET",format:"json"},t))}),h(this,"votes",{syncVotes:(t={})=>this.request(c({path:"/votes/sync",method:"POST",secure:!0,format:"json"},t)),vote:(t,e,n,i={})=>this.request(c({path:`/votes/${t}/${e}`,method:"POST",body:n,type:"application/json",format:"json"},i))})}};var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;nu(this,null,(function*(){const i=t.getApiToken&&t.getApiToken(),s=new Headers(c({Authorization:i?`Bearer ${i}`:""},null==n?void 0:n.headers));s.get("Authorization")||s.delete("Authorization");const o=yield fetch(e,d(c({},n),{headers:s}));if(!o.ok){const i=(yield o.json().catch((()=>{})))||{};let s=!1;if(t.handlers&&(yield t.handlers.get().reduce(((t,e)=>u(this,null,(function*(){yield t,!0===i[e.action]&&(yield e.handler(i),s=!0)}))),Promise.resolve())),s)return y(t,e,n);throw function(t,e){const n=new v;return n.message=e.msg||e.message||"fetch error",n.code=t,n.data=e,console.error(n),n}(o.status,i)}return o}));class v extends Error{constructor(){super(...arguments),h(this,"code",0),h(this,"message","fetch error"),h(this,"data")}}class k extends m{constructor(t){super({baseUrl:t.baseURL,customFetch:(e,n)=>y(t,e,n)}),h(this,"_opts"),this._opts=t}getUserFields(){const t=this._opts.userInfo;if((null==t?void 0:t.name)&&(null==t?void 0:t.email))return{name:t.name,email:t.email}}}var $={"&":"&","<":"<",">":">",'"':""","'":"'"},b={"&":"&","<":"<",">":">",""":'"',"'":"'"},w=/(&|<|>|"|')/g,C=/[&<>"']/g;function E(t){return $[t]}function x(t){return b[t]}function S(t){return null==t?"":String(t).replace(C,E)}function T(t){return null==t?"":String(t).replace(w,x)}S.options=T.options={};var L={encode:S,escape:S,decode:T,unescape:T,version:"1.0.0-browser"};var A=function t(e){for(var n,i,s=Array.prototype.slice.call(arguments,1);s.length;)for(i in n=s.shift())n.hasOwnProperty(i)&&("[object Object]"===Object.prototype.toString.call(e[i])?e[i]=t(e[i],n[i]):e[i]=n[i]);return e},M=function(t){return"string"==typeof t?t.toLowerCase():t};function P(t,e){return t[e]=!0,t}var O=function(t){return t.reduce(P,{})},U={uris:O(["background","base","cite","href","longdesc","src","usemap"])},I={voids:O(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},R=L,q=M,j=I,B=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,D=/^<\s*\/\s*([\w:-]+)[^>]*>/,_=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,F=/^=0&&(e.comment&&e.comment(t.substring(4,i)),t=t.substring(i+3),n=!1):N.test(t)?r(D,l):F.test(t)&&r(B,a);var i;!function(){if(!n)return;var i,s=t.indexOf("<");s>=0?(i=t.substring(0,s),t=t.substring(s)):(i=t,t="");e.chars&&e.chars(i)}()}();var i=t===s;s=t,i&&(t="")}function r(e,i){var s=t.match(e);s&&(t=t.substring(s[0].length),s[0].replace(e,i),n=!1)}function a(t,n,s,o){var r={},a=q(n),l=j.voids[a]||!!o;s.replace(_,(function(t,e,n,i,s){r[e]=void 0===n&&void 0===i&&void 0===s?void 0:R.decode(n||i||s||"")})),l||i.push(a),e.start&&e.start(a,r,l)}function l(t,n){var s,o=0,r=q(n);if(r)for(o=i.length-1;o>=0&&i[o]!==r;o--);if(o>=0){for(s=i.length-1;s>=o;s--)e.end&&e.end(i[s]);i.length=o}}l()},K=function(t,e){var n,i=e||{};return a(),{start:function(t,e,r){var a=H(t);if(n.ignoring)return void o(a);if(-1===(i.allowedTags||[]).indexOf(a))return void o(a);if(i.filter&&!i.filter({tag:a,attrs:e}))return void o(a);s("<"),s(a),Object.keys(e).forEach((function(t){var n=e[t],o=(i.allowedClasses||{})[a]||[],r=(i.allowedAttributes||{})[a]||[],l=H(t);("class"===l&&-1===r.indexOf(l)?(n=n.split(" ").filter((function(t){return o&&-1!==o.indexOf(t)})).join(" ").trim()).length:-1!==r.indexOf(l)&&(!0!==V.uris[l]||function(t){var e=t[0];if("#"===e||"/"===e)return!0;var n=t.indexOf(":");if(-1===n)return!0;var s=t.indexOf("?");if(-1!==s&&n>s)return!0;var o=t.indexOf("#");return-1!==o&&n>o||i.allowedSchemes.some(r);function r(e){return 0===t.indexOf(e+":")}}(n)))&&(s(" "),s(t),"string"==typeof n&&(s('="'),s(W.encode(n)),s('"')))})),s(r?"/>":">")},end:function(t){var e=H(t);-1!==(i.allowedTags||[]).indexOf(e)&&!1===n.ignoring?(s("")):r(e)},chars:function(t){!1===n.ignoring&&s(i.transformText?i.transformText(t):t)}};function s(e){t.push(e)}function o(t){G.voids[t]||(!1===n.ignoring?n={ignoring:t,depth:1}:n.ignoring===t&&n.depth++)}function r(t){n.ignoring===t&&--n.depth<=0&&a()}function a(){n={ignoring:!1,depth:0}}},Y={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function J(t,e,n){var i=[],s=!0===n?e:z({},Y,e),o=K(i,s);return Q(t,o),i.join("")}J.defaults=Y;const X=f(J),Z={allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:t=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([e,n])=>{t.tag===e&&t.attrs.class&&!n.test(t.attrs.class)&&delete t.attrs.class})),"span"===t.tag&&t.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(t.attrs.style)&&delete t.attrs.style,!0)};function tt(t){return X(t,Z)}var et={exports:{}};et.exports=function(){function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){var e=t.exports=function(){return new RegExp("(?:"+e.line().source+")|(?:"+e.block().source+")","gm")};e.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},e.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function i(t){return''+t+""}return function(t,s){void 0===s&&(s={});var o=s.colors;void 0===o&&(o=n);var r=0,a={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+e+"
        ";return r=++r%o.length,l}))}}();const nt=f(et.exports);function it(t){return nt(t)}function st(){const t=new e.marked.Renderer;return t.link=ot(t,t.link),t.code=rt(),t}const ot=(t,e)=>(n,i,s)=>{const o=null==n?void 0:n.startsWith(`${window.location.protocol}//${window.location.hostname}`);return e.call(t,n,i,s).replace(/^(t,e)=>{const n=e||"plaintext";let i=t;return window.hljs?n&&window.hljs.getLanguage(n)&&(i=window.hljs.highlight(n,t).value):i=it(t),`
        \n${i.replace(/&/g,"&")}\n
        `};let at,lt=[];const ct={gfm:!0,breaks:!0,async:!1};function dt(){return at}function ht(t){var e;let n=null==(e=dt())?void 0:e.parse(t);n||(n=function(t){return t.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((t,e)=>`
        ${it(e)}
        `)).replace(/!\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`${e}`)).replace(/\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`
        ${e}`)).replace(/\n/g,"
        ")}(t));let i=tt(n);return lt.forEach((t=>{"function"==typeof t&&(i=t(i))})),i}function ut(...t){const e=t=>t&&"object"==typeof t&&t.constructor===Object;return t.reduce(((t,n)=>(Object.keys(null!=n?n:{}).forEach((i=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t[i],o=n[i];Array.isArray(s)&&Array.isArray(o)?t[i]=s.concat(...o):e(s)&&e(o)?t[i]=ut(s,o):t[i]=o})),t)),{})}class pt{constructor(t){h(this,"loading",!1),h(this,"listLastFetch"),h(this,"comments",[]),h(this,"notifies",[]),h(this,"page"),this.events=t}getLoading(){return this.loading}setLoading(t){this.loading=t}getListLastFetch(){return this.listLastFetch}setListLastFetch(t){this.listLastFetch=t}getComments(){return this.comments}fetchComments(t){this.events.trigger("list-fetch",t)}findComment(t){return this.comments.find((e=>e.id===t))}clearComments(){this.comments=[],this.events.trigger("list-loaded",this.comments)}loadComments(t){this.events.trigger("list-load",t),this.comments.push(...t),this.events.trigger("list-loaded",this.comments)}insertComment(t){this.comments.push(t),this.events.trigger("comment-inserted",t),this.events.trigger("list-loaded",this.comments)}updateComment(t){this.comments=this.comments.map((e=>e.id===t.id?t:e)),this.events.trigger("comment-updated",t),this.events.trigger("list-loaded",this.comments)}deleteComment(t){const e=this.comments.find((e=>e.id===t));if(!e)throw new Error(`Comment ${t} not found`);this.comments=this.comments.filter((e=>e.id!==t)),this.events.trigger("comment-deleted",e),this.events.trigger("list-loaded",this.comments)}getNotifies(){return this.notifies}updateNotifies(t){this.notifies=t,this.events.trigger("notifies-updated",this.notifies)}getPage(){return this.page}updatePage(t){this.page=t,this.events.trigger("page-loaded",t)}}const mt={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",uploadImage:"Upload Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",emailVerified:"Email has been verified",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly",updateMsg:"Please update Artalk {name} to get the full experience",currentVersion:"Current Version",ignore:"Ignore",open:"Open",openName:"Open {name}"},gt="ArtalkI18n";function ft(t=""){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild||e}function yt(t){const e=document.createElement("div");e.innerText=t;return e.innerHTML}function vt(t){const e=RegExp(`[?&]${t}=([^&]*)`).exec(window.location.search);return e&&decodeURIComponent(e[1].replace(/\+/g," "))}function kt(t,e){const n=t=>{const e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+i,left:e.left+n}},i=n(t);if(!e)return i;const s=n(e);return{top:i.top-s.top,left:i.left-s.left}}function $t(t,e){let n=t.toString();for(;n.lengtht)){try{const n=t.getTime(),i=(new Date).getTime()-n,s=Math.floor(i/864e5);if(0===s){const t=i%864e5,n=Math.floor(t/36e5);if(0===n){const n=t%36e5,i=Math.floor(n/6e4);if(0===i){const t=n%6e4,i=Math.round(t/1e3);return i<10?e("now"):`${i} ${e("seconds")}`}return`${i} ${e("minutes")}`}return`${n} ${e("hours")}`}return s<0?e("now"):s<8?`${s} ${e("days")}`:function(t){const e=$t(t.getDate(),2),n=$t(t.getMonth()+1,2);return`${$t(t.getFullYear(),2)}-${n}-${e}`}(t)}catch(n){return console.error(n)," - "}}function wt(){return u(this,null,(function*(){const t=navigator.userAgent;if(!navigator.userAgentData||!navigator.userAgentData.getHighEntropyValues)return t;const e=navigator.userAgentData;let n=null;try{n=yield e.getHighEntropyValues(["platformVersion"])}catch(s){return console.error(s),t}const i=Number(n.platformVersion.split(".")[0]);return"Windows"===e.platform&&i>=13?t.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===e.platform&&i>=11?t.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):t}))}function Ct(t){let e;try{e=new URL(t)}catch(n){return!1}return"http:"===e.protocol||"https:"===e.protocol}function Et(t){return e=t.base,n=t.path,`${e.replace(/\/$/,"")}/${n.replace(/^\//,"")}`;var e,n}const xt={en:mt,"en-US":mt,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送",save:"保存",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",uploadImage:"上传图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",emailVerified:"邮箱已验证",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止",updateMsg:"请更新 Artalk {name} 以获得完整体验",currentVersion:"当前版本",ignore:"忽略",open:"打开",openName:"打开{name}"}};function St(t){return t=t.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((t,e,n)=>e.toLowerCase()+(n||"").toUpperCase())),xt[t]?xt[t]:window[gt]&&window[gt][t]?window[gt][t]:xt.en}let Tt="en",Lt=St(Tt);function At(t){t!==Tt&&(Tt=t,Lt="string"==typeof t?St(t):t)}function Mt(t,e={}){let n=(null==Lt?void 0:Lt[t])||t;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((t,n)=>e[n]||"")),yt(n)}class Pt{constructor(){h(this,"events",[])}on(t,e,n={}){this.events.push(c({name:t,handler:e},n))}off(t,e){e&&(this.events=this.events.filter((n=>!(n.name===t&&n.handler===e))))}trigger(t,e){this.events.slice(0).filter((e=>e.name===t&&"function"==typeof e.handler)).forEach((n=>{n.once&&this.off(t,n.handler),n.handler(e)}))}}const Ot={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"en"};function Ut(t,e=!1){const n=e?ut(Ot,t):t;if(n.el&&"string"==typeof n.el)try{const t=document.querySelector(n.el);if(!t)throw Error(`Target element "${n.el}" was not found.`);n.el=t}catch(i){throw console.error(i),new Error("Please check your Artalk `el` config.")}return""===n.pageKey&&(n.pageKey=`${window.location.pathname}`),""===n.pageTitle&&(n.pageTitle=`${document.title}`),n.server&&(n.server=n.server.replace(/\/$/,"").replace(/\/api\/?$/,"")),"auto"===n.locale&&(n.locale=navigator.language),"auto"===n.flatMode&&(n.flatMode=window.matchMedia("(max-width: 768px)").matches),"number"==typeof n.nestMax&&Number(n.nestMax)<=1&&(n.flatMode=!0),n}function It(t,e){return{baseURL:`${t.server}/api/v2`,siteName:t.site||"",pageKey:t.pageKey||"",pageTitle:t.pageTitle||"",timeout:t.reqTimeout,getApiToken:()=>null==e?void 0:e.get("user").getData().token,userInfo:(null==e?void 0:e.get("user").checkHasBasicUserInfo())?{name:null==e?void 0:e.get("user").getData().nick,email:null==e?void 0:e.get("user").getData().email}:void 0,handlers:null==e?void 0:e.getApiHandlers()}}function Rt(t,e,n){let i=null;const s=()=>{const s=(()=>{const n=t.getConf(),i={};return e.forEach((t=>{i[t]=n[t]})),i})();var o,r;(null==i||(o=i,r=s,!(JSON.stringify(o)===JSON.stringify(r))))&&(i=s,n(s))};t.on("mounted",s),t.on("updated",s)}class qt{constructor(t){h(this,"conf"),h(this,"data"),h(this,"$root"),h(this,"events",new Pt),h(this,"mounted",!1),h(this,"apiHandlers",null),h(this,"getCommentList",this.getCommentNodes),h(this,"getCommentDataList",this.getComments),this.conf=t,this.$root=t.el,this.$root.classList.add("artalk"),this.$root.innerHTML="",this.data=new pt(this.events),this.on("mounted",(()=>{this.mounted=!0}))}inject(t,e){this[t]=e}get(t){return this[t]}getApi(){return new k(It(this.conf,this))}getApiHandlers(){return this.apiHandlers||(this.apiHandlers=function(t){const e=function(){const t=[];return{add:(e,n)=>{t.push({action:e,handler:n})},get:()=>t}}();return e.add("need_captcha",(e=>t.checkCaptcha(e))),e.add("need_login",(()=>t.checkAdmin({}))),e}(this)),this.apiHandlers}getData(){return this.data}replyComment(t,e){this.editor.setReply(t,e)}editComment(t,e){this.editor.setEditComment(t,e)}fetch(t){this.data.fetchComments(t)}reload(){this.data.fetchComments({offset:0})}listGotoFirst(){this.events.trigger("list-goto-first")}getCommentNodes(){return this.list.getCommentNodes()}getComments(){return this.data.getComments()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(t,e){this.editor.showNotify(t,e)}editorResetState(){this.editor.resetState()}showSidebar(t){this.sidebarLayer.show(t)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(t){return this.checkerLauncher.checkAdmin(t)}checkCaptcha(t){return this.checkerLauncher.checkCaptcha(t)}on(t,e){this.events.on(t,e)}off(t,e){this.events.off(t,e)}trigger(t,e){this.events.trigger(t,e)}$t(t,e={}){return Mt(t,e)}setDarkMode(t){this.updateConf({darkMode:t})}updateConf(t){this.conf=ut(this.conf,Ut(t,!1)),this.mounted&&this.events.trigger("updated",this.conf)}getConf(){return this.conf}getEl(){return this.$root}getMarked(){return dt()}watchConf(t,e){Rt(this,t,e)}}class jt{constructor(t){h(this,"$el"),h(this,"$content"),h(this,"$actions"),this.$el=ft('
        \n
        \n
        \n
        \n
        \n
        '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(t)}setYes(t){const e=ft(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}setNo(t){const e=ft(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}onBtnClick(t){return e=>{const n=t(e.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function Bt(t,e){let n=t.querySelector(":scope > .atk-loading");n||(n=ft(''),(null==e?void 0:e.transparentBg)&&(n.style.background="transparent"),t.appendChild(n)),n.style.display="";const i=n.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.isConnected&&(i.style.display="")}),500))}function Dt(t){const e=t.querySelector(":scope > .atk-loading");e&&(e.style.display="none")}function _t(t,e){t?Bt(e):Dt(e)}function Ft(t,e=!0,n){let i;if(n){const e=n.getBoundingClientRect();i=t.getBoundingClientRect().top-e.top+n.scrollTop-n.clientHeight/2+t.clientHeight/2}else{const e=t.getBoundingClientRect();i=e.top+window.scrollY-(window.innerHeight/2-e.height/2)}const s={top:i,left:0,behavior:"instant"};n?n.scroll(s):window.scroll(s)}function Nt(t,e){!function(t,e,n="in"){t.classList.add(`atk-fade-${n}`);const i=()=>{t.classList.remove(`atk-fade-${n}`),t.removeEventListener("animationend",i),e&&e()};t.addEventListener("animationend",i)}(t,e,"in")}function Wt(t,e,n='Artalk Error'){let i=t.querySelector(".atk-error-layer");if(null===e)return void(null!==i&&i.remove());i||(i=ft(`
        ${n}
        `),t.appendChild(i));const s=i.querySelector(".atk-error-text");s.innerHTML="",null!==e&&(e instanceof HTMLElement?s.appendChild(e):s.innerText=e)}function Ht(t){const e=ft('
        '),n=ft('');n.style.display="none",Bt(e,{transparentBg:!0}),n.src=t.getOpts().getCaptchaIframeURL(),n.onload=()=>{n.style.display="",Dt(e)},e.append(n);const i=ft('
        ');e.append(i),t.hideInteractInput();let s=!1;return function e(){return u(this,null,(function*(){var n;if(yield(n=1e3,new Promise((t=>{window.setTimeout((()=>{t(null)}),n)}))),s)return;let i=!1;try{i=(yield t.getApi().captcha.getCaptchaStatus()).data.is_pass}catch(o){i=!1}i?t.triggerSuccess():e()}))}(),i.onclick=()=>{s=!0,t.cancel()},e}const Vt={request:(t,e)=>t.getApi().captcha.verifyCaptcha({value:e}),body:t=>t.get("iframe")?Ht(t):function(t){const e=ft(`${Mt("captchaCheck")}`);return e.querySelector(".atk-captcha-img").onclick=()=>{const n=e.querySelector(".atk-captcha-img");t.getApi().captcha.getCaptcha().then((t=>{n.setAttribute("src",t.data.img_data)})).catch((t=>{console.error("Failed to get captcha image ",t)}))},e}(t),onSuccess(t,e,n,i){t.set("val",n)},onError(t,e,n,i){i.querySelector(".atk-captcha-img").click(),i.querySelector('input[type="text"]').value=""}},Gt={inputType:"password",request(t,e){return u(this,null,(function*(){return(yield t.getApi().user.login({name:t.getUser().getData().nick,email:t.getUser().getData().email,password:e})).data}))},body:t=>ft(`${Mt("adminCheck")}`),onSuccess(t,e,n,i){t.getUser().update({isAdmin:!0,token:e.token}),t.getOpts().onReload()},onError(t,e,n,i){}};function zt(t){return e=>new Promise(((n,i)=>{const s=e.onCancel;e.onCancel=()=>{s&&s(),i(new Error("user canceled the checker"))};const o=e.onSuccess;e.onSuccess=()=>{o&&o(),n()},t(e)}))}class Qt{constructor(t){h(this,"checkCaptcha",zt((t=>{this.fire(Vt,t,(e=>{e.set("img_data",t.img_data),e.set("iframe",t.iframe)}))}))),h(this,"checkAdmin",zt((t=>{this.fire(Gt,t)}))),this.opts=t}fire(t,e,n){const i=this.opts.getCtx().get("layerManager").create(`checker-${(new Date).getTime()}`);i.show();const s=()=>{i.destroy()},o={};let r=!1;const a={set:(t,e)=>{o[t]=e},get:t=>o[t],getOpts:()=>this.opts,getUser:()=>this.opts.getCtx().get("user"),getApi:()=>this.opts.getApi(),hideInteractInput:()=>{r=!0},triggerSuccess:()=>{s(),t.onSuccess&&t.onSuccess(a,"","",l),e.onSuccess&&e.onSuccess()},cancel:()=>{s(),e.onCancel&&e.onCancel()}};n&&n(a);const l=ft();l.appendChild(t.body(a));const c=ft(``);let d;l.appendChild(c),setTimeout((()=>c.focus()),80),c.onkeyup=t=>{"Enter"!==t.key&&13!==t.keyCode||(t.preventDefault(),i.getEl().querySelector('button[data-action="confirm"]').click())};const h=new jt(l);h.setYes((n=>{const i=c.value.trim();d||(d=n.innerText);const o=()=>{n.innerText=d||"",n.classList.remove("error")};return n.innerText=`${Mt("loading")}...`,t.request(a,i).then((n=>{s(),t.onSuccess&&t.onSuccess(a,n,i,l),e.onSuccess&&e.onSuccess()})).catch((e=>{var s;s=String(e.message||String(e)),n.innerText=s,n.classList.add("error"),t.onError&&t.onError(a,e,i,l);const r=setTimeout((()=>o()),3e3);c.onfocus=()=>{o(),clearTimeout(r)}})),!1})),h.setNo((()=>(s(),e.onCancel&&e.onCancel(),!1))),r&&(c.style.display="none",h.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),i.getEl().append(h.$el),e.onMount&&e.onMount(h.$el)}}class Kt{constructor(t){h(this,"$el"),this.ctx=t}get conf(){return this.ctx.conf}getEl(){return this.$el}}const Yt={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$bottomLeft:".atk-bottom-left",$stateWrap:".atk-state-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class Jt{constructor(t){this.kit=t}useBtn(t="
        "){return this.$btn=ft(`${t}`),this.$btn}usePanel(t="
        "){return this.$panel=ft(t),this.$panel}useContentTransformer(t){this.contentTransformer=t}usePanelShow(t){this.kit.useEvents().on("panel-show",(e=>{e===this&&t()}))}usePanelHide(t){this.kit.useEvents().on("panel-hide",(e=>{e===this&&t()}))}useEditorStateEffect(t,e){this.editorStateEffectWhen=t,this.editorStateEffect=e}}class Xt extends Jt{constructor(){super(...arguments),h(this,"isMoved",!1)}move(t){if(this.isMoved)return;this.isMoved=!0;const e=this.kit.useUI().$el;e.after(ft('
        '));const n=ft("
        ");t.after(n),n.replaceWith(e),e.classList.add("atk-fade-in"),e.classList.add("editor-traveling")}back(){var t;this.isMoved&&(this.isMoved=!1,null==(t=this.kit.useGlobalCtx().$root.querySelector(".atk-editor-travel-placeholder"))||t.replaceWith(this.kit.useUI().$el),this.kit.useUI().$el.classList.remove("editor-traveling"))}}class Zt{constructor(t){h(this,"stateCurt","normal"),h(this,"stateUnmountFn",null),this.editor=t}get(){return this.stateCurt}switch(t,e){var n,i,s,o,r;if(this.stateUnmountFn&&(this.stateUnmountFn(),this.stateUnmountFn=null,null==(i=null==(n=this.editor.getPlugs())?void 0:n.get(Xt))||i.back()),"normal"!==t&&e){let n=e.$comment;this.editor.conf.flatMode||(n=n.querySelector(".atk-footer")),null==(o=null==(s=this.editor.getPlugs())?void 0:s.get(Xt))||o.move(n);const i=this.editor.ctx.conf.scrollRelativeTo&&this.editor.ctx.conf.scrollRelativeTo();Ft(this.editor.getUI().$el,!0,i);const a=null==(r=this.editor.getPlugs())?void 0:r.getPlugs().find((e=>e.editorStateEffectWhen===t));a&&a.editorStateEffect&&(this.stateUnmountFn=a.editorStateEffect(e.comment))}this.stateCurt=t}}class te extends Kt{constructor(t){super(t),h(this,"ui"),h(this,"state"),this.ui=function(){const t=ft('
        \n
        \n \n \n \n
        \n
        \n \n
        \n \n
        \n
        \n \n \n
        \n
        \n \n
        \n
        \n
        \n
        \n'),e={$el:t};return Object.entries(Yt).forEach((([n,i])=>{e[n]=t.querySelector(i)})),e}(),this.$el=this.ui.$el,this.state=new Zt(this)}getUI(){return this.ui}getPlugs(){return this.ctx.get("editorPlugs")}getState(){return this.state.get()}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}getContentFinal(){let t=this.getContentRaw();const e=this.getPlugs();return e&&(t=e.getTransformedContent(t)),t}getContentRaw(){return this.ui.$textarea.value||""}getContentMarked(){return ht(this.getContentFinal())}setContent(t){var e;this.ui.$textarea.value=t,null==(e=this.getPlugs())||e.getEvents().trigger("content-updated",t)}insertContent(t){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=t,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const e=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,i=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,e)+t+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=e+t.length,this.ui.$textarea.selectionEnd=e+t.length,this.ui.$textarea.scrollTop=i}else this.ui.$textarea.focus(),this.ui.$textarea.value+=t}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.resetState()}resetState(){this.state.switch("normal")}setReply(t,e){this.state.switch("reply",{comment:t,$comment:e})}setEditComment(t,e){this.state.switch("edit",{comment:t,$comment:e})}showNotify(t,e){!function(t,e,n){const i=ft(`
        `);i.querySelector(".atk-notify-content").innerHTML=yt(e).replace("\n","
        "),t.appendChild(i);const s=()=>{i.classList.add("atk-fade-out"),setTimeout((()=>{i.remove()}),200)};let o;o=window.setTimeout((()=>{s()}),3e3),i.addEventListener("click",(()=>{s(),window.clearTimeout(o)}))}(this.ui.$notifyWrap,t,e)}showLoading(){Bt(this.ui.$el)}hideLoading(){Dt(this.ui.$el)}submit(){const t=()=>this.ctx.trigger("editor-submit");this.ctx.conf.beforeSubmit?this.ctx.conf.beforeSubmit(this,t):t()}}class ee extends Kt{constructor(t){super(t),h(this,"layer"),h(this,"$header"),h(this,"$closeBtn"),h(this,"$iframeWrap"),h(this,"$iframe"),h(this,"refreshOnShow",!0),h(this,"animTimer"),this.$el=ft('
        \n
        \n
        \n
        \n
        \n
        \n
        \n
        \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.refreshOnShow=!0}))}show(){return u(this,arguments,(function*(t={}){if(this.$el.style.transform="",this.initLayer(),this.layer.show(),this.refreshOnShow)this.refreshOnShow=!1,this.$iframeWrap.innerHTML="",this.$iframe=this.createIframe(t.view),this.$iframeWrap.append(this.$iframe);else{const t=this.$iframe,e=t.src;this.conf.darkMode!==e.includes("darkMode=1")&&this.iframeLoad(t,this.conf.darkMode?e.concat("&darkMode=1"):e.replace("&darkMode=1",""))}this.authCheck({onSuccess:()=>this.show(t)}),this.animTimer=setTimeout((()=>{this.animTimer=void 0,this.$el.style.transform="translate(0, 0)",setTimeout((()=>{this.ctx.getData().updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}),100)}))}hide(){var t;null==(t=this.layer)||t.hide()}authCheck(t){return u(this,null,(function*(){const e=(yield this.ctx.getApi().user.getUserStatus(c({},this.ctx.getApi().getUserFields()))).data;e.is_admin&&!e.is_login&&(this.refreshOnShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{t.onSuccess()}),500)},onCancel:()=>{this.hide()}}),this.hide())}))}initLayer(){this.layer||(this.layer=this.ctx.get("layerManager").create("sidebar",this.$el),this.layer.setOnAfterHide((()=>{this.ctx.editorResetState(),this.animTimer&&clearTimeout(this.animTimer),this.$el.style.transform="",this.ctx.trigger("sidebar-hide")})))}createIframe(t){const e=ft(''),n=Et({base:this.ctx.conf.server,path:"/sidebar/"}),i={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(this.ctx.get("user").getData()),time:+new Date};t&&(i.view=t),this.conf.darkMode&&(i.darkMode="1");const s=new URLSearchParams(i);return this.iframeLoad(e,`${n}?${s.toString()}`),e}iframeLoad(t,e){t.src=e,Bt(this.$iframeWrap),t.onload=()=>{Dt(this.$iframeWrap)}}}const ne=t=>({import:e=>{(function(t,e="DATE_DESC",n=2){const i=[];t.filter((t=>0===t.rid)).forEach((e=>{const s={id:e.id,comment:e,children:[],level:1};s.parent=s,i.push(s),function e(i){const s=t.filter((t=>t.rid===i.id));0!==s.length&&(i.level>=n&&(i=i.parent),s.forEach((t=>{const n={id:t.id,comment:t,children:[],parent:i,level:i.level+1};i.children.push(n),e(n)})))}(s)}));const s=(n,i)=>{let s=n.id-i.id;return"DATE_ASC"===e?s=+new Date(n.comment.date)-+new Date(i.comment.date):"DATE_DESC"===e?s=+new Date(i.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===e?s=t.indexOf(n.comment)-t.indexOf(i.comment):"VOTE_UP_DESC"===e&&(s=i.comment.vote_up-n.comment.vote_up),s};return function t(e){e.forEach((e=>{e.children=e.children.sort(s),t(e.children)}))}(i),i})(e,t.nestSortBy,t.nestMax).forEach((e=>{var n;const i=t.createCommentNode(e.comment);null==(n=t.$commentsWrap)||n.appendChild(i.getEl()),i.getRender().playFadeAnim();const s=(e,n)=>{n.children.forEach((n=>{const i=n.comment,o=t.createCommentNode(i,e.getData());e.putChild(o),s(o,n)}))};s(i,e),i.getRender().checkHeightLimit()}))},insert:(e,n)=>{var i;const s=t.createCommentNode(e,n);if(0===e.rid)null==(i=t.$commentsWrap)||i.prepend(s.getEl());else{const n=t.findCommentNode(e.rid);n&&(n.putChild(s,"DATE_ASC"===t.nestSortBy?"append":"prepend"),s.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()})))}s.getRender().checkHeightLimit(),s.scrollIntoView(),s.getRender().playFadeAnim()}});function ie(t,e,n,i){n.is_collapsed&&(n.is_allow_reply=!1);const s=t.createCommentNode(n,i);if(n.visible){const n=s.getEl(),i=t.$commentsWrap;"append"===e&&(null==i||i.append(n)),"prepend"===e&&(null==i||i.prepend(n)),s.getRender().playFadeAnim()}return s.getRender().checkHeightLimit(),s}class se{constructor(t){this.options=t}getStrategy(){return this.options.flatMode?(t=this.options,{import:e=>{e.forEach((n=>{const i=0===n.rid?void 0:e.find((t=>t.id===n.rid));ie(t,"append",n,i)}))},insert:(e,n)=>{ie(t,"prepend",e,n).scrollIntoView()}}):ne(this.options);var t}import(t){this.getStrategy().import(t)}insert(t,e){this.getStrategy().insert(t,e)}}function oe(t,e){e.forEach((({el:e,max:n,imgContains:i})=>{const s=()=>{e&&(t.scrollable?function(t){if(!t.el)return;if(t.el.classList.contains(le))return;t.el.classList.add(le),t.el.style.height=`${t.maxHeight}px`}({el:e,maxHeight:n}):function(t){if(!t.el)return;if(!t.maxHeight)return;if(t.el.classList.contains(re))return;t.el.classList.add(re),t.el.style.height=`${t.maxHeight}px`,t.el.style.overflow="hidden";const e=ft(`
        ${Mt("readMore")}`);e.onclick=e=>{e.stopPropagation(),ae(t.el),t.postBtnClick&&t.postBtnClick(e)},t.el.append(e)}({el:e,maxHeight:n,postBtnClick:t.postExpandBtnClick}))},o=()=>{e&&function(t){return parseFloat(getComputedStyle(t,null).height.replace("px",""))}(e)>n&&s()};o(),i&&e&&function(t,e){if(!t)return;const n=t.getElementsByTagName("img");if(!n.length)return;let i=n.length;for(let s=0;s{i--,0===i&&e()})),0===i&&e()}(e,(()=>o()))}))}const re="atk-height-limit";function ae(t){t&&t.classList.contains(re)&&(t.classList.remove(re),Array.from(t.children).forEach((t=>{t.classList.contains("atk-height-limit-btn")&&t.remove()})),t.style.height="",t.style.overflow="")}const le="atk-height-limit-scroll";function ce(t){if(t.$headerNick=t.$el.querySelector(".atk-nick"),t.data.link){const e=ft('');e.innerText=t.data.nick,e.href=Ct(t.data.link)?t.data.link:`https://${t.data.link}`,t.$headerNick.append(e)}else t.$headerNick.innerText=t.data.nick}function de(t){t.$headerBadgeWrap=t.$el.querySelector(".atk-badge-wrap"),t.$headerBadgeWrap.innerHTML="";const e=t.data.badge_name,n=t.data.badge_color;if(e){const i=ft('');i.innerText=e.replace("管理员",Mt("admin")),i.style.backgroundColor=n||"",t.$headerBadgeWrap.append(i)}else if(t.data.is_verified){const e=ft(``);t.$headerBadgeWrap.append(e)}if(t.data.is_pinned){const e=ft(`${Mt("pin")}`);t.$headerBadgeWrap.append(e)}}function he(t){const e=t.$el.querySelector(".atk-date");e.innerText=t.comment.getDateFormatted(),e.setAttribute("data-atk-comment-date",String(+new Date(t.data.date)))}function ue(t){if(!t.opts.uaBadge&&!t.data.ip_region)return;let e=t.$header.querySelector("atk-ua-wrap");if(e||(e=ft(''),t.$header.append(e)),e.innerHTML="",t.data.ip_region){const n=ft('');n.innerText=t.data.ip_region,e.append(n)}if(t.opts.uaBadge){const{browser:n,os:i}=t.comment.getUserUA();if(String(n).trim()){const t=ft('');t.innerText=n,e.append(t)}if(String(i).trim()){const t=ft('');t.innerText=i,e.append(t)}}}class pe{constructor(t){h(this,"opts"),h(this,"$el"),h(this,"isLoading",!1),h(this,"msgRecTimer"),h(this,"msgRecTimerFunc"),h(this,"isConfirming",!1),h(this,"confirmRecTimer"),this.$el=ft(''),this.opts="object"!=typeof t?{text:t}:t,this.$el.innerText=this.getText(),this.opts.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(t){return t.append(this.$el),this}getText(){return"string"==typeof this.opts.text?this.opts.text:this.opts.text()}setClick(t){this.$el.onclick=e=>{if(e.stopPropagation(),!this.isLoading){if(this.opts.confirm&&!this.isMessaging){const t=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.opts.confirmText||Mt("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>t()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),t()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();t()}}}updateText(t){t&&(this.opts.text=t),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(t,e){this.isLoading!==t&&(this.isLoading=t,t?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=e||`${Mt("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(t){this.setMsg(t,"atk-btn-error")}setWarn(t){this.setMsg(t,"atk-btn-warn")}setSuccess(t){this.setMsg(t,"atk-btn-success")}setMsg(t,e,n,i){this.setLoading(!1),e&&this.$el.classList.add(e),this.$el.innerText=t,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),e&&this.$el.classList.remove(e),i&&i()}),n||2500)}setMsgRecTimer(t,e){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=t,this.msgRecTimer=window.setTimeout((()=>{t(),this.clearMsgRecTimer()}),e)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function me(t){t.opts.vote&&(t.voteBtnUp=new pe((()=>`${Mt("voteUp")} (${t.data.vote_up||0})`)).appendTo(t.$actions),t.voteBtnUp.setClick((()=>{t.comment.getActions().vote("up")})),t.opts.voteDown&&(t.voteBtnDown=new pe((()=>`${Mt("voteDown")} (${t.data.vote_down||0})`)).appendTo(t.$actions),t.voteBtnDown.setClick((()=>{t.comment.getActions().vote("down")}))))}function ge(t){if(!t.data.is_allow_reply)return;const e=ft(`${Mt("reply")}`);t.$actions.append(e),e.addEventListener("click",(e=>{e.stopPropagation(),t.opts.replyComment(t.data,t.$el)}))}function fe(t){const e=new pe({text:()=>t.data.is_collapsed?Mt("expand"):Mt("collapse"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("collapsed",e)}))}function ye(t){const e=new pe({text:()=>t.data.is_pending?Mt("pending"):Mt("approved"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pending",e)}))}function ve(t){const e=new pe({text:()=>t.data.is_pinned?Mt("unpin"):Mt("pin"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pinned",e)}))}function ke(t){const e=new pe({text:Mt("edit"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.opts.editComment(t.data,t.$el)}))}function $e(t){const e=new pe({text:Mt("delete"),confirm:!0,confirmText:Mt("deleteConfirm"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminDelete(e)}))}const be={Avatar:function(t){const e=t.$el.querySelector(".atk-avatar"),n=ft(""),i=t.opts.avatarURLBuilder;if(n.src=i?i(t.data):t.comment.getGravatarURL(),t.data.link){const i=ft('');i.href=Ct(t.data.link)?t.data.link:`https://${t.data.link}`,i.append(n),e.append(i)}else e.append(n)},Header:function(t){Object.entries({renderNick:ce,renderVerifyBadge:de,renderDate:he,renderUABadge:ue}).forEach((([e,n])=>{n(t)}))},Content:function(t){if(!t.data.is_collapsed)return t.$content.innerHTML=t.comment.getContentMarked(),void t.$content.classList.remove("atk-hide","atk-collapsed");t.$content.classList.add("atk-hide","atk-type-collapsed");const e=ft(`\n
        \n ${Mt("collapsedMsg")}\n ${Mt("expand")}\n
        `);t.$body.insertAdjacentElement("beforeend",e);const n=e.querySelector(".atk-show-btn");n.addEventListener("click",(e=>{e.stopPropagation(),t.$content.classList.contains("atk-hide")?(t.$content.innerHTML=t.comment.getContentMarked(),t.$content.classList.remove("atk-hide"),Nt(t.$content),n.innerText=Mt("collapse")):(t.$content.innerHTML="",t.$content.classList.add("atk-hide"),n.innerText=Mt("expand"))}))},ReplyAt:function(t){t.opts.flatMode||0===t.data.rid||t.opts.replyTo&&(t.$replyAt=ft(''),t.$replyAt.querySelector(".atk-nick").innerText=`${t.opts.replyTo.nick}`,t.$replyAt.onclick=()=>{t.comment.getActions().goToReplyComment()},t.$headerBadgeWrap.insertAdjacentElement("afterend",t.$replyAt))},ReplyTo:function(t){if(!t.opts.flatMode)return;if(!t.opts.replyTo)return;t.$replyTo=ft(`\n
        \n
        ${Mt("reply")} :
        \n
        \n
        `);const e=t.$replyTo.querySelector(".atk-nick");e.innerText=`@${t.opts.replyTo.nick}`,e.onclick=()=>{t.comment.getActions().goToReplyComment()};let n=ht(t.opts.replyTo.content);t.opts.replyTo.is_collapsed&&(n=`[${Mt("collapsed")}]`),t.$replyTo.querySelector(".atk-content").innerHTML=n,t.$body.prepend(t.$replyTo)},Pending:function(t){if(!t.data.is_pending)return;const e=ft(`
        ${Mt("pendingMsg")}
        `);t.$body.prepend(e)},Actions:function(t){Object.entries({renderVote:me,renderReply:ge,renderCollapse:fe,renderModerator:ye,renderPin:ve,renderEdit:ke,renderDel:$e}).forEach((([e,n])=>{n(t)}))}};class we{constructor(t){h(this,"comment"),h(this,"$el"),h(this,"$main"),h(this,"$header"),h(this,"$headerNick"),h(this,"$headerBadgeWrap"),h(this,"$body"),h(this,"$content"),h(this,"$childrenWrap"),h(this,"$actions"),h(this,"voteBtnUp"),h(this,"voteBtnDown"),h(this,"$replyTo"),h(this,"$replyAt"),this.comment=t}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}render(){var t;return this.$el=ft('
        \n
        \n
        \n
        \n
        \n \n \n \n
        \n
        \n
        \n
        \n \n
        \n
        \n
        \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),t=this,Object.entries(be).forEach((([e,n])=>{n(t)})),this.$childrenWrap&&this.$main.append(this.$childrenWrap),this.$el}checkHeightLimit(){const t=this.opts.heightLimit;if(!t||!t.content||!t.children)return;const e=t.content,n=t.children;oe({postExpandBtnClick:()=>{const t=this.comment.getChildren();1===t.length&&ae(t[0].getRender().$content)},scrollable:t.scrollable},[{el:this.$content,max:e,imgContains:!0},{el:this.$replyTo,max:e,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&ae(this.$childrenWrap)}playFadeAnim(){Nt(this.comment.getRender().$el)}playFadeAnimForBody(){Nt(this.comment.getRender().$body)}playFlashAnim(){this.$el.classList.remove("atk-flash-once"),window.setTimeout((()=>{this.$el.classList.add("atk-flash-once")}),150)}getChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=ft('
        '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}setUnread(t){t?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(t){t?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(t){this.setOpenable(!0),this.$el.onclick=e=>{e.stopPropagation(),window.open(t)}}setOpenAction(t){this.setOpenable(!0),this.$el.onclick=e=>{e.stopPropagation(),t()}}}class Ce{constructor(t){h(this,"comment"),this.comment=t}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}getApi(){return this.comment.getOpts().getApi()}vote(t){const e="up"===t?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.getApi().votes.vote(`comment_${t}`,this.data.id,c({},this.getApi().getUserFields())).then((t=>{var e,n;this.data.vote_up=t.data.up,this.data.vote_down=t.data.down,null==(e=this.comment.getRender().voteBtnUp)||e.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((t=>{null==e||e.setError(Mt("voteFail")),console.log(t)}))}adminEdit(t,e){if(e.isLoading)return;e.setLoading(!0,`${Mt("editing")}...`);const n=c({},this.data);"collapsed"===t?n.is_collapsed=!n.is_collapsed:"pending"===t?n.is_pending=!n.is_pending:"pinned"===t&&(n.is_pinned=!n.is_pinned),this.getApi().comments.updateComment(this.data.id,c({},n)).then((t=>{e.setLoading(!1),this.comment.setData(t.data)})).catch((t=>{console.error(t),e.setError(Mt("editFail"))}))}adminDelete(t){t.isLoading||(t.setLoading(!0,`${Mt("deleting")}...`),this.getApi().comments.deleteComment(this.data.id).then((()=>{t.setLoading(!1),this.opts.onDelete&&this.opts.onDelete(this.comment)})).catch((e=>{console.error(e),t.setError(Mt("deleteFail"))})))}goToReplyComment(){const t=window.location.hash,e=`#atk-comment-${this.data.rid}`;window.location.hash=e,e===t&&window.dispatchEvent(new Event("hashchange"))}}class Ee{constructor(t,e){h(this,"$el"),h(this,"renderInstance"),h(this,"actionInstance"),h(this,"data"),h(this,"opts"),h(this,"parent"),h(this,"children",[]),h(this,"nestCurt"),this.opts=e,this.data=c({},t),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new Ce(this),this.renderInstance=new we(this)}render(){const t=this.renderInstance.render();this.$el&&this.$el.replaceWith(t),this.$el=t,this.opts.onAfterRender&&this.opts.onAfterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(t){this.data=t,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(t,e="append"){t.parent=this,t.nestCurt=this.nestCurt+1,this.children.push(t);const n=this.getChildrenWrapEl(),i=t.getEl();"append"===e?n.append(i):"prepend"===e&&n.prepend(i),t.getRender().playFadeAnim(),t.getRender().checkHeightLimit()}getChildrenWrapEl(){return this.nestCurt>=this.opts.nestMax?this.parent.getChildrenWrapEl():this.getRender().getChildrenWrap()}getParents(){const t=[];let e=this.parent;for(;e;)t.push(e),e=e.getParent();return t}getEl(){if(!this.$el)throw new Error("comment element not initialized before `getEl()`");return this.$el}focus(){if(!this.$el)throw new Error("comment element not initialized before `focus()`");this.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()})),this.scrollIntoView(),this.getRender().playFlashAnim()}scrollIntoView(){this.$el&&Ft(this.$el,!1,this.opts.scrollRelativeTo&&this.opts.scrollRelativeTo())}remove(){var t;null==(t=this.$el)||t.remove()}getGravatarURL(){return`${(t={mirror:this.opts.gravatar.mirror,params:this.opts.gravatar.params,emailMD5:this.data.email_encrypted}).mirror.replace(/\/$/,"")}/${t.emailMD5}?${t.params.replace(/^\?/,"")}`;var t}getContentMarked(){return ht(this.data.content)}getDateFormatted(){return bt(new Date(this.data.date),Mt)}getUserUA(){const t=function(t){const e=window||{},n=navigator||{},i=String(t||n.userAgent),s={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},o={Trident:i.includes("Trident")||i.includes("NET CLR"),Presto:i.includes("Presto"),WebKit:i.includes("AppleWebKit"),Gecko:i.includes("Gecko/")},r={Safari:i.includes("Safari"),Chrome:i.includes("Chrome")||i.includes("CriOS"),IE:i.includes("MSIE")||i.includes("Trident"),Edge:i.includes("Edge")||i.includes("Edg"),Firefox:i.includes("Firefox")||i.includes("FxiOS"),"Firefox Focus":i.includes("Focus"),Chromium:i.includes("Chromium"),Opera:i.includes("Opera")||i.includes("OPR"),Vivaldi:i.includes("Vivaldi"),Yandex:i.includes("YaBrowser"),Kindle:i.includes("Kindle")||i.includes("Silk/"),360:i.includes("360EE")||i.includes("360SE"),UC:i.includes("UC")||i.includes(" UBrowser"),QQBrowser:i.includes("QQBrowser"),QQ:i.includes("QQ/"),Baidu:i.includes("Baidu")||i.includes("BIDUBrowser"),Maxthon:i.includes("Maxthon"),Sogou:i.includes("MetaSr")||i.includes("Sogou"),LBBROWSER:i.includes("LBBROWSER"),"2345Explorer":i.includes("2345Explorer"),TheWorld:i.includes("TheWorld"),MIUI:i.includes("MiuiBrowser"),Quark:i.includes("Quark"),Qiyu:i.includes("Qiyu"),Wechat:i.includes("MicroMessenger"),Taobao:i.includes("AliApp(TB"),Alipay:i.includes("AliApp(AP"),Weibo:i.includes("Weibo"),Douban:i.includes("com.douban.frodo"),Suning:i.includes("SNEBUY-APP"),iQiYi:i.includes("IqiyiApp")},a={Windows:i.includes("Windows"),Linux:i.includes("Linux")||i.includes("X11"),macOS:i.includes("Macintosh"),Android:i.includes("Android")||i.includes("Adr"),Ubuntu:i.includes("Ubuntu"),FreeBSD:i.includes("FreeBSD"),Debian:i.includes("Debian"),"Windows Phone":i.includes("IEMobile")||i.includes("Windows Phone"),BlackBerry:i.includes("BlackBerry")||i.includes("RIM"),MeeGo:i.includes("MeeGo"),Symbian:i.includes("Symbian"),iOS:i.includes("like Mac OS X"),"Chrome OS":i.includes("CrOS"),WebOS:i.includes("hpwOS")},l={Mobile:i.includes("Mobi")||i.includes("iPh")||i.includes("480"),Tablet:i.includes("Tablet")||i.includes("Pad")||i.includes("Nexus 7")};l.Mobile?l.Mobile=!i.includes("iPad"):r.Chrome&&i.includes("Edg")?(r.Chrome=!1,r.Edge=!0):e.showModalDialog&&e.chrome&&(r.Chrome=!1,r[360]=!0),s.device="PC",s.language=(()=>{const t=(n.browserLanguage||n.language).split("-");return t[1]&&(t[1]=t[1].toUpperCase()),t.join("_")})();const c={engine:o,browser:r,os:a,device:l};Object.entries(c).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{!0===n&&(s[t]=e)}))}));const d={Windows:()=>{const t=i.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[t]||t},Android:()=>i.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>i.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>i.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>i.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>i.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>i.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};s.osVersion="",d[s.os]&&(s.osVersion=d[s.os](),s.osVersion===i&&(s.osVersion=""));const h={Safari:()=>i.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>i.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>i.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>i.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>i.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>i.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>i.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>i.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>i.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>i.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>i.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>i.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>i.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>i.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>i.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>i.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>i.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>i.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>i.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>i.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>i.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>i.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>i.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>i.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>i.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>i.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>i.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>i.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>i.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return s.version="",h[s.browser]&&(s.version=h[s.browser](),s.version===i&&(s.version="")),s.version.indexOf(".")&&(s.version=s.version.substring(0,s.version.indexOf("."))),"iOS"===s.os&&i.includes("iPad")?s.os="iPadOS":"Edge"!==s.browser||i.includes("Edg")?"MIUI"===s.browser?s.os="Android":"Chrome"===s.browser&&Number(s.version)>27||"Opera"===s.browser&&Number(s.version)>12||"Yandex"===s.browser?s.engine="Blink":void 0===s.browser&&(s.browser="Unknow App"):s.engine="EdgeHTML",s}(this.data.ua);return{browser:`${t.browser} ${t.version}`,os:`${t.os} ${t.osVersion}`}}getOpts(){return this.opts}}class xe{constructor(t){h(this,"opts"),h(this,"$el"),h(this,"$loading"),h(this,"$text"),h(this,"offset",0),h(this,"total",0),h(this,"origText","Load More"),this.opts=t,this.origText=this.opts.text||this.origText,this.$el=ft(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.opts.pageSize}click(){this.hasMore&&this.opts.onClick(this.offset+this.opts.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(t){this.$loading.style.display=t?"":"none",this.$text.style.display=t?"none":""}showErr(t){this.setLoading(!1),this.$text.innerText=t,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(t,e){this.offset=t,this.total=e,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}class Se{constructor(){h(this,"instance"),h(this,"onReachedBottom",null),h(this,"opt")}create(t){return this.opt=t,this.instance=new xe({pageSize:t.pageSize,onClick:e=>u(this,null,(function*(){t.ctx.fetch({offset:e})})),text:Mt("loadMore")}),t.readMoreAutoLoad&&(this.onReachedBottom=()=>{this.instance.hasMore&&!this.opt.ctx.getData().getLoading()&&this.instance.click()},this.opt.ctx.on("list-reach-bottom",this.onReachedBottom)),this.instance.$el}setLoading(t){this.instance.setLoading(t)}update(t,e){this.instance.update(t,e)}showErr(t){this.instance.showErr(t)}next(){this.instance.click()}getHasMore(){return this.instance.hasMore}getIsClearComments(t){return 0===t.offset}dispose(){this.onReachedBottom&&this.opt.ctx.off("list-reach-bottom",this.onReachedBottom),this.instance.$el.remove()}}class Te{constructor(t,e){h(this,"opts"),h(this,"total"),h(this,"$el"),h(this,"$input"),h(this,"inputTimer"),h(this,"$prevBtn"),h(this,"$nextBtn"),h(this,"page",1),this.total=t,this.opts=e,this.$el=ft('
        \n
        \n
        \n \n
        \n \n
        \n \n
        \n
        \n
        '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=t=>this.keydown(t),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.opts.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(t,e){this.page=Math.ceil(t/this.pageSize)+1,this.total=e,this.setInput(this.page),this.checkDisabled()}setInput(t){this.$input.value=`${t}`}input(t=!1){window.clearTimeout(this.inputTimer);const e=this.$input.value.trim(),n=()=>{if(""===e)return void this.setInput(this.page);let t=Number(e);Number.isNaN(t)||t<1?this.setInput(this.page):(t>this.maxPage&&(this.setInput(this.maxPage),t=this.maxPage),this.change(t))};t?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const t=this.page-1;t<1||this.change(t)}next(){const t=this.page+1;t>this.maxPage||this.change(t)}getHasMore(){return this.page+1<=this.maxPage}change(t){this.page=t,this.opts.onChange(this.offset),this.setInput(t),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(t){const e=t.keyCode||t.which;if(38===e){const t=Number(this.$input.value)+1;if(t>this.maxPage)return;this.setInput(t),this.input()}else if(40===e){const t=Number(this.$input.value)-1;if(t<1)return;this.setInput(t),this.input()}else 13===e&&this.input(!0)}setLoading(t){t?Bt(this.$el):Dt(this.$el)}}class Le{constructor(){h(this,"instance")}create(t){return this.instance=new Te(t.total,{pageSize:t.pageSize,onChange:e=>u(this,null,(function*(){t.ctx.editorResetState(),t.ctx.fetch({offset:e,onSuccess:()=>{t.ctx.listGotoFirst()}})}))}),this.instance.$el}setLoading(t){this.instance.setLoading(t)}update(t,e){this.instance.update(t,e)}next(){this.instance.next()}getHasMore(){return this.instance.getHasMore()}getIsClearComments(){return!0}dispose(){this.instance.$el.remove()}}function Ae(t){const e=t.getData().getListLastFetch(),n={offset:0,total:0};return e?(n.offset=e.params.offset,e.data&&(n.total=e.params.flatMode?e.data.count:e.data.roots_count),n):n}const Me=t=>{let e=null;t.watchConf(["pagination","locale"],(n=>{const i=t.get("list");e&&e.dispose(),e=function(t){return t.pagination.readMore?new Se:new Le}(n);const{offset:s,total:o}=Ae(t),r=e.create({ctx:t,pageSize:n.pagination.pageSize,total:o,readMoreAutoLoad:n.pagination.autoLoad});i.$commentsWrap.after(r),null==e||e.update(s,o)})),t.on("list-loaded",(n=>{const{offset:i,total:s}=Ae(t);null==e||e.update(i,s)})),t.on("list-fetch",(n=>{t.getData().getComments().length>0&&(null==e?void 0:e.getIsClearComments(n))&&t.getData().clearComments()})),t.on("list-failed",(()=>{var t;null==(t=null==e?void 0:e.showErr)||t.call(e,Mt("loadFail"))})),t.on("list-fetch",(t=>{null==e||e.setLoading(!0)})),t.on("list-fetched",(({params:t})=>{null==e||e.setLoading(!1)}))};class Pe extends Kt{constructor(t){super(t),h(this,"$commentsWrap"),h(this,"commentNodes",[]),this.$el=ft('
        \n
        \n
        \n
        \n
        \n
        \n \n \n \n
        \n
        \n
        \n
        \n
        \n
        \n
        \n \n
        \n'),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),Me(t),this.initCrudEvents()}getCommentsWrapEl(){return this.$commentsWrap}getCommentNodes(){return this.commentNodes}getListLayout({forceFlatMode:t}={}){return new se({$commentsWrap:this.$commentsWrap,nestSortBy:this.ctx.conf.nestSort,nestMax:this.ctx.conf.nestMax,flatMode:"boolean"==typeof t?t:this.ctx.conf.flatMode,createCommentNode:(e,n)=>{const i=function(t,e,n,i){const s=new Ee(e,{onAfterRender:()=>{t.trigger("comment-rendered",s)},onDelete:e=>{t.getData().deleteComment(e.getID())},replyTo:n,flatMode:"boolean"==typeof(null==i?void 0:i.forceFlatMode)?null==i?void 0:i.forceFlatMode:t.conf.flatMode,gravatar:t.conf.gravatar,nestMax:t.conf.nestMax,heightLimit:t.conf.heightLimit,avatarURLBuilder:t.conf.avatarURLBuilder,scrollRelativeTo:t.conf.scrollRelativeTo,vote:t.conf.vote,voteDown:t.conf.voteDown,uaBadge:t.conf.uaBadge,getApi:()=>t.getApi(),replyComment:(e,n)=>t.replyComment(e,n),editComment:(e,n)=>t.editComment(e,n)});return s.render(),s}(this.ctx,e,n,{forceFlatMode:t});return this.commentNodes.push(i),i},findCommentNode:t=>this.commentNodes.find((e=>e.getID()===t))})}initCrudEvents(){this.ctx.on("list-load",(t=>{this.getListLayout().import(t)})),this.ctx.on("list-loaded",(t=>{0===t.length&&(this.commentNodes=[],this.$commentsWrap.innerHTML="")})),this.ctx.on("comment-inserted",(t=>{this.getListLayout().insert(t)})),this.ctx.on("comment-deleted",(t=>{const e=this.commentNodes.find((e=>e.getID()===t.id));e?(e.remove(),this.commentNodes=this.commentNodes.filter((e=>e.getID()!==t.id))):console.error(`comment node id=${t.id} not found`)})),this.ctx.on("comment-updated",(t=>{const e=this.commentNodes.find((e=>e.getID()===t.id));e&&e.setData(t)}))}}let Oe,Ue;function Ie(){return{init(){Oe=document.body.style.overflow,Ue=document.body.style.paddingRight},unlock(){document.body.style.overflow=Oe,document.body.style.paddingRight=Ue},lock(){document.body.style.overflow="hidden";const t=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);const n=t.offsetWidth;e.style.overflow="scroll";let i=t.offsetWidth;return n===i&&(i=e.clientWidth),document.body.removeChild(e),n-i}()+t||0}px`}}}class Re{constructor(t,e){h(this,"allowMaskClose",!0),h(this,"onAfterHide"),this.$el=t,this.opts=e}setOnAfterHide(t){this.onAfterHide=t}setAllowMaskClose(t){this.allowMaskClose=t}getAllowMaskClose(){return this.allowMaskClose}getEl(){return this.$el}show(){this.opts.onShow(),this.$el.style.display=""}hide(){return u(this,null,(function*(){this.opts.onHide(),this.$el.style.display="none",this.onAfterHide&&this.onAfterHide()}))}destroy(){return u(this,null,(function*(){this.opts.onHide(),this.$el.remove(),this.onAfterHide&&this.onAfterHide()}))}}class qe{constructor(){h(this,"$wrap"),h(this,"$mask"),h(this,"items",[]),this.$wrap=ft(''),this.$mask=this.$wrap.querySelector(".atk-layer-mask")}createItem(t,e){(e=e||this.createItemElement(t)).setAttribute("data-layer-name",t),this.$wrap.appendChild(e);const n=new Re(e,{onHide:()=>this.hideWrap(e),onShow:()=>this.showWrap()});return this.getMask().addEventListener("click",(()=>{n.getAllowMaskClose()&&n.hide()})),this.items.push(n),n}createItemElement(t){const e=document.createElement("div");return e.classList.add("atk-layer-item"),e.style.display="none",this.$wrap.appendChild(e),e}getWrap(){return this.$wrap}getMask(){return this.$mask}showWrap(){this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),Ie().lock()}hideWrap(t){this.items.map((t=>t.getEl())).filter((e=>e!==t&&e.isConnected&&"none"!==e.style.display)).length>0||(this.$wrap.style.display="none",Ie().unlock())}}class je{constructor(t){h(this,"wrap"),this.wrap=new qe,document.body.appendChild(this.wrap.getWrap()),t.on("unmounted",(()=>{this.wrap.getWrap().remove()})),Ie().init()}getEl(){return this.wrap.getWrap()}create(t,e){return this.wrap.createItem(t,e)}}const Be="ArtalkUser";class De{constructor(t){h(this,"data"),this.opts=t;const e=JSON.parse(window.localStorage.getItem(Be)||"{}");this.data={nick:e.nick||"",email:e.email||"",link:e.link||"",token:e.token||"",isAdmin:e.isAdmin||!1}}getData(){return this.data}update(t={}){Object.entries(t).forEach((([t,e])=>{this.data[t]=e})),window.localStorage.setItem(Be,JSON.stringify(this.data)),this.opts.onUserChanged&&this.opts.onUserChanged(this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}}const _e={i18n(t){At(t.conf.locale),t.watchConf(["locale"],(t=>{At(t.locale)}))},user:t=>new De({onUserChanged:e=>{t.trigger("user-changed",e)}}),layerManager:t=>new je(t),checkerLauncher:t=>new Qt({getCtx:()=>t,getApi:()=>t.getApi(),onReload:()=>t.reload(),getCaptchaIframeURL:()=>`${t.conf.server}/api/v2/captcha/?t=${+new Date}`}),editor(t){const e=new te(t);return t.$root.appendChild(e.$el),e},list(t){const e=new Pe(t);return t.$root.appendChild(e.$el),e},sidebarLayer:t=>new ee(t),editorPlugs(){}};function Fe(t){return u(this,null,(function*(){t.countEl&&document.querySelector(t.countEl)&&Ne(t,{query:"page_comment",numEl:t.countEl});const e=t.pvAdd&&t.pageKey?{[t.pageKey]:(yield t.getApi().pages.logPv({page_key:t.pageKey,page_title:t.pageTitle,site_name:t.siteName})).data.pv}:void 0;t.pvEl&&document.querySelector(t.pvEl)&&Ne(t,{query:"page_pv",numEl:t.pvEl,data:e})}))}function Ne(t,e){return u(this,null,(function*(){let n=e.data||{},i=Array.from(document.querySelectorAll(e.numEl)).map((e=>e.getAttribute("data-page-key")||t.pageKey)).filter((t=>t&&"number"!=typeof n[t]));if(i=[...new Set(i)],i.length>0){const s=(yield t.getApi().stats.getStats(e.query,{page_keys:i.join(","),site_name:t.siteName})).data.data;n=c(c({},n),s)}const s=t.pageKey?n[t.pageKey]:0;!function(t,e,n){document.querySelectorAll(t).forEach((t=>{const i=t.getAttribute("data-page-key"),s=Number(i?e[i]:n);t.innerHTML=`${s}`}))}(e.numEl,n,s)}))}function We(t){const e=ft('

        ');if(e.querySelector(".error-message").innerText=`${Mt("listLoadFailMsg")}\n${t.errMsg}`,t.retryFn){const n=ft(`${Mt("listRetry")}`);n.onclick=()=>t.retryFn&&t.retryFn(),e.appendChild(n)}if(t.onOpenSidebar){const n=ft(` | ${Mt("openName",{name:Mt("ctrlCenter")})}`);e.appendChild(n),n.onclick=()=>t.onOpenSidebar&&t.onOpenSidebar()}Wt(t.$err,e)}const He="ArtalkContent";class Ve{constructor(t){this.kit=t}reqAdd(){return u(this,null,(function*(){return(yield this.kit.useApi().comments.createComment(c({},yield this.getSubmitAddParams()))).data}))}getSubmitAddParams(){return u(this,null,(function*(){const{nick:t,email:e,link:n}=this.kit.useUser().getData(),i=this.kit.useConf();return{content:this.kit.useEditor().getContentFinal(),name:t,email:e,link:n,rid:0,page_key:i.pageKey,page_title:i.pageTitle,site_name:i.site,ua:yield wt()}}))}postSubmitAdd(t){this.kit.useGlobalCtx().getData().insertComment(t)}}class Ge extends Jt{constructor(t){super(t),h(this,"customs",[]),h(this,"defaultPreset"),this.defaultPreset=new Ve(this.kit);const e=()=>this.do();this.kit.useMounted((()=>{this.kit.useGlobalCtx().on("editor-submit",e)})),this.kit.useUnmounted((()=>{this.kit.useGlobalCtx().off("editor-submit",e)}))}registerCustom(t){this.customs.push(t)}do(){return u(this,null,(function*(){if(""===this.kit.useEditor().getContentFinal().trim())return void this.kit.useEditor().focus();const t=this.customs.find((t=>t.activeCond()));this.kit.useEditor().showLoading();try{let e;(null==t?void 0:t.pre)&&t.pre(),e=(null==t?void 0:t.req)?yield t.req():yield this.defaultPreset.reqAdd(),(null==t?void 0:t.post)?t.post(e):this.defaultPreset.postSubmitAdd(e)}catch(e){return console.error(e),void this.kit.useEditor().showNotify(`${Mt("commentFail")}: ${e.message||String(e)}`,"e")}finally{this.kit.useEditor().hideLoading()}this.kit.useEditor().reset(),this.kit.useGlobalCtx().trigger("editor-submitted")}))}}class ze extends Jt{constructor(t){super(t),h(this,"emoticons",[]),h(this,"loadingTask",null),h(this,"$grpWrap"),h(this,"$grpSwitcher"),h(this,"isListLoaded",!1),h(this,"isImgLoaded",!1),this.kit.useMounted((()=>{this.usePanel('
        '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.useContentTransformer((t=>this.transEmoticonImageText(t))),this.usePanelShow((()=>{(()=>{u(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()})),this.usePanelHide((()=>{this.$panel.parentElement.style.height=""})),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}loadEmoticonsData(){return u(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>u(this,null,(function*(){Bt(this.$panel),this.emoticons=yield this.handleData(this.kit.useConf().emoticons),Dt(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(t){return u(this,null,(function*(){if(!Array.isArray(t)&&["object","string"].includes(typeof t)&&(t=[t]),!Array.isArray(t))return Wt(this.$panel,`[${Mt("emoticon")}] Data must be of Array/Object/String type`),Dt(this.$panel),[];const e=e=>{"object"==typeof e&&(e.name&&t.find((t=>t.name===e.name))||t.push(e))},n=t=>u(this,null,(function*(){yield Promise.all(t.map(((t,i)=>u(this,null,(function*(){if("object"!=typeof t||Array.isArray(t)){if(Array.isArray(t))yield n(t);else if("string"==typeof t){const i=yield this.remoteLoad(t);Array.isArray(i)?yield n(i):"object"==typeof i&&e(i)}}else e(t)})))))}));return yield n(t),t.forEach((t=>{if(this.isOwOFormat(t)){this.convertOwO(t).forEach((t=>{e(t)}))}else Array.isArray(t)&&t.forEach((t=>{e(t)}))})),t=t.filter((t=>"object"==typeof t&&!Array.isArray(t)&&!!t&&!!t.name)),this.solveNullKey(t),this.solveSameKey(t),t}))}remoteLoad(t){return u(this,null,(function*(){if(!t)return[];try{const e=yield fetch(t);return yield e.json()}catch(e){return Dt(this.$panel),console.error("[Emoticons] Load Failed:",e),Wt(this.$panel,`[${Mt("emoticon")}] ${Mt("loadFail")}: ${String(e)}`),[]}}))}solveNullKey(t){t.forEach((t=>{t.items.forEach(((e,n)=>{e.key||(e.key=`${t.name} ${n+1}`)}))}))}solveSameKey(t){const e={};t.forEach((t=>{t.items.forEach((t=>{t.key&&""!==String(t.key).trim()&&(e[t.key]?e[t.key]++:e[t.key]=1,e[t.key]>1&&(t.key=`${t.key} ${e[t.key]}`))}))}))}isOwOFormat(t){try{return"object"==typeof t&&!!Object.values(t).length&&Array.isArray(Object.keys(Object.values(t)[0].container))&&Object.keys(Object.values(t)[0].container[0]).includes("icon")}catch(e){return!1}}convertOwO(t){const e=[];return Object.entries(t).forEach((([t,n])=>{const i={name:t,type:n.type,items:[]};n.container.forEach(((e,n)=>{const s=e.icon;if(/<(img|IMG)/.test(s)){const t=/src=["'](.*?)["']/.exec(s);t&&t.length>1&&(e.icon=t[1])}i.items.push({key:e.text||`${t} ${n+1}`,val:e.icon})})),e.push(i)})),e}initEmoticonsList(){this.$grpWrap=ft('
        '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((t,e)=>{const n=ft('');this.$grpWrap.append(n),n.setAttribute("data-index",String(e)),n.setAttribute("data-grp-name",t.name),n.setAttribute("data-type",t.type),t.items.forEach((e=>{const i=ft('');if(n.append(i),e.key&&!new RegExp(`^(${t.name})?\\s?[0-9]+$`).test(e.key)&&i.setAttribute("title",e.key),"image"===t.type){const t=document.createElement("img");t.src=e.val,t.alt=e.key,i.append(t)}else i.innerText=e.val;i.onclick=()=>{"image"===t.type?this.kit.useEditor().insertContent(`:[${e.key}]`):this.kit.useEditor().insertContent(e.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=ft('
        '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((t,e)=>{const n=ft("");n.innerText=t.name,n.setAttribute("data-index",String(e)),n.onclick=()=>this.openGrp(e),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(t){var e,n,i;Array.from(this.$grpWrap.children).forEach((e=>{const n=e;n.getAttribute("data-index")!==String(t)?n.style.display="none":n.style.display=""})),null==(e=this.$grpSwitcher)||e.querySelectorAll("span.active").forEach((t=>t.classList.remove("active"))),null==(i=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${t}"]`))||i.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(t){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((e=>{"image"===e.type&&Object.entries(e.items).forEach((([e,n])=>{t=t.split(`:[${n.key}]`).join(``)}))})),t):t}}const Qe=["png","jpg","jpeg","gif","bmp","svg","webp"];class Ke extends Jt{constructor(t){super(t),h(this,"$imgUploadInput"),this.kit.useMounted((()=>this.init())),this.initDragImg()}init(){this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=Qe.map((t=>`.${t}`)).join(",");const t=this.useBtn(``);t.after(this.$imgUploadInput),t.onclick=()=>{const t=this.$imgUploadInput;t.onchange=()=>{(()=>{u(this,null,(function*(){if(!t.files||0===t.files.length)return;const e=t.files[0];this.uploadImg(e)}))})()},t.click()},this.kit.useConf().imgUpload||this.$btn.setAttribute("atk-only-admin-show","")}initDragImg(){const t=t=>{if(t)for(let e=0;e{t.stopPropagation(),t.preventDefault()},n=e=>{var n;const i=null==(n=e.dataTransfer)?void 0:n.files;(null==i?void 0:i.length)&&(e.preventDefault(),t(i))},i=e=>{var n;const i=null==(n=e.clipboardData)?void 0:n.files;(null==i?void 0:i.length)&&(e.preventDefault(),t(i))};this.kit.useMounted((()=>{this.kit.useUI().$textarea.addEventListener("dragover",e),this.kit.useUI().$textarea.addEventListener("drop",n),this.kit.useUI().$textarea.addEventListener("paste",i)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("dragover",e),this.kit.useUI().$textarea.removeEventListener("drop",n),this.kit.useUI().$textarea.removeEventListener("paste",i)}))}uploadImg(t){return u(this,null,(function*(){const e=/[^.]+$/.exec(t.name);if(!e||!Qe.includes(e[0]))return;if(!this.kit.useUser().checkHasBasicUserInfo())return void this.kit.useEditor().showNotify(Mt("uploadLoginMsg"),"w");let n="\n";""===this.kit.useUI().$textarea.value.trim()&&(n="");const i=`${n}![](Uploading ${t.name}...)`;let s;this.kit.useEditor().insertContent(i);try{const e=this.kit.useConf().imgUploader;s=e?{public_url:yield e(t)}:(yield this.kit.useApi().upload.upload({file:t})).data}catch(o){console.error(o),this.kit.useEditor().showNotify(`${Mt("uploadFail")}: ${o.message}`,"e")}if(s&&s.public_url){let t=s.public_url;Ct(t)||(t=Et({base:this.kit.useConf().server,path:t})),this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(i,`${n}![](${t})`))}else this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(i,""))}))}}class Ye extends Jt{constructor(t){super(t),h(this,"isPlugPanelShow",!1),this.kit.useMounted((()=>{this.usePanel('
        '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.kit.useEvents().on("content-updated",(t=>{this.isPlugPanelShow&&this.updateContent()})),this.usePanelShow((()=>{this.isPlugPanelShow=!0,this.updateContent()})),this.usePanelHide((()=>{this.isPlugPanelShow=!1}))}updateContent(){this.$panel.innerHTML=this.kit.useEditor().getContentMarked()}}const Je=[class extends Jt{constructor(t){super(t);const e=()=>{this.save()};this.kit.useMounted((()=>{const t=window.localStorage.getItem(He)||"";""!==t.trim()&&(this.kit.useEditor().showNotify(Mt("restoredMsg"),"i"),this.kit.useEditor().setContent(t)),this.kit.useEvents().on("content-updated",e)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("content-updated",e)}))}save(){window.localStorage.setItem(He,this.kit.useEditor().getContentRaw().trim())}},class extends Jt{get $inputs(){return this.kit.useEditor().getHeaderInputEls()}constructor(t){super(t);const e={},n={},i=(t,e,n)=>()=>{this.kit.useEvents().trigger(t,{field:n,$input:e})};this.kit.useMounted((()=>{Object.entries(this.$inputs).forEach((([t,s])=>{s.addEventListener("input",e[t]=i("header-input",s,t)),s.addEventListener("change",n[t]=i("header-change",s,t))}))})),this.kit.useUnmounted((()=>{Object.entries(this.$inputs).forEach((([t,i])=>{i.removeEventListener("input",e[t]),i.removeEventListener("change",n[t])}))}))}},class extends Jt{constructor(t){super(t),h(this,"query",{timer:null,abortFn:null});const e=({$input:t,field:e})=>{"edit"!==this.kit.useEditor().getState()&&(this.kit.useUser().update({[e]:t.value.trim()}),"nick"!==e&&"email"!==e||this.fetchUserInfo())};this.kit.useMounted((()=>{Object.entries(this.kit.useEditor().getHeaderInputEls()).forEach((([t,e])=>{e.placeholder=`${Mt(t)}`,e.value=this.kit.useUser().getData()[t]||""})),this.kit.useEvents().on("header-input",e)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-input",e)}))}fetchUserInfo(){this.kit.useUser().logout(),this.query.timer&&window.clearTimeout(this.query.timer),this.query.abortFn&&this.query.abortFn(),this.query.timer=window.setTimeout((()=>{this.query.timer=null;const t=this.kit.useApi(),e="getUserCancelToken";this.query.abortFn=()=>t.abortRequest(e),t.user.getUser(c({},t.getUserFields()),{cancelToken:e}).then((t=>this.onUserInfoFetched(t.data))).catch((t=>{})).finally((()=>{this.query.abortFn=null}))}),400)}onUserInfoFetched(t){var e;t.is_login||this.kit.useUser().logout(),this.kit.useGlobalCtx().getData().updateNotifies(t.notifies),this.kit.useUser().checkHasBasicUserInfo()&&!t.is_login&&(null==(e=t.user)?void 0:e.is_admin)&&this.kit.useGlobalCtx().checkAdmin({onSuccess:()=>{}}),t.user&&t.user.link&&(this.kit.useUI().$link.value=t.user.link,this.kit.useUser().update({link:t.user.link}))}},class extends Jt{constructor(t){super(t);const e=({field:t})=>{"link"===t&&this.onLinkInputChange()};this.kit.useMounted((()=>{this.kit.useEvents().on("header-change",e)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-change",e)}))}onLinkInputChange(){const t=this.kit.useUI().$link.value.trim();t&&!/^(http|https):\/\//.test(t)&&(this.kit.useUI().$link.value=`https://${t}`,this.kit.useUser().update({link:this.kit.useUI().$link.value}))}},class extends Jt{constructor(t){super(t);const e=t=>this.onKeydown(t),n=()=>this.onInput();this.kit.useMounted((()=>{this.kit.useUI().$textarea.placeholder=this.kit.useConf().placeholder||Mt("placeholder"),this.kit.useUI().$textarea.addEventListener("keydown",e),this.kit.useUI().$textarea.addEventListener("input",n)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("keydown",e),this.kit.useUI().$textarea.removeEventListener("input",n)})),this.kit.useEvents().on("content-updated",(()=>{window.setTimeout((()=>{this.adaptiveHeightByContent()}),80)}))}onKeydown(t){9===(t.keyCode||t.which)&&(t.preventDefault(),this.kit.useEditor().insertContent("\t"))}onInput(){this.kit.useEvents().trigger("content-updated",this.kit.useEditor().getContentRaw())}adaptiveHeightByContent(){const t=this.kit.useUI().$textarea.offsetHeight-this.kit.useUI().$textarea.clientHeight;this.kit.useUI().$textarea.style.height="0px",this.kit.useUI().$textarea.style.height=`${this.kit.useUI().$textarea.scrollHeight+t}px`}},Ge,class extends Jt{constructor(t){super(t);const e=()=>{this.kit.useEditor().submit()};this.kit.useMounted((()=>{this.kit.useUI().$submitBtn.innerText=this.kit.useConf().sendBtn||Mt("send"),this.kit.useUI().$submitBtn.addEventListener("click",e)})),this.kit.useUnmounted((()=>{this.kit.useUI().$submitBtn.removeEventListener("click",e)}))}},Xt,class extends Jt{constructor(t){super(t),h(this,"comment"),this.useEditorStateEffect("reply",(t=>(this.setReply(t),()=>{this.cancelReply()}))),this.kit.useEvents().on("mounted",(()=>{const t=this.kit.useDeps(Ge);if(!t)throw Error("SubmitPlug not initialized");const e=new Ve(this.kit);t.registerCustom({activeCond:()=>!!this.comment,req:()=>u(this,null,(function*(){if(!this.comment)throw new Error("reply comment cannot be empty");return(yield this.kit.useApi().comments.createComment(d(c({},yield e.getSubmitAddParams()),{rid:this.comment.id,page_key:this.comment.page_key,page_title:void 0,site_name:this.comment.site_name}))).data})),post:t=>{const n=this.kit.useConf();t.page_key!==n.pageKey&&window.open(`${t.page_url}#atk-comment-${t.id}`),e.postSubmitAdd(t)}})}))}setReply(t){const e=this.kit.useUI();if(!e.$sendReplyBtn){const n=ft(`${Mt("reply")} `);n.querySelector(".atk-text").innerText=`@${t.nick}`,n.addEventListener("click",(()=>{this.kit.useEditor().resetState()})),e.$stateWrap.append(n),e.$sendReplyBtn=n}this.comment=t,e.$textarea.focus()}cancelReply(){if(!this.comment)return;const t=this.kit.useUI();t.$sendReplyBtn&&(t.$sendReplyBtn.remove(),t.$sendReplyBtn=void 0),this.comment=void 0}},class extends Jt{constructor(t){super(t),h(this,"comment"),h(this,"originalSubmitBtnText","Send"),this.useEditorStateEffect("edit",(t=>(this.edit(t),()=>{this.cancelEdit()}))),this.kit.useMounted((()=>{const t=this.kit.useDeps(Ge);if(!t)throw Error("SubmitPlug not initialized");t.registerCustom({activeCond:()=>!!this.comment,req:()=>u(this,null,(function*(){const t={content:this.kit.useEditor().getContentFinal(),nick:this.kit.useUI().$nick.value,email:this.kit.useUI().$email.value,link:this.kit.useUI().$link.value},e=this.comment;return(yield this.kit.useApi().comments.updateComment(e.id,c(c({},e),t))).data})),post:t=>{this.kit.useGlobalCtx().getData().updateComment(t)}})}))}edit(t){const e=this.kit.useUI();if(!e.$editCancelBtn){const t=ft(`${Mt("editCancel")}`);t.onclick=()=>{this.kit.useEditor().resetState()},e.$stateWrap.append(t),e.$editCancelBtn=t}this.comment=t,e.$header.style.display="none",e.$nick.value=t.nick||"",e.$email.value=t.email||"",e.$link.value=t.link||"",this.kit.useEditor().setContent(t.content),e.$textarea.focus(),this.updateSubmitBtnText(Mt("save"))}cancelEdit(){if(!this.comment)return;const t=this.kit.useUI();t.$editCancelBtn&&(t.$editCancelBtn.remove(),t.$editCancelBtn=void 0),this.comment=void 0;const{nick:e,email:n,link:i}=this.kit.useUser().getData();t.$nick.value=e,t.$email.value=n,t.$link.value=i,this.kit.useEditor().setContent(""),this.restoreSubmitBtnText(),t.$header.style.display=""}updateSubmitBtnText(t){this.originalSubmitBtnText=this.kit.useUI().$submitBtn.innerText,this.kit.useUI().$submitBtn.innerText=t}restoreSubmitBtnText(){this.kit.useUI().$submitBtn.innerText=this.originalSubmitBtnText}},class extends Jt{constructor(t){super(t);const e=()=>this.open(),n=()=>this.close();this.kit.useMounted((()=>{this.kit.useEvents().on("editor-open",e),this.kit.useEvents().on("editor-close",n)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("editor-open",e),this.kit.useEvents().off("editor-close",n)}))}open(){var t;null==(t=this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed"))||t.remove(),this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""}close(){this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed")||this.kit.useUI().$textareaWrap.prepend(ft(`
        ${Mt("onlyAdminCanReply")}
        `)),this.kit.useUser().getData().isAdmin?(this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""):(this.kit.useUI().$textarea.style.display="none",this.kit.useEvents().trigger("panel-close"),this.kit.useUI().$bottom.style.display="none")}},ze,Ke,Ye];class Xe{constructor(t){this.plugs=t}useEditor(){return this.plugs.editor}useGlobalCtx(){return this.plugs.editor.ctx}useConf(){return this.plugs.editor.ctx.conf}useApi(){return this.plugs.editor.ctx.getApi()}useUser(){return this.plugs.editor.ctx.get("user")}useUI(){return this.plugs.editor.getUI()}useEvents(){return this.plugs.getEvents()}useMounted(t){this.useEvents().on("mounted",t)}useUnmounted(t){this.useEvents().on("unmounted",t)}useDeps(t){return this.plugs.get(t)}}class Ze{constructor(t){h(this,"plugs",[]),h(this,"openedPlug",null),h(this,"events",new Pt),this.editor=t;let e=!1;this.editor.ctx.watchConf(["imgUpload","emoticons","preview","editorTravel","locale"],(t=>{e&&this.getEvents().trigger("unmounted"),this.clear(),function(t){const e=new Map;return e.set(Ke,t.imgUpload),e.set(ze,t.emoticons),e.set(Ye,t.preview),e.set(Xt,t.editorTravel),Je.filter((t=>!e.has(t)||!!e.get(t)))}(t).forEach((t=>{const e=new Xe(this);this.plugs.push(new t(e))})),this.getEvents().trigger("mounted"),e=!0,this.loadPluginUI()})),this.events.on("panel-close",(()=>this.closePlugPanel()))}getPlugs(){return this.plugs}getEvents(){return this.events}clear(){this.plugs=[],this.events=new Pt,this.openedPlug&&this.closePlugPanel()}loadPluginUI(){this.editor.getUI().$plugPanelWrap.innerHTML="",this.editor.getUI().$plugPanelWrap.style.display="none",this.editor.getUI().$plugBtnWrap.innerHTML="",this.plugs.forEach((t=>this.loadPluginItem(t)))}loadPluginItem(t){const e=t.$btn;if(!e)return;this.editor.getUI().$plugBtnWrap.appendChild(e),!e.onclick&&(e.onclick=()=>{this.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((t=>t.classList.remove("active"))),t!==this.openedPlug?(this.openPlugPanel(t),e.classList.add("active")):this.closePlugPanel()});const n=t.$panel;n&&(n.style.display="none",this.editor.getUI().$plugPanelWrap.appendChild(n))}get(t){return this.plugs.find((e=>e instanceof t))}openPlugPanel(t){this.plugs.forEach((e=>{const n=e.$panel;n&&(e===t?(n.style.display="",this.events.trigger("panel-show",t)):(n.style.display="none",this.events.trigger("panel-hide",t)))})),this.editor.getUI().$plugPanelWrap.style.display="",this.openedPlug=t}closePlugPanel(){this.openedPlug&&(this.editor.getUI().$plugPanelWrap.style.display="none",this.events.trigger("panel-hide",this.openedPlug),this.openedPlug=null)}getTransformedContent(t){let e=t;return this.plugs.forEach((t=>{t.contentTransformer&&(e=t.contentTransformer(e))})),e}}const tn="2.8.4";let en=!1;let nn;function sn(t,e){const n="atk-dark-mode";t.forEach((t=>{e?t.classList.add(n):t.classList.remove(n)}))}const on=[...[t=>{!function(){try{if(!e.marked.name)return}catch(t){return}e.marked.setOptions(c({renderer:st()},ct)),at=e.marked}(),t.on("updated",(t=>{var e;t.markedReplacers&&(e=t.markedReplacers,lt=e)}))},t=>{const e=t.get("editor"),n=new Ze(e);t.inject("editorPlugs",n)},t=>{const e=()=>{var e;e=t.get("user").getData().isAdmin,function(t){const e=[];t.$root.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t)));const n=document.querySelector(".atk-sidebar");return n&&n.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t))),e}({$root:t.$root}).forEach((t=>{e?t.classList.remove("atk-hide"):t.classList.add("atk-hide")}))};t.on("list-loaded",(()=>{e()})),t.on("user-changed",(t=>{e()}))},...[t=>{t.on("list-fetch",(e=>{if(t.getData().getLoading())return;t.getData().setLoading(!0);const n=c({offset:0,limit:t.conf.pagination.pageSize,flatMode:t.conf.flatMode,paramsModifier:t.conf.listFetchParamsModifier},e);t.getData().setListLastFetch({params:n});const i={limit:n.limit,offset:n.offset,flat_mode:n.flatMode,page_key:t.getConf().pageKey,site_name:t.getConf().site};n.paramsModifier&&n.paramsModifier(i),t.getApi().comments.getComments(c(c({},i),t.getApi().getUserFields())).then((({data:e})=>{t.getData().setListLastFetch({params:n,data:e}),t.getData().loadComments(e.comments),t.getData().updatePage(e.page),n.onSuccess&&n.onSuccess(e),t.trigger("list-fetched",{params:n,data:e})})).catch((e=>{const i={msg:e.msg||String(e),data:e.data};throw n.onError&&n.onError(i),t.trigger("list-failed",i),t.trigger("list-fetched",{params:n,error:i}),e})).finally((()=>{t.getData().setLoading(!1)}))}))},t=>{t.on("list-fetch",(e=>{const n=t.get("list");0===e.offset&&_t(!0,n.$el)})),t.on("list-fetched",(()=>{_t(!1,t.get("list").$el)}))},t=>{t.on("comment-rendered",(e=>{if(!0===t.conf.listUnreadHighlight){const n=t.getData().getNotifies(),i=n.find((t=>t.comment_id===e.getID()));i?(e.getRender().setUnread(!0),e.getRender().setOpenAction((()=>{window.open(i.read_link),t.getData().updateNotifies(n.filter((t=>t.comment_id!==e.getID())))}))):e.getRender().setUnread(!1)}})),t.on("list-goto",(e=>{const n=vt("atk_notify_key");n&&t.getApi().notifies.markNotifyRead(e,n).then((()=>{t.getData().updateNotifies(t.getData().getNotifies().filter((t=>t.comment_id!==e)))}))}))},t=>{let e;t.on("mounted",(()=>{const n=t.get("list");e=n.$el.querySelector('[data-action="admin-close-comment"]'),e.addEventListener("click",(()=>{const e=t.getData().getPage();if(!e)throw new Error("Page data not found");e.admin_only=!e.admin_only,function(t,e){t.editorShowLoading(),t.getApi().pages.updatePage(e.id,e).then((({data:e})=>{t.getData().updatePage(e)})).catch((e=>{t.editorShowNotify(`${Mt("editFail")}: ${e.message||String(e)}`,"e")})).finally((()=>{t.editorHideLoading()}))}(t,e)}))})),t.on("page-loaded",(n=>{var i,s;const o=t.get("editor");!0===(null==n?void 0:n.admin_only)?(null==(i=o.getPlugs())||i.getEvents().trigger("editor-close"),e&&(e.innerText=Mt("openComment"))):(null==(s=o.getPlugs())||s.getEvents().trigger("editor-open"),e&&(e.innerText=Mt("closeComment")))})),t.on("list-loaded",(e=>{t.editorResetState()}))},t=>{t.on("list-loaded",(()=>{(()=>{var e,n;const i=t.get("list").$el.querySelector(".atk-comment-count .atk-text");if(!i)return;const s=yt(Mt("counter",{count:`${Number(null==(n=null==(e=t.getData().getListLastFetch())?void 0:e.data)?void 0:n.count)||0}`}));i.innerHTML=s.replace(/(\d+)/,'$1')})()})),t.on("comment-inserted",(()=>{const e=t.getData().getListLastFetch();(null==e?void 0:e.data)&&(e.data.count+=1)})),t.on("comment-deleted",(()=>{const e=t.getData().getListLastFetch();(null==e?void 0:e.data)&&(e.data.count-=1)}))},t=>{let e=null;const n=()=>{if(!e)return;const n=t.get("user").getData();if(n.nick&&n.email){e.classList.remove("atk-hide");const t=e.querySelector(".atk-text");t&&(t.innerText=n.isAdmin?Mt("ctrlCenter"):Mt("msgCenter"))}else e.classList.add("atk-hide")};t.watchConf(["locale"],(i=>{const s=t.get("list");e=s.$el.querySelector('[data-action="open-sidebar"]'),e&&(e.onclick=()=>{t.showSidebar()},n())})),t.on("user-changed",(t=>{n()}))},t=>{let e=null;t.on("mounted",(()=>{const n=t.get("list");e=n.$el.querySelector(".atk-unread-badge")})),t.on("notifies-updated",(t=>{var n;n=t.length||0,e&&(n>0?(e.innerText=`${Number(n||0)}`,e.style.display="block"):e.style.display="none")}))},t=>{const e=e=>{t.conf.listFetchParamsModifier=e,t.reload()},n=t=>{!function(t){const{$dropdownWrap:e,dropdownList:n}=t;if(e.querySelector(".atk-dropdown"))return;e.classList.add("atk-dropdown-wrap"),e.append(ft(''));let i=0;const s=(t,e,n,s)=>{s(),i=t,o.querySelectorAll(".active").forEach((t=>{t.classList.remove("active")})),e.classList.add("active"),o.style.display="none",setTimeout((()=>{o.style.display=""}),80)},o=ft('
          ');n.forEach(((t,e)=>{const n=t[0],r=t[1],a=ft('
        • '),l=a.querySelector("span");l.innerText=n,l.onclick=()=>{s(e,a,n,r)},o.append(a),e===i&&a.classList.add("active")})),e.append(o)}({$dropdownWrap:t,dropdownList:[[Mt("sortLatest"),()=>{e((t=>{t.sort_by="date_desc"}))}],[Mt("sortBest"),()=>{e((t=>{t.sort_by="vote"}))}],[Mt("sortOldest"),()=>{e((t=>{t.sort_by="date_asc"}))}],[Mt("sortAuthor"),()=>{e((t=>{t.view_only_admin=!0}))}]]})};t.watchConf(["listSort","locale"],(e=>{const i=t.get("list").$el.querySelector(".atk-comment-count");i&&(e.listSort?n(i):function(t){var e,n;const{$dropdownWrap:i}=t;i.classList.remove("atk-dropdown-wrap"),null==(e=i.querySelector(".atk-arrow-down-icon"))||e.remove(),null==(n=i.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:i}))}))},t=>{let e=0;const n=({locker:n})=>{const i=function(){const t=window.location.hash.match(/#atk-comment-([0-9]+)/);let e=t&&t[1]&&!Number.isNaN(parseFloat(t[1]))?parseFloat(t[1]):null;e||(e=Number(vt("atk_comment")));return e||null}();i&&(n&&e===i||(e=i,t.trigger("list-goto",i)))},i=()=>n({locker:!1}),s=()=>n({locker:!0});t.on("mounted",(()=>{window.addEventListener("hashchange",i),t.on("list-loaded",s)})),t.on("unmounted",(()=>{window.removeEventListener("hashchange",i),t.off("list-loaded",s)}))},t=>{t.on("list-goto",(e=>u(this,null,(function*(){let n=t.getCommentNodes().find((t=>t.getID()===e));if(!n){const i=(yield t.getApi().comments.getComment(e)).data;t.get("list").getListLayout({forceFlatMode:!0}).insert(i.comment,i.reply_comment),n=t.getCommentNodes().find((t=>t.getID()===e))}n&&n.focus()}))))},t=>{t.on("list-loaded",(e=>{const n=t.get("list"),i=e.length<=0;let s=n.getCommentsWrapEl().querySelector(".atk-list-no-comment");i?s||(s=ft('
          '),s.innerHTML=tt(n.ctx.conf.noComment||n.ctx.$t("noComment")),n.getCommentsWrapEl().appendChild(s)):null==s||s.remove()}))},t=>{t.on("mounted",(()=>{const e=t.get("list").$el.querySelector(".atk-copyright");e&&(e.innerHTML=`Powered By Artalk`)}))},t=>{let e=null;t.on("mounted",(()=>{e=window.setInterval((()=>{t.get("list").$el.querySelectorAll("[data-atk-comment-date]").forEach((e=>{const n=e.getAttribute("data-atk-comment-date");e.innerText=bt(new Date(Number(n)),t.$t)}))}),3e4)})),t.on("unmounted",(()=>{e&&window.clearInterval(e)}))},t=>{t.on("list-fetch",(()=>{Wt(t.get("list").$el,null)})),t.on("list-failed",(e=>{We({$err:t.get("list").$el,errMsg:e.msg,errData:e.data,retryFn:()=>t.fetch({offset:0})})}))},t=>{let e=null;const n=()=>{null==e||e.disconnect(),e=null};t.on("list-loaded",(()=>{n();const i=t.get("list").getCommentsWrapEl().childNodes,s=i.length>2?i[i.length-2]:null;s&&("IntersectionObserver"in window?(i=>{const s=t.conf.scrollRelativeTo&&t.conf.scrollRelativeTo()||null;e=new IntersectionObserver((([e])=>{e.isIntersecting&&(n(),t.trigger("list-reach-bottom"))}),{threshold:.9,root:s}),e.observe(i)})(s):console.warn("IntersectionObserver api not supported"))})),t.on("unmounted",(()=>{n()}))},t=>{const e=()=>{const e=t.get("list"),n=t.conf.scrollRelativeTo&&t.conf.scrollRelativeTo();(n||window).scroll({top:kt(e.$el,n).top,left:0})};t.on("mounted",(()=>{t.on("list-goto-first",e)})),t.on("unmounted",(()=>{t.off("list-goto-first",e)}))}],t=>{t.on("list-fetch",(e=>{if(0!==e.offset)return;const n=t.getApi().getUserFields();n&&t.getApi().notifies.getNotifies(n).then((e=>{t.getData().updateNotifies(e.data.notifies)}))}))},t=>{t.watchConf(["site","pageKey","pageTitle","countEl","pvEl"],(e=>{Fe({getApi:()=>t.getApi(),siteName:e.site,pageKey:e.pageKey,pageTitle:e.pageTitle,countEl:e.countEl,pvEl:e.pvEl,pvAdd:"boolean"!=typeof t.conf.pvAdd||t.conf.pvAdd})}))},t=>{t.watchConf(["apiVersion","versionCheck"],(e=>{const n=t.get("list");e.apiVersion&&e.versionCheck&&!en&&function(t,e,n){const i=function(t,e){const n=t.split("."),i=e.split(".");for(let s=0;s<3;s++){const t=Number(n[s]),e=Number(i[s]);if(t>e)return 1;if(e>t)return-1;if(!Number.isNaN(t)&&Number.isNaN(e))return 1;if(Number.isNaN(t)&&!Number.isNaN(e))return-1}return 0}(e,n);if(0===i)return;const s=ft(`
          ${Mt("updateMsg",{name:Mt(i<0?"frontend":"backend")})}

          ${Mt("currentVersion")}: ${Mt("frontend")} ${e} / ${Mt("backend")} ${n}

          `),o=ft(`${Mt("ignore")}`);o.onclick=()=>{Wt(t.$el.parentElement,null),en=!0,t.ctx.fetch({offset:0})},s.append(o),Wt(t.$el.parentElement,s,'Artalk Warn')}(n,tn,e.apiVersion)}))},t=>{let e;const n=n=>{const i=[t.$root,t.get("layerManager").getEl()];nn||(nn=window.matchMedia("(prefers-color-scheme: dark)")),"auto"===n?(e||(e=t=>sn(i,t.matches),nn.addEventListener("change",e)),sn(i,nn.matches)):(e&&(nn.removeEventListener("change",e),e=void 0),sn(i,n))};t.watchConf(["darkMode"],(t=>n(t.darkMode))),t.on("created",(()=>n(t.conf.darkMode))),t.on("unmounted",(()=>{e&&(null==nn||nn.removeEventListener("change",e)),e=void 0}))}]];function rn(t){return u(this,null,(function*(){var e;const n=[],i=e=>{e.forEach((e=>{"function"!=typeof e||n.includes(e)||(e(t),n.push(e))}))};i(on);const{data:s}=yield t.getApi().conf.conf().catch((e=>{throw function(t,e){var n;let i="";if(null==(n=e.data)?void 0:n.err_no_site){const e={create_name:t.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};i=`sites|${JSON.stringify(e)}`}We({$err:t.get("list").$el,errMsg:e.msg||String(e),errData:e.data,retryFn:()=>rn(t),onOpenSidebar:t.get("user").getData().isAdmin?()=>t.showSidebar({view:i}):void 0})}(t,e),e}));let o={apiVersion:null==(e=s.version)?void 0:e.version};if(t.conf.useBackendConf){if(!s.frontend_conf)throw new Error("The remote backend does not respond to the frontend conf, but `useBackendConf` conf is enabled");o=c(c({},o),function(t){const e=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(t).forEach((n=>{e.includes(n)&&delete t[n]})),t.emoticons&&"string"==typeof t.emoticons&&(t.emoticons=t.emoticons.trim(),t.emoticons.startsWith("[")||t.emoticons.startsWith("{")?t.emoticons=JSON.parse(t.emoticons):"false"===t.emoticons&&(t.emoticons=!1)),t}(s.frontend_conf))}t.conf.remoteConfModifier&&t.conf.remoteConfModifier(o),o.pluginURLs&&(yield function(t,e){return u(this,null,(function*(){if(!t||!Array.isArray(t))return[];const n=[];return t.forEach((t=>{/^(http|https):\/\//.test(t)||(t=`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`),n.push(new Promise(((e,n)=>{if(document.querySelector(`script[src="${t}"]`))return void e();const i=document.createElement("script");i.src=t,document.head.appendChild(i),i.onload=()=>e(),i.onerror=t=>n(t)})))})),yield Promise.all(n),Object.values(window.ArtalkPlugins||{})}))}(o.pluginURLs,t.conf.server).then((t=>{i(t)})).catch((t=>{console.error("Failed to load plugin",t)}))),t.trigger("created"),t.updateConf(o),t.trigger("mounted"),t.conf.remoteConfModifier||t.fetch({offset:0})}))}class an{constructor(t){h(this,"ctx");const e=Ut(t,!0);this.ctx=new qt(e),Object.entries(_e).forEach((([t,e])=>{const n=e(this.ctx);n&&this.ctx.inject(t,n)})),rn(this.ctx)}getConf(){return this.ctx.getConf()}getEl(){return this.ctx.$root}update(t){return this.ctx.updateConf(t),this}reload(){this.ctx.reload()}destroy(){for(this.ctx.trigger("unmounted");this.ctx.$root.firstChild;)this.ctx.$root.removeChild(this.ctx.$root.firstChild)}on(t,e){this.ctx.on(t,e)}off(t,e){this.ctx.off(t,e)}trigger(t,e){this.ctx.trigger(t,e)}setDarkMode(t){this.ctx.setDarkMode(t)}static init(t){return new an(t)}static use(t){on.includes(t)||on.push(t)}static loadCountWidget(t){const e=Ut(t,!0);Fe({getApi:()=>new k(It(e)),siteName:e.site,countEl:e.countEl,pvEl:e.pvEl,pvAdd:!1})}get $root(){return this.ctx.$root}get conf(){return this.ctx.getConf()}}const ln=an.init,cn=an.use,dn=an.loadCountWidget;t.default=an,t.init=ln,t.loadCountWidget=dn,t.use=cn,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); + */let m=class extends p{constructor(){super(...arguments),h(this,"cache",{flushCache:(t={})=>this.request(c({path:"/cache/flush",method:"POST",secure:!0,format:"json"},t)),warmUpCache:(t={})=>this.request(c({path:"/cache/warm_up",method:"POST",secure:!0,format:"json"},t))}),h(this,"captcha",{getCaptcha:(t={})=>this.request(c({path:"/captcha",method:"GET",format:"json"},t)),getCaptchaStatus:(t={})=>this.request(c({path:"/captcha/status",method:"GET",format:"json"},t)),verifyCaptcha:(t,e={})=>this.request(c({path:"/captcha/verify",method:"POST",body:t,type:"application/json",format:"json"},e))}),h(this,"comments",{getComments:(t,e={})=>this.request(c({path:"/comments",method:"GET",query:t,secure:!0,type:"application/json",format:"json"},e)),createComment:(t,e={})=>this.request(c({path:"/comments",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),getComment:(t,e={})=>this.request(c({path:`/comments/${t}`,method:"GET",type:"application/json",format:"json"},e)),updateComment:(t,e,n={})=>this.request(c({path:`/comments/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deleteComment:(t,e={})=>this.request(c({path:`/comments/${t}`,method:"DELETE",secure:!0,format:"json"},e))}),h(this,"conf",{conf:(t={})=>this.request(c({path:"/conf",method:"GET",format:"json"},t)),getDomain:(t,e={})=>this.request(c({path:"/conf/domain",method:"GET",query:t,format:"json"},e))}),h(this,"notifies",{getNotifies:(t,e={})=>this.request(c({path:"/notifies",method:"GET",query:t,type:"application/json",format:"json"},e)),markAllNotifyRead:(t,e={})=>this.request(c({path:"/notifies/read",method:"POST",body:t,type:"application/json",format:"json"},e)),markNotifyRead:(t,e,n={})=>this.request(c({path:`/notifies/${t}/${e}`,method:"POST",format:"json"},n))}),h(this,"pages",{getPages:(t,e={})=>this.request(c({path:"/pages",method:"GET",query:t,secure:!0,type:"application/json",format:"json"},e)),fetchAllPages:(t,e={})=>this.request(c({path:"/pages/fetch",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),getPageFetchStatus:(t={})=>this.request(c({path:"/pages/fetch/status",method:"GET",secure:!0,format:"json"},t)),logPv:(t,e={})=>this.request(c({path:"/pages/pv",method:"POST",body:t,type:"application/json",format:"json"},e)),updatePage:(t,e,n={})=>this.request(c({path:`/pages/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deletePage:(t,e={})=>this.request(c({path:`/pages/${t}`,method:"DELETE",secure:!0,format:"json"},e)),fetchPage:(t,e={})=>this.request(c({path:`/pages/${t}/fetch`,method:"POST",secure:!0,type:"application/json",format:"json"},e))}),h(this,"sendEmail",{sendEmail:(t,e={})=>this.request(c({path:"/send_email",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e))}),h(this,"settings",{getSettings:(t={})=>this.request(c({path:"/settings",method:"GET",secure:!0,format:"json"},t)),applySettings:(t,e={})=>this.request(c({path:"/settings",method:"PUT",body:t,secure:!0,type:"application/json",format:"json"},e)),getSettingsTemplate:(t,e={})=>this.request(c({path:`/settings/template/${t}`,method:"GET",secure:!0,format:"json"},e))}),h(this,"sites",{getSites:(t={})=>this.request(c({path:"/sites",method:"GET",secure:!0,format:"json"},t)),createSite:(t,e={})=>this.request(c({path:"/sites",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),updateSite:(t,e,n={})=>this.request(c({path:`/sites/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deleteSite:(t,e={})=>this.request(c({path:`/sites/${t}`,method:"DELETE",secure:!0,format:"json"},e))}),h(this,"stats",{getStats:(t,e,n={})=>this.request(c({path:`/stats/${t}`,method:"GET",query:e,type:"application/json",format:"json"},n))}),h(this,"transfer",{exportArtrans:(t={})=>this.request(c({path:"/transfer/export",method:"GET",secure:!0,format:"json"},t)),importArtrans:(t,e={})=>this.request(c({path:"/transfer/import",method:"POST",body:t,secure:!0,type:"application/json"},e)),uploadArtrans:(t,e={})=>this.request(c({path:"/transfer/upload",method:"POST",body:t,secure:!0,type:"multipart/form-data",format:"json"},e))}),h(this,"upload",{upload:(t,e={})=>this.request(c({path:"/upload",method:"POST",body:t,secure:!0,type:"multipart/form-data",format:"json"},e))}),h(this,"user",{getUser:(t,e={})=>this.request(c({path:"/user",method:"GET",query:t,secure:!0,format:"json"},e)),login:(t,e={})=>this.request(c({path:"/user/access_token",method:"POST",body:t,type:"application/json",format:"json"},e)),getUserStatus:(t,e={})=>this.request(c({path:"/user/status",method:"GET",query:t,secure:!0,format:"json"},e))}),h(this,"users",{createUser:(t,e={})=>this.request(c({path:"/users",method:"POST",body:t,secure:!0,type:"application/json",format:"json"},e)),updateUser:(t,e,n={})=>this.request(c({path:`/users/${t}`,method:"PUT",body:e,secure:!0,type:"application/json",format:"json"},n)),deleteUser:(t,e={})=>this.request(c({path:`/users/${t}`,method:"DELETE",secure:!0,format:"json"},e)),getUsers:(t,e,n={})=>this.request(c({path:`/users/${t}`,method:"GET",query:e,secure:!0,type:"application/json",format:"json"},n))}),h(this,"version",{getVersion:(t={})=>this.request(c({path:"/version",method:"GET",format:"json"},t))}),h(this,"votes",{syncVotes:(t={})=>this.request(c({path:"/votes/sync",method:"POST",secure:!0,format:"json"},t)),vote:(t,e,n,i={})=>this.request(c({path:`/votes/${t}/${e}`,method:"POST",body:n,type:"application/json",format:"json"},i))})}};var g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;nu(this,null,(function*(){const i=t.getApiToken&&t.getApiToken(),s=new Headers(c({Authorization:i?`Bearer ${i}`:""},null==n?void 0:n.headers));s.get("Authorization")||s.delete("Authorization");const o=yield fetch(e,d(c({},n),{headers:s}));if(!o.ok){const i=(yield o.json().catch((()=>{})))||{};let s=!1;if(t.handlers&&(yield t.handlers.get().reduce(((t,e)=>u(this,null,(function*(){yield t,!0===i[e.action]&&(yield e.handler(i),s=!0)}))),Promise.resolve())),s)return y(t,e,n);throw function(t,e){const n=new v;return n.message=e.msg||e.message||"fetch error",n.code=t,n.data=e,console.error(n),n}(o.status,i)}return o}));class v extends Error{constructor(){super(...arguments),h(this,"code",0),h(this,"message","fetch error"),h(this,"data")}}class k extends m{constructor(t){super({baseUrl:t.baseURL,customFetch:(e,n)=>y(t,e,n)}),h(this,"_opts"),this._opts=t}getUserFields(){const t=this._opts.userInfo;if((null==t?void 0:t.name)&&(null==t?void 0:t.email))return{name:t.name,email:t.email}}}var $={"&":"&","<":"<",">":">",'"':""","'":"'"},b={"&":"&","<":"<",">":">",""":'"',"'":"'"},w=/(&|<|>|"|')/g,C=/[&<>"']/g;function E(t){return $[t]}function x(t){return b[t]}function S(t){return null==t?"":String(t).replace(C,E)}function T(t){return null==t?"":String(t).replace(w,x)}S.options=T.options={};var L={encode:S,escape:S,decode:T,unescape:T,version:"1.0.0-browser"};var A=function t(e){for(var n,i,s=Array.prototype.slice.call(arguments,1);s.length;)for(i in n=s.shift())n.hasOwnProperty(i)&&("[object Object]"===Object.prototype.toString.call(e[i])?e[i]=t(e[i],n[i]):e[i]=n[i]);return e},M=function(t){return"string"==typeof t?t.toLowerCase():t};function P(t,e){return t[e]=!0,t}var O=function(t){return t.reduce(P,{})},U={uris:O(["background","base","cite","href","longdesc","src","usemap"])},I={voids:O(["area","br","col","hr","img","wbr","input","base","basefont","link","meta"])},R=L,q=M,j=I,D=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,B=/^<\s*\/\s*([\w:-]+)[^>]*>/,_=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,F=/^=0&&(e.comment&&e.comment(t.substring(4,i)),t=t.substring(i+3),n=!1):N.test(t)?r(B,l):F.test(t)&&r(D,a);var i;!function(){if(!n)return;var i,s=t.indexOf("<");s>=0?(i=t.substring(0,s),t=t.substring(s)):(i=t,t="");e.chars&&e.chars(i)}()}();var i=t===s;s=t,i&&(t="")}function r(e,i){var s=t.match(e);s&&(t=t.substring(s[0].length),s[0].replace(e,i),n=!1)}function a(t,n,s,o){var r={},a=q(n),l=j.voids[a]||!!o;s.replace(_,(function(t,e,n,i,s){r[e]=void 0===n&&void 0===i&&void 0===s?void 0:R.decode(n||i||s||"")})),l||i.push(a),e.start&&e.start(a,r,l)}function l(t,n){var s,o=0,r=q(n);if(r)for(o=i.length-1;o>=0&&i[o]!==r;o--);if(o>=0){for(s=i.length-1;s>=o;s--)e.end&&e.end(i[s]);i.length=o}}l()},K=function(t,e){var n,i=e||{};return a(),{start:function(t,e,r){var a=H(t);if(n.ignoring)return void o(a);if(-1===(i.allowedTags||[]).indexOf(a))return void o(a);if(i.filter&&!i.filter({tag:a,attrs:e}))return void o(a);s("<"),s(a),Object.keys(e).forEach((function(t){var n=e[t],o=(i.allowedClasses||{})[a]||[],r=(i.allowedAttributes||{})[a]||[],l=H(t);("class"===l&&-1===r.indexOf(l)?(n=n.split(" ").filter((function(t){return o&&-1!==o.indexOf(t)})).join(" ").trim()).length:-1!==r.indexOf(l)&&(!0!==V.uris[l]||function(t){var e=t[0];if("#"===e||"/"===e)return!0;var n=t.indexOf(":");if(-1===n)return!0;var s=t.indexOf("?");if(-1!==s&&n>s)return!0;var o=t.indexOf("#");return-1!==o&&n>o||i.allowedSchemes.some(r);function r(e){return 0===t.indexOf(e+":")}}(n)))&&(s(" "),s(t),"string"==typeof n&&(s('="'),s(W.encode(n)),s('"')))})),s(r?"/>":">")},end:function(t){var e=H(t);-1!==(i.allowedTags||[]).indexOf(e)&&!1===n.ignoring?(s("")):r(e)},chars:function(t){!1===n.ignoring&&s(i.transformText?i.transformText(t):t)}};function s(e){t.push(e)}function o(t){G.voids[t]||(!1===n.ignoring?n={ignoring:t,depth:1}:n.ignoring===t&&n.depth++)}function r(t){n.ignoring===t&&--n.depth<=0&&a()}function a(){n={ignoring:!1,depth:0}}},Y={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};function J(t,e,n){var i=[],s=!0===n?e:z({},Y,e),o=K(i,s);return Q(t,o),i.join("")}J.defaults=Y;const X=f(J),Z={allowedClasses:{},allowedSchemes:["http","https","mailto","data"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],allowedAttributes:{"*":["title","accesskey"],a:["href","name","target","aria-label","rel"],img:["src","alt","title","atk-emoticon","aria-label"],code:["class"],span:["class","style"]},filter:t=>([["code",/^hljs\W+language-(.*)$/],["span",/^(hljs-.*)$/]].forEach((([e,n])=>{t.tag===e&&t.attrs.class&&!n.test(t.attrs.class)&&delete t.attrs.class})),"span"===t.tag&&t.attrs.style&&!/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(t.attrs.style)&&delete t.attrs.style,!0)};function tt(t){return X(t,Z)}var et={exports:{}};et.exports=function(){function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t((function(t){var e=t.exports=function(){return new RegExp("(?:"+e.line().source+")|(?:"+e.block().source+")","gm")};e.line=function(){return/(?:^|\s)\/\/(.+?)$/gm},e.block=function(){return/\/\*([\S\s]*?)\*\//gm}})),n=["23AC69","91C132","F19726","E8552D","1AAB8E","E1147F","2980C1","1BA1E6","9FA0A0","F19726","E30B20","E30B20","A3338B"];function i(t){return''+t+""}return function(t,s){void 0===s&&(s={});var o=s.colors;void 0===o&&(o=n);var r=0,a={},l=new RegExp("("+/[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/.source+"|"+/'+e+"
          ";return r=++r%o.length,l}))}}();const nt=f(et.exports);function it(t){return nt(t)}function st(){const t=new e.marked.Renderer;return t.link=ot(t,t.link),t.code=rt(),t}const ot=(t,e)=>(n,i,s)=>{const o=null==n?void 0:n.startsWith(`${window.location.protocol}//${window.location.hostname}`);return e.call(t,n,i,s).replace(/^(t,e)=>{const n=e||"plaintext";let i=t;return window.hljs?n&&window.hljs.getLanguage(n)&&(i=window.hljs.highlight(n,t).value):i=it(t),`
          \n${i.replace(/&/g,"&")}\n
          `};let at,lt=[];const ct={gfm:!0,breaks:!0,async:!1};function dt(){return at}function ht(t){var e;let n=null==(e=dt())?void 0:e.parse(t);n||(n=function(t){return t.replace(/```\s*([^]+?.*?[^]+?[^]+?)```/g,((t,e)=>`
          ${it(e)}
          `)).replace(/!\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`${e}`)).replace(/\[(.*?)\]\((.*?)\)/g,((t,e,n)=>`
          ${e}`)).replace(/\n/g,"
          ")}(t));let i=tt(n);return lt.forEach((t=>{"function"==typeof t&&(i=t(i))})),i}function ut(...t){const e=t=>t&&"object"==typeof t&&t.constructor===Object;return t.reduce(((t,n)=>(Object.keys(null!=n?n:{}).forEach((i=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t[i],o=n[i];Array.isArray(s)&&Array.isArray(o)?t[i]=s.concat(...o):e(s)&&e(o)?t[i]=ut(s,o):t[i]=o})),t)),{})}class pt{constructor(t){h(this,"loading",!1),h(this,"listLastFetch"),h(this,"comments",[]),h(this,"notifies",[]),h(this,"page"),this.events=t}getLoading(){return this.loading}setLoading(t){this.loading=t}getListLastFetch(){return this.listLastFetch}setListLastFetch(t){this.listLastFetch=t}getComments(){return this.comments}fetchComments(t){this.events.trigger("list-fetch",t)}findComment(t){return this.comments.find((e=>e.id===t))}clearComments(){this.comments=[],this.events.trigger("list-loaded",this.comments)}loadComments(t){this.events.trigger("list-load",t),this.comments.push(...t),this.events.trigger("list-loaded",this.comments)}insertComment(t){this.comments.push(t),this.events.trigger("comment-inserted",t),this.events.trigger("list-loaded",this.comments)}updateComment(t){this.comments=this.comments.map((e=>e.id===t.id?t:e)),this.events.trigger("comment-updated",t),this.events.trigger("list-loaded",this.comments)}deleteComment(t){const e=this.comments.find((e=>e.id===t));if(!e)throw new Error(`Comment ${t} not found`);this.comments=this.comments.filter((e=>e.id!==t)),this.events.trigger("comment-deleted",e),this.events.trigger("list-loaded",this.comments)}getNotifies(){return this.notifies}updateNotifies(t){this.notifies=t,this.events.trigger("notifies-updated",this.notifies)}getPage(){return this.page}updatePage(t){this.page=t,this.events.trigger("page-loaded",t)}}const mt={placeholder:"Leave a comment",noComment:"No Comment",send:"Send",save:"Save",nick:"Nickname",email:"Email",link:"Website",emoticon:"Emoji",preview:"Preview",uploadImage:"Upload Image",uploadFail:"Upload Failed",commentFail:"Failed to comment",restoredMsg:"Content has been restored",onlyAdminCanReply:"Only admin can reply",uploadLoginMsg:"Please fill in your name and email to upload",counter:"{count} Comments",sortLatest:"Latest",sortOldest:"Oldest",sortBest:"Best",sortAuthor:"Author",openComment:"Open Comment",closeComment:"Close Comment",listLoadFailMsg:"Failed to load comments",listRetry:"Retry",loadMore:"Load More",admin:"Admin",reply:"Reply",voteUp:"Up",voteDown:"Down",voteFail:"Vote Failed",readMore:"Read More",actionConfirm:"Confirm",collapse:"Collapse",collapsed:"Collapsed",collapsedMsg:"This comment has been collapsed",expand:"Expand",approved:"Approved",pending:"Pending",pendingMsg:"Pending, visible only to commenter.",edit:"Edit",editCancel:"Cancel Edit",delete:"Delete",deleteConfirm:"Confirm",pin:"Pin",unpin:"Unpin",seconds:"seconds ago",minutes:"minutes ago",hours:"hours ago",days:"days ago",now:"just now",adminCheck:"Enter admin password:",captchaCheck:"Enter the CAPTCHA to continue:",confirm:"Confirm",cancel:"Cancel",msgCenter:"Messages",ctrlCenter:"Admin",emailVerified:"Email has been verified",frontend:"Frontend",backend:"Backend",loading:"Loading",loadFail:"Load Failed",editing:"Editing",editFail:"Edit Failed",deleting:"Deleting",deleteFail:"Delete Failed",reqGot:"Request got",reqAborted:"Request timed out or terminated unexpectedly",updateMsg:"Please update Artalk {name} to get the best experience!",currentVersion:"Current Version",ignore:"Ignore",open:"Open",openName:"Open {name}"},gt="ArtalkI18n";function ft(t=""){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild||e}function yt(t){const e=document.createElement("div");e.innerText=t;return e.innerHTML}function vt(t){const e=RegExp(`[?&]${t}=([^&]*)`).exec(window.location.search);return e&&decodeURIComponent(e[1].replace(/\+/g," "))}function kt(t,e){const n=t=>{const e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:e.top+i,left:e.left+n}},i=n(t);if(!e)return i;const s=n(e);return{top:i.top-s.top,left:i.left-s.left}}function $t(t,e){let n=t.toString();for(;n.lengtht)){try{const n=t.getTime(),i=(new Date).getTime()-n,s=Math.floor(i/864e5);if(0===s){const t=i%864e5,n=Math.floor(t/36e5);if(0===n){const n=t%36e5,i=Math.floor(n/6e4);if(0===i){const t=n%6e4,i=Math.round(t/1e3);return i<10?e("now"):`${i} ${e("seconds")}`}return`${i} ${e("minutes")}`}return`${n} ${e("hours")}`}return s<0?e("now"):s<8?`${s} ${e("days")}`:function(t){const e=$t(t.getDate(),2),n=$t(t.getMonth()+1,2);return`${$t(t.getFullYear(),2)}-${n}-${e}`}(t)}catch(n){return console.error(n)," - "}}function wt(){return u(this,null,(function*(){const t=navigator.userAgent;if(!navigator.userAgentData||!navigator.userAgentData.getHighEntropyValues)return t;const e=navigator.userAgentData;let n=null;try{n=yield e.getHighEntropyValues(["platformVersion"])}catch(s){return console.error(s),t}const i=Number(n.platformVersion.split(".")[0]);return"Windows"===e.platform&&i>=13?t.replace(/Windows NT 10.0/,"Windows NT 11.0"):"macOS"===e.platform&&i>=11?t.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/,`Mac OS X ${n.platformVersion.replace(/\./g,"_")}`):t}))}function Ct(t){let e;try{e=new URL(t)}catch(n){return!1}return"http:"===e.protocol||"https:"===e.protocol}function Et(t){return e=t.base,n=t.path,`${e.replace(/\/$/,"")}/${n.replace(/^\//,"")}`;var e,n}const xt={en:mt,"en-US":mt,"zh-CN":{placeholder:"键入内容...",noComment:"「此时无声胜有声」",send:"发送",save:"保存",nick:"昵称",email:"邮箱",link:"网址",emoticon:"表情",preview:"预览",uploadImage:"上传图片",uploadFail:"上传失败",commentFail:"评论失败",restoredMsg:"内容已自动恢复",onlyAdminCanReply:"仅管理员可评论",uploadLoginMsg:"填入你的名字邮箱才能上传哦",counter:"{count} 条评论",sortLatest:"最新",sortOldest:"最早",sortBest:"最热",sortAuthor:"作者",openComment:"打开评论",closeComment:"关闭评论",listLoadFailMsg:"无法获取评论列表数据",listRetry:"点击重新获取",loadMore:"加载更多",admin:"管理员",reply:"回复",voteUp:"赞同",voteDown:"反对",voteFail:"投票失败",readMore:"阅读更多",actionConfirm:"确认操作",collapse:"折叠",collapsed:"已折叠",collapsedMsg:"该评论已被系统或管理员折叠",expand:"展开",approved:"已审",pending:"待审",pendingMsg:"审核中,仅本人可见。",edit:"编辑",editCancel:"取消编辑",delete:"删除",deleteConfirm:"确认删除",pin:"置顶",unpin:"取消置顶",seconds:"秒前",minutes:"分钟前",hours:"小时前",days:"天前",now:"刚刚",adminCheck:"键入密码来验证管理员身份:",captchaCheck:"键入验证码继续:",confirm:"确认",cancel:"取消",msgCenter:"通知中心",ctrlCenter:"控制中心",emailVerified:"邮箱已验证",frontend:"前端",backend:"后端",loading:"加载中",loadFail:"加载失败",editing:"修改中",editFail:"修改失败",deleting:"删除中",deleteFail:"删除失败",reqGot:"请求响应",reqAborted:"请求超时或意外终止",updateMsg:"请更新 Artalk {name} 以获得更好的体验!",currentVersion:"当前版本",ignore:"忽略",open:"打开",openName:"打开{name}"}};function St(t){return t=t.replace(/^([a-zA-Z]+)(-[a-zA-Z]+)?$/,((t,e,n)=>e.toLowerCase()+(n||"").toUpperCase())),xt[t]?xt[t]:window[gt]&&window[gt][t]?window[gt][t]:xt.en}let Tt="en",Lt=St(Tt);function At(t){t!==Tt&&(Tt=t,Lt="string"==typeof t?St(t):t)}function Mt(t,e={}){let n=(null==Lt?void 0:Lt[t])||t;return n=n.replace(/\{\s*(\w+?)\s*\}/g,((t,n)=>e[n]||"")),yt(n)}class Pt{constructor(){h(this,"events",[])}on(t,e,n={}){this.events.push(c({name:t,handler:e},n))}off(t,e){e&&(this.events=this.events.filter((n=>!(n.name===t&&n.handler===e))))}trigger(t,e){this.events.slice(0).filter((e=>e.name===t&&"function"==typeof e.handler)).forEach((n=>{n.once&&this.off(t,n.handler),n.handler(e)}))}}const Ot={el:"",pageKey:"",pageTitle:"",server:"",site:"",placeholder:"",noComment:"",sendBtn:"",darkMode:!1,editorTravel:!0,flatMode:"auto",nestMax:2,nestSort:"DATE_ASC",emoticons:"https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",vote:!0,voteDown:!1,uaBadge:!0,listSort:!0,preview:!0,countEl:"#ArtalkCount",pvEl:"#ArtalkPV",gravatar:{mirror:"https://cravatar.cn/avatar/",params:"d=mp&s=240"},pagination:{pageSize:20,readMore:!0,autoLoad:!0},heightLimit:{content:300,children:400,scrollable:!1},imgUpload:!0,reqTimeout:15e3,versionCheck:!0,useBackendConf:!0,locale:"en"};function Ut(t,e=!1){const n=e?ut(Ot,t):t;if(n.el&&"string"==typeof n.el)try{const t=document.querySelector(n.el);if(!t)throw Error(`Target element "${n.el}" was not found.`);n.el=t}catch(i){throw console.error(i),new Error("Please check your Artalk `el` config.")}return""===n.pageKey&&(n.pageKey=`${window.location.pathname}`),""===n.pageTitle&&(n.pageTitle=`${document.title}`),n.server&&(n.server=n.server.replace(/\/$/,"").replace(/\/api\/?$/,"")),"auto"===n.locale&&(n.locale=navigator.language),"auto"===n.flatMode&&(n.flatMode=window.matchMedia("(max-width: 768px)").matches),"number"==typeof n.nestMax&&Number(n.nestMax)<=1&&(n.flatMode=!0),n}function It(t,e){return{baseURL:`${t.server}/api/v2`,siteName:t.site||"",pageKey:t.pageKey||"",pageTitle:t.pageTitle||"",timeout:t.reqTimeout,getApiToken:()=>null==e?void 0:e.get("user").getData().token,userInfo:(null==e?void 0:e.get("user").checkHasBasicUserInfo())?{name:null==e?void 0:e.get("user").getData().nick,email:null==e?void 0:e.get("user").getData().email}:void 0,handlers:null==e?void 0:e.getApiHandlers()}}function Rt(t,e,n){let i=null;const s=()=>{const s=(()=>{const n=t.getConf(),i={};return e.forEach((t=>{i[t]=n[t]})),i})();var o,r;(null==i||(o=i,r=s,!(JSON.stringify(o)===JSON.stringify(r))))&&(i=s,n(s))};t.on("mounted",s),t.on("updated",s)}class qt{constructor(t){h(this,"conf"),h(this,"data"),h(this,"$root"),h(this,"events",new Pt),h(this,"mounted",!1),h(this,"apiHandlers",null),h(this,"getCommentList",this.getCommentNodes),h(this,"getCommentDataList",this.getComments),this.conf=t,this.$root=t.el,this.$root.classList.add("artalk"),this.$root.innerHTML="",this.data=new pt(this.events),this.on("mounted",(()=>{this.mounted=!0}))}inject(t,e){this[t]=e}get(t){return this[t]}getApi(){return new k(It(this.conf,this))}getApiHandlers(){return this.apiHandlers||(this.apiHandlers=function(t){const e=function(){const t=[];return{add:(e,n)=>{t.push({action:e,handler:n})},get:()=>t}}();return e.add("need_captcha",(e=>t.checkCaptcha(e))),e.add("need_login",(()=>t.checkAdmin({}))),e}(this)),this.apiHandlers}getData(){return this.data}replyComment(t,e){this.editor.setReply(t,e)}editComment(t,e){this.editor.setEditComment(t,e)}fetch(t){this.data.fetchComments(t)}reload(){this.data.fetchComments({offset:0})}listGotoFirst(){this.events.trigger("list-goto-first")}getCommentNodes(){return this.list.getCommentNodes()}getComments(){return this.data.getComments()}editorShowLoading(){this.editor.showLoading()}editorHideLoading(){this.editor.hideLoading()}editorShowNotify(t,e){this.editor.showNotify(t,e)}editorResetState(){this.editor.resetState()}showSidebar(t){this.sidebarLayer.show(t)}hideSidebar(){this.sidebarLayer.hide()}checkAdmin(t){return this.checkerLauncher.checkAdmin(t)}checkCaptcha(t){return this.checkerLauncher.checkCaptcha(t)}on(t,e){this.events.on(t,e)}off(t,e){this.events.off(t,e)}trigger(t,e){this.events.trigger(t,e)}$t(t,e={}){return Mt(t,e)}setDarkMode(t){this.updateConf({darkMode:t})}updateConf(t){this.conf=ut(this.conf,Ut(t,!1)),this.mounted&&this.events.trigger("updated",this.conf)}getConf(){return this.conf}getEl(){return this.$root}getMarked(){return dt()}watchConf(t,e){Rt(this,t,e)}}class jt{constructor(t){h(this,"$el"),h(this,"$content"),h(this,"$actions"),this.$el=ft('
          \n
          \n
          \n
          \n
          \n
          '),this.$actions=this.$el.querySelector(".atk-layer-dialog-actions"),this.$content=this.$el.querySelector(".atk-layer-dialog-content"),this.$content.appendChild(t)}setYes(t){const e=ft(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}setNo(t){const e=ft(``);return e.onclick=this.onBtnClick(t),this.$actions.appendChild(e),this}onBtnClick(t){return e=>{const n=t(e.currentTarget,this);void 0!==n&&!0!==n||this.$el.remove()}}}function Dt(t,e){let n=t.querySelector(":scope > .atk-loading");n||(n=ft(''),(null==e?void 0:e.transparentBg)&&(n.style.background="transparent"),t.appendChild(n)),n.style.display="";const i=n.querySelector(".atk-loading-spinner");i&&(i.style.display="none",window.setTimeout((()=>{i.isConnected&&(i.style.display="")}),500))}function Bt(t){const e=t.querySelector(":scope > .atk-loading");e&&(e.style.display="none")}function _t(t,e){t?Dt(e):Bt(e)}function Ft(t,e=!0,n){let i;if(n){const e=n.getBoundingClientRect();i=t.getBoundingClientRect().top-e.top+n.scrollTop-n.clientHeight/2+t.clientHeight/2}else{const e=t.getBoundingClientRect();i=e.top+window.scrollY-(window.innerHeight/2-e.height/2)}const s={top:i,left:0,behavior:"instant"};n?n.scroll(s):window.scroll(s)}function Nt(t,e){!function(t,e,n="in"){t.classList.add(`atk-fade-${n}`);const i=()=>{t.classList.remove(`atk-fade-${n}`),t.removeEventListener("animationend",i),e&&e()};t.addEventListener("animationend",i)}(t,e,"in")}function Wt(t,e,n='Artalk Error'){let i=t.querySelector(".atk-error-layer");if(null===e)return void(null!==i&&i.remove());i||(i=ft(`
          ${n}
          `),t.appendChild(i));const s=i.querySelector(".atk-error-text");s.innerHTML="",null!==e&&(e instanceof HTMLElement?s.appendChild(e):s.innerText=e)}function Ht(t){const e=ft('
          '),n=ft('');n.style.display="none",Dt(e,{transparentBg:!0}),n.src=t.getOpts().getCaptchaIframeURL(),n.onload=()=>{n.style.display="",Bt(e)},e.append(n);const i=ft('
          ');e.append(i),t.hideInteractInput();let s=!1;return function e(){return u(this,null,(function*(){var n;if(yield(n=1e3,new Promise((t=>{window.setTimeout((()=>{t(null)}),n)}))),s)return;let i=!1;try{i=(yield t.getApi().captcha.getCaptchaStatus()).data.is_pass}catch(o){i=!1}i?t.triggerSuccess():e()}))}(),i.onclick=()=>{s=!0,t.cancel()},e}const Vt={request:(t,e)=>t.getApi().captcha.verifyCaptcha({value:e}),body:t=>t.get("iframe")?Ht(t):function(t){const e=ft(`${Mt("captchaCheck")}`);return e.querySelector(".atk-captcha-img").onclick=()=>{const n=e.querySelector(".atk-captcha-img");t.getApi().captcha.getCaptcha().then((t=>{n.setAttribute("src",t.data.img_data)})).catch((t=>{console.error("Failed to get captcha image ",t)}))},e}(t),onSuccess(t,e,n,i){t.set("val",n)},onError(t,e,n,i){i.querySelector(".atk-captcha-img").click(),i.querySelector('input[type="text"]').value=""}},Gt={inputType:"password",request(t,e){return u(this,null,(function*(){return(yield t.getApi().user.login({name:t.getUser().getData().nick,email:t.getUser().getData().email,password:e})).data}))},body:t=>ft(`${Mt("adminCheck")}`),onSuccess(t,e,n,i){t.getUser().update({isAdmin:!0,token:e.token}),t.getOpts().onReload()},onError(t,e,n,i){}};function zt(t){return e=>new Promise(((n,i)=>{const s=e.onCancel;e.onCancel=()=>{s&&s(),i(new Error("user canceled the checker"))};const o=e.onSuccess;e.onSuccess=()=>{o&&o(),n()},t(e)}))}class Qt{constructor(t){h(this,"checkCaptcha",zt((t=>{this.fire(Vt,t,(e=>{e.set("img_data",t.img_data),e.set("iframe",t.iframe)}))}))),h(this,"checkAdmin",zt((t=>{this.fire(Gt,t)}))),this.opts=t}fire(t,e,n){const i=this.opts.getCtx().get("layerManager").create(`checker-${(new Date).getTime()}`);i.show();const s=()=>{i.destroy()},o={};let r=!1;const a={set:(t,e)=>{o[t]=e},get:t=>o[t],getOpts:()=>this.opts,getUser:()=>this.opts.getCtx().get("user"),getApi:()=>this.opts.getApi(),hideInteractInput:()=>{r=!0},triggerSuccess:()=>{s(),t.onSuccess&&t.onSuccess(a,"","",l),e.onSuccess&&e.onSuccess()},cancel:()=>{s(),e.onCancel&&e.onCancel()}};n&&n(a);const l=ft();l.appendChild(t.body(a));const c=ft(``);let d;l.appendChild(c),setTimeout((()=>c.focus()),80),c.onkeyup=t=>{"Enter"!==t.key&&13!==t.keyCode||(t.preventDefault(),i.getEl().querySelector('button[data-action="confirm"]').click())};const h=new jt(l);h.setYes((n=>{const i=c.value.trim();d||(d=n.innerText);const o=()=>{n.innerText=d||"",n.classList.remove("error")};return n.innerText=`${Mt("loading")}...`,t.request(a,i).then((n=>{s(),t.onSuccess&&t.onSuccess(a,n,i,l),e.onSuccess&&e.onSuccess()})).catch((e=>{var s;s=String(e.message||String(e)),n.innerText=s,n.classList.add("error"),t.onError&&t.onError(a,e,i,l);const r=setTimeout((()=>o()),3e3);c.onfocus=()=>{o(),clearTimeout(r)}})),!1})),h.setNo((()=>(s(),e.onCancel&&e.onCancel(),!1))),r&&(c.style.display="none",h.$el.querySelector(".atk-layer-dialog-actions").style.display="none"),i.getEl().append(h.$el),e.onMount&&e.onMount(h.$el)}}class Kt{constructor(t){h(this,"$el"),this.ctx=t}get conf(){return this.ctx.conf}getEl(){return this.$el}}const Yt={$header:".atk-header",$nick:'.atk-header [name="nick"]',$email:'.atk-header [name="email"]',$link:'.atk-header [name="link"]',$textareaWrap:".atk-textarea-wrap",$textarea:".atk-textarea",$bottom:".atk-bottom",$submitBtn:".atk-send-btn",$notifyWrap:".atk-notify-wrap",$bottomLeft:".atk-bottom-left",$stateWrap:".atk-state-wrap",$plugBtnWrap:".atk-plug-btn-wrap",$plugPanelWrap:".atk-plug-panel-wrap"};class Jt{constructor(t){this.kit=t}useBtn(t="
          "){return this.$btn=ft(`${t}`),this.$btn}usePanel(t="
          "){return this.$panel=ft(t),this.$panel}useContentTransformer(t){this.contentTransformer=t}usePanelShow(t){this.kit.useEvents().on("panel-show",(e=>{e===this&&t()}))}usePanelHide(t){this.kit.useEvents().on("panel-hide",(e=>{e===this&&t()}))}useEditorStateEffect(t,e){this.editorStateEffectWhen=t,this.editorStateEffect=e}}class Xt extends Jt{constructor(){super(...arguments),h(this,"isMoved",!1)}move(t){if(this.isMoved)return;this.isMoved=!0;const e=this.kit.useUI().$el;e.after(ft('
          '));const n=ft("
          ");t.after(n),n.replaceWith(e),e.classList.add("atk-fade-in"),e.classList.add("editor-traveling")}back(){var t;this.isMoved&&(this.isMoved=!1,null==(t=this.kit.useGlobalCtx().$root.querySelector(".atk-editor-travel-placeholder"))||t.replaceWith(this.kit.useUI().$el),this.kit.useUI().$el.classList.remove("editor-traveling"))}}class Zt{constructor(t){h(this,"stateCurt","normal"),h(this,"stateUnmountFn",null),this.editor=t}get(){return this.stateCurt}switch(t,e){var n,i,s,o,r;if(this.stateUnmountFn&&(this.stateUnmountFn(),this.stateUnmountFn=null,null==(i=null==(n=this.editor.getPlugs())?void 0:n.get(Xt))||i.back()),"normal"!==t&&e){let n=e.$comment;this.editor.conf.flatMode||(n=n.querySelector(".atk-footer")),null==(o=null==(s=this.editor.getPlugs())?void 0:s.get(Xt))||o.move(n);const i=this.editor.ctx.conf.scrollRelativeTo&&this.editor.ctx.conf.scrollRelativeTo();Ft(this.editor.getUI().$el,!0,i);const a=null==(r=this.editor.getPlugs())?void 0:r.getPlugs().find((e=>e.editorStateEffectWhen===t));a&&a.editorStateEffect&&(this.stateUnmountFn=a.editorStateEffect(e.comment))}this.stateCurt=t}}class te extends Kt{constructor(t){super(t),h(this,"ui"),h(this,"state"),this.ui=function(){const t=ft('
          \n
          \n \n \n \n
          \n
          \n \n
          \n \n
          \n
          \n \n \n
          \n
          \n \n
          \n
          \n
          \n
          \n'),e={$el:t};return Object.entries(Yt).forEach((([n,i])=>{e[n]=t.querySelector(i)})),e}(),this.$el=this.ui.$el,this.state=new Zt(this)}getUI(){return this.ui}getPlugs(){return this.ctx.get("editorPlugs")}getState(){return this.state.get()}getHeaderInputEls(){return{nick:this.ui.$nick,email:this.ui.$email,link:this.ui.$link}}getContentFinal(){let t=this.getContentRaw();const e=this.getPlugs();return e&&(t=e.getTransformedContent(t)),t}getContentRaw(){return this.ui.$textarea.value||""}getContentMarked(){return ht(this.getContentFinal())}setContent(t){var e;this.ui.$textarea.value=t,null==(e=this.getPlugs())||e.getEvents().trigger("content-updated",t)}insertContent(t){if(document.selection)this.ui.$textarea.focus(),document.selection.createRange().text=t,this.ui.$textarea.focus();else if(this.ui.$textarea.selectionStart||0===this.ui.$textarea.selectionStart){const e=this.ui.$textarea.selectionStart,n=this.ui.$textarea.selectionEnd,i=this.ui.$textarea.scrollTop;this.setContent(this.ui.$textarea.value.substring(0,e)+t+this.ui.$textarea.value.substring(n,this.ui.$textarea.value.length)),this.ui.$textarea.focus(),this.ui.$textarea.selectionStart=e+t.length,this.ui.$textarea.selectionEnd=e+t.length,this.ui.$textarea.scrollTop=i}else this.ui.$textarea.focus(),this.ui.$textarea.value+=t}focus(){this.ui.$textarea.focus()}reset(){this.setContent(""),this.resetState()}resetState(){this.state.switch("normal")}setReply(t,e){this.state.switch("reply",{comment:t,$comment:e})}setEditComment(t,e){this.state.switch("edit",{comment:t,$comment:e})}showNotify(t,e){!function(t,e,n){const i=ft(`
          `);i.querySelector(".atk-notify-content").innerHTML=yt(e).replace("\n","
          "),t.appendChild(i);const s=()=>{i.classList.add("atk-fade-out"),setTimeout((()=>{i.remove()}),200)};let o;o=window.setTimeout((()=>{s()}),3e3),i.addEventListener("click",(()=>{s(),window.clearTimeout(o)}))}(this.ui.$notifyWrap,t,e)}showLoading(){Dt(this.ui.$el)}hideLoading(){Bt(this.ui.$el)}submit(){const t=()=>this.ctx.trigger("editor-submit");this.ctx.conf.beforeSubmit?this.ctx.conf.beforeSubmit(this,t):t()}}class ee extends Kt{constructor(t){super(t),h(this,"layer"),h(this,"$header"),h(this,"$closeBtn"),h(this,"$iframeWrap"),h(this,"$iframe"),h(this,"refreshOnShow",!0),h(this,"animTimer"),this.$el=ft('
          \n
          \n
          \n
          \n \n
          \n
          \n
          \n
          \n
          \n'),this.$header=this.$el.querySelector(".atk-sidebar-header"),this.$closeBtn=this.$header.querySelector(".atk-sidebar-close"),this.$iframeWrap=this.$el.querySelector(".atk-sidebar-iframe-wrap"),this.$closeBtn.onclick=()=>{this.hide()},this.ctx.on("user-changed",(()=>{this.refreshOnShow=!0}))}show(){return u(this,arguments,(function*(t={}){if(this.$el.style.transform="",this.initLayer(),this.layer.show(),this.refreshOnShow)this.refreshOnShow=!1,this.$iframeWrap.innerHTML="",this.$iframe=this.createIframe(t.view),this.$iframeWrap.append(this.$iframe);else{const t=this.$iframe,e=t.src;this.conf.darkMode!==e.includes("darkMode=1")&&this.iframeLoad(t,this.conf.darkMode?e.concat("&darkMode=1"):e.replace("&darkMode=1",""))}this.authCheck({onSuccess:()=>this.show(t)}),this.animTimer=setTimeout((()=>{this.animTimer=void 0,this.$el.style.transform="translate(0, 0)",setTimeout((()=>{this.ctx.getData().updateNotifies([])}),0),this.ctx.trigger("sidebar-show")}),100)}))}hide(){var t;null==(t=this.layer)||t.hide()}authCheck(t){return u(this,null,(function*(){const e=(yield this.ctx.getApi().user.getUserStatus(c({},this.ctx.getApi().getUserFields()))).data;e.is_admin&&!e.is_login&&(this.refreshOnShow=!0,this.ctx.checkAdmin({onSuccess:()=>{setTimeout((()=>{t.onSuccess()}),500)},onCancel:()=>{this.hide()}}),this.hide())}))}initLayer(){this.layer||(this.layer=this.ctx.get("layerManager").create("sidebar",this.$el),this.layer.setOnAfterHide((()=>{this.ctx.editorResetState(),this.animTimer&&clearTimeout(this.animTimer),this.$el.style.transform="",this.ctx.trigger("sidebar-hide")})))}createIframe(t){const e=ft(''),n=Et({base:this.ctx.conf.server,path:"/sidebar/"}),i={pageKey:this.conf.pageKey,site:this.conf.site||"",user:JSON.stringify(this.ctx.get("user").getData()),time:+new Date};t&&(i.view=t),this.conf.darkMode&&(i.darkMode="1");const s=new URLSearchParams(i);return this.iframeLoad(e,`${n}?${s.toString()}`),e}iframeLoad(t,e){t.src=e,Dt(this.$iframeWrap),t.onload=()=>{Bt(this.$iframeWrap)}}}const ne=t=>({import:e=>{(function(t,e="DATE_DESC",n=2){const i=[];t.filter((t=>0===t.rid)).forEach((e=>{const s={id:e.id,comment:e,children:[],level:1};s.parent=s,i.push(s),function e(i){const s=t.filter((t=>t.rid===i.id));0!==s.length&&(i.level>=n&&(i=i.parent),s.forEach((t=>{const n={id:t.id,comment:t,children:[],parent:i,level:i.level+1};i.children.push(n),e(n)})))}(s)}));const s=(n,i)=>{let s=n.id-i.id;return"DATE_ASC"===e?s=+new Date(n.comment.date)-+new Date(i.comment.date):"DATE_DESC"===e?s=+new Date(i.comment.date)-+new Date(n.comment.date):"SRC_INDEX"===e?s=t.indexOf(n.comment)-t.indexOf(i.comment):"VOTE_UP_DESC"===e&&(s=i.comment.vote_up-n.comment.vote_up),s};return function t(e){e.forEach((e=>{e.children=e.children.sort(s),t(e.children)}))}(i),i})(e,t.nestSortBy,t.nestMax).forEach((n=>{var i;const s=t.createCommentNode(n.comment);null==(i=t.$commentsWrap)||i.appendChild(s.getEl()),s.getRender().playFadeAnim();const o=(n,i)=>{i.children.forEach((i=>{const s=e.find((t=>t.id===i.comment.rid)),r=i.comment,a=t.createCommentNode(r,s);n.putChild(a),o(a,i)}))};o(s,n),s.getRender().checkHeightLimit()}))},insert:(e,n)=>{var i;const s=t.createCommentNode(e,n);if(0===e.rid)null==(i=t.$commentsWrap)||i.prepend(s.getEl());else{const n=t.findCommentNode(e.rid);n&&(n.putChild(s,"DATE_ASC"===t.nestSortBy?"append":"prepend"),s.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()})))}s.getRender().checkHeightLimit(),s.scrollIntoView(),s.getRender().playFadeAnim()}});function ie(t,e,n,i){n.is_collapsed&&(n.is_allow_reply=!1);const s=t.createCommentNode(n,i);if(n.visible){const n=s.getEl(),i=t.$commentsWrap;"append"===e&&(null==i||i.append(n)),"prepend"===e&&(null==i||i.prepend(n)),s.getRender().playFadeAnim()}return s.getRender().checkHeightLimit(),s}class se{constructor(t){this.options=t}getStrategy(){return this.options.flatMode?(t=this.options,{import:e=>{e.forEach((n=>{const i=0===n.rid?void 0:e.find((t=>t.id===n.rid));ie(t,"append",n,i)}))},insert:(e,n)=>{ie(t,"prepend",e,n).scrollIntoView()}}):ne(this.options);var t}import(t){this.getStrategy().import(t)}insert(t,e){this.getStrategy().insert(t,e)}}function oe(t,e){e.forEach((({el:e,max:n,imgContains:i})=>{const s=()=>{e&&(t.scrollable?function(t){if(!t.el)return;if(t.el.classList.contains(le))return;t.el.classList.add(le),t.el.style.height=`${t.maxHeight}px`}({el:e,maxHeight:n}):function(t){if(!t.el)return;if(!t.maxHeight)return;if(t.el.classList.contains(re))return;t.el.classList.add(re),t.el.style.height=`${t.maxHeight}px`,t.el.style.overflow="hidden";const e=ft(`
          ${Mt("readMore")}`);e.onclick=e=>{e.stopPropagation(),ae(t.el),t.postBtnClick&&t.postBtnClick(e)},t.el.append(e)}({el:e,maxHeight:n,postBtnClick:t.postExpandBtnClick}))},o=()=>{e&&function(t){return parseFloat(getComputedStyle(t,null).height.replace("px",""))}(e)>n&&s()};o(),i&&e&&function(t,e){if(!t)return;const n=t.getElementsByTagName("img");if(!n.length)return;let i=n.length;for(let s=0;s{i--,0===i&&e()})),0===i&&e()}(e,(()=>o()))}))}const re="atk-height-limit";function ae(t){t&&t.classList.contains(re)&&(t.classList.remove(re),Array.from(t.children).forEach((t=>{t.classList.contains("atk-height-limit-btn")&&t.remove()})),t.style.height="",t.style.overflow="")}const le="atk-height-limit-scroll";function ce(t){if(t.$headerNick=t.$el.querySelector(".atk-nick"),t.data.link){const e=ft('');e.innerText=t.data.nick,e.href=Ct(t.data.link)?t.data.link:`https://${t.data.link}`,t.$headerNick.append(e)}else t.$headerNick.innerText=t.data.nick}function de(t){t.$headerBadgeWrap=t.$el.querySelector(".atk-badge-wrap"),t.$headerBadgeWrap.innerHTML="";const e=t.data.badge_name,n=t.data.badge_color;if(e){const i=ft('');i.innerText=e.replace("管理员",Mt("admin")),i.style.backgroundColor=n||"",t.$headerBadgeWrap.append(i)}else if(t.data.is_verified){const e=ft(``);t.$headerBadgeWrap.append(e)}if(t.data.is_pinned){const e=ft(`${Mt("pin")}`);t.$headerBadgeWrap.append(e)}}function he(t){const e=t.$el.querySelector(".atk-date");e.innerText=t.comment.getDateFormatted(),e.setAttribute("data-atk-comment-date",String(+new Date(t.data.date)))}function ue(t){if(!t.opts.uaBadge&&!t.data.ip_region)return;let e=t.$header.querySelector("atk-ua-wrap");if(e||(e=ft(''),t.$header.append(e)),e.innerHTML="",t.data.ip_region){const n=ft('');n.innerText=t.data.ip_region,e.append(n)}if(t.opts.uaBadge){const{browser:n,os:i}=t.comment.getUserUA();if(String(n).trim()){const t=ft('');t.innerText=n,e.append(t)}if(String(i).trim()){const t=ft('');t.innerText=i,e.append(t)}}}class pe{constructor(t){h(this,"opts"),h(this,"$el"),h(this,"isLoading",!1),h(this,"msgRecTimer"),h(this,"msgRecTimerFunc"),h(this,"isConfirming",!1),h(this,"confirmRecTimer"),this.$el=ft(''),this.opts="object"!=typeof t?{text:t}:t,this.$el.innerText=this.getText(),this.opts.adminOnly&&this.$el.setAttribute("atk-only-admin-show","")}get isMessaging(){return!!this.msgRecTimer}appendTo(t){return t.append(this.$el),this}getText(){return"string"==typeof this.opts.text?this.opts.text:this.opts.text()}setClick(t){this.$el.onclick=e=>{if(e.stopPropagation(),!this.isLoading){if(this.opts.confirm&&!this.isMessaging){const t=()=>{this.isConfirming=!1,this.$el.classList.remove("atk-btn-confirm"),this.$el.innerText=this.getText()};if(!this.isConfirming)return this.isConfirming=!0,this.$el.classList.add("atk-btn-confirm"),this.$el.innerText=this.opts.confirmText||Mt("actionConfirm"),void(this.confirmRecTimer=window.setTimeout((()=>t()),5e3));this.confirmRecTimer&&window.clearTimeout(this.confirmRecTimer),t()}if(this.msgRecTimer)return this.fireMsgRecTimer(),void this.clearMsgRecTimer();t()}}}updateText(t){t&&(this.opts.text=t),this.setLoading(!1),this.$el.innerText=this.getText()}setLoading(t,e){this.isLoading!==t&&(this.isLoading=t,t?(this.$el.classList.add("atk-btn-loading"),this.$el.innerText=e||`${Mt("loading")}...`):(this.$el.classList.remove("atk-btn-loading"),this.$el.innerText=this.getText()))}setError(t){this.setMsg(t,"atk-btn-error")}setWarn(t){this.setMsg(t,"atk-btn-warn")}setSuccess(t){this.setMsg(t,"atk-btn-success")}setMsg(t,e,n,i){this.setLoading(!1),e&&this.$el.classList.add(e),this.$el.innerText=t,this.setMsgRecTimer((()=>{this.$el.innerText=this.getText(),e&&this.$el.classList.remove(e),i&&i()}),n||2500)}setMsgRecTimer(t,e){this.fireMsgRecTimer(),this.clearMsgRecTimer(),this.msgRecTimerFunc=t,this.msgRecTimer=window.setTimeout((()=>{t(),this.clearMsgRecTimer()}),e)}fireMsgRecTimer(){this.msgRecTimerFunc&&this.msgRecTimerFunc()}clearMsgRecTimer(){this.msgRecTimer&&window.clearTimeout(this.msgRecTimer),this.msgRecTimer=void 0,this.msgRecTimerFunc=void 0}}function me(t){t.opts.vote&&(t.voteBtnUp=new pe((()=>`${Mt("voteUp")} (${t.data.vote_up||0})`)).appendTo(t.$actions),t.voteBtnUp.setClick((()=>{t.comment.getActions().vote("up")})),t.opts.voteDown&&(t.voteBtnDown=new pe((()=>`${Mt("voteDown")} (${t.data.vote_down||0})`)).appendTo(t.$actions),t.voteBtnDown.setClick((()=>{t.comment.getActions().vote("down")}))))}function ge(t){if(!t.data.is_allow_reply)return;const e=ft(`${Mt("reply")}`);t.$actions.append(e),e.addEventListener("click",(e=>{e.stopPropagation(),t.opts.replyComment(t.data,t.$el)}))}function fe(t){const e=new pe({text:()=>t.data.is_collapsed?Mt("expand"):Mt("collapse"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("collapsed",e)}))}function ye(t){const e=new pe({text:()=>t.data.is_pending?Mt("pending"):Mt("approved"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pending",e)}))}function ve(t){const e=new pe({text:()=>t.data.is_pinned?Mt("unpin"):Mt("pin"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminEdit("pinned",e)}))}function ke(t){const e=new pe({text:Mt("edit"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.opts.editComment(t.data,t.$el)}))}function $e(t){const e=new pe({text:Mt("delete"),confirm:!0,confirmText:Mt("deleteConfirm"),adminOnly:!0});e.appendTo(t.$actions),e.setClick((()=>{t.comment.getActions().adminDelete(e)}))}const be={Avatar:function(t){const e=t.$el.querySelector(".atk-avatar"),n=ft(""),i=t.opts.avatarURLBuilder;if(n.src=i?i(t.data):t.comment.getGravatarURL(),t.data.link){const i=ft('');i.href=Ct(t.data.link)?t.data.link:`https://${t.data.link}`,i.append(n),e.append(i)}else e.append(n)},Header:function(t){Object.entries({renderNick:ce,renderVerifyBadge:de,renderDate:he,renderUABadge:ue}).forEach((([e,n])=>{n(t)}))},Content:function(t){if(!t.data.is_collapsed)return t.$content.innerHTML=t.comment.getContentMarked(),void t.$content.classList.remove("atk-hide","atk-collapsed");t.$content.classList.add("atk-hide","atk-type-collapsed");const e=ft(`\n
          \n ${Mt("collapsedMsg")}\n ${Mt("expand")}\n
          `);t.$body.insertAdjacentElement("beforeend",e);const n=e.querySelector(".atk-show-btn");n.addEventListener("click",(e=>{e.stopPropagation(),t.$content.classList.contains("atk-hide")?(t.$content.innerHTML=t.comment.getContentMarked(),t.$content.classList.remove("atk-hide"),Nt(t.$content),n.innerText=Mt("collapse")):(t.$content.innerHTML="",t.$content.classList.add("atk-hide"),n.innerText=Mt("expand"))}))},ReplyAt:function(t){t.opts.flatMode||0===t.data.rid||t.opts.replyTo&&(t.$replyAt=ft(''),t.$replyAt.querySelector(".atk-nick").innerText=`${t.opts.replyTo.nick}`,t.$replyAt.onclick=()=>{t.comment.getActions().goToReplyComment()},t.$headerBadgeWrap.insertAdjacentElement("afterend",t.$replyAt))},ReplyTo:function(t){if(!t.opts.flatMode)return;if(!t.opts.replyTo)return;t.$replyTo=ft(`\n
          \n
          ${Mt("reply")} :
          \n
          \n
          `);const e=t.$replyTo.querySelector(".atk-nick");e.innerText=`@${t.opts.replyTo.nick}`,e.onclick=()=>{t.comment.getActions().goToReplyComment()};let n=ht(t.opts.replyTo.content);t.opts.replyTo.is_collapsed&&(n=`[${Mt("collapsed")}]`),t.$replyTo.querySelector(".atk-content").innerHTML=n,t.$body.prepend(t.$replyTo)},Pending:function(t){if(!t.data.is_pending)return;const e=ft(`
          ${Mt("pendingMsg")}
          `);t.$body.prepend(e)},Actions:function(t){Object.entries({renderVote:me,renderReply:ge,renderCollapse:fe,renderModerator:ye,renderPin:ve,renderEdit:ke,renderDel:$e}).forEach((([e,n])=>{n(t)}))}};class we{constructor(t){h(this,"comment"),h(this,"$el"),h(this,"$main"),h(this,"$header"),h(this,"$headerNick"),h(this,"$headerBadgeWrap"),h(this,"$body"),h(this,"$content"),h(this,"$childrenWrap"),h(this,"$actions"),h(this,"voteBtnUp"),h(this,"voteBtnDown"),h(this,"$replyTo"),h(this,"$replyAt"),this.comment=t}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}render(){var t;return this.$el=ft('
          \n
          \n
          \n
          \n
          \n \n \n \n
          \n
          \n
          \n
          \n \n
          \n
          \n
          \n'),this.$main=this.$el.querySelector(".atk-main"),this.$header=this.$el.querySelector(".atk-header"),this.$body=this.$el.querySelector(".atk-body"),this.$content=this.$body.querySelector(".atk-content"),this.$actions=this.$el.querySelector(".atk-actions"),this.$el.setAttribute("id",`atk-comment-${this.data.id}`),t=this,Object.entries(be).forEach((([e,n])=>{n(t)})),this.$childrenWrap&&this.$main.append(this.$childrenWrap),this.$el}checkHeightLimit(){const t=this.opts.heightLimit;if(!t||!t.content||!t.children)return;const e=t.content,n=t.children;oe({postExpandBtnClick:()=>{const t=this.comment.getChildren();1===t.length&&ae(t[0].getRender().$content)},scrollable:t.scrollable},[{el:this.$content,max:e,imgContains:!0},{el:this.$replyTo,max:e,imgContains:!0},{el:this.$childrenWrap,max:n,imgContains:!1}])}heightLimitRemoveForChildren(){this.$childrenWrap&&ae(this.$childrenWrap)}playFadeAnim(){Nt(this.comment.getRender().$el)}playFadeAnimForBody(){Nt(this.comment.getRender().$body)}playFlashAnim(){this.$el.classList.remove("atk-flash-once"),window.setTimeout((()=>{this.$el.classList.add("atk-flash-once")}),150)}getChildrenWrap(){return this.$childrenWrap||(this.$childrenWrap=ft('
          '),this.$main.append(this.$childrenWrap)),this.$childrenWrap}setUnread(t){t?this.$el.classList.add("atk-unread"):this.$el.classList.remove("atk-unread")}setOpenable(t){t?this.$el.classList.add("atk-openable"):this.$el.classList.remove("atk-openable")}setOpenURL(t){this.setOpenable(!0),this.$el.onclick=e=>{e.stopPropagation(),window.open(t)}}setOpenAction(t){this.setOpenable(!0),this.$el.onclick=e=>{e.stopPropagation(),t()}}}class Ce{constructor(t){h(this,"comment"),this.comment=t}get data(){return this.comment.getData()}get opts(){return this.comment.getOpts()}getApi(){return this.comment.getOpts().getApi()}vote(t){const e="up"===t?this.comment.getRender().voteBtnUp:this.comment.getRender().voteBtnDown;this.getApi().votes.vote(`comment_${t}`,this.data.id,c({},this.getApi().getUserFields())).then((t=>{var e,n;this.data.vote_up=t.data.up,this.data.vote_down=t.data.down,null==(e=this.comment.getRender().voteBtnUp)||e.updateText(),null==(n=this.comment.getRender().voteBtnDown)||n.updateText()})).catch((t=>{null==e||e.setError(Mt("voteFail")),console.log(t)}))}adminEdit(t,e){if(e.isLoading)return;e.setLoading(!0,`${Mt("editing")}...`);const n=c({},this.data);"collapsed"===t?n.is_collapsed=!n.is_collapsed:"pending"===t?n.is_pending=!n.is_pending:"pinned"===t&&(n.is_pinned=!n.is_pinned),this.getApi().comments.updateComment(this.data.id,c({},n)).then((t=>{e.setLoading(!1),this.comment.setData(t.data)})).catch((t=>{console.error(t),e.setError(Mt("editFail"))}))}adminDelete(t){t.isLoading||(t.setLoading(!0,`${Mt("deleting")}...`),this.getApi().comments.deleteComment(this.data.id).then((()=>{t.setLoading(!1),this.opts.onDelete&&this.opts.onDelete(this.comment)})).catch((e=>{console.error(e),t.setError(Mt("deleteFail"))})))}goToReplyComment(){const t=window.location.hash,e=`#atk-comment-${this.data.rid}`;window.location.hash=e,e===t&&window.dispatchEvent(new Event("hashchange"))}}class Ee{constructor(t,e){h(this,"$el"),h(this,"renderInstance"),h(this,"actionInstance"),h(this,"data"),h(this,"opts"),h(this,"parent"),h(this,"children",[]),h(this,"nestCurt"),this.opts=e,this.data=c({},t),this.data.date=this.data.date.replace(/-/g,"/"),this.parent=null,this.nestCurt=1,this.actionInstance=new Ce(this),this.renderInstance=new we(this)}render(){const t=this.renderInstance.render();this.$el&&this.$el.replaceWith(t),this.$el=t,this.opts.onAfterRender&&this.opts.onAfterRender()}getActions(){return this.actionInstance}getRender(){return this.renderInstance}getData(){return this.data}setData(t){this.data=t,this.render(),this.getRender().playFadeAnimForBody()}getParent(){return this.parent}getChildren(){return this.children}getNestCurt(){return this.nestCurt}getIsRoot(){return 0===this.data.rid}getID(){return this.data.id}putChild(t,e="append"){t.parent=this,t.nestCurt=this.nestCurt+1,this.children.push(t);const n=this.getChildrenWrapEl(),i=t.getEl();"append"===e?n.append(i):"prepend"===e&&n.prepend(i),t.getRender().playFadeAnim(),t.getRender().checkHeightLimit()}getChildrenWrapEl(){return this.nestCurt>=this.opts.nestMax?this.parent.getChildrenWrapEl():this.getRender().getChildrenWrap()}getParents(){const t=[];let e=this.parent;for(;e;)t.push(e),e=e.getParent();return t}getEl(){if(!this.$el)throw new Error("comment element not initialized before `getEl()`");return this.$el}focus(){if(!this.$el)throw new Error("comment element not initialized before `focus()`");this.getParents().forEach((t=>{t.getRender().heightLimitRemoveForChildren()})),this.scrollIntoView(),this.getRender().playFlashAnim()}scrollIntoView(){this.$el&&Ft(this.$el,!1,this.opts.scrollRelativeTo&&this.opts.scrollRelativeTo())}remove(){var t;null==(t=this.$el)||t.remove()}getGravatarURL(){return`${(t={mirror:this.opts.gravatar.mirror,params:this.opts.gravatar.params,emailMD5:this.data.email_encrypted}).mirror.replace(/\/$/,"")}/${t.emailMD5}?${t.params.replace(/^\?/,"")}`;var t}getContentMarked(){return ht(this.data.content)}getDateFormatted(){return bt(new Date(this.data.date),Mt)}getUserUA(){const t=function(t){const e=window||{},n=navigator||{},i=String(t||n.userAgent),s={os:"",osVersion:"",engine:"",browser:"",device:"",language:"",version:""},o={Trident:i.includes("Trident")||i.includes("NET CLR"),Presto:i.includes("Presto"),WebKit:i.includes("AppleWebKit"),Gecko:i.includes("Gecko/")},r={Safari:i.includes("Safari"),Chrome:i.includes("Chrome")||i.includes("CriOS"),IE:i.includes("MSIE")||i.includes("Trident"),Edge:i.includes("Edge")||i.includes("Edg"),Firefox:i.includes("Firefox")||i.includes("FxiOS"),"Firefox Focus":i.includes("Focus"),Chromium:i.includes("Chromium"),Opera:i.includes("Opera")||i.includes("OPR"),Vivaldi:i.includes("Vivaldi"),Yandex:i.includes("YaBrowser"),Kindle:i.includes("Kindle")||i.includes("Silk/"),360:i.includes("360EE")||i.includes("360SE"),UC:i.includes("UC")||i.includes(" UBrowser"),QQBrowser:i.includes("QQBrowser"),QQ:i.includes("QQ/"),Baidu:i.includes("Baidu")||i.includes("BIDUBrowser"),Maxthon:i.includes("Maxthon"),Sogou:i.includes("MetaSr")||i.includes("Sogou"),LBBROWSER:i.includes("LBBROWSER"),"2345Explorer":i.includes("2345Explorer"),TheWorld:i.includes("TheWorld"),MIUI:i.includes("MiuiBrowser"),Quark:i.includes("Quark"),Qiyu:i.includes("Qiyu"),Wechat:i.includes("MicroMessenger"),Taobao:i.includes("AliApp(TB"),Alipay:i.includes("AliApp(AP"),Weibo:i.includes("Weibo"),Douban:i.includes("com.douban.frodo"),Suning:i.includes("SNEBUY-APP"),iQiYi:i.includes("IqiyiApp")},a={Windows:i.includes("Windows"),Linux:i.includes("Linux")||i.includes("X11"),macOS:i.includes("Macintosh"),Android:i.includes("Android")||i.includes("Adr"),Ubuntu:i.includes("Ubuntu"),FreeBSD:i.includes("FreeBSD"),Debian:i.includes("Debian"),"Windows Phone":i.includes("IEMobile")||i.includes("Windows Phone"),BlackBerry:i.includes("BlackBerry")||i.includes("RIM"),MeeGo:i.includes("MeeGo"),Symbian:i.includes("Symbian"),iOS:i.includes("like Mac OS X"),"Chrome OS":i.includes("CrOS"),WebOS:i.includes("hpwOS")},l={Mobile:i.includes("Mobi")||i.includes("iPh")||i.includes("480"),Tablet:i.includes("Tablet")||i.includes("Pad")||i.includes("Nexus 7")};l.Mobile?l.Mobile=!i.includes("iPad"):r.Chrome&&i.includes("Edg")?(r.Chrome=!1,r.Edge=!0):e.showModalDialog&&e.chrome&&(r.Chrome=!1,r[360]=!0),s.device="PC",s.language=(()=>{const t=(n.browserLanguage||n.language).split("-");return t[1]&&(t[1]=t[1].toUpperCase()),t.join("_")})();const c={engine:o,browser:r,os:a,device:l};Object.entries(c).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{!0===n&&(s[t]=e)}))}));const d={Windows:()=>{const t=i.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000","10.0":"10","11.0":"11"}[t]||t},Android:()=>i.replace(/^.*Android ([\d.]+);.*$/,"$1"),iOS:()=>i.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,"."),Debian:()=>i.replace(/^.*Debian\/([\d.]+).*$/,"$1"),"Windows Phone":()=>i.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2"),macOS:()=>i.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,"."),WebOS:()=>i.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")};s.osVersion="",d[s.os]&&(s.osVersion=d[s.os](),s.osVersion===i&&(s.osVersion=""));const h={Safari:()=>i.replace(/^.*Version\/([\d.]+).*$/,"$1"),Chrome:()=>i.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1"),IE:()=>i.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1"),Edge:()=>i.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/,"$2"),Firefox:()=>i.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1"),"Firefox Focus":()=>i.replace(/^.*Focus\/([\d.]+).*$/,"$1"),Chromium:()=>i.replace(/^.*Chromium\/([\d.]+).*$/,"$1"),Opera:()=>i.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1"),Vivaldi:()=>i.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1"),Yandex:()=>i.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1"),Kindle:()=>i.replace(/^.*Version\/([\d.]+).*$/,"$1"),Maxthon:()=>i.replace(/^.*Maxthon\/([\d.]+).*$/,"$1"),QQBrowser:()=>i.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1"),QQ:()=>i.replace(/^.*QQ\/([\d.]+).*$/,"$1"),Baidu:()=>i.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/,"$1"),UC:()=>i.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1"),Sogou:()=>i.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1"),"2345Explorer":()=>i.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1"),TheWorld:()=>i.replace(/^.*TheWorld ([\d.]+).*$/,"$1"),MIUI:()=>i.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1"),Quark:()=>i.replace(/^.*Quark\/([\d.]+).*$/,"$1"),Qiyu:()=>i.replace(/^.*Qiyu\/([\d.]+).*$/,"$1"),Wechat:()=>i.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1"),Taobao:()=>i.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1"),Alipay:()=>i.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1"),Weibo:()=>i.replace(/^.*weibo__([\d.]+).*$/,"$1"),Douban:()=>i.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1"),Suning:()=>i.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1"),iQiYi:()=>i.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")};return s.version="",h[s.browser]&&(s.version=h[s.browser](),s.version===i&&(s.version="")),s.version.indexOf(".")&&(s.version=s.version.substring(0,s.version.indexOf("."))),"iOS"===s.os&&i.includes("iPad")?s.os="iPadOS":"Edge"!==s.browser||i.includes("Edg")?"MIUI"===s.browser?s.os="Android":"Chrome"===s.browser&&Number(s.version)>27||"Opera"===s.browser&&Number(s.version)>12||"Yandex"===s.browser?s.engine="Blink":void 0===s.browser&&(s.browser="Unknow App"):s.engine="EdgeHTML",s}(this.data.ua);return{browser:`${t.browser} ${t.version}`,os:`${t.os} ${t.osVersion}`}}getOpts(){return this.opts}}class xe{constructor(t){h(this,"opts"),h(this,"$el"),h(this,"$loading"),h(this,"$text"),h(this,"offset",0),h(this,"total",0),h(this,"origText","Load More"),this.opts=t,this.origText=this.opts.text||this.origText,this.$el=ft(``),this.$loading=this.$el.querySelector(".atk-loading-icon"),this.$text=this.$el.querySelector(".atk-text"),this.$el.onclick=()=>{this.click()}}get hasMore(){return this.total>this.offset+this.opts.pageSize}click(){this.hasMore&&this.opts.onClick(this.offset+this.opts.pageSize),this.checkDisabled()}show(){this.$el.style.display=""}hide(){this.$el.style.display="none"}setLoading(t){this.$loading.style.display=t?"":"none",this.$text.style.display=t?"none":""}showErr(t){this.setLoading(!1),this.$text.innerText=t,this.$el.classList.add("atk-err"),window.setTimeout((()=>{this.$text.innerText=this.origText,this.$el.classList.remove("atk-err")}),2e3)}update(t,e){this.offset=t,this.total=e,this.checkDisabled()}checkDisabled(){this.hasMore?this.show():this.hide()}}class Se{constructor(){h(this,"instance"),h(this,"onReachedBottom",null),h(this,"opt")}create(t){return this.opt=t,this.instance=new xe({pageSize:t.pageSize,onClick:e=>u(this,null,(function*(){t.ctx.fetch({offset:e})})),text:Mt("loadMore")}),t.readMoreAutoLoad&&(this.onReachedBottom=()=>{this.instance.hasMore&&!this.opt.ctx.getData().getLoading()&&this.instance.click()},this.opt.ctx.on("list-reach-bottom",this.onReachedBottom)),this.instance.$el}setLoading(t){this.instance.setLoading(t)}update(t,e){this.instance.update(t,e)}showErr(t){this.instance.showErr(t)}next(){this.instance.click()}getHasMore(){return this.instance.hasMore}getIsClearComments(t){return 0===t.offset}dispose(){this.onReachedBottom&&this.opt.ctx.off("list-reach-bottom",this.onReachedBottom),this.instance.$el.remove()}}class Te{constructor(t,e){h(this,"opts"),h(this,"total"),h(this,"$el"),h(this,"$input"),h(this,"inputTimer"),h(this,"$prevBtn"),h(this,"$nextBtn"),h(this,"page",1),this.total=t,this.opts=e,this.$el=ft('
          \n
          \n
          \n \n
          \n \n
          \n \n
          \n
          \n
          '),this.$input=this.$el.querySelector(".atk-input"),this.$input.value=`${this.page}`,this.$input.oninput=()=>this.input(),this.$input.onkeydown=t=>this.keydown(t),this.$prevBtn=this.$el.querySelector(".atk-btn-prev"),this.$nextBtn=this.$el.querySelector(".atk-btn-next"),this.$prevBtn.onclick=()=>this.prev(),this.$nextBtn.onclick=()=>this.next(),this.checkDisabled()}get pageSize(){return this.opts.pageSize}get offset(){return this.pageSize*(this.page-1)}get maxPage(){return Math.ceil(this.total/this.pageSize)}update(t,e){this.page=Math.ceil(t/this.pageSize)+1,this.total=e,this.setInput(this.page),this.checkDisabled()}setInput(t){this.$input.value=`${t}`}input(t=!1){window.clearTimeout(this.inputTimer);const e=this.$input.value.trim(),n=()=>{if(""===e)return void this.setInput(this.page);let t=Number(e);Number.isNaN(t)||t<1?this.setInput(this.page):(t>this.maxPage&&(this.setInput(this.maxPage),t=this.maxPage),this.change(t))};t?n():this.inputTimer=window.setTimeout((()=>n()),800)}prev(){const t=this.page-1;t<1||this.change(t)}next(){const t=this.page+1;t>this.maxPage||this.change(t)}getHasMore(){return this.page+1<=this.maxPage}change(t){this.page=t,this.opts.onChange(this.offset),this.setInput(t),this.checkDisabled()}checkDisabled(){this.page+1>this.maxPage?this.$nextBtn.classList.add("atk-disabled"):this.$nextBtn.classList.remove("atk-disabled"),this.page-1<1?this.$prevBtn.classList.add("atk-disabled"):this.$prevBtn.classList.remove("atk-disabled")}keydown(t){const e=t.keyCode||t.which;if(38===e){const t=Number(this.$input.value)+1;if(t>this.maxPage)return;this.setInput(t),this.input()}else if(40===e){const t=Number(this.$input.value)-1;if(t<1)return;this.setInput(t),this.input()}else 13===e&&this.input(!0)}setLoading(t){t?Dt(this.$el):Bt(this.$el)}}class Le{constructor(){h(this,"instance")}create(t){return this.instance=new Te(t.total,{pageSize:t.pageSize,onChange:e=>u(this,null,(function*(){t.ctx.editorResetState(),t.ctx.fetch({offset:e,onSuccess:()=>{t.ctx.listGotoFirst()}})}))}),this.instance.$el}setLoading(t){this.instance.setLoading(t)}update(t,e){this.instance.update(t,e)}next(){this.instance.next()}getHasMore(){return this.instance.getHasMore()}getIsClearComments(){return!0}dispose(){this.instance.$el.remove()}}function Ae(t){const e=t.getData().getListLastFetch(),n={offset:0,total:0};return e?(n.offset=e.params.offset,e.data&&(n.total=e.params.flatMode?e.data.count:e.data.roots_count),n):n}const Me=t=>{let e=null;t.watchConf(["pagination","locale"],(n=>{const i=t.get("list");e&&e.dispose(),e=function(t){return t.pagination.readMore?new Se:new Le}(n);const{offset:s,total:o}=Ae(t),r=e.create({ctx:t,pageSize:n.pagination.pageSize,total:o,readMoreAutoLoad:n.pagination.autoLoad});i.$commentsWrap.after(r),null==e||e.update(s,o)})),t.on("list-loaded",(n=>{const{offset:i,total:s}=Ae(t);null==e||e.update(i,s)})),t.on("list-fetch",(n=>{t.getData().getComments().length>0&&(null==e?void 0:e.getIsClearComments(n))&&t.getData().clearComments()})),t.on("list-failed",(()=>{var t;null==(t=null==e?void 0:e.showErr)||t.call(e,Mt("loadFail"))})),t.on("list-fetch",(t=>{null==e||e.setLoading(!0)})),t.on("list-fetched",(({params:t})=>{null==e||e.setLoading(!1)}))};class Pe extends Kt{constructor(t){super(t),h(this,"$commentsWrap"),h(this,"commentNodes",[]),this.$el=ft('
          \n
          \n
          \n
          \n
          \n
          \n \n \n \n
          \n
          \n
          \n
          \n
          \n
          \n
          \n \n
          \n'),this.$commentsWrap=this.$el.querySelector(".atk-list-comments-wrap"),Me(t),this.initCrudEvents()}getCommentsWrapEl(){return this.$commentsWrap}getCommentNodes(){return this.commentNodes}getListLayout({forceFlatMode:t}={}){return new se({$commentsWrap:this.$commentsWrap,nestSortBy:this.ctx.conf.nestSort,nestMax:this.ctx.conf.nestMax,flatMode:"boolean"==typeof t?t:this.ctx.conf.flatMode,createCommentNode:(e,n)=>{const i=function(t,e,n,i){const s=new Ee(e,{onAfterRender:()=>{t.trigger("comment-rendered",s)},onDelete:e=>{t.getData().deleteComment(e.getID())},replyTo:n,flatMode:"boolean"==typeof(null==i?void 0:i.forceFlatMode)?null==i?void 0:i.forceFlatMode:t.conf.flatMode,gravatar:t.conf.gravatar,nestMax:t.conf.nestMax,heightLimit:t.conf.heightLimit,avatarURLBuilder:t.conf.avatarURLBuilder,scrollRelativeTo:t.conf.scrollRelativeTo,vote:t.conf.vote,voteDown:t.conf.voteDown,uaBadge:t.conf.uaBadge,getApi:()=>t.getApi(),replyComment:(e,n)=>t.replyComment(e,n),editComment:(e,n)=>t.editComment(e,n)});return s.render(),s}(this.ctx,e,n,{forceFlatMode:t});return this.commentNodes.push(i),i},findCommentNode:t=>this.commentNodes.find((e=>e.getID()===t))})}initCrudEvents(){this.ctx.on("list-load",(t=>{this.getListLayout().import(t)})),this.ctx.on("list-loaded",(t=>{0===t.length&&(this.commentNodes=[],this.$commentsWrap.innerHTML="")})),this.ctx.on("comment-inserted",(t=>{var e;const n=t.rid?null==(e=this.commentNodes.find((e=>e.getID()===t.rid)))?void 0:e.getData():void 0;this.getListLayout().insert(t,n)})),this.ctx.on("comment-deleted",(t=>{const e=this.commentNodes.find((e=>e.getID()===t.id));e?(e.remove(),this.commentNodes=this.commentNodes.filter((e=>e.getID()!==t.id))):console.error(`comment node id=${t.id} not found`)})),this.ctx.on("comment-updated",(t=>{const e=this.commentNodes.find((e=>e.getID()===t.id));e&&e.setData(t)}))}}let Oe,Ue;function Ie(){return{init(){Oe=document.body.style.overflow,Ue=document.body.style.paddingRight},unlock(){document.body.style.overflow=Oe,document.body.style.paddingRight=Ue},lock(){document.body.style.overflow="hidden";const t=parseInt(window.getComputedStyle(document.body,null).getPropertyValue("padding-right"),10);document.body.style.paddingRight=`${function(){const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);const n=t.offsetWidth;e.style.overflow="scroll";let i=t.offsetWidth;return n===i&&(i=e.clientWidth),document.body.removeChild(e),n-i}()+t||0}px`}}}class Re{constructor(t,e){h(this,"allowMaskClose",!0),h(this,"onAfterHide"),this.$el=t,this.opts=e}setOnAfterHide(t){this.onAfterHide=t}setAllowMaskClose(t){this.allowMaskClose=t}getAllowMaskClose(){return this.allowMaskClose}getEl(){return this.$el}show(){this.opts.onShow(),this.$el.style.display=""}hide(){return u(this,null,(function*(){this.opts.onHide(),this.$el.style.display="none",this.onAfterHide&&this.onAfterHide()}))}destroy(){return u(this,null,(function*(){this.opts.onHide(),this.$el.remove(),this.onAfterHide&&this.onAfterHide()}))}}class qe{constructor(){h(this,"$wrap"),h(this,"$mask"),h(this,"items",[]),this.$wrap=ft(''),this.$mask=this.$wrap.querySelector(".atk-layer-mask")}createItem(t,e){(e=e||this.createItemElement(t)).setAttribute("data-layer-name",t),this.$wrap.appendChild(e);const n=new Re(e,{onHide:()=>this.hideWrap(e),onShow:()=>this.showWrap()});return this.getMask().addEventListener("click",(()=>{n.getAllowMaskClose()&&n.hide()})),this.items.push(n),n}createItemElement(t){const e=document.createElement("div");return e.classList.add("atk-layer-item"),e.style.display="none",this.$wrap.appendChild(e),e}getWrap(){return this.$wrap}getMask(){return this.$mask}showWrap(){this.$wrap.style.display="block",this.$mask.style.display="block",this.$mask.classList.add("atk-fade-in"),Ie().lock()}hideWrap(t){this.items.map((t=>t.getEl())).filter((e=>e!==t&&e.isConnected&&"none"!==e.style.display)).length>0||(this.$wrap.style.display="none",Ie().unlock())}}class je{constructor(t){h(this,"wrap"),this.wrap=new qe,document.body.appendChild(this.wrap.getWrap()),t.on("unmounted",(()=>{this.wrap.getWrap().remove()})),Ie().init()}getEl(){return this.wrap.getWrap()}create(t,e){return this.wrap.createItem(t,e)}}const De="ArtalkUser";class Be{constructor(t){h(this,"data"),this.opts=t;const e=JSON.parse(window.localStorage.getItem(De)||"{}");this.data={nick:e.nick||"",email:e.email||"",link:e.link||"",token:e.token||"",isAdmin:e.isAdmin||!1}}getData(){return this.data}update(t={}){Object.entries(t).forEach((([t,e])=>{this.data[t]=e})),window.localStorage.setItem(De,JSON.stringify(this.data)),this.opts.onUserChanged&&this.opts.onUserChanged(this.data)}logout(){this.update({token:"",isAdmin:!1})}checkHasBasicUserInfo(){return!!this.data.nick&&!!this.data.email}}const _e={i18n(t){At(t.conf.locale),t.watchConf(["locale"],(t=>{At(t.locale)}))},user:t=>new Be({onUserChanged:e=>{t.trigger("user-changed",e)}}),layerManager:t=>new je(t),checkerLauncher:t=>new Qt({getCtx:()=>t,getApi:()=>t.getApi(),onReload:()=>t.reload(),getCaptchaIframeURL:()=>`${t.conf.server}/api/v2/captcha/?t=${+new Date}`}),editor(t){const e=new te(t);return t.$root.appendChild(e.$el),e},list(t){const e=new Pe(t);return t.$root.appendChild(e.$el),e},sidebarLayer:t=>new ee(t),editorPlugs(){}};function Fe(t){return u(this,null,(function*(){t.countEl&&document.querySelector(t.countEl)&&Ne(t,{query:"page_comment",numEl:t.countEl});const e=t.pvAdd&&t.pageKey?{[t.pageKey]:(yield t.getApi().pages.logPv({page_key:t.pageKey,page_title:t.pageTitle,site_name:t.siteName})).data.pv}:void 0;t.pvEl&&document.querySelector(t.pvEl)&&Ne(t,{query:"page_pv",numEl:t.pvEl,data:e})}))}function Ne(t,e){return u(this,null,(function*(){let n=e.data||{},i=Array.from(document.querySelectorAll(e.numEl)).map((e=>e.getAttribute("data-page-key")||t.pageKey)).filter((t=>t&&"number"!=typeof n[t]));if(i=[...new Set(i)],i.length>0){const s=(yield t.getApi().stats.getStats(e.query,{page_keys:i.join(","),site_name:t.siteName})).data.data;n=c(c({},n),s)}const s=t.pageKey?n[t.pageKey]:0;!function(t,e,n){document.querySelectorAll(t).forEach((t=>{const i=t.getAttribute("data-page-key"),s=Number(i?e[i]:n);t.innerHTML=`${s}`}))}(e.numEl,n,s)}))}function We(t){const e=ft('

          ');if(e.querySelector(".error-message").innerText=`${Mt("listLoadFailMsg")}\n${t.errMsg}`,t.retryFn){const n=ft(`${Mt("listRetry")}`);n.onclick=()=>t.retryFn&&t.retryFn(),e.appendChild(n)}if(t.onOpenSidebar){const n=ft(` | ${Mt("openName",{name:Mt("ctrlCenter")})}`);e.appendChild(n),n.onclick=()=>t.onOpenSidebar&&t.onOpenSidebar()}Wt(t.$err,e)}const He="ArtalkContent";class Ve{constructor(t){this.kit=t}reqAdd(){return u(this,null,(function*(){return(yield this.kit.useApi().comments.createComment(c({},yield this.getSubmitAddParams()))).data}))}getSubmitAddParams(){return u(this,null,(function*(){const{nick:t,email:e,link:n}=this.kit.useUser().getData(),i=this.kit.useConf();return{content:this.kit.useEditor().getContentFinal(),name:t,email:e,link:n,rid:0,page_key:i.pageKey,page_title:i.pageTitle,site_name:i.site,ua:yield wt()}}))}postSubmitAdd(t){this.kit.useGlobalCtx().getData().insertComment(t)}}class Ge extends Jt{constructor(t){super(t),h(this,"customs",[]),h(this,"defaultPreset"),this.defaultPreset=new Ve(this.kit);const e=()=>this.do();this.kit.useMounted((()=>{this.kit.useGlobalCtx().on("editor-submit",e)})),this.kit.useUnmounted((()=>{this.kit.useGlobalCtx().off("editor-submit",e)}))}registerCustom(t){this.customs.push(t)}do(){return u(this,null,(function*(){if(""===this.kit.useEditor().getContentFinal().trim())return void this.kit.useEditor().focus();const t=this.customs.find((t=>t.activeCond()));this.kit.useEditor().showLoading();try{let e;(null==t?void 0:t.pre)&&t.pre(),e=(null==t?void 0:t.req)?yield t.req():yield this.defaultPreset.reqAdd(),(null==t?void 0:t.post)?t.post(e):this.defaultPreset.postSubmitAdd(e)}catch(e){return console.error(e),void this.kit.useEditor().showNotify(`${Mt("commentFail")}: ${e.message||String(e)}`,"e")}finally{this.kit.useEditor().hideLoading()}this.kit.useEditor().reset(),this.kit.useGlobalCtx().trigger("editor-submitted")}))}}class ze extends Jt{constructor(t){super(t),h(this,"emoticons",[]),h(this,"loadingTask",null),h(this,"$grpWrap"),h(this,"$grpSwitcher"),h(this,"isListLoaded",!1),h(this,"isImgLoaded",!1),this.kit.useMounted((()=>{this.usePanel('
          '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.useContentTransformer((t=>this.transEmoticonImageText(t))),this.usePanelShow((()=>{(()=>{u(this,null,(function*(){yield this.loadEmoticonsData(),this.isImgLoaded||(this.initEmoticonsList(),this.isImgLoaded=!0),setTimeout((()=>{this.changeListHeight()}),30)}))})()})),this.usePanelHide((()=>{this.$panel.parentElement.style.height=""})),window.setTimeout((()=>{this.loadEmoticonsData()}),1e3)}loadEmoticonsData(){return u(this,null,(function*(){this.isListLoaded||(null===this.loadingTask?(this.loadingTask=(()=>u(this,null,(function*(){Dt(this.$panel),this.emoticons=yield this.handleData(this.kit.useConf().emoticons),Bt(this.$panel),this.loadingTask=null,this.isListLoaded=!0})))(),yield this.loadingTask):yield this.loadingTask)}))}handleData(t){return u(this,null,(function*(){if(!Array.isArray(t)&&["object","string"].includes(typeof t)&&(t=[t]),!Array.isArray(t))return Wt(this.$panel,`[${Mt("emoticon")}] Data must be of Array/Object/String type`),Bt(this.$panel),[];const e=e=>{"object"==typeof e&&(e.name&&t.find((t=>t.name===e.name))||t.push(e))},n=t=>u(this,null,(function*(){yield Promise.all(t.map(((t,i)=>u(this,null,(function*(){if("object"!=typeof t||Array.isArray(t)){if(Array.isArray(t))yield n(t);else if("string"==typeof t){const i=yield this.remoteLoad(t);Array.isArray(i)?yield n(i):"object"==typeof i&&e(i)}}else e(t)})))))}));return yield n(t),t.forEach((t=>{if(this.isOwOFormat(t)){this.convertOwO(t).forEach((t=>{e(t)}))}else Array.isArray(t)&&t.forEach((t=>{e(t)}))})),t=t.filter((t=>"object"==typeof t&&!Array.isArray(t)&&!!t&&!!t.name)),this.solveNullKey(t),this.solveSameKey(t),t}))}remoteLoad(t){return u(this,null,(function*(){if(!t)return[];try{const e=yield fetch(t);return yield e.json()}catch(e){return Bt(this.$panel),console.error("[Emoticons] Load Failed:",e),Wt(this.$panel,`[${Mt("emoticon")}] ${Mt("loadFail")}: ${String(e)}`),[]}}))}solveNullKey(t){t.forEach((t=>{t.items.forEach(((e,n)=>{e.key||(e.key=`${t.name} ${n+1}`)}))}))}solveSameKey(t){const e={};t.forEach((t=>{t.items.forEach((t=>{t.key&&""!==String(t.key).trim()&&(e[t.key]?e[t.key]++:e[t.key]=1,e[t.key]>1&&(t.key=`${t.key} ${e[t.key]}`))}))}))}isOwOFormat(t){try{return"object"==typeof t&&!!Object.values(t).length&&Array.isArray(Object.keys(Object.values(t)[0].container))&&Object.keys(Object.values(t)[0].container[0]).includes("icon")}catch(e){return!1}}convertOwO(t){const e=[];return Object.entries(t).forEach((([t,n])=>{const i={name:t,type:n.type,items:[]};n.container.forEach(((e,n)=>{const s=e.icon;if(/<(img|IMG)/.test(s)){const t=/src=["'](.*?)["']/.exec(s);t&&t.length>1&&(e.icon=t[1])}i.items.push({key:e.text||`${t} ${n+1}`,val:e.icon})})),e.push(i)})),e}initEmoticonsList(){this.$grpWrap=ft('
          '),this.$panel.append(this.$grpWrap),this.emoticons.forEach(((t,e)=>{const n=ft('');this.$grpWrap.append(n),n.setAttribute("data-index",String(e)),n.setAttribute("data-grp-name",t.name),n.setAttribute("data-type",t.type),t.items.forEach((e=>{const i=ft('');if(n.append(i),e.key&&!new RegExp(`^(${t.name})?\\s?[0-9]+$`).test(e.key)&&i.setAttribute("title",e.key),"image"===t.type){const t=document.createElement("img");t.src=e.val,t.alt=e.key,i.append(t)}else i.innerText=e.val;i.onclick=()=>{"image"===t.type?this.kit.useEditor().insertContent(`:[${e.key}]`):this.kit.useEditor().insertContent(e.val||"")}}))})),this.emoticons.length>1&&(this.$grpSwitcher=ft('
          '),this.$panel.append(this.$grpSwitcher),this.emoticons.forEach(((t,e)=>{const n=ft("");n.innerText=t.name,n.setAttribute("data-index",String(e)),n.onclick=()=>this.openGrp(e),this.$grpSwitcher.append(n)}))),this.emoticons.length>0&&this.openGrp(0)}openGrp(t){var e,n,i;Array.from(this.$grpWrap.children).forEach((e=>{const n=e;n.getAttribute("data-index")!==String(t)?n.style.display="none":n.style.display=""})),null==(e=this.$grpSwitcher)||e.querySelectorAll("span.active").forEach((t=>t.classList.remove("active"))),null==(i=null==(n=this.$grpSwitcher)?void 0:n.querySelector(`span[data-index="${t}"]`))||i.classList.add("active"),this.changeListHeight()}changeListHeight(){}transEmoticonImageText(t){return this.emoticons&&Array.isArray(this.emoticons)?(this.emoticons.forEach((e=>{"image"===e.type&&Object.entries(e.items).forEach((([e,n])=>{t=t.split(`:[${n.key}]`).join(``)}))})),t):t}}const Qe=["png","jpg","jpeg","gif","bmp","svg","webp"];class Ke extends Jt{constructor(t){super(t),h(this,"$imgUploadInput"),this.kit.useMounted((()=>this.init())),this.initDragImg()}init(){this.$imgUploadInput=document.createElement("input"),this.$imgUploadInput.type="file",this.$imgUploadInput.style.display="none",this.$imgUploadInput.accept=Qe.map((t=>`.${t}`)).join(",");const t=this.useBtn(``);t.after(this.$imgUploadInput),t.onclick=()=>{const t=this.$imgUploadInput;t.onchange=()=>{(()=>{u(this,null,(function*(){if(!t.files||0===t.files.length)return;const e=t.files[0];this.uploadImg(e)}))})()},t.click()},this.kit.useConf().imgUpload||this.$btn.setAttribute("atk-only-admin-show","")}initDragImg(){const t=t=>{if(t)for(let e=0;e{t.stopPropagation(),t.preventDefault()},n=e=>{var n;const i=null==(n=e.dataTransfer)?void 0:n.files;(null==i?void 0:i.length)&&(e.preventDefault(),t(i))},i=e=>{var n;const i=null==(n=e.clipboardData)?void 0:n.files;(null==i?void 0:i.length)&&(e.preventDefault(),t(i))};this.kit.useMounted((()=>{this.kit.useUI().$textarea.addEventListener("dragover",e),this.kit.useUI().$textarea.addEventListener("drop",n),this.kit.useUI().$textarea.addEventListener("paste",i)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("dragover",e),this.kit.useUI().$textarea.removeEventListener("drop",n),this.kit.useUI().$textarea.removeEventListener("paste",i)}))}uploadImg(t){return u(this,null,(function*(){const e=/[^.]+$/.exec(t.name);if(!e||!Qe.includes(String(e[0]).toLowerCase()))return;if(!this.kit.useUser().checkHasBasicUserInfo())return void this.kit.useEditor().showNotify(Mt("uploadLoginMsg"),"w");let n="\n";""===this.kit.useUI().$textarea.value.trim()&&(n="");const i=`${n}![](Uploading ${t.name}...)`;let s;this.kit.useEditor().insertContent(i);try{const e=this.kit.useConf().imgUploader;s=e?{public_url:yield e(t)}:(yield this.kit.useApi().upload.upload({file:t})).data}catch(o){console.error(o),this.kit.useEditor().showNotify(`${Mt("uploadFail")}: ${o.message}`,"e")}if(s&&s.public_url){let t=s.public_url;Ct(t)||(t=Et({base:this.kit.useConf().server,path:t})),this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(i,`${n}![](${t})`))}else this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(i,""))}))}}class Ye extends Jt{constructor(t){super(t),h(this,"isPlugPanelShow",!1),this.kit.useMounted((()=>{this.usePanel('
          '),this.useBtn(``)})),this.kit.useUnmounted((()=>{})),this.kit.useEvents().on("content-updated",(t=>{this.isPlugPanelShow&&this.updateContent()})),this.usePanelShow((()=>{this.isPlugPanelShow=!0,this.updateContent()})),this.usePanelHide((()=>{this.isPlugPanelShow=!1}))}updateContent(){this.$panel.innerHTML=this.kit.useEditor().getContentMarked()}}const Je=[class extends Jt{constructor(t){super(t);const e=()=>{this.save()};this.kit.useMounted((()=>{const t=window.localStorage.getItem(He)||"";""!==t.trim()&&(this.kit.useEditor().showNotify(Mt("restoredMsg"),"i"),this.kit.useEditor().setContent(t)),this.kit.useEvents().on("content-updated",e)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("content-updated",e)}))}save(){window.localStorage.setItem(He,this.kit.useEditor().getContentRaw().trim())}},class extends Jt{get $inputs(){return this.kit.useEditor().getHeaderInputEls()}constructor(t){super(t);const e={},n={},i=(t,e,n)=>()=>{this.kit.useEvents().trigger(t,{field:n,$input:e})};this.kit.useMounted((()=>{Object.entries(this.$inputs).forEach((([t,s])=>{s.addEventListener("input",e[t]=i("header-input",s,t)),s.addEventListener("change",n[t]=i("header-change",s,t))}))})),this.kit.useUnmounted((()=>{Object.entries(this.$inputs).forEach((([t,i])=>{i.removeEventListener("input",e[t]),i.removeEventListener("change",n[t])}))}))}},class extends Jt{constructor(t){super(t),h(this,"query",{timer:null,abortFn:null});const e=({$input:t,field:e})=>{"edit"!==this.kit.useEditor().getState()&&(this.kit.useUser().update({[e]:t.value.trim()}),"nick"!==e&&"email"!==e||this.fetchUserInfo())};this.kit.useMounted((()=>{Object.entries(this.kit.useEditor().getHeaderInputEls()).forEach((([t,e])=>{e.placeholder=`${Mt(t)}`,e.value=this.kit.useUser().getData()[t]||""})),this.kit.useEvents().on("header-input",e)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-input",e)}))}fetchUserInfo(){this.kit.useUser().logout(),this.query.timer&&window.clearTimeout(this.query.timer),this.query.abortFn&&this.query.abortFn(),this.query.timer=window.setTimeout((()=>{this.query.timer=null;const t=this.kit.useApi(),e="getUserCancelToken";this.query.abortFn=()=>t.abortRequest(e),t.user.getUser(c({},t.getUserFields()),{cancelToken:e}).then((t=>this.onUserInfoFetched(t.data))).catch((t=>{})).finally((()=>{this.query.abortFn=null}))}),400)}onUserInfoFetched(t){var e;t.is_login||this.kit.useUser().logout(),this.kit.useGlobalCtx().getData().updateNotifies(t.notifies),this.kit.useUser().checkHasBasicUserInfo()&&!t.is_login&&(null==(e=t.user)?void 0:e.is_admin)&&this.kit.useGlobalCtx().checkAdmin({onSuccess:()=>{}}),t.user&&t.user.link&&(this.kit.useUI().$link.value=t.user.link,this.kit.useUser().update({link:t.user.link}))}},class extends Jt{constructor(t){super(t);const e=({field:t})=>{"link"===t&&this.onLinkInputChange()};this.kit.useMounted((()=>{this.kit.useEvents().on("header-change",e)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("header-change",e)}))}onLinkInputChange(){const t=this.kit.useUI().$link.value.trim();t&&!/^(http|https):\/\//.test(t)&&(this.kit.useUI().$link.value=`https://${t}`,this.kit.useUser().update({link:this.kit.useUI().$link.value}))}},class extends Jt{constructor(t){super(t);const e=t=>this.onKeydown(t),n=()=>this.onInput();this.kit.useMounted((()=>{this.kit.useUI().$textarea.placeholder=this.kit.useConf().placeholder||Mt("placeholder"),this.kit.useUI().$textarea.addEventListener("keydown",e),this.kit.useUI().$textarea.addEventListener("input",n)})),this.kit.useUnmounted((()=>{this.kit.useUI().$textarea.removeEventListener("keydown",e),this.kit.useUI().$textarea.removeEventListener("input",n)})),this.kit.useEvents().on("content-updated",(()=>{window.setTimeout((()=>{this.adaptiveHeightByContent()}),80)}))}onKeydown(t){9===(t.keyCode||t.which)&&(t.preventDefault(),this.kit.useEditor().insertContent("\t"))}onInput(){this.kit.useEvents().trigger("content-updated",this.kit.useEditor().getContentRaw())}adaptiveHeightByContent(){const t=this.kit.useUI().$textarea.offsetHeight-this.kit.useUI().$textarea.clientHeight;this.kit.useUI().$textarea.style.height="0px",this.kit.useUI().$textarea.style.height=`${this.kit.useUI().$textarea.scrollHeight+t}px`}},Ge,class extends Jt{constructor(t){super(t);const e=()=>{this.kit.useEditor().submit()};this.kit.useMounted((()=>{this.kit.useUI().$submitBtn.innerText=this.kit.useConf().sendBtn||Mt("send"),this.kit.useUI().$submitBtn.addEventListener("click",e)})),this.kit.useUnmounted((()=>{this.kit.useUI().$submitBtn.removeEventListener("click",e)}))}},Xt,class extends Jt{constructor(t){super(t),h(this,"comment"),this.useEditorStateEffect("reply",(t=>(this.setReply(t),()=>{this.cancelReply()}))),this.kit.useEvents().on("mounted",(()=>{const t=this.kit.useDeps(Ge);if(!t)throw Error("SubmitPlug not initialized");const e=new Ve(this.kit);t.registerCustom({activeCond:()=>!!this.comment,req:()=>u(this,null,(function*(){if(!this.comment)throw new Error("reply comment cannot be empty");return(yield this.kit.useApi().comments.createComment(d(c({},yield e.getSubmitAddParams()),{rid:this.comment.id,page_key:this.comment.page_key,page_title:void 0,site_name:this.comment.site_name}))).data})),post:t=>{const n=this.kit.useConf();t.page_key!==n.pageKey&&window.open(`${t.page_url}#atk-comment-${t.id}`),e.postSubmitAdd(t)}})}))}setReply(t){const e=this.kit.useUI();if(!e.$sendReplyBtn){const n=ft(`${Mt("reply")} `);n.querySelector(".atk-text").innerText=`@${t.nick}`,n.addEventListener("click",(()=>{this.kit.useEditor().resetState()})),e.$stateWrap.append(n),e.$sendReplyBtn=n}this.comment=t,e.$textarea.focus()}cancelReply(){if(!this.comment)return;const t=this.kit.useUI();t.$sendReplyBtn&&(t.$sendReplyBtn.remove(),t.$sendReplyBtn=void 0),this.comment=void 0}},class extends Jt{constructor(t){super(t),h(this,"comment"),h(this,"originalSubmitBtnText","Send"),this.useEditorStateEffect("edit",(t=>(this.edit(t),()=>{this.cancelEdit()}))),this.kit.useMounted((()=>{const t=this.kit.useDeps(Ge);if(!t)throw Error("SubmitPlug not initialized");t.registerCustom({activeCond:()=>!!this.comment,req:()=>u(this,null,(function*(){const t={content:this.kit.useEditor().getContentFinal(),nick:this.kit.useUI().$nick.value,email:this.kit.useUI().$email.value,link:this.kit.useUI().$link.value},e=this.comment;return(yield this.kit.useApi().comments.updateComment(e.id,c(c({},e),t))).data})),post:t=>{this.kit.useGlobalCtx().getData().updateComment(t)}})}))}edit(t){const e=this.kit.useUI();if(!e.$editCancelBtn){const t=ft(`${Mt("editCancel")}`);t.onclick=()=>{this.kit.useEditor().resetState()},e.$stateWrap.append(t),e.$editCancelBtn=t}this.comment=t,e.$header.style.display="none",e.$nick.value=t.nick||"",e.$email.value=t.email||"",e.$link.value=t.link||"",this.kit.useEditor().setContent(t.content),e.$textarea.focus(),this.updateSubmitBtnText(Mt("save"))}cancelEdit(){if(!this.comment)return;const t=this.kit.useUI();t.$editCancelBtn&&(t.$editCancelBtn.remove(),t.$editCancelBtn=void 0),this.comment=void 0;const{nick:e,email:n,link:i}=this.kit.useUser().getData();t.$nick.value=e,t.$email.value=n,t.$link.value=i,this.kit.useEditor().setContent(""),this.restoreSubmitBtnText(),t.$header.style.display=""}updateSubmitBtnText(t){this.originalSubmitBtnText=this.kit.useUI().$submitBtn.innerText,this.kit.useUI().$submitBtn.innerText=t}restoreSubmitBtnText(){this.kit.useUI().$submitBtn.innerText=this.originalSubmitBtnText}},class extends Jt{constructor(t){super(t);const e=()=>this.open(),n=()=>this.close();this.kit.useMounted((()=>{this.kit.useEvents().on("editor-open",e),this.kit.useEvents().on("editor-close",n)})),this.kit.useUnmounted((()=>{this.kit.useEvents().off("editor-open",e),this.kit.useEvents().off("editor-close",n)}))}open(){var t;null==(t=this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed"))||t.remove(),this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""}close(){this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed")||this.kit.useUI().$textareaWrap.prepend(ft(`
          ${Mt("onlyAdminCanReply")}
          `)),this.kit.useUser().getData().isAdmin?(this.kit.useUI().$textarea.style.display="",this.kit.useUI().$bottom.style.display=""):(this.kit.useUI().$textarea.style.display="none",this.kit.useEvents().trigger("panel-close"),this.kit.useUI().$bottom.style.display="none")}},ze,Ke,Ye];class Xe{constructor(t){this.plugs=t}useEditor(){return this.plugs.editor}useGlobalCtx(){return this.plugs.editor.ctx}useConf(){return this.plugs.editor.ctx.conf}useApi(){return this.plugs.editor.ctx.getApi()}useUser(){return this.plugs.editor.ctx.get("user")}useUI(){return this.plugs.editor.getUI()}useEvents(){return this.plugs.getEvents()}useMounted(t){this.useEvents().on("mounted",t)}useUnmounted(t){this.useEvents().on("unmounted",t)}useDeps(t){return this.plugs.get(t)}}class Ze{constructor(t){h(this,"plugs",[]),h(this,"openedPlug",null),h(this,"events",new Pt),this.editor=t;let e=!1;this.editor.ctx.watchConf(["imgUpload","emoticons","preview","editorTravel","locale"],(t=>{e&&this.getEvents().trigger("unmounted"),this.clear(),function(t){const e=new Map;return e.set(Ke,t.imgUpload),e.set(ze,t.emoticons),e.set(Ye,t.preview),e.set(Xt,t.editorTravel),Je.filter((t=>!e.has(t)||!!e.get(t)))}(t).forEach((t=>{const e=new Xe(this);this.plugs.push(new t(e))})),this.getEvents().trigger("mounted"),e=!0,this.loadPluginUI()})),this.events.on("panel-close",(()=>this.closePlugPanel()))}getPlugs(){return this.plugs}getEvents(){return this.events}clear(){this.plugs=[],this.events=new Pt,this.openedPlug&&this.closePlugPanel()}loadPluginUI(){this.editor.getUI().$plugPanelWrap.innerHTML="",this.editor.getUI().$plugPanelWrap.style.display="none",this.editor.getUI().$plugBtnWrap.innerHTML="",this.plugs.forEach((t=>this.loadPluginItem(t)))}loadPluginItem(t){const e=t.$btn;if(!e)return;this.editor.getUI().$plugBtnWrap.appendChild(e),!e.onclick&&(e.onclick=()=>{this.editor.getUI().$plugBtnWrap.querySelectorAll(".active").forEach((t=>t.classList.remove("active"))),t!==this.openedPlug?(this.openPlugPanel(t),e.classList.add("active")):this.closePlugPanel()});const n=t.$panel;n&&(n.style.display="none",this.editor.getUI().$plugPanelWrap.appendChild(n))}get(t){return this.plugs.find((e=>e instanceof t))}openPlugPanel(t){this.plugs.forEach((e=>{const n=e.$panel;n&&(e===t?(n.style.display="",this.events.trigger("panel-show",t)):(n.style.display="none",this.events.trigger("panel-hide",t)))})),this.editor.getUI().$plugPanelWrap.style.display="",this.openedPlug=t}closePlugPanel(){this.openedPlug&&(this.editor.getUI().$plugPanelWrap.style.display="none",this.events.trigger("panel-hide",this.openedPlug),this.openedPlug=null)}getTransformedContent(t){let e=t;return this.plugs.forEach((t=>{t.contentTransformer&&(e=t.contentTransformer(e))})),e}}const tn="2.8.5";let en=!1;let nn;function sn(t,e){const n="atk-dark-mode";t.forEach((t=>{e?t.classList.add(n):t.classList.remove(n)}))}const on=[...[t=>{!function(){try{if(!e.marked.name)return}catch(t){return}e.marked.setOptions(c({renderer:st()},ct)),at=e.marked}(),t.on("updated",(t=>{var e;t.markedReplacers&&(e=t.markedReplacers,lt=e)}))},t=>{const e=t.get("editor"),n=new Ze(e);t.inject("editorPlugs",n)},t=>{const e=()=>{var e;e=t.get("user").getData().isAdmin,function(t){const e=[];t.$root.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t)));const n=document.querySelector(".atk-sidebar");return n&&n.querySelectorAll("[atk-only-admin-show]").forEach((t=>e.push(t))),e}({$root:t.$root}).forEach((t=>{e?t.classList.remove("atk-hide"):t.classList.add("atk-hide")}))};t.on("list-loaded",(()=>{e()})),t.on("user-changed",(t=>{e()}))},...[t=>{t.on("list-fetch",(e=>{if(t.getData().getLoading())return;t.getData().setLoading(!0);const n=c({offset:0,limit:t.conf.pagination.pageSize,flatMode:t.conf.flatMode,paramsModifier:t.conf.listFetchParamsModifier},e);t.getData().setListLastFetch({params:n});const i={limit:n.limit,offset:n.offset,flat_mode:n.flatMode,page_key:t.getConf().pageKey,site_name:t.getConf().site};n.paramsModifier&&n.paramsModifier(i),t.getApi().comments.getComments(c(c({},i),t.getApi().getUserFields())).then((({data:e})=>{t.getData().setListLastFetch({params:n,data:e}),t.getData().loadComments(e.comments),t.getData().updatePage(e.page),n.onSuccess&&n.onSuccess(e),t.trigger("list-fetched",{params:n,data:e})})).catch((e=>{const i={msg:e.msg||String(e),data:e.data};throw n.onError&&n.onError(i),t.trigger("list-failed",i),t.trigger("list-fetched",{params:n,error:i}),e})).finally((()=>{t.getData().setLoading(!1)}))}))},t=>{t.on("list-fetch",(e=>{const n=t.get("list");0===e.offset&&_t(!0,n.$el)})),t.on("list-fetched",(()=>{_t(!1,t.get("list").$el)}))},t=>{t.on("comment-rendered",(e=>{if(!0===t.conf.listUnreadHighlight){const n=t.getData().getNotifies(),i=n.find((t=>t.comment_id===e.getID()));i?(e.getRender().setUnread(!0),e.getRender().setOpenAction((()=>{window.open(i.read_link),t.getData().updateNotifies(n.filter((t=>t.comment_id!==e.getID())))}))):e.getRender().setUnread(!1)}})),t.on("list-goto",(e=>{const n=vt("atk_notify_key");n&&t.getApi().notifies.markNotifyRead(e,n).then((()=>{t.getData().updateNotifies(t.getData().getNotifies().filter((t=>t.comment_id!==e)))}))}))},t=>{let e;t.on("mounted",(()=>{const n=t.get("list");e=n.$el.querySelector('[data-action="admin-close-comment"]'),e.addEventListener("click",(()=>{const e=t.getData().getPage();if(!e)throw new Error("Page data not found");e.admin_only=!e.admin_only,function(t,e){t.editorShowLoading(),t.getApi().pages.updatePage(e.id,e).then((({data:e})=>{t.getData().updatePage(e)})).catch((e=>{t.editorShowNotify(`${Mt("editFail")}: ${e.message||String(e)}`,"e")})).finally((()=>{t.editorHideLoading()}))}(t,e)}))})),t.on("page-loaded",(n=>{var i,s;const o=t.get("editor");!0===(null==n?void 0:n.admin_only)?(null==(i=o.getPlugs())||i.getEvents().trigger("editor-close"),e&&(e.innerText=Mt("openComment"))):(null==(s=o.getPlugs())||s.getEvents().trigger("editor-open"),e&&(e.innerText=Mt("closeComment")))})),t.on("list-loaded",(e=>{t.editorResetState()}))},t=>{t.on("list-loaded",(()=>{(()=>{var e,n;const i=t.get("list").$el.querySelector(".atk-comment-count .atk-text");if(!i)return;const s=yt(Mt("counter",{count:`${Number(null==(n=null==(e=t.getData().getListLastFetch())?void 0:e.data)?void 0:n.count)||0}`}));i.innerHTML=s.replace(/(\d+)/,'$1')})()})),t.on("comment-inserted",(()=>{const e=t.getData().getListLastFetch();(null==e?void 0:e.data)&&(e.data.count+=1)})),t.on("comment-deleted",(()=>{const e=t.getData().getListLastFetch();(null==e?void 0:e.data)&&(e.data.count-=1)}))},t=>{let e=null;const n=()=>{if(!e)return;const n=t.get("user").getData();if(n.nick&&n.email){e.classList.remove("atk-hide");const t=e.querySelector(".atk-text");t&&(t.innerText=n.isAdmin?Mt("ctrlCenter"):Mt("msgCenter"))}else e.classList.add("atk-hide")};t.watchConf(["locale"],(i=>{const s=t.get("list");e=s.$el.querySelector('[data-action="open-sidebar"]'),e&&(e.onclick=()=>{t.showSidebar()},n())})),t.on("user-changed",(t=>{n()}))},t=>{let e=null;t.on("mounted",(()=>{const n=t.get("list");e=n.$el.querySelector(".atk-unread-badge")})),t.on("notifies-updated",(t=>{var n;n=t.length||0,e&&(n>0?(e.innerText=`${Number(n||0)}`,e.style.display="block"):e.style.display="none")}))},t=>{const e=e=>{t.conf.listFetchParamsModifier=e,t.reload()},n=t=>{!function(t){const{$dropdownWrap:e,dropdownList:n}=t;if(e.querySelector(".atk-dropdown"))return;e.classList.add("atk-dropdown-wrap"),e.append(ft(''));let i=0;const s=(t,e,n,s)=>{s(),i=t,o.querySelectorAll(".active").forEach((t=>{t.classList.remove("active")})),e.classList.add("active"),o.style.display="none",setTimeout((()=>{o.style.display=""}),80)},o=ft('
            ');n.forEach(((t,e)=>{const n=t[0],r=t[1],a=ft('
          • '),l=a.querySelector("span");l.innerText=n,l.onclick=()=>{s(e,a,n,r)},o.append(a),e===i&&a.classList.add("active")})),e.append(o)}({$dropdownWrap:t,dropdownList:[[Mt("sortLatest"),()=>{e((t=>{t.sort_by="date_desc"}))}],[Mt("sortBest"),()=>{e((t=>{t.sort_by="vote"}))}],[Mt("sortOldest"),()=>{e((t=>{t.sort_by="date_asc"}))}],[Mt("sortAuthor"),()=>{e((t=>{t.view_only_admin=!0}))}]]})};t.watchConf(["listSort","locale"],(e=>{const i=t.get("list").$el.querySelector(".atk-comment-count");i&&(e.listSort?n(i):function(t){var e,n;const{$dropdownWrap:i}=t;i.classList.remove("atk-dropdown-wrap"),null==(e=i.querySelector(".atk-arrow-down-icon"))||e.remove(),null==(n=i.querySelector(".atk-dropdown"))||n.remove()}({$dropdownWrap:i}))}))},t=>{let e=0;const n=({locker:n})=>{const i=function(){const t=window.location.hash.match(/#atk-comment-([0-9]+)/);let e=t&&t[1]&&!Number.isNaN(parseFloat(t[1]))?parseFloat(t[1]):null;e||(e=Number(vt("atk_comment")));return e||null}();i&&(n&&e===i||(e=i,t.trigger("list-goto",i)))},i=()=>n({locker:!1}),s=()=>n({locker:!0});t.on("mounted",(()=>{window.addEventListener("hashchange",i),t.on("list-loaded",s)})),t.on("unmounted",(()=>{window.removeEventListener("hashchange",i),t.off("list-loaded",s)}))},t=>{t.on("list-goto",(e=>u(this,null,(function*(){let n=t.getCommentNodes().find((t=>t.getID()===e));if(!n){const i=(yield t.getApi().comments.getComment(e)).data;t.get("list").getListLayout({forceFlatMode:!0}).insert(i.comment,i.reply_comment),n=t.getCommentNodes().find((t=>t.getID()===e))}n&&n.focus()}))))},t=>{t.on("list-loaded",(e=>{const n=t.get("list"),i=e.length<=0;let s=n.getCommentsWrapEl().querySelector(".atk-list-no-comment");i?s||(s=ft('
            '),s.innerHTML=tt(n.ctx.conf.noComment||n.ctx.$t("noComment")),n.getCommentsWrapEl().appendChild(s)):null==s||s.remove()}))},t=>{t.on("mounted",(()=>{const e=t.get("list").$el.querySelector(".atk-copyright");e&&(e.innerHTML=`Powered By Artalk`)}))},t=>{let e=null;t.on("mounted",(()=>{e=window.setInterval((()=>{t.get("list").$el.querySelectorAll("[data-atk-comment-date]").forEach((e=>{const n=e.getAttribute("data-atk-comment-date");e.innerText=bt(new Date(Number(n)),t.$t)}))}),3e4)})),t.on("unmounted",(()=>{e&&window.clearInterval(e)}))},t=>{t.on("list-fetch",(()=>{Wt(t.get("list").$el,null)})),t.on("list-failed",(e=>{We({$err:t.get("list").$el,errMsg:e.msg,errData:e.data,retryFn:()=>t.fetch({offset:0})})}))},t=>{let e=null;const n=()=>{null==e||e.disconnect(),e=null};t.on("list-loaded",(()=>{n();const i=t.get("list").getCommentsWrapEl().childNodes,s=i.length>2?i[i.length-2]:null;s&&("IntersectionObserver"in window?(i=>{const s=t.conf.scrollRelativeTo&&t.conf.scrollRelativeTo()||null;e=new IntersectionObserver((([e])=>{e.isIntersecting&&(n(),t.trigger("list-reach-bottom"))}),{threshold:.9,root:s}),e.observe(i)})(s):console.warn("IntersectionObserver api not supported"))})),t.on("unmounted",(()=>{n()}))},t=>{const e=()=>{const e=t.get("list"),n=t.conf.scrollRelativeTo&&t.conf.scrollRelativeTo();(n||window).scroll({top:kt(e.$el,n).top,left:0})};t.on("mounted",(()=>{t.on("list-goto-first",e)})),t.on("unmounted",(()=>{t.off("list-goto-first",e)}))}],t=>{t.on("list-fetch",(e=>{if(0!==e.offset)return;const n=t.getApi().getUserFields();n&&t.getApi().notifies.getNotifies(n).then((e=>{t.getData().updateNotifies(e.data.notifies)}))}))},t=>{t.watchConf(["site","pageKey","pageTitle","countEl","pvEl"],(e=>{Fe({getApi:()=>t.getApi(),siteName:e.site,pageKey:e.pageKey,pageTitle:e.pageTitle,countEl:e.countEl,pvEl:e.pvEl,pvAdd:"boolean"!=typeof t.conf.pvAdd||t.conf.pvAdd})}))},t=>{t.watchConf(["apiVersion","versionCheck"],(e=>{const n=t.get("list");e.apiVersion&&e.versionCheck&&!en&&function(t,e,n){const i=function(t,e){const n=t.split("."),i=e.split(".");for(let s=0;s<3;s++){const t=Number(n[s]),e=Number(i[s]);if(t>e)return 1;if(e>t)return-1;if(!Number.isNaN(t)&&Number.isNaN(e))return 1;if(Number.isNaN(t)&&!Number.isNaN(e))return-1}return 0}(e,n);if(0===i)return;const s=ft(`
            ${Mt("updateMsg",{name:Mt(i<0?"frontend":"backend")})} ${Mt("currentVersion")}: ${Mt("frontend")} ${e} / ${Mt("backend")} ${n}
            `),o=ft(`${Mt("ignore")}`);o.onclick=()=>{s.remove(),en=!0},s.append(o),t.$el.parentElement.prepend(s)}(n,tn,e.apiVersion)}))},t=>{let e;const n=n=>{const i=[t.$root,t.get("layerManager").getEl()];nn||(nn=window.matchMedia("(prefers-color-scheme: dark)")),"auto"===n?(e||(e=t=>sn(i,t.matches),nn.addEventListener("change",e)),sn(i,nn.matches)):(e&&(nn.removeEventListener("change",e),e=void 0),sn(i,n))};t.watchConf(["darkMode"],(t=>n(t.darkMode))),t.on("created",(()=>n(t.conf.darkMode))),t.on("unmounted",(()=>{e&&(null==nn||nn.removeEventListener("change",e)),e=void 0}))}]];function rn(t){return u(this,null,(function*(){var e;const n=[],i=e=>{e.forEach((e=>{"function"!=typeof e||n.includes(e)||(e(t),n.push(e))}))};i(on);const{data:s}=yield t.getApi().conf.conf().catch((e=>{throw function(t,e){var n;let i="";if(null==(n=e.data)?void 0:n.err_no_site){const e={create_name:t.conf.site,create_urls:`${window.location.protocol}//${window.location.host}`};i=`sites|${JSON.stringify(e)}`}We({$err:t.get("list").$el,errMsg:e.msg||String(e),errData:e.data,retryFn:()=>rn(t),onOpenSidebar:t.get("user").getData().isAdmin?()=>t.showSidebar({view:i}):void 0})}(t,e),e}));let o={apiVersion:null==(e=s.version)?void 0:e.version};if(t.conf.useBackendConf){if(!s.frontend_conf)throw new Error("The remote backend does not respond to the frontend conf, but `useBackendConf` conf is enabled");o=c(c({},o),function(t){const e=["el","pageKey","pageTitle","server","site","darkMode"];return Object.keys(t).forEach((n=>{e.includes(n)&&delete t[n]})),t.emoticons&&"string"==typeof t.emoticons&&(t.emoticons=t.emoticons.trim(),t.emoticons.startsWith("[")||t.emoticons.startsWith("{")?t.emoticons=JSON.parse(t.emoticons):"false"===t.emoticons&&(t.emoticons=!1)),t}(s.frontend_conf))}t.conf.remoteConfModifier&&t.conf.remoteConfModifier(o),o.pluginURLs&&(yield function(t,e){return u(this,null,(function*(){if(!t||!Array.isArray(t))return[];const n=[];return t.forEach((t=>{/^(http|https):\/\//.test(t)||(t=`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`),n.push(new Promise(((e,n)=>{if(document.querySelector(`script[src="${t}"]`))return void e();const i=document.createElement("script");i.src=t,document.head.appendChild(i),i.onload=()=>e(),i.onerror=t=>n(t)})))})),yield Promise.all(n),Object.values(window.ArtalkPlugins||{})}))}(o.pluginURLs,t.conf.server).then((t=>{i(t)})).catch((t=>{console.error("Failed to load plugin",t)}))),t.trigger("created"),t.updateConf(o),t.trigger("mounted"),t.conf.remoteConfModifier||t.fetch({offset:0})}))}class an{constructor(t){h(this,"ctx");const e=Ut(t,!0);this.ctx=new qt(e),Object.entries(_e).forEach((([t,e])=>{const n=e(this.ctx);n&&this.ctx.inject(t,n)})),rn(this.ctx)}getConf(){return this.ctx.getConf()}getEl(){return this.ctx.$root}update(t){return this.ctx.updateConf(t),this}reload(){this.ctx.reload()}destroy(){for(this.ctx.trigger("unmounted");this.ctx.$root.firstChild;)this.ctx.$root.removeChild(this.ctx.$root.firstChild)}on(t,e){this.ctx.on(t,e)}off(t,e){this.ctx.off(t,e)}trigger(t,e){this.ctx.trigger(t,e)}setDarkMode(t){this.ctx.setDarkMode(t)}static init(t){return new an(t)}static use(t){on.includes(t)||on.push(t)}static loadCountWidget(t){const e=Ut(t,!0);Fe({getApi:()=>new k(It(e)),siteName:e.site,countEl:e.countEl,pvEl:e.pvEl,pvAdd:!1})}get $root(){return this.ctx.$root}get conf(){return this.ctx.getConf()}}const ln=an.init,cn=an.use,dn=an.loadCountWidget;t.default=an,t.init=ln,t.loadCountWidget=dn,t.use=cn,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); //# sourceMappingURL=ArtalkLite.js.map diff --git a/dependencies.json b/dependencies.json index 161706815..205e4c4af 100644 --- a/dependencies.json +++ b/dependencies.json @@ -71,7 +71,7 @@ }, { "name": "artalk", - "version": "2.8.4", + "version": "2.8.5", "files": [ { "remote": "dist/Artalk.js",