!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";x.ui=x.ui||{};x.ui.version="1.14.2";
var o,n,W,C,s,r,l,a,h,i,f=0,c=Array.prototype.hasOwnProperty,u=Array.prototype.slice;x.cleanData=(o=x.cleanData,function(t){for(var e,i,n=0;null!=(i=t[n]);n++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");o(t)}),x.widget=function(t,i,e){var n,o,s,r,l={},a=t.split(".")[0];return"__proto__"===(t=t.split(".")[1])||"constructor"===t?x.error("Invalid widget name: "+t):(r=a+"-"+t,e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[r.toLowerCase()]=function(t){return!!x.data(t,r)},x[a]=x[a]||{},n=x[a][t],o=x[a][t]=function(t,e){if(!this||!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},x.extend(o,n,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(s=new i).options=x.widget.extend({},s.options),x.each(e,function(e,n){function o(){return i.prototype[e].apply(this,arguments)}function s(t){return i.prototype[e].apply(this,t)}l[e]="function"!=typeof n?n:function(){var t,e=this._super,i=this._superApply;return this._super=o,this._superApply=s,t=n.apply(this,arguments),this._super=e,this._superApply=i,t}}),o.prototype=x.widget.extend(s,{widgetEventPrefix:n&&s.widgetEventPrefix||t},l,{constructor:o,namespace:a,widgetName:t,widgetFullName:r}),n?(x.each(n._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,o,e._proto)}),delete n._childConstructors):i._childConstructors.push(o),x.widget.bridge(t,o),o)},x.widget.extend=function(t){for(var e,i,n=u.call(arguments,1),o=0,s=n.length;o<s;o++)for(e in n[o])i=n[o][e],c.call(n[o],e)&&void 0!==i&&(x.isPlainObject(i)?t[e]=x.isPlainObject(t[e])?x.widget.extend({},t[e],i):x.widget.extend({},i):t[e]=i);return t},x.widget.bridge=function(s,e){var r=e.prototype.widgetFullName||s;x.fn[s]=function(i){var t="string"==typeof i,n=u.call(arguments,1),o=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=x.data(this,r);return"instance"===i?(o=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?x.error("no such method '"+i+"' for "+s+" widget instance"):(t=e[i].apply(e,n))!==e&&void 0!==t?(o=t&&t.jquery?o.pushStack(t.get()):t,!1):void 0:x.error("cannot call methods on "+s+" prior to initialization; attempted to call method '"+i+"'")}):o=void 0:(n.length&&(i=x.widget.extend.apply(null,[i].concat(n))),this.each(function(){var t=x.data(this,r);t?(t.option(i||{}),t._init&&t._init()):x.data(this,r,new e(i,this))})),o}},x.Widget=function(){},x.Widget._childConstructors=[],x.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=f++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o<i.length-1;o++)n[i[o]]=n[i[o]]||{},n=n[i[o]];if(t=i.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=e}return this._setOptions(s),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,n;for(e in t)n=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&n&&n.length&&(i=x(n.get()),this._removeClass(n,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(o){var s=[],r=this;function t(t,e){for(var i,n=0;n<t.length;n++)i=r.classesElementLookup[t[n]]||x(),i=o.add?(function(){var i=[];o.element.each(function(t,e){x.map(r.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),r._on(x(i),{remove:"_untrackClassesElement"})}(),x(x.uniqueSort(i.get().concat(o.element.get())))):x(i.not(o.element).get()),r.classesElementLookup[t[n]]=i,s.push(t[n]),e&&o.classes[t[n]]&&s.push(o.classes[t[n]])}return(o=x.extend({element:this.element,classes:this.options.classes||{}},o)).keys&&t(o.keys.match(/\S+/g)||[],!0),o.extra&&t(o.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(i){var n=this;x.each(n.classesElementLookup,function(t,e){-1!==x.inArray(i.target,e)&&(n.classesElementLookup[t]=x(e.not(i.target).get()))}),this._off(x(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,n){var o="string"==typeof t||null===t,e={extra:o?e:i,keys:o?t:e,element:o?this.element:t,add:n="boolean"==typeof n?n:i};return e.element.toggleClass(this._classes(e),n),this},_on:function(o,s,t){var r,l=this;"boolean"!=typeof o&&(t=s,s=o,o=!1),t?(s=r=x(s),this.bindings=this.bindings.add(s)):(t=s,s=this.element,r=this.widget()),x.each(t,function(t,e){function i(){if(o||!0!==l.options.disabled&&!x(this).hasClass("ui-state-disabled"))return("string"==typeof e?l[e]:e).apply(l,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||x.guid++);var t=t.match(/^([\w:-]*)\s*(.*)$/),n=t[1]+l.eventNamespace,t=t[2];t?r.on(n,t,i):s.on(n,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=x(this.bindings.not(t).get()),this.focusable=x(this.focusable.not(t).get()),this.hoverable=x(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(x(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(x(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var n,o,s=this.options[t];if(i=i||{},(e=x.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],o=e.originalEvent)for(n in o)n in e||(e[n]=o[n]);return this.element.trigger(e,i),!("function"==typeof s&&!1===s.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},x.each({show:"fadeIn",hide:"fadeOut"},function(s,r){x.Widget.prototype["_"+s]=function(e,t,i){var n,o=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||r:s;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),n=!x.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),n&&x.effects&&x.effects.effect[o]?e[s](t):o!==s&&e[o]?e[o](t.duration,t.easing,i):e.queue(function(t){x(this)[s](),i&&i.call(e[0]),t()})}}),x.widget;function E(t,e,i){return[parseFloat(t[0])*(h.test(t[0])?e/100:1),parseFloat(t[1])*(h.test(t[1])?i/100:1)]}function P(t,e){return parseInt(x.css(t,e),10)||0}function H(t){return null!=t&&t===t.window}
W=Math.max,C=Math.abs,s=/left|center|right/,r=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,a=/^\w+/,h=/%$/,i=x.fn.position,x.position={scrollbarWidth:function(){var t,e,i;return void 0!==n?n:(i=(e=x("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?x.position.scrollbarWidth():0,height:e?x.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=x(t||window),i=H(e[0]),n=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:n,offset:!i&&!n?x(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},x.fn.position=function(c){var u,d,p,g,m,v,w,y,b,_,t,e;return c&&c.of?(v="string"==typeof(c=x.extend({},c)).of?x(document).find(c.of):x(c.of),w=x.position.getWithinInfo(c.within),y=x.position.getScrollInfo(w),b=(c.collision||"flip").split(" "),_={},e=9===(e=(t=v)[0]).nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:H(e)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:e.preventDefault?{width:0,height:0,offset:{top:e.pageY,left:e.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()},v[0].preventDefault&&(c.at="left top"),d=e.width,p=e.height,m=x.extend({},g=e.offset),x.each(["my","at"],function(){var t,e,i=(c[this]||"").split(" ");(i=1===i.length?s.test(i[0])?i.concat(["center"]):r.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=s.test(i[0])?i[0]:"center",i[1]=r.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),_[this]=[t?t[0]:0,e?e[0]:0],c[this]=[a.exec(i[0])[0],a.exec(i[1])[0]]}),1===b.length&&(b[1]=b[0]),"right"===c.at[0]?m.left+=d:"center"===c.at[0]&&(m.left+=d/2),"bottom"===c.at[1]?m.top+=p:"center"===c.at[1]&&(m.top+=p/2),u=E(_.at,d,p),m.left+=u[0],m.top+=u[1],this.each(function(){var i,t,r=x(this),l=r.outerWidth(),a=r.outerHeight(),e=P(this,"marginLeft"),n=P(this,"marginTop"),o=l+e+P(this,"marginRight")+y.width,s=a+n+P(this,"marginBottom")+y.height,h=x.extend({},m),f=E(_.my,r.outerWidth(),r.outerHeight());"right"===c.my[0]?h.left-=l:"center"===c.my[0]&&(h.left-=l/2),"bottom"===c.my[1]?h.top-=a:"center"===c.my[1]&&(h.top-=a/2),h.left+=f[0],h.top+=f[1],i={marginLeft:e,marginTop:n},x.each(["left","top"],function(t,e){x.ui.position[b[t]]&&x.ui.position[b[t]][e](h,{targetWidth:d,targetHeight:p,elemWidth:l,elemHeight:a,collisionPosition:i,collisionWidth:o,collisionHeight:s,offset:[u[0]+f[0],u[1]+f[1]],my:c.my,at:c.at,within:w,elem:r})}),c.using&&(t=function(t){var e=g.left-h.left,i=e+d-l,n=g.top-h.top,o=n+p-a,s={target:{element:v,left:g.left,top:g.top,width:d,height:p},element:{element:r,left:h.left,top:h.top,width:l,height:a},horizontal:i<0?"left":0<e?"right":"center",vertical:o<0?"top":0<n?"bottom":"middle"};d<l&&C(e+i)<d&&(s.horizontal="center"),p<a&&C(n+o)<p&&(s.vertical="middle"),W(C(e),C(i))>W(C(n),C(o))?s.important="horizontal":s.important="vertical",c.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):i.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;n<e.collisionWidth?0<r&&l<=0?(i=t.left+r+e.collisionWidth-n-o,t.left+=r-i):t.left=!(0<l&&r<=0)&&l<r?o+n-e.collisionWidth:o:0<r?t.left+=r:0<l?t.left-=l:t.left=W(t.left-s,t.left)},top:function(t,e){var i,n=e.within,n=n.isWindow?n.scrollTop:n.offset.top,o=e.within.height,s=t.top-e.collisionPosition.marginTop,r=n-s,l=s+e.collisionHeight-o-n;o<e.collisionHeight?0<r&&l<=0?(i=t.top+r+e.collisionHeight-o-n,t.top+=r-i):t.top=!(0<l&&r<=0)&&l<r?n+o-e.collisionHeight:n:0<r?t.top+=r:0<l?t.top-=l:t.top=W(t.top-s,t.top)}},flip:{left:function(t,e){var i=e.within,n=i.offset.left+i.scrollLeft,o=i.width,i=i.isWindow?i.scrollLeft:i.offset.left,s=t.left-e.collisionPosition.marginLeft,r=s-i,s=s+e.collisionWidth-o-i,l="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,a="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,h=-2*e.offset[0];r<0?((o=t.left+l+a+h+e.collisionWidth-o-n)<0||o<C(r))&&(t.left+=l+a+h):0<s&&(0<(n=t.left-e.collisionPosition.marginLeft+l+a+h-i)||C(n)<s)&&(t.left+=l+a+h)},top:function(t,e){var i=e.within,n=i.offset.top+i.scrollTop,o=i.height,i=i.isWindow?i.scrollTop:i.offset.top,s=t.top-e.collisionPosition.marginTop,r=s-i,s=s+e.collisionHeight-o-i,l="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,a="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,h=-2*e.offset[1];r<0?((o=t.top+l+a+h+e.collisionHeight-o-n)<0||o<C(r))&&(t.top+=l+a+h):0<s&&(0<(n=t.top-e.collisionPosition.marginTop+l+a+h-i)||C(n)<s)&&(t.top+=l+a+h)}},flipfit:{left:function(){x.ui.position.flip.left.apply(this,arguments),x.ui.position.fit.left.apply(this,arguments)},top:function(){x.ui.position.flip.top.apply(this,arguments),x.ui.position.fit.top.apply(this,arguments)}}};var t,e;
x.ui.position,x.extend(x.expr.pseudos,{data:x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}})}),x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}),
x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&"visible"===x(t).css("visibility"))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.ui.focusable,x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=x(this.element.prop("form")),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},
x.escapeSelector||(x.escapeSelector=function(t){return CSS.escape(t+"")}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}),x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+CSS.escape(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=x(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:x(this[0].ownerDocument||document)},x.extend(x.expr.pseudos,{tabbable:function(t){var e=x.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&x.ui.focusable(t,i)}}),x.fn.extend({uniqueId:(e=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&x(this).removeAttr("id")})}});x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o<s.length;o++)t.options[s[o][0]]&&s[o][1].apply(t.element,i)}}});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","../widget"],t):t(jQuery)}(function(r){"use strict";var s=/ui-corner-([a-z]){2,6}/g;return r.widget("ui.controlgroup",{version:"1.14.2",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var s=this,l=[];r.each(this.options.items,function(n,t){var e,o={};t&&("controlgroupLabel"===n?((e=s.element.find(t)).each(function(){var t=r(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),s._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),l=l.concat(e.get())):r.fn[n]&&(o=s["_"+n+"Options"]?s["_"+n+"Options"]("middle"):{classes:{}},s.element.find(t).each(function(){var t=r(this),e=t[n]("instance"),i=r.widget.extend({},o);"button"===n&&t.parent(".ui-spinner").length||((e=e||t[n]()[n]("instance"))&&(i.classes=s._resolveClassesValues(i.classes,e)),t[n](i),i=t[n]("widget"),r.data(i[0],"ui-controlgroup-data",e||t[n]("instance")),l.push(i[0]))})))}),this.childWidgets=r(r.uniqueSort(l)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=r(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){e=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,e)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,n={classes:{}};return n.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],n},_spinnerOptions:function(t){t=this._buildSimpleOptions(t,"ui-spinner");return t.classes["ui-spinner-up"]="",t.classes["ui-spinner-down"]="",t},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,n){var o={};return r.each(i,function(t){var e=n.options.classes[t]||"",e=String.prototype.trim.call(e.replace(s,""));o[t]=(e+" "+i[t]).replace(/\s+/g," ")}),o},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?this._callChildMethod(e?"disable":"enable"):this.refresh()},refresh:function(){var o,s=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),o=this.childWidgets,(o=this.options.onlyVisible?o.filter(":visible"):o).length&&(r.each(["first","last"],function(t,e){var i,n=o[e]().data("ui-controlgroup-data");n&&s["_"+n.widgetName+"Options"]?((i=s["_"+n.widgetName+"Options"](1===o.length?"only":e)).classes=s._resolveClassesValues(i.classes,n),n.element[n.widgetName](i)):s._updateCornerClass(o[e](),e)}),this._callChildMethod("refresh"))}})});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../form-reset-mixin","../labels","../widget"],e):e(jQuery)}(function(t){"use strict";return t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.14.2",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i=this._super()||{};return this._readType(),e=this.element.labels(),this.label=t(e[e.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",(e=this.label.contents().not(this.element[0])).length&&(this.originalLabel+=e.clone().wrapAll("<div></div>").parent().html()),this.originalLabel&&(i.label=this.originalLabel),null!=(e=this.element[0].disabled)&&(i.disabled=e),i},_create:function(){var e=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),e&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e=this.element[0].name,i="input[name='"+CSS.escape(e)+"']";return e?(this.form.length?t(this.form[0].elements).filter(i):t(i).filter(function(){return 0===t(t(this).prop("form")).length})).not(this.element):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(e,i){"label"===e&&!i||(this._super(e,i),"disabled"===e?(this._toggleClass(this.label,null,"ui-state-disabled",i),this.element[0].disabled=i):this.refresh())},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var e=this.label.contents().not(this.element[0]);this.icon&&(e=e.not(this.icon[0])),(e=this.iconSpace?e.not(this.iconSpace[0]):e).remove(),this.label.append(this.options.label)},refresh:function(){var e=this.element[0].checked,i=this.element[0].disabled;this._updateIcon(e),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),null!==this.options.label&&this._updateLabel(),i!==this.options.disabled&&this._setOptions({disabled:i})}}]),t.ui.checkboxradio});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./controlgroup","./checkboxradio","../keycode","../widget"],t):t(jQuery)}(function(e){"use strict";var h;return e.widget("ui.button",{version:"1.14.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,i=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(i.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(i.label=this.originalLabel),i},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(t){t.keyCode===e.ui.keyCode.SPACE&&(t.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(t,i){var t="iconPosition"!==t,o=t?this.options.iconPosition:i,s="top"===o||"bottom"===o;this.icon?t&&this._removeClass(this.icon,null,this.options.icon):(this.icon=e("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),t&&this._addClass(this.icon,null,i),this._attachIcon(o),s?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=e("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(o))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var i=(void 0===t.showLabel?this.options:t).showLabel,o=(void 0===t.icon?this.options:t).icon;i||o||(t.showLabel=!0),this._super(t)},_setOption:function(t,i){"icon"===t&&(i?this._updateIcon(t,i):this.icon&&(this.icon.remove(),this.iconSpace)&&this.iconSpace.remove()),"iconPosition"===t&&this._updateIcon(t,i),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!i),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(i):(this.element.html(i),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,i),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",i),this.element[0].disabled=i)&&this.element.trigger("blur")},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!0===e.uiBackCompat&&(e.widget("ui.button",e.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,i){"text"===t?this._super("showLabel",i):("showLabel"===t&&(this.options.text=i),"icon"===t&&(this.options.icons.primary=i),"icons"===t&&(i.primary?(this._super("icon",i.primary),this._super("iconPosition","beginning")):i.secondary&&(this._super("icon",i.secondary),this._super("iconPosition","end"))),this._superApply(arguments))}}),e.fn.button=(h=e.fn.button,function(o){var t="string"==typeof o,s=Array.prototype.slice.call(arguments,1),n=this;return t?this.length||"instance"!==o?this.each(function(){var t,i=e(this).attr("type"),i=e.data(this,"ui-"+("checkbox"!==i&&"radio"!==i?"button":"checkboxradio"));return"instance"===o?(n=i,!1):i?"function"!=typeof i[o]||"_"===o.charAt(0)?e.error("no such method '"+o+"' for button widget instance"):(t=i[o].apply(i,s))!==i&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:e.error("cannot call methods on button prior to initialization; attempted to call method '"+o+"'")}):n=void 0:(s.length&&(o=e.widget.extend.apply(null,[o].concat(s))),this.each(function(){var t=e(this).attr("type"),t="checkbox"!==t&&"radio"!==t?"button":"checkboxradio",i=e.data(this,"ui-"+t);i?(i.option(o||{}),i._init&&i._init()):"button"==t?h.call(e(this),o):e(this).checkboxradio(e.extend({icon:!1},o))})),n}),e.fn.buttonset=function(){return e.ui.controlgroup||e.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),e.ui.button});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./button","../version","../keycode","../widget"],t):t(jQuery)}(function(o){"use strict";function i(i){return function(){var t=this.element.val();i.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}return o.widget("ui.spinner",{version:"1.14.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),s=this.element;return o.each(["min","max","step"],function(t,i){var n=s.attr(i);null!=n&&n.length&&(e[i]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t)},wheel:function(t){var i=this.document[0].activeElement,i=this.element[0]===i,n=t.deltaY||t.originalEvent&&t.originalEvent.deltaY;if(i&&n){if(!this.spinning&&!this._start(t))return!1;this._spin((0<n?-1:1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},mousewheel:function(t,i){if(t.isTrigger)return(t=o.Event(t)).type="wheel",i&&(t.deltaY=-i),this._events.wheel.call(this,t)},"mousedown .ui-spinner-button":function(t){var i;i=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),function(){this.element[0]!==this.document[0].activeElement&&(this.element.trigger("focus"),this.previous=i)}.call(this),!1!==this._start(t)&&this._repeat(null,o(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(o(t.currentTarget).hasClass("ui-state-active"))return!1!==this._start(t)&&void this._repeat(null,o(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&0<this.uiSpinner.height()&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(t){var i=this.options,n=o.ui.keyCode;switch(t.keyCode){case n.UP:return this._repeat(null,1,t),!0;case n.DOWN:return this._repeat(null,-1,t),!0;case n.PAGE_UP:return this._repeat(null,i.page,t),!0;case n.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_start:function(t){return!(!this.spinning&&!1===this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0)},_repeat:function(t,i,n){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,i,n)},t),this._spin(i*this.options.step,n)},_spin:function(t,i){var n=this.value()||0;this.counter||(this.counter=1),n=this._adjustValue(n+t*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",i,{value:n})||(this._value(n),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?"function"==typeof i?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var t=t.toString(),i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(t){var i=this.options,n=null!==i.min?i.min:0,e=t-n;return t=n+Math.round(e/i.step)*i.step,t=parseFloat(t.toFixed(this._precision())),null!==i.max&&t>i.max?i.max:null!==i.min&&t<i.min?i.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,i){var n;"culture"===t||"numberFormat"===t?(n=this._parse(this.element.val()),this.options[t]=i,this.element.val(this._format(n))):("max"!==t&&"min"!==t&&"step"!==t||"string"==typeof i&&(i=this._parse(i)),"icons"===t&&(n=this.buttons.first().find(".ui-icon"),this._removeClass(n,null,this.options.icons.up),this._addClass(n,null,i.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,i.down)),this._super(t,i))},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:i(function(t){this._super(t)}),_parse:function(t){return""===(t="string"==typeof t&&""!==t?window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t:t)||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,i){var n;""!==t&&null!==(n=this._parse(t))&&(i||(n=this._adjustValue(n)),t=this._format(n)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:i(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:i(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:i(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:i(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());i(this._value).call(this,t)},widget:function(){return this.uiSpinner}}),!0===o.uiBackCompat&&o.widget("ui.spinner",o.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),o.ui.spinner});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../version","../keycode"],e):e(jQuery)}(function(V){"use strict";var n;function e(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},V.extend(this._defaults,this.regional[""]),this.regional.en=V.extend(!0,{},this.regional[""]),this.regional["en-US"]=V.extend(!0,{},this.regional.en),this.dpDiv=a(V("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",t,function(){V(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",t,d)}function d(){V.datepicker._isDisabledDatepicker((n.inline?n.dpDiv.parent():n.input)[0])||(V(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),V(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).addClass("ui-datepicker-next-hover"))}function c(e,t){for(var a in V.extend(e,t),t)null==t[a]&&(e[a]=t[a])}return V.extend(V.ui,{datepicker:{version:"1.14.2"}}),V.extend(e.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return c(this._defaults,e||{}),this},_attachDatepicker:function(e,t){var a,i=e.nodeName.toLowerCase(),s="div"===i||"span"===i;e.id||(this.uuid+=1,e.id="dp"+this.uuid),(a=this._newInst(V(e),s)).settings=V.extend({},t||{}),"input"===i?this._connectDatepicker(e,a):s&&this._inlineDatepicker(e,a)},_newInst:function(e,t){return{id:e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?a(V("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,t){var a=V(e);t.append=V([]),t.trigger=V([]),a.hasClass(this.markerClassName)||(this._attachments(a,t),a.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(t),V.data(e,"datepicker",t),t.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,t){var a,i=this._get(t,"appendText"),s=this._get(t,"isRTL");t.append&&t.append.remove(),i&&(t.append=V("<span>").addClass(this._appendClass).text(i),e[s?"before":"after"](t.append)),e.off("focus",this._showDatepicker),t.trigger&&t.trigger.remove(),"focus"!==(i=this._get(t,"showOn"))&&"both"!==i||e.on("focus",this._showDatepicker),"button"!==i&&"both"!==i||(i=this._get(t,"buttonText"),a=this._get(t,"buttonImage"),this._get(t,"buttonImageOnly")?t.trigger=V("<img>").addClass(this._triggerClass).attr({src:a,alt:i,title:i}):(t.trigger=V("<button type='button'>").addClass(this._triggerClass),a?t.trigger.html(V("<img>").attr({src:a,alt:i,title:i})):t.trigger.text(i)),e[s?"before":"after"](t.trigger),t.trigger.on("click",function(){return V.datepicker._datepickerShowing&&V.datepicker._lastInput===e[0]?V.datepicker._hideDatepicker():(V.datepicker._datepickerShowing&&V.datepicker._lastInput!==e[0]&&V.datepicker._hideDatepicker(),V.datepicker._showDatepicker(e[0])),!1}))},_autoSize:function(e){var t,a,i,s,r,n;this._get(e,"autoSize")&&!e.inline&&(r=new Date(2009,11,20),(n=this._get(e,"dateFormat")).match(/[DM]/)&&(r.setMonth((t=function(e){for(s=i=a=0;s<e.length;s++)e[s].length>a&&(a=e[s].length,i=s);return i})(this._get(e,n.match(/MM/)?"monthNames":"monthNamesShort"))),r.setDate(t(this._get(e,n.match(/DD/)?"dayNames":"dayNamesShort"))+20-r.getDay())),e.input.attr("size",this._formatDate(e,r).length))},_inlineDatepicker:function(e,t){var a=V(e);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(t.dpDiv),V.data(e,"datepicker",t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block"))},_dialogDatepicker:function(e,t,a,i,s){var r,n=this._dialogInst;return n||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=V("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),V("body").append(this._dialogInput),(n=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},V.data(this._dialogInput[0],"datepicker",n)),c(n.settings,i||{}),t=t&&t.constructor===Date?this._formatDate(n,t):t,this._dialogInput.val(t),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(r=document.documentElement.clientWidth,i=document.documentElement.clientHeight,t=document.documentElement.scrollLeft||document.body.scrollLeft,s=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[r/2-100+t,i/2-150+s]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),n.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),V.blockUI&&V.blockUI(this.dpDiv),V.data(this._dialogInput[0],"datepicker",n),this},_destroyDatepicker:function(e){var t,a=V(e),i=V.data(e,"datepicker");a.hasClass(this.markerClassName)&&(t=e.nodeName.toLowerCase(),V.removeData(e,"datepicker"),"input"===t?(i.append.remove(),i.trigger.remove(),a.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):"div"!==t&&"span"!==t||a.removeClass(this.markerClassName).empty(),V.datepicker._hideDatepicker(),n===i)&&(n=null,this._curInst=null)},_enableDatepicker:function(t){var e,a=V(t),i=V.data(t,"datepicker");a.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!1,i.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==e&&"span"!==e||((i=a.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=V.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var e,a=V(t),i=V.data(t,"datepicker");a.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!0,i.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==e&&"span"!==e||((i=a.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=V.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(e)for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(e){try{return V.data(e,"datepicker")}catch(e){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,t,a){var i,s,r=this._getInst(e);if(2===arguments.length&&"string"==typeof t)return"defaults"===t?V.extend({},V.datepicker._defaults):r?"all"===t?V.extend({},r.settings):this._get(r,t):null;i=t||{},"string"==typeof t&&((i={})[t]=a),r&&(this._curInst===r&&this._hideDatepicker(),t=this._getDateDatepicker(e,!0),a=this._getMinMaxDate(r,"min"),s=this._getMinMaxDate(r,"max"),c(r.settings,i),null!==a&&void 0!==i.dateFormat&&void 0===i.minDate&&(r.settings.minDate=this._formatDate(r,a)),null!==s&&void 0!==i.dateFormat&&void 0===i.maxDate&&(r.settings.maxDate=this._formatDate(r,s)),"disabled"in i&&(i.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(V(e),r),this._autoSize(r),this._setDate(r,t),this._updateAlternate(r),this._updateDatepicker(r))},_changeDatepicker:function(e,t,a){this._optionDatepicker(e,t,a)},_refreshDatepicker:function(e){e=this._getInst(e);e&&this._updateDatepicker(e)},_setDateDatepicker:function(e,t){e=this._getInst(e);e&&(this._setDate(e,t),this._updateDatepicker(e),this._updateAlternate(e))},_getDateDatepicker:function(e,t){e=this._getInst(e);return e&&!e.inline&&this._setDateFromField(e,t),e?this._getDate(e):null},_doKeyDown:function(e){var t,a,i=V.datepicker._getInst(e.target),s=!0,r=i.dpDiv.is(".ui-datepicker-rtl");if(i._keyEvent=!0,V.datepicker._datepickerShowing)switch(e.keyCode){case 9:V.datepicker._hideDatepicker(),s=!1;break;case 13:return(a=V("td."+V.datepicker._dayOverClass+":not(."+V.datepicker._currentClass+")",i.dpDiv))[0]&&V.datepicker._selectDay(e.target,i.selectedMonth,i.selectedYear,a[0]),(a=V.datepicker._get(i,"onSelect"))?(t=V.datepicker._formatDate(i),a.apply(i.input?i.input[0]:null,[t,i])):V.datepicker._hideDatepicker(),!1;case 27:V.datepicker._hideDatepicker();break;case 33:V.datepicker._adjustDate(e.target,e.ctrlKey?-V.datepicker._get(i,"stepBigMonths"):-V.datepicker._get(i,"stepMonths"),"M");break;case 34:V.datepicker._adjustDate(e.target,e.ctrlKey?+V.datepicker._get(i,"stepBigMonths"):+V.datepicker._get(i,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&V.datepicker._clearDate(e.target),s=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&V.datepicker._gotoToday(e.target),s=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&V.datepicker._adjustDate(e.target,r?1:-1,"D"),s=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&V.datepicker._adjustDate(e.target,e.ctrlKey?-V.datepicker._get(i,"stepBigMonths"):-V.datepicker._get(i,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&V.datepicker._adjustDate(e.target,-7,"D"),s=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&V.datepicker._adjustDate(e.target,r?-1:1,"D"),s=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&V.datepicker._adjustDate(e.target,e.ctrlKey?+V.datepicker._get(i,"stepBigMonths"):+V.datepicker._get(i,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&V.datepicker._adjustDate(e.target,7,"D"),s=e.ctrlKey||e.metaKey;break;default:s=!1}else 36===e.keyCode&&e.ctrlKey?V.datepicker._showDatepicker(this):s=!1;s&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var t,a=V.datepicker._getInst(e.target);if(V.datepicker._get(a,"constrainInput"))return a=V.datepicker._possibleChars(V.datepicker._get(a,"dateFormat")),t=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||t<" "||!a||-1<a.indexOf(t)},_doKeyUp:function(e){e=V.datepicker._getInst(e.target);if(e.input.val()!==e.lastVal)try{V.datepicker.parseDate(V.datepicker._get(e,"dateFormat"),e.input?e.input.val():null,V.datepicker._getFormatConfig(e))&&(V.datepicker._setDateFromField(e),V.datepicker._updateAlternate(e),V.datepicker._updateDatepicker(e))}catch(e){}return!0},_showDatepicker:function(e){var t,a,i,s;"input"!==(e=e.target||e).nodeName.toLowerCase()&&(e=V("input",e.parentNode)[0]),V.datepicker._isDisabledDatepicker(e)||V.datepicker._lastInput===e||(s=V.datepicker._getInst(e),V.datepicker._curInst&&V.datepicker._curInst!==s&&(V.datepicker._curInst.dpDiv.stop(!0,!0),s)&&V.datepicker._datepickerShowing&&V.datepicker._hideDatepicker(V.datepicker._curInst.input[0]),!1===(a=(a=V.datepicker._get(s,"beforeShow"))?a.apply(e,[e,s]):{}))||(c(s.settings,a),s.lastVal=null,V.datepicker._lastInput=e,V.datepicker._setDateFromField(s),V.datepicker._inDialog&&(e.value=""),V.datepicker._pos||(V.datepicker._pos=V.datepicker._findPos(e),V.datepicker._pos[1]+=e.offsetHeight),t=!1,V(e).parents().each(function(){return!(t|="fixed"===V(this).css("position"))}),a={left:V.datepicker._pos[0],top:V.datepicker._pos[1]},V.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),V.datepicker._updateDatepicker(s),a=V.datepicker._checkOffset(s,a,t),s.dpDiv.css({position:V.datepicker._inDialog&&V.blockUI?"static":t?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),s.inline)||(a=V.datepicker._get(s,"showAnim"),i=V.datepicker._get(s,"duration"),s.dpDiv.css("z-index",function(e){for(var t;e.length&&e[0]!==document;){if(("absolute"===(t=e.css("position"))||"relative"===t||"fixed"===t)&&(t=parseInt(e.css("zIndex"),10),!isNaN(t))&&0!==t)return t;e=e.parent()}return 0}(V(e))+1),V.datepicker._datepickerShowing=!0,V.effects&&V.effects.effect[a]?s.dpDiv.show(a,V.datepicker._get(s,"showOptions"),i):s.dpDiv[a||"show"](a?i:null),V.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),V.datepicker._curInst=s)},_updateDatepicker:function(e){this.maxRows=4,(n=e).dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var t,a=this._getNumberOfMonths(e),i=a[1],s=e.dpDiv.find("."+this._dayOverClass+" a"),r=V.datepicker._get(e,"onUpdateDatepicker");0<s.length&&d.apply(s.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),1<i&&e.dpDiv.addClass("ui-datepicker-multi-"+i).css("width",17*i+"em"),e.dpDiv[(1!==a[0]||1!==a[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===V.datepicker._curInst&&V.datepicker._datepickerShowing&&V.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(t=e.yearshtml,setTimeout(function(){t===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year").first().replaceWith(e.yearshtml),t=e.yearshtml=null},0)),r&&r.apply(e.input?e.input[0]:null,[e])},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")},_checkOffset:function(e,t,a){var i=e.dpDiv.outerWidth(),s=e.dpDiv.outerHeight(),r=e.input?e.input.outerWidth():0,n=e.input?e.input.outerHeight():0,d=document.documentElement.clientWidth+(a?0:V(document).scrollLeft()),c=document.documentElement.clientHeight+(a?0:V(document).scrollTop());return t.left-=this._get(e,"isRTL")?i-r:0,t.left-=a&&t.left===e.input.offset().left?V(document).scrollLeft():0,t.top-=a&&t.top===e.input.offset().top+n?V(document).scrollTop():0,t.left-=Math.min(t.left,d<t.left+i&&i<d?Math.abs(t.left+i-d):0),t.top-=Math.min(t.top,c<t.top+s&&s<c?Math.abs(s+n):0),t},_findPos:function(e){for(var t=this._getInst(e),a=this._get(t,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||V.expr.pseudos.hidden(e));)e=e[a?"previousSibling":"nextSibling"];return[(t=V(e).offset()).left,t.top]},_hideDatepicker:function(e){var t,a,i=this._curInst;!i||e&&i!==V.data(e,"datepicker")||this._datepickerShowing&&(e=this._get(i,"showAnim"),a=this._get(i,"duration"),t=function(){V.datepicker._tidyDialog(i)},V.effects&&V.effects.effect[e]?i.dpDiv.hide(e,V.datepicker._get(i,"showOptions"),a,t):i.dpDiv["slideDown"===e?"slideUp":"fadeIn"===e?"fadeOut":"hide"](e?a:null,t),e||t(),this._datepickerShowing=!1,(a=this._get(i,"onClose"))&&a.apply(i.input?i.input[0]:null,[i.input?i.input.val():"",i]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),V.blockUI)&&(V.unblockUI(),V("body").append(this.dpDiv)),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){var t;V.datepicker._curInst&&(e=V(e.target),t=V.datepicker._getInst(e[0]),!(e[0].id===V.datepicker._mainDivId||0!==e.parents("#"+V.datepicker._mainDivId).length||e.hasClass(V.datepicker.markerClassName)||e.closest("."+V.datepicker._triggerClass).length||!V.datepicker._datepickerShowing||V.datepicker._inDialog&&V.blockUI)||e.hasClass(V.datepicker.markerClassName)&&V.datepicker._curInst!==t)&&V.datepicker._hideDatepicker()},_adjustDate:function(e,t,a){var e=V(e),i=this._getInst(e[0]);this._isDisabledDatepicker(e[0])||(this._adjustInstDate(i,t,a),this._updateDatepicker(i))},_gotoToday:function(e){var t,e=V(e),a=this._getInst(e[0]);this._get(a,"gotoCurrent")&&a.currentDay?(a.selectedDay=a.currentDay,a.drawMonth=a.selectedMonth=a.currentMonth,a.drawYear=a.selectedYear=a.currentYear):(t=new Date,a.selectedDay=t.getDate(),a.drawMonth=a.selectedMonth=t.getMonth(),a.drawYear=a.selectedYear=t.getFullYear()),this._notifyChange(a),this._adjustDate(e)},_selectMonthYear:function(e,t,a){var e=V(e),i=this._getInst(e[0]);i["selected"+("M"===a?"Month":"Year")]=i["draw"+("M"===a?"Month":"Year")]=parseInt(t.options[t.selectedIndex].value,10),this._notifyChange(i),this._adjustDate(e)},_selectDay:function(e,t,a,i){var s=V(e);V(i).hasClass(this._unselectableClass)||this._isDisabledDatepicker(s[0])||((s=this._getInst(s[0])).selectedDay=s.currentDay=parseInt(V("a",i).attr("data-date")),s.selectedMonth=s.currentMonth=t,s.selectedYear=s.currentYear=a,this._selectDate(e,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear)))},_clearDate:function(e){e=V(e);this._selectDate(e,"")},_selectDate:function(e,t){var a,e=V(e),e=this._getInst(e[0]);t=null!=t?t:this._formatDate(e),e.input&&e.input.val(t),this._updateAlternate(e),(a=this._get(e,"onSelect"))?a.apply(e.input?e.input[0]:null,[t,e]):e.input&&e.input.trigger("change"),e.inline?this._updateDatepicker(e):(this._hideDatepicker(),this._lastInput=e.input[0],"object"!=typeof e.input[0]&&e.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var t,a,i=this._get(e,"altField");i&&(a=this._get(e,"altFormat")||this._get(e,"dateFormat"),t=this._getDate(e),a=this.formatDate(a,t,this._getFormatConfig(e)),V(document).find(i).val(a))},noWeekends:function(e){e=e.getDay();return[0<e&&e<6,""]},iso8601Week:function(e){var t,e=new Date(e.getTime());return e.setDate(e.getDate()+4-(e.getDay()||7)),t=e.getTime(),e.setMonth(0),e.setDate(1),Math.floor(Math.round((t-e)/864e5)/7)+1},parseDate:function(t,s,e){if(null==t||null==s)throw"Invalid arguments";if(""===(s="object"==typeof s?s.toString():s+""))return null;for(var a,i,r=0,n=(e?e.shortYearCutoff:null)||this._defaults.shortYearCutoff,n="string"!=typeof n?n:(new Date).getFullYear()%100+parseInt(n,10),d=(e?e.dayNamesShort:null)||this._defaults.dayNamesShort,c=(e?e.dayNames:null)||this._defaults.dayNames,o=(e?e.monthNamesShort:null)||this._defaults.monthNamesShort,l=(e?e.monthNames:null)||this._defaults.monthNames,h=-1,u=-1,p=-1,g=-1,_=!1,f=function(e){e=y+1<t.length&&t.charAt(y+1)===e;return e&&y++,e},k=function(e){var t=f(e),t="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,e=new RegExp("^\\d{"+("y"===e?t:1)+","+t+"}"),t=s.substring(r).match(e);if(t)return r+=t[0].length,parseInt(t[0],10);throw"Missing number at position "+r},D=function(e,t,a){var i=-1,e=V.map(f(e)?a:t,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(V.each(e,function(e,t){var a=t[1];if(s.substr(r,a.length).toLowerCase()===a.toLowerCase())return i=t[0],r+=a.length,!1}),-1!==i)return i+1;throw"Unknown name at position "+r},m=function(){if(s.charAt(r)!==t.charAt(y))throw"Unexpected literal at position "+r;r++},y=0;y<t.length;y++)if(_)"'"!==t.charAt(y)||f("'")?m():_=!1;else switch(t.charAt(y)){case"d":p=k("d");break;case"D":D("D",d,c);break;case"o":g=k("o");break;case"m":u=k("m");break;case"M":u=D("M",o,l);break;case"y":h=k("y");break;case"@":h=(i=new Date(k("@"))).getFullYear(),u=i.getMonth()+1,p=i.getDate();break;case"!":h=(i=new Date((k("!")-this._ticksTo1970)/1e4)).getFullYear(),u=i.getMonth()+1,p=i.getDate();break;case"'":f("'")?m():_=!0;break;default:m()}if(r<s.length&&(e=s.substr(r),!/^\s+/.test(e)))throw"Extra/unparsed characters found in date: "+e;if(-1===h?h=(new Date).getFullYear():h<100&&(h+=(new Date).getFullYear()-(new Date).getFullYear()%100+(h<=n?0:-100)),-1<g)for(u=1,p=g;;){if(p<=(a=this._getDaysInMonth(h,u-1)))break;u++,p-=a}if((i=this._daylightSavingAdjust(new Date(h,u-1,p))).getFullYear()!==h||i.getMonth()+1!==u||i.getDate()!==p)throw"Invalid date";return i},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(t,e,a){if(!e)return"";function i(e,t,a){var i=""+t;if(l(e))for(;i.length<a;)i="0"+i;return i}function s(e,t,a,i){return(l(e)?i:a)[t]}var r,n=(a?a.dayNamesShort:null)||this._defaults.dayNamesShort,d=(a?a.dayNames:null)||this._defaults.dayNames,c=(a?a.monthNamesShort:null)||this._defaults.monthNamesShort,o=(a?a.monthNames:null)||this._defaults.monthNames,l=function(e){e=r+1<t.length&&t.charAt(r+1)===e;return e&&r++,e},h="",u=!1;if(e)for(r=0;r<t.length;r++)if(u)"'"!==t.charAt(r)||l("'")?h+=t.charAt(r):u=!1;else switch(t.charAt(r)){case"d":h+=i("d",e.getDate(),2);break;case"D":h+=s("D",e.getDay(),n,d);break;case"o":h+=i("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":h+=i("m",e.getMonth()+1,2);break;case"M":h+=s("M",e.getMonth(),c,o);break;case"y":h+=l("y")?e.getFullYear():(e.getFullYear()%100<10?"0":"")+e.getFullYear()%100;break;case"@":h+=e.getTime();break;case"!":h+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?h+="'":u=!0;break;default:h+=t.charAt(r)}return h},_possibleChars:function(t){for(var e="",a=!1,i=function(e){e=s+1<t.length&&t.charAt(s+1)===e;return e&&s++,e},s=0;s<t.length;s++)if(a)"'"!==t.charAt(s)||i("'")?e+=t.charAt(s):a=!1;else switch(t.charAt(s)){case"d":case"m":case"y":case"@":e+="0123456789";break;case"D":case"M":return null;case"'":i("'")?e+="'":a=!0;break;default:e+=t.charAt(s)}return e},_get:function(e,t){return(void 0!==e.settings[t]?e.settings:this._defaults)[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var a=this._get(e,"dateFormat"),i=e.lastVal=e.input?e.input.val():null,s=this._getDefaultDate(e),r=s,n=this._getFormatConfig(e);try{r=this.parseDate(a,i,n)||s}catch(e){i=t?"":i}e.selectedDay=r.getDate(),e.drawMonth=e.selectedMonth=r.getMonth(),e.drawYear=e.selectedYear=r.getFullYear(),e.currentDay=i?r.getDate():0,e.currentMonth=i?r.getMonth():0,e.currentYear=i?r.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(d,e,t){var a,i=null==e||""===e?t:"string"==typeof e?function(e){try{return V.datepicker.parseDate(V.datepicker._get(d,"dateFormat"),e,V.datepicker._getFormatConfig(d))}catch(e){}for(var t=(e.toLowerCase().match(/^c/)?V.datepicker._getDate(d):null)||new Date,a=t.getFullYear(),i=t.getMonth(),s=t.getDate(),r=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,n=r.exec(e);n;){switch(n[2]||"d"){case"d":case"D":s+=parseInt(n[1],10);break;case"w":case"W":s+=7*parseInt(n[1],10);break;case"m":case"M":i+=parseInt(n[1],10),s=Math.min(s,V.datepicker._getDaysInMonth(a,i));break;case"y":case"Y":a+=parseInt(n[1],10),s=Math.min(s,V.datepicker._getDaysInMonth(a,i))}n=r.exec(e)}return new Date(a,i,s)}(e):"number"==typeof e?isNaN(e)?t:(i=e,(a=new Date).setDate(a.getDate()+i),a):new Date(e.getTime());return(i=i&&"Invalid Date"===i.toString()?t:i)&&(i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(0)),this._daylightSavingAdjust(i)},_daylightSavingAdjust:function(e){return e?(e.setHours(12<e.getHours()?e.getHours()+2:0),e):null},_setDate:function(e,t,a){var i=!t,s=e.selectedMonth,r=e.selectedYear,t=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=t.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=t.getMonth(),e.drawYear=e.selectedYear=e.currentYear=t.getFullYear(),s===e.selectedMonth&&r===e.selectedYear||a||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(i?"":this._formatDate(e))},_getDate:function(e){return!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay))},_attachHandlers:function(e){var t=this._get(e,"stepMonths"),a="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){V.datepicker._adjustDate(a,-t,"M")},next:function(){V.datepicker._adjustDate(a,+t,"M")},hide:function(){V.datepicker._hideDatepicker()},today:function(){V.datepicker._gotoToday(a)},selectDay:function(){return V.datepicker._selectDay(a,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return V.datepicker._selectMonthYear(a,this,"M"),!1},selectYear:function(){return V.datepicker._selectMonthYear(a,this,"Y"),!1}};V(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,a,i,s,r,O,L,R,H,n,d,W,c,o,l,h,u,p,g,_,f,k,E,D,m,U,y,P,z,v,M,b,w=new Date,B=this._daylightSavingAdjust(new Date(w.getFullYear(),w.getMonth(),w.getDate())),C=this._get(e,"isRTL"),w=this._get(e,"showButtonPanel"),I=this._get(e,"hideIfNoPrevNext"),x=this._get(e,"navigationAsDateFormat"),Y=this._getNumberOfMonths(e),S=this._get(e,"showCurrentAtPos"),F=this._get(e,"stepMonths"),J=1!==Y[0]||1!==Y[1],N=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),T=this._getMinMaxDate(e,"min"),A=this._getMinMaxDate(e,"max"),K=e.drawMonth-S,j=e.drawYear;if(K<0&&(K+=12,j--),A)for(t=this._daylightSavingAdjust(new Date(A.getFullYear(),A.getMonth()-Y[0]*Y[1]+1,A.getDate())),t=T&&t<T?T:t;this._daylightSavingAdjust(new Date(j,K,1))>t;)--K<0&&(K=11,j--);for(e.drawMonth=K,e.drawYear=j,S=this._get(e,"prevText"),S=x?this.formatDate(S,this._daylightSavingAdjust(new Date(j,K-F,1)),this._getFormatConfig(e)):S,a=this._canAdjustMonth(e,-1,j,K)?V("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:S}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(C?"e":"w")).text(S))[0].outerHTML:I?"":V("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:S}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(C?"e":"w")).text(S))[0].outerHTML,S=this._get(e,"nextText"),S=x?this.formatDate(S,this._daylightSavingAdjust(new Date(j,K+F,1)),this._getFormatConfig(e)):S,i=this._canAdjustMonth(e,1,j,K)?V("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:S}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(C?"w":"e")).text(S))[0].outerHTML:I?"":V("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:S}).append(V("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(C?"w":"e")).text(S))[0].outerHTML,F=this._get(e,"currentText"),I=this._get(e,"gotoCurrent")&&e.currentDay?N:B,F=x?this.formatDate(F,I,this._getFormatConfig(e)):F,S="",e.inline||(S=V("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(e,"closeText"))[0].outerHTML),x="",w&&(x=V("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(C?S:"").append(this._isInRange(e,I)?V("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(F):"").append(C?"":S)[0].outerHTML),s=parseInt(this._get(e,"firstDay"),10),s=isNaN(s)?0:s,r=this._get(e,"showWeek"),O=this._get(e,"dayNames"),L=this._get(e,"dayNamesMin"),R=this._get(e,"monthNames"),H=this._get(e,"monthNamesShort"),n=this._get(e,"beforeShowDay"),d=this._get(e,"showOtherMonths"),W=this._get(e,"selectOtherMonths"),c=this._getDefaultDate(e),o="",h=0;h<Y[0];h++){for(u="",this.maxRows=4,p=0;p<Y[1];p++){if(g=this._daylightSavingAdjust(new Date(j,K,e.selectedDay)),_=" ui-corner-all",f="",J){if(f+="<div class='ui-datepicker-group",1<Y[1])switch(p){case 0:f+=" ui-datepicker-group-first",_=" ui-corner-"+(C?"right":"left");break;case Y[1]-1:f+=" ui-datepicker-group-last",_=" ui-corner-"+(C?"left":"right");break;default:f+=" ui-datepicker-group-middle",_=""}f+="'>"}for(f+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+_+"'>"+(/all|left/.test(_)&&0===h?C?i:a:"")+(/all|right/.test(_)&&0===h?C?a:i:"")+this._generateMonthYearHeader(e,K,j,T,A,0<h||0<p,R,H)+"</div><table class='ui-datepicker-calendar'><thead><tr>",k=r?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",l=0;l<7;l++)k+="<th scope='col'"+(5<=(l+s+6)%7?" class='ui-datepicker-week-end'":"")+"><span title='"+O[E=(l+s)%7]+"'>"+L[E]+"</span></th>";for(f+=k+"</tr></thead><tbody>",m=this._getDaysInMonth(j,K),j===e.selectedYear&&K===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,m)),D=(this._getFirstDayOfMonth(j,K)-s+7)%7,m=Math.ceil((D+m)/7),U=J&&this.maxRows>m?this.maxRows:m,this.maxRows=U,y=this._daylightSavingAdjust(new Date(j,K,1-D)),P=0;P<U;P++){for(f+="<tr>",z=r?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(y)+"</td>":"",l=0;l<7;l++)v=n?n.apply(e.input?e.input[0]:null,[y]):[!0,""],b=(M=y.getMonth()!==K)&&!W||!v[0]||T&&y<T||A&&A<y,z+="<td class='"+(5<=(l+s+6)%7?" ui-datepicker-week-end":"")+(M?" ui-datepicker-other-month":"")+(y.getTime()===g.getTime()&&K===e.selectedMonth&&e._keyEvent||c.getTime()===y.getTime()&&c.getTime()===g.getTime()?" "+this._dayOverClass:"")+(b?" "+this._unselectableClass+" ui-state-disabled":"")+(M&&!d?"":" "+v[1]+(y.getTime()===N.getTime()?" "+this._currentClass:"")+(y.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(M&&!d||!v[2]?"":" title='"+v[2].replace(/'/g,"&#39;")+"'")+(b?"":" data-handler='selectDay' data-event='click' data-month='"+y.getMonth()+"' data-year='"+y.getFullYear()+"'")+">"+(M&&!d?"&#xa0;":b?"<span class='ui-state-default'>"+y.getDate()+"</span>":"<a class='ui-state-default"+(y.getTime()===B.getTime()?" ui-state-highlight":"")+(y.getTime()===N.getTime()?" ui-state-active":"")+(M?" ui-priority-secondary":"")+"' href='#' aria-current='"+(y.getTime()===N.getTime()?"true":"false")+"' data-date='"+y.getDate()+"'>"+y.getDate()+"</a>")+"</td>",y.setDate(y.getDate()+1),y=this._daylightSavingAdjust(y);f+=z+"</tr>"}11<++K&&(K=0,j++),u+=f+="</tbody></table>"+(J?"</div>"+(0<Y[0]&&p===Y[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}o+=u}return o+=x,e._keyEvent=!1,o},_generateMonthYearHeader:function(e,t,a,i,s,r,n,d){var c,o,l,h,u,p,g=this._get(e,"changeMonth"),_=this._get(e,"changeYear"),f=this._get(e,"showMonthAfterYear"),k=this._get(e,"selectMonthLabel"),D=this._get(e,"selectYearLabel"),m="<div class='ui-datepicker-title'>",y="";if(r||!g)y+="<span class='ui-datepicker-month'>"+n[t]+"</span>";else{for(c=i&&i.getFullYear()===a,o=s&&s.getFullYear()===a,y+="<select class='ui-datepicker-month' aria-label='"+k+"' data-handler='selectMonth' data-event='change'>",l=0;l<12;l++)(!c||l>=i.getMonth())&&(!o||l<=s.getMonth())&&(y+="<option value='"+l+"'"+(l===t?" selected='selected'":"")+">"+d[l]+"</option>");y+="</select>"}if(f||(m+=y+(!r&&g&&_?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",r||!_)m+="<span class='ui-datepicker-year'>"+a+"</span>";else{for(n=this._get(e,"yearRange").split(":"),h=(new Date).getFullYear(),u=(k=function(e){e=e.match(/c[+\-].*/)?a+parseInt(e.substring(1),10):e.match(/[+\-].*/)?h+parseInt(e,10):parseInt(e,10);return isNaN(e)?h:e})(n[0]),p=Math.max(u,k(n[1]||"")),u=i?Math.max(u,i.getFullYear()):u,p=s?Math.min(p,s.getFullYear()):p,e.yearshtml+="<select class='ui-datepicker-year' aria-label='"+D+"' data-handler='selectYear' data-event='change'>";u<=p;u++)e.yearshtml+="<option value='"+u+"'"+(u===a?" selected='selected'":"")+">"+u+"</option>";e.yearshtml+="</select>",m+=e.yearshtml,e.yearshtml=null}return m+=this._get(e,"yearSuffix"),f&&(m+=(!r&&g&&_?"":"&#xa0;")+y),m+="</div>"},_adjustInstDate:function(e,t,a){var i=e.selectedYear+("Y"===a?t:0),s=e.selectedMonth+("M"===a?t:0),t=Math.min(e.selectedDay,this._getDaysInMonth(i,s))+("D"===a?t:0),i=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(i,s,t)));e.selectedDay=i.getDate(),e.drawMonth=e.selectedMonth=i.getMonth(),e.drawYear=e.selectedYear=i.getFullYear(),"M"!==a&&"Y"!==a||this._notifyChange(e)},_restrictMinMax:function(e,t){var a=this._getMinMaxDate(e,"min"),e=this._getMinMaxDate(e,"max"),a=a&&t<a?a:t;return e&&e<a?e:a},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){e=this._get(e,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,a,i){var s=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(a,i+(t<0?t:s[0]*s[1]),1));return t<0&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var a,i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),r=null,n=null,e=this._get(e,"yearRange");return e&&(e=e.split(":"),a=(new Date).getFullYear(),r=parseInt(e[0],10),n=parseInt(e[1],10),e[0].match(/[+\-].*/)&&(r+=a),e[1].match(/[+\-].*/))&&(n+=a),(!i||t.getTime()>=i.getTime())&&(!s||t.getTime()<=s.getTime())&&(!r||t.getFullYear()>=r)&&(!n||t.getFullYear()<=n)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return{shortYearCutoff:"string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,a,i){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);i=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(i,a,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),V.fn.datepicker=function(e){if(!this.length)return this;V.datepicker.initialized||(V(document).on("mousedown",V.datepicker._checkExternalClick),V.datepicker.initialized=!0),0===V("#"+V.datepicker._mainDivId).length&&V("body").append(V.datepicker.dpDiv);var t=Array.prototype.slice.call(arguments,1);return"string"==typeof e&&("isDisabled"===e||"getDate"===e||"widget"===e)||"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?V.datepicker["_"+e+"Datepicker"].apply(V.datepicker,[this[0]].concat(t)):this.each(function(){"string"==typeof e?V.datepicker["_"+e+"Datepicker"].apply(V.datepicker,[this].concat(t)):V.datepicker._attachDatepicker(this,e)})},V.datepicker=new e,V.datepicker.initialized=!1,V.datepicker.uuid=(new Date).getTime(),V.datepicker.version="1.14.2",V.datepicker});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../version","../widget"],e):e(jQuery)}(function(o){"use strict";var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.14.2",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){var t,s,i;if(!n)return this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),s=1===(this._mouseDownEvent=e).which,i="string"==typeof(t=this).options.cancel&&o(e.target).closest(this.options.cancel).length,s&&!i&&this._mouseCapture(e)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?e.preventDefault():(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0)),!0},_mouseMove:function(e){if(this._mouseMoved&&!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e);return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../disable-selection","../plugin","../version","../widget"],t):t(jQuery)}(function(z){"use strict";return z.widget("ui.resizable",z.ui.mouse,{version:"1.14.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(t,e){var i=!1,s=z(t).css("overflow");if("hidden"===s)return!1;if("scroll"===s)return!0;if(0<t[s=e&&"left"===e?"scrollLeft":"scrollTop"])return!0;try{t[s]=1,i=0<t[s],t[s]=0}catch(t){}return i},_create:function(){var t,e=this.options,i=this;this._addClass("ui-resizable"),z.extend(this,{_aspectRatio:!!e.aspectRatio,aspectRatio:e.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:e.helper||e.ghost||e.animate?e.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(z("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this._proportionallyResize()),this._setupHandles(),e.autoHide&&z(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){z(t).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,h,n=this.options,o=this;if(this.handles=n.handles||(z(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=z(),this._addedHandles=z(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e<i.length;e++)s="ui-resizable-"+(t=String.prototype.trim.call(i[e])),h=z("<div>"),this._addClass(h,"ui-resizable-handle "+s),h.css({zIndex:n.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(h),this._addedHandles=this._addedHandles.add(h));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=z(this.handles[e]),this._on(this.handles[e],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=z(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?s.outerHeight():s.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){o.resizing||(this.className&&(h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=h&&h[1]?h[1]:"se")}),n.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=z(this.handles[e])[0])!==t.target&&!z.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s,h=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),h.containment&&(e+=z(h.containment).scrollLeft()||0,i+=z(h.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this._helper||(s=this._calculateAdjustedElementDimensions(n)),this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:s.width,height:s.height},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:s.width,height:s.height},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof h.aspectRatio?h.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=z(".ui-resizable-"+this.axis).css("cursor"),z("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(i=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),z.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,h=this.options,n=this;return this._helper&&(i=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:n.sizeDiff.height,e=e?0:n.sizeDiff.width,e={width:n.helper.width()-e,height:n.helper.height()-i},i=parseFloat(n.element.css("left"))+(n.position.left-n.originalPosition.left)||null,s=parseFloat(n.element.css("top"))+(n.position.top-n.originalPosition.top)||null,h.animate||this.element.css(z.extend(e,{top:s,left:i})),n.helper.height(n.size.height),n.helper.width(n.size.width),this._helper)&&!h.animate&&this._proportionallyResize(),z("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.helper.css(t),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px",this.helper.width(t.width)),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px",this.helper.height(t.height)),t},_updateVirtualBoundaries:function(t){var e,i,s,h=this.options,h={minWidth:this._isNumber(h.minWidth)?h.minWidth:0,maxWidth:this._isNumber(h.maxWidth)?h.maxWidth:1/0,minHeight:this._isNumber(h.minHeight)?h.minHeight:0,maxHeight:this._isNumber(h.maxHeight)?h.maxHeight:1/0};(this._aspectRatio||t)&&(t=h.minHeight*this.aspectRatio,i=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,s=h.maxWidth/this.aspectRatio,h.minWidth<t&&(h.minWidth=t),h.minHeight<i&&(h.minHeight=i),e<h.maxWidth&&(h.maxWidth=e),s<h.maxHeight)&&(h.maxHeight=s),this._vBoundaries=h},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,h=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,n=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,o=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,a=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,r=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return n&&(t.width=e.minWidth),o&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),h&&(t.height=e.maxHeight),n&&r&&(t.left=a-e.minWidth),s&&r&&(t.left=a-e.maxWidth),o&&i&&(t.top=l-e.minHeight),h&&i&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],h=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(h[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_calculateAdjustedElementDimensions:function(t){var e,i,s=t.get(0);return"content-box"!==t.css("box-sizing")||!this._hasScroll(s)&&!this._hasScroll(s,"left")?{height:parseFloat(t.css("height")),width:parseFloat(t.css("width"))}:(e=parseFloat(s.style.width),s=parseFloat(s.style.height),i=this._getPaddingPlusBorderDimensions(t),e=isNaN(e)?this._getElementTheoreticalSize(t,i,"width"):e,{height:isNaN(s)?this._getElementTheoreticalSize(t,i,"height"):s,width:e})},_getElementTheoreticalSize:function(t,e,i){return Math.max(0,Math.ceil(t.get(0)["offset"+i[0].toUpperCase()+i.slice(1)]-e[i]-.5))||0},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||z("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return z.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return z.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return z.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return z.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){z.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),z.ui.plugin.add("resizable","animate",{stop:function(e){var i=z(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,h=s.length&&/textarea/i.test(s[0].nodeName),n=h&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,h=h?0:i.sizeDiff.width,h={width:i.size.width-h,height:i.size.height-n},n=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(z.extend(h,o&&n?{top:o,left:n}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&z(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),z.ui.plugin.add("resizable","containment",{start:function(){var i,s,t,e,h=z(this).resizable("instance"),n=h.options,o=h.element,n=n.containment,o=n instanceof z?n.get(0):/parent/.test(n)?o.parent().get(0):n;o&&(h.containerElement=z(o),/document/.test(n)||n===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:z(document),left:0,top:0,width:z(document).width(),height:z(document).height()||document.body.parentNode.scrollHeight}):(i=z(o),s=[],z(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=h._num(i.css("padding"+e))}),h.containerOffset=i.offset(),h.containerPosition=i.position(),h.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=h.containerOffset,e=h.containerSize.height,t=h.containerSize.width,t=h._hasScroll(o,"left")?o.scrollWidth:t,e=h._hasScroll(o)?o.scrollHeight:e,h.parentData={element:o,left:n.left,top:n.top,width:t,height:e}))},resize:function(t){var e=z(this).resizable("instance"),i=e.options,s=e.containerOffset,h=e.position,t=e._aspectRatio||t.shiftKey,n={top:0,left:0},o=e.containerElement,a=!0;o[0]!==document&&/static/.test(o.css("position"))&&(n=s),h.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-n.left),t&&(e.size.height=e.size.width/e.aspectRatio,a=!1),e.position.left=i.helper?s.left:0),h.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),t&&(e.size.width=e.size.height*e.aspectRatio,a=!1),e.position.top=e._helper?s.top:0),o=e.containerElement.get(0)===e.element.parent().get(0),i=/relative|absolute/.test(e.containerElement.css("position")),o&&i?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),h=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-n.left:e.offset.left-s.left)),o=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-n.top:e.offset.top-s.top)),h+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-h,t)&&(e.size.height=e.size.width/e.aspectRatio,a=!1),o+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-o,t)&&(e.size.width=e.size.height*e.aspectRatio,a=!1),a||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=z(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,h=t.containerElement,n=z(t.helper),o=n.offset(),a=n.outerWidth()-t.sizeDiff.width,n=n.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(h.css("position"))&&z(this).css({left:o.left-s.left-i.left,width:a,height:n}),t._helper&&!e.animate&&/static/.test(h.css("position"))&&z(this).css({left:o.left-s.left-i.left,width:a,height:n})}}),z.ui.plugin.add("resizable","alsoResize",{start:function(){var i=z(this).resizable("instance"),t=i.options;z(t.alsoResize).each(function(){var t=z(this),e=i._calculateAdjustedElementDimensions(t);t.data("ui-resizable-alsoresize",{width:e.width,height:e.height,left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=z(this).resizable("instance"),s=e.options,h=e.originalSize,n=e.originalPosition,o={height:e.size.height-h.height||0,width:e.size.width-h.width||0,top:e.position.top-n.top||0,left:e.position.left-n.left||0};z(s.alsoResize).each(function(){var t=z(this),s=z(this).data("ui-resizable-alsoresize"),h={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];z.each(e,function(t,e){var i=(s[e]||0)+(o[e]||0);i&&0<=i&&(h[e]=i||null)}),t.css(h)})},stop:function(){z(this).removeData("ui-resizable-alsoresize")}}),z.ui.plugin.add("resizable","ghost",{start:function(){var t=z(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!0===z.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=z(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=z(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),z.ui.plugin.add("resizable","grid",{resize:function(){var t,e=z(this).resizable("instance"),i=e.options,s=e.size,h=e.originalSize,n=e.originalPosition,o=e.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=a[0]||1,r=a[1]||1,p=Math.round((s.width-h.width)/l)*l,s=Math.round((s.height-h.height)/r)*r,d=h.width+p,g=h.height+s,u=i.maxWidth&&i.maxWidth<d,c=i.maxHeight&&i.maxHeight<g,f=i.minWidth&&i.minWidth>d,m=i.minHeight&&i.minHeight>g;i.grid=a,f&&(d+=l),m&&(g+=r),u&&(d-=l),c&&(g-=r),/^(se|s|e)$/.test(o)?(e.size.width=d,e.size.height=g):/^(ne)$/.test(o)?(e.size.width=d,e.size.height=g,e.position.top=n.top-s):/^(sw)$/.test(o)?(e.size.width=d,e.size.height=g,e.position.left=n.left-p):((g-r<=0||d-l<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0<g-r?(e.size.height=g,e.position.top=n.top-s):(g=r-t.height,e.size.height=g,e.position.top=n.top+h.height-g),0<d-l?(e.size.width=d,e.position.left=n.left-p):(d=l-t.width,e.size.width=d,e.position.left=n.left+h.width-d))}}),z.ui.resizable});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../data","../plugin","../scroll-parent","../version","../widget"],t):t(jQuery)}(function(P){"use strict";return P.widget("ui.draggable",P.ui.mouse,{version:"1.14.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<P(t.target).closest(".ui-resizable-handle").length||(this.handle=this._getHandle(t),!this.handle)||(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=P(this);return P("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=this.document[0].activeElement;P(t.target).closest(e).length||P(e).trigger("blur")},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),P.ui.ddmanager&&(P.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===P(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),P.ui.ddmanager&&!e.dropBehaviour&&P.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),P.ui.ddmanager&&P.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new P.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",P.ui.ddmanager&&P.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,s=!1;return P.ui.ddmanager&&!this.options.dropBehaviour&&(s=P.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,s)?P(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),P.ui.ddmanager&&P.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),P.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new P.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!P(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,s="function"==typeof e.helper,t=s?P(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),s&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&P.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){var t,e;return"relative"!==this.cssPosition?{top:0,left:0}:(t=this.element.position(),e=this._isRootNode(this.scrollParent[0]),{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())})},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e=this.options,s=this.document[0];this.relativeContainer=null,e.containment?"window"===e.containment?this.containment=[P(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,P(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,P(window).scrollLeft()+P(window).width()-this.helperProportions.width-this.margins.left,P(window).scrollTop()+(P(window).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:"document"===e.containment?this.containment=[0,0,P(s).width()-this.helperProportions.width-this.margins.left,(P(s).height()||s.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:e.containment.constructor===Array?this.containment=e.containment:("parent"===e.containment&&(e.containment=this.helper[0].parentNode),(e=(s=P(e.containment))[0])&&(t=/(scroll|auto)/.test(s.css("overflow")),this.containment=[(parseInt(s.css("borderLeftWidth"),10)||0)+(parseInt(s.css("paddingLeft"),10)||0),(parseInt(s.css("borderTopWidth"),10)||0)+(parseInt(s.css("paddingTop"),10)||0),(t?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(s.css("borderRightWidth"),10)||0)-(parseInt(s.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(s.css("borderBottomWidth"),10)||0)-(parseInt(s.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=s)):this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var t="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*t+this.offset.parent.top*t-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*t,left:e.left+this.offset.relative.left*t+this.offset.parent.left*t-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*t}},_generatePosition:function(t,e){var s,i=this.options,o=this._isRootNode(this.scrollParent[0]),n=t.pageX,r=t.pageY;return o&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),{top:(r=e&&(this.containment&&(s=this.relativeContainer?(e=this.relativeContainer.offset(),[this.containment[0]+e.left,this.containment[1]+e.top,this.containment[2]+e.left,this.containment[3]+e.top]):this.containment,t.pageX-this.offset.click.left<s[0]&&(n=s[0]+this.offset.click.left),t.pageY-this.offset.click.top<s[1]&&(r=s[1]+this.offset.click.top),t.pageX-this.offset.click.left>s[2]&&(n=s[2]+this.offset.click.left),t.pageY-this.offset.click.top>s[3])&&(r=s[3]+this.offset.click.top),i.grid&&(e=i.grid[1]?this.originalPageY+Math.round((r-this.originalPageY)/i.grid[1])*i.grid[1]:this.originalPageY,r=!s||e-this.offset.click.top>=s[1]||e-this.offset.click.top>s[3]?e:e-this.offset.click.top>=s[1]?e-i.grid[1]:e+i.grid[1],t=i.grid[0]?this.originalPageX+Math.round((n-this.originalPageX)/i.grid[0])*i.grid[0]:this.originalPageX,n=!s||t-this.offset.click.left>=s[0]||t-this.offset.click.left>s[2]?t:t-this.offset.click.left>=s[0]?t-i.grid[0]:t+i.grid[0]),"y"===i.axis&&(n=this.originalPageX),"x"===i.axis)?this.originalPageY:r)-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:o?0:this.offset.scroll.top),left:n-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:o?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,s){return s=s||this._uiHash(),P.ui.plugin.call(this,t,[e,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),P.Widget.prototype._trigger.call(this,t,e,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),P.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,s){var i=P.extend({},t,{item:s.element});s.sortables=[],P(s.options.connectToSortable).each(function(){var t=P(this).sortable("instance");t&&!t.options.disabled&&(s.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,i))})},stop:function(e,t,s){var i=P.extend({},t,{item:s.element});s.cancelHelperRemoval=!1,P.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,i))})},drag:function(s,i,o){P.each(o.sortables,function(){var t=!1,e=this;e.positionAbs=o.positionAbs,e.helperProportions=o.helperProportions,e.offset.click=o.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,P.each(o.sortables,function(){return this.positionAbs=o.positionAbs,this.helperProportions=o.helperProportions,this.offset.click=o.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&P.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,o._parent=i.helper.parent(),e.currentItem=i.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return i.helper[0]},s.target=e.currentItem[0],e._mouseCapture(s,!0),e._mouseStart(s,!0,!0),e.offset.click.top=o.offset.click.top,e.offset.click.left=o.offset.click.left,e.offset.parent.left-=o.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=o.offset.parent.top-e.offset.parent.top,o._trigger("toSortable",s),o.dropped=e.element,P.each(o.sortables,function(){this.refreshPositions()}),o.currentItem=o.element,e.fromOutside=o),e.currentItem&&(e._mouseDrag(s),i.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",s,e._uiHash(e)),e._mouseStop(s,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),i.helper.appendTo(o._parent),o._refreshOffsets(s),i.position=o._generatePosition(s,!0),o._trigger("fromSortable",s),o.dropped=!1,P.each(o.sortables,function(){this.refreshPositions()}))})}}),P.ui.plugin.add("draggable","cursor",{start:function(t,e,s){var i=P("body"),s=s.options;i.css("cursor")&&(s._cursor=i.css("cursor")),i.css("cursor",s.cursor)},stop:function(t,e,s){s=s.options;s._cursor&&P("body").css("cursor",s._cursor)}}),P.ui.plugin.add("draggable","opacity",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("opacity")&&(s._opacity=e.css("opacity")),e.css("opacity",s.opacity)},stop:function(t,e,s){s=s.options;s._opacity&&P(e.helper).css("opacity",s._opacity)}}),P.ui.plugin.add("draggable","scroll",{start:function(t,e,s){s.scrollParentNotHidden||(s.scrollParentNotHidden=s.helper.scrollParent(!1)),s.scrollParentNotHidden[0]!==s.document[0]&&"HTML"!==s.scrollParentNotHidden[0].tagName&&(s.overflowOffset=s.scrollParentNotHidden.offset())},drag:function(t,e,s){var i=s.options,o=!1,n=s.scrollParentNotHidden[0],r=s.document[0];n!==r&&"HTML"!==n.tagName?(i.axis&&"x"===i.axis||(s.overflowOffset.top+n.offsetHeight-t.pageY<i.scrollSensitivity?n.scrollTop=o=n.scrollTop+i.scrollSpeed:t.pageY-s.overflowOffset.top<i.scrollSensitivity&&(n.scrollTop=o=n.scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(s.overflowOffset.left+n.offsetWidth-t.pageX<i.scrollSensitivity?n.scrollLeft=o=n.scrollLeft+i.scrollSpeed:t.pageX-s.overflowOffset.left<i.scrollSensitivity&&(n.scrollLeft=o=n.scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-P(r).scrollTop()<i.scrollSensitivity?o=P(r).scrollTop(P(r).scrollTop()-i.scrollSpeed):P(window).height()-(t.pageY-P(r).scrollTop())<i.scrollSensitivity&&(o=P(r).scrollTop(P(r).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-P(r).scrollLeft()<i.scrollSensitivity?o=P(r).scrollLeft(P(r).scrollLeft()-i.scrollSpeed):P(window).width()-(t.pageX-P(r).scrollLeft())<i.scrollSensitivity&&(o=P(r).scrollLeft(P(r).scrollLeft()+i.scrollSpeed)))),!1!==o&&P.ui.ddmanager&&!i.dropBehaviour&&P.ui.ddmanager.prepareOffsets(s,t)}}),P.ui.plugin.add("draggable","snap",{start:function(t,e,s){var i=s.options;s.snapElements=[],P(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var t=P(this),e=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,s){for(var i,o,n,r,l,a,h,p,c,f=s.options,d=f.snapTolerance,g=e.offset.left,u=g+s.helperProportions.width,m=e.offset.top,v=m+s.helperProportions.height,_=s.snapElements.length-1;0<=_;_--)a=(l=s.snapElements[_].left-s.margins.left)+s.snapElements[_].width,p=(h=s.snapElements[_].top-s.margins.top)+s.snapElements[_].height,u<l-d||a+d<g||v<h-d||p+d<m||!P.contains(s.snapElements[_].item.ownerDocument,s.snapElements[_].item)?(s.snapElements[_].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,P.extend(s._uiHash(),{snapItem:s.snapElements[_].item})),s.snapElements[_].snapping=!1):("inner"!==f.snapMode&&(i=Math.abs(h-v)<=d,o=Math.abs(p-m)<=d,n=Math.abs(l-u)<=d,r=Math.abs(a-g)<=d,i&&(e.position.top=s._convertPositionTo("relative",{top:h-s.helperProportions.height,left:0}).top),o&&(e.position.top=s._convertPositionTo("relative",{top:p,left:0}).top),n&&(e.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r)&&(e.position.left=s._convertPositionTo("relative",{top:0,left:a}).left),c=i||o||n||r,"outer"!==f.snapMode&&(i=Math.abs(h-m)<=d,o=Math.abs(p-v)<=d,n=Math.abs(l-g)<=d,r=Math.abs(a-u)<=d,i&&(e.position.top=s._convertPositionTo("relative",{top:h,left:0}).top),o&&(e.position.top=s._convertPositionTo("relative",{top:p-s.helperProportions.height,left:0}).top),n&&(e.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r)&&(e.position.left=s._convertPositionTo("relative",{top:0,left:a-s.helperProportions.width}).left),!s.snapElements[_].snapping&&(i||o||n||r||c)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,P.extend(s._uiHash(),{snapItem:s.snapElements[_].item})),s.snapElements[_].snapping=i||o||n||r||c)}}),P.ui.plugin.add("draggable","stack",{start:function(t,e,s){var i,s=s.options,s=P.makeArray(P(s.stack)).sort(function(t,e){return(parseInt(P(t).css("zIndex"),10)||0)-(parseInt(P(e).css("zIndex"),10)||0)});s.length&&(i=parseInt(P(s[0]).css("zIndex"),10)||0,P(s).each(function(t){P(this).css("zIndex",i+t)}),this.css("zIndex",i+s.length))}}),P.ui.plugin.add("draggable","zIndex",{start:function(t,e,s){e=P(e.helper),s=s.options;e.css("zIndex")&&(s._zIndex=e.css("zIndex")),e.css("zIndex",s.zIndex)},stop:function(t,e,s){s=s.options;s._zIndex&&P(e.helper).css("zIndex",s._zIndex)}}),P.ui.draggable});
!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery","./button","./draggable","./mouse","./resizable","../focusable","../keycode","../position","../tabbable","../unique-id","../version","../widget"],i):i(jQuery)}(function(l){"use strict";return l.widget("ui.dialog",{version:"1.14.2",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(i){var t=l(this).css(i).offset().top;t<0&&l(this).css("top",i.top-t)}},resizable:!0,show:null,title:null,uiDialogTitleHeadingLevel:0,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&l.fn.draggable&&this._makeDraggable(),this.options.resizable&&l.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var i=this.options.appendTo;return i&&(i.jquery||i.nodeType)?l(i):this.document.find(i||"body").eq(0)},_destroy:function(){var i,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(i=t.parent.children().eq(t.index)).length&&i[0]!==this.element[0]?i.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:l.noop,enable:l.noop,close:function(i){var t=this;this._isOpen&&!1!==this._trigger("beforeClose",i)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||l(this.document[0].activeElement).trigger("blur"),this._hide(this.uiDialog,this.options.hide,function(){t._trigger("close",i)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(i,t){var e=!1,o=this.uiDialog.siblings(".ui-front:visible").map(function(){return+l(this).css("z-index")}).get(),o=Math.max.apply(null,o);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),e=!0),e&&!t&&this._trigger("focus",i),e},open:function(){var i=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=l(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){i._focusTabbable(),i._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var i=this._focusedElement;(i=(i=(i=(i=(i=i||this.element.find("[autofocus]")).length?i:this.element.find(":tabbable")).length?i:this.uiDialogButtonPane.find(":tabbable")).length?i:this.uiDialogTitlebarClose.filter(":tabbable")).length?i:this.uiDialog).eq(0).trigger("focus")},_restoreTabbableFocus:function(){var i=this.document[0].activeElement;this.uiDialog[0]===i||l.contains(this.uiDialog[0],i)||this._focusTabbable()},_keepFocus:function(i){i.preventDefault(),this._restoreTabbableFocus()},_createWrapper:function(){this.uiDialog=l("<div>").hide().attr({tabIndex:-1,role:"dialog","aria-modal":this.options.modal?"true":null}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(i){var t,e,o;this.options.closeOnEscape&&!i.isDefaultPrevented()&&i.keyCode&&i.keyCode===l.ui.keyCode.ESCAPE?(i.preventDefault(),this.close(i)):i.keyCode!==l.ui.keyCode.TAB||i.isDefaultPrevented()||(t=this.uiDialog.find(":tabbable"),e=t.first(),o=t.last(),i.target!==o[0]&&i.target!==this.uiDialog[0]||i.shiftKey?i.target!==e[0]&&i.target!==this.uiDialog[0]||!i.shiftKey||(this._delay(function(){o.trigger("focus")}),i.preventDefault()):(this._delay(function(){e.trigger("focus")}),i.preventDefault()))},mousedown:function(i){this._moveToTop(i)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){this.uiDialogTitlebar=l("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(i){l(i.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=l("<button type='button'></button>").button({label:l("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(i){i.preventDefault(),this.close(i)}});var i=Number.isInteger(this.options.uiDialogTitleHeadingLevel)&&0<this.options.uiDialogTitleHeadingLevel&&this.options.uiDialogTitleHeadingLevel<=6?"h"+this.options.uiDialogTitleHeadingLevel:"span",i=l("<"+i+">").uniqueId().prependTo(this.uiDialogTitlebar);this._addClass(i,"ui-dialog-title"),this._title(i),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":i.attr("id")})},_title:function(i){this.options.title?i.text(this.options.title):i.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=l("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=l("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var o=this,i=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),l.isEmptyObject(i)||Array.isArray(i)&&!i.length?this._removeClass(this.uiDialog,"ui-dialog-buttons"):(l.each(i,function(i,t){var e;t=l.extend({type:"button"},t="function"==typeof t?{click:t,text:i}:t),e=t.click,i={icon:t.icon,iconPosition:t.iconPosition,showLabel:t.showLabel,icons:t.icons,text:t.text},delete t.click,delete t.icon,delete t.iconPosition,delete t.showLabel,delete t.icons,"boolean"==typeof t.text&&delete t.text,l("<button></button>",t).button(i).appendTo(o.uiButtonSet).on("click",function(){e.apply(o.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){var s=this,n=this.options;function a(i){return{position:i.position,offset:i.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(i,t){s._addClass(l(this),"ui-dialog-dragging"),s._blockFrames(),s._trigger("dragStart",i,a(t))},drag:function(i,t){s._trigger("drag",i,a(t))},stop:function(i,t){var e=t.offset.left-s.document.scrollLeft(),o=t.offset.top-s.document.scrollTop();n.position={my:"left top",at:"left"+(0<=e?"+":"")+e+" top"+(0<=o?"+":"")+o,of:s.window},s._removeClass(l(this),"ui-dialog-dragging"),s._unblockFrames(),s._trigger("dragStop",i,a(t))}})},_makeResizable:function(){var s=this,n=this.options,i=n.resizable,t=this.uiDialog.css("position"),i="string"==typeof i?i:"n,e,s,w,se,sw,ne,nw";function a(i){return{originalPosition:i.originalPosition,originalSize:i.originalSize,position:i.position,size:i.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:n.maxWidth,maxHeight:n.maxHeight,minWidth:n.minWidth,minHeight:this._minHeight(),handles:i,start:function(i,t){s._addClass(l(this),"ui-dialog-resizing"),s._blockFrames(),s._trigger("resizeStart",i,a(t))},resize:function(i,t){s._trigger("resize",i,a(t))},stop:function(i,t){var e=s.uiDialog.offset(),o=e.left-s.document.scrollLeft(),e=e.top-s.document.scrollTop();n.height=s.uiDialog.height(),n.width=s.uiDialog.width(),n.position={my:"left top",at:"left"+(0<=o?"+":"")+o+" top"+(0<=e?"+":"")+e,of:s.window},s._removeClass(l(this),"ui-dialog-resizing"),s._unblockFrames(),s._trigger("resizeStop",i,a(t))}}).css("position",t)},_trackFocus:function(){this._on(this.widget(),{focusin:function(i){this._makeFocusTarget(),this._focusedElement=l(i.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var i=this._trackingInstances(),t=l.inArray(this,i);-1!==t&&i.splice(t,1)},_trackingInstances:function(){var i=this.document.data("ui-dialog-instances");return i||this.document.data("ui-dialog-instances",i=[]),i},_minHeight:function(){var i=this.options;return"auto"===i.height?i.minHeight:Math.min(i.minHeight,i.height)},_position:function(){var i=this.uiDialog.is(":visible");i||this.uiDialog.show(),this.uiDialog.position(this.options.position),i||this.uiDialog.hide()},_setOptions:function(i){var e=this,o=!1,s={};l.each(i,function(i,t){e._setOption(i,t),i in e.sizeRelatedOptions&&(o=!0),i in e.resizableRelatedOptions&&(s[i]=t)}),o&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",s)},_setOption:function(i,t){var e,o=this.uiDialog;"disabled"!==i&&(this._super(i,t),"appendTo"===i&&this.uiDialog.appendTo(this._appendTo()),"buttons"===i&&this._createButtons(),"closeText"===i&&this.uiDialogTitlebarClose.button({label:l("<a>").text(""+this.options.closeText).html()}),"draggable"===i&&((e=o.is(":data(ui-draggable)"))&&!t&&o.draggable("destroy"),!e)&&t&&this._makeDraggable(),"position"===i&&this._position(),"resizable"===i&&((e=o.is(":data(ui-resizable)"))&&!t&&o.resizable("destroy"),e&&"string"==typeof t&&o.resizable("option","handles",t),e||!1===t||this._makeResizable()),"title"===i&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")),"modal"===i)&&o.attr("aria-modal",t?"true":null)},_size:function(){var i,t,e,o=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),o.minWidth>o.width&&(o.width=o.minWidth),i=this.uiDialog.css({height:"auto",width:o.width}).outerHeight(),t=Math.max(0,o.minHeight-i),e="number"==typeof o.maxHeight?Math.max(0,o.maxHeight-i):"none","auto"===o.height?this.element.css({minHeight:t,maxHeight:e,height:"auto"}):this.element.height(Math.max(0,o.height-i)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var i=l(this);return l("<div>").css({position:"absolute",width:i.outerWidth(),height:i.outerHeight()}).appendTo(i.parent()).offset(i.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(i){return!!l(i.target).closest(".ui-dialog").length||!!l(i.target).closest(".ui-datepicker").length},_createOverlay:function(){var e;this.options.modal&&(e=!0,this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",function(i){var t;e||(t=this._trackingInstances()[0])._allowInteraction(i)||(i.preventDefault(),t._focusTabbable())}.bind(this)),this.overlay=l("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1))},_destroyOverlay:function(){var i;this.options.modal&&this.overlay&&((i=this.document.data("ui-dialog-overlays")-1)?this.document.data("ui-dialog-overlays",i):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null)}}),!0===l.uiBackCompat&&l.widget("ui.dialog",l.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(i,t){"dialogClass"===i&&this.uiDialog.removeClass(this.options.dialogClass).addClass(t),this._superApply(arguments)}}),l.ui.dialog});
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f)}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown")};c._touchMove=function(f){if(!a){return}this._touchMoved=true;d(f,"mousemove")};c._touchEnd=function(f){if(!a){return}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click")}a=false};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f)}})(jQuery);
var Opentip,firstAdapter,i,mouseMoved,mousePosition,mousePositionObservers,position,vendors,_i,_len,_ref,__slice=[].slice,__indexOf=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1},__hasProp={}.hasOwnProperty;for(Opentip=function(){function t(e,i,o,s){var n,r,a,h,p,d,l,u,c,g,f,m,v,b,w=this;if(this.id=++t.lastId,this.debug("Creating Opentip."),t.tips.push(this),this.adapter=t.adapter,n=this.adapter.data(e,"opentips")||[],n.push(this),this.adapter.data(e,"opentips",n),this.triggerElement=this.adapter.wrap(e),this.triggerElement.length>1)throw Error("You can't call Opentip on multiple elements.");if(1>this.triggerElement.length)throw Error("Invalid element.");this.loaded=!1,this.loading=!1,this.visible=!1,this.waitingToShow=!1,this.waitingToHide=!1,this.currentPosition={left:0,top:0},this.dimensions={width:100,height:50},this.content="",this.redraw=!0,this.currentObservers={showing:!1,visible:!1,hiding:!1,hidden:!1},s=this.adapter.clone(s),typeof i=="object"?(s=i,i=o=void 0):typeof o=="object"&&(s=o,o=void 0),o!=null&&(s.title=o),i!=null&&this.setContent(i),s["extends"]==null&&(s["extends"]=s.style!=null?s.style:t.defaultStyle),h=[s],b=s;while(b["extends"]){if(d=b["extends"],b=t.styles[d],b==null)throw Error("Invalid style: "+d);h.unshift(b),b["extends"]==null&&d!=="standard"&&(b["extends"]="standard")}for(s=(f=this.adapter).extend.apply(f,[{}].concat(__slice.call(h))),s.hideTriggers=function(){var t,e,i,o;for(i=s.hideTriggers,o=[],t=0,e=i.length;e>t;t++)r=i[t],o.push(r);return o}(),s.hideTrigger&&s.hideTriggers.length===0&&s.hideTriggers.push(s.hideTrigger),m=["tipJoint","targetJoint","stem"],l=0,c=m.length;c>l;l++)p=m[l],s[p]&&typeof s[p]=="string"&&(s[p]=new t.Joint(s[p]));for(!s.ajax||s.ajax!==!0&&s.ajax||(s.ajax=this.adapter.tagName(this.triggerElement)==="A"?this.adapter.attr(this.triggerElement,"href"):!1),s.showOn==="click"&&this.adapter.tagName(this.triggerElement)==="A"&&this.adapter.observe(this.triggerElement,"click",function(t){return t.preventDefault(),t.stopPropagation(),t.stopped=!0}),s.target&&(s.fixed=!0),s.stem===!0&&(s.stem=new t.Joint(s.tipJoint)),s.target===!0?s.target=this.triggerElement:s.target&&(s.target=this.adapter.wrap(s.target)),this.currentStem=s.stem,s.delay==null&&(s.delay=s.showOn==="mouseover"?.2:0),s.targetJoint==null&&(s.targetJoint=new t.Joint(s.tipJoint).flip()),this.showTriggers=[],this.showTriggersWhenVisible=[],this.hideTriggers=[],s.showOn&&s.showOn!=="creation"&&this.showTriggers.push({element:this.triggerElement,event:s.showOn}),s.ajaxCache!=null&&(s.cache=s.ajaxCache,delete s.ajaxCache),this.options=s,this.bound={},v=["prepareToShow","prepareToHide","show","hide","reposition"],u=0,g=v.length;g>u;u++)a=v[u],this.bound[a]=function(t){return function(){return w[t].apply(w,arguments)}}(a);this.adapter.domReady(function(){return w.activate(),w.options.showOn==="creation"?w.prepareToShow():void 0})}return t.prototype.STICKS_OUT_TOP=1,t.prototype.STICKS_OUT_BOTTOM=2,t.prototype.STICKS_OUT_LEFT=1,t.prototype.STICKS_OUT_RIGHT=2,t.prototype["class"]={container:"opentip-container",opentip:"opentip",header:"ot-header",content:"ot-content",loadingIndicator:"ot-loading-indicator",close:"ot-close",goingToHide:"ot-going-to-hide",hidden:"ot-hidden",hiding:"ot-hiding",goingToShow:"ot-going-to-show",showing:"ot-showing",visible:"ot-visible",loading:"ot-loading",ajaxError:"ot-ajax-error",fixed:"ot-fixed",showEffectPrefix:"ot-show-effect-",hideEffectPrefix:"ot-hide-effect-",stylePrefix:"style-"},t.prototype._setup=function(){var t,e,i,o,s,n,r,a,h,p,d;for(this.debug("Setting up the tooltip."),this._buildContainer(),this.hideTriggers=[],h=this.options.hideTriggers,o=s=0,r=h.length;r>s;o=++s){if(e=h[o],i=null,t=this.options.hideOn instanceof Array?this.options.hideOn[o]:this.options.hideOn,typeof e=="string")switch(e){case"trigger":t=t||"mouseout",i=this.triggerElement;break;case"tip":t=t||"mouseover",i=this.container;break;case"target":t=t||"mouseover",i=this.options.target;break;case"closeButton":break;default:throw Error("Unknown hide trigger: "+e+".")}else t=t||"mouseover",i=this.adapter.wrap(e);i&&this.hideTriggers.push({element:i,event:t,original:e})}for(p=this.hideTriggers,d=[],n=0,a=p.length;a>n;n++)e=p[n],d.push(this.showTriggersWhenVisible.push({element:e.element,event:"mouseover"}));return d},t.prototype._buildContainer=function(){return this.container=this.adapter.create('<div id="opentip-'+this.id+'" class="'+this["class"].container+" "+this["class"].hidden+" "+this["class"].stylePrefix+this.options.className+'"></div>'),this.adapter.css(this.container,{position:"absolute"}),this.options.ajax&&this.adapter.addClass(this.container,this["class"].loading),this.options.fixed&&this.adapter.addClass(this.container,this["class"].fixed),this.options.showEffect&&this.adapter.addClass(this.container,""+this["class"].showEffectPrefix+this.options.showEffect),this.options.hideEffect?this.adapter.addClass(this.container,""+this["class"].hideEffectPrefix+this.options.hideEffect):void 0},t.prototype._buildElements=function(){var t,e;return this.tooltipElement=this.adapter.create('<div class="'+this["class"].opentip+'"><div class="'+this["class"].header+'"></div><div class="'+this["class"].content+'"></div></div>'),this.backgroundCanvas=this.adapter.wrap(document.createElement("canvas")),this.adapter.css(this.backgroundCanvas,{position:"absolute"}),typeof G_vmlCanvasManager!="undefined"&&G_vmlCanvasManager!==null&&G_vmlCanvasManager.initElement(this.adapter.unwrap(this.backgroundCanvas)),t=this.adapter.find(this.tooltipElement,"."+this["class"].header),this.options.title&&(e=this.adapter.create("<h1></h1>"),this.adapter.update(e,this.options.title,this.options.escapeTitle),this.adapter.append(t,e)),this.options.ajax&&!this.loaded&&this.adapter.append(this.tooltipElement,this.adapter.create('<div class="'+this["class"].loadingIndicator+'"><span>↻</span></div>')),__indexOf.call(this.options.hideTriggers,"closeButton")>=0&&(this.closeButtonElement=this.adapter.create('<a href="javascript:undefined;" class="'+this["class"].close+'"><span>Close</span></a>'),this.adapter.append(t,this.closeButtonElement)),this.adapter.append(this.container,this.backgroundCanvas),this.adapter.append(this.container,this.tooltipElement),this.adapter.append(document.body,this.container),this._newContent=!0,this.redraw=!0},t.prototype.setContent=function(t){return this.content=t,this._newContent=!0,typeof this.content=="function"?(this._contentFunction=this.content,this.content=""):this._contentFunction=null,this.visible?this._updateElementContent():void 0},t.prototype._updateElementContent=function(){var t;return(this._newContent||!this.options.cache&&this._contentFunction)&&(t=this.adapter.find(this.container,"."+this["class"].content),t!=null&&(this._contentFunction&&(this.debug("Executing content function."),this.content=this._contentFunction(this)),this.adapter.update(t,this.content,this.options.escapeContent)),this._newContent=!1),this._storeAndLockDimensions(),this.reposition()},t.prototype._storeAndLockDimensions=function(){var t;if(this.container)return t=this.dimensions,this.adapter.css(this.container,{width:"auto",left:"0px",top:"0px"}),this.dimensions=this.adapter.dimensions(this.container),this.dimensions.width+=1,this.adapter.css(this.container,{width:""+this.dimensions.width+"px",top:""+this.currentPosition.top+"px",left:""+this.currentPosition.left+"px"}),this._dimensionsEqual(this.dimensions,t)?void 0:(this.redraw=!0,this._draw())},t.prototype.activate=function(){return this._setupObservers("hidden","hiding")},t.prototype.deactivate=function(){return this.debug("Deactivating tooltip."),this.hide(),this._setupObservers("-showing","-visible","-hidden","-hiding")},t.prototype._setupObservers=function(){var t,e,i,o,s,n,r,a,h,p,d,l,u,c,g,f,m=this;for(o=arguments.length>=1?__slice.call(arguments,0):[],n=0,p=o.length;p>n;n++)if(i=o[n],e=!1,i.charAt(0)==="-"&&(e=!0,i=i.substr(1)),this.currentObservers[i]!==!e)switch(this.currentObservers[i]=!e,t=function(){var t,i,o;return t=arguments.length>=1?__slice.call(arguments,0):[],e?(i=m.adapter).stopObserving.apply(i,t):(o=m.adapter).observe.apply(o,t)},i){case"showing":for(c=this.hideTriggers,r=0,d=c.length;d>r;r++)s=c[r],t(s.element,s.event,this.bound.prepareToHide);t(document.onresize!=null?document:window,"resize",this.bound.reposition),t(window,"scroll",this.bound.reposition);break;case"visible":for(g=this.showTriggersWhenVisible,a=0,l=g.length;l>a;a++)s=g[a],t(s.element,s.event,this.bound.prepareToShow);break;case"hiding":for(f=this.showTriggers,h=0,u=f.length;u>h;h++)s=f[h],t(s.element,s.event,this.bound.prepareToShow);break;case"hidden":break;default:throw Error("Unknown state: "+i)}return null},t.prototype.prepareToShow=function(){return this._abortHiding(),this._abortShowing(),this.visible?void 0:(this.debug("Showing in "+this.options.delay+"s."),this.container==null&&this._setup(),this.options.group&&t._abortShowingGroup(this.options.group,this),this.preparingToShow=!0,this._setupObservers("-hidden","-hiding","showing"),this._followMousePosition(),this.options.fixed&&!this.options.target&&(this.initialMousePosition=mousePosition),this.reposition(),this._showTimeoutId=this.setTimeout(this.bound.show,this.options.delay||0))},t.prototype.show=function(){var e=this;return this._abortHiding(),this.visible?void 0:(this._clearTimeouts(),this._triggerElementExists()?(this.debug("Showing now."),this.container==null&&this._setup(),this.options.group&&t._hideGroup(this.options.group,this),this.visible=!0,this.preparingToShow=!1,this.tooltipElement==null&&this._buildElements(),this._updateElementContent(),!this.options.ajax||this.loaded&&this.options.cache||this._loadAjax(),this._searchAndActivateCloseButtons(),this._startEnsureTriggerElement(),this.adapter.css(this.container,{zIndex:t.lastZIndex++}),this._setupObservers("-hidden","-hiding","-showing","-visible","showing","visible"),this.options.fixed&&!this.options.target&&(this.initialMousePosition=mousePosition),this.reposition(),this.adapter.removeClass(this.container,this["class"].hiding),this.adapter.removeClass(this.container,this["class"].hidden),this.adapter.addClass(this.container,this["class"].goingToShow),this.setCss3Style(this.container,{transitionDuration:"0s"}),this.defer(function(){var t;if(e.visible&&!e.preparingToHide)return e.adapter.removeClass(e.container,e["class"].goingToShow),e.adapter.addClass(e.container,e["class"].showing),t=0,e.options.showEffect&&e.options.showEffectDuration&&(t=e.options.showEffectDuration),e.setCss3Style(e.container,{transitionDuration:""+t+"s"}),e._visibilityStateTimeoutId=e.setTimeout(function(){return e.adapter.removeClass(e.container,e["class"].showing),e.adapter.addClass(e.container,e["class"].visible)},t),e._activateFirstInput()}),this._draw()):this.deactivate())},t.prototype._abortShowing=function(){return this.preparingToShow?(this.debug("Aborting showing."),this._clearTimeouts(),this._stopFollowingMousePosition(),this.preparingToShow=!1,this._setupObservers("-showing","-visible","hiding","hidden")):void 0},t.prototype.prepareToHide=function(){return this._abortShowing(),this._abortHiding(),this.visible?(this.debug("Hiding in "+this.options.hideDelay+"s"),this.preparingToHide=!0,this._setupObservers("-showing","visible","-hidden","hiding"),this._hideTimeoutId=this.setTimeout(this.bound.hide,this.options.hideDelay)):void 0},t.prototype.hide=function(){var t=this;return this._abortShowing(),this.visible&&(this._clearTimeouts(),this.debug("Hiding!"),this.visible=!1,this.preparingToHide=!1,this._stopEnsureTriggerElement(),this._setupObservers("-showing","-visible","-hiding","-hidden","hiding","hidden"),this.options.fixed||this._stopFollowingMousePosition(),this.container)?(this.adapter.removeClass(this.container,this["class"].visible),this.adapter.removeClass(this.container,this["class"].showing),this.adapter.addClass(this.container,this["class"].goingToHide),this.setCss3Style(this.container,{transitionDuration:"0s"}),this.defer(function(){var e;return t.adapter.removeClass(t.container,t["class"].goingToHide),t.adapter.addClass(t.container,t["class"].hiding),e=0,t.options.hideEffect&&t.options.hideEffectDuration&&(e=t.options.hideEffectDuration),t.setCss3Style(t.container,{transitionDuration:""+e+"s"}),t._visibilityStateTimeoutId=t.setTimeout(function(){return t.adapter.removeClass(t.container,t["class"].hiding),t.adapter.addClass(t.container,t["class"].hidden),t.setCss3Style(t.container,{transitionDuration:"0s"}),t.options.removeElementsOnHide?(t.debug("Removing HTML elements."),t.adapter.remove(t.container),delete t.container,delete t.tooltipElement):void 0},e)})):void 0},t.prototype._abortHiding=function(){return this.preparingToHide?(this.debug("Aborting hiding."),this._clearTimeouts(),this.preparingToHide=!1,this._setupObservers("-hiding","showing","visible")):void 0},t.prototype.reposition=function(){var t,e,i,o=this;return t=this.getPosition(),t==null||(e=this.options.stem,this.options.containInViewport&&(i=this._ensureViewportContainment(t),t=i.position,e=i.stem),this._positionsEqual(t,this.currentPosition))?void 0:(this.options.stem&&!e.eql(this.currentStem)&&(this.redraw=!0),this.currentPosition=t,this.currentStem=e,this._draw(),this.adapter.css(this.container,{left:""+t.left+"px",top:""+t.top+"px"}),this.defer(function(){var t,e;return t=o.adapter.unwrap(o.container),t.style.visibility="hidden",e=t.offsetHeight,t.style.visibility="visible"}))},t.prototype.getPosition=function(t,e,i){var o,s,n,r,a,h,p,d,l;if(this.container)return t==null&&(t=this.options.tipJoint),e==null&&(e=this.options.targetJoint),r={},this.options.target?(p=this.adapter.offset(this.options.target),h=this.adapter.dimensions(this.options.target),r=p,e.right?(d=this.adapter.unwrap(this.options.target),d.getBoundingClientRect!=null?r.left=d.getBoundingClientRect().right+((l=window.pageXOffset)!=null?l:document.body.scrollLeft):r.left+=h.width):e.center&&(r.left+=Math.round(h.width/2)),e.bottom?r.top+=h.height:e.middle&&(r.top+=Math.round(h.height/2)),this.options.borderWidth&&(this.options.tipJoint.left&&(r.left+=this.options.borderWidth),this.options.tipJoint.right&&(r.left-=this.options.borderWidth),this.options.tipJoint.top?r.top+=this.options.borderWidth:this.options.tipJoint.bottom&&(r.top-=this.options.borderWidth))):r=this.initialMousePosition?{top:this.initialMousePosition.y,left:this.initialMousePosition.x}:{top:mousePosition.y,left:mousePosition.x},this.options.autoOffset&&(a=this.options.stem?this.options.stemLength:0,n=a&&this.options.fixed?2:10,o=t.middle&&!this.options.fixed?15:0,s=t.center&&!this.options.fixed?15:0,t.right?r.left-=n+o:t.left&&(r.left+=n+o),t.bottom?r.top-=n+s:t.top&&(r.top+=n+s),a&&(i==null&&(i=this.options.stem),i.right?r.left-=a:i.left&&(r.left+=a),i.bottom?r.top-=a:i.top&&(r.top+=a))),r.left+=this.options.offset[0],r.top+=this.options.offset[1],t.right?r.left-=this.dimensions.width:t.center&&(r.left-=Math.round(this.dimensions.width/2)),t.bottom?r.top-=this.dimensions.height:t.middle&&(r.top-=Math.round(this.dimensions.height/2)),r},t.prototype._ensureViewportContainment=function(e){var i,o,s,n,r,a,h,p,d,l,u,c;if(h=this.options.stem,s={position:e,stem:h},!this.visible||!e)return s;if(p=this._sticksOut(e),!p[0]&&!p[1])return s;if(l=new t.Joint(this.options.tipJoint),this.options.targetJoint&&(d=new t.Joint(this.options.targetJoint)),a=this.adapter.scrollOffset(),u=this.adapter.viewportDimensions(),c=[e.left-a[0],e.top-a[1]],i=!1,u.width>=this.dimensions.width&&p[0])switch(i=!0,p[0]){case this.STICKS_OUT_LEFT:l.setHorizontal("left"),this.options.targetJoint&&d.setHorizontal("right");break;case this.STICKS_OUT_RIGHT:l.setHorizontal("right"),this.options.targetJoint&&d.setHorizontal("left")}if(u.height>=this.dimensions.height&&p[1])switch(i=!0,p[1]){case this.STICKS_OUT_TOP:l.setVertical("top"),this.options.targetJoint&&d.setVertical("bottom");break;case this.STICKS_OUT_BOTTOM:l.setVertical("bottom"),this.options.targetJoint&&d.setVertical("top")}return i?(this.options.stem&&(h=l),e=this.getPosition(l,d,h),o=this._sticksOut(e),n=!1,r=!1,o[0]&&o[0]!==p[0]&&(n=!0,l.setHorizontal(this.options.tipJoint.horizontal),this.options.targetJoint&&d.setHorizontal(this.options.targetJoint.horizontal)),o[1]&&o[1]!==p[1]&&(r=!0,l.setVertical(this.options.tipJoint.vertical),this.options.targetJoint&&d.setVertical(this.options.targetJoint.vertical)),n&&r?s:((n||r)&&(this.options.stem&&(h=l),e=this.getPosition(l,d,h)),{position:e,stem:h})):s},t.prototype._sticksOut=function(t){var e,i,o,s;return i=this.adapter.scrollOffset(),s=this.adapter.viewportDimensions(),e=[t.left-i[0],t.top-i[1]],o=[!1,!1],0>e[0]?o[0]=this.STICKS_OUT_LEFT:e[0]+this.dimensions.width>s.width&&(o[0]=this.STICKS_OUT_RIGHT),0>e[1]?o[1]=this.STICKS_OUT_TOP:e[1]+this.dimensions.height>s.height&&(o[1]=this.STICKS_OUT_BOTTOM),o},t.prototype._draw=function(){var e,i,o,s,n,r,a,h,p,d,l,u,c,g,f,m,v,b,w,_=this;if(this.backgroundCanvas&&this.redraw){if(this.debug("Drawing background."),this.redraw=!1,this.currentStem){for(v=["top","right","bottom","left"],f=0,m=v.length;m>f;f++)u=v[f],this.adapter.removeClass(this.container,"stem-"+u);this.adapter.addClass(this.container,"stem-"+this.currentStem.horizontal),this.adapter.addClass(this.container,"stem-"+this.currentStem.vertical)}return r=[0,0],a=[0,0],__indexOf.call(this.options.hideTriggers,"closeButton")>=0&&(n=new t.Joint(((b=this.currentStem)!=null?b+"":void 0)==="top right"?"top left":"top right"),r=[this.options.closeButtonRadius+this.options.closeButtonOffset[0],this.options.closeButtonRadius+this.options.closeButtonOffset[1]],a=[this.options.closeButtonRadius-this.options.closeButtonOffset[0],this.options.closeButtonRadius-this.options.closeButtonOffset[1]]),o=this.adapter.clone(this.dimensions),s=[0,0],this.options.borderWidth&&(o.width+=this.options.borderWidth*2,o.height+=this.options.borderWidth*2,s[0]-=this.options.borderWidth,s[1]-=this.options.borderWidth),this.options.shadow&&(o.width+=this.options.shadowBlur*2,o.width+=Math.max(0,this.options.shadowOffset[0]-this.options.shadowBlur*2),o.height+=this.options.shadowBlur*2,o.height+=Math.max(0,this.options.shadowOffset[1]-this.options.shadowBlur*2),s[0]-=Math.max(0,this.options.shadowBlur-this.options.shadowOffset[0]),s[1]-=Math.max(0,this.options.shadowBlur-this.options.shadowOffset[1])),i={left:0,right:0,top:0,bottom:0},this.currentStem&&(this.currentStem.left?i.left=this.options.stemLength:this.currentStem.right&&(i.right=this.options.stemLength),this.currentStem.top?i.top=this.options.stemLength:this.currentStem.bottom&&(i.bottom=this.options.stemLength)),n&&(n.left?i.left=Math.max(i.left,a[0]):n.right&&(i.right=Math.max(i.right,a[0])),n.top?i.top=Math.max(i.top,a[1]):n.bottom&&(i.bottom=Math.max(i.bottom,a[1]))),o.width+=i.left+i.right,o.height+=i.top+i.bottom,s[0]-=i.left,s[1]-=i.top,this.currentStem&&this.options.borderWidth&&(w=this._getPathStemMeasures(this.options.stemBase,this.options.stemLength,this.options.borderWidth),g=w.stemLength,c=w.stemBase),e=this.adapter.unwrap(this.backgroundCanvas),e.width=o.width,e.height=o.height,this.adapter.css(this.backgroundCanvas,{width:""+e.width+"px",height:""+e.height+"px",left:""+s[0]+"px",top:""+s[1]+"px"}),h=e.getContext("2d"),h.setTransform(1,0,0,1,0,0),h.clearRect(0,0,e.width,e.height),h.beginPath(),h.fillStyle=this._getColor(h,this.dimensions,this.options.background,this.options.backgroundGradientHorizontal),h.lineJoin="miter",h.miterLimit=500,l=this.options.borderWidth/2,this.options.borderWidth?(h.strokeStyle=this.options.borderColor,h.lineWidth=this.options.borderWidth):(g=this.options.stemLength,c=this.options.stemBase),c==null&&(c=0),d=function(t,e,i){return i&&h.moveTo(Math.max(c,_.options.borderRadius,r[0])+1-l,-l),e?(h.lineTo(t/2-c/2,-l),h.lineTo(t/2,-g-l),h.lineTo(t/2+c/2,-l)):void 0},p=function(t,e,i){var o,s,n,a;return t?(h.lineTo(-c+l,0-l),h.lineTo(g+l,-g-l),h.lineTo(l,c-l)):e?(a=_.options.closeButtonOffset,n=r[0],i%2!==0&&(a=[a[1],a[0]],n=r[1]),o=Math.acos(a[1]/_.options.closeButtonRadius),s=Math.acos(a[0]/_.options.closeButtonRadius),h.lineTo(-n+l,-l),h.arc(l-a[0],-l+a[1],_.options.closeButtonRadius,-(Math.PI/2+o),s,!1)):(h.lineTo(-_.options.borderRadius+l,-l),h.quadraticCurveTo(l,-l,l,_.options.borderRadius-l))},h.translate(-s[0],-s[1]),h.save(),function(){var e,i,o,s,r,a,l,u,c,g,f;for(f=[],i=c=0,g=t.positions.length/2;g>=0?g>c:c>g;i=g>=0?++c:--c)r=i*2,a=i===0||i===3?0:_.dimensions.width,l=2>i?0:_.dimensions.height,u=Math.PI/2*i,o=i%2===0?_.dimensions.width:_.dimensions.height,s=new t.Joint(t.positions[r]),e=new t.Joint(t.positions[r+1]),h.save(),h.translate(a,l),h.rotate(u),d(o,s.eql(_.currentStem),i===0),h.translate(o,0),p(e.eql(_.currentStem),e.eql(n),i),f.push(h.restore());return f}(),h.closePath(),h.save(),this.options.shadow&&(h.shadowColor=this.options.shadowColor,h.shadowBlur=this.options.shadowBlur,h.shadowOffsetX=this.options.shadowOffset[0],h.shadowOffsetY=this.options.shadowOffset[1]),h.fill(),h.restore(),this.options.borderWidth&&h.stroke(),h.restore(),n?function(){var t,e,i,o,s;return i=e=_.options.closeButtonRadius*2,n+""=="top right"?(s=[_.dimensions.width-_.options.closeButtonOffset[0],_.options.closeButtonOffset[1]],t=[s[0]+l,s[1]-l]):(s=[_.options.closeButtonOffset[0],_.options.closeButtonOffset[1]],t=[s[0]-l,s[1]-l]),h.translate(t[0],t[1]),o=_.options.closeButtonCrossSize/2,h.save(),h.beginPath(),h.strokeStyle=_.options.closeButtonCrossColor,h.lineWidth=_.options.closeButtonCrossLineWidth,h.lineCap="round",h.moveTo(-o,-o),h.lineTo(o,o),h.stroke(),h.beginPath(),h.moveTo(o,-o),h.lineTo(-o,o),h.stroke(),h.restore(),_.adapter.css(_.closeButtonElement,{left:""+(s[0]-o-_.options.closeButtonLinkOverscan)+"px",top:""+(s[1]-o-_.options.closeButtonLinkOverscan)+"px",width:""+(_.options.closeButtonCrossSize+_.options.closeButtonLinkOverscan*2)+"px",height:""+(_.options.closeButtonCrossSize+_.options.closeButtonLinkOverscan*2)+"px"})}():void 0}},t.prototype._getPathStemMeasures=function(t,e,i){var o,s,n,r,a,h,p;if(r=i/2,n=Math.atan(t/2/e),o=n*2,a=r/Math.sin(o),s=2*a*Math.cos(n),p=r+e-s,0>p)throw Error("Sorry but your stemLength / stemBase ratio is strange.");return h=Math.tan(n)*p*2,{stemLength:p,stemBase:h}},t.prototype._getColor=function(t,e,i,o){var s,n,r,a,h;if(o==null&&(o=!1),typeof i=="string")return i;for(n=o?t.createLinearGradient(0,0,e.width,0):t.createLinearGradient(0,0,0,e.height),r=a=0,h=i.length;h>a;r=++a)s=i[r],n.addColorStop(s[0],s[1]);return n},t.prototype._searchAndActivateCloseButtons=function(){var t,e,i,o;for(o=this.adapter.findAll(this.container,"."+this["class"].close),e=0,i=o.length;i>e;e++)t=o[e],this.hideTriggers.push({element:this.adapter.wrap(t),event:"click"});return this.currentObservers.showing&&this._setupObservers("-showing","showing"),this.currentObservers.visible?this._setupObservers("-visible","visible"):void 0},t.prototype._activateFirstInput=function(){var t;return t=this.adapter.unwrap(this.adapter.find(this.container,"input, textarea")),t!=null?typeof t.focus=="function"?t.focus():void 0:void 0},t.prototype._followMousePosition=function(){return this.options.fixed?void 0:t._observeMousePosition(this.bound.reposition)},t.prototype._stopFollowingMousePosition=function(){return this.options.fixed?void 0:t._stopObservingMousePosition(this.bound.reposition)},t.prototype._clearShowTimeout=function(){return clearTimeout(this._showTimeoutId)},t.prototype._clearHideTimeout=function(){return clearTimeout(this._hideTimeoutId)},t.prototype._clearTimeouts=function(){return clearTimeout(this._visibilityStateTimeoutId),this._clearShowTimeout(),this._clearHideTimeout()},t.prototype._triggerElementExists=function(){var t;t=this.adapter.unwrap(this.triggerElement);while(t.parentNode){if(t.parentNode.tagName==="BODY")return!0;t=t.parentNode}return!1},t.prototype._loadAjax=function(){var t=this;if(!this.loading)return this.loaded=!1,this.loading=!0,this.adapter.addClass(this.container,this["class"].loading),this.setContent(""),this.debug("Loading content from "+this.options.ajax),this.adapter.ajax({url:this.options.ajax,method:this.options.ajaxMethod,onSuccess:function(e){return t.debug("Loading successful."),t.adapter.removeClass(t.container,t["class"].loading),t.setContent(e)},onError:function(e){var i;return i=t.options.ajaxErrorMessage,t.debug(i,e),t.setContent(i),t.adapter.addClass(t.container,t["class"].ajaxError)},onComplete:function(){return t.adapter.removeClass(t.container,t["class"].loading),t.loading=!1,t.loaded=!0,t._searchAndActivateCloseButtons(),t._activateFirstInput(),t.reposition()}})},t.prototype._ensureTriggerElement=function(){return this._triggerElementExists()?void 0:(this.deactivate(),this._stopEnsureTriggerElement())},t.prototype._ensureTriggerElementInterval=1e3,t.prototype._startEnsureTriggerElement=function(){var t=this;return this._ensureTriggerElementTimeoutId=setInterval(function(){return t._ensureTriggerElement()},this._ensureTriggerElementInterval)},t.prototype._stopEnsureTriggerElement=function(){return clearInterval(this._ensureTriggerElementTimeoutId)},t}(),vendors=["khtml","ms","o","moz","webkit"],Opentip.prototype.setCss3Style=function(t,e){var i,o,s,n,r;t=this.adapter.unwrap(t),r=[];for(i in e)__hasProp.call(e,i)&&(o=e[i],t.style[i]!=null?r.push(t.style[i]=o):r.push(function(){var e,r,a;for(a=[],e=0,r=vendors.length;r>e;e++)s=vendors[e],n=""+this.ucfirst(s)+this.ucfirst(i),t.style[n]!=null?a.push(t.style[n]=o):a.push(void 0);return a}.call(this)));return r},Opentip.prototype.defer=function(t){return setTimeout(t,0)},Opentip.prototype.setTimeout=function(t,e){return setTimeout(t,e?e*1e3:0)},Opentip.prototype.ucfirst=function(t){return t==null?"":t.charAt(0).toUpperCase()+t.slice(1)},Opentip.prototype.dasherize=function(t){return t.replace(/([A-Z])/g,function(t,e){return"-"+e.toLowerCase()})},mousePositionObservers=[],mousePosition={x:0,y:0},mouseMoved=function(t){var e,i,o,s;for(mousePosition=Opentip.adapter.mousePosition(t),s=[],i=0,o=mousePositionObservers.length;o>i;i++)e=mousePositionObservers[i],s.push(e());return s},Opentip.followMousePosition=function(){return Opentip.adapter.observe(document.body,"mousemove",mouseMoved)},Opentip._observeMousePosition=function(t){return mousePositionObservers.push(t)},Opentip._stopObservingMousePosition=function(t){var e;return mousePositionObservers=function(){var i,o,s;for(s=[],i=0,o=mousePositionObservers.length;o>i;i++)e=mousePositionObservers[i],e!==t&&s.push(e);return s}()},Opentip.Joint=function(){function t(t){t!=null&&(t instanceof Opentip.Joint&&(t+=""),this.set(t))}return t.prototype.set=function(t){return t=t.toLowerCase(),this.setHorizontal(t),this.setVertical(t),this},t.prototype.setHorizontal=function(t){var e,i,o,s,n,r,a;for(i=["left","center","right"],o=0,n=i.length;n>o;o++)e=i[o],~t.indexOf(e)&&(this.horizontal=e.toLowerCase());for(this.horizontal==null&&(this.horizontal="center"),a=[],s=0,r=i.length;r>s;s++)e=i[s],a.push(this[e]=this.horizontal===e?e:void 0);return a},t.prototype.setVertical=function(t){var e,i,o,s,n,r,a;for(i=["top","middle","bottom"],o=0,n=i.length;n>o;o++)e=i[o],~t.indexOf(e)&&(this.vertical=e.toLowerCase());for(this.vertical==null&&(this.vertical="middle"),a=[],s=0,r=i.length;r>s;s++)e=i[s],a.push(this[e]=this.vertical===e?e:void 0);return a},t.prototype.eql=function(t){return t!=null&&this.horizontal===t.horizontal&&this.vertical===t.vertical},t.prototype.flip=function(){var t,e;return e=Opentip.position[this.toString(!0)],t=(e+4)%8,this.set(Opentip.positions[t]),this},t.prototype.toString=function(t){var e,i;return t==null&&(t=!1),i=this.vertical==="middle"?"":this.vertical,e=this.horizontal==="center"?"":this.horizontal,i&&e&&(e=t?Opentip.prototype.ucfirst(e):" "+e),""+i+e},t}(),Opentip.prototype._positionsEqual=function(t,e){return t!=null&&e!=null&&t.left===e.left&&t.top===e.top},Opentip.prototype._dimensionsEqual=function(t,e){return t!=null&&e!=null&&t.width===e.width&&t.height===e.height},Opentip.prototype.debug=function(){var t;return t=arguments.length>=1?__slice.call(arguments,0):[],Opentip.debug&&(typeof console!="undefined"&&console!==null?console.debug:void 0)!=null?(t.unshift("#"+this.id+" |"),console.debug.apply(console,t)):void 0},Opentip.findElements=function(){var t,e,i,o,s,n,r,a,h,p;for(t=Opentip.adapter,h=t.findAll(document.body,"[data-ot]"),p=[],r=0,a=h.length;a>r;r++){i=h[r],n={},e=t.data(i,"ot"),(e===""||e==="true"||e==="yes")&&(e=t.attr(i,"title"),t.attr(i,"title","")),e=e||"";for(o in Opentip.styles.standard)s=t.data(i,"ot"+Opentip.prototype.ucfirst(o)),s!=null&&(s==="yes"||s==="true"||s==="on"?s=!0:(s==="no"||s==="false"||s==="off")&&(s=!1),n[o]=s);p.push(new Opentip(i,e,n))}return p},Opentip.version="2.4.6",Opentip.debug=!1,Opentip.lastId=0,Opentip.lastZIndex=100,Opentip.tips=[],Opentip._abortShowingGroup=function(t,e){var i,o,s,n,r;for(n=Opentip.tips,r=[],o=0,s=n.length;s>o;o++)i=n[o],i!==e&&i.options.group===t?r.push(i._abortShowing()):r.push(void 0);return r},Opentip._hideGroup=function(t,e){var i,o,s,n,r;for(n=Opentip.tips,r=[],o=0,s=n.length;s>o;o++)i=n[o],i!==e&&i.options.group===t?r.push(i.hide()):r.push(void 0);return r},Opentip.adapters={},Opentip.adapter=null,firstAdapter=!0,Opentip.addAdapter=function(t){return Opentip.adapters[t.name]=t,firstAdapter?(Opentip.adapter=t,t.domReady(Opentip.findElements),t.domReady(Opentip.followMousePosition),firstAdapter=!1):void 0},Opentip.positions=["top","topRight","right","bottomRight","bottom","bottomLeft","left","topLeft"],Opentip.position={},_ref=Opentip.positions,i=_i=0,_len=_ref.length;_len>_i;i=++_i)position=_ref[i],Opentip.position[position]=i;Opentip.styles={standard:{"extends":null,title:void 0,escapeTitle:!0,escapeContent:!1,className:"standard",stem:!0,delay:null,hideDelay:.1,fixed:!1,showOn:"mouseover",hideTrigger:"trigger",hideTriggers:[],hideOn:null,removeElementsOnHide:!1,offset:[0,0],containInViewport:!0,autoOffset:!0,showEffect:"appear",hideEffect:"fade",showEffectDuration:.3,hideEffectDuration:.2,stemLength:5,stemBase:8,tipJoint:"top left",target:null,targetJoint:null,cache:!0,ajax:!1,ajaxMethod:"GET",ajaxErrorMessage:"There was a problem downloading the content.",group:null,style:null,background:"#fff18f",backgroundGradientHorizontal:!1,closeButtonOffset:[5,5],closeButtonRadius:7,closeButtonCrossSize:4,closeButtonCrossColor:"#d2c35b",closeButtonCrossLineWidth:1.5,closeButtonLinkOverscan:6,borderRadius:5,borderWidth:1,borderColor:"#f2e37b",shadow:!0,shadowBlur:10,shadowOffset:[3,3],shadowColor:"rgba(0, 0, 0, 0.1)"},glass:{"extends":"standard",className:"glass",background:[[0,"rgba(252, 252, 252, 0.8)"],[.5,"rgba(255, 255, 255, 0.8)"],[.5,"rgba(250, 250, 250, 0.9)"],[1,"rgba(245, 245, 245, 0.9)"]],borderColor:"#eee",closeButtonCrossColor:"rgba(0, 0, 0, 0.2)",borderRadius:15,closeButtonRadius:10,closeButtonOffset:[8,8]},dark:{"extends":"standard",className:"dark",borderRadius:13,borderColor:"#444",closeButtonCrossColor:"rgba(240, 240, 240, 1)",shadowColor:"rgba(0, 0, 0, 0.3)",shadowOffset:[2,2],background:[[0,"rgba(30, 30, 30, 0.7)"],[.5,"rgba(30, 30, 30, 0.8)"],[.5,"rgba(10, 10, 10, 0.8)"],[1,"rgba(10, 10, 10, 0.9)"]]},alert:{"extends":"standard",className:"alert",borderRadius:1,borderColor:"#AE0D11",closeButtonCrossColor:"rgba(255, 255, 255, 1)",shadowColor:"rgba(0, 0, 0, 0.3)",shadowOffset:[2,2],background:[[0,"rgba(203, 15, 19, 0.7)"],[.5,"rgba(203, 15, 19, 0.8)"],[.5,"rgba(189, 14, 18, 0.8)"],[1,"rgba(179, 14, 17, 0.9)"]]}},Opentip.defaultStyle="standard",typeof module!="undefined"&&module!==null?module.exports=Opentip:window.Opentip=Opentip;var __slice=[].slice;(function(t){var e;return t.fn.opentip=function(t,e,i){return new Opentip(this,t,e,i)},e=function(){function e(){}return e.prototype.name="jquery",e.prototype.domReady=function(e){return t(e)},e.prototype.create=function(e){return t(e)},e.prototype.wrap=function(e){if(e=t(e),e.length>1)throw Error("Multiple elements provided.");return e},e.prototype.unwrap=function(e){return t(e)[0]
},e.prototype.tagName=function(t){return this.unwrap(t).tagName},e.prototype.attr=function(){var e,i,o;return i=arguments[0],e=arguments.length>=2?__slice.call(arguments,1):[],(o=t(i)).attr.apply(o,e)},e.prototype.data=function(){var e,i,o;return i=arguments[0],e=arguments.length>=2?__slice.call(arguments,1):[],(o=t(i)).data.apply(o,e)},e.prototype.find=function(e,i){return t(e).find(i).get(0)},e.prototype.findAll=function(e,i){return t(e).find(i)},e.prototype.update=function(e,i,o){return e=t(e),o?e.text(i):e.html(i)},e.prototype.append=function(e,i){return t(e).append(i)},e.prototype.remove=function(e){return t(e).remove()},e.prototype.addClass=function(e,i){return t(e).addClass(i)},e.prototype.removeClass=function(e,i){return t(e).removeClass(i)},e.prototype.css=function(e,i){return t(e).css(i)},e.prototype.dimensions=function(e){return{width:t(e).outerWidth(),height:t(e).outerHeight()}},e.prototype.scrollOffset=function(){return[window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop]},e.prototype.viewportDimensions=function(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}},e.prototype.mousePosition=function(t){return t==null?null:{x:t.pageX,y:t.pageY}},e.prototype.offset=function(e){var i;return i=t(e).offset(),{left:i.left,top:i.top}},e.prototype.observe=function(e,i,o){return t(e).bind(i,o)},e.prototype.stopObserving=function(e,i,o){return t(e).unbind(i,o)},e.prototype.ajax=function(e){var i,o;if(e.url==null)throw Error("No url provided");return t.ajax({url:e.url,type:(i=(o=e.method)!=null?o.toUpperCase():void 0)!=null?i:"GET"}).done(function(t){return typeof e.onSuccess=="function"?e.onSuccess(t):void 0}).fail(function(t){return typeof e.onError=="function"?e.onError("Server responded with status "+t.status):void 0}).always(function(){return typeof e.onComplete=="function"?e.onComplete():void 0})},e.prototype.clone=function(e){return t.extend({},e)},e.prototype.extend=function(){var e,i;return i=arguments[0],e=arguments.length>=2?__slice.call(arguments,1):[],t.extend.apply(t,[i].concat(__slice.call(e)))},e}(),Opentip.addAdapter(new e)})(jQuery);
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():a.numeral=b()}(this,function(){function a(a,b){this._input=a,this._value=b}var b,c,d="2.0.6",e={},f={},g={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},h={currentLocale:g.currentLocale,zeroFormat:g.zeroFormat,nullFormat:g.nullFormat,defaultFormat:g.defaultFormat,scalePercentBy100:g.scalePercentBy100};return b=function(d){var f,g,i,j;if(b.isNumeral(d))f=d.value();else if(0===d||"undefined"==typeof d)f=0;else if(null===d||c.isNaN(d))f=null;else if("string"==typeof d)if(h.zeroFormat&&d===h.zeroFormat)f=0;else if(h.nullFormat&&d===h.nullFormat||!d.replace(/[^0-9]+/g,"").length)f=null;else{for(g in e)if(j="function"==typeof e[g].regexps.unformat?e[g].regexps.unformat():e[g].regexps.unformat,j&&d.match(j)){i=e[g].unformat;break}i=i||b._.stringToNumber,f=i(d)}else f=Number(d)||null;return new a(d,f)},b.version=d,b.isNumeral=function(b){return b instanceof a},b._=c={numberToFormat:function(a,c,d){var e,g,h,i,j,k,l,m=f[b.options.currentLocale],n=!1,o=!1,p=0,q="",r=1e12,s=1e9,t=1e6,u=1e3,v="",w=!1;if(a=a||0,g=Math.abs(a),b._.includes(c,"(")?(n=!0,c=c.replace(/[\(|\)]/g,"")):(b._.includes(c,"+")||b._.includes(c,"-"))&&(j=b._.includes(c,"+")?c.indexOf("+"):0>a?c.indexOf("-"):-1,c=c.replace(/[\+|\-]/g,"")),b._.includes(c,"a")&&(e=c.match(/a(k|m|b|t)?/),e=e?e[1]:!1,b._.includes(c," a")&&(q=" "),c=c.replace(new RegExp(q+"a[kmbt]?"),""),g>=r&&!e||"t"===e?(q+=m.abbreviations.trillion,a/=r):r>g&&g>=s&&!e||"b"===e?(q+=m.abbreviations.billion,a/=s):s>g&&g>=t&&!e||"m"===e?(q+=m.abbreviations.million,a/=t):(t>g&&g>=u&&!e||"k"===e)&&(q+=m.abbreviations.thousand,a/=u)),b._.includes(c,"[.]")&&(o=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],k=c.indexOf(","),p=(c.split(".")[0].split(",")[0].match(/0/g)||[]).length,i?(b._.includes(i,"[")?(i=i.replace("]",""),i=i.split("["),v=b._.toFixed(a,i[0].length+i[1].length,d,i[1].length)):v=b._.toFixed(a,i.length,d),h=v.split(".")[0],v=b._.includes(v,".")?m.delimiters.decimal+v.split(".")[1]:"",o&&0===Number(v.slice(1))&&(v="")):h=b._.toFixed(a,0,d),q&&!e&&Number(h)>=1e3&&q!==m.abbreviations.trillion)switch(h=String(Number(h)/1e3),q){case m.abbreviations.thousand:q=m.abbreviations.million;break;case m.abbreviations.million:q=m.abbreviations.billion;break;case m.abbreviations.billion:q=m.abbreviations.trillion}if(b._.includes(h,"-")&&(h=h.slice(1),w=!0),h.length<p)for(var x=p-h.length;x>0;x--)h="0"+h;return k>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+m.delimiters.thousands)),0===c.indexOf(".")&&(h=""),l=h+v+(q?q:""),n?l=(n&&w?"(":"")+l+(n&&w?")":""):j>=0?l=0===j?(w?"-":"+")+l:l+(w?"-":"+"):w&&(l="-"+l),l},stringToNumber:function(a){var b,c,d,e=f[h.currentLocale],g=a,i={thousand:3,million:6,billion:9,trillion:12};if(h.zeroFormat&&a===h.zeroFormat)c=0;else if(h.nullFormat&&a===h.nullFormat||!a.replace(/[^0-9]+/g,"").length)c=null;else{c=1,"."!==e.delimiters.decimal&&(a=a.replace(/\./g,"").replace(e.delimiters.decimal,"."));for(b in i)if(d=new RegExp("[^a-zA-Z]"+e.abbreviations[b]+"(?:\\)|(\\"+e.currency.symbol+")?(?:\\))?)?$"),g.match(d)){c*=Math.pow(10,i[b]);break}c*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),c*=Number(a)}return c},isNaN:function(a){return"number"==typeof a&&isNaN(a)},includes:function(a,b){return-1!==a.indexOf(b)},insert:function(a,b,c){return a.slice(0,c)+b+a.slice(c)},reduce:function(a,b){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof b)throw new TypeError(b+" is not a function");var c,d=Object(a),e=d.length>>>0,f=0;if(3===arguments.length)c=arguments[2];else{for(;e>f&&!(f in d);)f++;if(f>=e)throw new TypeError("Reduce of empty array with no initial value");c=d[f++]}for(;e>f;f++)f in d&&(c=b(c,d[f],f,d));return c},multiplier:function(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var d=c.multiplier(b);return a>d?a:d},1)},toFixed:function(a,b,c,d){var e,f,g,h,i=a.toString().split("."),j=b-(d||0);return e=2===i.length?Math.min(Math.max(i[1].length,j),b):j,g=Math.pow(10,e),h=(c(a+"e+"+e)/g).toFixed(e),d>b-e&&(f=new RegExp("\\.?0{1,"+(d-(b-e))+"}$"),h=h.replace(f,"")),h}},b.options=h,b.formats=e,b.locales=f,b.locale=function(a){return a&&(h.currentLocale=a.toLowerCase()),h.currentLocale},b.localeData=function(a){if(!a)return f[h.currentLocale];if(a=a.toLowerCase(),!f[a])throw new Error("Unknown locale:"+a);return f[a]},b.reset=function(){for(var a in g)h[a]=g[a]},b.zeroFormat=function(a){h.zeroFormat="string"==typeof a?a:null},b.nullFormat=function(a){h.nullFormat="string"==typeof a?a:null},b.defaultFormat=function(a){h.defaultFormat="string"==typeof a?a:"0.0"},b.register=function(a,b,c){if(b=b.toLowerCase(),this[a+"s"][b])throw new TypeError(b+" "+a+" already registered.");return this[a+"s"][b]=c,c},b.validate=function(a,c){var d,e,f,g,h,i,j,k;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(""===a)return!1;try{j=b.localeData(c)}catch(l){j=b.localeData(b.locale())}return f=j.currency.symbol,h=j.abbreviations,d=j.delimiters.decimal,e="."===j.delimiters.thousands?"\\.":j.delimiters.thousands,k=a.match(/^[^\d]+/),null!==k&&(a=a.substr(1),k[0]!==f)?!1:(k=a.match(/[^\d]+$/),null!==k&&(a=a.slice(0,-1),k[0]!==h.thousand&&k[0]!==h.million&&k[0]!==h.billion&&k[0]!==h.trillion)?!1:(i=new RegExp(e+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(d),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i):1===g[0].length?!!g[0].match(/^\d+$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(i)&&!!g[1].match(/^\d+$/))))},b.fn=a.prototype={clone:function(){return b(this)},format:function(a,c){var d,f,g,i=this._value,j=a||h.defaultFormat;if(c=c||Math.round,0===i&&null!==h.zeroFormat)f=h.zeroFormat;else if(null===i&&null!==h.nullFormat)f=h.nullFormat;else{for(d in e)if(j.match(e[d].regexps.format)){g=e[d].format;break}g=g||b._.numberToFormat,f=g(i,j,c)}return f},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b,c,e){return a+Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([this._value,a],b,0)/d,this},subtract:function(a){function b(a,b,c,e){return a-Math.round(d*b)}var d=c.correctionFactor.call(null,this._value,a);return this._value=c.reduce([a],b,Math.round(this._value*d))/d,this},multiply:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)*Math.round(b*f)/Math.round(f*f)}return this._value=c.reduce([this._value,a],b,1),this},divide:function(a){function b(a,b,d,e){var f=c.correctionFactor(a,b);return Math.round(a*f)/Math.round(b*f)}return this._value=c.reduce([this._value,a],b),this},difference:function(a){return Math.abs(b(this._value).subtract(a).value())}},b.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),function(){b.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,c,d){var e,f=b._.includes(c," BPS")?" ":"";return a=1e4*a,c=c.replace(/\s?BPS/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"BPS"),e=e.join("")):e=e+f+"BPS",e},unformat:function(a){return+(1e-4*b._.stringToNumber(a)).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},c={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=a.suffixes.concat(c.suffixes.filter(function(b){return a.suffixes.indexOf(b)<0})),e=d.join("|");e="("+e.replace("B","B(?!PS)")+")",b.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(e)},format:function(d,e,f){var g,h,i,j,k=b._.includes(e,"ib")?c:a,l=b._.includes(e," b")||b._.includes(e," ib")?" ":"";for(e=e.replace(/\s?i?b/,""),h=0;h<=k.suffixes.length;h++)if(i=Math.pow(k.base,h),j=Math.pow(k.base,h+1),null===d||0===d||d>=i&&j>d){l+=k.suffixes[h],i>0&&(d/=i);break}return g=b._.numberToFormat(d,e,f),g+l},unformat:function(d){var e,f,g=b._.stringToNumber(d);if(g){for(e=a.suffixes.length-1;e>=0;e--){if(b._.includes(d,a.suffixes[e])){f=Math.pow(a.base,e);break}if(b._.includes(d,c.suffixes[e])){f=Math.pow(c.base,e);break}}g*=f||1}return g}})}(),function(){b.register("format","currency",{regexps:{format:/(\$)/},format:function(a,c,d){var e,f,g,h=b.locales[b.options.currentLocale],i={before:c.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:c.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(c=c.replace(/\s?\$\s?/,""),e=b._.numberToFormat(a,c,d),a>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):0>a&&!b._.includes(i.before,"-")&&!b._.includes(i.before,"(")&&(i.before="-"+i.before),g=0;g<i.before.length;g++)switch(f=i.before[g]){case"$":e=b._.insert(e,h.currency.symbol,g);break;case" ":e=b._.insert(e," ",g+h.currency.symbol.length-1)}for(g=i.after.length-1;g>=0;g--)switch(f=i.after[g]){case"$":e=g===i.after.length-1?e+h.currency.symbol:b._.insert(e,h.currency.symbol,-(i.after.length-(1+g)));break;case" ":e=g===i.after.length-1?e+" ":b._.insert(e," ",-(i.after.length-(1+g)+h.currency.symbol.length-1))}return e}})}(),function(){b.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,c,d){var e,f="number"!=typeof a||b._.isNaN(a)?"0e+0":a.toExponential(),g=f.split("e");return c=c.replace(/e[\+|\-]{1}0/,""),e=b._.numberToFormat(Number(g[0]),c,d),e+"e"+g[1]},unformat:function(a){function c(a,c,d,e){var f=b._.correctionFactor(a,c),g=a*f*(c*f)/(f*f);return g}var d=b._.includes(a,"e+")?a.split("e+"):a.split("e-"),e=Number(d[0]),f=Number(d[1]);return f=b._.includes(a,"e-")?f*=-1:f,b._.reduce([e,Math.pow(10,f)],c,1)}})}(),function(){b.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,c,d){var e,f=b.locales[b.options.currentLocale],g=b._.includes(c," o")?" ":"";return c=c.replace(/\s?o/,""),g+=f.ordinal(a),e=b._.numberToFormat(a,c,d),e+g}})}(),function(){b.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,c,d){var e,f=b._.includes(c," %")?" ":"";return b.options.scalePercentBy100&&(a=100*a),c=c.replace(/\s?\%/,""),e=b._.numberToFormat(a,c,d),b._.includes(e,")")?(e=e.split(""),e.splice(-1,0,f+"%"),e=e.join("")):e=e+f+"%",e},unformat:function(a){var c=b._.stringToNumber(a);return b.options.scalePercentBy100?.01*c:c}})}(),function(){b.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,b,c){var d=Math.floor(a/60/60),e=Math.floor((a-60*d*60)/60),f=Math.round(a-60*d*60-60*e);return d+":"+(10>e?"0"+e:e)+":"+(10>f?"0"+f:f)},unformat:function(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}})}(),b});
!function(a){function b(a,b){return a.toFixed(b.decimals)}a.fn.countTo=function(b){return b=b||{},a(this).each(function(){function k(){i+=e,h++,l(i),"function"==typeof c.onUpdate&&c.onUpdate.call(f,i),h>=d&&(g.removeData("countTo"),clearInterval(j.interval),i=c.to,"function"==typeof c.onComplete&&c.onComplete.call(f,i))}function l(a){var b=c.formatter.call(f,a,c);g.text(b)}var c=a.extend({},a.fn.countTo.defaults,{from:a(this).data("from"),to:a(this).data("to"),speed:a(this).data("speed"),refreshInterval:a(this).data("refresh-interval"),decimals:a(this).data("decimals")},b),d=Math.ceil(c.speed/c.refreshInterval),e=(c.to-c.from)/d,f=this,g=a(this),h=0,i=c.from,j=g.data("countTo")||{};g.data("countTo",j),j.interval&&clearInterval(j.interval),j.interval=setInterval(k,c.refreshInterval),l(i)})},a.fn.countTo.defaults={from:0,to:0,speed:1e3,refreshInterval:100,decimals:0,formatter:b,onUpdate:null,onComplete:null}}(jQuery);
if(typeof EZFC_Object==="undefined"){
EZFC_Object=function($){
var _this=this;
var ezfc_hidden_value="__HIDDEN__";
var conditional_value_parse_exceptions_array=["in", "not_in", "selected", "not_selected", "selected_index", "not_selected_index", "selected_id", "not_selected_id", "selected_count", "not_selected_count"];
this.init=function(){
if(typeof EZFC_LOADED!=="undefined") return;
EZFC_LOADED=true;
this.form_vars=[];
this.$form_elements=[];
this.$element_trigger=0;
this.element_trigger_id=0;
this.trigger_list=[];
this.subtotals=[];
this.conditional_once=[];
this.payment_form_id=0;
this.payment_methods=["stripe", "authorize"];
this.elements_cache=[];
this.group_repeat_elements=[];
this.uploaded_files=[];
this.skip_init_blur_classes=["ezfc-slider", "ezfc-spinner"];
this.current_steps=[];
this.step_is_changing=false;
this.functions={
calculate_element: function(form_id, element_id){
return _this.calculate_element(form_id, element_id);
},
calculate_price: function(form_id){
var $form=$(".ezfc-form[data-id='" + form_id + "']");
return _this.calculate_price($form);
},
get_calculated_value_from: function(form_id, id){
return _this.get_calculated_element_value(form_id, id);
},
get_element_id_by_name: function(form_id, name){
if(!name&&form_id) name=form_id;
var $element=$(".ezfc-form [data-elementname='" + name + "']");
if(!$element) return false;
if(!form_id){
form_id=$element.closest(".ezfc-form").data("id");
}
if(!form_id) return false;
for (var i in ezfc_vars.element_vars[form_id]){
var element=ezfc_vars.element_vars[form_id][i];
var element_name=(_this.get_element_object_value(element, "name", "")).toLowerCase();
name=name.toLowerCase();
if(element_name==name){
return element.id;
}}
return false;
},
get_selected_id: function(element){
var id;
if(typeof element==="number"){
id=element;
}
else if(typeof element==="string"){
id=_this.functions.get_element_id_by_name(null, element);
if(!id){
_this.debug_message("Unknown element: " + element);
return false;
}}else{
_this.debug_message("Unknown object type: " + element);
return false;
}
var selected_ids=_this.functions.get_value_from(id, true, true, { return_value: "option_id" });
if(selected_ids.length==1) return selected_ids[0];
return _this.functions.get_value_from(id, true, true, { return_value: "option_id" });
},
get_value_from: function(id, is_text, ignore_factor, options){
return _this.get_value_from_element(null, id, is_text, ignore_factor, options);
},
get_value_from_name: function(form_id, name, is_text){
var id=_this.functions.get_element_id_by_name(form_id, name);
return _this.functions.get_value_from(id, is_text);
},
price_format: function(form_id, price, currency, custom_price_format, format_with_currency){
return _this.format_price(form_id, price, currency, custom_price_format, format_with_currency);
}};
ezfc_functions=this.functions;
this.external_listeners=[];
this.price_old_global=[];
numeral.register("locale", "ezfc", {
delimiters: {
decimal:   ezfc_vars.price_format_dec_point,
thousands: ezfc_vars.price_format_dec_thousand
},
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'b',
trillion: 't'
},
ordinal: function (number){
var b=number % 10;
return (~~ (number % 100 / 10)===1) ? 'th' :
(b===1) ? 'st' :
(b===2) ? 'nd' :
(b===3) ? 'rd':'th';
},
currency: {
symbol: '$'
}});
numeral.locale("ezfc");
this.defaultFormat=ezfc_vars.price_format ? ezfc_vars.price_format:"0,0[.][000000]";
numeral.defaultFormat(this.defaultFormat);
$.datepicker.setDefaults($.datepicker.regional[ezfc_vars.datepicker_language]);
this.init_form_vars();
this.attach_events();
this.init_tips();
};
this.attach_events=function(){
$(document).on("click", ".ezfc-element-option-image", function(){
if($(this).hasClass("ezfc-element-radio-image")){
_this.radio_change_state($(this).siblings(".ezfc-element-radio-input"));
}
else if($(this).hasClass("ezfc-element-checkbox-image")){
_this.checkbox_change_state($(this).siblings(".ezfc-element-checkbox-input"));
}});
$(document).on("click", ".ezfc-element-option-has-image label", function(){
var element_type=$(this).closest(".ezfc-element").data("element");
var $option_input=$(this).closest(".ezfc-element-single-option-container").find(":input");
if(element_type=="radio"){
_this.radio_change_state($option_input);
}
else if(element_type=="checkbox"){
_this.checkbox_change_state($option_input, null, false, true);
}});
$(".ezfc-addon-option").click(function(){
$(this).siblings(".ezfc-element-option-image").click();
});
$(".ezfc-form").each(function(){
var $form=$(this);
var $wrapper=$form.closest(".ezfc-wrapper");
_this.init_form_ui($form);
if($wrapper.find(".ezfc-form-loading-text").length){
$wrapper.find(".ezfc-form-loading-text").fadeOut(500, function(){
$form.fadeIn(500, function(){
$wrapper.removeClass("ezfc-form-loading");
_this.form_change($form);
_this.scroll();
});
});
}
$(document).trigger("ezfc_forms_loaded");
});
$(".ezfc-element-fileupload").each(function(i, el){
var $parent=$(this).closest(".ezfc-element");
var $btn=$parent.find(".ezfc-upload-button");
var $list=$parent.find(".ezfc-fileupload-files");
var fe_id=$parent.data("id");
var multiple=$(this).attr("multiple") ? true:false;
var $form=$(this).closest(".ezfc-form");
var form_id=$form.find("input[name='id']").val();
var ref_id=$form.find("input[name='ref_id']").val();
var formData={
action: "ezfc_frontend_fileupload",
data: "action=upload_file&id=" + form_id + "&ref_id=" + ref_id
};
if(typeof $.prototype.fileupload!=="function"){
_this.debug_message("Unable to load fileupload function.");
return false;
}
$(this).fileupload({
formData: formData,
dataType: 'json',
add: function (e, data){
$parent.find(".ezfc-bar").css("width", 0);
$parent.find(".progress").addClass("active");
$parent.find(".ezfc-fileupload-message").text("");
$btn.off("click");
if(_this.get_element_object_value(fe_id, "file_upload_auto", 1)==1){
_this.file_upload_attach_event(el, data, $btn, e);
}else{
$btn.click(function(){
_this.file_upload_attach_event(el, data, $btn, e);
});
}},
done: function (e, data){
$btn.removeAttr("disabled");
if(data.result.error){
$parent.find(".ezfc-fileupload-message").text(data.result.error);
$parent.find(".ezfc-bar").css("width", 0);
return false;
}
if(typeof _this.uploaded_files[form_id]==="undefined"){
_this.uploaded_files[form_id]=[];
}
if(typeof _this.uploaded_files[form_id][fe_id]==="undefined"){
_this.uploaded_files[form_id][fe_id]=[];
}
for (var i in data.result){
_this.uploaded_files[form_id][fe_id].push({
id:   data.result[i].success,
name: data.files[i].name
});
}
$(this).val("");
if(!$(this).attr("multiple")){
$(this).attr("disabled", "disabled");
}
$parent.find(".progress").removeClass("active");
$parent.find(".ezfc-fileupload-message").text(ezfc_vars.upload_success);
var list_out="";
for (var i in _this.uploaded_files[form_id][fe_id]){
list_out +="<li class='ezfc-fileupload-files-item' data-fileid='" + _this.uploaded_files[form_id][fe_id][i].id + "' data-refid='" + ref_id + "'>" + _this.uploaded_files[form_id][fe_id][i].name + " <span class='ezfc-fileupload-files-remove'><i class='fa fa-close'></i></span></li>";
}
$list.html(list_out);
},
progressall: function (e, data){
var progress=parseInt(data.loaded / data.total * 100, 10);
$($parent).find(".ezfc-bar").css("width", progress + "%");
},
replaceFileInput: false,
url: ezfc_vars.ajaxurl
});
});
$(document).on("click", ".ezfc-fileupload-files-remove", function(){
var $btn=$(this);
if($btn.hasClass("ezfc-state-removing")) return false;
var $form=$btn.closest(".ezfc-form");
var form_id=$form.find("input[name='id']").val();
var $wrapper=$btn.closest(".ezfc-element");
var $item=$btn.closest(".ezfc-fileupload-files-item");
var $msg=$wrapper.find(".ezfc-fileupload-message");
var $upload=$wrapper.find(".ezfc-element-fileupload");
var fe_id=$wrapper.data("id");
var file_id=$item.data("fileid");
var ref_id=$item.data("refid");
var send_data="action=remove_uploaded_file&file_id=" + file_id + "&ref_id=" + ref_id;
$btn.addClass("ezfc-state-removing");
$btn.find(".fa").removeClass("fa-close").addClass("fa-circle-o-notch fa-spin");
$.ajax({
type: "post",
url: ezfc_vars.ajaxurl,
data: {
action: "ezfc_frontend_fileupload",
data: send_data
},
complete: function(response){
var response_json;
if(typeof response==="object"&&typeof response.responseText!=="undefined"){
try {
response_json=$.parseJSON(response.responseText);
}
catch(e){}}
if(!response_json){
$msg.text(response.upload_remove_error);
$btn.find(".fa").removeClass("fa-circle-o-notch fa-spin ezfc-state-removing").addClass("fa-close");
return false;
}
if(!$upload.attr("multiple")){
var files=$wrapper.find(".ezfc-fileupload-files-item").length;
if(files==1){
$upload.removeAttr("disabled");
}}
$item.fadeOut();
$msg.text(ezfc_vars.upload_removed);
for (var i in _this.uploaded_files[form_id][fe_id]){
if(_this.uploaded_files[form_id][fe_id][i].id==file_id){
_this.uploaded_files[form_id][fe_id].splice(i, 1);
}}
}});
return false;
});
$(".ezfc-overview").dialog({
autoOpen: false,
modal: true
});
$(".ezfc-form .ezfc-input-format-listener").each(function(){
_this.input_format_listener_change($(this));
$(this).trigger("ezfc_blur_trigger");
});
var input_change_func_throttle=this.throttle(function($element, ev){
var form=$element.parents(".ezfc-form");
_this.form_change(form, null, $element, ev);
}, 100);
$(document).on("change keyup", ".ezfc-form input, .ezfc-form select", function(ev){
input_change_func_throttle($(this), ev);
});
$(document).on("blur", ".ezfc-form textarea", function(ev){
var form=$(this).closest(".ezfc-form");
_this.form_change(form, null);
});
$(".ezfc-element-wrapper-checkbox").change(function(){
_this.checkbox_change($(this));
});
$(document).on("click", ".ezfc-element-wrapper-radio :input", function(){
_this.radio_change_state($(this), true);
});
$(".ezfc-slider").each(function(i, el){
_this.init_slider($(el));
});
$(".ezfc-spinner").each(function(i, el){
_this.init_spinner($(el));
});
$(document).on("click", ".ezfc-step-button", function(){
var form_wrapper=$(this).parents(".ezfc-form");
var current_step=parseInt(form_wrapper.find(".ezfc-step-active").data("step"));
var next_step=current_step + ($(this).hasClass("ezfc-step-next") ? 1:-1);
var verify_step=$(this).hasClass("ezfc-step-next") ? 1:0;
_this.set_step(form_wrapper, next_step, verify_step);
return false;
});
$(document).on("click", ".ezfc-step-indicator-item-active, .ezfc-step-indicator-item-force", function(){
var $form=$(this).closest(".ezfc-form");
var step=parseInt($(this).data("step"));
_this.set_step($form, step, 0);
return false;
});
$(document).on("change", ".ezfc-element-wrapper-payment input", function(){
var $form=$(this).closest(".ezfc-form");
var form_id=$form.data("id");
if(_this.form_vars[form_id].price_show_request==1||_this.form_vars[form_id].summary_enabled==1) return;
_this.set_submit_text($form);
});
$(window).scroll(this.scroll);
this.scroll();
$(".ezfc-form").submit(function(e){
var $form=$(this);
var id=$form.data("id");
var $submit=$form.find(".ezfc-submit");
if(_this.form_vars[id].hard_submit==1){
return true;
}
_this.form_submit($form, -1, $submit.data("type"));
e.preventDefault();
return false;
});
$(".ezfc-payment-submit").click(function(e){
var $payment_form=$(this).closest(".ezfc-payment-form");
var form_id=$payment_form.data("form_id");
var $form=$(".ezfc-form[data-id='" + form_id + "']");
_this.form_submit($form, -1, $(this).data("payment"));
e.preventDefault();
return false;
});
$(".ezfc-payment-cancel").click(function(){
var $payment_form=$(this).closest(".ezfc-payment-form");
var form_id=$payment_form.data("form_id");
var $form=$("#ezfc-form-" + form_id);
var selectors=".ezfc-payment-dialog-modal[data-form_id='" + form_id + "']";
selectors    +=", .ezfc-payment-form";
$(selectors).removeClass("ezfc-payment-dialog-open");
_this.form_submit($form, false, false, true);
return false;
});
$(".ezfc-reset").click(function(){
var $form=$(this).parents(".ezfc-form");
_this.reset_form($form);
return false;
});
$(".ezfc-collapse-title-wrapper").on("click", function(){
var $group_wrapper=$(this).closest(".ezfc-element-wrapper-group");
_this.toggle_group($group_wrapper);
});
$(".ezfc-cc-number-formatter").on("change keyup", function(){
var value=$(this).val();
value=value.replace(/[^\dA-Z]/g, '').replace(/(.{4})/g, '$1 ').trim();
$(this).val(value);
});
$(document).on("click", ".ezfc-table_order-btn", function(ev){
var $target=$("#" + $(this).data("target"));
if($target.is(":disabled")) return false;
var $element=$target.closest(".ezfc-custom-element");
var form_id=$element.closest(".ezfc-form").data("id");
var min=$target.data("min");
var max=$target.data("max");
var value=$(this).data("value");
var value_target=_this.normalize_value($target.val());
var value_new=value_target + value;
if(max==0) max=value_new;
value_new=Math.min(value_new, max);
value_new=Math.max(value_new, min);
$target.val(value_new);
$target.trigger("blur");
_this.form_change(null, form_id, null, ev);
return false;
});
$(document).on("blur", ".ezfc-element-table_order-quantity-input", function(ev){
var $element=$(this).closest(".ezfc-custom-element");
var form_id=$element.closest(".ezfc-form").data("id");
var min=$(this).data("min");
var max=$(this).data("max");
var value=_this.normalize_value($(this).val());
if(max==0) max=value;
value=Math.min(value, max);
value=Math.max(value, min);
$(this).val(value);
_this.form_change(null, form_id, null, ev);
});
$(document).on("click", ".ezfc-repeatable-form-repeat-button", function(){
_this.group_repeat($(this).data("id"));
return false;
});
$(document).on("click", ".ezfc-repeatable-form-remove-button", function(){
_this.group_remove($(this).data("id"), $(this).data("row"));
return false;
});
$(".ezfc-form-open-popup-button").click(function(){
var form_id=$(this).data("target");
_this.popup_form_open(form_id);
return false;
});
$(".ezfc-form-popup-close").click(function(){
var form_id=$(this).data("target");
_this.popup_form_close(form_id);
return false;
});
};
this.init_form_ui=function(form_dom, build_groups){
if(typeof build_groups==="undefined") build_groups=true;
var $form=$(form_dom);
var form_id=$form.data("id");
$form.find(".ezfc-element-datepicker").each(function(){
var $element=$(this);
var el_settings={};
if($element.data("settings")){
el_settings=$element.data("settings");
}
var available_days=[0, 1, 2, 3, 4, 5, 6];
if(el_settings.available_days.length){
available_days=el_settings.available_days.split(",");
}
available_days=available_days.map(function(d){
return parseInt(d);
});
var blocked_days=[];
if(el_settings.blocked_days.length){
blocked_days=el_settings.blocked_days.split(",");
}
var datepicker_format=$.trim(_this.form_vars[form_id].datepicker_format);
if(datepicker_format=="") datepicker_format="dd/mm/yy";
var yearRange=$.trim(el_settings.yearRange);
if(yearRange=="") yearRange="c-10:c+10";
$element.datepicker({
changeMonth:    el_settings.changeMonth ? el_settings.changeMonth:false,
changeYear:     el_settings.changeYear ? el_settings.changeYear:false,
dateFormat:     datepicker_format,
firstDay:       el_settings.firstDay ? el_settings.firstDay:false,
minDate:        el_settings.minDate ? el_settings.minDate:"",
maxDate:        el_settings.maxDate ? el_settings.maxDate:"",
numberOfMonths: el_settings.numberOfMonths ? parseInt(el_settings.numberOfMonths):1,
showAnim:       el_settings.showAnim ? el_settings.showAnim:"fadeIn",
showWeek:       el_settings.showWeek=="1" ? el_settings.showWeek:false,
yearRange:      yearRange,
beforeShowDay: function(date){
return _this.check_datepicker_days(date, available_days, blocked_days);
}});
$element.on("change keyup", function(ev){
var date=$(this).datepicker("getDate");
var check=_this.check_datepicker_days(date, available_days, blocked_days);
var valid=true;
if(typeof check==="object"&&!check[0]) valid=false;
if(!valid) $(this).val("");
_this.form_change($form, null, null, ev);
});
_this.check_datepicker_predefined_values($element);
});
$form.find(".ezfc-element-daterange").each(function(){
var $element=$(this);
var el_settings=$element.closest(".ezfc-element-daterange-container").data("settings");
var available_days=[0, 1, 2, 3, 4, 5, 6];
if(el_settings.available_days.length){
available_days=el_settings.available_days.split(",");
}
available_days=available_days.map(function(d){
return parseInt(d);
});
var blocked_days=[];
if(el_settings.blocked_days.length){
blocked_days=el_settings.blocked_days.split(",");
}
var datepicker_format=$.trim(_this.form_vars[form_id].datepicker_format);
if(datepicker_format=="") datepicker_format="dd/mm/yy";
var yearRange=$.trim(el_settings.yearRange);
if(yearRange=="") yearRange="c-10:c+10";
if($element.hasClass("ezfc-element-daterange-from")){
$element.datepicker({
changeMonth:    el_settings.changeMonth ? el_settings.changeMonth:false,
changeYear:     el_settings.changeYear ? el_settings.changeYear:false,
dateFormat:     datepicker_format,
firstDay:       el_settings.firstDay ? el_settings.firstDay:false,
minDate:        $element.data("mindate"),
maxDate:        $element.data("maxdate"),
numberOfMonths: el_settings.numberOfMonths ? parseInt(el_settings.numberOfMonths):1,
showAnim:       el_settings.showAnim ? el_settings.showAnim:"fadeIn",
showWeek:       el_settings.showWeek=="1" ? el_settings.showWeek:false,
yearRange:      yearRange,
onSelect: function(selectedDate){
var minDays=$element.data("mindays")||0;
var maxDays=$element.data("maxdays")||0;
var minDate=$.datepicker.parseDate(datepicker_format, selectedDate);
minDate.setDate(minDate.getDate() + minDays);
var maxDate=$.datepicker.parseDate(datepicker_format, selectedDate);
maxDate.setDate(maxDate.getDate() + maxDays);
$element.siblings(".ezfc-element-daterange-to").datepicker("option", "minDate", minDate);
if(maxDays!=0) $element.siblings(".ezfc-element-daterange-to").datepicker("option", "maxDate", maxDate);
$element.trigger("change");
},
beforeShowDay: function(date){
return _this.check_datepicker_days(date, available_days, blocked_days);
}});
_this.check_datepicker_predefined_values($element);
}else{
$element.datepicker({
changeMonth:    el_settings.changeMonth ? el_settings.changeMonth:false,
changeYear:     el_settings.changeYear ? el_settings.changeYear:false,
dateFormat:     datepicker_format,
firstDay:       el_settings.firstDay ? el_settings.firstDay:false,
minDate:        $element.data("mindate"),
maxDate:        $element.data("maxdate"),
numberOfMonths: el_settings.numberOfMonths ? parseInt(el_settings.numberOfMonths):1,
showAnim:       el_settings.showAnim ? el_settings.showAnim:"fadeIn",
showWeek:       el_settings.showWeek=="1" ? el_settings.showWeek:false,
yearRange:      yearRange,
onSelect: function(selectedDate){
$element.trigger("change");
},
beforeShowDay: function(date){
return _this.check_datepicker_days(date, available_days, blocked_days);
}});
_this.check_datepicker_predefined_values($element);
}});
$form.find(".ezfc-element-timepicker").each(function(){
_this.init_timepicker($(this), form_id);
});
$form.find(".ezfc-element-colorpicker").each(function(){
var $element=$(this);
var input=$element.parents(".ezfc-element").find(".ezfc-element-colorpicker-input");
var colorpicker=$element.colorpicker({
container: $element
}).on("changeColor.colorpicker", function(ev){
$element.css("background-color", ev.color.toHex());
input.val(ev.color.toHex());
});
$(input).on("click focus", function(){
colorpicker.colorpicker("show");
}).on("change", function(){
colorpicker.colorpicker("setValue", $form.val());
});
});
var steps=$form.find(".ezfc-step");
if(steps.length > 0){
var last_step=steps.last();
$form.find(".ezfc-summary-wrapper").appendTo(last_step);
$form.find(".ezfc-submit-wrapper").appendTo(last_step).addClass("ezfc-submit-step");
this.prevent_enter_step_listener(last_step.find("input"), $form);
}
_this.init_form(form_dom);
};
this.init_slider=function($element){
var element_id=$element.data("id");
var element=this.get_element_object(element_id);
var form_id=$element.closest(".ezfc-form").data("id");
var $slider_element=$element.siblings(".ezfc-slider-element");
var slider_orientation=$element.hasClass("ezfc-slider-vertical") ? "vertical":"horizontal";
var value_normalized=this.normalize_value($element.val(), $element);
var slider_options={
min:         $element.data("min")||0,
max:         $element.data("max")||100,
step:        $element.data("stepsslider")||1,
value:       value_normalized||0,
orientation: slider_orientation
};
var slider_values_array=$element.data("values");
var slider_values=null;
if(slider_values_array){
slider_values=String(slider_values_array).split(",");
slider_values=$.map(slider_values, $.trim);
slider_options.min=0;
slider_options.max=slider_values.length - 1;
for (var sv in slider_values){
if(slider_values[sv]==value_normalized){
slider_options.value=sv;
}}
}
slider_options.change=function(ev, ui){
var ui_value=_this.normalize_value($element.val(), $element);
var value=ui_value;
if(slider_values){
for (var i in slider_values){
var normalized_ui_value=_this.normalize_value(ui_value, $element);
if(ui_value==slider_values[i]) value=i;
}}
this.value=value;
};
slider_options.slide=function(ev, ui){
var ui_value=ui.value;
if(slider_values){
if(typeof slider_values[ui.value]!=="undefined"){
ui_value=slider_values[ui.value];
}}
var value=_this.format_price(form_id, ui_value, false, false, false, true);
$element.val(value);
$element.trigger("change");
};
slider_options.start=function(ev, ui){
$element.trigger("focus");
};
slider_options.stop=function(ev, ui){
var ui_value=ui.value;
if(slider_values&&typeof slider_values[ui.value]!=="undefined"){
ui_value=slider_values[ui.value];
}
var value=_this.format_value_element(element_id, ui_value);
$element.val(value);
$element.trigger("change");
$element.trigger("blur");
};
var slider_object=$slider_element.slider(slider_options);
if($element.hasClass("ezfc-pips")){
var pips_args={ rest: "label" };
if(slider_values) pips_args.labels=slider_values;
if(!isNaN($element.data("stepspips"))&&$element.data("stepspips")!="") pips_args.step=$element.data("stepspips");
$slider_element.slider("pips", pips_args);
$slider_element.find(".ui-slider-pip").on("click", function(){
var pip_val=$(this).find(".ui-slider-label").data("value");
if(slider_values&&typeof slider_values[pip_val]!=="undefined") pip_val=slider_values[pip_val];
pip_val=_this.format_price(form_id, pip_val, false, false, false, true);
$element.val(pip_val);
$element.trigger("change");
$element.trigger("blur");
});
if($element.data("pipsfloat")==1) $slider_element.slider("float");
}};
this.init_spinner=function($element){
var $parent_element=$element.closest(".ezfc-custom-element");
var element_id=$parent_element.data("id");
var form_id=$element.closest(".ezfc-form").data("id");
var steps=$element.data("stepsspinner")||1;
$element.spinner({
min:  $element.data("min")||0,
max:  $element.data("max")||100,
step: steps,
change: function(ev, ui){
},
spin: function(ev, ui){
var value=_this.format_price(form_id, ui.value, false, false, false, false);
},
start: function(ev, ui){
var ui_value=$element.val();
var value=_this.normalize_value(ui_value);
$element.val(value);
},
stop: function(ev, ui){
var ui_value=$element.val();
ui_value=_this.normalize_value(ui_value, $element);
var value=_this.format_value_element(element_id, ui_value);
$element.val(value);
$element.trigger("change");
$element.trigger("blur");
}});
};
this.init_timepicker=function($timepicker, form_id, add_settings){
var el_settings={};
if($timepicker.data("settings")){
el_settings=$timepicker.data("settings");
}
if(typeof add_settings==="object"){
el_settings=$.extend({}, el_settings, add_settings);
}
var timepicker_format=el_settings.format ? el_settings.format:_this.form_vars[form_id].timepicker_format;
if(timepicker_format=="") timepicker_format="H:i";
$timepicker.timepicker({
disableTimeRanges: el_settings.disabledTimes ? el_settings.disabledTimes:[],
minTime:           el_settings.minTime ? el_settings.minTime:null,
maxTime:           el_settings.maxTime ? el_settings.maxTime:null,
step:              el_settings.steps ? el_settings.steps:30,
timeFormat:        timepicker_format
});
};
this.init_form_vars=function(){
for (var form_id in ezfc_vars.form_vars){
this.form_vars[form_id]=ezfc_vars.form_vars[form_id];
this.subtotals[form_id]=[];
this.conditional_once[form_id]=[];
this.external_listeners[form_id]=[];
this.elements_cache[form_id]=[];
this.current_steps[form_id]=0;
this.trigger_list[form_id]=[];
$.each(this.form_vars[form_id].form_elements_order, function(i, element_id){
_this.form_vars[form_id].form_elements_order[i]=String(_this.form_vars[form_id].form_elements_order[i]);
_this.add_form_element_to_cache(element_id, form_id);
});
}};
this.add_form_element_to_cache=function(element_id, form_id){
if(typeof ezfc_vars.element_vars[form_id][element_id]==="undefined") return;
var $element=$("#ezfc_element-" + element_id);
var element_obj={
element: ezfc_vars.element_vars[form_id][element_id],
$element: $element,
$element_input: $element.find("input, textarea"),
id: element_id,
form_id: form_id
};
this.$form_elements[element_id]=element_obj;
};
this.init_form=function(form_dom){
var $form=$(form_dom);
var form_id=$form.data("id");
this.set_ref_id(form_id);
if(this.form_vars[form_id].price_show_request==1){
this.price_request_toggle(form_id, false);
}
this.price_old_global[form_id]=0;
this.set_price($form);
this.set_submit_text($form);
if(this.form_vars[form_id].use_woocommerce){
var elements_to_hide=".woocommerce form.cart, .woocommerce .price";
$(elements_to_hide).hide();
}
var step_indicator_start=parseInt(this.form_vars[form_id].step_indicator_start) + 1;
if(step_indicator_start > 1){
$form.find(".ezfc-step-indicator").hide();
}
if(ezfc_vars.debug_mode==2&&!$("#ezfc-show-all-elements").length){
$form.append("<button id='ezfc-show-all-elements'>Show/hide elements</button>");
$("#ezfc-show-all-elements").click(function(){
if($form.hasClass("ezfc-debug-visible")){
$form.removeClass("ezfc-debug-visible");
$form.find(".ezfc-tmp-visible").removeClass("ezfc-tmp-visible").hide();
}else{
$form.addClass("ezfc-debug-visible");
$form.find(".ezfc-hidden").addClass("ezfc-tmp-visible").show().css("display", "inline-block");
}
return false;
});
}
if(this.form_vars[form_id].use_stripe==1&&typeof Stripe!=="undefined"){
Stripe.setPublishableKey(ezfc_vars.stripe.publishable_key);
}
this.prevent_enter_step_listener(":input:not(textarea):not([type=submit])", $form);
this.populate_html_placeholders($form);
if(this.form_vars[form_id].popup_open_auto==1){
this.popup_form_open(form_id);
}
this.init_table_order(form_id);
for (var i in ezfc_vars.element_vars[form_id]){
var element=ezfc_vars.element_vars[form_id][i];
if(element.type=="repeatable_form"){
this.init_repeatable_group(element.id);
if(element.repeatable==1){
var clone_count=parseInt(this.get_element_object_value(element, "repeatable_count_start", 0));
clone_count=Math.min(clone_count, this.get_element_object_value(element, "repeatable_count_max"));
for (var n=0; n < clone_count; n++){
this.group_repeat(element.id);
}}
}}
$(document).trigger("ezfc_form_init", form_id);
};
this.form_change=function(form, form_id, $element_trigger, ev){
form=form||$("#ezfc-form-" + form_id);
form_id=form_id||$(form).data("id");
if(!form||!form.length){
form=$element_trigger.closest(".ezfc-form");
if(!form.length) return;
}
this.trigger_list[form_id]=[];
this.$element_trigger=$element_trigger;
this.element_trigger_id=0;
if($element_trigger){
this.element_trigger_id=$element_trigger.data("id");
if(!$element_trigger.hasClass("ezfc-custom-element")){
this.element_trigger_id=$element_trigger.closest(".ezfc-custom-element").data("id");
}
if(!this.element_trigger_id||!this.element_trigger_id.indexOf||this.element_trigger_id.indexOf("-") < 0){
var element=this.get_element_object(this.element_trigger_id);
if(!element.hasOwnProperty("trigger_ids")||element.trigger_ids.length < 1) return;
this.form_build_trigger_list(form_id, element.id);
}}
this.clear_hidden_values(form);
this.form_vars[form_id].price_requested=0;
this.form_vars[form_id].summary_shown=0;
$(form).find(".ezfc-summary-wrapper").fadeOut();
if(this.form_vars[form_id].price_show_request==1){
this.price_request_toggle(form_id, false);
}
this.remove_debug_info();
this.set_price(form);
this.set_submit_text(form);
this.populate_html_placeholders(form);
this.live_summary_update(form_id);
this.scroll();
this.call_hook("ezfc_after_form_change", {
form_id: form_id
});
};
this.form_build_trigger_list=function(form_id, element_id){
var element=this.get_element_object(element_id);
var trigger_list=[element_id];
$.each(element.trigger_ids, function(i, trigger_element_id){
var trigger_element=_this.get_element_object(trigger_element_id);
trigger_list=trigger_list.concat(trigger_element.trigger_ids);
});
this.trigger_list[form_id]=this.unique(trigger_list);
};
this.form_submit=function(form, step, submit_type, cancel){
var $form=$(form);
var $form_wrapper=$form.closest(".ezfc-wrapper");
var id=$form.data("id");
this.call_hook("ezfc_form_submit_start", {
data: data,
form: $form,
form_vars: this.form_vars[id],
id: id
});
var form_error=false;
$form.find(".ezfc-submit-icon").addClass("ezfc-submit-icon-show");
var submit_icon=$form.find(".ezfc-submit-icon, .ezfc-step-submit-icon");
var submit_element=$form.find("input[type='submit']");
if(this.form_vars[id].price_show_request==1){
this.set_price(form);
}
if(cancel){
_this.submit_cancel($form);
return false;
}
if($.inArray(submit_type, _this.payment_methods)!==-1){
var $payment_form=$("#ezfc-" + submit_type + "-form-" + id);
var price_html=this.format_price(id, this.price_old_global[id], false, false, true);
$payment_form.find(".ezfc-payment-price").text(price_html);
if(!_this.form_vars[id].payment_info_shown[submit_type]){
_this.form_vars[id].payment_info_shown[submit_type]=1;
$("#ezfc-" + submit_type + "-form-" + id + ", #ezfc-" + submit_type + "-form-modal-" + id).addClass("ezfc-payment-dialog-open");
}else{
_this.payment_form_id=id;
$payment_form.find(".ezfc-payment-submit, .ezfc-payment-cancel").prop("disabled", true);
if(submit_type=="stripe"){
Stripe.card.createToken($payment_form, this.stripe_response_handler);
}
else if(submit_type=="authorize"){
if(typeof Accept==="undefined"){
_this.debug_message("AcceptJS wasn't loaded.");
return false;
}
this.authorize_create_token(id);
}}
submit_icon.fadeOut();
return false;
}
submit_icon.fadeIn();
submit_element.prop("disabled", true);
$form.find(".ezfc-custom-hidden:not(.ezfc-element-wrapper-fileupload):not(.ezfc-element-wrapper-group)").each(function(){
var radio_empty=$(this).find(".ezfc-element-radio:not(:has(:radio:checked))");
if(radio_empty.length){
$(radio_empty).first().find("input").prop("checked", true);
}
$(this).find("option").first().prop("checked", true).val(ezfc_hidden_value);
$(this).find(".ezfc-element-checkbox-input").first().prop("checked", true).addClass("ezfc-has-hidden-placeholder").val(ezfc_hidden_value);
$(this).find(":input").val(ezfc_hidden_value).removeAttr("disabled").addClass("ezfc-has-hidden-placeholder");
});
var elements_custom_data="";
for (var i in this.form_vars[id].form_elements_order){
var element_id=this.form_vars[id].form_elements_order[i];
var element=this.get_element_object(element_id);
if(element&&element.type=="repeatable_form") continue;
if(this.is_repeatable_element(element_id)){
var parent_id=this.get_repeatable_parent_id(element_id);
if(!parent_id) continue;
var real_element_id=this.get_repeatable_element_id(element_id);
var counter_id=this.get_repeatable_element_counter(element_id);
elements_custom_data +="&calculated_values[" + parent_id + "][" + real_element_id + "][" + counter_id + "]=" + this.get_calculated_element_value(id, element_id);
}else{
var calculate_enabled=this.get_element_object_value(element_id, "calculate_enabled", 1);
var element_is_visible=_this.element_is_visible(element_id);
if(element_is_visible){
elements_custom_data +="&elements_visible[" + element_id + "]=1";
}
if(calculate_enabled==0&&!element_is_visible){
var $element_input=this.get_element_child_input_dom(element_id);
$element_input.val(ezfc_hidden_value);
}
var element_calculated_value=this.get_calculated_element_value(id, element_id);
elements_custom_data +="&calculated_values[" + element_id + "]=" + element_calculated_value;
}}
$form.find(".ezfc-element-wrapper-checkbox").each(function(){
if($(this).find(".ezfc-has-hidden-placeholder").length) return false;
var $element=$(this);
var min_selected=parseInt($element.attr("data-min_selectable"));
var max_selected=parseInt($element.attr("data-max_selectable"));
var selected=$element.find(":checked").length;
if(min_selected > 0&&selected < min_selected){
form_error=true;
_this.show_tip($element, "#" + $element.attr("id"), 0, _this.sprintf(_this.form_vars[id].selectable_min_error, min_selected));
_this.scroll_to($element);
}
if(max_selected > 0&&selected > max_selected){
form_error=true;
_this.show_tip($element, "#" + $element.attr("id"), 0, _this.sprintf(_this.form_vars[id].selectable_max_error, max_selected));
_this.scroll_to($element);
}});
var values_before_submission=[];
var data=$form.serialize();
data +=elements_custom_data;
$.each(values_before_submission, function(i, obj){
$(obj.element).val(obj.value);
});
if(form_error){
submit_icon.fadeOut();
submit_element.removeAttr("disabled");
_this.clear_hidden_values($form);
return false;
}
$(".ezfc-element[data-min], .ezfc-element[data-max]").each(function(){
var mm_element_id=$(this).closest(".ezfc-custom-element").data("id");
var mm_min=$(this).data("min");
var mm_max=$(this).data("max");
var mm_data="&dynamic_min[" + mm_element_id + "]=" + mm_min;
mm_data    +="&dynamic_max[" + mm_element_id + "]=" + mm_max;
data +=mm_data;
});
data +="&url=" + encodeURI(window.location.href);
if(this.form_vars[id].price_requested==0){
data +="&price_requested=1";
}
if(this.form_vars[id].summary_shown==0){
data +="&summary=1";
}
if(step!=-1){
data +="&step=" + step;
}
if(this.form_vars[id].preview_form){
data +="&preview_form=" + this.form_vars[id].preview_form;
}
var generated_price=this.price_old_global[id];
if(this.form_vars[id].price_show_request==1){
generated_price=_this.functions.calculate_price(id);
}
data +="&generated_price=" + generated_price;
this.call_hook("ezfc_before_submission", {
data: data,
form: $form,
form_vars: this.form_vars[id],
id: id
});
var req=$.ajax({
type: "post",
url: ezfc_vars.ajaxurl,
data: {
action: "ezfc_frontend",
data: data
},
success: function(response){
$(".ezfc-submit-icon").removeClass("ezfc-submit-icon-show");
submit_element.removeAttr("disabled");
submit_icon.fadeOut();
_this.debug_message(response);
try {
response=$.parseJSON(response);
}
catch (e){
response=false;
_this.debug_message(e);
}
if(!response){
$("#ezfc-message-" + id).text(ezfc_vars.form_submit_error);
_this.recaptcha_reload();
_this.reset_disabled_fields(form, true);
return false;
}
if(typeof response.error!=="undefined"){
_this.reset_disabled_fields(form, true);
if(response.id){
var show_error_tip=true;
var el_target="#ezfc_element-" + response.id;
var el_tip=$(el_target).find(".ezfc-element").first();
var tip=null;
var use_steps=$form.find(".ezfc-step-active").length > 0 ? true:false;
if(use_steps){
var error_step=parseInt($(el_target).parents(".ezfc-step").data("step"));
if(error_step!=step&&step!=-1){
show_error_tip=false;
_this.set_step(form, step + 1);
}}
if(show_error_tip){
if(!el_tip.length){
el_tip=$(el_target);
}
var tip_delay=use_steps ? 1000:400;
var payment_dialog_open=$form_wrapper.find(".ezfc-payment-dialog-open").length > 0;
if(el_tip.is(":visible")){
_this.show_tip(el_tip, el_target, tip_delay, response.error);
if(payment_dialog_open){
_this.set_message(id, response.error + " (#" + response.id + ")");
}}else{
var $el_tip_parent_groups=el_tip.parents(".ezfc-element-wrapper-group");
if($el_tip_parent_groups.length){
$el_tip_parent_groups.each(function(gi, group_el){
_this.toggle_group($(group_el), true);
});
_this.show_tip(el_tip, el_target, tip_delay, response.error);
}else{
_this.set_message(id, response.error + " (#" + response.id + ")");
}}
if(typeof ezfc_vars.required_text_auto_hide!=="undefined"){
var required_text_auto_hide=parseFloat(ezfc_vars.required_text_auto_hide) * 1000;
if(required_text_auto_hide > 0){
setTimeout(function(){
if(tip) tip.hide();
}, required_text_auto_hide);
}}
if(_this.form_vars[id].disable_error_scroll==0){
_this.scroll_to(el_target);
}}
}else{
_this.set_message(id, response.error);
}
_this.recaptcha_reload();
return false;
}
else if(response.step_valid){
_this.reset_disabled_fields(form);
_this.set_step(form, step + 1);
return false;
}
else if(response.summary){
$form.find(".ezfc-summary-wrapper").fadeIn().find(".ezfc-summary").html(response.summary);
_this.form_vars[id].summary_shown=1;
_this.reset_disabled_fields(form);
return false;
}
_this.recaptcha_reload();
if(response.paypal){
submit_element.attr("disabled", "disabled");
window.location.href=response.paypal;
}else{
if(response.price_requested||response.price_requested===0){
_this.price_request_toggle(id, true, response.price_requested);
return false;
}
var hook_vars={
data: data,
form: $form,
form_vars: _this.form_vars[id],
id: id,
price: price,
response: response
};
_this.call_hook("ezfc_submission_success", hook_vars);
if(_this.form_vars[id].submission_js_func&&typeof window[_this.form_vars[id].submission_js_func]==="function"){
window[_this.form_vars[id].submission_js_func](hook_vars);
}
$form_wrapper.find(".ezfc-payment-dialog, .ezfc-payment-dialog-modal").removeClass("ezfc-payment-dialog-open");
var $success_text=$(".ezfc-success-text[data-id='" + id + "']");
$success_text.html(response.success);
_this.set_ref_id(id);
if(_this.form_vars[id].reset_after_submission==1){
_this.reset_form(form);
var success_text_delay=10000;
if(_this.object_has_property(_this.form_vars[id], "show_success_text_duration")){
success_text_delay=parseFloat(_this.form_vars[id].show_success_text_duration) * 1000;
}
if(success_text_delay==0) success_text_delay=99999999999;
$success_text.fadeIn().delay(success_text_delay).fadeOut();
return;
}
if(_this.form_vars[id].hide_all_forms==1){
$(".ezfc-form, .ezfc-required-notification").fadeOut().addClass("ezfc-form-submitted");
}else{
$form.find(".ezfc-required-notification").fadeOut();
if(_this.form_vars[id].show_success_text==1){
$form.fadeOut().addClass("ezfc-form-submitted");
}}
if(_this.form_vars[id].show_success_text==1){
if(_this.form_vars[id].scroll_to_success_message==1){
$success_text.fadeIn(400, function(){
_this.scroll_to($success_text);
});
}else{
$success_text.fadeIn();
}}
if(response.woo_update_cart){
$(document.body).trigger("wc_fragment_refresh");
_this.call_hook("ezfc_wc_submission_success", hook_vars);
}
var redirect_timer=Math.max(0, Math.abs(parseInt(_this.form_vars[id].redirect_timer)));
if(typeof _this.form_vars[id].redirect_url!=="undefined"&&_this.form_vars[id].redirect_url.length > 0){
var redirect_form_vars="";
if(_this.form_vars[id].redirect_forward_values==1){
for (var _element_id in ezfc_vars.element_vars[id]){
var _element=ezfc_vars.element_vars[id][_element_id];
redirect_form_vars +="&" + _this.get_element_object_value(_element_id, "name", "") + "=" + _this.get_value_from_element(null, _element_id);
}
redirect_form_vars +="&total=" + _this.price_old_global[id];
redirect_form_vars +="&total_f=" + _this.functions.price_format(id, _this.price_old_global[id]);
}
if(response.hasOwnProperty("insert_key")) redirect_form_vars +="&ezfc_insert_key=" + response.insert_key;
var href_separator=_this.form_vars[id].redirect_url.indexOf("?")==-1 ? "?":"&";
setTimeout(function(){
window.location.href=_this.form_vars[id].redirect_url + href_separator + redirect_form_vars;
}, redirect_timer * 1000);
}
else if(typeof _this.form_vars[id].refresh_page_after_submission!=="undefined"&&_this.form_vars[id].refresh_page_after_submission==1){
setTimeout(function(){
window.location.reload();
}, redirect_timer * 1000);
}}
}});
req.fail(function(jqXHR, testStatus, errorThrown){
_this.debug_message({ jqXHR: jqXHR, testStatus: testStatus, errorThrown: errorThrown });
_this.set_message(id, ezfc_vars.form_submit_error);
_this.submit_cancel($form);
return false;
});
};
this.calculate_get_external_values=function(form, form_id, el_object, el_type){
if(!el_object) return;
var value_external_element=el_object.data("value_external");
var value_external_listen=el_object.data("value_external_listen");
if(this.external_listeners[form_id][value_external_element]&&!value_external_listen) return;
if(value_external_element&&$(value_external_element).length > 0){
var value_external;
if($(value_external_element).is("input[type='radio']")){
value_external=$(value_external_element).find(":checked").val();
}
else if($(value_external_element).is("input, input[type='text'], textarea")){
value_external=$(value_external_element).val();
}
else if($(value_external_element).is("select")){
value_external=$(value_external_element).find(":selected").text();
}else{
value_external=$(value_external_element).text();
}
if(el_type=="input"||el_type=="numbers"||el_type=="subtotal"){
el_object.find("input").val(value_external);
}
else if(el_type=="dropdown"){
el_object.find(":selected").removeAttr("selected");
el_object.find("option[value='" + value_external + "']").attr("selected", "selected");
}
else if(el_type=="radio"){
el_object.find(":checked").removeAttr("checked");
el_object.find("input[value='" + value_external + "']").attr("checked", "checked");
}
else if(el_type=="checkbox"){
el_object.find(":checked").removeAttr("checked");
el_object.find("input[value='" + value_external + "']").attr("checked", "checked");
}
else if(el_type=="textfield"){
el_object.find("textarea").val(value_external);
}
if(!this.external_listeners[form_id][value_external_element]){
this.external_listeners[form_id][value_external_element]=1;
$(value_external_element).on("change keyup", function(){
_this.set_price($(form));
});
}}
};
this.calculate_conditionals=function(form, form_id, element_id, el_type, is_global){
var element=this.get_element_object(element_id);
var $element=this.get_element_dom(element_id);
if((!element_id||!element.hasOwnProperty("conditional"))&&!is_global) return;
var cond=element.conditional;
if(is_global) cond=element_id;
if(!cond) return;
var el_value=this.get_value_from_element($element, null, element.is_number==0);
var el_factor=this.get_element_object_value(element, "factor", 1);
for (var ic in cond.action){
var action=cond.action[ic];
if(!action||action==0) continue;
var $cond_target;
var cond_target_element_id=cond.target[ic];
var cond_target_element=_this.get_element_object(cond_target_element_id);
if(cond.target[ic]=="submit_button"||action=="redirect"){
$cond_target=$(form).find(".ezfc-submit");
}
else if(cond.target[ic]=="price"){
$cond_target=$(form).find(".ezfc-price-wrapper-element");
}else{
$cond_target=_this.get_element_dom(cond_target_element_id);
}
if(!$cond_target||($cond_target.length < 1&&cond.redirects.length < 1)) continue;
if(cond.use_factor[ic]==1){
el_factor=parseFloat(el_factor);
if(!isNaN(el_factor)){
el_value *=el_factor;
}}
var conditional_chain=[ { operator: cond.operator[ic], value: cond.values[ic], compare_target: _this.get_object_value(cond, "compare_value_first", "", ic) } ];
if(typeof cond.chain!=="undefined"&&typeof cond.chain[ic]!=="undefined"&&typeof cond.chain[ic].operator){
$.each(cond.chain[ic].operator, function(cn, operator_chain){
conditional_chain.push({ operator: cond.chain[ic].operator[cn], value: cond.chain[ic].value[cn], compare_target: cond.chain[ic].compare_target[cn] });
});
}
var do_action=false;
var do_action_count=0;
var conditional_chain_check_length=0;
$.each(conditional_chain, function(chain_index, chain_row){
if(chain_row.operator=="") return;
conditional_chain_check_length++;
var do_action_index=false;
var cond_custom_value=chain_row.value;
var cond_value_min_max=[];
var tmp_compare_value=el_value;
var compare_target_element=element;
if(chain_row.compare_target!=0&&chain_row.compare_target!=""){
tmp_compare_value=_this.get_value_from_element(false, chain_row.compare_target);
compare_target_element=_this.get_element_object(chain_row.compare_target);
}
if(chain_row.value=="__self__"){
chain_row.value=el_value;
}
if(element.is_number==1&&$.inArray(chain_row.operator, conditional_value_parse_exceptions_array)===-1&&compare_target_element.type!=="datepicker"){
cond_custom_value=parseFloat(chain_row.value);
}else{
cond_custom_value=chain_row.value;
}
if(chain_row.operator=="between"||chain_row.operator=="not_between"){
cond_value_min_max=chain_row.value.split(":");
if(cond_value_min_max.length > 1&&compare_target_element.type!=="datepicker"){
cond_value_min_max[0]=parseFloat(cond_value_min_max[0]);
cond_value_min_max[1]=parseFloat(cond_value_min_max[1]);
}}
if(compare_target_element.type==="datepicker"){
var target_element_child_input=_this.get_element_child_input_dom(compare_target_element.id);
if(!target_element_child_input) return;
var tmp_compare_value_date=$(target_element_child_input).datepicker("getDate");
if(_this.is_valid_date(tmp_compare_value_date)){
tmp_compare_value_date.setHours(0, 0, 0, 0);
tmp_compare_value=tmp_compare_value_date.getTime();
}
if(cond_value_min_max.length > 1){
cond_value_min_max=[
new Date(cond_value_min_max[0]),
new Date(cond_value_min_max[1]),
];
if(_this.is_valid_date(cond_value_min_max[0])) cond_value_min_max[0].setHours(0, 0, 0, 0);
if(_this.is_valid_date(cond_value_min_max[1])) cond_value_min_max[1].setHours(0, 0, 0, 0);
}else{
var cond_custom_value_date=new Date(cond_custom_value);
cond_custom_value_date.setHours(0, 0, 0, 0);
cond_custom_value=cond_custom_value_date.getTime();
}}
switch (chain_row.operator){
case "gr": do_action_index=tmp_compare_value > cond_custom_value;
break;
case "gre": do_action_index=tmp_compare_value >=cond_custom_value;
break;
case "less": do_action_index=tmp_compare_value < cond_custom_value;
break;
case "lesse": do_action_index=tmp_compare_value <=cond_custom_value;
break;
case "equals":
if(el_type=="input"){
do_action_index=cond_custom_value.toLowerCase()==$cond_target.val().toLowerCase();
}else{
do_action_index=tmp_compare_value==cond_custom_value;
}
break;
case "between":
if(cond_value_min_max.length < 2){
do_action_index=false;
}else{
do_action_index=(tmp_compare_value >=cond_value_min_max[0]&&tmp_compare_value <=cond_value_min_max[1]);
}
break;
case "not_between":
if(cond_value_min_max.length < 2){
do_action_index=false;
}else{
do_action_index=(tmp_compare_value < cond_value_min_max[0]||tmp_compare_value > cond_value_min_max[1]);
}
break;
case "not":
if(cond_value_min_max.length < 2){
do_action_index=tmp_compare_value!=cond_custom_value;
}else{
do_action_index=(tmp_compare_value < cond_value_min_max[0]&&tmp_compare_value > cond_value_min_max[1]);
}
break;
case "hidden": do_action_index = !_this.element_is_visible(element_id);
break;
case "visible": do_action_index=_this.element_is_visible(element_id);
break;
case "mod0": do_action_index=tmp_compare_value > 0&&(tmp_compare_value % cond_custom_value)==0;
break;
case "mod1": do_action_index=tmp_compare_value > 0&&(tmp_compare_value % cond_custom_value)!=0;
break;
case "bit_and": do_action_index=tmp_compare_value & cond_custom_value;
break;
case "bit_or": do_action_index=tmp_compare_value | cond_custom_value;
break;
case "empty":
if(typeof tmp_compare_value==="undefined"){
do_action_index=true;
}
if(typeof tmp_compare_value==="number"){
do_action_index=isNaN(tmp_compare_value);
}else{
do_action_index=tmp_compare_value.length < 1;
}
break;
case "notempty":
if(typeof tmp_compare_value==="undefined"){
do_action_index=false;
}
else if(typeof tmp_compare_value==="number"){
do_action_index = !isNaN(tmp_compare_value);
}else{
do_action_index=tmp_compare_value.length > 0;
}
break;
case "contains":
case "starts_with":
case "ends_with":
if(typeof tmp_compare_value==="undefined"){
do_action_index=false;
}else{
var str_compare_value=$.trim(String(cond_custom_value));
var str_compare_check=$.trim(String(tmp_compare_value));
if(chain_row.operator=="contains")         do_action_index=str_compare_check.includes(str_compare_value);
else if(chain_row.operator=="starts_with") do_action_index=str_compare_check.startsWith(str_compare_value);
else if(chain_row.operator=="ends_with")   do_action_index=str_compare_check.endsWith(str_compare_value);
}
break;
case "in":
if(typeof tmp_compare_value==="undefined"){
do_action_index=false;
}else{
do_action_index=_this.conditional_check_multiple_options(cond_custom_value, tmp_compare_value);
}
break;
case "not_in":
if(typeof tmp_compare_value==="undefined"){
do_action_index=false;
}else{
do_action_index = !_this.conditional_check_multiple_options(cond_custom_value, tmp_compare_value);
}
break;
case "once":
do_action_index=true;
if(typeof _this.conditional_once[form_id][element_id]==="undefined"){
_this.conditional_once[form_id][element_id]=[];
}
if(typeof _this.conditional_once[form_id][element_id][ic]==="undefined"){
_this.conditional_once[form_id][element_id][ic]=[];
}
if(typeof _this.conditional_once[form_id][element_id][ic][chain_index]==="undefined"){
_this.conditional_once[form_id][element_id][ic][chain_index]=1;
}else{
do_action_index=false;
}
break;
case "selected":
case "selected_index":
case "selected_id":
case "selected_count":
case "selected_count_gt":
case "selected_count_lt":
do_action_index=false;
var tmp_return_value="value";
if(chain_row.operator=="selected_index") tmp_return_value="index";
else if(chain_row.operator=="selected_id") tmp_return_value="option_id";
else if(chain_row.operator=="selected_count"||chain_row.operator=="selected_count_gt"||chain_row.operator=="selected_count_lt") tmp_return_value="count";
var tmp_value;
if(chain_row.compare_target!=0&&chain_row.compare_target!=""){
tmp_value=_this.get_value_from_element(false, chain_row.compare_target, true, false, { return_array: true, return_value: tmp_return_value });
}else{
tmp_value=_this.get_value_from_element($element, null, true, false, { return_array: true, return_value: tmp_return_value });
}
if(typeof tmp_value==="object"){
do_action_index=_this.conditional_check_multiple_options(cond_custom_value, tmp_value);
}else{
if(chain_row.operator=="selected_count") do_action_index=tmp_value==cond_custom_value;
else if(chain_row.operator=="selected_count_gt") do_action_index=tmp_value > cond_custom_value;
else if(chain_row.operator=="selected_count_lt") do_action_index=tmp_value < cond_custom_value;
else {
do_action_index=_this.conditional_check_multiple_options(cond_custom_value, tmp_value);
}}
break;
case "not_selected":
case "not_selected_index":
case "not_selected_id":
case "not_selected_count":
do_action_index=true;
var tmp_return_value="value";
if(chain_row.operator=="not_selected_index") tmp_return_value="index";
else if(chain_row.operator=="not_selected_id") tmp_return_value="option_id";
else if(chain_row.operator=="not_selected_count") tmp_return_value="count";
var tmp_value;
if(chain_row.compare_target!=0&&chain_row.compare_target!=""){
tmp_value=_this.get_value_from_element(false, chain_row.compare_target, true, false, { return_array: true, return_value: tmp_return_value });
}else{
tmp_value=_this.get_value_from_element($element, null, true, false, { return_array: true, return_value: tmp_return_value });
}
do_action_index = !_this.conditional_check_multiple_options(cond_custom_value, tmp_value);
break;
case "focus":
if($element.find(".ezfc-slider").length > 0){
do_action_index=$element.find("input").is(":focus")||$element.find(".ui-state-active").length > 0;
}else{
do_action_index=$element.find("input").is(":focus");
}
break;
case "blur":
if($element.find(".ezfc-slider").length > 0){
do_action_index = !$element.find("input").is(":focus")&&$element.find(".ui-state-active").length < 1;
}else{
do_action_index = !$element.find("input").is(":focus");
}
break;
case "always":
do_action_index=true;
break;
case "step_equals":
var current_step=_this.current_steps[form_id];
do_action_index=current_step==cond_custom_value;
break;
case "step_gt":
var current_step=_this.current_steps[form_id];
do_action_index=current_step > cond_custom_value;
break;
case "step_lt":
var current_step=_this.current_steps[form_id];
do_action_index=current_step < cond_custom_value;
break;
case "calculate_enabled":
do_action_index=_this.get_element_object_value(element, "calculate_enabled", 1)==1;
break;
case "calculate_disabled":
do_action_index=_this.get_element_object_value(element, "calculate_enabled", 1)==0;
break;
case "triggered":
if(!compare_target_element) do_action_index=false;
else do_action_index=_this.element_trigger_id==compare_target_element.id;
break;
default:
do_action_index=false;
break;
}
if(typeof cond.row_operator[ic]!=="undefined"&&cond.row_operator[ic]==1){
if(do_action_index){
do_action_count++;
do_action=true;
return false;
}}else{
if(!do_action_index) return;
do_action_count++;
}});
if(do_action_count > 0&&do_action_count==conditional_chain_check_length){
do_action=true;
}
var js_action, js_counter_action;
var cond_notoggle_element=cond.notoggle[ic];
var cond_target_type=$cond_target.data("element");
var tmp_custom_value=cond.target_value[ic];
tmp_custom_value=tmp_custom_value.replace(/__self__/gi, el_value);
if(cond_target_type=="group"){
$cond_target.push($($cond_target).find("> .ezfc-custom-element"));
}
if((action=="set"||action=="add_text")&&do_action){
var tmp_custom_value_inline_math=_this.check_inline_math(tmp_custom_value, $cond_target);
if(action=="add_text"){
var tmp_text=$cond_target.find("input").val();
tmp_custom_value_inline_math=tmp_text + tmp_custom_value;
}
if(cond_target_type=="input"||cond_target_type=="hidden"||cond_target_type=="numbers"||cond_target_type=="subtotal"||cond_target_type=="set"){
_this.set_element_object_value(cond_target_element_id, "current_value", tmp_custom_value_inline_math);
_this.set_element_object_value(cond_target_element_id, "current_value_forced", tmp_custom_value_inline_math);
$cond_target.find("input").val(tmp_custom_value_inline_math).trigger("blur");
}
else if(cond_target_type=="dropdown"){
$cond_target.find(":selected").removeAttr("selected");
$cond_target.find("option[data-value='" + tmp_custom_value_inline_math + "']").prop("selected", "selected");
}
else if(cond_target_type=="radio"){
_this.radio_change_state($cond_target.find("input[data-value='" + tmp_custom_value_inline_math + "']"), true, true);
}
else if(cond_target_type=="checkbox"){
_this.checkbox_change_state($cond_target.find("input[data-value='" + tmp_custom_value_inline_math + "']"), true, true);
}
else if(cond_target_type=="datepicker"){
var $datepicker_element=$cond_target.find("input.hasDatepicker");
if($datepicker_element.length){
$datepicker_element.datepicker("setDate", tmp_custom_value);
}}
else if(cond_target_type=="daterange"){
var $datepicker_element=$cond_target.find("input.hasDatepicker");
if($datepicker_element.length > 1){
var daterange_values=tmp_custom_value.split(";;");
if(typeof daterange_values[0]!=="undefined") $($datepicker_element[0]).datepicker("setDate", daterange_values[0]);
if(typeof daterange_values[1]!=="undefined") $($datepicker_element[1]).datepicker("setDate", daterange_values[1]);
}}
else if(cond_target_type=="image"){
$cond_target.find("img").attr("src", tmp_custom_value);
}else{
$cond_target.text(tmp_custom_value_inline_math);
}}
else if(action=="set_factor"&&do_action){
_this.set_element_object_value(cond_target_element_id, "factor", tmp_custom_value);
}
else if(action=="select_option"&&do_action){
var tmp_custom_values_array=tmp_custom_value.split("|");
for (var i in tmp_custom_values_array){
var tmp_custom_value_index=tmp_custom_values_array[i];
if(cond_target_type=="radio"){
_this.radio_change_state($cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']"), true, true);
}
else if(cond_target_type=="checkbox"){
_this.checkbox_change_state($cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']"), true, true);
}
else if(cond_target_type=="dropdown"){
$cond_target.find(":selected").removeAttr("selected");
$cond_target.find("option[data-optionid='" + tmp_custom_value_index + "']").prop("selected", "selected");
}}
}
else if((action=="deselect_option"||action=="deselect_all_options")&&do_action){
var tmp_custom_values_array=tmp_custom_value.split("|");
for (var i in tmp_custom_values_array){
var tmp_custom_value_index=tmp_custom_values_array[i];
var find_input_selector="input[data-optionid='" + tmp_custom_value_index + "']";
if(action=="deselect_all_options"){
find_input_selector=":selected, :checked";
}
if(cond_target_type=="radio"){
_this.radio_change_state($cond_target.find(find_input_selector), false, true);
}
else if(cond_target_type=="checkbox"){
_this.checkbox_change_state($cond_target.find(find_input_selector), false, true);
}
else if(cond_target_type=="dropdown"){
$cond_target.find(":selected").removeAttr("selected");
}}
}
else if(action=="show_option"){
var tmp_custom_values_array=tmp_custom_value.split("|");
for (var i in tmp_custom_values_array){
var tmp_custom_value_index=tmp_custom_values_array[i];
if(do_action){
if(cond_target_type=="radio"||cond_target_type=="checkbox"){
$cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']").closest(".ezfc-element-single-option-container").show();
}
else if(cond_target_type=="dropdown"){
$cond_target.find("option[data-optionid='" + tmp_custom_value_index + "']").removeAttr("hidden");
}}else{
if(cond_target_type=="radio"){
_this.radio_change_state($cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']"), false, true);
$cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']").closest(".ezfc-element-single-option-container").hide();
}
else if(cond_target_type=="checkbox"){
_this.checkbox_change_state($cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']"), false, true);
$cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']").closest(".ezfc-element-single-option-container").hide();
}
else if(cond_target_type=="dropdown"){
$cond_target.find(":selected").removeAttr("selected");
$cond_target.find("option[data-optionid='" + tmp_custom_value_index + "']").attr("hidden", true);
}}
}}
else if(action=="hide_option"){
var tmp_custom_values_array=tmp_custom_value.split("|");
for (var i in tmp_custom_values_array){
var tmp_custom_value_index=tmp_custom_values_array[i];
if(do_action){
if(cond_target_type=="radio"){
_this.radio_change_state($cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']"), false, true);
$cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']").closest(".ezfc-element-single-option-container").hide();
}
else if(cond_target_type=="checkbox"){
_this.checkbox_change_state($cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']"), false, true);
$cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']").closest(".ezfc-element-single-option-container").hide();
}
else if(cond_target_type=="dropdown"){
$cond_target.find("option[data-optionid='" + tmp_custom_value_index + "']").attr("hidden", true).removeAttr("selected");
}}else{
if(cond_target_type=="radio"||cond_target_type=="checkbox"){
$cond_target.find("input[data-optionid='" + tmp_custom_value_index + "']").closest(".ezfc-element-single-option-container").show();
}
else if(cond_target_type=="dropdown"){
$cond_target.find("option[data-optionid='" + tmp_custom_value_index + "']").removeAttr("hidden");
}}
}}
else if(action=="activate"){
if(do_action){
if(cond_target_type=="submit"){
$cond_target.prop("disabled", false);
}
else if(cond_target_type=="group"){
var group_children=_this.get_group_children(cond_target_element_id);
_this.set_element_list_object_value(group_children, "calculate_enabled", 1);
}else{
_this.set_element_object_value(cond_target_element_id, "calculate_enabled", 1);
}}
else if(cond_notoggle_element!=1){
if(cond_target_type=="submit"){
$cond_target.prop("disabled", true);
}
else if(cond_target_type=="group"){
var group_children=_this.get_group_children(cond_target_element_id);
_this.set_element_list_object_value(group_children, "calculate_enabled", 0);
}else{
_this.set_element_object_value(cond_target_element_id, "calculate_enabled", 0);
}}
}
else if(action=="activate_option"){
var find_option_id="[data-optionid='" + cond.option_index_value[ic] + "']";
if(do_action){
$cond_target.find(find_option_id).prop("disabled", false).removeClass("force-disabled");
}else{
$cond_target.find(find_option_id).prop("disabled", true).addClass("force-disabled");
}}
else if(action=="deactivate"){
if(do_action){
if(cond_target_type=="submit"){
$cond_target.prop("disabled", true);
}
else if(cond_target_type=="group"){
var group_children=_this.get_group_children(cond_target_element_id);
_this.set_element_list_object_value(group_children, "calculate_enabled", 0);
}else{
_this.set_element_object_value(cond_target_element_id, "calculate_enabled", 0);
}}
else if(cond_notoggle_element!=1){
if(cond_target_type=="submit"){
$cond_target.prop("disabled", false);
}
else if(cond_target_type=="group"){
var group_children=_this.get_group_children(cond_target_element_id);
_this.set_element_list_object_value(group_children, "calculate_enabled", 1);
}else{
_this.set_element_object_value(cond_target_element_id, "calculate_enabled", 1);
}}
}
else if(action=="deactivate_option"){
var find_option_index="[data-optionid='" + cond.option_index_value[ic] + "']";
if(do_action){
$cond_target.find(find_option_index).prop("disabled", true).addClass("force-disabled");
}else{
$cond_target.find(find_option_index).prop("disabled", false).removeClass("force-disabled");
}}
else if(action=="redirect"&&do_action){
var message_wrapper=$(form).parents(".ezfc-wrapper").find(".ezfc-message");
message_wrapper.text(_this.form_vars[form_id].redirect_text).fadeIn();
$(form).fadeOut();
setTimeout(function(){
window.location.href=cond.redirects[ic];
}, _this.form_vars[form_id].redirect_timer * 1000);
}
else if((action=="step_goto"||action=="step_prev"||action=="step_next")&&do_action){
_this.set_step_action(form_id, action, cond.target[ic]);
}
else if((action=="set_min"||action=="set_max")&&do_action){
var action_attr=action=="set_min" ? "min":"max";
var action_attr_opposite=action=="set_min" ? "max":"min";
var $cond_target_input=$cond_target.find(":input");
var slider_custom_value=parseFloat(tmp_custom_value);
var slider_min=$cond_target_input.data("min");
var slider_max=$cond_target_input.data("max");
if(action=="set_min"&&slider_custom_value > slider_max) continue;
if(action=="set_max"&&slider_custom_value < slider_min) continue;
$cond_target_input.data(action_attr, slider_custom_value).trigger("ezfc_blur_trigger");
if($cond_target_input.hasClass("ezfc-slider")){
var $cond_target_slider=$cond_target.find(".ezfc-slider-element");
if(typeof $cond_target_slider.slider!=="undefined"&&$cond_target_slider.slider("instance")!==undefined){
$cond_target_slider.slider("option", action_attr, slider_custom_value);
}}
}
else if(action=="set_min_selectable"&&do_action){
$cond_target.attr("data-min_selectable", tmp_custom_value);
_this.checkbox_change($cond_target);
}
else if(action=="set_max_selectable"&&do_action){
$cond_target.attr("data-max_selectable", tmp_custom_value);
_this.checkbox_change($cond_target);
}
else if(action=="add_class"){
var tmp_action=do_action ? "addClass":"removeClass";
$cond_target[tmp_action](tmp_custom_value);
}
else if(action=="remove_class"){
var tmp_action=do_action ? "removeClass":"addClass";
$cond_target[tmp_action](tmp_custom_value);
}
else if(action=="set_color"&&do_action){
$cond_target.find("input, select, .ezfc-price, .ezfc-element-checkbox-text, .ezfc-text-wrapper").css("color", tmp_custom_value);
if(cond_target_type=="submit") $cond_target.css("color", tmp_custom_value);
}
else if(action=="calc_routine_enable"){
var calculation_routine_id=parseInt(tmp_custom_value);
if(!isNaN(calculation_routine_id)){
calculation_routine_id -=1;
if(cond_target_element.hasOwnProperty("calculate_routine")&&typeof cond_target_element.calculate_routine[calculation_routine_id]==="object"){
cond_target_element.calculate_routine[calculation_routine_id].activated=do_action;
}}
}
else if(action=="calc_routine_enable_name"){
if(tmp_custom_value.length > 0&&cond_target_element.hasOwnProperty("calculate_routine")){
var calculation_routines=_this.get_calculation_routine_by_name(cond_target_element, tmp_custom_value);
for (var cri in calculation_routines){
if(typeof cond_target_element.calculate_routine[calculation_routines[cri]]==="object"){
cond_target_element.calculate_routine[calculation_routines[cri]].activated=do_action;
}}
}}
else if(action=="calc_routine_disable"){
var calculation_routine_id=parseInt(tmp_custom_value);
if(!isNaN(calculation_routine_id)){
calculation_routine_id -=1;
if(cond_target_element.hasOwnProperty("calculate_routine")&&typeof cond_target_element.calculate_routine[calculation_routine_id]==="object"){
cond_target_element.calculate_routine[calculation_routine_id].activated = !do_action;
}}
}
else if(action=="calc_routine_disable_name"){
if(tmp_custom_value.length > 0&&cond_target_element.hasOwnProperty("calculate_routine")){
var calculation_routines=_this.get_calculation_routine_by_name(cond_target_element, tmp_custom_value);
for (var cri in calculation_routines){
if(typeof cond_target_element.calculate_routine[calculation_routines[cri]]==="object"){
cond_target_element.calculate_routine[calculation_routines[cri]].activated = !do_action;
}}
}}else{
_this.call_conditional_action(do_action, action, $cond_target, cond_target_element_id, cond_notoggle_element, tmp_custom_value);
}}
};
this.conditional_actions={
class_hidden: "ezfc-hidden ezfc-custom-hidden",
class_visible: "ezfc-fade-in",
show: function(do_action, $target_element, element, notoggle){
$target_element.addClass(_this.conditional_actions.class_visible).removeClass(_this.conditional_actions.class_hidden);
if(element&&element.type=="group"){
$target_element.find(".ezfc-element").addClass(_this.conditional_actions.class_visible).removeClass(_this.conditional_actions.class_hidden);
}
if(!do_action&&notoggle!=1){
_this.conditional_actions.hide(true, $target_element, element);
}},
hide: function(do_action, $target_element, element, notoggle){
$target_element.addClass(_this.conditional_actions.class_hidden).removeClass(_this.conditional_actions.class_visible);
if(element&&element.type=="group"){
$target_element.find(".ezfc-element").addClass(_this.conditional_actions.class_hidden).removeClass(_this.conditional_actions.class_visible);
}
if(!do_action&&notoggle!=1){
_this.conditional_actions.show(true, $target_element, element);
}}
};
this.call_conditional_action=function(do_action, action, $target_element, target_element_id, notoggle, custom_value){
if(!this.conditional_actions.hasOwnProperty(action)) return;
var element;
if(target_element_id=="submit_button"){
element=null;
}else{
element=this.get_element_object(target_element_id);
if(!element) return;
}
this.conditional_actions[action](do_action, $target_element, element, notoggle, custom_value);
};
this.calculate_element=function(form_id, element_id, loop_price){
if(!form_id&&element_id) form_id=$("#ezfc_element-" + element_id).closest(".ezfc-form").data("id");
var $element=this.get_element_dom(element_id);
var element=this.get_element_object(element_id);
var parent_id=this.get_repeatable_parent_id(element_id);
if(typeof element==="undefined") return;
if(!$element){
this.debug_message("Unable to find element #" + element_id, 2);
return;
}
if(parent_id){
form_id=this.get_element_object_value(parent_id, "form_id", 0);
}
var calc_rows=typeof element.calculate==="undefined" ? []:element.calculate;
var calc_enabled=element.calculate_enabled;
var add_to_price=element.add_to_price;
var el_type=element.type;
var form_has_steps=_this.form_vars[form_id].has_steps;
var overwrite_price=element.overwrite_price;
var price=0;
var value=_this.get_value_from_element($element, null, false);
if(el_type=="subtotal"||el_type=="custom_calculation"||el_type=="extension"){
price=loop_price;
}
if(el_type=="extension"){
calc_rows=[];
}
var calculate_when_zero=this.get_element_object_value(element, "calculate_when_zero", 1);
if(calculate_when_zero==0&&price==0) return;
var calc_list=$element.find(".ezfc-element-numbers, .ezfc-element-input-hidden, .ezfc-element-subtotal, .ezfc-element-daterange-container, .ezfc-element-set, .ezfc-element-extension, :selected, :checked, .ezfc-element-custom-calculation, .ezfc-element-table_order");
var operator_no_check=["ceil", "floor", "round", "abs", "subtotal"];
$(calc_list).each(function(cl, cl_object){
if((typeof calc_rows==="undefined"||calc_rows.length==0)&&el_type!="custom_calculation"&&el_type!="repeatable_form") return;
var check_visible=_this.element_is_visible(element_id);
if(!check_visible&&element.calculate_when_hidden==0&&el_type!="hidden"&&el_type!="custom_calculation"){
_this.add_debug_info("calculate", $element, "Skipped as element is hidden and calculate_when_hidden is not enabled.");
return;
}
if((!calc_enabled||calc_enabled==0) &&
!calc_rows.targets &&
!calc_rows.values &&
el_type!="set" &&
el_type!="subtotal" &&
el_type!="hidden" &&
el_type!="extension" &&
el_type!="custom_calculation" &&
el_type!="repeatable_form"){
_this.add_debug_info("calculate", $element, "No target or values were found to calculate with. Subtotal, Hidden and Set elements are skipped.");
return;
}
if((!calc_enabled||calc_enabled==0)&&el_type!="custom_calculation"){
_this.add_debug_info("calculate", $element, "Calculation is disabled.");
return;
}
var factor=parseFloat(_this.get_element_object_value(element, "factor", 1));
var value_raw=$(cl_object).val();
var value_pct=value / 100;
var value_is_pct=false;
if(!value||isNaN(value)) value=0;
if((!factor||isNaN(factor))&&factor!==0) factor=1;
var addPrice=value;
switch (el_type){
case "numbers":
case "extension":
case "hidden":
addPrice=value;
break;
case "dropdown":
case "radio":
case "checkbox":
addPrice=parseFloat($(cl_object).data("value"));
if(isNaN(addPrice)) addPrice=0;
break;
case "subtotal":
addPrice=loop_price;
break;
case "daterange":
var tmp_target_value=[
$(cl_object).find(".ezfc-element-daterange-from").datepicker("getDate"),
$(cl_object).find(".ezfc-element-daterange-to").datepicker("getDate")
];
addPrice=_this.jqueryui_date_diff(tmp_target_value[0], tmp_target_value[1], _this.get_element_object_value(element, "workdays_only", 0)==1, element) * factor;
break;
case "custom_calculation":
var function_name=$($element).find(".ezfc-element-custom-calculation").data("function");
try {
addPrice=window[function_name](price);
}
catch (err){
_this.add_debug_info("custom_calculation", $element, "--- Custom Calculation Error ---\n" + err);
addPrice=0;
}
if(calc_enabled){
addPrice=parseFloat(addPrice);
}
$($element).find(".ezfc-element-custom-calculation-input").val(addPrice);
if(ezfc_vars.debug_mode==2){
var function_text=$($element).find(".ezfc-element-custom-calculation script").text();
_this.add_debug_info("custom_calculation", $element, "custom_calculation:\n" + function_text);
}
break;
case "table_order":
var tmp_total=0;
var tmp_element=_this.get_element_object(element_id);
var table_order_loop_func=_this.get_element_object_value(tmp_element, "table_order_loop_function", "");
$.each(tmp_element.table_order, function(i, row){
var $input_id=$element.find(".ezfc-element-table_order-row[data-row='" + i + "'] .ezfc-element-table_order-quantity-input");
var qty=_this.normalize_value($input_id.val());
var row_add_text="";
var row_total=parseFloat(row.value) * qty;
var table_order_loop_func_result;
if(typeof window[table_order_loop_func]==="function"){
table_order_loop_func_result=window[table_order_loop_func](row_total, qty, i, form_id, element_id, tmp_element);
}
var row_total_before=row_total;
if(typeof table_order_loop_func_result==="object"){
row_total=_this.get_element_object_value(table_order_loop_func_result, "value", row_total);
row_add_text=_this.get_element_object_value(table_order_loop_func_result, "text", "");
}
var row_total_format_value=row_total;
if(row_total_before!=row_total){
row_total_format_value=row_total_before;
}
var row_total_formatted=_this.format_price(form_id, row_total_format_value, null, null, tmp_element.is_currency);
row_total_formatted    +=row_add_text;
tmp_total +=row_total;
$element.find(".ezfc-element-table_order-row[data-row='" + i + "'] .ezfc-element-table_order-subtotal").html(row_total_formatted);
});
addPrice=tmp_total;
break;
}
if(value_is_pct){
addPrice=price * value * 100;
}
var calc_rows_loop=[];
if(typeof calc_rows[0]!=="undefined"){
calc_rows_loop=calc_rows.slice(0);
}
if(element.hasOwnProperty("calculate_routine")){
for (var cr_index in element.calculate_routine){
if(element.calculate_routine[cr_index].activated&&typeof calc_rows[0]!=="undefined"){
for (var cr_row_index in element.calculate_routine[cr_index].calculation_rows){
calc_rows_loop.push(element.calculate_routine[cr_index].calculation_rows[cr_row_index]);
}}
}}
if(typeof calc_rows_loop[0]!=="undefined"){
for (var c_open in calc_rows){
if(calc_rows[c_open].target=="__open__"&&typeof calc_rows[c_open].reference_index==="undefined"){
calc_rows[c_open].prio=parseInt(calc_rows[c_open].prio);
if(isNaN(calc_rows[c_open].prio)){
calc_rows[c_open].prio=0;
}
for (var c_close in calc_rows){
if(c_open==c_close) continue;
calc_rows[c_close].prio=parseInt(calc_rows[c_close].prio);
if(isNaN(calc_rows[c_close].prio)){
calc_rows[c_close].prio=0;
}
if(calc_rows[c_close].target=="__close__"&&calc_rows[c_open].prio==calc_rows[c_close].prio&&typeof calc_rows[c_open].reference_index==="undefined"&&typeof calc_rows[c_close].reference_index==="undefined"){
calc_rows[c_close].operator=calc_rows[c_open].operator;
calc_rows[c_close].reference_index=c_open;
calc_rows[c_open].reference_index=c_close;
}}
}}
$.each(calc_rows_loop, function(n, calc_row){
if((!calc_row.operator||calc_row.operator==0)&&calc_row.target!="__close__"){
_this.add_debug_info("calculate", $element, "#" + n + ": No operator found here.");
return;
}
if(calc_row.target=="__open__"){
calc_row.value=addPrice;
addPrice=0;
return;
}
var $calc_target=[];
var target_element=[];
if($.inArray(calc_row.operator, operator_no_check)===-1&&calc_row.target!="__open__"&&calc_row.target!="__close__"){
$calc_target=_this.get_element_dom(calc_row.target);
target_element=_this.get_element_object(calc_row.target);
if(!_this.element_is_visible(calc_row.target)&&target_element.calculate_when_hidden==0){
_this.add_debug_info("calculate", $element, "#" + n + ": Skipping this element as it is conditionally hidden.");
if(n==0&&calc_row.operator=="equals") addPrice=0;
return;
}}
var calc_value=calc_row.value;
var target_value;
var calc_target_id=0;
if(calc_row.target=="__close__"){
if(typeof calc_rows[calc_row.reference_index]==="undefined") return;
target_value=addPrice;
addPrice=calc_rows[calc_row.reference_index].value;
}else{
if($calc_target.length > 0){
calc_target_id=target_element.id;
if(typeof calc_row.use_calculated_target_value==="undefined"){
calc_row.use_calculated_target_value=0;
}
if(calc_row.use_calculated_target_value==0){
target_value=_this.get_value_from_element(null, calc_target_id, false);
}
else if(calc_row.use_calculated_target_value==1){
target_value=_this.get_target_subtotal_value(form_id, calc_target_id) + _this.get_calculated_element_value(form_id, calc_target_id);
}
else if(calc_row.use_calculated_target_value==2){
target_value=_this.get_calculated_element_value(form_id, calc_target_id);
}
else if(calc_row.use_calculated_target_value==3){
target_value=_this.get_value_from_element($calc_target, null, false, true);
}
else if(calc_row.use_calculated_target_value==4){
target_value=_this.get_value_from_element($calc_target, null, true, false, { return_array: false, return_value: "count" });
}}
else if(calc_value!=0){
target_value=parseFloat(calc_value);
}}
if(!target_value||isNaN(target_value)) target_value=0;
if(element.precision!=""){
target_value=parseFloat(_this.roundTo(target_value, element.precision));
}
switch (calc_row.operator){
case "add":	addPrice +=target_value;
break;
case "subtract": addPrice -=target_value;
break;
case "multiply": addPrice *=target_value;
break;
case "divide":
if(target_value==0){
_this.add_debug_info("calculate", $element, "#" + n + ": Division by 0.");
addPrice=0;
}else{
addPrice /=target_value;
if($(cl_object).data("calculate_before")=="1"){
overwrite_price=1;
addPrice=target_value / value;
}}
break;
case "equals": addPrice=target_value;
break;
case "power": addPrice=Math.pow(addPrice, target_value);
break;
case "ceil": addPrice=Math.ceil(addPrice);
break;
case "floor": addPrice=Math.floor(addPrice);
break;
case "min": addPrice=Math.min(addPrice, target_value);
break;
case "max": addPrice=Math.max(addPrice, target_value);
break;
case "minmax":
var minmax=String(calc_value).split(":");
if(minmax.length < 2) return;
addPrice=Math.max(Math.min(addPrice, minmax[1]), minmax[0]);
break;
case "round": addPrice=Math.round(addPrice);
break;
case "roundx": addPrice=_this.roundTo(addPrice, target_value);
break;
case "abs": addPrice=Math.abs(addPrice);
break;
case "subtotal": addPrice=loop_price;
break;
case "log":
if(target_value==0) return;
addPrice=Math.log(target_value);
break;
case "log2":
if(target_value==0) return;
addPrice=Math.log2(target_value);
break;
case "log10":
if(target_value==0) return;
addPrice=Math.log10(target_value);
break;
case "sqrt": addPrice=Math.sqrt(addPrice);
break;
case "function":
var function_name=_this.get_element_object_value(calc_row, "data", "");
if(function_name.length&&typeof window[function_name]==="function"){
var function_price=parseFloat(window[function_name](addPrice, target_value));
if(!isNaN(function_price)){
addPrice=function_price;
}}
break;
}
_this.add_debug_info("calculate", $element, "#" + n + ": operator=" + calc_row.operator + "\ntarget_value=" + target_value + "\ntarget_element=#" + calc_target_id + "\ncalc_value=" + calc_value + "\naddPrice=" + addPrice);
});
}
if(add_to_price==1){
price +=addPrice;
}
else if(add_to_price==2){
price=addPrice;
}
if(overwrite_price==1){
price=addPrice;
}
_this.add_debug_info("calculate", $element, "===\nprice=" + price + "\naddPrice=" + addPrice + "\nloop_price="+ loop_price + "\nvalue=" + value + "\nfactor=" + factor);
});
if(typeof element.inline_calculation!=="undefined"&&typeof window[element.inline_calculation]==="function"){
try {
price=window[element.inline_calculation](price);
_this.add_debug_info("calculate", $element, "===\ninline calculation=" + price);
}
catch(e){
_this.add_debug_info("calculate", $element, "===\nInvalid inline calculation!");
}}
if(this.get_element_object_value(element, "force_use_value_enabled", 0)==1){
price=this.get_element_object_value(element, "force_use_value", 0);
}
var element_min_value=this.get_element_object_value(element, "min", "");
var element_max_value=this.get_element_object_value(element, "max", "");
if(element_min_value!=""){
element_min_value=parseFloat(element_min_value);
price=Math.max(element_min_value, price);
}
if(element_max_value!=""){
element_max_value=parseFloat(element_max_value);
price=Math.min(element_max_value, price);
}
return price;
};
this.calculate_element_loop=function(element_id, price, read_only){
var element=this.get_element_object(element_id);
var $element=this.get_element_dom(element_id);
var form_id=element.form_id;
var calc_enabled=element.calculate_enabled;
var overwrite_price=element.overwrite_price;
var add_to_price=element.add_to_price;
var tmp_price;
var addPrice=0;
if(calc_enabled==0){
addPrice=0;
}
else if(calc_enabled==1){
addPrice=this.calculate_element(form_id, element_id, price);
addPrice=this.calculate_discounts(element_id, addPrice, addPrice);
if(add_to_price >=1){
if(overwrite_price==1){
price=addPrice;
}else{
price +=addPrice;
}}else{
if(overwrite_price==1){
tmp_price=addPrice;
}}
}
if((element.type=="subtotal"||element.type=="set"||element.type=="custom_calculation")&&!read_only){
var $element_input=this.get_element_child_input_dom(element_id);
if(calc_enabled==0){
tmp_price=0;
}
else if(calc_enabled==1){
if(add_to_price==1){
tmp_price=overwrite_price==1 ? price:addPrice;
}
else if(add_to_price==2){
tmp_price=addPrice;
}else{
tmp_price=addPrice;
}}
$element_input.val(tmp_price);
$element_input.data("converted", 0);
this.set_element_object_value(element, "current_value_forced", tmp_price);
}
return price;
};
this.calculate_discounts=function(element_id, price, custom_value){
var element=this.get_element_object(element_id);
var $element=this.get_element_dom(element_id);
var $element_input=this.get_element_child_input_dom(element_id);
var overwrite_price=this.get_element_object_value(element, "overwrite_price", 0);
if(!element||!element_id||!this.object_has_property(element, "discount")) return price;
var discount=element.discount;
if(discount){
var discount_range_min_values=discount.range_min;
var discount_range_max_values=discount.range_max;
var discount_operator_values=discount.operator;
var discount_value_values=discount.values;
var discount_value_type=this.get_element_object_value(element, "discount_value_type", "calculated");
var discount_value_apply=this.get_element_object_value(element, "discount_value_apply", "calculated");
var el_value=0;
var el_value_calculated;
var factor=this.get_element_object_value(element, "factor_default", 1);
if((!factor||isNaN(factor))&&factor!==0) factor=1;
factor=parseFloat(factor);
_this.set_element_object_value(element, "factor", factor);
if(element.type=="input"||element.type=="numbers"||element.type=="subtotal"||element.type=="hidden"||element.type=="extension"){
el_value=this.normalize_value($element_input.val(), $element, null, $element_input.data("converted")==0);
}
else if(element.type=="dropdown"){
el_value=parseFloat($element.find(":selected").data("value"));
}
else if(element.type=="radio"){
el_value=parseFloat($element.find(":checked").data("value"));
}
else if(element.type=="checkbox"){
el_value=0;
$element.find(":checked").each(function(ct, ct_el){
el_value +=parseFloat($(ct_el).data("value"));
});
}
else if(element.type=="daterange"){
var tmp_target_value=[
$element.find(".ezfc-element-daterange-from").datepicker("getDate"),
$element.find(".ezfc-element-daterange-to").datepicker("getDate")
];
el_value=_this.jqueryui_date_diff(tmp_target_value[0], tmp_target_value[1], _this.get_element_object_value(element, "workdays_only", 0)==1, element, discount_value_type);
el_value_calculated=_this.jqueryui_date_diff(tmp_target_value[0], tmp_target_value[1], _this.get_element_object_value(element, "workdays_only", 0)==1, element);
}
if(!el_value_calculated&&el_value_calculated!=0){
el_value_calculated=el_value;
}
if(discount_value_type=="calculated"&&typeof custom_value!=="undefined"){
el_value=custom_value;
}
var el_value_factor=el_value * factor;
var discount_compare_value=el_value;
var discount_active_ids=[];
$.each(discount_operator_values, function(id, operator){
if(discount_value_values[id].length < 1) return;
if(!discount_range_min_values[id]&&discount_range_min_values[id]!==0) discount_range_min_values[id]=Number.NEGATIVE_INFINITY;
if(!discount_range_max_values[id]&&discount_range_max_values[id]!==0) discount_range_max_values[id]=Number.POSITIVE_INFINITY;
var discount_value_write_to_input;
if(discount_compare_value >=parseFloat(discount_range_min_values[id])&&discount_compare_value <=parseFloat(discount_range_max_values[id])){
var disc_value_raw=discount_value_values[id];
var disc_value=parseFloat(disc_value_raw);
var discount_value_operator;
discount_active_ids.push(id);
if(discount_value_apply=="calculated"){
el_value=el_value_calculated;
}
switch (operator){
case "add":
discount_value_operator=disc_value;
discount_value_write_to_input=price + discount_value_operator;
if(overwrite_price){
price=discount_value_write_to_input;
}else{
price +=discount_value_write_to_input;
}
break;
case "subtract":
discount_value_operator=disc_value;
discount_value_write_to_input=price - discount_value_operator;
if(overwrite_price){
price=discount_value_write_to_input;
}else{
price -=discount_value_write_to_input;
}
break;
case "percent_add":
discount_value_operator=el_value_factor * (disc_value / 100);
discount_value_write_to_input=el_value_factor + discount_value_operator;
price=discount_value_write_to_input;
break;
case "percent_sub":
discount_value_operator=el_value_factor * (disc_value / 100);
discount_value_write_to_input=el_value_factor - discount_value_operator;
price=discount_value_write_to_input;
break;
case "equals":
discount_value_operator=disc_value;
discount_value_write_to_input=discount_value_operator;
price=discount_value_write_to_input;
break;
case "factor":
discount_value_operator=el_value * disc_value;
discount_value_write_to_input=discount_value_operator;
_this.set_element_object_value(element, "factor", disc_value);
price=discount_value_write_to_input;
break;
case "price_plus_factor":
var discount_value_inputs=disc_value_raw.split("|");
if(discount_value_inputs&&discount_value_inputs.length >=2){
discount_value_inputs=$.map(discount_value_inputs, parseFloat);
var base_price=discount_value_inputs[0];
var base_factor=discount_value_inputs[1];
discount_value_operator=base_price + base_factor * el_value;
discount_value_write_to_input=discount_value_operator;
_this.set_element_object_value(element, "factor", base_factor);
price=discount_value_write_to_input;
}
break;
}
if(element.type=="subtotal"&&!isNaN(discount_value_write_to_input)){
var $element_input=$($element).find("input");
$element_input.val(discount_value_write_to_input);
$element_input.data("converted", 0);
}
_this.add_debug_info("discount", $element, "discount=" + discount_value_operator + "\nprice after discount=" + price);
}});
_this.set_element_object_value(element, "__discount_table_active_ids", discount_active_ids);
}
return price;
};
this.discount_table_update=function(element){
var active_ids=_this.get_element_object_value(element, "__discount_table_active_ids", []);
var table_cache=_this.get_element_object_value(element, "__discount_table_dom_cached", false);
var highlight_class="ezfc-element-discount-table-highlighted";
var $table;
if(table_cache){
$table=table_cache;
}else{
var $element=_this.get_element_dom(element.id);
$table=$element.find(".ezfc-element-discount-table tbody");
_this.set_element_object_value(element, "__discount_table_dom_cached", $table);
}
$table.find(".ezfc-element-discount-table-highlighted").removeClass(highlight_class);
if(!active_ids) return;
var $table_rows=$table.find("tr");
for (var i in active_ids){
$table_rows.eq(active_ids[i]).addClass(highlight_class);
}};
this.calculate_set_elements=function(form, form_id, el_object, el_type, price){
var element=this.get_element_object(el_object.data("id"));
var set_operator=this.get_element_object_value(element, "set_operator");
var tmp_targets=this.get_element_object_value(element, "set_elements");
var allow_zero=this.get_element_object_value(element, "set_allow_zero")==1;
var set_dom_selector=this.get_element_object_value(element, "set_dom_selector");
var use_factor=this.get_element_object_value(element, "set_use_factor", 1);
var targets=[];
var value_to_write;
if(!tmp_targets&&!set_dom_selector) return;
if(set_dom_selector){
targets=$(set_dom_selector);
}else{
var tmp_targets_elements=tmp_targets;
$.each(tmp_targets_elements, function(i, v){
var $target_object=$("#ezfc_element-" + v);
if(!$target_object) return;
targets.push($target_object);
});
}
$.each(targets, function(i, tmp_element){
var $element=$(tmp_element);
var target_element_object=_this.get_element_object($element.data("id"));
var el_value=_this.get_value_from_element($element, null, false, use_factor==0);
if(!allow_zero&&el_value==0) return;
if(i==0){
value_to_write=el_value;
return;
}
switch (set_operator){
case "min":
if(el_value < value_to_write) value_to_write=el_value;
break;
case "max":
if(el_value > value_to_write) value_to_write=el_value;
break;
case "avg":
case "sum":
value_to_write +=el_value;
break;
case "dif":
value_to_write -=el_value;
break;
case "prod":
value_to_write *=el_value;
break;
case "quot":
if(el_value!=0) value_to_write /=el_value;
break;
}});
if(set_operator=="avg"){
value_to_write=value_to_write / targets.length;
}
var value_to_write_formatted=this.normalize_value(value_to_write, el_object);
element.current_value=value_to_write;
element.current_value_formatted=value_to_write_formatted;
el_object.find("input").val(value_to_write_formatted);
};
this.calculate_price=function(form, form_id){
form_id=form_id||$(form).data("id");
var price=0;
this.subtotals[form_id]=[];
var element_trigger_list=this.trigger_list[form_id].length > 0 ? this.trigger_list[form_id]:_this.form_vars[form_id].form_elements_order;
var return_early=true;
if(_this.form_vars[form_id].hasOwnProperty("global_conditions")){
_this.calculate_conditionals(form, form_id, _this.form_vars[form_id].global_conditions, false, true);
}
for (var ie in element_trigger_list){
var element_id=element_trigger_list[ie];
var element=_this.get_element_object(element_id);
var $element=_this.get_element_dom(element_id);
_this.calculate_get_external_values(form, form_id, $element, element.type);
if(element.hasOwnProperty("conditional")){
_this.calculate_conditionals(form, form_id, element_id, element.type);
}
if(!element.hasOwnProperty("calculate")&&element.type!="custom_calculation"&&element.type!="matrix"&&element.type!="set") continue;
return_early=false;
if(!_this.element_is_visible(element_id)&&element.calculate_when_hidden==0&&element.type!="hidden"&&element.type!="custom_calculation") continue;
_this.calculate_set_elements(form, form_id, $element, element.type);
}
if(return_early) return this.price_old_global[form_id];
var repeatable_price_first_element_id=0;
var repeatable_price_first_element_parent_id=0;
var repeatable_price_holder=0;
for (var i in _this.form_vars[form_id].form_elements_order){
var element_id=_this.form_vars[form_id].form_elements_order[i];
var element=_this.get_element_object(element_id);
var $element=_this.get_element_dom(element_id);
if(!element.hasOwnProperty("calculate")&&element.type!=="custom_calculation"&&element.type!="matrix"&&element.type!="set"&&element.type!="repeatable_form") continue;
if(this.has_repeatable_parent_id(element_id)&&!repeatable_price_first_element_id){
repeatable_price_first_element_id=element_id;
repeatable_price_first_element_parent_id=this.get_repeatable_parent_id(element_id);
repeatable_price_holder=price;
price=0;
}
else if(this.has_repeatable_parent_id(element_id)&&this.get_repeatable_element_id(element_id)==repeatable_price_first_element_id){
repeatable_price_holder +=price;
price=0;
}
else if(element.type=="repeatable_form"&&element_id==repeatable_price_first_element_parent_id){
price=repeatable_price_holder + price;
repeatable_price_first_element_id=0;
repeatable_price_first_element_parent_id=0;
repeatable_price_holder=0;
continue;
}
var element_loop_price=_this.calculate_element_loop(element_id, price);
var element_single_price=_this.calculate_element_loop(element_id, 0, true);
_this.calculate_conditionals(form, form_id, element_id, element.type);
_this.set_element_object_value(element_id, "current_value", element_single_price);
if(_this.get_element_object_value(element, "calculate_enabled", 1)==1&&_this.get_element_object_value(element, "add_to_price", 1) > 0&&this.element_can_calculate_visibility(element_id)){
price=element_loop_price;
}
if(_this.get_element_object_value(element, "add_to_price", 1)==0){
var current_value=_this.get_value_from_element($element, null, true);
_this.set_element_object_value(element, "current_value", current_value);
}
if(_this.get_element_object_value(element, "calculate_enabled", 1)==1){
_this.subtotals[form_id].push({
el_id: element_id,
price: price
});
}}
return price;
};
this.set_price=function(form, price_old, force_price){
var form_id=$(form).data("id");
if(force_price){
price=force_price;
}
else if(!price_old||price_old!==0){
price=this.calculate_price($(form));
}
this.set_subtotal_values($(form));
this.update_table_order_all(form_id);
if(this.form_vars[form_id].price_show_request==1&&this.form_vars[form_id].price_requested==0){
this.price_request_toggle(form_id, false);
return;
}
if(typeof this.price_old_global[form_id]==="undefined"||isNaN(this.price_old_global[form_id])) this.price_old_global[form_id]=0;
$form_price_elements=$(document).find(".ezfc-price-value[data-id='" + form_id + "']");
if(this.price_old_global[form_id]==price){
$form_price_elements.text(this.format_price(form_id, price));
return;
}
if(this.form_vars[form_id].counter_duration!=0){
$form_price_elements.countTo({
from: _this.price_old_global[form_id],
to: price,
speed: this.form_vars[form_id].counter_duration,
refreshInterval: this.form_vars[form_id].counter_interval,
formatter: function (value, options){
var price_formatted=_this.format_price(form_id, value);
var price_numeral=numeral(price_formatted).value();
if(isNaN(price_numeral)||!price_numeral) price_formatted=0;
return price_formatted;
},
onComplete: function(value){
$form_price_elements.text(_this.format_price(form_id, price));
}});
}else{
$form_price_elements.text(this.format_price(form_id, price));
}
this.price_old_global[form_id]=price;
};
this.conditional_check_multiple_options=function(needles, haystack){
var do_action_index=false;
if(typeof needles==="string"||typeof haystack==="number"){
needles=String(needles).split("|");
needles=$.map(needles, $.trim);
}
if(typeof haystack==="string"||typeof haystack==="number"){
haystack=String(haystack).split("|");
haystack=$.map(haystack, $.trim);
}
for (var i in needles){
for (var t in haystack){
if(haystack[t]==needles[i]){
do_action_index=true;
}}
}
return do_action_index;
};
this.format_value_element=function(element_id, price){
var element=this.get_element_object(element_id);
return this.format_price(element.form_id, price, null, element.price_format, element.is_currency, true);
};
this.format_price=function(form_id, price, currency, custom_price_format, format_with_currency, disable_normalize, element){
var form_price_format=this.defaultFormat;
var form_currency=currency||this.form_vars[form_id].currency;
if(this.form_vars[form_id].price_format&&this.form_vars[form_id].price_format.length){
form_price_format=this.form_vars[form_id].price_format;
}
if(typeof custom_price_format!=="undefined"&&custom_price_format!==null){
form_price_format=custom_price_format;
}
if(isNaN(price)||price===null) price=0;
var price_value=disable_normalize ? numeral().set(price):numeral(price);
var price_format_string = !this.is_empty(form_price_format) ? form_price_format:this.defaultFormat;
var price_formatted=price_value.format(price_format_string);
if(price_formatted==="NaN") price_formatted=price;
if(ezfc_vars.price_format_replace_trailing_zeros.enabled==1){
if(parseFloat(price).toFixed(6) % 1===0){
price_formatted +=ezfc_vars.price_format_dec_point + ezfc_vars.price_format_replace_trailing_zeros.text;
}}
if(format_with_currency==1&&_this.form_vars[form_id].format_currency_numbers_elements==1){
if(this.form_vars[form_id].currency_position==0){
price_formatted=form_currency + price_formatted;
}else{
price_formatted=price_formatted + form_currency;
}}
return price_formatted;
};
this.price_request_toggle=function(form_id, enable, price){
var form=$(".ezfc-form[data-id='" + form_id + "']");
if(enable){
this.price_old_global[form_id]=0;
this.form_vars[form_id].price_requested=1;
this.calculate_price(form);
this.set_price(form, null, price);
this.set_submit_text(form);
}else{
this.form_vars[form_id].price_requested=0;
$(form).find(".ezfc-price-value").text(this.form_vars[form_id].price_show_request_before);
$(form).find(".ezfc-submit").val(this.form_vars[form_id].submit_text.request);
}};
this.set_subtotal_values=function(form, form_id){
form_id=form_id||$(form).data("id");
var element_list=["subtotal", "set", "numbers", "custom_calculation"];
var force_format_input_elements=["subtotal", "set"];
$.each(_this.form_vars[form_id].form_elements_order, function(i, element_id){
var element=_this.get_element_object(element_id);
var $element=_this.get_element_dom(element_id);
if($.inArray(element.type, element_list)===-1) return;
var precision=_this.get_element_object_value(element, "precision", 2);
var price_format=element.price_format;
if(element.type=="custom_calculation"){
$element_input=$element.find(".ezfc-element-custom-calculation-input");
}else{
$element_input=$element.find(".ezfc-element-" + element.type);
}
var value_pre=element.current_value;
if(_this.object_has_property(element, "current_value_forced")){
value_pre=element.current_value_forced;
}
if(_this.is_repeatable_element(element_id)&&element.type=="subtotal"){
value_pre=$(_this.get_element_child_input_dom(element_id)).val();
}
var value=_this.normalize_value(value_pre, $element_input, precision, $element_input.data("converted")==0);
if($element_input.data("min")!=""){
var min_value=parseFloat($element_input.data("min"));
if(min_value > value) value=min_value;
}
if($element_input.data("max")!=""){
var max_value=parseFloat($element_input.data("max"));
if(max_value < value) value=max_value;
}
var text="", text_currency="";
var text_before=_this.get_element_object_value(element, "text_before", "");
var text_after=_this.get_element_object_value(element, "text_after", "");
if(_this.form_vars[form_id].format_number_show_zero==0&&(value==""||value==0)){
value="";
}else{
text=_this.format_price(element.form_id, value, null, price_format, false, $element_input.data("converted")==0);
text_currency=_this.format_price(element.form_id, value, null, price_format, element.is_currency, $element_input.data("converted")==0);
text_currency=text_before + text_currency + text_after;
}
if($.inArray(element.type, force_format_input_elements)!==-1){
$element_input.val(text_currency);
$element_input.data("converted", 1);
}
$element.find(".ezfc-text").text(text);
});
};
this.scroll=function(){
$(".ezfc-fixed").each(function(){
var form_id=$(this).data("id");
if(!_this.form_vars[form_id]) return;
var active_scroll_class="ezfc-fixed-scrolling";
var offset=$(this).offset();
var form=$(".ezfc-form[data-id='" + form_id + "']");
var form_height=form.outerHeight();
var form_offset=form.offset();
var window_top=$(window).scrollTop();
var price_position_top=parseFloat(_this.form_vars[form_id].price_position_scroll_top);
var diff=form_offset.top - window_top - price_position_top;
if(diff < 0&&diff > -form_height){
$(this).offset({ top: window_top + price_position_top });
$(this).addClass(active_scroll_class);
}
else if(diff > 0&&offset.top > form_offset.top){
$(this).offset({ top: form_offset.top });
$(this).removeClass(active_scroll_class);
}
else if(offset.top < form_offset.top||offset.top > form_offset.top + form_height){
$(this).offset({ top: form_offset.top });
}});
};
this.reset_disabled_fields=function(form, error){
var $form_wrapper=$(form).closest(".ezfc-wrapper");
$(form).find(".ezfc-custom-hidden").each(function(){
$.each($(this).find("input, :selected"), function(i, v){
$(this).val($(this).data("index")).removeAttr("disabled");
if($(this).is(":checked")){
$(this).prop("checked", false);
}});
});
$form_wrapper.find(".ezfc-payment-submit, .ezfc-payment-cancel").prop("disabled", false);
this.set_submit_text(form, error);
};
this.reset_form=function($form){
this.init_form($form);
this.reset_elements($form);
this.set_step($form, 0, 0);
this.form_change($form);
};
this.reset_elements=function($wrapper){
$wrapper.find(".ezfc-custom-element").each(function(){
var element_id=$(this).data("id");
var element=_this.get_element_object(element_id);
if(element.type=="group") return;
if(_this.get_element_object_value(element, "keep_value_after_reset", 0)==1) return;
var el_type=$(this).data("element");
var initvalue=$(this).find("[data-initvalue]").data("initvalue");
switch (el_type){
case "checkbox":
$(this).find("input").each(function(){
initvalue=$(this).data("initvalue");
if(initvalue==1)
$(this).prop("checked", true);
else
$(this).removeAttr("checked");
});
break;
case "dropdown":
$(this).find("option").removeAttr("selected");
$(this).find("option[data-index='" + initvalue + "']").prop("selected", true);
break;
case "numbers":
$(this).find("input").val(initvalue);
var $sliders=$(this).find(".ezfc-slider-element");
if($sliders.length) $sliders.slider({ value: initvalue });
break;
case "radio":
$(this).find("input").removeAttr("checked");
$(this).find("input[data-initvalue]").prop("checked", true);
break;
case "textfield":
$(this).find("textarea").val(initvalue);
break;
default:
$(this).find("input").val(initvalue);
break;
}});
$wrapper.find(".ezfc-selected").removeClass("ezfc-selected");
};
this.set_step=function(form, new_step, verify){
var current_step=parseInt(form.find(".ezfc-step-active").data("step"));
var $step_wrapper=form.find(".ezfc-step[data-step='" + current_step + "']");
var form_id=form.data("id");
this.step_is_changing=false;
if(current_step==new_step) return;
if(verify==1&&this.form_vars[form_id].verify_steps==1){
var submit_icon=form.find(".ezfc-step-submit-icon");
submit_icon.fadeIn();
this.form_submit(form, new_step - 1);
$(".ezfc-has-hidden-placeholder").val("").removeClass("ezfc-has-hidden-placeholder");
return;
}
var step_indicator_start=parseInt(this.form_vars[form_id].step_indicator_start) - 1;
var step_fade_speed=parseInt(this.form_vars[form_id].step_speed);
if(isNaN(step_fade_speed)) step_fade_speed=200;
$step_wrapper.fadeOut(step_fade_speed, function(){
var step_wrapper_next=form.find(".ezfc-step[data-step='" + new_step + "']");
step_wrapper_next.fadeIn(step_fade_speed).addClass("ezfc-step-active");
$(this).removeClass("ezfc-step-active");
if(new_step >=step_indicator_start){
form.find(".ezfc-step-indicator").fadeIn();
}else{
form.find(".ezfc-step-indicator").hide();
}
_this.scroll_to(step_wrapper_next);
});
form.find(".ezfc-step-indicator-item").each(function(){
var step_dom=parseInt($(this).data("step"));
$(this).removeClass("ezfc-step-indicator-item-active");
if(step_dom <=new_step){
$(this).addClass("ezfc-step-indicator-item-active");
}});
if(new_step < current_step&&_this.form_vars[form_id].step_reset_succeeding==1){
for (var s=new_step + 1; s < _this.form_vars[form_id].step_count; s++){
var $step_wrapper_reset=$(".ezfc-step[data-step='" + s  +"']");
this.reset_elements($step_wrapper_reset);
}}
_this.current_steps[form_id]=new_step;
_this.form_change(form);
return false;
};
this.set_step_action=function(form_id, action, target_id){
if(this.step_is_changing) return;
var $form=$("#ezfc-form-" + form_id);
var current_step=parseInt($form.find(".ezfc-step-active").data("step"));
var next_step=0;
switch (action){
case "step_prev":
if(current_step==0) return;
next_step=current_step - 1;
break;
case "step_next":
var step_length=$form.find(".ezfc-step-start").length;
if(current_step==step_length - 1) return;
next_step=current_step + 1;
break;
case "step_goto":
target_id=parseInt(target_id);
if(isNaN(target_id)) return;
var step_goto=$form.find(".ezfc-step-start[data-id='" + target_id + "']");
if(step_goto.length < 1) return;
next_step=parseInt(step_goto.data("step"));
break;
}
this.step_is_changing=true;
setTimeout(function(){
_this.set_step($form, next_step, 1);
}, 350);
};
this.scroll_to=function(element, custom_offset){
var element_offset=$(element).offset();
if(typeof element_offset==="undefined"||ezfc_vars.auto_scroll_steps==0) return;
var offset_add=parseFloat(custom_offset)||0;
if(!this.is_empty(ezfc_vars.scroll_steps_offset)){
offset_add=parseFloat(ezfc_vars.scroll_steps_offset);
}
var offset_scroll=element_offset.top + offset_add;
$("html, body").animate({ scrollTop: offset_scroll });
};
this.get_element_dom=function(element_id){
if(this.is_repeatable_element(element_id)) return $("#ezfc_element-" + element_id);
if(typeof this.$form_elements[element_id]==="undefined") return false;
return this.$form_elements[element_id].$element;
};
this.get_element_child_input_dom=function(element_id){
if(this.is_repeatable_element(element_id)) return $("#ezfc_element-" + element_id).find(":input");
if(typeof this.$form_elements[element_id]==="undefined") return false;
return this.$form_elements[element_id].$element_input;
};
this.get_object_value=function(obj, option, default_value, array_index){
if(typeof obj!=="object") return default_value;
if(!obj||!this.object_has_property(obj, option)) return default_value;
if(typeof obj[option]==="object"&&typeof array_index!=="undefined"&&typeof obj[option][array_index]!=="undefined") return obj[option][array_index];
return obj[option];
};
this.get_element_object=function(element_id){
if(typeof this.$form_elements[element_id]==="undefined") return false;
return this.$form_elements[element_id].element;
};
this.get_element_object_value=function(element, option, default_value){
if(typeof element!=="object") element=this.get_element_object(element);
if(!element||!this.object_has_property(element, option)) return default_value;
return element[option];
};
this.get_repeatable_element_id=function(element_id){
if(!this.is_repeatable_element(element_id)) return element_id;
if(String(element_id).indexOf("-")===-1) return element_id;
return String(element_id).split("-")[0];
};
this.get_repeatable_element_counter=function(element_id){
if(!this.is_repeatable_element(element_id)) return element_id;
if(String(element_id).indexOf("-")===-1) return 0;
return String(element_id).split("-")[1];
};
this.get_repeatable_element_counter_from_dom_id=function(element_dom_id){
var id_parts=String(element_dom_id).split("-");
if(id_parts.length < 3) return false;
return id_parts[2];
};
this.is_repeatable_element=function(element_id){
if(typeof element_id!=="string"&&typeof element_id!=="number") return false;
return String(element_id).indexOf("-") >=0||this.has_repeatable_parent_id(element_id);
};
this.get_repeatable_parent_id=function(element_id){
if(String(element_id).indexOf("-") >=0){
element_id=String(element_id).split("-")[0];
}
return this.get_element_object_value(this.get_element_object(element_id), "__parent_id", 0);
};
this.has_repeatable_parent_id=function(element_id){
return this.get_repeatable_parent_id(element_id)!=0;
};
this.set_element_object_value=function(element, option, value){
if(typeof element!=="object"){
if(element=="price"||element=="submit_button") return;
element=this.get_element_object(element);
}
if(!element) return false;
element[option]=value;
};
this.set_element_list_object_value=function(list, option, value){
for (var i in list){
_this.set_element_object_value(list[i], option, value);
}};
this.get_top_parent_group_id=function(group_id){
var element=this.get_element_object(group_id);
if(!element) return false;
if(element.group_id!=0) return this.get_top_parent_group(element.group_id);
return element.id;
};
this.has_parent_group_id=function(element_id, find_group_id){
var element=this.get_element_object(element_id);
if(!element.group_id||element.group_id==0) return false;
if(element_id==find_group_id) return false;
if(element.group_id==find_group_id) return true;
return this.has_parent_group_id(element.group_id, find_group_id);
};
this.get_group_children=function(group_id){
var group_element=this.get_element_object(group_id);
if(!group_element) return [];
var group_children_list=[];
for (var i in _this.form_vars[group_element.form_id].form_elements_order){
var element_id=_this.form_vars[group_element.form_id].form_elements_order[i];
var element=_this.get_element_object(element_id);
if(element_id==group_id) continue;
if(_this.has_parent_group_id(element_id, group_id)){
group_children_list.push(element_id);
}}
return group_children_list;
};
this.get_value_from_element=function($el_object, element_id, is_text, ignore_factor, options){
var default_options={
return_array: false,
return_value: "value"
};
options=$.extend({}, default_options, options);
if(!$el_object&&element_id){
if(typeof this.$form_elements[element_id]!=="undefined"){
$el_object=this.$form_elements[element_id].$element;
}else{
$el_object=this.get_element_dom(element_id);
}}
if(!$el_object||!$el_object.length){
this.debug_message("Unable to find element #" + element_id, 2);
return 0;
}
if(!element_id) element_id=$el_object.data("id");
var element=this.get_element_object(element_id);
if(!element) return 0;
var $input_element=this.get_element_child_input_dom(element_id);
var el_type=element.type;
var factor=this.get_element_object_value(element_id, "factor", 1);
var value_raw=$input_element.val();
var disable_normalize=$input_element.data("converted")==0;
var value_is_pct=false;
var value=this.normalize_value(value_raw, $el_object, null, disable_normalize);
var value_pct=value / 100;
if(element.calculate_when_hidden==0&&!this.element_is_visible(element_id)&&el_type!="hidden"&&el_type!="custom_calculation") return 0;
if(!value||isNaN(value)) value=0;
var return_value=is_text ? value:parseFloat(value);
if(options.return_value=="count") return_value=0;
switch (el_type){
case "subtotal":
case "numbers":
case "hidden":
if((!factor||isNaN(factor))&&factor!==0) factor=1;
if(is_text){
return_value=value_raw;
}else{
return_value=ignore_factor ? value:value * factor;
}
break;
case "dropdown":
case "radio":
case "checkbox":
var read_value=options.return_value;
var return_calculated_value = !is_text&&$.inArray(read_value, ["count", "name", "option_id"])===-1;
$el_object.find(":selected, :checked").each(function(){
if(return_calculated_value){
return_value +=parseFloat($(this).data("value"));
}else{
if(typeof return_value!=="object"&&read_value!="count") return_value=[];
if(read_value=="name"){
var index=$(this).data("index");
return_value.push(element.options[index].text);
}
else if(read_value=="option_id"){
return_value.push($(this).data("optionid"));
}
else if(read_value=="count"){
return_value++;
}else{
return_value.push($(this).data(read_value));
}}
});
break;
case "datepicker":
var datepicker_format=$.trim(_this.form_vars[element.form_id].datepicker_format);
if(datepicker_format=="") datepicker_format="dd/mm/yy";
var date_raw=$el_object.find(".ezfc-element-datepicker").datepicker("getDate");
return_value=$.datepicker.formatDate(datepicker_format, date_raw);
is_text=true;
break;
case "daterange":
var datepicker_format=$.trim(_this.form_vars[element.form_id].datepicker_format);
if(datepicker_format=="") datepicker_format="dd/mm/yy";
var tmp_target_value=[
$el_object.find(".ezfc-element-daterange-from").datepicker("getDate"),
$el_object.find(".ezfc-element-daterange-to").datepicker("getDate")
];
var date_values=[
$.datepicker.formatDate(datepicker_format, tmp_target_value[0]),
$.datepicker.formatDate(datepicker_format, tmp_target_value[1]),
];
if(is_text){
return_value=date_values;
}else{
var $daterange_container=$el_object.find(".ezfc-element-daterange-container");
var days=_this.jqueryui_date_diff(tmp_target_value[0], tmp_target_value[1], this.get_element_object_value(element, "workdays_only", 0)==1, element);
return_value=ignore_factor ? days:days * factor;
}
break;
case "custom_calculation":
return_value=$el_object.find(".ezfc-element-custom-calculation-input").val();
if(!is_text){
return_value=parseFloat(return_value);
}
break;
case "starrating":
return_value=parseFloat($el_object.find(":checked").val());
if(isNaN(return_value)) return_value=0;
break;
case "table_order":
var tmp_total=0;
$.each(element.table_order, function(i, row){
var $input_id=$el_object.find(".ezfc-element-table_order-row[data-row='" + i + "'] .ezfc-element-table_order-quantity-input");
var qty=parseFloat($input_id.val());
var row_total=parseFloat(row.value) * qty;
if(options.return_value=="count") tmp_total +=qty;
else tmp_total +=row_total;
});
return_value=tmp_total;
break;
case "set":
return_value=element.current_value;
break;
case "input":
case "textfield":
if(options.return_value=="letter_count"){
return_value=String(value_raw).replace(/\s+/g, "").length;
}
else if(options.return_value=="letter_count_with_space"){
return_value=String(value_raw).replace(/\r?\n|\r/g, "").length;
}else{
return_value=value_raw;
}
break;
case "repeatable_form":
var calc_value=0;
var repeated_element_ids=this.get_element_object_value(element, "__repeated_ids", []);
var repeated_elements_count=this.get_element_object_value(element, "__repeated_elements_count", 0);
var repeatable_price_first_element_id=repeated_element_ids[0];
var repeatable_price_holder=0;
var element_counter_index=0;
for (var i in repeated_element_ids){
var loop_element_id=repeated_element_ids[i];
var loop_element=this.get_element_object(repeated_element_ids[i]);
var loop_value=this.get_calculated_element_value(loop_element.form_id, loop_element_id);
if(loop_element.overwrite_price==1){
calc_value=loop_value;
}else{
calc_value +=loop_value;
}
if(element_counter_index > 0&&element_counter_index % (repeated_elements_count - 1)==0){
repeatable_price_holder +=calc_value;
calc_value=0;
element_counter_index=0;
}else{
element_counter_index++;
}}
calc_value=repeatable_price_holder + calc_value;
return_value=calc_value;
break;
case "discount_codes":
return_value=_this.get_element_object_value(element, "discount_value", 0);
break;
case "address_distance":
return_value=_this.get_element_object_value(element, "distance_value", 0);
break;
case "fileupload":
case "group":
case "heading":
case "hr":
case "html":
case "image":
case "placeholder":
case "spacer":
case "stepstart":
case "stepend":
return_value=0;
break;
default:
return_value=value_raw;
break;
}
if(value_is_pct){
return_value=value_pct;
}
if(is_text){
if(read_value=="name"){
var parser=new DOMParser();
var dom=parser.parseFromString(return_value, "text/html");
if(dom.body&&dom.body.textContent){
return_value=dom.body.textContent;
}}
}else{
if(isNaN(return_value)) return_value=0;
return !return_value ? 0:parseFloat(return_value);
}
return return_value;
};
this.checkbox_change=function($element){
var max_selectable=parseInt($element.attr("data-max_selectable"));
if(!max_selectable){
$element.find("input:not(:checked):not(.force-disabled)").removeAttr("disabled");
}
if(max_selectable&&max_selectable >=0){
var selected=$element.find(":checked").length;
if(selected >=max_selectable){
$element.find("input:not(:checked)").attr("disabled", "disabled");
}else{
$element.find("input:not(:checked):not(.force-disabled)").removeAttr("disabled");
}}
};
this.checkbox_change_state=function($checkbox, state, disable_change_trigger, change_image_only){
if($checkbox.attr("disabled")) return false;
if(typeof state==="undefined"||state===null){
state = !$checkbox.is(":checked");
}
var $parent_container=$checkbox.closest(".ezfc-element-single-option-container");
var has_image=$parent_container.hasClass("ezfc-element-option-has-image");
if(has_image){
var $image=$checkbox.siblings(".ezfc-element-option-image");
if(!state){
$image.removeClass("ezfc-selected");
}else{
$image.addClass("ezfc-selected");
}}
if(!state){
$parent_container.removeClass("ezfc-option-wrapper-selected");
}else{
$parent_container.addClass("ezfc-option-wrapper-selected");
}
if(!change_image_only){
$checkbox.prop("checked", state);
}
if(!disable_change_trigger){
$checkbox.trigger("change");
}};
this.radio_change_state=function($radio, state, disable_change_trigger){
var form_id=$radio.closest(".ezfc-form").data("id");
if($radio.attr("disabled")) return false;
if(state===undefined){
state = !$radio.is(":checked");
}
var $parent_container=$radio.closest(".ezfc-element-radio-container");
var $parent_wrapper=$parent_container.closest(".ezfc-element-option-container");
$parent_wrapper.find(".ezfc-selected").removeClass("ezfc-selected");
$parent_wrapper.find(".ezfc-element-radio-input").removeAttr("checked");
if(state){
$parent_container.siblings(".ezfc-option-wrapper-selected").removeClass("ezfc-option-wrapper-selected");
$parent_container.addClass("ezfc-option-wrapper-selected");
}
var has_image=$parent_container.hasClass("ezfc-element-option-has-image");
if(has_image){
var $image=$radio.siblings(".ezfc-element-option-image");
if(state){
$radio.attr("checked", "checked");
$radio.prop("checked", true);
$parent_wrapper.find(".ezfc-selected").removeClass("ezfc-selected");
$image.addClass("ezfc-selected");
}}
else if(state){
$radio.attr("checked", "checked");
$radio.prop("checked", true);
}
if(!disable_change_trigger){
$radio.trigger("change");
}
if(this.form_vars[form_id]&&this.form_vars[form_id].step_auto_progress==1&&!$parent_wrapper.hasClass("disable-auto-progress")&&state){
this.set_step_action(form_id, "step_next");
}};
this.live_summary_update=function(form_id){
if(this.form_vars[form_id].live_summary_enabled==0) return;
var _this=this;
var out="";
$.each(ezfc_vars.element_vars[form_id], function(i, element){
if(typeof element["current_value"]==="undefined"||element.show_in_live_summary==0||!_this.element_is_visible(element.id)) return;
var current_value=$.trim(element.current_value);
if(typeof element["options"]!=="undefined"){
current_value=_this.get_value_from_element(null, element.id, true, null, { return_value: "name" });
if(current_value==0) return;
}
else if(typeof element["current_value_formatted"]!=="undefined"){
current_value=element.current_value_formatted;
}
if(current_value==""||current_value==0) return;
if(typeof current_value==="object"){
current_value="<ul class='ezfc-live-summary-list'><li class='ezfc-live-summary-list-item'>" + current_value.join("</li><li class='ezfc-live-summary-list-item'>") + "</li></ul>";
}
var hook_values={
current_value: current_value,
element: element,
form_id: form_id
};
var hook_return=_this.call_hook("ezfc_live_summary_item", hook_values);
current_value=hook_return.current_value;
out +="<div class='ezfc-live-summary-item'><div class='ezfc-live-summary-item-name'>" + element.label + "<span class='ezfc-live-summary-item-separator'></span></div><div class='ezfc-live-summary-item-value'>" + current_value + "</div></div>";
});
$("#ezfc-live-summary-" + form_id).find(".ezfc-live-summary-content").html(out);
};
this.input_format_listener_change=function($element){
var $el_wrapper=$element.parent().closest(".ezfc-element");
var element_id=$el_wrapper.data("id");
var element=this.get_element_object(element_id);
if(!element) return;
var form_id=element.form_id;
var text_before=this.get_element_object_value(element, "text_before", "");
var text_after=this.get_element_object_value(element, "text_after", "");
var price_format=this.get_element_object_value(element, "price_format", null);
$element.on("focus click", function(){
var regex_text_before=_this.escape_regex(text_before);
var regex_text_after=_this.escape_regex(text_after);
if(text_before!=""){
this.value=this.value.replace(new RegExp("^" + regex_text_before, ""), "");
}
if(text_after!=""){
this.value=this.value.replace(new RegExp(regex_text_after + "$", ""), "");
}
if(element.is_number==1){
this.value=this.value.replace(/[^0-9\.,-]/g, "");
this.value=this.value.replace(ezfc_vars.price_format_dec_thousand, "");
}});
var blur_func=function(element_dom, disable_recalc_price){
var value_old=element_dom.value;
element_dom.value=_this.get_element_object_value(element, "current_value_forced", element_dom.value);
var is_number=_this.get_element_object_value(element, "is_number", 1)==1;
if(is_number){
element_dom.value=element_dom.value.replace(/[^0-9\.,-]/g, "");
var el_value_min=$element.data("min");
var el_value_max=$element.data("max");
if(element_dom.value!=""){
var normalized_value=_this.normalize_value(element_dom.value);
if(!isNaN(normalized_value)){
if(el_value_min!=""&&!isNaN(el_value_min)&&normalized_value < el_value_min) element_dom.value=el_value_min;
if(el_value_max!=""&&!isNaN(el_value_max)&&normalized_value > el_value_max) element_dom.value=el_value_max;
}}
}
var update_form=element_dom.value!=value_old;
var value_is_empty_or_zero=_this.is_empty_or_zero(element_dom.value);
if(_this.form_vars[form_id].format_number_show_zero==0&&value_is_empty_or_zero){
element_dom.value="";
}else{
if(_this.get_element_object_value(element, "is_currency", 1)==1){
var format_value=_this.normalize_value(element_dom.value);
element_dom.value=_this.format_price(form_id, format_value, null, price_format, _this.form_vars[form_id].format_currency_numbers_elements, null, element);
}else{
var text_before=_this.get_element_object_value(element, "text_before", "");
var text_after=_this.get_element_object_value(element, "text_after", "");
element_dom.value=text_before + element_dom.value + text_after;
}}
_this.set_element_object_value(element, "current_value_formatted", element_dom.value);
if(update_form&&!disable_recalc_price){
_this.form_change(null, form_id, $element);
}
_this.live_summary_update(form_id);
if(_this.get_element_object_value(element, "discount_show_table", 0)==1&&_this.get_element_object_value(element, "discount_show_table_indicator", 1)==1){
_this.discount_table_update(element);
}};
$element.on("blur", function(){ blur_func(this); });
$element.bind("ezfc_blur_trigger", function(){ blur_func(this, true); });
};
this.element_is_visible=function(element_id){
var element=this.get_element_object(element_id);
if(!element) return false;
var $element=this.get_element_dom(element_id);
var form_id=element.form_id;
var form_has_steps=this.form_vars[form_id].has_steps;
var is_visible;
if($element.hasClass("ezfc-custom-hidden")||$element.hasClass("ezfc-hidden")) return false;
if(element.group_id!=0){
is_visible=$element.closest(".ezfc-custom-hidden, .ezfc-hidden").length < 1;
}else{
is_visible=true;
}
return is_visible;
};
this.element_can_calculate_visibility=function(element_id){
var element=this.get_element_object(element_id);
if(!element) return false;
if(this.get_element_object_value(element, "calculate_when_hidden", 0)==0){
return this.element_is_visible(element_id);
}
return true;
};
this.clear_hidden_values=function(form){
var form_id=$(form).data("id");
if(this.form_vars[form_id].clear_selected_values_hidden!=1) return;
$(form).find(".ezfc-custom-hidden").each(function(){
_this.clear_hidden_values_element($(this).data("id"), true);
});
};
this.clear_hidden_values_element=function(element_id, disable_change_trigger){
var element=this.get_element_object(element_id);
var $element=this.get_element_dom(element_id);
var $element_input=this.get_element_child_input_dom(element_id);
if(!$element||!$element.length) return;
if(element.type=="dropdown"){
$element.find(":selected").removeAttr("selected");
}
else if(element.type=="radio"){
this.radio_change_state($element.find(".ezfc-element-radio-input"), false, disable_change_trigger);
}
else if(element.type=="checkbox"){
this.checkbox_change_state($element.find(".ezfc-element-checkbox-input"), false, disable_change_trigger);
}else{
$element_input.val("");
}};
this.escape_regex=function(s){
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};
this.normalize_value=function(value, $element_dom, precision, disable_normalize){
value=String(value);
if(typeof $element_dom!=="undefined"){
var $element=$($element_dom);
var element_id=$element.data("id");
var element=this.get_element_object(element_id);
var text_before=$.trim(this.get_element_object_value(element, "text_before", ""));
var text_after=$.trim(this.get_element_object_value(element, "text_after", ""));
if(text_before!=""){
var regex_text_before=_this.escape_regex(text_before);
value=value.replace(new RegExp("^" + regex_text_before, ""), "");
}
if(text_after!=""){
var regex_text_after=_this.escape_regex(text_after);
value=value.replace(new RegExp(regex_text_after + "$", ""), "");
}}
var value_normalized=parseFloat(value);
if(typeof precision!=="undefined"&&(precision||precision==0)){
precision=parseInt(precision);
value_normalized=value_normalized.toFixed(precision);
}
if(!disable_normalize){
value_normalized=numeral(value).value();
}
return value_normalized;
};
this.set_submit_text=function(form, error){
var form_id=$(form).data("id");
var $submit_button=$(form).find(".ezfc-submit");
var submit_type="default";
var submit_text=this.form_vars[form_id].submit_text.default;
if(this.form_vars[form_id].price_show_request==1){
if(!this.form_vars[form_id].price_requested||error){
submit_text=this.form_vars[form_id].submit_text.request;
submit_type="request";
}
if(error){
this.price_request_toggle(form_id, false);
return false;
}}
else if(this.form_vars[form_id].summary_enabled==1&&this.form_vars[form_id].summary_shown==0){
submit_type="summary";
submit_text=this.form_vars[form_id].submit_text.summary;
}
else if(this.form_vars[form_id].use_paypal==1){
submit_type="paypal";
submit_text=this.form_vars[form_id].submit_text.paypal;
}
else if(this.form_vars[form_id].payment_force_stripe==1){
submit_type="stripe";
submit_text=this.form_vars[form_id].submit_text.stripe;
}
else if(this.form_vars[form_id].use_woocommerce==1){
submit_type="woocommerce";
submit_text=this.form_vars[form_id].submit_text.woocommerce;
}else{
submit_text=this.form_vars[form_id].submit_text.default;
var payment_method_element=$(form).find(".ezfc-element-wrapper-payment");
if(payment_method_element.length > 0){
var payment_method_value=$(payment_method_element).find(":checked").data("value");
if(typeof this.form_vars[form_id].submit_text[payment_method_value]!=="undefined"){
submit_type=payment_method_value;
submit_text=this.form_vars[form_id].submit_text[payment_method_value];
}}
}
$submit_button.val(submit_text);
$submit_button.data("type", submit_type);
};
this.prevent_enter_step_listener=function($elements, $form){
$($elements).keypress(function(e){
var key=e.keyCode||e.which;
if(e.which==13){
e.preventDefault();
}});
};
this.call_hook=function(hook_name, args){
var func=window[hook_name];
args=typeof args==="undefined" ? {}:args;
if(typeof func!=="function") return args;
return func(args);
};
this.stripe_response_handler=function(status, response){
var $form=$(".ezfc-form[data-id='" + _this.payment_form_id + "']");
var $form_payment=$(".ezfc-payment-form[data-form_id='" + _this.payment_form_id + "']");
if(response.error){
_this.debug_message(response.error.message);
$("#ezfc-payment-message-" + _this.payment_form_id).text(response.error.message);
$form_payment.find(".ezfc-payment-submit, .ezfc-payment-cancel").prop("disabled", false);
setTimeout(function(){
$("#ezfc-payment-message-" + _this.payment_form_id).text("");
}, 7500);
}else{
var token=response.id;
$form.find("#ezfc-stripetoken-" + _this.payment_form_id).val(token);
_this.form_submit($form, -1, "stripe-checkout");
}};
this.authorize_create_token=function(id){
var secureData={}; authData={}; cardData={};
var $form_payment=$("#ezfc-authorize-form-" + id);
cardData.cardNumber=$("#ezfc-element-payment-authorize-card-number-" + id).val();
cardData.cardNumber=cardData.cardNumber.replace(/ /g, "");
cardData.month=$("#ezfc-element-payment-authorize-expiry-month-" + id).val();
cardData.year=$("#ezfc-element-payment-authorize-expiry-year-" + id).val();
cardData.cardCode=$("#ezfc-element-payment-authorize-cvc-" + id).val();
secureData.cardData=cardData;
authData.clientKey=ezfc_vars.authorize.client_key;
authData.apiLoginID=ezfc_vars.authorize.api_login_id;
secureData.authData=authData;
Accept.dispatchData(secureData, _this.authorize_response_handler);
};
this.authorize_response_handler=function(response){
var $form=$(".ezfc-form[data-id='" + _this.payment_form_id + "']");
var $form_payment=$(".ezfc-payment-form[data-form_id='" + _this.payment_form_id + "']");
var form_id=$form.data("id");
if(response.messages.resultCode==="Error"){
$form_payment.find(".ezfc-payment-submit, .ezfc-payment-cancel").prop("disabled", false);
var error_messages=[];
for (var i=0; i < response.messages.message.length; i++){
error_messages.push(response.messages.message[i].text);
_this.debug_message(response.messages.message[i].code + ": " + response.messages.message[i].text);
}
_this.set_message(form_id, error_messages.join(" "));
}else{
var token=response.opaqueData.dataValue;
$("#ezfc-authorizetoken-" + _this.payment_form_id).val(token);
_this.form_submit($form, -1, "authorize-checkout");
}};
this.is_valid_date=function(d){
return d&&typeof d==="object"&&typeof d.setHours==="function";
};
this.check_datepicker_days=function(date, available_days, blocked_days){
if(!date||typeof date!=="object"||typeof date.setHours!=="function"){
return [false, ""];
}
date.setHours(0,0,0,0);
var loop_date=date.getTime();
if(blocked_days.length){
for (var bd in blocked_days){
blocked_days[bd]=$.trim(blocked_days[bd]);
var is_period=blocked_days[bd].indexOf(":")!==-1;
if(is_period){
var blocked_days_period=blocked_days[bd].split(":");
if(blocked_days_period.length==2){
var blocked_days_period_begin=new Date(blocked_days_period[0]);
var blocked_days_period_end=new Date(blocked_days_period[1]);
blocked_days_period_begin.setHours(0,0,0,0);
blocked_days_period_end.setHours(0,0,0,0);
if(loop_date >=blocked_days_period_begin.getTime()&&loop_date <=blocked_days_period_end.getTime()){
return [false, ""];
}}
}else{
var blocked_day=new Date(blocked_days[bd]);
blocked_day.setHours(0,0,0,0);
if(loop_date==blocked_day.getTime()){
return [false, ""];
}}
}}
var day=date.getDay();
return [$.inArray(day, available_days)!==-1, ''];
};
this.check_datepicker_predefined_values=function($element){
var input_date=$element.val();
var set_date=false;
if(input_date=="") return;
switch (input_date){
case "__today__":
set_date=new Date();
break;
case "__tomorrow__":
set_date=new Date(new Date().getTime() + 86400000);
break;
case "__current_month__":
set_date=new Date().getMonth();
break;
case "__current_year__":
set_date=new Date().getFullYear();
break;
default:
set_date=input_date;
break;
}
if(set_date){
$element.datepicker("setDate", set_date);
}};
this.check_inline_math=function(custom_value, cond_target){
var inline_math_func=function(){
};
return custom_value;
};
this.get_target_subtotal_value=function(form_id, element_id, use_previous_element_price){
for (var i in this.subtotals[form_id]){
if(this.subtotals[form_id][i].el_id==element_id){
if(use_previous_element_price){
return typeof this.subtotals[form_id][i-1]!=="undefined" ? this.subtotals[form_id][i-1].price:0;
}else{
return this.subtotals[form_id][i].price;
}}
}
return null;
};
this.get_calculated_element_value=function(form_id, element_id){
var $form=$("#ezfc-form-" + form_id);
var element=this.get_element_object(element_id);
var $element=this.get_element_dom(element_id);
var calc_activated=this.get_element_object_value(element, "calculate_enabled", 1);
if(this.is_repeatable_element(element_id)||this.has_repeatable_parent_id(element_id)) return this.calculate_element_loop(element_id, 0, true);
if(calc_activated==0) return 0;
var calculated_value=this.get_element_object_value(element, "current_value_forced", this.get_element_object_value(element, "current_value", 0));
return calculated_value;
};
this.set_message=function(form_id, message){
var $form=$("#ezfc-form-" + form_id);
if(!$form) return false;
var $form_wrapper=$form.closest(".ezfc-wrapper");
var $message_wrapper;
if($form_wrapper.find(".ezfc-payment-dialog-open").length > 0){
$message_wrapper=$form_wrapper.find(".ezfc-payment-errors");
}else{
$message_wrapper=$("#ezfc-message-" + form_id);
}
if(!$message_wrapper.length&&console){
console.log(message);
return false;
}
$message_wrapper.text(message).fadeIn().delay(7500).fadeOut();
};
this.recaptcha_reload=function(){
var has_recaptcha=$(".ezfc-form .g-recaptcha").length;
if(has_recaptcha&&typeof grecaptcha!=="undefined"){
grecaptcha.reset();
}};
this.populate_html_placeholders=function($form){
$form.find(".ezfc-html-placeholder").each(function(i, el){
var $el=$(el);
var $element_wrapper=$el.closest(".ezfc-custom-element");
var element_id=$element_wrapper.data("id");
var element=_this.get_element_object(element_id);
var value="";
var target_id=_this.functions.get_element_id_by_name($form.data("id"), $el.data("listen_target"));
if(!target_id) return;
var retrieve_value=$el.data("listen_retrieve");
value=_this.get_value_from_element(false, target_id, true, false, { return_value: retrieve_value });
var replace_placeholders_show_zero=_this.get_element_object_value(element, "replace_placeholders_show_zero", 1);
if(replace_placeholders_show_zero==0&&value==0){
value="";
}
if(value&&typeof value==="object"&&typeof value.join==="function") value=value.join(", ");
value=$.trim(value);
$el.text(value);
});
};
this.init_repeatable_group=function(group_id){
var element=this.get_element_object(group_id);
var $element=this.get_element_dom(group_id);
this.group_check_actions(group_id);
};
this.group_repeat=function(group_id){
var element=this.get_element_object(group_id);
var repeatable_count_max=parseInt(this.get_element_object_value(element, "repeatable_count_max", 0));
var repeatable_count=this.get_element_object_value(element, "__repeated_count", 0);
if(repeatable_count_max > 0&&repeatable_count >=repeatable_count_max - 1) return;
if(typeof this.group_repeat_elements[group_id]==="undefined"){
this.group_repeat_elements[group_id]=0;
}
this.group_repeat_elements[group_id]++;
this.set_element_object_value(element, "__repeated_count", ++repeatable_count);
var $group=$("#ezfc_element-" + group_id);
$group.find(".ezfc-spinner").each(function(){
if($(this).spinner("instance")) $(this).spinner("destroy");
});
$group.find(".ezfc-slider-element").each(function(){
if($(this).slider("instance")) $(this).slider("destroy");
});
var $clone=$group.clone(true);
var clone_id=$clone.attr("id") + "-" + this.group_repeat_elements[group_id];
var $form=$group.closest(".ezfc-form");
var form_id=$form.data("id");
$clone.find(".ezfc-group-repeatable-wrapper").remove();
var group_id_index=this.form_vars[form_id].form_elements_order.indexOf(String(group_id));
var group_elements=this.get_element_object_value(element, "__repeated_ids", []);
$clone.attr("id", clone_id);
$clone.hide();
this.reset_elements($clone);
$clone.appendTo($("#ezfc-repeatable-wrapper-" + group_id + " .ezfc-repeatable-form-elements")).fadeIn(500);
var new_group_elements_ids=[];
var new_group_elements_data=[];
$clone.find("[id^='ezfc_element-']").each(function(){
var element_id=$(this).data("id");
var old_id=$(this).attr("id");
var new_id=old_id + "-" + _this.group_repeat_elements[group_id];
var new_fe_id=$(this).data("id") + "-" + _this.group_repeat_elements[group_id];
if($(this).hasClass("ezfc-custom-element")){
new_group_elements_ids.push(new_fe_id);
new_group_elements_data.push({
new_element_id: new_fe_id,
old_element_id: element_id,
repeat_index: _this.group_repeat_elements[group_id],
});
}else{
var element_input_name=$(this).attr("name");
if(!element_input_name) return;
var names_array=element_input_name.replace(/\]/g, "").split("[").map(function(part){
return part.replace(/\[/g, "");
});
if(names_array.length < 3) return;
var input_name_begin=names_array[0];
names_array=names_array.slice(1, names_array.length);
var counter_id=_this.group_repeat_elements[group_id] + parseInt(names_array[2]);
names_array[2]=counter_id;
var new_name=input_name_begin + "[" + names_array.join("][") + "]";
$(this).attr("name", new_name);
}
$(this).attr("id", new_id);
$(this).data("id", new_fe_id);
var label_selector_old_id="label[for='" + old_id + "']";
$clone.find(label_selector_old_id).each(function(){
$(this).attr("for", new_id);
});
});
$clone.find(".ezfc-element-table_order").each(function(){
$clone.find(".ezfc-table_order-btn").each(function(){
var target=$(this).siblings(".ezfc-element-table_order-quantity-input").attr("id");
$(this).data("target", target);
});
$clone.find(".ezfc-element-table_order-subtotal").each(function(){
var row_id=$(this).closest("tr[data-row]").data("row");
var subtotal_id_old=$(this).attr("id");
var subtotal_id_new=subtotal_id_old + "-" + _this.group_repeat_elements[group_id] + "-" + row_id;
$(this).attr("id", subtotal_id_new);
});
});
this.form_vars[form_id].form_elements_order.splice.apply(this.form_vars[form_id].form_elements_order, [group_id_index, 0].concat(new_group_elements_ids));
var repeated_ids=this.get_element_object_value(element, "__repeated_ids", []);
repeated_ids=this.unique(repeated_ids.concat(new_group_elements_ids));
this.set_element_object_value(element, "__repeated_ids", repeated_ids);
for (var i in new_group_elements_data){
var old_element_id=new_group_elements_data[i].old_element_id;
var new_element_id=new_group_elements_data[i].new_element_id;
var cloned_element=_this.get_element_object(old_element_id);
if(!cloned_element) continue;
var new_element_object=$.extend(true, {}, cloned_element);
new_element_object.id=new_element_id;
ezfc_vars.element_vars[new_element_object.form_id][new_element_object.id]=new_element_object;
_this.add_form_element_to_cache(new_element_id, new_element_object.form_id);
if(new_element_object.hasOwnProperty("calculate")){
for (var ica in new_element_object.calculate){
var calc_row=new_element_object.calculate[ica];
if(_this.form_vars[form_id].form_elements_order.indexOf(String(calc_row.target))!==-1){
calc_row.target=calc_row.target + "-" + new_group_elements_data[i].repeat_index;
}}
}
if(new_element_object.hasOwnProperty("conditional")){
for (var it in new_element_object.conditional.target){
var cond_target=String(new_element_object.conditional.target[it]);
if(_this.form_vars[form_id].form_elements_order.indexOf(cond_target)!==-1){
new_element_object.conditional.target[it]=cond_target + "-" + new_group_elements_data[i].repeat_index;
}}
}}
$group.find(".ezfc-spinner").each(function(){ _this.init_spinner($(this)); });
$group.find(".ezfc-slider").each(function(){ _this.init_slider($(this)); });
$clone.find(".ezfc-spinner").each(function(){ _this.init_spinner($(this)); });
$clone.find(".ezfc-slider").each(function(){ _this.init_slider($(this)); });
this.init_table_order(form_id);
this.form_change($form);
this.group_check_actions(group_id);
};
this.group_remove=function(group_id){
var $repeated_elements=$("#ezfc-repeatable-wrapper-" + group_id).find(".ezfc-repeatable-form-elements > .ezfc-custom-element");
var repeated_length=$repeated_elements.length;
if(repeated_length <=1) return;
var element=this.get_element_object(group_id);
var repeatable_count=this.get_element_object_value(element, "__repeated_count", 0);
this.set_element_object_value(element, "__repeated_count", --repeatable_count);
var $last_element=$repeated_elements.last();
var index=this.get_repeatable_element_counter_from_dom_id($last_element.attr("id"));
var $group=$("#ezfc_element-" + group_id + "-" + index);
var $form=$group.closest(".ezfc-form");
for (var ie in element.__element_ids){
var find_id=element.__element_ids[ie] + "-" + index;
var find_element_in_repeated_ids=element.__repeated_ids.indexOf(find_id);
if(find_element_in_repeated_ids > -1){
element.__repeated_ids.splice(find_element_in_repeated_ids, 1);
}
var find_element_in_form_elements_order=this.form_vars[element.form_id].form_elements_order.indexOf(find_id);
if(find_element_in_form_elements_order > -1){
this.form_vars[element.form_id].form_elements_order.splice(find_element_in_form_elements_order, 1);
}}
$group.fadeOut(300, function(){
$(this).remove();
});
this.form_change($form);
this.group_check_actions(group_id);
};
this.group_check_actions=function(group_id){
var element=this.get_element_object(group_id);
var $element=$("#ezfc-repeatable-wrapper-" + group_id);
var repeatable_count_max=parseInt(this.get_element_object_value(element, "repeatable_count_max", 0));
var repeatable_count=this.get_element_object_value(element, "__repeated_count", 0);
var btn_disabled_class="ezfc-btn-disabled";
var $btn_repeat_group=$element.find(".ezfc-repeatable-form-repeat-button");
var $btn_remove_group=$element.find(".ezfc-repeatable-form-remove-button");
if(repeatable_count==0){
$btn_repeat_group.removeAttr("disabled");
$btn_remove_group.attr("disabled", "disabled");
}
else if(repeatable_count_max > 0&&repeatable_count >=repeatable_count_max - 1){
$btn_repeat_group.attr("disabled", "disabled");
$btn_remove_group.removeAttr("disabled");
}else{
$btn_repeat_group.removeAttr("disabled");
$btn_remove_group.removeAttr("disabled");
}};
this.toggle_group=function($group_wrapper, force_show){
var $group=$group_wrapper.find("> .ezfc-group-elements").first();
if($group_wrapper.hasClass("ezfc-group-collapsible")){
$group.slideToggle(500);
var group_class_active="ezfc-group-active";
var icon_class_open="fa-chevron-circle-down";
var icon_class_closed="fa-chevron-circle-right";
var $toggle_icon=$group_wrapper.find(".ezfc-collapse-icon i").first();
if($toggle_icon.hasClass(icon_class_open)&&!force_show){
$toggle_icon.removeClass(icon_class_open).addClass(icon_class_closed);
$group_wrapper.removeClass(group_class_active);
}else{
$toggle_icon.removeClass(icon_class_closed).addClass(icon_class_open);
$group_wrapper.addClass(group_class_active);
}}
};
this.init_tips=function(){
$(".ezfc-element-description[data-ezfctip]").each(function(){
var message=$(this).data("ezfctip");
var tip=new Opentip($(this), {
background: ezfc_vars.opentip.background||"yellow",
borderWidth: 0,
closeButtonCrossColor: ezfc_vars.opentip.color||"black",
redraw: true,
removeElementsOnHide: true,
target: $(this),
tipJoint: ezfc_vars.required_text_position||"middle right",
});
tip.setContent(message);
});
};
this.init_table_order=function(form_id){
for (var i in this.form_vars[form_id].form_elements_order){
var element_id=this.form_vars[form_id].form_elements_order[i];
var element=this.get_element_object(element_id);
var $element=this.get_element_dom(element_id);
if(element.type!="table_order") continue;
for (var r in element.table_order){
var row_item=element.table_order[r];
var row_price=row_item.option.value;
var $row=$element.find(".ezfc-element-table_order-row[data-row='" + r + "']");
var $row_price_dom=$row.find(".ezfc-element-table_order-subtotal");
var row_price_formatted=_this.format_price(form_id, row_price, null, null, element.is_currency);
var text_prefix=_this.get_element_object_value(row_item.option, "text_prefix", "");
var text_suffix=_this.get_element_object_value(row_item.option, "text_suffix", "");
$row_price_dom.text(text_prefix + row_price_formatted + text_suffix);
}}
};
this.update_table_order=function(element_id, form_id){
var element=this.get_element_object(element_id);
var total=_this.get_element_object_value(element, "current_value", 0);
var total_formatted=this.format_price(form_id, total, null, null, element.is_currency);
$("#ezfc_element-" + element_id + "-footer-price").text(total_formatted);
};
this.update_table_order_all=function(form_id){
for (var i in this.form_vars[form_id].form_elements_order){
var element_id=this.form_vars[form_id].form_elements_order[i];
var element=this.get_element_object(element_id);
if(element.type!="table_order") continue;
this.update_table_order(element_id, form_id);
}};
this.show_tip=function(el_tip, el_target, tip_delay, message){
var tip=new Opentip(el_tip, {
background: ezfc_vars.opentip.background||"yellow",
closeButtonCrossColor: ezfc_vars.opentip.color||"black",
delay: tip_delay,
hideDelay: 0.1,
hideTriggers: ["closeButton", "target"],
removeElementsOnHide: true,
showOn: null,
target: el_target,
tipJoint: ezfc_vars.required_text_position||"middle right",
});
tip.setContent(message);
tip.show();
};
this.submit_cancel=function($form, buttons_only){
var $form_wrapper=$form.closest(".ezfc-wrapper");
var $submit_element=$form.find("input[type='submit']");
var $submit_icon=$form.find(".ezfc-submit-icon");
var id=$form.data("id");
$submit_icon.fadeOut();
$submit_element.prop("disabled", false);
$form_wrapper.find(".ezfc-payment-submit, .ezfc-payment-cancel").prop("disabled", false);
for (var i in this.payment_methods){
var payment_method=_this.payment_methods[i];
_this.form_vars[id].payment_info_shown[payment_method]=0;
}};
this.popup_form_open=function(form_id){
var $form=$("#ezfc-form-popup-" + form_id);
if(!$form.length) return;
var $modal=$(".ezfc-modal");
var $form_parent=$form.parent();
if($form_parent.length&&$form_parent[0].tagName!="body"){
$form.appendTo("body");
$modal.appendTo("body");
}
$modal.addClass("ezfc-modal-open");
$form.fadeIn();
};
this.popup_form_close=function(form_id){
$(".ezfc-modal").removeClass("ezfc-modal-open");
$("#ezfc-form-popup-" + form_id).fadeOut();
};
this.remove_debug_info=function(){
$(".ezfc-debug-info").remove();
};
this.add_debug_info=function(type, element, text){
if(ezfc_vars.debug_mode!=2) return;
type=type||$(element).data("element");
if(type=="group") return;
var id=$(element).attr("id");
if(id){
id=id.split("ezfc_element-")[1];
}
var debug_el_id="ezfc-debug-" + id;
var debug_exists_for_element=$("#" + debug_el_id).length;
if(type=="custom_calculation"&&debug_exists_for_element) return;
var debug_text="[[" + type + " #" + id + "]]\n[" + type + "]\n" + text + "\n\n";
if(debug_exists_for_element){
$(element).find(".ezfc-debug-info").append(debug_text);
}else{
$(element).append("<pre id='" + debug_el_id + "' class='ezfc-debug-info ezfc-debug-type-" + type + "'>" + debug_text + "</pre>");
}
console.log(text, element);
};
this.debug_message=function(message, level){
level=typeof level==="undefined" ? 1:level;
if(ezfc_vars.debug_mode==0||ezfc_vars.debug_mode < level) return;
console.log(message);
};
this.jqueryui_date_diff=function(start_date, end_date, workdays_only, element, discount_value_type){
if(!start_date||!end_date) return 0;
var start=new Date(start_date);
var end=new Date(end_date);
var days=0;
var days_price=0;
var days_use_single_prices=false;
var datepicker_day_prices=[];
var datepicker_day_prices_default=false;
var datepicker_day_prices_raw=false;
discount_value_type=discount_value_type||"calculated";
var full_days_only=this.get_element_object_value(element, "daterange_count_full_days", 0);
if(full_days_only==1){
end=end.setDate(end.getDate() + 1);
}
if(element){
datepicker_day_prices_default=this.get_element_object_value(element, "datepicker_day_prices_default", false);
datepicker_day_prices_raw=this.get_element_object_value(element, "datepicker_day_prices", false);
if(typeof datepicker_day_prices_default==="object"){
datepicker_day_prices_default=$.map(datepicker_day_prices_default, parseFloat);
}
if(typeof datepicker_day_prices_raw==="object"){
for (var i in datepicker_day_prices_raw){
var datepicker_day_prices_text_array_row=datepicker_day_prices_raw[i].split("=");
if(datepicker_day_prices_text_array_row.length > 1){
days_use_single_prices=true;
var row_dates=datepicker_day_prices_text_array_row[0].split(":");
row_dates[0]=new Date(row_dates[0]);
row_dates[1]=new Date(row_dates[1]);
var day_prices=$.map(datepicker_day_prices_text_array_row[1].split(","), parseFloat);
datepicker_day_prices.push({
start:  row_dates[0],
end:    row_dates[1],
prices: day_prices,
});
}}
}}
while (start < end){
var day=start.getUTCDay();
var day_price=this.dates_get_single_price(datepicker_day_prices, start);
var add_day=false;
if(workdays_only){
if(day!==6&&day!==7){
add_day=true;
}}else{
add_day=true;
}
if(add_day){
days++;
}
if(day_price!=-1){
days_price +=day_price;
}
else if(datepicker_day_prices_default&&typeof datepicker_day_prices_default[day]!=="undefined"){
days_price +=datepicker_day_prices_default[day];
}
start.setDate(start.getDate() + 1);
}
if(!days_use_single_prices||discount_value_type=="raw") return days;
return days_price;
};
this.dates_get_single_price=function(date_array, day){
for (var i in date_array){
var date_row_object=date_array[i];
if(day >=date_row_object.start&&day <=date_row_object.end){
var utc_day=day.getUTCDay();
if(typeof date_row_object.prices[utc_day]!=="undefined"){
return date_row_object.prices[utc_day];
}
else if(date_row_object.prices[0]!=="undefined"){
return date_row_object.prices[0];
}}
}
return -1;
};
this.roundTo=function(number, precision){
precision=Math.max(0, parseInt(precision));
var factor=Math.pow(10, precision);
var tempNumber=number * factor;
var roundedTempNumber=Math.round(tempNumber);
return roundedTempNumber / factor;
};
this.sprintf=function(){
var args=arguments,
string=args[0],
i=1;
return string.replace(/%((%)|s|d)/g, function (m){
var val=null;
if(m[2]){
val=m[2];
}else{
val=args[i];
switch (m){
case '%d':
val=parseFloat(val);
if(isNaN(val)){
val=0;
}
break;
}
i++;
}
return val;
});
};
this.throttle=function(fn, threshhold, scope){
threshhold=threshhold||(threshhold=100);
var last,
deferTimer;
return function (){
var context=scope||this;
var now=+new Date(),
args=arguments;
if(last&&now < last + threshhold){
clearTimeout(deferTimer);
deferTimer=setTimeout(function (){
last=now;
fn.apply(context, args);
}, threshhold);
}else{
last=now;
fn.apply(context, args);
}};};
this.unique=function(array){
var array_unique=[];
$.each(array, function(i, el){
if($.inArray(el, array_unique)===-1) array_unique.push(el);
});
return array_unique;
};
this.has_class=function($element, classes){
for (var i in classes){
if($element.hasClass(classes[i])) return true;
}
return false;
};
this.is_empty=function(value){
return $.trim(value)==="";
};
this.is_empty_or_zero=function(value){
return this.is_empty(value)||value==0;
};
this.object_has_property=function(obj, key){
if(typeof obj!=="object"||obj===null) return false;
return obj.hasOwnProperty(key);
};
this.generate_ref_id=function(){
function s4(){
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + s4() + s4();
};
this.set_ref_id=function(form_id){
var ref_id=this.generate_ref_id();
$("#ezfc-ref-id-" + form_id).val(ref_id);
};
this.get_calculation_routine_by_name=function(element, name){
if(!element.hasOwnProperty("calculate_routine")) return false;
name=$.trim(name);
var calculation_routines=[];
for (var i in element.calculate_routine){
if(element.calculate_routine[i].name==name){
calculation_routines.push(parseInt(i));
}}
return calculation_routines;
};
this.file_upload_attach_event=function(el, data, $btn, e){
if($(el).val()=="") return false;
data.files=data.originalFiles;
data.submit();
$($btn).attr("disabled", "disabled");
e.preventDefault();
return false;
};
this.init();
};
ezfc_functions={};
var EZFC;
jQuery(document).ready(function($){
EZFC=new EZFC_Object($);
});
};
var APP_XMENU=APP_XMENU||{};(function(a){'use strict';APP_XMENU={timeOutHoverMenu:[],timeOutHoverOutMenu:[],initialize:function(){APP_XMENU.event()},event:function(){APP_XMENU.window_resize(),APP_XMENU.menu_event(),APP_XMENU.window_scroll(),APP_XMENU.tabs_position(5),APP_XMENU.windowLoad()},windowLoad:function(){a(window).load(function(){a('header.main-header .x-nav-menu').each(function(){var b=this;a('header.main-header .x-nav-menu > li').each(function(){APP_XMENU.process_menu_position(this),APP_XMENU.process_tab_padding(this,b)})})})},window_scroll:function(){a(window).on('scroll',function(){APP_XMENU.is_desktop()&&a('header.main-header .x-nav-menu > li').each(function(){APP_XMENU.process_menu_position(this)})})},window_resize:function(){a(window).resize(function(){APP_XMENU.is_desktop()&&(APP_XMENU.tabs_position(5),a('header.main-header .x-nav-menu').each(function(){var b=this;a('header.main-header .x-nav-menu > li').each(function(){APP_XMENU.process_menu_position(this),APP_XMENU.process_tab_padding(this,b)})}))})},tabs_position:function(b){a('header.main-header ul.x-nav-menu').each(function(){a(this).hasClass('x-nav-vmenu')||(a('.x-sub-menu-tab',this).each(function(){var c=a(this),d=a(this).parent().outerWidth();0==a('> li.x-menu-active',this).length&&a('> li:first-child',this).addClass('x-menu-active'),a('> li',this).each(function(){a('> ul',this).css('left',d+'px')}),a('> li.x-menu-active',this).each(function(){APP_XMENU.tab_position(a(this))})}),0<b&&setTimeout(function(){APP_XMENU.tabs_position(b-1)},500))})},tab_position:function(b){var c=0;0!=a('> ul',b).length&&(c=a('> ul',b).outerHeight()),b.parent().css('min-height',c+'px')},menu_event:function(){a('header.main-header .x-sub-menu-tab > li:first-child').addClass('x-menu-active'),APP_XMENU.process_menu_mobile_click(),a('header.main-header .x-nav-menu').each(function(){if(!a(this).hasClass('x-nav-vmenu')){var b=APP_XMENU.get_transition_name(this);APP_XMENU.transition_menu(this,b,this),a('.x-sub-menu-tab > li',this).hover(function(){APP_XMENU.is_desktop()&&(a('> li',a(this).parent()).removeClass('x-menu-active'),a(this).addClass('x-menu-active'),APP_XMENU.tab_position(a(this)))},function(){})}})},process_menu_mobile_click:function(){a('.header-mobile-nav li.x-menu-item, header.header-left li.x-menu-item').on('click',function(b){if(0!=a('> ul.x-sub-menu',this).length&&!(0<a(b.target).closest(a('> ul.x-sub-menu',this)).length)){if(0<a(b.target).closest(a('> a > span',this)).length){var c='';if('undefined'!=typeof b.target&&null!=b.target&&'undefined'!=typeof b.target.baseURI&&null!=b.target.baseURI){var d=b.target.baseURI.split('#');0<d.length&&(c=d[0]);var e=a('> a',this);if(0<e.length){var f=e.attr('href');if('#'!=f&&('undefined'!=typeof f&&null!=f&&(f=f.split('#')[0]),c!=f))return}}}b.preventDefault(),a(this).toggleClass('x-sub-menu-open'),a('> ul.x-sub-menu',this).slideToggle()}})},process_tab_padding:function(b,c){if(APP_XMENU.is_desktop()&&!a(c).hasClass('x-nav-vmenu')){var d=a(b);if(d.hasClass('x-sub-menu-multi-column')){var e=a('> ul.x-sub-menu > li.x-tabs',d);0<e.length&&a(' > ul.x-sub-menu',d).addClass('no-padding')}a('> ul.x-sub-menu > li').each(function(){APP_XMENU.process_tab_padding(this,c)})}},transition_menu:function(b,c,d){var e=a(b);a(d).hasClass('x-nav-vmenu')||a('> li.x-menu-item',e).each(function(){var f=APP_XMENU.get_transition_name(a('> ul',this));''==f&&(f=c);var g=300;''==f&&(g=200);var h=0;a(this).hover(function(){if(APP_XMENU.is_desktop()){var i=a(this);h=i.prop('id'),a('.main-menu').hasClass('x-nav-vmenu')&&0<i.offset().top-jQuery(window).scrollTop()-a(window).outerHeight()/2&&a('> ul',i).removeClass('x-drop-from-bottom').addClass('x-drop-from-bottom'),'undefined'!=typeof APP_XMENU.timeOutHoverMenu[i.prop('id')]&&clearTimeout(APP_XMENU.timeOutHoverMenu[i.prop('id')]),APP_XMENU.timeOutHoverMenu[i.prop('id')]=setTimeout(function(){i.addClass('x-active'),''!=f&&a('> ul',i).addClass(f)},g)}},function(){if(APP_XMENU.is_desktop()){var i=a(this);h=0,a('.main-menu').hasClass('x-nav-vmenu')&&0<i.offset().top-jQuery(window).scrollTop()-a(window).outerHeight()/2&&a('> ul',i).removeClass('x-drop-from-bottom'),clearTimeout(APP_XMENU.timeOutHoverMenu[i.prop('id')]),APP_XMENU.timeOutHoverOutMenu[i.prop('id')]=setTimeout(function(){h==i.prop('id')||i.hasClass('x-active')&&(a('> ul',i).addClass(f+'-out'),setTimeout(function(){''!=f&&(a('> ul',i).removeClass(f),a('> ul',i).removeClass(f+'-out')),a(i).removeClass('x-active')},g))},200)}}),a(this).hasClass('x-sub-menu-multi-column')||APP_XMENU.transition_menu(a('> ul.x-sub-menu',this),c,d)})},get_transition_name:function(b){var c='';return a(b).hasClass('x-animate-slide-up')?c='x-slide-up':a(b).hasClass('x-animate-slide-down')?c='x-slide-down':a(b).hasClass('x-animate-slide-left')?c='x-slide-left':a(b).hasClass('x-animate-slide-right')?c='x-slide-right':a(b).hasClass('x-animate-fade-in')?c='x-fade-in':a(b).hasClass('x-animate-sign-flip')&&(c='x-sign-flip'),c},process_menu_position:function(b){if(!a('.main-menu').hasClass('x-nav-vmenu')){var c=a(b),d=a('.x-nav-menu'),e=a(b).parent();c.hasClass('x-pos-left-menu-parent')?APP_XMENU.process_position_left_menu_parent(b):c.hasClass('x-pos-right-menu-parent')?APP_XMENU.process_position_right_menu_parent(b):c.hasClass('x-pos-center-menu-parent')?APP_XMENU.process_position_center_menu_parent(b):c.hasClass('x-pos-left-menu-bar')?APP_XMENU.process_position_left_menu_bar(b):c.hasClass('x-pos-right-menu-bar')?APP_XMENU.process_position_right_menu_bar(b):c.hasClass('x-pos-full')||APP_XMENU.process_position_right_menu_parent(b)}},get_margin_left:function(b){var c=a(b).css('margin-left');try{c=parseInt(c.replace('px',''),10)}catch(d){c=0}return c},process_position_left_menu_parent:function(b){for(var c=a(b),d=a('header.main-header .x-nav-menu');'BODY'!=d.prop('tagName')&&'static'==d.css('position');)d=d.parent();var e=a('> ul.x-sub-menu',c);if(0!=e.length)if(d.outerWidth()<=e.outerWidth())e.css('left','0'),e.css('right','0');else{var f=APP_XMENU.get_margin_left(b),g=d.outerWidth()-a(b).outerWidth()-a(b).position().left-f;a(b).outerWidth()+a(b).position().left+f<e.outerWidth()?(e.css('left','0'),e.css('right','auto')):(e.css('left','auto'),e.css('right',g+'px'))}},process_position_right_menu_parent:function(b){for(var c=a(b),d=a('header.main-header .x-nav-menu');'BODY'!=d.prop('tagName')&&'static'==d.css('position');)d=d.parent();var e=a('> ul.x-sub-menu',c);if(0!=e.length){var f=APP_XMENU.get_margin_left(b);d.outerWidth()<=e.outerWidth()?(e.css('left','0'),e.css('right','0')):d.outerWidth()-a(b).position().left-f<e.outerWidth()?(e.css('left','auto'),e.css('right','0')):(e.css('left',a(b).position().left+f+'px'),e.css('right','auto'))}},process_position_center_menu_parent:function(b){for(var c=a(b),d=a('header.main-header .x-nav-menu');'BODY'!=d.prop('tagName')&&'static'==d.css('position');)d=d.parent();var e=a('> ul.x-sub-menu',c);if(0!=e.length)if(d.outerWidth()<=e.outerWidth())e.css('left','0'),e.css('right','0');else{var f=APP_XMENU.get_margin_left(b),g=(e.outerWidth()-c.outerWidth()-f)/2;g>a(b).position().left?(e.css('left','0'),e.css('right','auto')):g>d.outerWidth()-a(b).outerWidth()-a(b).position().left?(e.css('left','auto'),e.css('right','0')):(e.css('left',a(b).position().left-g+'px'),e.css('right','auto'))}},process_position_left_menu_bar:function(b){var c=a(b),d=a('> ul.x-sub-menu',c);d.css('left','0'),d.css('right','auto')},process_position_right_menu_bar:function(b){var c=a(b),d=a('> ul.x-sub-menu',c);d.css('left','auto'),d.css('right','0')},is_desktop:function(){var b=991,c=a('body');return'undefined'==typeof c.attr('data-breakpoint')||isNaN(parseInt(c.attr('data-breakpoint'),10))||(b=parseInt(c.attr('data-breakpoint'),10)),window.matchMedia('(min-width: '+(b+1)+'px)').matches}},a(document).ready(function(){APP_XMENU.initialize()})})(jQuery);