tungsten 0.1.20 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/tungsten/_icons.js +1 -1
  3. data/app/assets/javascripts/tungsten/enhancements/text-helpers.js +10 -0
  4. data/app/assets/stylesheets/tungsten/_colors.yml +1 -0
  5. data/app/assets/stylesheets/tungsten/components/_toggle-nav.scss +1 -0
  6. data/app/assets/stylesheets/tungsten/core/_banner.scss +44 -0
  7. data/app/assets/stylesheets/tungsten/core/_index.scss +2 -1
  8. data/app/assets/stylesheets/tungsten/core/_layout.scss +0 -41
  9. data/app/assets/stylesheets/tungsten/form/_base.scss +1 -1
  10. data/app/assets/stylesheets/tungsten/form/_copy-input.scss +5 -4
  11. data/app/assets/stylesheets/tungsten/form/_label-placeholder.scss +4 -4
  12. data/app/assets/svgs/tungsten/cluster.svg +1 -0
  13. data/app/assets/svgs/tungsten/copy.svg +1 -1
  14. data/app/helpers/tungsten/button_helper.rb +1 -1
  15. data/app/helpers/tungsten/form_helper.rb +1 -1
  16. data/app/views/layouts/tungsten/default.html.slim +1 -4
  17. data/lib/tungsten/version.rb +1 -1
  18. data/public/{code-0.1.20.js → code-0.1.21.js} +1 -1
  19. data/public/{code-0.1.20.js.gz → code-0.1.21.js.gz} +0 -0
  20. data/public/{code-0.1.20.map.json → code-0.1.21.map.json} +0 -0
  21. data/public/{tungsten-0.1.20.css → tungsten-0.1.21.css} +142 -161
  22. data/public/tungsten-0.1.21.css.gz +0 -0
  23. data/public/{tungsten-0.1.20.js → tungsten-0.1.21.js} +3 -3
  24. data/public/tungsten-0.1.21.js.gz +0 -0
  25. data/public/tungsten-0.1.21.map.json +1 -0
  26. metadata +12 -10
  27. data/public/tungsten-0.1.20.css.gz +0 -0
  28. data/public/tungsten-0.1.20.js.gz +0 -0
  29. data/public/tungsten-0.1.20.map.json +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["node_modules/browser-pack/_prelude.js","app/assets/javascripts/tungsten/_form-helpers.js","app/assets/javascripts/tungsten/_icons.js","app/assets/javascripts/tungsten/enhancements/clipboard.js","app/assets/javascripts/tungsten/enhancements/flash-messages.js","app/assets/javascripts/tungsten/enhancements/notify.js","app/assets/javascripts/tungsten/enhancements/text-helpers.js","app/assets/javascripts/tungsten/tungsten.js","node_modules/bean/bean.js","node_modules/component-emitter/index.js","node_modules/compose-event/index.js","node_modules/compose-event/lib/animation-events.js","node_modules/compose-event/lib/bubble-form-events.js","node_modules/compose-event/lib/callback-manager.js","node_modules/compose-event/lib/debounce.js","node_modules/compose-event/lib/delay.js","node_modules/compose-event/lib/media.js","node_modules/compose-event/lib/optimized-event-manager.js","node_modules/compose-event/lib/page.js","node_modules/compose-event/lib/repeat.js","node_modules/compose-event/lib/resize.js","node_modules/compose-event/lib/scroll.js","node_modules/compose-event/lib/shims/custom-event.js","node_modules/compose-event/lib/tap-events.js","node_modules/compose-event/lib/throttle.js","node_modules/compose-form-up/index.js","node_modules/compose-form-up/lib/progressive.js","node_modules/compose-form-up/lib/validation.js","node_modules/compose-slider/index.js","node_modules/compose-slider/lib/object.assign.js","node_modules/compose-toggler/index.js","node_modules/compose-toolbox/index.js","node_modules/compose-toolbox/lib/ease.js","node_modules/compose-toolbox/lib/fromtop.js","node_modules/compose-toolbox/lib/scrollto.js","node_modules/compose-toolbox/lib/shims/_classlist.js","node_modules/compose-toolbox/lib/shims/_object.assign.js","node_modules/keymaster/keymaster.js","node_modules/superagent/lib/client.js","node_modules/superagent/lib/is-object.js","node_modules/superagent/lib/request-base.js","node_modules/superagent/lib/request.js"],"names":["syncValue","input","target","classList","toggle","value","trim","length","toolbox","require","Event","event","textSelectors","change","each","document","querySelectorAll","on","embed","querySelector","insertAdjacentHTML","readyState","window","Turbolinks","addEventListener","clipboard","copy","console","log","copyTrigger","currentTarget","copyElement","dataset","copyTarget","preventDefault","select","execCommand","blur","add","setTimeout","remove","err","alert","module","exports","Notify","flash","type","textContent","notify","message","show","clearTimeout","autoDismissTimeout","messageEl","dismiss","body","template","lastChild","innerHTML","defaults","defaultsByType","dismissAfter","keyOne","one","callback","cb","timeout","afterAnimation","parentNode","removeChild","normal","success","autoSizeTextarea","textarea","parent","parentElement","contains","style","height","offset","offsetHeight","clientHeight","newHeight","scrollHeight","maxHeight","innerHeight","textareas","delay","Array","prototype","forEach","call","toggler","formUp","ajax","scroll","disablePointer","Tungsten","merge","form","name","context","definition","define","amd","this","selectorEngine","win","old","namespaceRegex","nameRegex","addEvent","doc","root","documentElement","W3C_MODEL","eventSupport","ONE","slice","str2arr","s","d","split","isString","o","isFunction","isObject","buildOptions","originalDefaults","maybeOptions","key","hasOwnProperty","nativeEvents","hash","events","i","customEvents","isAncestor","element","container","compareDocumentPosition","nodeType","check","related","relatedTarget","prefix","test","toString","mouseenter","base","condition","mouseleave","mousewheel","navigator","userAgent","commonProps","mouseProps","concat","mouseWheelProps","keyProps","textProps","touchProps","messageProps","stateProps","overOutRegex","typeFixers","reg","fix","newEvent","keyCode","which","rightClick","button","pos","x","y","pageX","pageY","clientX","clientY","scrollLeft","scrollTop","typeFixerMap","isNative","arguments","ownerDocument","parentWindow","originalEvent","isBean","l","p","props","fixer","srcElement","returnValue","stopPropagation","cancelBubble","stop","stopped","stopImmediatePropagation","isImmediatePropagationStopped","clone","ne","targetElement","RegEntry","wrappedHandler","fn","args","eargs","apply","findTarget","eventElement","__beanDel","ft","handler","original","namespaces","customType","once","removeListener","eventType","inNamespaces","checkNamespaces","j","c","matches","checkElement","checkOriginal","checkHandler","registry","map","forAll","pfx","list","all","t","charAt","substr","has","get","entries","entry","push","put","del","splice","removed","setSelectorEngine","e","r","Error","rootListener","propertyName","listeners","listener","custom","useCapture","attachEvent","detachEvent","rm","originalFn","orgType","replace","handlers","delegate","selector","array","match","fireListener","evt","createEvent","dispatchEvent","fireEvent","createEventObject","off","typeSpec","k","isTypeStr","defaultOpts","opts","indexOf","types","first","undefined","delfn","options","fire","names","from","beanDel","bean","noConflict","cleanup","CollectGarbage","Emitter","obj","mixin","_callbacks","removeAllListeners","removeEventListener","callbacks","emit","len","hasListeners","setEvent","animationEvent","transform","isEmpty","join","registerType","transformArgs","arg","keys","scope","unbind","el","getComputedStyle","getPropertyValue","transformedArgs","newEvents","shift","objEvents","touchstart","tap","a","Object","page","debounce","throttle","repeat","bubbleFormEvents","resize","callbackManager","media","formBubbling","ready","keyOn","keyOff","camelCaseEventTypes","animationstart","animationend","animationiteration","lowerCaseEventTypes","getAnimationEventTypes","prefixes","animationName","toLowerCase","transformAnimationEvents","cssAnimEventTypes","env","error","supported","formEls","fireBubble","detail","triggered","ev","CustomEvent","bubbles","cancelable","defaultPrevented","tagName","bubbleOn","bubbleOff","Manager","new","manager","start","bool","enabled","now","Date","pickFunction","found","candidate","wait","max","leading","trailing","leadingFn","trailingFn","queued","handle","lastCalled","lastInvoked","leadingBlocked","invoke","callType","addToQueue","requestAnimationFrame","loop","removeFromQueue","cancelAnimationFrame","maxPassed","waitReached","debounced","argsStart","queueDelay","complete","parseQuery","query","dimension","result","min","size","num","limit","toPx","width","listen","minWidth","maxWidth","minHeight","matchMedia","addListener","optimizedEventManager","run","running","started","toUpperCase","substring","readyAlready","changed","cancel","disableAnimation","head","pointerEvents","params","initCustomEvent","Tap","e1","done","e2","timeout_id","endEvents","touches","validation","progressive","validate","invalidateField","next","reset","formCallbacks","registeredForms","newForm","currentStep","steps","stepIndex","nextStep","active","disabled","forward","showStep","index","Number","step","direction","disable","revisit","disableOtherFieldsets","firstInput","focus","setNav","nav","enableFieldsets","fieldset","trigger","formEl","getClosest","fireCallbacks","getCallbacks","formData","filter","Callback","formSelector","watching","nextSelector","backSelector","createElement","checkValidity","validateForm","invalidInput","inputs","some","checkInput","showMessage","statusEl","valid","isValid","activeElement","setAttribute","checkValue","checkLength","setCustomValidity","invalidValue","regexp","escapedRegex","cachedMessage","invalidValueMessage","str","RegExp","checkCount","goal","lessThanGoal","wordCount","phrasing","display","nextSibling","submit","checkValidation","hideMessage","msg","label","validationMessage","existingMessage","invalidHandler","sliders","listening","Slider","self","refresh","slider","setLabels","setInput","setFill","setup","ranges","data","id","getAttribute","labels","externalLabels","assign","extractData","extractValues","getLabels","values","segments","camelCase","removeAttribute","inputClass","inputExists","getLineLabels","mark","getData","val","delimiter","external","default","labelCount","objectSize","lineLabels","containerHTML","templateHTML","classes","previousSibling","outerHTML","html","fills","labelTemplate","labelHTML","positionLabel","labelMeta","position","altKey","meta","attributes","nodeName","nodeValue","labelElements","internalSelector","externalSelector","sliderIndex","fill","offsetParent","labelEls","labelAtIndex","set","object","group","TypeError","output","source","nextKey","Toggler","checkboxSelector","radioSelector","selectSelector","hashChange","location","anchor","checked","getSelectFromOption","selectedIndex","ratchet","triggerToggling","toggleCheckboxes","setupSelects","setupRadios","actions","selectedOptions","action","dispatch","setClass","setState","selectors","sel","settings","classnames","classname","method","triggerTogglerEventsOnChildren","state","toggleAction","focusEl","hide","getLeafNodes","hasChildNodes","getElementsByTagName","elem","children","eventName","leafChildNodes","node","checkboxes","radio","togglerActive","radioName","siblings","parentForm","showSelectors","dataAttributes","addClassSelectors","addClass","removeClass","option","elements","attr","scrollTo","fromTop","ease","getNext","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","count","collection","rootEl","FormData","fields","field","append","inOutQuad","b","inOutCubic","inOutQuint","ts","tc","inOutCirc","Math","sqrt","round","getBoundingClientRect","top","pageYOffset","move","amount","to","duration","currentTime","animateScroll","testElement","createMethod","DOMTokenList","token","_toggle","force","view","elemCtrProto","Element","objCtr","strTrim","String","arrIndexOf","item","DOMEx","code","DOMException","checkTokenAndGetIndex","ClassList","trimmedClasses","_updateClassName","classListProto","classListGetter","tokens","iter","updated","defineProperty","classListPropDesc","enumerable","configurable","ex","number","__defineGetter__","global","compareArray","a1","a2","updateModifierKey","_mods","modifierMap","modifiersMatch","_downKeys","_MODIFIERS","assignKey","_handlers","getScope","mods","clearModifier","resetModifiers","getKeys","getMods","shortcut","unbindKey","multipleKeys","isPressed","getPressedKeyCodes","setScope","_scope","deleteScope","mi","previousKey","16","18","17","91","⇧","⌥","alt","⌃","ctrl","control","⌘","command","_MAP","backspace","tab","clear","enter","return","esc","escape","space","left","up","right","down","delete","home","end","pageup","pagedown",",",".","/","`","-","=",";","'","[","]","\\","charCodeAt","noop","serialize","pairs","pushEncodedKeyValuePair","isArray","v","subkey","encodeURIComponent","parseString","pair","decodeURIComponent","parseHeader","line","lines","pop","isJSON","mime","reduce","parts","Response","req","xhr","text","responseType","responseText","statusText","_setStatusProperties","status","header","headers","getAllResponseHeaders","getResponseHeader","_setHeaderProperties","_parseBody","response","Request","url","_query","_header","res","parse","rawResponse","statusCode","new_err","request","warn","requestBase","bind","getXHR","XMLHttpRequest","protocol","ActiveXObject","serializeObject","json","xml","urlencoded","form-data","application/x-www-form-urlencoded","application/json","JSON","stringify","ct","statusType","info","ok","clientError","serverError","toError","accepted","noContent","badRequest","unauthorized","notAcceptable","notFound","forbidden","_responseType","accept","auth","user","pass","btoa","username","password","attach","file","filename","_getFormData","_formData","_callback","crossDomainError","crossDomain","_timeoutError","_timeout","_appendQueryString","_data","onreadystatechange","timedout","_aborted","handleProgress","total","percent","loaded","onprogress","upload","_timer","abort","open","_withCredentials","withCredentials","_isHost","contentType","_serializer","setRequestHeader","send","patch","post","_parser","ms","then","resolve","reject","_fullfilledPromise","Promise","innerResolve","innerReject","catch","use","getHeader","unset","redirects","n","_maxRedirects","toJSON","RequestConstructor"],"mappings":"AAAA;YCIA,SAASA,WAAWC,GAGlBA,EAAUA,EAAMC,QAAUD,EAI1BA,EAAME,UAAUC,OAAQ,SAAUH,EAAMI,MAAMC,OAAOC,QAXvD,GAAIC,SAAUC,QAAS,mBACnBC,MAAQF,QAAQG,MAChBC,cAAgB,oJAapBF,OAAMG,OAAQ,WACZL,QAAQM,KAAMC,SAASC,iBAAkBJ,eAAiBZ,aAI5DU,MAAMO,GAAIF,SAAU,QAASH,cAAeZ;;cCpB5C,WAEE,QAASkB,KACFH,SA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MAYT9D,QAAQi2B,OAAS,WACf,OACE1S,OAAQzf,KAAKyf,OACb0M,IAAKnsB,KAAKmsB,IACV7R,KAAMta,KAAK6vB,MACXjE,QAAS5rB,KAAKqsB,UAelBnwB,QAAQ00B,QAAU,SAAiB9kB,GAGjC,UAFapJ,SAASxD,KAAK4M,IAGzB,IAAK,gBACL,IAAK,gBACL,IAAK,oBACH,OAAO,CACT,SACE,OAAO,IA4Cb5P,QAAQ80B,KAAO,SAAS1W,GACtB,GAAIxO,GAAMzK,SAASiZ,GACfje,EAAO2D,KAAKqsB,QAAQ,eAGxB,IAAIvgB,GAAOzK,SAASrB,KAAK6vB,OACvB,IAAK,GAAIpuB,KAAO6Y,GACdta,KAAK6vB,MAAMpuB,GAAO6Y,EAAK7Y,OAEhB,gBAAmB6Y,IAEvBje,GAAM2D,KAAK3D,KAAK,QACrBA,EAAO2D,KAAKqsB,QAAQ,gBAElBrsB,KAAK6vB,MADH,qCAAuCxzB,EAC5B2D,KAAK6vB,MACd7vB,KAAK6vB,MAAQ,IAAMvV,EACnBA,GAEUta,KAAK6vB,OAAS,IAAMvV,GAGpCta,KAAK6vB,MAAQvV,CAGf,QAAKxO,GAAO9L,KAAK4wB,QAAQtW,GAActa,MAGlC3D,GAAM2D,KAAK3D,KAAK,QACd2D;;ACjWT,QAAS2sB,SAAQyF,EAAoB3S,EAAQ0M,GAE3C,MAAI,kBAAqBA,GAChB,GAAIiG,GAAmB,MAAO3S,GAAQuJ,IAAImD,GAI/C,GAAKpnB,UAAUlL,OACV,GAAIu4B,GAAmB,MAAO3S,GAGhC,GAAI2S,GAAmB3S,EAAQ0M,GAGxClwB,OAAOC,QAAUywB","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","var toolbox = require( 'compose-toolbox' )\nvar Event = toolbox.event\nvar textSelectors = 'textarea, input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=hidden]):not([type=submit]):not([type=image]):not([type=reset])'\n\nfunction syncValue( input ) {\n\n // Allow calling from event handler\n input = ( input.target || input )\n\n // If element is empty (or contains only whitespace)\n // Add empty class\n input.classList.toggle( 'empty', !input.value.trim().length )\n}\n\n// Initialize input state\nEvent.change( function() {\n toolbox.each( document.querySelectorAll( textSelectors ), syncValue )\n})\n\n// Set input state on keyup (debounced)\nEvent.on( document, 'input', textSelectors, syncValue )\n","(function(){\n\n function embed() {\n if (!document.querySelector('#esvg-svg-icons')) {\n document.querySelector('body').insertAdjacentHTML('afterbegin', '<svg id=\"esvg-svg-icons\" data-symbol-class=\"svg-symbol\" data-prefix=\"svg\" version=\"1.1\" style=\"height:0;position:absolute\"><symbol id=\"svg-deployment\" data-name=\"deployment\" viewBox=\"0 0 176 201\" width=\"176\" height=\"201\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.414\"><path d=\"M88 5.985l82.272 47.5v95L88 195.985l-82.272-47.5v-95L88 5.985z\"/></symbol><symbol id=\"svg-copy\" data-name=\"copy\" viewBox=\"0 0 294 294\" width=\"294\" height=\"294\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.414\"><path d=\"M0 136.96c0-28.877 23.444-52.32 52.32-52.32v89.854c0 37.036 30.07 67.105 67.105 67.105h89.854c0 28.875-23.445 52.32-52.32 52.32H52.32C23.444 293.92 0 270.474 0 241.6V136.96z\" fill-opacity=\".529\"/><path d=\"M136.96 0c-28.877 0-52.32 23.444-52.32 52.32v104.64c0 28.875 23.443 52.32 52.32 52.32H241.6c28.875 0 52.32-23.445 52.32-52.32V52.32C293.92 23.444 270.474 0 241.6 0H136.96z\"/></symbol><symbol id=\"svg-logo\" data-name=\"logo\" viewBox=\"0 0 256 256\" width=\"256\" height=\"256\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.414\"><path d=\"M152.89 179.214l-49.78 28.74-53.332-30.792L0 148.42V86.838l53.333-30.792 49.777 28.74 49.777-28.74 53.333 30.792 49.78 28.74v61.584l-53.333 30.792-49.778-28.74zm3.137-6.374v-49.052l42.975 24.635.01 49.27-42.985-24.853zm-99.14.217v-49.27l43.126 24.77.01 49.566-43.135-25.066zM7.11 144.317v-49.27l42.668 24.635.002 49.27-42.67-24.635zm96-51.32l42.67 24.634-42.67 24.636-42.67-24.634 42.67-24.634zm99.557 0l42.668 24.634-42.668 24.636-42.67-24.634 42.67-24.634zM53.333 64.257l42.67 24.633-42.67 24.635-42.67-24.634 42.67-24.633zm99.554 0l42.67 24.633-42.67 24.635-42.67-24.634 42.67-24.633z\"/><path d=\"M6.82 144.547l.023-50 93.295 53.877.04 50.06L6.82 144.547zm148.916 28.477l.14-49.667 43.428 24.894-.045 50.235-43.525-25.46z\" fill-opacity=\".349\"/></symbol></svg>')\n }\n }\n\n // If DOM is already ready, embed SVGs\n if (document.readyState == 'interactive') { embed() }\n\n // Handle Turbolinks page change events\n if ( window.Turbolinks ) {\n document.addEventListener(\"turbolinks:load\", function(event) { embed() })\n }\n\n // Handle standard DOM ready events\n document.addEventListener(\"DOMContentLoaded\", function(event) { embed() })\n})()","var event = require( 'compose-toolbox' ).event\n\n// Public API function\nvar clipboard = function() {\n\n // Listen for click events\n event.on( document, 'click', '[data-copy-target]', copy )\n\n // Copy to clipboard handler\n function copy( event ) {\n\n console.log( event )\n\n // Assignment\n var copyTrigger = event.currentTarget,\n copyElement = document.querySelector( copyTrigger.dataset.copyTarget )\n\n // Prevent default behavior\n event.preventDefault()\n\n // Is the element selectable?\n if ( copyElement && copyElement.select ) {\n\n // Select text\n copyElement.select();\n\n // Give it a try\n try {\n\n // Copy text\n document.execCommand( 'copy' )\n\n // Blur the element\n copyElement.blur()\n\n // Trigger copied state\n copyTrigger.classList.add( 'copied' )\n\n // Remove copied state after a couple seconds\n setTimeout( function() {\n copyTrigger.classList.remove( 'copied' )\n }, 2000 )\n\n // If it borks\n } catch ( err ) {\n\n // Go nuclear\n alert( 'please press Ctrl/Cmd+C to copy' )\n\n }\n\n }\n\n }\n}\n\nmodule.exports = clipboard\n","var Event = require('compose-event')\nvar Notify = require('./notify')\n\n// If a page has an element .form-flash, trigger a notification\n//\nEvent.change(function(){\n var flash = document.querySelector('.flash-message')\n if (flash) {\n flash.classList.add('hidden')\n var type = flash.dataset.type || 'error'\n Notify(type, flash.textContent.trim())\n }\n})\n\n","var Event = require( 'compose-event' )\n\nvar defaultsByType = {\n normal: { dismissAfter: 2500 },\n success: { dismissAfter: 2500 },\n}\n\n\nvar autoDismissTimeout,\n messageEl,\n template = '\\\n<div class=\"notification\">\\\n <div class=\"notification-content\">\\\n <div class=\"notification-message\" role=\"alert\"></div>\\\n <button class=\"notification-close\" href=\"#\" role=\"button\" aria-label=\"close message\">\\\n <span class=\"close-icon\" aria-hidden=\"true\"></span>\\\n </button>\\\n </div>\\\n</div>\\\n'\n\nfunction notify (type, message) {\n if ( !message ) {\n message = type\n type = 'normal'\n }\n\n return show( type, message )\n}\n\nfunction show ( type, message ) {\n clearTimeout( autoDismissTimeout )\n if ( messageEl ) return dismiss( function(){ show( type, message ) })\n\n document.body.insertAdjacentHTML( 'beforeend', template )\n messageEl = document.body.lastChild\n\n messageEl.querySelector( '.notification-message' ).innerHTML = message\n\n if ( type ) {\n\n messageEl.classList.add( type )\n var defaults = defaultsByType[ type ]\n\n if ( defaults && defaults.dismissAfter ){\n autoDismissTimeout = window.setTimeout( dismiss, defaults.dismissAfter )\n }\n }\n\n messageEl = document.body.lastChild\n\n Event.keyOne( 'esc', dismiss )\n Event.one( messageEl, 'click', '.notification-close', dismiss )\n\n return {\n dismiss: dismiss\n }\n}\n\nfunction dismiss ( callback ) {\n clearTimeout( autoDismissTimeout )\n\n var cb\n\n if ( typeof callback == 'function' ) {\n cb = function() { remove(); callback() }\n } else {\n cb = remove;\n }\n\n var timeout = window.setTimeout( cb, 500 )\n\n Event.one( messageEl, 'animationstart', function() {\n clearTimeout( timeout )\n\n Event.afterAnimation( messageEl, cb )\n })\n\n messageEl.classList.add( 'dismiss' )\n}\n\nfunction remove () {\n messageEl = document.querySelector('body > .notification')\n\n if (messageEl) {\n messageEl.parentNode.removeChild( messageEl )\n }\n messageEl = null\n}\n\nmodule.exports = notify\n","var toolbox = require( 'compose-toolbox' )\n\nfunction autoSizeTextarea( textarea ) {\n var parent = textarea.parentElement\n\n if ( textarea.value == '' ) return\n if ( parent.classList.contains('input-wrapper') ) {\n\n parent.style.height = textarea.style.height\n var offset = textarea.offsetHeight - textarea.clientHeight\n textarea.style.height = 'auto'\n var newHeight = ( textarea.scrollHeight + offset )\n var maxHeight = window.innerHeight * .95\n\n if ( newHeight < maxHeight )\n textarea.style.height = newHeight + 'px'\n else\n textarea.style.height = maxHeight + 'px'\n\n parent.style.height = 'auto'\n }\n}\n\ntoolbox.event.change(function(){\n var textareas = document.querySelectorAll('textarea')\n toolbox.event.delay( function(){ Array.prototype.forEach.call(textareas, autoSizeTextarea) } )\n})\n\ntoolbox.event.on(document, 'keyup toggler:show', 'textarea', function(event){\n autoSizeTextarea(event.currentTarget)\n})\n","var toggler = require( 'compose-toggler' )\nvar formUp = require( 'compose-form-up' )\nvar toolbox = require( 'compose-toolbox' )\nvar ajax = require( 'superagent' )\nvar event = toolbox.event\nvar clipboard = require( './enhancements/clipboard' )\nvar notify = require( './enhancements/notify' )\n\nevent.scroll.disablePointer() // disable pointer events on scroll for performance (to avoid extra repaints)\nclipboard();\n\nrequire( 'compose-slider' ) // Our slider (range input) component\nrequire( './_icons' ) // Import svg icons (from Esvg)\nrequire( './_form-helpers' )\nrequire( './enhancements/flash-messages' )\nrequire( './enhancements/text-helpers' )\n\n// Public API object\nwindow.Tungsten = module.exports = toolbox.merge( {\n ajax : ajax,\n form : formUp,\n toggler : toggler,\n clipboard : clipboard,\n notify : notify\n}, toolbox )\n","/*!\n * Bean - copyright (c) Jacob Thornton 2011-2012\n * https://github.com/fat/bean\n * MIT license\n */\n(function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n})('bean', this, function (name, context) {\n name = name || 'bean'\n context = context || this\n\n var win = window\n , old = context[name]\n , namespaceRegex = /[^\\.]*(?=\\..*)\\.|.*/\n , nameRegex = /\\..*/\n , addEvent = 'addEventListener'\n , removeEvent = 'removeEventListener'\n , doc = document || {}\n , root = doc.documentElement || {}\n , W3C_MODEL = root[addEvent]\n , eventSupport = W3C_MODEL ? addEvent : 'attachEvent'\n , ONE = {} // singleton for quick matching making add() do one()\n\n , slice = Array.prototype.slice\n , str2arr = function (s, d) { return s.split(d || ' ') }\n , isString = function (o) { return typeof o == 'string' }\n , isFunction = function (o) { return typeof o == 'function' }\n , isObject = function (o) { return typeof o == 'object' }\n\n // Try to build an options object. If any key in `maybeOptions`\n // matches a key in `defaults`, it will be copied into a clone\n // of `defaults`, thus overriding the default.\n , buildOptions = function (originalDefaults, maybeOptions) {\n var defaults = {}\n\n for (var key in originalDefaults) {\n if (originalDefaults.hasOwnProperty(key)) {\n defaults[key] = originalDefaults[key];\n }\n }\n\n if (!isObject(maybeOptions)) {\n return defaults;\n }\n\n for (key in defaults) {\n if (defaults.hasOwnProperty(key) && maybeOptions.hasOwnProperty(key)) {\n defaults[key] = maybeOptions[key]\n }\n }\n\n return defaults\n }\n\n // events that we consider to be 'native', anything not in this list will\n // be treated as a custom event\n , standardNativeEvents =\n 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons\n 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel\n 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement\n 'keydown keypress keyup ' + // keyboard\n 'orientationchange ' + // mobile\n 'focus blur change reset select submit ' + // form elements\n 'load unload beforeunload resize move DOMContentLoaded ' + // window\n 'readystatechange message ' + // window\n 'error abort scroll ' // misc\n // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event\n // that doesn't actually exist, so make sure we only do these on newer browsers\n , w3cNativeEvents =\n 'show ' + // mouse buttons\n 'input invalid ' + // form elements\n 'touchstart touchmove touchend touchcancel ' + // touch\n 'gesturestart gesturechange gestureend ' + // gesture\n 'textinput ' + // TextEvent\n 'readystatechange pageshow pagehide popstate ' + // window\n 'hashchange offline online ' + // window\n 'afterprint beforeprint ' + // printing\n 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd\n 'loadstart progress suspend emptied stalled loadmetadata ' + // media\n 'loadeddata canplay canplaythrough playing waiting seeking ' + // media\n 'seeked ended durationchange timeupdate play pause ratechange ' + // media\n 'volumechange cuechange ' + // media\n 'checking noupdate downloading cached updateready obsolete ' // appcache\n\n // convert to a hash for quick lookups\n , nativeEvents = (function (hash, events, i) {\n for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1)\n return hash\n }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : ''))))\n\n // custom events are events that we *fake*, they are not provided natively but\n // we can use native events to generate them\n , customEvents = (function () {\n var isAncestor = 'compareDocumentPosition' in root\n ? function (element, container) {\n return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16\n }\n : 'contains' in root\n ? function (element, container) {\n container = container.nodeType === 9 || container === window ? root : container\n return container !== element && container.contains(element)\n }\n : function (element, container) {\n while (element = element.parentNode) if (element === container) return 1\n return 0\n }\n , check = function (event) {\n var related = event.relatedTarget\n return !related\n ? related == null\n : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString())\n && !isAncestor(related, this))\n }\n\n return {\n mouseenter: { base: 'mouseover', condition: check }\n , mouseleave: { base: 'mouseout', condition: check }\n , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' }\n }\n }())\n\n // we provide a consistent Event object across browsers by taking the actual DOM\n // event object and generating a new one from its properties.\n , Event = (function () {\n // a whitelist of properties (for different event types) tells us what to check for and copy\n var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' +\n 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' +\n 'srcElement target timeStamp type view which propertyName path')\n , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' +\n 'fromElement offsetX offsetY pageX pageY screenX screenY toElement movementX movementY region'))\n , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' +\n 'axis')) // 'axis' is FF specific\n , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' +\n 'keyLocation location isComposing code'))\n , textProps = commonProps.concat(str2arr('data'))\n , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation'))\n , messageProps = commonProps.concat(str2arr('data origin source'))\n , stateProps = commonProps.concat(str2arr('state'))\n , overOutRegex = /over|out/\n // some event types need special handling and some need special properties, do that all here\n , typeFixers = [\n { // key events\n reg: /key/i\n , fix: function (event, newEvent) {\n newEvent.keyCode = event.keyCode || event.which\n return keyProps\n }\n }\n , { // mouse events\n reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i\n , fix: function (event, newEvent, type) {\n newEvent.rightClick = event.which === 3 || event.button === 2\n newEvent.pos = { x: 0, y: 0 }\n if (event.pageX || event.pageY) {\n newEvent.clientX = event.pageX\n newEvent.clientY = event.pageY\n } else if (event.clientX || event.clientY) {\n newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft\n newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop\n }\n if (overOutRegex.test(type)) {\n newEvent.relatedTarget = event.relatedTarget\n || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']\n }\n return mouseProps\n }\n }\n , { // mouse wheel events\n reg: /mouse.*(wheel|scroll)/i\n , fix: function () { return mouseWheelProps }\n }\n , { // TextEvent\n reg: /^text/i\n , fix: function () { return textProps }\n }\n , { // touch and gesture events\n reg: /^touch|^gesture/i\n , fix: function () { return touchProps }\n }\n , { // message events\n reg: /^message$/i\n , fix: function () { return messageProps }\n }\n , { // popstate events\n reg: /^popstate$/i\n , fix: function () { return stateProps }\n }\n , { // everything else\n reg: /.*/\n , fix: function () { return commonProps }\n }\n ]\n , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism\n\n , Event = function (event, element, isNative) {\n if (!arguments.length) return\n event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event\n this.originalEvent = event\n this.isNative = isNative\n this.isBean = true\n\n if (!event) return\n\n var type = event.type\n , target = event.target || event.srcElement\n , i, l, p, props, fixer\n\n this.target = target && target.nodeType === 3 ? target.parentNode : target\n\n if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless\n fixer = typeFixerMap[type]\n if (!fixer) { // haven't encountered this event type before, map a fixer function for it\n for (i = 0, l = typeFixers.length; i < l; i++) {\n if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .*\n typeFixerMap[type] = fixer = typeFixers[i].fix\n break\n }\n }\n }\n\n props = fixer(event, this, type)\n for (i = props.length; i--;) {\n if (!((p = props[i]) in this) && p in event) this[p] = event[p]\n }\n }\n }\n\n // preventDefault() and stopPropagation() are a consistent interface to those functions\n // on the DOM, stop() is an alias for both of them together\n Event.prototype.preventDefault = function () {\n if (this.originalEvent.preventDefault) this.originalEvent.preventDefault()\n else this.originalEvent.returnValue = false\n }\n Event.prototype.stopPropagation = function () {\n if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation()\n else this.originalEvent.cancelBubble = true\n }\n Event.prototype.stop = function () {\n this.preventDefault()\n this.stopPropagation()\n this.stopped = true\n }\n // stopImmediatePropagation() has to be handled internally because we manage the event list for\n // each element\n // note that originalElement may be a Bean#Event object in some situations\n Event.prototype.stopImmediatePropagation = function () {\n if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation()\n this.isImmediatePropagationStopped = function () { return true }\n }\n Event.prototype.isImmediatePropagationStopped = function () {\n return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped()\n }\n Event.prototype.clone = function (currentTarget) {\n //TODO: this is ripe for optimisation, new events are *expensive*\n // improving this will speed up delegated events\n var ne = new Event(this, this.element, this.isNative)\n ne.currentTarget = currentTarget\n return ne\n }\n\n return Event\n }())\n\n // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both\n , targetElement = function (element, isNative) {\n return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element\n }\n\n /**\n * Bean maintains an internal registry for event listeners. We don't touch elements, objects\n * or functions to identify them, instead we store everything in the registry.\n * Each event listener has a RegEntry object, we have one 'registry' for the whole instance.\n */\n , RegEntry = (function () {\n // each handler is wrapped so we can handle delegation and custom events\n var wrappedHandler = function (element, fn, condition, args) {\n var call = function (event, eargs) {\n return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs)\n }\n , findTarget = function (event, eventElement) {\n return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement\n }\n , handler = condition\n ? function (event) {\n var target = findTarget(event, this) // deleated event\n if (condition.apply(target, arguments)) {\n if (event) event.currentTarget = target\n return call(event, arguments)\n }\n }\n : function (event) {\n if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix\n return call(event, arguments)\n }\n handler.__beanDel = fn.__beanDel\n return handler\n }\n\n , RegEntry = function (element, type, handler, original, namespaces, args, root) {\n var customType = customEvents[type]\n , isNative\n\n if (type == 'unload') {\n // self clean-up\n handler = once(removeListener, element, type, handler, original)\n }\n\n if (customType) {\n if (customType.condition) {\n handler = wrappedHandler(element, handler, customType.condition, args)\n }\n type = customType.base || type\n }\n\n this.isNative = isNative = nativeEvents[type] && !!element[eventSupport]\n this.customType = !W3C_MODEL && !isNative && type\n this.element = element\n this.type = type\n this.original = original\n this.namespaces = namespaces\n this.eventType = W3C_MODEL || isNative ? type : 'propertychange'\n this.target = targetElement(element, isNative)\n this[eventSupport] = !!this.target[eventSupport]\n this.root = root\n this.handler = wrappedHandler(element, handler, null, args)\n }\n\n // given a list of namespaces, is our entry in any of them?\n RegEntry.prototype.inNamespaces = function (checkNamespaces) {\n var i, j, c = 0\n if (!checkNamespaces) return true\n if (!this.namespaces) return false\n for (i = checkNamespaces.length; i--;) {\n for (j = this.namespaces.length; j--;) {\n if (checkNamespaces[i] == this.namespaces[j]) c++\n }\n }\n return checkNamespaces.length === c\n }\n\n // match by element, original fn (opt), handler fn (opt)\n RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) {\n return this.element === checkElement &&\n (!checkOriginal || this.original === checkOriginal) &&\n (!checkHandler || this.handler === checkHandler)\n }\n\n return RegEntry\n }())\n\n , registry = (function () {\n // our map stores arrays by event type, just because it's better than storing\n // everything in a single array.\n // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for\n // rootListeners so we can look them up fast\n var map = {}\n\n // generic functional search of our registry for matching listeners,\n // `fn` returns false to break out of the loop\n , forAll = function (element, type, original, handler, root, fn) {\n var pfx = root ? 'r' : '$'\n if (!type || type == '*') {\n // search the whole registry\n for (var t in map) {\n if (t.charAt(0) == pfx) {\n forAll(element, t.substr(1), original, handler, root, fn)\n }\n }\n } else {\n var i = 0, l, list = map[pfx + type], all = element == '*'\n if (!list) return\n for (l = list.length; i < l; i++) {\n if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return\n }\n }\n }\n\n , has = function (element, type, original, root) {\n // we're not using forAll here simply because it's a bit slower and this\n // needs to be fast\n var i, list = map[(root ? 'r' : '$') + type]\n if (list) {\n for (i = list.length; i--;) {\n if (!list[i].root && list[i].matches(element, original, null)) return true\n }\n }\n return false\n }\n\n , get = function (element, type, original, root) {\n var entries = []\n forAll(element, type, original, null, root, function (entry) {\n return entries.push(entry)\n })\n return entries\n }\n\n , put = function (entry) {\n var has = !entry.root && !this.has(entry.element, entry.type, null, false)\n , key = (entry.root ? 'r' : '$') + entry.type\n ;(map[key] || (map[key] = [])).push(entry)\n return has\n }\n\n , del = function (entry) {\n forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) {\n list.splice(i, 1)\n entry.removed = true\n if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type]\n return false\n })\n }\n\n // dump all entries, used for onunload\n , entries = function () {\n var t, entries = []\n for (t in map) {\n if (t.charAt(0) == '$') entries = entries.concat(map[t])\n }\n return entries\n }\n\n return { has: has, get: get, put: put, del: del, entries: entries }\n }())\n\n // we need a selector engine for delegated events, use querySelectorAll if it exists\n // but for older browsers we need Qwery, Sizzle or similar\n , selectorEngine\n , setSelectorEngine = function (e) {\n if (!arguments.length) {\n selectorEngine = doc.querySelectorAll\n ? function (s, r) {\n return r.querySelectorAll(s)\n }\n : function () {\n throw new Error('Bean: No selector engine installed') // eeek\n }\n } else {\n selectorEngine = e\n }\n }\n\n // we attach this listener to each DOM event that we need to listen to, only once\n // per event type per DOM element\n , rootListener = function (event, type) {\n if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return\n\n var listeners = registry.get(this, type || event.type, null, false)\n , l = listeners.length\n , i = 0\n\n event = new Event(event, this, true)\n if (type) event.type = type\n\n // iterate through all handlers registered for this type, calling them unless they have\n // been removed by a previous handler or stopImmediatePropagation() has been called\n for (; i < l && !event.isImmediatePropagationStopped(); i++) {\n if (!listeners[i].removed) listeners[i].handler.call(this, event)\n }\n }\n\n // add and remove listeners to DOM elements\n , listener = W3C_MODEL\n ? function (element, type, add, custom, useCapture) {\n // new browsers\n element[add ? addEvent : removeEvent](type, rootListener, useCapture)\n }\n : function (element, type, add, custom /*, useCapture */) {\n // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events\n // to simulate event bubbling etc.\n var entry\n if (add) {\n registry.put(entry = new RegEntry(\n element\n , custom || type\n , function (event) { // handler\n rootListener.call(element, event, custom)\n }\n , rootListener\n , null\n , null\n , true // is root\n ))\n if (custom && element['_on' + custom] == null) element['_on' + custom] = 0\n entry.target.attachEvent('on' + entry.eventType, entry.handler)\n } else {\n entry = registry.get(element, custom || type, rootListener, true)[0]\n if (entry) {\n entry.target.detachEvent('on' + entry.eventType, entry.handler)\n registry.del(entry)\n }\n }\n }\n\n , once = function (rm, element, type, fn, originalFn) {\n // wrap the handler in a handler that does a remove as well\n return function () {\n fn.apply(this, arguments)\n rm(element, type, originalFn)\n }\n }\n\n , removeListener = function (element, orgType, handler, namespaces, useCapture) {\n var type = orgType && orgType.replace(nameRegex, '')\n , handlers = registry.get(element, type, null, false)\n , removed = {}\n , i, l\n\n for (i = 0, l = handlers.length; i < l; i++) {\n if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) {\n // TODO: this is problematic, we have a registry.get() and registry.del() that\n // both do registry searches so we waste cycles doing this. Needs to be rolled into\n // a single registry.forAll(fn) that removes while finding, but the catch is that\n // we'll be splicing the arrays that we're iterating over. Needs extra tests to\n // make sure we don't screw it up. @rvagg\n registry.del(handlers[i])\n if (!removed[handlers[i].eventType] && handlers[i][eventSupport])\n removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type }\n }\n }\n // check each type/element for removed listeners and remove the rootListener where it's no longer needed\n for (i in removed) {\n if (!registry.has(element, removed[i].t, null, false)) {\n // last listener of this type, remove the rootListener\n listener(element, removed[i].t, false, removed[i].c, useCapture)\n }\n }\n }\n\n // set up a delegate helper using the given selector, wrap the handler function\n , delegate = function (selector, fn) {\n //TODO: findTarget (therefore $) is called twice, once for match and once for\n // setting e.currentTarget, fix this so it's only needed once\n var findTarget = function (target, root) {\n var i, array = isString(selector) ? selectorEngine(selector, root) : selector\n for (; target && target !== root; target = target.parentNode) {\n for (i = array.length; i--;) {\n if (array[i] === target) return target\n }\n }\n }\n , handler = function (e) {\n var match = findTarget(e.target, this)\n if (match) fn.apply(match, arguments)\n }\n\n // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean\n handler.__beanDel = {\n ft : findTarget // attach it here for customEvents to use too\n , selector : selector\n }\n return handler\n }\n\n , fireListener = W3C_MODEL ? function (isNative, type, element) {\n // modern browsers, do a proper dispatchEvent()\n var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents')\n evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1)\n element.dispatchEvent(evt)\n } : function (isNative, type, element) {\n // old browser use onpropertychange, just increment a custom property to trigger the event\n element = targetElement(element, isNative)\n isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++\n }\n\n /**\n * Public API: off(), on(), add(), (remove()), one(), fire(), clone()\n */\n\n /**\n * off(element[, eventType(s)[, handler ], options])\n */\n , off = function (element, typeSpec, fn) {\n var isTypeStr = isString(typeSpec),\n defaultOpts = {\n useCapture: false\n }\n , opts = buildOptions(defaultOpts, arguments[arguments.length - 1])\n , k, type, namespaces, i\n\n if (isTypeStr && typeSpec.indexOf(' ') > 0) {\n // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3')\n typeSpec = str2arr(typeSpec)\n for (i = typeSpec.length; i--;)\n off(element, typeSpec[i], fn)\n return element\n }\n\n type = isTypeStr && typeSpec.replace(nameRegex, '')\n if (type && customEvents[type]) type = customEvents[type].base\n\n if (!typeSpec || isTypeStr) {\n // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3)\n if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.')\n removeListener(element, type, fn, namespaces, opts.useCapture)\n } else if (isFunction(typeSpec)) {\n // off(el, fn)\n removeListener(element, null, typeSpec, null, opts.useCapture)\n } else {\n // off(el, { t1: fn1, t2, fn2 })\n for (k in typeSpec) {\n if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k])\n }\n }\n\n return element\n }\n\n /**\n * on(element, eventType(s)[, selector], handler[, args ], [options])\n */\n , on = function(element, events, selector, fn) {\n var defaultOpts = {\n useCapture: false\n },\n originalFn, type, types, i, args, entry, first, opts\n\n //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps?\n if (selector === undefined && typeof events == 'object') {\n //TODO: this can't handle delegated events\n for (type in events) {\n if (events.hasOwnProperty(type)) {\n on.call(this, element, type, events[type])\n }\n }\n return\n }\n\n if (!isFunction(selector)) {\n // delegated event\n originalFn = fn\n args = slice.call(arguments, 4)\n fn = delegate(selector, originalFn, selectorEngine)\n } else {\n args = slice.call(arguments, 3)\n fn = originalFn = selector\n }\n\n opts = buildOptions(defaultOpts, args[args.length - 1])\n types = str2arr(events)\n\n // special case for one(), wrap in a self-removing handler\n if (this === ONE) {\n fn = once(off, element, events, fn, originalFn)\n }\n\n for (i = types.length; i--;) {\n // add new handler to the registry and check if it's the first for this element/type\n first = registry.put(entry = new RegEntry(\n element\n , types[i].replace(nameRegex, '') // event type\n , fn\n , originalFn\n , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces\n , args\n , false // not root\n ))\n if (entry[eventSupport] && first) {\n // first event of this type on this element, add root listener\n listener(element, entry.eventType, true, entry.customType, opts.useCapture)\n }\n }\n\n return element\n }\n\n /**\n * add(element[, selector], eventType(s), handler[, args ])\n *\n * Deprecated: kept (for now) for backward-compatibility\n */\n , add = function (element, events, fn, delfn, options) {\n return on.apply(\n null\n , !isString(fn)\n ? slice.call(arguments)\n : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 4) : [])\n )\n }\n\n /**\n * one(element, eventType(s)[, selector], handler[, args ])\n */\n , one = function () {\n return on.apply(ONE, arguments)\n }\n\n /**\n * fire(element, eventType(s)[, args ])\n *\n * The optional 'args' argument must be an array, if no 'args' argument is provided\n * then we can use the browser's DOM event system, otherwise we trigger handlers manually\n */\n , fire = function (element, type, args) {\n var types = str2arr(type)\n , i, j, l, names, handlers\n\n for (i = types.length; i--;) {\n type = types[i].replace(nameRegex, '')\n if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.')\n if (!names && !args && element[eventSupport]) {\n fireListener(nativeEvents[type], type, element)\n } else {\n // non-native event, either because of a namespace, arguments or a non DOM element\n // iterate over all listeners and manually 'fire'\n handlers = registry.get(element, type, null, false)\n args = [false].concat(args)\n for (j = 0, l = handlers.length; j < l; j++) {\n if (handlers[j].inNamespaces(names)) {\n handlers[j].handler.apply(element, args)\n }\n }\n }\n }\n return element\n }\n\n /**\n * clone(dstElement, srcElement[, eventType ])\n *\n * TODO: perhaps for consistency we should allow the same flexibility in type specifiers?\n */\n , clone = function (element, from, type) {\n var handlers = registry.get(from, type, null, false)\n , l = handlers.length\n , i = 0\n , args, beanDel\n\n for (; i < l; i++) {\n if (handlers[i].original) {\n args = [ element, handlers[i].type ]\n if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector)\n args.push(handlers[i].original)\n on.apply(null, args)\n }\n }\n return element\n }\n\n , bean = {\n 'on' : on\n , 'add' : add\n , 'one' : one\n , 'off' : off\n , 'remove' : off\n , 'clone' : clone\n , 'fire' : fire\n , 'Event' : Event\n , 'setSelectorEngine' : setSelectorEngine\n , 'noConflict' : function () {\n context[name] = old\n return this\n }\n }\n\n // for IE, clean up on unload to avoid leaks\n if (win.attachEvent) {\n var cleanup = function () {\n var i, entries = registry.entries()\n for (i in entries) {\n if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type)\n }\n win.detachEvent('onunload', cleanup)\n win.CollectGarbage && win.CollectGarbage()\n }\n win.attachEvent('onunload', cleanup)\n }\n\n // initialize selector engine to internal default (qSA or throw Error)\n setSelectorEngine()\n\n return bean\n});\n","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","require( './lib/shims/custom-event' )\n\nvar bean = require( 'bean' )\nvar key = require( 'keymaster' ) \nvar animationEvent = require( './lib/animation-events' )\nvar page = require( './lib/page' )\nvar tap = require( './lib/tap-events' )\nvar debounce = require( './lib/debounce' )\nvar throttle = require( './lib/throttle' )\nvar delay = require( './lib/delay' )\nvar repeat = require( './lib/repeat' )\nvar bubbleFormEvents = require( './lib/bubble-form-events' )\nvar scroll = require( './lib/scroll' )\nvar resize = require( './lib/resize' )\nvar callbackManager = require( './lib/callback-manager' )\nvar media = require( './lib/media' )\n\nvar slice = Array.prototype.slice\nvar formBubbling = false\n\nmodule.exports = {\n\n // DOM events\n on: on,\n off: off,\n one: one,\n fire: fire,\n clone: bean.clone,\n ready: page.ready,\n change: page.change,\n afterAnimation: afterAnimation,\n\n // Media query events\n media: media,\n\n // Keyboard events\n key: key,\n keyOn: key,\n keyOff: key.unbind,\n keyOne: keyOne,\n\n // Timing utilities\n debounce: debounce,\n throttle: throttle,\n delay: delay,\n repeat: repeat,\n\n // Optimized Event Managers\n scroll: scroll,\n resize: resize,\n\n callbackManager: callbackManager,\n callback: callbackManager.callback,\n\n // Bubbling fix\n bubbleFormEvents: bubbleFormEvents\n}\n\n// Bean doesn't account for cross-browser support on animation events\n// So rather than pass through events to bean, we process them to add\n// vendor prefixes or remove events if browsers do not suppor them\n//\nfunction on () {\n setEvent( 'on', slice.call( arguments ) )\n}\n\nfunction off () {\n setEvent( 'off', slice.call( arguments ) )\n}\n\nfunction one () {\n setEvent( 'one', slice.call( arguments ) )\n}\n\nfunction fire () {\n\n args = slice.call( arguments )\n var el = args[0]\n var events = []\n\n args[1].split(' ').forEach( function( event ) {\n\n var event = animationEvent.transform( event )\n if ( !isEmpty( event ) ) events.push( event )\n\n })\n\n if ( !isEmpty( events ) ) {\n\n args[1] = events.join( ' ' )\n bean.fire.apply( this, args )\n\n }\n}\n\nfunction setEvent( registerType, args ) {\n\n transformArgs( args ).forEach( function( arg ) {\n bean[ registerType ].apply( null, arg )\n })\n\n}\n\n// Add support for unbinding a key event after it is called\n//\nfunction keyOne ( keys, scope, fn ) {\n\n if ( typeof scope == 'function' ) {\n fn = scope\n scope = 'all'\n }\n\n key( keys, scope, function( event ) {\n key.unbind( keys, scope )\n fn( event )\n })\n}\n\nfunction afterAnimation( el, callback ) {\n var hasAnimation = !!window.getComputedStyle( el ).getPropertyValue( 'animation-duration' )\n if ( hasAnimation ) {\n one( el, 'animationend', callback )\n } else {\n callback()\n }\n}\n\n// Transform event arguments to handle tap event and cross-browser animation events\n// Returns an array of events to be registered individually\n//\nfunction transformArgs( args ) {\n\n var transformedArgs = []\n var newEvents = {}\n var element = args.shift() // retrieve element\n var events = args.shift()\n\n // detect event delegate selector\n if ( typeof args[0] != 'function' ) {\n var delegate = args.shift()\n }\n\n // convert event strings to object based events for code simplification\n // example: arguments ('hover focus', function) would become ({ 'hover focus': function })\n if ( typeof events == 'string' ) {\n var objEvents = {}\n objEvents[events] = args.shift()\n events = objEvents\n }\n\n // Walk through each key in the events object and add vendor prefixes to 'animation' events\n // and wrap callback in the tap function for all 'tap' events.\n //\n for ( event in events ) {\n\n if ( events.hasOwnProperty( event ) ) {\n var callback = events[event]\n\n // Events can be registered as space separated groups like \"hover focus\"\n // This handles each event independantly\n //\n event.split(' ').forEach( function( e ){\n\n // If it is an animation event, vendor prefix it, or fire the callback according to browser support\n e = animationEvent.transform( e )\n\n if ( isEmpty( e ) ) {\n // If it's empty, it has been removed since animation events are not supported.\n // In that case, trigger the event immediately\n callback()\n\n } else if ( e.match( /tap/ ) ) {\n\n // If it's a tap event, wrap the callback and set the event to 'touchstart'\n // Tap isn't a real native event, but this wrapper lets us simulate what a\n // native tap event would be.\n //\n newEvents.touchstart = tap( callback )\n } else {\n newEvents[ e ] = callback\n }\n })\n }\n }\n\n for ( event in newEvents ) {\n var a = []\n a.push( element, event )\n\n if ( delegate ) a.push( delegate )\n\n a.push( newEvents[ event ] )\n transformedArgs.push( a.concat( args ) )\n }\n\n return transformedArgs\n}\n\n\nfunction isEmpty( obj ) {\n\n var hasOwnProperty = Object.prototype.hasOwnProperty\n\n if ( obj == null || obj.length === 0 ) return true\n\n if ( 0 < obj.length ) return false\n\n for (var key in obj) {\n if ( hasOwnProperty.call( obj, key ) ) return false\n }\n\n return true;\n}\n","var cssAnimEventTypes = getAnimationEventTypes()\nvar supported = cssAnimEventTypes.animationstart !== undefined\n\nmodule.exports = {\n transform: transformAnimationEvents\n}\n\nfunction camelCaseEventTypes(prefix) {\n prefix = prefix || '';\n\n return {\n animationstart: prefix + 'AnimationStart',\n animationend: prefix + 'AnimationEnd',\n animationiteration: prefix + 'AnimationIteration'\n };\n}\n\nfunction lowerCaseEventTypes(prefix) {\n prefix = prefix || '';\n\n return {\n animationstart: prefix + 'animationstart',\n animationend: prefix + 'animationend',\n animationiteration: prefix + 'animationiteration'\n };\n}\n\n/**\n * @return {Object} Animation event types {animationstart, animationend, animationiteration}\n */\n\nfunction getAnimationEventTypes() {\n var prefixes = ['webkit', 'Moz', 'O', ''];\n var style = document.documentElement.style;\n\n // browser compliant\n if (undefined !== style.animationName) {\n return lowerCaseEventTypes();\n }\n\n for (var i = 0, len = prefixes.length, prefix; i < len; i++) {\n prefix = prefixes[i];\n\n if (undefined !== style[prefix + 'AnimationName']) {\n // Webkit\n if (0 === i) {\n return camelCaseEventTypes(prefix.toLowerCase());\n }\n // Mozilla\n else if (1 === i) {\n return lowerCaseEventTypes();\n }\n // Opera\n else if (2 === i) {\n return lowerCaseEventTypes(prefix.toLowerCase());\n }\n }\n }\n\n return {};\n}\n\n\n// Adds necessary add vendor prefixes or camelCased event names\n//\nfunction transformAnimationEvents (event) {\n if (!event.match(/animation/i)) {\n return event\n } else {\n if (cssAnimEventTypes[event]) {\n return cssAnimEventTypes[event]\n } else {\n if(window.env != 'test') {\n console.error('\"' + event + '\" is not a supported animation event')\n }\n return ''\n }\n }\n}\n","var Event = require( 'bean' ),\n page = require( './page' ),\n formEls;\n\nvar formBubbling = false\n\nvar fireBubble = function ( event ) {\n if ( event.detail && event.detail.triggered ) { return false }\n\n var ev = new CustomEvent( event.type, { bubbles: true, cancelable: true, detail: { triggered: true } } )\n\n event.stopPropagation()\n event.target.dispatchEvent( ev ) \n\n // Prevent default on original event if custom event is prevented\n if ( ev.defaultPrevented ) event.preventDefault() \n}\n\n// Simplify setting the event type based on the element\nvar eventType = function ( el ) {\n return ( el.tagName == 'FORM' ) ? 'submit' : 'focus blur'\n}\n\n// Add event listeners\nvar bubbleOn = function ( el ) {\n Event.on( el, eventType( el ), fireBubble )\n}\n\n// Remove event listeners\nvar bubbleOff = function ( el ) {\n Event.off( el, eventType( el ), fireBubble )\n}\n\n// Add/Remove event listeners\nvar bubbleFormEvents = function () {\n if ( formBubbling ) { return } \n page.change( function() {\n\n // Remove listeners from previous page\n if ( formEls ) Array.prototype.forEach.call( formEls, bubbleOff )\n\n // Add new listeners to this page\n formEls = document.querySelectorAll( 'form, input' )\n\n Array.prototype.forEach.call( formEls, bubbleOn )\n })\n\n var formBubbling = true\n}\n\nmodule.exports = bubbleFormEvents\n","var Manager = {\n new: function() {\n var manager = {\n\n callbacks: [],\n\n add: function( fn ) {\n\n var cb = Manager.callback.new( fn )\n manager.callbacks.push( cb )\n \n return cb\n\n },\n\n stop: function() {\n manager.callbacks.forEach( function( cb ) { cb.stop() } )\n },\n\n start: function() {\n manager.callbacks.forEach( function( cb ) { cb.start() } )\n },\n\n toggle: function( bool ) {\n manager.callbacks.forEach( function( cb ) { cb.toggle( bool ) } )\n },\n\n remove: function() {\n manager.callbacks = []\n },\n\n fire: function() {\n var args = Array.prototype.slice.call( arguments )\n manager.callbacks.forEach( function( fn ) { fn.apply( this, args ) } )\n }\n }\n\n return manager\n },\n\n callback: {\n new: function( fn ) {\n var cb = function() {\n if ( cb.enabled ) { fn.apply( fn, arguments ) }\n }\n\n cb.stop = function() { cb.enabled = false }\n cb.start = function() { cb.enabled = true }\n cb.toggle = function( bool ) {\n cb.enabled = ( 0 in arguments ) ? bool : !cb.enabled\n }\n cb.enabled = true\n\n return cb\n }\n }\n}\n\nmodule.exports = Manager\n","var now = function() {\n return Date.now()\n}\n\nvar pickFunction = function() {\n var found\n Array.prototype.forEach.call( arguments, function( candidate ) {\n if ( typeof( candidate ) == 'function' && !found ) { found = candidate }\n })\n\n return found\n}\n\nvar debounce = function( fn, wait, options ) {\n\n // Allow options passed as the first argument\n if ( typeof( fn ) == 'object' ) { options = fn } \n\n // Options won't be null\n else { options = options || {} }\n\n wait = options.wait || wait || 0\n\n var max = options.max || false,\n leading = ( ( 'leading' in options ) ? options.leading : false ),\n trailing = ( ( 'trailing' in options ) ? options.trailing : true ),\n \n // Grab functions from options or default to first argument\n leadingFn = pickFunction( options.leading, options.trailing, options.callback, fn ),\n trailingFn = pickFunction( options.trailing, options.leading, options.callback, fn ),\n\n // State tracking vars\n args, // Track arguments passed to debounced callback\n queued = false, // Has a callback been added to the animation loop?\n handle = {}, // Object for tracking functions and callbacks\n lastCalled = 0, // Keep a timer for debouncing\n lastInvoked = 0, // Keep a timer for max\n leadingBlocked = false; // Track leading, throttling subsequent leading calls\n\n // Queue the function with requestAnimationFrame\n var invoke = function( callType ) {\n\n lastCalled = now()\n lastInvoked = now()\n queued = false\n leadingBlocked = true\n\n if ( callType === 'leading' ) {\n leadingFn.apply( leadingFn, args ) }\n else {\n trailingFn.apply( trailingFn, args ) }\n\n }\n\n // Load the loop into the animation queue\n var addToQueue = function () {\n\n if ( !queued ) {\n queued = true\n handle.value = requestAnimationFrame( loop ) // Add to browser's animation queue\n }\n\n }\n\n // Remove from animation queue and reset debounce \n var removeFromQueue = function() {\n\n if ( \"value\" in handle ) {\n cancelAnimationFrame( handle.value )\n queued = false\n lastCalled = 0\n lastInvoked = 0\n leadingBlocked = false\n }\n \n }\n\n // prevent infinite debouncing ( if options.max is set )\n var maxPassed = function() {\n return ( max && now() - lastInvoked >= max )\n }\n\n var waitReached = function() {\n return ( now() - lastCalled ) >= wait\n }\n\n // This gets loaded into the animation queue and determines whether to ivoke the debounced function\n var loop = function () {\n \n // Loop was executed so it's no longer in the animation queue\n queued = false\n \n if ( leading && !leadingBlocked ) {\n invoke( 'leading' )\n }\n\n // If function has been called to frequently to execute\n else if ( maxPassed() ) {\n\n if ( leading ) { invoke( 'leading' ) }\n else { invoke( 'trailing' ) }\n\n } \n \n // If function hasn't been called since last wait\n else if ( waitReached() ) {\n\n // If trailing it's safe to invoke\n if ( trailing ) { invoke( 'trailing' ) }\n\n // If leading, it's safe to remove block\n if ( leading ) { leadingBlocked = false }\n \n } else {\n addToQueue()\n }\n\n }\n\n // A wrapper function for queueing up function calls\n //\n var debounced = function() {\n lastCalled = now()\n args = arguments\n addToQueue()\n }\n\n debounced.stop = removeFromQueue\n\n return debounced\n}\n\nmodule.exports = debounce\n","var now = function() {\n return Date.now()\n}\n\nvar delay = function ( fn, wait ) {\n\n var argsStart = ( wait != null ) ? 2 : 1;\n var handle = {}\n\n handle.args = Array.prototype.slice.call( arguments, argsStart )\n handle.wait = wait || 0\n handle.start = now()\n\n handle.stop = function () {\n if ( \"value\" in handle ) {\n cancelAnimationFrame( handle.value );\n }\n }\n\n handle.loop = function () {\n\n // If wait limit has been reached\n if ( now() - handle.start >= handle.wait ) {\n fn.apply( fn, handle.args )\n\n // If repeat is set and is not 0\n if ( !!handle.repeat ) {\n handle.repeat = handle.repeat - 1\n handle.start = now()\n queueDelay( handle )\n } else if ( handle.repeat === 0 && handle.complete ) {\n handle.complete()\n }\n\n } else {\n queueDelay( handle )\n }\n\n }\n\n\n return queueDelay( handle )\n}\n\nvar queueDelay = function ( handle ) {\n handle.value = requestAnimationFrame( handle.loop )\n return handle\n}\n\nmodule.exports = delay\n","// This simplifies common uses for window.matchMedia \n// namely, adding listeners for width and height queries\n\nfunction parseQuery( query, dimension ) {\n var result = {}\n\n if ( typeof( query ) === 'string' ) { return query }\n\n result.min = size( query.min, 'min-' + dimension )\n result.max = size( query.max, 'max-' + dimension )\n\n if ( result.min && result.max )\n result.query = result.min + ' and ' + result.max\n\n return result.query || result.min || result.max\n}\n\nfunction size( num, limit ) {\n return ( num ) ? '('+limit+': ' + toPx( num ) + ')' : null\n}\n\nfunction toPx( width ) {\n if ( typeof( width ) === 'number' ) { return width + 'px'}\n return width\n}\n\nvar media = {\n\n width: function( query, fn ) {\n return media.listen( parseQuery( query, 'width' ), fn )\n },\n\n minWidth: function( size, fn ) { return media.width( { min: size }, fn ) },\n maxWidth: function( size, fn ) { return media.width( { max: size }, fn ) },\n\n height: function( query, fn ) {\n return media.listen( parseQuery( query, 'height' ), fn )\n },\n\n minHeight: function( size, fn ) { return media.height( { min: size }, fn ) },\n maxHeight: function( size, fn ) { return media.height( { max: size }, fn ) },\n\n listen: function( query, fn ) {\n var match = window.matchMedia( query )\n\n if ( fn ) {\n fn( match )\n match.addListener( fn )\n }\n\n return match\n }\n\n}\n\n\nmodule.exports = media\n","var Event = require( 'bean' )\nvar callbackManager = require( './callback-manager' )\nvar throttle = require( './throttle' )\nvar debounce = require( './debounce' )\n\nvar optimizedEventManager = {\n new: function( name ) {\n\n // Create a new callback manager\n var manager = {\n run: callbackManager.new(),\n start: callbackManager.new(),\n stop: callbackManager.new()\n }\n\n // run callbacks when event happens (at paint-ready frames)\n var running = throttle( manager.run.fire )\n\n // fire callbacks when event starts (at paint-ready frames)\n var started = debounce({\n leading: manager.start.fire,\n trailing: false,\n wait: 150\n })\n\n // fire callbacks when event starts (at paint-ready frames)\n var stopped = debounce( manager.stop.fire, 150 )\n\n Event.on( window, name, function() {\n running()\n started()\n stopped()\n })\n\n // Public API\n var run = function ( fn ) { return manager.run.add( fn ) }\n run.start = function ( fn ) { return manager.start.add( fn ) }\n run.stop = function ( fn ) { return manager.stop.add( fn ) }\n\n // Add custom events for to run optimized listeners. ( name -> Name )\n run( function() { Event.fire( window, 'optimized' + name[0].toUpperCase() + name.substring(1) ) } )\n run.start( function() { Event.fire( window, name + 'Start' ) } )\n run.stop( function() { Event.fire( window, name + 'Stop' ) } )\n\n return run\n }\n}\n\nmodule.exports = optimizedEventManager\n","var Event = require( 'bean' )\nvar callbackManager = require( './callback-manager' )\n\n// Create a new page event manager\nvar manager = {\n ready: callbackManager.new(),\n change: callbackManager.new(),\n readyAlready: false,\n changed: false,\n}\n\nmanager.ready.add( function(){\n manager.readyAlready = true \n})\n\nmanager.ready.add( function(){ \n if ( !window.Turbolinks && !manager.changed ) { \n manager.changed = true \n manager.change.fire()\n }\n})\n\nvar ready = function ( fn ) {\n if ( manager.readyAlready ) { fn() }\n return manager.ready.add( fn ) }\n\nvar change = function( fn ) {\n if ( manager.changed ) { fn() }\n return manager.change.add( fn ) }\n\n// Make it easy to trigger ready callbacks\nready.fire = function () {\n manager.ready.fire()\n // Be sure ready can only be fired once\n manager.ready.stop() }\n\n// Make it easy to trigger change callbacks\nchange.fire = function () {\n manager.change.fire() }\n\nEvent.on( document, 'DOMContentLoaded', ready.fire )\nEvent.on( document, 'page:change', change.fire ) // Support rails turbolinks page load event\n\nmodule.exports = {\n ready: ready,\n change: change\n}\n","var delay = require( './delay' )\n\nvar repeat = function( fn, wait, limit ) {\n\n var argsStart = 1,\n handle = delay ( fn, wait );\n\n if ( limit != null ) { argsStart = 3 }\n else if ( wait != null ) { argsStart = 2 }\n\n // Enable repeat ( -1 will repeat forever )\n handle.repeat = limit || -1\n handle.args = Array.prototype.slice.call( arguments, argsStart )\n handle.stop = handle.cancel\n\n return handle\n}\n\nmodule.exports = repeat\n","var manager = require( './optimized-event-manager' )\nvar resize = manager.new( 'resize' )\n\n// Pause animations during resizing for better performance\nresize.disableAnimation = function() {\n var style = '<style id=\"fullstop\">.no-animation *, .no-animation *:after, .no-animation *:before {\\\n transition: none !important; animation: none !important\\\n }</style>'\n\n // Inject style for easy classname manipulation\n if ( !document.querySelector('style#fullstop') ) { \n document.head.insertAdjacentHTML('beforeend', style)\n }\n\n resize.start( function() { document.body.classList.add( 'no-animation' ) } )\n resize.stop( function() { document.body.classList.remove( 'no-animation' ) } )\n}\n\nmodule.exports = resize\n","var manager = require( './optimized-event-manager' )\nvar scroll = manager.new( 'scroll' )\n\nscroll.disablePointer = function() {\n\n // Disable pointer interaction\n scroll.start( function() {\n document.documentElement.style.pointerEvents = 'none'\n })\n\n // Enable pointer interaction\n scroll.stop( function() {\n document.documentElement.style.pointerEvents = ''\n })\n}\n\nmodule.exports = scroll\n","// Custom Event Polyfill\n(function () {\n\n if ( typeof window.CustomEvent === \"function\" ) return false;\n\n function CustomEvent ( event, params ) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n var evt = document.createEvent( 'CustomEvent' );\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n})()\n","var endEvents = [\n 'touchend'\n]\n\nmodule.exports = Tap\n\n// default tap timeout in ms\nTap.timeout = 200\n\nfunction Tap(callback, options) {\n options = options || {}\n // if the user holds his/her finger down for more than 200ms,\n // then it's not really considered a tap.\n // however, you can make this configurable.\n var timeout = options.timeout || Tap.timeout\n\n // to keep track of the original listener\n listener.handler = callback\n\n return listener\n\n // el.addEventListener('touchstart', listener)\n function listener(e1) {\n // tap should only happen with a single finger\n if (!e1.touches || e1.touches.length > 1) return\n\n var el = e1.target\n var context = this\n var args = arguments;\n\n var timeout_id = setTimeout(cleanup, timeout)\n\n el.addEventListener('touchmove', cleanup)\n\n endEvents.forEach(function (event) {\n el.addEventListener(event, done)\n })\n\n function done(e2) {\n // since touchstart is added on the same tick\n // and because of bubbling,\n // it'll execute this on the same touchstart.\n // this filters out the same touchstart event.\n if (e1 === e2) return\n\n cleanup()\n\n // already handled\n if (e2.defaultPrevented) return\n\n // overwrite these functions so that they all to both start and events.\n var preventDefault = e1.preventDefault\n var stopPropagation = e1.stopPropagation\n\n e1.stopPropagation = function () {\n stopPropagation.call(e1)\n stopPropagation.call(e2)\n }\n\n e1.preventDefault = function () {\n preventDefault.call(e1)\n preventDefault.call(e2)\n }\n\n // calls the handler with the `end` event,\n // but i don't think it matters.\n callback.apply(context, args)\n }\n\n // cleanup end events\n // to cancel the tap, just run this early\n function cleanup(e2) {\n // if it's the same event as the origin,\n // then don't actually cleanup.\n // hit issues with this - don't remember\n if (e1 === e2) return\n\n clearTimeout(timeout_id)\n\n el.removeEventListener('touchmove', cleanup)\n\n endEvents.forEach(function (event) {\n el.removeEventListener(event, done)\n })\n }\n }\n}\n","var debounce = require( './debounce' )\n\nvar throttle = function( fn, wait, options ) {\n\n if ( typeof( fn ) == 'object' ) { options = fn; fn = undefined } \n else { options = options || {} }\n\n options.wait = options.wait || wait || 0\n options.max = options.max || options.wait\n options.callback = options.callback || fn\n options.leading = true\n options.trailing = true\n\n return debounce(options)\n}\n\n\nmodule.exports = throttle\n","var validation = require( './lib/validation' )\nvar progressive = require( './lib/progressive' )\n\nmodule.exports = {\n\n validate: validation.validate,\n invalidateField: validation.invalidateField,\n next: progressive.next,\n\n}\n","var toolbox = require( 'compose-toolbox' ),\n Event = toolbox.event,\n Callback = toolbox.event.callback,\n formSelector = 'form.progressive',\n watching = false,\n formCallbacks,\n registeredForms\n\n// Remove any existing callbacks and registered forms\nfunction reset () {\n\n formCallbacks = { next: [] }\n registeredForms = []\n\n}\n\nfunction newForm( form ) {\n\n if ( !form ) return\n\n var steps = toolbox.slice( form.querySelectorAll( '.form-step' ) ),\n stepIndex = 0,\n navItems = ''\n\n if ( steps.length == 0 ) return\n\n\n steps.forEach( function( step, index ) { \n\n // disable all steps but the current step\n step.disabled = step != currentStep()\n step.dataset.step = index\n\n })\n\n if ( form.dataset.nav ) {\n var nav = '<nav class=\"progressive-form-nav\">'\n\n steps.forEach( function( step, index ) {\n nav += '<a href=\"#\" class=\"progressive-form-nav-item\" data-step=\"'+( index + 1 )+'\">'\n nav += step.dataset.nav || \"Step \" + ( index + 1 )\n nav += '</a> '\n })\n\n nav += '</nav>'\n\n form.insertAdjacentHTML( 'afterbegin', nav )\n }\n\n show()\n\n function previousStep () { return steps[ stepIndex - 1] }\n function currentStep () { return steps[ stepIndex ] }\n function nextStep () { return steps[ stepIndex + 1] }\n function active () { return currentStep() && !currentStep().disabled }\n \n // Move to next fieldset\n function forward () {\n showStep( stepIndex + 1 )\n }\n\n // Move to next fieldset\n function back () {\n showStep( stepIndex - 1 )\n }\n\n // Accepts a step index\n function showStep ( index ) {\n\n index = Number( index )\n\n // Get the step from the index\n var step = steps[ index ]\n\n // Don't go to a non-existant step, or the current step\n if ( step && step != currentStep() ) {\n\n var direction = ( stepIndex < index ) ? 'forward' : 'reverse'\n\n // If a step is currently active\n // dismiss it before going to the specified step\n if ( active() ) {\n return dismiss( function() { showStep( index ) }, direction )\n }\n\n stepIndex = index\n\n show( direction )\n\n }\n }\n \n // Hide a completed step and move to the next\n function dismiss ( callback, direction ) {\n direction = direction || 'forward'\n\n currentStep().classList.remove( 'active', 'enter' )\n currentStep().classList.add( 'exit' )\n currentStep().dataset.direction = direction\n\n Event.afterAnimation( currentStep(), function() {\n disable()\n\n if ( typeof callback === 'function' ) callback()\n\n })\n\n }\n\n function revisit ( callback, direction ) {\n\n if ( !active() ) {\n direction = direction || 'reverse'\n\n currentStep().classList.remove( 'exit', 'completed' )\n currentStep().classList.add( 'active', 'enter' )\n currentStep().dataset.direction = direction\n\n disableOtherFieldsets()\n\n Event.afterAnimation( currentStep(), function() {\n if ( typeof callback === 'function' ) callback()\n })\n }\n }\n\n // Show the form-step\n function show ( direction ) {\n\n disableOtherFieldsets()\n currentStep().classList.remove( 'completed' )\n currentStep().dataset.direction = direction\n currentStep().classList.add( 'active', 'enter' )\n\n // focus on the first input\n var firstInput = currentStep().querySelector( 'input:not([hidden]), textarea, select' )\n if ( firstInput ) firstInput.focus()\n\n setNav()\n\n }\n\n // Disable a form step after it has been hidden\n function disable () {\n\n currentStep().disabled = true\n currentStep().classList.add( 'completed' )\n currentStep().classList.remove( 'enter', 'exit' )\n\n }\n\n function setNav () {\n toolbox.each( form.querySelectorAll( 'nav [data-step]' ), function ( nav ) {\n\n if ( nav.dataset.step < stepIndex + 1 ) {\n nav.classList.remove( 'here', 'next' )\n nav.classList.add( 'previous', 'completed' )\n }\n\n if ( nav.dataset.step == stepIndex + 1 ) {\n nav.classList.remove( 'previous', 'next' )\n nav.classList.add( 'here' )\n }\n\n if ( nav.dataset.step > stepIndex + 1 ) {\n nav.classList.remove( 'previous', 'here' )\n nav.classList.add( 'next' )\n }\n\n })\n }\n\n function enableFieldsets ( form ) {\n toolbox.each( form.querySelectorAll( 'fieldset.form-step[disabled]' ), function( fieldset ) {\n fieldset.disabled = false \n })\n }\n\n function disableOtherFieldsets ( ) {\n steps.forEach( function( fieldset ) {\n fieldset.disabled = fieldset != currentStep() \n })\n }\n\n registeredForms.push( function( event, trigger ) {\n var target = event.currentTarget\n\n if ( trigger === 'show-step' ) {\n event.preventDefault()\n\n if ( toolbox.matches( target, '.previous, .completed, .completed + a' ) )\n showStep( target.dataset.step - 1 )\n\n } else if ( trigger === 'next' ) {\n\n // Continue if submit was triggered on this form\n // and no invalid fields are found\n\n var formEl = ( target.tagName == \"FORM\" ) ? target : toolbox.getClosest( target, 'form')\n\n if ( form == formEl && !currentStep().querySelector( ':invalid' ) ) {\n\n // Get the function which triggers callbacks\n var fireCallbacks = getCallbacks( form )\n\n // This is the last stop, be sure all fieldsets are enabled!\n if ( !nextStep() ) enableFieldsets( form )\n else disableOtherFieldsets( form )\n\n // If there are callbacks, let them handle this!\n if ( fireCallbacks ) {\n\n // Since there are callbacks, stop the submission event\n event.preventDefault()\n\n fireCallbacks( event, {\n fieldset: currentStep(), // Valid fieldset element\n form: form, // Parent form element\n forward: forward, // Call forward() to move to the next fieldset\n dismiss: dismiss, // Hide and disable current step\n revisit: revisit, // Revisit current disabled step\n showStep: showStep, // Show a specific step by index (0 based)\n complete: !nextStep(), // is this is the final form step?\n formData: toolbox.formData( currentStep() ) // pass FormData for current fieldset\n })\n }\n\n // No callbacks? If there's a next step, stop submission and proceed\n else if ( nextStep() ) {\n event.preventDefault() \n forward()\n }\n }\n }\n })\n}\n\nfunction fire ( event, type ) {\n registeredForms.forEach( function( fn ) { fn( event, type ) })\n}\n\n\n// Returns a function which triggers callbacks\nfunction getCallbacks ( form, type ) {\n\n type = type || 'next'\n var callbacks = [], cb;\n\n formCallbacks[ type ].forEach( function( test ) {\n if ( cb = test( form ) ) {\n callbacks.push( cb )\n }\n })\n\n // Return a function which can trigger all callbacks\n // or returns fallse if none are called\n\n if ( callbacks.length )\n return function() {\n var args = toolbox.slice( arguments )\n\n callbacks.forEach( function( callback ) {\n callback.apply( callback, args ) }) }\n\n else return false\n}\n\nfunction next ( el, callback ) {\n on( el, 'next', callback )\n}\n\nfunction on ( el, event, callback ) {\n\n // Accept events list as an object e.g. { next: callback }\n if ( typeof event === 'object' ) {\n for ( type in event ) {\n on( el, type, event[ type ] )\n }\n }\n\n else if ( formCallbacks[ event ] ) {\n\n // Only allow access to a callback if the form matches\n var filter = function( form ) {\n if ( form == el ) return callback\n }\n\n // Add the test wrapper function to the callback list\n formCallbacks[ event ].push( filter )\n }\n}\n\nEvent.ready( function(){\n reset()\n\n // Add bubbling so we can listen for submission\n Event.bubbleFormEvents()\n\n var nextSelector = formSelector + ' [type=submit], ' + formSelector + ' .next-step'\n var backSelector = formSelector + ' .back-step'\n var navSelector = '.progressive-form-nav-item[data-step]'\n\n Event.on( document, 'click', nextSelector , fire, 'next' )\n Event.on( document, 'click', backSelector , fire, 'back' )\n Event.on( document, 'click', navSelector , fire, 'show-step' )\n// insert core styling for hiding disabled and completed form-steps\n document.head.insertAdjacentHTML( 'beforeend', \"<style>\\\n.form-step[disabled], .form-step.completed {\\\n position: absolute !important;\\\n top: -9999px !important;\\\n left: -9999px !important;\\\n left: 0 !important;\\\n right: 0 !important; }\\\n</style>\" )\n\n Event.change( function() {\n reset()\n\n toolbox.each( document.querySelectorAll( formSelector ), function( el ) {\n newForm( el )\n })\n })\n})\n\nmodule.exports = {\n next: next,\n new: newForm\n}\n","// Dependencies\nvar toolbox = require( 'compose-toolbox' ),\n Event = toolbox.event,\n getClosest = toolbox.getClosest,\n wordCount = toolbox.wordCount,\n textSelectors = '[required]';\n\n// Does this browser support HTML5 validation?\nfunction supported () {\n\n return typeof document.createElement( 'input' ).checkValidity === 'function'\n\n}\n\nvar invalidHandler = Event.callback.new( function( event ) { \n event.preventDefault() \n event.stopPropagation() \n})\n\n// Watch for events ( if validation is suported )\nEvent.ready( function(){\n\n if ( supported() ) { \n\n Event.bubbleFormEvents()\n\n document.addEventListener( 'invalid', invalidHandler, true )\n\n Event.on( document.body, 'click', '[type=submit]', submit )\n\n Event.on( document, 'validate', 'form', function( event ) { \n validateForm( event.target )\n })\n\n // Ensure all required inputs have aria-requrired attributes\n toolbox.slice( document.querySelectorAll( '[required]' ) ).forEach( function( element ) { \n element.setAttribute( 'aria-required', true )\n })\n\n // Watch input events\n Event.on( document, 'blur', '[required]', checkValidation )\n Event.on( document, 'keydown', '[required]', Event.debounce( checkValidation, 200 ) )\n Event.on( document, 'input', 'select[required]', Event.debounce( checkValidation, 200 ) )\n\n }\n})\n\nfunction validateForm ( form ) {\n\n // Scoped variables\n var inputs = form.querySelectorAll( '[required]' ),\n invalidInput;\n\n toolbox.slice( inputs ).some( function( input ) {\n\n // if invalid\n if ( !getClosest( input, '[disabled]' ) && !checkInput( input ) ) {\n invalidInput = input\n return true\n }\n })\n\n if ( invalidInput ) { \n\n // Show validation message\n focus( invalidInput )\n showMessage( invalidInput )\n\n return false\n }\n\n // The form is valid, skip it\n else { \n return true \n }\n\n}\n\n// Handler for validation events\nvar checkValidation = Event.callback.new( function( event ) {\n\n if ( checkInput( event.target, event.type ) ) {\n\n // Remove any pre-existing validation message\n hideMessage( event.target )\n }\n\n})\n\n\nfunction checkInput ( input, event ) {\n\n var el = statusEl( input ),\n valid = isValid( input ),\n neutral = event == 'keydown' && !valid;\n\n // Don't trigger invalid style while typing\n if ( neutral && input == document.activeElement ) {\n\n el.classList.remove( 'invalid', 'valid' )\n input.setAttribute( 'aria-invalid', false )\n\n } else {\n\n el.classList.toggle( 'invalid', !valid )\n el.classList.toggle( 'valid', valid )\n input.setAttribute( 'aria-invalid', valid )\n\n }\n\n return valid\n\n}\n\n// Is an input valid?\nfunction isValid ( input ) {\n\n // If element only contains whitespace, strip value\n if ( !input.value.replace( /\\s/g, '' ).length )\n input.value = ''\n\n // Set a custom validation message for word count\n var message = checkValue( input ) || checkLength( input ) || ''\n input.setCustomValidity( message )\n\n var valid = input.checkValidity()\n\n return valid\n\n}\n\n\nfunction checkValue( input ) {\n if ( input.dataset.invalidValue ) {\n\n // Does input value == invalid value? (case insensitive)\n var regexp = escapedRegex( input.dataset.invalidValue, 'i' )\n\n if ( input.value.match( regexp ) ) {\n\n // Remove any standard custom message\n input.dataset.cachedMessage = input.dataset.message\n input.dataset.message = ''\n\n return input.dataset.invalidValueMessage || \"Value '\"+input.value+\"' is not permitted\"\n\n // If not invalid value reset standard validation message\n } else if ( input.dataset.cachedMessage ) {\n\n input.dataset.message = input.dataset.cachedMessage\n input.dataset.cachedMessage = ''\n\n }\n }\n}\n\nfunction escapedRegex( input, options ) {\n var str = input.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')\n return new RegExp( \"^\" + str + '$', options )\n}\n\nfunction checkLength ( input ) {\n return checkCount( input, 'min' )\n || checkCount( input, 'max' )\n}\n\n// Test custom validation for maximum or minimum words present\nfunction checkCount ( input, limit ) {\n\n var goal = input.dataset[ limit + 'Words' ]\n\n if ( goal ) {\n\n var lessThanGoal = wordCount( input.value ) < goal\n phrasing = ( limit == 'min' ) ? 'at least ' : 'no more than ',\n valid = ( limit == 'min' ) ? !lessThanGoal : lessThanGoal\n\n // Return a custom error message\n if ( input.value && !valid )\n return 'Please write ' + phrasing + goal + ' words.'\n }\n\n\n}\n\n// If input is nested in a label, treat the label as the\n// target for assigning status (class names and messages).\nfunction statusEl ( input ) {\n\n return getClosest( input, 'label' ) || input\n\n}\n\n// Focus() if invalid element is not hidden\n// or Focus its immediate sibling (mostly used for upload buttons)\nfunction focus ( el ) {\n\n el = ( el.style.display !== 'none' ) ? el : el.nextSibling\n el.focus()\n\n}\n\n// Submission validation handler function\nfunction submit ( event ) {\n\n var form = ( event.target.tagName == \"FORM\" ) ? event.target : getClosest( event.target, 'form')\n\n // Skip validation if no invalid inputs found\n if ( !validateForm( form ) ) {\n\n // Pause keydown/blur triggers for the next second to avoid neutral empty style\n checkValidation.stop()\n Event.delay( checkValidation.start, 500 )\n\n // Stop the submission event\n event.preventDefault()\n event.stopImmediatePropagation()\n\n }\n\n}\n\nfunction invalidateField ( el, message ) {\n if ( el && el.value ) {\n el.dataset.invalidValue = el.value\n if ( message )\n el.dataset.invalidValueMessage = message\n }\n}\n\nfunction hideMessage ( el ) {\n\n var form = getClosest( el, 'form' ),\n msg = form.querySelector( '.validation-message' )\n\n if ( msg ) msg.parentNode.removeChild( msg )\n\n}\n\n\n// Validation message handler function\nfunction showMessage ( el ) {\n\n //hideMessage( el )\n\n var label = getClosest( el, 'label' ),\n message = el.dataset.message || el.validationMessage\n\n if ( label ) {\n var existingMessage = label.querySelector( '.validation-message-text' )\n\n if ( !existingMessage ) {\n label.insertAdjacentHTML( 'beforeend', '<span class=\"validation-message\"><span class=\"validation-message-text\" role=\"alert\">' + message + '</span></span>' )\n\n } else if ( existingMessage.textContent != message ) {\n existingMessage.innerHTML = message\n }\n }\n\n}\n\n// Public API\nmodule.exports = {\n validate: validateForm,\n invalidateField: invalidateField\n}\n","require ('./lib/object.assign')\n\nvar Event = require('compose-event')\n// Improves the utility and user interface for range inputs\n\nvar sliders = []\nvar listening\n\nvar Slider = {\n // When a slider is changed, update the associated label and input.\n change: function(event) {\n self.refresh(event.currentTarget)\n },\n\n // Update labels and inputs\n refresh: function (slider) {\n self.setLabels(slider)\n self.setInput(slider)\n self.setFill(slider)\n },\n \n // Some browsers don't focus when a slider input is changed, this lets us force focus.\n focus: function(event){\n event.currentTarget.focus()\n },\n \n // Inject slider templates into the DOM\n setup: function(){\n\n if (!listening) {\n Event.on(document, \"input toggler:show\", \"[type=range]\", self.change, { useCapture: true })\n Event.on(document, \"click change input\", \"[type=range]\", self.focus, { useCapture: true })\n listening = true\n }\n\n var ranges = document.querySelectorAll('[type=range]:not(.slider-input)')\n\n Array.prototype.forEach.call(ranges, function(slider){\n\n var data = self.data(slider)\n sliders.push(data)\n\n slider.dataset.id = data.id\n\n // Inject template and set inputs\n slider = self.template(slider)\n self.refresh(slider)\n\n })\n },\n\n data: function(el) {\n var data = {\n // Assign an incremental ID to track this slider with its data\n id: sliders.length,\n min: el.getAttribute('min') || 0,\n max: el.getAttribute('max') || 100,\n labels: {},\n externalLabels: {}\n }\n\n // Gets dataset as a hash\n Object.assign(data, self.extractData(el))\n\n data = self.extractValues(data)\n data = self.getLabels(data)\n\n if (data.values)\n data.max = (data.min + data.values.length - 1)\n\n data.segments = Number(data.max) - Number(data.min) + 1\n\n for (var key in data) {\n if(key.match(/-/)){\n data[this.camelCase(key)] = data[key]\n delete data[key]\n }\n }\n\n // Allow data-input or name attribute to set value for hidden input.\n //\n if (!data.input && el.getAttribute('name')) {\n data.input = el.getAttribute('name')\n el.removeAttribute('name')\n }\n\n if (data.input) {\n // Generate a class name for querying later (because some name attributes contain illegal characters for queries)\n data.inputClass = data.input.replace(/\\W/g,'-')\n data.inputExists = self.inputExists(el, data)\n }\n\n data = self.getLineLabels(data)\n\n if (data.mark) { \n data.mark = data.mark.split(',').map(Number) \n }\n\n return data\n },\n\n getData: function(slider) {\n if (typeof slider != 'string' && slider.dataset) {\n slider = slider.dataset.id\n }\n return sliders[slider]\n },\n\n extractValues: function(data) {\n if (data.values) { \n data.values = data.values.split(',').map(self.trim)\n } else {\n data.values = []\n for (var i = data.min; i <= data.max; i++ ) {\n data.values.push(i)\n }\n }\n\n return data\n },\n\n // Convert dataset strings into hashes of arrays\n // examples:\n // - data-label='one,two,three' => data.labels.default = ['one','two','three']\n // - data.external-label-awesome='one;two;three' => data.externalLabels.awesome = ['one','two','three']\n //\n // If labels have not been disabled (data-label='false') and there are no data labels,\n // an array of values is set to data.labels.default\n //\n getLabels: function(data) {\n if (data.label && data.label.match(/false|none/))\n data.label = false\n\n // Unless labels have been disabed with data-label='false'\n for (var val in data) {\n // Ignore non-native methods injected by some wayward lib\n if (!data.hasOwnProperty(val)) { continue }\n // Don't bother processing disabled labels\n if (data[val] === false) { continue }\n\n // Match properties: label, label-id, external-label-id\n var match = val.match(/^(external-)?label-(.+)|^label$/)\n\n if(match) {\n // Some labels may include commas, allow semicolons as an alternate separator\n //\n var delimiter = data[val].match(/;/) ? ';' : ','\n var labels = data[val].split(delimiter).map(self.trim)\n var external = match[1]\n var name = match[2]\n\n if(external){\n data.externalLabels[name] = labels\n } else if (val == 'label') {\n data.labels.default = labels\n delete data.label\n } else {\n data.labels[name] = labels\n }\n\n delete data[val]\n }\n\n var labelCount = self.objectSize(data.labels)\n\n // If there are no labels, use values for a label\n if (labelCount == 0)\n data.labels.default = data.values\n\n if (labelCount > 1)\n delete data.labels.default\n }\n\n return data\n },\n\n getLineLabels: function(data){\n var lineLabels = {}\n\n // Line labels may be in the following formats:\n // - 1:start,11:end - index specified, comma separated\n // - first,second,third,11:last - default to index for some labels\n // - 10,000;20,000;30,000 - semicolon separated\n //\n if(data.lineLabels) {\n var delimiter = data.lineLabels.match(/;/) ? ';' : ','\n data.lineLabels.split(delimiter).map(function(labels, index){\n var l = labels.split(':')\n label = (!l[1] ? l[0] : l[1])\n index = (!l[1] ? index + 1 : l[0])\n lineLabels[index] = label\n })\n data.lineLabels = lineLabels\n }\n\n return data\n },\n\n // \n template: function(slider){\n var data = self.getData(slider)\n\n slider.setAttribute('min', data.min)\n slider.setAttribute('max', data.max)\n\n slider.classList.add('slider-input')\n\n if(slider.classList.contains('left-label'))\n slider.classList.remove('left-label')\n\n var containerHTML = self.templateHTML(data)\n\n var classes = ['slider-container']\n\n if (containerHTML.match('slider-line-label'))\n classes.push('line-labels')\n\n if (containerHTML.match('slider-label'))\n classes.push(\"with-label\")\n else\n classes.push(\"without-label\")\n\n containerHTML = '<div class=\"'+classes.join(' ')+'\" id=\"slider'+data.id+'\">'\n + containerHTML\n +'</div>'\n\n slider.insertAdjacentHTML('beforebegin', containerHTML)\n var container = slider.previousSibling\n container.querySelector('.slider-input-container').insertAdjacentHTML('afterbegin', slider.outerHTML)\n slider.parentNode.removeChild(slider)\n\n slider = container.querySelector('.slider-input')\n \n // Update attributes from processed data\n //\n if(!slider.getAttribute('value'))\n slider.value = data.value || data.min\n return slider\n },\n \n templateHTML: function(data){\n var html = \"\"\n var fills = \"\"\n \n if (data.mark || data.lineLabels) {\n for(var i = 1; i <= data.segments; i++) {\n \n html += \"<div class='slider-segment'><span class='slider-segment-content'>\"\n\n if (data.mark && data.mark.indexOf(i) != -1)\n html += \"<span class='slider-segment-mark' data-index='\"+i+\"'></span>\"\n\n if (data.lineLabels && data.lineLabels[i]) \n html += \"<span class='slider-line-label'>\"+data.lineLabels[i]+\"</span>\"\n\n html += \"</span></div>\"\n }\n }\n\n // one less\n for(var i = 1; i < data.segments; i++) {\n fills += \"<span class='slider-fill' data-index='\"+i+\"'></span>\"\n }\n\n html = \"<div class='slider-input-container'>\"\n + \"<div class='slider-track'>\" + html + \"</div>\"\n + \"<div class='slider-fills'>\" + fills + \"</div>\"\n + \"</div>\"\n + self.labelTemplate(data)\n\n if (!data.inputExists && data.inputClass) {\n html += \"<input class='\"+data.inputClass+\"' type='hidden' name='\"+data.input+\"' value=''>\"\n }\n\n return html\n \n },\n\n labelTemplate: function(data){\n var html = \"\"\n\n if (data.label == false) { return html }\n\n for(var key in data.labels){\n html += '<span class=\"slider-label-'+key+' internal-label\" data-slider-label=\"'+key+'\">'\n html += self.labelHTML(data, key, '')\n html += '</span></span> '\n }\n\n if (html.length > 0) {\n html = \"<div class='slider-label align-\"+(data.positionLabel || 'right')+\"'>\" + html + \"</div>\"\n }\n\n return html\n },\n\n labelHTML: function(data, key, label) {\n return self.labelMeta(data, key, 'before')\n + \"<span class='label-content'>\" + label + \"</span>\"\n + self.labelMeta(data, key, 'after')\n },\n\n // Grab all prefixes or suffixes, for example:\n // - data-before-label='$'\n // - data-after-label='/mo'\n // - data-after-label-size='GB'\n //\n labelMeta: function(data, key, position) {\n var altKey = self.camelCase('-label-'+key)\n var meta = data[position+altKey] || data[position+'Label']\n if (meta)\n return \"<span class='\"+position+\"-label'>\"+meta+\"</span>\"\n else\n return ''\n },\n\n // Is there already an input matching this name?\n inputExists: function(slider, data) {\n if (data.inputClass) {\n var input = self.scope(slider).querySelector('input[name=\"'+data.input+'\"]')\n\n if(input) {\n input.classList.add(data.inputClass)\n return true\n }\n }\n },\n\n extractData: function(el) {\n var pattern = 'data-'\n var data = {}\n\n for (var i = 0; i < el.attributes.length; i++){\n var name = el.attributes[i].nodeName\n\n if(new RegExp(\"^\"+pattern).test(name)) {\n name = name.replace(pattern, '')\n data[name] = el.attributes[i].nodeValue\n }\n }\n return data\n },\n\n labelElements: function(id, key, external) {\n var selector = '[data-slider-label='+key+']'\n var internalSelector = \"#slider\"+id + ' ' + selector\n var externalSelector = selector += ':not(.internal-label)' \n if (external) { \n selector = externalSelector\n } else {\n selector = internalSelector + ', ' + externalSelector\n }\n\n return document.querySelectorAll(selector)\n },\n\n setFill: function(slider) {\n var data = self.getData(slider)\n var segments = document.querySelectorAll('#slider'+data.id+' .slider-segment')\n var fills = document.querySelectorAll('#slider'+data.id+' .slider-fill')\n var sliderIndex = self.sliderIndex(slider)\n \n Array.prototype.forEach.call(fills, function(fill, index){\n if (fill.dataset.index <= sliderIndex) {\n fill.classList.add('filled')\n if(segments[index]) {\n segments[index].classList.add('filled')\n }\n } else {\n fill.classList.remove('filled')\n if(segments[index]) {\n segments[index].classList.remove('filled')\n }\n }\n })\n \n },\n\n setInput: function(slider) {\n var data = self.getData(slider)\n\n // Don't update hidden sliders\n if (slider.offsetParent === null) { return }\n\n if (data.input && data.values) {\n var value = data.values[self.sliderIndex(slider)]\n var selector = \".\"+data.input.replace(/\\W/g,'-')\n var inputs = self.scope(slider).querySelectorAll(selector)\n\n Array.prototype.forEach.call(inputs, function(input){\n input.value = value\n })\n }\n },\n\n setLabels: function(slider) {\n var data = self.getData(slider)\n var index = self.sliderIndex(slider)\n\n if (slider.offsetParent === null) { return }\n\n Array.prototype.forEach.call(['labels', 'externalLabels'], function(type) {\n var external = (type == 'externalLabels')\n\n for (var key in data[type]) {\n var labelEls = self.labelElements(data.id, key, external)\n var labels = self.labelAtIndex(data[type], index)\n\n Array.prototype.forEach.call(labelEls, function(el) {\n var container = el.querySelector('.label-content')\n\n if ( container ) { container.innerHTML = labels[key] }\n else { el.innerHTML = self.labelHTML(data, key, labels[key]) }\n\n el.classList.toggle('empty-label', labels[key] === '')\n })\n }\n })\n },\n\n // Get all labels for the current slider position\n labelAtIndex: function(labels, index){\n var set = {}\n for (var key in labels) {\n set[key] = labels[key][index]\n }\n return set\n }, \n\n // Normalize the slider value by the minimum value\n sliderIndex: function(slider){\n return Number(slider.value) - Number(slider.getAttribute('min'))\n },\n\n // If slider is in a form, return that form.\n // This alows us to be sure that sliders in one\n // form do not update labels with the same name\n // in another form.\n //\n scope: function(slider) {\n var el = slider\n\n while (el && el.tagName != \"FORM\") {\n el = el.parentNode\n }\n\n return el || document\n },\n\n // Function for easy maping, as in: someArray.map(self.trim)\n trim: function(name){ \n return name.trim()\n },\n\n objectSize: function(object) {\n var length = 0; for(var i in object) { length++ }\n return length\n },\n\n camelCase: function(input) {\n return input.toLowerCase().replace(/-(.)/g, function(match, group) {\n return group.toUpperCase();\n });\n }\n}\n\nvar self = Slider\n\nEvent.change(Slider.setup)\n\nmodule.exports = Slider\n","if (typeof Object.assign != 'function') {\n (function () {\n Object.assign = function (target) {\n 'use strict';\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (Object.prototype.hasOwnProperty.call(source, nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n })();\n}\n","var Event = require('compose-event')\n\nvar Toggler = {\n checkboxSelector: \"[type=checkbox][data-toggle], [type=checkbox][data-show], [type=checkbox][data-hide]\",\n radioSelector: \"input[type=radio][data-show], input[type=radio][data-hide], input[type=radio][data-add-class], input[type=radio][data-remove-class]\",\n selectSelector: \"option[data-hide], option[data-show]\",\n\n listen: function(){\n Event.on(document, \"click change\", \"[data-toggle], [data-show], [data-hide], [data-toggle-class], [data-add-class], [data-remove-class]\", Toggler.trigger)\n Event.on(document, \"change\", \".select-toggler\", Toggler.trigger)\n Event.on(window, 'hashchange', Toggler.hashChange)\n },\n\n hashChange: function() {\n if ( window.location.hash ) {\n\n var anchor = '[data-anchor=\"'+window.location.hash+'\"]'\n var target = document.querySelector( 'input'+anchor+ ', option'+anchor )\n\n if ( target ) {\n if ( target.type == 'radio' ) {\n target.checked = true\n } else {\n var select = Toggler.getSelectFromOption(target)\n select.selectedIndex = target.index\n target = select\n }\n ratchet.toggler.triggerToggling( target )\n }\n }\n },\n\n refresh: function(){\n Toggler.toggleCheckboxes()\n Toggler.setupSelects()\n Toggler.setupRadios()\n },\n\n trigger: function(event) {\n // Stop event and bubbling if link is only being used as a toggler\n if (event.currentTarget.getAttribute('href') == \"#\") {\n event.preventDefault()\n event.stop()\n } \n\n Toggler.triggerToggling(event.currentTarget, event)\n },\n\n triggerToggling: function(target, event) {\n var actions = ['hide', 'toggle', 'show', 'removeClass', 'toggleClass', 'addClass']\n var select\n\n // Store the select, and set the target to the current option\n // Events fire on the select, but the options have toggling attributes\n if (target.tagName.match(/select/i)) {\n select = target\n target = select.selectedOptions[0]\n }\n\n // Radio inputs and selects do not support toggling, so remove them\n if (select || target.type == 'radio') {\n actions = actions.filter(function(action) {\n return !action.match(/toggle/)\n })\n }\n\n // Dispatch all actions\n actions.forEach(function(action) {\n Toggler.dispatch(target, action)\n })\n },\n\n dispatch: function(el, type) {\n var action = type\n var data = el.dataset[type]\n\n // Abort if element doesn't have data for the action\n if (!data || typeof data == 'undefined' || data == '') return\n\n // Toggle and show are treated the same for checkboxes\n if (el.type == 'checkbox')\n action = (type.match(/hide|remove/i) ? !el.checked : el.checked)\n\n if (data){\n if (type.match(/class/i)){\n Toggler.setClass(data, action, el)\n } else {\n Toggler.setState(data, action)\n }\n }\n },\n\n // Add, remove, or toggle classnames, triggered by elements with:\n // data-hide-class, data-show-class, and data-toggle-class values\n //\n // Data value examples:\n // - \"classname\" - add/remove/toggle classname on current element\n // - \"foo bar\" - multiple classnames, separated by spaces (like html class property)\n // - \"foo bar; selector\" - change classnames on elements matched by selector\n // - \"foo bar; selector, selector\" - match multiple selectors\n //\n // You can perform multiple add/remove classes by joining values with an `&`\n // For example: \"classname & foo bar; selector\"\n // This would toggle classname on current element and toggle `foo bar` classnames\n // on an element matching the selector\n //\n\n setClass: function (selectors, action, el){\n if(typeof selectors == 'undefined' || selectors == '') return\n\n if (typeof(action) == 'boolean') {\n action = (action ? 'add' : 'remove')\n }\n\n if (selectors.match(/&/)) {\n selectors.split('&').forEach(function(sel){\n Toggler.setClass(sel.trim(), action, el) \n })\n return\n }\n\n // Get selector and classnames, format: \"classname classname; selector,selector\"\n var settings = selectors.split(';')\n var classnames = settings[0].trim()\n var matches = []\n selectors = settings[1]\n\n if (selectors) {\n matches = document.querySelectorAll(selectors)\n\n // If no slectors are present, and el is an OPTION, use its SELECT as the matched element\n } else if (el && el.tagName.match(/option/i)) {\n matches = [Toggler.getSelectFromOption(el)]\n \n // If no slectors are present, use the current el for classnames\n } else if (el) {\n matches = [el]\n }\n\n Array.prototype.forEach.call(matches, function(match){\n Array.prototype.forEach.call(classnames.split(' '), function(classname) {\n var method = action.replace(/Class/,'')\n match.classList[method](classname)\n })\n\n Toggler.triggerTogglerEventsOnChildren(match, 'class')\n })\n },\n\n setState: function(selectors, state) {\n var matches = document.querySelectorAll(selectors)\n\n Array.prototype.forEach.call(matches, function(match){\n var action = Toggler.toggleAction(match, state)\n\n Toggler[action](match)\n Toggler.triggerTogglerEventsOnChildren(match, action)\n })\n },\n\n toggleAction: function(el, action) {\n\n if (typeof(action) == 'boolean') {\n action = (action ? 'show' : 'hide')\n }\n\n if (action == 'toggle') {\n if (el.classList.contains('hidden')) {\n action = 'show'\n } else {\n action = 'hide'\n }\n }\n\n return action\n },\n\n show: function(el) {\n el.classList.remove('hidden')\n el.classList.add('visible')\n\n // Enable inputs, fieldsets or forms when shown\n if ( typeof el.disabled != 'undefined' ){\n el.disabled = false\n }\n\n // Focus on key element if an element expects focus\n var focusEl = el.querySelector('[data-focus]')\n if (focusEl) { focusEl.focus() }\n\n // Trigger input event on ranges that have been hidden\n var ranges = el.querySelectorAll('[type=range]')\n },\n\n hide: function(el) {\n el.classList.remove('visible')\n el.classList.add('hidden')\n\n // Disable inputs, fieldsets or forms when hidden\n if ( typeof el.disabled != 'undefined' ){\n el.disabled = true\n }\n },\n\n getLeafNodes: function (parent) {\n // is the parent itself a leaf node?\n if (!parent.hasChildNodes()) return [parent]\n\n var nodes = Array.prototype.slice.call(parent.getElementsByTagName(\"*\"), 0)\n\n return nodes.filter(function(elem) {\n return elem.children && elem.children.length === 0\n })\n },\n\n triggerTogglerEventsOnChildren: function(el, eventName){\n // we care about leaf nodes since the event will bubble to\n // non-leaf nodes from the leaf nodes\n var leafChildNodes = Toggler.getLeafNodes(el)\n\n Array.prototype.forEach.call(leafChildNodes, function(node) {\n // 'toggler:show', 'toggler:hide', etc\n Event.fire(node, \"toggler:\" + eventName)\n })\n },\n\n toggleCheckboxes: function(checkboxes) {\n checkboxes = checkboxes || document.querySelectorAll(Toggler.checkboxSelector)\n\n Array.prototype.forEach.call(checkboxes, Toggler.triggerToggling)\n },\n\n setupRadios: function() {\n Array.prototype.forEach.call(document.querySelectorAll(Toggler.radioSelector), function(radio, index){\n if (!radio.dataset.togglerActive) {\n\n var radioName = radio.getAttribute('name'),\n siblings = Toggler.parentForm(radio).querySelectorAll('[type=radio][name=\"'+radioName+'\"]'),\n showSelectors = Toggler.dataAttributes(siblings, 'show'),\n addClassSelectors = Toggler.dataAttributes(siblings, 'addClass'),\n checked\n\n Array.prototype.forEach.call(siblings, function(r){\n\n if (r.dataset.anchor && window.location.hash == ('#'+r.dataset.anchor.replace('#',''))) {\n r.checked = true\n }\n\n // Ensure that all radio buttons in a group have a default data-show value of ''\n // This means that unset data-show values will toggle off everything\n //\n r.dataset.show = r.dataset.show || ''\n r.dataset.addClass = r.dataset.addClass || ''\n\n // Append element's data-hide to showSelectors\n if ( r.dataset.hide && r.dataset.hide.length > 0 )\n showSelectors = showSelectors.concat( r.dataset.hide.split( ',' ) )\n\n r.dataset.hide = showSelectors.filter(function(selector){\n return r.dataset.show.indexOf( selector )\n }).join(',')\n\n // Ensure that all radio buttons in a group have a default data-add-class value of ''\n // This means that unset data-add-class values are toggle off all classes\n //\n r.dataset.addClass = r.dataset.addClass || ''\n\n // Ensure that selected radio buttons remove classes according\n // to the deselected radio buttons\n r.dataset.removeClass = addClassSelectors.filter(function(selector){\n return r.dataset.addClass.indexOf( selector )\n }).join('&')\n\n\n r.dataset.togglerActive = true\n\n\n if( r.checked ) checked = r\n\n })\n\n if ( checked ) {\n Toggler.triggerToggling( checked )\n } else {\n Toggler.setState( showSelectors.join(','), 'hide' )\n Toggler.setClass( addClassSelectors.join(' & '), 'removeClass' )\n }\n }\n\n })\n },\n\n // Add data-hide to each <option> containing the selectors from other\n // option's data-show. This makes the toggling of elements exclusive.\n //\n setupSelects: function(){\n Array.prototype.forEach.call(document.querySelectorAll(Toggler.selectSelector), function(option){\n // Prevent an option from being considered twice\n if (!option.dataset.togglerActive) {\n\n option.dataset.show = option.dataset.show || ''\n\n var select = Toggler.getSelectFromOption(option)\n select.classList.add('select-toggler')\n var options = select.querySelectorAll('option')\n\n var showSelectors = Toggler.dataAttributes(options, 'show')\n var addClassSelectors = Toggler.dataAttributes(options, 'addClass')\n\n Array.prototype.forEach.call(options, function(o, index) {\n\n if (o.dataset.anchor && window.location.hash == ('#'+o.dataset.anchor.replace('#',''))) {\n select.selectedIndex = index\n }\n\n o.dataset.show = o.dataset.show || ''\n o.dataset.addClass = o.dataset.addClass || ''\n\n // Append element's data-hide to showSelectors\n if ( o.dataset.hide && o.dataset.hide.length > 0 )\n showSelectors = showSelectors.concat( o.dataset.hide.split( ',' ) )\n\n // If show selectors are not present in element's data-show\n // Add them to the list of selectors to be hidden\n o.dataset.hide = showSelectors.filter(function(selector){\n return o.dataset.show.indexOf( selector )\n }).join(',')\n\n o.dataset.removeClass = addClassSelectors.filter(function(selector){\n return o.dataset.addClass.indexOf( selector )\n }).join(' & ')\n\n o.dataset.togglerActive = true\n })\n\n // Ensure that currently selected option is toggled properly\n //\n Toggler.triggerToggling(select)\n }\n })\n },\n\n // Find parent <select> for an option (accounts for option groups)\n //\n getSelectFromOption: function(el) {\n var p = el.parentElement\n\n if (p.tagName == 'SELECT') {\n return p\n } else {\n return Toggler.getSelectFromOption(p)\n }\n },\n\n\n // Find parent <form> or document if there is no form\n //\n parentForm: function(element) {\n var el = element\n\n while (el && el.tagName != \"FORM\") {\n el = el.parentNode\n }\n\n return el || document\n },\n\n // Return a unique array of all data attribute values from elements\n //\n dataAttributes: function(elements, attr) {\n return Array.prototype.map.call(elements, function(el) { \n return el.dataset[attr]\n }).filter(function(selectors, index, self) {\n return selectors != \"\" && typeof selectors != 'undefined' && self.indexOf(selectors) === index\n })\n }\n}\n\nEvent.ready(Toggler.listen)\nEvent.change(Toggler.refresh)\n\nmodule.exports = Toggler\n","// Shims\nrequire( './lib/shims/_classlist' )\nvar merge = require( './lib/shims/_object.assign' )\n\nvar event = require( 'compose-event' )\nvar scrollTo = require( './lib/scrollto' )\nvar fromTop = require( './lib/fromtop' )\nvar ease = require( './lib/ease' )\n\nvar toolbox = {\n\n event: event,\n scrollTo: scrollTo,\n fromTop: fromTop,\n merge: merge,\n ease: ease,\n\n // Get closest DOM element up the tree that matches a given selector\n getClosest: function ( el, selector ) {\n for ( ; el && el !== document; el = el.parentNode ) {\n if ( toolbox.matches( el, selector ) ) return el;\n }\n return false;\n },\n\n // Get next DOM element that matches a given selector\n getNext: function( el, selector ) {\n for ( ; el && el !== document; el = el.parentNode ) {\n if ( el.querySelector( selector ) ) return el.querySelector( selector );\n }\n return false;\n },\n\n // Matches selector function\n // @reference https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n matches: function ( el, selector ) {\n return ( el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector ).call( el, selector );\n },\n\n wordCount: function( str ) {\n var matches = str.match( /\\S+/g );\n return matches ? matches.length : 0;\n },\n\n // Easy access to slice for converting objects into arrays of values.\n slice: function( obj, count ) {\n return Array.prototype.slice.call( obj, count )\n },\n\n each: function( collection, callback ) {\n return Array.prototype.forEach.call( collection, callback )\n },\n\n formData: function( rootEl ) {\n var formData = new FormData(),\n fields = rootEl.querySelectorAll( 'input[name]' )\n\n // Loop over fields\n toolbox.each( fields, function( field ) {\n // Append current field’s name/value to new formData object\n formData.append( field.name, field.value );\n })\n\n // Then return said formData object\n return formData;\n }\n\n}\n\n\nmodule.exports = toolbox\n","// easing functions http://gizma.com/easing/\nvar ease = {\n\n inOutQuad: function (t, b, c, d) {\n t /= d/2\n if (t < 1) { return c/2*t*t + b }\n t--\n return -c/2 * (t*(t-2) - 1) + b\n },\n\n inOutCubic: function (t, b, c, d) {\n\tt /= d/2;\n\tif (t < 1) return c/2*t*t*t + b;\n\tt -= 2;\n\treturn c/2*(t*t*t + 2) + b;\n },\n\n inOutQuint: function(t, b, c, d) {\n var ts = (t/=d)*t,\n tc = ts*t;\n return b+c*(6*tc*ts + -15*ts*ts + 10*tc);\n },\n\n inOutCirc: function (t, b, c, d) {\n t /= d/2;\n if (t < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;\n t -= 2;\n return c/2 * (Math.sqrt(1 - t*t) + 1) + b;\n }\n\n}\n\nease.default = ease.inOutQuad\n\nmodule.exports = ease\n","module.exports = function( el ) {\n return Math.round( el.getBoundingClientRect().top + window.pageYOffset );\n}\n","var ease = require( './ease' )\nvar fromTop = require( './fromtop' )\n\nfunction move(amount) {\n\n // Scroll all because document.scrollingElement is still expiremental\n document.documentElement.scrollTop = amount;\n document.body.parentNode.scrollTop = amount;\n document.body.scrollTop = amount;\n\n}\n\nfunction position() {\n return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;\n}\n\nfunction scrollTo(to, callback, duration) {\n\n // Making args flexible\n //\n // Allow for element or y-coordinates\n if( typeof( to ) === 'object' ) { to = fromTop( to ) }\n\n // Accept duration as the second argument\n if( typeof( callback ) === 'number' ) { duration = callback; callback = null }\n\n // Default duration = 500\n duration = ( typeof( duration ) === 'undefined' ) ? 500 : duration\n\n var start = position(),\n change = to - start,\n currentTime = 0,\n increment = 20;\n\n\n var animateScroll = function() {\n\n // increment the time\n currentTime += increment\n\n // find the value with the quadratic in-out easing function\n var val = ease.default(currentTime, start, change, duration)\n\n // move the document.body\n move(val);\n\n // do the animation unless its over\n if ( currentTime < duration ) {\n requestAnimationFrame( animateScroll )\n } else {\n if ( callback && typeof( callback ) === 'function') {\n callback()\n }\n }\n }\n\n animateScroll()\n}\n\nmodule.exports = scrollTo\n","/**\n * ClassList polyfill\n * Cross-browser full element.classList implementation\n * @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js\n * @author Eli Grey - http://eligrey.com\n * @license MIT\n **/\n\nif ( 'document' in self ) {\n\n // Full polyfill for browsers with no classList support\n if ( !( 'classList' in document.createElement( '_' ) ) ) {\n\n ( function( view ) {\n\n 'use strict';\n\n if ( !( 'Element' in view ) ) return;\n\n var\n classListProp = 'classList',\n protoProp = 'prototype',\n elemCtrProto = view.Element[ protoProp ],\n objCtr = Object,\n\n strTrim = String[ protoProp ].trim || function() {\n return this.replace( /^\\s+|\\s+$/g, '' );\n },\n\n arrIndexOf = Array[ protoProp ].indexOf || function( item ) {\n for ( var i = 0; i < this.length; i++ ) {\n if ( i in this && this[ i ] === item ) {\n return i;\n }\n }\n return -1;\n },\n\n DOMEx = function( type, message ) {\n this.name = type;\n this.code = DOMException[ type ];\n this.message = message;\n },\n\n checkTokenAndGetIndex = function( classList, token ) {\n if ( token === '' ) {\n throw new DOMEx(\n 'SYNTAX_ERR',\n 'An invalid or illegal string was specified'\n );\n }\n if ( /\\s/.test( token ) ) {\n throw new DOMEx(\n 'INVALID_CHARACTER_ERR',\n 'String contains an invalid character'\n );\n }\n return arrIndexOf.call( classList, token );\n },\n\n ClassList = function( elem ) {\n var trimmedClasses = strTrim.call( elem.getAttribute( 'class' ) || '' ),\n classes = trimmedClasses ? trimmedClasses.split( /\\s+/ ) : [];\n\n for ( var i = 0; i < classes.length; i++ ) {\n this.push( classes[ i ] );\n }\n\n this._updateClassName = function() {\n elem.setAttribute( 'class', this.toString() );\n };\n },\n\n classListProto = ClassList[ protoProp ] = [],\n\n classListGetter = function() {\n return new ClassList( this );\n };\n\n DOMEx[ protoProp ] = Error[ protoProp ];\n\n classListProto.item = function( i ) {\n return this[ i ] || null;\n };\n\n classListProto.contains = function( token ) {\n token += '';\n return checkTokenAndGetIndex( this, token ) !== -1;\n };\n\n classListProto.add = function() {\n var\n tokens = arguments,\n iter = 0,\n len = tokens.length,\n updated = false,\n token;\n\n do {\n token = tokens[ iter ] + '';\n if ( checkTokenAndGetIndex( this, token ) === -1 ) {\n this.push( token );\n updated = true;\n }\n }\n\n while ( ++iter < len );\n\n if ( updated ) {\n this._updateClassName();\n }\n };\n\n classListProto.remove = function() {\n var\n tokens = arguments,\n iter = 0,\n len = tokens.length,\n updated = false,\n token,\n index;\n\n do {\n token = tokens[ iter ] + '';\n index = checkTokenAndGetIndex( this, token );\n\n while ( index !== -1 ) {\n this.splice( index, 1 );\n updated = true;\n index = checkTokenAndGetIndex( this, token );\n }\n }\n\n while ( ++iter < len );\n\n if ( updated ) {\n this._updateClassName();\n }\n };\n\n classListProto.toggle = function( token, force ) {\n token += '';\n\n var\n result = this.contains( token ),\n method = result ? force !== true && 'remove' : force !== false && 'add';\n\n if ( method ) {\n this[ method ]( token );\n }\n\n if ( force === true || force === false ) {\n return force;\n } else {\n return !result;\n }\n };\n\n classListProto.toString = function() {\n return this.join( ' ' );\n };\n\n if ( objCtr.defineProperty ) {\n var classListPropDesc = {\n get : classListGetter,\n enumerable : true,\n configurable : true\n };\n\n try {\n objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );\n }\n\n catch ( ex ) {\n if ( ex.number === -0x7FF5EC54 ) {\n classListPropDesc.enumerable = false;\n objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );\n }\n }\n\n } else if ( objCtr[ protoProp ].__defineGetter__ ) {\n elemCtrProto.__defineGetter__( classListProp, classListGetter );\n }\n\n }( self ));\n\n } else {\n\n ( function() {\n\n 'use strict';\n\n var testElement = document.createElement( '_' );\n\n testElement.classList.add( 'c1', 'c2' );\n\n if ( !testElement.classList.contains( 'c2' ) ) {\n var createMethod = function( method ) {\n var original = DOMTokenList.prototype[ method ];\n\n DOMTokenList.prototype[ method ] = function( token ) {\n var i, len = arguments.length;\n\n for ( i = 0; i < len; i++ ) {\n token = arguments[ i ];\n original.call( this, token );\n }\n };\n };\n createMethod( 'add' );\n createMethod( 'remove' );\n }\n\n testElement.classList.toggle( 'c3', false );\n\n if ( testElement.classList.contains( 'c3' ) ) {\n var _toggle = DOMTokenList.prototype.toggle;\n\n DOMTokenList.prototype.toggle = function( token, force ) {\n if ( 1 in arguments && !this.contains( token ) === !force ) {\n return force;\n } else {\n return _toggle.call( this, token );\n }\n };\n\n }\n\n testElement = null;\n\n }());\n\n }\n}\n","/**\n * Object.assign polyfill\n * Cross-browser full Object.assign implementation\n * @source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill\n * @license MIT\n **/\n\nif ( typeof Object.assign != 'function' ) {\n ( function() {\n Object.assign = function( target ) {\n 'use strict';\n if ( target === undefined || target === null ) {\n throw new TypeError( 'Cannot convert undefined or null to object' );\n }\n\n var output = Object( target );\n for ( var index = 1; index < arguments.length; index++ ) {\n var source = arguments[ index ];\n if ( source !== undefined && source !== null ) {\n for ( var nextKey in source ) {\n if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {\n output[ nextKey ] = source[ nextKey ];\n }\n }\n }\n }\n return output;\n };\n })();\n}\n\n// Make it easy to merge objects without overwriting the original objects\nvar merge = function() {\n var args = [{}].concat( Array.prototype.slice.call( arguments ) )\n return Object.assign.apply( this, args )\n}\n\nmodule.exports = merge\n","// keymaster.js\n// (c) 2011-2013 Thomas Fuchs\n// keymaster.js may be freely distributed under the MIT license.\n\n;(function(global){\n var k,\n _handlers = {},\n _mods = { 16: false, 18: false, 17: false, 91: false },\n _scope = 'all',\n // modifier keys\n _MODIFIERS = {\n '⇧': 16, shift: 16,\n '⌥': 18, alt: 18, option: 18,\n '⌃': 17, ctrl: 17, control: 17,\n '⌘': 91, command: 91\n },\n // special keys\n _MAP = {\n backspace: 8, tab: 9, clear: 12,\n enter: 13, 'return': 13,\n esc: 27, escape: 27, space: 32,\n left: 37, up: 38,\n right: 39, down: 40,\n del: 46, 'delete': 46,\n home: 36, end: 35,\n pageup: 33, pagedown: 34,\n ',': 188, '.': 190, '/': 191,\n '`': 192, '-': 189, '=': 187,\n ';': 186, '\\'': 222,\n '[': 219, ']': 221, '\\\\': 220\n },\n code = function(x){\n return _MAP[x] || x.toUpperCase().charCodeAt(0);\n },\n _downKeys = [];\n\n for(k=1;k<20;k++) _MAP['f'+k] = 111+k;\n\n // IE doesn't support Array#indexOf, so have a simple replacement\n function index(array, item){\n var i = array.length;\n while(i--) if(array[i]===item) return i;\n return -1;\n }\n\n // for comparing mods before unassignment\n function compareArray(a1, a2) {\n if (a1.length != a2.length) return false;\n for (var i = 0; i < a1.length; i++) {\n if (a1[i] !== a2[i]) return false;\n }\n return true;\n }\n\n var modifierMap = {\n 16:'shiftKey',\n 18:'altKey',\n 17:'ctrlKey',\n 91:'metaKey'\n };\n function updateModifierKey(event) {\n for(k in _mods) _mods[k] = event[modifierMap[k]];\n };\n\n // handle keydown event\n function dispatch(event) {\n var key, handler, k, i, modifiersMatch, scope;\n key = event.keyCode;\n\n if (index(_downKeys, key) == -1) {\n _downKeys.push(key);\n }\n\n // if a modifier key, set the key.<modifierkeyname> property to true and return\n if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko\n if(key in _mods) {\n _mods[key] = true;\n // 'assignKey' from inside this closure is exported to window.key\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;\n return;\n }\n updateModifierKey(event);\n\n // see if we need to ignore the keypress (filter() can can be overridden)\n // by default ignore key presses if a select, textarea, or input is focused\n if(!assignKey.filter.call(this, event)) return;\n\n // abort if no potentially matching shortcuts found\n if (!(key in _handlers)) return;\n\n scope = getScope();\n\n // for each potential shortcut\n for (i = 0; i < _handlers[key].length; i++) {\n handler = _handlers[key][i];\n\n // see if it's in the current scope\n if(handler.scope == scope || handler.scope == 'all'){\n // check if modifiers match if any\n modifiersMatch = handler.mods.length > 0;\n for(k in _mods)\n if((!_mods[k] && index(handler.mods, +k) > -1) ||\n (_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;\n // call the handler and stop the event if neccessary\n if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){\n if(handler.method(event, handler)===false){\n if(event.preventDefault) event.preventDefault();\n else event.returnValue = false;\n if(event.stopPropagation) event.stopPropagation();\n if(event.cancelBubble) event.cancelBubble = true;\n }\n }\n }\n }\n };\n\n // unset modifier keys on keyup\n function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n };\n\n function resetModifiers() {\n for(k in _mods) _mods[k] = false;\n for(k in _MODIFIERS) assignKey[k] = false;\n };\n\n // parse and assign shortcut\n function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n };\n\n // unbind all handlers for given key in current scope\n function unbindKey(key, scope) {\n var multipleKeys, keys,\n mods = [],\n i, j, obj;\n\n multipleKeys = getKeys(key);\n\n for (j = 0; j < multipleKeys.length; j++) {\n keys = multipleKeys[j].split('+');\n\n if (keys.length > 1) {\n mods = getMods(keys);\n key = keys[keys.length - 1];\n }\n\n key = code(key);\n\n if (scope === undefined) {\n scope = getScope();\n }\n if (!_handlers[key]) {\n return;\n }\n for (i = 0; i < _handlers[key].length; i++) {\n obj = _handlers[key][i];\n // only clear handlers if correct scope and mods match\n if (obj.scope === scope && compareArray(obj.mods, mods)) {\n _handlers[key][i] = {};\n }\n }\n }\n };\n\n // Returns true if the key with code 'keyCode' is currently down\n // Converts strings into key codes.\n function isPressed(keyCode) {\n if (typeof(keyCode)=='string') {\n keyCode = code(keyCode);\n }\n return index(_downKeys, keyCode) != -1;\n }\n\n function getPressedKeyCodes() {\n return _downKeys.slice(0);\n }\n\n function filter(event){\n var tagName = (event.target || event.srcElement).tagName;\n // ignore keypressed in any elements that support keyboard data input\n return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');\n }\n\n // initialize key.<modifier> to false\n for(k in _MODIFIERS) assignKey[k] = false;\n\n // set current scope (default 'all')\n function setScope(scope){ _scope = scope || 'all' };\n function getScope(){ return _scope || 'all' };\n\n // delete all handlers for a given scope\n function deleteScope(scope){\n var key, handlers, i;\n\n for (key in _handlers) {\n handlers = _handlers[key];\n for (i = 0; i < handlers.length; ) {\n if (handlers[i].scope === scope) handlers.splice(i, 1);\n else i++;\n }\n }\n };\n\n // abstract key logic for assign and unassign\n function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }\n\n // abstract mods logic for assign and unassign\n function getMods(key) {\n var mods = key.slice(0, key.length - 1);\n for (var mi = 0; mi < mods.length; mi++)\n mods[mi] = _MODIFIERS[mods[mi]];\n return mods;\n }\n\n // cross-browser events\n function addEvent(object, event, method) {\n if (object.addEventListener)\n object.addEventListener(event, method, false);\n else if(object.attachEvent)\n object.attachEvent('on'+event, function(){ method(window.event) });\n };\n\n // set the handlers globally on document\n addEvent(document, 'keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48\n addEvent(document, 'keyup', clearModifier);\n\n // reset modifiers to false whenever the window is (re)focused.\n addEvent(window, 'focus', resetModifiers);\n\n // store previously defined key\n var previousKey = global.key;\n\n // restore previously defined key and return reference to our key object\n function noConflict() {\n var k = global.key;\n global.key = previousKey;\n return k;\n }\n\n // set window.key and window.key.set/get/deleteScope, and the default filter\n global.key = assignKey;\n global.key.setScope = setScope;\n global.key.getScope = getScope;\n global.key.deleteScope = deleteScope;\n global.key.filter = filter;\n global.key.isPressed = isPressed;\n global.key.getPressedKeyCodes = getPressedKeyCodes;\n global.key.noConflict = noConflict;\n global.key.unbind = unbindKey;\n\n if(typeof module !== 'undefined') module.exports = assignKey;\n\n})(this);\n","/**\n * Root reference for iframes.\n */\n\nvar root;\nif (typeof window !== 'undefined') { // Browser window\n root = window;\n} else if (typeof self !== 'undefined') { // Web Worker\n root = self;\n} else { // Other environments\n console.warn(\"Using browser-only version of superagent in non-browser environment\");\n root = this;\n}\n\nvar Emitter = require('emitter');\nvar requestBase = require('./request-base');\nvar isObject = require('./is-object');\n\n/**\n * Noop.\n */\n\nfunction noop(){};\n\n/**\n * Expose `request`.\n */\n\nvar request = module.exports = require('./request').bind(null, Request);\n\n/**\n * Determine XHR.\n */\n\nrequest.getXHR = function () {\n if (root.XMLHttpRequest\n && (!root.location || 'file:' != root.location.protocol\n || !root.ActiveXObject)) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n throw Error(\"Browser-only verison of superagent could not find XHR\");\n};\n\n/**\n * Removes leading and trailing whitespace, added to support IE.\n *\n * @param {String} s\n * @return {String}\n * @api private\n */\n\nvar trim = ''.trim\n ? function(s) { return s.trim(); }\n : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\n/**\n * Serialize the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api private\n */\n\nfunction serialize(obj) {\n if (!isObject(obj)) return obj;\n var pairs = [];\n for (var key in obj) {\n pushEncodedKeyValuePair(pairs, key, obj[key]);\n }\n return pairs.join('&');\n}\n\n/**\n * Helps 'serialize' with serializing arrays.\n * Mutates the pairs array.\n *\n * @param {Array} pairs\n * @param {String} key\n * @param {Mixed} val\n */\n\nfunction pushEncodedKeyValuePair(pairs, key, val) {\n if (val != null) {\n if (Array.isArray(val)) {\n val.forEach(function(v) {\n pushEncodedKeyValuePair(pairs, key, v);\n });\n } else if (isObject(val)) {\n for(var subkey in val) {\n pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);\n }\n } else {\n pairs.push(encodeURIComponent(key)\n + '=' + encodeURIComponent(val));\n }\n } else if (val === null) {\n pairs.push(encodeURIComponent(key));\n }\n}\n\n/**\n * Expose serialization method.\n */\n\n request.serializeObject = serialize;\n\n /**\n * Parse the given x-www-form-urlencoded `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseString(str) {\n var obj = {};\n var pairs = str.split('&');\n var pair;\n var pos;\n\n for (var i = 0, len = pairs.length; i < len; ++i) {\n pair = pairs[i];\n pos = pair.indexOf('=');\n if (pos == -1) {\n obj[decodeURIComponent(pair)] = '';\n } else {\n obj[decodeURIComponent(pair.slice(0, pos))] =\n decodeURIComponent(pair.slice(pos + 1));\n }\n }\n\n return obj;\n}\n\n/**\n * Expose parser.\n */\n\nrequest.parseString = parseString;\n\n/**\n * Default MIME type map.\n *\n * superagent.types.xml = 'application/xml';\n *\n */\n\nrequest.types = {\n html: 'text/html',\n json: 'application/json',\n xml: 'application/xml',\n urlencoded: 'application/x-www-form-urlencoded',\n 'form': 'application/x-www-form-urlencoded',\n 'form-data': 'application/x-www-form-urlencoded'\n};\n\n/**\n * Default serialization map.\n *\n * superagent.serialize['application/xml'] = function(obj){\n * return 'generated xml here';\n * };\n *\n */\n\n request.serialize = {\n 'application/x-www-form-urlencoded': serialize,\n 'application/json': JSON.stringify\n };\n\n /**\n * Default parsers.\n *\n * superagent.parse['application/xml'] = function(str){\n * return { object parsed from str };\n * };\n *\n */\n\nrequest.parse = {\n 'application/x-www-form-urlencoded': parseString,\n 'application/json': JSON.parse\n};\n\n/**\n * Parse the given header `str` into\n * an object containing the mapped fields.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parseHeader(str) {\n var lines = str.split(/\\r?\\n/);\n var fields = {};\n var index;\n var line;\n var field;\n var val;\n\n lines.pop(); // trailing CRLF\n\n for (var i = 0, len = lines.length; i < len; ++i) {\n line = lines[i];\n index = line.indexOf(':');\n field = line.slice(0, index).toLowerCase();\n val = trim(line.slice(index + 1));\n fields[field] = val;\n }\n\n return fields;\n}\n\n/**\n * Check if `mime` is json or has +json structured syntax suffix.\n *\n * @param {String} mime\n * @return {Boolean}\n * @api private\n */\n\nfunction isJSON(mime) {\n return /[\\/+]json\\b/.test(mime);\n}\n\n/**\n * Return the mime type for the given `str`.\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction type(str){\n return str.split(/ *; */).shift();\n};\n\n/**\n * Return header field parameters.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction params(str){\n return str.split(/ *; */).reduce(function(obj, str){\n var parts = str.split(/ *= */),\n key = parts.shift(),\n val = parts.shift();\n\n if (key && val) obj[key] = val;\n return obj;\n }, {});\n};\n\n/**\n * Initialize a new `Response` with the given `xhr`.\n *\n * - set flags (.ok, .error, etc)\n * - parse header\n *\n * Examples:\n *\n * Aliasing `superagent` as `request` is nice:\n *\n * request = superagent;\n *\n * We can use the promise-like API, or pass callbacks:\n *\n * request.get('/').end(function(res){});\n * request.get('/', function(res){});\n *\n * Sending data can be chained:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' })\n * .end(function(res){});\n *\n * Or passed to `.send()`:\n *\n * request\n * .post('/user')\n * .send({ name: 'tj' }, function(res){});\n *\n * Or passed to `.post()`:\n *\n * request\n * .post('/user', { name: 'tj' })\n * .end(function(res){});\n *\n * Or further reduced to a single call for simple cases:\n *\n * request\n * .post('/user', { name: 'tj' }, function(res){});\n *\n * @param {XMLHTTPRequest} xhr\n * @param {Object} options\n * @api private\n */\n\nfunction Response(req, options) {\n options = options || {};\n this.req = req;\n this.xhr = this.req.xhr;\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')\n ? this.xhr.responseText\n : null;\n this.statusText = this.req.xhr.statusText;\n this._setStatusProperties(this.xhr.status);\n this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n // getResponseHeader still works. so we get content-type even if getting\n // other headers fails.\n this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n this._setHeaderProperties(this.header);\n this.body = this.req.method != 'HEAD'\n ? this._parseBody(this.text ? this.text : this.xhr.response)\n : null;\n}\n\n/**\n * Get case-insensitive `field` value.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nResponse.prototype.get = function(field){\n return this.header[field.toLowerCase()];\n};\n\n/**\n * Set header related properties:\n *\n * - `.type` the content type without params\n *\n * A response of \"Content-Type: text/plain; charset=utf-8\"\n * will provide you with a `.type` of \"text/plain\".\n *\n * @param {Object} header\n * @api private\n */\n\nResponse.prototype._setHeaderProperties = function(header){\n // content-type\n var ct = this.header['content-type'] || '';\n this.type = type(ct);\n\n // params\n var obj = params(ct);\n for (var key in obj) this[key] = obj[key];\n};\n\n/**\n * Parse the given body `str`.\n *\n * Used for auto-parsing of bodies. Parsers\n * are defined on the `superagent.parse` object.\n *\n * @param {String} str\n * @return {Mixed}\n * @api private\n */\n\nResponse.prototype._parseBody = function(str){\n var parse = request.parse[this.type];\n if (!parse && isJSON(this.type)) {\n parse = request.parse['application/json'];\n }\n return parse && str && (str.length || str instanceof Object)\n ? parse(str)\n : null;\n};\n\n/**\n * Set flags such as `.ok` based on `status`.\n *\n * For example a 2xx response will give you a `.ok` of __true__\n * whereas 5xx will be __false__ and `.error` will be __true__. The\n * `.clientError` and `.serverError` are also available to be more\n * specific, and `.statusType` is the class of error ranging from 1..5\n * sometimes useful for mapping respond colors etc.\n *\n * \"sugar\" properties are also defined for common cases. Currently providing:\n *\n * - .noContent\n * - .badRequest\n * - .unauthorized\n * - .notAcceptable\n * - .notFound\n *\n * @param {Number} status\n * @api private\n */\n\nResponse.prototype._setStatusProperties = function(status){\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n if (status === 1223) {\n status = 204;\n }\n\n var type = status / 100 | 0;\n\n // status / class\n this.status = this.statusCode = status;\n this.statusType = type;\n\n // basics\n this.info = 1 == type;\n this.ok = 2 == type;\n this.clientError = 4 == type;\n this.serverError = 5 == type;\n this.error = (4 == type || 5 == type)\n ? this.toError()\n : false;\n\n // sugar\n this.accepted = 202 == status;\n this.noContent = 204 == status;\n this.badRequest = 400 == status;\n this.unauthorized = 401 == status;\n this.notAcceptable = 406 == status;\n this.notFound = 404 == status;\n this.forbidden = 403 == status;\n};\n\n/**\n * Return an `Error` representative of this response.\n *\n * @return {Error}\n * @api public\n */\n\nResponse.prototype.toError = function(){\n var req = this.req;\n var method = req.method;\n var url = req.url;\n\n var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';\n var err = new Error(msg);\n err.status = this.status;\n err.method = method;\n err.url = url;\n\n return err;\n};\n\n/**\n * Expose `Response`.\n */\n\nrequest.Response = Response;\n\n/**\n * Initialize a new `Request` with the given `method` and `url`.\n *\n * @param {String} method\n * @param {String} url\n * @api public\n */\n\nfunction Request(method, url) {\n var self = this;\n this._query = this._query || [];\n this.method = method;\n this.url = url;\n this.header = {}; // preserves header name case\n this._header = {}; // coerces header names to lowercase\n this.on('end', function(){\n var err = null;\n var res = null;\n\n try {\n res = new Response(self);\n } catch(e) {\n err = new Error('Parser is unable to parse the response');\n err.parse = true;\n err.original = e;\n // issue #675: return the raw response if the response parsing fails\n err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;\n // issue #876: return the http status code if the response parsing fails\n err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;\n return self.callback(err);\n }\n\n self.emit('response', res);\n\n var new_err;\n try {\n if (res.status < 200 || res.status >= 300) {\n new_err = new Error(res.statusText || 'Unsuccessful HTTP response');\n new_err.original = err;\n new_err.response = res;\n new_err.status = res.status;\n }\n } catch(e) {\n new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android\n }\n\n // #1000 don't catch errors from the callback to avoid double calling it\n if (new_err) {\n self.callback(new_err, res);\n } else {\n self.callback(null, res);\n }\n });\n}\n\n/**\n * Mixin `Emitter` and `requestBase`.\n */\n\nEmitter(Request.prototype);\nfor (var key in requestBase) {\n Request.prototype[key] = requestBase[key];\n}\n\n/**\n * Set Content-Type to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.xml = 'application/xml';\n *\n * request.post('/')\n * .type('xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * request.post('/')\n * .type('application/xml')\n * .send(xmlstring)\n * .end(callback);\n *\n * @param {String} type\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.type = function(type){\n this.set('Content-Type', request.types[type] || type);\n return this;\n};\n\n/**\n * Set responseType to `val`. Presently valid responseTypes are 'blob' and\n * 'arraybuffer'.\n *\n * Examples:\n *\n * req.get('/')\n * .responseType('blob')\n * .end(callback);\n *\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.responseType = function(val){\n this._responseType = val;\n return this;\n};\n\n/**\n * Set Accept to `type`, mapping values from `request.types`.\n *\n * Examples:\n *\n * superagent.types.json = 'application/json';\n *\n * request.get('/agent')\n * .accept('json')\n * .end(callback);\n *\n * request.get('/agent')\n * .accept('application/json')\n * .end(callback);\n *\n * @param {String} accept\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.accept = function(type){\n this.set('Accept', request.types[type] || type);\n return this;\n};\n\n/**\n * Set Authorization field value with `user` and `pass`.\n *\n * @param {String} user\n * @param {String} pass\n * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.auth = function(user, pass, options){\n if (!options) {\n options = {\n type: 'basic'\n }\n }\n\n switch (options.type) {\n case 'basic':\n var str = btoa(user + ':' + pass);\n this.set('Authorization', 'Basic ' + str);\n break;\n\n case 'auto':\n this.username = user;\n this.password = pass;\n break;\n }\n return this;\n};\n\n/**\n* Add query-string `val`.\n*\n* Examples:\n*\n* request.get('/shoes')\n* .query('size=10')\n* .query({ color: 'blue' })\n*\n* @param {Object|String} val\n* @return {Request} for chaining\n* @api public\n*/\n\nRequest.prototype.query = function(val){\n if ('string' != typeof val) val = serialize(val);\n if (val) this._query.push(val);\n return this;\n};\n\n/**\n * Queue the given `file` as an attachment to the specified `field`,\n * with optional `filename`.\n *\n * ``` js\n * request.post('/upload')\n * .attach('content', new Blob(['<a id=\"a\"><b id=\"b\">hey!</b></a>'], { type: \"text/html\"}))\n * .end(callback);\n * ```\n *\n * @param {String} field\n * @param {Blob|File} file\n * @param {String} filename\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.attach = function(field, file, filename){\n this._getFormData().append(field, file, filename || file.name);\n return this;\n};\n\nRequest.prototype._getFormData = function(){\n if (!this._formData) {\n this._formData = new root.FormData();\n }\n return this._formData;\n};\n\n/**\n * Invoke the callback with `err` and `res`\n * and handle arity check.\n *\n * @param {Error} err\n * @param {Response} res\n * @api private\n */\n\nRequest.prototype.callback = function(err, res){\n var fn = this._callback;\n this.clearTimeout();\n fn(err, res);\n};\n\n/**\n * Invoke callback with x-domain error.\n *\n * @api private\n */\n\nRequest.prototype.crossDomainError = function(){\n var err = new Error('Request has been terminated\\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');\n err.crossDomain = true;\n\n err.status = this.status;\n err.method = this.method;\n err.url = this.url;\n\n this.callback(err);\n};\n\n/**\n * Invoke callback with timeout error.\n *\n * @api private\n */\n\nRequest.prototype._timeoutError = function(){\n var timeout = this._timeout;\n var err = new Error('timeout of ' + timeout + 'ms exceeded');\n err.timeout = timeout;\n this.callback(err);\n};\n\n/**\n * Compose querystring to append to req.url\n *\n * @api private\n */\n\nRequest.prototype._appendQueryString = function(){\n var query = this._query.join('&');\n if (query) {\n this.url += ~this.url.indexOf('?')\n ? '&' + query\n : '?' + query;\n }\n};\n\n/**\n * Initiate request, invoking callback `fn(res)`\n * with an instanceof `Response`.\n *\n * @param {Function} fn\n * @return {Request} for chaining\n * @api public\n */\n\nRequest.prototype.end = function(fn){\n var self = this;\n var xhr = this.xhr = request.getXHR();\n var timeout = this._timeout;\n var data = this._formData || this._data;\n\n // store callback\n this._callback = fn || noop;\n\n // state change\n xhr.onreadystatechange = function(){\n if (4 != xhr.readyState) return;\n\n // In IE9, reads to any property (e.g. status) off of an aborted XHR will\n // result in the error \"Could not complete the operation due to error c00c023f\"\n var status;\n try { status = xhr.status } catch(e) { status = 0; }\n\n if (0 == status) {\n if (self.timedout) return self._timeoutError();\n if (self._aborted) return;\n return self.crossDomainError();\n }\n self.emit('end');\n };\n\n // progress\n var handleProgress = function(direction, e) {\n if (e.total > 0) {\n e.percent = e.loaded / e.total * 100;\n }\n e.direction = direction;\n self.emit('progress', e);\n }\n if (this.hasListeners('progress')) {\n try {\n xhr.onprogress = handleProgress.bind(null, 'download');\n if (xhr.upload) {\n xhr.upload.onprogress = handleProgress.bind(null, 'upload');\n }\n } catch(e) {\n // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.\n // Reported here:\n // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context\n }\n }\n\n // timeout\n if (timeout && !this._timer) {\n this._timer = setTimeout(function(){\n self.timedout = true;\n self.abort();\n }, timeout);\n }\n\n // querystring\n this._appendQueryString();\n\n // initiate request\n if (this.username && this.password) {\n xhr.open(this.method, this.url, true, this.username, this.password);\n } else {\n xhr.open(this.method, this.url, true);\n }\n\n // CORS\n if (this._withCredentials) xhr.withCredentials = true;\n\n // body\n if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) {\n // serialize stuff\n var contentType = this._header['content-type'];\n var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];\n if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];\n if (serialize) data = serialize(data);\n }\n\n // set header fields\n for (var field in this.header) {\n if (null == this.header[field]) continue;\n xhr.setRequestHeader(field, this.header[field]);\n }\n\n if (this._responseType) {\n xhr.responseType = this._responseType;\n }\n\n // send stuff\n this.emit('request', this);\n\n // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)\n // We need null here if data is undefined\n xhr.send(typeof data !== 'undefined' ? data : null);\n return this;\n};\n\n\n/**\n * Expose `Request`.\n */\n\nrequest.Request = Request;\n\n/**\n * GET `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.get = function(url, data, fn){\n var req = request('GET', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.query(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * HEAD `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.head = function(url, data, fn){\n var req = request('HEAD', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * OPTIONS query to `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.options = function(url, data, fn){\n var req = request('OPTIONS', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * DELETE `url` with optional callback `fn(res)`.\n *\n * @param {String} url\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nfunction del(url, fn){\n var req = request('DELETE', url);\n if (fn) req.end(fn);\n return req;\n};\n\nrequest['del'] = del;\nrequest['delete'] = del;\n\n/**\n * PATCH `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.patch = function(url, data, fn){\n var req = request('PATCH', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * POST `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed} [data]\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.post = function(url, data, fn){\n var req = request('POST', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n\n/**\n * PUT `url` with optional `data` and callback `fn(res)`.\n *\n * @param {String} url\n * @param {Mixed|Function} [data] or fn\n * @param {Function} [fn]\n * @return {Request}\n * @api public\n */\n\nrequest.put = function(url, data, fn){\n var req = request('PUT', url);\n if ('function' == typeof data) fn = data, data = null;\n if (data) req.send(data);\n if (fn) req.end(fn);\n return req;\n};\n","/**\n * Check if `obj` is an object.\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nfunction isObject(obj) {\n return null !== obj && 'object' === typeof obj;\n}\n\nmodule.exports = isObject;\n","/**\n * Module of mixed-in functions shared between node and client code\n */\nvar isObject = require('./is-object');\n\n/**\n * Clear previous timeout.\n *\n * @return {Request} for chaining\n * @api public\n */\n\nexports.clearTimeout = function _clearTimeout(){\n this._timeout = 0;\n clearTimeout(this._timer);\n return this;\n};\n\n/**\n * Override default response body parser\n *\n * This function will be called to convert incoming data into request.body\n *\n * @param {Function}\n * @api public\n */\n\nexports.parse = function parse(fn){\n this._parser = fn;\n return this;\n};\n\n/**\n * Override default request body serializer\n *\n * This function will be called to convert data set via .send or .attach into payload to send\n *\n * @param {Function}\n * @api public\n */\n\nexports.serialize = function serialize(fn){\n this._serializer = fn;\n return this;\n};\n\n/**\n * Set timeout to `ms`.\n *\n * @param {Number} ms\n * @return {Request} for chaining\n * @api public\n */\n\nexports.timeout = function timeout(ms){\n this._timeout = ms;\n return this;\n};\n\n/**\n * Promise support\n *\n * @param {Function} resolve\n * @param {Function} reject\n * @return {Request}\n */\n\nexports.then = function then(resolve, reject) {\n if (!this._fullfilledPromise) {\n var self = this;\n this._fullfilledPromise = new Promise(function(innerResolve, innerReject){\n self.end(function(err, res){\n if (err) innerReject(err); else innerResolve(res);\n });\n });\n }\n return this._fullfilledPromise.then(resolve, reject);\n}\n\nexports.catch = function(cb) {\n return this.then(undefined, cb);\n};\n\n/**\n * Allow for extension\n */\n\nexports.use = function use(fn) {\n fn(this);\n return this;\n}\n\n\n/**\n * Get request header `field`.\n * Case-insensitive.\n *\n * @param {String} field\n * @return {String}\n * @api public\n */\n\nexports.get = function(field){\n return this._header[field.toLowerCase()];\n};\n\n/**\n * Get case-insensitive header `field` value.\n * This is a deprecated internal API. Use `.get(field)` instead.\n *\n * (getHeader is no longer used internally by the superagent code base)\n *\n * @param {String} field\n * @return {String}\n * @api private\n * @deprecated\n */\n\nexports.getHeader = exports.get;\n\n/**\n * Set header `field` to `val`, or multiple fields with one object.\n * Case-insensitive.\n *\n * Examples:\n *\n * req.get('/')\n * .set('Accept', 'application/json')\n * .set('X-API-Key', 'foobar')\n * .end(callback);\n *\n * req.get('/')\n * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n * .end(callback);\n *\n * @param {String|Object} field\n * @param {String} val\n * @return {Request} for chaining\n * @api public\n */\n\nexports.set = function(field, val){\n if (isObject(field)) {\n for (var key in field) {\n this.set(key, field[key]);\n }\n return this;\n }\n this._header[field.toLowerCase()] = val;\n this.header[field] = val;\n return this;\n};\n\n/**\n * Remove header `field`.\n * Case-insensitive.\n *\n * Example:\n *\n * req.get('/')\n * .unset('User-Agent')\n * .end(callback);\n *\n * @param {String} field\n */\nexports.unset = function(field){\n delete this._header[field.toLowerCase()];\n delete this.header[field];\n return this;\n};\n\n/**\n * Write the field `name` and `val`, or multiple fields with one object\n * for \"multipart/form-data\" request bodies.\n *\n * ``` js\n * request.post('/upload')\n * .field('foo', 'bar')\n * .end(callback);\n *\n * request.post('/upload')\n * .field({ foo: 'bar', baz: 'qux' })\n * .end(callback);\n * ```\n *\n * @param {String|Object} name\n * @param {String|Blob|File|Buffer|fs.ReadStream} val\n * @return {Request} for chaining\n * @api public\n */\nexports.field = function(name, val) {\n\n // name should be either a string or an object.\n if (null === name || undefined === name) {\n throw new Error('.field(name, val) name can not be empty');\n }\n\n if (isObject(name)) {\n for (var key in name) {\n this.field(key, name[key]);\n }\n return this;\n }\n\n // val should be defined now\n if (null === val || undefined === val) {\n throw new Error('.field(name, val) val can not be empty');\n }\n this._getFormData().append(name, val);\n return this;\n};\n\n/**\n * Abort the request, and clear potential timeout.\n *\n * @return {Request}\n * @api public\n */\nexports.abort = function(){\n if (this._aborted) {\n return this;\n }\n this._aborted = true;\n this.xhr && this.xhr.abort(); // browser\n this.req && this.req.abort(); // node\n this.clearTimeout();\n this.emit('abort');\n return this;\n};\n\n/**\n * Enable transmission of cookies with x-domain requests.\n *\n * Note that for this to work the origin must not be\n * using \"Access-Control-Allow-Origin\" with a wildcard,\n * and also must set \"Access-Control-Allow-Credentials\"\n * to \"true\".\n *\n * @api public\n */\n\nexports.withCredentials = function(){\n // This is browser-only functionality. Node side is no-op.\n this._withCredentials = true;\n return this;\n};\n\n/**\n * Set the max redirects to `n`. Does noting in browser XHR implementation.\n *\n * @param {Number} n\n * @return {Request} for chaining\n * @api public\n */\n\nexports.redirects = function(n){\n this._maxRedirects = n;\n return this;\n};\n\n/**\n * Convert to a plain javascript object (not JSON string) of scalar properties.\n * Note as this method is designed to return a useful non-this value,\n * it cannot be chained.\n *\n * @return {Object} describing method, url, and data of this request\n * @api public\n */\n\nexports.toJSON = function(){\n return {\n method: this.method,\n url: this.url,\n data: this._data,\n headers: this._header\n };\n};\n\n/**\n * Check if `obj` is a host object,\n * we don't want to serialize these :)\n *\n * TODO: future proof, move to compoent land\n *\n * @param {Object} obj\n * @return {Boolean}\n * @api private\n */\n\nexports._isHost = function _isHost(obj) {\n var str = {}.toString.call(obj);\n\n switch (str) {\n case '[object File]':\n case '[object Blob]':\n case '[object FormData]':\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Send `data` as the request body, defaulting the `.type()` to \"json\" when\n * an object is given.\n *\n * Examples:\n *\n * // manual json\n * request.post('/user')\n * .type('json')\n * .send('{\"name\":\"tj\"}')\n * .end(callback)\n *\n * // auto json\n * request.post('/user')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // manual x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send('name=tj')\n * .end(callback)\n *\n * // auto x-www-form-urlencoded\n * request.post('/user')\n * .type('form')\n * .send({ name: 'tj' })\n * .end(callback)\n *\n * // defaults to x-www-form-urlencoded\n * request.post('/user')\n * .send('name=tobi')\n * .send('species=ferret')\n * .end(callback)\n *\n * @param {String|Object} data\n * @return {Request} for chaining\n * @api public\n */\n\nexports.send = function(data){\n var obj = isObject(data);\n var type = this._header['content-type'];\n\n // merge\n if (obj && isObject(this._data)) {\n for (var key in data) {\n this._data[key] = data[key];\n }\n } else if ('string' == typeof data) {\n // default to x-www-form-urlencoded\n if (!type) this.type('form');\n type = this._header['content-type'];\n if ('application/x-www-form-urlencoded' == type) {\n this._data = this._data\n ? this._data + '&' + data\n : data;\n } else {\n this._data = (this._data || '') + data;\n }\n } else {\n this._data = data;\n }\n\n if (!obj || this._isHost(data)) return this;\n\n // default to json\n if (!type) this.type('json');\n return this;\n};\n","// The node and browser modules expose versions of this with the\n// appropriate constructor function bound as first argument\n/**\n * Issue a request:\n *\n * Examples:\n *\n * request('GET', '/users').end(callback)\n * request('/users').end(callback)\n * request('/users', callback)\n *\n * @param {String} method\n * @param {String|Function} url or callback\n * @return {Request}\n * @api public\n */\n\nfunction request(RequestConstructor, method, url) {\n // callback\n if ('function' == typeof url) {\n return new RequestConstructor('GET', method).end(url);\n }\n\n // url first\n if (2 == arguments.length) {\n return new RequestConstructor('GET', method);\n }\n\n return new RequestConstructor(method, url);\n}\n\nmodule.exports = request;\n"]}