text: !function(e,o){e.nabopicro||(e.nabopicro=function(o,t,a){var n=this;return n.element=document.querySelector(o),n.photoHelper=n.element.getElementsByClassName("photo__helper")[0],n.photoOptions=n.element.getElementsByClassName("photo__options")[0],n.photoArea=n.element.getElementsByClassName("photo")[0],n.zoomControl=n.element.getElementsByClassName("zoom-handler")[0],n.photoFrame=n.element.getElementsByClassName("photo__frame")[0],n.canvas=n.photoFrame.getElementsByClassName("photo__canvas")[0],n.photoLoading=n.photoFrame.getElementsByClassName("message.is-loading")[0],n.model={imageSrc:null,width:null,height:null,originalWidth:null,originalHeight:null,y:null,x:null,zoom:1,cropWidth:null,cropHeight:null,file:null},n.options={},n.defaults={},n.defaults.imageHelper=!0,n.defaults.imageHelperColor="rgba(255,255,255,.90)",n.defaults.onChange=null,n.defaults.onZoomChange=null,n.defaults.onImageSizeChange=null,n.defaults.onPositionChange=null,n.defaults.onLoad=null,n.defaults.onRemove=null,n.defaults.onError=null,n.defaults.zoom={initialValue:1,minValue:.1,maxValue:2,step:.01},n.defaults.image={originalWidth:0,originalHeight:0,originaly:0,originalX:0,minWidth:350,minHeight:350,maxWidth:1e3,maxHeight:1e3},function(o,t,a){var i;n.canvas.width=n.photoFrame.offsetWidth,n.canvas.height=n.photoFrame.offsetHeight,n.canvasContext=n.canvas.getContext("2d"),n.options=Object.assign(n.defaults,a),n.options.imageHelper&&((i=document.createElement("canvas")).className="canvas--helper",i.width=n.photoHelper.offsetWidth,i.height=n.photoHelper.offsetHeight,n.photoHelper.prepend(i),n.imageHelperCanvas=i,n.imageHelperCanvasContext=i.getContext("2d"),n.imageHelperCanvasContext.mozImageSmoothingEnabled=!1,n.imageHelperCanvasContext.msImageSmoothingEnabled=!1,n.imageHelperCanvasContext.imageSmoothingEnabled=!1),function(){var e=null;function o(e){if(n.photoArea.classList.remove("photo--error","photo--error--file-type","photo--error-image-size"),!e.type.match("image.*"))return n.photoArea.classList.add("photo--error--file-type"),void("function"==typeof n.options.onError&&n.options.onError("file-type"));var o;(o=new FileReader).onloadstart=function(){n.photoArea.classList.add("photo--loading")},o.onloadend=function(o){var t=o.target.result;l(t,e.type)},o.onerror=function(){n.photoArea.classList.add("photo--error"),"function"==typeof n.options.onError&&n.options.onError("unknown")},n.model.file=e,o.readAsDataURL(e)}h(n.element,"drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"}),h(n.element,"dragend dragleave drop",function(o){e===o.target&&n.element.classList.remove("is-dragover")}),h(n.element,"dragover dragenter",function(o){e=o.target,n.element.classList.add("is-dragover")}),h(n.element,"change",function(e){var t=event.target.files;t&&t.length&&(o(t[0]),event.target.value="")},"input[type=file]"),h(n.element,"click",function(e){n.element.querySelector("input[type=file]").click()},".photo--empty .photo__frame"),h(n.element,"click",function(e){n.photoHelper.style.cursor="auto",m()},".remove"),h(n.element,"drop",function(e){o(e.dataTransfer.files[0])})}(),function(){var o,t,a,i,l;function m(e){o=!0,i=e.clientX,l=e.clientY,e.touches&&(i=e.touches[0].clientX,l=e.touches[0].clientY),t=i-n.model.x,a=l-n.model.y}n.options.imageHelper?h(n.photoHelper,"mousedown touchstart",m):h(n.photoFrame,"mousedown touchstart",m),h(e,"mouseup touchend",function(e){o&&("function"==typeof n.options.onPositionChange&&n.options.onPositionChange(n.model),"function"==typeof n.options.onChange&&n.options.onChange(n.model)),o=null}),h(e,"mousemove touchmove",function(e){if(o){e.preventDefault();var m=!1;i=e.clientX,l=e.clientY,e.touches&&(i=e.touches[0].clientX,l=e.touches[0].clientY);var r=l-a,s=i-t;s=Math.min(s,0),r=Math.min(r,0),n.model.width+s>=n.model.cropWidth&&(n.model.x=s,m=!0),n.model.height+r>=n.model.cropHeight&&(n.model.y=r,m=!0),m&&d()}})}(),n.zoomControl.setAttribute("min",n.options.zoom.minValue),n.zoomControl.setAttribute("max",n.options.zoom.maxValue),n.zoomControl.setAttribute("step",n.options.zoom.step),n.zoomControl.value=n.options.zoom.initialValue,n.zoomControl.addEventListener("input",function(e){n.model.zoom=Number(this.value),s(),r(),"function"==typeof n.options.onZoomChange&&n.options.onZoomChange(n.model)}),t?l(t):n.photoArea.classList.add("photo--empty")}(0,t,a),{getData:function(){return this.model}.bind(this),getAsDataURL:function(e){return e||(e=.8),n.canvas.toDataURL("image/jpeg",e)}.bind(this),removeImage:m.bind(this)};function i(e){n.model=e}function l(e){function o(e){return!!(e=e.toString()).match(o.regex)}o.regex=/^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i;var t=new Image;o(e)||(t.crossOrigin="anonymous"),n.photoArea.classList.add("photo--loading"),t.onload=function(){var e,o,a,l=this.width,m=this.height;if(l<n.options.image.minWidth||m<n.options.image.minHeight)return n.photoArea.classList.add("photo--error--image-size","photo--empty"),i({}),"function"==typeof n.options.onError&&n.options.onError("image-size"),void n.photoArea.classList.remove("photo--loading");n.photoArea.classList.remove("photo--error--image-size"),n.photoArea.classList.remove("photo--empty","photo--error--file-type","photo--loading");var r=n.options.image.maxHeight/n.options.image.maxWidth,h=n.model.height/n.model.width;r>h?(o=n.options.image.maxHeight,e=o/m,a=parseFloat(l)*e):(a=n.options.image.maxWidth,e=a/l,o=parseFloat(m)*e),m=o,l=a,n.model.imageSrc=t,n.model.originalHeight=m,n.model.originalWidth=l,n.model.height=m,n.model.width=l,n.model.cropWidth=n.photoFrame.offsetWidth,n.model.cropHeight=n.photoFrame.offsetHeight,n.model.x=0,n.model.y=0,n.photoOptions.classList.remove("hide"),n.photoHelper.style.cursor="move",function(){var e,o,t,a=n.model.cropHeight/n.model.cropWidth,i=n.model.height/n.model.width;a>i?(e=n.model.cropHeight,t=e/n.model.height,o=parseFloat(n.model.width)*t):(o=n.model.cropWidth,t=o/n.model.width,e=parseFloat(n.model.height)*t);n.model.zoom=t,n.zoomControl.setAttribute("min",t),n.zoomControl.setAttribute("max",n.options.zoom.maxValue-t),n.zoomControl.value=t,n.model.height=e,n.model.width=o,s(),function(){var e=Math.abs(n.model.x-(n.model.width-n.model.cropWidth)/2),o=Math.abs(n.model.y-(n.model.height-n.model.cropHeight)/2);e=n.model.x-e,o=n.model.y-o,e=Math.min(e,0),o=Math.min(o,0),n.model.width+e<n.model.cropWidth&&(e=-1*Math.abs(n.model.width-n.model.cropWidth));n.model.height+o<n.model.cropHeight&&(o=-1*Math.abs(n.model.height-n.model.cropHeight));n.model.x=e,n.model.y=o}()}(),d(),"function"==typeof n.options.onLoad&&n.options.onLoad(n.model)},t.src=e}function m(){n.canvasContext.clearRect(0,0,n.model.cropWidth,n.model.cropHeight),n.canvasContext.save(),n.photoArea.classList.add("photo--empty"),n.imageHelperCanvasContext.clearRect(0,0,n.imageHelperCanvas.width,n.imageHelperCanvas.height),n.imageHelperCanvasContext.save(),i({}),"function"==typeof n.options.onRemove&&n.options.onRemove(n.model)}function r(){var e=n.model.originalWidth*n.model.zoom,o=n.model.originalHeight*n.model.zoom,t=function(e,o){var t=(n.model.y-n.model.cropHeight/2)/n.model.height,a=(n.model.x-n.model.cropWidth/2)/n.model.width,i=t*o+n.model.cropHeight/2,l=a*e+n.model.cropWidth/2;l=Math.min(l,0),i=Math.min(i,0),e+l<n.model.cropWidth&&(l=-1*Math.abs(e-n.model.cropWidth));o+i<n.model.cropHeight&&(i=-1*Math.abs(o-n.model.cropHeight));return{x:l,y:i}}(e,o);n.model.width=e,n.model.height=o,n.model.x=t.x,n.model.y=t.y,s(),d(),"function"==typeof n.options.onImageSizeChange&&n.options.onImageSizeChange(n.model)}function s(){n.model.zoom.toFixed(2)==Number(n.zoomControl.getAttribute("min")).toFixed(2)?n.zoomControl.classList.add("zoom--minValue"):n.zoomControl.classList.remove("zoom--minValue"),n.model.zoom.toFixed(2)==Number(n.zoomControl.getAttribute("max")).toFixed(2)?n.zoomControl.classList.add("zoom--maxValue"):n.zoomControl.classList.remove("zoom--maxValue")}function d(){var e,o;n.canvasContext.clearRect(0,0,n.model.cropWidth,n.model.cropHeight),n.canvasContext.save(),n.canvasContext.globalCompositeOperation="destination-over",n.canvasContext.drawImage(n.model.imageSrc,n.model.x,n.model.y,n.model.width,n.model.height),n.canvasContext.restore(),n.options.imageHelper&&(e=n.model.x+n.photoFrame.offsetLeft,o=n.model.y+n.photoFrame.offsetTop,n.imageHelperCanvasContext.clearRect(0,0,n.imageHelperCanvas.width,n.imageHelperCanvas.height),n.imageHelperCanvasContext.save(),n.imageHelperCanvasContext.globalCompositeOperation="destination-over",n.imageHelperCanvasContext.beginPath(),n.imageHelperCanvasContext.rect(0,0,n.imageHelperCanvas.width,n.imageHelperCanvas.height),n.imageHelperCanvasContext.fillStyle=n.options.imageHelperColor,n.imageHelperCanvasContext.fill("evenodd"),n.imageHelperCanvasContext.drawImage(n.model.imageSrc,e,o,n.model.width,n.model.height),n.imageHelperCanvasContext.restore()),"function"==typeof n.options.onChange&&n.options.onChange(n.model)}function h(e,o,t,a){var n=t;a&&(n=function(e){var o=e.target,n=o.closest(a);n&&t(n)}),o.split(" ").forEach(function(o){e.addEventListener(o,n)})}})}(window);
  