"use strict";(self.webpackChunknodebb=self.webpackChunknodebb||[]).push([[65928,87212,87549],{25967:(E,A,T)=>{var P,w;P=[T(40027)],w=function(g){const d={};return d.init=function(){$("body").on("click",'[component="pagination/select-page"]',function(){return g.prompt("[[global:enter-page-number]]",function(i){d.loadPage(i)}),!1})},d.loadPage=function(i,I){if(I=I||function(){},i=parseInt(i,10),!utils.isNumber(i)||i<1||i>ajaxify.data.pagination.pageCount)return;const _=utils.params();_.page=i;const Y=window.location.pathname+"?"+$.param(_);ajaxify.go(Y,I)},d.nextPage=function(i){d.loadPage(ajaxify.data.pagination.currentPage+1,i)},d.previousPage=function(i){d.loadPage(ajaxify.data.pagination.currentPage-1,i)},d}.apply(A,P),w!==void 0&&(E.exports=w)},68636:(E,A,T)=>{var P;P=function(){function w(){this._store={},this._keys=[]}w.prototype.isMock=!0,w.prototype.setItem=function(i,I){i=String(i),this._keys.indexOf(i)===-1&&this._keys.push(i),this._store[i]=I},w.prototype.getItem=function(i){return i=String(i),this._keys.indexOf(i)===-1?null:this._store[i]},w.prototype.removeItem=function(i){i=String(i),this._keys=this._keys.filter(function(I){return I!==i}),this._store[i]=null},w.prototype.clear=function(){this._keys=[],this._store={}},w.prototype.key=function(i){return i=parseInt(i,10)||0,this._keys[i]},Object.defineProperty&&Object.defineProperty(w.prototype,"length",{get:function(){return this._keys.length}});let g;const d=Date.now().toString();try{if(g=window.localStorage,g.setItem(d,d),g.getItem(d)!==d)throw Error("localStorage behaved unexpectedly");return g.removeItem(d),g}catch(i){console.warn(i),console.warn("localStorage failed, falling back on sessionStorage");try{if(g=window.sessionStorage,g.setItem(d,d),g.getItem(d)!==d)throw Error("sessionStorage behaved unexpectedly");return g.removeItem(d),g}catch(I){return console.warn(I),console.warn("sessionStorage failed, falling back on memory storage"),new w}}}.call(A,T,A,E),P!==void 0&&(E.exports=P)},96352:(E,A,T)=>{var P,w;P=[T(25967),T(52473),T(91749),T(29930),T(17459),T(68636)],w=function(g,d,i,I,_,Y){const o={};let l=0,x=0,M=0,K,S,O,B,R,C=!1,k=!0,H="";o.scrollActive=!1;let c=$(".pagination-block"),F=c.find(".pagination-text"),tt=c.find("meter"),ot=c.find(".progress-bar"),W=c.find(".unread"),v;$(window).on("action:ajaxify.start",function(){$(window).off("keydown",J)}),o.init=function(t,e,a,n,p){l=0,o.selector=t,o.callback=p,o.toTop=a||function(){},o.toBottom=n||function(){},c=$(".pagination-block"),F=c.find(".pagination-text"),tt=c.find("meter"),ot=c.find(".progress-bar"),W=c.find(".unread"),v=$(".scroller-thumb"),H=utils.findBootstrapEnvironment(),$(window).off("scroll",o.delayedUpdate).on("scroll",o.delayedUpdate),c.find(".dropdown-menu").off("click").on("click",function(r){r.stopPropagation()}),c.off("shown.bs.dropdown",".wrapper").on("shown.bs.dropdown",".wrapper",function(){const r=$(this);setTimeout(async function(){["lg","xl","xxl"].includes(utils.findBootstrapEnvironment())&&r.find("input").trigger("focus"),await socket.emit("topics.getPostCountInTopic",ajaxify.data.tid)>0&&c.find("#myNextPostBtn").removeAttr("disabled")},100)}),c.find(".pageup").off("click").on("click",o.scrollUp),c.find(".pagedown").off("click").on("click",o.scrollDown),c.find(".pagetop").off("click").on("click",o.toTop),c.find(".pagebottom").off("click").on("click",o.toBottom),c.find(".pageprev").off("click").on("click",g.previousPage),c.find(".pagenext").off("click").on("click",g.nextPage),c.find("#myNextPostBtn").off("click").on("click",at),c.find("input").on("keydown",function(r){if(r.which===13){const h=$(this);if(!utils.isNumber(h.val())){h.val("");return}const b=parseInt(h.val(),10),f=D(b);h.val(""),c.find(".dopdown-menu.show").removeClass("show"),ajaxify.go(f)}}),ajaxify.data.template.topic&&(st(),M=ajaxify.data.postcount,nt(ajaxify.data.postIndex)),ct(),o.setCount(e),o.update()};let X=0;async function at(){async function t(e){return await socket.emit("topics.getMyNextPostIndex",{tid:ajaxify.data.tid,index:Math.max(1,e),sort:config.topicPostSort})}if(ajaxify.data.template.topic){let e=await t(l);X===e&&(e=await t(e)),e&&l!==e+1?(X=e,$(window).one("action:ajaxify.end",function(){c.find(".dropdown-menu").is(":hidden")&&c.find(".dropdown-toggle").dropdown("toggle")}),o.scrollToIndex(e,!0,0)):(I.alert({message:"[[topic:no-more-next-post]]",type:"info"}),X=1)}}function N(t,e){const a=t.parent(),n=a.offset(),r=t.find(".scroller-thumb-icon").height();return en.top+a.height()-r&&(e=n.top+a.height()-r),e}function L(t){!v||!v.length||!v.is(":visible")||(v.each((e,a)=>{const n=$(a);if(n.is(":hidden"))return;const p=n.parent(),r=p.offset(),b=n.find(".scroller-thumb-icon").height(),f=(p.height()-b)/(ajaxify.data.postcount-1),s={top:N(n,r.top+(t-1)*f),left:n.offset().left};n.offset(s),V(n,t),et(n,t)}),nt(t),G(t))}function V(t,e){H==="xs"||H==="sm"||H==="md"?t.find(".thumb-text").text(`${e}/${ajaxify.data.postcount}`):t.find(".thumb-text").translateText(`[[topic:navigator.index, ${e}, ${ajaxify.data.postcount}]]`)}async function et(t,e){const a=t.find(".thumb-timestamp");if(a.length){const n=ajaxify.data.posts.find(r=>parseInt(r.index,10)===Math.max(0,parseInt(e,10)-1)),p=n?n.timestamp:await it(e);a.attr("title",utils.toISOString(p)).timeago()}}async function it(t){const e=$(`[component="post"][data-index=${t-1}]`);return e.length?parseInt(e.attr("data-timestamp"),10):await socket.emit("posts.getPostTimestampByIndex",{tid:ajaxify.data.tid,index:t-1})}function st(){if(!v.length)return;v.parent().off("click").on("click",function(f){if($(f.target).hasClass("scroller-container")){const y=$(f.target).find(".scroller-thumb"),s=e(y,f.pageY);return o.scrollToIndex(s-1,!0,0),!1}});function e(f,y){const s=f.parent(),m=f.find(".scroller-thumb-icon").height(),j=N(f,y-m/2),Q=s.offset(),Z=(j-Q.top)/(s.height()-m);return l=Math.max(1,Math.ceil(ajaxify.data.postcount*Z)),l>ajaxify.data.postcount?ajaxify.data.postcount:l}let a=!1;i.on("action:ajaxify.end",function(){R=null}),c.find(".dropdown-menu").parent().off("shown.bs.dropdown").on("shown.bs.dropdown",function(){L(l)});let n=null;const p=utils.debounce(et,50);function r(f){if(!n||!n.length)return;const s=n.find(".scroller-thumb-icon").height(),u=N(n,f.pageY-s/2);n.offset({top:u,left:n.offset().left});const m=e(n,f.pageY);return o.updateTextAndProgressBar(),V(n,m),p(n,m),k&&b(),k=!1,f.stopPropagation(),!1}v.off("mousedown").on("mousedown",function(f){f.originalEvent.button===0&&(a=!0,n=$(this),n.addClass("active"),$(window).on("mousemove",r),k=!0)});function h(){$(window).off("mousemove",r),a&&(o.scrollToIndex(l-1,!0,0),c.find(".dropdown-menu.show").removeClass("show")),z(),a=!1,k=!1,n&&n.length&&n.removeClass("active"),n=null}function b(){z(),S=setInterval(function(){G(l)},250)}$(window).off("mousemove",r),$(window).off("mouseup",h).on("mouseup",h),v.each((f,y)=>{const s=$(y);s.off("touchstart").on("touchstart",function(u){C=!0,O=Math.min($(window).width(),Math.max(0,u.touches[0].clientX)),B=Math.min($(window).height(),Math.max(0,u.touches[0].clientY)),k=!0,s.addClass("active")}),s.off("touchmove").on("touchmove",function(u){const m=$(window).width(),j=$(window).height(),Q=Math.abs(O-Math.min(m,Math.max(0,u.touches[0].clientX))),Z=Math.abs(B-Math.min(j,Math.max(0,u.touches[0].clientY)));if(O=Math.min(m,Math.max(0,u.touches[0].clientX)),B=Math.min(j,Math.max(0,u.touches[0].clientY)),Z>=Q&&k&&(C=!0,b()),C&&u.cancelable){u.preventDefault(),u.stopPropagation();const rt=s.find(".scroller-thumb-icon").height(),lt=N(s,B+$(window).scrollTop()-rt/2);s.offset({top:lt,left:s.offset().left});const q=e(s,B+$(window).scrollTop());o.updateTextAndProgressBar(),V(s,q),p(s,q),k&&G(q)}k=!1}),s.off("touchend").on("touchend",function(){z(),C&&(s.removeClass("active"),o.scrollToIndex(l-1,!0,0),C=!1,c.find(".dropdown-menu.show").removeClass("show"))})})}async function nt(t){const{bookmarkThreshold:e}=ajaxify.data;if(!W.length||ajaxify.data.postcount<=e||!e)return;const a=ajaxify.data.bookmark||Y.getItem("topic:"+ajaxify.data.tid+":bookmark");t=Math.max(t,Math.min(a,ajaxify.data.postcount));const n=W.get(0),p=n.parentNode,r=p.getBoundingClientRect().height,h=1-t/ajaxify.data.postcount;n.style.height=`${r*h}px`;const b=p.querySelector(".scroller-thumb"),f=parseInt(b.style.height,10),y=parseInt(b.style.top||0,10)+f,s=n.querySelector(".meta a");M=Math.min(M,ajaxify.data.postcount-t);function u(m){s.innerText=m,s.setAttribute("aria-disabled",m?"false":"true"),m?s.removeAttribute("tabindex"):s.setAttribute("tabindex",-1)}if(M>0&&r-y>=f){const m=await _.translate(`[[topic:navigator.unread, ${M}]]`);s.href=`${config.relative_path}/topic/${ajaxify.data.slug}/${Math.min(t+1,ajaxify.data.postcount)}`,u(m)}else s.href=ajaxify.data.url,u("")}function z(){S&&(clearInterval(S),S=0)}async function G(t){if(!t||R===t||!c.find(".post-content").is(":visible"))return;R=t;const e=await socket.emit("posts.getPostSummaryByIndex",{tid:ajaxify.data.tid,index:t-1}),a=await app.parseAndTranslate("partials/topic/navigation-post",{post:e});c.find(".post-content").html(a).find(".timeago").timeago()}function ct(){config.usePagination||$(window).off("keydown",J).on("keydown",J)}function J(t){if(t.target.nodeName==="BODY"){if(t.shiftKey||t.ctrlKey||t.altKey)return;if(t.which===36&&o.toTop)return o.toTop(),!1;if(t.which===35&&o.toBottom)return o.toBottom(),!1}}function D(t){const a=window.location.pathname.replace(config.relative_path,"").split("/");return a[1]+"/"+a[2]+"/"+a[3]+(t?"/"+t:"")}o.getCount=()=>x,o.setCount=function(t){t=parseInt(t,10),t!==x&&(x=t,o.updateTextAndProgressBar(),U(x>0))},o.show=function(){U(!0)},o.disable=function(){x=0,l=1,o.callback=null,o.selector=null,$(window).off("scroll",o.delayedUpdate),U(!1)};function U(t){t&&!ajaxify.data.template.topic&&!ajaxify.data.template.category||(c.toggleClass("ready",t),c.toggleClass("noreplies",x<=1))}return o.delayedUpdate=function(){K||(K=setTimeout(function(){o.update(),K=void 0},100))},o.update=function(){let t=l;const e=$(o.selector).filter((y,s)=>!s.getAttribute("data-navigator-ignore"));e.length&&(t=parseInt(e.first().attr("data-index"),10)+1);const a=$(window).scrollTop(),n=$(window).height(),p=$(document).height(),r=a+n/2;let h=Number.MAX_VALUE;e.each(function(){const y=$(this),s=parseInt(y.attr("data-index"),10);if(s>=0){const u=Math.abs(r-(y.offset().top+y.outerHeight(!0)/2));if(u>h)return!1;up-100&&parseInt(e.last().attr("data-index"),10)===x-1;b?t=1:f&&(t=x),i.fire("action:navigator.update",{newIndex:t,index:l}),t!==l&&(typeof o.callback=="function"&&o.callback(t,x),l=t,o.updateTextAndProgressBar(),L(l)),U(x>0)},o.getIndex=()=>l,o.setIndex=t=>{l=t+1,typeof o.callback=="function"&&o.callback(l,x),o.updateTextAndProgressBar(),L(l)},o.updateTextAndProgressBar=function(){if(!utils.isNumber(l))return;l=l>x?x:l,config.usePagination?F.html(` ${ajaxify.data.pagination.currentPage} / ${ajaxify.data.pagination.pageCount}`):F.translateHtml("[[global:pagination.out-of, "+l+", "+x+"]]");const t=(l-1)/(x-1||1);tt.val(t),ot.width(t*100+"%")},o.scrollUp=function(){const t=$(window);if(config.usePagination&&t.scrollTop()<=0)return g.previousPage(function(){$("body,html").scrollTop($(document).height()-t.height())});$("body,html").animate({scrollTop:t.scrollTop()-t.height()})},o.scrollDown=function(){const t=$(window);if(config.usePagination&&t.scrollTop()>=$(document).height()-t.height())return g.nextPage();$("body,html").animate({scrollTop:t.scrollTop()+t.height()})},o.scrollTop=function(t){$(`${o.selector}[data-index="${t}"]:not([data-navigator-ignore])`).length?o.scrollToIndex(t,!0):ajaxify.go(D())},o.scrollBottom=function(t){parseInt(t,10)<0||($(`${o.selector}[data-index="${t}"]:not([data-navigator-ignore])`).length?o.scrollToIndex(t,!0):(t=parseInt(t,10)+1,ajaxify.go(D(t))))},o.scrollToIndex=function(t,e,a){const n=ajaxify.data.template.topic,p=ajaxify.data.template.category;if(!utils.isNumber(t)||!n&&!p)return;if(a=a!==void 0?a:400,o.scrollActive=!0,n&&d.get("post/anchor",t).length)return o.scrollToPostIndex(t,e,a);if(p&&$('[component="category/topic"][data-index="'+t+'"]').length)return o.scrollToTopicIndex(t,e,a);if(!config.usePagination){o.scrollActive=!1,t=parseInt(t,10)+1,ajaxify.go(D(t));return}const r=n?o.scrollToPostIndex:o.scrollToTopicIndex,h=1+Math.floor(t/config.postsPerPage);parseInt(h,10)!==ajaxify.data.pagination.currentPage?g.loadPage(h,function(){r(t,e,a)}):r(t,e,a)},o.shouldScrollToPost=function(t){if(!ajaxify.data.template.topic||t<=1)return!1;const e=$('[component="topic"] [component="post"]').first();return parseInt(e.attr("data-index"),10)!==t-1},o.scrollToPostIndex=function(t,e,a){const n=$(`[component="post"][data-index="${t}"]:not([data-navigator-ignore])`);o.scrollToElement(n,e,a,t)},o.scrollToTopicIndex=function(t,e,a){const n=$('[component="category/topic"][data-index="'+t+'"]');o.scrollToElement(n,e,a,t)},o.scrollToElement=async(t,e,a,n=null)=>{if(!t.length){o.scrollActive=!1;return}await i.fire("filter:navigator.scroll",{scrollTo:t,highlight:e,duration:a,newIndex:n+1});const p=t.outerHeight(!0),r=d.get("navbar").outerHeight(!0)||0,h=$(".topic-main-buttons").outerHeight(!0)||0,b=$(window).height();$(window).off("scroll",o.delayedUpdate),a=a!==void 0?a:400,o.scrollActive=!0;let f=!1;function y(){function u(){setTimeout(()=>{$(window).off("scroll",o.delayedUpdate).on("scroll",o.delayedUpdate),i.fire("action:navigator.scrolled",{scrollTo:t,highlight:e,duration:a,newIndex:n+1})},50)}function m(){if(f){u();return}f=!0,o.scrollActive=!1,s(),n?o.setIndex(n):o.update()}let j=0;if(p