Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
unlimited-elements-for-elementor
/
assets_libraries
/
unitegallery
/
js
:
unitegallery.min.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
//Unite Gallery, Version: 1.7.86, released 24 August 2025 function debugLine(e,t,i){!0===e&&(e="true"),!1===e&&(e="false");var n=e;if("object"==typeof e)for(name in n="",e){var r=e[name];n+=" "+name+": "+r}1!=t||i||(n+=" "+Math.random()),1==i&&((i=jQuery("#debug_line")).width(200),500<=i.height()&&i.html(""),n=i.html()+"<br> -------------- <br>"+n),jQuery("#debug_line").show().html(n)}function debugSide(e){var t="";for(name in e){var i=e[name];t+=name+" : "+i+"<br>"}jQuery("#debug_side").show().html(t)}function trace(e){"undefined"!=typeof console&&console.log(e)}function UGFunctions(){var r=null,v=this,o={starTime:0,arrThemes:[],isTouchDevice:-1,isRgbaSupported:-1,timeCache:{},dataCache:{},lastEventType:"",lastEventTime:0,lastTouchStartElement:null,touchThreshold:700,handle:null};function t(e,t,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent?t.attachEvent("on"+e,i):t[e]=i}this.debugVar="",this.getvalopt={FORCE_BOOLEAN:"force_boolean",FORCE_NUMERIC:"force_numeric",TRIM:"trim"},this.z__________GENERAL___________=function(){},this.getVal=function(e,t,i,n){i=i||"";var r="",r=!e||"object"!=typeof e||0==e.hasOwnProperty(t)?i:e[t];switch(n){case v.getvalopt.FORCE_BOOLEAN:r=v.strToBool(r);break;case v.getvalopt.TRIM:r=String(r),r=jQuery.trim(r);break;case v.getvalopt.FORCE_NUMERIC:"string"==typeof(r=jQuery.trim(r))&&(r.replace("px",""),r=Number(r))}return r},this.z__________FULL_SCREEN___________=function(){},this.toFullscreen=function(e,t){if(e.requestFullscreen)e.requestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},this.exitFullscreen=function(){if(0==v.isFullScreen())return!1;if(document.exitFullscreen)document.exitFullscreen();else if(document.cancelFullScreen)document.cancelFullScreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},this.addFullScreenChangeEvent=function(e){document.msExitFullscreen?t("MSFullscreenChange",document,e):document.onfullscreenchange?t("mozfullscreenchange",document,e):t("fullscreenchange",document,e)},this.destroyFullScreenChangeEvent=function(){jQuery(document).unbind("fullscreenChange"),jQuery(document).unbind("mozfullscreenchange"),jQuery(document).unbind("webkitfullscreenchange"),jQuery(document).unbind("MSFullscreenChange")},this.getFullScreenElement=function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},this.isFullScreen=function(){var e=document.fullscreen||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement;return e=!!e},this.z__________GET_PROPS___________=function(){},this.getBrowserPrefix=function(){if(null!==r)return r;var e,t=["webkit","Moz","ms","O"],i=document.createElement("div");for(e in t){var n=t[e];if(n+"Transform"in i.style)return n=n.toLowerCase(),r=n}return r=""},this.getImageInsideParentDataByImage=function(e,t,i){var n=e.parent(),e=v.getImageOriginalSize(e);return v.getImageInsideParentData(n,e.width,e.height,t,i)},this.getImageInsideParentData=function(e,t,i,n,r,o,a){r=r||{};var s={};void 0===o&&(o=e.width()),void 0===a&&(a=e.height()),r.padding_left&&(o-=r.padding_left),r.padding_right&&(o-=r.padding_right),r.padding_top&&(a-=r.padding_top),r.padding_bottom&&(a-=r.padding_bottom);var l,u=null,d="100%",c=null,_=null,e="display:block;margin:0px auto;";return 0<t&&0<i&&("down"==n&&t<o&&i<a?(_=(o-(u=t))/2,c=(a-(d=i))/2):"fill"==n||"filltop"==n?(u=(d=a)*(l=t/i))<o?(d=(u=o)/l,_=0,c=Math.round((d-a)/2*-1),"filltop"==n&&(c=0)):(c=0,_=Math.round((u-o)/2*-1)):(c=0,_=(o-(u=(d=a)*(l=t/i)))/2,"fitvert"!=n&&o<u&&(_=0,c=(a-(d=(u=o)/l))/2)),u=Math.floor(u),d=Math.floor(d),c=Math.floor(c),_=Math.floor(_),e="position:absolute;"),r.padding_top&&(c+=r.padding_top),r.padding_left&&(_+=r.padding_left),s.imageWidth=u,s.imageHeight=d,s.imageTop=c,s.imageLeft=_,s.imageRight=_+u,s.imageBottom=0==c||"100%"==d?null:c+d,s.style=e,s},this.getElementCenterPosition=function(e,t){var i=e.parent(),n=v.getElementSize(e),r=v.getElementSize(i),e=r.width,i=r.height;t&&void 0!==t.padding_top&&(i-=t.padding_top),t&&void 0!==t.padding_bottom&&(i-=t.padding_bottom),t&&void 0!==t.padding_left&&(e-=t.padding_left),t&&void 0!==t.padding_right&&(e-=t.padding_right);r={};return r.left=Math.round((e-n.width)/2),r.top=Math.round((i-n.height)/2),t&&void 0!==t.padding_top&&(r.top+=t.padding_top),t&&void 0!==t.padding_left&&(r.left+=t.padding_left),r},this.getElementCenterPoint=function(e,t){t=t||!1;var i=v.getElementSize(e),e={};return e.x=i.width/2,e.y=i.height/2,1==t&&(e.x+=i.left,e.y+=i.top),e.x=Math.round(e.x),e.y=Math.round(e.y),e},this.getMousePosition=function(e,t){var i={pageX:e.pageX,pageY:e.pageY,clientX:e.clientX,clientY:e.clientY};return e.originalEvent&&e.originalEvent.touches&&0<e.originalEvent.touches.length&&(i.pageX=e.originalEvent.touches[0].pageX,i.pageY=e.originalEvent.touches[0].pageY,i.clientX=e.originalEvent.touches[0].clientX,i.clientY=e.originalEvent.touches[0].clientY),t&&(t=t.offset(),i.mouseX=i.pageX-t.left,i.mouseY=i.pageY-t.top),i},this.getMouseElementPoint=function(e,t){e={x:e.pageX,y:e.pageY};return v.getElementLocalPoint(e,t)},this.getElementLocalPoint=function(e,t){var i={},t=t.offset();return i.x=Math.round(e.x-t.left),i.y=Math.round(e.y-t.top),i},this.getImageOriginalSize=function(e,t,i){if(void 0!==t&&void 0!==i)return{width:t,height:i};var n=e[0];if(void 0===n)throw new Error("getImageOriginalSize error - Image not found");t={};if(void 0!==n.naturalWidth)return t.width=n.naturalWidth,t.height=n.naturalHeight,t;if("number"==typeof e.data("naturalWidth"))return(t={}).width=e.data("naturalWidth"),t.height=e.data("naturalHeight"),t;i=new Image;return i.src=n.src,i.complete?(t.width=i.width,t.height=i.height,e.data("naturalWidth",t.width),e.data("naturalHeight",t.height),t):{width:0,height:0}},this.getimageRatio=function(e){var t=v.getImageOriginalSize(e);return v.getElementSize(e).width/t.width},this.isImageFitParent=function(e){var t=e.parent(),e=v.getElementSize(e),t=v.getElementSize(t);return e.width<=t.width&&e.height<=t.height},this.getElementSize=function(e){if(void 0===e)throw new Error("Can't get size, empty element");var t=e.position();return t.height=e.outerHeight(),t.width=e.outerWidth(),t.left=Math.round(t.left),t.top=Math.round(t.top),t.right=t.left+t.width,t.bottom=t.top+t.height,t},this.isElementBiggerThenParent=function(e){var t=e.parent(),e=v.getElementSize(e),t=v.getElementSize(t);return e.width>t.width||e.height>t.height},this.isPointInsideElement=function(e,t){return 0!=(0<=e.x&&e.x<t.width)&&0!=(0<=e.y&&e.y<t.height)},this.getElementRelativePos=function(e,t,i,n){var r;n=n||e.parent(),r="number"==typeof e?{width:e,height:e}:v.getElementSize(e);var o=v.getElementSize(n);switch(t){case"top":case"left":t=0,i&&(t+=i);break;case"center":t=Math.round((o.width-r.width)/2),i&&(t+=i);break;case"right":t=o.width-r.width,i&&(t-=i);break;case"middle":t=Math.round((o.height-r.height)/2),i&&(t+=i);break;case"bottom":t=o.height-r.height,i&&(t-=i)}return t},this.getScreenVisibleSize=function(){document.body.clientWidth,document.body.clientHeight,jQuery(document).scrollTop();var e=jQuery(document),t=e.scrollLeft(),i=e.scrollTop(),t=Math.round(t),n=(i=Math.round(i))+window.innerHeight,e=t+window.innerWidth;return{top:i,left:t,height:n-i,width:e-t,right:e,bottom:n}},this.isElementsIntersect=function(e,t){return!(e.right<t.left)&&(!(e.left>t.right)&&(!(e.bottom<t.top)&&!(e.top>t.bottom)))},this.isElementInsideScreen=function(e){var t=v.getElementSize(e),e=v.getScreenVisibleSize();return v.isElementsIntersect(e,t)},this.z_________SET_ELEMENT_PROPS_______=function(){},this.zoomImageInsideParent=function(e,t,i,n,r,o,a){r=r||"fit";var s,l,u,d=i=i||1.2,c=e.parent(),_=v.getElementSize(e),h=v.getImageOriginalSize(e),g=!1,p=0,m=0,f=0,i=0;if(n?(l=v.getMouseElementPoint(n,e),g=v.isPointInsideElement(l,_),f=l.x,i=l.y):g=!1,0==g&&(f=(l=v.getElementCenterPoint(e)).x,i=l.y),1==t)b=_.height*d,s=_.width*d,0!=f&&(p=-(f*d-f)),0!=i&&(m=-(i*d-i));else{var b=_.height/d;if((s=_.width/d)<v.getImageInsideParentData(c,h.width,h.height,r,a).imageWidth)return v.scaleImageFitParent(e,h.width,h.height,r,a),!0;1==g&&(0!=f&&(p=-(f/d-f)),0!=i&&(m=-(i/d-i)))}if(o){i=1;if(0!=h.width&&(i=s/h.width),o<i)return!1}return v.setElementSize(e,s,b),m=0==t&&0==g?(u=(g=v.getElementCenterPosition(e)).left,g.top):(u=_.left+p,_.top+m),v.placeElement(e,u,m),!0},this.placeElement=function(e,t,i,n,r,o){var a,s;if(0!=jQuery.isNumeric(t)&&0!=jQuery.isNumeric(i)||(o=o||e.parent(),a=v.getElementSize(e),s=v.getElementSize(o)),0==jQuery.isNumeric(t))switch(t){case"left":t=0,n&&(t+=n);break;case"center":t=Math.round((s.width-a.width)/2),n&&(t+=n);break;case"right":t=s.width-a.width,n&&(t-=n)}if(0==jQuery.isNumeric(i))switch(i){case"top":i=0,r&&(i+=r);break;case"middle":case"center":i=Math.round((s.height-a.height)/2),r&&(i+=r);break;case"bottom":i=s.height-a.height,r&&(i-=r)}o={position:"absolute",margin:"0px"};null!==t&&(o.left=t),null!==i&&(o.top=i),e.css(o)},this.placeElementInParentCenter=function(e){v.placeElement(e,"center","middle")},this.setElementSizeAndPosition=function(e,t,i,n,r){i={width:n+"px",height:r+"px",left:t+"px",top:i+"px",position:"absolute",margin:"0px"};e.css(i)},this.setElementSize=function(e,t,i){t={width:t+"px"};null!=i&&(t.height=i+"px"),e.css(t)},this.cloneElementSizeAndPos=function(e,t,i,n,r){var o=e.position();if(null==o)throw new Error("Can't get size, empty element");!0===i?(o.height=e.outerHeight(),o.width=e.outerWidth()):(o.height=e.height(),o.width=e.width()),o.left=Math.round(o.left),o.top=Math.round(o.top),n&&(o.left+=n),r&&(o.top+=r),v.setElementSizeAndPosition(t,o.left,o.top,o.width,o.height)},this.placeImageInsideParent=function(e,t,i,n,r,o){r=v.getImageInsideParentData(t,i,n,r,o),o="<img";return null!==r.imageWidth&&(o+=" width = '"+r.imageWidth+"'",r.style+="width:"+r.imageWidth+";"),null!=r.imageHeight&&("100%"==r.imageHeight?(o+=" height = '"+r.imageHeight+"'",r.style+="height:"+r.imageHeight+";"):(o+=" height = '"+r.imageHeight+"'",r.style+="height:"+r.imageHeight+"px;")),null!==r.imageTop&&(r.style+="top:"+r.imageTop+"px;"),null!==r.imageLeft&&(r.style+="left:"+r.imageLeft+"px;"),e=v.escapeDoubleSlash(e),o+=" style='"+r.style+"'",o+=' src="'+e+'"',o+=">",t.html(o),t.children("img")},this.scaleImageCoverParent=function(e,t,i){var n,r;r="number"==typeof t?(n=t,i):(n=t.outerWidth(),t.outerHeight());var o=v.getImageOriginalSize(e),a=o.width/o.height,s=r,i=s*a,t=0,o=0;i<n?(s=(i=n)/a,o=0,t=Math.round((s-r)/2*-1)):(t=0,o=Math.round((i-n)/2*-1)),i=Math.round(i),s=Math.round(s),e.css({width:i+"px",height:s+"px",left:o+"px",top:t+"px"})},this.scaleImageFitParent=function(e,t,i,n,r){var o=e.parent(),i=v.getImageInsideParentData(o,t,i,n,r),n=!1,r={};return null!==i.imageWidth&&(n=!0,e.removeAttr("width"),r.width=i.imageWidth+"px"),null!=i.imageHeight&&(n=!0,e.removeAttr("height"),r.height=i.imageHeight+"px"),null!==i.imageTop&&(n=!0,r.top=i.imageTop+"px"),null!==i.imageLeft&&(n=!0,r.left=i.imageLeft+"px"),1==n&&(r.position="absolute",r.margin="0px 0px",e.css(r)),i},this.scaleImageByHeight=function(e,t,i,n){n=v.getImageOriginalSize(e,i,n),n=n.width/n.height,n=Math.round(t*n);t=Math.round(t),v.setElementSize(e,n,t)},this.scaleImageByWidth=function(e,t,i,n){n=v.getImageOriginalSize(e,i,n),n=n.width/n.height,n=Math.round(t/n);t=Math.round(t),v.setElementSize(e,t,n)},this.scaleImageExactSizeInParent=function(e,t,i,n,r,o){var a=e.parent(),s=v.getElementSize(a);s.width<n&&(n=s.width),s.height<r&&(r=s.height);var l=v.getImageInsideParentData(null,t,i,o,null,n,r),u=n,d=r,c=l.imageLeft,a=l.imageLeft,t=l.imageTop,i=l.imageTop,o=Math.round((s.width-n)/2),s=Math.round((s.height-r)/2),n=n-(l.imageWidth+c+a);0!=n&&(a+=n),0!=(n=r-(l.imageHeight+t+i))&&(i+=n),e.removeAttr("width"),e.removeAttr("height");n={position:"absolute",margin:"0px 0px"};n.width=u+"px",n.height=d+"px",n.left=o+"px",n.top=s+"px",n["padding-left"]=c+"px",n["padding-top"]=t+"px",n["padding-right"]=a+"px",n["padding-bottom"]=i+"px",e.css(n);n={};return n.imageWidth=u,n.imageHeight=d,n},this.showElement=function(e,t,i){e.show().fadeTo(0,1),t&&t.show().fadeTo(0,1),i&&i.show().fadeTo(0,1)},this.z_________GALLERY_RELATED_FUNCTIONS_______=function(){},this.disableButton=function(e,t){t=t||"ug-button-disabled",0==v.isButtonDisabled(e,t)&&e.addClass(t)},this.convertCustomPrefixOptions=function(e,n,r){if(!n)return e;var o={};return jQuery.each(e,function(e,t){var i;0===e.indexOf(n+"_"+r+"_")?(i=e.replace(n+"_"+r+"_",r+"_"),o[i]=t):o[e]=t}),o},this.enableButton=function(e,t){t=t||"ug-button-disabled",1==v.isButtonDisabled(e,t)&&e.removeClass(t)},this.isButtonDisabled=function(e,t){return t=t||"ug-button-disabled",!!e.hasClass(t)},this.z_________MATH_FUNCTIONS_______=function(){},this.normalizeSetting=function(e,t,i,n,r,o){return r=e+(t-e)*((r-i)/(n-i)),1==(o=o||!1)&&(r<e&&(r=e),t<r&&(r=t)),r},this.getNormalizedValue=function(e,t,i,n,r){return r=e+(n-i)*((r-e)/(t-e))},this.getDistance=function(e,t,i,n){return Math.round(Math.sqrt(Math.abs((i-e)*(i-e)+(n-t)*(n-t))))},this.getMiddlePoint=function(e,t,i,n){var r={};return r.x=e+Math.round((i-e)/2),r.y=t+Math.round((n-t)/2),r},this.getNumItemsInSpace=function(e,t,i){return Math.floor((e+i)/(t+i))},this.getNumItemsInSpaceRound=function(e,t,i){return Math.round((e+i)/(t+i))},this.getSpaceByNumItems=function(e,t,i){return e*t+(e-1)*i},this.getItemSizeInSpace=function(e,t,i){return Math.floor((e-(t-1)*i)/t)},this.getColX=function(e,t,i){return e*(t+i)},this.getColByIndex=function(e,t){return t%e},this.getColRowByIndex=function(e,t){var i=Math.floor(e/t);return{col:Math.floor(e%t),row:i}},this.getIndexByRowCol=function(e,t,i){return e<0||t<0?-1:e*i+t},this.getPrevRowSameColIndex=function(e,t){e=v.getColRowByIndex(e,t);return v.getIndexByRowCol(e.row-1,e.col,t)},this.getNextRowSameColIndex=function(e,t){e=v.getColRowByIndex(e,t);return v.getIndexByRowCol(e.row+1,e.col,t)},this.z_________DATA_FUNCTIONS_______=function(){},this.setGlobalData=function(e,t){jQuery.data(document.body,e,t)},this.getGlobalData=function(e){return jQuery.data(document.body,e)},this.z_________EVENT_DATA_FUNCTIONS_______=function(){},this.handleScrollTop=function(e){if(0==v.isTouchDevice())return null;var t=v.getStoredEventData(e);if(null===t.scrollDir&&(15<Math.abs(t.diffMouseX)?t.scrollDir="hor":15<Math.abs(t.diffMouseY)&&Math.abs(t.diffMouseY)>Math.abs(t.diffMouseX)&&(t.scrollDir="vert",t.scrollStartY=t.lastMouseClientY,t.scrollOrigin=jQuery(document).scrollTop(),o.dataCache[e].scrollStartY=t.lastMouseClientY,o.dataCache[e].scrollOrigin=t.scrollOrigin),o.dataCache[e].scrollDir=t.scrollDir),"vert"!==t.scrollDir)return t.scrollDir;jQuery(document).scrollTop();e=t.scrollOrigin-(t.lastMouseClientY-t.scrollStartY);return 0<=e&&jQuery(document).scrollTop(e),t.scrollDir},this.wasVerticalScroll=function(e){return"vert"===v.getStoredEventData(e).scrollDir},this.storeEventData=function(e,t,i){var n=v.getMousePosition(e),e=jQuery.now(),n={startTime:e,lastTime:e,startMouseX:n.pageX,startMouseY:n.pageY,lastMouseX:n.pageX,lastMouseY:n.pageY,startMouseClientY:n.clientY,lastMouseClientY:n.clientY,scrollTop:jQuery(document).scrollTop(),scrollDir:null};i&&(n=jQuery.extend(n,i)),o.dataCache[t]=n},this.updateStoredEventData=function(e,t,i){if(!o.dataCache[t])throw new Error("updateEventData error: must have stored cache object");var n=o.dataCache[t],e=v.getMousePosition(e);n.lastTime=jQuery.now(),void 0!==e.pageX&&(n.lastMouseX=e.pageX,n.lastMouseY=e.pageY,n.lastMouseClientY=e.clientY),i&&(n=jQuery.extend(n,i)),o.dataCache[t]=n},this.getStoredEventData=function(e,t){if(!o.dataCache[e])throw new Error("updateEventData error: must have stored cache object");e=o.dataCache[e];return e.diffMouseX=e.lastMouseX-e.startMouseX,e.diffMouseY=e.lastMouseY-e.startMouseY,e.diffMouseClientY=e.lastMouseClientY-e.startMouseClientY,e.diffTime=e.lastTime-e.startTime,!0===t?(e.startMousePos=e.lastMouseY,e.lastMousePos=e.lastMouseY,e.diffMousePos=e.diffMouseY):(e.startMousePos=e.lastMouseX,e.lastMousePos=e.lastMouseX,e.diffMousePos=e.diffMouseX),e},this.isApproveStoredEventClick=function(e,t){if(!o.dataCache[e])return!0;e=v.getStoredEventData(e,t),t=Math.abs(e.diffMousePos);return!(400<e.diffTime)&&!(30<t)},this.clearStoredEventData=function(e){o.dataCache[e]=null},this.z_________CHECK_SUPPORT_FUNCTIONS_______=function(){},this.isCanvasExists=function(){return"function"==typeof jQuery('<canvas width="500" height="500" > </canvas>')[0].getContext},this.isScrollbarExists=function(){return window.innerWidth>document.documentElement.clientWidth},this.isTouchDevice=function(){if(-1!==o.isTouchDevice)return o.isTouchDevice;try{document.createEvent("TouchEvent"),o.isTouchDevice=!0}catch(e){o.isTouchDevice=!1}return o.isTouchDevice},this.isRgbaSupported=function(){if(-1!==o.isRgbaSupported)return o.isRgbaSupported;var e=document.getElementsByTagName("script")[0],t=e.style.color;try{e.style.color="rgba(1,5,13,0.44)"}catch(e){}var i=e.style.color!=t;return e.style.color=t,o.isRgbaSupported=i},this.z_________GENERAL_FUNCTIONS_______=function(){},this.checkMinJqueryVersion=function(e){for(var t=jQuery.fn.jquery.split("."),i=e.split("."),n=0,r=t.length;n<r;n++){var o=parseInt(t[n]),a=parseInt(i[n]);if(void 0===i[n])return!0;if(o<a)return!1;if(a<o)return!0}return!0},this.getCssSizeParam=function(e){return jQuery.isNumeric(e)?e+"px":e},this.convertHexToRGB=function(e,t){try{var i=e.replace("#","");if(i===e)return e;var n="rgba("+parseInt(i.substring(0,2),16)+","+parseInt(i.substring(2,4),16)+","+parseInt(i.substring(4,6),16)+","+t+")"}catch(e){n="rgba(0,0,0,1)";trace("error in convertHexToRGB function"),trace(e),trace("hex: "+i)}return n},this.timestampToString=function(e){var t=new Date(e),e=t.getDate()+"/"+t.getMonth();return e+=" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+":"+t.getMilliseconds()},this.getArrTouches=function(e){var t=[];return e.originalEvent&&e.originalEvent.touches&&0<e.originalEvent.touches.length&&(t=e.originalEvent.touches),t},this.getArrTouchPositions=function(e){for(var t=[],i=0;i<e.length;i++){var n={pageX:e[i].pageX,pageY:e[i].pageY};t.push(n)}return t},this.startTimeDebug=function(){o.starTime=jQuery.now()},this.showTimeDebug=function(){debugLine({"Time Passed":jQuery.now()-o.starTime},!0)},this.initProgressIndicator=function(e,t,i){switch("bar"!=e&&0==v.isCanvasExists()&&(e="bar"),e){case"bar":(n=new UGProgressBar).putHidden(i,t);break;default:case"pie":(n=new UGProgressPie).putHidden(i,t);break;case"pie2":var n;t.type_fill=!0,(n=new UGProgressPie).putHidden(i,t)}return n},this.setButtonMobileReady=function(e){e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover")}),e.on("mousedown touchend",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1})},this.registerTheme=function(e){o.arrThemes.push(e)},this.getArrThemes=function(){return o.arrThemes},this.isThemeRegistered=function(e){return-1!==jQuery.inArray(e,o.arrThemes)},this.getFirstRegisteredTheme=function(){return 0==o.arrThemes.length?"":o.arrThemes[0]},this.isTimePassed=function(e,t){t=t||100;var i=jQuery.now();lastTime=0==o.timeCache.hasOwnProperty(e)?0:o.timeCache[e];var n=i-lastTime;return o.timeCache[e]=i,!(n<=t)},this.whenContiniousEventOver=function(e,t,i){i=i||300,1==o.timeCache.hasOwnProperty(e)&&null!=o.timeCache[e]&&(clearTimeout(o.timeCache[e]),o.timeCache[e]=null),o.timeCache[e]=setTimeout(t,i)},this.validateClickTouchstartEvent=function(e){var t=!0,i=jQuery.now()-o.lastEventTime;return"click"==e&&"touchstart"==o.lastEventType&&i<1e3&&(t=!1),o.lastEventTime=jQuery.now(),o.lastEventType=e,t},this.addClassOnHover=function(e,t){t=t||"ug-button-hover",e.hover(function(){jQuery(this).addClass(t)},function(){jQuery(this).removeClass(t)})},this.destroyButton=function(e){e.off("mouseenter"),e.off("mouseleave"),e.off("click"),e.off("touchstart"),e.off("touchend"),e.off("mousedown"),e.off("tap")},this.setButtonOnClick=function(e,i){v.setButtonMobileReady(e),e.on("click touchstart",function(e){var t=jQuery(this);if(e.stopPropagation(),e.stopImmediatePropagation(),0==v.validateClickTouchstartEvent(e.type))return!0;i(t,e)})},this.setButtonOnTap=function(e,t){e.on("tap",t),0==v.isTouchDevice()?e.on("click",function(e){var t=jQuery(this);if(0==v.validateClickTouchstartEvent(e.type))return!0;t.trigger("tap")}):(e.on("touchstart",function(e){jQuery(this).addClass("ug-nohover"),o.lastTouchStartElement=jQuery(this),o.lastEventTime=jQuery.now()}),e.on("touchend",function(e){var t=jQuery(this);return 0==t.is(o.lastTouchStartElement)||(!o.lastEventTime||(jQuery.now()-o.lastEventTime>o.touchThreshold||void t.trigger("tap")))}))},this.loadJs=function(e,t){!0===t&&(e=location.protocol+"//"+e);t=document.createElement("script");t.src=e;e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)},this.loadCss=function(e,t){!0===t&&(e=location.protocol+"//"+e);t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(t)},this.addEvent=function(e,t,i){void 0!==e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},this.checkImagesLoaded=function(n,i,r){var o=0,a=n.length;if(0==a&&i)return i(),!1;function s(e,t){o++,"function"==typeof r&&setTimeout(function(){r(e,t)}),o==a&&"function"==typeof i&&setTimeout(function(){i()})}setTimeout(function(){for(var e=0;e<a;e++){var t,i=n[e];void 0!==i.naturalWidth&&0!==i.naturalWidth?s(n[e],!1):((t=jQuery("<img/>")).data("index",e),t.on("load",function(){var e=jQuery(this).data("index");s(n[e],!1)}),t.on("error",function(){var e=jQuery(this).data("index");s(n[e],!0)}),t.attr("src",i.src))}})},this.waitForWidth=function(e,t){var i=e.width();if(0!=i)return t(),!1;o.handle=setInterval(function(){0!=e.width()&&(clearInterval(o.handle),t())},300)},this.arrayShuffle=function(e){if("object"!=typeof e)return e;for(var t,i,n=e.length;n;t=parseInt(Math.random()*n),i=e[--n],e[n]=e[t],e[t]=i);return e},this.getObjectLength=function(e){var t,i=0;for(t in e)i++;return i},this.normalizePercent=function(e){return e<0&&(e=0),1<e&&(e=1),e},this.stripTags=function(e){return"string"!=typeof e?e:e.replace(/(<([^>]+)>)/gi,"")},this.escapeDoubleSlash=function(e){return e.replace('"','"')},this.htmlentitles=function(e){return jQuery("<div/>").text(e).html()},this.z_________END_GENERAL_FUNCTIONS_______=function(){}}!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(l){function t(e){var t,i,n=e||window.event,r=h.call(arguments,1),o=0,a=0,s=0;if(e=l.event.fix(n),e.type="mousewheel","detail"in n&&(s=-1*n.detail),"wheelDelta"in n&&(s=n.wheelDelta),"wheelDeltaY"in n&&(s=n.wheelDeltaY),"wheelDeltaX"in n&&(a=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(a=-1*s,s=0),o=0===s?a:s,"deltaY"in n&&(s=-1*n.deltaY,o=s),"deltaX"in n&&(a=n.deltaX,0===s&&(o=-1*a)),0!==s||0!==a)return 1===n.deltaMode?(o*=i=l.data(this,"mousewheel-line-height"),s*=i,a*=i):2===n.deltaMode&&(o*=i=l.data(this,"mousewheel-page-height"),s*=i,a*=i),t=Math.max(Math.abs(s),Math.abs(a)),(!_||t<_)&&(d(n,_=t)&&(_/=40)),d(n,t)&&(o/=40,a/=40,s/=40),o=Math[1<=o?"floor":"ceil"](o/_),a=Math[1<=a?"floor":"ceil"](a/_),s=Math[1<=s?"floor":"ceil"](s/_),e.deltaX=a,e.deltaY=s,e.deltaFactor=_,e.deltaMode=0,r.unshift(e,o,a,s),c&&clearTimeout(c),c=setTimeout(u,200),(l.event.dispatch||l.event.handle).apply(this,r)}function u(){_=null}function d(e,t){return r.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var c,_,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],h=Array.prototype.slice;if(l.event.fixHooks)for(var n=e.length;n;)l.event.fixHooks[e[--n]]=l.event.mouseHooks;var r=l.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var e=i.length;e;)this.addEventListener(i[--e],t,!1);else this.onmousewheel=t;l.data(this,"mousewheel-line-height",r.getLineHeight(this)),l.data(this,"mousewheel-page-height",r.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=i.length;e;)this.removeEventListener(i[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(e){return parseInt(l(e)["offsetParent"in l.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(e){return l(e).height()},settings:{adjustOldDeltas:!0}};l.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?exports=e(require("jquery")):e(jQuery)}(function(t){t.easing.jswing=t.easing.swing;var i=Math.pow,n=Math.sqrt,r=Math.sin,o=Math.cos,a=Math.PI,s=1.70158,l=1.525*s,u=1+s,d=2*a/3,c=2*a/4.5;function _(e){var t=7.5625,i=2.75;return e<1/i?t*e*e:e<2/i?t*(e-=1.5/i)*e+.75:e<2.5/i?t*(e-=2.25/i)*e+.9375:t*(e-=2.625/i)*e+.984375}t.extend(t.easing,{def:"easeOutQuad",swing:function(e){return t.easing[t.easing.def](e)},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return 1-(1-e)*(1-e)},easeInOutQuad:function(e){return e<.5?2*e*e:1-i(-2*e+2,2)/2},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return 1-i(1-e,3)},easeInOutCubic:function(e){return e<.5?4*e*e*e:1-i(-2*e+2,3)/2},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1-i(1-e,4)},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-i(-2*e+2,4)/2},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1-i(1-e,5)},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1-i(-2*e+2,5)/2},easeInSine:function(e){return 1-o(e*a/2)},easeOutSine:function(e){return r(e*a/2)},easeInOutSine:function(e){return-(o(a*e)-1)/2},easeInExpo:function(e){return 0===e?0:i(2,10*e-10)},easeOutExpo:function(e){return 1===e?1:1-i(2,-10*e)},easeInOutExpo:function(e){return 0===e?0:1===e?1:e<.5?i(2,20*e-10)/2:(2-i(2,-20*e+10))/2},easeInCirc:function(e){return 1-n(1-i(e,2))},easeOutCirc:function(e){return n(1-i(e-1,2))},easeInOutCirc:function(e){return e<.5?(1-n(1-i(2*e,2)))/2:(n(1-i(-2*e+2,2))+1)/2},easeInElastic:function(e){return 0===e?0:1===e?1:-i(2,10*e-10)*r((10*e-10.75)*d)},easeOutElastic:function(e){return 0===e?0:1===e?1:i(2,-10*e)*r((10*e-.75)*d)+1},easeInOutElastic:function(e){return 0===e?0:1===e?1:e<.5?-(i(2,20*e-10)*r((20*e-11.125)*c))/2:i(2,-20*e+10)*r((20*e-11.125)*c)/2+1},easeInBack:function(e){return u*e*e*e-s*e*e},easeOutBack:function(e){return 1+u*i(e-1,3)+s*i(e-1,2)},easeInOutBack:function(e){return e<.5?i(2*e,2)*(2*(1+l)*e-l)/2:(i(2*e-2,2)*((1+l)*(2*e-2)+l)+2)/2},easeInBounce:function(e){return 1-_(1-e)},easeOutBounce:_,easeInOutBounce:function(e){return e<.5?(1-_(1-2*e))/2:(1+_(2*e-1))/2}})}),function(d,c){var s,_,e,h,g,p,a,t,m;function f(e,t,i){var n=p[t.type]||{};return null==e?i||!t.def?null:t.def:(e=n.floor?~~e:parseFloat(e),isNaN(e)?t.def:n.mod?(e+n.mod)%n.mod:e<0?0:n.max<e?n.max:e)}function l(n){var r=h(),o=r._rgba=[];return n=n.toLowerCase(),m(e,function(e,t){var i=t.re.exec(n),i=i&&t.parse(i),t=t.space||"rgba";return i?(i=r[t](i),r[g[t].cache]=i[g[t].cache],o=r._rgba=i._rgba,!1):void 0}),o.length?("0,0,0,0"===o.join()&&d.extend(o,s.transparent),r):s[n]}function r(e,t,i){return 6*(i=(i+1)%1)<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}void 0!==d.cssHooks&&(_=/^([\-+])=\s*(\d+\.?\d*)/,e=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],h=d.Color=function(e,t,i,n){return new d.Color.fn.parse(e,t,i,n)},g={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},p={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},a=h.support={},t=d("<p>")[0],m=d.each,t.style.cssText="background-color:rgba(1,1,1,.5)",a.rgba=-1<t.style.backgroundColor.indexOf("rgba"),m(g,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),h.fn=d.extend(h.prototype,{parse:function(r,e,t,i){if(r===c)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=d(r).css(e),e=c);var o=this,n=d.type(r),a=this._rgba=[];return e!==c&&(r=[r,e,t,i],n="array"),"string"===n?this.parse(l(r)||s._default):"array"===n?(m(g.rgba.props,function(e,t){a[t.idx]=f(r[t.idx],t)}),this):"object"===n?(m(g,r instanceof h?function(e,t){r[t.cache]&&(o[t.cache]=r[t.cache].slice())}:function(e,i){var n=i.cache;m(i.props,function(e,t){if(!o[n]&&i.to){if("alpha"===e||null==r[e])return;o[n]=i.to(o._rgba)}o[n][t.idx]=f(r[e],t,!0)}),o[n]&&d.inArray(null,o[n].slice(0,3))<0&&(o[n][3]=1,i.from&&(o._rgba=i.from(o[n])))}),this):void 0},is:function(e){var r=h(e),o=!0,a=this;return m(g,function(e,t){var i,n=r[t.cache];return n&&(i=a[t.cache]||t.to&&t.to(a._rgba)||[],m(t.props,function(e,t){return null!=n[t.idx]?o=n[t.idx]===i[t.idx]:void 0})),o}),o},_space:function(){var i=[],n=this;return m(g,function(e,t){n[t.cache]&&i.push(e)}),i.pop()},transition:function(e,a){var t=(u=h(e))._space(),i=g[t],e=0===this.alpha()?h("transparent"):this,s=e[i.cache]||i.to(e._rgba),l=s.slice(),u=u[i.cache];return m(i.props,function(e,t){var i=t.idx,n=s[i],r=u[i],o=p[t.type]||{};null!==r&&(null===n?l[i]=r:(o.mod&&(o.mod/2<r-n?n+=o.mod:o.mod/2<n-r&&(n-=o.mod)),l[i]=f((r-n)*a+n,t)))}),this[t](l)},blend:function(e){if(1===this._rgba[3])return this;var t=this._rgba.slice(),i=t.pop(),n=h(e)._rgba;return h(d.map(t,function(e,t){return(1-i)*n[t]+i*e}))},toRgbaString:function(){var e="rgba(",t=d.map(this._rgba,function(e,t){return null==e?2<t?1:0:e});return 1===t[3]&&(t.pop(),e="rgb("),e+t.join()+")"},toHslaString:function(){var e="hsla(",t=d.map(this.hsla(),function(e,t){return null==e&&(e=2<t?1:0),t&&t<3&&(e=Math.round(100*e)+"%"),e});return 1===t[3]&&(t.pop(),e="hsl("),e+t.join()+")"},toHexString:function(e){var t=this._rgba.slice(),i=t.pop();return e&&t.push(~~(255*i)),"#"+d.map(t,function(e){return 1===(e=(e||0).toString(16)).length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),h.fn.parse.prototype=h.fn,g.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/255,i=e[1]/255,n=e[2]/255,r=e[3],o=Math.max(t,i,n),a=Math.min(t,i,n),s=o-a,l=o+a,e=.5*l,i=a===o?0:t===o?60*(i-n)/s+360:i===o?60*(n-t)/s+120:60*(t-i)/s+240,l=0==s?0:e<=.5?s/l:s/(2-l);return[Math.round(i)%360,l,e,null==r?1:r]},g.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],n=e[2],e=e[3],i=n<=.5?n*(1+i):n+i-n*i,n=2*n-i;return[Math.round(255*r(n,i,t+1/3)),Math.round(255*r(n,i,t)),Math.round(255*r(n,i,t-1/3)),e]},m(g,function(s,e){var o=e.props,a=e.cache,l=e.to,u=e.from;h.fn[s]=function(e){if(l&&!this[a]&&(this[a]=l(this._rgba)),e===c)return this[a].slice();var t,i=d.type(e),n="array"===i||"object"===i?e:arguments,r=this[a].slice();return m(o,function(e,t){e=n["object"===i?e:t.idx];null==e&&(e=r[t.idx]),r[t.idx]=f(e,t)}),u?((t=h(u(r)))[a]=r,t):h(r)},m(o,function(o,a){h.fn[o]||(h.fn[o]=function(e){var t=d.type(e),i="alpha"===o?this._hsla?"hsla":"rgba":s,n=this[i](),r=n[a.idx];return"undefined"===t?r:("function"===t&&(e=e.call(this,r),t=d.type(e)),null==e&&a.empty?this:("string"===t&&((t=_.exec(e))&&(e=r+parseFloat(t[2])*("+"===t[1]?1:-1))),n[a.idx]=e,this[i](n)))})})}),h.hook=function(e){e=e.split(" ");m(e,function(e,o){d.cssHooks[o]={set:function(e,t){var i,n,r="";if("transparent"!==t&&("string"!==d.type(t)||(i=l(t)))){if(t=h(i||t),!a.rgba&&1!==t._rgba[3]){for(n="backgroundColor"===o?e.parentNode:e;(""===r||"transparent"===r)&&n&&n.style;)try{r=d.css(n,"backgroundColor"),n=n.parentNode}catch(e){}t=t.blend(r&&"transparent"!==r?r:"_default")}t=t.toRgbaString()}try{e.style[o]=t}catch(e){}}},d.fx.step[o]=function(e){e.colorInit||(e.start=h(e.elem,o),e.end=h(e.end),e.colorInit=!0),d.cssHooks[o].set(e.elem,e.start.transition(e.end,e.pos))}})},h.hook("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),d.cssHooks.borderColor={expand:function(i){var n={};return m(["Top","Right","Bottom","Left"],function(e,t){n["border"+t+"Color"]=i}),n}},s=d.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"})}(jQuery),function(n){n.mlp={x:0,y:0},n(function e(){try{var t=this===document?n(this):n(this).contents()}catch(e){return!1}t.mousemove(function(e){n.mlp={x:e.pageX,y:e.pageY}}),t.find("iframe").on("load",e)}),n.fn.ismouseover=function(){var i=!1;return this.eq(0).each(function(){var e=n(this).is("iframe")?n(this).contents().find("body"):n(this),t=e.offset();i=t.left<=n.mlp.x&&t.left+e.outerWidth()>n.mlp.x&&t.top<=n.mlp.y&&t.top+e.outerHeight()>n.mlp.y}),i}}(jQuery),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DOMPurify=t()}(this,function(){"use strict";function We(e){return(We="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)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e,t,i){return(n=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),1}catch(e){return}}}()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);n=new(Function.bind.apply(e,n));return i&&r(n,i.prototype),n}).apply(null,arguments)}function Ue(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}()||function(e){if(e){if("string"==typeof e)return i(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,void 0):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var o,a=Object.hasOwnProperty,s=Object.setPrototypeOf,l=Object.isFrozen,u=Object.getPrototypeOf,d=Object.getOwnPropertyDescriptor,Ye=Object.freeze,e=Object.seal,c=Object.create,t="undefined"!=typeof Reflect&&Reflect,_=(_=t.apply)||function(e,t,i){return e.apply(t,i)},Ye=Ye||function(e){return e},e=e||function(e){return e},h=(h=t.construct)||function(e,t){return n(e,Ue(t))},Ve=g(Array.prototype.forEach),Xe=g(Array.prototype.pop),Ze=g(Array.prototype.push),qe=g(String.prototype.toLowerCase),Ke=g(String.prototype.toString),Je=g(String.prototype.match),$e=g(String.prototype.replace),et=g(String.prototype.indexOf),tt=g(String.prototype.trim),it=g(RegExp.prototype.test),nt=(o=TypeError,function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return h(o,t)});function g(r){return function(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return _(r,e,i)}}function rt(e,t,i){i=null!==i&&void 0!==i?i:qe,s&&s(e,null);for(var n=t.length;n--;){var r,o=t[n];"string"!=typeof o||(r=i(o))!==o&&(l(t)||(t[n]=r),o=r),e[o]=!0}return e}function ot(e){var t,i=c(null);for(t in e)!0===_(a,e,[t])&&(i[t]=e[t]);return i}function at(e,t){for(;null!==e;){var i=d(e,t);if(i){if(i.get)return g(i.get);if("function"==typeof i.value)return g(i.value)}e=u(e)}return function(e){return console.warn("fallback value for",e),null}}var st=Ye(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),lt=Ye(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ut=Ye(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),dt=Ye(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ct=Ye(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),_t=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ht=Ye(["#text"]),gt=Ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),pt=Ye(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mt=Ye(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ft=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),bt=e(/\{\{[\w\W]*|[\w\W]*\}\}/gm),vt=e(/<%[\w\W]*|[\w\W]*%>/gm),yt=e(/\${[\w\W]*}/gm),wt=e(/^data-[\-\w.\u00B7-\uFFFF]+$/),Et=e(/^aria-[\-\w]+$/),xt=e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Tt=e(/^(?:\w+script|data):/i),It=e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),St=e(/^html$/i),Pt=e(/^[a-z][.\w]*(-[.\w]+)+$/i);return function t(){function u(e){return t(e)}var l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;if(u.version="2.5.8",u.removed=[],!l||!l.document||9!==l.document.nodeType)return u.isSupported=!1,u;var d=l.document,o=l.document,c=l.DocumentFragment,e=l.HTMLTemplateElement,_=l.Node,s=l.Element,i=l.NodeFilter,n=l.NamedNodeMap,r=void 0===n?l.NamedNodeMap||l.MozNamedAttrMap:n,a=l.HTMLFormElement,h=l.DOMParser,g=l.trustedTypes,n=s.prototype,p=at(n,"cloneNode"),m=at(n,"nextSibling"),f=at(n,"childNodes"),b=at(n,"parentNode");"function"!=typeof e||(e=o.createElement("template")).content&&e.content.ownerDocument&&(o=e.content.ownerDocument);var v=function(e,t){if("object"!==We(e)||"function"!=typeof e.createPolicy)return null;var i=null,n="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(n)&&(i=t.currentScript.getAttribute(n));var r="dompurify"+(i?"#"+i:"");try{return e.createPolicy(r,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(g,d),y=v?v.createHTML(""):"",w=o.implementation,E=o.createNodeIterator,x=o.createDocumentFragment,T=o.getElementsByTagName,I=d.importNode,S={};try{S=ot(o).documentMode?o.documentMode:{}}catch(e){}var P={};u.isSupported="function"==typeof b&&w&&void 0!==w.createHTMLDocument&&9!==S;function C(e){return e instanceof RegExp||e instanceof Function}function A(e){Ie&&Ie===e||(e&&"object"===We(e)||(e={}),e=ot(e),j=-1===Te.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,M="application/xhtml+xml"===j?Ke:qe,B="ALLOWED_TAGS"in e?rt({},e.ALLOWED_TAGS,M):F,W="ALLOWED_ATTR"in e?rt({},e.ALLOWED_ATTR,M):U,Ee="ALLOWED_NAMESPACES"in e?rt({},e.ALLOWED_NAMESPACES,Ke):xe,pe="ADD_URI_SAFE_ATTR"in e?rt(ot(me),e.ADD_URI_SAFE_ATTR,M):me,he="ADD_DATA_URI_TAGS"in e?rt(ot(ge),e.ADD_DATA_URI_TAGS,M):ge,ce="FORBID_CONTENTS"in e?rt({},e.FORBID_CONTENTS,M):_e,V="FORBID_TAGS"in e?rt({},e.FORBID_TAGS,M):{},X="FORBID_ATTR"in e?rt({},e.FORBID_ATTR,M):{},O="USE_PROFILES"in e&&e.USE_PROFILES,Z=!1!==e.ALLOW_ARIA_ATTR,q=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,J=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,$=e.SAFE_FOR_TEMPLATES||!1,ee=!1!==e.SAFE_FOR_XML,te=e.WHOLE_DOCUMENT||!1,re=e.RETURN_DOM||!1,oe=e.RETURN_DOM_FRAGMENT||!1,ae=e.RETURN_TRUSTED_TYPE||!1,ne=e.FORCE_BODY||!1,se=!1!==e.SANITIZE_DOM,le=e.SANITIZE_NAMED_PROPS||!1,ue=!1!==e.KEEP_CONTENT,de=e.IN_PLACE||!1,Q=e.ALLOWED_URI_REGEXP||Q,ye=e.NAMESPACE||ve,Y=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&C(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&C(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Y.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$&&(q=!1),oe&&(re=!0),O&&(B=rt({},Ue(ht)),W=[],!0===O.html&&(rt(B,st),rt(W,gt)),!0===O.svg&&(rt(B,lt),rt(W,pt),rt(W,ft)),!0===O.svgFilters&&(rt(B,ut),rt(W,pt),rt(W,ft)),!0===O.mathMl&&(rt(B,ct),rt(W,mt),rt(W,ft))),e.ADD_TAGS&&(B===F&&(B=ot(B)),rt(B,e.ADD_TAGS,M)),e.ADD_ATTR&&(W===U&&(W=ot(W)),rt(W,e.ADD_ATTR,M)),e.ADD_URI_SAFE_ATTR&&rt(pe,e.ADD_URI_SAFE_ATTR,M),e.FORBID_CONTENTS&&(ce===_e&&(ce=ot(ce)),rt(ce,e.FORBID_CONTENTS,M)),ue&&(B["#text"]=!0),te&&rt(B,["html","head","body"]),B.table&&(rt(B,["tbody"]),delete V.tbody),Ye&&Ye(e),Ie=e)}var j,M,O,k=bt,L=vt,z=yt,N=wt,H=Et,R=Tt,D=It,G=Pt,Q=xt,B=null,F=rt({},[].concat(Ue(st),Ue(lt),Ue(ut),Ue(ct),Ue(ht))),W=null,U=rt({},[].concat(Ue(gt),Ue(pt),Ue(mt),Ue(ft))),Y=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,X=null,Z=!0,q=!0,K=!1,J=!0,$=!1,ee=!0,te=!1,ie=!1,ne=!1,re=!1,oe=!1,ae=!1,se=!0,le=!1,ue=!0,de=!1,ce=null,_e=rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),he=null,ge=rt({},["audio","video","img","source","image","track"]),pe=null,me=rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",be="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml",ye=ve,we=!1,Ee=null,xe=rt({},[fe,be,ve],Ke),Te=["application/xhtml+xml","text/html"],Ie=null,Se=o.createElement("form"),Pe=rt({},["mi","mo","mn","ms","mtext"]),Ce=rt({},["annotation-xml"]),Ae=rt({},["title","style","font","a","script"]),je=rt({},lt);rt(je,ut),rt(je,dt);var Me=rt({},ct);rt(Me,_t);function Oe(t){Ze(u.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=y}catch(e){t.remove()}}}function ke(e,t){try{Ze(u.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Ze(u.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!W[e])if(re||oe)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}}function Le(e){var t,i;ne?e="<remove></remove>"+e:i=(r=Je(e,/^[\r\n\t ]+/))&&r[0],"application/xhtml+xml"===j&&ye===ve&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var n=v?v.createHTML(e):e;if(ye===ve)try{t=(new h).parseFromString(n,j)}catch(e){}if(!t||!t.documentElement){t=w.createDocument(ye,"template",null);try{t.documentElement.innerHTML=we?y:n}catch(e){}}var r=t.body||t.documentElement;return e&&i&&r.insertBefore(o.createTextNode(i),r.childNodes[0]||null),ye===ve?T.call(t,te?"html":"body")[0]:te?t.documentElement:r}function ze(e){return E.call(e.ownerDocument||e,e,i.SHOW_ELEMENT|i.SHOW_COMMENT|i.SHOW_TEXT|i.SHOW_PROCESSING_INSTRUCTION|i.SHOW_CDATA_SECTION,null,!1)}function Ne(e){return e instanceof a&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof r)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)}function He(e){return"object"===We(_)?e instanceof _:e&&"object"===We(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function Re(e,t,i){P[e]&&Ve(P[e],function(e){e.call(u,t,i,Ie)})}function De(e){var t;if(Re("beforeSanitizeElements",e,null),Ne(e))return Oe(e),1;if(it(/[\u0080-\uFFFF]/,e.nodeName))return Oe(e),1;var i=M(e.nodeName);if(Re("uponSanitizeElement",e,{tagName:i,allowedTags:B}),e.hasChildNodes()&&!He(e.firstElementChild)&&(!He(e.content)||!He(e.content.firstElementChild))&&it(/<[/\w]/g,e.innerHTML)&&it(/<[/\w]/g,e.textContent))return Oe(e),1;if("select"===i&&it(/<template/i,e.innerHTML))return Oe(e),1;if(7===e.nodeType)return Oe(e),1;if(ee&&8===e.nodeType&&it(/<[/\w]/g,e.data))return Oe(e),1;if(B[i]&&!V[i])return(!(e instanceof s)||function(e){var t=b(e);t&&t.tagName||(t={namespaceURI:ye,tagName:"template"});var i=qe(e.tagName),n=qe(t.tagName);return Ee[e.namespaceURI]&&(e.namespaceURI===be?t.namespaceURI===ve?"svg"===i:t.namespaceURI===fe?"svg"===i&&("annotation-xml"===n||Pe[n]):Boolean(je[i]):e.namespaceURI===fe?t.namespaceURI===ve?"math"===i:t.namespaceURI===be?"math"===i&&Ce[n]:Boolean(Me[i]):e.namespaceURI===ve?(t.namespaceURI!==be||Ce[n])&&(t.namespaceURI!==fe||Pe[n])&&!Me[i]&&(Ae[i]||!je[i]):"application/xhtml+xml"===j&&Ee[e.namespaceURI])}(e))&&("noscript"!==i&&"noembed"!==i&&"noframes"!==i||!it(/<\/no(script|embed|frames)/i,e.innerHTML))?($&&3===e.nodeType&&(t=e.textContent,t=$e(t,k," "),t=$e(t,L," "),t=$e(t,z," "),e.textContent!==t&&(Ze(u.removed,{element:e.cloneNode()}),e.textContent=t)),Re("afterSanitizeElements",e,null),!1):(Oe(e),!0);if(!V[i]&&Fe(i)){if(Y.tagNameCheck instanceof RegExp&&it(Y.tagNameCheck,i))return;if(Y.tagNameCheck instanceof Function&&Y.tagNameCheck(i))return}if(ue&&!ce[i]){var n=b(e)||e.parentNode,r=f(e)||e.childNodes;if(r&&n)for(var o=r.length-1;0<=o;--o){var a=p(r[o],!0);a.__removalCount=(e.__removalCount||0)+1,n.insertBefore(a,m(e))}}return Oe(e),1}function Ge(e,t,i){if(se&&("id"===t||"name"===t)&&(i in o||i in Se))return!1;if((!q||X[t]||!it(N,t))&&(!Z||!it(H,t)))if(!W[t]||X[t]){if(!(Fe(e)&&(Y.tagNameCheck instanceof RegExp&&it(Y.tagNameCheck,e)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(e))&&(Y.attributeNameCheck instanceof RegExp&&it(Y.attributeNameCheck,t)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(t))||"is"===t&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&it(Y.tagNameCheck,i)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(i))))return!1}else if(!pe[t]&&!it(Q,$e(i,D,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==et(i,"data:")||!he[e])&&(!K||it(R,$e(i,D,"")))&&i)return!1;return!0}function Qe(e){Re("beforeSanitizeAttributes",e,null);var t=e.attributes;if(t&&!Ne(e)){for(var i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W},n=t.length;n--;){var r=l=t[n],o=r.name,a=r.namespaceURI,s="value"===o?l.value:tt(l.value),r=M(o);if(i.attrName=r,i.attrValue=s,i.keepAttr=!0,i.forceKeepAttr=void 0,Re("uponSanitizeAttribute",e,i),s=i.attrValue,!i.forceKeepAttr&&(ke(o,e),i.keepAttr))if(J||!it(/\/>/i,s)){$&&(s=$e(s,k," "),s=$e(s,L," "),s=$e(s,z," "));var l=M(e.nodeName);if(Ge(l,r,s))if(!le||"id"!==r&&"name"!==r||(ke(o,e),s="user-content-"+s),ee&&it(/((--!?|])>)|<\/(style|title)/i,s))ke(o,e);else{if(v&&"object"===We(g)&&"function"==typeof g.getAttributeType&&!a)switch(g.getAttributeType(l,r)){case"TrustedHTML":s=v.createHTML(s);break;case"TrustedScriptURL":s=v.createScriptURL(s)}try{a?e.setAttributeNS(a,o,s):e.setAttribute(o,s),Ne(e)?Oe(e):Xe(u.removed)}catch(e){}}}else ke(o,e)}Re("afterSanitizeAttributes",e,null)}}function Be(e){var t,i=ze(e);for(Re("beforeSanitizeShadowDOM",e,null);t=i.nextNode();)Re("uponSanitizeShadowNode",t,null),De(t),Qe(t),t.content instanceof c&&Be(t.content);Re("afterSanitizeShadowDOM",e,null)}var Fe=function(e){return"annotation-xml"!==e&&Je(e,G)};return u.sanitize=function(e){var t,i,n,r,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if((we=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!He(e)){if("function"!=typeof e.toString)throw nt("toString is not a function");if("string"!=typeof(e=e.toString()))throw nt("dirty is not a string, aborting")}if(!u.isSupported){if("object"===We(l.toStaticHTML)||"function"==typeof l.toStaticHTML){if("string"==typeof e)return l.toStaticHTML(e);if(He(e))return l.toStaticHTML(e.outerHTML)}return e}if(ie||A(o),u.removed=[],"string"==typeof e&&(de=!1),de){if(e.nodeName){var a=M(e.nodeName);if(!B[a]||V[a])throw nt("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof _)1===(a=(t=Le("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?t=a:t.appendChild(a);else{if(!re&&!$&&!te&&-1===e.indexOf("<"))return v&&ae?v.createHTML(e):e;if(!(t=Le(e)))return re?null:ae?y:""}t&&ne&&Oe(t.firstChild);for(var s=ze(de?e:t);i=s.nextNode();)3===i.nodeType&&i===n||(De(i),Qe(i),i.content instanceof c&&Be(i.content),n=i);if(n=null,de)return e;if(re){if(oe)for(r=x.call(t.ownerDocument);t.firstChild;)r.appendChild(t.firstChild);else r=t;return(W.shadowroot||W.shadowrootmod)&&(r=I.call(d,r,!0)),r}e=te?t.outerHTML:t.innerHTML;return te&&B["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&it(St,t.ownerDocument.doctype.name)&&(e="<!DOCTYPE "+t.ownerDocument.doctype.name+">\n"+e),$&&(e=$e(e,k," "),e=$e(e,L," "),e=$e(e,z," ")),v&&ae?v.createHTML(e):e},u.setConfig=function(e){A(e),ie=!0},u.clearConfig=function(){Ie=null,ie=!1},u.isValidAttribute=function(e,t,i){Ie||A({});e=M(e),t=M(t);return Ge(e,t,i)},u.addHook=function(e,t){"function"==typeof t&&(P[e]=P[e]||[],Ze(P[e],t))},u.removeHook=function(e){if(P[e])return Xe(P[e])},u.removeHooks=function(e){P[e]&&(P[e]=[])},u.removeAllHooks=function(){P={}},u}()});var g_ugFunctions=new UGFunctions;function UGThumbsGeneral(){var i,n,l,u,o=this,r=jQuery(o),a=new UniteGalleryMain,s=new UGFunctions;this.type={GET_THUMBS_ALL:"all",GET_THUMBS_RATIO:"ratio",GET_THUMBS_NO_RATIO:"no_ratio",GET_THUMBS_NEW:"new"};var d={thumb_width:88,thumb_height:50,thumb_fixed_size:!0,thumb_resize_by:"height",thumb_border_effect:!0,thumb_border_width:0,thumb_border_color:"#000000",thumb_over_border_width:0,thumb_over_border_color:"#d9d9d9",thumb_selected_border_width:1,thumb_selected_border_color:"#d9d9d9",thumb_round_corners_radius:0,thumb_color_overlay_effect:!0,thumb_overlay_color:"#000000",thumb_overlay_opacity:.4,thumb_overlay_reverse:!(this.events={SETOVERSTYLE:"thumbmouseover",SETNORMALSTYLE:"thumbmouseout",SETSELECTEDSTYLE:"thumbsetselected",PLACEIMAGE:"thumbplaceimage",AFTERPLACEIMAGE:"thumb_after_place_image",IMAGELOADERROR:"thumbimageloaderror",THUMB_IMAGE_LOADED:"thumb_image_loaded"}),thumb_image_overlay_effect:!1,thumb_image_overlay_type:"bw",thumb_transition_duration:200,thumb_transition_easing:"easeOutQuad",thumb_show_loader:!0,thumb_loader_type:"dark",thumb_wrapper_as_link:!1,thumb_link_newpage:!1},c={touchEnabled:!1,num_thumbs_checking:0,customThumbs:!1,funcSetCustomThumbHtml:null,isEffectBorder:!1,isEffectOverlay:!1,isEffectImage:!1,colorOverlayOpacity:1,thumbInnerReduce:0,allowOnResize:!0,classNewThumb:"ug-new-thumb"},t="thumb_size_change";function _(e,t){var i=l[e],n="";0==c.customThumbs&&(n=" ug-thumb-generated");var r,o,a="<div class='ug-thumb-wrapper"+n+"' "+("style='z-index:"+(i.index+1)+";'")+"></div>";1==d.thumb_wrapper_as_link&&(r=i.link,""==i.link&&(r="javascript:void(0)"),o="",1==d.thumb_link_newpage&&i.link&&(o=" target='_blank'"),a="<a href='"+r+"'"+o+" class='ug-thumb-wrapper"+n+"'></a>");var s,n=jQuery(a),a=i.objThumbImage;return 0==c.customThumbs&&(1==d.thumb_show_loader&&a&&(s="ug-thumb-loader-dark","bright"==d.thumb_loader_type&&(s="ug-thumb-loader-bright"),n.append("<div class='ug-thumb-loader "+s+"'></div>"),n.append("<div class='ug-thumb-error' style='display:none'></div>")),a&&(a.addClass("ug-thumb-image"),1==d.thumb_image_overlay_effect&&((s=a.clone().appendTo(n)).addClass("ug-thumb-image-overlay "+t).removeClass("ug-thumb-image"),s.fadeTo(0,0),i.objImageOverlay=s),n.append(a))),c.isEffectBorder&&n.append("<div class='ug-thumb-border-overlay'></div>"),c.isEffectOverlay&&n.append("<div class='ug-thumb-overlay'></div>"),u.append(n),c.customThumbs&&c.funcSetCustomThumbHtml(n,i),l[e].objThumbWrapper=n}function h(e,t,i,n){var r={width:e+"px",height:t+"px"},e={width:e-c.thumbInnerReduce+"px",height:t-c.thumbInnerReduce+"px"},t=".ug-thumb-loader, .ug-thumb-error, .ug-thumb-border-overlay, .ug-thumb-overlay";i?(!0!==n&&i.css(r),i.find(t).css(e)):(u.children(".ug-thumb-wrapper").css(r),u.find(t).css(e))}function g(e,t,i,n){n=n||!1,a.isFakeFullscreen()&&(n=!0);var r=e.children(".ug-thumb-border-overlay"),e={};e["border-width"]=t+"px",0!=t&&(e["border-color"]=i),n&&!0===n?(r.css(e),0==t?r.hide():r.show()):(0==t?r.stop().fadeOut(d.thumb_transition_duration):r.show().stop().fadeIn(d.thumb_transition_duration),e=e,r.stop(!0).animate(e,{duration:d.thumb_transition_duration,easing:d.thumb_transition_easing,queue:!1}))}function p(e,t,i){var n=e.children(".ug-thumb-overlay"),e=d.thumb_transition_duration;i&&!0===i&&(e=0),t?n.stop(!0).fadeTo(e,c.colorOverlayOpacity):n.stop(!0).fadeTo(e,0)}function m(e,t,i){var n=e.children("img.ug-thumb-image"),r=e.children("img.ug-thumb-image-overlay"),e=d.thumb_transition_duration;i&&!0===i&&(e=0),t?r.stop(!0).fadeTo(e,1):(n.fadeTo(0,1),r.stop(!0).fadeTo(e,0))}function f(e,t){c.isEffectBorder&&g(e,d.thumb_selected_border_width,d.thumb_selected_border_color,t),c.isEffectOverlay&&p(e,1==d.thumb_overlay_reverse,t),c.isEffectImage&&m(e,!1,t),r.trigger(o.events.SETSELECTEDSTYLE,e)}function b(e){1==y(e)?f(e,!0):o.setThumbNormalStyle(e,!0,"redraw")}function v(e,t){var i,n;1==d.thumb_fixed_size?s.scaleImageCoverParent(t,e):("height"==d.thumb_resize_by?s.scaleImageByHeight(t,d.thumb_height):s.scaleImageByWidth(t,d.thumb_width),n=s.getElementSize(t),s.placeElement(t,0,0),h(n.width,n.height,e)),e.children(".ug-thumb-loader").hide(),t.show(),0==d.thumb_image_overlay_effect?t.fadeTo(0,1):(1!=d.thumb_image_overlay_effect||0!=(n=(i=t).siblings(".ug-thumb-image-overlay")).length&&(i={width:(i=s.getElementSize(i)).width+"px",height:i.height+"px",left:i.left+"px",top:i.top+"px"},n.css(i),0==c.customThumbs&&n.fadeTo(0,1)),t.fadeTo(0,0),b(e)),r.trigger(o.events.AFTERPLACEIMAGE,e)}function y(e){return!!e.hasClass("ug-thumb-selected")}function w(e,t){t=jQuery(t);o.getItemByThumb(t);var i=s.getElementSize(t);h(i.width,i.height,t,!0),b(t)}function E(e,t,i){var n=o.getItemByThumb(t);n.isLoaded=!0,n.isThumbImageLoaded=!0;i=s.getImageOriginalSize(i);n.thumbWidth=i.width,n.thumbHeight=i.height,n.thumbRatioByWidth=i.width/i.height,n.thumbRatioByHeight=i.height/i.width,t.addClass("ug-thumb-ratio-set")}this.init=function(e,t){i=e.getObjects(),a=e,jQuery(e),n=i.g_objWrapper,l=i.g_arrItems,d=jQuery.extend(d,t),c.isEffectBorder=d.thumb_border_effect,c.isEffectOverlay=d.thumb_color_overlay_effect,c.isEffectImage=d.thumb_image_overlay_effect},this._____________EXTERNAL_SETTERS__________=function(){},this.setHtmlThumbs=function(e,t){var i;if(u=e,1==c.isEffectImage&&(i=function(){var e,t="",i=d.thumb_image_overlay_type.split(",");for(e in i)switch(i[e]){case"bw":t+=" ug-bw-effect";break;case"blur":t+=" ug-blur-effect";break;case"sepia":t+=" ug-sepia-effect"}return t}()),!0!==t)for(var n=a.getNumItems(),r=0;r<n;r++)_(r,i);else{o.getThumbs().removeClass(c.classNewThumb);t=a.getNewAddedItemsIndexes();jQuery.each(t,function(e,t){_(t,i).addClass(c.classNewThumb)})}},this.setThumbNormalStyle=function(e,t,i){1==c.customThumbs&&e.removeClass("ug-thumb-over"),c.isEffectBorder&&g(e,d.thumb_border_width,d.thumb_border_color,t),c.isEffectOverlay&&p(e,1!=d.thumb_overlay_reverse,t),c.isEffectImage&&m(e,!0,t),r.trigger(o.events.SETNORMALSTYLE,e)},this.setThumbOverStyle=function(e){1==c.customThumbs&&e.addClass("ug-thumb-over"),c.isEffectBorder&&g(e,d.thumb_over_border_width,d.thumb_over_border_color),c.isEffectOverlay&&p(e,1==d.thumb_overlay_reverse),1==c.isEffectImage&&m(e,!1),r.trigger(o.events.SETOVERSTYLE,e)},this.setHtmlProperties=function(e){var t,i;e=e||o.getThumbs(),0==c.customThumbs&&(1==d.thumb_fixed_size&&h(d.thumb_width,d.thumb_height,e),t=e,d.thumb_round_corners_radius<=0||(i={"border-radius":d.thumb_round_corners_radius+"px"},t?(t.css(i),t.find(".ug-thumb-border-overlay").css(i)):u.find(".ug-thumb-wrapper, .ug-thumb-wrapper .ug-thumb-border-overlay").css(i))),e.each(function(){b(jQuery(this))}),c.isEffectOverlay&&d.thumb_overlay_color&&(t={},s.isRgbaSupported()?(i=s.convertHexToRGB(d.thumb_overlay_color,d.thumb_overlay_opacity),t["background-color"]=i):(t["background-color"]=d.thumb_overlay_color,c.colorOverlayOpacity=d.thumb_overlay_opacity),e.find(".ug-thumb-overlay").css(t))},this.setThumbSelected=function(e){if(1==c.customThumbs&&e.removeClass("ug-thumb-over"),1==y(e))return!0;e.addClass("ug-thumb-selected"),f(e)},this.setThumbUnselected=function(e){e.removeClass("ug-thumb-selected"),o.setThumbNormalStyle(e,!1,"set unselected")},this.setOptions=function(e){d=jQuery.extend(d,e)},this.setThumbInnerReduce=function(e){c.thumbInnerReduce=e},this.setCustomThumbs=function(e,t,i){if(c.customThumbs=!0,"function"!=typeof e)throw new Error("The argument should be function");c.funcSetCustomThumbHtml=e,-1==jQuery.inArray("overlay",t)&&(c.isEffectOverlay=!1),-1==jQuery.inArray("border",t)&&(c.isEffectBorder=!1),c.isEffectImage=!1,i&&!1===i.allow_onresize&&(c.allowOnResize=!1)},this._____________EXTERNAL_GETTERS__________=function(){},this.getOptions=function(){return d},this.getNumThumbs=function(){return l.length},this.getThumbImage=function(e){return e.find(".ug-thumb-image")},this.getThumbByIndex=function(e){var t=o.getThumbs();if(e>=t.length||e<0)throw new Error("Wrong thumb index");return jQuery(t[e])},this.getThumbs=function(e){var t=".ug-thumb-wrapper",i=".ug-thumb-ratio-set";switch(e){default:case o.type.GET_THUMBS_ALL:var n=u.children(t);break;case o.type.GET_THUMBS_NO_RATIO:n=u.children(t).not(i);break;case o.type.GET_THUMBS_RATIO:n=u.children(t+i);break;case o.type.GET_THUMBS_NEW:n=u.children("."+c.classNewThumb)}return n},this.getItemByThumb=function(e){var t=e.data("index");return void 0===t&&(t=e.index()),l[t]},this.isThumbLoaded=function(e){return o.getItemByThumb(e).isLoaded},this.getGlobalThumbSize=function(){return{width:d.thumb_width,height:d.thumb_height}},this._____________EXTERNAL_OTHERS__________=function(){},this.initEvents=function(){var e=".ug-thumb-wrapper";1==c.allowOnResize&&n.on(t,w),r.on(o.events.THUMB_IMAGE_LOADED,E),u.on("touchstart",e,function(){c.touchEnabled=!0,u.off("mouseenter").off("mouseleave")}),u.on("mouseenter",e,function(e){var t=jQuery(this);t=t,1==c.touchEnabled?objThumbs.off("mouseenter").off("mouseleave"):0==y(t)&&o.setThumbOverStyle(t)}),u.on("mouseleave",e,function(e){var t=jQuery(this);t=t,1!=c.touchEnabled&&0==y(t)&&o.setThumbNormalStyle(t,!1)})},this.destroy=function(){var e=".ug-thumb-wrapper";u.off("touchstart",e),n.off(t),u.off("mouseenter",e),u.off("mouseleave",e),r.off(o.events.THUMB_IMAGE_LOADED)},this.loadThumbsImages=function(){var e=u.find(".ug-thumb-image");s.checkImagesLoaded(e,null,function(e,t){0==t?function(e,t){t=t||!1;var i=jQuery(e);0!=(e=i.parents(".ug-thumb-wrapper")).parent().length&&(1==o.getItemByThumb(e).isLoaded&&!1===t||(o.triggerImageLoadedEvent(e,i),1==c.customThumbs?r.trigger(o.events.PLACEIMAGE,[e,i]):v(e,i)))}(e,!0):function(e){var t=o.getItemByThumb(e);if(t.isLoaded=!0,t.isThumbImageLoaded=!1,1==c.customThumbs)return r.trigger(o.events.IMAGELOADERROR,e);e.children(".ug-thumb-loader").hide(),e.children(".ug-thumb-error").show()}(jQuery(e).parent())})},this.triggerImageLoadedEvent=function(e,t){r.trigger(o.events.THUMB_IMAGE_LOADED,[e,t])},this.hideThumbs=function(){u.find(".ug-thumb-wrapper").hide()}}function UGThumbsStrip(){var a,i,n,r,s,l,u,d,c=this,_=new UniteGalleryMain,h=new UGFunctions,g=!1,p=new UGThumbsGeneral,h=new UGFunctions,m={strip_vertical_type:!1,strip_thumbs_align:"left",strip_space_between_thumbs:6,strip_thumb_touch_sensetivity:15,strip_scroll_to_thumb_duration:500,strip_scroll_to_thumb_easing:"easeOutCubic",strip_control_avia:!0,strip_control_touch:!0,strip_padding_top:0,strip_padding_bottom:0,strip_padding_left:0,strip_padding_right:0},f={isRunOnce:!1,is_placed:!1,isNotFixedThumbs:!1,handle:null},b={stripSize:0,stripActiveSize:0,stripInnerSize:0,thumbSize:0,thumbSecondSize:0};this.events={STRIP_MOVE:"stripmove",INNER_SIZE_CHANGE:"size_change"};var o={strip_thumbs_align:"top",thumb_resize_by:"width"};function v(){var e=p.getOptions();f.isNotFixedThumbs=!1===e.thumb_fixed_size,g=m.strip_vertical_type}function e(){var e,t,i,n,r,o;p.setHtmlProperties(),e=l.children(".ug-thumb-wrapper"),t=jQuery(e[0]),i=t.outerWidth(),e=t.outerHeight(),t=p.getOptions(),0==g?(b.thumbSize=i,1==t.thumb_fixed_size?b.thumbSecondSize=e:b.thumbSecondSize=t.thumb_height,y(s.width()),b.stripInnerSize=l.width()):(b.thumbSize=e,1==t.thumb_fixed_size?b.thumbSecondSize=i:b.thumbSecondSize=t.thumb_width,y(s.height()),b.stripInnerSize=l.height()),0==g?(n=b.thumbSecondSize,(r={}).height=n+"px",(o={}).height=n+"px"):(n=b.thumbSecondSize,(r={}).width=n+"px",(o={}).width=n+"px"),s.css(r),l.css(o),w(),0==f.isRunOnce&&(1==m.strip_control_touch&&(d=new UGTouchThumbsControl).init(c),1==m.strip_control_avia&&(u=new UGAviaControl).init(c),I(),p.loadThumbsImages(),p.initEvents(),s.find(".ug-thumb-wrapper").on("click touchend",function(e){!function(e){if(c.isTouchMotionActive())if(1==d.isSignificantPassed())return;e=p.getItemByThumb(e),_.selectItem(e)}(jQuery(this))}),a.on(_.events.ITEM_CHANGE,P),f.isNotFixedThumbs&&jQuery(p).on(p.events.AFTERPLACEIMAGE,S)),f.isRunOnce=!0}function y(e){b.stripSize=e,b.stripActiveSize=0==g?b.stripSize-m.strip_padding_left-m.strip_padding_right:b.stripSize-m.strip_padding_top-m.strip_padding_bottom,b.stripActiveSize<0&&(b.stripActiveSize=0)}function w(){var e=l.children(".ug-thumb-wrapper"),t=0,i=0;0==g&&(i=m.strip_padding_top);for(var n,r=0;r<e.length;r++){var o=jQuery(e[r]);if(1==f.isNotFixedThumbs){if(objItem=p.getItemByThumb(o),0==objItem.isLoaded)continue;o.show()}h.placeElement(o,t,i),0==g?t+=o.outerWidth()+m.strip_space_between_thumbs:i+=o.outerHeight()+m.strip_space_between_thumbs}n=0==g?t-m.strip_space_between_thumbs:i-m.strip_space_between_thumbs,n=n,0==g?l.width(n):l.height(n),b.stripInnerSize=n,I(),jQuery(c).trigger(c.events.INNER_SIZE_CHANGE)}function t(e){e=c.getInnerStripPos()+e,e=c.fixInnerStripLimits(e);c.positionInnerStrip(e,!0)}function E(e){e=-1*A(e).min,e=c.fixInnerStripLimits(e);c.positionInnerStrip(e,!0)}function x(e){e=-1*A(e).max+b.stripSize,e=c.fixInnerStripLimits(e);c.positionInnerStrip(e,!0)}function T(e){var t,i,n;0!=C()&&(i={},t=c.getInnerStripPos(),i.minPosThumbs=-1*t+1,i.maxPosThumbs=-1*t+b.stripSize-1,n=i,(t=A(e)).min<n.minPosThumbs?(i=e.prev()).length?E(i):E(e):t.max>n.maxPosThumbs&&((n=e.next()).length?x(n):x(e)))}function I(){1==C()?(u&&u.enable(),d&&d.enable()):(u&&u.disable(),d&&d.disable())}function S(){clearTimeout(f.handle),f.handle=setTimeout(function(){w()},50)}function P(){var e=_.getSelectedItem();p.setThumbSelected(e.objThumbWrapper),T(e.objThumbWrapper)}function C(){return b.stripInnerSize>b.stripActiveSize}function A(e){var t={},e=e.position();return 0==g?(t.min=e.left,t.max=e.left+b.thumbSize):(t.min=e.top,t.max=e.top+b.thumbSize),t}this.setHtml=function(e){e||(e=n,null!=m.parent_container&&(e=m.parent_container)),e.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"),s=e.children(".ug-thumbs-strip"),l=s.children(".ug-thumbs-strip-inner"),p.setHtmlThumbs(l),1==f.isNotFixedThumbs&&p.hideThumbs()},this.destroy=function(){var e=s.find(".ug-thumb-wrapper");e.off("click"),e.off("touchend"),a.off(_.events.ITEM_CHANGE),jQuery(p).off(p.events.AFTERPLACEIMAGE),d&&d.destroy(),u&&u.destroy(),p.destroy()},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t){t=t,i=(e=e).getObjects(),(_=e).attachThumbsPanel("strip",c),a=jQuery(e),n=i.g_objWrapper,r=i.g_arrItems,m=jQuery.extend(m,t),1==(g=m.strip_vertical_type)&&(m=jQuery.extend(m,o),m=jQuery.extend(m,t),t.thumb_resize_by="width"),p.init(e,t),v()},this.run=function(){e()},this.positionInnerStrip=function(e,t){void 0===t&&(t=!1),e=0==g?{left:e+"px"}:{top:e+"px"},0==t?(l.css(e),c.triggerStripMoveEvent()):(c.triggerStripMoveEvent(),l.stop(!0).animate(e,{duration:m.strip_scroll_to_thumb_duration,easing:m.strip_scroll_to_thumb_easing,queue:!1,progress:function(){c.triggerStripMoveEvent()},always:function(){c.triggerStripMoveEvent()}}))},this.triggerStripMoveEvent=function(){jQuery(c).trigger(c.events.STRIP_MOVE)},this.isTouchMotionActive=function(){return!!d&&d.isTouchActive()},this.isItemThumbVisible=function(e){var t,i,n=e.objThumbWrapper,r=n.position(),e=-1*c.getInnerStripPos();return e<=(0==g?(t=e+b.stripSize,i=r.left,r.left+n.width()):(t=e+b.stripSize,i=r.top,r.top+n.height()))&&i<=t?!0:!1},this.getInnerStripPos=function(){return 0==g?l.position().left:l.position().top},this.getInnerStripLimits=function(){var e={};return e.maxPos=0==g?m.strip_padding_left:m.strip_padding_top,e.minPos=-(b.stripInnerSize-b.stripActiveSize),e},this.fixInnerStripLimits=function(e){var t=c.getInnerStripLimits();return e>t.maxPos&&(e=t.maxPos),e<t.minPos&&(e=t.minPos),e},this.scrollForeward=function(){t(-b.stripSize)},this.scrollBack=function(){t(b.stripSize)},this.________EXTERNAL_SETTERS___________=function(){},this.setOptions=function(e){m=jQuery.extend(m,e),p.setOptions(e),v()},this.setSizeVertical=function(e){if(0==g)throw new Error("setSizeVertical error, the strip size is not vertical");var t=b.thumbSecondSize,i={};i.width=t+"px",i.height=e+"px",s.css(i),y(e);e={};e.width=t+"px",e.left="0px",e.top="0px",l.css(e),f.is_placed=!0,I()},this.setSizeHorizontal=function(e){if(1==g)throw new Error("setSizeHorizontal error, the strip size is not horizontal");var t=b.thumbSecondSize+m.strip_padding_top+m.strip_padding_bottom,i={};i.width=e+"px",i.height=t+"px",s.css(i),y(e);i=m.strip_padding_left,e={};e.height=t+"px",e.left=i+"px",e.top="0px",l.css(e),f.is_placed=!0,I()},this.setPosition=function(e,t,i,n){h.placeElement(s,e,t,i,n)},this.resize=function(e){var t;0==g?(s.width(e),b.stripActiveSize=e-m.strip_padding_left-m.strip_padding_right):(s.height(e),b.stripActiveSize=e-m.strip_padding_top-m.strip_padding_bottom),y(e),I(),0==C()||(t=c.getInnerStripPos())!=(t=c.fixInnerStripLimits(t))&&c.positionInnerStrip(t,!0),C()||(0==g?h.placeElement(l,m.strip_thumbs_align,0):h.placeElement(l,0,m.strip_thumbs_align)),null!=(t=_.getSelectedItem())&&(t=t.objThumbWrapper)&&T(t),u&&u.onResize()},this.setThumbUnselected=function(e){p.setThumbUnselected(e)},this.setCustomThumbs=function(e){p.setCustomThumbs(e)},this.________EXTERNAL_GETTERS___________=function(){},this.getObjects=function(){var e=p.getOptions(),e=jQuery.extend(m,e);return{g_gallery:_,g_objGallery:a,g_objWrapper:n,g_arrItems:r,g_objStrip:s,g_objStripInner:l,g_aviaControl:u,g_touchThumbsControl:d,isVertical:g,g_options:e,g_thumbs:p}},this.getObjThumbs=function(){return p},this.getSelectedThumb=function(){var e=_.getSelectedItemIndex();return-1==e?null:p.getThumbByIndex(e)},this.getSizeAndPosition=function(){return h.getElementSize(s)},this.getHeight=function(){return s.outerHeight()},this.getWidth=function(){return s.outerWidth()},this.getSizes=function(){return b},this.isVertical=function(){return g},this.isPlaced=function(){return f.is_placed},this.isMoveEnabled=function(){return C()}}function UGTouchThumbsControl(){var c,t,i,_,n,h,r=new UGFunctions,g={touch_portion_time:200,thumb_touch_slowFactor:0,minDeltaTime:70,minPath:10,limitsBreakAddition:30,returnAnimateSpeed:500,animationEasing:"easeOutCubic",returnAnimationEasing:"easeOutCubic"},p={touch_active:!1,loop_active:!1,mousePos:0,innerPos:0,startPos:0,startTime:0,lastTime:0,buttonReleaseTime:0,lastPos:0,lastPortionPos:0,lastDeltaTime:0,lastDeltaPos:0,speed:0,handle:"",touchEnabled:!1,isControlEnabled:!0};function o(){var e=jQuery.now(),t={};return t.passedTime=p.lastTime-p.startTime,t.lastActiveTime=e-p.buttonReleaseTime,t.passedDistance=p.lastPos-p.startPos,t.passedDistanceAbs=Math.abs(t.passedDistance),t}function a(e){return 0==h?r.getMousePosition(e).pageX:r.getMousePosition(e).pageY}function s(){var e=jQuery.now();e-p.lastTime>=g.touch_portion_time&&(p.lastDeltaTime=e-p.lastTime,p.lastDeltaTime>g.touch_portion_time&&(p.lastDeltaTime=g.touch_portion_time),p.lastDeltaPos=p.lastPos-p.lastPortionPos,p.lastPortionPos=p.lastPos,p.lastTime=e)}function m(){p.lastPos=c.getInnerStripPos(),c.triggerStripMoveEvent()}function l(e){if(0==p.loop_active)return 1;e&&(a(e),function(){var e=g.thumb_touch_slowFactor,t=g.minDeltaTime,i=g.minPath,n=c.getInnerStripPos(),r=jQuery.now()-p.lastTime,o=n-p.lastPortionPos;r<t&&0<p.lastDeltaTime&&(r=p.lastDeltaTime,o=p.lastDeltaPos+o),r<t&&(r=t);var a=0;0<r&&(a=o/r);var s=a*a/(2*e)*(0<o?1:-1);Math.abs(s)<=i&&(s=0);var l=c.getInnerStripPos(),u=l+s,n=c.fixInnerStripLimits(u),t=c.getInnerStripLimits(),r=g.limitsBreakAddition,o=!1,i=n;u>t.maxPos&&(o=!0,u<(n=r)&&(n=u)),u<t.minPos&&(o=!0,n=(d=t.minPos-r)<u?u:d);var d=n-l,e=Math.abs(Math.round(a/e));0!=s&&(e=e*d/s),l!=n&&(n=1==h?{top:n+"px"}:{left:n+"px"},_.animate(n,{duration:e,easing:g.animationEasing,queue:!0,progress:m})),1==o&&(o=g.returnAnimateSpeed,i=1==h?{top:i+"px"}:{left:i+"px"},_.animate(i,{duration:o,easing:g.returnAnimationEasing,queue:!0,progress:m}))}()),p.loop_active=!1,p.handle=clearInterval(p.handle)}function u(e){return 0==p.isControlEnabled||(p.buttonReleaseTime=jQuery.now(),0==p.touch_active?(l(e),!0):(e.preventDefault(),p.touch_active=!1,l(e),void i.removeClass("ug-dragging")))}function d(e){if(0==p.isControlEnabled)return!0;e.preventDefault(),p.touch_active=!0;var t=a(e);_.stop(!0),e=t,t=c.getInnerStripPos(),p.mousePos=e,p.innerPos=t,p.lastPortionPos=t,p.lastDeltaTime=0,p.lastDeltaPos=0,p.startTime=jQuery.now(),p.startPos=p.innerPos,p.lastTime=p.startTime,p.lastPos=p.startPos,p.speed=0,1!=p.loop_active&&(p.loop_active=!0,p.handle=setInterval(s,10)),i.addClass("ug-dragging")}function f(e){if(0==p.isControlEnabled)return!0;if(0==p.touch_active)return!0;if(e.preventDefault(),0==e.buttons)return p.touch_active=!1,l(e),!0;var t,i=a(e);p.lastPos=c.getInnerStripPos(),e=i,i=p.mousePos-e,e=p.innerPos-i,i=c.getInnerStripLimits(),e>i.maxPos&&(t=e-i.maxPos,e=i.maxPos+t/3),e<i.minPos&&(t=i.minPos-e,e=i.minPos-t/3),c.positionInnerStrip(e),s()}this.enable=function(){p.isControlEnabled=!0},this.disable=function(){p.isControlEnabled=!1},this.init=function(e){t=(c=e).getObjects(),t.g_gallery,t.g_objGallery,i=t.g_objStrip,_=t.g_objStripInner,n=t.g_options,h=t.isVertical,g.thumb_touch_slowFactor=r.normalizeSetting(5e-5,.01,1,100,n.strip_thumb_touch_sensetivity,!0),i.bind("mousedown touchstart",d),jQuery(window).add("body").bind("mouseup touchend",u),jQuery("body").bind("mousemove touchmove",f)},this.isSignificantPassed=function(){var e=o();return 300<e.passedTime||30<e.passedDistanceAbs},this.isTouchActive=function(){return 1==p.touch_active||(1==_.is(":animated")||o().lastActiveTime<50)},this.destroy=function(){i.unbind("mousedown"),i.unbind("touchstart"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),jQuery("body").unbind("mousemove").unbind("touchmove")}}function UGPanelsBase(){var o,a,n,s,l,t,u,d=new UniteGalleryMain,i=this,r=new UGFunctions;function c(e,t){switch(o.orientation){case"right":case"left":var i={left:e+"px"};break;case"top":case"bottom":i={top:e+"px"}}n.stop(!0).animate(i,{duration:300,easing:"easeInOutQuad",queue:!1,complete:function(){t&&t()}})}function _(e){switch(o.orientation){case"right":case"left":r.placeElement(n,e,null);break;case"top":case"bottom":r.placeElement(n,null,e)}}function h(){l.trigger(a.events.FINISH_MOVE)}this.init=function(e,t,i,n,r){o=t,a=i,d=e,s=n,l=r,u=jQuery(d)},this.setHtml=function(e){n=e,e="strip"==o.panelType?s.strippanel_enable_handle:s.gridpanel_enable_handle,"default"==s.gallery_theme&&(e=!1),1==e&&((t=new UGPanelHandle).init(a,n,s,o.panelType,d),t.setHtml()),!0===o.isDisabledAtStart&&(n.append("<div class='ug-overlay-disabled'></div>"),setTimeout(function(){n.children(".ug-overlay-disabled").hide()},o.disabledAtStartTimeout))},this.placeElements=function(){t&&t.placeHandle()},this.initEvents=function(){t&&(t.initEvents(),u.on(d.events.SLIDER_ACTION_START,function(){t.hideHandle()}),u.on(d.events.SLIDER_ACTION_END,function(){t.showHandle()}))},this.destroy=function(){t&&(t.destroy(),u.off(d.events.SLIDER_ACTION_START),u.off(d.events.SLIDER_ACTION_END))},this.openPanel=function(e){return e=e||!1,!n.is(":animated")&&(0!=o.isClosed&&(o.isClosed=!1,l.trigger(a.events.OPEN_PANEL),void(!1===e?c(o.originalPos,h):(_(o.originalPos),h()))))},this.closePanel=function(e){if(e=e||!1,n.is(":animated"))return!1;if(1==o.isClosed)return!1;var t=i.getClosedPanelDest();o.isClosed=!0,l.trigger(a.events.CLOSE_PANEL),!1===e?c(t,h):(_(t),h())},this.setClosedState=function(e){o.originalPos=e,l.trigger(a.events.CLOSE_PANEL),o.isClosed=!0},this.setOpenedState=function(e){l.trigger(a.events.OPEN_PANEL),o.isClosed=!1},this.getClosedPanelDest=function(){var e=r.getElementSize(n);switch(o.orientation){case"left":o.originalPos=e.left,t=-o.panelWidth;break;case"right":o.originalPos=e.left;var t=d.getSize().width;break;case"top":o.originalPos=e.top,t=-o.panelHeight;break;case"bottom":o.originalPos=e.top,t=d.getSize().height}return t},this.isPanelClosed=function(){return o.isClosed},this.setDisabledAtStart=function(e){if(e<=0)return!1;o.isDisabledAtStart=!0,o.disabledAtStartTimeout=e}}function UGPanelHandle(){var o,a,r,i=new UGFunctions,s={panel_handle_align:"top",panel_handle_offset:0,panel_handle_skin:0,panel_handle_type:"default",panel_handle_custom_icon:"",panel_handle_icon_color:"#ffffff"};function e(){r.removeClass("ug-button-hover")}function t(e){if(e.stopPropagation(),e.stopImmediatePropagation(),0==i.validateClickTouchstartEvent(e.type))return!0;a.isPanelClosed()?a.openPanel():a.closePanel(),r.trigger("handle_tip_clicked")}this.init=function(e,t,i,n,r){switch(a=e,o=t,n){case"grid":s.panel_handle_align=i.gridpanel_handle_align,s.panel_handle_offset=i.gridpanel_handle_offset,s.panel_handle_skin=i.gridpanel_handle_skin,s.panel_handle_type=i.gridpanel_handle_type,s.panel_handle_custom_icon=i.gridpanel_handle_custom_icon,s.panel_handle_icon_color=i.gridpanel_handle_icon_color;break;case"strip":s.panel_handle_align=i.strippanel_handle_align,s.panel_handle_offset=i.strippanel_handle_offset,s.panel_handle_skin=i.strippanel_handle_skin,s.panel_handle_type=i.strippanel_handle_type,s.panel_handle_custom_icon=i.strippanel_handle_custom_icon,s.panel_handle_icon_color=i.strippanel_handle_icon_color;break;default:throw new Error("Panel handle error: wrong panel type: "+n)}r=r.getOptions().gallery_skin;""==s.panel_handle_skin&&(s.panel_handle_skin=r)},this.setHtml=function(){var e,t=a.getOrientation(),i="ug-panel-handle-tip",n=s.panel_handle_icon_color||"#ffffff";switch(t){case"right":i+=" ug-handle-tip-left",e='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12"><g stroke-width="2" transform="translate(0, 0)"><polyline points="3.5 0.5 9.5 6 3.5 11.5" fill="none" stroke="'+n+'" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></polyline></g></svg>';break;case"left":i+=" ug-handle-tip-right",e='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12"><g stroke-width="2" transform="translate(0, 0)"><polyline points="7.5 0.5 3.5 6 7.5 11.5" fill="none" stroke="'+n+'" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></polyline></g></svg>';break;case"bottom":i+=" ug-handle-tip-top",e='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12"><g stroke-width="2" transform="translate(0, 0)"><polyline points="0.5 3.5 6 9.5 11.5 3.5" fill="none" stroke="'+n+'" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></polyline></g></svg>';break;case"top":i+=" ug-handle-tip-bottom",e='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12"><g stroke-width="2" transform="translate(0, 0)"><polyline points="0.5 8.5 6 2.5 11.5 8.5" fill="none" stroke="'+n+'" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></polyline></g></svg>'}"custom"==s.panel_handle_type&&(i+=" ug-panel-handle-tip-custom",e=s.panel_handle_custom_icon),o.append("<div class='"+i+" ug-skin-"+s.panel_handle_skin+"'>"+e+"</div>"),r=o.children(".ug-panel-handle-tip")},this.initEvents=function(){i.addClassOnHover(r),r.bind("click touchstart",t),jQuery(a).on(a.events.OPEN_PANEL,function(){e(),r.removeClass("ug-button-closed")}),jQuery(a).on(a.events.CLOSE_PANEL,function(){e(),r.addClass("ug-button-closed")})},this.destroy=function(){i.destroyButton(r),jQuery(a).off(a.events.OPEN_PANEL),jQuery(a).off(a.events.CLOSE_PANEL)},this.placeHandle=function(){var e=i.getElementSize(r);!function(){switch(a.getOrientation()){case"right":case"left":"top"!=s.panel_handle_align&&"bottom"!=s.panel_handle_align&&(s.panel_handle_align="top");break;case"bottom":"left"!=s.panel_handle_align&&"right"!=s.panel_handle_align&&(s.panel_handle_align="left");break;case"top":"left"!=s.panel_handle_align&&"right"!=s.panel_handle_align&&(s.panel_handle_align="right")}}();var t=a.getOrientation();switch(t){case"left":i.placeElement(r,"right",s.panel_handle_align,-e.width);break;case"right":i.placeElement(r,-e.width,s.panel_handle_align,0,s.panel_handle_offset);break;case"top":i.placeElement(r,s.panel_handle_align,"bottom",s.panel_handle_offset,-e.height);break;case"bottom":i.placeElement(r,s.panel_handle_align,"top",s.panel_handle_offset,-e.height);break;default:throw new Error("Wrong panel orientation: "+t)}},this.hideHandle=function(){1==r.is(":visible")&&r.hide()},this.showHandle=function(){0==r.is(":visible")&&r.show()}}function UGStripPanel(){var i,o,a,s,l,n=this,r=jQuery(this),u=new UniteGalleryMain,d=new UGFunctions,c=new UGThumbsStrip,_=new UGPanelsBase,h={strippanel_vertical_type:!(this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"}),strippanel_padding_top:8,strippanel_padding_bottom:8,strippanel_padding_left:0,strippanel_padding_right:0,strippanel_enable_buttons:!0,strippanel_buttons_skin:"",strippanel_buttons_type:"default",strippanel_buttons_icon_color:"#ffffff",strippanel_buttons_icon_prev_custom:"",strippanel_buttons_icon_next_custom:"",strippanel_padding_buttons:2,strippanel_buttons_role:"scroll_strip",strippanel_enable_handle:!0,strippanel_handle_align:"top",strippanel_handle_offset:0,strippanel_handle_skin:"",strippanel_background_color:""},g={strip_vertical_type:!0,strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:0,strippanel_padding_bottom:0},p={strippanel_padding_left:8,strippanel_padding_right:8,strippanel_padding_top:8,strippanel_padding_bottom:8},m={panelType:"strip",panelWidth:0,panelHeight:0,isEventsInited:!1,isClosed:!1,orientation:null,originalPos:null,isFirstRun:!0,strip_speed:10};function e(){1==m.isFirstRun&&0==function(){if(0==h.strippanel_vertical_type){if(0==m.panelWidth)throw new Error("Strip panel error: The width not set, please set width")}else if(0==m.panelHeight)throw new Error("Strip panel error: The height not set, please set height");if(null==m.orientation)throw new Error("Wrong orientation, please set panel orientation before run");return!0}()||(c.run(),f(),b(),1!=m.isEventsInited&&(m.isEventsInited=!0,s&&(d.addClassOnHover(s,"ug-button-hover"),d.addClassOnHover(l,"ug-button-hover"),d.setButtonOnClick(l,y),d.setButtonOnClick(s,v),"advance_item"!=h.strippanel_buttons_role?(jQuery(c).on(c.events.STRIP_MOVE,E),jQuery(c).on(c.events.INNER_SIZE_CHANGE,w),i.on(u.events.SIZE_CHANGE,w)):0==u.getOptions().gallery_carousel&&jQuery(u).on(u.events.ITEM_CHANGE,x)),_.initEvents()),m.isFirstRun=!1,w())}function t(e){var t,i,n,r;(e=e||o).append("<div class='ug-strip-panel'></div>"),a=e.children(".ug-strip-panel"),1==h.strippanel_enable_buttons&&(t="ug-strip-arrow-left",r="ug-strip-arrow-right",e="","default"==h.strippanel_buttons_type&&(i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12"><g stroke-width="1" transform="translate(0, 0)"><polyline points="7.5 0.5 3.5 6 7.5 11.5" fill="none" stroke="'+h.strippanel_buttons_icon_color+'" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></polyline></g></svg>',n='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="12px" height="12px" viewBox="0 0 12 12"><g stroke-width="1" transform="translate(0, 0)"><polyline points="4.5 0.5 8.5 6 4.5 11.5" fill="none" stroke="'+h.strippanel_buttons_icon_color+'" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></polyline></g></svg>'),"custom"==h.strippanel_buttons_type&&(e=" ug-strip-arrow-custom ",i=h.strippanel_buttons_icon_prev_custom,n=h.strippanel_buttons_icon_next_custom),1==h.strippanel_vertical_type&&(t="ug-strip-arrow-up",r="ug-strip-arrow-down"),a.append("<div class='ug-strip-arrow "+t+e+" ug-skin-"+h.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'>"+i+"</div></div>"),a.append("<div class='ug-strip-arrow "+r+e+" ug-skin-"+h.strippanel_buttons_skin+"'><div class='ug-strip-arrow-tip'>"+n+"</div></div>")),_.setHtml(a),c.setHtml(a),1==h.strippanel_enable_buttons&&(l=a.children("."+t),s=a.children("."+r)),""!=h.strippanel_background_color&&a.css("background-color",h.strippanel_background_color),0!=h.strippanel_enable_handle&&(r=a.find(".ug-panel-handle-tip"),""!=h.strippanel_background_color&&r.css("background-color",h.strippanel_background_color))}function f(){var e,t,i;0==h.strippanel_vertical_type?(t=c.getHeight(),i=m.panelWidth,s&&(l.height(t),s.height(t),e=l.children(".ug-strip-arrow-tip"),d.placeElement(e,"center","middle"),e=s.children(".ug-strip-arrow-tip"),d.placeElement(e,"center","middle")),t=t+h.strippanel_padding_top+h.strippanel_padding_bottom,a.width(i),a.height(t),m.panelHeight=t,i=i-h.strippanel_padding_left-h.strippanel_padding_right,s&&(i=i-2*s.outerWidth()-2*h.strippanel_padding_buttons),c.resize(i)):(e=c.getWidth(),t=m.panelHeight,s&&(l.width(e),s.width(e),i=l.children(".ug-strip-arrow-tip"),d.placeElement(i,"center","middle"),i=s.children(".ug-strip-arrow-tip"),d.placeElement(i,"center","middle")),e=e+h.strippanel_padding_left+h.strippanel_padding_right,a.width(e),a.height(t),m.panelWidth=e,t=t-h.strippanel_padding_top-h.strippanel_padding_bottom,s&&(t=t-2*s.outerHeight()-2*h.strippanel_padding_buttons),c.resize(t))}function b(){(0==h.strippanel_vertical_type?function(){s&&(d.placeElement(l,"left","top",h.strippanel_padding_left,h.strippanel_padding_top),d.placeElement(s,"right","top",h.strippanel_padding_right,h.strippanel_padding_top));var e=h.strippanel_padding_left;s&&(e+=s.outerWidth()+h.strippanel_padding_buttons),c.setPosition(e,h.strippanel_padding_top)}:function(){s&&(d.placeElement(l,"left","top",h.strippanel_padding_left,h.strippanel_padding_top),d.placeElement(s,"left","bottom",h.strippanel_padding_left,h.strippanel_padding_bottom));var e=h.strippanel_padding_top;s&&(e+=s.outerHeight()+h.strippanel_padding_buttons),c.setPosition(h.strippanel_padding_left,e)})(),_.placeElements()}function v(e){if(d.isButtonDisabled(e))return!0;"advance_item"==h.strippanel_buttons_role?u.nextItem():c.scrollForeward()}function y(e){if(d.isButtonDisabled(e))return!0;"advance_item"==h.strippanel_buttons_role?u.prevItem():c.scrollBack()}function w(){if(!s)return!0;if(0==c.isMoveEnabled())return d.disableButton(l),d.disableButton(s),!0;var e=c.getInnerStripLimits(),t=c.getInnerStripPos();t>=e.maxPos?d.disableButton(l):d.enableButton(l),t<=e.minPos?d.disableButton(s):d.enableButton(s)}function E(){w()}function x(){u.isLastItem()?d.disableButton(s):d.enableButton(s),u.isFirstItem()?d.disableButton(l):d.enableButton(l)}this.destroy=function(){s&&(d.destroyButton(s),d.destroyButton(l),jQuery(c).off(c.events.STRIP_MOVE),jQuery(u).off(u.events.ITEM_CHANGE),jQuery(u).off(u.events.SIZE_CHANGE)),_.destroy(),c.destroy()},this.getOrientation=function(){return m.orientation},this.setOrientation=function(e){m.orientation=e},this.init=function(e,t){t=t,u=e=e,i=jQuery(u),e=!1,1==(h=jQuery.extend(h,t)).strippanel_vertical_type&&(h=jQuery.extend(h,g),e=!0),0==h.strippanel_enable_buttons&&(h=jQuery.extend(h,p),e=!0),1==e&&(h=jQuery.extend(h,t)),t=u.getOptions().gallery_skin,""==h.strippanel_buttons_skin&&(h.strippanel_buttons_skin=t),o=u.getElement(),_.init(u,m,n,h,r),(c=new UGThumbsStrip).init(u,h)},this.run=function(){e()},this.setHtml=function(e){t(e)},this.getElement=function(){return a},this.getSize=function(){return d.getElementSize(a)},this.setWidth=function(e){m.panelWidth=e},this.setHeight=function(e){m.panelHeight=e},this.resize=function(e){n.setWidth(e),f(),b()},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return _.isPanelClosed()},this.getClosedPanelDest=function(){return _.getClosedPanelDest()},this.openPanel=function(e){_.openPanel(e)},this.closePanel=function(e){_.closePanel(e)},this.setOpenedState=function(e){_.setOpenedState(e)},this.setClosedState=function(e){_.setClosedState(e)},this.setCustomThumbs=function(e){c.setCustomThumbs(e)},this.setDisabledAtStart=function(e){_.setDisabledAtStart(e)}}function UGGridPanel(){var o,a,u,d,i=this,n=jQuery(this),r=new UniteGalleryMain,c=new UGFunctions,_=new UGThumbsGrid,s=new UGPanelsBase,h={gridpanel_vertical_scroll:!0,gridpanel_grid_align:"middle",gridpanel_padding_border_top:10,gridpanel_padding_border_bottom:4,gridpanel_padding_border_left:10,gridpanel_padding_border_right:10,gridpanel_arrows_skin:"",gridpanel_arrows_align_vert:"middle",gridpanel_arrows_padding_vert:4,gridpanel_arrows_align_hor:"center",gridpanel_arrows_padding_hor:10,gridpanel_arrows_type:"default",gridpanel_arrows_icon_up_custom:"",gridpanel_arrows_icon_down_custom:"",gridpanel_arrows_icon_left_custom:"",gridpanel_arrows_icon_right_custom:"",gridpanel_arrows_icon_color:"#ffffff",gridpanel_space_between_arrows:20,gridpanel_arrows_always_on:!(this.events={FINISH_MOVE:"gridpanel_move_finish",OPEN_PANEL:"open_panel",CLOSE_PANEL:"close_panel"}),gridpanel_enable_handle:!0,gridpanel_handle_align:"top",gridpanel_handle_offset:0,gridpanel_handle_skin:"",gridpanel_background_color:""},l={gridpanel_grid_align:"middle",gridpanel_padding_border_top:2,gridpanel_padding_border_bottom:2},g={gridpanel_grid_align:"center"},p={panelType:"grid",isHorType:!1,arrowsVisible:!1,panelHeight:0,panelWidth:0,originalPosX:null,isEventsInited:!1,isClosed:!1,orientation:null};function m(){if(null==p.orientation)throw new Error("Wrong orientation, please set panel orientation before run")}function e(){var e;m(),"center"==h.gridpanel_grid_align&&(h.gridpanel_grid_align="middle"),_.run(),e=!1,(1==h.gridpanel_arrows_always_on||1<_.getNumPanes())&&(e=!0),1==e?(u.show().fadeTo(0,1),d.show().fadeTo(0,1),p.arrowsVisible=!0):(u.hide(),d.hide(),p.arrowsVisible=!1),e=_.getSize(),1==p.isHorType?p.panelHeight=e.height+h.gridpanel_padding_border_top+h.gridpanel_padding_border_bottom:p.panelWidth=e.width+h.gridpanel_padding_border_left+h.gridpanel_padding_border_right,c.setElementSize(a,p.panelWidth,p.panelHeight),(0==p.isHorType?1==h.gridpanel_vertical_scroll?1==p.arrowsVisible?function(){var e,t,i,n,r=c.getElementSize(d),o=_.getSize();switch(h.gridpanel_grid_align){default:case"top":e=h.gridpanel_padding_border_top+r.height+h.gridpanel_arrows_padding_vert;break;case"middle":e="middle";break;case"bottom":e=p.panelHeight-o.height-r.height-h.gridpanel_padding_border_bottom-h.gridpanel_arrows_padding_vert}var a=f(),s=_.getElement();switch(c.placeElement(s,a,e),o=_.getSize(),h.gridpanel_arrows_align_vert){default:case"center":case"middle":t=(o.top-r.height)/2,i=o.bottom+(p.panelHeight-o.bottom-r.height)/2,n=0;break;case"grid":t=o.top-r.height-h.gridpanel_arrows_padding_vert_vert,i=o.bottom+h.gridpanel_arrows_padding_vert,n=0;break;case"border":case"borders":t=h.gridpanel_padding_border_top,i="bottom",n=h.gridpanel_padding_border_bottom}c.placeElement(d,"center",t),c.placeElement(u,"center",i,0,n)}:b:1==p.arrowsVisible?function(){var e,t,i=c.getElementSize(d),n=_.getSize(),r=h.gridpanel_padding_border_top;switch(h.gridpanel_grid_align){case"middle":switch(h.gridpanel_arrows_align_vert){default:var o=n.height+h.gridpanel_arrows_padding_vert+i.height;r=(p.panelHeight-o)/2;break;case"border":case"borders":var a=p.panelHeight-i.height-h.gridpanel_padding_border_bottom;r=(a-n.height)/2}break;case"bottom":o=n.height+i.height+h.gridpanel_arrows_padding_vert;r=p.panelHeight-o-h.gridpanel_padding_border_bottom}var s=_.getElement(),l=f();switch(c.placeElement(s,l,r),n=_.getSize(),h.gridpanel_arrows_align_vert){default:case"center":case"middle":e=n.bottom+(p.panelHeight-n.bottom-i.height)/2,t=0;break;case"grid":e=n.bottom+h.gridpanel_arrows_padding_vert,t=0;break;case"border":case"borders":e="bottom",t=h.gridpanel_padding_border_bottom}l=-i.width/2-h.gridpanel_space_between_arrows/2,c.placeElement(d,"center",e,l,t),l=Math.abs(l),c.placeElement(u,"center",e,l,t)}:b:1==p.arrowsVisible?function(){var e,t,i,n,r=c.getElementSize(d),o=_.getSize();switch(h.gridpanel_grid_align){default:case"left":e=h.gridpanel_padding_border_left+h.gridpanel_arrows_padding_hor+r.width;break;case"middle":case"center":e="center";break;case"right":e=p.panelWidth-o.width-r.width-h.gridpanel_padding_border_right-h.gridpanel_arrows_padding_hor}var a=_.getElement();switch(c.placeElement(a,e,h.gridpanel_padding_border_top),o=_.getSize(),h.gridpanel_arrows_align_vert){default:case"center":case"middle":n=(o.height-r.height)/2+o.top;break;case"top":n=h.gridpanel_padding_border_top+h.gridpanel_arrows_padding_vert;break;case"bottom":n=p.panelHeight-h.gridpanel_padding_border_bottom-h.gridpanel_arrows_padding_vert-r.height}switch(h.gridpanel_arrows_align_hor){default:case"borders":t=h.gridpanel_padding_border_left,i=p.panelWidth-h.gridpanel_padding_border_right-r.width;break;case"grid":t=o.left-h.gridpanel_arrows_padding_hor-r.width,i=o.right+h.gridpanel_arrows_padding_hor;break;case"center":t=(o.left-r.width)/2,i=o.right+(p.panelWidth-o.right-r.width)/2}c.placeElement(d,t,n),c.placeElement(u,i,n)}:function(){var e,t=_.getSize();switch(h.gridpanel_grid_align){default:case"left":e=h.gridpanel_padding_border_left;break;case"middle":case"center":e="center";break;case"right":e=p.panelWidth-t.width-h.gridpanel_padding_border_right}var i=_.getElement();c.placeElement(i,e,h.gridpanel_padding_border_top)})(),s.placeElements(),1!=p.isEventsInited&&(p.isEventsInited=!0,d&&(c.addClassOnHover(d),_.attachPrevPaneButton(d)),u&&(c.addClassOnHover(u),_.attachNextPaneButton(u)),s.initEvents())}function t(){o.append("<div class='ug-grid-panel'></div>"),a=o.children(".ug-grid-panel");var e,t,i,n,r="";"default"==h.gridpanel_arrows_type&&(e='<svg width="31" height="17" viewBox="0 0 31 17" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_16_5)"><path d="M0.5 16.5L15 1.5L30 16.5" stroke="'+h.gridpanel_arrows_icon_color+'"/></g><defs><clipPath id="clip0_16_5"><rect width="31" height="17" fill="white"/></clipPath></defs></svg>',t='<svg width="31" height="17" viewBox="0 0 31 17" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_16_5)"><path d="M30.5 0.5L16 15.5L1 0.5" stroke="'+h.gridpanel_arrows_icon_color+'"/></g><defs><clipPath id="clip0_16_5"><rect width="31" height="17" fill="white" transform="matrix(-1 0 0 -1 31 17)"/></clipPath></defs></svg>',i='<svg width="17" height="31" viewBox="0 0 17 31" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_16_5)"><path d="M16.5 30.5L1.5 16L16.5 1" stroke="'+h.gridpanel_arrows_icon_color+'"/></g><defs><clipPath id="clip0_16_5"><rect width="31" height="17" fill="white" transform="matrix(0 -1 1 0 0 31)"/></clipPath></defs></svg>',n='<svg width="17" height="31" viewBox="0 0 17 31" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_16_5)"><path d="M0.5 0.5L15.5 15L0.5 30" stroke="'+h.gridpanel_arrows_icon_color+'"/></g><defs><clipPath id="clip0_16_5"><rect width="31" height="17" fill="white" transform="matrix(0 1 -1 0 17 0)"/></clipPath></defs></svg>'),"custom"==h.gridpanel_arrows_type&&(r="grid-arrow-custom",e=h.gridpanel_arrows_icon_up_custom,t=h.gridpanel_arrows_icon_down_custom,i=h.gridpanel_arrows_icon_left_custom,n=h.gridpanel_arrows_icon_right_custom),u=p.isHorType?(a.append("<div class='grid-arrow "+r+" grid-arrow-left-hortype ug-skin-"+h.gridpanel_arrows_skin+"'>"+i+"</div>"),a.append("<div class='grid-arrow "+r+" grid-arrow-right-hortype ug-skin-"+h.gridpanel_arrows_skin+"'>"+n+"</div>"),d=a.children(".grid-arrow-left-hortype"),a.children(".grid-arrow-right-hortype")):0==h.gridpanel_vertical_scroll?(a.append("<div class='grid-arrow "+r+" grid-arrow-left ug-skin-"+h.gridpanel_arrows_skin+"'>"+i+"</div>"),a.append("<div class='grid-arrow "+r+" grid-arrow-right ug-skin-"+h.gridpanel_arrows_skin+"'>"+n+"</div>"),d=a.children(".grid-arrow-left"),a.children(".grid-arrow-right")):(a.append("<div class='grid-arrow "+r+" grid-arrow-up ug-skin-"+h.gridpanel_arrows_skin+"'>"+e+"</div>"),a.append("<div class='grid-arrow "+r+" grid-arrow-down ug-skin-"+h.gridpanel_arrows_skin+"'>"+t+"</div>"),d=a.children(".grid-arrow-up"),a.children(".grid-arrow-down")),s.setHtml(a),d.fadeTo(0,0),u.fadeTo(0,0),_.setHtml(a),""!=h.gridpanel_background_color&&a.css("background-color",h.gridpanel_background_color)}function f(){return h.gridpanel_padding_border_left}function b(){var e=h.gridpanel_grid_align,t=0;switch(e){case"top":t=h.gridpanel_padding_border_top;break;case"bottom":t=h.gridpanel_padding_border_bottom}var i=f(),n=_.getElement();c.placeElement(n,i,e,0,t)}this.destroy=function(){d&&c.destroyButton(d),u&&c.destroyButton(u),s.destroy(),_.destroy()},this.getOrientation=function(){return p.orientation},this.setOrientation=function(e){switch(p.orientation=e){case"right":case"left":p.isHorType=!1;break;case"top":case"bottom":p.isHorType=!0;break;default:throw new Error("Wrong grid panel orientation: "+e)}},this.setHeight=function(e){if(1==p.isHorType)throw new Error("setHeight is not appliable to this orientatio ("+p.orientation+"). Please use setWidth");p.panelHeight=e;var t,e=(t=h.gridpanel_padding_border_top+h.gridpanel_padding_border_bottom,e=p.panelHeight-t,0==h.gridpanel_arrows_always_on&&1==_.getNumPanesEstimationByHeight(e)?e:(t=c.getElementSize(u).height+h.gridpanel_arrows_padding_vert,1==h.gridpanel_vertical_scroll&&(t*=2),t+=h.gridpanel_padding_border_top+h.gridpanel_padding_border_bottom,e=p.panelHeight-t));_.setMaxHeight(e)},this.setWidth=function(e){if(0==p.isHorType)throw new Error("setWidth is not appliable to this orientatio ("+p.orientation+"). Please use setHeight");p.panelWidth=e;var t,e=(t=h.gridpanel_padding_border_left+h.gridpanel_padding_border_right,e=p.panelWidth-t,0==h.gridpanel_arrows_always_on&&1==_.getNumPanesEstimationByWidth(e)?e:(t+=2*(c.getElementSize(u).width+h.gridpanel_arrows_padding_hor),e=p.panelWidth-t));_.setMaxWidth(e)},this.init=function(e,t){t=t,r=e=e,m(),t&&t.vertical_scroll&&(h.gridpanel_vertical_scroll=t.vertical_scroll),h=jQuery.extend(h,t),1==p.isHorType?(h=jQuery.extend(h,g),h=jQuery.extend(h,t)):1==h.gridpanel_vertical_scroll&&(h=jQuery.extend(h,l),(h=jQuery.extend(h,t)).grid_panes_direction="bottom"),t=r.getOptions().gallery_skin,""==h.gridpanel_arrows_skin&&(h.gridpanel_arrows_skin=t),e=e.getObjects(),o=e.g_objWrapper,s.init(r,p,i,h,n),(_=new UGThumbsGrid).init(r,h)},this.setHtml=function(){t()},this.run=function(){e()},this.getElement=function(){return a},this.getSize=function(){return c.getElementSize(a)},this.__________Functions_From_Base_____=function(){},this.isPanelClosed=function(){return s.isPanelClosed()},this.getClosedPanelDest=function(){return s.getClosedPanelDest()},this.openPanel=function(e){s.openPanel(e)},this.closePanel=function(e){s.closePanel(e)},this.setOpenedState=function(e){s.setOpenedState(e)},this.setClosedState=function(e){s.setClosedState(e)},this.setDisabledAtStart=function(e){s.setDisabledAtStart(e)}}function UGThumbsGrid(){var n,r,o,p,m,a=this,s=jQuery(this),l=new UniteGalleryMain,f=new UGFunctions,u=new UGThumbsGeneral,d=new UGTileDesign,b={grid_panes_direction:"left",grid_num_cols:2,grid_min_cols:2,grid_num_rows:2,grid_space_between_cols:10,grid_space_between_rows:10,grid_space_between_mobile:10,grid_transition_duration:300,grid_transition_easing:"easeInOutQuad",grid_carousel:!1,grid_padding:0,grid_vertical_scroll_ondrag:!1},v={eventSizeChange:"thumb_size_change",isHorizontal:!(this.events={PANE_CHANGE:"pane_change"}),isMaxHeight:!1,isMaxWidth:!1,gridHeight:0,gridWidth:0,innerWidth:0,innerHeight:0,numPanes:0,arrPanes:0,numThumbs:0,currentPane:0,numThumbsInPane:0,isNavigationVertical:!1,touchActive:!1,startScrollPos:0,isFirstTimeRun:!0,isTilesMode:!1,storedEventID:"thumbsgrid",tileMaxWidth:null,tileMaxHeight:null,spaceBetweenCols:null,spaceBetweenRows:null};function c(e,t,i){o=e.getObjects(),(l=e).attachThumbsPanel("grid",a),n=jQuery(e),r=o.g_objWrapper,o=o.g_arrItems,!0===i&&(v.isTilesMode=!0),v.numThumbs=o.length,i=t,b=jQuery.extend(b,i),u.setOptions(i),v.isNavigationVertical="top"==b.grid_panes_direction||"bottom"==b.grid_panes_direction,v.spaceBetweenCols=b.grid_space_between_cols,v.spaceBetweenRows=b.grid_space_between_rows,1==v.isTilesMode?(d.setFixedMode(),d.setApproveClickFunction(S),d.init(e,b),i=d.getOptions(),v.tileMaxHeight=i.tile_height,v.tileMaxWidth=i.tile_width,u=d.getObjThumbs()):(t.thumb_fixed_size=!0,u.init(e,t))}function e(){var e,t=l.getSelectedItem();!function(){if(0==v.isHorizontal){if(0==v.gridHeight)throw new Error("You must set height before run.")}else if(0==v.gridWidth)throw new Error("You must set width before run.")}(),1==v.isFirstTimeRun?(0==v.isTilesMode?(u.initEvents(),p.find(".ug-thumb-wrapper").on("click touchend",P),n.on(l.events.ITEM_CHANGE,M)):d.initEvents(),p.bind("mousedown touchstart",C),jQuery("body").bind("mousemove touchmove",A),jQuery(window).add("body").bind("mouseup touchend",j),1==v.isTilesMode?(h(),g(),d.run()):(u.setHtmlProperties(),g(),u.loadThumbsImages())):1==v.isTilesMode&&1==h()&&(g(),d.run()),(0==v.isHorizontal?v.isNavigationVertical?function(){var e=m.children(".ug-thumb-wrapper"),t=0,i=0,n=0,r=0,o=0,a=0;v.innerWidth=0,v.numPanes=1,v.arrPanes=[],v.numThumbsInPane=0,v.arrPanes.push(o);for(var s=e.length,l=0;l<s;l++){var u=jQuery(e[l]);f.placeElement(u,t,i);var d=u.outerWidth(),u=u.outerHeight();t+=d+v.spaceBetweenCols;d=i+u;n<d&&(n=d),++r>=b.grid_num_cols&&(i+=u+v.spaceBetweenRows,t=o,r=0),1==v.numPanes&&v.numThumbsInPane++,d=i+u;u=a+v.gridHeight;u<d&&(1==v.isMaxHeight&&1==v.numPanes&&(v.gridHeight=n,p.height(v.gridHeight),u=v.gridHeight),i=u+v.spaceBetweenRows,a=i,t=o=0,r=0,l<s-1&&(v.numPanes++,v.arrPanes.push(i)))}m.height(n),v.innerHeight=n,1==v.isMaxHeight&&1==v.numPanes&&(v.gridHeight=n,p.height(n))}:function(){var e=m.children(".ug-thumb-wrapper"),t=0,n=0,r=0,o=0,a=0,s=0;v.innerWidth=0,v.numPanes=1,v.arrPanes=[],v.numThumbsInPane=0,v.arrPanes.push(o);var l=e.length;for(i=0;i<l;i++){var u=jQuery(e[i]);f.placeElement(u,t,n);var d=u.outerWidth(),c=u.outerHeight();a<t&&(a=t);u=n+c;s<u&&(s=u);u=a+d;u>v.innerWidth&&(v.innerWidth=u),t+=d+v.spaceBetweenCols,++r>=b.grid_num_cols&&(n+=c+v.spaceBetweenRows,t=o,r=0),1==v.numPanes&&v.numThumbsInPane++,n+c>v.gridHeight&&(n=0,o=v.innerWidth+v.spaceBetweenCols,t=o,r=0,1==v.isMaxHeight&&1==v.numPanes&&(v.gridHeight=s,p.height(v.gridHeight)),i<l-1&&(v.numPanes++,v.arrPanes.push(o)))}m.width(v.innerWidth),1==v.isMaxHeight&&1==v.numPanes&&(v.gridHeight=s,p.height(s))}:function(){var e=m.children(".ug-thumb-wrapper"),t=b.grid_padding,i=b.grid_padding,n=i,r=t,o=0,a=0,s=0,l=0,u=0;v.innerWidth=0,v.numPanes=1,v.arrPanes=[],v.numThumbsInPane=0,v.arrPanes.push(t-b.grid_padding);for(var d=e.length,c=0;c<d;c++){var _=jQuery(e[c]),h=_.outerWidth(),g=_.outerHeight();r-t+h>v.gridWidth&&(n=0,++u>=b.grid_num_rows?(t=r,n=i,s=u=0,1==v.numPanes&&(v.gridWidth=o+b.grid_padding,p.width(v.gridWidth),v.gridHeight=l+b.grid_padding,p.height(v.gridHeight)),v.numPanes++,v.arrPanes.push(t-b.grid_padding)):(r=t,n=s+v.spaceBetweenRows)),f.placeElement(_,r,n);_=r+h;o<_&&(o=_);g=n+g;s<g&&(s=g),l<g&&(l=g),a<g&&(a=g),(_=o+h)>v.innerWidth&&(v.innerWidth=_),r+=h+v.spaceBetweenCols,1==v.numPanes&&v.numThumbsInPane++}v.innerWidth=o+b.grid_padding,v.innerHeight=l+b.grid_padding,m.width(v.innerWidth),m.height(v.innerHeight),1==v.numPanes&&(v.gridWidth=o+b.grid_padding,v.gridHeight=l+b.grid_padding,p.width(v.gridWidth),p.height(v.gridHeight))})(),1==v.isFirstTimeRun&&v.isTilesMode&&((e=u.getThumbs()).each(function(e,t){r.trigger(v.eventSizeChange,jQuery(t))}),e.fadeTo(0,1)),null!=t&&y(t.index),s.trigger(a.events.PANE_CHANGE,v.currentPane),v.isFirstTimeRun=!1}function _(){return 1==v.isTilesMode?d.getGlobalTileSize():u.getGlobalThumbSize()}function h(){if(0==v.isTilesMode)throw new Error("Dynamic size can be set only in tiles mode");var e=!1,t=l.isMobileMode(),i=v.spaceBetweenCols;1==t?(v.spaceBetweenCols=b.grid_space_between_mobile,v.spaceBetweenRows=b.grid_space_between_mobile):(v.spaceBetweenCols=b.grid_space_between_cols,v.spaceBetweenRows=b.grid_space_between_rows),v.spaceBetweenCols!=i&&(e=!0);t=_().width,i=v.tileMaxWidth;return f.getNumItemsInSpace(v.gridWidth,v.tileMaxWidth,v.spaceBetweenCols)<b.grid_min_cols&&(i=f.getItemSizeInSpace(v.gridWidth,b.grid_min_cols,v.spaceBetweenCols)),d.setTileSizeOptions(i),i!=t&&(e=!0),e}function g(){var e,t;0==v.isHorizontal?(e=_().width,t=b.grid_num_cols*e+(b.grid_num_cols-1)*v.spaceBetweenCols+2*b.grid_padding,e=v.gridHeight,v.gridWidth=t,f.setElementSize(p,t,e),f.setElementSize(m,t,e),v.innerWidth=t,v.innerHeight=e):(t=_().height,e=v.gridWidth,t=b.grid_num_rows*t+(b.grid_num_rows-1)*v.spaceBetweenRows+2*b.grid_padding,v.gridHeight=t,f.setElementSize(p,e,t),f.setElementSize(m,e,t),v.innerWidth=e,v.innerHeight=t)}function y(e){e=T(e);-1!=e&&a.gotoPane(e,"scroll")}function w(e){e=E(e);0!=e&&m.stop(!0).animate(e,{duration:b.grid_transition_duration,easing:b.grid_transition_easing,queue:!1})}function t(){w(-v.arrPanes[v.currentPane])}function E(e){var t={};return 1==v.isNavigationVertical?t.top=e+"px":t.left=e+"px",t}function x(){var e=f.getElementSize(m);return 1==v.isNavigationVertical?e.top:e.left}function T(e){return 0==function(e){if(e<0||e>=v.numThumbs)throw new Error("Thumb not exists: "+e);return!0}(e)?-1:Math.floor(e/v.numThumbsInPane)}function I(){var e=f.getStoredEventData(v.storedEventID),t=x(),i=Math.abs(e.startInnerPos-t),t=1==v.isNavigationVertical?v.gridHeight:v.gridWidth;return Math.round(3*t/8)<=i||e.diffTime<300&&25<i}function S(){return 1==v.numPanes||f.isApproveStoredEventClick(v.storedEventID,v.isNavigationVertical)}function P(e){if(1==function(){if(1==v.numPanes)return!1;var e=f.getStoredEventData(v.storedEventID),t=e.diffTime,i=x();return 30<(e=Math.abs(i-e.startInnerPos))||5<e&&300<t}())return!0;var t=jQuery(this),t=u.getItemByThumb(t);l.selectItem(t)}function C(e){if(1==v.numPanes)return!0;if(1==v.touchActive)return!0;0==v.isTilesMode&&e.preventDefault(),v.touchActive=!0;var t={startInnerPos:x()};f.storeEventData(e,v.storedEventID,t)}function A(e){if(0==v.touchActive)return!0;e.preventDefault(),f.updateStoredEventData(e,v.storedEventID);var t=f.getStoredEventData(v.storedEventID,v.isNavigationVertical);if(0!=b.grid_vertical_scroll_ondrag&&(1!=v.isNavigationVertical&&"vert"===f.handleScrollTop(v.storedEventID)))return!0;var i=t.diffMousePos,n=t.startInnerPos+i,r=0<i?"prev":"next",e=v.arrPanes[v.numPanes-1];0==b.grid_carousel&&0<n&&"prev"==r&&(n/=3),0==b.grid_carousel&&n<-e&&"next"==r&&(n=t.startInnerPos+i/3),0!=(n=E(n=n))&&m.css(n)}function j(e){if(0==v.touchActive)return!0;f.updateStoredEventData(e,v.storedEventID);e=f.getStoredEventData(v.storedEventID,v.isNavigationVertical);if(v.touchActive=!1,0==I())return t(),!0;"next"==(0<x()-e.startInnerPos?"prev":"next")?0==b.grid_carousel&&a.isLastPane()?t():a.nextPane():0==b.grid_carousel&&a.isFirstPane()?t():a.prevPane()}function M(){var e=l.getSelectedItem();u.setThumbSelected(e.objThumbWrapper),y(e.index)}this.destroy=function(){var e;0==v.isTilesMode?((e=p.find(".ug-thumb-wrapper")).off("click"),e.off("touchend"),n.on(l.events.ITEM_CHANGE),u.destroy()):d.destroy(),p.unbind("mousedown"),p.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("touchend"),jQuery(window).add("body").unbind("mouseup"),s.off(a.events.PANE_CHANGE)},this.__________EXTERNAL_GENERAL_________=function(){},this.setThumbUnselected=function(e){u.setThumbUnselected(e)},this.isItemThumbVisible=function(e){return T(e.index)==v.currentPane},this.__________EXTERNAL_API_________=function(){},this.getNumPanesEstimationByHeight=function(e){var t;t=1==v.isTilesMode?b.tile_height:u.getOptions().thumb_height;var i=u.getNumThumbs(),i=Math.ceil(i/b.grid_num_cols),i=i*t+(i-1)*v.spaceBetweenRows;return Math.ceil(i/e)},this.getNumPanesEstimationByWidth=function(e){var t;t=v.isTilesMode?b.tile_width:u.getOptions().thumb_width;var i=u.getNumThumbs(),i=Math.ceil(i/b.grid_num_rows),i=i*t+(i-1)*v.spaceBetweenCols;return Math.ceil(i/e)},this.getHeightEstimationByWidth=function(e){if(0==v.isTilesMode)throw new Error("This function works only with tiles mode");var t=u.getNumThumbs(),e=f.getNumItemsInSpace(e,b.tile_width,v.spaceBetweenCols),e=Math.ceil(t/e);e>b.grid_num_rows&&(e=b.grid_num_rows);e=f.getSpaceByNumItems(e,b.tile_height,v.spaceBetweenRows);return e+=2*b.grid_padding},this.getElement=function(){return p},this.getSize=function(){return f.getElementSize(p)},this.getNumPanes=function(){return v.numPanes},this.isFirstPane=function(){return 0==v.currentPane},this.isLastPane=function(){return v.currentPane==v.numPanes-1},this.getPaneInfo=function(){return{pane:v.currentPane,total:v.numPanes}},this.getPane=function(){return v.currentPane},this.setWidth=function(e){v.gridWidth=e,v.isHorizontal=!0},this.setMaxWidth=function(e){v.gridWidth=e,v.isMaxWidth=!0,v.isHorizontal=!0},this.setHeight=function(e){v.gridHeight=e,v.isHorizontal=!1},this.setMaxHeight=function(e){v.gridHeight=e,v.isMaxHeight=!0,v.isHorizontal=!1},this.gotoPane=function(e,t){if(0==function(e){if(e>=v.numPanes||e<0)throw new Error("Pane "+index+" doesn't exists.");return!0}(e))return!1;if(e==v.currentPane)return!1;var i=-v.arrPanes[e];v.currentPane=e,w(i),s.trigger(a.events.PANE_CHANGE,e)},this.nextPane=function(){var e=v.currentPane+1;if(e>=v.numPanes){if(0==b.grid_carousel)return!0;e=0}a.gotoPane(e,"next")},this.prevPane=function(){var e=v.currentPane-1;if(e<0&&(e=v.numPanes-1,0==b.grid_carousel))return!1;a.gotoPane(e,"prev")},this.attachNextPaneButton=function(e){if(f.setButtonOnClick(e,a.nextPane),1==b.grid_carousel)return!0;a.isLastPane()&&e.addClass("ug-button-disabled"),s.on(a.events.PANE_CHANGE,function(){a.isLastPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachPrevPaneButton=function(e){if(f.setButtonOnClick(e,a.prevPane),1==b.grid_carousel)return!0;a.isFirstPane()&&e.addClass("ug-button-disabled"),s.on(a.events.PANE_CHANGE,function(){a.isFirstPane()?e.addClass("ug-button-disabled"):e.removeClass("ug-button-disabled")})},this.attachBullets=function(i){i.setActive(v.currentPane),jQuery(i).on(i.events.BULLET_CLICK,function(e,t){a.gotoPane(t,"theme"),i.setActive(t)}),jQuery(a).on(a.events.PANE_CHANGE,function(e,t){i.setActive(t)})},this.getObjTileDesign=function(){return d},this.init=function(e,t,i){c(e,t,i)},this.run=function(){e()},this.setHtml=function(e){(e=(e=e)||r).append("<div class='ug-thumbs-grid'><div class='ug-thumbs-grid-inner'></div></div>"),p=e.children(".ug-thumbs-grid"),m=p.children(".ug-thumbs-grid-inner"),1==v.isTilesMode?d.setHtml(m):u.setHtmlThumbs(m)}}function UGTileDesign(){var i,n,g=this,r=jQuery(this),p=new UniteGalleryMain,m=new UGFunctions,o=new UGThumbsGeneral;this.resizemode={FULL:"full",WRAPPER_ONLY:"wrapper_only",VISIBLE_ELEMENTS:"visible_elements"},this.sizeby={GLOBAL_RATIO:"global_ratio",TILE_RATIO:"tile_ratio",IMAGE_RATIO:"image_ratio",CUSTOM:"custom"},this.events={TILE_CLICK:"tile_click"};var f={tile_width:250,tile_height:200,tile_size_by:g.sizeby.IMAGE_RATIO,tile_visible_before_image:!1,tile_enable_background:!0,tile_background_color:"#F0F0F0",tile_enable_border:!1,tile_border_width:3,tile_border_color:"#F0F0F0",tile_border_radius:0,tile_enable_outline:!1,tile_outline_color:"#8B8B8B",tile_enable_shadow:!1,tile_shadow_h:1,tile_shadow_v:1,tile_shadow_blur:3,tile_shadow_spread:2,tile_shadow_color:"#8B8B8B",tile_enable_action:!0,tile_as_link:!1,tile_link_newpage:!0,tile_icon_type:"default",tile_zoom_icon_color:"#ffffff",tile_play_icon_color:"#ffffff",tile_link_icon_color:"#ffffff",tile_zoom_icon_custom:"",tile_play_icon_custom:"",tile_link_icon_custom:"",tile_show_video_play_icons_always:!1,tile_enable_overlay:!0,tile_overlay_opacity:.4,tile_overlay_color:"#000000",tile_enable_icons:!0,tile_show_link_icon:!1,tile_videoplay_icon_always_on:"never",tile_space_between_icons:26,tile_enable_image_effect:!1,tile_image_effect_type:"bw",tile_image_effect_reverse:!1,tile_enable_textpanel:!1,tile_textpanel_source:"title",tile_textpanel_always_on:!1,tile_textpanel_appear_type:"slide",tile_textpanel_position:"inside_bottom",tile_textpanel_offset:0},a={thumb_color_overlay_effect:!0,thumb_overlay_reverse:!0,thumb_image_overlay_effect:!1,tile_textpanel_enable_description:!1,tile_textpanel_bg_opacity:.6,tile_textpanel_padding_top:8,tile_textpanel_padding_bottom:8},b={ratioByHeight:0,ratioByWidth:0,eventSizeChange:"thumb_size_change",funcCustomTileHtml:null,funcCustomPositionElements:null,funcParentApproveClick:null,isSaparateIcons:!1,tileInnerReduce:0,isTextpanelOutside:!1,hasImageContainer:!1,isVideoplayIconAlwaysOn:!1,isTextPanelHidden:!1};function s(e,t){p=e,jQuery(e);var i=p.getObjects();n=i.g_objWrapper,p.getArrItems(),f=jQuery.extend(f,a),f=jQuery.extend(f,t),function(){if(1==f.tile_enable_overlay?(f.thumb_overlay_opacity=f.tile_overlay_opacity,f.thumb_overlay_color=f.tile_overlay_color):0==f.tile_enable_icons?f.thumb_color_overlay_effect=!1:f.thumb_overlay_opacity=0,f.tile_as_link&&(f.thumb_wrapper_as_link=!0,f.thumb_link_newpage=f.tile_link_newpage),1==f.tile_enable_outline&&0==f.tile_enable_border&&(f.tile_enable_outline=!1),b.tileInnerReduce=0,f.tile_enable_border&&(b.tileInnerReduce=2*f.tile_border_width,o.setThumbInnerReduce(b.tileInnerReduce)),b.isSaparateIcons=!m.isRgbaSupported(),1==f.tile_enable_textpanel){switch(f.tile_textpanel_position){case"top":f.tile_textpanel_align="top";case"bottom":b.isTextpanelOutside=!0,f.tile_textpanel_always_on=!0,f.tile_textpanel_offset=0;break;case"inside_top":f.tile_textpanel_align="top";break;case"middle":f.tile_textpanel_align="middle",f.tile_textpanel_appear_type="fade"}0==f.tile_textpanel_always_on&&(b.isSaparateIcons=!0)}0!=f.tile_textpanel_offset&&(f.tile_textpanel_appear_type="fade",f.tile_textpanel_margin=f.tile_textpanel_offset),"title_and_desc"==f.tile_textpanel_source&&(f.tile_textpanel_enable_description=!0,f.tile_textpanel_desc_style_as_title=!0)}(),o.init(e,f);e=["overlay"];b.funcCustomTileHtml&&(e=[]),o.setCustomThumbs(u,e,{allow_onresize:!1});e=o.getOptions();f=jQuery.extend(f,e),b.ratioByWidth=f.tile_width/f.tile_height,b.ratioByHeight=f.tile_height/f.tile_width,f.tile_size_by==g.sizeby.GLOBAL_RATIO&&b.isTextpanelOutside&&(b.hasImageContainer=!0)}function l(){var e=p.isMobileMode();switch(b.isTextPanelHidden=!1,1==e&&0==f.tile_textpanel_always_on&&(b.isTextPanelHidden=!0),b.isVideoplayIconAlwaysOn=f.tile_videoplay_icon_always_on,f.tile_videoplay_icon_always_on){case"always":b.isVideoplayIconAlwaysOn=!0;break;case"never":b.isVideoplayIconAlwaysOn=!1;break;case"mobile_only":b.isVideoplayIconAlwaysOn=1==e;break;case"desktop_only":b.isVideoplayIconAlwaysOn=0==e}}function u(e,t){if(e.addClass("ug-tile"),b.funcCustomTileHtml)return b.funcCustomTileHtml(e,t),!1;var i="";1==b.hasImageContainer&&(i+="<div class='ug-image-container ug-trans-enabled'>");var n="ug-thumb-image";0!=f.tile_enable_image_effect&&1!=f.tile_image_effect_reverse||(n+=" ug-trans-enabled");var r=m.stripTags(t.title),r=m.htmlentitles(r);i+='<img src="'+m.escapeDoubleSlash(t.urlThumb)+"\" alt='"+r+"' class='"+n+"'>",1==b.hasImageContainer&&(i+="</div>"),e.append(i),f.tile_size_by==g.sizeby.GLOBAL_RATIO&&e.fadeTo(0,0);n={};1==f.tile_enable_background&&(n["background-color"]=f.tile_background_color),1==f.tile_enable_border&&(n["border-width"]=f.tile_border_width+"px",n["border-style"]="solid",n["border-color"]=f.tile_border_color,f.tile_border_radius&&(n["border-radius"]=f.tile_border_radius+"px")),1==f.tile_enable_outline&&(n.outline="1px solid "+f.tile_outline_color),1==f.tile_enable_shadow&&(o=f.tile_shadow_h+"px ",o+=f.tile_shadow_v+"px ",o+=f.tile_shadow_blur+"px ",o+=f.tile_shadow_spread+"px ",o+=f.tile_shadow_color,n["box-shadow"]=o),e.css(n);var o,a,s,l,u,i="";if(f.tile_enable_icons?(0==f.tile_as_link&&1==f.tile_enable_action&&(l="ug-button-play ug-icon-zoom",a="",o='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g transform="translate(0, 0)"><path d="M30.414,27.586,22.77,19.942a12.038,12.038,0,1,0-2.828,2.828l7.644,7.644a2,2,0,0,0,2.828-2.828ZM3,13A10,10,0,1,1,13,23,10.011,10.011,0,0,1,3,13Z" fill="'+f.tile_zoom_icon_color+'"/></g></svg>',n='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g transform="translate(0, 0)"><path d="M27,16a1.234,1.234,0,0,0-.4-.8l-18-13a1.073,1.073,0,0,0-1.1-.1A1.05,1.05,0,0,0,7,3V29a1.05,1.05,0,0,0,.5.9A.9.9,0,0,0,8,30a1.421,1.421,0,0,0,.6-.2l18-13A1.234,1.234,0,0,0,27,16Z" fill="'+f.tile_play_icon_color+'"/></g></svg>',s=o,"image"!=t.type&&(l="ug-button-play ug-icon-play",1==f.tile_show_video_play_icons_always&&(l+=" ug-button-play-show-always"),s=n),"custom"==f.tile_icon_type&&(o=f.tile_zoom_icon_custom,n=f.tile_play_icon_custom,s=o,a="ug-icon-zoom-custom","image"!=t.type&&(s=n,a="ug-icon-play-custom")),i+="<div class='ug-tile-icon "+l+" "+a+"' style='display:none'>"+s+"</div>"),(t.link&&1==f.tile_show_link_icon||1==f.tile_as_link)&&(u='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g transform="translate(0, 0)"><path d="M17.619,10.138l-2.241,2.24c-.06.061-.1.13-.158.193a4.958,4.958,0,0,1,2.816,1.393,5.008,5.008,0,0,1,0,7.072l-5.5,5.5a5,5,0,0,1-7.072-7.072l2.385-2.385a10.054,10.054,0,0,1-.23-4.011L3.343,17.343A8,8,0,0,0,14.657,28.657l5.5-5.5a7.99,7.99,0,0,0-2.538-13.019Z" fill="'+f.tile_link_icon_color+'"/><path data-color="color-2" d="M17.343,3.343l-5.5,5.5a7.99,7.99,0,0,0,2.538,13.019l2.241-2.24c.06-.061.107-.129.162-.193a4.953,4.953,0,0,1-2.82-1.393,5.008,5.008,0,0,1,0-7.072l5.5-5.5a5,5,0,0,1,7.072,7.072l-2.383,2.382a10.086,10.086,0,0,1,.241,4l4.263-4.263A8,8,0,0,0,17.343,3.343Z" fill="'+f.tile_link_icon_color+'"/></g></svg>',a="","custom"==f.tile_icon_type&&(u=f.tile_link_icon_custom,a="ug-icon-link-custom"),0==f.tile_as_link?(s="",1==f.tile_link_newpage&&(s=" target='_blank'"),i+="<a href='"+t.link+"'"+s+" class='ug-tile-icon ug-icon-link "+a+"'>"+u+"</a>"):i+="<div class='ug-tile-icon ug-icon-link "+a+"' style='display:none'>"+u+"</div>"),0==(u=b.isSaparateIcons)&&"image"!=t.type&&1==b.isVideoplayIconAlwaysOn&&(u=!0),(u=u?e:e.children(".ug-thumb-overlay")).append(i),0==(l=u.children("."+l)).length?l=null:l.hide(),0==(u=u.children(".ug-icon-link")).length?u=null:u.hide(),u||1!=f.tile_enable_action||e.addClass("ug-tile-clickable")):1==f.tile_enable_action&&e.addClass("ug-tile-clickable"),1==f.tile_enable_image_effect&&(d="",0==f.tile_image_effect_reverse&&(d=" ug-trans-enabled"),c="<div class='ug-tile-image-overlay"+d+"' >",u=" ug-"+f.tile_image_effect_type+"-effect",c+='<img src="'+m.escapeDoubleSlash(t.urlThumb)+"\" alt='"+t.title+"' class='"+u+d+"'>",c+="</div>",e.append(c),1==f.tile_image_effect_reverse&&e.children(".ug-tile-image-overlay").fadeTo(0,0)),1==f.tile_enable_textpanel){var d=new UGTextPanel;d.init(p,f,"tile");var c="";1!=f.tile_textpanel_always_on&&1!=b.isTextpanelOutside||(c="ug-trans-enabled"),d.appendHTML(e,c);var _=t.title,h="";switch(f.tile_textpanel_source){case"desc":case"description":_=t.description;break;case"desc_title":""!=t.description&&(_=t.description);break;case"title_and_desc":_=t.title,h=t.description}d.setTextPlain(_,h),0==f.tile_textpanel_always_on&&d.getElement().fadeTo(0,0),e.data("objTextPanel",d),1==f.tile_textpanel_always_on&&v(e).css("z-index",2),1==b.isTextpanelOutside&&(e.append("<div class='ug-tile-cloneswrapper'></div>"),c=e.children(".ug-tile-cloneswrapper"),(d=new UGTextPanel).init(p,f,"tile"),d.appendHTML(c),d.setTextPlain(_,h),e.data("objTextPanelClone",d))}null!==t.addHtml&&e.append(t.addHtml)}function d(e){return e.children(".ug-tile-image-overlay")}function c(e){return e.data("objTextPanel")}function v(e){return e.children(".ug-textpanel")}function _(e){return(e=(1==b.isTextpanelOutside?function(e){if(0==(e=e.find(".ug-tile-cloneswrapper .ug-textpanel")).length)throw new Error("text panel cloned element not found");return e}:v)(e))?m.getElementSize(e).height:0}function h(e){e=e.find(".ug-icon-link");return 0==e.length?null:e}function y(e){e=e.find(".ug-button-play");return 0==e.length?null:e}function w(e){return!!e.hasClass("ug-thumb-over")}function E(e){return e.hasClass("ug-tile-clickable")}function x(e){return 1==f.tile_enable_icons&&1==b.isVideoplayIconAlwaysOn&&"image"!=e.type}function T(e,t,i,n){var r=d(e),o=g.getTileImage(e),a=e.find(".ug-tile-image-overlay img");t-=b.tileInnerReduce,i-=b.tileInnerReduce;var s,l,u=null;1==b.isTextpanelOutside&&(i-=s=_(e),"top"==f.tile_textpanel_position&&(u=s),1==b.hasImageContainer&&(l=e,l=0==b.hasImageContainer?null:l.children(".ug-image-container"),m.setElementSize(l,t,i),null!==u&&m.placeElement(l,0,u))),0==f.tile_enable_image_effect?(m.scaleImageCoverParent(o,t,i),0==b.hasImageContainer&&null!==u&&m.placeElement(o,0,u)):(l="nothing",!0===n&&0==b.isTextpanelOutside&&(l=1==f.tile_image_effect_reverse?"effect":"image"),"effect"!=l&&(m.setElementSize(r,t,i),null!==u&&m.placeElement(r,0,u),m.scaleImageCoverParent(a,t,i)),"image"!=l&&(1==b.hasImageContainer?m.scaleImageCoverParent(o,t,i):"effect"==l?(m.scaleImageCoverParent(o,t,i),null!==u&&m.placeElement(o,0,u)):m.cloneElementSizeAndPos(a,o,!1,null,u)))}function I(e,t,i,n){var r=null;if(i&&(r=i-b.tileInnerReduce),n&&(n-=b.tileInnerReduce),"clone"==t)return e.data("objTextPanelClone").refresh(!0,!0,r),void(g.getItemByTile(e).textPanelCloneSizeSet=!0);i=c(e);i&&(t=null,1==b.isTextpanelOutside&&(t=_(e)),i.refresh(!1,!0,r,t),1!=f.tile_textpanel_always_on&&"fade"!=f.tile_textpanel_appear_type||(1==b.isTextpanelOutside&&n&&"bottom"==f.tile_textpanel_position?(t=n-t,i.positionPanel(t)):i.positionPanel()))}function S(e){g.getItemByTile(e);var t=y(e),i=h(e),n=m.getElementSize(e);T(e,n.width,n.height),1==f.tile_enable_textpanel&&I(e,"regular",n.width,n.height);var r=n.width-b.tileInnerReduce,o=n.height-b.tileInnerReduce,a=0;1==b.isTextpanelOutside&&(o-=d=_(e),"top"==f.tile_textpanel_position&&(a=d));var s,l,u,d=e.children(".ug-thumb-overlay");m.setElementSizeAndPosition(d,0,a,r,o),(t||i)&&(s=0,1==f.tile_enable_textpanel&&0==b.isTextPanelHidden&&0==b.isTextpanelOutside&&(l=v(e),0<(u=m.getElementSize(l)).height&&(s=Math.floor(u.height/2*-1)))),t&&i?(r=m.getElementSize(t),o=m.getElementSize(i),e=f.tile_space_between_icons,l=r.width+e+o.width,(u=Math.floor((n.width-l)/2))<e&&(e=Math.floor((n.width-r.width-o.width)/3),l=r.width+e+o.width,u=Math.floor((n.width-l)/2)),m.placeElement(t,u,"middle",0,s),m.placeElement(i,u+r.width+e,"middle",0,s)):(t&&m.placeElement(t,"center","middle",0,s),i&&m.placeElement(i,"center","middle",0,s)),t&&t.show(),i&&i.show()}function P(e,t){g.getItemByTile(e);var i=d(e),n=f.thumb_transition_duration;0==f.tile_image_effect_reverse?(e=g.getTileImage(e),t?(e.fadeTo(0,1),i.stop(!0).fadeTo(n,0)):i.stop(!0).fadeTo(n,1)):t?i.stop(!0).fadeTo(n,1):i.stop(!0).fadeTo(n,0)}function C(e,t){var i,n,r,o=f.thumb_transition_duration,a=v(e);if(!a)return 1;"slide"==f.tile_textpanel_appear_type?0!=(r=m.getElementSize(a)).width&&(i=-r.height,n={},e={},r="bottom","inside_top"==f.tile_textpanel_position&&(r="top"),n[r]=i+"px",e[r]="0px",1==t?(a.fadeTo(0,1),0==a.is(":animated")&&a.css(n),e.opacity=1,a.stop(!0).animate(e,o)):a.stop(!0).animate(n,o)):1==t?a.stop(!0).fadeTo(o,1):a.stop(!0).fadeTo(o,0)}function A(e,t,i){var n=f.thumb_transition_duration;i&&!0===i&&(n=0);i=y(e),e=h(e),t=t?1:0;i&&i.stop(!0).fadeTo(n,t),e&&e.stop(!0).fadeTo(n,t)}function e(e,t){var i;t=jQuery(t),f.tile_enable_image_effect&&P(t,!0),1==f.tile_enable_textpanel&&0==f.tile_textpanel_always_on&&0==b.isTextPanelHidden&&C(t,!0),b.isSaparateIcons&&1==f.tile_enable_icons&&(i=1==f.thumb_overlay_reverse,0==x(g.getItemByTile(t))&&A(t,i,!1))}function t(e,t){var i;t=jQuery(t),f.tile_enable_image_effect&&P(t,!1),1==f.tile_enable_textpanel&&0==f.tile_textpanel_always_on&&C(t,!1),1==b.isSaparateIcons&&1==f.tile_enable_icons&&(i=1!=f.thumb_overlay_reverse,0==x(g.getItemByTile(t))?A(t,i,!1):A(t,!0,!0))}function j(e,t,i){if(t=jQuery(t),1==f.tile_visible_before_image&&!0!==t.data("image_placed")&&!0!==i)return!0;S(t),o.setThumbNormalStyle(t)}function M(e,t,i){S(t),i.fadeTo(0,1),t.data("image_placed",!0)}function O(e){if(1==E(e))return r.trigger(g.events.TILE_CLICK,e),1;var t;0==w(e)&&(t=e,o.getThumbs().not(t).each(function(e,t){o.setThumbNormalStyle(jQuery(t))}),o.setThumbOverStyle(e))}function k(e){var t=jQuery(this),i=t.prop("tagName").toLowerCase(),n=!0;if(b.funcParentApproveClick&&0==b.funcParentApproveClick()&&(n=!1),"a"==i)0==n&&e.preventDefault();else if(0==w(t))1==n&&O(t);else{if(0==E(t))return!0;1==n&&r.trigger(g.events.TILE_CLICK,t)}}function L(e){e.stopPropagation();var t=jQuery(this).parents(".ug-tile"),e=!0;return b.funcParentApproveClick&&0==b.funcParentApproveClick()&&(e=!1),0==w(t)?(O(t),!0):1==e?(r.trigger(g.events.TILE_CLICK,t),!1):void 0}function z(e){var t=jQuery(this).parents(".ug-tile");b.funcParentApproveClick&&0==b.funcParentApproveClick()&&e.preventDefault(),0==w(t)&&0==f.tile_as_link&&(e.preventDefault(),O(t))}this.loadTileImage=function(i){var e=g.getTileImage(i);m.checkImagesLoaded(e,null,function(e,t){M(0,i,jQuery(e))})},this.setHtml=function(e,t){i=e,!0!==t&&l(),o.setHtmlThumbs(e,t)},this.initEvents=function(){o.initEvents(),jQuery(o).on(o.events.SETOVERSTYLE,e),jQuery(o).on(o.events.SETNORMALSTYLE,t),jQuery(o).on(o.events.PLACEIMAGE,M),n.on(b.eventSizeChange,j),i.on("click",".ug-tile",k),i.on("click",".ug-tile .ug-button-play",L),i.on("click",".ug-tile .ug-icon-link",z)},this.destroy=function(){var e;i.off("click",".ug-tile"),i.off("click",".ug-tile .ug-button-play"),i.off("click",".ug-tile .ug-icon-link"),jQuery(o).off(o.events.SETOVERSTYLE),jQuery(o).off(o.events.SETNORMALSTYLE),jQuery(o).off(o.events.PLACEIMAGE),n.off(b.eventSizeChange),1==f.tile_enable_textpanel&&(e=o.getThumbs(),jQuery.each(e,function(e,t){t=c(jQuery(t));t&&t.destroy()})),o.destroy()},this.init=function(e,t,i){s(e,t)},this.setFixedMode=function(){f.tile_size_by=g.sizeby.GLOBAL_RATIO,f.tile_visible_before_image=!0},this.setApproveClickFunction=function(e){b.funcParentApproveClick=e},this.resizeTile=function(e,t,i,n){switch(1==b.isTextpanelOutside&&I(e,"clone",t),i=t?i||g.getTileHeightByWidth(t,e):(t=f.tile_width,f.tile_height),m.setElementSize(e,t,i),n){default:case g.resizemode.FULL:g.triggerSizeChangeEvent(e,!0);break;case g.resizemode.WRAPPER_ONLY:return!0;case g.resizemode.VISIBLE_ELEMENTS:if(b.funcCustomTileHtml)return g.triggerSizeChangeEvent(e,!0),!0;T(e,t,i,!0),1==f.tile_enable_textpanel&&1==f.tile_textpanel_always_on&&t&&I(e,"regular",t,i)}},this.resizeAllTiles=function(i,n,e){l();var r=null;f.tile_size_by==g.sizeby.GLOBAL_RATIO&&(r=g.getTileHeightByWidth(i)),(e=e||o.getThumbs()).each(function(e,t){g.resizeTile(jQuery(t),i,r,n)})},this.triggerSizeChangeEvent=function(e,t){if(!e)return!1;t=t||!1,n.trigger(b.eventSizeChange,[e,t])},this.triggerSizeChangeEventAllTiles=function(t){o.getThumbs().each(function(){var e=jQuery(this);g.triggerSizeChangeEvent(e,t)})},this.disableEvents=function(){o.getThumbs().css("pointer-events","none")},this.enableEvents=function(){o.getThumbs().css("pointer-events","auto")},this.setOptions=function(e){f=jQuery.extend(f,e),o.setOptions(e)},this.setTileSizeOptions=function(e){if(f.tile_size_by!==g.sizeby.GLOBAL_RATIO)throw new Error("setNewTileOptions works with global ration only");f.tile_width=e,f.tile_height=Math.floor(e*b.ratioByHeight)},this.setCustomFunctions=function(e,t){b.funcCustomTileHtml=e,b.funcCustomPositionElements=t},this.run=function(e){var t=o.type.GET_THUMBS_ALL;!0===e&&(t=o.type.GET_THUMBS_NEW);t=o.getThumbs(t);f.tile_size_by==g.sizeby.GLOBAL_RATIO&&g.resizeAllTiles(f.tile_width,g.resizemode.WRAPPER_ONLY,t),1==f.tile_enable_image_effect&&0==f.tile_image_effect_reverse&&t.children(".ug-thumb-image").fadeTo(0,0),o.setHtmlProperties(t),1==f.tile_visible_before_image&&(t.children(".ug-thumb-image").fadeTo(0,0),o.loadThumbsImages())},this._____________EXTERNAL_GETTERS____________=function(){},this.getObjThumbs=function(){return o},this.getOptions=function(){return f},this.getTileImage=function(e){return e.find("img.ug-thumb-image")},this.getItemByTile=function(e){return o.getItemByThumb(e)},this.getTileHeightByWidth=function(e,t){var i=function(e){var t=b.ratioByHeight;switch(f.tile_size_by){default:t=b.ratioByHeight;break;case g.sizeby.IMAGE_RATIO:if(!e)throw new Error("tile should be given for tile ratio");var i=g.getItemByTile(e);if(void 0!==i.thumbRatioByHeight){if(0==i.thumbRatioByHeight)throw trace(i),new Error("the item ratio not inited yet");t=i.thumbRatioByHeight}break;case g.sizeby.CUSTOM:return null}return t}(t);if(null===i)return null;i=Math.floor((e-b.tileInnerReduce)*i)+b.tileInnerReduce;return t&&1==b.isTextpanelOutside&&f.tile_size_by==g.sizeby.IMAGE_RATIO&&(i+=_(t)),i},this.getTileImageSize=function(e){e=g.getItemByTile(e);if(!e.thumbWidth||!e.thumbHeight)throw new Error("Can't get image size - image not inited.");return{width:e.thumbWidth,height:e.thumbHeight}},this.getGlobalTileSize=function(){if(f.tile_size_by!=g.sizeby.GLOBAL_RATIO)throw new Error("The size has to be global ratio");return{width:f.tile_width,height:f.tile_height}}}function UGTiles(){var n,r,d,c,g,i,o=this,a=jQuery(this),s=new UniteGalleryMain,_=new UGFunctions,h=new UGTileDesign,b=new UGThumbsGeneral,l={},v={tiles_type:"columns",tiles_col_width:250,tiles_align:"center",tiles_exact_width:!1,tiles_space_between_cols:3,tiles_space_between_cols_mobile:3,tiles_include_padding:!0,tiles_min_columns:2,tiles_max_columns:0,tiles_keep_order:!1,tiles_set_initial_height:!0,tiles_justified_row_height:150,tiles_justified_space_between:3,tiles_nested_optimal_tile_width:250,tiles_nested_col_width:null,tiles_nested_debug:!1,tiles_enable_transition:!0},u={isFirstTimeRun:!0,handle:null,isTransActive:!(this.events={THUMB_SIZE_CHANGE:"thumb_size_change",TILES_FIRST_PLACED:"tiles_first_placed",ALL_TILES_LOADED:"all_tiles_loaded"}),isTransInited:!1,isFirstPlaced:!0,isAllLoaded:!1},p={colWidth:null,nestedOptimalCols:5,gridY:0,maxColumns:0,columnsValueToEnableHeightResize:3,resizeLeftRightToColumn:!0,currentItem:0,currentGap:null,optimalTileWidth:null,maxGridY:0};function m(e,t){i=e.getObjects(),s=e,n=jQuery(e),r=i.g_objWrapper,i.g_arrItems,(v=jQuery.extend(v,t)).tiles_min_columns<1&&(v.tiles_min_columns=1),0!=v.tiles_max_columns&&v.tiles_max_columns<v.tiles_min_columns&&(v.tiles_max_columns=v.tiles_min_columns),h.init(e,v),b=h.getObjThumbs()}function f(){var e;d.addClass("ug-tiles-rest-mode"),u.isTransInited=!0,1==v.tiles_enable_transition&&(d.addClass("ug-tiles-transit"),1==(e=h.getOptions()).tile_enable_image_effect&&0==e.tile_image_effect_reverse&&d.addClass("ug-tiles-transit-overlays"),u.isTransActive=!0)}function y(){return _.getElementSize(d).width}function w(){0!=u.isTransInited&&(d.addClass("ug-tiles-transition-active"),d.removeClass("ug-tiles-rest-mode"),0!=u.isTransActive&&h.disableEvents())}function e(){0!=u.isTransInited&&(d.removeClass("ug-tiles-transition-active"),d.addClass("ug-tiles-rest-mode"))}function E(){1==u.isTransActive?(setTimeout(function(){h.enableEvents(),h.triggerSizeChangeEventAllTiles(),e()},800),u.handle&&clearTimeout(u.handle),u.handle=setTimeout(function(){e(),h.triggerSizeChangeEventAllTiles(),u.handle=null},2e3)):(h.triggerSizeChangeEventAllTiles(),e())}function x(){l.colWidth=(l.availWidth-l.colGap*(l.numCols-1))/l.numCols,l.colWidth=Math.floor(l.colWidth),l.totalWidth=_.getSpaceByNumItems(l.numCols,l.colWidth,l.colGap)}function T(){var e;switch(l.colWidth=v.tiles_col_width,l.minCols=v.tiles_min_columns,l.maxCols=v.tiles_max_columns,0==s.isMobileMode()?l.colGap=v.tiles_space_between_cols:l.colGap=v.tiles_space_between_cols_mobile,l.galleryWidth=y(),l.availWidth=l.galleryWidth,1==v.tiles_include_padding&&(l.availWidth=l.galleryWidth-2*l.colGap),1==v.tiles_exact_width?(l.numCols=_.getNumItemsInSpace(l.availWidth,l.colWidth,l.colGap),0<l.maxCols&&l.numCols>l.maxCols&&(l.numCols=l.maxCols),l.numCols<l.minCols?(l.numCols=l.minCols,x()):l.totalWidth=l.numCols*(l.colWidth+l.colGap)-l.colGap):((e=_.getNumItemsInSpaceRound(l.availWidth,l.colWidth,l.colGap))<l.minCols?e=l.minCols:0!=l.maxCols&&e>l.maxCols&&(e=l.maxCols),l.numCols=e,x()),v.tiles_align){case"center":default:l.addX=Math.round((l.galleryWidth-l.totalWidth)/2);break;case"left":l.addX=0;break;case"right":l.addX=l.galleryWidth-l.totalWidth}l.arrPosx=[];for(var t=0;t<l.numCols;t++){var i=_.getColX(t,l.colWidth,l.colGap);l.arrPosx[t]=i+l.addX}}function I(){l.maxColHeight=0,l.colHeights=[0]}function S(e,t,i,n){null==n&&(n=function(){for(var e=0,t=999999999,i=0;i<l.numCols;i++){if(null==l.colHeights[i]||0==l.colHeights[i])return i;l.colHeights[i]<t&&(e=i,t=l.colHeights[i])}return e}());var r=0;if(void 0!==l.colHeights[n]&&(r=l.colHeights[n]),null===(o=h.getTileHeightByWidth(l.colWidth,e))){if(1==v.tiles_enable_transition)throw new Error("Can't know tile height, please turn off transition");var o=_.getElementSize(e).height}var a=l.arrPosx[n];_.placeElement(e,a,r);o=r+o;l.colHeights[n]=o+l.colGap,l.maxColHeight<o&&(l.maxColHeight=o),1==t&&e.show().fadeTo(0,1),1==i&&d.height(l.maxColHeight)}function P(e){e=e||!1,T(),I();var t=b.getThumbs(b.type.GET_THUMBS_RATIO);w(),h.resizeAllTiles(l.colWidth,h.resizemode.VISIBLE_ELEMENTS,t);for(var i=0;i<t.length;i++){var n=jQuery(t[i]),r=void 0;1==v.tiles_keep_order&&(r=_.getColByIndex(l.numCols,i)),S(n,e,!1,r)}E();var o=d.height();1==u.isTransActive&&o>l.maxColHeight?setTimeout(function(){d.height(l.maxColHeight)},700):d.height(l.maxColHeight)}function C(e,t){if(!0!==t&&0==(n=(n=e).index(),!0!==s.getItem(n).ordered_placed&&((n=_.getPrevRowSameColIndex(n,l.numCols))<0||!0===s.getItem(n).ordered_placed)))return;var i=e.index(),t=_.getColByIndex(l.numCols,i),n=s.getItem(i);h.resizeTile(e,l.colWidth),S(e,!0,!0,t),n.ordered_placed=!0;n=s.getNumItems(),i=_.getNextRowSameColIndex(i,l.numCols);n<=i||(n=b.getThumbByIndex(i),i=s.getItem(i),b.isThumbLoaded(n),b.isThumbLoaded(n)&&!i.ordered_placed&&C(n,!0))}function A(){var e,t,i,n=b.getThumbs(b.type.GET_THUMBS_NO_RATIO);n&&0!=n.length&&(u.isAllLoaded=!1,1==u.isFirstPlaced&&(T(),I(),e=Math.abs(l.galleryWidth-l.totalWidth),1==v.tiles_set_initial_height&&0==_.isScrollbarExists()&&e<25&&(n.length,e=Math.ceil(n.length/l.numCols)*v.tiles_col_width*.75,d.height(e),T())),n.fadeTo(0,0),n=n.find("img.ug-thumb-image"),t=l.numCols,i=l.galleryWidth,_.checkImagesLoaded(n,function(){T(),t==l.numCols&&i==l.galleryWidth||P(!1),f(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){1==u.isFirstPlaced&&s.triggerEvent(o.events.TILES_FIRST_PLACED),e=e,1!=(t=t)&&(e=jQuery(e),t=jQuery(e).parent(),b.triggerImageLoadedEvent(t,e),1==v.tiles_keep_order?C(t):(h.resizeTile(t,l.colWidth),S(t,!0,!0)))}))}function t(){var l=y(),e=b.getThumbs(!0),u=v.tiles_justified_row_height,d=[],n=0,c=v.tiles_justified_space_between,t=e.length;jQuery.each(e,function(e,t){t=jQuery(t);var i=b.getItemByThumb(t),t=i.thumbWidth;i.thumbHeight!==u&&(t=Math.floor(i.thumbRatioByWidth*u)),d[e]=t,n+=t});var i=Math.ceil(n/l);t<i&&(i=t);var r=n/i,o=[],a=0,_=[],s=[],h=0,g=0;jQuery.each(e,function(e,t){e=d[e];(g+1)*r<h+e/2&&(_[o.length]=a,o.push(s),s=[],a=0,g++),h+=e,a+=e,s.push(t)}),_[o.length]=a,o.push(s);var p=[],m=[],f=0;return jQuery.each(o,function(e,t){t.length;var i=_[e],n=(t.length-1)*c,i=(l-n)/i,i=Math.round(u*i);f+=i,0<e&&(f+=c),m.push(i);var r=i/u,o=[],a=n;jQuery.each(t,function(e,t){t=jQuery(t).index(),t=d[t],t=Math.round(t*r);o[e]=t,a+=t});var s=a-l;jQuery.each(o,function(e,t){return 0!=s&&(s<0?(o[e]=t+1,s++):(o[e]=t-1,s--),void(e==o.length-1&&0!=s&&(o[e]-=s)))}),p[e]=o}),{arrRows:o,arrRowWidths:p,arrRowHeights:m,gap:c,totalHeight:f}}function j(a){a=a||!1;var e=y(),s=t();d.height(s.totalHeight),y()!=e&&(s=t()),w();var l=0,u=0;jQuery.each(s.arrRows,function(e,t){var n=s.arrRowWidths[e],r=s.arrRowHeights[e],o=0;jQuery.each(t,function(e,t){var i=jQuery(t),e=n[e];h.resizeTile(i,e,r,h.resizemode.VISIBLE_ELEMENTS),_.placeElement(i,o,l),u<(o+=e)&&(u=o),o+=s.gap,1==a&&jQuery(t).show()}),l+=r+s.gap}),E()}function M(){var e=y();switch(p.galleryWidth=e,c={},p.colWidth=v.tiles_nested_col_width,p.optimalTileWidth=v.tiles_nested_optimal_tile_width,p.currentGap=v.tiles_space_between_cols,1==s.isMobileMode()&&(p.currentGap=v.tiles_space_between_cols_mobile),null==p.colWidth?p.colWidth=Math.floor(p.optimalTileWidth/p.nestedOptimalCols):p.optimalTileWidth>p.colWidth?p.nestedOptimalCols=Math.ceil(p.optimalTileWidth/p.colWidth):p.nestedOptimalCols=1,p.maxColumns=_.getNumItemsInSpace(e,p.colWidth,p.currentGap),p.colWidth=_.getItemSizeInSpace(e,p.maxColumns,p.currentGap),p.gridY=0,g=[],b.getThumbs(!0).each(function(){var e=function(e){var t,i,n={},r=p.colWidth,o=p.currentGap,a=h.getTileImageSize(e),s=e.index(),l=Math.ceil(function(e){return Math.abs(Math.sin(Math.abs(1e3*Math.sin(e))))}(s)*(+p.nestedOptimalCols/3)+2*p.nestedOptimalCols/3),e=a.width,s=a.height,a=e/s;s<e?(t=l,0==(i=Math.round(t/a))&&(i=1)):(i=l,0==(t=Math.round(i*a))&&(t=1));return n.dimWidth=t,n.dimHeight=i,n.width=t*r+o*(t-1),n.height=i*r+o*(i-1),n.imgWidth=e,n.imgHeight=s,n.left=0,n.top=0,n}(jQuery(this));g.push(e)}),p.optimalTileWidth>p.colWidth?p.nestedOptimalCols=Math.ceil(p.optimalTileWidth/p.colWidth):p.nestedOptimalCols=1,p.totalWidth=p.maxColumns*(p.colWidth+p.currentGap)-p.currentGap,v.tiles_align){case"center":default:p.addX=Math.round((p.galleryWidth-p.totalWidth)/2);break;case"left":p.addX=0;break;case"right":p.addX=p.galleryWidth-p.totalWidth}p.maxGridY=0}function O(e){var t=y();M(),k();var i=p.maxGridY*(p.colWidth+p.currentGap)-p.currentGap;d.height(i),y()!=t&&(M(),k()),0==v.tiles_nested_debug&&function(e){e=e||!1,w();for(var t=0;t<g.length;t++)F(t,e);d.height(p.maxColHeight),E()}(e)}function k(t){if(1==v.tiles_nested_debug)return void 0===t&&(t=!0),void function(){if(0==t){for(var e=p.currentItem;e<g.length;e++)L(e);p.currentItem=g.length-1}else L(p.currentItem);for(e=0;e<=p.currentItem;e++)F(e,!0);p.currentItem++}();for(var e=0;e<g.length;e++)L(e)}function L(e){p.maxColHeight=0;for(var t=_.getObjectLength(c),i=p.gridY;i<=t+1;i++){for(var n=0;n<p.maxColumns;n++)if(0==G(p.gridY)||0==B(p.gridY,n))return void function(e,t,i){var n=jQuery.extend(!0,{},g[e]),r=n.dimWidth,o=t-n.dimWidth,a=p.nestedOptimalCols;if(t<=n.dimWidth||o<=.33*a||t<=a)N(e,t);else if(o<=a)4<=a?1==D(Math.floor(t/2),i)?N(e,Math.floor(t/2)+1):N(e,Math.floor(t/2)):N(objImage,t);else if(1==D(r,i))switch(a<=r){case!0:N(e,r-1);break;case!1:N(e,r+1)}n=jQuery.extend(!0,{},g[e]);var s=function(e,t,i){var n=p.gridY-1,r=0,o=0,a=1,s=[],l=[];if(s.push(e),0<=n){for(o=0;0<=n;){if(r=c[n][i],void 0!==c[n][i-1]&&c[n][i-1]==c[n][i]||void 0!==c[n][i+t]&&c[n][i+t-1]==c[n][i+t]||c[n][i]!=c[n][i+t-1])return l.push(a),l.push(s),l;o!=r&&(a++,s.push(r)),n--,o=r}return l.push(a),l.push(s),l}return[0,[]]}(e,n.dimWidth,i);if(p.columnsValueToEnableHeightResize<=s[0]&&p.maxColumns>=2*p.nestedOptimalCols){var l=function(e,t){var i=0,n=0,r=t.dimWidth,o=t.dimHeight,a=0,s=0,l=jQuery.map(c,function(e,t){return[e]});if(void 0===l[p.gridY]||void 0===l[p.gridY][e-1])n=0;else for(var u=0;void 0!==c[p.gridY+u]&&-1!=c[p.gridY+u][e-1];)a=c[p.gridY+u][e-2],u++,n++;if(void 0===l[p.gridY]||void 0===l[p.gridY][e+r])i=0;else for(u=0;void 0!==c[p.gridY+u]&&-1!=c[p.gridY+u][e+r];)s=c[p.gridY+u][e+r+1],u++,i++;t=0,l=0;Math.abs(o-n)<Math.abs(o-i)&&0!=n?(t=n,l=a):0!=i?(t=i,l=s):t=o;return{newHeight:t,idToResize:l}}(i,n),o=H(e,l.newHeight,!0);g[e].dimHeight=o.dimHeight;t=function(e,t){for(var i=0,n=0,r=[],o=0,a=0,s=0;s<e[1].length;s++){var l,u=e[1][s],d=g[e[1][s]];n+=d.dimHeight,0!=s?(i+=d.dimHeight,r.push([u,d.dimHeight])):(l=N(u,t,!0),i+=l.dimHeight,r.push([e[1][s],l.dimHeight]))}o=d.left,a=d.top;for(var c,_=n,h=[],s=r.length-1;0<=s;s--){u=r[s][0];0!=s?(c=Math.max(Math.round(+n/3),Math.floor(r[s][1]*(n/i))),_-=c,(l=H(u,c,!0)).left=o,l.top=a,h.push({tileID:u,sizes:l}),a+=l.dimHeight):((l=H(u,c=_,!0)).left=o,l.top=a,h.push({tileID:u,sizes:l}))}return h}(s,o.dimWidth),a=2<=function(e){for(var t=0,i=0,n=0;n<e.length-1;n++){var r=e[n].sizes,o=-1,a=-1;G(r.top+r.dimHeight)&&p.maxColumns>r.left+r.dimWidth&&(o=c[r.top+r.dimHeight-1][r.left+r.dimWidth],a=c[r.top+r.dimHeight][r.left+r.dimWidth]),o!=a&&t++}for(n=0;n<e.length-1;n++){r=e[n].sizes,o=-1,a=-1;G(r.top+r.dimHeight)&&0<=r.left-1&&(o=c[r.top+r.dimHeight-1][r.left-1],a=c[r.top+r.dimHeight][r.left-1]),o!=a&&i++}return Math.max(i,t)}(t)?!0:!1;l.newHeight>=n.dimHeight&&(n=H(e,l.newHeight,!0));s=function(e,t,i){var n=g[e],r=n.dimHeight,o=(n.dimWidth,n.left),n=n.top,t=(parseInt(n/(p.colWidth+p.currentGap)),parseInt(o/(p.colWidth+p.currentGap)),H(e,r-t+i,!0)),i=[];return i.push({tileID:e,sizes:t}),i}(l.idToResize,l.newHeight,n.dimHeight);n.top=p.gridY,n.left=i,s.push({tileID:e,sizes:n});o=R(s),l=R(t);return o<l||1==a?z(s):z(t)}n.left=i,n.top=p.gridY,g[e]=n,Q(e,n,i,p.gridY),p.maxGridY=n.top+n.dimHeight}(e,function(e){var t=e,i=0;if(1==G(p.gridY))for(;0==B(p.gridY,t);)i++,t++;else i=p.maxColumns;return i}(n),n);p.gridY++}}function z(e){for(var t=0;t<e.length;t++){var i=e[t].sizes,n=e[t].tileID;g[n]=jQuery.extend(!0,{},i),Q(n,i,i.left,i.top)}}function N(e,t,i){i=i||!1;var n=p.colWidth,r=p.currentGap,o=g[e],e=o.imgWidth/o.imgHeight,t=t,e=Math.round(t/e);if(1==i){i=jQuery.extend(!0,{},o);return i.dimWidth=t,i.dimHeight=e,i.width=t*n+r*(t-1),i.height=e*n+r*(e-1),i}o.dimWidth=t,o.dimHeight=e,o.width=t*n+r*(t-1),o.height=e*n+r*(e-1)}function H(e,t,i){i=i||!1;var n=g[e],r=n.dimWidth,o=p.colWidth,e=p.currentGap;if(1==i){i=jQuery.extend(!0,{},n);return i.dimHeight=t,i.width=r*o+e*(r-1),i.height=t*o+e*(t-1),i}n.dimHeight=t,n.width=r*o+e*(r-1),n.height=t*o+e*(t-1)}function R(e){for(var t=0,i=0,n=0;n<e.length;n++){var r=g[e[n].tileID];if(0==r.dimHeight||0==r.height)return;r=r.dimWidth/r.dimHeight/(r.imgWidth/r.imgHeight);r<1&&(r=1/r),t+=r,i++}return t/i}function D(e,t){var i=p.gridY-1;return!(i<=0||0==G(i))&&c[i][t+e-1]!=c[i][t+e]}function G(e){return void 0!==c[e]}function Q(e,t,i,n){for(var r,o,a=0;a<t.dimHeight;a++)for(var s=0;s<t.dimWidth;s++)0==G(n+a)&&function(e){c[e]=new Object;for(var t=0;t<p.maxColumns;t++)c[e][t]=-1}(n+a),r=i+s,o=e,c[n+a][r]=o}function B(e,t){return-1!=c[e][t]}function F(e,t){var i=b.getThumbByIndex(e),n=g[e],r=n.top*(p.colWidth+p.currentGap),e=p.addX+n.left*(p.colWidth+p.currentGap);h.resizeTile(i,n.width,n.height,h.resizemode.VISIBLE_ELEMENTS),_.placeElement(i,e,r),r+n.height>p.maxColHeight&&(p.maxColHeight=r+n.height),1==t&&i.fadeTo(0,1)}function W(){if(1==u.isFirstTimeRun)return!0;if(0==u.isAllLoaded)return!1;switch(v.tiles_type){case"columns":P(!1);break;case"justified":j(!1);break;case"nested":(1==s.isMobileMode()?P:O)(!1)}}function U(){switch(r.children(".ug-tile").show(),1==u.isFirstTimeRun&&(a.on(o.events.ALL_TILES_LOADED,function(){u.isAllLoaded=!0}),n.on(s.events.SIZE_CHANGE,W),n.on(o.events.TILES_FIRST_PLACED,function(){u.isFirstPlaced=!1}),h.initEvents()),h.run(),v.tiles_type){default:case"columns":A();break;case"justified":t=jQuery(r).find("img.ug-thumb-image"),i=b.getThumbs(),u.isAllLoaded=!1,i.fadeTo(0,0),_.checkImagesLoaded(t,function(){setTimeout(function(){j(!0),i.fadeTo(0,1),s.triggerEvent(o.events.TILES_FIRST_PLACED),f(),a.trigger(o.events.ALL_TILES_LOADED)})},function(e,t){e=jQuery(e);var i=jQuery(e).parent();b.triggerImageLoadedEvent(i,e)});break;case"nested":e=jQuery(r).find("img.ug-thumb-image"),t=b.getThumbs(),u.isAllLoaded=!1,t.fadeTo(0,0),_.checkImagesLoaded(e,function(){(1==s.isMobileMode()?P:O)(!0),s.triggerEvent(o.events.TILES_FIRST_PLACED),f(),a.trigger(o.events.ALL_TILES_LOADED)},function(e,t){e=jQuery(e);var i=jQuery(e).parent();b.triggerImageLoadedEvent(i,e)})}var e,t,i;u.isFirstTimeRun=!1}this.destroy=function(){n.off(s.events.SIZE_CHANGE),h.destroy(),n.off(o.events.TILES_FIRST_PLACED)},this.init=function(e,t){m(e,t)},this.setHtml=function(e){!function(e){d=e=e||(d||r);var t=v.tiles_type;e.addClass("ug-tiletype-"+t),h.setHtml(e),e.children(".ug-thumb-wrapper").hide()}(e)},this.getObjTileDesign=function(){return h},this.run=function(){U()},this.runNewItems=function(){if(!d)throw new Error("Can't run new items - parent not set");switch(h.setHtml(d,!0),h.run(!0),v.tiles_type){case"columns":A();break;default:case"justified":case"nested":throw new Error("Tiles type: "+v.tiles_type+" not support load more yet")}}}function UGAviaControl(){var a,t,s,o,l,u,n={strip_speed:10},d={touchEnabled:!1,isMouseInsideStrip:!1,strip_finalPos:0,handle_timeout:"",handle_request_frame:0,isStripMoving:!1,isControlEnabled:!0,area_thumb_sizes:1};function i(){u=!0}function r(){u=!1,h()}function c(e){if(0==d.isControlEnabled)return!0;if(1==d.touchEnabled)return jQuery("body").off("mousemove"),!0;d.isMouseInsideStrip=s.ismouseover();var t,i,n,r=a.isTouchMotionActive();if(1==u&&0==r){var e=function(e){var t=a.getSizes().thumbSize;if(200<(t=d.area_thumb_sizes*t)&&(t=200),0!=l)return i=s.offset().top,n=i+s.height(),r=i+t,o=n-t,i<e&&e<r?"start":e<n&&o<e?"stop":null;var i=s.offset().left,n=i+s.width(),r=i+t,o=n-t;return i<e&&e<r?"start":e<n&&o<e?"stop":null}((e=e,0==l?e.pageX:e.pageY));if(!e)return h(),!1;e=e,0==l&&(i=o.width(),n=s.width(),"start"==e&&(t=0),"stop"==e&&(t=-(i-n))),1==l&&(i=o.height(),n=s.height(),"start"==e&&(t=0),"stop"==e&&(t=-(i-n))),t=Math.floor(t),d.is_strip_moving=!0,d.strip_finalPos=t,!void(1!=d.isStripMoving&&(d.isStripMoving=!0,d.handle_request_frame=requestAnimationFrame(_)))}else h()}function _(){if(0==d.is_strip_moving)return!1;var e=a.getInnerStripPos();Math.floor(e)==Math.floor(d.strip_finalPos)&&h();var t=Math.abs(d.strip_finalPos-e),i=n.strip_speed;d.strip_finalPos<e&&(i*=-1);e+=i;if(d.strip_finalPos>e&&i<0&&(e=d.strip_finalPos),0==t)return h(),!1;a.positionInnerStrip(e),d.handle_request_frame=requestAnimationFrame(_)}function h(){0!=d.isStripMoving&&(d.isStripMoving=!1,cancelAnimationFrame(d.handle_request_frame))}this.enable=function(){d.isControlEnabled=!0},this.disable=function(){d.isControlEnabled=!1},this.onResize=function(){},this.init=function(e){t=(a=e).getObjects(),t.g_gallery,s=t.g_objStrip,o=t.g_objStripInner,n=t.g_options,l=t.isVertical,jQuery("body").on("touchstart",function(e){return 0==d.isControlEnabled||void(d.touchEnabled=!0)}),jQuery("body").mousemove(c),s.on("mouseover",i),s.on("mouseleave",r)},this.destroy=function(){jQuery("body").off("touchstart"),jQuery("body").off("mousemove")}}function UGSlider(){var r,l,u,d,c,_,h,g,p,n,o,m,a,f=this,b=jQuery(f),v=new UniteGalleryMain,y=null,w=null,E=null,x=new UGVideoPlayer,T=new UGFunctions,I=null,S=null,P={slider_scale_mode:"fill",slider_scale_mode_media:"fill",slider_scale_mode_fullscreen:"down",slider_item_padding_top:0,slider_item_padding_bottom:0,slider_item_padding_left:0,slider_item_padding_right:0,slider_background_color:"",slider_background_opacity:1,slider_image_padding_top:0,slider_image_padding_bottom:0,slider_image_padding_left:0,slider_image_padding_right:0,slider_image_border:!(this.events={ITEM_CHANGED:"item_changed",BEFORE_SWITCH_SLIDES:"before_switch",BEFORE_RETURN:"before_return",AFTER_RETURN:"after_return",ZOOM_START:"slider_zoom_start",ZOOM_END:"slider_zoom_end",ZOOMING:"slider_zooming",ZOOM_CHANGE:"slider_zoom_change",START_DRAG:"start_drag",AFTER_DRAG_CHANGE:"after_drag_change",ACTION_START:"action_start",ACTION_END:"action_end",CLICK:"slider_click",TRANSITION_START:"slider_transition_start",TRANSITION_END:"slider_transition_end",AFTER_PUT_IMAGE:"after_put_image",IMAGE_MOUSEENTER:"slider_image_mouseenter",IMAGE_MOUSELEAVE:"slider_image_mouseleave",CURRENTSLIDE_LOAD_START:"slider_current_loadstart",CURRENTSLIDE_LOAD_END:"slider_current_loadend"}),slider_image_border_width:10,slider_image_border_color:"#ffffff",slider_image_border_radius:0,slider_image_border_maxratio:.35,slider_image_shadow:!1,slider_video_constantsize:!1,slider_video_constantsize_scalemode:"fit",slider_video_constantsize_width:854,slider_video_constantsize_height:480,slider_video_padding_top:0,slider_video_padding_bottom:0,slider_video_padding_left:0,slider_video_padding_right:0,slider_video_enable_closebutton:!0,slider_transition:"slide",slider_transition_speed:300,slider_transition_easing:"easeInOutQuad",slider_control_swipe:!0,slider_control_zoom:!0,slider_zoom_mousewheel:!0,slider_vertical_scroll_ondrag:!1,slider_loader_type:1,slider_loader_color:"white",slider_enable_links:!0,slider_links_newpage:!1,slider_enable_bullets:!1,slider_bullets_size:"",slider_bullets_color:"",slider_bullets_color_reverse:!1,slider_bullets_space_between:-1,slider_bullets_align_hor:"center",slider_bullets_align_vert:"bottom",slider_bullets_offset_hor:0,slider_bullets_offset_vert:10,slider_enable_arrows:!0,slider_arrows_skin:"",slider_arrows_width:2,slider_arrows_type:"default",slider_arrows_custom_icon_right:"",slider_arrows_custom_icon_left:"",slider_arrow_left_align_hor:"left",slider_arrow_left_align_vert:"middle",slider_arrow_left_offset_hor:10,slider_arrow_left_offset_vert:0,slider_arrow_right_align_hor:"right",slider_arrow_right_align_vert:"middle",slider_arrow_right_offset_hor:10,slider_arrow_right_offset_vert:0,slider_enable_progress_indicator:!0,slider_progress_indicator_type:"pie",slider_progress_indicator_align_hor:"right",slider_progress_indicator_align_vert:"top",slider_progress_indicator_offset_hor:10,slider_progress_indicator_offset_vert:10,slider_enable_play_button:!0,slider_play_button_skin:"",slider_play_button_align_hor:"left",slider_play_button_align_vert:"top",slider_play_button_offset_hor:40,slider_play_button_offset_vert:8,slider_play_button_mobilehide:!1,slider_play_button_type:"default",slider_play_button_custom:"",slider_pause_button_custom:"",slider_enable_fullscreen_button:!0,slider_fullscreen_button_skin:"",slider_fullscreen_button_align_hor:"left",slider_fullscreen_button_align_vert:"top",slider_fullscreen_button_offset_hor:11,slider_fullscreen_button_offset_vert:9,slider_fullscreen_button_mobilehide:!1,slider_fullscreen_button_type:"default",slider_fullscreen_button_icon_custom:"",slider_smallscreen_button_icon_custom:"",slider_enable_zoom_panel:!0,slider_zoompanel_skin:"",slider_zoompanel_align_hor:"left",slider_zoompanel_align_vert:"top",slider_zoompanel_offset_hor:12,slider_zoompanel_offset_vert:92,slider_zoompanel_mobilehide:!1,slider_controls_always_on:!1,slider_controls_appear_ontap:!0,slider_controls_appear_duration:300,slider_enable_text_panel:!0,slider_textpanel_always_on:!0,slider_videoplay_button_type:"square",slider_videoplay_icon_type:"default",slider_videoplay_icon_custom:"",slider_video_autoplay:!1,slider_video_muted:!1},C={slider_progress_indicator_align_hor:"left",slider_progress_indicator_align_vert:"bottom",slider_progress_indicator_offset_hor:0,slider_progress_indicator_offset_vert:0},A={isRunOnce:!1,isTextPanelSaparateHover:!1,numPrev:1,numCurrent:2,numNext:3,isControlsVisible:!0,currentControlsMode:"image"};function s(e,t,i){v=e,i&&(a=i,t=T.convertCustomPrefixOptions(t,a,"slider")),r=jQuery(e);e=v.getObjects();l=e.g_objWrapper,e.g_objThumbs,t.hasOwnProperty("slider_progress_indicator_type")&&(P.slider_progress_indicator_type=t.slider_progress_indicator_type),"bar"==P.slider_progress_indicator_type&&(P=jQuery.extend(P,C)),t&&f.setOptions(t),e=v.getOptions(),t=e.gallery_skin,""==P.slider_arrows_skin&&(P.slider_arrows_skin=t),""==P.slider_zoompanel_skin&&(P.slider_zoompanel_skin=t),""==P.slider_play_button_skin&&(P.slider_play_button_skin=t),""==P.slider_fullscreen_button_skin&&(P.slider_fullscreen_button_skin=t),P.video_enable_closebutton=P.slider_video_enable_closebutton,"zoom"!=e.gallery_mousewheel_role&&(P.slider_zoom_mousewheel=!1),1==P.slider_enable_bullets&&(E=new UGBullets,n={bullets_size:P.slider_bullets_size,bullets_color:P.slider_bullets_color,bullets_color_reverse:P.slider_bullets_color_reverse,bullets_space_between:P.slider_bullets_space_between},E.init(v,n)),P.slider_enable_text_panel&&(S=new UGTextPanel).init(v,P,"slider"),P.slider_enable_zoom_panel&&(m=new UGZoomButtonsPanel).init(f,P);var n=v.getGalleryID();x.init(P,!1,n)}function e(){var e,t,i;1!=A.isRunOnce&&(A.isRunOnce=!0,P.slider_background_color?(e=P.slider_background_color,1!=P.slider_background_opacity&&(e=T.convertHexToRGB(e,P.slider_background_opacity)),u.css("background-color",e)):1!=P.slider_background_opacity&&(e=T.convertHexToRGB("#000000",P.slider_background_opacity),u.css("background-color",e)),1==P.slider_control_swipe&&(n=new UGTouchSliderControl).init(f,P),1==P.slider_control_zoom&&(o=new UGZoomSliderControl).init(f,P),S&&S.run(),r.on(v.events.ITEM_IMAGE_UPDATED,se),r.on(v.events.ITEM_CHANGE,K),E&&jQuery(E).on(E.events.BULLET_CLICK,J),1==P.slider_enable_arrows&&(T.addClassOnHover(p,"ug-arrow-hover"),T.addClassOnHover(g,"ug-arrow-hover"),v.setNextButton(p),v.setPrevButton(g)),0==P.slider_controls_always_on&&u.hover(ie,ne),u.on("touchend click",$),b.on(f.events.CLICK,ee),S&&1==A.isTextPanelSaparateHover&&u.hover(G,D),y&&(T.addClassOnHover(y,"ug-button-hover"),t="custom"==P.slider_play_button_type,i=P.slider_pause_button_custom,v.setPlayButton(y,t,i)),w&&(T.addClassOnHover(w,"ug-button-hover"),t="custom"==P.slider_fullscreen_button_type,i=P.slider_smallscreen_button_icon_custom,v.setFullScreenToggleButton(w,t,i),w.on("click",function(e){e.stopPropagation()})),o&&b.on(f.events.ZOOM_CHANGE,te),m&&m.initEvents(),x.initEvents(),jQuery(x).on(x.events.SHOW,oe),jQuery(x).on(x.events.HIDE,ae),ue(c),ue(_),ue(h),b.on(f.events.AFTER_PUT_IMAGE,le),u.on("mouseenter",".ug-item-wrapper img",function(e){b.trigger(f.events.IMAGE_MOUSEENTER)}),u.on("mouseleave",".ug-item-wrapper img",function(e){0==f.isMouseInsideSlideImage(e)&&b.trigger(f.events.IMAGE_MOUSELEAVE)}))}function j(e,t){var i,n="";"default"==P.slider_videoplay_icon_type&&(i='<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_19_2)"><path d="M28 15.998C28 15.346 27.682 14.734 27.146 14.36L7.146 0.360047C6.538 -0.0679528 5.738 -0.115953 5.076 0.224047C4.414 0.570047 4 1.25205 4 1.99805V30C4 30.746 4.414 31.43 5.076 31.774C5.738 32.114 6.536 32.066 7.146 31.638L27.146 17.638C27.682 17.266 28 16.654 28 16.002C28 16 28 16 28 15.998C28 16 28 16 28 15.998Z" fill="white"/></g><defs><clipPath id="clip0_19_2"><rect width="32" height="32" fill="white"/></clipPath></defs></svg>'),"custom"==P.slider_videoplay_icon_type&&(i=P.slider_videoplay_icon_custom,n="ug-button-videoplay-custom");var r="ug-type-square";"round"==P.slider_videoplay_button_type&&(r="ug-type-round");var o="";return o+="<div class='ug-slide-wrapper ug-slide"+t+"'>",o+="<div class='ug-item-wrapper'></div>",o+="<div class='ug-slider-preloader "+e+"'></div>",o+="<div class='ug-button-videoplay "+n+" "+r+"' style='display:none'>"+i+"</div>",o+="</div>"}function t(e){e&&(l=e);var t,i,n,r,o,a=function(){var e;switch(P.slider_loader_type){default:case 1:e="ug-loader1";break;case 2:e="ug-loader2";break;case 3:e="ug-loader3";break;case 4:e="ug-loader4";break;case 5:e="ug-loader5";break;case 6:e="ug-loader6";break;case 7:e="ug-loader7";break;case 8:e="ug-loader8";break;case 9:e="ug-loader9"}"black"==P.slider_loader_color&&(e+=" ug-loader-black");return e}(),s=(v.getOptions(),"<div class='ug-slider-wrapper'>");s+="<div class='ug-slider-inner'>",s+=j(a,1),s+=j(a,2),s+=j(a,3),s+="</div>",1==P.slider_enable_arrows&&(t=P.slider_arrows_width,a=e="","default"==P.slider_arrows_type&&(i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 48 48"><g stroke-width="'+t+'" transform="translate(0.5, 0.5)"><polyline fill="none" stroke="#ffffff" stroke-width="'+t+'" stroke-linecap="square" stroke-miterlimit="10" points="31,3 17,24 31,45 " stroke-linejoin="miter"></polyline></g></svg>',n='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 48 48"><g stroke-width="'+t+'" transform="translate(0.5, 0.5)"><polyline fill="none" stroke="#ffffff" stroke-width="'+t+'" stroke-linecap="square" stroke-miterlimit="10" points="17,3 31,24 17,45 " stroke-linejoin="miter"></polyline></g></svg>'),"custom"==P.slider_arrows_type&&(i=P.slider_arrows_custom_icon_left,n=P.slider_arrows_custom_icon_right,e="ug-arrow-left-custom",a="ug-arrow-right-custom"),s+="<div class='ug-slider-control ug-arrow-left "+e+" ug-skin-"+P.slider_arrows_skin+"'>"+i+"</div>",s+="<div class='ug-slider-control ug-arrow-right "+a+" ug-skin-"+P.slider_arrows_skin+"'>"+n+"</div>"),1==P.slider_enable_play_button&&(n="","default"==P.slider_play_button_type&&(o='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16"><g transform="translate(0, 0)"><path fill="#ffffff" d="M14,7.999c0-0.326-0.159-0.632-0.427-0.819l-10-7C3.269-0.034,2.869-0.058,2.538,0.112C2.207,0.285,2,0.626,2,0.999v14.001c0,0.373,0.207,0.715,0.538,0.887c0.331,0.17,0.73,0.146,1.035-0.068l10-7C13.841,8.633,14,8.327,14,8.001C14,8,14,8,14,7.999C14,8,14,8,14,7.999z"></path></g></svg>'),"custom"==P.slider_play_button_type&&(o=P.slider_play_button_custom,n="ug-button-play-custom"),s+="<div class='ug-slider-control ug-button-play "+n+" ug-skin-"+P.slider_play_button_skin+"'>"+o+"</div>"),1==P.slider_enable_fullscreen_button&&(o="","default"==P.slider_fullscreen_button_type&&(r='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16"><g transform="translate(0, 0)"><polyline fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="10.5,0.5 15.5,0.5 15.5,5.5 "></polyline><polyline fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="0.5,10.5 0.5,15.5 5.5,15.5 "></polyline><line fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="15.5" y1="0.5" x2="11.5" y2="4.5"></line><line fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="4.5" y1="11.5" x2="0.5" y2="15.5"></line><polyline fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="5.5,0.5 0.5,0.5 0.5,5.5 "></polyline><line fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="0.5" y1="0.5" x2="4.5" y2="4.5"></line><polyline fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="15.5,10.5 15.5,15.5 10.5,15.5 "></polyline><line fill="none" stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="11.5" y1="11.5" x2="15.5" y2="15.5"></line><circle fill="#ffffff" cx="8" cy="8" r="2" data-cap="butt" data-color="color-2" data-stroke="none"></circle></g></svg>'),"custom"==P.slider_fullscreen_button_type&&(r=P.slider_fullscreen_button_icon_custom,o="ug-button-fullscreen-custom"),s+="<div class='ug-slider-control ug-button-fullscreen "+o+" ug-skin-"+P.slider_fullscreen_button_skin+"'>"+r+"</div>"),s+="</div>",l.append(s),u=l.children(".ug-slider-wrapper"),d=u.children(".ug-slider-inner"),c=d.children(".ug-slide1"),_=d.children(".ug-slide2"),h=d.children(".ug-slide3"),c.data("slidenum",1),_.data("slidenum",2),h.data("slidenum",3),E&&E.appendHTML(u),1==P.slider_enable_arrows&&(g=u.children(".ug-arrow-left"),p=u.children(".ug-arrow-right")),1==P.slider_enable_play_button&&(y=u.children(".ug-button-play")),1==P.slider_enable_fullscreen_button&&(w=u.children(".ug-button-fullscreen")),1==P.slider_enable_progress_indicator&&("bar"==(I=T.initProgressIndicator(P.slider_progress_indicator_type,P,u)).getType()&&"pie"==P.slider_progress_indicator_type&&(P.slider_progress_indicator_type="bar",P=jQuery.extend(P,C)),v.setProgressIndicator(I)),1==P.slider_enable_text_panel&&(S.appendHTML(u),0==P.slider_textpanel_always_on&&(S.getElement().hide().data("isHidden",!0),A.isTextPanelSaparateHover=!0)),1==P.slider_enable_zoom_panel&&m.appendHTML(u),x.setHtml(d)}function i(e){var t=_e(e);T.placeElementInParentCenter(t);e=he(e);T.placeElementInParentCenter(e)}function M(){var e,t;E&&(e=E.getElement(),T.placeElement(e,P.slider_bullets_align_hor,P.slider_bullets_align_vert,P.slider_bullets_offset_hor,P.slider_bullets_offset_vert),T.placeElement(e,P.slider_bullets_align_hor,P.slider_bullets_align_vert,P.slider_bullets_offset_hor,P.slider_bullets_offset_vert)),1==P.slider_enable_arrows&&(T.placeElement(g,P.slider_arrow_left_align_hor,P.slider_arrow_left_align_vert,P.slider_arrow_left_offset_hor,P.slider_arrow_left_offset_vert),T.placeElement(p,P.slider_arrow_right_align_hor,P.slider_arrow_left_align_vert,P.slider_arrow_right_offset_hor,P.slider_arrow_right_offset_vert)),0==P.slider_controls_always_on&&X(!0),I&&(t=I.getElement(),"bar"==P.slider_progress_indicator_type?(e=u.width(),I.setSize(e),T.placeElement(t,"left",P.slider_progress_indicator_align_vert,0,P.slider_progress_indicator_offset_vert)):T.placeElement(t,P.slider_progress_indicator_align_hor,P.slider_progress_indicator_align_vert,P.slider_progress_indicator_offset_hor,P.slider_progress_indicator_offset_vert)),S&&S.positionPanel(),y&&T.placeElement(y,P.slider_play_button_align_hor,P.slider_play_button_align_vert,P.slider_play_button_offset_hor,P.slider_play_button_offset_vert),w&&T.placeElement(w,P.slider_fullscreen_button_align_hor,P.slider_fullscreen_button_align_vert,P.slider_fullscreen_button_offset_hor,P.slider_fullscreen_button_offset_vert),m&&(t=m.getElement(),T.placeElement(t,P.slider_zoompanel_align_hor,P.slider_zoompanel_align_vert,P.slider_zoompanel_offset_hor,P.slider_zoompanel_offset_vert)),i(c),i(_),i(h),v.isMobileMode()?(1==P.slider_fullscreen_button_mobilehide&&w&&w.hide(),1==P.slider_play_button_mobilehide&&y&&y.hide(),1==P.slider_zoompanel_mobilehide&&m&&m.getElement().hide()):(1==P.slider_fullscreen_button_mobilehide&&w&&w.show(),1==P.slider_play_button_mobilehide&&y&&y.show(),1==P.slider_zoompanel_mobilehide&&m&&m.getElement().show())}function O(){var e,t,i=f.getSlidesReference(),n=0,r=f.isSlideHasItem(i.objNextSlide),o=f.isSlideHasItem(i.objPrevSlide);o?(n=i.objPrevSlide.outerWidth(),i.objPrevSlide.css("z-index",1)):i.objPrevSlide.hide(),e=t=n+i.objCurrentSlide.outerWidth(),r?(e=t+i.objNextSlide.outerWidth(),i.objPrevSlide.css("z-index",2)):i.objNextSlide.hide(),i.objCurrentSlide.css("z-index",3),T.placeElement(i.objCurrentSlide,n,0),d.css({left:-n+"px",width:e+"px"}),o&&(T.placeElement(i.objPrevSlide,0,0),T.showElement(i.objPrevSlide)),r&&(T.showElement(i.objNextSlide),T.placeElement(i.objNextSlide,t,0))}function k(e){var t=e.data("index");void 0===t||null==t||(t=v.getItem(t))&&R(e,t)}function L(e){e.stop(!0).hide(100)}function z(e,t,i){var n={};1==P.slider_image_border&&(n["border-style"]="solid",i=function(e,t){if((n=P.slider_image_border_width)<=10)return n;var e=(i=T.getElementSize(e)).width,i=i.height;if(t&&(t.hasOwnProperty("imageWidth")&&(e=t.imageWidth),t.hasOwnProperty("imageHeight")&&(i=t.imageHeight)),e<=0)return n;if(2*n/(i=e<i?e:i)<P.slider_image_border_maxratio)return n;var n=i*P.slider_image_border_maxratio/2;return n=Math.round(n)}(e,i),n["border-width"]=i+"px",n["border-color"]=P.slider_image_border_color,n["border-radius"]=P.slider_image_border_radius),"image"!=t&&1==P.slider_video_constantsize&&(n["background-color"]="#000000"),1==P.slider_image_shadow&&(n["box-shadow"]="3px 3px 10px 0px #353535"),e.css(n)}function N(e,t){var i=P.slider_video_constantsize_width,n=P.slider_video_constantsize_height,r=P.slider_video_constantsize_scalemode;return T.scaleImageExactSizeInParent(e,t.imageWidth,t.imageHeight,i,n,r)}function H(e,t,i){var n=e.children(".ug-item-wrapper"),r=_e(e);if(void 0===t.urlImage||""==t.urlImage)throw new Error("The slide don't have big image defined ( data-image='imageurl' ). Please check gallery items.","showbig");var o=t.urlImage,a=e.data("urlImage");e.data("urlImage",o);var s,l,u=f.getScaleMode(e),d=f.getSlideType(e),c=f.getObjImagePadding(),_="";"string"==typeof t.description&&(_=t.description),a==o&&!0!==i?((s=n.children("img")).attr("alt",_),0!=t.imageWidth&&0!=t.imageHeight||v.checkFillImageSize(s,t),l={},z(s,d,l="image"!=d&&1==P.slider_video_constantsize?N(s,t):T.scaleImageFitParent(s,t.imageWidth,t.imageHeight,u,c)),b.trigger(f.events.AFTER_PUT_IMAGE,e)):((s=T.placeImageInsideParent(o,n,t.imageWidth,t.imageHeight,u,c)).attr("alt",_),1==t.isBigImageLoaded?(s.fadeTo(0,1),L(r),l="image"!=d&&1==P.slider_video_constantsize?N(s,t):T.getImageInsideParentData(n,t.imageWidth,t.imageHeight,u,c),s.css("width",l.imageWidth+"px"),z(s,d,l),b.trigger(f.events.AFTER_PUT_IMAGE,e)):(s.fadeTo(0,0),r.stop(!0).show(100),e.data("isLoading",!0),f.isSlideCurrent(e)&&b.trigger(f.events.CURRENTSLIDE_LOAD_START),s.data("itemIndex",t.index),s.on("load",function(){var e=jQuery(this),t=e.data("itemIndex");e.fadeTo(0,1);var i=e.parent().parent(),n=f.getSlideType(i),r=_e(i),o=f.getObjImagePadding(),a=f.getScaleMode(i);L(r),i.data("isLoading",!1),f.isSlideCurrent(i)&&b.trigger(f.events.CURRENTSLIDE_LOAD_END),v.onItemBigImageLoaded(null,e);r=v.getItem(t),t={};"image"!=n&&1==P.slider_video_constantsize?N(e,r):t=T.scaleImageFitParent(e,r.imageWidth,r.imageHeight,a,o),e.fadeTo(0,1),z(e,n,t),b.trigger(f.events.AFTER_PUT_IMAGE,i)})))}function R(e,t){try{var i=e.children(".ug-item-wrapper");if(null==t)return i.html(""),e.removeData("index"),e.removeData("type"),void e.removeData("urlImage");e.data("index");e.data("index",t.index),e.data("type",t.type),1==P.slider_enable_links&&"image"==t.type&&(t.link?e.addClass("ug-slide-clickable"):e.removeClass("ug-slide-clickable")),H(e,t);var n=he(e);"image"===t.type?n.hide():n.show()}catch(e){throw void 0!==e.fileName&&"showbig"==e.fileName&&v.showErrorMessageReplaceGallery(e.message),i.html(""),new Error(e)}}function D(){if(!S)return!1;if(1==Q())return!1;var e=S.getElement(),t=0;1!=A.isTextPanelSaparateHover&&1!=P.slider_textpanel_always_on||(t=P.slider_controls_appear_duration),e.stop().fadeTo(t,0),e.data("isHidden",!0)}function G(){if(!S)return!1;if(0==Q())return!1;var e=S.getElement(),t=0;1!=A.isTextPanelSaparateHover&&1!=P.slider_textpanel_always_on||(e.show(),S.positionElements(),t=P.slider_controls_appear_duration),e.stop().show().fadeTo(t,1),e.data("isHidden",!1)}function Q(){return!1!==S.getElement().data("isHidden")}function B(){var e=f.getCurrentSlide(),t=f.getSlideImage(e),i=T.getElementSize(e),e=i.left,i=i.top;1==P.slider_video_constantsize?(e+=(t=T.getElementSize(t)).left,i+=t.top):(e+=P.slider_video_padding_left,i+=P.slider_video_padding_top),x.setPosition(e,i)}function F(){var e=P.slider_video_constantsize_width,t=P.slider_video_constantsize_height;x.setSize(e,t),z(x.getObject(),"video")}function W(e,t,i){b.trigger(f.events.TRANSITION_START);var n=P.slider_transition;switch(i&&(n=i),f.stopSlideAction(null,!0),n){default:case"fade":Y(t);break;case"slide":!function t(e,i){var n=f.isAnimating();if(1==n)return A.itemWaiting=i,!0;null!=A.itemWaiting&&(A.itemWaiting=null);var r=f.getSlidesReference();switch(e){case"right":R(r.objPrevSlide,i),O();var o=T.getElementSize(r.objPrevSlide),a=-o.left;f.switchSlideNums("right");break;case"left":R(r.objNextSlide,i),O();var o=T.getElementSize(r.objNextSlide),a=-o.left;f.switchSlideNums("left");break;default:throw new Error("wrong direction: "+e)}var s=P.slider_transition_speed;n=P.slider_transition_easing;var n={duration:s,easing:n,queue:!1,always:function(){var e;f.stopSlideAction(),x.hide(),null!=A.itemWaiting?(e=ce(A.itemWaiting),t(e,A.itemWaiting)):(f.placeNabourItems(),b.trigger(f.events.TRANSITION_END))}};d.animate({left:a+"px"},n)}(e,t);break;case"lightbox_open":Y(t,!1,!0)}}function U(e,t,i){i?e.fadeTo(P.slider_transition_speed,t,i):e.fadeTo(P.slider_transition_speed,t)}function Y(e,t,i){t=t||!1;var n=f.getSlidesReference();R(n.objNextSlide,e);e=T.getElementSize(n.objCurrentSlide);T.placeElement(n.objNextSlide,e.left,e.top);e=A.numCurrent;A.numCurrent=A.numNext,A.numNext=e,b.trigger(f.events.ITEM_CHANGED),n.objNextSlide.stop(!0),n.objCurrentSlide.stop(!0),1==t?(n.objCurrentSlide.fadeTo(0,0),n.objNextSlide.fadeTo(0,1),f.placeNabourItems(),b.trigger(f.events.TRANSITION_END),!0!==i&&x.hide()):(n.objNextSlide.fadeTo(0,0),U(n.objCurrentSlide,0,function(){f.placeNabourItems(),b.trigger(f.events.TRANSITION_END),!0!==i&&x.hide()}),1==x.isVisible()&&U(x.getObject(),0),U(n.objNextSlide,1))}function V(){return u.children(".ug-slider-control")}function X(e){var t;0!=T.isTimePassed("sliderControlsToggle")&&0!=A.isControlsVisible&&(e=e||!1,t=V(),!0===e?t.stop().fadeTo(0,0).hide():t.stop().fadeTo(P.slider_controls_appear_duration,0,function(){t.hide()}),A.isControlsVisible=!1)}function Z(e){if(0!=T.isTimePassed("sliderControlsToggle")){if(1==A.isControlsVisible)return 1;e=e||!1;var t=V();!0===e?t.stop().show():(t.stop().show().fadeTo(0,0),t.fadeTo(P.slider_controls_appear_duration,1)),A.isControlsVisible=!0}}function q(e){if(e!=A.currentControlsMode){switch(e){case"image":m&&m.getElement().show();break;case"video":m&&m.getElement().hide();break;default:throw new Error("wrong controld mode: "+e)}A.currentControlsMode=e}}function K(e,t,i){var n=v.getSelectedItem();f.setItem(n,!1,i);i=n.index;1==P.slider_video_autoplay&&setTimeout(function(){re(he(f.getCurrentSlide()))},500),E&&E.setActive(i),S&&0==A.isTextPanelSaparateHover&&G(),"image"==n.type?q("image"):q("video")}function J(e,t){v.selectItem(t)}function $(e){if(n&&0==n.isTapEventOccured(e))return!0;b.trigger(f.events.CLICK,e)}function ee(){var e=f.getCurrentSlide().hasClass("ug-slide-clickable"),t=f.getCurrentItem();if(e)return 0==P.slider_links_newpage?location.href=t.link:window.open(t.link,"_blank"),!0;0==P.slider_controls_always_on&&1==P.slider_controls_appear_ontap&&1==f.isCurrentSlideType("image")&&((0==A.isControlsVisible?Z:X)(),S&&1==P.slider_textpanel_always_on&&f.isCurrentSlideType("image")&&f.isCurrentSlideImageFit()&&G())}function te(e){S&&f.isCurrentSlideType("image")&&0==f.isCurrentSlideImageFit()&&D()}function ie(){Z()}function ne(){X()}function re(e){e=e.parent();f.startSlideAction(e)}function oe(){v.isPlayMode()&&v.pausePlaying(),b.trigger(f.events.ACTION_START)}function ae(){v.isPlayMode()&&v.continuePlaying(),b.trigger(f.events.ACTION_END)}function se(e,t,i){c.data("index")==t&&(objItem=v.getItem(t),H(c,objItem,!0)),_.data("index")==t&&(objItem=v.getItem(t),H(_,objItem,!0)),h.data("index")==t&&(objItem=v.getItem(t),H(h,objItem,!0))}function le(e,t){t=jQuery(t);var i=f.getSlideImage(t),n=he(t),t=T.getElementSize(i);T.placeElement(n,"center","middle",t.left,t.top,i)}function ue(e){e=he(e);T.addClassOnHover(e),T.setButtonOnClick(e,re)}function de(e){switch(e){case 1:return c;case 2:return _;case 3:return h;default:throw new Error("wrong num: "+e)}}function ce(e){var t=f.getSlidesReference().objCurrentSlide.data("index");return e.index<t?"right":"left"}function _e(e){return(e=e||f.getCurrentSlide()).children(".ug-slider-preloader")}function he(e){return e.children(".ug-button-videoplay")}function ge(e){e=(e=e||f.getCurrentSlide()).data("index");return null==e?null:v.getItem(e)}this.switchSlideNums=function(e){switch(b.trigger(f.events.BEFORE_SWITCH_SLIDES),e){case"left":var t=A.numCurrent;A.numCurrent=A.numNext,A.numNext=A.numPrev,A.numPrev=t;break;case"right":t=A.numCurrent;A.numCurrent=A.numPrev,A.numPrev=A.numNext,A.numNext=t;break;default:throw new Error("wrong direction: "+e)}b.trigger(f.events.ITEM_CHANGED)},this.destroy=function(){b.off(f.events.AFTER_PUT_IMAGE),r.off(v.events.ITEM_IMAGE_UPDATED),r.off(v.events.ITEM_CHANGE),E&&jQuery(E).on(E.events.BULLET_CLICK),u.off("mouseenter"),u.off("mouseleave"),u.off("touchend"),u.off("click"),b.off(f.events.CLICK),o&&b.off(f.events.ZOOM_CHANGE),b.off(f.events.BEFORE_SWITCH_SLIDES),jQuery(x).off(x.events.SHOW),jQuery(x).off(x.events.HIDE),x.destroy(),u.off("mouseenter",".ug-item-wrapper img"),u.off("mouseleave",".ug-item-wrapper img")},this.________EXTERNAL_GENERAL___________=function(){},this.init=function(e,t,i){s(e,t,i)},this.getSlideImage=function(e){return(e=e||f.getCurrentSlide()).find(".ug-item-wrapper img")},this.setHtml=function(e){t(e)},this.run=function(){e()},this.isInnerInPlace=function(){var e=f.getSlidesReference();return-T.getElementSize(e.objCurrentSlide).left==T.getElementSize(d).left},this.isAnimating=function(){return d.is(":animated")},this.isSlideCurrent=function(e){e=e.data("slidenum");return A.numCurrent==e},this.isSlideHasItem=function(e){e=e.data("index");return null!=e},this.getObjImagePadding=function(){return{padding_top:P.slider_image_padding_top,padding_bottom:P.slider_image_padding_bottom,padding_left:P.slider_image_padding_left,padding_right:P.slider_image_padding_right}},this.getSlidesReference=function(){return{objPrevSlide:de(A.numPrev),objNextSlide:de(A.numNext),objCurrentSlide:de(A.numCurrent)}},this.getCurrentSlide=function(){return f.getSlidesReference().objCurrentSlide},this.getCurrentItemIndex=function(){var e=f.getSlidesReference().objCurrentSlide.data("index");return null==e&&(e=-1),e},this.getCurrentItem=function(){var e=f.getCurrentItemIndex();return-1==e?null:v.getItem(e)},this.getSlideType=function(e){return null==e&&(e=f.getCurrentSlide()),e.data("type")},this.isMouseInsideSlideImage=function(e){var t=f.getSlideImage(),e=T.getMousePosition(e);void 0===e.pageX&&(e=n.getLastMousePos());e=T.getMouseElementPoint(e,t),t=T.getElementSize(t);return T.isPointInsideElement(e,t)},this.isCurrentSlideType=function(e){return f.getSlideType()==e},this.isCurrentSlideLoadingImage=function(){return!0===f.getCurrentSlide().data("isLoading")},this.setItem=function(e,t,i){var n=f.getSlidesReference(),r=n.objCurrentSlide.data("index"),o=e.index;if(o==r)return!0;null==r?(R(n.objCurrentSlide,e),f.placeNabourItems()):(n="left",v.getNumItems(),"next"==i?n="left":("prev"==i||o<r||o<r)&&(n="right"),W(n,e,t))},this.placeNabourItems=function(){var e=f.getSlidesReference(),t=e.objCurrentSlide.data("index"),i=v.getPrevItem(t),t=v.getNextItem(t);R(e.objNextSlide,t),R(e.objPrevSlide,i),O()},this.________EXTERNAL_API___________=function(){},this.stopSlideAction=function(e,t){e=e||f.getCurrentSlide(),!0===t?x.pause():x.hide()},this.startSlideAction=function(e){var t=ge(e=e||f.getCurrentSlide());if("image"==t.type)return!0;1==P.slider_video_constantsize&&F(),B(),x.show();var i=P.slider_video_muted;switch(t.type){case"youtube":x.playYoutube(t.videoid,!0,t.video_start),1==i&&setTimeout(function(){x.muteVideoYoutube()},300);break;case"vimeo":x.playVimeo(t.videoid),1==i&&setTimeout(function(){x.muteVideoVimeo()},300);break;case"html5video":x.playHtml5Video(t.videoogv,t.videowebm,t.videomp4,t.urlImage),1==i&&setTimeout(function(){x.muteVideoHtml5()},300);break;case"soundcloud":x.playSoundCloud(t.trackid);break;case"wistia":x.playWistia(t.videoid),1==i&&setTimeout(function(){x.muteVideoWistia()},300);break;case"iframe":x.playIframe(t.videoUrl)}},this.getScaleMode=function(e){return e=e||f.getCurrentSlide(),"image"!=f.getSlideType(e)?P.slider_scale_mode_media:P.slider_scale_mode!=P.slider_scale_mode_fullscreen&&1==v.isFullScreen()?P.slider_scale_mode_fullscreen:P.slider_scale_mode},this.getObjects=function(){return{g_objSlider:u,g_objInner:d,g_options:P,g_objZoomSlider:o}},this.getObjZoom=function(){return o},this.getOptions=function(){return P},this.getElement=function(){return u},this.getVideoObject=function(){return x},this.isCurrentSlideImageFit=function(){var e=f.getCurrentSlide();f.getSlideType(e);!function(e,t){if(null==t&&(t=f.getCurrentSlide()),(t=f.getSlideType(t))!=e)throw new Error("Wrong slide type: "+t+", should be: "+e)}("image",e);e=f.getSlideImage(e);return 0!=e.length&&T.isImageFitParent(e)},this.isCurrentImageInPlace=function(){var e=f.getSlideImage();if(0==e.length)return!1;var t=f.getScaleMode(),i=f.getObjImagePadding(),n=ge(),r=e.parent(),t=T.getImageInsideParentData(r,n.imageWidth,n.imageHeight,t,i),i=T.getElementSize(e),e=!1;return t.imageWidth==i.width&&(e=!0),e},this.isSlideActionActive=function(){return x.isVisible()},this.isSwiping=function(){return!!n&&n.isTouchActive()},this.isPreloading=function(){return!!_e().is(":visible")},this.setOptions=function(e){a&&(e=T.convertCustomPrefixOptions(e,a,"slider")),P=jQuery.extend(P,e)},this.setSize=function(e,t){if(e<0||t<0)return!0;var i={};i.width=e+"px",i.height=t+"px",u.css(i);var n={};n.height=t+"px",n.top="0px",n.left="0px",d.css(n);var r={};r.height=t+"px",r.width=e+"px",c.css(r),_.css(r),h.css(r);i=e-P.slider_item_padding_left-P.slider_item_padding_right,n=t-P.slider_item_padding_top-P.slider_item_padding_bottom,r={};r.width=i+"px",r.height=n+"px",r.top=P.slider_item_padding_top+"px",r.left=P.slider_item_padding_left+"px",u.find(".ug-item-wrapper").css(r),S&&S.setSizeByParent(),M(),k(c),k(_),k(h),O(),"image"!=f.getSlideType()&&1==P.slider_video_constantsize?F():(e=e-P.slider_video_padding_left-P.slider_video_padding_right,t=t-P.slider_video_padding_top-P.slider_video_padding_bottom,x.setSize(e,t)),B()},this.refreshSlideItems=function(){if(1==f.isAnimating())return!0;k(c),k(_),k(h),O()},this.isMouseOver=function(){return u.ismouseover()},this.setPosition=function(e,t){T.placeElement(u,e,t)},this.zoomIn=function(){if(!o)return!0;o.zoomIn()},this.zoomOut=function(){if(!o)return!0;o.zoomOut()},this.zoomBack=function(){if(!o)return!0;o.zoomBack()}}function UGTextPanel(){var r,n,o,a,s,l,u,d=this,c=new UGFunctions,_="",h={textpanel_align:"bottom",textpanel_margin:0,textpanel_text_valign:"middle",textpanel_padding_top:10,textpanel_padding_bottom:10,textpanel_height:null,textpanel_padding_title_description:5,textpanel_padding_right:11,textpanel_padding_left:11,textpanel_fade_duration:200,textpanel_enable_title:!0,textpanel_enable_description:!0,textpanel_title_as_link:!1,textpanel_title_link_newtab:!0,textpanel_enable_bg:!0,textpanel_bg_color:"#000000",textpanel_bg_opacity:.4,textpanel_title_color:null,textpanel_title_font_family:null,textpanel_title_text_align:null,textpanel_title_font_size:null,textpanel_title_bold:null,textpanel_css_title:{},textpanel_desc_color:null,textpanel_desc_font_family:null,textpanel_desc_text_align:null,textpanel_desc_font_size:null,textpanel_desc_bold:null,textpanel_css_description:{},textpanel_desc_style_as_title:!1,textpanel_bg_css:{}},g={isFirstTime:!0,setInternalHeight:!0,lastTitleBottom:0,lastDescHeight:0};function i(e,t){var i=t=t||h.textpanel_padding_top;o&&(c.placeElement(o,0,i),1==o.is(":visible")?0<(i=c.getElementSize(o).bottom)&&(g.lastTitleBottom=i):(i=20,0<g.lastTitleBottom&&(i=g.lastTitleBottom)));var n,t="";a&&(t=jQuery.trim(a.text())),""!=t&&(t=i,o&&(t+=h.textpanel_padding_title_description),c.placeElement(a,0,t),1==jQuery(a).is(":visible")?(i=(n=c.getElementSize(a)).bottom,0<n.height&&(g.lastDescHeight=n.height)):(n=16,0<g.lastDescHeight&&(n=g.lastDescHeight),i=t+n)),h.textpanel_height||1!=g.setInternalHeight||(i=i+h.textpanel_padding_bottom,i=i,1==(e=(e=e)||!1)?(s&&s.height()<i&&s.height(i),e={height:i+"px"},r.add(l).animate(e,h.textpanel_fade_duration)):(s&&s.height(i),r.add(l).height(i)))}function p(){var e,t=0;return o&&(t+=o.outerHeight()),a&&(e="",a&&(e=jQuery.trim(a.text())),""!=e&&(o&&(t+=h.textpanel_padding_title_description),t+=a.outerHeight())),t}function m(){var e,t;1==h.textpanel_enable_bg&&((s=r.children(".ug-textpanel-bg")).fadeTo(0,h.textpanel_bg_opacity),e={"background-color":h.textpanel_bg_color},e=jQuery.extend(e,h.textpanel_bg_css),s.css(e)),1==h.textpanel_enable_title&&(o=l.children(".ug-textpanel-title"),t={},null!==h.textpanel_title_color&&(t.color=h.textpanel_title_color),null!==h.textpanel_title_font_family&&(t["font-family"]=h.textpanel_title_font_family),null!==h.textpanel_title_text_align&&(t["text-align"]=h.textpanel_title_text_align),null!==h.textpanel_title_font_size&&(t["font-size"]=h.textpanel_title_font_size+"px"),null!==h.textpanel_title_bold&&(!0===h.textpanel_title_bold?t["font-weight"]="bold":t["font-weight"]="normal"),h.textpanel_css_title&&(t=jQuery.extend(t,h.textpanel_css_title)),o.css(t)),1==h.textpanel_enable_description&&(a=l.children(".ug-textpanel-description"),t={},null!==h.textpanel_desc_color&&(t.color=h.textpanel_desc_color),null!==h.textpanel_desc_font_family&&(t["font-family"]=h.textpanel_desc_font_family),null!==h.textpanel_desc_text_align&&(t["text-align"]=h.textpanel_desc_text_align),null!==h.textpanel_desc_font_size&&(t["font-size"]=h.textpanel_desc_font_size+"px"),null!==h.textpanel_desc_bold&&(!0===h.textpanel_desc_bold?t["font-weight"]="bold":t["font-weight"]="normal"),h.textpanel_css_title&&(t=jQuery.extend(t,h.textpanel_css_description)),a.css(t))}function e(){var e=u.getSelectedItem();d.setText(e.title,e.description,e.link)}this.positionElements=function(e){if(!h.textpanel_height||"top"==h.textpanel_text_valign)return i(e),!1;switch(h.textpanel_text_valign){default:case"top":i(!1);break;case"bottom":t=p(),i(!1,l.height()-t-h.textpanel_padding_bottom);break;case"center":case"middle":t=p(),i(!1,(l.height()-t)/2)}var t},this.init=function(e,t,i){if(u=e,i&&(_=i,t=c.convertCustomPrefixOptions(t,_,"textpanel")),t&&(h=jQuery.extend(h,t)),0==h.textpanel_enable_title&&0==h.textpanel_enable_description)throw new Error("Textpanel Error: The title or description must be enabled");h.textpanel_height&&h.textpanel_height<0&&(h.textpanel_height=null),1==h.textpanel_desc_style_as_title&&(h.textpanel_desc_color||(h.textpanel_desc_color=h.textpanel_title_color),h.textpanel_desc_bold||(h.textpanel_desc_bold=h.textpanel_title_bold),h.textpanel_desc_font_family||(h.textpanel_desc_font_family=h.textpanel_title_font_family),h.textpanel_desc_font_size||(h.textpanel_desc_font_size=h.textpanel_title_font_size),h.textpanel_desc_text_align||(h.textpanel_desc_text_align=h.textpanel_title_text_align))},this.appendHTML=function(e,t){n=e;var i="<div class='ug-textpanel"+(t=t?" "+t:"")+"'>";1==h.textpanel_enable_bg&&(i+="<div class='ug-textpanel-bg"+t+"'></div>"),i+="<div class='ug-textpanel-textwrapper"+t+"'>",1==h.textpanel_enable_title&&(i+="<div class='ug-textpanel-title"+t+"'></div>"),1==h.textpanel_enable_description&&(i+="<div class='ug-textpanel-description"+t+"'></div>"),i+="</div></div>",e.append(i),r=e.children(".ug-textpanel"),l=r.children(".ug-textpanel-textwrapper"),m()},this.destroy=function(){jQuery(u).off(u.events.ITEM_CHANGE)},this.run=function(){d.setSizeByParent(),jQuery(u).on(u.events.ITEM_CHANGE,e)},this.setPanelSize=function(e,t){g.setInternalHeight=!0,t?g.setInternalHeight=!1:t=80,h.textpanel_height&&(t=h.textpanel_height),r.width(e),r.height(t),s&&(s.width(e),s.height(t));var i=e-h.textpanel_padding_left-h.textpanel_padding_right,e=h.textpanel_padding_left;c.setElementSizeAndPosition(l,e,0,i,t),o&&o.width(i),a&&a.width(i),0==g.isFirstTime&&d.positionElements(!1)},this.setSizeByParent=function(){var e=c.getElementSize(n);d.setPanelSize(e.width)},this.setTextPlain=function(e,t,i){var n;1==h.textpanel_title_as_link&&e&&i&&(n="",1==h.textpanel_title_link_newtab&&(n+=' target="blank"'),e='<a class="ug-textpanel-link" href="'+i+'" '+n+">"+e+"</a>"),o&&o.html(e),a&&a.html(t)},this.setText=function(e,t,i){1==g.isFirstTime?(d.setTextPlain(e,t,i),g.isFirstTime=!1,d.positionElements(!1)):l.stop().fadeTo(h.textpanel_fade_duration,0,function(){d.setTextPlain(e,t,i),d.positionElements(!0),jQuery(this).fadeTo(h.textpanel_fade_duration,1)})},this.positionPanel=function(e,t){var i={};if(null!=e)i.top=e,i.bottom="auto";else switch(h.textpanel_align){case"top":i.top=h.textpanel_margin+"px";break;case"bottom":i.top="auto",i.bottom=h.textpanel_margin+"px";break;case"middle":i.top=c.getElementRelativePos(r,"middle",h.textpanel_margin)}null!=t&&(i.left=t),r.css(i)},this.setOptions=function(e){_&&(e=c.convertCustomPrefixOptions(e,_,"textpanel")),h=jQuery.extend(h,e)},this.getElement=function(){return r},this.getSize=function(){return c.getElementSize(r)},this.refresh=function(e,t,i,n){m(),i?d.setPanelSize(i,n):d.setSizeByParent(),d.positionElements(!1),!0!==t&&d.positionPanel(),!0===e&&d.show()},this.hide=function(){r.hide()},this.show=function(){r.show()},this.getOptions=function(){return h},this.getOption=function(e){return 0==h.hasOwnProperty(e)?null:h[e]}}function UGZoomButtonsPanel(){var a,s,l,u,i=new UGSlider,e=new UGFunctions,d={slider_zoompanel_skin:"",slider_zoom_icons_color:"#ffffff",slider_zoom_icons_type:"default",slider_zoom_icon_plus:"",slider_zoom_icon_minus:"",slider_zoom_icon_return:""};function t(e){return!e||!!e.hasClass("ug-zoompanel-button-disabled")}function n(e){e&&e.addClass("ug-zoompanel-button-disabled")}function r(e){e&&e.removeClass("ug-zoompanel-button-disabled")}function o(){if(0==i.isCurrentSlideType("image"))return!0;1==i.isCurrentSlideImageFit()?0==t(l)&&(n(l),n(u)):1==t(l)&&(r(l),r(u))}this.init=function(e,t){i=e,t&&(d=jQuery.extend(d,t))},this.appendHTML=function(e){0;var t,i,n,r="<div class='ug-slider-control ug-zoompanel ug-skin-"+d.slider_zoompanel_skin+"'>",o="";"custom"==d.slider_zoom_icons_type&&(t=d.slider_zoom_icon_plus,i=d.slider_zoom_icon_minus,n=d.slider_zoom_icon_return,o="ug-zoompanel-button-custom"),"default"==d.slider_zoom_icons_type&&(t='<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23" fill="none" style="fill:none"><path d="M7 11.5H11.5M16 11.5H11.5M11.5 11.5V7V16M0.5 0.5H22.5V22.5H0.5V0.5Z" stroke="white"/></svg>',i='<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23" fill="none" style="fill:none"><path d="M9 11.5H14M0.5 0.5H22.5V22.5H0.5V0.5Z" stroke="white"/></svg>',n='<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23" fill="none" style="fill:none"><path d="M7.5 9L6 11H8.5H9L7.5 9ZM7.5 9V15H13M16.5 14.5L18 12.5H15L16.5 14.5ZM16.5 14.5V8.5H11M0.5 0.5H22.5V22.5H0.5V0.5Z" stroke="white"/></svg>'),r+='<div class="ug-zoompanel-button '+o+' ug-zoompanel-plus">'+t+"</div>",r+='<div class="ug-zoompanel-button '+o+' ug-zoompanel-minus ug-zoompanel-button-disabled">'+i+"</div>",r+='<div class="ug-zoompanel-button '+o+' ug-zoompanel-return ug-zoompanel-button-disabled">'+n+"</div>",r+="</div>",e.append(r),a=e.children(".ug-zoompanel"),s=a.children(".ug-zoompanel-plus"),l=a.children(".ug-zoompanel-minus"),u=a.children(".ug-zoompanel-return"),"default"==d.slider_zoom_icons_type&&a.find("svg path").css("stroke",d.slider_zoom_icons_color)},this.setObjects=function(e,t,i){s=e,u=i,(l=t)&&l.addClass("ug-zoompanel-button-disabled"),u&&u.addClass("ug-zoompanel-button-disabled")},this.getElement=function(){return a},this.initEvents=function(){e.addClassOnHover(s,"ug-button-hover"),e.addClassOnHover(l,"ug-button-hover"),e.addClassOnHover(u,"ug-button-hover"),e.setButtonOnClick(s,function(){return 1==t(s)||void i.zoomIn()}),e.setButtonOnClick(l,function(){return 1==t(l)||void i.zoomOut()}),e.setButtonOnClick(u,function(){return 1==t(u)||void i.zoomBack()}),jQuery(i).on(i.events.ZOOM_CHANGE,o),jQuery(i).on(i.events.ITEM_CHANGED,o)}}function UGBullets(){var r,o,t=this,a=0,n=new UniteGalleryMain,i=new UGFunctions,s={isInited:!1},l={bullets_size:"",bullets_color:"",bullets_color_reverse:!1,bullets_addclass:"",bullets_space_between:-1};function u(){var e="",t="";-1!=l.bullets_space_between&&(t=" style='margin-left:"+l.bullets_space_between+"px'");for(var i,n=0;n<a;n++)e+=0==n?"<div class='ug-bullet'></div>":"<div class='ug-bullet'"+t+"></div>";r.html(e),o||(i=r.find(".ug-bullet:first-child")).length&&(o=i.width()),""!=l.bullets_size&&r.children(".ug-bullet").css({width:l.bullets_size+"px",height:l.bullets_size+"px"})}function d(e){if(1==t.isActive(e))return!0;e=e.index();jQuery(t).trigger(t.events.BULLET_CLICK,e)}function c(){var e=r.children(".ug-bullet");i.setButtonOnClick(e,d),e.on("mousedown mouseup",function(e){return!1})}function _(e){if(e<0||a<=e)throw new Error("wrong bullet index: "+e)}function h(){if(1==s.isInited)return 1;throw new Error("The bullets are not inited!")}this.events={BULLET_CLICK:"bullet_click"},this.init=function(e,t,i){n=e,a=i||n.getNumItems(),s.isInited=!0,l=jQuery.extend(l,t)},this.getBulletsWidth=function(){return 0!=a&&o?a*o+(a-1)*l.bullets_space_between:0},this.appendHTML=function(e){h();var t="";""!=l.bullets_addclass&&(t=" "+l.bullets_addclass);t="<div class='ug-slider-control ug-bullets ug-skin-"+t+"'>";t+="</div>",r=jQuery(t),e.append(r),u(),c()},this.updateNumBullets=function(e){a=e,u(),c()},this.getElement=function(){return r},this.setActive=function(e){h(),_(e);var t=r.children(".ug-bullet");t.removeClass("ug-bullet-active");t=jQuery(t[e]);if(t.addClass("ug-bullet-active"),!t.hasClass("ug-bullet-active"))return!1;!function(e){if(1==l.bullets_color_reverse){if(""!=l.bullets_color)return r.children(".ug-bullet").css({"background-color":l.bullets_color,"border-color":l.bullets_color}),e.css({"background-color":"transparent"});var t=e.css("background-color");return r.children(".ug-bullet").css({"background-color":t,"border-color":t}),e.css({"background-color":"transparent"})}""!=l.bullets_color&&(r.children(".ug-bullet").css({"background-color":"","border-color":l.bullets_color}),e.css({"background-color":l.bullets_color}))}(t)},this.isActive=function(e){return _(e),!!("number"!=typeof e?e:r.children(".ug-bullet")[e]).hasClass("ug-bullet-active")},this.getNumBullets=function(){return a}}function UGProgressBar(){var r,i,n=this,t=0,o=new UGFunctions,a={slider_progressbar_color:"#ffffff",slider_progressbar_opacity:.6,slider_progressbar_line_width:5};this.put=function(e,t){t&&(a=jQuery.extend(a,t)),e.append("<div class='ug-progress-bar'><div class='ug-progress-bar-inner'></div></div>"),r=e.children(".ug-progress-bar"),(i=r.children(".ug-progress-bar-inner")).css("background-color",a.slider_progressbar_color),r.height(a.slider_progressbar_line_width),i.height(a.slider_progressbar_line_width),i.width("0%");t=a.slider_progressbar_opacity,e=i[0];e.style.opacity=t,e.style.filter="alpha(opacity="+100*t+")"},this.putHidden=function(e,t){n.put(e,t),r.hide()},this.getElement=function(){return r},this.setSize=function(e){r.width(e),i.width(e),n.draw()},this.setPosition=function(e,t,i,n){o.placeElement(r,e,t,i,n)},this.draw=function(){var e=100*t;i.width(e+"%")},this.setProgress=function(e){t=o.normalizePercent(e),n.draw()},this.getType=function(){return"bar"}}function UGProgressPie(){var s,i=this,l=!1,n=new UGFunctions,u={slider_progresspie_type_fill:!1,slider_progresspie_color1:"#B5B5B5",slider_progresspie_color2:"#E5E5E5",slider_progresspie_stroke_width:6,slider_progresspie_width:30,slider_progresspie_height:30};function r(e){e=e||0;var t=Math.min(u.slider_progresspie_width,u.slider_progresspie_height)/2,i=s[0].getContext("2d");0==l&&(l=!0,i.rotate(1.5*Math.PI),i.translate(-2*t,0)),i.clearRect(0,0,u.slider_progresspie_width,u.slider_progresspie_height);var n=u.slider_progresspie_width/2,r=u.slider_progresspie_height/2,o=0,a=e*Math.PI*2;1==u.slider_progresspie_type_fill?(i.beginPath(),i.moveTo(n,r),i.arc(n,r,t,o,a)):(i.globalCompositeOperation="source-over",i.beginPath(),i.moveTo(n,r),i.arc(n,r,t,o,a),i.lineTo(n,r),i.fillStyle=u.slider_progresspie_color1,i.fill(),i.closePath(),i.globalCompositeOperation="destination-out",e=t-u.slider_progresspie_stroke_width,i.beginPath(),i.moveTo(n,r),i.arc(n,r,e,o,a)),i.lineTo(n,r),i.fillStyle=u.slider_progresspie_color1,i.fill(),i.closePath(),1==u.slider_progresspie_type_fill&&(o=a,a=2*Math.PI,i.beginPath(),i.arc(n,r,t,o,a),i.lineTo(n,r),i.fillStyle=u.slider_progresspie_color2,i.fill(),i.closePath())}this.put=function(e,t){t&&(u=jQuery.extend(u,t)),e.append("<canvas class='ug-canvas-pie' width='"+u.slider_progresspie_width+"' height='"+u.slider_progresspie_height+"'></canvas>"),s=e.children(".ug-canvas-pie")},this.putHidden=function(e,t){i.put(e,t),r(.1),s.hide()},this.getElement=function(){return s},this.setPosition=function(e,t){n.placeElement(s,e,t)},this.getSize=function(){return{width:u.slider_progresspie_width,height:u.slider_progresspie_height}},this.setProgress=function(e){e=n.normalizePercent(e),r(e)},this.getType=function(){return"pie"}}function UGTouchSliderControl(){var r,o,a,i,s=new UGSlider,l=new UGFunctions,u={slider_transition_continuedrag_speed:250,slider_transition_continuedrag_easing:"linear",slider_transition_return_speed:300,slider_transition_return_easing:"easeInOutQuad"},d={touch_active:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startPosx:0,startTime:0,isInitDataValid:!1,slides:null,lastNumTouches:0,isDragging:!1,storedEventID:"touchSlider",videoStartX:0,isDragVideo:!1,videoObject:null};function c(e){return e=e||s.getSlidesReference(),-l.getElementSize(e.objCurrentSlide).left-l.getElementSize(o).left}function _(e){var r;1!=s.isInnerInPlace()&&(a.trigger(s.events.BEFORE_RETURN),e=e||s.getSlidesReference(),r=-l.getElementSize(e.objCurrentSlide).left,o.animate({left:r+"px"},{duration:u.slider_transition_return_speed,easing:u.slider_transition_continuedrag_easing,queue:!1,progress:function(e,t,i){var n;1==d.isDragVideo&&(n=l.getElementSize(o).left-r,n=d.videoStartX+n,d.videoObject.css("left",n))},complete:function(){a.trigger(s.events.AFTER_RETURN)}}))}function h(){var e=s.getSlidesReference(),t=c(e);if(0!=t){var i,n=0<t?"left":"right",r=!1;switch(n){case"right":s.isSlideHasItem(e.objPrevSlide)?i=-l.getElementSize(e.objPrevSlide).left:r=!0;break;case"left":s.isSlideHasItem(e.objNextSlide)?i=-l.getElementSize(e.objNextSlide).left:r=!0}1==r?_(e):o.stop().animate({left:i+"px"},{duration:u.slider_transition_continuedrag_speed,easing:u.slider_transition_continuedrag_easing,queue:!1,progress:function(){var e;1==d.isDragVideo&&(e=l.getElementSize(o).left-d.startPosx,e=d.videoStartX+e,d.videoObject.css("left",e))},always:function(){var e;e=n,s.getVideoObject().hide(),s.switchSlideNums(e),s.placeNabourItems(),a.trigger(s.events.AFTER_DRAG_CHANGE)}})}}function g(e){var t=l.getMousePosition(e);d.startMouseX=t.pageX,d.startMouseY=t.pageY,d.lastMouseX=d.startMouseX,d.lastMouseY=d.startMouseY,d.startTime=jQuery.now();t=l.getArrTouches(e);d.startArrTouches=l.getArrTouchPositions(t);t=l.getElementSize(o);d.startPosx=t.left,d.isInitDataValid=!0,d.isDragVideo=!1,l.storeEventData(e,d.storedEventID)}function p(){d.touch_active=!1}function m(e,t){d.touch_active=!0,g(t)}function n(e){return e.preventDefault(),d.isDragging=!1,1==s.isAnimating()&&o.stop(!0,!0),1<l.getArrTouches(e).length?(1==d.touch_active&&p(),!0):1==d.touch_active||void m(0,e)}function f(e){if(0==d.touch_active)return!0;if(0==e.buttons)return p(),h(),!0;l.updateStoredEventData(e,d.storedEventID);var t=l.getMousePosition(e);d.lastMouseX=t.pageX,d.lastMouseY=t.pageY;t=null;1==u.slider_vertical_scroll_ondrag&&(t=l.handleScrollTop(d.storedEventID)),"vert"!==t&&function(e){var t=d.lastMouseX-d.startMouseX;if(0!=t){var i=t<0?"left":"right",n=s.getObjZoom();if(n){if(1==n.isPanEnabled(e,i))return d.isInitDataValid=!1;if(0==d.isInitDataValid)return g(e)}e=d.startPosx+t,0<t&&0<e?e/=3:t<0&&e+o.width()<r.width()&&(e=d.startPosx+t/3),0==d.isDragging&&(d.isDragging=!0,a.trigger(s.events.START_DRAG)),o.css("left",e+"px"),1==d.isDragVideo&&(e=e-d.startPosx,e=d.videoStartX+e,d.videoObject.css("left",e))}}(e)}function b(e){var t,i,n,r=l.getArrTouches(e).length;if(1==s.isInnerInPlace()&&0==d.touch_active&&0==r)return!0;0==r&&1==d.touch_active?(p(),t=!1,0==l.wasVerticalScroll(d.storedEventID)&&(i=c(n=s.getSlidesReference()),n=Math.round(3*n.objCurrentSlide.width()/8),t=Math.abs(i)>=n||(n=Math.abs(d.lastMouseX-d.startMouseX),Math.abs(d.lastMouseY-d.startMouseY),!(n<20)&&jQuery.now()-d.startTime<500)),(1==t?h:_)()):1==r&&0==d.touch_active&&m(0,e)}this.isTapEventOccured=function(e){var t=l.getArrTouches(e).length;if(0!=t||0!=d.lastNumTouches)return d.lastNumTouches=t,!1;d.lastNumTouches=t;c(s.getSlidesReference());var i=Math.abs(d.lastMouseX-d.startMouseX),e=Math.abs(d.lastMouseY-d.startMouseY),t=jQuery.now()-d.startTime;return i<20&&e<50&&t<500},this.init=function(e,t){s=e,a=jQuery(s),i=e.getObjects(),r=i.g_objSlider,o=i.g_objInner,u=jQuery.extend(u,t),r.bind("mousedown touchstart",n),jQuery("body").bind("mousemove touchmove",f),jQuery(window).add("body").bind("mouseup touchend",b)},this.getLastMousePos=function(){return{pageX:d.lastMouseX,pageY:d.lastMouseY}},this.isTouchActive=function(){return d.touch_active}}function UGZoomSliderControl(){var i,s,n,l=new UGSlider,u=new UGFunctions,d={slider_zoom_step:1.2,slider_zoom_max_ratio:6,slider_zoom_return_pan_duration:400,slider_zoom_return_pan_easing:"easeOutCubic"},c={isPanActive:!1,startMouseX:0,startMouseY:0,lastMouseX:0,lastMouseY:0,startImageX:0,startImageY:0,panXActive:!1,panYActive:!1,objImage:null,objImageSize:null,objParent:null,objParentSize:null,objSlide:null,storeImageLastTime:0,isZoomActive:!1,startDistance:0,startMiddlePoint:null,imageOrientPoint:null,objFitImageSize:null,isZoomedOnce:!1};function r(e,t){l=e,s=jQuery(l),n=e.getObjects(),i=n.g_objSlider,n.g_objInner,d=jQuery.extend(d,t),i.on("mousewheel",w),i.bind("mousedown touchstart",b),jQuery("body").bind("mousemove touchmove",y),jQuery(window).add("body").bind("mouseup touchend",v),s.bind(l.events.BEFORE_RETURN,function(){f()}),s.bind(l.events.ITEM_CHANGED,function(){c.isZoomedOnce=!1}),s.bind(l.events.ZOOM_CHANGE,function(){c.isZoomedOnce=!0})}function _(){var e=l.getScaleMode();return"down"!=e&&(e="fit"),e}function o(){if((i=jQuery.now())-c.storeImageLastTime<20)return!1;var e=l.getSlidesReference();if(c.objSlide=e.objCurrentSlide,c.objImage=e.objCurrentSlide.find("img"),0==c.objImage.length)return!1;c.objImageSize=u.getElementSize(c.objImage),c.objParent=c.objImage.parent(),c.objParentSize=u.getElementSize(c.objParent);var t=_(),e=l.getObjImagePadding();c.objFitImageSize=u.getImageInsideParentDataByImage(c.objImage,t,e);var i=jQuery.now();return c.storeImageLastTime=i,!0}function a(e,t){var i=l.getSlidesReference().objCurrentSlide.find("img"),n=_();s.trigger(l.events.ZOOM_START);var r,o=!0,a=l.getObjImagePadding();"back"==e?(r=u.getImageOriginalSize(i),u.scaleImageFitParent(i,r.width,r.height,n,a)):(e="in"==e,o=u.zoomImageInsideParent(i,e,d.slider_zoom_step,t,n,d.slider_zoom_max_ratio,a)),1==o&&(s.trigger(l.events.ZOOMING),s.trigger(l.events.ZOOM_CHANGE),s.trigger(l.events.ZOOM_END))}function h(e,t,i){t=u.getArrTouches(t);if(!0===i){if(1!=t.length)return!1}else if(1<t.length)return!1;return!!u.isElementBiggerThenParent(e)}function g(e){c.isPanActive=!0,e=e,e=u.getMousePosition(e),c.startMouseX=e.pageX,c.startMouseY=e.pageY,c.lastMouseX=c.startMouseX,c.lastMouseY=c.startMouseY,c.startImageX=c.objImageSize.left,c.startImageY=c.objImageSize.top,c.panXActive=c.objImageSize.width>c.objParentSize.width,c.panYActive=c.objImageSize.height>c.objParentSize.height}function p(e){0!=c.isZoomActive&&2!=u.getArrTouches(e).length&&(c.isZoomActive=!1,s.trigger(l.events.ZOOM_END))}function m(e){if(1==c.isZoomActive)return 1;e=u.getArrTouches(e);if(2!=e.length)return 1;e=e,c.isZoomActive=!0,c.startDistance=u.getDistance(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),0==c.startDistance&&(c.startDistance=1),c.startMiddlePoint=u.getMiddlePoint(e[0].pageX,e[0].pageY,e[1].pageX,e[1].pageY),c.objImageSize=u.getElementSize(c.objImage),c.startImageX=c.objImageSize.left,c.startImageY=c.objImageSize.top,c.imageOrientPoint=u.getElementLocalPoint(c.startMiddlePoint,c.objImage),0==u.isPointInsideElement(c.imageOrientPoint,c.objImageSize)&&(c.imageOrientPoint=u.getElementCenterPoint(c.objImage)),s.trigger(l.events.ZOOM_START)}function f(){if(null==c.objImage||0==c.objImage.length)return 1;var e,t,i,n,r,o;u.getElementSize(c.objImage).width<c.objFitImageSize.imageWidth?(c.objImage.css({position:"absolute",margin:"none"}),o={top:c.objFitImageSize.imageTop+"px",left:c.objFitImageSize.imageLeft+"px",width:c.objFitImageSize.imageWidth+"px",height:c.objFitImageSize.imageHeight+"px"},c.objImage.animate(o,{duration:d.slider_zoom_return_pan_duration,easing:d.slider_zoom_return_pan_easing,queue:!1})):(t=e=!1,n=i=0,r=u.getElementSize(c.objImage),o=l.getObjImagePadding(),o=u.getElementCenterPosition(c.objImage,o),c.panXActive=c.objImageSize.width>c.objParentSize.width,c.panYActive=c.objImageSize.height>c.objParentSize.height,1==c.panYActive?0<r.top?t=!(n=0):r.bottom<c.objParentSize.height&&(n=c.objParentSize.height-r.height,t=!0):r.top!=o.top&&(t=!0,n=o.top),1==c.panXActive?0<r.left?e=!(i=0):r.right<c.objParentSize.width&&(i=c.objParentSize.width-r.width,e=!0):r.left!=o.left&&(e=!0,i=o.left),o={},1==t&&(o.top=n+"px"),1==e&&(o.left=i+"px"),1!=t&&1!=e||c.objImage.animate(o,{duration:d.slider_zoom_return_pan_duration,easing:d.slider_zoom_return_pan_easing,queue:!1}))}function b(e){if(0==l.isCurrentSlideType("image"))return!0;o();if(null==c.objImage||0==c.objImage.length)return!0;e.preventDefault(),1==!(!c.objImage||!c.objImage.is(":animated"))&&c.objImage.stop(!0),(1==c.isZoomActive?p:m)(e),1==c.isZoomActive?c.isPanActive=!1:1==h(c.objImage,e)&&1==c.isZoomedOnce&&g(e)}function v(e){if(0==l.isCurrentSlideType("image"))return!0;if(1==jQuery(e.target).data("ug-button"))return!1;o();if(null==c.objImage||0==c.objImage.length)return!0;var t,i=c.isPanActive,n=c.isZoomActive;if(0==l.isInnerInPlace())return c.isZoomActive=!1,!(c.isPanActive=!1);(1==c.isZoomActive?p:m)(e),1==c.isZoomActive?c.isPanActive=!1:(t=h(c.objImage,e,!0),1==c.isPanActive?c.isPanActive=!1:1==t&&g(e)),(i||n)&&0==c.isZoomActive&&0==c.isPanActive&&f()}function y(e){if(0==l.isCurrentSlideType("image"))return!0;var t,i,n,r,o,a;1==c.isZoomActive?(t=e,i=u.getArrTouches(t),n=u.getDistance(i[0].pageX,i[0].pageY,i[1].pageX,i[1].pageY)/c.startDistance,r=u.getMiddlePoint(i[0].pageX,i[0].pageY,i[1].pageX,i[1].pageY),o=c.objImageSize.width*n,a=c.objImageSize.height*n,t=u.getImageOriginalSize(c.objImage),i=1,0<t.width&&(i=o/t.width),i>d.slider_zoom_max_ratio||(panX=-(c.imageOrientPoint.x*n-c.imageOrientPoint.x),panY=-(c.imageOrientPoint.y*n-c.imageOrientPoint.y),n=r.x-c.startMiddlePoint.x,r=r.y-c.startMiddlePoint.y,n=c.startImageX+panX+n,r=c.startImageY+panY+r,u.setElementSizeAndPosition(c.objImage,n,r,o,a),s.trigger(l.events.ZOOMING),s.trigger(l.events.ZOOM_CHANGE))):1==c.isPanActive&&(n=e,null!=c.objImage&&0!=c.objImage.length&&((r=u.getMousePosition(n)).pageX,c.startMouseX,r.pageY,c.startMouseY,o=r.pageX-c.lastMouseX,a=r.pageY-c.lastMouseY,e=o<0?"left":"right",n=a<0?"up":"down",c.lastMouseX=r.pageX,c.lastMouseY=r.pageY,r=u.getElementSize(c.objImage),0==c.panYActive?a=0:("down"==n&&0<r.top||"up"==n&&r.bottom<c.objParentSize.height)&&(a/=3),0==c.panXActive||0==l.isInnerInPlace()?o=0:("right"==e&&0<r.left||"left"==e&&r.right<c.objParentSize.width)&&(o/=3),o=r.left+o,a=r.top+a,u.placeElement(c.objImage,o,a)))}function w(e,t,i,n){return 0==d.slider_zoom_mousewheel||(0==l.isCurrentSlideType("image")||(e.preventDefault(),void a(1==0<t?"in":"out",u.getMousePosition(e))))}this.________EXTERNAL_____________=function(){},this.isPanEnabled=function(e,t){if(o(),null==c.objImage||0==c.objImage.length)return!1;if(0==c.isZoomedOnce)return!1;if(0==h(c.objImage,e))return!1;if(0==l.isInnerInPlace())return!1;if("left"==t){if(c.objImageSize.right<=c.objParentSize.width)return!1}else if(0<=c.objImageSize.left)return!1;return!0},this.init=function(e,t){r(e,t)},this.zoomIn=function(){a("in")},this.zoomOut=function(){a("out")},this.zoomBack=function(){a("back")}}function UGWistiaAPI(){this.isAPILoaded=!1;var a,s,l=this,u=jQuery(this),d=!1;function c(){return"undefined"!=typeof Wistia}function _(e,t,i,n,r){s=null,d=!1;var o=e+"_video",a="<div id='"+o+"' class='wistia_embed' style='width:"+i+";height:"+n+";' data-video-width='"+i+"' data-video-height='"+n+"'> </div>";jQuery("#"+e).html(a),s=Wistia.embed(t,{version:"v1",videoWidth:i,videoHeight:n,container:o,autoPlay:r}),d=!0,s.bind("play",function(){u.trigger(l.events.START_PLAYING)}),s.bind("pause",function(){u.trigger(l.events.STOP_PLAYING)}),s.bind("end",function(){u.trigger(l.events.STOP_PLAYING),u.trigger(l.events.VIDEO_ENDED)})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugWistiaAPI.isAPILoaded||(c()?g_ugWistiaAPI.isAPILoaded=!0:(!0!==e&&g_ugFunctions.loadJs("fast.wistia.com/assets/external/E-v1.js",!0),void(g_ugWistiaAPI.isAPILoaded=!0)))},this.doCommand=function(e){if(null==s)return!1;if(0==d)return!1;switch(e){case"play":s.play();break;case"pause":s.pause()}},this.pause=function(){l.doCommand("pause")},this.play=function(){l.doCommand("play")},this.putVideo=function(e,t,i,n,r,o){if(c())return _(e,t,i,n,r),!0;this.loadAPI(),a=setInterval(function(){c()&&(_(e,t,i,n,r),clearInterval(a))},500)},this.isPlayerReady=function(){return!(!d||!s)},this.muteVideo=function(){s.mute()}}function UGIframeAPI(){this.isAPILoaded=!1;var s,l,e=this,u=(jQuery(this),!1);this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){if(1==g_ugIframeAPI.isAPILoaded)return!0;g_ugIframeAPI.isAPILoaded=!0},this.doCommand=function(e){if(null==l)return!1;if(0==u)return!1;switch(e){case"play":l.play();break;case"pause":l.pause()}},this.pause=function(){e.doCommand("pause")},this.play=function(){e.doCommand("play")},this.putVideo=function(n,r,o,a){this.loadAPI(),s=setInterval(function(){var e,t,i;l=null,u=!1,i="<iframe id='"+((e=n)+"_video")+"' class='iframe_embed' src='"+a+"' style='width:"+(t=r)+";height:"+(i=o)+";' data-video-width='"+t+"' data-video-height='"+i+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>",jQuery("#"+e).html(i),u=!0,clearInterval(s)},500)},this.isPlayerReady=function(){return 1==g_ugIframeAPI.isAPILoaded}}function UGSoundCloudAPI(){this.isAPILoaded=!1;var o,a,s,l,u=this,d=jQuery(this);function c(){return"undefined"!=typeof SC}function _(e,t,i,n,r){a=null,l=!1;var o=e+"_iframe",t=location.protocol+"//w.soundcloud.com/player/?url=http://api.soundcloud.com/tracks/"+t;t+="&buying=false&liking=false&download=false&sharing=false&show_artwork=true&show_comments=false&show_playcount=true&show_user=false&hide_related=true&visual=true&start_track=0&callback=true";n="<iframe id='"+o+"' src="+(t+=!0===r?"&auto_play=true":"&auto_play=false")+" width='"+i+"' height='"+n+"' frameborder='0' scrolling='no' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(n),(a=SC.Widget(o)).bind(SC.Widget.Events.READY,function(){a&&(l=!0,a.bind(SC.Widget.Events.PLAY,function(){d.trigger(u.events.START_PLAYING)}),a.bind(SC.Widget.Events.PAUSE,function(){d.trigger(u.events.STOP_PLAYING)}),a.bind(SC.Widget.Events.FINISH,function(){d.trigger(u.events.STOP_PLAYING),d.trigger(u.events.VIDEO_ENDED)}))}),s=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugSoundCloudAPI.isAPILoaded||(c()?g_ugSoundCloudAPI.isAPILoaded=!0:(!0!==e&&g_ugFunctions.loadJs("w.soundcloud.com/player/api.js",!0),void(g_ugSoundCloudAPI.isAPILoaded=!0)))},this.putSound=function(e,t,i,n,r){if(c())return _(e,t,i,n,r),!0;this.loadAPI(),o=setInterval(function(){c()&&(_(e,t,i,n,r),clearInterval(o))},500)},this.doCommand=function(e){if(null==a)return!1;if(0==l)return!1;switch(e){case"play":a.play();break;case"pause":a.pause()}},this.pause=function(){u.doCommand("pause")},this.play=function(){u.doCommand("play")},this.destroy=function(){l=!1,a=null,s&&(jQuery("#"+s).html(""),s=null)}}function UGHtml5MediaAPI(){this.isAPILoaded=!1;var o,d,c,_=this,h=jQuery(this);function a(){return"undefined"!=typeof mejs}function s(e,t,i,n,r){d=null,c=!1;var o=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/flashmediaelement-cdn.swf",a=location.protocol+"//cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/silverlightmediaelement.xap",s=e+"_video",l="";r&&!0===r&&(l="autoplay='true' muted='muted'");var u="";t.posterImage&&(u="poster='"+t.posterImage+"'");u="<video id='"+s+"' width='"+i+"' height='"+n+"' controls='controls' controlsList='nodownload' preload='none' "+l+" "+u+">";""!=t.mp4&&(u+="<source type='video/mp4' src='"+t.mp4+"' />"),""!=t.webm&&(u+="<source type='video/webm' src='"+t.webm+"' />"),""!=t.ogv&&(u+="<source type='video/ogg' src='"+t.ogv+"' />"),u+="<object width='"+i+"' height='"+n+"' type='application/x-shockwave-flash' data='"+o+"'>",u+="<param name='movie' value='"+o+"' />",u+="<param name='flashvars' value='controls=true&file="+t.mp4+"' />",u+="</object>",u+="</video>",jQuery("#"+e).html(u),jQuery("#"+s).on("contextmenu",function(){return!1}),new MediaElement(s,{enablePluginDebug:!1,flashName:o,silverlightName:a,success:function(e,t){c=!0,d=e,0==r&&d.pause(),g_ugFunctions.addEvent(d,"play",function(){h.trigger(_.events.START_PLAYING)}),g_ugFunctions.addEvent(d,"pause",function(){h.trigger(_.events.STOP_PLAYING)}),g_ugFunctions.addEvent(d,"ended",function(){h.trigger(_.events.STOP_PLAYING),h.trigger(_.events.VIDEO_ENDED)})},error:function(e){trace(e)}})}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugHtml5MediaAPI.isAPILoaded||(a()?g_ugHtml5MediaAPI.isAPILoaded=!0:(!0!==e&&(g_ugFunctions.loadJs("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement.min.js",!0),g_ugFunctions.loadCss("cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css",!0)),void(g_ugHtml5MediaAPI.isAPILoaded=!0)))},this.putVideo=function(e,t,i,n,r){if(a())return s(e,t,i,n,r),!0;this.loadAPI(),o=setInterval(function(){a()&&(s(e,t,i,n,r),clearInterval(o))},500)},this.doCommand=function(e){if(null==d)return!1;if(0==c)return!1;switch(e){case"play":d.play();break;case"pause":d.pause()}},this.pause=function(){_.doCommand("pause")},this.play=function(){_.doCommand("play")},this.muteVideo=function(){d.volume=0}}function UGVimeoAPI(){this.isAPILoaded=!1;var o,a,s=this,l=jQuery(this),u=null,d=!1,c=!1;function _(){return"object"==typeof Vimeo}function h(e,t,i,n,r){u=null,d=!1;t=location.protocol+"//player.vimeo.com/video/"+t+"?api=1";!0===r&&(t+="&byline=0&autoplay=1&title=0&portrait=0");n="<iframe src="+t+" width='"+i+"' height='"+n+"' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";jQuery("#"+e).html(n);jQuery("#"+e+" iframe")[0];u=new Vimeo.Player(e),d=!0,u&&(u.on("cuechange",function(){1==c&&s.play()}),u.on("play",function(){l.trigger(s.events.START_PLAYING)}),u.on("pause",function(){l.trigger(s.events.STOP_PLAYING)}),u.on("ended",function(){l.trigger(s.events.STOP_PLAYING),l.trigger(s.events.VIDEO_ENDED)})),a=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.loadAPI=function(e){return 1==g_ugVimeoAPI.isAPILoaded||1!=_()&&(!0!==e&&g_ugFunctions.loadJs("player.vimeo.com/api/player.js",!0),void(g_ugVimeoAPI.isAPILoaded=!0))},this.doCommand=function(e){if(null==u)return!1;if(0==d)return!1;switch(e){case"pause":u.pause();break;case"play":u.play();break;default:throw new Error("wrong command: "+e)}},this.pause=function(){s.doCommand("pause")},this.play=function(){s.doCommand("play")},this.destroy=function(){u&&(u.unload(),u=null,d=!1),a&&jQuery("#"+a).html("")},this.putVideo=function(e,t,i,n,r){if(_())return h(e,t,i,n,r),!0;this.loadAPI(),o=setInterval(function(){_()&&(h(e,t,i,n,r),clearInterval(o))},500)},this.isPlayerReady=function(){return!(!d||!u)},this.changeVideo=function(e,t){if(0==s.isPlayerReady())return!1;c=t,u.loadVideo(e)},this.getVideoImages=function(e,i,n){e=location.protocol+"//vimeo.com/api/v2/video/"+e+".json";jQuery.get(e,{},function(e){var t={};t.preview=e[0].thumbnail_large,t.thumb=e[0].thumbnail_medium,n(i,t)})},this.muteVideo=function(){u.ready().then(function(){u.setVolume(0)})}}function UGYoutubeAPI(){this.isAPILoaded=!1;var a,s,i=this,l=null,u=!1,t=jQuery(this),n=-1,d=new UGFunctions,c={video_youtube_showinfo:!0};function _(e,t,i,n,r,o){l&&u&&l.destroy();var a={controls:1,showinfo:c.video_youtube_showinfo,start:0,rel:0};!0===r&&(a.autoplay=1);o=d.getVal(o,"start");o&&jQuery.isNumeric(o)&&(a.start=o),u=!1,l=new YT.Player(e,{height:n,width:i,videoId:t,playerVars:a,events:{onReady:g,onStateChange:p}}),s=e}function h(){return"undefined"!=typeof YT&&void 0!==YT.Player}function g(){u=!0,1==l.muted&&l.mute()}function p(){if("function"!=typeof l.getPlayerState)return trace("Youtube API error: can't get player state"),!1;var e=l.getPlayerState();switch(e){case YT.PlayerState.PLAYING:t.trigger(i.events.START_PLAYING);break;case YT.PlayerState.ENDED:t.trigger(i.events.STOP_PLAYING),t.trigger(i.events.VIDEO_ENDED);break;default:n==YT.PlayerState.PLAYING&&t.trigger(i.events.STOP_PLAYING)}n=e}this.events={START_PLAYING:"start_playing",STOP_PLAYING:"stop_playing",VIDEO_ENDED:"video_ended"},this.setOptions=function(e){c=jQuery.extend(c,e)},this.putVideo=function(e,t,i,n,r,o){if(h())return _(e,t,i,n,r,o),!0;this.loadAPI(),a=setInterval(function(){h()&&(_(e,t,i,n,r,o),clearInterval(a))},500)},this.loadAPI=function(e){return 1==g_ugYoutubeAPI.isAPILoaded||("undefined"!=typeof YT?g_ugYoutubeAPI.isAPILoaded=!0:(!0!==e&&g_ugFunctions.loadJs("https://www.youtube.com/player_api",!1),void(g_ugYoutubeAPI.isAPILoaded=!0)))},this.doCommand=function(e,t){if(!l)return!0;if(0==u)return!1;switch(e){case"play":if("function"!=typeof l.playVideo)return!1;l.playVideo();break;case"pause":if("function"!=typeof l.pauseVideo)return!1;l.pauseVideo();break;case"seek":if("function"!=typeof l.seekTo)return!1;l.seekTo(t);break;case"stopToBeginning":var i=l.getPlayerState();switch(l.pauseVideo(),i){case YT.PlayerState.PLAYING:case YT.PlayerState.ENDED:case YT.PlayerState.PAUSED:l.seekTo(0)}}},this.play=function(){i.doCommand("play")},this.pause=function(){i.doCommand("pause")},this.destroy=function(){try{l&&(u=!1,l.clearVideo(),l.destroy())}catch(e){jQuery("#"+s).html("")}},this.stopToBeginning=function(){i.doCommand("stopToBeginning")},this.changeVideo=function(e,t){if(0==i.isPlayerReady())return!1;if(!l)return!1;if(t&&1==t)l.loadVideoById(e,0,"large");else{if(void 0===l.cueVideoById)return!1;l.cueVideoById(e,0,"large")}},this.isPlayerReady=function(){return!(!u||!l)},this.getVideoImages=function(e){var t={};return t.preview="https://i.ytimg.com/vi/"+e+"/sddefault.jpg",t.thumb="https://i.ytimg.com/vi/"+e+"/default.jpg",t},this.muteVideo=function(){l.muted=!0}}function UGVideoPlayer(){var r,o,a,s,l,u,d,c,_,t=this,e=jQuery(this),i=new UGFunctions,h=new UGYoutubeAPI,g=new UGVimeoAPI,p=new UGHtml5MediaAPI,m=new UGSoundCloudAPI,f=new UGWistiaAPI,b=new UGIframeAPI,v=null,y={video_enable_closebutton:!0,video_closebutton_type:"default",video_closebutton_custom:""},w={standAloneMode:!(this.events={SHOW:"video_show",HIDE:"video_hide",PLAY_START:"video_play_start",PLAY_STOP:"video_play_stop",VIDEO_ENDED:"video_ended"}),youtubeInnerID:"",vimeoPlayerID:"",html5PlayerID:"",wistiaPlayerID:"",iframePlayerID:"",soundCloudPlayerID:""};function n(){t.hide()}function E(){e.trigger(t.events.PLAY_START),u&&u.hide()}function x(){e.trigger(t.events.PLAY_STOP),u&&u.show()}function T(){e.trigger(t.events.VIDEO_ENDED)}function I(e){var t,i=["youtube","vimeo","html5","soundcloud","wistia","iframe"];for(t in i){var n=i[t];if(n!=e)switch(n){case"youtube":h.pause(),h.destroy(),a.hide();break;case"vimeo":g.pause(),g.destroy(),s.hide();break;case"html5":p.pause(),l.hide();break;case"soundcloud":m.pause(),m.destroy(),d.hide();break;case"wistia":f.pause(),c.hide();break;case"iframe":b.pause(),_.hide()}}}this.init=function(e,t,i){if(!(r=i))throw new Error("missing gallery ID for video player, it's a must!");y=jQuery.extend(y,e),h.setOptions(y),t&&1==t&&(w.standAloneMode=!0)},this.setHtml=function(e){w.youtubeInnerID=r+"_youtube_inner",w.vimeoPlayerID=r+"_videoplayer_vimeo",w.html5PlayerID=r+"_videoplayer_html5",w.wistiaPlayerID=r+"_videoplayer_wistia",w.iframePlayerID=r+"_videoplayer_iframe",w.soundCloudPlayerID=r+"_videoplayer_soundcloud";var t,i,n="<div class='ug-videoplayer' style='display:none'>";n+="<div class='ug-videoplayer-wrapper ug-videoplayer-youtube' style='display:none'><div id='"+w.youtubeInnerID+"'></div></div>",n+="<div id='"+w.vimeoPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-vimeo' style='display:none'></div>",n+="<div id='"+w.html5PlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-html5'></div>",n+="<div id='"+w.soundCloudPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-soundcloud'></div>",n+="<div id='"+w.wistiaPlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-wistia'></div>",n+="<div id='"+w.iframePlayerID+"' class='ug-videoplayer-wrapper ug-videoplayer-iframe'></div>",0==w.standAloneMode&&1==y.video_enable_closebutton&&(i="","default"==y.video_closebutton_type&&(t='<svg xmlns="http://www.w3.org/2000/svg" width="58" height="58" viewBox="0 0 58 58" fill="none"><rect x="4" y="4" width="50" height="50" rx="25" fill="#C80000"/><rect x="4" y="4" width="50" height="50" rx="25" stroke="white" stroke-width="8"/><path d="M18 18L29 29M40 40L29 29M29 29L18 40L40 18" stroke="white" stroke-width="7"/></svg>'),"custom"==y.video_closebutton_type&&(t=y.video_closebutton_custom,i="ug-videoplayer-button-close-custom"),n+="<div class='ug-videoplayer-button-close "+i+"'>"+t+"</div>"),n+="</div>",e.append(n),o=e.children(".ug-videoplayer"),a=o.children(".ug-videoplayer-youtube"),s=o.children(".ug-videoplayer-vimeo"),l=o.children(".ug-videoplayer-html5"),d=o.children(".ug-videoplayer-soundcloud"),c=o.children(".ug-videoplayer-wistia"),_=o.children(".ug-videoplayer-iframe"),0==w.standAloneMode&&1==y.video_enable_closebutton&&(u=o.children(".ug-videoplayer-button-close"))},this.destroy=function(){u&&(u.off("click"),u.off("touchend")),jQuery(h).off(h.events.START_PLAYING),jQuery(h).off(h.events.STOP_PLAYING),jQuery(g).off(g.events.START_PLAYING),jQuery(g).off(g.events.STOP_PLAYING),jQuery(p).off(p.events.START_PLAYING),jQuery(p).off(p.events.STOP_PLAYING),jQuery(m).off(m.events.START_PLAYING,E),jQuery(m).off(m.events.STOP_PLAYING,x),jQuery(f).off(f.events.START_PLAYING,E),jQuery(f).off(f.events.STOP_PLAYING,x),jQuery(b).off(b.events.START_PLAYING,E),jQuery(b).off(b.events.STOP_PLAYING,x),v=null},this.initEvents=function(){u&&(i.setButtonMobileReady(u),i.setButtonOnClick(u,n)),jQuery(h).on(h.events.START_PLAYING,E),jQuery(h).on(h.events.STOP_PLAYING,x),jQuery(h).on(h.events.VIDEO_ENDED,T),jQuery(g).on(g.events.START_PLAYING,E),jQuery(g).on(g.events.STOP_PLAYING,x),jQuery(g).on(g.events.VIDEO_ENDED,T),jQuery(p).on(p.events.START_PLAYING,E),jQuery(p).on(p.events.STOP_PLAYING,x),jQuery(p).on(p.events.VIDEO_ENDED,T),jQuery(m).on(m.events.START_PLAYING,E),jQuery(m).on(m.events.STOP_PLAYING,x),jQuery(m).on(m.events.VIDEO_ENDED,T),jQuery(f).on(f.events.START_PLAYING,E),jQuery(f).on(f.events.STOP_PLAYING,x),jQuery(f).on(f.events.VIDEO_ENDED,T),jQuery(b).on(b.events.START_PLAYING,E),jQuery(b).on(b.events.STOP_PLAYING,x),jQuery(b).on(b.events.VIDEO_ENDED,T)},this.setSize=function(e,t){i.setElementSize(o,e,t),u&&i.placeElement(u,"right","top")},this.setPosition=function(e,t){i.placeElement(o,e,t)},this.getObject=function(){return o},this.show=function(){if(1==t.isVisible())return!0;o.show(),o.fadeTo(0,1),u&&u.show(),e.trigger(t.events.SHOW)},this.hide=function(){if(0==t.isVisible())return!0;I(),v=null,o.hide(),e.trigger(t.events.HIDE)},this.getActiveAPI=function(){switch(v){case"youtube":return h;case"vimeo":return g;case"wistia":return f;case"iframe":return b;case"soundcloud":return m;case"html5":return p;default:return null}},this.pause=function(){var e=t.getActiveAPI();if(null==e)return!1;"function"==typeof e.pause&&e.pause()},this.isVisible=function(){return o.is(":visible")},this.playYoutube=function(e,t,i){void 0===t&&(t=!0),i=i||null,I("youtube"),a.show(),0==a.children("#"+w.youtubeInnerID).length&&a.append("<div id='"+w.youtubeInnerID+"'></div>");var n={};i&&(n.start=i),1==h.isPlayerReady()&&1==w.standAloneMode?h.changeVideo(e,t):h.putVideo(w.youtubeInnerID,e,"100%","100%",t,n),v="youtube"},this.muteVideoYoutube=function(){h.muteVideo()},this.playVimeo=function(e,t){void 0===t&&(t=!0),I("vimeo"),s.show(),g.putVideo(w.vimeoPlayerID,e,"100%","100%",t),v="vimeo"},this.muteVideoVimeo=function(){g.muteVideo()},this.playHtml5Video=function(e,t,i,n,r){void 0===r&&(r=!0),I("html5"),l.show();n={ogv:e,webm:t,mp4:i,posterImage:n};p.putVideo(w.html5PlayerID,n,"100%","100%",r),v="html5"},this.muteVideoHtml5=function(){p.muteVideo()},this.playSoundCloud=function(e,t){void 0===t&&(t=!0),I("soundcloud"),d.show(),m.putSound(w.soundCloudPlayerID,e,"100%","100%",t),v="soundcloud"},this.playWistia=function(e,t){void 0===t&&(t=!0),I("wistia"),c.show(),f.putVideo(w.wistiaPlayerID,e,"100%","100%",t),v="wistia"},this.muteVideoWistia=function(){f.muteVideo()},this.playIframe=function(e){I("iframe"),_.show(),b.putVideo(w.iframePlayerID,"100%","100%",e),v="iframe"}}var g_ugYoutubeAPI=new UGYoutubeAPI,g_ugVimeoAPI=new UGVimeoAPI,g_ugHtml5MediaAPI=new UGHtml5MediaAPI,g_ugSoundCloudAPI=new UGSoundCloudAPI,g_ugWistiaAPI=new UGWistiaAPI,g_ugIframeAPI=new UGIframeAPI;function ugCheckForMinJQueryVersion(){if(0==g_ugFunctions.checkMinJqueryVersion("1.8.0"))throw new Error("The gallery can run from jquery 1.8 You have jQuery "+jQuery.fn.jquery+" Please update your jQuery library.")}function ugCheckForErrors(t,i){try{"jquery"==i?(function(){if("undefined"==typeof jQuery)throw new Error("jQuery library not included")}(),ugCheckForMinJQueryVersion()):(ugCheckForMinJQueryVersion(),function(){if("function"!=typeof jQuery.fn.unitegallery){var e="You have some jquery.js library include that comes after the gallery files js include.";throw e+="<br> This include eliminates the gallery libraries, and make it not work.","cms"==i?(e+="<br><br> To fix it you can:<br> 1. In the Gallery Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true.",e+="<br> 2. Find the double jquery.js include and remove it."):e+="<br><br> Please find and remove this jquery.js include and the gallery will work. <br> * There should be only one jquery.js include before all other js includes in the page.",new Error(e)}}())}catch(e){var n,r=e.message;return r="<div style='font-size:16px;color:#BC0C06;max-width:900px;border:1px solid red;padding:10px;'>"+(r="Unite Gallery Error: "+r)+"</div>","jquery"==i?((n=document.getElementById(t)).innerHTML=r,n.style.display="block"):jQuery(t).show().html(r),!1}return!0}function UniteGalleryMain(){var o,a,s,l,u,d,c,_,p=this,r=jQuery(p),h=new UGFunctions,g=[],m=null,f=-1,b={},v={gallery_width:900,gallery_height:500,gallery_height_mobile:null,gallery_height_tablet:null,gallery_min_width:150,gallery_min_height:100,gallery_theme:"default",gallery_skin:"default",gallery_images_preload_type:"minimal",gallery_autoplay:!(this.events={ITEM_CHANGE:"item_change",SIZE_CHANGE:"size_change",ENTER_FULLSCREEN:"enter_fullscreen",EXIT_FULLSCREEN:"exit_fullscreen",START_PLAY:"start_play",STOP_PLAY:"stop_play",PAUSE_PLAYING:"pause_playing",CONTINUE_PLAYING:"continue_playing",SLIDER_ACTION_START:"slider_action_start",SLIDER_ACTION_END:"slider_action_end",ITEM_IMAGE_UPDATED:"item_image_updated",GALLERY_KEYPRESS:"gallery_keypress",GALLERY_BEFORE_REQUEST_ITEMS:"gallery_before_request_items",OPEN_LIGHTBOX:"open_lightbox",CLOSE_LIGHTBOX:"close_lightbox"}),gallery_play_interval:3e3,gallery_pause_on_mouseover:!0,gallery_mousewheel_role:"zoom",gallery_control_keyboard:!0,gallery_carousel:!0,gallery_preserve_ratio:!0,gallery_background_color:"",gallery_debug_errors:!1,gallery_shuffle:!1,gallery_urlajax:null,gallery_enable_tabs:!1,gallery_enable_loadmore:!1,gallery_enable_cache:!0,gallery_initial_catid:"",load_api_externally:!1},y={objCustomOptions:{},isAllItemsPreloaded:!1,isFreestyleMode:!1,lastWidth:0,lastHeigh:0,handleResize:null,isInited:!1,isPlayMode:!1,isPlayModePaused:!1,playTimePassed:0,playTimeLastStep:0,playHandle:"",playStepInterval:33,objProgress:null,isFakeFullscreen:!1,thumbsType:null,isYoutubePresent:!1,isVimeoPresent:!1,isHtml5VideoPresent:!1,isIframeVideoPresent:!1,isSoundCloudPresent:!1,isWistiaPresent:!1,resizeDelay:100,isRunFirstTime:!0,originalOptions:{},funcCustomHeight:null};function w(e,t,i,n){var r="object"==typeof t;if(r&&(y.objCustomOptions=t),1==y.isRunFirstTime){if(o=e,0==(a=jQuery(o)).length)return void trace("div with id: "+o+" not found");a.parent(),function(){try{ugCheckForMinJQueryVersion()}catch(e){T(e.message)}"object"==typeof a.outerWidth()&&T("You have some buggy script. most chances jquery-ui.js that destroy jquery outerWidth, outerHeight functions. The gallery can't run. Please update jquery-ui.js to latest version."),setTimeout(function(){ugCheckForErrors(o,"cms")},5e3)}(),y.originalOptions=jQuery.extend({},v),r&&(v=jQuery.extend(v,t)),1==v.gallery_enable_cache&&v.gallery_initial_catid&&D(v.gallery_initial_catid),p.setSizeClass(),C(a.children()),A(),a.find("img").fadeTo(0,0).hide(),a.show(),I()}else if(p.destroy(),v=jQuery.extend({},y.originalOptions),f=-1,m=null,u=s=l=void 0,v=jQuery.extend(v,y.objCustomOptions),i){if(n&&1==v.gallery_enable_cache&&D(n,i),"noitems"==i)return void x("No items in this category","");a.html(i),C(a.children()),A(),a.children().fadeTo(0,0).hide(),a.show(),I()}1==y.isRunFirstTime&&1==v.gallery_enable_tabs&&(d=new UGTabs).init(p,v),1==y.isRunFirstTime&&1==v.gallery_enable_loadmore&&(new UGLoadMore).init(p,v),r&&(y.objCustomOptions,v.gallery_images_preload_type||(v.gallery_images_preload_type="minimal"),(null==v.gallery_min_height||v.gallery_height<v.gallery_min_height)&&(v.gallery_min_height=0),(null==v.gallery_min_width||v.gallery_width<v.gallery_min_width)&&(v.gallery_min_width=0)),function(){if(!v.gallery_theme)throw new Error("The gallery can't run without theme");if(jQuery.isNumeric(v.gallery_height)&&v.gallery_height<v.gallery_min_height)throw new Error("The <b>gallery_height</b> option must be bigger then <b>gallery_min_height option</b>");if(v.gallery_width<v.gallery_min_width)throw new Error("The <b>gallery_width</b> option must be bigger then <b>gallery_min_width option</b>")}(),1==v.gallery_shuffle&&p.shuffleItems(),function(e){e.hasOwnProperty("gallery_theme")?v.gallery_theme=e.gallery_theme:(t=v.gallery_theme,0==g_ugFunctions.isThemeRegistered(t)&&(v.gallery_theme=g_ugFunctions.getFirstRegisteredTheme()));var t=(-1==(t=v.gallery_theme).indexOf("UGTheme_")&&(t="UGTheme_"+t),t);"function"==typeof window[t]?(v.gallery_theme=window[t],(_=new v.gallery_theme).init(p,e)):console.error("Theme function "+t+" not found.")}(y.objCustomOptions),a.addClass("ug-gallery-wrapper"),a.append("<div class='ug-overlay-disabled' style='display:none'></div>"),p.setSizeClass(),S(),0==a.width()?h.waitForWidth(a,E):E()}function E(){p.setSizeClass(),0==y.isFreestyleMode&&1==v.gallery_preserve_ratio&&n(),_.run(),d&&y.isRunFirstTime&&d.run(),t(),function(){if(a.on("dragstart",function(e){e.preventDefault()}),r.on(p.events.ITEM_IMAGE_UPDATED,H),s)switch(y.thumbsType){case"strip":jQuery(s).on(s.events.STRIP_MOVE,z);break;case"grid":jQuery(s).on(s.events.PANE_CHANGE,z)}"advance"==v.gallery_mousewheel_role&&0==y.isFreestyleMode&&a.on("mousewheel",p.onGalleryMouseWheel),i(),jQuery(window).resize(function(){a.css("width","auto"),h.whenContiniousEventOver("gallery_resize",L,y.resizeDelay)}),setTimeout(function(){setInterval(L,2e3)},1e4),h.addFullScreenChangeEvent(N),l&&(jQuery(l).on(l.events.ITEM_CHANGED,function(){var e=l.getCurrentItemIndex();-1!=e&&p.selectItem(e)}),1==v.gallery_pause_on_mouseover&&(l.getElement().hover(e,M),r.on(p.events.ENTER_FULLSCREEN,function(){M()})),G(l,l.events.ACTION_START,p.events.SLIDER_ACTION_START),G(l,l.events.ACTION_END,p.events.SLIDER_ACTION_END),jQuery(l).on(l.events.CURRENTSLIDE_LOAD_END,R)),1==v.gallery_control_keyboard&&jQuery(document).keydown(k)}(),0<c&&p.selectItem(0),1==v.gallery_autoplay&&p.startPlayMode(),y.isRunFirstTime=!1}function x(e,t){e="<div class='ug-error-message-wrapper'><div class='ug-error-message'>"+(e=(t=void 0===t?"<b>Unite Gallery Error: </b>":"<b>"+t+": </b>")+e)+"</div></div>";a.children().remove(),a.html(e),a.show()}function T(e){throw x(e),new Error(e)}function I(){a.children().remove()}function i(){var e=p.getSize();y.lastWidth=e.width,y.lastHeight=e.height}function n(){var e=p.getSize();e.width/e.height!=e.orig_ratio&&(e=e.width/e.orig_ratio,(e=Math.round(e))<v.gallery_min_height&&(e=v.gallery_min_height),a.height(e))}function S(){var e,t={"max-width":h.getCssSizeParam(v.gallery_width),"min-width":h.getCssSizeParam(v.gallery_min_width)};0==y.isFreestyleMode?(e=h.getCssSizeParam(v.gallery_height),1==p.isTabletMode()&&v.gallery_height_tablet&&(e=h.getCssSizeParam(v.gallery_height_tablet)),1==p.isMobileMode()&&v.gallery_height_mobile&&(e=h.getCssSizeParam(v.gallery_height_mobile)),t.height=e):t.overflow="visible",v.gallery_background_color&&(t["background-color"]=v.gallery_background_color),a.css(t)}function P(e){var t;return t=e,e=DOMPurify.sanitize(t),String(e).replace(/<(?!\/?(b|strong|br|i|span|a|ul|ol|li|p|hr|small)\b)[^>]+>/gi,"")}function C(e,t){if(!0!==t)g=[];else for(var i=0;i<c;i++)g[i].isNewAdded=!1;for(i=0;i<e.length;i++){var n,r=jQuery(e[i]),o=function(e){var t=p.isMobileMode(),i=e.prop("tagName").toLowerCase();if("noscript"==i)return null;if("picture"==i){var n=e.find("img");if(0==n.length)return null;e=n,i="img"}var r=e.data("lazy-src");r&&e.attr("src",r);var o="";if("a"==i){o=e.attr("href");var a=e.children();if(0==(e=e.find("img")).length)return null;i="img"}var s=e.data("type");null==s&&(s="image");var l={};if(l.type=s,"img"==i){var u="lazyload-src",d=e.data(u);d||(u="lazy-src",d=e.data(u)),d||(u="src",d=e.data(u)),d&&""!=d&&(e.attr("src",d),jQuery.removeData(e,u));n=e.data("image"),r=e.data("thumb"),d=(d=e.data("title"))&&P(d);void 0===n&&(n=null),void 0===r&&(r=null);u=e.attr("src"),n=n||u;r=(r=r||u)||n,n=n||r,r&&-1!==r.indexOf("data:image")&&(r=n),l.urlThumb=r,l.urlImage=n,l.title=e.attr("alt"),l.title&&(l.title=P(l.title)),d&&(l.title=d),l.objThumbImage=e,l.objThumbImage.attr("src",l.urlThumb)}else{if("image"==s)throw trace("Problematic gallery item found:"),trace(e),trace("Please look for some third party js script that could add this item to the gallery"),new Error("The item should not be image type");l.urlThumb=e.data("thumb"),l.title=e.data("title"),l.title&&(l.title=P(l.title)),l.objThumbImage=null,l.urlImage=e.data("image")}1==t&&(void 0!==(c=e.data("thumb-mobile"))&&""!=c&&(l.urlThumb=c,"img"==i&&e.attr("src",l.urlThumb)),void 0!==(c=e.data("image-mobile"))&&""!=c&&(l.urlImage=c)),l.link=o,l.description=e.attr("title"),l.description&&(l.description=P(l.description)),l.description||(l.description=e.data("description"),l.description&&(l.description=P(l.description))),l.description||(l.description=""),l.isNewAdded=!1,l.isLoaded=!1,l.isThumbImageLoaded=!1,l.objPreloadImage=null,l.isBigImageLoadStarted=!1,l.isBigImageLoaded=!1,l.isBigImageLoadError=!1,l.imageWidth=0,l.imageHeight=0,l.thumbWidth=0,l.thumbHeight=0,l.thumbRatioByWidth=0,l.thumbRatioByHeight=0;var c=e.data("width"),o=e.data("height");c&&"number"==typeof c&&o&&"number"==typeof o&&(l.thumbWidth=c,l.thumbHeight=o,l.thumbRatioByWidth=c/o,l.thumbRatioByHeight=o/c);var _=(l.addHtml=null)==l.urlImage||""==l.urlImage,h=null==l.urlThumb||""==l.urlThumb;switch(l.type){case"youtube":l.videoid=e.data("videoid"),l.video_start=e.data("start"),(_||h)&&(g=g_ugYoutubeAPI.getVideoImages(l.videoid),_&&(l.urlImage=g.preview),h&&(l.urlThumb=g.thumb,"img"==i&&e.attr("src",l.urlThumb))),y.isYoutubePresent=!0;break;case"vimeo":l.videoid=e.data("videoid"),y.isVimeoPresent=!0;break;case"html5video":l.videoogv=e.data("videoogv"),l.videowebm=e.data("videowebm"),l.videomp4=e.data("videomp4"),y.isHtml5VideoPresent=!0;break;case"soundcloud":l.trackid=e.data("trackid"),y.isSoundCloudPresent=!0;break;case"wistia":l.videoid=e.data("videoid"),y.isWistiaPresent=!0;break;case"iframe":l.videoUrl=e.data("videourl"),y.isIframeVideoPresent=!0;break;case"custom":var g=e.children("img");g.length&&(g=jQuery(g[0]),l.urlThumb=g.attr("src"),l.title=g.attr("alt"),l.title&&(l.title=P(l.title)),l.objThumbImage=g),(a=e.children().not("img:first-child")).length&&(l.addHtml=a.clone())}return l.objThumbImage&&(l.objThumbImage.removeAttr("data-description",""),l.objThumbImage.removeAttr("data-image",""),l.objThumbImage.removeAttr("data-thumb",""),l.objThumbImage.removeAttr("title","")),l}(r);null!==o?(n=g.length,o.index=n,!0===t&&(o.isNewAdded=!0),g.push(o)):r.remove()}c=g.length}function A(){var e=v.load_api_externally;y.isYoutubePresent&&g_ugYoutubeAPI.loadAPI(e),y.isVimeoPresent&&g_ugVimeoAPI.loadAPI(e),y.isHtml5VideoPresent&&g_ugHtml5MediaAPI.loadAPI(e),y.isSoundCloudPresent&&g_ugSoundCloudAPI.loadAPI(e),y.isWistiaPresent&&g_ugWistiaAPI.loadAPI(e),y.isIframeVideoPresent&&g_ugIframeAPI.loadAPI(e)}function t(){if("visible"!=v.gallery_images_preload_type||s||(v.gallery_images_preload_type="minimal"),1==y.isAllItemsPreloaded)return 1;switch(v.gallery_images_preload_type){default:case"minimal":break;case"all":jQuery(g).each(function(){j(this)});break;case"visible":jQuery(g).each(function(){1==s.isItemThumbVisible(this)&&j(this)})}}function j(e){if(1==e.isBigImageLoadStarted||1==e.isBigImageLoaded||1==e.isBigImageLoadError)return 1;var t=e.urlImage;""!=t&&null!=t?(e.isBigImageLoadStarted=!0,e.objPreloadImage=jQuery("<img/>").attr("src",t),e.objPreloadImage.data("itemIndex",e.index),e.objPreloadImage.on("load",p.onItemBigImageLoaded),e.objPreloadImage.on("error",function(){var e=jQuery(this).data("itemIndex"),t=g[e];t.isBigImageLoadError=!0,t.isBigImageLoaded=!1;var i=jQuery(this).attr("src");console.log("Can't load image: "+i),r.trigger(p.events.ITEM_IMAGE_UPDATED,[e,t.urlImage]),t.objThumbImage.attr("src",t.urlThumb)}),function(){if(1!=y.isAllItemsPreloaded){for(var e in g)if(0==g[e].isBigImageLoadStarted)return;y.isAllItemsPreloaded=!0}}()):e.isBigImageLoadError=!0}function e(e){1==v.gallery_pause_on_mouseover&&0==p.isFullScreen()&&1==y.isPlayMode&&l&&0==l.isSlideActionActive()&&p.pausePlaying()}function M(e){1==v.gallery_pause_on_mouseover&&1==y.isPlayMode&&l&&0==l.isSlideActionActive()&&0==l.isCurrentSlideLoadingImage()&&p.continuePlaying()}function O(){if(!window.ugArrGalleriesObjects)return!0;window.ugArrGalleriesObjects.length;if(1==window.ugArrGalleriesObjects.length)return!0;var n,r=0,o=p.getGalleryID();return jQuery.each(window.ugArrGalleriesObjects,function(e,t){var i=t.getGalleryID(),t=t.getKeyPressScore();r<t&&(r=t),i==o&&(n=t)}),n==r}function k(e){var t=jQuery(e.target);if(t.is("textarea")||t.is("select")||t.is("input"))return!0;var t=e.charCode||e.keyCode||e.which||0,i=!1;switch(t){case 39:1==O()&&(p.nextItem(),i=!0);break;case 37:1==O()&&(p.prevItem(),i=!0);break;default:i=!1}1==i&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()),r.trigger(p.events.GALLERY_KEYPRESS,[t,e])}function L(){var e,t=p.getSize();if(0==t.width)return!0;p.setSizeClass(),((t=p.getSize()).width!=y.lastWidth||0==y.isFreestyleMode&&t.height!=y.lastHeight)&&(e=!1,!y.funcCustomHeight||(t=y.funcCustomHeight(t))&&(a.height(t),e=!0),0==e&&0==y.isFreestyleMode&&(1==v.gallery_preserve_ratio?n():v.gallery_height_mobile&&S()),i(),r.trigger(p.events.SIZE_CHANGE))}function z(e){"visible"==v.gallery_images_preload_type&&0==y.isAllItemsPreloaded&&t()}function N(){var e=h.isFullScreen(),t=e?p.events.ENTER_FULLSCREEN:p.events.EXIT_FULLSCREEN,i=h.getGlobalData("fullscreenID");if(o!==i)return!0;e?a.addClass("ug-fullscreen"):a.removeClass("ug-fullscreen"),r.trigger(t),L()}function H(e,t){!function(e){if(1!=e.isBigImageLoadStarted&&1!=e.isBigImageLoaded&&1!=e.isBigImageLoadError)switch(v.gallery_images_preload_type){default:case"minimal":break;case"all":j(e);break;case"visible":1==s.isItemThumbVisible(e)&&j(e)}}(p.getItem(t))}function R(){1==p.isPlayMode()&&p.continuePlaying()}function D(e,t){var i;t?"noitems"!=(i=t)&&(i=jQuery(t).clone()):i=a.children().clone(),b[e]=i}function G(e,t,i){jQuery(e).on(t,function(e){r.trigger(i,[this])})}function Q(){var e=jQuery.now(),t=e-y.playTimeLastStep;if(y.playTimeLastStep=e,0==p.isGalleryVisible())return!1;y.playTimePassed+=t,y.objProgress&&(t=y.playTimePassed/v.gallery_play_interval,y.objProgress.setProgress(t)),y.playTimePassed>=v.gallery_play_interval&&(p.nextItem(),y.playTimePassed=0)}this.onItemBigImageLoaded=function(e,t){var i=(t=t||jQuery(this)).data("itemIndex"),i=g[i];i.isBigImageLoaded=!0;t=h.getImageOriginalSize(t);i.imageWidth=t.width,i.imageHeight=t.height},this.checkFillImageSize=function(e,t){if(!t){var i=e.data("itemIndex");if(void 0===i)throw new Error("Wrong image given to gallery.checkFillImageSize");t=g[i]}e=h.getImageOriginalSize(e);t.imageWidth=e.width,t.imageHeight=e.height},this.setFreestyleMode=function(){y.isFreestyleMode=!0},this.attachThumbsPanel=function(e,t){y.thumbsType=e,s=t},this.initSlider=function(e,t){e=e||{},e=jQuery.extend(y.objCustomOptions,e),(l=new UGSlider).init(p,e,t)},this.onGalleryMouseWheel=function(e,t,i,n){e.preventDefault(),0<t?p.prevItem():p.nextItem()},this.getKeyPressScore=function(){if(p.isGalleryInsideScreen())return 1;if(u&&1==u.isOpened())return 2;return 0},this.getGalleryID=function(){return o},this.destroy=function(){if(a.off("dragstart"),r.off(p.events.ITEM_IMAGE_UPDATED),s)switch(y.thumbsType){case"strip":jQuery(s).off(s.events.STRIP_MOVE);break;case"grid":jQuery(s).off(s.events.PANE_CHANGE)}var e;a.off("mousewheel"),jQuery(window).off("resize"),h.destroyFullScreenChangeEvent(),l&&(jQuery(l).off(l.events.ITEM_CHANGED),(e=l.getElement()).off("mouseenter"),e.off("mouseleave"),r.off(p.events.ENTER_FULLSCREEN),jQuery(l).off(l.events.ACTION_START),jQuery(l).off(l.events.ACTION_END),jQuery(l).off(l.events.CURRENTSLIDE_LOAD_END)),1==v.gallery_control_keyboard&&jQuery(document).off("keydown"),_&&"function"==typeof _.destroy&&_.destroy(),a.html("")},this.getArrItems=function(){return g},this.getObjects=function(){return{g_galleryID:o,g_objWrapper:a,g_objThumbs:s,g_objSlider:l,g_options:v,g_arrItems:g,g_numItems:c}},this.getObjSlider=function(){return l},this.getItem=function(e){if(e<0)throw new Error("item with index: "+e+" not found");if(c<=e)throw new Error("item with index: "+e+" not found");return g[e]},this.getWidth=function(){return p.getSize().width},this.getHeight=function(){return p.getSize().height},this.getSize=function(){var e=h.getElementSize(a);return e.orig_width=v.gallery_width,e.orig_height=v.gallery_height,e.orig_ratio=e.orig_width/e.orig_height,e},this.getGalleryID=function(){return o.replace("#","")},this.getNextItem=function(e,t){"object"==typeof e&&(e=e.index);e+=1;if(!0!==t&&1==c)return null;if(c<=e){if(1!=v.gallery_carousel&&!0!==t)return null;e=0}return g[e]},this.getPrevItem=function(e){"object"==typeof e&&(e=e.index);--e;if(e<0){if(1!=v.gallery_carousel)return null;e=c-1}return g[e]},this.getSelectedItem=function(){return m},this.getSelectedItemIndex=function(){return f},this.getNumItems=function(){return c},this.isLastItem=function(){return f==c-1},this.isFirstItem=function(){return 0==f},this.getOptions=function(){return v},this.getElement=function(){return a},this.___________SET_CONTROLS___________=function(){},this.setNextButton=function(e){e.data("ug-button",!0),h.setButtonOnClick(e,p.nextItem)},this.setPrevButton=function(e){e.data("ug-button",!0),h.setButtonOnClick(e,p.prevItem)},this.setFullScreenToggleButton=function(t,i,n){t.data("ug-button",!0);var e=t.html();h.setButtonOnTap(t,p.toggleFullscreen),r.on(p.events.ENTER_FULLSCREEN,function(){var e;t.addClass("ug-fullscreenmode"),i&&0!=i||(e='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_23_15)"><path d="M15.7799 4.88073L13.945 3.08257L15.7799 1.24771C16.0734 0.954129 16.0734 0.513762 15.7799 0.220184C15.4863 -0.0733945 15.0459 -0.0733945 14.7523 0.220184L12.9542 2.01835L11.156 0.220184C11.0092 0.0733945 10.789 0.0733945 10.6422 0.220184C10.5689 0.293578 10.5322 0.366973 10.5322 0.440367L9.72482 5.87156C9.68812 6.09174 9.8716 6.27523 10.0551 6.27523C10.0918 6.27523 10.0918 6.27523 10.1285 6.27523L15.5597 5.50459C15.7432 5.46789 15.89 5.2844 15.8533 5.10092C15.8533 5.02752 15.8166 4.95413 15.7799 4.88073Z" fill="white"/><path d="M10.4955 15.5596C10.5321 15.7431 10.7156 15.8899 10.8991 15.8532C10.9725 15.8532 11.0459 15.8165 11.1193 15.7431L12.9175 13.945L14.7156 15.7431C15.0092 16.0367 15.4496 16.0367 15.7432 15.7431C16.0367 15.4495 16.0367 15.0092 15.7432 14.7156L13.945 12.9174L15.7432 11.1193C15.8899 10.9725 15.8899 10.7523 15.7432 10.6055C15.6698 10.5321 15.5964 10.4954 15.523 10.4954L10.0918 9.72478C9.90829 9.68808 9.68811 9.83487 9.68811 10.0184C9.68811 10.0551 9.68811 10.0917 9.68811 10.1284L10.4955 15.5596Z" fill="white"/><path d="M0.220184 11.1192L2.01835 12.9174L0.220184 14.7156C-0.0733945 15.0091 -0.0733945 15.4495 0.220184 15.7431C0.513762 16.0367 0.954129 16.0367 1.24771 15.7431L3.04587 13.9449L4.84404 15.7431C4.99083 15.8899 5.21101 15.8899 5.3578 15.7431C5.43119 15.6697 5.46789 15.5963 5.46789 15.5229L6.23853 10.0917C6.27523 9.90823 6.12844 9.68805 5.94495 9.68805C5.90826 9.68805 5.87156 9.68805 5.83486 9.68805L0.440367 10.4954C0.256881 10.5321 0.110092 10.7156 0.146789 10.8991C0.110092 10.9725 0.146789 11.0458 0.220184 11.1192Z" fill="white"/><path d="M1.24771 0.220184C0.954129 -0.0733945 0.513762 -0.0733945 0.220184 0.220184C-0.0733945 0.513762 -0.0733945 0.954129 0.220184 1.24771L2.01835 3.04587L0.220184 4.84404C0.0733945 4.99083 0.0733945 5.21101 0.220184 5.3578C0.256881 5.46789 0.330275 5.50459 0.440367 5.50459L5.87156 6.27523C6.05505 6.31193 6.27523 6.16514 6.27523 5.98165C6.27523 5.94495 6.27523 5.90826 6.27523 5.87156L5.50459 0.440367C5.46789 0.256881 5.2844 0.110092 5.10092 0.146789C5.02752 0.146789 4.95413 0.183486 4.88073 0.256881L3.08257 2.01835L1.24771 0.220184Z" fill="white"/></g><defs><clipPath id="clip0_23_15"><rect width="16" height="16" fill="white"/></clipPath></defs></svg>'),1==i&&(e=n),t.html(e)}),r.on(p.events.EXIT_FULLSCREEN,function(){t.removeClass("ug-fullscreenmode"),t.html(e)})},this.destroyFullscreenButton=function(e){h.destroyButton(e),r.off(p.events.ENTER_FULLSCREEN),r.off(p.events.EXIT_FULLSCREEN)},this.setPlayButton=function(t,i,n){t.data("ug-button",!0);var e=t.html();h.setButtonOnClick(t,p.togglePlayMode),r.on(p.events.START_PLAY,function(){var e;t.addClass("ug-stop-mode"),e=0==i?'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16"><g transform="translate(0, 0)"><path fill="#ffffff" d="M5,1H2C1.4,1,1,1.4,1,2v12c0,0.6,0.4,1,1,1h3c0.6,0,1-0.4,1-1V2C6,1.4,5.6,1,5,1z"></path><path fill="#ffffff" d="M14,1h-3c-0.6,0-1,0.4-1,1v12c0,0.6,0.4,1,1,1h3c0.6,0,1-0.4,1-1V2C15,1.4,14.6,1,14,1z"></path></g></svg>':n,t.html(e)}),r.on(p.events.STOP_PLAY,function(){t.removeClass("ug-stop-mode"),t.html(e)})},this.destroyPlayButton=function(e){h.destroyButton(e),r.off(p.events.START_PLAY),r.off(p.events.STOP_PLAY)},this.setProgressIndicator=function(e){y.objProgress=e},this.setTextContainers=function(t,i){r.on(p.events.ITEM_CHANGE,function(){var e=p.getSelectedItem();t.html(e.title),i.html(e.description)})},this.showDisabledOverlay=function(){a.children(".ug-overlay-disabled").show()},this.hideDisabledOverlay=function(){a.children(".ug-overlay-disabled").hide()},this.___________END_SET_CONTROLS___________=function(){},this.___________PLAY_MODE___________=function(){},this.startPlayMode=function(){var e;y.isPlayMode=!0,y.isPlayModePaused=!1,y.playTimePassed=0,y.playTimeLastStep=jQuery.now(),y.playHandle=setInterval(Q,y.playStepInterval),y.objProgress&&(e=y.objProgress.getElement(),y.objProgress.setProgress(0),e.show()),r.trigger(p.events.START_PLAY),l&&1==l.isCurrentSlideLoadingImage()&&p.pausePlaying()},this.resetPlaying=function(){if(0==y.isPlayMode)return!0;y.playTimePassed=0,y.playTimeLastStep=jQuery.now()},this.pausePlaying=function(){if(1==y.isPlayModePaused)return!0;y.isPlayModePaused=!0,clearInterval(y.playHandle),r.trigger(p.events.PAUSE_PLAYING)},this.continuePlaying=function(){if(0==y.isPlayModePaused)return!0;y.isPlayModePaused=!1,y.playTimeLastStep=jQuery.now(),y.playHandle=setInterval(Q,y.playStepInterval)},this.stopPlayMode=function(){y.isPlayMode=!1,clearInterval(y.playHandle),y.playTimePassed=0,y.objProgress&&y.objProgress.getElement().hide(),r.trigger(p.events.STOP_PLAY)},this.isPlayMode=function(){return y.isPlayMode},this.togglePlayMode=function(){0==p.isPlayMode()?p.startPlayMode():p.stopPlayMode()},this.___________GENERAL_EXTERNAL___________=function(){},this.getCurrentNumItem=function(){return f},this.shuffleItems=function(){for(var e in g=h.arrayShuffle(g))g[e].index=parseInt(e)},this.setOptions=function(e){v=jQuery.extend(v,e)},this.selectItem=function(e,t){"number"==typeof e&&(e=p.getItem(e));var i=e.index;if(i==f)return!0;null!=m&&(s&&s.setThumbUnselected(m.objThumbWrapper),m=null,f=-1),m=e,f=i,r.trigger(p.events.ITEM_CHANGE,[e,t]),1==y.isPlayMode&&(p.resetPlaying(),1==l.isCurrentSlideLoadingImage()&&p.pausePlaying())},this.nextItem=function(){var e=f+1;return 0==c||(0==v.gallery_carousel&&c<=e||(c<=e&&(e=0),void p.selectItem(e,"next")))},this.prevItem=function(){var e=-1==f?0:f-1;return 0==c||(0==v.gallery_carousel&&e<0||(e<0&&(e=c-1),void p.selectItem(e,"prev")))},this.isFullScreen=function(){return 1==y.isFakeFullscreen||1==h.isFullScreen()},this.isFakeFullscreen=function(){return y.isFakeFullscreen},this.toFullScreen=function(){h.setGlobalData("fullscreenID",o);var e=a.get(0);0==h.toFullscreen(e)&&(jQuery("body").addClass("ug-body-fullscreen"),a.addClass("ug-fake-fullscreen"),y.isFakeFullscreen=!0,r.trigger(p.events.ENTER_FULLSCREEN),r.trigger(p.events.SIZE_CHANGE))},this.exitFullScreen=function(){1==y.isFakeFullscreen?(jQuery("body").removeClass("ug-body-fullscreen"),a.removeClass("ug-fake-fullscreen"),y.isFakeFullscreen=!1,r.trigger(p.events.EXIT_FULLSCREEN),r.trigger(p.events.SIZE_CHANGE)):h.exitFullscreen()},this.toggleFullscreen=function(){0==p.isFullScreen()?p.toFullScreen():p.exitFullScreen()},this.resize=function(e,t,i){a.css("width","auto"),a.css("max-width",e+"px"),t&&a.height(t),i||!0===i||L()},this.setSizeClass=function(e,t){e=e||a,0==(t=t||jQuery(window).width())&&(t=jQuery(window).width());var i="";if(t<=480?i="ug-under-480":t<=780?i="ug-under-780":t<960&&(i="ug-under-960"),1==e.hasClass(i))return!0;(t=(t=e)||a).removeClass("ug-under-480"),t.removeClass("ug-under-780"),t.removeClass("ug-under-960"),""!=i&&e.addClass(i)},this.isMobileMode=function(){return!!a.hasClass("ug-under-780")||!!a.hasClass("ug-under-480")},this.isTabletMode=function(){return!!a.hasClass("ug-under-960")||(a.hasClass("ug-under-780")||a.hasClass("ug-under-480"),!1)},this.isSmallWindow=function(){var e=jQuery(window).width();return!e||e<=480},this.isGalleryVisible=function(){return a.is(":visible")},this.isGalleryInsideScreen=function(){return 1!=y.isFreestyleMode&&(!!l&&h.isElementInsideScreen(a))},this.changeItems=function(e,t){w(o,"nochange",e=e||"noitems",t)},this.addItems=function(e){if(!e||0==e.length)return!1;var t=a.children(".ug-newitems-wrapper");if(0==t.length&&a.append("<div class='ug-newitems-wrapper' style='display:none'></div>"),(t=a.children(".ug-newitems-wrapper")).append(e),C(jQuery(t.children()),!0),A(),!_||"function"!=typeof _.addItems)throw new Error("addItems function not found in the theme");t.remove(),_.addItems()},this.getNewAddedItemsIndexes=function(){var i=[];return jQuery.each(g,function(e,t){1==t.isNewAdded&&i.push(e)}),i},this.showErrorMessageReplaceGallery=function(e){x(e)},this.setFuncCustomHeight=function(e){y.funcCustomHeight=e},this.setObjLightbox=function(e){u=e},this.__________EXTERNAL_EVENTS_______=function(){},this.triggerEvent=function(e,t){t?("array"!=jQuery.type(t)&&(t=[t]),r.trigger(e,t)):r.trigger(e)},this.onEvent=function(e,t){r.on(e,t)},this.destroyEvent=function(e){r.off(e)},this.__________AJAX_REQUEST_______=function(){},this.ajaxRequest=function(e,t,i,n){if(!i||"function"!=typeof i)throw new Error("ajaxRequest error: success function should be passed");var r=v.gallery_urlajax;if(!r||""==r)throw new Error("ajaxRequest error: Ajax url don't passed");void 0===t&&(t={});t={action:"unitegallery_ajax_action",client_action:e,galleryID:o,data:t};jQuery.ajax({type:"post",url:v.gallery_urlajax,dataType:"json",data:t,success:function(e){if(!e)throw new Error("Empty ajax response!");if(-1==e||0===e)throw new Error("ajax error!!!");if(void 0===e.success)throw new Error("ajax error!!!");if(0==e.success)return x(e.message,"ajax error"),!1;i(e)},error:function(e,t,i){console.log("Ajax Error!!! "+t),responseText=e.responseText,(n&&"function"==typeof n?n:trace)(responseText)}})},this.requestNewItems=function(e,t,i){var n=v.gallery_enable_cache;i=i||e,1==t&&(n=!1),1==n&&b.hasOwnProperty(i)?(n=b[i],p.changeItems(n,i)):(r.trigger(p.events.GALLERY_BEFORE_REQUEST_ITEMS),p.ajaxRequest("front_get_cat_items",{catid:e},function(e){e=e.html;p.changeItems(e,i)}))},this.run=function(e,t){if(t&&t.hasOwnProperty("gallery_debug_errors")&&(v.gallery_debug_errors=t.gallery_debug_errors),1==v.gallery_debug_errors)try{w(e,t)}catch(e){var i,n,r;"object"==typeof e?(r=e.message,i=e.lineNumber,n=e.fileName,e.stack,r+=" <br><br> in file: "+n,r+=" <b> line "+i+"</b>",trace(e)):r=e,x(r=r.replace("Error:",""))}else w(e,t)}}function UGLightbox(){var i,l,o,u,d,c,a,s,r=this,n=jQuery(this),_=new UniteGalleryMain,h=new UGSlider,g=new UGFunctions,p=new UGTextPanel,m={lightbox_type:"wide",lightbox_show_textpanel:!0,lightbox_textpanel_width:550,lightbox_hide_arrows_onvideoplay:!0,lightbox_arrows_position:"sides",lightbox_arrows_offset:10,lightbox_arrows_inside_offset:10,lightbox_arrows_inside_alwayson:!1,lightbox_overlay_color:null,lightbox_overlay_opacity:1,lightbox_top_panel_opacity:null,lightbox_show_numbers:!0,lightbox_numbers_size:null,lightbox_numbers_color:null,lightbox_numbers_padding_top:null,lightbox_numbers_padding_right:null,lightbox_compact_closebutton_offsetx:1,lightbox_compact_closebutton_offsety:1,lightbox_close_on_emptyspace:!0,lightbox_close_icon_type:"default",lightbox_close_icon_color:"#ffffff",lightbox_close_icon_color_custom:"#ffffff",lightbox_close_icon_custom:"",lightbox_close_icon_size_custom:24,lightbox_arrows_type:"default",lightbox_arrows_color:"#ffffff",lightbox_arrows_color_custom:"#ffffff",lightbox_arrow_next_custom:"",lightbox_arrow_prev_custom:"",lightbox_arrows_size_custom:32},f={topPanelHeight:44,initTextPanelHeight:26,isOpened:!(this.events={LIGHTBOX_INIT:"lightbox_init"}),isRightNowOpened:!1,putSlider:!0,isCompact:!1,fadeDuration:300,positionFrom:null,textPanelTop:null,textPanelLeft:null,isArrowsInside:!1,isArrowsOnHoverMode:!1,lastMouseX:null,lastMouseY:null,originalOptions:null,isSliderChangedOnce:!1,isTopPanelEnabled:!0},b={lightbox_slider_controls_always_on:!0,lightbox_slider_enable_bullets:!1,lightbox_slider_enable_arrows:!1,lightbox_slider_enable_progress_indicator:!1,lightbox_slider_enable_play_button:!1,lightbox_slider_enable_fullscreen_button:!1,lightbox_slider_enable_zoom_panel:!1,lightbox_slider_enable_text_panel:!1,lightbox_slider_scale_mode_media:"down",lightbox_slider_scale_mode:"down",lightbox_slider_loader_type:3,lightbox_slider_loader_color:"black",lightbox_slider_transition:"fade",lightbox_slider_image_padding_top:f.topPanelHeight,lightbox_slider_image_padding_bottom:0,lightbox_slider_video_padding_top:38,lightbox_slider_video_padding_bottom:0,lightbox_textpanel_align:"middle",lightbox_textpanel_padding_top:5,lightbox_textpanel_padding_bottom:5,slider_video_constantsize:!1,lightbox_slider_image_border:!1,lightbox_textpanel_enable_title:!0,lightbox_textpanel_enable_description:!1,lightbox_textpanel_desc_style_as_title:!0,lightbox_textpanel_enable_bg:!1,video_enable_closebutton:!1,lightbox_slider_video_enable_closebutton:!1,video_youtube_showinfo:!1,lightbox_slider_enable_links:!1},v={lightbox_overlay_opacity:.6,lightbox_slider_image_border:!0,lightbox_slider_image_shadow:!0,lightbox_slider_image_padding_top:30,lightbox_slider_image_padding_bottom:30,slider_video_constantsize:!0,lightbox_textpanel_align:"bottom",lightbox_textpanel_title_text_align:"left",lightbox_textpanel_desc_text_align:"left",lightbox_textpanel_padding_left:10,lightbox_textpanel_padding_right:10};function y(){1==f.isCompact&&1==m.lightbox_show_textpanel&&(m.lightbox_slider_image_padding_bottom=f.initTextPanelHeight),1==f.isCompact&&"inside"==m.lightbox_arrows_position&&(f.isArrowsInside=!0),1==f.isArrowsInside&&0==m.lightbox_arrows_inside_alwayson&&(f.isArrowsOnHoverMode=!0),0==m.lightbox_show_textpanel&&(f.isTopPanelEnabled=!1,f.topPanelHeight=0,m.lightbox_slider_image_padding_top=0)}function w(e){if(!h)return 1;e={slider_image_padding_top:e};h.setOptions(e),h.refreshSlideItems()}function E(){var e,t,i;s&&(!p||0!=(e=s.height())&&0!=s.is(":visible")&&(t=e,i=p.getSize().height,e!=f.topPanelHeight&&(t=f.topPanelHeight),t<i&&(t=i),e!=t&&(s.height(t),h&&0==h.isAnimating()&&w(t))))}function x(e){if(0==f.isOpened)return!1;if(!p)return!1;if(!h)return!1;var t,i=g.getElementSize(l),n=p.getSize();if(0==n.width||120<n.height)return!1;if(e||(t=h.getSlideImage(),e=g.getElementSize(t)),0==e.height||0==e.width)return!1;if(e.bottom+n.height<i.height)return!1;i=h.getOptions(),n=n.height;if(n!=i.slider_image_padding_bottom){n={slider_image_padding_bottom:n};if(0==h.isAnimating())return h.setOptions(n),h.refreshSlideItems(),!0}return!1}function T(e){g.getElementSize(l);var t,i,n=h.getSlideImage(),r=g.getElementSize(n);0!=r.width&&(f.textPanelLeft=r.left,f.textPanelTop=r.bottom,n=r.width,a&&(n-=(t=g.getElementSize(a)).width,t=r.right-t.width,g.placeElement(a,t,f.textPanelTop)),p&&(p.show(),p.refresh(!0,!0,n),(t=r)||(n=h.getSlideImage(),t=g.getElementSize(n)),f.textPanelTop=t.bottom,!0===i&&p.positionPanel(f.textPanelTop,f.textPanelLeft)),0==x(r)&&(f.positionFrom="handleCompactTextpanelSizes",p&&(p.positionPanel(f.textPanelTop,f.textPanelLeft),!0===e&&(e(),N()))))}function I(){return 0==h.isCurrentSlideType("image")||1==h.isCurrentImageInPlace()}function S(e,t){var i,n,r,o,a,s;0!=f.isArrowsInside&&u&&(o=I(),u.show(),d.show(),f.positionFrom="positionArrowsInside",1==f.isArrowsOnHoverMode&&1==o&&0==j()&&M(!0),o=(r=0==o?(i=g.getElementRelativePos(u,"left",m.lightbox_arrows_offset),n=g.getElementRelativePos(u,"middle"),g.getElementRelativePos(d,"right",m.lightbox_arrows_offset)):(a=h.getSlideImage(),s=g.getElementSize(a),g.getElementSize(h.getElement()),i=g.getElementRelativePos(u,"left",0,a)+s.left+m.lightbox_arrows_inside_offset,n=g.getElementRelativePos(u,"middle",0,a)+s.top,g.getElementRelativePos(u,"right",0,a)+s.left-m.lightbox_arrows_inside_offset),n),!0===t?(a={left:i,top:n},s={left:r,top:o},u.stop().animate(a,{duration:f.fadeDuration}),d.stop().animate(s,{duration:f.fadeDuration})):(u.stop(),d.stop(),g.placeElement(u,i,n),g.placeElement(d,r,o)),1==e&&O(t))}function P(e,t){f.positionFrom=null;var i,n,r,o,a=I(),s=g.getElementRelativePos(c,"right",2,l);0==a?(o=2,r=s):(n=h.getSlideImage(),i=g.getElementSize(n),a=g.getElementSize(h.getElement()),n=g.getElementSize(c),a.top==a.height&&(a.top=0),r=a.left+i.right-n.width/2+m.lightbox_compact_closebutton_offsetx,(o=a.top+i.top-n.height/2-m.lightbox_compact_closebutton_offsety)<2&&(o=2),s<r&&(r=s)),!0===t?(s={left:r,top:o},c.stop().animate(s,{duration:f.fadeDuration})):(c.stop(),g.placeElement(c,r,o)),!0===e&&(!0!==t&&c.stop(),c.fadeTo(f.fadeDuration,1))}function t(){c&&c.stop().fadeTo(f.fadeDuration,0),e(),A(),f.positionFrom="hideCompactElements",1==f.isArrowsInside&&M()}function C(){var e,t=g.getElementSize(l);s&&g.setElementSizeAndPosition(s,0,0,t.width,f.topPanelHeight),u&&0==f.isArrowsInside&&(1==m.lightbox_hide_arrows_onvideoplay&&(u.show(),d.show()),g.placeElement(u,"left","middle",m.lightbox_arrows_offset),g.placeElement(d,"right","middle",m.lightbox_arrows_offset)),0==f.isCompact&&g.placeElement(c,"right","top",2,2),p&&(f.positionFrom="positionElements",0==f.isCompact?(e=t,n={},i=m.lightbox_textpanel_width,e.width-47-40<i?(n.textpanel_padding_left=47,n.textpanel_padding_right=40,n.textpanel_title_text_align="center",n.textpanel_desc_text_align="center"):(n.textpanel_padding_left=Math.floor((e.width-i)/2),n.textpanel_padding_right=n.textpanel_padding_left,n.textpanel_title_text_align="left",n.textpanel_desc_text_align="left",m.lightbox_textpanel_title_text_align&&(n.textpanel_title_text_align=m.lightbox_textpanel_desc_text_align),m.lightbox_textpanel_desc_text_align&&(n.textpanel_desc_text_align=m.lightbox_textpanel_desc_text_align)),p.setOptions(n),p.refresh(!0,!0),E(),p.positionPanel()):(z(),N()));var i=t.width,n=t.height;h&&(s&&(t={slider_image_padding_top:s.height()},h.setOptions(t)),h.setSize(i,n),h.setPosition(0,0))}function e(){p&&p.getElement().stop().fadeTo(f.fadeDuration,0)}function A(){a&&a.stop().fadeTo(f.fadeDuration,0)}function j(){if(!f.lastMouseX)return!0;var e={pageX:f.lastMouseX,pageY:f.lastMouseY};return h.isMouseInsideSlideImage(e)}function M(e,t){return u&&(1==f.isArrowsOnHoverMode&&!1===t?(j(),1):void(!0===e?(u.stop().fadeTo(0,0),d.stop().fadeTo(0,0)):(u.stop().fadeTo(f.fadeDuration,0),d.stop().fadeTo(f.fadeDuration,0))))}function O(e,t){return u&&(1==f.isArrowsOnHoverMode&&!0!==t&&1==I()||(1==h.isSwiping()||(!0!==e&&(u.stop(),d.stop()),u.fadeTo(f.fadeDuration,1),void d.fadeTo(f.fadeDuration,1))))}function k(e){p&&(e=e||h.getCurrentItem(),p.setTextPlain(e.title,e.description))}function L(e){var t;a&&(e=e||h.getCurrentItem(),t=_.getNumItems(),e=e.index+1,a.html(e+" / "+t))}function z(){p&&p.getElement().show().stop().fadeTo(f.fadeDuration,1)}function N(){a&&a.stop().fadeTo(f.fadeDuration,1)}function H(){if(0==f.isCompact)return!0;t()}function R(){if(0==f.isCompact)return!0;f.positionFrom="onZoomChange",P(!1,!0),S(!1,!0),1==f.isCompact&&(0==(h.isCurrentSlideType("image")&&1==h.isCurrentImageInPlace())?(e(),A()):(f.positionFrom="onZoomChange",z(),N()))}function D(){if(0==f.isCompact)return!0;f.positionFrom="onSliderAfterReturn",P(!0),S(!0),0==x()&&T(),z(),N()}function G(e,t){return t=jQuery(t),0==f.isCompact||(0==h.isSlideCurrent(t)||(f.positionFrom="onSliderAfterPutImage",P(!0),S(!0),void T()))}function Q(){var e,t=h.getOptions().slider_image_padding_top;!s||(e=s.height())!=t&&w(e),1==f.isCompact&&(k(),L(),f.positionFrom="onSliderTransitionEnd",P(!0),S(!0),0==h.isSlideActionActive()&&0==x()&&T(),z(),N())}function B(e,t){0==f.isCompact?(a&&L(t),p&&(k(t),0==f.isRightNowOpened&&(p.positionElements(!1),E(),p.positionPanel()))):0==h.isAnimating()&&(p&&k(t),a&&L(t)),0==f.isSliderChangedOnce&&(f.isSliderChangedOnce=!0,n.trigger(r.events.LIGHTBOX_INIT))}function F(e,t){return!("image"==h.getSlideType()||0!=f.isCompact||!h.isSlideActionActive())||(1==h.isPreloading()?(r.close("slider"),!0):void(1==m.lightbox_close_on_emptyspace&&0==h.isMouseInsideSlideImage(t)&&r.close("slider_inside")))}function W(){C()}function U(){s?s&&s.hide():a&&a.hide(),u&&1==m.lightbox_hide_arrows_onvideoplay&&(u.hide(),d.hide())}function Y(){s?(s&&s.show(),E()):a&&a.show(),u&&1==m.lightbox_hide_arrows_onvideoplay&&(u.show(),d.show())}function V(e,t,i){var n=!1;switch(t){case 27:1==f.isOpened&&r.close("keypress");break;case 38:case 40:case 33:case 34:n=!0}1==f.isOpened&&1==n&&i.preventDefault()}function X(){1==f.isArrowsOnHoverMode&&O(!1,!0)}function Z(e){f.positionFrom="hideCompactElements",1==f.isArrowsOnHoverMode&&1==I()&&M(!1,!0)}function q(e){f.lastMouseX=e.pageX,f.lastMouseY=e.pageY,1==(!u||(0==u.is(":visible")||1!=u.css("opacity")))&&j()&&0==h.isAnimating()&&(f.positionFrom="onMouseMove",u&&0==u.is(":animated")&&O(!1,!0))}function K(e,t,i,n){if(0==f.isOpened)return!0;switch(m.gallery_mousewheel_role){default:case"zoom":"image"!=h.getSlideType()&&e.preventDefault();break;case"none":e.preventDefault();break;case"advance":_.onGalleryMouseWheel(e,t,i,n)}}this.destroy=function(){var e;jQuery(document).unbind("mousemove"),o.off("touchstart"),o.off("touchend"),c.off("click"),i.off(_.events.ITEM_CHANGE),h&&(jQuery(h).off(h.events.TRANSITION_END),jQuery(h).off(h.events.CLICK),jQuery(h).off(h.events.START_DRAG),jQuery(h).off(h.events.TRANSITION_START),jQuery(h).off(h.events.AFTER_DRAG_CHANGE),jQuery(h).off(h.events.AFTER_RETURN),e=h.getVideoObject(),jQuery(e).off(e.events.PLAY_START),jQuery(e).off(e.events.PLAY_STOP),jQuery(h).on(h.events.IMAGE_MOUSEENTER,X),jQuery(h).on(h.events.IMAGE_MOUSELEAVE,Z),h.destroy()),jQuery(window).unbind("resize"),i.off(_.events.GALLERY_KEYPRESS,V),l.off("mousewheel"),l.remove()},this.isOpened=function(){return f.isOpened},this.open=function(e){e=_.getItem(e);f.isOpened=!0,f.isRightNowOpened=!0,setTimeout(function(){f.isRightNowOpened=!1},100),h&&h.setItem(e,"lightbox_open"),p&&p.setTextPlain(e.title,e.description),o.stop().fadeTo(0,0),l.show(),l.fadeTo(0,1),o.stop().fadeTo(f.fadeDuration,m.lightbox_overlay_opacity),C(),1==f.isCompact&&(1==h.isPreloading()?(c&&c.hide(),u&&1==f.isArrowsInside&&(u.hide(),d.hide()),a&&a.hide(),p&&p.hide()):1==f.isArrowsInside&&(u.hide(),d.hide())),h&&h.startSlideAction(),i.trigger(_.events.OPEN_LIGHTBOX,e)},this.close=function(e){f.isOpened=!1,1==f.isCompact&&t(),h&&h.stopSlideAction(),"image"!=h.getSlideType()?l.hide():l.fadeTo(f.fadeDuration,0,function(){l.hide()}),i.trigger(_.events.CLOSE_LIGHTBOX)},this.init=function(e,t){t=t,_=e=e,i=jQuery(e),_.setObjLightbox(r),m=jQuery.extend(m,b),m=jQuery.extend(m,t),f.originalOptions=jQuery.extend({},m),"compact"==m.lightbox_type&&(f.isCompact=!0,m=jQuery.extend(m,v),m=jQuery.extend(m,t)),y(),h=1==f.putSlider?(_.initSlider(m,"lightbox"),e.getObjects().g_objSlider):null,1==m.lightbox_show_textpanel?p.init(_,m,"lightbox"):p=null},this.putHtml=function(){_.isSmallWindow()&&1==f.isCompact&&(f.isCompact=!1,y(),f.isArrowsInside=!1,f.isArrowsOnHoverMode=!1,(m=jQuery.extend({},f.originalOptions)).lightbox_arrows_position="sides",h.setOptions(m)),function(){var e="",t="";1==f.isCompact&&(t=" ug-lightbox-compact"),e+="<div class='ug-gallery-wrapper ug-lightbox"+t+"' >",e+="<div class='ug-lightbox-overlay'></div>",0==f.isCompact&&f.isTopPanelEnabled?(e+="<div class='ug-lightbox-top-panel'>",e+="<div class='ug-lightbox-top-panel-overlay'></div>",m.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>"),e+="</div>"):m.lightbox_show_numbers&&(e+="<div class='ug-lightbox-numbers'></div>");var i='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g transform="translate(0, 0)"><path fill="'+m.lightbox_close_icon_color+'" d="M19.7,4.3c-0.4-0.4-1-0.4-1.4,0L12,10.6L5.7,4.3c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l6.3,6.3l-6.3,6.3 c-0.4,0.4-0.4,1,0,1.4C4.5,19.9,4.7,20,5,20s0.5-0.1,0.7-0.3l6.3-6.3l6.3,6.3c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3 c0.4-0.4,0.4-1,0-1.4L13.4,12l6.3-6.3C20.1,5.3,20.1,4.7,19.7,4.3z"/></g></svg>';"compact"==m.lightbox_type&&(i='<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_15_2)"><rect width="22" height="22" rx="11" fill="black"/><path d="M7 7L11 11M15 15L11 11M11 11L7 15L15 7" stroke="white" stroke-width="2"/><path d="M3.5 18.5C7.64213 22.6421 14.3579 22.6421 18.5 18.5C22.6421 14.3579 22.6421 7.64214 18.5 3.5C14.3579 -0.642134 7.64213 -0.642134 3.5 3.5C-0.642135 7.64214 -0.642135 14.3579 3.5 18.5Z" stroke="white"/></g><defs><clipPath id="clip0_15_2"><rect width="22" height="22" rx="11" fill="white"/></clipPath></defs></svg>');var n="";"custom"==m.lightbox_close_icon_type&&(i=m.lightbox_close_icon_custom,n="ug-lightbox-button-close-custom"),e+='<div href="javascript:void(0)" class=\'ug-lightbox-button-close '+n+"'>"+i+"</div>";var r,t='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g transform="translate(0, 0)"><path d="M11.775.592a.5.5,0,0,0-.7-.092L8.7,2.329a.5.5,0,0,0-.092.7L18.581,16,8.6,28.97a.5.5,0,0,0,.092.7L11.074,31.5a.5.5,0,0,0,.7-.092L23.4,16.305a.5.5,0,0,0,0-.61Z" fill="'+m.lightbox_arrows_color+'"/></g></svg>',n='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"><g transform="translate(0, 0)"><path d="M23.5,2.661a.5.5,0,0,0-.191-.332L20.926.5a.5.5,0,0,0-.7.092L8.6,15.7a.5.5,0,0,0,0,.61l11.621,15.1a.5.5,0,0,0,.7.092L23.3,29.671a.5.5,0,0,0,.092-.7L13.419,16,23.4,3.03A.5.5,0,0,0,23.5,2.661Z" fill="'+m.lightbox_arrows_color+'"/></g></svg>',i="";"custom"==m.lightbox_arrows_type&&(t=m.lightbox_arrow_next_custom,n=m.lightbox_arrow_prev_custom,i="ug-lightbox-arrow-custom"),e+="<div class='ug-lightbox-arrow-left "+i+"'>"+n+"</div>",e+="<div class='ug-lightbox-arrow-right "+i+"'>"+t+"</div>",e+="</div>",l=jQuery(e),jQuery("body").append(l),h&&h.setHtml(l),o=l.children(".ug-lightbox-overlay"),0==f.isCompact&&1==f.isTopPanelEnabled&&0==(s=l.children(".ug-lightbox-top-panel")).length&&(s=null),c=l.find(".ug-lightbox-button-close"),"custom"==m.lightbox_close_icon_type&&(c.css({color:m.lightbox_close_icon_color_custom,"font-size":m.lightbox_close_icon_size_custom+"px"}),(r=c.find("svg"))&&0<r.length&&r.css({fill:m.lightbox_close_icon_color_custom,width:m.lightbox_close_icon_size_custom+"px",height:m.lightbox_close_icon_size_custom+"px"})),m.lightbox_show_numbers&&(a=l.find(".ug-lightbox-numbers")),u=l.children(".ug-lightbox-arrow-left"),d=l.children(".ug-lightbox-arrow-right"),"custom"==m.lightbox_arrows_type&&(u.css({color:m.lightbox_arrows_color_custom,"font-size":m.lightbox_arrows_size_custom+"px"}),(r=u.find("svg"))&&0<r.length&&r.css({fill:m.lightbox_arrows_color_custom,width:m.lightbox_arrows_size_custom+"px",height:m.lightbox_arrows_size_custom+"px"}),d.css({color:m.lightbox_arrows_color_custom,"font-size":m.lightbox_arrows_size_custom+"px"}),(r=d.find("svg"))&&0<r.length&&r.css({fill:m.lightbox_arrows_color_custom,width:m.lightbox_arrows_size_custom+"px",height:m.lightbox_arrows_size_custom+"px"})),p&&(s?p.appendHTML(s):p.appendHTML(l))}()},this.run=function(){var e;"none"==m.lightbox_type&&this.destroy(),null!==m.lightbox_overlay_color&&o.css("background-color",m.lightbox_overlay_color),null!==m.lightbox_overlay_opacity&&o.fadeTo(0,m.lightbox_overlay_opacity),s&&null!==m.lightbox_top_panel_opacity&&s.children(".ug-lightbox-top-panel-overlay").fadeTo(0,m.lightbox_top_panel_opacity),a&&(e={},null!==m.lightbox_numbers_size&&(e["font-size"]=m.lightbox_numbers_size+"px"),m.lightbox_numbers_color&&(e.color=m.lightbox_numbers_color),null!==m.lightbox_numbers_padding_right&&(e["padding-right"]=m.lightbox_numbers_padding_right+"px"),null!==m.lightbox_numbers_padding_top&&(e["padding-top"]=m.lightbox_numbers_padding_top+"px"),a.css(e)),h&&h.run(),o.on("touchstart",function(e){e.preventDefault()}),o.on("touchend",function(e){r.close("overlay")}),g.addClassOnHover(d,"ug-arrow-hover"),g.addClassOnHover(u,"ug-arrow-hover"),g.addClassOnHover(c),_.setNextButton(d),_.setPrevButton(u),c.on("click",function(){r.close("button")}),i.on(_.events.ITEM_CHANGE,B),h&&(jQuery(h).on(h.events.TRANSITION_END,Q),jQuery(h).on(h.events.CLICK,F),e=h.getVideoObject(),jQuery(e).on(e.events.PLAY_START,U),jQuery(e).on(e.events.PLAY_STOP,Y),jQuery(h).on(h.events.START_DRAG,H),jQuery(h).on(h.events.TRANSITION_START,H),jQuery(h).on(h.events.AFTER_DRAG_CHANGE,D),jQuery(h).on(h.events.AFTER_RETURN,D),jQuery(h).on(h.events.AFTER_PUT_IMAGE,G),jQuery(h).on(h.events.ZOOM_CHANGE,R),jQuery(h).on(h.events.IMAGE_MOUSEENTER,X),jQuery(h).on(h.events.IMAGE_MOUSELEAVE,Z)),jQuery(window).resize(function(){return 0==f.isOpened||void g.whenContiniousEventOver("lightbox_resize",W,100)}),i.on(_.events.GALLERY_KEYPRESS,V),1==f.isArrowsOnHoverMode&&jQuery(document).bind("mousemove",q),l.on("mousewheel",K)}}function UGCarousel(){var n,r,s,l,o,a=this,u=jQuery(this),d=new UniteGalleryMain,c=new UGFunctions,_=new UGTileDesign,h=new UGThumbsGeneral,g={carousel_padding:8,carousel_space_between_tiles:20,carousel_navigation_numtiles:3,carousel_scroll_duration:500,carousel_scroll_easing:"easeOutCubic",carousel_autoplay:!0,carousel_autoplay_timeout:3e3,carousel_autoplay_direction:"right",carousel_autoplay_pause_onhover:!0,carousel_vertical_scroll_ondrag:!1},p={eventSizeChange:"thumb_size_change",isFirstTimeRun:!0,carouselMaxWidth:null,tileWidth:0,initTileWidth:0,initTileHeight:0,sideSpace:1500,spaceActionSize:500,numCurrent:0,touchActive:!(this.events={START_PLAY:"carousel_start_play",PAUSE_PLAY:"carousel_pause_play",STOP_PLAY:"carousel_stop_play"}),startInnerPos:0,lastTime:0,startTime:0,startMousePos:0,lastMousePos:0,scrollShortDuration:200,scrollShortEasing:"easeOutQuad",handle:null,isPlayMode:!1,isPaused:!1,storedEventID:"carousel"};function i(e,t){t=t||p.initTileHeight/p.initTileWidth*e;var i={tile_width:p.tileWidth=e,tile_height:t};_.setOptions(i),g.tile_width=e,g.tile_height=t,_.resizeAllTiles(e),x(!0)}function e(){if(null===p.carouselMaxWidth)throw new Error("The carousel width not set");var e;p.tileWidth<p.initTileWidth?((e=p.carouselMaxWidth-2*g.carousel_padding)>p.initTileWidth&&(e=p.initTileWidth),i(e),t=c.getNumItemsInSpace(p.carouselMaxWidth,e,g.carousel_space_between_tiles)):(t=c.getNumItemsInSpace(p.carouselMaxWidth,p.tileWidth,g.carousel_space_between_tiles))<=0&&(t=1,i(e=p.carouselMaxWidth-2*g.carousel_padding));var t=c.getSpaceByNumItems(t,p.tileWidth,g.carousel_space_between_tiles);t+=2*g.carousel_padding,s.width(t),1==p.isFirstTimeRun?(_.initEvents(),s.bind("mousedown touchstart",j),jQuery("body").bind("mousemove touchmove",M),jQuery(window).add("body").bind("mouseup touchend",O),s.hover(k,L),_.run(),jQuery.each(r,function(e,t){t.objThumbWrapper.data("index",e),n.trigger(p.eventSizeChange,[t.objThumbWrapper,!0]),t.objTileOriginal=t.objThumbWrapper.clone(!0,!0)}),x(!0)):(1==g.carousel_autoplay&&a.pauseAutoplay(),P(0,!1)),1==g.carousel_autoplay&&a.startAutoplay(),c.placeElement(l,0,g.carousel_padding),C(),p.isFirstTimeRun=!1}function m(){return c.getElementSize(l).left}function f(e){return c.getMousePosition(e).pageX}function b(){return l.children(".ug-thumb-wrapper")}function v(e){return c.getNumItemsInSpace(e,p.tileWidth,g.carousel_space_between_tiles)}function y(){return b().length}function w(e){T(e);var t=b();return jQuery(t[e])}function E(){return v(c.getElementSize(s).width)}function x(e){e=e||!1;var i,n=b(),r=0,o=0;return jQuery.each(n,function(e,t){t=jQuery(t),c.placeElement(t,r,0);t=c.getElementSize(t);r+=t.width+g.carousel_space_between_tiles,o=Math.max(o,t.height),e==n.length-1&&(i=t.right)}),l.width(i),o+=2*g.carousel_padding,!0===e&&(l.height(o),s.height(o)),P(p.numCurrent,!1),i}function T(e){if(e>b().length-1)throw new Error("Wrogn tile number: "+e)}function I(e,i){e=function(e,t,i){if(null==(s=e.data("index")))throw new Error("every tile should have index!");for(var n,r=[],o=0;o<t;o++){if(!(n="prev"==i?d.getPrevItem(s,!0):d.getNextItem(s,!0)))throw new Error("the item to add is empty");var a=n.objTileOriginal.clone(!0,!0),s=n.index;a.addClass("cloned"),r.push(a)}return r}("left"==i?l.children(".ug-thumb-wrapper").first():l.children(".ug-thumb-wrapper").last(),e,"left"==i?"prev":"next");jQuery.each(e,function(e,t){"left"==i?l.prepend(t):l.append(t),n.trigger(p.eventSizeChange,t),_.loadTileImage(t)})}function S(e,t){T(void 0);for(var i=b(),n=i.length,r=0;r<e;r++)("left"==t?jQuery(i[r]):jQuery(i[n-1-r])).remove()}function P(e,t,i){if(void 0===t){t=!0;if(l.is(":animated"))return 1}var n=w(e),r={left:-c.getElementSize(n).left+g.carousel_padding+"px"};!0===t?(n=g.carousel_scroll_duration,t=g.carousel_scroll_easing,!0===i&&(n=p.scrollShortDuration,t=p.scrollShortEasing),l.stop(!0).animate(r,{duration:n,easing:t,queue:!1,complete:function(){p.numCurrent=e,C()}})):(p.numCurrent=e,l.css(r))}function t(){var e,t,i,n;P((e=-m(),t=v(e),i=c.getElementSize(w(t)).left,n=c.getElementSize(w(t+1)).left,Math.abs(i-e)<Math.abs(n-e)?t:t+1),!0,!0)}function C(){var e=(r=-m(),p.sideSpace-r),t=(o=c.getElementSize(s),a=(a=c.getElementSize(l)).width-o.width+a.left,p.sideSpace-a),i=0,n=0,r=0,o=0,a=y();if(e>p.spaceActionSize?(I(i=v(e),"left"),p.numCurrent+=i):e<-p.spaceActionSize&&(S(r=v(Math.abs(e)),"left"),p.numCurrent-=r),t>p.spaceActionSize?I(n=v(t),"right"):t<-p.spaceActionSize&&S(o=v(Math.abs(t)),"right"),a<o)throw new Error("Can't remove more then num tiles");a=!1;return(i||n||r||o)&&(x(),a=!0),a}function A(){"left"==g.carousel_autoplay_direction?a.scrollRight(1):a.scrollLeft(1)}function j(e){if(1==p.touchActive)return!0;p.touchActive=!0,a.pauseAutoplay(),p.startTime=jQuery.now(),p.startMousePos=f(e),p.startInnerPos=m(),p.lastTime=p.startTime,p.lastMousePos=p.startMousePos,c.storeEventData(e,p.storedEventID)}function M(e){if(0==p.touchActive)return!0;c.updateStoredEventData(e,p.storedEventID),e.preventDefault();var t=null;if(1==g.carousel_vertical_scroll_ondrag&&(t=c.handleScrollTop(p.storedEventID)),"vert"===t)return!0;p.lastMousePos=f(e);var i=p.lastMousePos-p.startMousePos,t=p.startInnerPos+i,e=0<i?"prev":"next";0<t&&"prev"==e&&(t/=3),t<-c.getElementSize(l).width&&"next"==e&&(t=p.startInnerPos+i/3),t={left:(t=t)+"px"},l.css(t)}function O(e){if(0==p.touchActive)return!0;p.touchActive=!1,t(),a.unpauseAutoplay()}function k(e){if(0==g.carousel_autoplay_pause_onhover)return!0;1==p.isPlayMode&&0==p.isPaused&&a.pauseAutoplay()}function L(e){if(0==g.carousel_autoplay_pause_onhover)return!0;a.unpauseAutoplay()}function z(){var e=p.lastTime-p.startTime,t=Math.abs(p.lastMousePos-p.startMousePos);return!(300<e)&&!(30<t)}this.startAutoplay=function(){p.isPlayMode=!0,p.isPaused=!1,u.trigger(a.events.START_PLAY),p.handle&&clearInterval(p.handle),p.handle=setInterval(A,g.carousel_autoplay_timeout)},this.unpauseAutoplay=function(){return 0==p.isPlayMode||(0==p.isPaused||void a.startAutoplay())},this.pauseAutoplay=function(){if(0==p.isPlayMode)return!0;p.isPaused=!0,p.handle&&clearInterval(p.handle),u.trigger(a.events.PAUSE_PLAY)},this.stopAutoplay=function(){if(0==p.isPlayMode)return!0;p.isPaused=!1,p.isPlayMode=!1,p.handle&&clearInterval(p.handle),u.trigger(a.events.STOP_PLAY)},this.destroy=function(){p.handle&&clearInterval(p.handle),u.off(a.events.START_PLAY),u.off(a.events.STOP_PLAY),s.unbind("mousedown"),s.unbind("touchstart"),jQuery("body").unbind("mousemove"),jQuery("body").unbind("touchmove"),jQuery(window).add("body").unbind("mouseup").unbind("touchend"),s.off("mouseenter").off("mouseleave"),_.destroy()},this.init=function(e,t,i){i&&this.setMaxWidth(i),t=t,o=(e=e).getObjects(),d=e,jQuery(e),n=o.g_objWrapper,r=o.g_arrItems,g=jQuery.extend(g,t),_.setFixedMode(),_.setApproveClickFunction(z),_.init(e,g),h=_.getObjThumbs(),g=_.getOptions(),p.initTileWidth=g.tile_width,p.initTileHeight=g.tile_height,p.tileWidth=g.tile_width},this.setMaxWidth=function(e){p.carouselMaxWidth=e},this.setHtml=function(e){n.append("<div class='ug-carousel-wrapper'><div class='ug-carousel-inner'></div></div>"),s=n.children(".ug-carousel-wrapper"),l=s.children(".ug-carousel-inner"),_.setHtml(l),h.getThumbs().fadeTo(0,1)},this.getElement=function(){return s},this.getObjTileDesign=function(){return _},this.getEstimatedHeight=function(){return g.tile_height+2*g.carousel_padding},this.run=function(){e()},this.scrollRight=function(e){e&&"object"!=typeof e||(e=g.carousel_navigation_numtiles);var t=E();t<e&&(e=t);e=p.numCurrent-e;e<=0&&(e=0),P(e)},this.scrollLeft=function(e){e&&"object"!=typeof e||(e=g.carousel_navigation_numtiles);var t=E();t<e&&(e=t);t=y(),e=p.numCurrent+e;t<=e&&(e=t-1),P(e)},this.setScrollLeftButton=function(e){c.setButtonMobileReady(e),c.setButtonOnClick(e,a.scrollLeft)},this.setScrollRightButton=function(e){c.setButtonMobileReady(e),c.setButtonOnClick(e,a.scrollRight)},this.setPlayPauseButton=function(e){c.setButtonMobileReady(e);var t=e.find(".ug-button-tile-pause-icon"),i=e.find(".ug-button-tile-play-icon");1==p.isPlayMode&&0==p.isPaused&&(e.addClass("ug-pause-icon"),i&&0<i.length&&i.hide(),t&&0<t.length&&t.show()),u.on(a.events.START_PLAY,function(){e.addClass("ug-pause-icon"),i&&0<i.length&&i.hide(),t&&0<t.length&&t.show()}),u.on(a.events.STOP_PLAY,function(){e.removeClass("ug-pause-icon"),i&&0<i.length&&i.show(),t&&0<t.length&&t.hide()}),c.setButtonOnClick(e,function(){0==p.isPlayMode||1==p.isPaused?a.startAutoplay():a.stopAutoplay()})}}function UGLoadMore(){jQuery(this);var i,n,r,o,a=new UniteGalleryMain,s=(new UGFunctions,{isInited:!1}),l={loadmore_container:"ug_loadmore_wrapper"};function u(){i.show()}function d(){n.hide(),r.show();var e={numitems:a.getNumItems()};a.ajaxRequest("front_loadmore",e,function(e){r.hide();var t=e.html_items;1==e.show_loadmore?(n.blur().show(),r.hide()):i.hide(),a.addItems(t)},function(e){e="Ajax Error!"+e,r.hide(),o.show(),o.html(e)})}this.events={},this.destroy=function(){if(0==s.isInited)return!1},this.init=function(e,t){if(a=e,jQuery(a),l=jQuery.extend(l,t),0!=(i=jQuery("#"+l.loadmore_container)).length&&0!=(n=i.find(".ug-loadmore-button")).length&&0!=(r=i.find(".ug-loadmore-loader")).length&&0!=(o=i.find(".ug-loadmore-error")).length&&(s.isInited=!0),0==s.isInited)return trace("load more not inited, something is wrong"),!1;a.onEvent("tiles_first_placed",u),n.click(d)}}function UGTabs(){jQuery(this);var i,n,r=new UniteGalleryMain,o=(new UGFunctions,{tabs_type:"tabs",tabs_container:"#ug_tabs",tabs_class_selected:"ug-tab-selected"});function e(){"select"==o.tabs_type?n.change(s):i.click(t)}function a(e){r.requestNewItems(e)}function t(){var e=o.tabs_class_selected,t=jQuery(this);if(t.hasClass(e))return!0;i.not(t).removeClass(e),t.addClass(e);t=t.data("catid");if(!t)return!0;a(t)}function s(){var e=jQuery(this).val();if(!e)return!0;a(e)}this.events={},this.destroy=function(){n&&n.off("change"),i&&i.off("click")},this.init=function(e,t){t=t,r=e,jQuery(r),"select"==(o=jQuery.extend(o,t)).tabs_type?n=jQuery(o.tabs_container):i=jQuery(o.tabs_container+" .ug-tab")},this.run=function(){e()}}function UG_API(e){var n,r=this,o=(jQuery(r),new UniteGalleryMain),a=[];function s(e){var t,i={index:e.index,title:e.title,description:e.description,urlImage:e.urlImage,urlThumb:e.urlThumb},n=e.objThumbImage.data();for(t in n){switch(t){case"image":case"description":continue}i[t]=n[t]}return i}o=e,n=jQuery(e),this.events={API_INIT_FUNCTIONS:"api_init",API_ON_EVENT:"api_on_event"},this.on=function(e,t,i){switch(!0!==i&&a.push({event:e,func:t}),e){case"item_change":n.on(o.events.ITEM_CHANGE,function(){var e=s(o.getSelectedItem());t(e.index,e)});break;case"resize":n.on(o.events.SIZE_CHANGE,t);break;case"enter_fullscreen":n.on(o.events.ENTER_FULLSCREEN,t);break;case"exit_fullscreen":n.on(o.events.EXIT_FULLSCREEN,t);break;case"play":n.on(o.events.START_PLAY,t);break;case"stop":n.on(o.events.STOP_PLAY,t);break;case"pause":n.on(o.events.PAUSE_PLAYING,t);break;case"continue":n.on(o.events.CONTINUE_PLAYING,t);break;case"open_lightbox":n.on(o.events.OPEN_LIGHTBOX,t);break;case"close_lightbox":n.on(o.events.CLOSE_LIGHTBOX,t);break;default:console&&console.log("wrong api event: "+e)}n.trigger(r.events.API_ON_EVENT,[e,t])},this.play=function(){o.startPlayMode()},this.stop=function(){o.stopPlayMode()},this.togglePlay=function(){o.togglePlayMode()},this.enterFullscreen=function(){o.toFullScreen()},this.exitFullscreen=function(){o.exitFullScreen()},this.toggleFullscreen=function(){o.toggleFullscreen()},this.resetZoom=function(){var e=o.getObjSlider();if(!e)return!1;e.zoomBack()},this.zoomIn=function(){var e=o.getObjSlider();if(!e)return!1;e.zoomIn()},this.zoomOut=function(){var e=o.getObjSlider();if(!e)return!1;e.zoomOut()},this.nextItem=function(){o.nextItem()},this.prevItem=function(){o.prevItem()},this.selectItem=function(e){o.selectItem(e)},this.resize=function(e,t){t?o.resize(e,t):o.resize(e)},this.getItem=function(e){return s(o.getItem(e))},this.isPlaying=function(){return o.isPlayMode()},this.getNumItems=function(){return o.getNumItems()},this.getNumCurrent=function(){return o.getCurrentNumItem()},this.reloadGallery=function(e){e=e||{},o.run(null,e),a.map(function(e){r.on(e.event,e.func,!0)})},this.changeItems=function(e){o.changeItems(e)},this.addItems=function(e){o.addItems(e)},this.showMessageReplaceGallery=function(e){o.showErrorMessageReplaceGallery(e)},this.destroy=function(){o.destroy()},n.trigger(r.events.API_INIT_FUNCTIONS,r)}jQuery.fn.unitegallery=function(e){var t="#"+jQuery(this).attr("id");e=e||{};var i=new UniteGalleryMain;return i.run(t,e),void 0===window.ugArrGalleriesObjects&&(window.ugArrGalleriesObjects=[]),window.ugArrGalleriesObjects.push(i),new UG_API(i)};