").addClass("tpd-close-icon").html("×")))))),this.skin=new Skin(this),this._contentSpacer.css({"border-radius":Math.max(this.skin._css.radius-this.skin._css.border,0)}),this.createPostBuildObservers(),this.is("build",!0))},createPostBuildObservers:function(){this._tooltip.delegate(".tpd-close, .close-tooltip","click",function(t){t.stopPropagation(),t.preventDefault(),this.is("api",!1),this.hide(!0)}.bind(this))},createPreBuildObservers:function(){this.bind(this.element,"mouseenter",this.setActive),this.bind(this._tooltip,Support.touch&&Browser.MobileSafari?"touchstart":"mouseenter",this.setActive),this.bind(this.element,"mouseleave",function(t){this.setIdle(t)}),this.bind(this._tooltip,"mouseleave",function(t){this.setIdle(t)}),this.options.showOn&&($.each(this.options.showOn,function(t,i){var e,s=!1;switch(t){case"element":e=this.element,this.options.hideOn&&this.options.showOn&&"click"===this.options.hideOn.element&&"click"===this.options.showOn.element&&this.is("toggleable",s=!0);break;case"tooltip":e=this._tooltip;break;case"target":e=this.target}e&&i&&this.bind(e,i,"click"===i&&s?function(){this.is("api",!1),this.toggle()}:function(){this.is("api",!1),this.showDelayed()})}.bind(this)),Support.touch&&Browser.MobileSafari&&this.bind(this._tooltip,"touchend",function(){this._tooltipTouchEndTime=(new Date).getTime()})),this.options.hideOn&&$.each(this.options.hideOn,function(t,i){var e,s;switch(t){case"element":if(this.is("toggleable")&&"click"===i)return;e=this.element;break;case"tooltip":e=this._tooltip;break;case"target":e=this.target}e&&i&&(s=i,Support.touch&&Browser.MobileSafari&&/^(target|element)/.test(t)&&/mouse(leave|out)/.test(s)?this.bind(e,s,function(t){if(this._tooltipTouchEndTime&&/^mouse(leave|out)$/.test(t.type)&&(new Date).getTime()-this._tooltipTouchEndTime<450)return;this.is("api",!1),this.hideDelayed()}):this.bind(e,s,function(){this.is("api",!1),this.hideDelayed()}))}.bind(this)),this.options.hideOnClickOutside&&($(this.element).addClass("tpd-hideOnClickOutside"),this.bind(document.documentElement,"click touchend",function(t){this.visible()&&((t=$(t.target).closest(".tpd-tooltip, .tpd-hideOnClickOutside")[0])&&(t===this._tooltip[0]||t===this.element)||this.hide())}.bind(this))),"mouse"===this.options.target&&this.bind(this.element,"mouseenter mousemove",function(t){this._cache.event=t}.bind(this));var t=!1;(t=this.options.showOn&&"mouse"===this.options.target&&!this.options.fixed?!0:t)&&this.bind(this.element,"mousemove",function(){this.is("build")&&(this.is("api",!1),this.position())})}}),$.extend(Tooltip.prototype,{stop:function(){this._tooltip&&(this.queues.showhide.queue([]),this._tooltip.stop(1,0))},showDelayed:function(t){this.is("disabled")||(this.clearTimer("hide"),this.is("visible")||this.getTimer("show")||this.setTimer("show",function(){this.clearTimer("show"),this.show()}.bind(this),this.options.showDelay||1))},show:function(){var t;this.clearTimer("hide"),this.visible()||this.is("disabled")||!$(this.target).is(":visible")||(this.is("visible",!0),this.attach(),this.stop(),t=this.queues.showhide,this.is("updated")||this.is("updating")||t.queue(function(i){this._onResizeDimensions={width:0,height:0},this.update(function(t){if(t)return this.is("visible",!1),void this.detach();i()}.bind(this))}.bind(this)),t.queue(function(t){this.is("sanitized")?(this.stopLoading(),this._contentWrapper.css({visibility:"visible"}),this.is("resize-to-content",!0),t()):(this._contentWrapper.css({visibility:"hidden"}),this.startLoading(),this.sanitize(function(){this.stopLoading(),this._contentWrapper.css({visibility:"visible"}),this.is("resize-to-content",!0),t()}.bind(this)))}.bind(this)),t.queue(function(t){this.position(),this.raise(),t()}.bind(this)),t.queue(function(t){var i;this.is("updated")&&"function"==typeof this.options.onShow&&(i=new Visible(this._tooltip),this.options.onShow(this._content[0],this.element),i.restore()),t()}.bind(this)),t.queue(function(t){this._show(this.options.fadeIn,function(){t()})}.bind(this)))},_show:function(t,i){t=("number"==typeof t?t:this.options.fadeIn)||0,i=i||"function"==typeof arguments[0]&&arguments[0],this.options.hideOthers&&Tooltips.hideAll(this),this._tooltip.fadeTo(t,1,function(){i&&i()}.bind(this))},hideDelayed:function(){this.clearTimer("show"),this.getTimer("hide")||!this.visible()||this.is("disabled")||this.setTimer("hide",function(){this.clearTimer("hide"),this.hide()}.bind(this),this.options.hideDelay||1)},hide:function(i,e){var t;this.clearTimer("show"),this.visible()&&!this.is("disabled")&&(this.is("visible",!1),this.stop(),(t=this.queues.showhide).queue(function(t){this.abort(),t()}.bind(this)),t.queue(function(t){this._hide(i,t)}.bind(this)),t.queue(function(t){Tooltips.resetZ(),t()}),t.queue(function(t){this.clearUpdatedTo(),t()}.bind(this)),"function"==typeof this.options.afterHide&&this.is("updated")&&t.queue(function(t){this.options.afterHide(this._content[0],this.element),t()}.bind(this)),this.options.cache||!this.options.ajax&&!this._fn||t.queue(function(t){this.is("updated",!1),this.is("updating",!1),this.is("sanitized",!1),t()}.bind(this)),"function"==typeof e&&t.queue(function(t){e(),t()}),t.queue(function(t){this.detach(),t()}.bind(this)))},_hide:function(t,i){i=i||"function"==typeof t&&t,this.attach(),this._tooltip.fadeTo(t?0:this.options.fadeOut,0,function(){this.stopLoading(),this.is("resize-to-content",!1),this._tooltip.hide(),i&&i()}.bind(this))},toggle:function(){this.is("disabled")||this[this.visible()?"hide":"show"]()},raise:function(){var t;!this.is("build")||this.options.zIndex||(t=Tooltips.getHighestTooltip())&&t!==this&&this.zIndex<=t.zIndex&&(this.zIndex=t.zIndex+1,this._tooltip.css({"z-index":this.zIndex}),this._tooltipShadow&&(this._tooltipShadow.css({"z-index":this.zIndex}),this.zIndex=t.zIndex+2,this._tooltip.css({"z-index":this.zIndex})))}}),$.extend(Tooltip.prototype,{createElementMarker:function(){!this.elementMarker&&this.content&&_.element.isAttached(this.content)&&($(this.content).data("tpd-restore-inline-display",$(this.content).css("display")),this.elementMarker=$("
").hide(),$(this.content).before($(this.elementMarker).hide()))},restoreElementToMarker:function(){var t;this.elementMarker&&this.content&&((t=$(this.content).data("tpd-restore-inline-display"))&&$(this.content).css({display:t}),$(this.elementMarker).before(this.content).remove())},startLoading:function(){this.is("loading")||(this.build(),this.is("loading",!0),this.options.spinner&&(this._tooltip.addClass("tpd-is-loading"),this.skin.startLoading(),this.is("resize-to-content")||(this.position(),this.raise(),this._show())))},stopLoading:function(){this.build(),this.is("loading",!1),this.options.spinner&&(this._tooltip.removeClass("tpd-is-loading"),this.skin.stopLoading())},abort:function(){this.abortAjax(),this.abortSanitize(),this.is("refreshed-before-sanitized",!1)},abortSanitize:function(){this._cache.voila&&(this._cache.voila.abort(),this._cache.voila=null)},abortAjax:function(){this._cache.xhr&&(this._cache.xhr.abort(),this._cache.xhr=null,this.is("updated",!1),this.is("updating",!1))},update:function(o){if(!this.is("updating")){this.is("updating",!0),this.build();var t=this.options.inline?"inline":this.options.ajax?"ajax":_.isElement(this.content)||_.isText(this.content)||_.isDocumentFragment(this.content)?"element":this._fn?"function":"html";switch(this._contentWrapper.css({visibility:"hidden"}),t){case"html":case"element":case"inline":if(this.is("updated"))return void(o&&o());this._update(this.content,o);break;case"function":if(this.is("updated"))return void(o&&o());var i=this._fn(this.element);if(!i)return this.is("updating",!1),void(o&&o(!0));this._update(i,o);break;case"ajax":var e=this.options.ajax||{},s=e.url||this.__content,n=e.data||{},t=e.type||"GET",i=e.dataType,n={url:s,data:n};t&&$.extend(n,{type:t}),i&&$.extend(n,{dataType:i});var h,r=$.extend({},n,e);if(r.method&&delete(r=$.extend({},r)).method,$.each("complete error success".split(" "),function(t,s){r[s]||(r[s]="success"===s?function(t,i,e){return e.responseText}:function(){}),r[s]=_.wrap(r[s],function(t){var i=_slice.call(arguments,1),e="object"==typeof i[0]?i[0]:i[2];e.statusText&&"abort"===e.statusText||(this.options.cache&&AjaxCache.set({url:r.url,type:r.type,data:r.data},s,i),this._cache.xhr=null,(i=t.apply(this,i))&&this._update(i,o))}.bind(this))}.bind(this)),this.options.cache&&(h=AjaxCache.get(r))&&h.callbacks.success)return void $.each(h.callbacks,function(t,i){"function"==typeof r[t]&&r[t].apply(this,i)}.bind(this));this.startLoading(),this._cache.xhr=$.ajax(r)}}},_update:function(t,i){var e={title:this.options.title,close:this.options.close};"string"==typeof t||_.isElement(t)||_.isText(t)||_.isDocumentFragment(t)||t instanceof $?e.content=t:$.extend(e,t);var t=e.content,s=e.title,e=e.close;this.content=t,this.title=s,this.close=e,this.createElementMarker(),(_.isElement(t)||t instanceof $)&&$(t).show(),this._content.html(this.content),this._title.html(s&&"string"==typeof s?s:""),this._titleWrapper[s?"show":"hide"](),this._close[(this.title||this.options.title)&&e?"show":"hide"]();t=e&&!(this.options.title||this.title),s=e&&!(this.options.title||this.title)&&"overlap"!==e,e=e&&(this.options.title||this.title)&&"overlap"!==e;this._inner_close[t?"show":"hide"](),this._tooltip[(s?"add":"remove")+"Class"]("tpd-has-inner-close"),this._tooltip[(e?"add":"remove")+"Class"]("tpd-has-title-close"),this._content[(this.options.padding?"remove":"add")+"Class"]("tpd-content-no-padding"),this.finishUpdate(i)},sanitize:function(i){if(!this.options.voila||this._content.find("img").length<1)return this.is("sanitized",!0),void(i&&i());this._cache.voila=Voila(this._content,{method:"onload"},function(t){this._markImagesAsSanitized(t.images),this.is("refreshed-before-sanitized")?(this.is("refreshed-before-sanitized",!1),this.sanitize(i)):(this.is("sanitized",!0),i&&i())}.bind(this))},_markImagesAsSanitized:function(t){$.each(t,function(t,i){var e=i.img;$(e).data("completed-src",i.img.src)})},_hasAllImagesSanitized:function(){var s=!0;return this._content.find("img").each(function(t,i){var e=$(i).data("completed-src");if(!e||i.src!==e)return s=!1}),s},refresh:function(){this.visible()&&(this.is("sanitized")?(this.is("refreshing",!0),this.clearTimer("refresh-spinner"),!this.options.voila||this._content.find("img").length<1||this._hasAllImagesSanitized()?(this.is("should-update-dimensions",!0),this.position(),this.is("refreshing",!1)):(this.is("sanitized",!1),this._contentWrapper.css({visibility:"hidden"}),this.startLoading(),this.sanitize(function(){this._contentWrapper.css({visibility:"visible"}),this.stopLoading(),this.is("should-update-dimensions",!0),this.position(),this.is("refreshing",!1)}.bind(this)))):this.is("refreshed-before-sanitized",!0))},finishUpdate:function(t){var i;this.is("updated",!0),this.is("updating",!1),"function"==typeof this.options.afterUpdate&&((i=this._contentWrapper.css("visibility"))&&this._contentWrapper.css({visibility:"visible"}),this.options.afterUpdate(this._content[0],this.element),i&&this._contentWrapper.css({visibility:"hidden"})),t&&t()}}),$.extend(Tooltip.prototype,{clearUpdatedTo:function(){this._cache.updatedTo={}},updateDimensionsToContent:function(t,i){this.skin.build();var e,s,o,n,h,r,a,d,l,p,c,u,f,m=this.is("loading"),g=this._cache.updatedTo;(this._maxWidthPass||this.is("api")||this.is("should-update-dimensions")||g.stemPosition!==i||g.loading!==m)&&(m&&this.is("resize-to-content")||(this._cache.updatedTo={type:this.is("resize-to-content")?"content":"spinner",loading:this.is("loading"),stemPosition:i},this.is("should-update-dimensions")&&this.is("should-update-dimensions",!1),t=t||this.options.position.target,i=i||this.options.position.tooltip,c=Position.getSide(i),p=Position.getOrientation(i),u=this.skin._css.border,this._tooltip.addClass("tpd-tooltip-measuring"),f=this._tooltip.attr("style"),this._tooltip.removeAttr("style"),e={top:u,right:u,bottom:u,left:u},h=0,"vertical"===Position.getOrientation(i)&&(this.options.stem&&(e[c]=this.skin["stem_"+c].getMath().dimensions.outside.height),(d=this.getMouseRoom())[Position._flip[c]]&&(e[c]+=d[Position._flip[c]]),s=this.getContainmentLayout(i),o=this.getPaddingLine(t),n=!1,Position.isPointWithinBoxLayout(o.x1,o.y1,s)||Position.isPointWithinBoxLayout(o.x2,o.y2,s)?n=!0:$.each("top right bottom left".split(" "),function(t,i){i=this.getSideLine(s,i);if(Position.intersectsLine(o.x1,o.y1,o.x2,o.y2,i.x1,i.y1,i.x2,i.y2))return!(n=!0)}.bind(this)),n&&(h="left"===c?o.x1-s.position.left:s.position.left+s.dimensions.width-o.x1,e[c]+=h)),this.options.offset&&("vertical"!==p||0!==(l=Position.adjustOffsetBasedOnPosition(this.options.offset,this.options.position.target,t)).x&&(e.right+=Math.abs(l.x))),this.options.containment&&(h=this.options.containment.padding)&&($.each(e,function(t,i){e[t]+=h}),"vertical"===p?e["left"===c?"left":"right"]-=h:e["top"===c?"top":"bottom"]-=h),r=Bounds.viewport(),a={width:0,height:0},this.close&&"overlap"!==this.close&&!this.title&&(a=this._innerCloseDimensions||{width:this._inner_close.outerWidth(!0),height:this._inner_close.outerHeight(!0)},this._innerCloseDimensions=a),this._contentRelativePadder.css({"padding-right":a.width}),this._contentSpacer.css({width:r.width-e.left-e.right}),g={width:this._content.innerWidth()+a.width,height:Math.max(this._content.innerHeight(),a.height||0)},m={width:0,height:0},this.title&&(d={width:0,height:0},this._titleWrapper.add(this._titleSpacer).css({width:"auto",height:"auto"}),this.close&&"overlap"!==this.close&&(d={width:this._close.outerWidth(!0),height:this._close.outerHeight(!0)},this._close.hide()),this._maxWidthPass&&g.width>this.options.maxWidth&&this._titleRelative.css({width:g.width}),this._titleRelativePadder.css({"padding-right":d.width}),l=parseFloat(this._titleWrapper.css("border-bottom-width")),(m={width:this.title?this._titleWrapper.innerWidth():0,height:Math.max(this.title?this._titleWrapper.innerHeight()+l:0,d.height+l)}).width>r.width-e.left-e.right&&(m.width=r.width-e.left-e.right,this._titleSpacer.css({width:m.width}),m.height=Math.max(this.title?this._titleWrapper.innerHeight()+l:0,d.height+l)),g.width=Math.max(m.width,g.width),g.height+=m.height,this._titleWrapper.css({height:Math.max(this.title?this._titleWrapper.innerHeight():0,d.height)}),this.close&&this._close.show()),this.options.stem&&(p="vertical"===p?"height":"width",c=this.skin["stem_"+c].getMath().outside.width+2*this.skin._css.radius,g[p]
this.options.maxWidth&&!this._maxWidthPass&&this.is("resize-to-content")&&(f.css({width:this.options.maxWidth}),this._maxWidthPass=!0,this.updateDimensionsToContent(t,i),this._maxWidthPass=!1,f.css({width:"auto"}))))},setDimensions:function(t){this.skin.setDimensions(t)},getContainmentSpace:function(t,i){var e=this.getContainmentLayout(t,i),s=this.getTargetLayout(),o=s.position,t=s.dimensions,i=e.position,s=e.dimensions,e={top:Math.max(o.top-i.top,0),bottom:Math.max(i.top+s.height-(o.top+t.height),0),left:Math.max(o.left-i.left,0),right:Math.max(i.left+s.width-(o.left+t.width),0)};return o.top>i.top+s.height&&(e.top-=o.top-(i.top+s.height)),o.top+t.heighti.left+s.width&&i.left+s.width>=o.left&&(e.left-=o.left-(i.left+s.width)),o.left+t.widthn[h[1]]?0:1])+Position.split(r)[1],c=Position.flip(p=r),o[Position.getSide(p)]?(this.updateDimensionsToContent(p,c),i=this.getPositionBasedOnTarget(p,c)):i.contained=!1,i.contained?this.setPosition(i,c):(e.unshift({position:i,targetPosition:p,stemPosition:c}),d=[],$.each(e,function(t,i){var e,s;0<=i.position.top&&0<=i.position.left?a=i:(e=0<=i.position.top?1:Math.abs(i.position.top),s=0<=i.position.left?1:Math.abs(i.position.left),d.push({result:i,negativity:e*s}))}),a||(l=d[d.length-1],$.each(d,function(t,i){i.negativity=g?(c[w]+=f,l[u]=-1*f,d=!0):Position.getOrientation(t)===Position.getOrientation(i)&&(c[w]+=r*b,l[u]=r*b*-1,c[w]=h.connections[i].move[p[0]]&&_<=h.connections[i].move[p[1]]&&(l[u]-=v)),p=(a=this.getContainment({top:c.top,left:c.left},i)).correction[u],v=deepExtend({},c),this.options.offset&&(v.left-=this.options.offset.x,v.top-=this.options.offset.y),(x={stem:{top:v.top+c.stem.connection.top,left:v.left+c.stem.connection.left}}).stem[w]+=l[u],w=this.getTargetLayout(),y=h.stemDimensions.width,y=Math.floor(.5*y),T=g+m.dimensions[T?"width":"height"],"x"==u?(k=w.position.left+y,0=k&&v.left+p>=g||0
=k&&v.top+p>=g||0
e.position.left+e.dimensions.width)&&(s.horizontal=!1,t.lefte.position.top+e.dimensions.height)&&(s.vertical=!1,t.topg?h=10*d:e>=h&&e!==g?c.maskDigitPosMapOld[h]||(e=h,h=h-(k-l)-a,c.maskDigitPosMap[h]&&(h=e)):h>e&&(h=h+(l-k)+f)}return h},behaviour:function(d){d=
d||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,l.byPassKeys)){e=c.getMasked();var h=c.getCaret(),g=b.data("mask-previus-value")||"";setTimeout(function(){c.setCaret(c.calculateCaretPosition(g))},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(h);return c.callbacks(d)}},getMasked:function(a,b){var h=[],f=void 0===b?c.val():b+"",g=0,k=d.length,n=0,p=f.length,m=1,r="push",u=-1,w=0;b=[];if(e.reverse){r="unshift";m=-1;var x=0;g=k-1;n=p-1;var A=function(){return-1<
g&&-1