!function(t,i){"function"==typeof define&&define.amd?define(["jquery"],function(s){return t.jBox=i(s)}):"object"==typeof module&&module.exports?module.exports=t.jBox=i(require("jquery")):t.jBox=i(t.jQuery)}(this,function(t){var i=function i(s,o){return this.options={id:null,width:"auto",height:"auto",minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,responsiveWidth:!0,responsiveHeight:!0,responsiveMinWidth:100,responsiveMinHeight:100,attach:null,trigger:"click",preventDefault:!1,content:null,getContent:null,title:null,getTitle:null,footer:null,isolateScroll:!0,ajax:{url:null,data:"",reload:!1,getURL:"data-url",getData:"data-ajax",setContent:!0,spinner:!0,spinnerDelay:300,spinnerReposition:!0},target:null,position:{x:"center",y:"center"},outside:null,offset:0,attributes:{x:"left",y:"top"},fixed:!1,adjustPosition:!0,adjustTracker:!1,adjustDistance:5,reposition:!0,repositionOnOpen:!0,repositionOnContent:!0,pointer:!1,pointTo:"target",fade:180,animation:null,theme:"Default",addClass:null,overlay:!1,zIndex:1e4,delayOpen:0,delayClose:0,closeOnEsc:!1,closeOnClick:!1,closeOnMouseleave:!1,closeButton:!1,appendTo:t("body"),createOnInit:!1,blockScroll:!1,draggable:!1,dragOver:!0,autoClose:!1,preloadAudio:!0,audio:null,volume:100,onInit:null,onAttach:null,onPosition:null,onCreated:null,onOpen:null,onClose:null,onCloseComplete:null},this._pluginOptions={Tooltip:{getContent:"title",trigger:"mouseenter",position:{x:"center",y:"top"},outside:"y",pointer:!0},Mouse:{responsiveWidth:!1,responsiveHeight:!1,adjustPosition:"flip",target:"mouse",trigger:"mouseenter",position:{x:"right",y:"bottom"},outside:"xy",offset:5},Modal:{target:t(window),fixed:!0,blockScroll:!0,closeOnEsc:!0,closeOnClick:"overlay",closeButton:!0,overlay:!0,animation:"zoomIn"}},this.options=t.extend(!0,this.options,this._pluginOptions[s]?this._pluginOptions[s]:i._pluginOptions[s],o),"string"==t.type(s)&&(this.type=s),this._fireEvent=function(t,i){this.options["_"+t]&&this.options["_"+t].bind(this)(i),this.options[t]&&this.options[t].bind(this)(i)},null===this.options.id&&(this.options.id="jBox"+i._getUniqueID()),this.id=this.options.id,("center"==this.options.position.x&&"x"==this.options.outside||"center"==this.options.position.y&&"y"==this.options.outside)&&(this.options.outside=null),"target"==this.options.pointTo&&(!this.options.outside||"xy"==this.options.outside)&&(this.options.pointer=!1),"object"!=t.type(this.options.offset)?this.options.offset={x:this.options.offset,y:this.options.offset}:this.options.offset=t.extend({x:0,y:0},this.options.offset),"object"!=t.type(this.options.adjustDistance)?this.options.adjustDistance={top:this.options.adjustDistance,right:this.options.adjustDistance,bottom:this.options.adjustDistance,left:this.options.adjustDistance}:this.options.adjustDistance=t.extend({top:5,left:5,right:5,bottom:5},this.options.adjustDistance),this.outside=!(!this.options.outside||"xy"==this.options.outside)&&this.options.position[this.options.outside],this.align=this.outside?this.outside:"center"!=this.options.position.y&&"number"!=t.type(this.options.position.y)?this.options.position.x:"center"!=this.options.position.x&&"number"!=t.type(this.options.position.x)?this.options.position.y:this.options.attributes.x,this._getOpp=function(t){return{left:"right",right:"left",top:"bottom",bottom:"top",x:"y",y:"x"}[t]},this._getXY=function(t){return{left:"x",right:"x",top:"y",bottom:"y",center:"x"}[t]},this._getTL=function(t){return{left:"left",right:"left",top:"top",bottom:"top",center:"left",x:"left",y:"top"}[t]},this._getInt=function(i,s){return"auto"==i?"auto":i&&"string"==t.type(i)&&"%"==i.slice(-1)?t(window)["height"==s?"innerHeight":"innerWidth"]()*parseInt(i.replace("%",""))/100:i},this._createSVG=function(i,s){var o=document.createElementNS("http://www.w3.org/2000/svg",i);return t.each(s,function(t,i){o.setAttribute(i[0],i[1]||"")}),o},this._isolateScroll=function(t){t&&t.length&&t.on("DOMMouseScroll.jBoxIsolateScroll mousewheel.jBoxIsolateScroll",function(i){var s=i.wheelDelta||i.originalEvent&&i.originalEvent.wheelDelta||-i.detail,o=this.scrollTop+t.outerHeight()-this.scrollHeight>=0,e=this.scrollTop<=0;(s<0&&o||s>0&&e)&&i.preventDefault()})},this._setTitleWidth=function(){if(!this.titleContainer||"auto"==this.content[0].style.width&&!this.content[0].style.maxWidth)return null;if("none"==this.wrapper.css("display")){this.wrapper.css("display","block");var t=this.content.outerWidth();this.wrapper.css("display","none")}else var t=this.content.outerWidth();this.titleContainer.css({maxWidth:Math.max(t,parseInt(this.content[0].style.maxWidth))||null})},this._draggable=function(){if(!this.options.draggable)return!1;var s="title"==this.options.draggable?this.titleContainer:this.options.draggable instanceof t?this.options.draggable:"string"==t.type(this.options.draggable)?t(this.options.draggable):this.wrapper;return!(!(s&&s instanceof t&&s.length)||s.data("jBox-draggable"))&&(s.addClass("jBox-draggable").data("jBox-draggable",!0).on("mousedown",function(s){if(2!=s.button&&!t(s.target).hasClass("jBox-noDrag")&&!t(s.target).parents(".jBox-noDrag").length){this.options.dragOver&&this.wrapper.css("zIndex")<=i.zIndexMax&&(i.zIndexMax+=1,this.wrapper.css("zIndex",i.zIndexMax));var o=this.wrapper.outerHeight(),e=this.wrapper.outerWidth(),n=this.wrapper.offset().top+o-s.pageY,a=this.wrapper.offset().left+e-s.pageX;t(document).on("mousemove.jBox-draggable-"+this.id,function(t){this.wrapper.offset({top:t.pageY+n-o,left:t.pageX+a-e})}.bind(this)),s.preventDefault()}}.bind(this)).on("mouseup",function(){t(document).off("mousemove.jBox-draggable-"+this.id)}.bind(this)),i.zIndexMax=i.zIndexMax?Math.max(i.zIndexMax,this.options.zIndex):this.options.zIndex,this)},this._create=function(){if(!this.wrapper){if(this.wrapper=t("
",{id:this.id,class:"jBox-wrapper"+(this.type?" jBox-"+this.type:"")+(this.options.theme?" jBox-"+this.options.theme:"")+(this.options.addClass?" "+this.options.addClass:"")}).css({position:this.options.fixed?"fixed":"absolute",display:"none",opacity:0,zIndex:this.options.zIndex}).data("jBox",this),this.options.closeOnMouseleave&&this.wrapper.on("mouseleave",function(i){!this.source||!(i.relatedTarget==this.source[0]||t.inArray(this.source[0],t(i.relatedTarget).parents("*"))!==-1)&&this.close()}.bind(this)),"box"==this.options.closeOnClick&&this.wrapper.on("touchend click",function(){this.close({ignoreDelay:!0})}.bind(this)),this.container=t('').appendTo(this.wrapper),this.content=t('').appendTo(this.container),this.options.footer&&(this.footer=t('').append(this.options.footer).appendTo(this.container)),this.options.isolateScroll&&this._isolateScroll(this.content),this.options.closeButton){var i=this._createSVG("svg",[["viewBox","0 0 24 24"]]);i.appendChild(this._createSVG("path",[["d","M22.2,4c0,0,0.5,0.6,0,1.1l-6.8,6.8l6.9,6.9c0.5,0.5,0,1.1,0,1.1L20,22.3c0,0-0.6,0.5-1.1,0L12,15.4l-6.9,6.9c-0.5,0.5-1.1,0-1.1,0L1.7,20c0,0-0.5-0.6,0-1.1L8.6,12L1.7,5.1C1.2,4.6,1.7,4,1.7,4L4,1.7c0,0,0.6-0.5,1.1,0L12,8.5l6.8-6.8c0.5-0.5,1.1,0,1.1,0L22.2,4z"]])),this.closeButton=t('').on("touchend click",function(t){this.close({ignoreDelay:!0})}.bind(this)).append(i),"box"!=this.options.closeButton&&(this.options.closeButton!==!0||this.options.overlay||this.options.title)||(this.wrapper.addClass("jBox-closeButton-box"),this.closeButton.appendTo(this.container))}if(this.wrapper.appendTo(this.options.appendTo),this.wrapper.find(".jBox-closeButton").length&&t.each(["top","right","bottom","left"],function(t,i){this.wrapper.find(".jBox-closeButton").css(i)&&"auto"!=this.wrapper.find(".jBox-closeButton").css(i)&&(this.options.adjustDistance[i]=Math.max(this.options.adjustDistance[i],this.options.adjustDistance[i]+((parseInt(this.wrapper.find(".jBox-closeButton").css(i))||0)+(parseInt(this.container.css("border-"+i+"-width"))||0))*-1))}.bind(this)),this.options.pointer){if(this.pointer={position:"target"!=this.options.pointTo?this.options.pointTo:this._getOpp(this.outside),xy:"target"!=this.options.pointTo?this._getXY(this.options.pointTo):this._getXY(this.outside),align:"center",offset:0},this.pointer.element=t('').appendTo(this.wrapper),this.pointer.dimensions={x:this.pointer.element.outerWidth(),y:this.pointer.element.outerHeight()},"string"==t.type(this.options.pointer)){var s=this.options.pointer.split(":");s[0]&&(this.pointer.align=s[0]),s[1]&&(this.pointer.offset=parseInt(s[1]))}this.pointer.alignAttribute="x"==this.pointer.xy?"bottom"==this.pointer.align?"bottom":"top":"right"==this.pointer.align?"right":"left",this.wrapper.css("padding-"+this.pointer.position,this.pointer.dimensions[this.pointer.xy]),this.pointer.element.css(this.pointer.alignAttribute,"center"==this.pointer.align?"50%":0).css("margin-"+this.pointer.alignAttribute,this.pointer.offset),this.pointer.margin={},this.pointer.margin["margin-"+this.pointer.alignAttribute]=this.pointer.offset,"center"==this.pointer.align&&this.pointer.element.css("transform","translate("+("y"==this.pointer.xy?this.pointer.dimensions.x*-.5+"px":0)+", "+("x"==this.pointer.xy?this.pointer.dimensions.y*-.5+"px":0)+")"),this.pointer.element.css("x"==this.pointer.xy?"width":"height",parseInt(this.pointer.dimensions[this.pointer.xy])+parseInt(this.container.css("border-"+this.pointer.alignAttribute+"-width"))),this.wrapper.addClass("jBox-pointerPosition-"+this.pointer.position)}this.setContent(this.options.content,!0),this.setTitle(this.options.title,!0),this.options.draggable&&this._draggable(),this._fireEvent("onCreated")}},this.options.createOnInit&&this._create(),this.options.attach&&this.attach(),this._attachEvents=function(){this.options.closeOnEsc&&t(document).on("keyup.jBox-"+this.id,function(t){27==t.keyCode&&this.close({ignoreDelay:!0})}.bind(this)),this.options.closeOnClick!==!0&&"body"!=this.options.closeOnClick||t(document).on("touchend.jBox-"+this.id+" click.jBox-"+this.id,function(t){this.blockBodyClick||"body"==this.options.closeOnClick&&(t.target==this.wrapper[0]||this.wrapper.has(t.target).length)||this.close({ignoreDelay:!0})}.bind(this)),(this.options.adjustPosition||this.options.reposition)&&!this.fixed&&this.outside&&(this.options.adjustTracker&&t(window).on("scroll.jBox-"+this.id,function(t){this.position()}.bind(this)),(this.options.adjustPosition||this.options.reposition)&&t(window).on("resize.jBox-"+this.id,function(t){this.position()}.bind(this))),"mouse"==this.options.target&&t("body").on("mousemove.jBox-"+this.id,function(t){this.position({mouseTarget:{top:t.pageY,left:t.pageX}})}.bind(this))},this._detachEvents=function(){this.options.closeOnEsc&&t(document).off("keyup.jBox-"+this.id),(this.options.closeOnClick===!0||"body"==this.options.closeOnClick)&&t(document).off("touchend.jBox-"+this.id+" click.jBox-"+this.id),this.options.adjustTracker&&t(window).off("scroll.jBox-"+this.id),(this.options.adjustPosition||this.options.reposition)&&t(window).off("resize.jBox-"+this.id),"mouse"==this.options.target&&t("body").off("mousemove.jBox-"+this.id)},this._showOverlay=function(){this.overlay||(this.overlay=t('').addClass("jBox-overlay"+(this.type?" jBox-overlay-"+this.type:"")).css({display:"none",opacity:0,zIndex:this.options.zIndex-1}).appendTo(this.options.appendTo),("overlay"==this.options.closeButton||this.options.closeButton===!0&&!this.titleContainer)&&this.overlay.append(this.closeButton),"overlay"==this.options.closeOnClick&&this.overlay.on("touchend click",function(){this.close({ignoreDelay:!0})}.bind(this)),t("#"+this.id+"-overlay .jBox-closeButton").length&&(this.options.adjustDistance.top=Math.max(t("#"+this.id+"-overlay .jBox-closeButton").outerHeight(),this.options.adjustDistance.top))),"block"!=this.overlay.css("display")&&(this.options.fade?this.overlay.stop()&&this.overlay.animate({opacity:1},{queue:!1,duration:this.options.fade,start:function(){this.overlay.css({display:"block"})}.bind(this)}):this.overlay.css({display:"block",opacity:1}))},this._hideOverlay=function(){this.overlay&&(this.options.fade?this.overlay.stop()&&this.overlay.animate({opacity:0},{queue:!1,duration:this.options.fade,complete:function(){this.overlay.css({display:"none"})}.bind(this)}):this.overlay.css({display:"none",opacity:0}))},this._exposeDimensions=function(){this.wrapper.css({top:-1e4,left:-1e4,right:"auto",bottom:"auto"});var t={x:this.wrapper.outerWidth(),y:this.wrapper.outerHeight()};return this.wrapper.css({top:"auto",left:"auto"}),t},this._generateAnimationCSS=function(){if("object"!=t.type(this.options.animation)&&(this.options.animation={pulse:{open:"pulse",close:"zoomOut"},zoomIn:{open:"zoomIn",close:"zoomIn"},zoomOut:{open:"zoomOut",close:"zoomOut"},move:{open:"move",close:"move"},slide:{open:"slide",close:"slide"},flip:{open:"flip",close:"flip"},tada:{open:"tada",close:"zoomOut"}}[this.options.animation]),!this.options.animation)return null;this.options.animation.open&&(this.options.animation.open=this.options.animation.open.split(":")),this.options.animation.close&&(this.options.animation.close=this.options.animation.close.split(":")),this.options.animation.openDirection=this.options.animation.open[1]?this.options.animation.open[1]:null,this.options.animation.closeDirection=this.options.animation.close[1]?this.options.animation.close[1]:null,this.options.animation.open&&(this.options.animation.open=this.options.animation.open[0]),this.options.animation.close&&(this.options.animation.close=this.options.animation.close[0]),this.options.animation.open&&(this.options.animation.open+="Open"),this.options.animation.close&&(this.options.animation.close+="Close");var i={pulse:{duration:350,css:[["0%","scale(1)"],["50%","scale(1.1)"],["100%","scale(1)"]]},zoomInOpen:{duration:this.options.fade||180,css:[["0%","scale(0.9)"],["100%","scale(1)"]]},zoomInClose:{duration:this.options.fade||180,css:[["0%","scale(1)"],["100%","scale(0.9)"]]},zoomOutOpen:{duration:this.options.fade||180,css:[["0%","scale(1.1)"],["100%","scale(1)"]]},zoomOutClose:{duration:this.options.fade||180,css:[["0%","scale(1)"],["100%","scale(1.1)"]]},moveOpen:{duration:this.options.fade||180,positions:{top:{"0%":-12},right:{"0%":12},bottom:{"0%":12},left:{"0%":-12}},css:[["0%","translate%XY(%Vpx)"],["100%","translate%XY(0px)"]]},moveClose:{duration:this.options.fade||180,timing:"ease-in",positions:{top:{"100%":-12},right:{"100%":12},bottom:{"100%":12},left:{"100%":-12}},css:[["0%","translate%XY(0px)"],["100%","translate%XY(%Vpx)"]]},slideOpen:{duration:400,positions:{top:{"0%":-400},right:{"0%":400},bottom:{"0%":400},left:{"0%":-400}},css:[["0%","translate%XY(%Vpx)"],["100%","translate%XY(0px)"]]},slideClose:{duration:400,timing:"ease-in",positions:{top:{"100%":-400},right:{"100%":400},bottom:{"100%":400},left:{"100%":-400}},css:[["0%","translate%XY(0px)"],["100%","translate%XY(%Vpx)"]]},flipOpen:{duration:600,css:[["0%","perspective(400px) rotateX(90deg)"],["40%","perspective(400px) rotateX(-15deg)"],["70%","perspective(400px) rotateX(15deg)"],["100%","perspective(400px) rotateX(0deg)"]]},flipClose:{duration:this.options.fade||300,css:[["0%","perspective(400px) rotateX(0deg)"],["100%","perspective(400px) rotateX(90deg)"]]},tada:{duration:800,css:[["0%","scale(1)"],["10%, 20%","scale(0.9) rotate(-3deg)"],["30%, 50%, 70%, 90%","scale(1.1) rotate(3deg)"],["40%, 60%, 80%","scale(1.1) rotate(-3deg)"],["100%","scale(1) rotate(0)"]]}};t.each(["pulse","tada"],function(t,s){i[s+"Open"]=i[s+"Close"]=i[s]});var s=function(s,o){return keyframe_css="@keyframes jBox-"+this.id+"-animation-"+this.options.animation[s]+"-"+s+(o?"-"+o:"")+" {",t.each(i[this.options.animation[s]].css,function(t,e){var n=o?e[1].replace("%XY",this._getXY(o).toUpperCase()):e[1];i[this.options.animation[s]].positions&&(n=n.replace("%V",i[this.options.animation[s]].positions[o][e[0]])),keyframe_css+=e[0]+" {transform:"+n+";}"}.bind(this)),keyframe_css+="}",keyframe_css+=".jBox-"+this.id+"-animation-"+this.options.animation[s]+"-"+s+(o?"-"+o:"")+" {",keyframe_css+="animation-duration: "+i[this.options.animation[s]].duration+"ms;",keyframe_css+="animation-name: jBox-"+this.id+"-animation-"+this.options.animation[s]+"-"+s+(o?"-"+o:"")+";",keyframe_css+=i[this.options.animation[s]].timing?"animation-timing-function: "+i[this.options.animation[s]].timing+";":"",keyframe_css+="}",keyframe_css}.bind(this);this._animationCSS="",t.each(["open","close"],function(o,e){return this.options.animation[e]&&i[this.options.animation[e]]&&("close"!=e||this.options.fade)?void(i[this.options.animation[e]].positions?t.each(["top","right","bottom","left"],function(t,i){this._animationCSS+=s(e,i)}.bind(this)):this._animationCSS+=s(e)):""}.bind(this))},this.options.animation&&this._generateAnimationCSS(),this._blockBodyClick=function(){this.blockBodyClick=!0,setTimeout(function(){this.blockBodyClick=!1}.bind(this),10)},this._animate=function(t){if(!t&&(t=this.isOpen?"open":"close"),!this.options.fade&&"close"==t)return null;var i=this.options.animation[t+"Direction"]||("center"!=this.align?this.align:this.options.attributes.x);this.flipped&&this._getXY(i)==this._getXY(this.align)&&(i=this._getOpp(i));var s="jBox-"+this.id+"-animation-"+this.options.animation[t]+"-"+t+" jBox-"+this.id+"-animation-"+this.options.animation[t]+"-"+t+"-"+i;this.wrapper.addClass(s);var o=1e3*parseFloat(this.wrapper.css("animation-duration"));"close"==t&&(o=Math.min(o,this.options.fade)),setTimeout(function(){this.wrapper.removeClass(s)}.bind(this),o)},this._abortAnimation=function(){var t=this.wrapper.attr("class").split(" ").filter(function(t){return 0!==t.lastIndexOf("jBox-"+this.id+"-animation",0)}.bind(this));this.wrapper.attr("class",t.join(" "))},(this.options.responsiveWidth||this.options.responsiveHeight)&&t(window).on("resize.responsivejBox-"+this.id,function(t){this.isOpen&&this.position()}.bind(this)),"string"===t.type(this.options.preloadAudio)&&(this.options.preloadAudio=[this.options.preloadAudio]),"string"===t.type(this.options.audio)&&(this.options.audio={open:this.options.audio}),"number"===t.type(this.options.volume)&&(this.options.volume={open:this.options.volume,close:this.options.volume}),this.options.preloadAudio===!0&&this.options.audio&&(this.options.preloadAudio=[],t.each(this.options.audio,function(t,i){this.options.preloadAudio.push(i+".mp3"),this.options.preloadAudio.push(i+".ogg")}.bind(this))),this.options.preloadAudio.length&&t.each(this.options.preloadAudio,function(t,i){var s=new Audio;s.src=i,s.preload="auto"}),this._fireEvent("onInit"),this};return i.prototype.attach=function(i,s){return!i&&(i=this.options.attach),"string"==t.type(i)&&(i=t(i)),!s&&(s=this.options.trigger),i&&i.length&&t.each(i,function(i,o){o=t(o),o.data("jBox-attached-"+this.id)||("title"==this.options.getContent&&void 0!=o.attr("title")&&o.data("jBox-getContent",o.attr("title")).removeAttr("title"),this.attachedElements||(this.attachedElements=[]),this.attachedElements.push(o[0]),o.on(s+".jBox-attach-"+this.id,function(t){if(this.timer&&clearTimeout(this.timer),"mouseenter"!=s||!this.isOpen||this.source[0]!=o[0]){if(this.isOpen&&this.source&&this.source[0]!=o[0])var i=!0;this.source=o,!this.options.target&&(this.target=o),"click"==s&&this.options.preventDefault&&t.preventDefault(),this["click"!=s||i?"open":"toggle"]()}}.bind(this)),"mouseenter"==this.options.trigger&&o.on("mouseleave",function(i){return this.wrapper?void(this.options.closeOnMouseleave&&(i.relatedTarget==this.wrapper[0]||t(i.relatedTarget).parents("#"+this.id).length)||this.close()):null}.bind(this)),o.data("jBox-attached-"+this.id,s),this._fireEvent("onAttach",o))}.bind(this)),this},i.prototype.detach=function(i){return!i&&(i=this.attachedElements||[]),i&&i.length&&t.each(i,function(i,s){s=t(s),s.data("jBox-attached-"+this.id)&&(s.off(s.data("jBox-attached-"+this.id)+".jBox-attach-"+this.id),s.data("jBox-attached-"+this.id,null)),this.attachedElements=t.grep(this.attachedElements,function(t){return t!=s[0]})}.bind(this)),this},i.prototype.setTitle=function(i,s){if(null==i||void 0==i)return this;!this.wrapper&&this._create();var o=this.wrapper.outerHeight(),e=this.wrapper.outerWidth();return this.title||(this.titleContainer=t(''),this.title=t("").appendTo(this.titleContainer),this.wrapper.addClass("jBox-hasTitle"),("title"==this.options.closeButton||this.options.closeButton===!0&&!this.options.overlay)&&(this.wrapper.addClass("jBox-closeButton-title"),this.closeButton.appendTo(this.titleContainer)),this.titleContainer.insertBefore(this.content),this._setTitleWidth()),this.title.html(i),e!=this.wrapper.outerWidth()&&this._setTitleWidth(),this.options.draggable&&this._draggable(),!s&&this.options.repositionOnContent&&(o!=this.wrapper.outerHeight()||e!=this.wrapper.outerWidth())&&this.position(),this},i.prototype.setContent=function(i,s){if(null==i||void 0==i)return this;!this.wrapper&&this._create();var o=this.wrapper.outerHeight(),e=this.wrapper.outerWidth();switch(this.content.children("[data-jbox-content-appended]").appendTo("body").css({display:"none"}),t.type(i)){case"string":this.content.html(i);break;case"object":this.content.html(""),i.attr("data-jbox-content-appended",1).appendTo(this.content).css({display:"block"})}return e!=this.wrapper.outerWidth()&&this._setTitleWidth(),this.options.draggable&&this._draggable(),!s&&this.options.repositionOnContent&&(o!=this.wrapper.outerHeight()||e!=this.wrapper.outerWidth())&&this.position(),this},i.prototype.setDimensions=function(t,i,s){!this.wrapper&&this._create(),void 0==i&&(i="auto"),this.content.css(t,this._getInt(i)),"width"==t&&this._setTitleWidth(),(void 0==s||s)&&this.position()},i.prototype.setWidth=function(t,i){this.setDimensions("width",t,i)},i.prototype.setHeight=function(t,i){this.setDimensions("height",t,i)},i.prototype.position=function(i){if(!i&&(i={}),i=t.extend(!0,this.options,i),this.target=i.target||this.target||t(window),!(this.target instanceof t||"mouse"==this.target)&&(this.target=t(this.target)),!this.target.length)return this;this.content.css({width:this._getInt(i.width,"width"),height:this._getInt(i.height,"height"),minWidth:this._getInt(i.minWidth,"width"),minHeight:this._getInt(i.minHeight,"height"),maxWidth:this._getInt(i.maxWidth,"width"),maxHeight:this._getInt(i.maxHeight,"height")}),this._setTitleWidth();var s=this._exposeDimensions();"mouse"!=this.target&&!this.target.data("jBox-"+this.id+"-fixed")&&this.target.data("jBox-"+this.id+"-fixed",this.target[0]!=t(window)[0]&&("fixed"==this.target.css("position")||this.target.parents().filter(function(){return"fixed"==t(this).css("position")}).length>0)?"fixed":"static");var o={x:t(window).outerWidth(),y:t(window).outerHeight(),top:i.fixed&&this.target.data("jBox-"+this.id+"-fixed")?0:t(window).scrollTop(),left:i.fixed&&this.target.data("jBox-"+this.id+"-fixed")?0:t(window).scrollLeft()};o.bottom=o.top+o.y,o.right=o.left+o.x;try{var e=this.target.offset()}catch(t){var e={top:0,left:0}}"mouse"!=this.target&&"fixed"==this.target.data("jBox-"+this.id+"-fixed")&&i.fixed&&(e.top=e.top-t(window).scrollTop(),e.left=e.left-t(window).scrollLeft());var n={x:"mouse"==this.target?12:this.target.outerWidth(),y:"mouse"==this.target?20:this.target.outerHeight(),top:"mouse"==this.target&&i.mouseTarget?i.mouseTarget.top:e?e.top:0,left:"mouse"==this.target&&i.mouseTarget?i.mouseTarget.left:e?e.left:0},a=i.outside&&!("center"==i.position.x&&"center"==i.position.y),h={x:o.x-i.adjustDistance.left-i.adjustDistance.right,y:o.y-i.adjustDistance.top-i.adjustDistance.bottom,left:a?n.left-t(window).scrollLeft()-i.adjustDistance.left:0,right:a?o.x-n.left+t(window).scrollLeft()-n.x-i.adjustDistance.right:0,top:a?n.top-t(window).scrollTop()-this.options.adjustDistance.top:0,bottom:a?o.y-n.top+t(window).scrollTop()-n.y-i.adjustDistance.bottom:0},p={x:"x"!=i.outside&&"xy"!=i.outside||"number"==t.type(i.position.x)?null:i.position.x,y:"y"!=i.outside&&"xy"!=i.outside||"number"==t.type(i.position.y)?null:i.position.y},r={x:!1,y:!1};if(p.x&&s.x>h[p.x]&&h[this._getOpp(p.x)]>h[p.x]&&(p.x=this._getOpp(p.x))&&(r.x=!0),p.y&&s.y>h[p.y]&&h[this._getOpp(p.y)]>h[p.y]&&(p.y=this._getOpp(p.y))&&(r.y=!0),i.responsiveWidth||i.responsiveHeight){var l=function(){if(i.responsiveWidth&&s.x>h[p.x||"x"]){var t=h[p.x||"x"]-(this.pointer&&a&&"x"==i.outside?this.pointer.dimensions.x:0)-parseInt(this.container.css("border-left-width"))-parseInt(this.container.css("border-right-width"));this.content.css({width:t>this.options.responsiveMinWidth?t:null,minWidth:t