/home/techb158/immovalet.com/platform/plugins/ecommerce/public/js
Edit: /home/techb158/immovalet.com/platform/plugins/ecommerce/public/js/avatar.js (197981B)
(()=>{var e={3521:(e,t,n)=>{var i,r,o;n(1645),n(3734);var a=function(e,t){var n="";$.each(e,(function(e,t){n+=t+"
"})),$(t).find(".success-message").html("").hide(),$(t).find(".error-message").html("").hide(),$(t).find(".error-message").html(n).show()};r=[n(9755)],void 0===(o="function"==typeof(i=function(e){function t(e){this.$container=e,this.$avatarView=this.$container.find(".avatar-view"),this.$avatar=this.$avatarView.find("img"),this.$avatarModal=this.$container.find("#avatar-modal"),this.$loading=this.$container.find(".loading"),this.$avatarForm=this.$avatarModal.find(".avatar-form"),this.$avatarSrc=this.$avatarForm.find(".avatar-src"),this.$avatarData=this.$avatarForm.find(".avatar-data"),this.$avatarInput=this.$avatarForm.find(".avatar-input"),this.$avatarSave=this.$avatarForm.find(".avatar-save"),this.$avatarWrapper=this.$avatarModal.find(".avatar-wrapper"),this.$avatarPreview=this.$avatarModal.find(".avatar-preview"),this.init()}t.prototype={constructor:t,support:{fileList:!!e('
').prop("files"),fileReader:!!window.FileReader,formData:!!window.FormData},init:function(){this.support.datauri=this.support.fileList&&this.support.fileReader,this.support.formData||this.initIframe(),this.initModal(),this.addListener()},addListener:function(){this.$avatarView.on("click",e.proxy(this.click,this)),this.$avatarInput.on("change",e.proxy(this.change,this)),this.$avatarForm.on("submit",e.proxy(this.submit,this))},initModal:function(){this.$avatarModal.modal("hide"),this.initPreview()},initPreview:function(){var e=this.$avatar.prop("src");this.$avatarPreview.empty().html('

')},initIframe:function(){var t="avatar-iframe-"+Math.random().toString().replace(".",""),n=e('
'),i=!0,r=this;this.$iframe=n,this.$avatarForm.attr("target",t).after(n),this.$iframe.on("load",(function(){var t,n,o;try{n=this.contentWindow,t=(o=(o=this.contentDocument)||n.document)?o.body.innerText:null}catch(e){}t?r.submitDone(t):i?i=!1:e("#print-msg").text("Image upload failed!").removeClass("hidden"),r.submitEnd()}))},click:function(){this.$avatarModal.modal("show")},change:function(){var e,t;this.support.datauri?(e=this.$avatarInput.prop("files")).length>0&&(t=e[0],this.isImageFile(t)&&this.read(t)):(t=this.$avatarInput.val(),this.isImageFile(t)&&this.syncUpload())},submit:function(){return this.$avatarSrc.val()||this.$avatarInput.val()?this.support.formData?(this.ajaxUpload(),!1):void 0:(alert("Please select image!"),!1)},isImageFile:function(e){return e.type?/^image\/\w+$/.test(e.type):/\.(jpg|jpeg|png|gif)$/.test(e)},read:function(e){var t=this,n=new FileReader;n.readAsDataURL(e),n.onload=function(){t.url=this.result,t.startCropper()}},startCropper:function(){var t=this;this.active?this.$img.cropper("replace",this.url):(this.$img=e('

'),this.$avatarWrapper.empty().html(this.$img),this.$img.cropper({aspectRatio:1,rotatable:!0,preview:this.$avatarPreview.selector,done:function(e){var n=['{"x":'+e.x,'"y":'+e.y,'"height":'+e.height,'"width":'+e.width+"}"].join();t.$avatarData.val(n)}}),this.active=!0)},stopCropper:function(){this.active&&(this.$img.cropper("destroy"),this.$img.remove(),this.active=!1)},ajaxUpload:function(){var t=this.$avatarForm.attr("action"),n=new FormData(this.$avatarForm[0]),i=this;e.ajax(t,{type:"post",data:n,processData:!1,contentType:!1,beforeSend:function(){i.submitStart()},success:function(e){i.submitDone(e)},error:function(e){!function(e,t){if(void 0===e.errors||_.isArray(e.errors))if(void 0!==e.responseJSON)if(void 0!==e.responseJSON.errors)422===e.status&&a(e.responseJSON.errors,t);else if(void 0!==e.responseJSON.message)$(t).find(".error-message").html(e.responseJSON.message).show();else{var n="";$.each(e.responseJSON,(function(e,t){$.each(t,(function(e,t){n+=t+"
"}))})),$(t).find(".error-message").html(n).show()}else $(t).find(".error-message").html(e.statusText).show();else a(e.errors,t)}(e)},complete:function(){i.submitEnd()}})},syncUpload:function(){this.$avatarSave.click()},submitStart:function(){this.$loading.fadeIn(),this.$avatarSave.attr("disabled",!0).text("Saving...")},submitDone:function(t){try{t=e.parseJSON(t)}catch(e){}t&&!t.error?t.error?e("#print-msg").text(t.message).removeClass("hidden"):(this.url=t.data.url,this.support.datauri||this.uploaded?(this.uploaded=!1,this.cropDone()):(this.uploaded=!0,this.$avatarSrc.val(this.url),this.startCropper()),this.$avatarInput.val("")):e("#print-msg").text(t.message).removeClass("hidden")},submitEnd:function(){this.$loading.fadeOut(),this.$avatarSave.removeAttr("disabled").text("Save")},cropDone:function(){this.$avatarSrc.val(""),this.$avatarData.val(""),this.$avatar.prop("src",this.url),e(".user-menu img").prop("src",this.url),e(".user.dropdown img").prop("src",this.url),this.stopCropper(),this.initModal()}},e((function(){new t(e(".crop-avatar"))}))})?i.apply(t,r):i)||(e.exports=o)},1645:(e,t,n)=>{var i,r,o;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
/*!
* Cropper v0.7.9
* https://github.com/fengyuanchen/cropper
*
* Copyright 2014-2015 Fengyuan Chen
* Released under the MIT license
*/r=[n(9755)],void 0===(o="function"==typeof(i=function(e){"use strict";var t=e(window),n=e(document),i=window.location,r=!0,o=!1,s=null,l=1/0,u="undefined",c="directive",f=".cropper",d=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,h=/^(x|y|width|height)$/,p=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,g="cropper-modal",m="cropper-hidden",v="cropper-invisible",y="cropper-crop",b="cropper-disabled",_="mousedown touchstart",w="mousemove touchmove",x="mouseup mouseleave touchend touchleave touchcancel",E="wheel mousewheel DOMMouseScroll",T="resize"+f,C="dblclick",S="build"+f,D="built"+f,k="dragstart"+f,N="dragmove"+f,A="dragend"+f,j=function(e){return"number"==typeof e},O=function(e,t){var n=[];return j(t)&&n.push(t),n.slice.apply(e,n)},I=function(e,t){var n=O(arguments,2);return function(){return e.apply(t,n.concat(O(arguments)))}},L=function t(n,i){this.element=n,this.$element=e(n),this.defaults=e.extend({},t.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=s,this.ready=o,this.built=o,this.cropped=o,this.rotated=o,this.disabled=o,this.replaced=o,this.init()},H=Math.sqrt,$=Math.min,P=Math.max,R=Math.abs,q=Math.sin,M=Math.cos,F=parseFloat;L.prototype={constructor:L,support:{canvas:e.isFunction(e("
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",customClass:"",sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},popperConfig:null},Qe="show",Ve="out",Ke={HIDE:"hide"+Me,HIDDEN:"hidden"+Me,SHOW:"show"+Me,SHOWN:"shown"+Me,INSERTED:"inserted"+Me,CLICK:"click"+Me,FOCUSIN:"focusin"+Me,FOCUSOUT:"focusout"+Me,MOUSEENTER:"mouseenter"+Me,MOUSELEAVE:"mouseleave"+Me},Je="fade",Ge="show",Ze="hover",et="focus",tt=function(){function e(e,t){if(void 0===o.default)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=e,this.config=this._getConfig(t),this.tip=null,this._setListeners()}var t=e.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(e){if(this._isEnabled)if(e){var t=this.constructor.DATA_KEY,n=r.default(e.currentTarget).data(t);n||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),r.default(e.currentTarget).data(t,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(r.default(this.getTipElement()).hasClass(Ge))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),r.default.removeData(this.element,this.constructor.DATA_KEY),r.default(this.element).off(this.constructor.EVENT_KEY),r.default(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&r.default(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===r.default(this.element).css("display"))throw new Error("Please use show on visible elements");var t=r.default.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){r.default(this.element).trigger(t);var n=d.findShadowRoot(this.element),i=r.default.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!i)return;var a=this.getTipElement(),s=d.getUID(this.constructor.NAME);a.setAttribute("id",s),this.element.setAttribute("aria-describedby",s),this.setContent(),this.config.animation&&r.default(a).addClass(Je);var l="function"==typeof this.config.placement?this.config.placement.call(this,a,this.element):this.config.placement,u=this._getAttachment(l);this.addAttachmentClass(u);var c=this._getContainer();r.default(a).data(this.constructor.DATA_KEY,this),r.default.contains(this.element.ownerDocument.documentElement,this.tip)||r.default(a).appendTo(c),r.default(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new o.default(this.element,a,this._getPopperConfig(u)),r.default(a).addClass(Ge),r.default(a).addClass(this.config.customClass),"ontouchstart"in document.documentElement&&r.default(document.body).children().on("mouseover",null,r.default.noop);var f=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,r.default(e.element).trigger(e.constructor.Event.SHOWN),t===Ve&&e._leave(null,e)};if(r.default(this.tip).hasClass(Je)){var h=d.getTransitionDurationFromElement(this.tip);r.default(this.tip).one(d.TRANSITION_END,f).emulateTransitionEnd(h)}else f()}},t.hide=function(e){var t=this,n=this.getTipElement(),i=r.default.Event(this.constructor.Event.HIDE),o=function(){t._hoverState!==Qe&&n.parentNode&&n.parentNode.removeChild(n),t._cleanTipClass(),t.element.removeAttribute("aria-describedby"),r.default(t.element).trigger(t.constructor.Event.HIDDEN),null!==t._popper&&t._popper.destroy(),e&&e()};if(r.default(this.element).trigger(i),!i.isDefaultPrevented()){if(r.default(n).removeClass(Ge),"ontouchstart"in document.documentElement&&r.default(document.body).children().off("mouseover",null,r.default.noop),this._activeTrigger.click=!1,this._activeTrigger[et]=!1,this._activeTrigger[Ze]=!1,r.default(this.tip).hasClass(Je)){var a=d.getTransitionDurationFromElement(n);r.default(n).one(d.TRANSITION_END,o).emulateTransitionEnd(a)}else o();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(e){r.default(this.getTipElement()).addClass(We+"-"+e)},t.getTipElement=function(){return this.tip=this.tip||r.default(this.config.template)[0],this.tip},t.setContent=function(){var e=this.getTipElement();this.setElementContent(r.default(e.querySelectorAll(".tooltip-inner")),this.getTitle()),r.default(e).removeClass(Je+" "+Ge)},t.setElementContent=function(e,t){"object"!=typeof t||!t.nodeType&&!t.jquery?this.config.html?(this.config.sanitize&&(t=Pe(t,this.config.whiteList,this.config.sanitizeFn)),e.html(t)):e.text(t):this.config.html?r.default(t).parent().is(e)||e.empty().append(t):e.text(r.default(t).text())},t.getTitle=function(){var e=this.element.getAttribute("data-original-title");return e||(e="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),e},t._getPopperConfig=function(e){var t=this;return l({},{placement:e,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(e){e.originalPlacement!==e.placement&&t._handlePopperPlacementChange(e)},onUpdate:function(e){return t._handlePopperPlacementChange(e)}},this.config.popperConfig)},t._getOffset=function(){var e=this,t={};return"function"==typeof this.config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e.config.offset(t.offsets,e.element)||{}),t}:t.offset=this.config.offset,t},t._getContainer=function(){return!1===this.config.container?document.body:d.isElement(this.config.container)?r.default(this.config.container):r.default(document).find(this.config.container)},t._getAttachment=function(e){return Xe[e.toUpperCase()]},t._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach((function(t){if("click"===t)r.default(e.element).on(e.constructor.Event.CLICK,e.config.selector,(function(t){return e.toggle(t)}));else if("manual"!==t){var n=t===Ze?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,i=t===Ze?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;r.default(e.element).on(n,e.config.selector,(function(t){return e._enter(t)})).on(i,e.config.selector,(function(t){return e._leave(t)}))}})),this._hideModalHandler=function(){e.element&&e.hide()},r.default(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var e=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==e)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(e,t){var n=this.constructor.DATA_KEY;(t=t||r.default(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),r.default(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusin"===e.type?et:Ze]=!0),r.default(t.getTipElement()).hasClass(Ge)||t._hoverState===Qe?t._hoverState=Qe:(clearTimeout(t._timeout),t._hoverState=Qe,t.config.delay&&t.config.delay.show?t._timeout=setTimeout((function(){t._hoverState===Qe&&t.show()}),t.config.delay.show):t.show())},t._leave=function(e,t){var n=this.constructor.DATA_KEY;(t=t||r.default(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),r.default(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusout"===e.type?et:Ze]=!1),t._isWithActiveTrigger()||(clearTimeout(t._timeout),t._hoverState=Ve,t.config.delay&&t.config.delay.hide?t._timeout=setTimeout((function(){t._hoverState===Ve&&t.hide()}),t.config.delay.hide):t.hide())},t._isWithActiveTrigger=function(){for(var e in this._activeTrigger)if(this._activeTrigger[e])return!0;return!1},t._getConfig=function(e){var t=r.default(this.element).data();return Object.keys(t).forEach((function(e){-1!==Ue.indexOf(e)&&delete t[e]})),"number"==typeof(e=l({},this.constructor.Default,t,"object"==typeof e&&e?e:{})).delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),d.typeCheckConfig(Re,e,this.constructor.DefaultType),e.sanitize&&(e.template=Pe(e.template,e.whiteList,e.sanitizeFn)),e},t._getDelegateConfig=function(){var e={};if(this.config)for(var t in this.config)this.constructor.Default[t]!==this.config[t]&&(e[t]=this.config[t]);return e},t._cleanTipClass=function(){var e=r.default(this.getTipElement()),t=e.attr("class").match(Be);null!==t&&t.length&&e.removeClass(t.join(""))},t._handlePopperPlacementChange=function(e){this.tip=e.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(e.placement))},t._fixTransition=function(){var e=this.getTipElement(),t=this.config.animation;null===e.getAttribute("x-placement")&&(r.default(e).removeClass(Je),this.config.animation=!1,this.hide(),this.show(),this.config.animation=t)},e._jQueryInterface=function(t){return this.each((function(){var n=r.default(this),i=n.data(qe),o="object"==typeof t&&t;if((i||!/dispose|hide/.test(t))&&(i||(i=new e(this,o),n.data(qe,i)),"string"==typeof t)){if(void 0===i[t])throw new TypeError('No method named "'+t+'"');i[t]()}}))},s(e,null,[{key:"VERSION",get:function(){return"4.6.0"}},{key:"Default",get:function(){return Ye}},{key:"NAME",get:function(){return Re}},{key:"DATA_KEY",get:function(){return qe}},{key:"Event",get:function(){return Ke}},{key:"EVENT_KEY",get:function(){return Me}},{key:"DefaultType",get:function(){return ze}}]),e}();r.default.fn[Re]=tt._jQueryInterface,r.default.fn[Re].Constructor=tt,r.default.fn[Re].noConflict=function(){return r.default.fn[Re]=Fe,tt._jQueryInterface};var nt="popover",it="bs.popover",rt="."+it,ot=r.default.fn[nt],at="bs-popover",st=new RegExp("(^|\\s)"+at+"\\S+","g"),lt=l({},tt.Default,{placement:"right",trigger:"click",content:"",template:'