Sindbad~EG File Manager
!function i(o,n,a){function h(e,t){if(!n[e]){if(!o[e]){var s="function"==typeof require&&require;if(!t&&s)return s(e,!0);if(d)return d(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}s=n[e]={exports:{}},o[e][0].call(s.exports,function(t){return h(o[e][1][t]||t)},s,s.exports,i,o,n,a)}return n[e].exports}for(var d="function"==typeof require&&require,t=0;t<a.length;t++)h(a[t]);return h}({1:[function(t,e,s){!function(a){!function(){var t,e,s,h,d,i="undefined"!=typeof window?window.peepso:void 0!==a?a.peepso:null,o="undefined"!=typeof window?window.peepsodata:void 0!==a?a.peepsodata:null;function n(){this.create()}t=jQuery,e=_,s=peepso,window.PsChatInput=(h=t,(d=s).npm.objectAssign(n.prototype,d.npm.EventEmitter.prototype,{template:peepsochatdata.windowInputTemplate,create:function(){this.$el=h(this.template),this.$textarea=this.$el.find("textarea"),this.$addons=this.$el.find(".ps-js-addons"),this.$attachment=this.$el.find(".ps-js-attachment"),this.$textarea.on("keydown",h.proxy(this.onKeyDown,this)),this.$textarea.on("input",h.proxy(this.onInput,this)),this.$textarea.on("click",h.proxy(this.onClick,this)),this.$textarea.on("focus",h.proxy(this.onFocus,this)),this.$textarea.on("blur",h.proxy(this.onBlur,this)),window.peepsophotosdata&&(this.$uploadPhoto=this.$addons.find(".ps-js-photo-trigger"),this.$filePhoto=this.$el.find("input.ps-js-photo-file"),this.$uploadPhoto.on("click",h.proxy(this.onUploadPhoto,this)),this.uploadPhotoInit()),window.peepsodata.file&&(this.$uploadFile=this.$addons.find(".ps-js-file-trigger"),this.$fileFile=this.$el.find("input.ps-js-file-file"),this.$uploadFile.on("click",t=>this.onUploadFile(t)),this.uploadFileInit())},update:function(t={}){t=i.observer.applyFilters("pschat_input",{},t);t.attachment?this.$attachment.html(t.attachment).show():this.$attachment.hide()},focus:function(){this.$textarea.focus()},uploadPhotoInit:function(){var e,t=h(document),s="ps-chat-drop-intercept";t.data(s)||(t.data(s,1),t.bind("drop dragover",function(t){h(t.target).closest(".ps-chat-window").length&&t.preventDefault()})),this.$filePhoto.psFileupload&&this.$filePhoto.psFileupload({formData:{user_id:peepsodata.currentuserid},singleFileUploads:!1,sequentialUploads:!1,replaceFileInput:!1,pasteZone:null,dropZone:this.$el,dataType:"json",url:peepsodata.ajaxurl_legacy+"photosajax.upload_photo",beforeSend:function(t){t.setRequestHeader("X-PeepSo-Nonce",peepsodata.peepso_nonce)},add:h.proxy(function(t,e){this.validatePhoto(e)},this),done:h.proxy(function(t,e){e=e.result;e.success&&this.emit("submit","",{type:"photo","files[]":e.data.files})},this)}),e=setInterval(h.proxy(function(){var t=this.$el.parent();t&&(clearInterval(e),this.$filePhoto.psFileupload)&&this.$filePhoto.psFileupload("option","dropZone",t.add(t.prev()))},this),1e3)},uploadPhoto:function(){this.$filePhoto.trigger("click")},validatePhoto:function(e){for(var t,s=0,i=0;i<e.files.length;i++){if(t=e.files[i],!/\.(gif|jpg|jpeg|tiff|png|webp)$/i.test(t.name))return psmessage.show("",h("#photo-supported-format").text()).fade_out(psmessage.fade_time),!1;s+=parseInt(t.size)}var o={size:s,filesize:s,photos:e.files.length},n=(new Date).getTime()+Math.floor(1e3*Math.random()),a=(this.emit("photos_added",e.files.length,n),this);d.postJson("photosajax.validate_photo_upload",o,function(t){t.success?e.submit():(a.emit("photos_cancel",n),psmessage.show("",t.errors[0]).fade_out(psmessage.fade_time))})},uploadFileInit:function(){var e,t=h(document),s="ps-chat-drop-intercept";t.data(s)||(t.data(s,1),t.bind("drop dragover",function(t){h(t.target).closest(".ps-chat-window").length&&t.preventDefault()})),this.$fileFile.psFileupload&&this.$fileFile.psFileupload({singleFileUploads:!1,sequentialUploads:!1,replaceFileInput:!1,pasteZone:null,dropZone:this.$el,dataType:"json",url:""+o.rest_url+o.file.uploadUrl,beforeSend:t=>{t.setRequestHeader("X-WP-Nonce",o.rest_nonce)},add:(t,e)=>{var s=e.files[0],s=i.observer.applyFilters("file_upload_warning",null,s);if(s)return(0,i.dialog)(s).error(),!1;s=(new Date).getTime()+Math.floor(1e3*Math.random());this.emit("files_added",e.files,s),e._uploadId=s,e.submit()},done:(t,e)=>{var s=e.result;s.filename?(this.emit("submit","",{type:"files","files[]":s.filename}),i.observer.doAction("file_upload_added",e.files[0])):that.emit("files_cancel",e._uploadId)}}),e=setInterval(h.proxy(function(){var t=this.$el.parent();t&&(clearInterval(e),this.$filePhoto.psFileupload)&&this.$filePhoto.psFileupload("option","dropZone",t.add(t.prev()))},this),1e3)},uploadFile:function(){this.$fileFile.trigger("click")},onKeyDown:function(t){13!==t.keyCode||t.shiftKey||(t.preventDefault(),t.stopPropagation(),this.emit("submit",t.target.value.trim()),this.$textarea.val(""),this.autosize())},onInput:function(t){this.autosize(),this.emit("change",t.target.value)},onClick:function(t){this.emit("click",t)},onFocus:function(t){this.emit("focus",t)},onBlur:function(t){this.emit("blur",t)},onUploadPhoto:function(){this.uploadPhoto()},onUploadFile:function(){this.uploadFile()},autosize:e.debounce(function(){this.$textarea[0].style.height="",this.$textarea[0].style.height=Math.min(+this.$textarea[0].scrollHeight,100)+"px"},1)}),n)}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,h){!function(n){!function(){Object.defineProperty(h,"__esModule",{value:!0}),h.default=o;var a=t("undefined"!=typeof window?window.jQuery:void 0!==n?n.jQuery:null),s=t("undefined"!=typeof window?window._:void 0!==n?n._:null),i=t("undefined"!=typeof window?window.peepso:void 0!==n?n.peepso:null);function t(t){return t&&t.__esModule?t:{default:t}}let e="ps-chat-sidebar-open";function o(){this.ids=[],this.create()}i.default.npm.objectAssign(o.prototype,i.default.npm.EventEmitter.prototype,{template:peepsochatdata.sidebarTemplate,itemTemplate:peepsochatdata.sidebarItemTemplate,translations:peepsochatdata.translations,create:function(){this.$el=(0,a.default)(this.template).hide(),this.$items=this.$el.find(".ps-chat-sidebar-items"),this.$notif=this.$el.find(".ps-chat-sidebar-label .ps-chat-sidebar-notif"),this.$label=this.$el.find(".ps-chat-sidebar-label").find("span"),this.visible=!1,this.$el.on("click",a.default.proxy(this.onToggle,this)),this.$el.on("click",".ps-chat-sidebar-item",a.default.proxy(this.onSelect,this)),this.$el.on("click",".ps-chat-close",a.default.proxy(this.onRemove,this))},isExpanded(){return this.$el.hasClass(e)},expand(){this.$el.addClass(e),this.emit("expand")},collapse(){this.$el.removeClass(e),this.emit("collapse")},toggle(){this.isExpanded()?this.collapse():this.expand()},reset:function(t,e){this.remove(s.default.difference(this.ids,t=t||[])),this.add(t),this.updateNotification(e)},add:function(t,e){var s,i,o,n;if(t&&t.length){for(n=0;n<t.length;n++)-1===(o=this.ids.indexOf(i=+t[n]))&&((s=(0,a.default)(this.itemTemplate.replace(/\{id\}/g,i))).appendTo(this.$items),this.ids.push(i),this.update(i,s));for(n=0;n<t.length;n++)n!==(o=this.ids.indexOf(i=+t[n]))&&(s=this.$items.children("[data-id="+i+"]"),this.ids.splice(o,1),this.ids.splice(n,0,i),0===n?s.prependTo(this.$items):s.insertBefore(this.$items.children().eq(n)));this.ids.length&&!this.visible&&(this.$el.show(),this.visible=!0),e&&this.emit("add",t),this.updateCounter()}},remove:function(t,e){var s,i,o;if(t&&t.length){for(o=0;o<t.length;o++)0<=(i=this.ids.indexOf(s=+t[o]))&&(this.$items.children("[data-id="+s+"]").remove(),this.ids.splice(i,1));!this.ids.length&&this.visible&&(this.$el.hide(),this.visible=!1),e&&this.emit("remove",t),this.updateCounter()}},removeFirst:function(){var t;if(this.ids.length)return t=this.ids[0],this.remove([t]),t},select:function(t){this.emit("select",+t)},update(n,t){if(this.captions=this.captions||{},(t=t||this.$items.children("[data-id="+n+"]")).length){let s=t.find(".ps-js-caption"),o=this.captions[n];if(o)s.find("img").attr("src",o.avatar),s.find("span").html(o.name);else if(!s.data("deferCaption")){s.data("deferCaption",1);let t=()=>{var t=i.default.disableAuth().disableError(),e={msg_id:n,chat:1,get_participants:1,get_messages:0};this.fetchQueue=this.fetchQueue||[],this.fetchQueueCounter=this.fetchQueueCounter||0,this.fetchQueueExec=this.fetchQueueExec||function(){if(!(5<=this.fetchQueueCounter)&&this.fetchQueue.length){this.fetchQueueCounter++;let{transport:t,action:e,params:s,$caption:i}=this.fetchQueue.shift();t.postJson(e,s,t=>{t.success&&(t=t.data.users)&&t.length&&(this.captions[n]=o={avatar:1===t.length?t[0].avatar:"",name:this.formatParticipants(t)},o.name=(0,a.default)("<span/>").html(o.name).text(),i.find("a").attr("aria-label",o.name),i.find("img").attr("src",o.avatar),i.find("span").html(o.name)),this.fetchQueueCounter--,this.fetchQueueExec()})}}.bind(this),this.fetchQueue.push({transport:t,action:"messagesajax.get_messages_in_conversation",params:e,$caption:s}),setTimeout(()=>this.fetchQueueExec(),500)};this.isExpanded()?t():this.once("expand",()=>{t()})}}},updateCounter:s.default.debounce(function(){this.counter||(this.counter=0),this.ids.length!==this.counter&&(this.counter=this.ids.length,this.$label.html(this.counter))},400),updateNotification:s.default.debounce(function(t){var e,s,i=0,o=!1;for(s in this.notifState||(this.notifState={}),t)-1!==this.ids.indexOf(+s)&&t[s]!==this.notifState[s]&&(o=!0,this.notifState[s]=t[s],e=this.$items.find(".ps-chat-sidebar-item-"+s).find(".ps-chat-sidebar-notif"),t[s]?(e.show(),i++):e.hide());o&&(i?this.$notif.html(i).show():this.$notif.hide())},400),formatParticipants:function(t){var e=" ";if(1===t.length)e=t[0].name_full;else if(1<t.length){for(var e=[],s=0,i=Math.min(2,t.length-1);s<i;s++)e.push(t[s].name_first);e=e.join(", "),e=2===t.length?this.translations.and.replace(/%s(.+)%s/,e+"$1"+t[t.length-1].name_first):3===t.length?this.translations.and_x_other.replace("%s",e).replace("%d",1):this.translations.and_x_others.replace("%s",e).replace("%d",t.length-2)}return e},onToggle:function(t){t.preventDefault(),t.stopPropagation(),this.toggle()},onSelect:function(t){t.preventDefault(),t.stopPropagation(),this.select((0,a.default)(t.currentTarget).data("id"))},onRemove:function(t){t.preventDefault(),t.stopPropagation(),this.remove([(0,a.default)(t.currentTarget).data("id")],!0),this.updateCounter()}})}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(t,e,s){function i(t,e){e=e||{},this.id=t,this.oldestMessageId=!1,this.newestMessageId=!1,this.deletedMessageIds=[],this.caption=null,this.input=new PsChatInput,this.disabled=e.disabled||!1,this.muted=e.muted||!1,this.send_receipt=e.send_receipt||!1,this.receipt=e.receipt||!1,this.receipt_unread=e.receipt_unread||!1,this.create(),this.checkStatus()}var o,n,h,d;t("./chat-input"),t=jQuery,o=_,n=peepso,window.PsChatWindow=(h=t,t=o,(d=n).npm.objectAssign(i.prototype,d.npm.EventEmitter.prototype,{template:peepsochatdata.windowTemplate,messageTemplate:peepsochatdata.sendMessageTemplate,photosTemplate:peepsochatdata.sendPhotosTemplate,filesTemplate:peepsochatdata.sendFilesTemplate,translations:peepsochatdata.translations,messageUrl:peepsochatdata.messageUrl,create:function(){this.$el=h(this.template.replace(/\{id\}/g,this.id)),this.$header=this.$el.find(".ps-js-chat-window-header"),this.$status=this.$el.find(".ps-js-chat-window-status"),this.$notif=this.$header.find(".ps-js-chat-window-notif").hide(),this.$caption=this.$header.find(".ps-js-chat-window-caption"),this.$dropdown=this.$el.find(".ps-js-chat-window-dropdown"),this.$turnoff=this.$el.find(".ps-js-chat-window-turned-off"),this.$muted=this.$el.find(".ps-js-chat-window-muted"),this.$content=this.$el.find(".ps-js-chat-window-content"),this.$messages=this.$el.find(".ps-js-chat-window-messages"),this.$tmpchat=this.$el.find(".ps-js-chat-window-tmpchat"),this.$typing=this.$el.find(".ps-js-chat-window-typing"),this.$btnOption=this.$el.find(".ps-js-chat-options").hide(),this.$el.find(".ps-js-chat-window-input").append(this.input.$el),this.$el.on("click",".ps-js-chat-window-header",h.proxy(function(t){t.preventDefault(),t.stopPropagation(),this.toggle(!0)},this)),this.$content.on("click",".ps-js-conversation-content",function(t){t.stopPropagation()}),this.$content.on("click",h.proxy(function(t){this.focus()},this)),this.$el.on("click",".ps-js-chat-options",h.proxy(this.onOptions,this)),this.$el.on("click",".ps-js-chat-disable",h.proxy(this.onDisable,this)),this.$el.on("click",".ps-js-chat-mute",h.proxy(this.onMute,this)),this.$el.on("click",".ps-js-chat-fullscreen",h.proxy(this.onFullScreen,this)),this.$el.on("click",".ps-js-chat-blockuser",h.proxy(this.onBlockUser,this)),this.$el.on("click",".ps-js-chat-close",h.proxy(this.onClose,this)),this.$el.on("click",".ps-js-chat-checkmark",h.proxy(this.onToggleNotification,this)),this.expanded=!1,this.loadInitialMessages(),this.$caption.on("click","a",h.proxy(function(t){this.expanded?t.stopPropagation():t.preventDefault()},this)),this.updateDisabled(),this.updateMuted(),d.observer.addAction("msgso_send_message",h.proxy(this.send,this),10,3),d.observer.addAction("psmessages_conversation_mute",t=>{+t==+this.id&&(this.muted=!0,this.updateMuted())},10,1),d.observer.addAction("psmessages_conversation_unmute",t=>{+t==+this.id&&(this.muted=!1,this.updateMuted())},10,1),d.observer.addAction("pschat_remove_attachment",t=>{+t==+this.id&&(delete this.opts,this.input.update({}))},10,1)},loadInitialMessages:function(){this.loadNewerLock=!0,this.loadNewerCount||(this.loadNewerCount=0),this.loadMessages({msg_id:this.id,chat:1,get_messages:1,get_participants:1},function(t){t.success&&(this.renderConversation(t.data),this.updateCheckmark(),this.scrollTo("bottom"),this.expanded||(this.scrollOnExpand=!0),this.input.on("submit",h.proxy(this.onInputSubmit,this)),this.input.on("click",h.proxy(this.onInputFocus,this)),this.input.on("focus",h.proxy(this.onInputFocus,this)),this.input.on("blur",h.proxy(this.onInputBlur,this)),this.input.on("change",h.proxy(this.onInputChange,this)),this.input.on("photos_added",this.onInputAddPhotos.bind(this)),this.input.on("photos_cancel",t=>this.onInputCancelAddPhotos(t)),this.input.on("files_added",this.onInputAddFiles.bind(this)),this.input.on("files_cancel",t=>this.onInputCancelAddFiles(t)),this.loadNewerLock=!1,this.loadNewerQueue&&this.expanded&&(this.loadNewerQueue=!1,this.loadNewerMessages()),this.$content.bind("mousewheel",h.proxy(function(t,e){var s=h(t.currentTarget);0<e&&0===s.scrollTop()?(t.preventDefault(),this.loadOlderMessages()):e<0&&s.scrollTop()==s.get(0).scrollHeight-s.innerHeight()&&t.preventDefault()},this)))})},send:function(s,i,o){return h.Deferred(h.proxy(function(e){var t;(s=+s)==+this.id&&(i=i.trim(),o=o||{},i||o.type)?(t=h.extend({},{content:i,id:peepsodata.currentuserid,uid:peepsodata.userid,type:"activity",parent_id:s},o),d.disableAuth().disableError().postJson("messagesajax.add_message",t,h.proxy(function(t){t.success&&(this.loadNewerMessages(),e.resolve())},this))):e.reject()},this))},loadNewerMessages:function(){this.loadNewerLock?this.loadNewerQueue=!0:(this.loadNewerLock=!0,this.loadNewerCount||(this.loadNewerCount=0),this.loadMessages({msg_id:this.id,chat:1,get_messages:1,get_participants:++this.loadNewerCount%10==0?1:0,get_recently_deleted:1,direction:"new",from_id:this.newestMessageId},function(t){var e=this.$content[0].scrollHeight-this.$content.innerHeight()-this.$content.scrollTop();this.renderConversation(t.data,"append"),Math.abs(e)<1&&this.scrollTo("bottom"),this.loadNewerLock=!1,this.tmpNotEmpty&&(this.$tmpchat.empty(),this.tmpNotEmpty=!1),this.loadNewerQueue&&(this.loadNewerQueue=!1,this.loadNewerMessages())}))},loadOlderMessages:function(){this.loadOlderLock||this.loadOlderEnd||(this.loadOlderLock=!0,this.loadMessages({msg_id:this.id,chat:1,get_messages:1,get_participants:0,get_recently_deleted:0,direction:"old",from_id:this.oldestMessageId},function(t){var e=this.$content.scrollTop();Math.abs(e)<1&&(this.$content[0].scrollTop=1),this.renderConversation(t.data,"prepend"),this.updateCheckmark(),this.loadOlderLock=!1,this.loadOlderEnd=!(t.data.ids&&t.data.ids.length)}))},loadMessages:function(t,e){this.loadMessagesXHR&&this.loadMessagesXHR.ret.abort(),this.loadMessagesXHR=d.disableAuth().disableError().postJson("messagesajax.get_messages_in_conversation",t,h.proxy(function(t){h.proxy(e,this)(t),this.loadMessagesXHR=!1},this))},checkStatus:function(){var t={msg_id:this.id,chat:1,get_messages:0,get_participants:1,get_recently_deleted:0};clearInterval(this.checkStatusTimer),this.checkStatusTimer=setInterval(h.proxy(function(){this.checkStatusXHR&&this.checkStatusXHR.ret.abort(),this.checkStatusXHR=d.disableAuth().disableError().postJson("messagesajax.get_messages_in_conversation",t,h.proxy(function(t){this.renderConversation(t.data),this.checkStatusXHR=!1},this))},this),6e4)},renderConversation:function(i,t){var e;if(i.users&&i.users.length){this.caption=this.formatParticipants(i.users),this.$caption.html(this.caption||" ");let s="";if(i.users.length)for(let t=0,e=Math.min(3,i.users.length);t<e;t++){var o=i.users[t],n=!!+o.online;s+=`<div class="ps-avatar${n?" ps-avatar--online":""}"><img src="${o.avatar}" /></div>`}this.$status.html(s),1<i.users.length&&this.$el.addClass("ps-chat__window--group");var a=this.$dropdown.find(".ps-js-chat-blockuser");1<i.users.length?a.hide():(a.show(),a.data("user-id",i.users[0].id))}if(i.ids&&i.ids.length&&i.html&&(a=d.observer.applyFilters("messages_render",h(i.html)),d.observer.doAction("peepso_external_link",a),"prepend"===t?(this.oldestMessageId=+i.ids[0],this.$messages.prepend(a)):"append"===t?(this.newestMessageId=+i.ids[i.ids.length-1],this.$messages.append(a)):(this.oldestMessageId=+i.ids[0],this.newestMessageId=+i.ids[i.ids.length-1],this.$messages.html(a))),i.recently_deleted&&i.recently_deleted.length)for(;i.recently_deleted.length;)e=+i.recently_deleted.shift(),-1===this.deletedMessageIds.indexOf(e)&&(this.deletedMessageIds.push(e),this.$messages.find(".ps-js-message-"+e).remove(),e===this.newestMessageId?this.newestMessageId=+this.$messages.find(".ps-js-message").last().data("id"):e===this.oldestMessageId&&(this.oldestMessageId=+this.$messages.find(".ps-js-message").first().data("id")));this.renderTyping(i.currently_typing)},renderTyping:function(t){let e;var s;t&&(s=this.$content,e=s[0].scrollHeight-s.innerHeight()-s.scrollTop()),this.$typing.html(t||""),t&&Math.abs(e)<1&&requestAnimationFrame(()=>this.scrollTo("bottom")),clearTimeout(this.renderTypingTimer),this.renderTypingTimer=setTimeout(h.proxy(function(){this.$typing.html("")},this),5e3)},markAsRead:t.throttle(function(){d.disableAuth().disableError().postJson("messagesajax.mark_read_messages_in_conversation",{msg_id:this.id},function(){d.observer.applyFilters("pschat_mark_as_read")})},2e3),iAmTyping:t.throttle(function(){d.disableAuth().disableError().postJson("messagesajax.i_am_typing",{msg_id:this.id})},+peepsodata.notification_ajax_delay_min||5e3),focus:t.debounce(function(){this.input.focus()},100),update:function(t,e={}){var s=+(t=t||{}).unread||0;this.unread||(this.unread=0),this.unread!==s?(s>this.unread&&d.hooks.doAction("chat_unread_new"),this.unread=s,this.expanded?this.loadNewerMessages():this.disabled||(this.unread?this.$notif.html(this.unread).show():this.$notif.hide())):this.last_activity!==t.last_activity&&(this.last_activity=t.last_activity,this.loadNewerMessages()),this.disabled!==t.disabled&&(this.disabled=t.disabled,this.updateDisabled()),this.muted!==t.muted&&(this.muted=t.muted,this.updateMuted()),this.send_receipt!==t.send_receipt&&(this.send_receipt=t.send_receipt,this.updateNotification()),this.receipt===t.receipt&&this.receipt_unread===t.receipt_unread||(this.receipt=t.receipt,this.receipt_unread=t.receipt_unread,this.receipt&&this.updateCheckmark()),this.opts=e,this.input.update(this.opts)},toggle:function(t){this.expanded?this.collapse(t):this.expand(t)},expand:function(t){this.expanded||(this.$el.addClass("ps-chat__window--open"),this.$btnOption.show(),this.expanded=!0,this.focus(),0<this.unread&&(this.loadNewerMessages(),this.unread=0,this.$notif.hide()),this.scrollOnExpand&&(this.scrollTo("bottom"),this.scrollOnExpand=!1),t&&this.emit("expand",this.id))},collapse:function(t){this.expanded&&(this.$el.removeClass("ps-chat__window--open"),this.$btnOption.hide(),this.expanded=!1,t)&&this.emit("collapse",this.id)},destroy:function(t){this.$el.remove(),t&&this.emit("destroy",this.id),this.removeAllListeners()},formatParticipants:function(t){if(1===t.length)e='<a href="'+t[0].url+'">'+t[0].name_full+"</a>";else if(1<t.length){for(var e=[],s=0,i=Math.min(2,t.length-1);s<i;s++)e.push(t[s].name_first);e=e.join(", "),e=2===t.length?this.translations.and.replace(/%s(.+)%s/,e+"$1"+t[t.length-1].name_first):3===t.length?this.translations.and_x_other.replace("%s",e).replace("%d",1):this.translations.and_x_others.replace("%s",e).replace("%d",t.length-2),e='<a href="'+this.messageUrl.replace("{id}",this.id)+'">'+e+"</a>"}return e},scrollTo:function(t){this.$content[0].scrollTop="top"===t?0:this.$content[0].scrollHeight},toggleDisable:t.debounce(function(){var e={msg_id:this.id,disabled:this.disabled?0:1};this.$el.find(".ps-js-chat-disable img").show(),d.disableAuth().disableError().postJson("chatajax.set_chat_disabled",e,h.proxy(function(t){this.$el.find(".ps-js-chat-disable img").hide(),t.success&&(this.disabled=e.disabled,this.updateDisabled(),this.updateMuted(),this.toggleDropdown("hide"))},this))},400),updateDisabled:function(){var t;(this.disabled?(t=this.translations.turn_on_chat,this.$el.removeClass("ps-chat__window--active"),this.$turnoff.show(),this.$notif):(t=this.translations.turn_off_chat,this.$turnoff)).hide(),this.$el.find(".ps-js-chat-disable span").html(t)},toggleMute:t.debounce(function(){var e;this.muted?(e={parent_id:this.id,mute:this.muted?0:1},this.$el.find(".ps-js-chat-mute img").show(),d.disableAuth().disableError().postJson("messagesajax.set_mute",e,h.proxy(function(t){this.$el.find(".ps-js-chat-mute img").hide(),t.success&&(d.observer.doAction("psmessages_conversation_"+(e.mute?"mute":"unmute"),e.parent_id),this.toggleDropdown("hide"))},this))):(this.toggleDropdown("hide"),ps_messages.mute_conversation(this.id))},400),updateMuted:function(){var t=this.muted?this.translations.unmute_chat:this.translations.mute_chat;(this.muted&&!this.disabled?(this.$el.removeClass("ps-chat__window--active"),this.$muted.show(),this.$notif):this.$muted).hide(),this.$el.find(".ps-js-chat-mute span").html(t)},toggleBlockUser:t.debounce(function(t){confirm(peepsomessagesdata.blockuser_confirm_text)&&(this.destroy(!0),ps_member.block_user(t))},400),toggleNotification:t.debounce(function(){var e={msg_id:this.id,read_notif:this.send_receipt?0:1};this.$el.find(".ps-js-chat-checkmark img").show(),d.disableAuth().disableError().postJson("chatajax.set_chat_read_notification",e,h.proxy(function(t){this.$el.find(".ps-js-chat-checkmark img").hide(),t.success&&(this.send_receipt=e.read_notif,this.updateNotification(),this.toggleDropdown("hide"))},this))},400),updateNotification:function(){this.$el.find(".ps-js-chat-checkmark").find("span").html(this.send_receipt?this.translations.hide_checkmark:this.translations.show_checkmark)},updateCheckmark:t.throttle(function(){var t;this.receipt&&(t=this.$messages.find(".gci-check-circle").addClass("read"),0<this.receipt_unread)&&t.slice(0-this.receipt_unread).removeClass("read")},1e3),toggleDropdown:function(t){"hide"===t?(this.$dropdown.hide(),this.$btnOption.removeClass("ps-chat__window-header-dropdown--open")):(this.$dropdown.show(),this.$btnOption.addClass("ps-chat__window-header-dropdown--open"))},onOptions:function(t){t.preventDefault(),t.stopPropagation(),this.$dropdown.is(":visible")?this.toggleDropdown("hide"):this.toggleDropdown("show")},onDisable:function(t){t.preventDefault(),t.stopPropagation(),this.toggleDisable()},onMute:function(t){t.preventDefault(),t.stopPropagation(),this.toggleMute()},onFullScreen:function(t){t.preventDefault(),t.stopPropagation(),window.location=this.messageUrl.replace("{id}",this.id)},onBlockUser:function(t){t.preventDefault(),t.stopPropagation();t=h(t.currentTarget).data();+t.userId&&this.toggleBlockUser(+t.userId)},onClose:function(t){t.preventDefault(),t.stopPropagation(),this.destroy(!0)},onToggleNotification:function(t){t.preventDefault(),t.stopPropagation(),this.toggleNotification()},onInputSubmit:function(t,e){e=e||{},((t=t.trim())||e.type)&&("activity"===(e=h.extend({},{content:t,id:peepsodata.currentuserid,uid:peepsodata.userid,type:"activity",parent_id:this.id},e)).type&&("object"==typeof this.opts&&(e=h.extend(e,this.opts),delete this.opts,this.input.update({})),this.tmpNotEmpty=!0,this.$tmpchat.append(this.messageTemplate.replace("{content}",t)),this.scrollTo("bottom")),d.disableAsync().disableAuth().disableError().postJson("messagesajax.add_message",e,h.proxy(function(t){t.success&&this.loadNewerMessages()},this)))},onInputFocus:function(t){t.stopPropagation(),this.markAsRead(),this.disabled||this.$el.addClass("ps-chat__window--active")},onInputBlur:function(t){t.stopPropagation(),this.$el.removeClass("ps-chat__window--active"),this.toggleDropdown("hide")},onInputChange:function(t){this.iAmTyping()},onInputAddPhotos:function(t,e){for(var s=/\{item\}([\s\S]+)\{\/item\}/,i=this.photosTemplate.match(s)[1],o="",n=1;n<=t;n++)o+=i;this.tmpNotEmpty=!0,this.$tmpchat.append(this.photosTemplate.replace("{id}",e).replace(s,o)),this.scrollTo("bottom")},onInputCancelAddPhotos:function(t){this.$tmpchat.find(".my-message-photos-"+t).remove()},onInputAddFiles:function(e,s){var i=d.template(this.filesTemplate);let o="";for(let t=0;t<e.length;t++)o+=i({id:s,name:e[t].name,size:(t=>{var e;return+t?(e=Math.floor(Math.log(t)/Math.log(1024)),parseFloat((t/Math.pow(1024,e)).toFixed(0))+" "+["B","KB","MB","GB","TB"][e]):"0 B"})(e[t].size)});this.tmpNotEmpty=!0,this.$tmpchat.append(o),this.scrollTo("bottom")},onInputCancelAddFiles:function(t){this.$tmpchat.find(".my-message-files-"+t).remove()}}),i)},{"./chat-input":1}],4:[function(s,t,e){!function(e){!function(){var t,d="undefined"!=typeof window?window.peepso:void 0!==e?e.peepso:null,r=(s("./chat-window"),(t=s("./chat-sidebar"))&&t.__esModule?t:{default:t});var l=jQuery||$,p=_,c=peepso;window.PsChat=null,window.ps_chat={},window.ps_chat.open_chat=function(t,e){t=window.peepsochatdata.messageUrl.replace("{id}",t);l(document.body).hasClass("wp-admin")?window.open(t):window.location=t},/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent)||setTimeout(function(){var a,s,t,h,e,i,o;function n(){if(!+peepsodata.currentuserid)return!(this.disabled=!0);this.state={},this.beforeDestroyState={},this.windows={},this.windowsOrder=[],this.windowsUpdate={},this.sidebar=new r.default,this.create()}void 0===window.ReactNativeWebView&&d.observer.applyFilters("chat_enabled",!0)&&((()=>{var t=window.location.pathname,e=window.peepsomessagesdata||{},s=+e.chat_restriction_mode||0,i=1===s,o=1===s?e.chat_enable_on_pages:e.chat_disable_on_pages;if((o=(o||"").split(/\r?\n/).map(t=>t.trim()).filter(t=>t.length)).length)for(var n=0;n<o.length;n++)try{if(t.match(new RegExp("^"+o[n]+"(#|\\?|\\/|$)"))){i=!i;break}}catch(t){}return i})()?(delete window.PsChat,delete window.ps_chat):(o=new(PsChat=(a=l,s=c,t=+peepsodata.sse,h=4,e=+peepsodata.notification_ajax_delay_min,i=+peepsodata.notification_ajax_delay,s.npm.objectAssign(n.prototype,{template:peepsochatdata.containerTemplate,create:function(){this.$root=a(this.template),this.$wrapper=this.$root.children(".ps-js-chat"),this.$windows=this.$wrapper.children(".ps-js-chat-windows"),this.$wrapper.append(this.sidebar.$el),this.$root.appendTo(document.body),this.sidebar.on("select",a.proxy(this.onSidebarSelect,this)),this.sidebar.on("remove",a.proxy(this.onSidebarRemove,this)),a(window).off("resize.ps-js-chat").on("resize.ps-js-chat",a.proxy(this.onDocumentResize,this)),setTimeout(a.proxy(function(){t?this.fetchChatState():(this.onDocumentResize(),+peepsomessagesdata.get_chats_longpoll&&setInterval(a.proxy(function(){this.startLongPolling()},this),3e4))},this),3e3),s.observer.addAction("peepso_sse",a.proxy(function(t){"get_chats"===t.event&&this.fetchChatState()},this),10,1),s.observer.addAction("browser.inactive",a.proxy(function(){this.browserInactive=!0},this)),s.observer.addAction("browser.active",a.proxy(function(){this.browserInactive=!1,this.checkChatDelay=e,this.stopLongPolling(),this.startLongPolling()},this))},startLongPolling:function(){t||this.sessionExpired||(this.stopLongPolling(),this.fetchChatState().done(a.proxy(function(){this.checkChatState()},this)))},stopLongPolling:function(){t||(clearTimeout(this.checkChatTimer),this.checkChatXHR&&this.checkChatXHR.abort(),this.fetchChatXHR&&this.fetchChatXHR.ret&&this.fetchChatXHR.ret.abort(),this.checkChatXHR=!1,this.fetchChatXHR=!1)},checkChatState:function(){this.checkChatXHR=a.post({url:peepsodata.ajaxurl,dataType:"json",data:{action:"peepso_should_get_chats",delay:this.checkChatDelay}}),this.checkChatXHR.always(function(t){var e,s;(t=t||[]).session_timeout?(this.stopLongPolling(),this.sessionExpired=!0):(s=+t[0],this.checkChatDelay=(e=+t[1])||this.checkChatDelay,s?this.fetchChatState().always(a.proxy(function(){this.checkChatDelayed(e)},this)):this.checkChatDelayed(e))}.bind(this))},checkChatDelayed:function(t){t=t||e,this.browserInactive&&(t=i),this.checkChatTimer=setTimeout(a.proxy(this.checkChatState,this),t)},fetchChatState:function(){return this.fetchChatXHR?a.Deferred(a.proxy(function(t){t.resolveWith(this)},this)):(this.fetchChatXHR=s.disableAuth().disableError().postJson("chatajax.get_chats",{},a.proxy(function(t){var e,s;if(t.success){for(this.windowsOrder=[],s=0;s<t.data.chats.length;s++)e=t.data.chats[s],this.state[e.id]=this.state[e.id]||{},this.windowsOrder.push(+e.id),this.state[e.id].last_activity===e.last_activity&&this.state[e.id].muted===+e.muted&&this.state[e.id].disabled===+e.disabled&&this.state[e.id].send_receipt===+e.send_receipt&&this.state[e.id].receipt===+e.receipt&&this.state[e.id].receipt_unread===+e.receipt_unread&&this.state[e.id].unread===+e.unread||(!this.state[e.id].last_activity&&h<=s?this.windowsUpdate[e.id]=!1:this.windowsUpdate[e.id]=!0),a.extend(this.state[e.id],{state:e.state,unread:e.unread,last_activity:e.last_activity,disabled:+e.disabled,muted:+e.muted,send_receipt:+e.send_receipt,receipt:+e.receipt,receipt_unread:+e.receipt_unread,unread:+e.unread});this.renderWindows()}this.fetchChatXHR=!1},this)),this.fetchChatXHR.ret)},getChatState:function(){for(var t,e,s=[],i=0;i<this.windowsOrder.length;i++)e=this.windowsOrder[i],t=this.state[e]||{},s.push({id:e,state:t.state||void 0,unread:t.unread||void 0,last_activity:t.last_activity||void 0});return s},setChatState:function(t,e){this.stopLongPolling(),this.state[t]=a.extend(this.state[t]||{},e),t=JSON.stringify(this.getChatState()),this.setChatStateXHR&&this.setChatStateXHR.ret.abort(),this.setChatStateXHR=s.disableAuth().disableError().postJson("chatajax.set_chats",{chats:t},a.proxy(function(){this.setChatStateXHR=!1,this.startLongPolling()},this))},renderWindows:function(){var t,e,s,i,o=this.windowsOrder.slice(h),n=this.windowsOrder.slice(0,h);for(t in this.windows)-1===n.indexOf(+this.windows[t].id)&&(this.windows[t].destroy(),delete this.windows[t]);for(i=0;i<n.length;i++)t=n[i],this.windows[t]||(this.windows[t]=this.createWindow(t),this.windows[t].$el.appendTo(this.$windows));for(i=0;i<n.length;i++)t=n[i],e=+this.state[t].state,s=this.windows[t].$el[0],i!==this.getWindowIndex(s)&&(0===i?a(s).prependTo(this.$windows):a(s).insertBefore(this.$windows.children().eq(i))),1==e?this.windows[t].expand():this.windows[t].collapse(),this.windowsUpdate[t]&&(this.windows[t].update(this.state[t],this.windows[t].opts),this.windowsUpdate[t]=!1);this.sidebar.reset(o,this.windowsUpdate),this.sidebar.visible?this.$wrapper.addClass("ps-chat--more"):this.$wrapper.removeClass("ps-chat--more"),this.windowsOrder.length?this.backspacePrevented||(this.backspacePrevented=!0,a(document).on("keydown.ps-js-chat",function(t){8!==t.which||a(t.target).is("input, textarea")||t.preventDefault()})):this.backspacePrevented&&(this.backspacePrevented=!1,a(document).off("keydown.ps-js-chat"))},createWindow:function(t){t=new PsChatWindow(t,this.state[t]);return t.on("expand",a.proxy(this.onWindowExpand,this)),t.on("collapse",a.proxy(this.onWindowCollapse,this)),t.on("destroy",a.proxy(this.onWindowDestroy,this)),t},getWindowIndex:function(t){var e;if(a.contains(document.documentElement,t))for(e=0;t=t.previousSibling;e++);return e},openChat:function(t,e){var s;-1===(s=this.windowsOrder.indexOf(t=+t))?(this.windows[t]=this.createWindow(t),this.windows[t].$el.show(),this.windows[t].$el.appendTo(this.$windows),this.windowsOrder.splice(h-1,0,t)):s<h?(this.windows[t].$el.show(),this.windows[t].expand()):(this.windows[t]||(this.windows[t]=this.createWindow(t)),this.windows[t].$el.show(),this.windows[t].$el.appendTo(this.$windows),this.windowsOrder.splice(s,1),this.windowsOrder.splice(h-1,0,t)),this.windows[t].opts=e,this.windows[t].focus(),this.windows[t].markAsRead(),this.setChatState(t,{state:1}),this.beforeDestroyState[t]&&(this.state[t].disabled=this.beforeDestroyState[t].disabled,this.state[t].muted=this.beforeDestroyState[t].muted,this.state[t].send_receipt=this.beforeDestroyState[t].send_receipt),this.windowsUpdate[t]=!0,this.renderWindows()},closeChat:function(t){this.beforeDestroyState[t]=this.state[t],this.windows[t]&&this.windows[t].destroy(),delete this.windows[t],delete this.state[t],-1<(t=this.windowsOrder.indexOf(+t))&&this.windowsOrder.splice(t,1)},isDisabled:function(){return this.disabled},onWindowExpand:function(t){this.setChatState(t,{state:1})},onWindowCollapse:function(t){this.setChatState(t,{state:2})},onWindowDestroy:function(t){this.beforeDestroyState[t]=this.state[t],this.setChatState(t,{state:0}),delete this.windows[t],delete this.state[t];var e=this.windowsOrder.indexOf(+t);-1<e&&this.windowsOrder.splice(e,1),(t=this.sidebar.removeFirst())&&(this.windows[t]||(this.windows[t]=this.createWindow(t)),this.windows[t].$el.show(),this.windows[t].$el.appendTo(this.$windows),this.windows[t].expand())},onSidebarSelect:function(t){this.openChat(t)},onSidebarRemove:function(t){if(t&&t.length)for(var e=0;e<t.length;e++)this.setChatState(t[e],{state:0})},onDocumentResize:p.debounce(function(){var t=this.$windows.width(),e=Math.floor(t/246);this._prevWidth!==t&&(this._prevWidth=t,this.stopLongPolling(),1<=e?(h=e,this.renderWindows(),this.startLongPolling(),this.$root.show()):this.$root.hide())},500)}),n))).isDisabled()||(ps_chat.open_chat=function(t,e){o.openChat(t,e)}))},100)}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./chat-sidebar":2,"./chat-window":3}]},{},[4]);
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists