1"use strict";(self.webpackChunknodebb=self.webpackChunknodebb||[]).push([[1091,16852,18314,22067,34271,43400,43602,49897,87212,99127],{7524(v,x,s){var h,p;h=[s(72254),s(49897),s(65303),s(29930),s(81335)],p=((u,g,d,E,P)=>{const t={};t.openChangeModal=async()=>{const a=await socket.emit("user.getProfilePictures",{uid:ajaxify.data.uid}),r=await P.render("modals/change-picture",{pictures:a,icon:{text:ajaxify.data["icon:text"],bgColor:ajaxify.data["icon:bgColor"]},defaultAvatar:ajaxify.data.defaultAvatar,allowProfileImageUploads:ajaxify.data.allowProfileImageUploads,iconBackgrounds:ajaxify.data.iconBackgrounds.map(n=>({color:n,selected:n===ajaxify.data["icon:bgColor"]})),user:{uid:ajaxify.data.uid,username:ajaxify.data.username,picture:ajaxify.data.picture,"icon:text":ajaxify.data["icon:text"],"icon:bgColor":ajaxify.data["icon:bgColor"]}}),e=await d.dialog({className:"picture-switcher",title:"[[user:change-picture]]",message:r,show:!0,size:"large",buttons:{close:{label:"[[global:close]]",className:"btn-link"},update:{label:"[[global:save-changes]]",callback:function(){const n=e.find('[component="profile/picture/button"].active'),i=n.attr("data-type"),l=n.find("img").attr("src"),D=e.find("[data-bg-color].selected").attr("data-bg-color")||"transparent";g.put(`/users/${ajaxify.data.theirid}/picture`,{type:i,picture:l,bgColor:D}).then(()=>{t.updateHeader(i==="default"?"":l,D),ajaxify.refresh()}).catch(E.error)}}}});e.on("click",'[component="profile/picture/button"]',function(){e.find('[component="profile/picture/button"]').removeClass("active"),$(this).addClass("active")}),e.on("click","[data-bg-color]",function(){const n=$(this).attr("data-bg-color");$(this).addClass("selected").siblings().removeClass("selected"),e.find('[component="avatar/icon"]').css("background-color",n)}),f(e)},t.updateHeader=(a,r)=>{if(parseInt(ajaxify.data.theirid,10)!==parseInt(ajaxify.data.yourid,10))return;!a&&ajaxify.data.defaultAvatar&&(a=ajaxify.data.defaultAvatar);const e=$('[component="header/avatar"] [component="avatar/picture"]'),n=$('[component="header/avatar"] [component="avatar/icon"]');if(a){if(e.length)e.attr("src",a);else if(n.length){const i=$("<img/>");$(n[0].attributes).each(function(){i.attr(this.nodeName,this.nodeValue)}),i.attr("component","avatar/picture").attr("src",a).insertBefore(n)}}else e.remove();r&&n.css({"background-color":r})};function f(a){function r(e){e=(e.startsWith("http")?"":config.relative_path)+e;const n=e+"?"+Date.now();t.updateHeader(n),ajaxify.data.picture&&ajaxify.data.picture.length?($(`#user-current-picture, img[data-uid="${ajaxify.data.theirid}"].avatar`).attr("src",n),ajaxify.data.uploadedpicture=e,ajaxify.data.picture=e):ajaxify.refresh(function(){$(`#user-current-picture, img[data-uid="${ajaxify.data.theirid}"].avatar`).attr("src",n)})}a.find('[data-action="upload"]').on("click",function(){return a.modal("hide"),u.show({title:"[[user:upload-picture]]",description:"[[user:upload-a-picture]]",socketMethod:"user.uploadCroppedPicture",route:`${config.relative_path}/api/user/${ajaxify.data.userslug}/uploadpicture`,aspectRatio:1/1,allowSkippingCrop:!1,paramName:"uid",paramValue:ajaxify.data.theirid,restrictImageDimension:!0,imageDimension:ajaxify.data.profileImageDimension,accept:ajaxify.data.allowedProfileImageExtensions},function(e){r(e)}),!1}),a.find('[data-action="upload-url"]').on("click",function(){return a.modal("hide"),app.parseAndTranslate("modals/upload-picture-from-url",{},function(e){e.modal("show"),e.find(".upload-btn").on("click",function(){const n=e.find("#uploadFromUrl").val();return n&&(e.modal("hide"),u.handleImageCrop({url:n,socketMethod:"user.uploadCroppedPicture",aspectRatio:1,allowSkippingCrop:!1,paramName:"uid",paramValue:ajaxify.data.theirid},r)),!1})}),!1}),a.find('[data-action="remove-uploaded"]').on("click",function(){const e=$(this),n=e.attr("data-url");socket.emit("user.removeUploadedPicture",{uid:ajaxify.data.theirid,picture:n},function(i){if(i)return E.error(i);e.parent().remove(),n===ajaxify.data.picture&&(a.modal("hide"),ajaxify.refresh(),t.updateHeader())})})}return t}).apply(x,h),p!==void 0&&(v.exports=p)},49897(v,x,s){s.r(x),s.d(x,{del:()=>D,get:()=>r,head:()=>e,patch:()=>i,post:()=>n,put:()=>l});var h=s(91749),p=s.n(h),u=s(65303),g=s(17459),d=s.n(g),E=s(68636),P=s.n(E);const t=config.relative_path+"/api/v3";async function f(o,m){if(o.url=o.url.startsWith("/api")?config.relative_path+o.url:t+o.url,o.headers=o.headers||{},o.headers["x-return-to"]||(o.headers["x-return-to"]=`${window.location.pathname.slice(config.relative_path.length)}${window.location.search}`),typeof m=="function"){a(o).then(c=>m(null,c),c=>m(c));return}try{return await a(o)}catch(c){if(c.message===await g.translate("[[error:api.401]]",config.userLang)){const{url:y}=await(0,h.fire)("filter:admin.reauth",{url:"login"}),C=await g.translate("[[error:api.reauth-required]]",config.userLang);(0,u.confirm)(C,I=>{I&&(E.setItem("location-hash",window.location.hash),ajaxify.go(y))})}throw c}}async function a(o){const{url:m}=o;delete o.url,o.data&&!(o.data instanceof FormData)&&(o.data=JSON.stringify(o.data||{}),o.headers["content-type"]="application/json; charset=utf-8"),{options:o}=await(0,h.fire)("filter:api.options",{options:o}),o.data&&(o.body=o.data,delete o.data);const c=await fetch(m,o),{headers:y}=c;if(y.get("x-redirect"))return a({url:y.get("x-redirect"),...o});const C=y.get("content-type"),I=C&&C.startsWith("application/json");let w;if(o.method!=="HEAD"&&(I?w=await c.json():w=await c.text()),!c.ok){if(w){const A=I&&(w.status?.message||w.error||""),j=typeof w=="string"?w:c.statusText||`[[error:api.${c.status}]]`;throw new Error(I&&A?A:j)}throw new Error(c.statusText)}return I&&w&&w.hasOwnProperty("status")&&w.hasOwnProperty("response")?w.response:w}function r(o,m,c){return f({url:o+(m&&Object.keys(m).length?"?"+$.param(m):"")},c)}function e(o,m,c){return f({url:o+(m&&Object.keys(m).length?"?"+$.param(m):""),method:"HEAD"},c)}function n(o,m,c,y){return b("POST",o,m,c,y)}function i(o,m,c,y){return b("PATCH",o,m,c,y)}function l(o,m,c,y){return b("PUT",o,m,c,y)}function D(o,m,c,y){return b("DELETE",o,m,c,y)}function b(o,m,c,y,C){return typeof y=="function"&&(C=y,y={}),f({url:m,method:o,data:c,headers:{"x-csrf-token":config.csrf_token,...y}},C)}},65303(v,x,s){s.r(x),s.d(x,{alert:()=>E,confirm:()=>P,dialog:()=>d,prompt:()=>t,promptPassword:()=>f});var h=s(33530),p=s.n(h),u=s(17459),g=s.n(u);h.setDefaults({locale:config.userLang}),u.translateKeys(["modules:bootbox.ok","modules:bootbox.cancel","modules:bootbox.confirm"]).then(e=>{h.addLocale(config.userLang,{OK:e[0],CANCEL:e[1],CONFIRM:e[2]}),h.setLocale(config.userLang)});async function d(e){const[n,i,l]=await Promise.all([u.translate(e.title||""),a(e)||"",r(e.buttons)]);return h.dialog({...e,title:n,message:i,buttons:l})}async function E(e,n){const[i,l]=await Promise.all([e&&e.title?u.translate(e.title):null,a(e)]);return n=typeof n=="function"?n:e.callback,h.alert({...e,title:i,message:l,callback:n})}async function P(e,n){const[i,l]=await Promise.all([e&&e.title?u.translate(e.title):null,a(e)]);return n=typeof n=="function"?n:e.callback,h.confirm({...e,title:i,message:l,callback:n})}async function t(e,n){const[i,l]=await Promise.all([u.translate(typeof e=="string"?e:e.title),e&&e.message?a(e):null]);return n=typeof n=="function"?n:e.callback,h.prompt({...e,title:i,message:l,callback:n})}async function f(e){return typeof e=="string"&&(e={title:e}),e=e||{title:"[[user:current-password]]",message:"[[user:emailUpdate.password-challenge]]"},await new Promise(n=>{t({...e,inputType:"password",required:!0,value:"",callback:n})})}function a(e){const n=e&&e.message?e.message:e;return n instanceof jQuery?n:u.translate(n||"")}async function r(e){if(!Object.keys(e||{}).length)return;const n=Object.values(e);return await Promise.all(n.map(async i=>({...i,label:await u.translateKey(i.label)})))}},72254(v,x,s){var h,p;h=[s(29930)],p=(function(u){const g={};g.show=function(t,f){const a=t.hasOwnProperty("fileSize")&&t.fileSize!==void 0?parseInt(t.fileSize,10):!1;app.parseAndTranslate("modals/upload-file",{showHelp:t.hasOwnProperty("showHelp")&&t.showHelp!==void 0?t.showHelp:!0,fileSize:a,title:t.title||"[[global:upload-file]]",description:t.description||"",button:t.button||"[[global:upload]]",accept:t.accept?t.accept.replace(/,/g,", "):""},function(r){r.modal("show"),r.on("hidden.bs.modal",function(){r.remove()});const e=r.find("#uploadForm");t.route&&e.attr("action",t.route),r.find("#fileUploadSubmitBtn").on("click",function(){return $(this).addClass("disabled"),t.uploadModal=r,P(t,f),!1})})},g.handleImageCrop=function(t,f){$("#crop-picture-modal").remove(),app.parseAndTranslate("modals/crop_picture",{url:utils.escapeHTML(t.url)},async function(a){a.modal({backdrop:"static"}).modal("show");const r=parseInt($(window).height()/2,10),e=document.getElementById("cropped-image");$(e).css("max-height",r);const n=(await s.e(60239).then(s.t.bind(s,65643,23))).default;let i=new n(e,{aspectRatio:t.aspectRatio,autoCropArea:1,viewMode:1,checkCrossOrigin:!0,cropmove:function(){t.restrictImageDimension&&(i.cropBoxData.width>t.imageDimension&&i.setCropBoxData({width:t.imageDimension}),i.cropBoxData.height>t.imageDimension&&i.setCropBoxData({height:t.imageDimension}))},ready:function(){if(!E(i,t))return a.modal("hide");if(t.restrictImageDimension){const l=e.width<e.height?e.width:e.height,D=l>
1t.imageDimension?t.imageDimension:l;i.setCropBoxData({width:D,height:D})}a.find(".rotate").on("click",function(){const l=this.getAttribute("data-degrees");i.rotate(l)}),a.find(".flip").on("click",function(){const l=this.getAttribute("data-option");this.getAttribute("data-method")==="scaleX"?i.scaleX(l):i.scaleY(l),this.setAttribute("data-option",l*-1)}),a.find(".reset").on("click",function(){i.reset()}),a.find(".crop-btn").on("click",function(){const l=E(i,t);l&&($(this).addClass("disabled"),a.find("#upload-progress-bar").css("width","0%"),a.find("#upload-progress-box").show().removeClass("hide"),d({data:t,imageData:l,progressBarEl:a.find("#upload-progress-bar")},function(D,b){if(D)return a.find("#upload-progress-box").hide(),a.find(".upload-btn").removeClass("disabled"),a.find(".crop-btn").removeClass("disabled"),u.error(D);f(b.url),a.modal("hide")}))}),a.find(".upload-btn").on("click",async function(){$(this).addClass("disabled"),i.destroy();const l=(await s.e(60239).then(s.t.bind(s,65643,23))).default;i=new l(e,{viewMode:1,autoCropArea:1,ready:function(){a.find(".crop-btn").trigger("click")}})})}})})};function d(t,f){const a={};a[t.data.paramName]=t.data.paramValue,a.method=t.data.socketMethod,a.size=t.imageData.length,a.progress=0;const r=1e5;function e(){const n=t.imageData.slice(a.progress,a.progress+r);socket.emit("uploads.upload",{chunk:n,params:a},function(i,l){if(i)return f(i);if(a.progress+r<a.size)return a.progress+=n.length,t.progressBarEl.css("width",(a.progress/a.size*100).toFixed(2)+"%"),setTimeout(e,100);t.progressBarEl.css("width","100%"),f(null,l)})}e()}function E(t,f){let a;try{const r={};f.restrictImageDimension&&(r.width=f.imageDimension,r.height=f.imageDimension,r.imageSmoothingEnabled=!0,r.imageSmoothingQuality="high"),a=f.imageType?t.getCroppedCanvas(r).toDataURL(f.imageType):t.getCroppedCanvas(r).toDataURL()}catch(r){["The operation is insecure.","Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported."].indexOf(r.message)!==-1?u.error("[[error:cors-error]]"):u.error(r.message);return}return a}function P(t,f){function a(l,D){l==="error"&&t.uploadModal.find("#fileUploadSubmitBtn").removeClass("disabled"),t.uploadModal.find("#alert-"+l).translateText(D).removeClass("hide")}const r=t.uploadModal.find("#fileInput");if(!r.val())return a("error","[[uploads:select-file-to-upload]]");const e=r[0].files[0],n=t.hasOwnProperty("fileSize")&&t.fileSize?parseInt(t.fileSize,10):!1;if(n&&e.size>n*1024)return a("error","[[error:file-too-big, "+n+"]]");if(e.name.endsWith(".gif")){s.e(98463).then(function(){var l=[s(24187)];(function(D){D.ajaxSubmit(t.uploadModal,f)}).apply(null,l)}).catch(s.oe);return}const i=new FileReader;i.addEventListener("load",function(){const l=i.result;t.uploadModal.modal("hide"),g.handleImageCrop({url:l,imageType:e.type,socketMethod:t.socketMethod,aspectRatio:t.aspectRatio,allowSkippingCrop:t.allowSkippingCrop,restrictImageDimension:t.restrictImageDimension,imageDimension:t.imageDimension,paramName:t.paramName,paramValue:t.paramValue},f)},!1),e&&i.readAsDataURL(e)}return g}).apply(x,h),p!==void 0&&(v.exports=p)},68636(v,x,s){var h;h=(function(){function p(){this._store={},this._keys=[]}p.prototype.isMock=!0,p.prototype.setItem=function(d,E){d=String(d),this._keys.indexOf(d)===-1&&this._keys.push(d),this._store[d]=E},p.prototype.getItem=function(d){return d=String(d),this._keys.indexOf(d)===-1?null:this._store[d]},p.prototype.removeItem=function(d){d=String(d),this._keys=this._keys.filter(function(E){return E!==d}),this._store[d]=null},p.prototype.clear=function(){this._keys=[],this._store={}},p.prototype.key=function(d){return d=parseInt(d,10)||0,this._keys[d]},Object.defineProperty&&Object.defineProperty(p.prototype,"length",{get:function(){return this._keys.length}});let u;const g=Date.now().toString();try{if(u=window.localStorage,u.setItem(g,g),u.getItem(g)!==g)throw Error("localStorage behaved unexpectedly");return u.removeItem(g),u}catch(d){console.warn(d),console.warn("localStorage failed, falling back on sessionStorage");try{if(u=window.sessionStorage,u.setItem(g,g),u.getItem(g)!==g)throw Error("sessionStorage behaved unexpectedly");return u.removeItem(g),u}catch(E){return console.warn(E),console.warn("sessionStorage failed, falling back on memory storage"),new p}}}
1).call(x,s,x,v),h!==void 0&&(v.exports=h)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.