{"version":3,"sources":["forms-api.js"],"names":["define","undefined","r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","obj","_conditionalElements","__esModule","default","mc4wp","window","Gator","forms","config","mc4wp_forms_config","scrollToElement","form","eventName","errors","data","timeStart","pageHeight","gator","document","body","on","event","getByElement","target","srcElement","defaultPrevented","trigger","id","started","init","listeners","callback","submitted_form","formConfig","element","getElementById","element_id","Date","now","clientHeight","setData","scrollY","auto_scroll","addEventListener","timeElapsed","./forms/conditional-elements.js","./forms/forms.js","./misc/scroll-to-element.js","2","toggleElement","el","show","getAttribute","conditions","split","fieldName","expectedValues","values","inputs","querySelectorAll","input","type","checked","push","value","getFieldValues","bubbleElement","parentElement","tagName","findForm","conditionMet","indexOf","style","display","forEach","required","removeAttribute","setAttribute","evaluate","elements","handleInputEvent","evt","className","Object","defineProperty","_default","3","Form","this","createElement","name","serialize","populate","prototype","console","error","getData","hash","empty","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","form-serialize","populate.js","4","emit","args","apply","createFromElement","formElement","parseInt","all","get","formId","func","off","filter","eventArgs","setTimeout","./form.js","5","x","pageXOffset","documentElement","scrollLeft","y","elem","html","elemRect","getBoundingClientRect","documentHeight","Math","max","scrollHeight","offsetHeight","scrollPosition","bottom","height","maxScrollPosition","min","pageYOffset","calculateScrollOffset","scrollTo","6","k_r_submitter","k_r_success_contrls","brackets","hash_serializer","result","key","match","hash_assign","keys","shift","between","Array","isArray","_values","string","index","isNaN","children","RegExp","exec","parse_keys","existing","str_serialize","replace","encodeURIComponent","options","serializer","radio_store","create","disabled","test","nodeName","val","selectOptions","isSelectedOptions","j","option","allowedEmpty","hasValue","selected","slice","7","_matchesSelector","selector","boundElement","_matcher","matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_getMatcher","parentNode","_level","_removeHandler","_handlers","splice","hasOwnProperty","_bind","events","remove","addEvent","_getGlobalCallback","_gatorInstances","matchesEvent","stopPropagation","cancelBubble","cancel","_handleEvent","_id","preventDefault","useCapture","8","root","basename","constructor","namedItem","k","toString","toISOString","amd"],"mappings":"CAAA,WAAe,IAA6BA,OAASC,GAAuB,SAASC,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,GAAG,CAACQ,QAAQ,IAAIZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAQ,IAAI,IAAIL,GAAE,EAAoCH,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAA7b,CAA4c,CAACY,EAAE,CAAC,SAASC,EAAQC,EAAOL,GACxiB,aAEA,IAEgCM,EAF5BC,GAE4BD,EAFkBF,EAAQ,qCAELE,EAAIE,WAAaF,EAAM,CAAEG,QAAWH,GAEzF,IAAII,EAAQC,OAAOD,OAAS,GAExBE,EAAQR,EAAQ,SAEhBS,EAAQT,EAAQ,oBAEhBU,EAASH,OAAOI,oBAAsB,GAEtCC,EAAkBZ,EAAQ,+BAiD9B,IA/C2Ba,EAAMC,EAAWC,EAAQC,EAC9CC,EACAC,EA6CFC,EAAQX,EAAMY,SAASC,MA8B3B,GA7BAF,EAAMG,GAAG,SAAU,cAAe,SAAUC,GAC1C,IAAIV,EAAOJ,EAAMe,aAAaD,EAAME,QAAUF,EAAMG,YAE/CH,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P,KAAmBzP,EAAOyP,IAC3EzP,EAAO,WACN,OAAOiH,SAEqB,IAAX7F,GAA0BA,EAAOL,QACnDK,EAAOL,QAAUkG,EAEjBiI,EAAKjI,SAAWA,GAKhB,KAAK,GAAG,CAAC,IA5lCX","file":"forms-api.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n'use strict'; // deps & vars\n\nvar _conditionalElements = _interopRequireDefault(require(\"./forms/conditional-elements.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar mc4wp = window.mc4wp || {};\n\nvar Gator = require('gator');\n\nvar forms = require('./forms/forms.js');\n\nvar config = window.mc4wp_forms_config || {};\n\nvar scrollToElement = require('./misc/scroll-to-element.js');\n\nfunction handleFormRequest(form, eventName, errors, data) {\n  var timeStart = Date.now();\n  var pageHeight = document.body.clientHeight; // re-populate form if an error occurred\n\n  if (errors) {\n    form.setData(data);\n  } // scroll to form\n\n\n  if (window.scrollY <= 10 && config.auto_scroll) {\n    scrollToElement(form.element);\n  } // trigger events on window.load so all other scripts have loaded\n\n\n  window.addEventListener('load', function () {\n    // trigger events\n    forms.trigger(form.id + '.submitted', [form]);\n    forms.trigger('submitted', [form]);\n\n    if (errors) {\n      forms.trigger(form.id + '.error', [form, errors]);\n      forms.trigger('error', [form, errors]);\n    } else {\n      // form was successfully submitted\n      forms.trigger(form.id + '.success', [form, data]);\n      forms.trigger('success', [form, data]); // subscribed / unsubscribed\n\n      forms.trigger(form.id + \".\" + eventName, [form, data]);\n      forms.trigger(eventName, [form, data]); // for BC: always trigger \"subscribed\" event when firing \"updated_subscriber\" event\n\n      if (eventName === 'updated_subscriber') {\n        forms.trigger(form.id + \".\" + \"subscribed\", [form, data, true]);\n        forms.trigger('subscribed', [form, data, true]);\n      }\n    } // scroll to form again if page height changed since last scroll, eg because of slow loading images\n    // (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)\n\n\n    var timeElapsed = Date.now() - timeStart;\n\n    if (config.auto_scroll && timeElapsed > 1000 && timeElapsed < 2000 && document.body.clientHeight !== pageHeight) {\n      scrollToElement(form.element);\n    }\n  });\n} // Bind browser events to form events (using delegation)\n\n\nvar gator = Gator(document.body);\ngator.on('submit', '.mc4wp-form', function (event) {\n  var form = forms.getByElement(event.target || event.srcElement);\n\n  if (!event.defaultPrevented) {\n    forms.trigger(form.id + '.submit', [form, event]);\n  }\n\n  if (!event.defaultPrevented) {\n    forms.trigger('submit', [form, event]);\n  }\n});\ngator.on('focus', '.mc4wp-form', function (event) {\n  var form = forms.getByElement(event.target || event.srcElement);\n\n  if (!form.started) {\n    forms.trigger(form.id + '.started', [form, event]);\n    forms.trigger('started', [form, event]);\n    form.started = true;\n  }\n});\ngator.on('change', '.mc4wp-form', function (event) {\n  var form = forms.getByElement(event.target || event.srcElement);\n  forms.trigger('change', [form, event]);\n  forms.trigger(form.id + '.change', [form, event]);\n}); // init conditional elements\n\n_conditionalElements[\"default\"].init(); // register early listeners\n\n\nif (mc4wp.listeners) {\n  var listeners = mc4wp.listeners;\n\n  for (var i = 0; i < listeners.length; i++) {\n    forms.on(listeners[i].event, listeners[i].callback);\n  } // delete temp listeners array, so we don't bind twice\n\n\n  delete mc4wp[\"listeners\"];\n} // expose forms object\n\n\nmc4wp.forms = forms; // handle submitted form\n\nif (config.submitted_form) {\n  var formConfig = config.submitted_form,\n      element = document.getElementById(formConfig.element_id),\n      form = forms.getByElement(element);\n  handleFormRequest(form, formConfig.event, formConfig.errors, formConfig.data);\n} // expose mc4wp object globally\n\n\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/conditional-elements.js\":2,\"./forms/forms.js\":4,\"./misc/scroll-to-element.js\":5,\"gator\":7}],2:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nfunction getFieldValues(form, fieldName) {\n  var values = [];\n  var inputs = form.querySelectorAll('input[name=\"' + fieldName + '\"], select[name=\"' + fieldName + '\"], textarea[name=\"' + fieldName + '\"]');\n\n  for (var i = 0; i < inputs.length; i++) {\n    var input = inputs[i];\n    var type = input.getAttribute(\"type\");\n\n    if ((type === \"radio\" || type === \"checkbox\") && !input.checked) {\n      continue;\n    }\n\n    values.push(input.value);\n  }\n\n  return values;\n}\n\nfunction findForm(element) {\n  var bubbleElement = element;\n\n  while (bubbleElement.parentElement) {\n    bubbleElement = bubbleElement.parentElement;\n\n    if (bubbleElement.tagName === 'FORM') {\n      return bubbleElement;\n    }\n  }\n\n  return null;\n}\n\nfunction toggleElement(el) {\n  var show = !!el.getAttribute('data-show-if');\n  var conditions = show ? el.getAttribute('data-show-if').split(':') : el.getAttribute('data-hide-if').split(':');\n  var fieldName = conditions[0];\n  var expectedValues = (conditions.length > 1 ? conditions[1] : \"*\").split('|');\n  var form = findForm(el);\n  var values = getFieldValues(form, fieldName); // determine whether condition is met\n\n  var conditionMet = false;\n\n  for (var i = 0; i < values.length; i++) {\n    var value = values[i]; // condition is met when value is in array of expected values OR expected values contains a wildcard and value is not empty\n\n    conditionMet = expectedValues.indexOf(value) > -1 || expectedValues.indexOf('*') > -1 && value.length > 0;\n\n    if (conditionMet) {\n      break;\n    }\n  } // toggle element display\n\n\n  if (show) {\n    el.style.display = conditionMet ? '' : 'none';\n  } else {\n    el.style.display = conditionMet ? 'none' : '';\n  } // find all inputs inside this element and toggle [required] attr (to prevent HTML5 validation on hidden elements)\n\n\n  var inputs = el.querySelectorAll('input, select, textarea');\n  [].forEach.call(inputs, function (el) {\n    if ((conditionMet || show) && el.getAttribute('data-was-required')) {\n      el.required = true;\n      el.removeAttribute('data-was-required');\n    }\n\n    if ((!conditionMet || !show) && el.required) {\n      el.setAttribute('data-was-required', \"true\");\n      el.required = false;\n    }\n  });\n} // evaluate conditional elements globally\n\n\nfunction evaluate() {\n  var elements = document.querySelectorAll('.mc4wp-form [data-show-if], .mc4wp-form [data-hide-if]');\n  [].forEach.call(elements, toggleElement);\n} // re-evaluate conditional elements for change events on forms\n\n\nfunction handleInputEvent(evt) {\n  if (!evt.target || !evt.target.form || evt.target.form.className.indexOf('mc4wp-form') < 0) {\n    return;\n  }\n\n  var form = evt.target.form;\n  var elements = form.querySelectorAll('[data-show-if], [data-hide-if]');\n  [].forEach.call(elements, toggleElement);\n}\n\nvar _default = {\n  'init': function init() {\n    document.addEventListener('keyup', handleInputEvent, true);\n    document.addEventListener('change', handleInputEvent, true);\n    document.addEventListener('mc4wp-refresh', evaluate, true);\n    window.addEventListener('load', evaluate);\n    evaluate();\n  }\n};\nexports[\"default\"] = _default;\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('form-serialize');\n\nvar populate = require('populate.js');\n\nvar Form = function Form(id, element) {\n  this.id = id;\n  this.element = element || document.createElement('form');\n  this.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n  this.errors = [];\n  this.started = false;\n};\n\nForm.prototype.setData = function (data) {\n  try {\n    populate(this.element, data);\n  } catch (e) {\n    console.error(e);\n  }\n};\n\nForm.prototype.getData = function () {\n  return serialize(this.element, {\n    hash: true,\n    empty: true\n  });\n};\n\nForm.prototype.getSerializedData = function () {\n  return serialize(this.element, {\n    hash: false,\n    empty: true\n  });\n};\n\nForm.prototype.setResponse = function (msg) {\n  this.element.querySelector('.mc4wp-response').innerHTML = msg;\n}; // revert back to original state\n\n\nForm.prototype.reset = function () {\n  this.setResponse('');\n  this.element.querySelector('.mc4wp-form-fields').style.display = '';\n  this.element.reset();\n};\n\nmodule.exports = Form;\n\n},{\"form-serialize\":6,\"populate.js\":8}],4:[function(require,module,exports){\n'use strict'; // deps\n\nvar Form = require('./form.js'); // variables\n\n\nvar forms = [];\nvar listeners = {};\n\nfunction emit(event, args) {\n  listeners[event] = listeners[event] || [];\n  listeners[event].forEach(function (f) {\n    return f.apply(null, args);\n  });\n}\n\nfunction on(event, func) {\n  listeners[event] = listeners[event] || [];\n  listeners[event].push(func);\n}\n\nfunction off(event, func) {\n  listeners[event] = listeners[event] || [];\n  listeners[event] = listeners[event].filter(function (f) {\n    return f !== func;\n  });\n} // get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\n\n\nfunction get(formId) {\n  formId = parseInt(formId); // do we have form for this one already?\n\n  for (var i = 0; i < forms.length; i++) {\n    if (forms[i].id === formId) {\n      return forms[i];\n    }\n  } // try to create from first occurence of this element\n\n\n  var formElement = document.querySelector('.mc4wp-form-' + formId);\n  return createFromElement(formElement, formId);\n} // get form by <form> element (or any input in form)\n\n\nfunction getByElement(element) {\n  var formElement = element.form || element;\n\n  for (var i = 0; i < forms.length; i++) {\n    if (forms[i].element === formElement) {\n      return forms[i];\n    }\n  }\n\n  return createFromElement(formElement);\n} // create form object from <form> element\n\n\nfunction createFromElement(formElement, id) {\n  id = id || parseInt(formElement.getAttribute('data-id')) || 0;\n  var form = new Form(id, formElement);\n  forms.push(form);\n  return form;\n}\n\nfunction all() {\n  return forms;\n}\n\nfunction triggerEvent(eventName, eventArgs) {\n  if (eventName === 'submit' || eventName.indexOf('.submit') > 0) {\n    // don't spin up new thread for submit event as we want to preventDefault()...\n    emit(eventName, eventArgs);\n  } else {\n    // process in separate thread to prevent errors from breaking core functionality\n    window.setTimeout(function () {\n      emit(eventName, eventArgs);\n    }, 1);\n  }\n}\n\nmodule.exports = {\n  \"all\": all,\n  \"get\": get,\n  \"getByElement\": getByElement,\n  \"on\": on,\n  \"off\": off,\n  \"trigger\": triggerEvent\n};\n\n},{\"./form.js\":3}],5:[function(require,module,exports){\n'use strict';\n\nfunction scrollTo(element) {\n  var x = window.pageXOffset || document.documentElement.scrollLeft;\n  var y = calculateScrollOffset(element);\n  window.scrollTo(x, y);\n}\n\nfunction calculateScrollOffset(elem) {\n  var body = document.body,\n      html = document.documentElement;\n  var elemRect = elem.getBoundingClientRect();\n  var clientHeight = html.clientHeight;\n  var documentHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n  var scrollPosition = elemRect.bottom - clientHeight / 2 - elemRect.height / 2;\n  var maxScrollPosition = documentHeight - clientHeight;\n  return Math.min(scrollPosition + window.pageYOffset, maxScrollPosition);\n}\n\nmodule.exports = scrollTo;\n\n},{}],6:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n//    - hash: [true | false] Configure the output type. If true, the output will\n//    be a js object.\n//    - serializer: [function] Optional serializer function to override the default one.\n//    The function takes 3 arguments (result, key, value) and should return new result\n//    hash and url encoded str serializers are provided with this module\n//    - disabled: [true | false]. If true serialize disabled fields.\n//    - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n    if (typeof options != 'object') {\n        options = { hash: !!options };\n    }\n    else if (options.hash === undefined) {\n        options.hash = true;\n    }\n\n    var result = (options.hash) ? {} : '';\n    var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n    var elements = form && form.elements ? form.elements : [];\n\n    //Object store each radio and set if it's empty or not\n    var radio_store = Object.create(null);\n\n    for (var i=0 ; i<elements.length ; ++i) {\n        var element = elements[i];\n\n        // ingore disabled fields\n        if ((!options.disabled && element.disabled) || !element.name) {\n            continue;\n        }\n        // ignore anyhting that is not considered a success field\n        if (!k_r_success_contrls.test(element.nodeName) ||\n            k_r_submitter.test(element.type)) {\n            continue;\n        }\n\n        var key = element.name;\n        var val = element.value;\n\n        // we can't just use element.value for checkboxes cause some browsers lie to us\n        // they say \"on\" for value when the box isn't checked\n        if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n            val = undefined;\n        }\n\n        // If we want empty elements\n        if (options.empty) {\n            // for checkbox\n            if (element.type === 'checkbox' && !element.checked) {\n                val = '';\n            }\n\n            // for radio\n            if (element.type === 'radio') {\n                if (!radio_store[element.name] && !element.checked) {\n                    radio_store[element.name] = false;\n                }\n                else if (element.checked) {\n                    radio_store[element.name] = true;\n                }\n            }\n\n            // if options empty is true, continue only if its radio\n            if (val == undefined && element.type == 'radio') {\n                continue;\n            }\n        }\n        else {\n            // value-less fields are ignored unless options.empty is true\n            if (!val) {\n                continue;\n            }\n        }\n\n        // multi select boxes\n        if (element.type === 'select-multiple') {\n            val = [];\n\n            var selectOptions = element.options;\n            var isSelectedOptions = false;\n            for (var j=0 ; j<selectOptions.length ; ++j) {\n                var option = selectOptions[j];\n                var allowedEmpty = options.empty && !option.value;\n                var hasValue = (option.value || allowedEmpty);\n                if (option.selected && hasValue) {\n                    isSelectedOptions = true;\n\n                    // If using a hash serializer be sure to add the\n                    // correct notation for an array in the multi-select\n                    // context. Here the name attribute on the select element\n                    // might be missing the trailing bracket pair. Both names\n                    // \"foo\" and \"foo[]\" should be arrays.\n                    if (options.hash && key.slice(key.length - 2) !== '[]') {\n                        result = serializer(result, key + '[]', option.value);\n                    }\n                    else {\n                        result = serializer(result, key, option.value);\n                    }\n                }\n            }\n\n            // Serialize if no selected options and options.empty is true\n            if (!isSelectedOptions && options.empty) {\n                result = serializer(result, key, '');\n            }\n\n            continue;\n        }\n\n        result = serializer(result, key, val);\n    }\n\n    // Check for all empty radio buttons and serialize them with key=\"\"\n    if (options.empty) {\n        for (var key in radio_store) {\n            if (!radio_store[key]) {\n                result = serializer(result, key, '');\n            }\n        }\n    }\n\n    return result;\n}\n\nfunction parse_keys(string) {\n    var keys = [];\n    var prefix = /^([^\\[\\]]*)/;\n    var children = new RegExp(brackets);\n    var match = prefix.exec(string);\n\n    if (match[1]) {\n        keys.push(match[1]);\n    }\n\n    while ((match = children.exec(string)) !== null) {\n        keys.push(match[1]);\n    }\n\n    return keys;\n}\n\nfunction hash_assign(result, keys, value) {\n    if (keys.length === 0) {\n        result = value;\n        return result;\n    }\n\n    var key = keys.shift();\n    var between = key.match(/^\\[(.+?)\\]$/);\n\n    if (key === '[]') {\n        result = result || [];\n\n        if (Array.isArray(result)) {\n            result.push(hash_assign(null, keys, value));\n        }\n        else {\n            // This might be the result of bad name attributes like \"[][foo]\",\n            // in this case the original `result` object will already be\n            // assigned to an object literal. Rather than coerce the object to\n            // an array, or cause an exception the attribute \"_values\" is\n            // assigned as an array.\n            result._values = result._values || [];\n            result._values.push(hash_assign(null, keys, value));\n        }\n\n        return result;\n    }\n\n    // Key is an attribute name and can be assigned directly.\n    if (!between) {\n        result[key] = hash_assign(result[key], keys, value);\n    }\n    else {\n        var string = between[1];\n        // +var converts the variable into a number\n        // better than parseInt because it doesn't truncate away trailing\n        // letters and actually fails if whole thing is not a number\n        var index = +string;\n\n        // If the characters between the brackets is not a number it is an\n        // attribute name and can be assigned directly.\n        if (isNaN(index)) {\n            result = result || {};\n            result[string] = hash_assign(result[string], keys, value);\n        }\n        else {\n            result = result || [];\n            result[index] = hash_assign(result[index], keys, value);\n        }\n    }\n\n    return result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n    var matches = key.match(brackets);\n\n    // Has brackets? Use the recursive assignment function to walk the keys,\n    // construct any missing objects in the result tree and make the assignment\n    // at the end of the chain.\n    if (matches) {\n        var keys = parse_keys(key);\n        hash_assign(result, keys, value);\n    }\n    else {\n        // Non bracket notation can make assignments directly.\n        var existing = result[key];\n\n        // If the value has been assigned already (for instance when a radio and\n        // a checkbox have the same name attribute) convert the previous value\n        // into an array before pushing into it.\n        //\n        // NOTE: If this requirement were removed all hash creation and\n        // assignment could go through `hash_assign`.\n        if (existing) {\n            if (!Array.isArray(existing)) {\n                result[key] = [ existing ];\n            }\n\n            result[key].push(value);\n        }\n        else {\n            result[key] = value;\n        }\n    }\n\n    return result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n    // encode newlines as \\r\\n cause the html spec says so\n    value = value.replace(/(\\r)?\\n/g, '\\r\\n');\n    value = encodeURIComponent(value);\n\n    // spaces should be '+' rather than '%20'.\n    value = value.replace(/%20/g, '+');\n    return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n\n},{}],7:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n *             .-._   _ _ _ _ _ _ _ _\n *  .-''-.__.-'00  '-' ' ' ' ' ' ' ' '-.\n * '.___ '    .   .--_'-' '-' '-' _'-' '._\n *  V: V 'vv-'   '_   '.       .'  _..' '.'.\n *    '=.____.=_.--'   :_.__.__:_   '.   : :\n *            (((____.-'        '-.  /   : :\n *                              (((-'\\ .' /\n *                            _____..'  .'\n *                           '-._____.-'\n */\n(function() {\n    var _matcher,\n        _level = 0,\n        _id = 0,\n        _handlers = {},\n        _gatorInstances = {};\n\n    function _addEvent(gator, type, callback) {\n\n        // blur and focus do not bubble up but if you use event capturing\n        // then you will get them\n        var useCapture = type == 'blur' || type == 'focus';\n        gator.element.addEventListener(type, callback, useCapture);\n    }\n\n    function _cancel(e) {\n        e.preventDefault();\n        e.stopPropagation();\n    }\n\n    /**\n     * returns function to use for determining if an element\n     * matches a query selector\n     *\n     * @returns {Function}\n     */\n    function _getMatcher(element) {\n        if (_matcher) {\n            return _matcher;\n        }\n\n        if (element.matches) {\n            _matcher = element.matches;\n            return _matcher;\n        }\n\n        if (element.webkitMatchesSelector) {\n            _matcher = element.webkitMatchesSelector;\n            return _matcher;\n        }\n\n        if (element.mozMatchesSelector) {\n            _matcher = element.mozMatchesSelector;\n            return _matcher;\n        }\n\n        if (element.msMatchesSelector) {\n            _matcher = element.msMatchesSelector;\n            return _matcher;\n        }\n\n        if (element.oMatchesSelector) {\n            _matcher = element.oMatchesSelector;\n            return _matcher;\n        }\n\n        // if it doesn't match a native browser method\n        // fall back to the gator function\n        _matcher = Gator.matchesSelector;\n        return _matcher;\n    }\n\n    /**\n     * determines if the specified element matches a given selector\n     *\n     * @param {Node} element - the element to compare against the selector\n     * @param {string} selector\n     * @param {Node} boundElement - the element the listener was attached to\n     * @returns {void|Node}\n     */\n    function _matchesSelector(element, selector, boundElement) {\n\n        // no selector means this event was bound directly to this element\n        if (selector == '_root') {\n            return boundElement;\n        }\n\n        // if we have moved up to the element you bound the event to\n        // then we have come too far\n        if (element === boundElement) {\n            return;\n        }\n\n        // if this is a match then we are done!\n        if (_getMatcher(element).call(element, selector)) {\n            return element;\n        }\n\n        // if this element did not match but has a parent we should try\n        // going up the tree to see if any of the parent elements match\n        // for example if you are looking for a click on an <a> tag but there\n        // is a <span> inside of the a tag that it is the target,\n        // it should still work\n        if (element.parentNode) {\n            _level++;\n            return _matchesSelector(element.parentNode, selector, boundElement);\n        }\n    }\n\n    function _addHandler(gator, event, selector, callback) {\n        if (!_handlers[gator.id]) {\n            _handlers[gator.id] = {};\n        }\n\n        if (!_handlers[gator.id][event]) {\n            _handlers[gator.id][event] = {};\n        }\n\n        if (!_handlers[gator.id][event][selector]) {\n            _handlers[gator.id][event][selector] = [];\n        }\n\n        _handlers[gator.id][event][selector].push(callback);\n    }\n\n    function _removeHandler(gator, event, selector, callback) {\n\n        // if there are no events tied to this element at all\n        // then don't do anything\n        if (!_handlers[gator.id]) {\n            return;\n        }\n\n        // if there is no event type specified then remove all events\n        // example: Gator(element).off()\n        if (!event) {\n            for (var type in _handlers[gator.id]) {\n                if (_handlers[gator.id].hasOwnProperty(type)) {\n                    _handlers[gator.id][type] = {};\n                }\n            }\n            return;\n        }\n\n        // if no callback or selector is specified remove all events of this type\n        // example: Gator(element).off('click')\n        if (!callback && !selector) {\n            _handlers[gator.id][event] = {};\n            return;\n        }\n\n        // if a selector is specified but no callback remove all events\n        // for this selector\n        // example: Gator(element).off('click', '.sub-element')\n        if (!callback) {\n            delete _handlers[gator.id][event][selector];\n            return;\n        }\n\n        // if we have specified an event type, selector, and callback then we\n        // need to make sure there are callbacks tied to this selector to\n        // begin with.  if there aren't then we can stop here\n        if (!_handlers[gator.id][event][selector]) {\n            return;\n        }\n\n        // if there are then loop through all the callbacks and if we find\n        // one that matches remove it from the array\n        for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n            if (_handlers[gator.id][event][selector][i] === callback) {\n                _handlers[gator.id][event][selector].splice(i, 1);\n                break;\n            }\n        }\n    }\n\n    function _handleEvent(id, e, type) {\n        if (!_handlers[id][type]) {\n            return;\n        }\n\n        var target = e.target || e.srcElement,\n            selector,\n            match,\n            matches = {},\n            i = 0,\n            j = 0;\n\n        // find all events that match\n        _level = 0;\n        for (selector in _handlers[id][type]) {\n            if (_handlers[id][type].hasOwnProperty(selector)) {\n                match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n                if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n                    _level++;\n                    _handlers[id][type][selector].match = match;\n                    matches[_level] = _handlers[id][type][selector];\n                }\n            }\n        }\n\n        // stopPropagation() fails to set cancelBubble to true in Webkit\n        // @see http://code.google.com/p/chromium/issues/detail?id=162270\n        e.stopPropagation = function() {\n            e.cancelBubble = true;\n        };\n\n        for (i = 0; i <= _level; i++) {\n            if (matches[i]) {\n                for (j = 0; j < matches[i].length; j++) {\n                    if (matches[i][j].call(matches[i].match, e) === false) {\n                        Gator.cancel(e);\n                        return;\n                    }\n\n                    if (e.cancelBubble) {\n                        return;\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * binds the specified events to the element\n     *\n     * @param {string|Array} events\n     * @param {string} selector\n     * @param {Function} callback\n     * @param {boolean=} remove\n     * @returns {Object}\n     */\n    function _bind(events, selector, callback, remove) {\n\n        // fail silently if you pass null or undefined as an alement\n        // in the Gator constructor\n        if (!this.element) {\n            return;\n        }\n\n        if (!(events instanceof Array)) {\n            events = [events];\n        }\n\n        if (!callback && typeof(selector) == 'function') {\n            callback = selector;\n            selector = '_root';\n        }\n\n        var id = this.id,\n            i;\n\n        function _getGlobalCallback(type) {\n            return function(e) {\n                _handleEvent(id, e, type);\n            };\n        }\n\n        for (i = 0; i < events.length; i++) {\n            if (remove) {\n                _removeHandler(this, events[i], selector, callback);\n                continue;\n            }\n\n            if (!_handlers[id] || !_handlers[id][events[i]]) {\n                Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n            }\n\n            _addHandler(this, events[i], selector, callback);\n        }\n\n        return this;\n    }\n\n    /**\n     * Gator object constructor\n     *\n     * @param {Node} element\n     */\n    function Gator(element, id) {\n\n        // called as function\n        if (!(this instanceof Gator)) {\n            // only keep one Gator instance per node to make sure that\n            // we don't create a ton of new objects if you want to delegate\n            // multiple events from the same node\n            //\n            // for example: Gator(document).on(...\n            for (var key in _gatorInstances) {\n                if (_gatorInstances[key].element === element) {\n                    return _gatorInstances[key];\n                }\n            }\n\n            _id++;\n            _gatorInstances[_id] = new Gator(element, _id);\n\n            return _gatorInstances[_id];\n        }\n\n        this.element = element;\n        this.id = id;\n    }\n\n    /**\n     * adds an event\n     *\n     * @param {string|Array} events\n     * @param {string} selector\n     * @param {Function} callback\n     * @returns {Object}\n     */\n    Gator.prototype.on = function(events, selector, callback) {\n        return _bind.call(this, events, selector, callback);\n    };\n\n    /**\n     * removes an event\n     *\n     * @param {string|Array} events\n     * @param {string} selector\n     * @param {Function} callback\n     * @returns {Object}\n     */\n    Gator.prototype.off = function(events, selector, callback) {\n        return _bind.call(this, events, selector, callback, true);\n    };\n\n    Gator.matchesSelector = function() {};\n    Gator.cancel = _cancel;\n    Gator.addEvent = _addEvent;\n    Gator.matchesEvent = function() {\n        return true;\n    };\n\n    if (typeof module !== 'undefined' && module.exports) {\n        module.exports = Gator;\n    }\n\n    window.Gator = Gator;\n}) ();\n\n},{}],8:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n                        if ('undefined' === typeof value) {\n                            value = '';\n                        }\n\n                        if (null === value) {\n                            value = '';\n                        }\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n          \t\t\t\telement.value = new Date(value).toISOString().split('T')[0];\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n\n},{}]},{},[1]);\n })();"]}