!function s(a,r,u){function c(e,t){if(!r[e]){if(!a[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(l)return l(e,!0);var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}var o=r[e]={exports:{}};a[e][0].call(o.exports,function(t){return c(a[e][1][t]||t)},o,o.exports,s,a,r,u)}return r[e].exports}for(var l="function"==typeof require&&require,t=0;t").concat(s,"");this.$year.html(r)}},{key:"populateMonth",value:function(t,e){var n=this.opts,i=n.minDate,o=n.maxDate,s=n.defaultDate,a=n.monthNames,r=i.getFullYear(),u=o.getFullYear(),c=r").concat(a[c-1],"");this.$month.html(p)}},{key:"populateDate",value:function(t,e,n){var i=this.opts,o=i.minDate,s=i.maxDate,a=i.defaultDate,r=o.getFullYear(),u=s.getFullYear(),c=o.getMonth()+1,l=s.getMonth()+1,p=r").concat(p,"");this.$date.html(d)}},{key:"onChangeYear",value:function(t){var e=+t.target.value;this.populateMonth(e),this.$month.triggerHandler("change")}},{key:"onChangeMonth",value:function(t){var e=+this.$year.val(),n=+t.target.value;this.populateDate(e,n),this.$date.triggerHandler("change")}},{key:"onChangeDate",value:function(){this.opts.onSelect(this.getDate())}}]),u}(),f=function(t,e){return new Date(t,e,0).getDate()},o=function(t){var e=t.split("-");return new Date(+e[0],e[1]-1,+e[2])},s=function(t){var e=t.getFullYear(),n=t.getMonth()+1,i=t.getDate();return[e,(n<10?"0":"")+n,(i<10?"0":"")+i].join("-")},a=n;r.default=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DateSelector",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(n,"TimeSelector",{enumerable:!0,get:function(){return o.default}});var i=s(t("./date-selector")),o=s(t("./time-selector"));function s(t){return t&&t.__esModule?t:{default:t}}},{"./date-selector":2,"./time-selector":4}],4:[function(t,e,l){(function(t){"use strict";Object.defineProperty(l,"__esModule",{value:!0}),l.default=void 0;var e,a=(e="undefined"!=typeof window?window.jQuery:void 0!==t?t.jQuery:null)&&e.__esModule?e:{default:e};function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],i=!0,o=!1,s=void 0;try{for(var a,r=t[Symbol.iterator]();!(i=(a=r.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){o=!0,s=t}finally{try{i||null==r.return||r.return()}finally{if(o)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(t,e){for(var n=0;n").concat(e<10?"0":"").concat(e,"");this.$hour.html(i)}},{key:"populateMinute",value:function(t){for(var e=0,n="";e<=59;e+=this.opts.step)n+='");this.$minute.html(n)}},{key:"populateAmpm",value:function(t){if(this.isAmpm){for(var e=[{value:"AM",label:this.opts.am},{value:"PM",label:this.opts.pm}],n="",i=0;i").concat(e[i].label||e[i].value,"");this.$ampm.html(n)}}},{key:"onChangeHour",value:function(){this.opts.onSelect(this.getTime())}},{key:"onChangeMinute",value:function(){this.opts.onSelect(this.getTime())}},{key:"onChangeAmpm",value:function(){this.opts.onSelect(this.getTime())}}]),s}(),u=function(t,e){return t="PM"!==e.toUpperCase()?12===t?0:t:12===t?12:t+12},c=function(t){var e;return{hour:t=t<12?(e="AM",0===t?12:t):(e="PM",12===t?12:t-12),ampm:e}},s=n;l.default=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e,n){"use strict";function i(t){var e=r(t.currentTarget).closest(".ps-js-dropdown"),n=e.find(".ps-js-dropdown-menu"),i=r(document),o=e.data("ps-guid");if(t.preventDefault(),o||(o=_.uniqueId("ps-dropdown-"),e.data("ps-guid",o)),n.is(":visible"))return t.stopPropagation(),i.off("click."+o),void n.hide();n.show(),i.one("click."+o,function(){n.hide()})}function o(t){var e,n="[class*=ps-icon-]",i=".ps-js-dropdown-label",o=r(t.currentTarget),s=o.closest(".ps-js-dropdown"),a=s.find(".ps-js-dropdown-toggle");s.hasClass("ps-js-dropdown--privacy")&&((e=s.children("[type=hidden]")).val(o.data("option-value")),e.triggerHandler("change"),a.find(n).attr("class",o.find(n).attr("class")),a.find(i).html(o.find(i).html()))}var r;(r=jQuery)(function(){r(document).on("click.ps-dropdown",".ps-js-dropdown-menu a",o).on("click.ps-dropdown",".ps-js-dropdown-toggle",i)})},{}],6:[function(t,e,s){(function(t){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.default=void 0;var u=e("undefined"!=typeof window?window.jQuery:void 0!==t?t.jQuery:null),c=e("undefined"!=typeof window?window._:void 0!==t?t._:null);function e(t){return t&&t.__esModule?t:{default:t}}function i(t,e){for(var n=0;nn;)1===i&&(this.$menuMore.insertBefore(this.$menuDropdown.parent()),this.$menuMore.show(),this.$menuMore.on("click",function(t){t.preventDefault(),t.stopPropagation(),e.toggleDropdown()})),(t=this.$menuMore.prevAll(".ps-focus__menu-item:visible").first()).length&&(t=t.hide().clone(),this.$menuDropdown.prepend(t.css("display","")))}},{key:"toggleDropdown",value:function(){var t=this,e=(0,u.default)(document),n="click.".concat(l);this.$menuDropdown.is(":visible")?(this.$menuDropdown.hide(),e.off(n)):(this.$menuDropdown.show(),e.one(n,function(){return t.$menuDropdown.hide()}))}},{key:"attachScroller",value:function(){var i,o,s,a=!1,r=!1;this.$menuInner.on("mousedown mouseup mousemove mouseleave",function(t){if(t.preventDefault(),t.stopPropagation(),"mousedown"===t.type)r=!(a=!0),i=[t.clientX,t.clientY];else if("mousemove"==t.type&&a){var e=(0,u.default)(this);o=[t.clientX,t.clientY],s=[o[0]-i[0],o[1]-i[1]],e.scrollLeft(e.scrollLeft()-s[0]),e.scrollTop(e.scrollTop()-s[1]),i=[t.clientX,t.clientY],r=!0}else if(("mouseup"===t.type||"mouseleave"===t.type)&&(a=!1,r)){var n=(0,u.default)(t.target).closest("a");n.length&&(n.on("click.".concat(l),function(t){return t.preventDefault()}),c.default.defer(function(){return n.off("click.".concat(l))}))}})}},{key:"detachScroller",value:function(){this.$menuInner.off("mousedown mouseup mousemove mouseleave")}}]),e}();s.default=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(u,t,c){(function(t){"use strict";Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var i=e("undefined"!=typeof window?window.jQuery:void 0!==t?t.jQuery:null),o="undefined"!=typeof window?window.peepso:void 0!==t?t.peepso:null,s=e(u("./focus-area-footer"));function e(t){return t&&t.__esModule?t:{default:t}}function a(t,e){for(var n=0;n").append(h.hovercard.template)).css({position:"absolute"}),(r=(0,l.default)("
").css({display:"none",height:1,overflow:"visible",position:"absolute",width:1,zIndex:100001})).on("mouseenter touchstart",function(t){t.stopPropagation(),f()}),r.on("mouseleave",function(t){t.stopPropagation(),v()}),r.append(u).appendTo(document.body),r),"loading"===t?r.find(".ps-js-loading").show():t&&(r.find(".ps-js-loading").hide(),r.find(".ps-js-name").html(t.name),r.find(".ps-js-avatar").attr("src",t.avatar),r.find(".ps-js-cover").css({backgroundImage:"url(".concat(encodeURI(t.cover),")")}),r.find(".ps-js-views").html(t.views||0),r.find(".ps-js-likes").html(t.likes||0),r.find(".ps-js-link").attr("href",t.link||"#"),p.observer.doAction("hovercard_update_html",r,t)),r.show(),p.default.isTouch()&&(0,l.default)(document).off("touchstart.hovercard").one("touchstart.hovercard",v),e&&e.currentTarget&&e.clientX){var n=(0,l.default)(e.currentTarget),i=n.offset(),o=window.innerWidth<=480;u.css({top:"",left:0,bottom:0,right:o?0:""}),r.css({top:i.top-r.height(),left:o?0:e.clientX,right:o?0:"",width:o?"":1});var s=u.get(0).getBoundingClientRect();s.top<0&&(r.css({top:i.top+n.height()}),u.css({bottom:"",top:0})),o||s.right>(window.innerWidth||document.documentElement.clientWidth)&&u.css({left:"",right:0})}}function v(){r&&(c=setTimeout(function(){r.hide(),p.default.isTouch()&&(0,l.default)(document).off("touchstart.hovercard")},200))}var o=function(){function s(t,e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),n(this,"$elem",void 0),n(this,"id",void 0),n(this,"data",void 0),n(this,"timer",void 0),this.id=e,this.$elem=(0,l.default)(t),this.$elem.on("mouseenter touchstart",function(t){t.stopPropagation(),i.show(t)}),this.$elem.on("mouseleave",function(t){t.stopPropagation(),i.hide()}),p.default.isTouch()&&this.$elem.on("click",function(t){t.preventDefault(),t.stopPropagation()}),p.observer.addAction("profile_update_like",function(t,e){if(+t==+i.id){var n=s.cache[i.id];n&&(n.likes=e)}},10,2)}return function(t,e,n){e&&i(t.prototype,e),n&&i(t,n)}(s,[{key:"getData",value:function(){var o=this;return new p.Promise(function(e,n){var i=s.cache[o.id];i?e(i):p.default.postJson("hovercard.info",{userid:o.id},function(t){t.success?(i=s.cache[o.id]=t.data,e(i)):n()})})}},{key:"show",value:function(n){var i=this;this.timer=setTimeout(function(){var e=setTimeout(function(){f("loading",n)},500);i.getData().then(function(t){clearTimeout(e),i.timer&&f(t,n)})},300)}},{key:"hide",value:function(){clearTimeout(this.timer),this.timer=null,v()}}]),s}();n(o,"cache",{});var s=o;m.default=s,(0,l.default)(function(){h.hovercard&&(0,l.default)(document).on("mouseenter touchstart","[data-hover-card]",function(t){var e=(0,l.default)(t.currentTarget);if(!e.data("ps-hovercard")){var n=e.data("hover-card"),i=new o(e[0],n);e.data("ps-hovercard",i),i.show(t)}})})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(t,e,n){"use strict";t("./autosize"),t("./dropdown"),t("./share"),t("./time"),t("./safety-warning"),t("./posttabs"),t("./postbox-legacy"),t("./postbox"),t("./notification-general"),t("./widgets"),t("./third-party-fixes"),t("./lightbox"),t("./focus-area"),t("./hover-card")},{"./autosize":1,"./dropdown":5,"./focus-area":8,"./hover-card":9,"./lightbox":11,"./notification-general":12,"./postbox":17,"./postbox-legacy":16,"./posttabs":21,"./safety-warning":22,"./share":23,"./third-party-fixes":24,"./time":25,"./widgets":26}],11:[function(t,e,n){"use strict";var i,u=s(t("imagesloaded")),o=s(t("swipejs"));function s(t){return t&&t.__esModule?t:{default:t}}i=new(function(r,i){var e=peepsolightboxdata.template.replace(/>\s+<"),t="ps-lightbox-data--opened",n="ps-lightbox-close--invert";function o(){}return o.prototype={init:function(){this.$container||(this.$container=r(e),this.$padding=this.$container.find(".ps-lightbox-padding"),this.$wrapper=this.$container.find(".ps-lightbox-wrapper"),this.$close=this.$container.find(".ps-lightbox-close"),this.$object=this.$container.find(".ps-lightbox-object"),this.$prev=this.$container.find(".ps-lightbox-arrow-prev"),this.$next=this.$container.find(".ps-lightbox-arrow-next"),this.$spinner=this.$container.find(".ps-lightbox-spinner"),this.$attachment=this.$container.find(".ps-lightbox-data"),this.$btnattachment=this.$container.find(".ps-lightbox-data-toggle"),this.$imagelink=this.$container.find(".ps-lightbox-imagelink"),this.attachevents(),this.$container.appendTo(document.body)),this.isMobile()&&(this.$viewport||(this.$viewport=r("meta[name=viewport]"),this.$viewport.length||(this.$viewport=r('').appendTo("head"))),this.vpNoZoom="width=device-width, user-scalable=no",this.vpValue||(this.vpValue=this.$viewport.attr("content"),this.$viewport.attr("content",this.vpNoZoom))),this.options.simple?this.$container.addClass("ps-lightbox-simple"):this.$container.removeClass("ps-lightbox-simple"),this.$prev.hide(),this.$next.hide(),this.$container.show(),this.resetHeight(),this.options.simple&&this.setHeight();var t=r(window);t.off("resize.ps-lightbox"),this.options.simple&&t.on("resize.ps-lightbox",r.proxy(this.setHeight,this)),r(document.body).off("keyup.ps-lightbox").on("keyup.ps-lightbox",r.proxy(function(t){27===t.keyCode&&this.close()},this))},open:function(t,e){if(this.data=t||[],this.options=e||{},this.index=e.index||0,this.init(),!this.options.simple){var n=r('\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t');_.each(this.data,function(t,e){n.children().append('\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t')}),this.$object.empty(),this.$object.append(n),this.mySwipe=i(n[0],{draggable:!0,startSlide:this.index,callback:r.proxy(function(t,e){this.go(t)},this)})}this.togglenav(),this.go(this.index),this.hideAttachment(),r("html, body").addClass("ps-lightbox--open")},close:function(){this.$container&&(this.$container.hide(),this.$object.empty(),this.$attachment.empty(),this.isMobile()&&this.vpValue&&(this.$viewport.attr("content",this.vpValue),this.vpValue=!1),r(window).off("resize.ps-lightbox"),r(document.body).off("keyup.ps-lightbox"),r("html, body").removeClass("ps-lightbox--open"))},go:function(t){var e,n,i;if("function"==typeof this.options.beforechange&&this.options.beforechange(this),this.data[t])if(this.data[this.index]&&(e=r.trim(this.$attachment.html()))&&(this.data[this.index].attachment=e),this.index=t,this.$attachment.html(this.data[this.index].attachment||""),this.options.simple)this.$object.html(this.data[this.index].content),(n=this.$object.find("img")).length&&(this.showLoading(),this.$close.hide(),n.on("load",r.proxy(function(){this.hideLoading(),this.$close.show(),this.resetHeight(),this.setHeight.apply(this)},this)),i=n.attr("src").replace("/thumbs/","/").replace(/_(l|m_s|s_s)\./,"."),this.$imagelink.find("a").attr("href",i)),this.options.nofulllink?this.$imagelink.hide():this.$imagelink.show();else{var o=this.$object.find(".ps-js-item").eq(this.index);if(2===this.mySwipe.getNumSlides()&&(o=o.add(this.$object.find(".ps-js-item").eq(this.index+2))),o.data("spinner")){o.removeData("spinner"),o.removeAttr("data-spinner");var s=this.data[this.index].content,a=r("
").append(s).children("img");a.length?(0,u.default)(a[0],function(){o.html(s)}):o.html(s)}}"function"==typeof this.options.afterchange&&this.options.afterchange(this),r(document).trigger("ps_lightbox_navigate")},prev:function(){this.mySwipe.prev()},next:function(){this.mySwipe.next()},togglenav:function(){var t=this.$prev.add(this.$next);this.$container.off("click.ps-lightbox",".ps-lightbox-arrow-prev"),this.$container.off("click.ps-lightbox",".ps-lightbox-arrow-next"),r(window).off("keyup.ps-lightbox"),this.options.nonav||!this.data.length||this.data.length<=1?t.hide():(t.show(),this.$container.on("click.ps-lightbox",".ps-lightbox-arrow-prev",r.proxy(this.prev,this)),this.$container.on("click.ps-lightbox",".ps-lightbox-arrow-next",r.proxy(this.next,this)),r(window).on("keyup.ps-lightbox",r.proxy(function(t){var e=t.keyCode;37===e?this.prev():39===e&&this.next()},this)))},isAttachmentOpened:function(){return this.$attachment.hasClass(t)},showAttachment:function(){this.$attachment.addClass(t),this.$close.addClass(n)},hideAttachment:function(){this.$attachment.removeClass(t),this.$close.removeClass(n)},showLoading:function(){this.$object.hide(),this.$spinner.show()},hideLoading:function(){this.$spinner.hide(),this.$object.show()},attachevents:function(){this.$container.on("click.ps-lightbox",".ps-lightbox-padding",r.proxy(function(t){t.target===t.currentTarget&&(t.stopPropagation(),this.close())},this)),this.$btnattachment.on("click",r.proxy(function(){this.isAttachmentOpened()?this.hideAttachment():this.showAttachment()},this)),this.$close.on("click",r.proxy(function(){this.isAttachmentOpened()?this.hideAttachment():this.close()},this)),this.$imagelink.on("click","a",r.proxy(function(){this.close()},this)),this.$attachment.on("keyup.ps-lightbox",function(t){t.stopPropagation()})},isMobile:function(){var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent);return this.isMobile=t?function(){return!0}:function(){return!1},t},resetHeight:function(){this.$object.find("img").css("maxHeight","")},setHeight:_.debounce(function(){this.$object.find("img").css("maxHeight",this.$wrapper.height())},100)},o}(jQuery||$,o.default)),peepso.lightbox=function(t,e){"close"!==t?"function"==typeof t?(i.options=e||{},i.init(),i.showLoading(),t(function(t,e){i.hideLoading(),i.open(t,e||{})})):i.open(t,e||{}):i.close()},peepso.simple_lightbox=function(t){peepso.lightbox([{content:'
'}],{simple:!0})}},{imagesloaded:31,swipejs:32}],12:[function(o,t,e){(function(t){"use strict";var e=i("undefined"!=typeof window?window.jQuery:void 0!==t?t.jQuery:null),n=i(o("./popover"));function i(t){return t&&t.__esModule?t:{default:t}}(0,e.default)(function(t){t(".ps-js-notifications").each(function(){new n.default(this)})})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./popover":13}],13:[function(g,t,w){(function(t){"use strict";Object.defineProperty(w,"__esModule",{value:!0}),w.default=void 0;var c=n("undefined"!=typeof window?window.jQuery:void 0!==t?t.jQuery:null),i=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==r(t)&&"function"!=typeof t)return{default:t};var e=a();if(e&&e.has(t))return e.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var s=i?Object.getOwnPropertyDescriptor(t,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}("undefined"!=typeof window?window.peepso:void 0!==t?t.peepso:null),e=n(g("./singleton")),o=n(g("../notification-popover"));function a(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return a=function(){return t},t}function n(t){return t&&t.__esModule?t:{default:t}}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n'+d+"").css({float:"left",width:"50%"}).on("click",function(t){e.onMarkAllRead(t)});var t=i.observer.applyFilters("notification_unread_only",0);return this.$btnToggleUnreadOnly=(0,c.default)(''+(t?m:v)+"").css({float:"left",width:"50%"}).on("click",function(t){e.onToggleUnreadOnly(t)}),(0,c.default)('').append(this.$btnMarkAllRead).append(this.$btnToggleUnreadOnly)}},{key:"updateCounter",value:function(t){var e=this.$counter;0','','
',t.join("
"),"
","
","
"].join("")]}).then(function(){o.emit("html:updated",o.html)}),e}},{key:"next",value:function(){var i=this;return new r.Promise(function(t,e){var n=i.params.page+1;i.fetchEnd?e():i.fetch(n).then(function(){i.params.page=n,t()})})}},{key:"markRead",value:function(t){var s=this,a=0").html(t),n=e.find("."+s);o&&(n=n.filter("."+s+"--"+o)),n.removeClass("ps-notification--unread").removeAttr("data-unread"),n.find(".ps-js-mark-as-read").remove(),t=e.html()}return t},this)}},{key:"html",get:function(){return _.flatten(this.notifications).join("")}}]),n}();d.default=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],15:[function(t,e,a){(function(t){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var e,i=(e="undefined"!=typeof window?window.jQuery:void 0!==t?t.jQuery:null)&&e.__esModule?e:{default:e};function o(t,e){for(var n=0;n').append('').appendTo(this.$popoverBody),this.$popover=(0,i.default)('
').append(this.$popoverBody).append(this.$popoverFooter).hide(),this.$elem.append(this.$popover))}},{key:"createBody",value:function(){var e=this;return(0,i.default)('
').css({maxHeight:"40vh",overflow:"auto"}).on("wheel",function(t){e.disableParentScroll(t)}).on("scroll",function(t){e.handleScroll(t)})}},{key:"createFooter",value:function(){return(0,i.default)()}},{key:"toggle",value:function(t){var e=this,n="click."+this.guid;if(t&&t.preventDefault(),this.$popover||this.render(),this.$popover.is(":visible"))return(0,i.default)(document).off(n),void this.$popover.stop().slideUp("fast");_.defer(function(){e.$popover.stop().slideDown({duration:"fast",start:function(){e.$popover.position({my:"right top",at:"right bottom",of:e.$elem,collision:"flip"})},done:function(){(0,i.default)(document).one(n,function(t){e.$popover.hide()}),e.tryLoadNext()}})})}},{key:"tryLoadNext",value:function(){var t=this.$popoverBody[0],e=t.scrollTop,n=t.scrollHeight-t.clientHeight;Math.abs(e-n)<=1&&this.loadNext()}},{key:"loadNext",value:function(){}},{key:"disableParentScroll",value:function(t){var e,n=t.currentTarget,i=n.scrollTop,o=t.originalEvent.deltaY;0===i&&o<0?(t.preventDefault(),t.stopPropagation()):(e=n.scrollHeight-n.clientHeight,Math.abs(i-e)<=1&&0
"),this.embedData=null,this.embedExceptions=[]}(o=jQuery).fn.pspostbox=function(t){if(!(this.length<=0)){var n=this;return this.$textarea=null,this.$access=null,this.$charcount=null,this.$cancel_button=null,this.$save_button=null,this.$posttabs=null,this.$privacy_dropdown=null,this.can_submit=!1,this.init=function(t){var n=this,e={textarea:"textarea.ps-postbox-textarea",mirror:".ps-postbox-mirror",addons:".ps-postbox-addons",access:"#postbox_acc",save_url:"postbox.post",charcount:".post-charcount",cancel_button:".ps-button-cancel",save_button:".postbox-submit",send_button_text:void 0,text_length:peepsodata.postsize,autosize:!0};this.opts=e,o.extend(!0,this.opts,t),this.guid=_.uniqueId("postbox-"),this.$posttabs=o(this).find(".ps-postbox-tab-root").ps_posttabs({container:this}),this.$textarea=jQuery(this.opts.textarea,this),this.$mirror=jQuery(this.opts.mirror,this),this.$addons=jQuery(this.opts.addons,this),this.$access=o(this.opts.access,this),this._default_access=this.$access.val(),this.$charcount=o(this.opts.charcount,this),this.$cancel_button=o(this.opts.cancel_button,this),this.$save_button=o(this.opts.save_button,this),_.isUndefined(this.opts.send_button_text)||this.$save_button.html(this.opts.send_button_text),this.$privacy=o("#privacy-tab",this),this.orig_height=this.$textarea.height(),this.opts.autosize&&this.$textarea.autosize(),this.$textarea.attr("maxlength",this.opts.text_length).on("keydown",function(t){n.on_keydown(t)}).on("keypress",function(t){n.on_keypress(t)}).on("paste",function(t){n.on_paste(t)}).on("focus",function(t){n.on_focus()}).on("keyup",function(t){n.on_change()}).on("input",function(t){n.on_input()}),this.$charcount.html(this.opts.text_length+""),this.$privacy_dropdown=o(".ps-privacy-dropdown",this.$privacy),this.$privacy_dropdown.on("click a",jQuery.proxy(function(t){var e=jQuery(t.target).closest("a"),n=this.$privacy.find(".interaction-icon-wrapper .pstd-secondary"),i=jQuery("#postbox_acc");t.stopPropagation(),n.find("i").attr("class",e.find("i").attr("class")),n.find("span").html(e.find("span").text()),i.val(e.attr("data-option-value")),this.$privacy_dropdown.hide()},this)),this.$privacy.on("click",function(t){n.privacy(t)}),peepso.observer.addAction("postbox_group_set",function(t){t===n&&n.$privacy.hide()},10,1),peepso.observer.addAction("postbox_group_reset",function(t){t===n&&n.$privacy.show()},10,1),jQuery("nav.ps-postbox-tab ul li a").click(this.clear_tabs),jQuery("#status-post",n).addClass("active"),jQuery(this.$posttabs).on("peepso_posttabs_show-status",function(){jQuery("#status-post",n).addClass("active"),jQuery(".ps-postbox-status").show()}),peepso.observer.addAction("postbox_type_set",function(t,e){t===n&&"status"===e&&jQuery("#status-post",n).trigger("click")},10,2),jQuery("#status-post",n).on("click",function(){jQuery(n.$posttabs).find("[data-tab='status']").trigger("click")}),this.$posttabs.on("peepso_posttabs_submit-status",function(){n.save_post()}),this.$posttabs.on("peepso_posttabs_cancel-status",function(){jQuery("#status-post",n).removeClass("active")}),this.$posttabs.on("peepso_posttabs_submit",function(){n.$textarea.attr("readonly","readonly"),n.find(".ps-postbox-status").css("opacity",.5)}),this.$posttabs.on("peepso_posttabs_cancel",function(){n.$textarea.val(""),n.cancel_post()}),this.find(".interactions > ul > li > .interaction-icon-wrapper a").on("click",function(t,e){e||n.find(".interactions > ul > li > .interaction-icon-wrapper a").not(this).trigger("peepso.interaction-hide",[!0])}),this._load_addons()},this._load_addons=function(){var t=peepso.observer.applyFilters("peepso_postbox_addons",[]);o(t).each(function(t,e){e.set_postbox(n),e.init()})},this.clear_tabs=function(){peepso.observer.applyFilters("postbox_clear_tabs",null)},this.privacy=function(t){var e=this;this.$privacy_dropdown.show(),jQuery(document).on("mouseup.postbox-privacy",function(t){e.$privacy_dropdown.is(t.target)||0!==e.$privacy_dropdown.has(t.target).length||(e.$privacy_dropdown.hide(),jQuery(document).off("mouseup.postbox-privacy"))})},this.save_post=function(){var t={content:this.$textarea.val(),id:peepsodata.currentuserid,uid:peepsodata.userid,acc:this.$access.val(),type:"activity"};_.isUndefined(this.opts.postbox_req)||("undefined"==typeof Function?"undefined":i(Function))!==i(this.opts.postbox_req)||(t=this.opts.postbox_req.apply(null,[t])),t=peepso.observer.applyFilters("postbox_req",t),t=peepso.observer.applyFilters("postbox_req_"+this.guid,t),this.save_post_queue||(this.save_post_queue=[]),this.save_post_queue.push(t),this.on_before_save(),this.save_post_progress||(this.save_post_progress=!0,this.save_post_execute())},this.save_post_execute=function(){if(!this.save_post_queue.length)return peepso.observer.applyFilters("peepso_postbox_enter_to_send",!1)||(jQuery(".ps-postbox-loading",this).hide(),jQuery(".ps-postbox-action",this).css("display","flex"),this.$posttabs.on_cancel()),this.save_post_progress=!1,this.on_queue_clear(),void postbox.remove_broken_thumbnails();var e=this.save_post_queue.shift();peepso.observer.applyFilters("peepso_postbox_enter_to_send",!1)||(jQuery(".ps-postbox-action",this).css("display","none"),jQuery(".ps-postbox-loading",this).show()),peepso.disableAsync().postJson(this.opts.save_url,e,function(t){t.success?(n.on_save(t),jQuery(n).trigger("postbox.post_saved",[e,t])):n.on_error(t),n.save_post_execute()})},this.on_before_save=function(){("undefined"==typeof Function?"undefined":i(Function))===i(this.opts.on_before_save)&&this.opts.on_before_save.apply(this)},this.on_save=function(t){var e=peepso.observer.applyFilters("peepso_postbox_onsave",!1,this);"function"==typeof e?e.apply(this,[t]):"function"==typeof this.opts.on_save&&(this.opts.on_save.apply(this,[t]),this.$textarea.css("height",this.orig_height),jQuery(this).trigger("postbox.post_saved",this))},this.on_queue_clear=function(){("undefined"==typeof Function?"undefined":i(Function))===i(this.opts.on_queue_clear)&&this.opts.on_queue_clear.apply(this)},this.on_error=function(t){("undefined"==typeof Function?"undefined":i(Function))===i(this.opts.on_error)?this.opts.on_error.apply(this,[t]):!1===_.isUndefined(t.errors[0])&&psmessage.show("Error",t.errors[0])},this.cancel_post=function(){this.$textarea.css("height",this.orig_height),this.$textarea.removeAttr("readonly"),this.find(".ps-postbox-status").css("opacity",""),this.on_change(),jQuery(this).trigger("postbox.post_cancel")},this.on_focus=function(){jQuery(".ps-postbox-tab-root",n).hide(),jQuery(".ps-postbox-tab.interactions",n).attr("data-tab-shown",this.$posttabs.current_tab().data("tab")),jQuery(".ps-postbox-tab.interactions",n).show()},this.on_keydown=function(t){if(this._go_submit=!1,13!==t.keyCode)return!0;var e=this.$textarea.val(),n=jQuery.trim(e);return!t.shiftKey&&peepso.observer.applyFilters("peepso_postbox_enter_to_send",!1)&&(n.length||this.submitable(e))?(t.preventDefault(),this._go_submit=!0,this.$posttabs.on_submit(),!1):n.length?void 0:(t.preventDefault(),!1)},this.on_keypress=function(t){if(this.$textarea.val()>=this.opts.text_length)return!1},this.on_paste=function(t){var e=this;t.originalEvent.clipboardData.getData("text/plain").slice(0,this.text_length),setTimeout(function(){e.on_change()},100)},this.on_input=function(t){this._go_submit||(peepso.observer.applyFilters("peepso_postbox_input_changed",this.$textarea.val()),this.update_beautifier())},this.on_change=function(){var t=this.$textarea.val(),e=t.length;(e=this.opts.text_length-e)<0&&(e=0),this.$charcount.html(e+""),50<=e?this.$charcount.removeClass("alert-info").removeClass("alert-error"):0===e?pswindow.show("","You may only enter up to "+this.opts.text_length+" characters"):e<30?this.$charcount.removeClass("alert-info").addClass("alert-error"):e<50&&this.$charcount.addClass("alert-info").removeClass("alert-error"),this.submitable(t)&&!peepso.observer.applyFilters("peepso_postbox_enter_to_send",!1)?this.$save_button.show():this.$save_button.hide();var n=t.replace(//g,">").replace(/\n/g,"
");this.$mirror.html(n),this.addons_update()},this.submitable=function(t){var e,n,i,o,s=this,a=Math.max(0,this.opts.text_length-t.length),r=peepso.observer.applyFilters("peepso_postbox_can_submit",{hard:[],soft:[a"),t=this.$textarea.parent(".ps-tagging-wrapper")),this.$beautifier=t.children(".ps-tagging-beautifier"),this.$beautifier.length||(this.$beautifier=o("
"),this.$beautifier.prependTo(t)),this.$textarea.focus()),(n=window._wpemojiSettings||{})&&n.supports&&(n.supports.everything=!0),e=this.$textarea.val()||"",e=(e=peepso.observer.applyFilters("peepso_postbox_beautifier",e,this.$textarea)).replace(/<(?!\/?ps_)/g,"<").replace(/<(\/?)ps_/g,"<$1").replace(/\r?\n/g,"
"),this.$beautifier.html(e)},this))},100),this.init(t),this}},s.prototype.init=function(){var t=this,e=this;return peepso.observer.addFilter("peepso_postbox_can_submit",function(t){return t||e.can_submit},20,1),this.$activity_stream_recent=jQuery("#ps-activitystream-recent"),this.$activity_stream=jQuery("#ps-activitystream"),this.$postbox=jQuery("#postbox-main").pspostbox({postbox_req:function(t){return e.embedData&&(t.embed=e.embedData),t},on_save:function(t){return jQuery(this.$posttabs).find("[data-tab='status']").trigger("click"),e.append_to_stream(t)}}),void 0!==this.$postbox&&(this.$postbox.$textarea.on("blur",function(t){e.check_url_preview()}).on("keyup",function(t){32===t.keyCode&&e.check_url_preview()}),this.$postbox.on("postbox.post_saved postbox.post_cancel",function(){e.can_submit=!1,e.$url_preview_container.empty().remove(),t.embedData=null,t.embedExceptions=[]})),this.$postbox},s.prototype.check_url_preview=function(){var n=this;if(!this.fetching&&"status"===this.$postbox.$posttabs.current_tab().data("tab")){var t=peepsodata.embed||{};if(+t.enable&&!this.embedData){var i,e=this.$postbox.$textarea.val();if(i=(i=e.match(/(^|\s)(https?:\/\/)?([a-z0-9-]+\.)+((com|net|org|int|edu|gov|mil|biz|info|mobi|co|io|me)(\.[a-z]{2})?)(?![a-z])(:\d+)?(\/[^*\s]*)?/gi)||e.match(/(^|\s)(https?:\/\/)([a-z0-9-]+\.)+([a-z]{2,24})(:\d+)?(\/[^*\s]*)?/gi))&&i[0]&&i[0].trim())if(i.match(/^https?:\/\//i)||(i="https://".concat(i)),(+t.enable_non_ssl||i.match(/^https:\/\//i))&&!(this.embedExceptions&&-1");n.$url_preview_container.html(e).appendTo(o),n.$url_preview_container.on("click.ps-embed-remove",".ps-js-remove",function(){n.$url_preview_container.off("click.ps-embed-remove"),n.$url_preview_container.empty().remove(),n.embedData=null,n.embedExceptions.push(i)}),e.match(/\sdata-instgrm-permalink/)&&setTimeout(function(){try{window.instgrm.Embeds.process()}catch(t){}},1e3)}).catch(function(){}).then(function(){n.fetching=!1,s.hide(),a.css("display","flex")})}}}},s.prototype.append_to_stream=function(t){if(t.data&&+t.data.post_id){0").append(t.data.html);i=peepso.observer.applyFilters("peepso_activity",i),e=peepso.observer.applyFilters("peepso_activity_content",i.html());var o=jQuery(e).hide(),s=this.$activity_stream.children(".ps-js-activity-pinned");(s=s.filter(function(){var t=jQuery(this).prev(".ps-js-activity");return!t.length||t.hasClass("ps-js-activity-pinned")})).length&&!s.first().prev(".ps-js-activity").length?o.insertAfter(s.last()):o.prependTo(this.$activity_stream),o.fadeIn("slow",function(){jQuery(this).find(".comment-container").hide(),jQuery(document).trigger("ps_activitystream_append",[jQuery("#peepso-wrap .ps-js-activity--"+n+" .ps-js-dropdown-toggle")]),peepso.util.scrollIntoViewIfNeeded(this,{position:"center"})}),peepso.observer.doAction("peepso_activity_actions",o.find("[data-type=stream-action]")),o.find(".ps-stream-body input[name=peepso_set_human_friendly]").each(function(){var t,e,n=jQuery(this),i=n.siblings(".ps-js-activity-content"),o=i.closest(".ps-js-activity");!+peepsodata.is_admin&&+o.data("author")!=+peepsodata.currentuserid||(t=i.get(0).innerText.trim(),(e=peepso.observer.applyFilters("human_friendly_extras",[],t,o[0])).length&&(t&&e.unshift(t),t=e.join(". ")),t||(i=o.find(".ps-stream-header .ps-stream-action-title")).length&&(t=i.get(0).innerText.trim()),t=t.replace(/\r?\n/g," "),peepso.modules.post.setHumanReadable(n.val(),t))}),e.match(/\sdata-instgrm-permalink/)&&setTimeout(function(){try{window.instgrm.Embeds.process()}catch(t){}},1e3),peepso.observer.applyFilters("peepso_posttabs_cancel-status")}},s.prototype.remove_broken_thumbnails=function(){jQuery(".ps-media-thumbnail img").each(function(){var t=new Image,e=this;t.onerror=function(){jQuery(e).closest(".ps-media-thumbnail").remove()},t.src=e.src})},window.postbox=new s,jQuery(document).ready(function(){postbox.init()}),jQuery(function(){if(jQuery.support.placeholder=!1,"placeholder"in document.createElement("input")&&(jQuery.support.placeholder=!0),!jQuery.support.placeholder){var t=document.activeElement;jQuery("textarea").focus(function(){jQuery(this).attr("placeholder")&&0v/2,i=!y&&0