f={initialize:function(){f.verbose("Initializing checkbox",g),f.create.label(),f.bind.events(),f.set.tabbable(),f.hide.input(),f.observeChanges(),f.instantiate(),f.setup()},instantiate:function(){f.verbose("Storing instance of module",f),R=f,C.data(x,f)},destroy:function(){f.verbose("Destroying module"),f.unbind.events(),f.show.input(),C.removeData(x)},fix:{reference:function(){C.is(h.input)&&(f.debug("Behavior called on <input> adjusting invoked element"),C=C.closest(h.checkbox),f.refresh())}},setup:function(){f.set.initialLoad(),f.is.indeterminate()?(f.debug("Initial value is indeterminate"),f.indeterminate()):f.is.checked()?(f.debug("Initial value is checked"),f.check()):(f.debug("Initial value is unchecked"),f.uncheck()),f.remove.initialLoad()},refresh:function(){w=C.children(h.label),k=C.children(h.input),S=k[0]},hide:{input:function(){f.verbose("Modfying <input> z-index to be unselectable"),k.addClass(p.hidden)}},show:{input:function(){f.verbose("Modfying <input> z-index to be selectable"),k.removeClass(p.hidden)}},observeChanges:function(){"MutationObserver"int&&(r=newMutationObserver(function(e){f.debug("DOM tree modified, updating selector cache"),f.refresh()}),r.observe(E,{childList:!0,subtree:!0}),f.debug("Setting up mutation observer",r))},attachEvents:function(t,n){vari=e(t);n=e.isFunction(f[n])?f[n]:f.toggle,i.length>0?(f.debug("Attaching checkbox events to element",t,n),i.on("click"+y,n)):f.error(b.notFound)},event:{click:function(t){varn=e(t.target);returnn.is(h.input)?voidf.verbose("Using default check action on initialized checkbox"):n.is(h.link)?voidf.debug("Clicking link inside checkbox, skipping toggle"):(f.toggle(),k.focus(),voidt.preventDefault())},keydown:function(e){vart=e.which,n={enter:13,space:32,escape:27};t==n.escape?(f.verbose("Escape key pressed blurring field"),k.blur(),A=!0):e.ctrlKey||t!=n.space&&t!=n.enter?A=!1:(f.verbose("Enter/space key pressed, toggling checkbox"),f.toggle(),A=!0)},keyup:function(e){A&&e.preventDefault()}},check:function(){f.should.allowCheck()&&(f.debug("Checking checkbox",k),f.set.checked(),f.should.ignoreCallbacks()||(g.onChecked.call(S),g.onChange.call(S)))},uncheck:function(){f.should.allowUncheck()&&(f.debug("Unchecking checkbox"),f.set.unchecked(),f.should.ignoreCallbacks()||(g.onUnchecked.call(S),g.onChange.call(S)))},indeterminate:function(){returnf.should.allowIndeterminate()?voidf.debug("Checkbox is already indeterminate"):(f.debug("Making checkbox indeterminate"),f.set.indeterminate(),void(f.should.ignoreCallbacks()||(g.onIndeterminate.call(S),g.onChange.call(S))))},determinate:function(){returnf.should.allowDeterminate()?voidf.debug("Checkbox is already determinate"):(f.debug("Making checkbox determinate"),f.set.determinate(),void(f.should.ignoreCallbacks()||(g.onDeterminate.call(S),g.onChange.call(S))))},enable:function(){returnf.is.enabled()?voidf.debug("Checkbox is already enabled"):(f.debug("Enabling checkbox"),f.set.enabled(),voidg.onEnable.call(S))},disable:function(){returnf.is.disabled()?voidf.debug("Checkbox is already disabled"):(f.debug("Disabling checkbox"),f.set.disabled(),voidg.onDisable.call(S))},get:{radios:function(){vart=f.get.name();returne('input[name="'+t+'"]').closest(h.checkbox)},otherRadios:function(){returnf.get.radios().not(C)},name:function(){returnk.attr("name")}},is:{initialLoad:function(){returnT},radio:function(){returnk.hasClass(p.radio)||"radio"==k.attr("type")},indeterminate:function(){returnk.prop("indeterminate")!==i&&k.prop("indeterminate")},checked:function(){returnk.prop("checked")!==i&&k.prop("checked")},disabled:function(){returnk.prop("disabled")!==i&&k.prop("disabled")},enabled:function(){return!f.is.disabled()},determinate:function(){return!f.is.indeterminate()},unchecked:function(){return!f.is.checked()}},should:{allowCheck:function(){returnf.is.determinate()&&f.is.checked()&&!f.should.forceCallbacks()?(f.debug("Should not allow check, checkbox is already checked"),!1):g.beforeChecked.apply(S)===!1?(f.debug("Should not allow check, beforeChecked cancelled"),!1):!0},allowUncheck:f
e.preventDefault()):(w.verbose("Selecting previous label"),i.last().addClass(S.active)):t==R.rightArrow?(f&&!s&&i.first().addClass(S.active),s&&(e.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"),i.removeClass(S.active)),u?d?m?i.removeClass(S.active):w.focusSearch():c?o.next(D.siblingLabel).addClass(S.active):o.addClass(S.active):o.next(D.siblingLabel).addClass(S.active),e.preventDefault())):t==R.deleteKey||t==R.backspace?s?(w.verbose("Removing active labels"),u&&d&&!m&&w.focusSearch(),o.last().next(D.siblingLabel).addClass(S.active),w.remove.activeLabels(o),e.preventDefault()):g&&!s&&t==R.backspace&&(w.verbose("Removing last label on input backspace"),o=i.last().addClass(S.active),w.remove.activeLabels(o)):o.removeClass(S.active)}}},keydown:function(e){vart=e.which,n=w.is.inObject(t,R);if(n){vari,o,a=B.not(D.unselectable).filter("."+S.selected).eq(0),r=W.children("."+S.active).eq(0),s=a.length>0?a:r,c=s.length>0?s.siblings(":not(."+S.filtered+")").andSelf():W.children(":not(."+S.filtered+")"),l=s.children(D.menu),u=s.closest(D.menu),d=u.hasClass(S.visible)||u.hasClass(S.animating)||u.parent(D.menu).length>0,m=l.length>0,f=s.length>0,g=s.not(D.unselectable).length>0,p=t==R.delimiter&&k.allowAdditions&&w.is.multiple();if(w.is.visible()){if((t==R.enter||p)&&(t==R.enter&&f&&m&&!k.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=R.rightArrow):g&&(w.verbose("Selecting item from keyboard shortcut",s),w.event.item.click.call(s,e),w.is.searchSelection()&&w.remove.searchTerm()),e.preventDefault()),t==R.leftArrow&&(o=u[0]!==W[0],o&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,u),s.removeClass(S.selected),u.closest(D.item).addClass(S.selected),e.preventDefault())),t==R.rightArrow&&m&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,l),s.removeClass(S.selected),l.find(D.item).eq(0).addClass(S.selected),e.preventDefault()),t==R.upArrow){if(i=f&&d?s.prevAll(D.item+":not("+D.unselectable+")").eq(0):B.eq(0),c.index(i)<0)returnw.verbose("Up key pressed but reached top of current menu"),voide.preventDefault();w.verbose("Up key pressed, changing active item"),s.removeClass(S.selected),i.addClass(S.selected),w.set.scrollPosition(i),e.preventDefault()}if(t==R.downArrow){if(i=f&&d?i=s.nextAll(D.item+":not("+D.unselectable+")").eq(0):B.eq(0),0===i.length)returnw.verbose("Down key pressed but reached bottom of current menu"),voide.preventDefault();w.verbose("Down key pressed, changing active item"),B.removeClass(S.selected),i.addClass(S.selected),w.set.scrollPosition(i),e.preventDefault()}t==R.pageUp&&(w.scrollPage("up"),e.preventDefault()),t==R.pageDown&&(w.scrollPage("down"),e.preventDefault()),t==R.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}elsep&&e.preventDefault(),t==R.downArrow&&(w.verbose("Down key pressed, showing dropdown"),w.show(),e.preventDefault())}elsew.is.selection()&&!w.is.search()&&w.set.selectedLetter(String.fromCharCode(t))}},trigger:{change:function(){vare=n.createEvent("HTMLEvents"),t=H[0];t&&(w.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},determine:{selectAction:function(t,n){w.verbose("Determining action",k.action),e.isFunction(w.action[k.action])?(w.verbose("Triggering preset action",k.action,t,n),w.action[k.action].call(this,t,n)):e.isFunction(k.action)?(w.verbose("Triggering user action",k.action,t,n),k.action.call(this,t,n)):w.error(O.action,k.action)},eventInModule:function(t,i){varo=e(t.target),a=o.closest(n.documentElement).length>0,r=o.closest(I).length>0;returni=e.isFunction(i)?i:function(){},a&&!r?(w.verbose("Triggering event",i),i(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){vari=e(t.target),o=i.closest(D.siblingLabel),a=0===I.find(o).length,r=0===i.closest(W).length;returnn=e.isFunction(n)?n:function(){},a&&r?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(
u=y.get.popupOffset(),d=y.get.distanceFromBoundary(u,t),y.is.offstage(d,e)){if(y.debug("Position is outside viewport",e),D<x.maxSearchDepth)returnD++,e=y.get.nextPosition(e),y.debug("Trying new position",e),n?y.set.position(e,t):!1;if(!x.lastResort)returny.debug("Popup could not find a position to display",n),y.error(k.cannotPlace,j),y.remove.attempts(),y.remove.loading(),y.reset(),!1;y.debug("No position found, showing with last position")}returny.debug("Position is on stage",e),y.remove.attempts(),y.remove.loading(),x.setFluidWidth&&y.is.fluid()&&y.set.fluidWidth(t),!0},fluidWidth:function(e){e=e||y.get.calculations(),y.debug("Automatically setting element width to parent width",e.parent.width),n.css("width",e.container.width)},variation:function(e){e=e||y.get.variation(),e&&y.has.popup()&&(y.verbose("Adding variation to popup",e),n.addClass(e))},visible:function(){E.addClass(w.visible)}},remove:{loading:function(){n.removeClass(w.loading)},variation:function(e){e=e||y.get.variation(),e&&(y.verbose("Removing variation",e),n.removeClass(e))},visible:function(){E.removeClass(w.visible)},attempts:function(){y.verbose("Resetting all searched positions"),D=0,O=!1}},bind:{events:function(){y.debug("Binding popup events to module"),"click"==x.on&&E.on("click"+A,y.toggle),"hover"==x.on&&d&&E.on("touchstart"+A,y.event.touchstart),y.get.startEvent()&&E.on(y.get.startEvent()+A,y.event.start).on(y.get.endEvent()+A,y.event.end),x.target&&y.debug("Target set to element",F),c.on("resize"+h,y.event.resize)},popup:function(){y.verbose("Allowing hover events on popup to prevent closing"),n&&y.has.popup()&&n.on("mouseenter"+A,y.event.start).on("mouseleave"+A,y.event.end)},close:function(){(x.hideOnScroll===!0||"auto"==x.hideOnScroll&&"click"!=x.on)&&(s.one(y.get.scrollEvent()+h,y.event.hideGracefully),P.one(y.get.scrollEvent()+h,y.event.hideGracefully)),"hover"==x.on&&q&&(y.verbose("Binding popup close event to document"),s.on("touchstart"+h,function(e){y.verbose("Touched away from popup"),y.event.hideGracefully.call(j,e)})),"click"==x.on&&x.closable&&(y.verbose("Binding popup close event to document"),s.on("click"+h,function(e){y.verbose("Clicked away from popup"),y.event.hideGracefully.call(j,e)}))}},unbind:{close:function(){(x.hideOnScroll===!0||"auto"==x.hideOnScroll&&"click"!=x.on)&&(s.off("scroll"+h,y.hide),P.off("scroll"+h,y.hide)),"hover"==x.on&&q&&(s.off("touchstart"+h),q=!1),"click"==x.on&&x.closable&&(y.verbose("Removing close event from document"),s.off("click"+h))}},has:{popup:function(){returnn&&n.length>0}},is:{offstage:function(t,n){vari=[];returne.each(t,function(e,t){t<-x.jitter&&(y.debug("Position exceeds allowable distance from edge",e,t,n),i.push(e))}),i.length>0?!0:!1},active:function(){returnE.hasClass(w.active)},animating:function(){returnn&&n.hasClass(w.animating)},fluid:function(){returnn&&n.hasClass(w.fluid)},visible:function(){returnn&&n.hasClass(w.visible)},dropdown:function(){returnE.hasClass(w.dropdown)},hidden:function(){return!y.is.visible()},rtl:function(){return"rtl"==E.css("direction")}},reset:function(){y.remove.visible(),x.preserve?e.fn.transition!==i&&n.transition("remove transition"):y.removePopup()},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,x,t);else{if(n===i)returnx[t];x[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,y,t);else{if(n===i)returny[t];y[t]=n}},debug:function(){x.debug&&(x.performance?y.performance.log(arguments):(y.debug=Function.prototype.bind.call(console.info,console,x.name+":"),y.debug.apply(console,arguments)))},verbose:function(){x.verbose&&x.debug&&(x.performance?y.performance.log(arguments):(y.verbose=Function.prototype.bind.call(console.info,console,x.name+":"),y.verbose.apply(console,arguments)))},error:function(){y.error=Function.prototype.bind.call(console.error,console,x.name+":"),y.error.apply(console,arguments)},performance:{log:function(e){vart,n,i;x.performance&&(t=(newDate).getTime(),i=m||t,n=t-i,m=t,f.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:j,"Execution Time":n})),clearTimeout(y.performance.timer),y.per
if(n===i)returng[t];g[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,f,t);else{if(n===i)returnf[t];f[t]=n}},debug:function(){g.debug&&(g.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,g.name+":"),f.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,g.name+":"),f.verbose.apply(console,arguments)))},error:function(){f.error=Function.prototype.bind.call(console.error,console,g.name+":"),f.error.apply(console,arguments)},performance:{log:function(e){vart,n,i;g.performance&&(t=(newDate).getTime(),i=c||t,n=t-i,c=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:E,"Execution Time":n})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(f.performance.display,500)},display:function(){vart=g.name+":",n=0;c=!1,clearTimeout(f.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",s&&(t+=" '"+s+"'"),r.length>1&&(t+=" ("+r.length+")"),(console.group!==i||console.table!==i)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,o){varr,s,c,l=P;returnn=n||m,o=E||o,"string"==typeoft&&l!==i&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,o){vara=n!=r?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[a])&&n!=r)l=l[a];else{if(l[a]!==i)returns=l[a],!1;if(!e.isPlainObject(l[o])||n==r)returnl[o]!==i?(s=l[o],!1):!1;l=l[o]}})),e.isFunction(s)?c=s.apply(o,n):s!==i&&(c=s),e.isArray(a)?a.push(c):a!==i?a=[a,c]:c!==i&&(a=c),s}},d?(P===i&&f.initialize(),f.invoke(u)):(P!==i&&P.invoke("destroy"),f.initialize())}),a!==i?a:this},e.fn.search.settings={name:"Search",namespace:"search",debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,apiSettings:!1,source:!1,searchFields:["title","description"],displayField:"",searchFullText:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,transition:"scale",duration:200,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(e){},onResults:function(e){},onResultsOpen:function(){},onResultsClose:function(){},className:{active:"active",empty:"empty",focus:"focus",loading:"loading",results:"results",pressed:"down"},error:{source:"Cannot search. No source used, and Semantic API module was not included",noResults:"Your search returned no results",logging:"Error in debug logging, exiting.",noEndpoint:"No search endpoint was specified",noTemplate:"A valid template name was not specified.",serverError:"There was an issue querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,beginsWith:"(?:s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",price:"price",results:"results",title:"title",url:"url",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",searchButton:".search.button",results:".results",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e){vart=/[&<>"'`]/g,n=/[&<>"'`]/,i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},o=function(e){returni[e]};returnn.test(e)?e.replace(t,o):e},message:function(e,t){varn="";returne!==i&&t!==i&&(n+='<div class="message '+t+'">',n+="empty"==t?'<div class="header">No Results</div class="header"><div class="description">'+e+'</div class="description">':' <div class="description">'+e+"</div>",n+="</div>"),n},category:function(t,n){varo="";e.fn.search.settings.templates.escape;returnt[n.categoryResults]!==i?(e.each(t[n.categoryResults],function(t,a){a[n.results]!==i&&a.results.length>0&&(o+='<div class="category">',a[n.categoryName]!==i&&(o+='<div class="name">'+a[n.categoryName
},offset:C.offset(),width:C.outerWidth(),height:C.outerHeight()},n={offset:m.offset(),height:m.outerHeight()};({height:a.outerHeight()});g.is.standardScroll()||(g.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=k.scrollTop(),e.left=k.scrollLeft(),t.offset.top+=e.top,n.offset.top+=e.top,t.offset.left+=e.left,n.offset.left+=e.left),g.cache={fits:t.height<e.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:n.offset.top,height:n.height,bottom:n.offset.top+n.height}},g.set.containerSize(),g.set.size(),g.stick(),g.debug("Caching element positions",g.cache)}},get:{direction:function(e){vart="down";returne=e||k.scrollTop(),g.lastScroll!==i&&(g.lastScroll<e?t="down":g.lastScroll>e&&(t="up")),t},scrollChange:function(e){returne=e||k.scrollTop(),g.lastScroll?e-g.lastScroll:0},currentElementScroll:function(){returng.elementScroll?g.elementScroll:g.is.top()?Math.abs(parseInt(C.css("top"),10))||0:Math.abs(parseInt(C.css("bottom"),10))||0},elementScroll:function(e){e=e||k.scrollTop();vart=g.cache.element,n=g.cache.scrollContext,i=g.get.scrollChange(e),o=t.height-n.height+p.offset,a=g.get.currentElementScroll(),r=a+i;returna=g.cache.fits||0>r?0:r>o?o:r}},remove:{lastScroll:function(){deleteg.lastScroll},elementScroll:function(e){deleteg.elementScroll},offset:function(){C.css("margin-top","")}},set:{offset:function(){g.verbose("Setting offset on element",p.offset),C.css("margin-top",p.offset)},containerSize:function(){vare=a.get(0).tagName;"HTML"===e||"body"==e?g.determineContainer():Math.abs(a.outerHeight()-g.cache.context.height)>p.jitter&&(g.debug("Context has padding, specifying exact height for container",g.cache.context.height),a.css({height:g.cache.context.height}))},minimumSize:function(){vare=g.cache.element;a.css("min-height",e.height)},scroll:function(e){g.debug("Setting scroll on element",e),g.elementScroll!=e&&(g.is.top()&&C.css("bottom","").css("top",-e),g.is.bottom()&&C.css("top","").css("bottom",e))},size:function(){0!==g.cache.element.height&&0!==g.cache.element.width&&(A.style.setProperty("width",g.cache.element.width+"px","important"),A.style.setProperty("height",g.cache.element.height+"px","important"))}},is:{standardScroll:function(){returnk[0]==t},top:function(){returnC.hasClass(v.top)},bottom:function(){returnC.hasClass(v.bottom)},initialPosition:function(){return!g.is.fixed()&&!g.is.bound()},hidden:function(){return!C.is(":visible")},bound:function(){returnC.hasClass(v.bound)},fixed:function(){returnC.hasClass(v.fixed)}},stick:function(e){vart=e||k.scrollTop(),n=g.cache,i=n.fits,o=n.element,a=n.scrollContext,r=n.context,s=g.is.bottom()&&p.pushing?p.bottomOffset:p.offset,e={top:t+s,bottom:t+s+a.height},c=(g.get.direction(e.top),i?0:g.get.elementScroll(e.top)),l=!i,u=0!==o.height;u&&(g.is.initialPosition()?e.top>=r.bottom?(g.debug("Initial element position is bottom of container"),g.bindBottom()):e.top>o.top&&(o.height+e.top-c>=r.bottom?(g.debug("Initial element position is bottom of container"),g.bindBottom()):(g.debug("Initial element position is fixed"),g.fixTop())):g.is.fixed()?g.is.top()?e.top<=o.top?(g.debug("Fixed element reached top of container"),g.setInitialPosition()):o.height+e.top-c>=r.bottom?(g.debug("Fixed element reached bottom of container"),g.bindBottom()):l&&(g.set.scroll(c),g.save.lastScroll(e.top),g.save.elementScroll(c)):g.is.bottom()&&(e.bottom-o.height<=o.top?(g.debug("Bottom fixed rail has reached top of container"),g.setInitialPosition()):e.bottom>=r.bottom?(g.debug("Bottom fixed rail has reached bottom of container"),g.bindBottom()):l&&(g.set.scroll(c),g.save.lastScroll(e.top),g.save.elementScroll(c))):g.is.bottom()&&(e.top<=o.top?(g.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),g.setInitialPosition()):p.pushing?g.is.bound()&&e.bottom<=r.bottom&&(g.debug("Fixing bottom attached element to bottom of browser."),g.fixBottom()):g.is.bound()&&e.top<=r.bottom-o.height&&(g.debug("F
support:"This browser does not support CSS animations"}}}(jQuery,window,document),function(e,t,n,i){"use strict";e.api=e.fn.api=function(n){varo,a=e(e.isFunction(this)?t:this),r=a.selector||"",s=(newDate).getTime(),c=[],l=arguments[0],u="string"==typeofl,d=[].slice.call(arguments,1);returna.each(function(){vara,m,f,g,p,v,h=e.isPlainObject(n)?e.extend(!0,{},e.fn.api.settings,n):e.extend({},e.fn.api.settings),b=h.namespace,y=h.metadata,x=h.selector,C=h.error,w=h.className,k="."+b,S="module-"+b,T=e(this),A=T.closest(x.form),R=h.stateContext?e(h.stateContext):T,E=this,P=R[0],F=T.data(S);v={initialize:function(){u||v.bind.events(),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),F=v,T.data(S,F)},destroy:function(){v.verbose("Destroying previous module for",E),T.removeData(S).off(k)},bind:{events:function(){vare=v.get.event();e?(v.verbose("Attaching API events to element",e),T.on(e+k,v.event.trigger)):"now"==h.on&&(v.debug("Querying API endpoint immediately"),v.query())}},decode:{json:function(e){if(e!==i&&"string"==typeofe)try{e=JSON.parse(e)}catch(t){}returne}},read:{cachedResponse:function(e){varn;returnt.Storage===i?voidv.error(C.noStorage):(n=sessionStorage.getItem(e),v.debug("Using cached response",e,n),n=v.decode.json(n),!1)}},write:{cachedResponse:function(n,o){returno&&""===o?voidv.debug("Response empty, not caching",o):t.Storage===i?voidv.error(C.noStorage):(e.isPlainObject(o)&&(o=JSON.stringify(o)),sessionStorage.setItem(n,o),voidv.verbose("Storing cached response for url",n,o))}},query:function(){if(v.is.disabled())returnvoidv.debug("Element is disabled API request aborted");if(v.is.loading()){if(!h.interruptRequests)returnvoidv.debug("Cancelling request, previous request is still pending");v.debug("Interrupting previous request"),v.abort()}returnh.defaultData&&e.extend(!0,h.urlData,v.get.defaultData()),h.serializeForm&&(h.data=v.add.formData(h.data)),m=v.get.settings(),m===!1?(v.cancelled=!0,voidv.error(C.beforeSend)):(v.cancelled=!1,f=v.get.templatedURL(),f||v.is.mocked()?(f=v.add.urlData(f),f||v.is.mocked()?(a=e.extend(!0,{},h,{type:h.method||h.type,data:g,url:h.base+f,beforeSend:h.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),v.debug("Querying URL",a.url),v.verbose("Using AJAX settings",a),"local"===h.cache&&v.read.cachedResponse(f)?(v.debug("Response returned from local cache"),v.request=v.create.request(),voidv.request.resolveWith(P,[v.read.cachedResponse(f)])):void(h.throttle?h.throttleFirstRequest||v.timer?(v.debug("Throttling request",h.throttle),clearTimeout(v.timer),v.timer=setTimeout(function(){v.timer&&deletev.timer,v.debug("Sending throttled request",g,a.method),v.send.request()},h.throttle)):(v.debug("Sending request",g,a.method),v.send.request(),v.timer=setTimeout(function(){},h.throttle)):(v.debug("Sending request",g,a.method),v.send.request()))):void0):voidv.error(C.missingURL))},should:{removeError:function(){returnh.hideError===!0||"auto"===h.hideError&&!v.is.form()}},is:{disabled:function(){returnT.filter(x.disabled).length>0},form:function(){returnT.is("form")||R.is("form")},mocked:function(){returnh.mockResponse||h.mockResponseAsync},input:function(){returnT.is("input")},loading:function(){returnv.request&&"pending"==v.request.state()},abortedRequest:function(e){returne&&e.readyState!==i&&0===e.readyState?(v.verbose("XHR request determined to be aborted"),!0):(v.verbose("XHR request was not aborted"),!1)},validResponse:function(t){return"json"!==h.dataType&&"jsonp"!==h.dataType||!e.isFunction(h.successTest)?(v.verbose("Response is not JSON, skipping validation",h.successTest,t),!0):(v.debug("Checking JSON returned success",h.successTest,t),h.successTest(t)?(v.debug("Response passed success test",t),!0):(v.debug("Response failed success test",t),!1))}},was:{cancelled:function(){returnv.cancelled||!1},succesful:function(){returnv.request&&"resolved"==v.request.state()},failure:function(){returnv.request&&"rejected"==v.request.state()},complete:function(){returnv.request&&("resolved"==v.request.st
g.cache.direction},elementPosition:function(){vare=g.cache.element,t=g.get.screenSize();returng.verbose("Saving element position"),e.fits=e.height<t.height,e.offset=k.offset(),e.width=k.outerWidth(),e.height=k.outerHeight(),g.cache.element=e,e},elementCalculations:function(){vare=g.get.screenCalculations(),t=g.get.elementPosition();returnp.includeMargin?(t.margin={},t.margin.top=parseInt(k.css("margin-top"),10),t.margin.bottom=parseInt(k.css("margin-bottom"),10),t.top=t.offset.top-t.margin.top,t.bottom=t.offset.top+t.height+t.margin.bottom):(t.top=t.offset.top,t.bottom=t.offset.top+t.height),t.topVisible=e.bottom>=t.top,t.topPassed=e.top>=t.top,t.bottomVisible=e.bottom>=t.bottom,t.bottomPassed=e.top>=t.bottom,t.pixelsPassed=0,t.percentagePassed=0,t.onScreen=t.topVisible&&!t.bottomPassed,t.passing=t.topPassed&&!t.bottomPassed,t.offScreen=!t.onScreen,t.passing&&(t.pixelsPassed=e.top-t.top,t.percentagePassed=(e.top-t.top)/t.height),g.cache.element=t,g.verbose("Updated element calculations",t),t},screenCalculations:function(){vare=g.get.scroll();returng.save.direction(),g.cache.screen.top=e,g.cache.screen.bottom=e+g.cache.screen.height,g.cache.screen},screenSize:function(){g.verbose("Saving window position"),g.cache.screen={height:S.height()}},position:function(){g.save.screenSize(),g.save.elementPosition()}},get:{pixelsPassed:function(e){vart=g.get.elementCalculations();returne.search("%")>-1?t.height*(parseInt(e,10)/100):parseInt(e,10)},occurred:function(e){returng.cache.occurred!==i?g.cache.occurred[e]||!1:!1},direction:function(){returng.cache.direction===i&&g.save.direction(),g.cache.direction},elementPosition:function(){returng.cache.element===i&&g.save.elementPosition(),g.cache.element},elementCalculations:function(){returng.cache.element===i&&g.save.elementCalculations(),g.cache.element},screenCalculations:function(){returng.cache.screen===i&&g.save.screenCalculations(),g.cache.screen},screenSize:function(){returng.cache.screen===i&&g.save.screenSize(),g.cache.screen},scroll:function(){returng.cache.scroll===i&&g.save.scroll(),g.cache.scroll},lastScroll:function(){returng.cache.screen===i?(g.debug("First scroll event, no last scroll could be found"),!1):g.cache.screen.top}},setting:function(t,n){if(e.isPlainObject(t))e.extend(!0,p,t);else{if(n===i)returnp[t];p[t]=n}},internal:function(t,n){if(e.isPlainObject(t))e.extend(!0,g,t);else{if(n===i)returng[t];g[t]=n}},debug:function(){p.debug&&(p.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,p.name+":"),g.debug.apply(console,arguments)))},verbose:function(){p.verbose&&p.debug&&(p.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),g.verbose.apply(console,arguments)))},error:function(){g.error=Function.prototype.bind.call(console.error,console,p.name+":"),g.error.apply(console,arguments)},performance:{log:function(e){vart,n,i;p.performance&&(t=(newDate).getTime(),i=c||t,n=t-i,c=t,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:R,"Execution Time":n})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){vart=p.name+":",n=0;c=!1,clearTimeout(g.performance.timer),e.each(l,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",s&&(t+=" '"+s+"'"),(console.group!==i||console.table!==i)&&l.length>0&&(console.groupCollapsed(t),console.table?console.table(l):e.each(l,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(t,n,o){varr,s,c,l=T;returnn=n||m,o=R||o,"string"==typeoft&&l!==i&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,o){vara=n!=r?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[a])&&n!=r)l=l[a];else{if(l[a]!==i)returns=l[a],!1;if(!e.isPlainObject(l[o])||n==r)returnl[o]!==i?(s=l[o],!1):(g.error(b.method,t),!1);l=l[o]}})),e.isFunction(s)?c=s.apply(o,n):s!==i&&(c=s),e.isArray(a)?a.push(c):a!==i?a=[a,c]:c!==i&&(a=c),s}},d?(T===i&&g.initialize(),T.save.scroll(),T.save.calculations(),g