From f140bafedd5ff4fcc210727697eccfabf01ed2f7 Mon Sep 17 00:00:00 2001
From: Daniel Tonon
")+"
";v=v.replace(/\$label/g,e.polyfill.label),v=v.replace(/\$segmentName/g,c),v=v.replace(/\$segmentValue/g,i),v=v.replace(/\$fullValue/g,_),e.polyfill.$a11y.innerHTML=v},1)}},{"../getters/get_current_segment":14,"../getters/get_values":17}],3:[function(e,t,r){t.exports=function(e){return e<=12?0===e?12:e:e-12}},{}],4:[function(e,t,r){t.exports=function(e){return isNaN(e)?e:parseInt(e)}},{}],5:[function(e,t,r){var n=e("./convert_number"),s=e("./convert_hours_to_12hr_time"),a=e("./leading_zero");t.exports=function(e){if(""===e)return"--:-- --";var t=/([0-9]{2})\:([0-9]{2})/,r=t.exec(e),o=n(r[1]),i=r[2],c=s(o),u=o>12,l=u?"PM":"AM";return[a(c),":",i," ",l].join("")}},{"./convert_hours_to_12hr_time":3,"./convert_number":4,"./leading_zero":7}],6:[function(e,t,r){var n=e("./leading_zero");t.exports=function(e){if(/-/.test(e))return"";var t,r=e.indexOf("PM")>-1,s=/^([0-9]{2})/.exec(e),a=s?parseInt(s[1]):"";t=12===a?r?12:0:r?a+12:a;var o=24===t?0:t,i=/^[0-9]{2}:([0-9]{2}) (AM|PM)/;return e.replace(i,n(o)+":$1")}},{"./leading_zero":7}],7:[function(e,t,r){t.exports=function(e){if(isNaN(e))return e;var t=parseInt(e);return t<10?"0"+t:e}},{}],8:[function(e,t,r){function n(e){e.polyfill.autoSwap&&(p(e,24),setTimeout(function(){p(e,12)},1))}var s=e("../helpers/values"),a=e("../selectors/select_segment"),o=e("../selectors/next_segment"),i=e("../selectors/prev_segment"),c=e("../selectors/select_cursor_segment"),u=e("../getters/get_current_segment"),l=e("../setters/reset"),_=e("../setters/manual_number_entry"),v=e("../setters/clear_segment"),f=e("../setters/increment_current_segment"),g=e("../setters/decrement_current_segment"),m=e("../setters/set_mode"),p=e("../setters/switch_times"),d=e("../events/handle_tab"),h=e("../static-values/all_number_keys"),b=e("../static-values/named_keys"),x=e("../accessibility/update_a11y");t.exports=function(e){var t="",r=!1;document.addEventListener("keydown",function(e){r=e.shiftKey}),document.addEventListener("keyup",function(e){r=e.shiftKey}),e.form&&e.form.addEventListener("submit",function(){n(e)});var p=!1;e.addEventListener("mousedown",function(){p=!0}),e.addEventListener("mouseup",function(){setTimeout(function(){""===e.value&&l(e)},1)}),e.addEventListener("click",function(t){c(e)}),e.addEventListener("blur",function(){var r=e.dataset.value;r!==t&&(t=r),p=!1}),e.addEventListener("focus",function(t){if(!p){t.preventDefault();var n=r?"mode":"hrs";a(e,n)}x(e,["initial","select"])}),e.addEventListener("keydown",function(t){var r=13===t.which;if(r)return!0;var n=h.indexOf(t.which)>-1,a=s(b).indexOf(t.which)>-1,c=[b.ArrowDown,b.ArrowRight,b.ArrowUp,b.ArrowLeft].indexOf(t.which)>-1,p=[b.a,b.p].indexOf(t.which)>-1,x=[b.Delete,b.Backspace].indexOf(t.which)>-1;if((!a||c||n||p||x)&&t.preventDefault(),n&&_(e,t.which),x){var y=u(e);v(e,y)}switch(t.which){case b.ArrowRight:o(e);break;case b.ArrowLeft:i(e);break;case b.ArrowUp:f(e);break;case b.ArrowDown:g(e);break;case b.Escape:l(e);break;case b.a:m(e,"AM");break;case b.p:m(e,"PM");break;case b.Tab:d(e,t)}})}},{"../accessibility/update_a11y":2,"../events/handle_tab":10,"../getters/get_current_segment":14,"../helpers/values":20,"../selectors/next_segment":21,"../selectors/prev_segment":22,"../selectors/select_cursor_segment":23,"../selectors/select_segment":24,"../setters/clear_segment":27,"../setters/decrement_current_segment":29,"../setters/increment_current_segment":31,"../setters/manual_number_entry":32,"../setters/reset":34,"../setters/set_mode":36,"../setters/switch_times":40,"../static-values/all_number_keys":43,"../static-values/named_keys":44}],9:[function(e,t,r){t.exports=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}},{}],10:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../selectors/prev_segment"),a=e("../selectors/next_segment");t.exports=function(e,t){var r=n(e),o=t.shiftKey&&"hrs"===r,i=!t.shiftKey&&"mode"===r;o||i||(t.preventDefault(),t.shiftKey?s(e):a(e))}},{"../getters/get_current_segment":14,"../selectors/next_segment":21,"../selectors/prev_segment":22}],11:[function(e,t,r){var n=e("./trigger_event");t.exports=function(e){n(e,"input"),n(e,"change")}},{"./trigger_event":12}],12:[function(e,t,r){function n(e){return!/--/.test(e.value)}var s=e("./create_event"),a=s("input"),o=s("change");t.exports=function(e,t){var r={input:a,change:o}[t];n(e)&&e.dispatchEvent(r)}},{"./create_event":9}],13:[function(e,t,r){t.exports=function(e,t){for(var r=e,n=[];r;){n.push(r);var s=r.msMatchesSelector?r.msMatchesSelector(t):r.matches(t);if(s)return n;r=r.parentElement}return n}},{}],14:[function(e,t,r){var n=e("../static-values/ranges"),s=e("./get_selected_range");t.exports=function(e){var t=s(e);for(var r in n){var a=n[r],o=a.start<=t.start,i=a.end>=t.end;if(o&&i)return r}return"hrs"}},{"../static-values/ranges":45,"./get_selected_range":16}],15:[function(e,t,r){function n(e){var t=e.getAttribute("aria-labelledby");if(t){var r=document.getElementById(t);if(r)return r.textContent}return!1}function s(e){var t=e.getAttribute("aria-label");return!!t&&t}function a(e){if(e.id){var t=document.querySelector('label[for="'+e.id+'"]');if(t)return t.textContent}return!1}function o(e){var t=c(e,"label"),r=t[t.length-1];return"LABEL"==r.nodeName&&r.textContent}function i(e){var t=e.getAttribute("title");return!!t&&t}var c=e("./get_ancestors");t.exports=function(e){var t=n(e)||s(e)||a(e)||o(e)||i(e);if(t)return t;throw console.error("Label text for input not found.",e),new Error("Cannot polyfill time input due to a missing label.")}},{"./get_ancestors":13}],16:[function(e,t,r){t.exports=function(e){return{start:e.selectionStart,end:e.selectionEnd}}},{}],17:[function(e,t,r){var n=e("../converters/convert_number");t.exports=function(e,t){var r=t?t:e.value,s=/([0-9-]{1,2})\:([0-9-]{1,2})\s?(AM|PM|\-\-)?/,a=s.exec(r);return{hrs:n(a[1]),min:n(a[2]),mode:a[3]}}},{"../converters/convert_number":4}],18:[function(e,t,r){function n(){o=[]}function s(e){o.push(e)}function a(){return o}var o=[];t.exports={items:a,clear:n,add:s}},{}],19:[function(e,t,r){t.exports=function(e){e.style.msUserSelect="none",e.style.mozUserSelect="none",e.style.webkitUserSelect="none",e.style.userSelect="none"}},{}],20:[function(e,t,r){t.exports=function(e){var t=[];for(var r in e)t.push(e[r]);return t}},{}],21:[function(e,t,r){var n=e("./traverse");t.exports=function(e){n(e,"next")}},{"./traverse":25}],22:[function(e,t,r){var n=e("./traverse");t.exports=function(e){n(e,"prev")}},{"./traverse":25}],23:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("./select_segment");t.exports=function(e){var t=n(e);s(e,t)}},{"../getters/get_current_segment":14,"./select_segment":24}],24:[function(e,t,r){t.exports=function(e,t){function r(){var r="mode"===t?"text":"tel";e.setAttribute("type",r)}function n(t,r){return function(){e.setSelectionRange(t,r)}}r();var s={hrs:n(0,2),min:n(3,5),mode:n(6,8)};s[t](e)}},{}],25:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../selectors/select_segment"),a=e("../helpers/manual_entry_log"),o=e("../static-values/segments"),i=e("../accessibility/update_a11y");t.exports=function(e,t){var r=n(e),c="next"===t?1:-1,u=o.indexOf(r)+c,l={next:o[u]||"mode",prev:u<0?"hrs":o[u]}[t];s(e,l),a.clear(),i(e,["select"])}},{"../accessibility/update_a11y":2,"../getters/get_current_segment":14,"../helpers/manual_entry_log":18,"../selectors/select_segment":24,"../static-values/segments":46}],26:[function(e,t,r){var n=e("../setters/set_data_attribute"),s=e("../events/trigger_both_events");t.exports=function(e){e.value="--:-- --",n(e,""),s(e)}},{"../events/trigger_both_events":11,"../setters/set_data_attribute":35}],27:[function(e,t,r){var n=e("./set_segment"),s=e("../accessibility/update_a11y");t.exports=function(e,t){n(e,t,"--"),s(e,["update"])}},{"../accessibility/update_a11y":2,"./set_segment":37}],28:[function(e,t,r){var n=e("./switch_mode"),s=e("./nudge_time_segment"),a=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?n(e,"PM"):s(e,t,"down"),a(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":33,"./switch_mode":39}],29:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../setters/decrement");t.exports=function(e){var t=n(e);s(e,t)}},{"../getters/get_current_segment":14,"../setters/decrement":28}],30:[function(e,t,r){var n=e("./switch_mode"),s=e("./nudge_time_segment"),a=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?n(e,"AM"):s(e,t,"up"),a(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":33,"./switch_mode":39}],31:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../setters/increment");t.exports=function(e){var t=n(e);s(e,t)}},{"../getters/get_current_segment":14,"../setters/increment":30}],32:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("./set_segment"),a=e("../selectors/next_segment"),o=e("../helpers/manual_entry_log"),i=e("../static-values/sorted_number_keys");t.exports=function(e,t){var r=i[t],c=n(e);if("mode"!==c){var u=o.items().length,l={hrs:[1,2],min:[5,9]},_=l[c][u];u<2&&o.add(r);var v=parseInt(l[c].join("")),f=parseInt(o.items().join(""));v>=f&&s(e,c,f);var g=r>_||2===o.items().length;g&&a(e)}}},{"../getters/get_current_segment":14,"../helpers/manual_entry_log":18,"../selectors/next_segment":21,"../static-values/sorted_number_keys":47,"./set_segment":37}],33:[function(e,t,r){var n=e("../getters/get_values"),s=e("../converters/convert_hours_to_12hr_time"),a=e("../converters/leading_zero"),o=e("./set_segment");t.exports=function(e,t,r){var i,c=n(e),u="up"===r?1:-1;if("--"===c[t]){var l=new Date;i={hrs:s(l.getHours()),min:l.getMinutes()}}else{var _={up:c.min<59?c.min+u:0,down:0===c.min?59:c.min+u};i={hrs:s(c.hrs+u),min:_[r]}}o(e,t,a(i[t]))}},{"../converters/convert_hours_to_12hr_time":3,"../converters/leading_zero":7,"../getters/get_values":17,"./set_segment":37}],34:[function(e,t,r){var n=e("./apply_default"),s=e("../selectors/select_segment");t.exports=function(e){n(e),s(e,"hrs")}},{"../selectors/select_segment":24,"./apply_default":26}],35:[function(e,t,r){var n=e("../converters/convert_to_24hr_time");t.exports=function(e,t){var r=t.indexOf("-")>-1?"":t,s=n(r);e.setAttribute("data-value",s)}},{"../converters/convert_to_24hr_time":6}],36:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("./set_segment");t.exports=function(e,t){var r=n(e);"mode"===r&&s(e,r,t)}},{"../getters/get_current_segment":14,"./set_segment":37}],37:[function(e,t,r){var n=e("../getters/get_values"),s=e("../converters/leading_zero"),a=e("../selectors/select_segment"),o=e("./set_data_attribute"),i=e("../events/trigger_both_events");t.exports=function(e,t,r){var c=n(e);c[t]=r;var u=[s(c.hrs),":",s(c.min)," ",c.mode].join("");e.value=u,a(e,t),o(e,u),i(e)}},{"../converters/leading_zero":7,"../events/trigger_both_events":11,"../getters/get_values":17,"../selectors/select_segment":24,"./set_data_attribute":35}],38:[function(e,t,r){var n=e("../converters/convert_to_12hr_time"),s=e("../setters/set_data_attribute");t.exports=function(e,t){var r=n(t);e.value=r,s(e,t)}},{"../converters/convert_to_12hr_time":5,"../setters/set_data_attribute":35}],39:[function(e,t,r){var n=e("../getters/get_values"),s=e("./set_segment");t.exports=function(e,t){t=t||"AM";var r=n(e).mode,a={"--":t,AM:"PM",PM:"AM"}[r];s(e,"mode",a)}},{"../getters/get_values":17,"./set_segment":37}],40:[function(e,t,r){var n=e("./switch_to_data_value"),s=e("./set_time");t.exports=function(e,t){var r=/\s/.test(e.value);12!=t&&24!=t&&(t=r?24:12);var a={12:function(){r||s(e,e.dataset.value)},24:function(){r&&n(e)}};a[t]()}},{"./set_time":38,"./switch_to_data_value":41}],41:[function(e,t,r){t.exports=function(e){var t=e.dataset.value;e.value=t}},{}],42:[function(e,t,r){var n=e("../setters/set_time");t.exports=function(e){return n(e,e.value),e}},{"../setters/set_time":38}],43:[function(e,t,r){var n=[48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105];t.exports=n},{}],44:[function(e,t,r){var n={ArrowDown:40,ArrowRight:39,ArrowUp:38,ArrowLeft:37,Backspace:8,Delete:46,Tab:9,Shift:16,Escape:27,a:65,p:80};t.exports=n},{}],45:[function(e,t,r){var n={hrs:{start:0,end:2},min:{start:3,end:5},mode:{start:6,end:8}};t.exports=n},{}],46:[function(e,t,r){var n=e("./ranges"),s=Object.keys(n);t.exports=s},{"./ranges":45}],47:[function(e,t,r){var n=e("./all_number_keys"),s={};n.forEach(function(e,t){var r=t>9?t-10:t;s[e]=r}),t.exports=s},{"./all_number_keys":43}],48:[function(e,t,r){function n(e){e.setAttribute("autocomplete","off"),a(e),e.setAttribute("aria-hidden",!0),f||(s=v(),f=!0);var t=_(e);e.polyfill={$a11y:s,label:t,autoSwap:!0,update:function(){i(e)},swap:function(t){l(e,t)}},""===e.value||/--/.test(e.value)?(o(e),c(e,"")):(i(e),c(e,e.value)),u(e)}var s,a=e("./core/helpers/prevent_user_select"),o=e("./core/setters/apply_default"),i=e("./core/setters/update_time"),c=e("./core/setters/set_data_attribute"),u=e("./core/events/bind_events"),l=e("./core/setters/switch_times"),_=e("./core/getters/get_label"),v=e("./core/accessibility/create_a11y_block"),f=!1;window&&(window.TimePolyfill=n),t&&(t.exports=n)},{"./core/accessibility/create_a11y_block":1,"./core/events/bind_events":8,"./core/getters/get_label":15,"./core/helpers/prevent_user_select":19,"./core/setters/apply_default":26,"./core/setters/set_data_attribute":35,"./core/setters/switch_times":40,"./core/setters/update_time":42}]},{},[48]); +!function(){function e(t,r,n){function s(o,i){if(!r[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var _=r[o]={exports:{}};t[o][0].call(_.exports,function(e){var r=t[o][1][e];return s(r||e)},_,_.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o")+"
";v=v.replace(/\$label/g,e.polyfill.label),v=v.replace(/\$segmentName/g,c),v=v.replace(/\$segmentValue/g,i),v=v.replace(/\$fullValue/g,l),e.polyfill.$a11y.innerHTML=v},1)}},{"../getters/get_current_segment":14,"../getters/get_values":17}],3:[function(e,t,r){t.exports=function(e){return e<=12?0===e?12:e:e-12}},{}],4:[function(e,t,r){t.exports=function(e){return isNaN(e)?e:parseInt(e)}},{}],5:[function(e,t,r){var n=e("./convert_number"),s=e("./convert_hours_to_12hr_time"),a=e("./leading_zero");t.exports=function(e){if(""===e)return"--:-- --";var t=/([0-9]{2})\:([0-9]{2})/,r=t.exec(e),o=n(r[1]),i=r[2],c=s(o),u=o>12,_=u?"PM":"AM";return[a(c),":",i," ",_].join("")}},{"./convert_hours_to_12hr_time":3,"./convert_number":4,"./leading_zero":7}],6:[function(e,t,r){var n=e("./leading_zero");t.exports=function(e){if(/-/.test(e))return"";var t,r=e.indexOf("PM")>-1,s=/^([0-9]{2})/.exec(e),a=s?parseInt(s[1]):"";t=12===a?r?12:0:r?a+12:a;var o=24===t?0:t,i=/^[0-9]{2}:([0-9]{2}) (AM|PM)/;return e.replace(i,n(o)+":$1")}},{"./leading_zero":7}],7:[function(e,t,r){t.exports=function(e){if(isNaN(e))return e;var t=parseInt(e);return t<10?"0"+t:e}},{}],8:[function(e,t,r){function n(e){e.polyfill.autoSwap&&(d(e,24),setTimeout(function(){d(e,12)},1))}var s=e("../helpers/values"),a=e("../selectors/select_segment"),o=e("../selectors/next_segment"),i=e("../selectors/prev_segment"),c=e("../selectors/select_cursor_segment"),u=e("../getters/get_current_segment"),_=e("../setters/reset"),l=e("../setters/manual_number_entry"),v=e("../setters/clear_segment"),f=e("../setters/increment_current_segment"),g=e("../setters/decrement_current_segment"),m=e("../setters/set_mode"),d=e("../setters/switch_times"),p=e("../events/handle_tab"),h=e("../static-values/all_number_keys"),b=e("../static-values/named_keys"),x=e("../accessibility/update_a11y");t.exports=function(e){var t="",r=!1;document.addEventListener("keydown",function(e){r=e.shiftKey}),document.addEventListener("keyup",function(e){r=e.shiftKey}),e.form&&e.form.addEventListener("submit",function(){n(e)});var d=!1;e.addEventListener("mousedown",function(){d=!0}),e.addEventListener("mouseup",function(){setTimeout(function(){""===e.value&&_(e)},1)}),e.addEventListener("click",function(t){c(e)}),e.addEventListener("blur",function(){var r=e.dataset.value;r!==t&&(t=r),d=!1}),e.addEventListener("focus",function(t){if(!d){t.preventDefault();var n=r?"mode":"hrs";a(e,n)}x(e,["initial","select"])}),e.addEventListener("keydown",function(t){var r=13===t.which;if(r)return!0;var n=h.indexOf(t.which)>-1,a=s(b).indexOf(t.which)>-1,c=[b.ArrowDown,b.ArrowRight,b.ArrowUp,b.ArrowLeft].indexOf(t.which)>-1,d=[b.a,b.p].indexOf(t.which)>-1,x=[b.Delete,b.Backspace].indexOf(t.which)>-1;if((!a||c||n||d||x)&&t.preventDefault(),n&&l(e,t.which),x){var y=u(e);v(e,y)}switch(t.which){case b.ArrowRight:o(e);break;case b.ArrowLeft:i(e);break;case b.ArrowUp:f(e);break;case b.ArrowDown:g(e);break;case b.Escape:_(e);break;case b.a:m(e,"AM");break;case b.p:m(e,"PM");break;case b.Tab:p(e,t)}})}},{"../accessibility/update_a11y":2,"../events/handle_tab":10,"../getters/get_current_segment":14,"../helpers/values":19,"../selectors/next_segment":20,"../selectors/prev_segment":21,"../selectors/select_cursor_segment":22,"../selectors/select_segment":23,"../setters/clear_segment":26,"../setters/decrement_current_segment":28,"../setters/increment_current_segment":30,"../setters/manual_number_entry":31,"../setters/reset":33,"../setters/set_mode":35,"../setters/switch_times":39,"../static-values/all_number_keys":42,"../static-values/named_keys":43}],9:[function(e,t,r){t.exports=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}},{}],10:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../selectors/prev_segment"),a=e("../selectors/next_segment");t.exports=function(e,t){var r=n(e),o=t.shiftKey&&"hrs"===r,i=!t.shiftKey&&"mode"===r;o||i||(t.preventDefault(),t.shiftKey?s(e):a(e))}},{"../getters/get_current_segment":14,"../selectors/next_segment":20,"../selectors/prev_segment":21}],11:[function(e,t,r){var n=e("./trigger_event");t.exports=function(e){n(e,"input"),n(e,"change")}},{"./trigger_event":12}],12:[function(e,t,r){function n(e){return!/--/.test(e.value)}var s=e("./create_event"),a=s("input"),o=s("change");t.exports=function(e,t){var r={input:a,change:o}[t];n(e)&&e.dispatchEvent(r)}},{"./create_event":9}],13:[function(e,t,r){t.exports=function(e,t){for(var r=e,n=[];r;){n.push(r);var s=r.msMatchesSelector?r.msMatchesSelector(t):r.matches(t);if(s)return n;r=r.parentElement}return n}},{}],14:[function(e,t,r){var n=e("../static-values/ranges"),s=e("./get_selected_range");t.exports=function(e){var t=s(e);for(var r in n){var a=n[r],o=a.start<=t.start,i=a.end>=t.end;if(o&&i)return r}return"hrs"}},{"../static-values/ranges":44,"./get_selected_range":16}],15:[function(e,t,r){function n(e){var t=e.getAttribute("aria-labelledby");if(t){var r=document.getElementById(t);if(r)return r.textContent}return!1}function s(e){var t=e.getAttribute("aria-label");return!!t&&t}function a(e){if(e.id){var t=document.querySelector('label[for="'+e.id+'"]');if(t)return t.textContent}return!1}function o(e){var t=c(e,"label"),r=t[t.length-1];return"LABEL"==r.nodeName&&r.textContent}function i(e){var t=e.getAttribute("title");return!!t&&t}var c=e("./get_ancestors");t.exports=function(e){var t=n(e)||s(e)||a(e)||o(e)||i(e);if(t)return t;throw console.error("Label text for input not found.",e),new Error("Cannot polyfill time input due to a missing label.")}},{"./get_ancestors":13}],16:[function(e,t,r){t.exports=function(e){return{start:e.selectionStart,end:e.selectionEnd}}},{}],17:[function(e,t,r){var n=e("../converters/convert_number");t.exports=function(e,t){var r=t?t:e.value,s=/([0-9-]{1,2})\:([0-9-]{1,2})\s?(AM|PM|\-\-)?/,a=s.exec(r);return{hrs:n(a[1]),min:n(a[2]),mode:a[3]}}},{"../converters/convert_number":4}],18:[function(e,t,r){function n(){o=[]}function s(e){o.push(e)}function a(){return o}var o=[];t.exports={items:a,clear:n,add:s}},{}],19:[function(e,t,r){t.exports=function(e){var t=[];for(var r in e)t.push(e[r]);return t}},{}],20:[function(e,t,r){var n=e("./traverse");t.exports=function(e){n(e,"next")}},{"./traverse":24}],21:[function(e,t,r){var n=e("./traverse");t.exports=function(e){n(e,"prev")}},{"./traverse":24}],22:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("./select_segment");t.exports=function(e){var t=n(e);s(e,t)}},{"../getters/get_current_segment":14,"./select_segment":23}],23:[function(e,t,r){t.exports=function(e,t){function r(){var r="mode"===t?"text":"tel";e.setAttribute("type",r)}function n(t,r){return function(){e.setSelectionRange(t,r)}}r();var s={hrs:n(0,2),min:n(3,5),mode:n(6,8)};s[t](e)}},{}],24:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../selectors/select_segment"),a=e("../helpers/manual_entry_log"),o=e("../static-values/segments"),i=e("../accessibility/update_a11y");t.exports=function(e,t){var r=n(e),c="next"===t?1:-1,u=o.indexOf(r)+c,_={next:o[u]||"mode",prev:u<0?"hrs":o[u]}[t];s(e,_),a.clear(),i(e,["select"])}},{"../accessibility/update_a11y":2,"../getters/get_current_segment":14,"../helpers/manual_entry_log":18,"../selectors/select_segment":23,"../static-values/segments":45}],25:[function(e,t,r){var n=e("../setters/set_data_attribute"),s=e("../events/trigger_both_events");t.exports=function(e){e.value="--:-- --",n(e,""),s(e)}},{"../events/trigger_both_events":11,"../setters/set_data_attribute":34}],26:[function(e,t,r){var n=e("./set_segment"),s=e("../accessibility/update_a11y");t.exports=function(e,t){n(e,t,"--"),s(e,["update"])}},{"../accessibility/update_a11y":2,"./set_segment":36}],27:[function(e,t,r){var n=e("./switch_mode"),s=e("./nudge_time_segment"),a=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?n(e,"PM"):s(e,t,"down"),a(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":32,"./switch_mode":38}],28:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../setters/decrement");t.exports=function(e){var t=n(e);s(e,t)}},{"../getters/get_current_segment":14,"../setters/decrement":27}],29:[function(e,t,r){var n=e("./switch_mode"),s=e("./nudge_time_segment"),a=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?n(e,"AM"):s(e,t,"up"),a(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":32,"./switch_mode":38}],30:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("../setters/increment");t.exports=function(e){var t=n(e);s(e,t)}},{"../getters/get_current_segment":14,"../setters/increment":29}],31:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("./set_segment"),a=e("../selectors/next_segment"),o=e("../helpers/manual_entry_log"),i=e("../static-values/sorted_number_keys");t.exports=function(e,t){var r=i[t],c=n(e);if("mode"!==c){var u=o.items().length,_={hrs:[1,2],min:[5,9]},l=_[c][u];u<2&&o.add(r);var v=parseInt(_[c].join("")),f=parseInt(o.items().join(""));v>=f&&s(e,c,f);var g=r>l||2===o.items().length;g&&a(e)}}},{"../getters/get_current_segment":14,"../helpers/manual_entry_log":18,"../selectors/next_segment":20,"../static-values/sorted_number_keys":46,"./set_segment":36}],32:[function(e,t,r){var n=e("../getters/get_values"),s=e("../converters/convert_hours_to_12hr_time"),a=e("../converters/leading_zero"),o=e("./set_segment");t.exports=function(e,t,r){var i,c=n(e),u="up"===r?1:-1;if("--"===c[t]){var _=new Date;i={hrs:s(_.getHours()),min:_.getMinutes()}}else{var l={up:c.min<59?c.min+u:0,down:0===c.min?59:c.min+u};i={hrs:s(c.hrs+u),min:l[r]}}o(e,t,a(i[t]))}},{"../converters/convert_hours_to_12hr_time":3,"../converters/leading_zero":7,"../getters/get_values":17,"./set_segment":36}],33:[function(e,t,r){var n=e("./apply_default"),s=e("../selectors/select_segment");t.exports=function(e){n(e),s(e,"hrs")}},{"../selectors/select_segment":23,"./apply_default":25}],34:[function(e,t,r){var n=e("../converters/convert_to_24hr_time");t.exports=function(e,t){var r=t.indexOf("-")>-1?"":t,s=n(r);e.setAttribute("data-value",s)}},{"../converters/convert_to_24hr_time":6}],35:[function(e,t,r){var n=e("../getters/get_current_segment"),s=e("./set_segment");t.exports=function(e,t){var r=n(e);"mode"===r&&s(e,r,t)}},{"../getters/get_current_segment":14,"./set_segment":36}],36:[function(e,t,r){var n=e("../getters/get_values"),s=e("../converters/leading_zero"),a=e("../selectors/select_segment"),o=e("./set_data_attribute"),i=e("../events/trigger_both_events");t.exports=function(e,t,r){var c=n(e);c[t]=r;var u=[s(c.hrs),":",s(c.min)," ",c.mode].join("");e.value=u,a(e,t),o(e,u),i(e)}},{"../converters/leading_zero":7,"../events/trigger_both_events":11,"../getters/get_values":17,"../selectors/select_segment":23,"./set_data_attribute":34}],37:[function(e,t,r){var n=e("../converters/convert_to_12hr_time"),s=e("../setters/set_data_attribute");t.exports=function(e,t){var r=n(t);e.value=r,s(e,t)}},{"../converters/convert_to_12hr_time":5,"../setters/set_data_attribute":34}],38:[function(e,t,r){var n=e("../getters/get_values"),s=e("./set_segment");t.exports=function(e,t){t=t||"AM";var r=n(e).mode,a={"--":t,AM:"PM",PM:"AM"}[r];s(e,"mode",a)}},{"../getters/get_values":17,"./set_segment":36}],39:[function(e,t,r){var n=e("./switch_to_data_value"),s=e("./set_time");t.exports=function(e,t){var r=/\s/.test(e.value);12!=t&&24!=t&&(t=r?24:12);var a={12:function(){r||s(e,e.dataset.value)},24:function(){r&&n(e)}};a[t]()}},{"./set_time":37,"./switch_to_data_value":40}],40:[function(e,t,r){t.exports=function(e){var t=e.dataset.value;e.value=t}},{}],41:[function(e,t,r){var n=e("../setters/set_time");t.exports=function(e){return n(e,e.value),e}},{"../setters/set_time":37}],42:[function(e,t,r){var n=[48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105];t.exports=n},{}],43:[function(e,t,r){var n={ArrowDown:40,ArrowRight:39,ArrowUp:38,ArrowLeft:37,Backspace:8,Delete:46,Tab:9,Shift:16,Escape:27,a:65,p:80};t.exports=n},{}],44:[function(e,t,r){var n={hrs:{start:0,end:2},min:{start:3,end:5},mode:{start:6,end:8}};t.exports=n},{}],45:[function(e,t,r){var n=e("./ranges"),s=Object.keys(n);t.exports=s},{"./ranges":44}],46:[function(e,t,r){var n=e("./all_number_keys"),s={};n.forEach(function(e,t){var r=t>9?t-10:t;s[e]=r}),t.exports=s},{"./all_number_keys":42}],47:[function(e,t,r){function n(e){e.setAttribute("autocomplete","off"),e.setAttribute("aria-hidden",!0),v||(s=l(),v=!0);var t=_(e);e.polyfill={$a11y:s,label:t,autoSwap:!0,update:function(){o(e)},swap:function(t){u(e,t)}},""===e.value||/--/.test(e.value)?(a(e),i(e,"")):(o(e),i(e,e.value)),c(e)}var s,a=e("./core/setters/apply_default"),o=e("./core/setters/update_time"),i=e("./core/setters/set_data_attribute"),c=e("./core/events/bind_events"),u=e("./core/setters/switch_times"),_=e("./core/getters/get_label"),l=e("./core/accessibility/create_a11y_block"),v=!1;window&&(window.TimePolyfill=n),t&&(t.exports=n)},{"./core/accessibility/create_a11y_block":1,"./core/events/bind_events":8,"./core/getters/get_label":15,"./core/setters/apply_default":25,"./core/setters/set_data_attribute":34,"./core/setters/switch_times":39,"./core/setters/update_time":41}]},{},[47]); //# sourceMappingURL=time-input-polyfill.min.js.map diff --git a/dist/time-input-polyfill.min.js.map b/dist/time-input-polyfill.min.js.map index 9741a3a..98b5000 100644 --- a/dist/time-input-polyfill.min.js.map +++ b/dist/time-input-polyfill.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["node_modules/browser-pack/_prelude.js","core/accessibility/create_a11y_block.js","index.js","core/accessibility/update_a11y.js","core/converters/convert_hours_to_12hr_time.js","core/converters/convert_number.js","core/converters/convert_to_12hr_time.js","core/converters/convert_to_24hr_time.js","core/converters/leading_zero.js","core/events/bind_events.js","core/events/create_event.js","core/events/handle_tab.js","core/events/trigger_both_events.js","core/events/trigger_event.js","core/getters/get_ancestors.js","core/getters/get_current_segment.js","core/getters/get_label.js","core/getters/get_selected_range.js","core/getters/get_values.js","core/helpers/manual_entry_log.js","core/helpers/prevent_user_select.js","core/helpers/values.js","core/selectors/next_segment.js","core/selectors/prev_segment.js","core/selectors/select_cursor_segment.js","core/selectors/select_segment.js","core/selectors/traverse.js","core/setters/apply_default.js","core/setters/clear_segment.js","core/setters/decrement.js","core/setters/decrement_current_segment.js","core/setters/increment.js","core/setters/increment_current_segment.js","core/setters/manual_number_entry.js","core/setters/nudge_time_segment.js","core/setters/reset.js","core/setters/set_data_attribute.js","core/setters/set_mode.js","core/setters/set_segment.js","core/setters/set_time.js","core/setters/switch_mode.js","core/setters/switch_times.js","core/setters/switch_to_data_value.js","core/setters/update_time.js","core/static-values/all_number_keys.js","core/static-values/named_keys.js","core/static-values/ranges.js","core/static-values/segments.js","core/static-values/sorted_number_keys.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","$block","document","createElement","setAttribute","classList","add","querySelector","appendChild","2","get_current_segment","get_values","$input","announcementArray","setTimeout","current_segment","values","value","finalValue","segmentName","hrs","min","mode","announcements","initial","select","update","textArray","map","providedString","fullValue","replace","html","join","polyfill","label","$a11y","innerHTML","../getters/get_current_segment","../getters/get_values","3","hours","4","number","isNaN","parseInt","5","convert_number","convert_hours_to_12hr_time","leading_zero","timeString_24hr","twentyFour_regex","result","exec","hrs_24","hrs_12","isPM","./convert_hours_to_12hr_time","./convert_number","./leading_zero","6","timeString_12hr","test","newHrs","indexOf","timeResult","finalHrs","timeRegEx","7","purified","8","auto_swap","autoSwap","switch_times","select_segment","next_segment","prev_segment","select_cursor_segment","reset","manual_number_entry","clear_segment","increment_current_segment","decrement_current_segment","set_mode","handle_tab","all_number_keys","named_keys","update_a11y","prev_value","shiftKey","addEventListener","form","focused_via_click","current_value","dataset","preventDefault","segment","is_enter_key","which","is_number_key","is_named_key","is_arrow_key","ArrowDown","ArrowRight","ArrowUp","ArrowLeft","is_mode_key","is_delete_key","Delete","Backspace","Escape","Tab","../accessibility/update_a11y","../events/handle_tab","../helpers/values","../selectors/next_segment","../selectors/prev_segment","../selectors/select_cursor_segment","../selectors/select_segment","../setters/clear_segment","../setters/decrement_current_segment","../setters/increment_current_segment","../setters/manual_number_entry","../setters/reset","../setters/set_mode","../setters/switch_times","../static-values/all_number_keys","../static-values/named_keys","9","eventName","event","createEvent","initEvent","10","backwards_and_first","forwards_and_last","11","trigger_event","./trigger_event","12","can_trigger_change","create_event","inputEvent","changeEvent","input","change","dispatchEvent","./create_event","13","selectorString","$elem","ancestors","push","matchesSelector","msMatchesSelector","matches","parentElement","14","ranges","get_selected_range","selection","range","aboveMin","start","belowMax","end","../static-values/ranges","./get_selected_range","15","aria_labelledby","ariaLabelByID","getAttribute","$ariaLabelBy","getElementById","textContent","aria_label","ariaLabel","for_attribute","id","$forLabel","label_wrapper_element","get_ancestors","$parentLabel","nodeName","title_attribute","titleLabel","labelText","console","error","./get_ancestors","16","selectionStart","selectionEnd","17","timeString","regEx","../converters/convert_number","18","clear","manual_entry_log","entry","items","19","style","msUserSelect","mozUserSelect","webkitUserSelect","userSelect","20","obj","key_values","key","21","traverse","./traverse","22","23","./select_segment","24","set_input_type","type","setSelectionRange","actions","25","segments","direction","modifier","next_segment_index","next","prev","../helpers/manual_entry_log","../static-values/segments","26","set_data_attribute","trigger_both_events","../events/trigger_both_events","../setters/set_data_attribute","27","set_segment","./set_segment","28","switch_mode","nudge_time_segment","./nudge_time_segment","./switch_mode","29","decrement","../setters/decrement","30","31","increment","../setters/increment","32","sorted_number_keys","key_value","entry_count","upper_limits","limit","full_limit","full_entry","at_limit","../static-values/sorted_number_keys","33","time","current_values","current_time","Date","getHours","getMinutes","minutes","up","down","../converters/convert_hours_to_12hr_time","../converters/leading_zero","34","apply_default","./apply_default","35","convert_to_24hr_time","filteredString","time24hr","../converters/convert_to_24hr_time","36","37","newInputVal","./set_data_attribute","38","convert_to_12hr_time","time_string_24hr","twelveHr","../converters/convert_to_12hr_time","39","default_mode","current_mode","new_mode","--","AM","PM","40","switch_to_data_value","set_time","format","is12hr","./set_time","./switch_to_data_value","41","replacementVal","42","../setters/set_time","43","44","Shift","45","46","Object","keys","./ranges","47","forEach","index","number_val","./all_number_keys","48","TimePolyfill","prevent_user_select","accessibility_block_created","create_a11y_block","get_label","update_time","swap","forcedFormat","bind_events","window","./core/accessibility/create_a11y_block","./core/events/bind_events","./core/getters/get_label","./core/helpers/prevent_user_select","./core/setters/apply_default","./core/setters/set_data_attribute","./core/setters/switch_times","./core/setters/update_time"],"mappings":";;;;;;;;CAAA,WAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAK,GAAA,GAAAC,OAAA,uBAAAN,EAAA,IAAA,MAAAK,GAAAE,KAAA,mBAAAF,EAAA,GAAAG,GAAAX,EAAAG,IAAAS,WAAAb,GAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL,EAAA,OAAAI,GAAAF,GAAAF,IAAAa,EAAAA,EAAAC,QAAAd,EAAAC,EAAAC,EAAAC,GAAA,MAAAD,GAAAG,GAAAS,QAAA,IAAA,GAAAL,GAAA,kBAAAD,UAAAA,QAAAH,EAAA,EAAAA,EAAAF,EAAAa,OAAAX,IAAAD,EAAAD,EAAAE,GAAA,OAAAD,GAAA,MAAAJ,OAAAiB,GAAA,SAAAT,EAAAU,EAAAJ,GCCAI,EAAAJ,QAAA,WACA,GAAAK,GAAAC,SAAAC,cAAA,MAKA,OAJAF,GAAAG,aAAA,YAAA,aACAH,EAAAG,aAAA,QAAA,gGACAH,EAAAI,UAAAC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ACAD,MAAAA,EACAqC,UAAA,EACA9C,OAAA,WACA8S,EAAA5T,IAEA6T,KAAA,SAAAC,GACAjQ,EAAA7D,EAAA8T,KAIA,KAAA9T,EAAAK,OAAA,KAAA6C,KAAAlD,EAAAK,QACAkQ,EAAAvQ,GACA6N,EAAA7N,EAAA,MAEA4T,EAAA5T,GACA6N,EAAA7N,EAAAA,EAAAK,QAGA0T,EAAA/T,GAjDA,GAWAwB,GAXAgS,EAAA9U,EAAA,sCACA6R,EAAA7R,EAAA,gCACAkV,EAAAlV,EAAA,8BACAmP,EAAAnP,EAAA,qCACAqV,EAAArV,EAAA,6BACAmF,EAAAnF,EAAA,+BACAiV,EAAAjV,EAAA,4BAEAgV,EAAAhV,EAAA,0CAEA+U,GAAA,CA0CAO,UAAAA,OAAAT,aAAAA,GACAnU,IAAAA,EAAAJ,QAAAuU,KAu2BGU,yCAAyC,EAAEC,4BAA4B,EAAEC,2BAA2B,GAAGC,qCAAqC,GAAGC,+BAA+B,GAAGC,oCAAoC,GAAGC,8BAA8B,GAAGC,6BAA6B,UAAU","file":"time-input-polyfill.min.js","sourcesContent":["(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') + '
';\r\n\t\thtml = html.replace(/\\$label/g, $input.polyfill.label);\r\n\t\thtml = html.replace(/\\$segmentName/g, segmentName);\r\n\t\thtml = html.replace(/\\$segmentValue/g, finalValue);\r\n\t\thtml = html.replace(/\\$fullValue/g, fullValue);\r\n\r\n\t\t$input.polyfill.$a11y.innerHTML = html;\r\n\t}, 1);\r\n}\r\n","\r\nmodule.exports = function convert_hours_to_12hr_time (hours) {\r\n\treturn hours <= 12 ? hours === 0 ? 12 : hours : hours - 12;\r\n}\r\n","\r\nmodule.exports = function convert_number (number) {\r\n\treturn isNaN(number) ? number : parseInt(number);\r\n}\r\n","\r\nvar convert_number = require('./convert_number');\r\nvar convert_hours_to_12hr_time = require('./convert_hours_to_12hr_time');\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_12hr_time (timeString_24hr) {\r\n\tif (timeString_24hr === '') return '--:-- --';\r\n\tvar twentyFour_regex = /([0-9]{2})\\:([0-9]{2})/;\r\n\tvar result = twentyFour_regex.exec(timeString_24hr);\r\n\tvar hrs_24 = convert_number(result[1]);\r\n\tvar min = result[2];\r\n\tvar hrs_12 = convert_hours_to_12hr_time(hrs_24);\r\n\tvar isPM = hrs_24 > 12;\r\n\tvar mode = isPM ? 'PM' : 'AM';\r\n\treturn [leading_zero(hrs_12), ':', min, ' ', mode].join('');\r\n}\r\n","\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_24hr_time (timeString_12hr) {\r\n\tif (/-/.test(timeString_12hr)) return '';\r\n\tvar isPM = timeString_12hr.indexOf('PM') > -1;\r\n\tvar timeResult = /^([0-9]{2})/.exec(timeString_12hr);\r\n\tvar hrs = timeResult ? parseInt(timeResult[1]) : '';\r\n\tvar newHrs;\r\n\tif (hrs === 12) {\r\n\t\tnewHrs = isPM ? 12 : 00;\r\n\t} else {\r\n\t\tnewHrs = isPM ? hrs + 12 : hrs;\r\n\t}\r\n\tvar finalHrs = newHrs === 24 ? 0 : newHrs;\r\n\tvar timeRegEx = /^[0-9]{2}:([0-9]{2}) (AM|PM)/;\r\n\treturn timeString_12hr.replace(timeRegEx, leading_zero(finalHrs)+':$1');\r\n}\r\n","\r\nmodule.exports = function leading_zero (number) {\r\n\tif (isNaN(number)) return number;\r\n\tvar purified = parseInt(number);\r\n\treturn purified < 10 ? '0' + purified : number;\r\n}\r\n","\r\nvar values = require('../helpers/values');\r\n\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar next_segment = require('../selectors/next_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar select_cursor_segment = require('../selectors/select_cursor_segment');\r\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\n\r\nvar reset = require('../setters/reset');\r\nvar manual_number_entry = require('../setters/manual_number_entry');\r\nvar clear_segment = require('../setters/clear_segment');\r\nvar increment_current_segment = require('../setters/increment_current_segment');\r\nvar decrement_current_segment = require('../setters/decrement_current_segment');\r\nvar set_mode = require('../setters/set_mode');\r\nvar switch_times = require('../setters/switch_times');\r\n\r\nvar handle_tab = require('../events/handle_tab');\r\n\r\nvar all_number_keys = require('../static-values/all_number_keys');\r\nvar named_keys = require('../static-values/named_keys');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function bind_events ($input) {\r\n\r\n\tvar prev_value = '';\r\n\r\n\tvar shiftKey = false;\r\n\r\n\tdocument.addEventListener('keydown', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\tdocument.addEventListener('keyup', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\r\n\tif ($input.form) {\r\n\t\t$input.form.addEventListener('submit', function(){\r\n\t\t\tauto_swap($input);\r\n\t\t})\r\n\t}\r\n\r\n\tvar focused_via_click = false;\r\n\r\n\t$input.addEventListener('mousedown', function(){\r\n\t\tfocused_via_click = true;\r\n\t});\r\n\r\n\t// Turns the IE clear button into a reset button\r\n\t$input.addEventListener('mouseup', function(){\r\n\t\tsetTimeout(function(){\r\n\t\t\tif ($input.value === '') reset($input);\r\n\t\t}, 1)\r\n\t});\r\n\r\n\t$input.addEventListener('click', function(e){\r\n\t\tselect_cursor_segment($input);\r\n\t});\r\n\r\n\t$input.addEventListener('blur', function(){\r\n\t\tvar current_value = $input.dataset.value;\r\n\t\tif (current_value !== prev_value) {\r\n\t\t\tprev_value = current_value;\r\n\t\t}\r\n\t\tfocused_via_click = false;\r\n\t});\r\n\r\n\t$input.addEventListener('focus', function(e){\r\n\t\tif (!focused_via_click) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar segment = shiftKey ? 'mode' : 'hrs';\r\n\t\t\tselect_segment($input, segment);\r\n\t\t}\r\n\t\tupdate_a11y($input, [\r\n\t\t\t'initial',\r\n\t\t\t'select'\r\n\t\t])\r\n\t});\r\n\r\n\t$input.addEventListener('keydown', function(e) {\r\n\t\tvar is_enter_key = e.which === 13;\r\n\t\tif (is_enter_key) return true;\r\n\r\n\t\tvar is_number_key = all_number_keys.indexOf(e.which) > -1;\r\n\t\tvar is_named_key = values(named_keys).indexOf(e.which) > -1;\r\n\t\tvar is_arrow_key = [named_keys.ArrowDown, named_keys.ArrowRight, named_keys.ArrowUp, named_keys.ArrowLeft].indexOf(e.which) > -1;\r\n\t\tvar is_mode_key = [named_keys.a, named_keys.p].indexOf(e.which) > -1;\r\n\t\tvar is_delete_key = [named_keys.Delete, named_keys.Backspace].indexOf(e.which) > -1;\r\n\r\n\t\tif (!is_named_key || is_arrow_key || is_number_key || is_mode_key || is_delete_key) { e.preventDefault(); }\r\n\r\n\t\tif (is_number_key) {\r\n\t\t\tmanual_number_entry($input, e.which);\r\n\t\t}\r\n\r\n\t\tif (is_delete_key) {\r\n\t\t\tvar segment = get_current_segment($input);\r\n\t\t\tclear_segment($input, segment);\r\n\t\t}\r\n\r\n\t\tswitch (e.which) {\r\n\t\t\tcase named_keys.ArrowRight: next_segment($input); break;\r\n\t\t\tcase named_keys.ArrowLeft: prev_segment($input); break;\r\n\t\t\tcase named_keys.ArrowUp: increment_current_segment($input); break;\r\n\t\t\tcase named_keys.ArrowDown: decrement_current_segment($input); break;\r\n\t\t\tcase named_keys.Escape: reset($input); break;\r\n\t\t\tcase named_keys.a: set_mode($input, 'AM'); break;\r\n\t\t\tcase named_keys.p: set_mode($input, 'PM'); break;\r\n\t\t\tcase named_keys.Tab: handle_tab($input, e); break;\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction auto_swap($input) {\r\n\tif ($input.polyfill.autoSwap) {\r\n\t\tswitch_times($input, 24);\r\n\t\tsetTimeout(function(){\r\n\t\t\tswitch_times($input, 12);\r\n\t\t}, 1);\r\n\t}\r\n}\r\n","\r\nmodule.exports = function create_event(eventName){\r\n\tvar event = document.createEvent('Event');\r\n\tevent.initEvent(eventName, true, true);\r\n\treturn event;\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nmodule.exports = function handle_tab($input, e) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tvar backwards_and_first = e.shiftKey && current_segment === 'hrs';\r\n\tvar forwards_and_last = !e.shiftKey && current_segment === 'mode';\r\n\r\n\tif (!backwards_and_first && !forwards_and_last) {\r\n\t\te.preventDefault();\r\n\t\tif (e.shiftKey) {\r\n\t\t\tprev_segment($input);\r\n\t\t} else {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar trigger_event = require('./trigger_event');\r\n\r\n// It seems that oninput and onchange are treated the same way by browsers :/\r\nmodule.exports = function trigger_both_events($input) {\r\n\t// the event only ever fires if there is a full valid value available\r\n\ttrigger_event($input, 'input');\r\n\ttrigger_event($input,'change');\r\n}\r\n","\r\nvar create_event = require('./create_event');\r\n\r\nvar inputEvent = create_event('input');\r\nvar changeEvent = create_event('change');\r\n\r\nmodule.exports = function trigger_event($input, eventName) {\r\n\tvar event = {\r\n\t\tinput: inputEvent,\r\n\t\tchange: changeEvent,\r\n\t}[eventName];\r\n\r\n\tif (can_trigger_change($input)) {\r\n\t\t$input.dispatchEvent(event);\r\n\t}\r\n}\r\n\r\n// Browsers only send out input and change events if the time element has a full valid value\r\nfunction can_trigger_change ($input) {\r\n\treturn !/--/.test($input.value);\r\n}\r\n","// selector is optional, it allows for an early exit\r\nmodule.exports = function ($input, selectorString) {\r\n\tvar $elem = $input;\r\n\r\n\t// https://stackoverflow.com/a/8729274/1611058\r\n\tvar ancestors = [];\r\n\twhile ($elem) {\r\n\t\tancestors.push($elem);\r\n\t\tvar matchesSelector = $elem.msMatchesSelector ?\r\n\t\t\t$elem.msMatchesSelector(selectorString) :\r\n\t\t\t$elem.matches(selectorString);\r\n\t\tif (matchesSelector) {\r\n\t\t\treturn ancestors;\r\n\t\t}\r\n\t\t$elem = $elem.parentElement;\r\n\t}\r\n\r\n\treturn ancestors;\r\n}\r\n","\r\nvar ranges = require('../static-values/ranges');\r\nvar get_selected_range = require('./get_selected_range');\r\n\r\nmodule.exports = function get_current_segment ($input) {\r\n\tvar selection = get_selected_range($input);\r\n\tfor (var segment in ranges) {\r\n\t\tvar range = ranges[segment];\r\n\t\tvar aboveMin = range.start <= selection.start;\r\n\t\tvar belowMax = range.end >= selection.end;\r\n\t\tif (aboveMin && belowMax) {\r\n\t\t\treturn segment;\r\n\t\t}\r\n\t}\r\n\treturn 'hrs';\r\n}\r\n","\r\nvar get_ancestors = require('./get_ancestors');\r\n\r\nmodule.exports = function get_label ($input) {\r\n\r\n\tvar labelText =\r\n\t\taria_labelledby($input) ||\r\n\t\taria_label($input) ||\r\n\t\tfor_attribute($input) ||\r\n\t\tlabel_wrapper_element($input) ||\r\n\t\ttitle_attribute($input);\r\n\r\n\tif (labelText) return labelText;\r\n\r\n\tconsole.error('Label text for input not found.', $input);\r\n\tthrow new Error('Cannot polyfill time input due to a missing label.');\r\n}\r\n\r\nfunction aria_labelledby($input){\r\n\tvar ariaLabelByID = $input.getAttribute('aria-labelledby');\r\n\tif (ariaLabelByID) {\r\n\t\tvar $ariaLabelBy = document.getElementById(ariaLabelByID);\r\n\t\tif ($ariaLabelBy) return $ariaLabelBy.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction aria_label($input){\r\n\tvar ariaLabel = $input.getAttribute('aria-label');\r\n\tif (ariaLabel) return ariaLabel;\r\n\treturn false;\r\n}\r\n\r\nfunction for_attribute($input){\r\n\tif ($input.id) {\r\n\t\tvar $forLabel = document.querySelector('label[for=\"'+$input.id+'\"]');\r\n\t\tif ($forLabel) return $forLabel.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction label_wrapper_element($input){\r\n\tvar ancestors = get_ancestors($input, 'label');\r\n\tvar $parentLabel = ancestors[ancestors.length - 1];\r\n\tif ($parentLabel.nodeName == 'LABEL') return $parentLabel.textContent;\r\n\treturn false\r\n}\r\n\r\nfunction title_attribute($input){\r\n\tvar titleLabel = $input.getAttribute('title');\r\n\tif (titleLabel) return titleLabel;\r\n\treturn false\r\n}\r\n","\r\nmodule.exports = function get_selected_range ($input) {\r\n\treturn { start: $input.selectionStart, end: $input.selectionEnd };\r\n}\r\n","\r\nvar convert_number = require('../converters/convert_number');\r\n\r\nmodule.exports = function get_values ($input, timeString) {\r\n\tvar value = timeString ? timeString : $input.value;\r\n\tvar regEx = /([0-9-]{1,2})\\:([0-9-]{1,2})\\s?(AM|PM|\\-\\-)?/;\r\n\tvar result = regEx.exec(value);\r\n\r\n\treturn {\r\n\t\thrs: convert_number(result[1]),\r\n\t\tmin: convert_number(result[2]),\r\n\t\tmode: result[3],\r\n\t}\r\n}\r\n","\r\nvar manual_entry_log = [];\r\n\r\nfunction clear () {\r\n\tmanual_entry_log = [];\r\n}\r\n\r\nfunction add (entry) {\r\n\tmanual_entry_log.push(entry);\r\n}\r\n\r\nfunction items(){\r\n\treturn manual_entry_log;\r\n}\r\n\r\nmodule.exports = {\r\n\titems: items,\r\n\tclear: clear,\r\n\tadd: add,\r\n}\r\n","\r\nmodule.exports = function prevent_user_select ($input) {\r\n\t$input.style.msUserSelect = \"none\";\r\n\t$input.style.mozUserSelect = \"none\";\r\n\t$input.style.webkitUserSelect = \"none\";\r\n\t$input.style.userSelect = \"none\";\r\n}\r\n","\r\n// IE11 doesn't support Object.values()\r\nmodule.exports = function values (obj) {\r\n\tvar key_values = [];\r\n\tfor (var key in obj) {\r\n\t\tkey_values.push(obj[key]);\r\n\t}\r\n\treturn key_values;\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function next_segment ($input) {\r\n\ttraverse($input, 'next');\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function prev_segment ($input) {\r\n\ttraverse($input, 'prev');\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('./select_segment');\r\n\r\nmodule.exports = function select_cursor_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tselect_segment($input, current_segment);\r\n}\r\n","\r\nmodule.exports = function select_segment ($input, segment) {\r\n\r\n\tset_input_type();\r\n\r\n\tvar actions = {\r\n\t\thrs: select(0, 2),\r\n\t\tmin: select(3, 5),\r\n\t\tmode: select(6, 8),\r\n\t};\r\n\r\n\tactions[segment]($input);\r\n\r\n\tfunction set_input_type() {\r\n\t\tvar type = segment === 'mode' ? 'text' : 'tel';\r\n\t\t$input.setAttribute('type', type);\r\n\t}\r\n\r\n\tfunction select (start, end) {\r\n\t\treturn function () {\r\n\t\t\t$input.setSelectionRange(start, end);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar segments = require('../static-values/segments');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function traverse ($input, direction) {\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tvar modifier = direction === 'next' ? 1 : -1;\r\n\tvar next_segment_index = segments.indexOf(segment) + modifier;\r\n\r\n\tvar next_segment = {\r\n\t\tnext: segments[next_segment_index] || 'mode',\r\n\t\tprev: next_segment_index < 0 ? 'hrs' : segments[next_segment_index],\r\n\t}[direction];\r\n\r\n\tselect_segment($input, next_segment);\r\n\tmanual_entry_log.clear();\r\n\tupdate_a11y($input, ['select'])\r\n}\r\n","\r\n// I need to keep this separate from reset so that\r\n// I can reset without attracting focus\r\n\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function apply_default ($input) {\r\n\t$input.value = '--:-- --';\r\n\tset_data_attribute($input, '');\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar set_segment = require('./set_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function clear_segment ($input, segment) {\r\n\tset_segment($input, segment, '--');\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function decrement ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'PM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'down');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar decrement = require('../setters/decrement');\r\n\r\nmodule.exports = function decrement_current_segment ($input){\r\n\tvar current_segment = get_current_segment($input);\r\n\tdecrement($input, current_segment);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function increment ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'AM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'up');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar increment = require('../setters/increment');\r\n\r\nmodule.exports = function increment_current_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tincrement($input, current_segment);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar sorted_number_keys = require('../static-values/sorted_number_keys');\r\n\r\nmodule.exports = function manual_number_entry($input, key) {\r\n\tvar key_value = sorted_number_keys[key];\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tif (segment !== 'mode') {\r\n\t\tvar entry_count = manual_entry_log.items().length;\r\n\r\n\t\tvar upper_limits = {\r\n\t\t\thrs: [1,2],\r\n\t\t\tmin: [5,9],\r\n\t\t}\r\n\t\tvar limit = upper_limits[segment][entry_count];\r\n\r\n\t\tif (entry_count < 2) {\r\n\t\t\tmanual_entry_log.add(key_value);\r\n\t\t}\r\n\r\n\t\tvar full_limit = parseInt(upper_limits[segment].join(''));\r\n\t\tvar full_entry = parseInt(manual_entry_log.items().join(''));\r\n\r\n\t\tif (full_limit >= full_entry) {\r\n\t\t\tset_segment($input, segment, full_entry);\r\n\t\t}\r\n\r\n\t\tvar at_limit = key_value > limit || manual_entry_log.items().length === 2;\r\n\r\n\t\tif (at_limit) {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar convert_hours_to_12hr_time = require('../converters/convert_hours_to_12hr_time');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function nudge_time_segment ($input, segment, direction) {\r\n\tvar current_values = get_values($input);\r\n\tvar time;\r\n\r\n\tvar modifier = direction === 'up' ? 1 : -1;\r\n\r\n\tif (current_values[segment] === '--') {\r\n\t\tvar current_time = new Date();\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_time.getHours()),\r\n\t\t\tmin: current_time.getMinutes(),\r\n\t\t}\r\n\t} else {\r\n\t\tvar minutes = {\r\n\t\t\tup : current_values.min < 59 ? current_values.min + modifier : 0,\r\n\t\t\tdown : current_values.min === 0 ? 59 : current_values.min + modifier,\r\n\t\t}\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_values.hrs + modifier),\r\n\t\t\tmin: minutes[direction],\r\n\t\t}\r\n\t}\r\n\r\n\tset_segment($input, segment, leading_zero(time[segment]) );\r\n}\r\n","\r\nvar apply_default = require('./apply_default');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nmodule.exports = function reset ($input) {\r\n\tapply_default($input);\r\n\tselect_segment($input, 'hrs');\r\n}\r\n","\r\nvar convert_to_24hr_time = require('../converters/convert_to_24hr_time')\r\n\r\nmodule.exports = function set_data_attribute($input, timeString_12hr){\r\n\tvar filteredString = timeString_12hr.indexOf('-') > -1 ? '' : timeString_12hr;\r\n\tvar time24hr = convert_to_24hr_time(filteredString);\r\n\t$input.setAttribute('data-value', time24hr);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function set_mode ($input, type) {\r\n\tvar segment = get_current_segment($input);\r\n\tif (segment === 'mode') {\r\n\t\tset_segment($input, segment, type);\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar select_segment = require('../selectors/select_segment');\r\nvar set_data_attribute = require('./set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function set_segment ($input, segment, value) {\r\n\tvar values = get_values($input);\r\n\tvalues[segment] = value;\r\n\tvar newInputVal = [\r\n\t\tleading_zero(values.hrs),':',\r\n\t\tleading_zero(values.min),' ',\r\n\t\tvalues.mode\r\n\t].join('');\r\n\t$input.value = newInputVal;\r\n\tselect_segment($input, segment);\r\n\tset_data_attribute($input, newInputVal);\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar convert_to_12hr_time = require('../converters/convert_to_12hr_time');\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\n\r\nmodule.exports = function set_time($input, time_string_24hr) {\r\n\tvar twelveHr = convert_to_12hr_time(time_string_24hr);\r\n\t$input.value = twelveHr;\r\n\tset_data_attribute($input, time_string_24hr);\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function switch_mode ($input, default_mode) {\r\n\tdefault_mode = default_mode || 'AM';\r\n\tvar current_mode = get_values($input).mode;\r\n\tvar new_mode = {\r\n\t\t'--' : default_mode,\r\n\t\t'AM' : 'PM',\r\n\t\t'PM' : 'AM',\r\n\t}[current_mode];\r\n\tset_segment($input, 'mode', new_mode);\r\n}\r\n","\r\nvar switch_to_data_value = require('./switch_to_data_value');\r\nvar set_time = require('./set_time');\r\n\r\nmodule.exports = function switch_times ($input, format) {\r\n\tvar is12hr = /\\s/.test($input.value);\r\n\r\n\tif (format != 12 && format != 24) {\r\n\t\tformat = is12hr ? 24 : 12;\r\n\t}\r\n\r\n\tvar actions = {\r\n\t\t12: function(){\r\n\t\t\tif (!is12hr) {\r\n\t\t\t\tset_time($input, $input.dataset.value);\r\n\t\t\t}\r\n\t\t},\r\n\t\t24: function(){\r\n\t\t\tif (is12hr) {\r\n\t\t\t\tswitch_to_data_value($input);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tactions[format]();\r\n}\r\n","\r\nmodule.exports = function($input) {\r\n\tvar replacementVal = $input.dataset.value;\r\n\t$input.value = replacementVal;\r\n}\r\n","\r\nvar set_time = require('../setters/set_time');\r\n\r\nmodule.exports = function update_time($input) {\r\n\tset_time($input, $input.value);\r\n\treturn $input;\r\n}\r\n","var all_number_keys = [\r\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\r\n 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\r\n 96, 97, 98, 99,100,101,102,103,104,105\r\n];\r\n\r\nmodule.exports = all_number_keys;\r\n","var named_keys = {\r\n\tArrowDown: 40,\r\n\tArrowRight: 39,\r\n\tArrowUp: 38,\r\n\tArrowLeft: 37,\r\n\tBackspace: 8,\r\n\tDelete: 46,\r\n\tTab: 9,\r\n\tShift: 16,\r\n\tEscape: 27,\r\n\ta: 65,\r\n\tp: 80,\r\n}\r\n\r\nmodule.exports = named_keys;\r\n","\r\nvar ranges = {\r\n\thrs : { start: 0, end: 2 },\r\n\tmin : { start: 3, end: 5 },\r\n\tmode : { start: 6, end: 8 },\r\n}\r\n\r\nmodule.exports = ranges;\r\n","\r\nvar ranges = require('./ranges');\r\n\r\nvar segments = Object.keys(ranges);\r\n\r\nmodule.exports = segments;\r\n","\r\nvar all_number_keys = require('./all_number_keys');\r\n\r\nvar sorted_number_keys = {};\r\n// sorted_number_keys = { 48: 0, 49: 1, 96: 0, 97: 1, ... };\r\nall_number_keys.forEach(function(key, index) {\r\n\tvar number_val = index > 9 ? index - 10 : index;\r\n\tsorted_number_keys[key] = number_val;\r\n});\r\n\r\nmodule.exports = sorted_number_keys;\r\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","core/accessibility/create_a11y_block.js","index.js","core/accessibility/update_a11y.js","core/converters/convert_hours_to_12hr_time.js","core/converters/convert_number.js","core/converters/convert_to_12hr_time.js","core/converters/convert_to_24hr_time.js","core/converters/leading_zero.js","core/events/bind_events.js","core/events/create_event.js","core/events/handle_tab.js","core/events/trigger_both_events.js","core/events/trigger_event.js","core/getters/get_ancestors.js","core/getters/get_current_segment.js","core/getters/get_label.js","core/getters/get_selected_range.js","core/getters/get_values.js","core/helpers/manual_entry_log.js","core/helpers/values.js","core/selectors/next_segment.js","core/selectors/prev_segment.js","core/selectors/select_cursor_segment.js","core/selectors/select_segment.js","core/selectors/traverse.js","core/setters/apply_default.js","core/setters/clear_segment.js","core/setters/decrement.js","core/setters/decrement_current_segment.js","core/setters/increment.js","core/setters/increment_current_segment.js","core/setters/manual_number_entry.js","core/setters/nudge_time_segment.js","core/setters/reset.js","core/setters/set_data_attribute.js","core/setters/set_mode.js","core/setters/set_segment.js","core/setters/set_time.js","core/setters/switch_mode.js","core/setters/switch_times.js","core/setters/switch_to_data_value.js","core/setters/update_time.js","core/static-values/all_number_keys.js","core/static-values/named_keys.js","core/static-values/ranges.js","core/static-values/segments.js","core/static-values/sorted_number_keys.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","$block","document","createElement","setAttribute","classList","add","querySelector","appendChild","2","get_current_segment","get_values","$input","announcementArray","setTimeout","current_segment","values","value","finalValue","segmentName","hrs","min","mode","announcements","initial","select","update","textArray","map","providedString","fullValue","replace","html","join","polyfill","label","$a11y","innerHTML","../getters/get_current_segment","../getters/get_values","3","hours","4","number","isNaN","parseInt","5","convert_number","convert_hours_to_12hr_time","leading_zero","timeString_24hr","twentyFour_regex","result","exec","hrs_24","hrs_12","isPM","./convert_hours_to_12hr_time","./convert_number","./leading_zero","6","timeString_12hr","test","newHrs","indexOf","timeResult","finalHrs","timeRegEx","7","purified","8","auto_swap","autoSwap","switch_times","select_segment","next_segment","prev_segment","select_cursor_segment","reset","manual_number_entry","clear_segment","increment_current_segment","decrement_current_segment","set_mode","handle_tab","all_number_keys","named_keys","update_a11y","prev_value","shiftKey","addEventListener","form","focused_via_click","current_value","dataset","preventDefault","segment","is_enter_key","which","is_number_key","is_named_key","is_arrow_key","ArrowDown","ArrowRight","ArrowUp","ArrowLeft","is_mode_key","is_delete_key","Delete","Backspace","Escape","Tab","../accessibility/update_a11y","../events/handle_tab","../helpers/values","../selectors/next_segment","../selectors/prev_segment","../selectors/select_cursor_segment","../selectors/select_segment","../setters/clear_segment","../setters/decrement_current_segment","../setters/increment_current_segment","../setters/manual_number_entry","../setters/reset","../setters/set_mode","../setters/switch_times","../static-values/all_number_keys","../static-values/named_keys","9","eventName","event","createEvent","initEvent","10","backwards_and_first","forwards_and_last","11","trigger_event","./trigger_event","12","can_trigger_change","create_event","inputEvent","changeEvent","input","change","dispatchEvent","./create_event","13","selectorString","$elem","ancestors","push","matchesSelector","msMatchesSelector","matches","parentElement","14","ranges","get_selected_range","selection","range","aboveMin","start","belowMax","end","../static-values/ranges","./get_selected_range","15","aria_labelledby","ariaLabelByID","getAttribute","$ariaLabelBy","getElementById","textContent","aria_label","ariaLabel","for_attribute","id","$forLabel","label_wrapper_element","get_ancestors","$parentLabel","nodeName","title_attribute","titleLabel","labelText","console","error","./get_ancestors","16","selectionStart","selectionEnd","17","timeString","regEx","../converters/convert_number","18","clear","manual_entry_log","entry","items","19","obj","key_values","key","20","traverse","./traverse","21","22","./select_segment","23","set_input_type","type","setSelectionRange","actions","24","segments","direction","modifier","next_segment_index","next","prev","../helpers/manual_entry_log","../static-values/segments","25","set_data_attribute","trigger_both_events","../events/trigger_both_events","../setters/set_data_attribute","26","set_segment","./set_segment","27","switch_mode","nudge_time_segment","./nudge_time_segment","./switch_mode","28","decrement","../setters/decrement","29","30","increment","../setters/increment","31","sorted_number_keys","key_value","entry_count","upper_limits","limit","full_limit","full_entry","at_limit","../static-values/sorted_number_keys","32","time","current_values","current_time","Date","getHours","getMinutes","minutes","up","down","../converters/convert_hours_to_12hr_time","../converters/leading_zero","33","apply_default","./apply_default","34","convert_to_24hr_time","filteredString","time24hr","../converters/convert_to_24hr_time","35","36","newInputVal","./set_data_attribute","37","convert_to_12hr_time","time_string_24hr","twelveHr","../converters/convert_to_12hr_time","38","default_mode","current_mode","new_mode","--","AM","PM","39","switch_to_data_value","set_time","format","is12hr","./set_time","./switch_to_data_value","40","replacementVal","41","../setters/set_time","42","43","Shift","44","45","Object","keys","./ranges","46","forEach","index","number_val","./all_number_keys","47","TimePolyfill","accessibility_block_created","create_a11y_block","get_label","update_time","swap","forcedFormat","bind_events","window","./core/accessibility/create_a11y_block","./core/events/bind_events","./core/getters/get_label","./core/setters/apply_default","./core/setters/set_data_attribute","./core/setters/switch_times","./core/setters/update_time"],"mappings":";;;;;;;;CAAA,WAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAA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A9J,GAAAJ,QAAA8N,I5Cy0BG4F,WAAW,KAAKC,IAAI,SAASjU,EAAQU,EAAOJ,G6C70B/C,GAAAyF,GAAA/F,EAAA,qBAEAiQ,IAEAlK,GAAAmO,QAAA,SAAA3G,EAAA4G,GACA,GAAAC,GAAAD,EAAA,EAAAA,EAAA,GAAAA,CACAlE,GAAA1C,GAAA6G,IAGA1T,EAAAJ,QAAA2P,I7Ci1BGoE,oBAAoB,KAAKC,IAAI,SAAStU,EAAQU,EAAOJ,GA90BxD,QAAAiU,GAAAjT,GAEAA,EAAAR,aAAA,eAAA,OAGAQ,EAAAR,aAAA,eAAA,GAEA0T,IACA1R,EAAA2R,IACAD,GAAA,EAGA,IAAA3R,GAAA6R,EAAApT,EAEAA,GAAAsB,UACAE,MAAAA,EACAD,MAAAA,EACAqC,UAAA,EACA9C,OAAA,WACAuS,EAAArT,IAEAsT,KAAA,SAAAC,GACA1P,EAAA7D,EAAAuT,KAIA,KAAAvT,EAAAK,OAAA,KAAA6C,KAAAlD,EAAAK,QACA4P,EAAAjQ,GACAuN,EAAAvN,EAAA,MAEAqT,EAAArT,GACAuN,EAAAvN,EAAAA,EAAAK,QAGAmT,EAAAxT,GA9CA,GAUAwB,GAVAyO,EAAAvR,EAAA,gCACA2U,EAAA3U,EAAA,8BACA6O,EAAA7O,EAAA,qCACA8U,EAAA9U,EAAA,6BACAmF,EAAAnF,EAAA,+BACA0U,EAAA1U,EAAA,4BAEAyU,EAAAzU,EAAA,0CAEAwU,GAAA,CAwCAO,UAAAA,OAAAR,aAAAA,GACA7T,IAAAA,EAAAJ,QAAAiU,KA81BGS,yCAAyC,EAAEC,4BAA4B,EAAEC,2BAA2B,GAAGC,+BAA+B,GAAGC,oCAAoC,GAAGC,8BAA8B,GAAGC,6BAA6B,UAAU","file":"time-input-polyfill.min.js","sourcesContent":["(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') + '
';\r\n\t\thtml = html.replace(/\\$label/g, $input.polyfill.label);\r\n\t\thtml = html.replace(/\\$segmentName/g, segmentName);\r\n\t\thtml = html.replace(/\\$segmentValue/g, finalValue);\r\n\t\thtml = html.replace(/\\$fullValue/g, fullValue);\r\n\r\n\t\t$input.polyfill.$a11y.innerHTML = html;\r\n\t}, 1);\r\n}\r\n","\r\nmodule.exports = function convert_hours_to_12hr_time (hours) {\r\n\treturn hours <= 12 ? hours === 0 ? 12 : hours : hours - 12;\r\n}\r\n","\r\nmodule.exports = function convert_number (number) {\r\n\treturn isNaN(number) ? number : parseInt(number);\r\n}\r\n","\r\nvar convert_number = require('./convert_number');\r\nvar convert_hours_to_12hr_time = require('./convert_hours_to_12hr_time');\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_12hr_time (timeString_24hr) {\r\n\tif (timeString_24hr === '') return '--:-- --';\r\n\tvar twentyFour_regex = /([0-9]{2})\\:([0-9]{2})/;\r\n\tvar result = twentyFour_regex.exec(timeString_24hr);\r\n\tvar hrs_24 = convert_number(result[1]);\r\n\tvar min = result[2];\r\n\tvar hrs_12 = convert_hours_to_12hr_time(hrs_24);\r\n\tvar isPM = hrs_24 > 12;\r\n\tvar mode = isPM ? 'PM' : 'AM';\r\n\treturn [leading_zero(hrs_12), ':', min, ' ', mode].join('');\r\n}\r\n","\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_24hr_time (timeString_12hr) {\r\n\tif (/-/.test(timeString_12hr)) return '';\r\n\tvar isPM = timeString_12hr.indexOf('PM') > -1;\r\n\tvar timeResult = /^([0-9]{2})/.exec(timeString_12hr);\r\n\tvar hrs = timeResult ? parseInt(timeResult[1]) : '';\r\n\tvar newHrs;\r\n\tif (hrs === 12) {\r\n\t\tnewHrs = isPM ? 12 : 00;\r\n\t} else {\r\n\t\tnewHrs = isPM ? hrs + 12 : hrs;\r\n\t}\r\n\tvar finalHrs = newHrs === 24 ? 0 : newHrs;\r\n\tvar timeRegEx = /^[0-9]{2}:([0-9]{2}) (AM|PM)/;\r\n\treturn timeString_12hr.replace(timeRegEx, leading_zero(finalHrs)+':$1');\r\n}\r\n","\r\nmodule.exports = function leading_zero (number) {\r\n\tif (isNaN(number)) return number;\r\n\tvar purified = parseInt(number);\r\n\treturn purified < 10 ? '0' + purified : number;\r\n}\r\n","\r\nvar values = require('../helpers/values');\r\n\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar next_segment = require('../selectors/next_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar select_cursor_segment = require('../selectors/select_cursor_segment');\r\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\n\r\nvar reset = require('../setters/reset');\r\nvar manual_number_entry = require('../setters/manual_number_entry');\r\nvar clear_segment = require('../setters/clear_segment');\r\nvar increment_current_segment = require('../setters/increment_current_segment');\r\nvar decrement_current_segment = require('../setters/decrement_current_segment');\r\nvar set_mode = require('../setters/set_mode');\r\nvar switch_times = require('../setters/switch_times');\r\n\r\nvar handle_tab = require('../events/handle_tab');\r\n\r\nvar all_number_keys = require('../static-values/all_number_keys');\r\nvar named_keys = require('../static-values/named_keys');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function bind_events ($input) {\r\n\r\n\tvar prev_value = '';\r\n\r\n\tvar shiftKey = false;\r\n\r\n\tdocument.addEventListener('keydown', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\tdocument.addEventListener('keyup', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\r\n\tif ($input.form) {\r\n\t\t$input.form.addEventListener('submit', function(){\r\n\t\t\tauto_swap($input);\r\n\t\t})\r\n\t}\r\n\r\n\tvar focused_via_click = false;\r\n\r\n\t$input.addEventListener('mousedown', function(){\r\n\t\tfocused_via_click = true;\r\n\t});\r\n\r\n\t// Turns the IE clear button into a reset button\r\n\t$input.addEventListener('mouseup', function(){\r\n\t\tsetTimeout(function(){\r\n\t\t\tif ($input.value === '') reset($input);\r\n\t\t}, 1)\r\n\t});\r\n\r\n\t$input.addEventListener('click', function(e){\r\n\t\tselect_cursor_segment($input);\r\n\t});\r\n\r\n\t$input.addEventListener('blur', function(){\r\n\t\tvar current_value = $input.dataset.value;\r\n\t\tif (current_value !== prev_value) {\r\n\t\t\tprev_value = current_value;\r\n\t\t}\r\n\t\tfocused_via_click = false;\r\n\t});\r\n\r\n\t$input.addEventListener('focus', function(e){\r\n\t\tif (!focused_via_click) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar segment = shiftKey ? 'mode' : 'hrs';\r\n\t\t\tselect_segment($input, segment);\r\n\t\t}\r\n\t\tupdate_a11y($input, [\r\n\t\t\t'initial',\r\n\t\t\t'select'\r\n\t\t])\r\n\t});\r\n\r\n\t$input.addEventListener('keydown', function(e) {\r\n\t\tvar is_enter_key = e.which === 13;\r\n\t\tif (is_enter_key) return true;\r\n\r\n\t\tvar is_number_key = all_number_keys.indexOf(e.which) > -1;\r\n\t\tvar is_named_key = values(named_keys).indexOf(e.which) > -1;\r\n\t\tvar is_arrow_key = [named_keys.ArrowDown, named_keys.ArrowRight, named_keys.ArrowUp, named_keys.ArrowLeft].indexOf(e.which) > -1;\r\n\t\tvar is_mode_key = [named_keys.a, named_keys.p].indexOf(e.which) > -1;\r\n\t\tvar is_delete_key = [named_keys.Delete, named_keys.Backspace].indexOf(e.which) > -1;\r\n\r\n\t\tif (!is_named_key || is_arrow_key || is_number_key || is_mode_key || is_delete_key) { e.preventDefault(); }\r\n\r\n\t\tif (is_number_key) {\r\n\t\t\tmanual_number_entry($input, e.which);\r\n\t\t}\r\n\r\n\t\tif (is_delete_key) {\r\n\t\t\tvar segment = get_current_segment($input);\r\n\t\t\tclear_segment($input, segment);\r\n\t\t}\r\n\r\n\t\tswitch (e.which) {\r\n\t\t\tcase named_keys.ArrowRight: next_segment($input); break;\r\n\t\t\tcase named_keys.ArrowLeft: prev_segment($input); break;\r\n\t\t\tcase named_keys.ArrowUp: increment_current_segment($input); break;\r\n\t\t\tcase named_keys.ArrowDown: decrement_current_segment($input); break;\r\n\t\t\tcase named_keys.Escape: reset($input); break;\r\n\t\t\tcase named_keys.a: set_mode($input, 'AM'); break;\r\n\t\t\tcase named_keys.p: set_mode($input, 'PM'); break;\r\n\t\t\tcase named_keys.Tab: handle_tab($input, e); break;\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction auto_swap($input) {\r\n\tif ($input.polyfill.autoSwap) {\r\n\t\tswitch_times($input, 24);\r\n\t\tsetTimeout(function(){\r\n\t\t\tswitch_times($input, 12);\r\n\t\t}, 1);\r\n\t}\r\n}\r\n","\r\nmodule.exports = function create_event(eventName){\r\n\tvar event = document.createEvent('Event');\r\n\tevent.initEvent(eventName, true, true);\r\n\treturn event;\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nmodule.exports = function handle_tab($input, e) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tvar backwards_and_first = e.shiftKey && current_segment === 'hrs';\r\n\tvar forwards_and_last = !e.shiftKey && current_segment === 'mode';\r\n\r\n\tif (!backwards_and_first && !forwards_and_last) {\r\n\t\te.preventDefault();\r\n\t\tif (e.shiftKey) {\r\n\t\t\tprev_segment($input);\r\n\t\t} else {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar trigger_event = require('./trigger_event');\r\n\r\n// It seems that oninput and onchange are treated the same way by browsers :/\r\nmodule.exports = function trigger_both_events($input) {\r\n\t// the event only ever fires if there is a full valid value available\r\n\ttrigger_event($input, 'input');\r\n\ttrigger_event($input,'change');\r\n}\r\n","\r\nvar create_event = require('./create_event');\r\n\r\nvar inputEvent = create_event('input');\r\nvar changeEvent = create_event('change');\r\n\r\nmodule.exports = function trigger_event($input, eventName) {\r\n\tvar event = {\r\n\t\tinput: inputEvent,\r\n\t\tchange: changeEvent,\r\n\t}[eventName];\r\n\r\n\tif (can_trigger_change($input)) {\r\n\t\t$input.dispatchEvent(event);\r\n\t}\r\n}\r\n\r\n// Browsers only send out input and change events if the time element has a full valid value\r\nfunction can_trigger_change ($input) {\r\n\treturn !/--/.test($input.value);\r\n}\r\n","// selector is optional, it allows for an early exit\r\nmodule.exports = function ($input, selectorString) {\r\n\tvar $elem = $input;\r\n\r\n\t// https://stackoverflow.com/a/8729274/1611058\r\n\tvar ancestors = [];\r\n\twhile ($elem) {\r\n\t\tancestors.push($elem);\r\n\t\tvar matchesSelector = $elem.msMatchesSelector ?\r\n\t\t\t$elem.msMatchesSelector(selectorString) :\r\n\t\t\t$elem.matches(selectorString);\r\n\t\tif (matchesSelector) {\r\n\t\t\treturn ancestors;\r\n\t\t}\r\n\t\t$elem = $elem.parentElement;\r\n\t}\r\n\r\n\treturn ancestors;\r\n}\r\n","\r\nvar ranges = require('../static-values/ranges');\r\nvar get_selected_range = require('./get_selected_range');\r\n\r\nmodule.exports = function get_current_segment ($input) {\r\n\tvar selection = get_selected_range($input);\r\n\tfor (var segment in ranges) {\r\n\t\tvar range = ranges[segment];\r\n\t\tvar aboveMin = range.start <= selection.start;\r\n\t\tvar belowMax = range.end >= selection.end;\r\n\t\tif (aboveMin && belowMax) {\r\n\t\t\treturn segment;\r\n\t\t}\r\n\t}\r\n\treturn 'hrs';\r\n}\r\n","\r\nvar get_ancestors = require('./get_ancestors');\r\n\r\nmodule.exports = function get_label ($input) {\r\n\r\n\tvar labelText =\r\n\t\taria_labelledby($input) ||\r\n\t\taria_label($input) ||\r\n\t\tfor_attribute($input) ||\r\n\t\tlabel_wrapper_element($input) ||\r\n\t\ttitle_attribute($input);\r\n\r\n\tif (labelText) return labelText;\r\n\r\n\tconsole.error('Label text for input not found.', $input);\r\n\tthrow new Error('Cannot polyfill time input due to a missing label.');\r\n}\r\n\r\nfunction aria_labelledby($input){\r\n\tvar ariaLabelByID = $input.getAttribute('aria-labelledby');\r\n\tif (ariaLabelByID) {\r\n\t\tvar $ariaLabelBy = document.getElementById(ariaLabelByID);\r\n\t\tif ($ariaLabelBy) return $ariaLabelBy.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction aria_label($input){\r\n\tvar ariaLabel = $input.getAttribute('aria-label');\r\n\tif (ariaLabel) return ariaLabel;\r\n\treturn false;\r\n}\r\n\r\nfunction for_attribute($input){\r\n\tif ($input.id) {\r\n\t\tvar $forLabel = document.querySelector('label[for=\"'+$input.id+'\"]');\r\n\t\tif ($forLabel) return $forLabel.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction label_wrapper_element($input){\r\n\tvar ancestors = get_ancestors($input, 'label');\r\n\tvar $parentLabel = ancestors[ancestors.length - 1];\r\n\tif ($parentLabel.nodeName == 'LABEL') return $parentLabel.textContent;\r\n\treturn false\r\n}\r\n\r\nfunction title_attribute($input){\r\n\tvar titleLabel = $input.getAttribute('title');\r\n\tif (titleLabel) return titleLabel;\r\n\treturn false\r\n}\r\n","\r\nmodule.exports = function get_selected_range ($input) {\r\n\treturn { start: $input.selectionStart, end: $input.selectionEnd };\r\n}\r\n","\r\nvar convert_number = require('../converters/convert_number');\r\n\r\nmodule.exports = function get_values ($input, timeString) {\r\n\tvar value = timeString ? timeString : $input.value;\r\n\tvar regEx = /([0-9-]{1,2})\\:([0-9-]{1,2})\\s?(AM|PM|\\-\\-)?/;\r\n\tvar result = regEx.exec(value);\r\n\r\n\treturn {\r\n\t\thrs: convert_number(result[1]),\r\n\t\tmin: convert_number(result[2]),\r\n\t\tmode: result[3],\r\n\t}\r\n}\r\n","\r\nvar manual_entry_log = [];\r\n\r\nfunction clear () {\r\n\tmanual_entry_log = [];\r\n}\r\n\r\nfunction add (entry) {\r\n\tmanual_entry_log.push(entry);\r\n}\r\n\r\nfunction items(){\r\n\treturn manual_entry_log;\r\n}\r\n\r\nmodule.exports = {\r\n\titems: items,\r\n\tclear: clear,\r\n\tadd: add,\r\n}\r\n","\r\n// IE11 doesn't support Object.values()\r\nmodule.exports = function values (obj) {\r\n\tvar key_values = [];\r\n\tfor (var key in obj) {\r\n\t\tkey_values.push(obj[key]);\r\n\t}\r\n\treturn key_values;\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function next_segment ($input) {\r\n\ttraverse($input, 'next');\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function prev_segment ($input) {\r\n\ttraverse($input, 'prev');\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('./select_segment');\r\n\r\nmodule.exports = function select_cursor_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tselect_segment($input, current_segment);\r\n}\r\n","\r\nmodule.exports = function select_segment ($input, segment) {\r\n\r\n\tset_input_type();\r\n\r\n\tvar actions = {\r\n\t\thrs: select(0, 2),\r\n\t\tmin: select(3, 5),\r\n\t\tmode: select(6, 8),\r\n\t};\r\n\r\n\tactions[segment]($input);\r\n\r\n\tfunction set_input_type() {\r\n\t\tvar type = segment === 'mode' ? 'text' : 'tel';\r\n\t\t$input.setAttribute('type', type);\r\n\t}\r\n\r\n\tfunction select (start, end) {\r\n\t\treturn function () {\r\n\t\t\t$input.setSelectionRange(start, end);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar segments = require('../static-values/segments');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function traverse ($input, direction) {\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tvar modifier = direction === 'next' ? 1 : -1;\r\n\tvar next_segment_index = segments.indexOf(segment) + modifier;\r\n\r\n\tvar next_segment = {\r\n\t\tnext: segments[next_segment_index] || 'mode',\r\n\t\tprev: next_segment_index < 0 ? 'hrs' : segments[next_segment_index],\r\n\t}[direction];\r\n\r\n\tselect_segment($input, next_segment);\r\n\tmanual_entry_log.clear();\r\n\tupdate_a11y($input, ['select'])\r\n}\r\n","\r\n// I need to keep this separate from reset so that\r\n// I can reset without attracting focus\r\n\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function apply_default ($input) {\r\n\t$input.value = '--:-- --';\r\n\tset_data_attribute($input, '');\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar set_segment = require('./set_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function clear_segment ($input, segment) {\r\n\tset_segment($input, segment, '--');\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function decrement ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'PM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'down');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar decrement = require('../setters/decrement');\r\n\r\nmodule.exports = function decrement_current_segment ($input){\r\n\tvar current_segment = get_current_segment($input);\r\n\tdecrement($input, current_segment);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function increment ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'AM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'up');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar increment = require('../setters/increment');\r\n\r\nmodule.exports = function increment_current_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tincrement($input, current_segment);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar sorted_number_keys = require('../static-values/sorted_number_keys');\r\n\r\nmodule.exports = function manual_number_entry($input, key) {\r\n\tvar key_value = sorted_number_keys[key];\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tif (segment !== 'mode') {\r\n\t\tvar entry_count = manual_entry_log.items().length;\r\n\r\n\t\tvar upper_limits = {\r\n\t\t\thrs: [1,2],\r\n\t\t\tmin: [5,9],\r\n\t\t}\r\n\t\tvar limit = upper_limits[segment][entry_count];\r\n\r\n\t\tif (entry_count < 2) {\r\n\t\t\tmanual_entry_log.add(key_value);\r\n\t\t}\r\n\r\n\t\tvar full_limit = parseInt(upper_limits[segment].join(''));\r\n\t\tvar full_entry = parseInt(manual_entry_log.items().join(''));\r\n\r\n\t\tif (full_limit >= full_entry) {\r\n\t\t\tset_segment($input, segment, full_entry);\r\n\t\t}\r\n\r\n\t\tvar at_limit = key_value > limit || manual_entry_log.items().length === 2;\r\n\r\n\t\tif (at_limit) {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar convert_hours_to_12hr_time = require('../converters/convert_hours_to_12hr_time');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function nudge_time_segment ($input, segment, direction) {\r\n\tvar current_values = get_values($input);\r\n\tvar time;\r\n\r\n\tvar modifier = direction === 'up' ? 1 : -1;\r\n\r\n\tif (current_values[segment] === '--') {\r\n\t\tvar current_time = new Date();\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_time.getHours()),\r\n\t\t\tmin: current_time.getMinutes(),\r\n\t\t}\r\n\t} else {\r\n\t\tvar minutes = {\r\n\t\t\tup : current_values.min < 59 ? current_values.min + modifier : 0,\r\n\t\t\tdown : current_values.min === 0 ? 59 : current_values.min + modifier,\r\n\t\t}\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_values.hrs + modifier),\r\n\t\t\tmin: minutes[direction],\r\n\t\t}\r\n\t}\r\n\r\n\tset_segment($input, segment, leading_zero(time[segment]) );\r\n}\r\n","\r\nvar apply_default = require('./apply_default');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nmodule.exports = function reset ($input) {\r\n\tapply_default($input);\r\n\tselect_segment($input, 'hrs');\r\n}\r\n","\r\nvar convert_to_24hr_time = require('../converters/convert_to_24hr_time')\r\n\r\nmodule.exports = function set_data_attribute($input, timeString_12hr){\r\n\tvar filteredString = timeString_12hr.indexOf('-') > -1 ? '' : timeString_12hr;\r\n\tvar time24hr = convert_to_24hr_time(filteredString);\r\n\t$input.setAttribute('data-value', time24hr);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function set_mode ($input, type) {\r\n\tvar segment = get_current_segment($input);\r\n\tif (segment === 'mode') {\r\n\t\tset_segment($input, segment, type);\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar select_segment = require('../selectors/select_segment');\r\nvar set_data_attribute = require('./set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function set_segment ($input, segment, value) {\r\n\tvar values = get_values($input);\r\n\tvalues[segment] = value;\r\n\tvar newInputVal = [\r\n\t\tleading_zero(values.hrs),':',\r\n\t\tleading_zero(values.min),' ',\r\n\t\tvalues.mode\r\n\t].join('');\r\n\t$input.value = newInputVal;\r\n\tselect_segment($input, segment);\r\n\tset_data_attribute($input, newInputVal);\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar convert_to_12hr_time = require('../converters/convert_to_12hr_time');\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\n\r\nmodule.exports = function set_time($input, time_string_24hr) {\r\n\tvar twelveHr = convert_to_12hr_time(time_string_24hr);\r\n\t$input.value = twelveHr;\r\n\tset_data_attribute($input, time_string_24hr);\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function switch_mode ($input, default_mode) {\r\n\tdefault_mode = default_mode || 'AM';\r\n\tvar current_mode = get_values($input).mode;\r\n\tvar new_mode = {\r\n\t\t'--' : default_mode,\r\n\t\t'AM' : 'PM',\r\n\t\t'PM' : 'AM',\r\n\t}[current_mode];\r\n\tset_segment($input, 'mode', new_mode);\r\n}\r\n","\r\nvar switch_to_data_value = require('./switch_to_data_value');\r\nvar set_time = require('./set_time');\r\n\r\nmodule.exports = function switch_times ($input, format) {\r\n\tvar is12hr = /\\s/.test($input.value);\r\n\r\n\tif (format != 12 && format != 24) {\r\n\t\tformat = is12hr ? 24 : 12;\r\n\t}\r\n\r\n\tvar actions = {\r\n\t\t12: function(){\r\n\t\t\tif (!is12hr) {\r\n\t\t\t\tset_time($input, $input.dataset.value);\r\n\t\t\t}\r\n\t\t},\r\n\t\t24: function(){\r\n\t\t\tif (is12hr) {\r\n\t\t\t\tswitch_to_data_value($input);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tactions[format]();\r\n}\r\n","\r\nmodule.exports = function($input) {\r\n\tvar replacementVal = $input.dataset.value;\r\n\t$input.value = replacementVal;\r\n}\r\n","\r\nvar set_time = require('../setters/set_time');\r\n\r\nmodule.exports = function update_time($input) {\r\n\tset_time($input, $input.value);\r\n\treturn $input;\r\n}\r\n","var all_number_keys = [\r\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\r\n 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\r\n 96, 97, 98, 99,100,101,102,103,104,105\r\n];\r\n\r\nmodule.exports = all_number_keys;\r\n","var named_keys = {\r\n\tArrowDown: 40,\r\n\tArrowRight: 39,\r\n\tArrowUp: 38,\r\n\tArrowLeft: 37,\r\n\tBackspace: 8,\r\n\tDelete: 46,\r\n\tTab: 9,\r\n\tShift: 16,\r\n\tEscape: 27,\r\n\ta: 65,\r\n\tp: 80,\r\n}\r\n\r\nmodule.exports = named_keys;\r\n","\r\nvar ranges = {\r\n\thrs : { start: 0, end: 2 },\r\n\tmin : { start: 3, end: 5 },\r\n\tmode : { start: 6, end: 8 },\r\n}\r\n\r\nmodule.exports = ranges;\r\n","\r\nvar ranges = require('./ranges');\r\n\r\nvar segments = Object.keys(ranges);\r\n\r\nmodule.exports = segments;\r\n","\r\nvar all_number_keys = require('./all_number_keys');\r\n\r\nvar sorted_number_keys = {};\r\n// sorted_number_keys = { 48: 0, 49: 1, 96: 0, 97: 1, ... };\r\nall_number_keys.forEach(function(key, index) {\r\n\tvar number_val = index > 9 ? index - 10 : index;\r\n\tsorted_number_keys[key] = number_val;\r\n});\r\n\r\nmodule.exports = sorted_number_keys;\r\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 1ec7127..76fdec1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -44,7 +44,7 @@v1.0.5
+v1.0.6
The demos on this page have been applied manually in order to demonstrate the difference between a real time input and a polyfill time input in modern browsers.
@@ -83,8 +83,8 @@<script src="https://cdn.jsdelivr.net/npm/time-input-polyfill@1.0.5"></script>
- https://cdn.jsdelivr.net/npm/time-input-polyfill@1.0.5
+<script src="https://cdn.jsdelivr.net/npm/time-input-polyfill@1.0.6"></script>
+
")+"
";v=v.replace(/\$label/g,e.polyfill.label),v=v.replace(/\$segmentName/g,c),v=v.replace(/\$segmentValue/g,i),v=v.replace(/\$fullValue/g,_),e.polyfill.$a11y.innerHTML=v},1)}},{"../getters/get_current_segment":15,"../getters/get_values":18}],3:[function(e,t,n){t.exports=function(e){return e<=12?0===e?12:e:e-12}},{}],4:[function(e,t,n){t.exports=function(e){return isNaN(e)?e:parseInt(e)}},{}],5:[function(e,t,n){var r=e("./convert_number"),s=e("./convert_hours_to_12hr_time"),o=e("./leading_zero");t.exports=function(e){if(""===e)return"--:-- --";var t=/([0-9]{2})\:([0-9]{2})/,n=t.exec(e),a=r(n[1]),i=n[2],c=s(a),u=a>12,l=u?"PM":"AM";return[o(c),":",i," ",l].join("")}},{"./convert_hours_to_12hr_time":3,"./convert_number":4,"./leading_zero":7}],6:[function(e,t,n){var r=e("./leading_zero");t.exports=function(e){if(/-/.test(e))return"";var t,n=e.indexOf("PM")>-1,s=/^([0-9]{2})/.exec(e),o=s?parseInt(s[1]):"";t=12===o?n?12:0:n?o+12:o;var a=24===t?0:t,i=/^[0-9]{2}:([0-9]{2}) (AM|PM)/;return e.replace(i,r(a)+":$1")}},{"./leading_zero":7}],7:[function(e,t,n){t.exports=function(e){if(isNaN(e))return e;var t=parseInt(e);return t<10?"0"+t:e}},{}],8:[function(e,t,n){t.exports=function(e){return Array.prototype.slice.call(e,0)}},{}],9:[function(e,t,n){function r(e){e.polyfill.autoSwap&&(d(e,24),setTimeout(function(){d(e,12)},1))}var s=e("../helpers/values"),o=e("../selectors/select_segment"),a=e("../selectors/next_segment"),i=e("../selectors/prev_segment"),c=e("../selectors/select_cursor_segment"),u=e("../getters/get_current_segment"),l=e("../setters/reset"),_=e("../setters/manual_number_entry"),v=e("../setters/clear_segment"),f=e("../setters/increment_current_segment"),g=e("../setters/decrement_current_segment"),m=e("../setters/set_mode"),d=e("../setters/switch_times"),p=e("../events/handle_tab"),h=e("../static-values/all_number_keys"),b=e("../static-values/named_keys"),y=e("../accessibility/update_a11y");t.exports=function(e){var t="",n=!1;document.addEventListener("keydown",function(e){n=e.shiftKey}),document.addEventListener("keyup",function(e){n=e.shiftKey}),e.form&&e.form.addEventListener("submit",function(){r(e)});var d=!1;e.addEventListener("mousedown",function(){d=!0}),e.addEventListener("mouseup",function(){setTimeout(function(){""===e.value&&l(e)},1)}),e.addEventListener("click",function(t){c(e)}),e.addEventListener("blur",function(){var n=e.dataset.value;n!==t&&(t=n),d=!1}),e.addEventListener("focus",function(t){if(!d){t.preventDefault();var r=n?"mode":"hrs";o(e,r)}y(e,["initial","select"])}),e.addEventListener("keydown",function(t){var n=13===t.which;if(n)return!0;var r=h.indexOf(t.which)>-1,o=s(b).indexOf(t.which)>-1,c=[b.ArrowDown,b.ArrowRight,b.ArrowUp,b.ArrowLeft].indexOf(t.which)>-1,d=[b.a,b.p].indexOf(t.which)>-1,y=[b.Delete,b.Backspace].indexOf(t.which)>-1;if((!o||c||r||d||y)&&t.preventDefault(),r&&_(e,t.which),y){var x=u(e);v(e,x)}switch(t.which){case b.ArrowRight:a(e);break;case b.ArrowLeft:i(e);break;case b.ArrowUp:f(e);break;case b.ArrowDown:g(e);break;case b.Escape:l(e);break;case b.a:m(e,"AM");break;case b.p:m(e,"PM");break;case b.Tab:p(e,t)}})}},{"../accessibility/update_a11y":2,"../events/handle_tab":11,"../getters/get_current_segment":15,"../helpers/values":21,"../selectors/next_segment":23,"../selectors/prev_segment":24,"../selectors/select_cursor_segment":25,"../selectors/select_segment":26,"../setters/clear_segment":29,"../setters/decrement_current_segment":31,"../setters/increment_current_segment":33,"../setters/manual_number_entry":34,"../setters/reset":36,"../setters/set_mode":38,"../setters/switch_times":42,"../static-values/all_number_keys":45,"../static-values/named_keys":46}],10:[function(e,t,n){t.exports=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}},{}],11:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../selectors/prev_segment"),o=e("../selectors/next_segment");t.exports=function(e,t){var n=r(e),a=t.shiftKey&&"hrs"===n,i=!t.shiftKey&&"mode"===n;a||i||(t.preventDefault(),t.shiftKey?s(e):o(e))}},{"../getters/get_current_segment":15,"../selectors/next_segment":23,"../selectors/prev_segment":24}],12:[function(e,t,n){var r=e("./trigger_event");t.exports=function(e){r(e,"input"),r(e,"change")}},{"./trigger_event":13}],13:[function(e,t,n){function r(e){return!/--/.test(e.value)}var s=e("./create_event"),o=s("input"),a=s("change");t.exports=function(e,t){var n={input:o,change:a}[t];r(e)&&e.dispatchEvent(n)}},{"./create_event":10}],14:[function(e,t,n){t.exports=function(e,t){for(var n=e,r=[];n;){r.push(n);var s=n.msMatchesSelector?n.msMatchesSelector(t):n.matches(t);if(s)return r;n=n.parentElement}return r}},{}],15:[function(e,t,n){var r=e("../static-values/ranges"),s=e("./get_selected_range");t.exports=function(e){var t=s(e);for(var n in r){var o=r[n],a=o.start<=t.start,i=o.end>=t.end;if(a&&i)return n}return"hrs"}},{"../static-values/ranges":47,"./get_selected_range":17}],16:[function(e,t,n){function r(e){var t=e.getAttribute("aria-labelledby");if(t){var n=document.getElementById(t);if(n)return n.textContent}return!1}function s(e){var t=e.getAttribute("aria-label");return!!t&&t}function o(e){if(e.id){var t=document.querySelector('label[for="'+e.id+'"]');if(t)return t.textContent}return!1}function a(e){var t=c(e,"label"),n=t[t.length-1];return"LABEL"==n.nodeName&&n.textContent}function i(e){var t=e.getAttribute("title");return!!t&&t}var c=e("./get_ancestors");t.exports=function(e){var t=r(e)||s(e)||o(e)||a(e)||i(e);if(t)return t;throw console.error("Label text for input not found.",e),new Error("Cannot polyfill time input due to a missing label.")}},{"./get_ancestors":14}],17:[function(e,t,n){t.exports=function(e){return{start:e.selectionStart,end:e.selectionEnd}}},{}],18:[function(e,t,n){var r=e("../converters/convert_number");t.exports=function(e,t){var n=t?t:e.value,s=/([0-9-]{1,2})\:([0-9-]{1,2})\s?(AM|PM|\-\-)?/,o=s.exec(n);return{hrs:r(o[1]),min:r(o[2]),mode:o[3]}}},{"../converters/convert_number":4}],19:[function(e,t,n){function r(){a=[]}function s(e){a.push(e)}function o(){return a}var a=[];t.exports={items:o,clear:r,add:s}},{}],20:[function(e,t,n){t.exports=function(e){e.style.msUserSelect="none",e.style.mozUserSelect="none",e.style.webkitUserSelect="none",e.style.userSelect="none"}},{}],21:[function(e,t,n){t.exports=function(e){var t=[];for(var n in e)t.push(e[n]);return t}},{}],22:[function(e,t,n){var r=e("../converters/toArray");t.exports=function(e){var t=document.querySelectorAll(e);return r(t)}},{"../converters/toArray":8}],23:[function(e,t,n){var r=e("./traverse");t.exports=function(e){r(e,"next")}},{"./traverse":27}],24:[function(e,t,n){var r=e("./traverse");t.exports=function(e){r(e,"prev")}},{"./traverse":27}],25:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("./select_segment");t.exports=function(e){var t=r(e);s(e,t)}},{"../getters/get_current_segment":15,"./select_segment":26}],26:[function(e,t,n){t.exports=function(e,t){function n(){var n="mode"===t?"text":"tel";e.setAttribute("type",n)}function r(t,n){return function(){e.setSelectionRange(t,n)}}n();var s={hrs:r(0,2),min:r(3,5),mode:r(6,8)};s[t](e)}},{}],27:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../selectors/select_segment"),o=e("../helpers/manual_entry_log"),a=e("../static-values/segments"),i=e("../accessibility/update_a11y");t.exports=function(e,t){var n=r(e),c="next"===t?1:-1,u=a.indexOf(n)+c,l={next:a[u]||"mode",prev:u<0?"hrs":a[u]}[t];s(e,l),o.clear(),i(e,["select"])}},{"../accessibility/update_a11y":2,"../getters/get_current_segment":15,"../helpers/manual_entry_log":19,"../selectors/select_segment":26,"../static-values/segments":48}],28:[function(e,t,n){var r=e("../setters/set_data_attribute"),s=e("../events/trigger_both_events");t.exports=function(e){e.value="--:-- --",r(e,""),s(e)}},{"../events/trigger_both_events":12,"../setters/set_data_attribute":37}],29:[function(e,t,n){var r=e("./set_segment"),s=e("../accessibility/update_a11y");t.exports=function(e,t){r(e,t,"--"),s(e,["update"])}},{"../accessibility/update_a11y":2,"./set_segment":39}],30:[function(e,t,n){var r=e("./switch_mode"),s=e("./nudge_time_segment"),o=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?r(e,"PM"):s(e,t,"down"),o(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":35,"./switch_mode":41}],31:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../setters/decrement");t.exports=function(e){var t=r(e);s(e,t)}},{"../getters/get_current_segment":15,"../setters/decrement":30}],32:[function(e,t,n){var r=e("./switch_mode"),s=e("./nudge_time_segment"),o=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?r(e,"AM"):s(e,t,"up"),o(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":35,"./switch_mode":41}],33:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../setters/increment");t.exports=function(e){var t=r(e);s(e,t)}},{"../getters/get_current_segment":15,"../setters/increment":32}],34:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("./set_segment"),o=e("../selectors/next_segment"),a=e("../helpers/manual_entry_log"),i=e("../static-values/sorted_number_keys");t.exports=function(e,t){var n=i[t],c=r(e);if("mode"!==c){var u=a.items().length,l={hrs:[1,2],min:[5,9]},_=l[c][u];u<2&&a.add(n);var v=parseInt(l[c].join("")),f=parseInt(a.items().join(""));v>=f&&s(e,c,f);var g=n>_||2===a.items().length;g&&o(e)}}},{"../getters/get_current_segment":15,"../helpers/manual_entry_log":19,"../selectors/next_segment":23,"../static-values/sorted_number_keys":49,"./set_segment":39}],35:[function(e,t,n){var r=e("../getters/get_values"),s=e("../converters/convert_hours_to_12hr_time"),o=e("../converters/leading_zero"),a=e("./set_segment");t.exports=function(e,t,n){var i,c=r(e),u="up"===n?1:-1;if("--"===c[t]){var l=new Date;i={hrs:s(l.getHours()),min:l.getMinutes()}}else{var _={up:c.min<59?c.min+u:0,down:0===c.min?59:c.min+u};i={hrs:s(c.hrs+u),min:_[n]}}a(e,t,o(i[t]))}},{"../converters/convert_hours_to_12hr_time":3,"../converters/leading_zero":7,"../getters/get_values":18,"./set_segment":39}],36:[function(e,t,n){var r=e("./apply_default"),s=e("../selectors/select_segment");t.exports=function(e){r(e),s(e,"hrs")}},{"../selectors/select_segment":26,"./apply_default":28}],37:[function(e,t,n){var r=e("../converters/convert_to_24hr_time");t.exports=function(e,t){var n=t.indexOf("-")>-1?"":t,s=r(n);e.setAttribute("data-value",s)}},{"../converters/convert_to_24hr_time":6}],38:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("./set_segment");t.exports=function(e,t){var n=r(e);"mode"===n&&s(e,n,t)}},{"../getters/get_current_segment":15,"./set_segment":39}],39:[function(e,t,n){var r=e("../getters/get_values"),s=e("../converters/leading_zero"),o=e("../selectors/select_segment"),a=e("./set_data_attribute"),i=e("../events/trigger_both_events");t.exports=function(e,t,n){var c=r(e);c[t]=n;var u=[s(c.hrs),":",s(c.min)," ",c.mode].join("");e.value=u,o(e,t),a(e,u),i(e)}},{"../converters/leading_zero":7,"../events/trigger_both_events":12,"../getters/get_values":18,"../selectors/select_segment":26,"./set_data_attribute":37}],40:[function(e,t,n){var r=e("../converters/convert_to_12hr_time"),s=e("../setters/set_data_attribute");t.exports=function(e,t){var n=r(t);e.value=n,s(e,t)}},{"../converters/convert_to_12hr_time":5,"../setters/set_data_attribute":37}],41:[function(e,t,n){var r=e("../getters/get_values"),s=e("./set_segment");t.exports=function(e,t){t=t||"AM";var n=r(e).mode,o={"--":t,AM:"PM",PM:"AM"}[n];s(e,"mode",o)}},{"../getters/get_values":18,"./set_segment":39}],42:[function(e,t,n){var r=e("./switch_to_data_value"),s=e("./set_time");t.exports=function(e,t){var n=/\s/.test(e.value);12!=t&&24!=t&&(t=n?24:12);var o={12:function(){n||s(e,e.dataset.value)},24:function(){n&&r(e)}};o[t]()}},{"./set_time":40,"./switch_to_data_value":43}],43:[function(e,t,n){t.exports=function(e){var t=e.dataset.value;e.value=t}},{}],44:[function(e,t,n){var r=e("../setters/set_time");t.exports=function(e){return r(e,e.value),e}},{"../setters/set_time":40}],45:[function(e,t,n){var r=[48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105];t.exports=r},{}],46:[function(e,t,n){var r={ArrowDown:40,ArrowRight:39,ArrowUp:38,ArrowLeft:37,Backspace:8,Delete:46,Tab:9,Shift:16,Escape:27,a:65,p:80};t.exports=r},{}],47:[function(e,t,n){var r={hrs:{start:0,end:2},min:{start:3,end:5},mode:{start:6,end:8}};t.exports=r},{}],48:[function(e,t,n){var r=e("./ranges"),s=Object.keys(r);t.exports=s},{"./ranges":47}],49:[function(e,t,n){var r=e("./all_number_keys"),s={};r.forEach(function(e,t){var n=t>9?t-10:t;s[e]=n}),t.exports=s},{"./all_number_keys":45}],50:[function(e,t,n){function r(e){e.setAttribute("autocomplete","off"),o(e),e.setAttribute("aria-hidden",!0),f||(s=v(),f=!0);var t=_(e);e.polyfill={$a11y:s,label:t,autoSwap:!0,update:function(){i(e)},swap:function(t){l(e,t)}},""===e.value||/--/.test(e.value)?(a(e),c(e,"")):(i(e),c(e,e.value)),u(e)}var s,o=e("./core/helpers/prevent_user_select"),a=e("./core/setters/apply_default"),i=e("./core/setters/update_time"),c=e("./core/setters/set_data_attribute"),u=e("./core/events/bind_events"),l=e("./core/setters/switch_times"),_=e("./core/getters/get_label"),v=e("./core/accessibility/create_a11y_block"),f=!1;window&&(window.TimePolyfill=r),t&&(t.exports=r)},{"./core/accessibility/create_a11y_block":1,"./core/events/bind_events":9,"./core/getters/get_label":16,"./core/helpers/prevent_user_select":20,"./core/setters/apply_default":28,"./core/setters/set_data_attribute":37,"./core/setters/switch_times":42,"./core/setters/update_time":44}],51:[function(e,t,n){t.exports=function(e,t){var n=e.querySelector(".result__list"),r=e.querySelector(".result__close"),s="";for(var o in t){var a=t[o].replace(/^$/,'blank');s+=['")+"
";v=v.replace(/\$label/g,e.polyfill.label),v=v.replace(/\$segmentName/g,c),v=v.replace(/\$segmentValue/g,i),v=v.replace(/\$fullValue/g,_),e.polyfill.$a11y.innerHTML=v},1)}},{"../getters/get_current_segment":15,"../getters/get_values":18}],3:[function(e,t,n){t.exports=function(e){return e<=12?0===e?12:e:e-12}},{}],4:[function(e,t,n){t.exports=function(e){return isNaN(e)?e:parseInt(e)}},{}],5:[function(e,t,n){var r=e("./convert_number"),s=e("./convert_hours_to_12hr_time"),o=e("./leading_zero");t.exports=function(e){if(""===e)return"--:-- --";var t=/([0-9]{2})\:([0-9]{2})/,n=t.exec(e),a=r(n[1]),i=n[2],c=s(a),u=a>12,l=u?"PM":"AM";return[o(c),":",i," ",l].join("")}},{"./convert_hours_to_12hr_time":3,"./convert_number":4,"./leading_zero":7}],6:[function(e,t,n){var r=e("./leading_zero");t.exports=function(e){if(/-/.test(e))return"";var t,n=e.indexOf("PM")>-1,s=/^([0-9]{2})/.exec(e),o=s?parseInt(s[1]):"";t=12===o?n?12:0:n?o+12:o;var a=24===t?0:t,i=/^[0-9]{2}:([0-9]{2}) (AM|PM)/;return e.replace(i,r(a)+":$1")}},{"./leading_zero":7}],7:[function(e,t,n){t.exports=function(e){if(isNaN(e))return e;var t=parseInt(e);return t<10?"0"+t:e}},{}],8:[function(e,t,n){t.exports=function(e){return Array.prototype.slice.call(e,0)}},{}],9:[function(e,t,n){function r(e){e.polyfill.autoSwap&&(d(e,24),setTimeout(function(){d(e,12)},1))}var s=e("../helpers/values"),o=e("../selectors/select_segment"),a=e("../selectors/next_segment"),i=e("../selectors/prev_segment"),c=e("../selectors/select_cursor_segment"),u=e("../getters/get_current_segment"),l=e("../setters/reset"),_=e("../setters/manual_number_entry"),v=e("../setters/clear_segment"),f=e("../setters/increment_current_segment"),g=e("../setters/decrement_current_segment"),m=e("../setters/set_mode"),d=e("../setters/switch_times"),p=e("../events/handle_tab"),h=e("../static-values/all_number_keys"),b=e("../static-values/named_keys"),y=e("../accessibility/update_a11y");t.exports=function(e){var t="",n=!1;document.addEventListener("keydown",function(e){n=e.shiftKey}),document.addEventListener("keyup",function(e){n=e.shiftKey}),e.form&&e.form.addEventListener("submit",function(){r(e)});var d=!1;e.addEventListener("mousedown",function(){d=!0}),e.addEventListener("mouseup",function(){setTimeout(function(){""===e.value&&l(e)},1)}),e.addEventListener("click",function(t){c(e)}),e.addEventListener("blur",function(){var n=e.dataset.value;n!==t&&(t=n),d=!1}),e.addEventListener("focus",function(t){if(!d){t.preventDefault();var r=n?"mode":"hrs";o(e,r)}y(e,["initial","select"])}),e.addEventListener("keydown",function(t){var n=13===t.which;if(n)return!0;var r=h.indexOf(t.which)>-1,o=s(b).indexOf(t.which)>-1,c=[b.ArrowDown,b.ArrowRight,b.ArrowUp,b.ArrowLeft].indexOf(t.which)>-1,d=[b.a,b.p].indexOf(t.which)>-1,y=[b.Delete,b.Backspace].indexOf(t.which)>-1;if((!o||c||r||d||y)&&t.preventDefault(),r&&_(e,t.which),y){var x=u(e);v(e,x)}switch(t.which){case b.ArrowRight:a(e);break;case b.ArrowLeft:i(e);break;case b.ArrowUp:f(e);break;case b.ArrowDown:g(e);break;case b.Escape:l(e);break;case b.a:m(e,"AM");break;case b.p:m(e,"PM");break;case b.Tab:p(e,t)}})}},{"../accessibility/update_a11y":2,"../events/handle_tab":11,"../getters/get_current_segment":15,"../helpers/values":20,"../selectors/next_segment":22,"../selectors/prev_segment":23,"../selectors/select_cursor_segment":24,"../selectors/select_segment":25,"../setters/clear_segment":28,"../setters/decrement_current_segment":30,"../setters/increment_current_segment":32,"../setters/manual_number_entry":33,"../setters/reset":35,"../setters/set_mode":37,"../setters/switch_times":41,"../static-values/all_number_keys":44,"../static-values/named_keys":45}],10:[function(e,t,n){t.exports=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}},{}],11:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../selectors/prev_segment"),o=e("../selectors/next_segment");t.exports=function(e,t){var n=r(e),a=t.shiftKey&&"hrs"===n,i=!t.shiftKey&&"mode"===n;a||i||(t.preventDefault(),t.shiftKey?s(e):o(e))}},{"../getters/get_current_segment":15,"../selectors/next_segment":22,"../selectors/prev_segment":23}],12:[function(e,t,n){var r=e("./trigger_event");t.exports=function(e){r(e,"input"),r(e,"change")}},{"./trigger_event":13}],13:[function(e,t,n){function r(e){return!/--/.test(e.value)}var s=e("./create_event"),o=s("input"),a=s("change");t.exports=function(e,t){var n={input:o,change:a}[t];r(e)&&e.dispatchEvent(n)}},{"./create_event":10}],14:[function(e,t,n){t.exports=function(e,t){for(var n=e,r=[];n;){r.push(n);var s=n.msMatchesSelector?n.msMatchesSelector(t):n.matches(t);if(s)return r;n=n.parentElement}return r}},{}],15:[function(e,t,n){var r=e("../static-values/ranges"),s=e("./get_selected_range");t.exports=function(e){var t=s(e);for(var n in r){var o=r[n],a=o.start<=t.start,i=o.end>=t.end;if(a&&i)return n}return"hrs"}},{"../static-values/ranges":46,"./get_selected_range":17}],16:[function(e,t,n){function r(e){var t=e.getAttribute("aria-labelledby");if(t){var n=document.getElementById(t);if(n)return n.textContent}return!1}function s(e){var t=e.getAttribute("aria-label");return!!t&&t}function o(e){if(e.id){var t=document.querySelector('label[for="'+e.id+'"]');if(t)return t.textContent}return!1}function a(e){var t=c(e,"label"),n=t[t.length-1];return"LABEL"==n.nodeName&&n.textContent}function i(e){var t=e.getAttribute("title");return!!t&&t}var c=e("./get_ancestors");t.exports=function(e){var t=r(e)||s(e)||o(e)||a(e)||i(e);if(t)return t;throw console.error("Label text for input not found.",e),new Error("Cannot polyfill time input due to a missing label.")}},{"./get_ancestors":14}],17:[function(e,t,n){t.exports=function(e){return{start:e.selectionStart,end:e.selectionEnd}}},{}],18:[function(e,t,n){var r=e("../converters/convert_number");t.exports=function(e,t){var n=t?t:e.value,s=/([0-9-]{1,2})\:([0-9-]{1,2})\s?(AM|PM|\-\-)?/,o=s.exec(n);return{hrs:r(o[1]),min:r(o[2]),mode:o[3]}}},{"../converters/convert_number":4}],19:[function(e,t,n){function r(){a=[]}function s(e){a.push(e)}function o(){return a}var a=[];t.exports={items:o,clear:r,add:s}},{}],20:[function(e,t,n){t.exports=function(e){var t=[];for(var n in e)t.push(e[n]);return t}},{}],21:[function(e,t,n){var r=e("../converters/toArray");t.exports=function(e){var t=document.querySelectorAll(e);return r(t)}},{"../converters/toArray":8}],22:[function(e,t,n){var r=e("./traverse");t.exports=function(e){r(e,"next")}},{"./traverse":26}],23:[function(e,t,n){var r=e("./traverse");t.exports=function(e){r(e,"prev")}},{"./traverse":26}],24:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("./select_segment");t.exports=function(e){var t=r(e);s(e,t)}},{"../getters/get_current_segment":15,"./select_segment":25}],25:[function(e,t,n){t.exports=function(e,t){function n(){var n="mode"===t?"text":"tel";e.setAttribute("type",n)}function r(t,n){return function(){e.setSelectionRange(t,n)}}n();var s={hrs:r(0,2),min:r(3,5),mode:r(6,8)};s[t](e)}},{}],26:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../selectors/select_segment"),o=e("../helpers/manual_entry_log"),a=e("../static-values/segments"),i=e("../accessibility/update_a11y");t.exports=function(e,t){var n=r(e),c="next"===t?1:-1,u=a.indexOf(n)+c,l={next:a[u]||"mode",prev:u<0?"hrs":a[u]}[t];s(e,l),o.clear(),i(e,["select"])}},{"../accessibility/update_a11y":2,"../getters/get_current_segment":15,"../helpers/manual_entry_log":19,"../selectors/select_segment":25,"../static-values/segments":47}],27:[function(e,t,n){var r=e("../setters/set_data_attribute"),s=e("../events/trigger_both_events");t.exports=function(e){e.value="--:-- --",r(e,""),s(e)}},{"../events/trigger_both_events":12,"../setters/set_data_attribute":36}],28:[function(e,t,n){var r=e("./set_segment"),s=e("../accessibility/update_a11y");t.exports=function(e,t){r(e,t,"--"),s(e,["update"])}},{"../accessibility/update_a11y":2,"./set_segment":38}],29:[function(e,t,n){var r=e("./switch_mode"),s=e("./nudge_time_segment"),o=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?r(e,"PM"):s(e,t,"down"),o(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":34,"./switch_mode":40}],30:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../setters/decrement");t.exports=function(e){var t=r(e);s(e,t)}},{"../getters/get_current_segment":15,"../setters/decrement":29}],31:[function(e,t,n){var r=e("./switch_mode"),s=e("./nudge_time_segment"),o=e("../accessibility/update_a11y");t.exports=function(e,t){"mode"===t?r(e,"AM"):s(e,t,"up"),o(e,["update"])}},{"../accessibility/update_a11y":2,"./nudge_time_segment":34,"./switch_mode":40}],32:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("../setters/increment");t.exports=function(e){var t=r(e);s(e,t)}},{"../getters/get_current_segment":15,"../setters/increment":31}],33:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("./set_segment"),o=e("../selectors/next_segment"),a=e("../helpers/manual_entry_log"),i=e("../static-values/sorted_number_keys");t.exports=function(e,t){var n=i[t],c=r(e);if("mode"!==c){var u=a.items().length,l={hrs:[1,2],min:[5,9]},_=l[c][u];u<2&&a.add(n);var v=parseInt(l[c].join("")),f=parseInt(a.items().join(""));v>=f&&s(e,c,f);var g=n>_||2===a.items().length;g&&o(e)}}},{"../getters/get_current_segment":15,"../helpers/manual_entry_log":19,"../selectors/next_segment":22,"../static-values/sorted_number_keys":48,"./set_segment":38}],34:[function(e,t,n){var r=e("../getters/get_values"),s=e("../converters/convert_hours_to_12hr_time"),o=e("../converters/leading_zero"),a=e("./set_segment");t.exports=function(e,t,n){var i,c=r(e),u="up"===n?1:-1;if("--"===c[t]){var l=new Date;i={hrs:s(l.getHours()),min:l.getMinutes()}}else{var _={up:c.min<59?c.min+u:0,down:0===c.min?59:c.min+u};i={hrs:s(c.hrs+u),min:_[n]}}a(e,t,o(i[t]))}},{"../converters/convert_hours_to_12hr_time":3,"../converters/leading_zero":7,"../getters/get_values":18,"./set_segment":38}],35:[function(e,t,n){var r=e("./apply_default"),s=e("../selectors/select_segment");t.exports=function(e){r(e),s(e,"hrs")}},{"../selectors/select_segment":25,"./apply_default":27}],36:[function(e,t,n){var r=e("../converters/convert_to_24hr_time");t.exports=function(e,t){var n=t.indexOf("-")>-1?"":t,s=r(n);e.setAttribute("data-value",s)}},{"../converters/convert_to_24hr_time":6}],37:[function(e,t,n){var r=e("../getters/get_current_segment"),s=e("./set_segment");t.exports=function(e,t){var n=r(e);"mode"===n&&s(e,n,t)}},{"../getters/get_current_segment":15,"./set_segment":38}],38:[function(e,t,n){var r=e("../getters/get_values"),s=e("../converters/leading_zero"),o=e("../selectors/select_segment"),a=e("./set_data_attribute"),i=e("../events/trigger_both_events");t.exports=function(e,t,n){var c=r(e);c[t]=n;var u=[s(c.hrs),":",s(c.min)," ",c.mode].join("");e.value=u,o(e,t),a(e,u),i(e)}},{"../converters/leading_zero":7,"../events/trigger_both_events":12,"../getters/get_values":18,"../selectors/select_segment":25,"./set_data_attribute":36}],39:[function(e,t,n){var r=e("../converters/convert_to_12hr_time"),s=e("../setters/set_data_attribute");t.exports=function(e,t){var n=r(t);e.value=n,s(e,t)}},{"../converters/convert_to_12hr_time":5,"../setters/set_data_attribute":36}],40:[function(e,t,n){var r=e("../getters/get_values"),s=e("./set_segment");t.exports=function(e,t){t=t||"AM";var n=r(e).mode,o={"--":t,AM:"PM",PM:"AM"}[n];s(e,"mode",o)}},{"../getters/get_values":18,"./set_segment":38}],41:[function(e,t,n){var r=e("./switch_to_data_value"),s=e("./set_time");t.exports=function(e,t){var n=/\s/.test(e.value);12!=t&&24!=t&&(t=n?24:12);var o={12:function(){n||s(e,e.dataset.value)},24:function(){n&&r(e)}};o[t]()}},{"./set_time":39,"./switch_to_data_value":42}],42:[function(e,t,n){t.exports=function(e){var t=e.dataset.value;e.value=t}},{}],43:[function(e,t,n){var r=e("../setters/set_time");t.exports=function(e){return r(e,e.value),e}},{"../setters/set_time":39}],44:[function(e,t,n){var r=[48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105];t.exports=r},{}],45:[function(e,t,n){var r={ArrowDown:40,ArrowRight:39,ArrowUp:38,ArrowLeft:37,Backspace:8,Delete:46,Tab:9,Shift:16,Escape:27,a:65,p:80};t.exports=r},{}],46:[function(e,t,n){var r={hrs:{start:0,end:2},min:{start:3,end:5},mode:{start:6,end:8}};t.exports=r},{}],47:[function(e,t,n){var r=e("./ranges"),s=Object.keys(r);t.exports=s},{"./ranges":46}],48:[function(e,t,n){var r=e("./all_number_keys"),s={};r.forEach(function(e,t){var n=t>9?t-10:t;s[e]=n}),t.exports=s},{"./all_number_keys":44}],49:[function(e,t,n){function r(e){e.setAttribute("autocomplete","off"),e.setAttribute("aria-hidden",!0),v||(s=_(),v=!0);var t=l(e);e.polyfill={$a11y:s,label:t,autoSwap:!0,update:function(){a(e)},swap:function(t){u(e,t)}},""===e.value||/--/.test(e.value)?(o(e),i(e,"")):(a(e),i(e,e.value)),c(e)}var s,o=e("./core/setters/apply_default"),a=e("./core/setters/update_time"),i=e("./core/setters/set_data_attribute"),c=e("./core/events/bind_events"),u=e("./core/setters/switch_times"),l=e("./core/getters/get_label"),_=e("./core/accessibility/create_a11y_block"),v=!1;window&&(window.TimePolyfill=r),t&&(t.exports=r)},{"./core/accessibility/create_a11y_block":1,"./core/events/bind_events":9,"./core/getters/get_label":16,"./core/setters/apply_default":27,"./core/setters/set_data_attribute":36,"./core/setters/switch_times":41,"./core/setters/update_time":43}],50:[function(e,t,n){t.exports=function(e,t){var n=e.querySelector(".result__list"),r=e.querySelector(".result__close"),s="";for(var o in t){var a=t[o].replace(/^$/,'blank');s+=['') + '
';\r\n\t\thtml = html.replace(/\\$label/g, $input.polyfill.label);\r\n\t\thtml = html.replace(/\\$segmentName/g, segmentName);\r\n\t\thtml = html.replace(/\\$segmentValue/g, finalValue);\r\n\t\thtml = html.replace(/\\$fullValue/g, fullValue);\r\n\r\n\t\t$input.polyfill.$a11y.innerHTML = html;\r\n\t}, 1);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../getters/get_values\":18}],3:[function(require,module,exports){\n\r\nmodule.exports = function convert_hours_to_12hr_time (hours) {\r\n\treturn hours <= 12 ? hours === 0 ? 12 : hours : hours - 12;\r\n}\r\n\n},{}],4:[function(require,module,exports){\n\r\nmodule.exports = function convert_number (number) {\r\n\treturn isNaN(number) ? number : parseInt(number);\r\n}\r\n\n},{}],5:[function(require,module,exports){\n\r\nvar convert_number = require('./convert_number');\r\nvar convert_hours_to_12hr_time = require('./convert_hours_to_12hr_time');\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_12hr_time (timeString_24hr) {\r\n\tif (timeString_24hr === '') return '--:-- --';\r\n\tvar twentyFour_regex = /([0-9]{2})\\:([0-9]{2})/;\r\n\tvar result = twentyFour_regex.exec(timeString_24hr);\r\n\tvar hrs_24 = convert_number(result[1]);\r\n\tvar min = result[2];\r\n\tvar hrs_12 = convert_hours_to_12hr_time(hrs_24);\r\n\tvar isPM = hrs_24 > 12;\r\n\tvar mode = isPM ? 'PM' : 'AM';\r\n\treturn [leading_zero(hrs_12), ':', min, ' ', mode].join('');\r\n}\r\n\n},{\"./convert_hours_to_12hr_time\":3,\"./convert_number\":4,\"./leading_zero\":7}],6:[function(require,module,exports){\n\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_24hr_time (timeString_12hr) {\r\n\tif (/-/.test(timeString_12hr)) return '';\r\n\tvar isPM = timeString_12hr.indexOf('PM') > -1;\r\n\tvar timeResult = /^([0-9]{2})/.exec(timeString_12hr);\r\n\tvar hrs = timeResult ? parseInt(timeResult[1]) : '';\r\n\tvar newHrs;\r\n\tif (hrs === 12) {\r\n\t\tnewHrs = isPM ? 12 : 00;\r\n\t} else {\r\n\t\tnewHrs = isPM ? hrs + 12 : hrs;\r\n\t}\r\n\tvar finalHrs = newHrs === 24 ? 0 : newHrs;\r\n\tvar timeRegEx = /^[0-9]{2}:([0-9]{2}) (AM|PM)/;\r\n\treturn timeString_12hr.replace(timeRegEx, leading_zero(finalHrs)+':$1');\r\n}\r\n\n},{\"./leading_zero\":7}],7:[function(require,module,exports){\n\r\nmodule.exports = function leading_zero (number) {\r\n\tif (isNaN(number)) return number;\r\n\tvar purified = parseInt(number);\r\n\treturn purified < 10 ? '0' + purified : number;\r\n}\r\n\n},{}],8:[function(require,module,exports){\n\r\nmodule.exports = function(array){\r\n\treturn Array.prototype.slice.call(array, 0);\r\n}\r\n\n},{}],9:[function(require,module,exports){\n\r\nvar values = require('../helpers/values');\r\n\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar next_segment = require('../selectors/next_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar select_cursor_segment = require('../selectors/select_cursor_segment');\r\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\n\r\nvar reset = require('../setters/reset');\r\nvar manual_number_entry = require('../setters/manual_number_entry');\r\nvar clear_segment = require('../setters/clear_segment');\r\nvar increment_current_segment = require('../setters/increment_current_segment');\r\nvar decrement_current_segment = require('../setters/decrement_current_segment');\r\nvar set_mode = require('../setters/set_mode');\r\nvar switch_times = require('../setters/switch_times');\r\n\r\nvar handle_tab = require('../events/handle_tab');\r\n\r\nvar all_number_keys = require('../static-values/all_number_keys');\r\nvar named_keys = require('../static-values/named_keys');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function bind_events ($input) {\r\n\r\n\tvar prev_value = '';\r\n\r\n\tvar shiftKey = false;\r\n\r\n\tdocument.addEventListener('keydown', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\tdocument.addEventListener('keyup', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\r\n\tif ($input.form) {\r\n\t\t$input.form.addEventListener('submit', function(){\r\n\t\t\tauto_swap($input);\r\n\t\t})\r\n\t}\r\n\r\n\tvar focused_via_click = false;\r\n\r\n\t$input.addEventListener('mousedown', function(){\r\n\t\tfocused_via_click = true;\r\n\t});\r\n\r\n\t// Turns the IE clear button into a reset button\r\n\t$input.addEventListener('mouseup', function(){\r\n\t\tsetTimeout(function(){\r\n\t\t\tif ($input.value === '') reset($input);\r\n\t\t}, 1)\r\n\t});\r\n\r\n\t$input.addEventListener('click', function(e){\r\n\t\tselect_cursor_segment($input);\r\n\t});\r\n\r\n\t$input.addEventListener('blur', function(){\r\n\t\tvar current_value = $input.dataset.value;\r\n\t\tif (current_value !== prev_value) {\r\n\t\t\tprev_value = current_value;\r\n\t\t}\r\n\t\tfocused_via_click = false;\r\n\t});\r\n\r\n\t$input.addEventListener('focus', function(e){\r\n\t\tif (!focused_via_click) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar segment = shiftKey ? 'mode' : 'hrs';\r\n\t\t\tselect_segment($input, segment);\r\n\t\t}\r\n\t\tupdate_a11y($input, [\r\n\t\t\t'initial',\r\n\t\t\t'select'\r\n\t\t])\r\n\t});\r\n\r\n\t$input.addEventListener('keydown', function(e) {\r\n\t\tvar is_enter_key = e.which === 13;\r\n\t\tif (is_enter_key) return true;\r\n\r\n\t\tvar is_number_key = all_number_keys.indexOf(e.which) > -1;\r\n\t\tvar is_named_key = values(named_keys).indexOf(e.which) > -1;\r\n\t\tvar is_arrow_key = [named_keys.ArrowDown, named_keys.ArrowRight, named_keys.ArrowUp, named_keys.ArrowLeft].indexOf(e.which) > -1;\r\n\t\tvar is_mode_key = [named_keys.a, named_keys.p].indexOf(e.which) > -1;\r\n\t\tvar is_delete_key = [named_keys.Delete, named_keys.Backspace].indexOf(e.which) > -1;\r\n\r\n\t\tif (!is_named_key || is_arrow_key || is_number_key || is_mode_key || is_delete_key) { e.preventDefault(); }\r\n\r\n\t\tif (is_number_key) {\r\n\t\t\tmanual_number_entry($input, e.which);\r\n\t\t}\r\n\r\n\t\tif (is_delete_key) {\r\n\t\t\tvar segment = get_current_segment($input);\r\n\t\t\tclear_segment($input, segment);\r\n\t\t}\r\n\r\n\t\tswitch (e.which) {\r\n\t\t\tcase named_keys.ArrowRight: next_segment($input); break;\r\n\t\t\tcase named_keys.ArrowLeft: prev_segment($input); break;\r\n\t\t\tcase named_keys.ArrowUp: increment_current_segment($input); break;\r\n\t\t\tcase named_keys.ArrowDown: decrement_current_segment($input); break;\r\n\t\t\tcase named_keys.Escape: reset($input); break;\r\n\t\t\tcase named_keys.a: set_mode($input, 'AM'); break;\r\n\t\t\tcase named_keys.p: set_mode($input, 'PM'); break;\r\n\t\t\tcase named_keys.Tab: handle_tab($input, e); break;\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction auto_swap($input) {\r\n\tif ($input.polyfill.autoSwap) {\r\n\t\tswitch_times($input, 24);\r\n\t\tsetTimeout(function(){\r\n\t\t\tswitch_times($input, 12);\r\n\t\t}, 1);\r\n\t}\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"../events/handle_tab\":11,\"../getters/get_current_segment\":15,\"../helpers/values\":21,\"../selectors/next_segment\":23,\"../selectors/prev_segment\":24,\"../selectors/select_cursor_segment\":25,\"../selectors/select_segment\":26,\"../setters/clear_segment\":29,\"../setters/decrement_current_segment\":31,\"../setters/increment_current_segment\":33,\"../setters/manual_number_entry\":34,\"../setters/reset\":36,\"../setters/set_mode\":38,\"../setters/switch_times\":42,\"../static-values/all_number_keys\":45,\"../static-values/named_keys\":46}],10:[function(require,module,exports){\n\r\nmodule.exports = function create_event(eventName){\r\n\tvar event = document.createEvent('Event');\r\n\tevent.initEvent(eventName, true, true);\r\n\treturn event;\r\n}\r\n\n},{}],11:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nmodule.exports = function handle_tab($input, e) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tvar backwards_and_first = e.shiftKey && current_segment === 'hrs';\r\n\tvar forwards_and_last = !e.shiftKey && current_segment === 'mode';\r\n\r\n\tif (!backwards_and_first && !forwards_and_last) {\r\n\t\te.preventDefault();\r\n\t\tif (e.shiftKey) {\r\n\t\t\tprev_segment($input);\r\n\t\t} else {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../selectors/next_segment\":23,\"../selectors/prev_segment\":24}],12:[function(require,module,exports){\n\r\nvar trigger_event = require('./trigger_event');\r\n\r\n// It seems that oninput and onchange are treated the same way by browsers :/\r\nmodule.exports = function trigger_both_events($input) {\r\n\t// the event only ever fires if there is a full valid value available\r\n\ttrigger_event($input, 'input');\r\n\ttrigger_event($input,'change');\r\n}\r\n\n},{\"./trigger_event\":13}],13:[function(require,module,exports){\n\r\nvar create_event = require('./create_event');\r\n\r\nvar inputEvent = create_event('input');\r\nvar changeEvent = create_event('change');\r\n\r\nmodule.exports = function trigger_event($input, eventName) {\r\n\tvar event = {\r\n\t\tinput: inputEvent,\r\n\t\tchange: changeEvent,\r\n\t}[eventName];\r\n\r\n\tif (can_trigger_change($input)) {\r\n\t\t$input.dispatchEvent(event);\r\n\t}\r\n}\r\n\r\n// Browsers only send out input and change events if the time element has a full valid value\r\nfunction can_trigger_change ($input) {\r\n\treturn !/--/.test($input.value);\r\n}\r\n\n},{\"./create_event\":10}],14:[function(require,module,exports){\n// selector is optional, it allows for an early exit\r\nmodule.exports = function ($input, selectorString) {\r\n\tvar $elem = $input;\r\n\r\n\t// https://stackoverflow.com/a/8729274/1611058\r\n\tvar ancestors = [];\r\n\twhile ($elem) {\r\n\t\tancestors.push($elem);\r\n\t\tvar matchesSelector = $elem.msMatchesSelector ?\r\n\t\t\t$elem.msMatchesSelector(selectorString) :\r\n\t\t\t$elem.matches(selectorString);\r\n\t\tif (matchesSelector) {\r\n\t\t\treturn ancestors;\r\n\t\t}\r\n\t\t$elem = $elem.parentElement;\r\n\t}\r\n\r\n\treturn ancestors;\r\n}\r\n\n},{}],15:[function(require,module,exports){\n\r\nvar ranges = require('../static-values/ranges');\r\nvar get_selected_range = require('./get_selected_range');\r\n\r\nmodule.exports = function get_current_segment ($input) {\r\n\tvar selection = get_selected_range($input);\r\n\tfor (var segment in ranges) {\r\n\t\tvar range = ranges[segment];\r\n\t\tvar aboveMin = range.start <= selection.start;\r\n\t\tvar belowMax = range.end >= selection.end;\r\n\t\tif (aboveMin && belowMax) {\r\n\t\t\treturn segment;\r\n\t\t}\r\n\t}\r\n\treturn 'hrs';\r\n}\r\n\n},{\"../static-values/ranges\":47,\"./get_selected_range\":17}],16:[function(require,module,exports){\n\r\nvar get_ancestors = require('./get_ancestors');\r\n\r\nmodule.exports = function get_label ($input) {\r\n\r\n\tvar labelText =\r\n\t\taria_labelledby($input) ||\r\n\t\taria_label($input) ||\r\n\t\tfor_attribute($input) ||\r\n\t\tlabel_wrapper_element($input) ||\r\n\t\ttitle_attribute($input);\r\n\r\n\tif (labelText) return labelText;\r\n\r\n\tconsole.error('Label text for input not found.', $input);\r\n\tthrow new Error('Cannot polyfill time input due to a missing label.');\r\n}\r\n\r\nfunction aria_labelledby($input){\r\n\tvar ariaLabelByID = $input.getAttribute('aria-labelledby');\r\n\tif (ariaLabelByID) {\r\n\t\tvar $ariaLabelBy = document.getElementById(ariaLabelByID);\r\n\t\tif ($ariaLabelBy) return $ariaLabelBy.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction aria_label($input){\r\n\tvar ariaLabel = $input.getAttribute('aria-label');\r\n\tif (ariaLabel) return ariaLabel;\r\n\treturn false;\r\n}\r\n\r\nfunction for_attribute($input){\r\n\tif ($input.id) {\r\n\t\tvar $forLabel = document.querySelector('label[for=\"'+$input.id+'\"]');\r\n\t\tif ($forLabel) return $forLabel.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction label_wrapper_element($input){\r\n\tvar ancestors = get_ancestors($input, 'label');\r\n\tvar $parentLabel = ancestors[ancestors.length - 1];\r\n\tif ($parentLabel.nodeName == 'LABEL') return $parentLabel.textContent;\r\n\treturn false\r\n}\r\n\r\nfunction title_attribute($input){\r\n\tvar titleLabel = $input.getAttribute('title');\r\n\tif (titleLabel) return titleLabel;\r\n\treturn false\r\n}\r\n\n},{\"./get_ancestors\":14}],17:[function(require,module,exports){\n\r\nmodule.exports = function get_selected_range ($input) {\r\n\treturn { start: $input.selectionStart, end: $input.selectionEnd };\r\n}\r\n\n},{}],18:[function(require,module,exports){\n\r\nvar convert_number = require('../converters/convert_number');\r\n\r\nmodule.exports = function get_values ($input, timeString) {\r\n\tvar value = timeString ? timeString : $input.value;\r\n\tvar regEx = /([0-9-]{1,2})\\:([0-9-]{1,2})\\s?(AM|PM|\\-\\-)?/;\r\n\tvar result = regEx.exec(value);\r\n\r\n\treturn {\r\n\t\thrs: convert_number(result[1]),\r\n\t\tmin: convert_number(result[2]),\r\n\t\tmode: result[3],\r\n\t}\r\n}\r\n\n},{\"../converters/convert_number\":4}],19:[function(require,module,exports){\n\r\nvar manual_entry_log = [];\r\n\r\nfunction clear () {\r\n\tmanual_entry_log = [];\r\n}\r\n\r\nfunction add (entry) {\r\n\tmanual_entry_log.push(entry);\r\n}\r\n\r\nfunction items(){\r\n\treturn manual_entry_log;\r\n}\r\n\r\nmodule.exports = {\r\n\titems: items,\r\n\tclear: clear,\r\n\tadd: add,\r\n}\r\n\n},{}],20:[function(require,module,exports){\n\r\nmodule.exports = function prevent_user_select ($input) {\r\n\t$input.style.msUserSelect = \"none\";\r\n\t$input.style.mozUserSelect = \"none\";\r\n\t$input.style.webkitUserSelect = \"none\";\r\n\t$input.style.userSelect = \"none\";\r\n}\r\n\n},{}],21:[function(require,module,exports){\n\r\n// IE11 doesn't support Object.values()\r\nmodule.exports = function values (obj) {\r\n\tvar key_values = [];\r\n\tfor (var key in obj) {\r\n\t\tkey_values.push(obj[key]);\r\n\t}\r\n\treturn key_values;\r\n}\r\n\n},{}],22:[function(require,module,exports){\n\r\nvar toArray = require('../converters/toArray');\r\n\r\nmodule.exports = function _$$ (selector) {\r\n\tvar elements = document.querySelectorAll(selector);\r\n\treturn toArray(elements);\r\n}\r\n\n},{\"../converters/toArray\":8}],23:[function(require,module,exports){\n\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function next_segment ($input) {\r\n\ttraverse($input, 'next');\r\n}\r\n\n},{\"./traverse\":27}],24:[function(require,module,exports){\n\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function prev_segment ($input) {\r\n\ttraverse($input, 'prev');\r\n}\r\n\n},{\"./traverse\":27}],25:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('./select_segment');\r\n\r\nmodule.exports = function select_cursor_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tselect_segment($input, current_segment);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"./select_segment\":26}],26:[function(require,module,exports){\n\r\nmodule.exports = function select_segment ($input, segment) {\r\n\r\n\tset_input_type();\r\n\r\n\tvar actions = {\r\n\t\thrs: select(0, 2),\r\n\t\tmin: select(3, 5),\r\n\t\tmode: select(6, 8),\r\n\t};\r\n\r\n\tactions[segment]($input);\r\n\r\n\tfunction set_input_type() {\r\n\t\tvar type = segment === 'mode' ? 'text' : 'tel';\r\n\t\t$input.setAttribute('type', type);\r\n\t}\r\n\r\n\tfunction select (start, end) {\r\n\t\treturn function () {\r\n\t\t\t$input.setSelectionRange(start, end);\r\n\t\t}\r\n\t}\r\n}\r\n\n},{}],27:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar segments = require('../static-values/segments');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function traverse ($input, direction) {\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tvar modifier = direction === 'next' ? 1 : -1;\r\n\tvar next_segment_index = segments.indexOf(segment) + modifier;\r\n\r\n\tvar next_segment = {\r\n\t\tnext: segments[next_segment_index] || 'mode',\r\n\t\tprev: next_segment_index < 0 ? 'hrs' : segments[next_segment_index],\r\n\t}[direction];\r\n\r\n\tselect_segment($input, next_segment);\r\n\tmanual_entry_log.clear();\r\n\tupdate_a11y($input, ['select'])\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"../getters/get_current_segment\":15,\"../helpers/manual_entry_log\":19,\"../selectors/select_segment\":26,\"../static-values/segments\":48}],28:[function(require,module,exports){\n\r\n// I need to keep this separate from reset so that\r\n// I can reset without attracting focus\r\n\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function apply_default ($input) {\r\n\t$input.value = '--:-- --';\r\n\tset_data_attribute($input, '');\r\n\ttrigger_both_events($input);\r\n}\r\n\n},{\"../events/trigger_both_events\":12,\"../setters/set_data_attribute\":37}],29:[function(require,module,exports){\n\r\nvar set_segment = require('./set_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function clear_segment ($input, segment) {\r\n\tset_segment($input, segment, '--');\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"./set_segment\":39}],30:[function(require,module,exports){\n\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function decrement ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'PM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'down');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"./nudge_time_segment\":35,\"./switch_mode\":41}],31:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar decrement = require('../setters/decrement');\r\n\r\nmodule.exports = function decrement_current_segment ($input){\r\n\tvar current_segment = get_current_segment($input);\r\n\tdecrement($input, current_segment);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../setters/decrement\":30}],32:[function(require,module,exports){\n\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function increment ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'AM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'up');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\r\n\n},{\"../accessibility/update_a11y\":2,\"./nudge_time_segment\":35,\"./switch_mode\":41}],33:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar increment = require('../setters/increment');\r\n\r\nmodule.exports = function increment_current_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tincrement($input, current_segment);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../setters/increment\":32}],34:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar sorted_number_keys = require('../static-values/sorted_number_keys');\r\n\r\nmodule.exports = function manual_number_entry($input, key) {\r\n\tvar key_value = sorted_number_keys[key];\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tif (segment !== 'mode') {\r\n\t\tvar entry_count = manual_entry_log.items().length;\r\n\r\n\t\tvar upper_limits = {\r\n\t\t\thrs: [1,2],\r\n\t\t\tmin: [5,9],\r\n\t\t}\r\n\t\tvar limit = upper_limits[segment][entry_count];\r\n\r\n\t\tif (entry_count < 2) {\r\n\t\t\tmanual_entry_log.add(key_value);\r\n\t\t}\r\n\r\n\t\tvar full_limit = parseInt(upper_limits[segment].join(''));\r\n\t\tvar full_entry = parseInt(manual_entry_log.items().join(''));\r\n\r\n\t\tif (full_limit >= full_entry) {\r\n\t\t\tset_segment($input, segment, full_entry);\r\n\t\t}\r\n\r\n\t\tvar at_limit = key_value > limit || manual_entry_log.items().length === 2;\r\n\r\n\t\tif (at_limit) {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../helpers/manual_entry_log\":19,\"../selectors/next_segment\":23,\"../static-values/sorted_number_keys\":49,\"./set_segment\":39}],35:[function(require,module,exports){\n\r\nvar get_values = require('../getters/get_values');\r\nvar convert_hours_to_12hr_time = require('../converters/convert_hours_to_12hr_time');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function nudge_time_segment ($input, segment, direction) {\r\n\tvar current_values = get_values($input);\r\n\tvar time;\r\n\r\n\tvar modifier = direction === 'up' ? 1 : -1;\r\n\r\n\tif (current_values[segment] === '--') {\r\n\t\tvar current_time = new Date();\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_time.getHours()),\r\n\t\t\tmin: current_time.getMinutes(),\r\n\t\t}\r\n\t} else {\r\n\t\tvar minutes = {\r\n\t\t\tup : current_values.min < 59 ? current_values.min + modifier : 0,\r\n\t\t\tdown : current_values.min === 0 ? 59 : current_values.min + modifier,\r\n\t\t}\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_values.hrs + modifier),\r\n\t\t\tmin: minutes[direction],\r\n\t\t}\r\n\t}\r\n\r\n\tset_segment($input, segment, leading_zero(time[segment]) );\r\n}\r\n\n},{\"../converters/convert_hours_to_12hr_time\":3,\"../converters/leading_zero\":7,\"../getters/get_values\":18,\"./set_segment\":39}],36:[function(require,module,exports){\n\r\nvar apply_default = require('./apply_default');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nmodule.exports = function reset ($input) {\r\n\tapply_default($input);\r\n\tselect_segment($input, 'hrs');\r\n}\r\n\n},{\"../selectors/select_segment\":26,\"./apply_default\":28}],37:[function(require,module,exports){\n\r\nvar convert_to_24hr_time = require('../converters/convert_to_24hr_time')\r\n\r\nmodule.exports = function set_data_attribute($input, timeString_12hr){\r\n\tvar filteredString = timeString_12hr.indexOf('-') > -1 ? '' : timeString_12hr;\r\n\tvar time24hr = convert_to_24hr_time(filteredString);\r\n\t$input.setAttribute('data-value', time24hr);\r\n}\r\n\n},{\"../converters/convert_to_24hr_time\":6}],38:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function set_mode ($input, type) {\r\n\tvar segment = get_current_segment($input);\r\n\tif (segment === 'mode') {\r\n\t\tset_segment($input, segment, type);\r\n\t}\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"./set_segment\":39}],39:[function(require,module,exports){\n\r\nvar get_values = require('../getters/get_values');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar select_segment = require('../selectors/select_segment');\r\nvar set_data_attribute = require('./set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function set_segment ($input, segment, value) {\r\n\tvar values = get_values($input);\r\n\tvalues[segment] = value;\r\n\tvar newInputVal = [\r\n\t\tleading_zero(values.hrs),':',\r\n\t\tleading_zero(values.min),' ',\r\n\t\tvalues.mode\r\n\t].join('');\r\n\t$input.value = newInputVal;\r\n\tselect_segment($input, segment);\r\n\tset_data_attribute($input, newInputVal);\r\n\ttrigger_both_events($input);\r\n}\r\n\n},{\"../converters/leading_zero\":7,\"../events/trigger_both_events\":12,\"../getters/get_values\":18,\"../selectors/select_segment\":26,\"./set_data_attribute\":37}],40:[function(require,module,exports){\n\r\nvar convert_to_12hr_time = require('../converters/convert_to_12hr_time');\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\n\r\nmodule.exports = function set_time($input, time_string_24hr) {\r\n\tvar twelveHr = convert_to_12hr_time(time_string_24hr);\r\n\t$input.value = twelveHr;\r\n\tset_data_attribute($input, time_string_24hr);\r\n}\r\n\n},{\"../converters/convert_to_12hr_time\":5,\"../setters/set_data_attribute\":37}],41:[function(require,module,exports){\n\r\nvar get_values = require('../getters/get_values');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function switch_mode ($input, default_mode) {\r\n\tdefault_mode = default_mode || 'AM';\r\n\tvar current_mode = get_values($input).mode;\r\n\tvar new_mode = {\r\n\t\t'--' : default_mode,\r\n\t\t'AM' : 'PM',\r\n\t\t'PM' : 'AM',\r\n\t}[current_mode];\r\n\tset_segment($input, 'mode', new_mode);\r\n}\r\n\n},{\"../getters/get_values\":18,\"./set_segment\":39}],42:[function(require,module,exports){\n\r\nvar switch_to_data_value = require('./switch_to_data_value');\r\nvar set_time = require('./set_time');\r\n\r\nmodule.exports = function switch_times ($input, format) {\r\n\tvar is12hr = /\\s/.test($input.value);\r\n\r\n\tif (format != 12 && format != 24) {\r\n\t\tformat = is12hr ? 24 : 12;\r\n\t}\r\n\r\n\tvar actions = {\r\n\t\t12: function(){\r\n\t\t\tif (!is12hr) {\r\n\t\t\t\tset_time($input, $input.dataset.value);\r\n\t\t\t}\r\n\t\t},\r\n\t\t24: function(){\r\n\t\t\tif (is12hr) {\r\n\t\t\t\tswitch_to_data_value($input);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tactions[format]();\r\n}\r\n\n},{\"./set_time\":40,\"./switch_to_data_value\":43}],43:[function(require,module,exports){\n\r\nmodule.exports = function($input) {\r\n\tvar replacementVal = $input.dataset.value;\r\n\t$input.value = replacementVal;\r\n}\r\n\n},{}],44:[function(require,module,exports){\n\r\nvar set_time = require('../setters/set_time');\r\n\r\nmodule.exports = function update_time($input) {\r\n\tset_time($input, $input.value);\r\n\treturn $input;\r\n}\r\n\n},{\"../setters/set_time\":40}],45:[function(require,module,exports){\nvar all_number_keys = [\r\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\r\n 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\r\n 96, 97, 98, 99,100,101,102,103,104,105\r\n];\r\n\r\nmodule.exports = all_number_keys;\r\n\n},{}],46:[function(require,module,exports){\nvar named_keys = {\r\n\tArrowDown: 40,\r\n\tArrowRight: 39,\r\n\tArrowUp: 38,\r\n\tArrowLeft: 37,\r\n\tBackspace: 8,\r\n\tDelete: 46,\r\n\tTab: 9,\r\n\tShift: 16,\r\n\tEscape: 27,\r\n\ta: 65,\r\n\tp: 80,\r\n}\r\n\r\nmodule.exports = named_keys;\r\n\n},{}],47:[function(require,module,exports){\n\r\nvar ranges = {\r\n\thrs : { start: 0, end: 2 },\r\n\tmin : { start: 3, end: 5 },\r\n\tmode : { start: 6, end: 8 },\r\n}\r\n\r\nmodule.exports = ranges;\r\n\n},{}],48:[function(require,module,exports){\n\r\nvar ranges = require('./ranges');\r\n\r\nvar segments = Object.keys(ranges);\r\n\r\nmodule.exports = segments;\r\n\n},{\"./ranges\":47}],49:[function(require,module,exports){\n\r\nvar all_number_keys = require('./all_number_keys');\r\n\r\nvar sorted_number_keys = {};\r\n// sorted_number_keys = { 48: 0, 49: 1, 96: 0, 97: 1, ... };\r\nall_number_keys.forEach(function(key, index) {\r\n\tvar number_val = index > 9 ? index - 10 : index;\r\n\tsorted_number_keys[key] = number_val;\r\n});\r\n\r\nmodule.exports = sorted_number_keys;\r\n\n},{\"./all_number_keys\":45}],50:[function(require,module,exports){\n\r\nvar prevent_user_select = require('./core/helpers/prevent_user_select');\r\nvar apply_default = require('./core/setters/apply_default');\r\nvar update_time = require('./core/setters/update_time');\r\nvar set_data_attribute = require('./core/setters/set_data_attribute');\r\nvar bind_events = require('./core/events/bind_events');\r\nvar switch_times = require('./core/setters/switch_times');\r\nvar get_label = require('./core/getters/get_label');\r\n\r\nvar create_a11y_block = require('./core/accessibility/create_a11y_block');\r\n\r\nvar accessibility_block_created = false;\r\nvar $a11y;\r\n\r\nfunction TimePolyfill($input) {\r\n\r\n\t$input.setAttribute('autocomplete','off');\r\n\r\n\tprevent_user_select($input);\r\n\r\n\t// Prevent screen reader from announcing the default stuff\r\n\t$input.setAttribute('aria-hidden', true);\r\n\r\n\tif (!accessibility_block_created) {\r\n\t\t$a11y = create_a11y_block();\r\n\t\taccessibility_block_created = true;\r\n\t}\r\n\r\n\tvar label = get_label($input);\r\n\r\n\t$input.polyfill = {\r\n\t\t$a11y: $a11y,\r\n\t\tlabel: label,\r\n\t\tautoSwap: true,\r\n\t\tupdate: function() {\r\n\t\t\tupdate_time($input);\r\n\t\t},\r\n\t\tswap: function(forcedFormat) {\r\n\t\t\tswitch_times($input, forcedFormat);\r\n\t\t}\r\n\t}\r\n\r\n\tif ($input.value === '' || /--/.test($input.value)) {\r\n\t\tapply_default($input);\r\n\t\tset_data_attribute($input, '');\r\n\t} else {\r\n\t\tupdate_time($input);\r\n\t\tset_data_attribute($input, $input.value);\r\n\t}\r\n\r\n\tbind_events($input);\r\n}\r\n\r\nif (window) window.TimePolyfill = TimePolyfill;\r\nif (module) module.exports = TimePolyfill;\r\n\n},{\"./core/accessibility/create_a11y_block\":1,\"./core/events/bind_events\":9,\"./core/getters/get_label\":16,\"./core/helpers/prevent_user_select\":20,\"./core/setters/apply_default\":28,\"./core/setters/set_data_attribute\":37,\"./core/setters/switch_times\":42,\"./core/setters/update_time\":44}],51:[function(require,module,exports){\n\r\nmodule.exports = function($result, values){\r\n\tvar $list = $result.querySelector('.result__list');\r\n\tvar $close = $result.querySelector('.result__close');\r\n\r\n\tvar html = '';\r\n\tfor (var label in values) {\r\n\t\tvar value = values[label].replace(/^$/,'blank');\r\n\t\thtml = html + [\r\n\t\t\t'' + textArray.join('
') + '
';\r\n\t\thtml = html.replace(/\\$label/g, $input.polyfill.label);\r\n\t\thtml = html.replace(/\\$segmentName/g, segmentName);\r\n\t\thtml = html.replace(/\\$segmentValue/g, finalValue);\r\n\t\thtml = html.replace(/\\$fullValue/g, fullValue);\r\n\r\n\t\t$input.polyfill.$a11y.innerHTML = html;\r\n\t}, 1);\r\n}\r\n","\r\nmodule.exports = function convert_hours_to_12hr_time (hours) {\r\n\treturn hours <= 12 ? hours === 0 ? 12 : hours : hours - 12;\r\n}\r\n","\r\nmodule.exports = function convert_number (number) {\r\n\treturn isNaN(number) ? number : parseInt(number);\r\n}\r\n","\r\nvar convert_number = require('./convert_number');\r\nvar convert_hours_to_12hr_time = require('./convert_hours_to_12hr_time');\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_12hr_time (timeString_24hr) {\r\n\tif (timeString_24hr === '') return '--:-- --';\r\n\tvar twentyFour_regex = /([0-9]{2})\\:([0-9]{2})/;\r\n\tvar result = twentyFour_regex.exec(timeString_24hr);\r\n\tvar hrs_24 = convert_number(result[1]);\r\n\tvar min = result[2];\r\n\tvar hrs_12 = convert_hours_to_12hr_time(hrs_24);\r\n\tvar isPM = hrs_24 > 12;\r\n\tvar mode = isPM ? 'PM' : 'AM';\r\n\treturn [leading_zero(hrs_12), ':', min, ' ', mode].join('');\r\n}\r\n","\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_24hr_time (timeString_12hr) {\r\n\tif (/-/.test(timeString_12hr)) return '';\r\n\tvar isPM = timeString_12hr.indexOf('PM') > -1;\r\n\tvar timeResult = /^([0-9]{2})/.exec(timeString_12hr);\r\n\tvar hrs = timeResult ? parseInt(timeResult[1]) : '';\r\n\tvar newHrs;\r\n\tif (hrs === 12) {\r\n\t\tnewHrs = isPM ? 12 : 00;\r\n\t} else {\r\n\t\tnewHrs = isPM ? hrs + 12 : hrs;\r\n\t}\r\n\tvar finalHrs = newHrs === 24 ? 0 : newHrs;\r\n\tvar timeRegEx = /^[0-9]{2}:([0-9]{2}) (AM|PM)/;\r\n\treturn timeString_12hr.replace(timeRegEx, leading_zero(finalHrs)+':$1');\r\n}\r\n","\r\nmodule.exports = function leading_zero (number) {\r\n\tif (isNaN(number)) return number;\r\n\tvar purified = parseInt(number);\r\n\treturn purified < 10 ? '0' + purified : number;\r\n}\r\n","\r\nmodule.exports = function(array){\r\n\treturn Array.prototype.slice.call(array, 0);\r\n}\r\n","\r\nvar values = require('../helpers/values');\r\n\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar next_segment = require('../selectors/next_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar select_cursor_segment = require('../selectors/select_cursor_segment');\r\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\n\r\nvar reset = require('../setters/reset');\r\nvar manual_number_entry = require('../setters/manual_number_entry');\r\nvar clear_segment = require('../setters/clear_segment');\r\nvar increment_current_segment = require('../setters/increment_current_segment');\r\nvar decrement_current_segment = require('../setters/decrement_current_segment');\r\nvar set_mode = require('../setters/set_mode');\r\nvar switch_times = require('../setters/switch_times');\r\n\r\nvar handle_tab = require('../events/handle_tab');\r\n\r\nvar all_number_keys = require('../static-values/all_number_keys');\r\nvar named_keys = require('../static-values/named_keys');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function bind_events ($input) {\r\n\r\n\tvar prev_value = '';\r\n\r\n\tvar shiftKey = false;\r\n\r\n\tdocument.addEventListener('keydown', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\tdocument.addEventListener('keyup', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\r\n\tif ($input.form) {\r\n\t\t$input.form.addEventListener('submit', function(){\r\n\t\t\tauto_swap($input);\r\n\t\t})\r\n\t}\r\n\r\n\tvar focused_via_click = false;\r\n\r\n\t$input.addEventListener('mousedown', function(){\r\n\t\tfocused_via_click = true;\r\n\t});\r\n\r\n\t// Turns the IE clear button into a reset button\r\n\t$input.addEventListener('mouseup', function(){\r\n\t\tsetTimeout(function(){\r\n\t\t\tif ($input.value === '') reset($input);\r\n\t\t}, 1)\r\n\t});\r\n\r\n\t$input.addEventListener('click', function(e){\r\n\t\tselect_cursor_segment($input);\r\n\t});\r\n\r\n\t$input.addEventListener('blur', function(){\r\n\t\tvar current_value = $input.dataset.value;\r\n\t\tif (current_value !== prev_value) {\r\n\t\t\tprev_value = current_value;\r\n\t\t}\r\n\t\tfocused_via_click = false;\r\n\t});\r\n\r\n\t$input.addEventListener('focus', function(e){\r\n\t\tif (!focused_via_click) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar segment = shiftKey ? 'mode' : 'hrs';\r\n\t\t\tselect_segment($input, segment);\r\n\t\t}\r\n\t\tupdate_a11y($input, [\r\n\t\t\t'initial',\r\n\t\t\t'select'\r\n\t\t])\r\n\t});\r\n\r\n\t$input.addEventListener('keydown', function(e) {\r\n\t\tvar is_enter_key = e.which === 13;\r\n\t\tif (is_enter_key) return true;\r\n\r\n\t\tvar is_number_key = all_number_keys.indexOf(e.which) > -1;\r\n\t\tvar is_named_key = values(named_keys).indexOf(e.which) > -1;\r\n\t\tvar is_arrow_key = [named_keys.ArrowDown, named_keys.ArrowRight, named_keys.ArrowUp, named_keys.ArrowLeft].indexOf(e.which) > -1;\r\n\t\tvar is_mode_key = [named_keys.a, named_keys.p].indexOf(e.which) > -1;\r\n\t\tvar is_delete_key = [named_keys.Delete, named_keys.Backspace].indexOf(e.which) > -1;\r\n\r\n\t\tif (!is_named_key || is_arrow_key || is_number_key || is_mode_key || is_delete_key) { e.preventDefault(); }\r\n\r\n\t\tif (is_number_key) {\r\n\t\t\tmanual_number_entry($input, e.which);\r\n\t\t}\r\n\r\n\t\tif (is_delete_key) {\r\n\t\t\tvar segment = get_current_segment($input);\r\n\t\t\tclear_segment($input, segment);\r\n\t\t}\r\n\r\n\t\tswitch (e.which) {\r\n\t\t\tcase named_keys.ArrowRight: next_segment($input); break;\r\n\t\t\tcase named_keys.ArrowLeft: prev_segment($input); break;\r\n\t\t\tcase named_keys.ArrowUp: increment_current_segment($input); break;\r\n\t\t\tcase named_keys.ArrowDown: decrement_current_segment($input); break;\r\n\t\t\tcase named_keys.Escape: reset($input); break;\r\n\t\t\tcase named_keys.a: set_mode($input, 'AM'); break;\r\n\t\t\tcase named_keys.p: set_mode($input, 'PM'); break;\r\n\t\t\tcase named_keys.Tab: handle_tab($input, e); break;\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction auto_swap($input) {\r\n\tif ($input.polyfill.autoSwap) {\r\n\t\tswitch_times($input, 24);\r\n\t\tsetTimeout(function(){\r\n\t\t\tswitch_times($input, 12);\r\n\t\t}, 1);\r\n\t}\r\n}\r\n","\r\nmodule.exports = function create_event(eventName){\r\n\tvar event = document.createEvent('Event');\r\n\tevent.initEvent(eventName, true, true);\r\n\treturn event;\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nmodule.exports = function handle_tab($input, e) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tvar backwards_and_first = e.shiftKey && current_segment === 'hrs';\r\n\tvar forwards_and_last = !e.shiftKey && current_segment === 'mode';\r\n\r\n\tif (!backwards_and_first && !forwards_and_last) {\r\n\t\te.preventDefault();\r\n\t\tif (e.shiftKey) {\r\n\t\t\tprev_segment($input);\r\n\t\t} else {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar trigger_event = require('./trigger_event');\r\n\r\n// It seems that oninput and onchange are treated the same way by browsers :/\r\nmodule.exports = function trigger_both_events($input) {\r\n\t// the event only ever fires if there is a full valid value available\r\n\ttrigger_event($input, 'input');\r\n\ttrigger_event($input,'change');\r\n}\r\n","\r\nvar create_event = require('./create_event');\r\n\r\nvar inputEvent = create_event('input');\r\nvar changeEvent = create_event('change');\r\n\r\nmodule.exports = function trigger_event($input, eventName) {\r\n\tvar event = {\r\n\t\tinput: inputEvent,\r\n\t\tchange: changeEvent,\r\n\t}[eventName];\r\n\r\n\tif (can_trigger_change($input)) {\r\n\t\t$input.dispatchEvent(event);\r\n\t}\r\n}\r\n\r\n// Browsers only send out input and change events if the time element has a full valid value\r\nfunction can_trigger_change ($input) {\r\n\treturn !/--/.test($input.value);\r\n}\r\n","// selector is optional, it allows for an early exit\r\nmodule.exports = function ($input, selectorString) {\r\n\tvar $elem = $input;\r\n\r\n\t// https://stackoverflow.com/a/8729274/1611058\r\n\tvar ancestors = [];\r\n\twhile ($elem) {\r\n\t\tancestors.push($elem);\r\n\t\tvar matchesSelector = $elem.msMatchesSelector ?\r\n\t\t\t$elem.msMatchesSelector(selectorString) :\r\n\t\t\t$elem.matches(selectorString);\r\n\t\tif (matchesSelector) {\r\n\t\t\treturn ancestors;\r\n\t\t}\r\n\t\t$elem = $elem.parentElement;\r\n\t}\r\n\r\n\treturn ancestors;\r\n}\r\n","\r\nvar ranges = require('../static-values/ranges');\r\nvar get_selected_range = require('./get_selected_range');\r\n\r\nmodule.exports = function get_current_segment ($input) {\r\n\tvar selection = get_selected_range($input);\r\n\tfor (var segment in ranges) {\r\n\t\tvar range = ranges[segment];\r\n\t\tvar aboveMin = range.start <= selection.start;\r\n\t\tvar belowMax = range.end >= selection.end;\r\n\t\tif (aboveMin && belowMax) {\r\n\t\t\treturn segment;\r\n\t\t}\r\n\t}\r\n\treturn 'hrs';\r\n}\r\n","\r\nvar get_ancestors = require('./get_ancestors');\r\n\r\nmodule.exports = function get_label ($input) {\r\n\r\n\tvar labelText =\r\n\t\taria_labelledby($input) ||\r\n\t\taria_label($input) ||\r\n\t\tfor_attribute($input) ||\r\n\t\tlabel_wrapper_element($input) ||\r\n\t\ttitle_attribute($input);\r\n\r\n\tif (labelText) return labelText;\r\n\r\n\tconsole.error('Label text for input not found.', $input);\r\n\tthrow new Error('Cannot polyfill time input due to a missing label.');\r\n}\r\n\r\nfunction aria_labelledby($input){\r\n\tvar ariaLabelByID = $input.getAttribute('aria-labelledby');\r\n\tif (ariaLabelByID) {\r\n\t\tvar $ariaLabelBy = document.getElementById(ariaLabelByID);\r\n\t\tif ($ariaLabelBy) return $ariaLabelBy.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction aria_label($input){\r\n\tvar ariaLabel = $input.getAttribute('aria-label');\r\n\tif (ariaLabel) return ariaLabel;\r\n\treturn false;\r\n}\r\n\r\nfunction for_attribute($input){\r\n\tif ($input.id) {\r\n\t\tvar $forLabel = document.querySelector('label[for=\"'+$input.id+'\"]');\r\n\t\tif ($forLabel) return $forLabel.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction label_wrapper_element($input){\r\n\tvar ancestors = get_ancestors($input, 'label');\r\n\tvar $parentLabel = ancestors[ancestors.length - 1];\r\n\tif ($parentLabel.nodeName == 'LABEL') return $parentLabel.textContent;\r\n\treturn false\r\n}\r\n\r\nfunction title_attribute($input){\r\n\tvar titleLabel = $input.getAttribute('title');\r\n\tif (titleLabel) return titleLabel;\r\n\treturn false\r\n}\r\n","\r\nmodule.exports = function get_selected_range ($input) {\r\n\treturn { start: $input.selectionStart, end: $input.selectionEnd };\r\n}\r\n","\r\nvar convert_number = require('../converters/convert_number');\r\n\r\nmodule.exports = function get_values ($input, timeString) {\r\n\tvar value = timeString ? timeString : $input.value;\r\n\tvar regEx = /([0-9-]{1,2})\\:([0-9-]{1,2})\\s?(AM|PM|\\-\\-)?/;\r\n\tvar result = regEx.exec(value);\r\n\r\n\treturn {\r\n\t\thrs: convert_number(result[1]),\r\n\t\tmin: convert_number(result[2]),\r\n\t\tmode: result[3],\r\n\t}\r\n}\r\n","\r\nvar manual_entry_log = [];\r\n\r\nfunction clear () {\r\n\tmanual_entry_log = [];\r\n}\r\n\r\nfunction add (entry) {\r\n\tmanual_entry_log.push(entry);\r\n}\r\n\r\nfunction items(){\r\n\treturn manual_entry_log;\r\n}\r\n\r\nmodule.exports = {\r\n\titems: items,\r\n\tclear: clear,\r\n\tadd: add,\r\n}\r\n","\r\nmodule.exports = function prevent_user_select ($input) {\r\n\t$input.style.msUserSelect = \"none\";\r\n\t$input.style.mozUserSelect = \"none\";\r\n\t$input.style.webkitUserSelect = \"none\";\r\n\t$input.style.userSelect = \"none\";\r\n}\r\n","\r\n// IE11 doesn't support Object.values()\r\nmodule.exports = function values (obj) {\r\n\tvar key_values = [];\r\n\tfor (var key in obj) {\r\n\t\tkey_values.push(obj[key]);\r\n\t}\r\n\treturn key_values;\r\n}\r\n","\r\nvar toArray = require('../converters/toArray');\r\n\r\nmodule.exports = function _$$ (selector) {\r\n\tvar elements = document.querySelectorAll(selector);\r\n\treturn toArray(elements);\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function next_segment ($input) {\r\n\ttraverse($input, 'next');\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function prev_segment ($input) {\r\n\ttraverse($input, 'prev');\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('./select_segment');\r\n\r\nmodule.exports = function select_cursor_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tselect_segment($input, current_segment);\r\n}\r\n","\r\nmodule.exports = function select_segment ($input, segment) {\r\n\r\n\tset_input_type();\r\n\r\n\tvar actions = {\r\n\t\thrs: select(0, 2),\r\n\t\tmin: select(3, 5),\r\n\t\tmode: select(6, 8),\r\n\t};\r\n\r\n\tactions[segment]($input);\r\n\r\n\tfunction set_input_type() {\r\n\t\tvar type = segment === 'mode' ? 'text' : 'tel';\r\n\t\t$input.setAttribute('type', type);\r\n\t}\r\n\r\n\tfunction select (start, end) {\r\n\t\treturn function () {\r\n\t\t\t$input.setSelectionRange(start, end);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar segments = require('../static-values/segments');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function traverse ($input, direction) {\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tvar modifier = direction === 'next' ? 1 : -1;\r\n\tvar next_segment_index = segments.indexOf(segment) + modifier;\r\n\r\n\tvar next_segment = {\r\n\t\tnext: segments[next_segment_index] || 'mode',\r\n\t\tprev: next_segment_index < 0 ? 'hrs' : segments[next_segment_index],\r\n\t}[direction];\r\n\r\n\tselect_segment($input, next_segment);\r\n\tmanual_entry_log.clear();\r\n\tupdate_a11y($input, ['select'])\r\n}\r\n","\r\n// I need to keep this separate from reset so that\r\n// I can reset without attracting focus\r\n\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function apply_default ($input) {\r\n\t$input.value = '--:-- --';\r\n\tset_data_attribute($input, '');\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar set_segment = require('./set_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function clear_segment ($input, segment) {\r\n\tset_segment($input, segment, '--');\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function decrement ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'PM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'down');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar decrement = require('../setters/decrement');\r\n\r\nmodule.exports = function decrement_current_segment ($input){\r\n\tvar current_segment = get_current_segment($input);\r\n\tdecrement($input, current_segment);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function increment ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'AM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'up');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar increment = require('../setters/increment');\r\n\r\nmodule.exports = function increment_current_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tincrement($input, current_segment);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar sorted_number_keys = require('../static-values/sorted_number_keys');\r\n\r\nmodule.exports = function manual_number_entry($input, key) {\r\n\tvar key_value = sorted_number_keys[key];\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tif (segment !== 'mode') {\r\n\t\tvar entry_count = manual_entry_log.items().length;\r\n\r\n\t\tvar upper_limits = {\r\n\t\t\thrs: [1,2],\r\n\t\t\tmin: [5,9],\r\n\t\t}\r\n\t\tvar limit = upper_limits[segment][entry_count];\r\n\r\n\t\tif (entry_count < 2) {\r\n\t\t\tmanual_entry_log.add(key_value);\r\n\t\t}\r\n\r\n\t\tvar full_limit = parseInt(upper_limits[segment].join(''));\r\n\t\tvar full_entry = parseInt(manual_entry_log.items().join(''));\r\n\r\n\t\tif (full_limit >= full_entry) {\r\n\t\t\tset_segment($input, segment, full_entry);\r\n\t\t}\r\n\r\n\t\tvar at_limit = key_value > limit || manual_entry_log.items().length === 2;\r\n\r\n\t\tif (at_limit) {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar convert_hours_to_12hr_time = require('../converters/convert_hours_to_12hr_time');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function nudge_time_segment ($input, segment, direction) {\r\n\tvar current_values = get_values($input);\r\n\tvar time;\r\n\r\n\tvar modifier = direction === 'up' ? 1 : -1;\r\n\r\n\tif (current_values[segment] === '--') {\r\n\t\tvar current_time = new Date();\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_time.getHours()),\r\n\t\t\tmin: current_time.getMinutes(),\r\n\t\t}\r\n\t} else {\r\n\t\tvar minutes = {\r\n\t\t\tup : current_values.min < 59 ? current_values.min + modifier : 0,\r\n\t\t\tdown : current_values.min === 0 ? 59 : current_values.min + modifier,\r\n\t\t}\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_values.hrs + modifier),\r\n\t\t\tmin: minutes[direction],\r\n\t\t}\r\n\t}\r\n\r\n\tset_segment($input, segment, leading_zero(time[segment]) );\r\n}\r\n","\r\nvar apply_default = require('./apply_default');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nmodule.exports = function reset ($input) {\r\n\tapply_default($input);\r\n\tselect_segment($input, 'hrs');\r\n}\r\n","\r\nvar convert_to_24hr_time = require('../converters/convert_to_24hr_time')\r\n\r\nmodule.exports = function set_data_attribute($input, timeString_12hr){\r\n\tvar filteredString = timeString_12hr.indexOf('-') > -1 ? '' : timeString_12hr;\r\n\tvar time24hr = convert_to_24hr_time(filteredString);\r\n\t$input.setAttribute('data-value', time24hr);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function set_mode ($input, type) {\r\n\tvar segment = get_current_segment($input);\r\n\tif (segment === 'mode') {\r\n\t\tset_segment($input, segment, type);\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar select_segment = require('../selectors/select_segment');\r\nvar set_data_attribute = require('./set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function set_segment ($input, segment, value) {\r\n\tvar values = get_values($input);\r\n\tvalues[segment] = value;\r\n\tvar newInputVal = [\r\n\t\tleading_zero(values.hrs),':',\r\n\t\tleading_zero(values.min),' ',\r\n\t\tvalues.mode\r\n\t].join('');\r\n\t$input.value = newInputVal;\r\n\tselect_segment($input, segment);\r\n\tset_data_attribute($input, newInputVal);\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar convert_to_12hr_time = require('../converters/convert_to_12hr_time');\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\n\r\nmodule.exports = function set_time($input, time_string_24hr) {\r\n\tvar twelveHr = convert_to_12hr_time(time_string_24hr);\r\n\t$input.value = twelveHr;\r\n\tset_data_attribute($input, time_string_24hr);\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function switch_mode ($input, default_mode) {\r\n\tdefault_mode = default_mode || 'AM';\r\n\tvar current_mode = get_values($input).mode;\r\n\tvar new_mode = {\r\n\t\t'--' : default_mode,\r\n\t\t'AM' : 'PM',\r\n\t\t'PM' : 'AM',\r\n\t}[current_mode];\r\n\tset_segment($input, 'mode', new_mode);\r\n}\r\n","\r\nvar switch_to_data_value = require('./switch_to_data_value');\r\nvar set_time = require('./set_time');\r\n\r\nmodule.exports = function switch_times ($input, format) {\r\n\tvar is12hr = /\\s/.test($input.value);\r\n\r\n\tif (format != 12 && format != 24) {\r\n\t\tformat = is12hr ? 24 : 12;\r\n\t}\r\n\r\n\tvar actions = {\r\n\t\t12: function(){\r\n\t\t\tif (!is12hr) {\r\n\t\t\t\tset_time($input, $input.dataset.value);\r\n\t\t\t}\r\n\t\t},\r\n\t\t24: function(){\r\n\t\t\tif (is12hr) {\r\n\t\t\t\tswitch_to_data_value($input);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tactions[format]();\r\n}\r\n","\r\nmodule.exports = function($input) {\r\n\tvar replacementVal = $input.dataset.value;\r\n\t$input.value = replacementVal;\r\n}\r\n","\r\nvar set_time = require('../setters/set_time');\r\n\r\nmodule.exports = function update_time($input) {\r\n\tset_time($input, $input.value);\r\n\treturn $input;\r\n}\r\n","var all_number_keys = [\r\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\r\n 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\r\n 96, 97, 98, 99,100,101,102,103,104,105\r\n];\r\n\r\nmodule.exports = all_number_keys;\r\n","var named_keys = {\r\n\tArrowDown: 40,\r\n\tArrowRight: 39,\r\n\tArrowUp: 38,\r\n\tArrowLeft: 37,\r\n\tBackspace: 8,\r\n\tDelete: 46,\r\n\tTab: 9,\r\n\tShift: 16,\r\n\tEscape: 27,\r\n\ta: 65,\r\n\tp: 80,\r\n}\r\n\r\nmodule.exports = named_keys;\r\n","\r\nvar ranges = {\r\n\thrs : { start: 0, end: 2 },\r\n\tmin : { start: 3, end: 5 },\r\n\tmode : { start: 6, end: 8 },\r\n}\r\n\r\nmodule.exports = ranges;\r\n","\r\nvar ranges = require('./ranges');\r\n\r\nvar segments = Object.keys(ranges);\r\n\r\nmodule.exports = segments;\r\n","\r\nvar all_number_keys = require('./all_number_keys');\r\n\r\nvar sorted_number_keys = {};\r\n// sorted_number_keys = { 48: 0, 49: 1, 96: 0, 97: 1, ... };\r\nall_number_keys.forEach(function(key, index) {\r\n\tvar number_val = index > 9 ? index - 10 : index;\r\n\tsorted_number_keys[key] = number_val;\r\n});\r\n\r\nmodule.exports = sorted_number_keys;\r\n","\r\nvar prevent_user_select = require('./core/helpers/prevent_user_select');\r\nvar apply_default = require('./core/setters/apply_default');\r\nvar update_time = require('./core/setters/update_time');\r\nvar set_data_attribute = require('./core/setters/set_data_attribute');\r\nvar bind_events = require('./core/events/bind_events');\r\nvar switch_times = require('./core/setters/switch_times');\r\nvar get_label = require('./core/getters/get_label');\r\n\r\nvar create_a11y_block = require('./core/accessibility/create_a11y_block');\r\n\r\nvar accessibility_block_created = false;\r\nvar $a11y;\r\n\r\nfunction TimePolyfill($input) {\r\n\r\n\t$input.setAttribute('autocomplete','off');\r\n\r\n\tprevent_user_select($input);\r\n\r\n\t// Prevent screen reader from announcing the default stuff\r\n\t$input.setAttribute('aria-hidden', true);\r\n\r\n\tif (!accessibility_block_created) {\r\n\t\t$a11y = create_a11y_block();\r\n\t\taccessibility_block_created = true;\r\n\t}\r\n\r\n\tvar label = get_label($input);\r\n\r\n\t$input.polyfill = {\r\n\t\t$a11y: $a11y,\r\n\t\tlabel: label,\r\n\t\tautoSwap: true,\r\n\t\tupdate: function() {\r\n\t\t\tupdate_time($input);\r\n\t\t},\r\n\t\tswap: function(forcedFormat) {\r\n\t\t\tswitch_times($input, forcedFormat);\r\n\t\t}\r\n\t}\r\n\r\n\tif ($input.value === '' || /--/.test($input.value)) {\r\n\t\tapply_default($input);\r\n\t\tset_data_attribute($input, '');\r\n\t} else {\r\n\t\tupdate_time($input);\r\n\t\tset_data_attribute($input, $input.value);\r\n\t}\r\n\r\n\tbind_events($input);\r\n}\r\n\r\nif (window) window.TimePolyfill = TimePolyfill;\r\nif (module) module.exports = TimePolyfill;\r\n","\r\nmodule.exports = function($result, values){\r\n\tvar $list = $result.querySelector('.result__list');\r\n\tvar $close = $result.querySelector('.result__close');\r\n\r\n\tvar html = '';\r\n\tfor (var label in values) {\r\n\t\tvar value = values[label].replace(/^$/,'blank');\r\n\t\thtml = html + [\r\n\t\t\t'') + '
';\r\n\t\thtml = html.replace(/\\$label/g, $input.polyfill.label);\r\n\t\thtml = html.replace(/\\$segmentName/g, segmentName);\r\n\t\thtml = html.replace(/\\$segmentValue/g, finalValue);\r\n\t\thtml = html.replace(/\\$fullValue/g, fullValue);\r\n\r\n\t\t$input.polyfill.$a11y.innerHTML = html;\r\n\t}, 1);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../getters/get_values\":18}],3:[function(require,module,exports){\n\r\nmodule.exports = function convert_hours_to_12hr_time (hours) {\r\n\treturn hours <= 12 ? hours === 0 ? 12 : hours : hours - 12;\r\n}\r\n\n},{}],4:[function(require,module,exports){\n\r\nmodule.exports = function convert_number (number) {\r\n\treturn isNaN(number) ? number : parseInt(number);\r\n}\r\n\n},{}],5:[function(require,module,exports){\n\r\nvar convert_number = require('./convert_number');\r\nvar convert_hours_to_12hr_time = require('./convert_hours_to_12hr_time');\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_12hr_time (timeString_24hr) {\r\n\tif (timeString_24hr === '') return '--:-- --';\r\n\tvar twentyFour_regex = /([0-9]{2})\\:([0-9]{2})/;\r\n\tvar result = twentyFour_regex.exec(timeString_24hr);\r\n\tvar hrs_24 = convert_number(result[1]);\r\n\tvar min = result[2];\r\n\tvar hrs_12 = convert_hours_to_12hr_time(hrs_24);\r\n\tvar isPM = hrs_24 > 12;\r\n\tvar mode = isPM ? 'PM' : 'AM';\r\n\treturn [leading_zero(hrs_12), ':', min, ' ', mode].join('');\r\n}\r\n\n},{\"./convert_hours_to_12hr_time\":3,\"./convert_number\":4,\"./leading_zero\":7}],6:[function(require,module,exports){\n\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_24hr_time (timeString_12hr) {\r\n\tif (/-/.test(timeString_12hr)) return '';\r\n\tvar isPM = timeString_12hr.indexOf('PM') > -1;\r\n\tvar timeResult = /^([0-9]{2})/.exec(timeString_12hr);\r\n\tvar hrs = timeResult ? parseInt(timeResult[1]) : '';\r\n\tvar newHrs;\r\n\tif (hrs === 12) {\r\n\t\tnewHrs = isPM ? 12 : 00;\r\n\t} else {\r\n\t\tnewHrs = isPM ? hrs + 12 : hrs;\r\n\t}\r\n\tvar finalHrs = newHrs === 24 ? 0 : newHrs;\r\n\tvar timeRegEx = /^[0-9]{2}:([0-9]{2}) (AM|PM)/;\r\n\treturn timeString_12hr.replace(timeRegEx, leading_zero(finalHrs)+':$1');\r\n}\r\n\n},{\"./leading_zero\":7}],7:[function(require,module,exports){\n\r\nmodule.exports = function leading_zero (number) {\r\n\tif (isNaN(number)) return number;\r\n\tvar purified = parseInt(number);\r\n\treturn purified < 10 ? '0' + purified : number;\r\n}\r\n\n},{}],8:[function(require,module,exports){\n\r\nmodule.exports = function(array){\r\n\treturn Array.prototype.slice.call(array, 0);\r\n}\r\n\n},{}],9:[function(require,module,exports){\n\r\nvar values = require('../helpers/values');\r\n\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar next_segment = require('../selectors/next_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar select_cursor_segment = require('../selectors/select_cursor_segment');\r\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\n\r\nvar reset = require('../setters/reset');\r\nvar manual_number_entry = require('../setters/manual_number_entry');\r\nvar clear_segment = require('../setters/clear_segment');\r\nvar increment_current_segment = require('../setters/increment_current_segment');\r\nvar decrement_current_segment = require('../setters/decrement_current_segment');\r\nvar set_mode = require('../setters/set_mode');\r\nvar switch_times = require('../setters/switch_times');\r\n\r\nvar handle_tab = require('../events/handle_tab');\r\n\r\nvar all_number_keys = require('../static-values/all_number_keys');\r\nvar named_keys = require('../static-values/named_keys');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function bind_events ($input) {\r\n\r\n\tvar prev_value = '';\r\n\r\n\tvar shiftKey = false;\r\n\r\n\tdocument.addEventListener('keydown', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\tdocument.addEventListener('keyup', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\r\n\tif ($input.form) {\r\n\t\t$input.form.addEventListener('submit', function(){\r\n\t\t\tauto_swap($input);\r\n\t\t})\r\n\t}\r\n\r\n\tvar focused_via_click = false;\r\n\r\n\t$input.addEventListener('mousedown', function(){\r\n\t\tfocused_via_click = true;\r\n\t});\r\n\r\n\t// Turns the IE clear button into a reset button\r\n\t$input.addEventListener('mouseup', function(){\r\n\t\tsetTimeout(function(){\r\n\t\t\tif ($input.value === '') reset($input);\r\n\t\t}, 1)\r\n\t});\r\n\r\n\t$input.addEventListener('click', function(e){\r\n\t\tselect_cursor_segment($input);\r\n\t});\r\n\r\n\t$input.addEventListener('blur', function(){\r\n\t\tvar current_value = $input.dataset.value;\r\n\t\tif (current_value !== prev_value) {\r\n\t\t\tprev_value = current_value;\r\n\t\t}\r\n\t\tfocused_via_click = false;\r\n\t});\r\n\r\n\t$input.addEventListener('focus', function(e){\r\n\t\tif (!focused_via_click) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar segment = shiftKey ? 'mode' : 'hrs';\r\n\t\t\tselect_segment($input, segment);\r\n\t\t}\r\n\t\tupdate_a11y($input, [\r\n\t\t\t'initial',\r\n\t\t\t'select'\r\n\t\t])\r\n\t});\r\n\r\n\t$input.addEventListener('keydown', function(e) {\r\n\t\tvar is_enter_key = e.which === 13;\r\n\t\tif (is_enter_key) return true;\r\n\r\n\t\tvar is_number_key = all_number_keys.indexOf(e.which) > -1;\r\n\t\tvar is_named_key = values(named_keys).indexOf(e.which) > -1;\r\n\t\tvar is_arrow_key = [named_keys.ArrowDown, named_keys.ArrowRight, named_keys.ArrowUp, named_keys.ArrowLeft].indexOf(e.which) > -1;\r\n\t\tvar is_mode_key = [named_keys.a, named_keys.p].indexOf(e.which) > -1;\r\n\t\tvar is_delete_key = [named_keys.Delete, named_keys.Backspace].indexOf(e.which) > -1;\r\n\r\n\t\tif (!is_named_key || is_arrow_key || is_number_key || is_mode_key || is_delete_key) { e.preventDefault(); }\r\n\r\n\t\tif (is_number_key) {\r\n\t\t\tmanual_number_entry($input, e.which);\r\n\t\t}\r\n\r\n\t\tif (is_delete_key) {\r\n\t\t\tvar segment = get_current_segment($input);\r\n\t\t\tclear_segment($input, segment);\r\n\t\t}\r\n\r\n\t\tswitch (e.which) {\r\n\t\t\tcase named_keys.ArrowRight: next_segment($input); break;\r\n\t\t\tcase named_keys.ArrowLeft: prev_segment($input); break;\r\n\t\t\tcase named_keys.ArrowUp: increment_current_segment($input); break;\r\n\t\t\tcase named_keys.ArrowDown: decrement_current_segment($input); break;\r\n\t\t\tcase named_keys.Escape: reset($input); break;\r\n\t\t\tcase named_keys.a: set_mode($input, 'AM'); break;\r\n\t\t\tcase named_keys.p: set_mode($input, 'PM'); break;\r\n\t\t\tcase named_keys.Tab: handle_tab($input, e); break;\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction auto_swap($input) {\r\n\tif ($input.polyfill.autoSwap) {\r\n\t\tswitch_times($input, 24);\r\n\t\tsetTimeout(function(){\r\n\t\t\tswitch_times($input, 12);\r\n\t\t}, 1);\r\n\t}\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"../events/handle_tab\":11,\"../getters/get_current_segment\":15,\"../helpers/values\":20,\"../selectors/next_segment\":22,\"../selectors/prev_segment\":23,\"../selectors/select_cursor_segment\":24,\"../selectors/select_segment\":25,\"../setters/clear_segment\":28,\"../setters/decrement_current_segment\":30,\"../setters/increment_current_segment\":32,\"../setters/manual_number_entry\":33,\"../setters/reset\":35,\"../setters/set_mode\":37,\"../setters/switch_times\":41,\"../static-values/all_number_keys\":44,\"../static-values/named_keys\":45}],10:[function(require,module,exports){\n\r\nmodule.exports = function create_event(eventName){\r\n\tvar event = document.createEvent('Event');\r\n\tevent.initEvent(eventName, true, true);\r\n\treturn event;\r\n}\r\n\n},{}],11:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nmodule.exports = function handle_tab($input, e) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tvar backwards_and_first = e.shiftKey && current_segment === 'hrs';\r\n\tvar forwards_and_last = !e.shiftKey && current_segment === 'mode';\r\n\r\n\tif (!backwards_and_first && !forwards_and_last) {\r\n\t\te.preventDefault();\r\n\t\tif (e.shiftKey) {\r\n\t\t\tprev_segment($input);\r\n\t\t} else {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../selectors/next_segment\":22,\"../selectors/prev_segment\":23}],12:[function(require,module,exports){\n\r\nvar trigger_event = require('./trigger_event');\r\n\r\n// It seems that oninput and onchange are treated the same way by browsers :/\r\nmodule.exports = function trigger_both_events($input) {\r\n\t// the event only ever fires if there is a full valid value available\r\n\ttrigger_event($input, 'input');\r\n\ttrigger_event($input,'change');\r\n}\r\n\n},{\"./trigger_event\":13}],13:[function(require,module,exports){\n\r\nvar create_event = require('./create_event');\r\n\r\nvar inputEvent = create_event('input');\r\nvar changeEvent = create_event('change');\r\n\r\nmodule.exports = function trigger_event($input, eventName) {\r\n\tvar event = {\r\n\t\tinput: inputEvent,\r\n\t\tchange: changeEvent,\r\n\t}[eventName];\r\n\r\n\tif (can_trigger_change($input)) {\r\n\t\t$input.dispatchEvent(event);\r\n\t}\r\n}\r\n\r\n// Browsers only send out input and change events if the time element has a full valid value\r\nfunction can_trigger_change ($input) {\r\n\treturn !/--/.test($input.value);\r\n}\r\n\n},{\"./create_event\":10}],14:[function(require,module,exports){\n// selector is optional, it allows for an early exit\r\nmodule.exports = function ($input, selectorString) {\r\n\tvar $elem = $input;\r\n\r\n\t// https://stackoverflow.com/a/8729274/1611058\r\n\tvar ancestors = [];\r\n\twhile ($elem) {\r\n\t\tancestors.push($elem);\r\n\t\tvar matchesSelector = $elem.msMatchesSelector ?\r\n\t\t\t$elem.msMatchesSelector(selectorString) :\r\n\t\t\t$elem.matches(selectorString);\r\n\t\tif (matchesSelector) {\r\n\t\t\treturn ancestors;\r\n\t\t}\r\n\t\t$elem = $elem.parentElement;\r\n\t}\r\n\r\n\treturn ancestors;\r\n}\r\n\n},{}],15:[function(require,module,exports){\n\r\nvar ranges = require('../static-values/ranges');\r\nvar get_selected_range = require('./get_selected_range');\r\n\r\nmodule.exports = function get_current_segment ($input) {\r\n\tvar selection = get_selected_range($input);\r\n\tfor (var segment in ranges) {\r\n\t\tvar range = ranges[segment];\r\n\t\tvar aboveMin = range.start <= selection.start;\r\n\t\tvar belowMax = range.end >= selection.end;\r\n\t\tif (aboveMin && belowMax) {\r\n\t\t\treturn segment;\r\n\t\t}\r\n\t}\r\n\treturn 'hrs';\r\n}\r\n\n},{\"../static-values/ranges\":46,\"./get_selected_range\":17}],16:[function(require,module,exports){\n\r\nvar get_ancestors = require('./get_ancestors');\r\n\r\nmodule.exports = function get_label ($input) {\r\n\r\n\tvar labelText =\r\n\t\taria_labelledby($input) ||\r\n\t\taria_label($input) ||\r\n\t\tfor_attribute($input) ||\r\n\t\tlabel_wrapper_element($input) ||\r\n\t\ttitle_attribute($input);\r\n\r\n\tif (labelText) return labelText;\r\n\r\n\tconsole.error('Label text for input not found.', $input);\r\n\tthrow new Error('Cannot polyfill time input due to a missing label.');\r\n}\r\n\r\nfunction aria_labelledby($input){\r\n\tvar ariaLabelByID = $input.getAttribute('aria-labelledby');\r\n\tif (ariaLabelByID) {\r\n\t\tvar $ariaLabelBy = document.getElementById(ariaLabelByID);\r\n\t\tif ($ariaLabelBy) return $ariaLabelBy.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction aria_label($input){\r\n\tvar ariaLabel = $input.getAttribute('aria-label');\r\n\tif (ariaLabel) return ariaLabel;\r\n\treturn false;\r\n}\r\n\r\nfunction for_attribute($input){\r\n\tif ($input.id) {\r\n\t\tvar $forLabel = document.querySelector('label[for=\"'+$input.id+'\"]');\r\n\t\tif ($forLabel) return $forLabel.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction label_wrapper_element($input){\r\n\tvar ancestors = get_ancestors($input, 'label');\r\n\tvar $parentLabel = ancestors[ancestors.length - 1];\r\n\tif ($parentLabel.nodeName == 'LABEL') return $parentLabel.textContent;\r\n\treturn false\r\n}\r\n\r\nfunction title_attribute($input){\r\n\tvar titleLabel = $input.getAttribute('title');\r\n\tif (titleLabel) return titleLabel;\r\n\treturn false\r\n}\r\n\n},{\"./get_ancestors\":14}],17:[function(require,module,exports){\n\r\nmodule.exports = function get_selected_range ($input) {\r\n\treturn { start: $input.selectionStart, end: $input.selectionEnd };\r\n}\r\n\n},{}],18:[function(require,module,exports){\n\r\nvar convert_number = require('../converters/convert_number');\r\n\r\nmodule.exports = function get_values ($input, timeString) {\r\n\tvar value = timeString ? timeString : $input.value;\r\n\tvar regEx = /([0-9-]{1,2})\\:([0-9-]{1,2})\\s?(AM|PM|\\-\\-)?/;\r\n\tvar result = regEx.exec(value);\r\n\r\n\treturn {\r\n\t\thrs: convert_number(result[1]),\r\n\t\tmin: convert_number(result[2]),\r\n\t\tmode: result[3],\r\n\t}\r\n}\r\n\n},{\"../converters/convert_number\":4}],19:[function(require,module,exports){\n\r\nvar manual_entry_log = [];\r\n\r\nfunction clear () {\r\n\tmanual_entry_log = [];\r\n}\r\n\r\nfunction add (entry) {\r\n\tmanual_entry_log.push(entry);\r\n}\r\n\r\nfunction items(){\r\n\treturn manual_entry_log;\r\n}\r\n\r\nmodule.exports = {\r\n\titems: items,\r\n\tclear: clear,\r\n\tadd: add,\r\n}\r\n\n},{}],20:[function(require,module,exports){\n\r\n// IE11 doesn't support Object.values()\r\nmodule.exports = function values (obj) {\r\n\tvar key_values = [];\r\n\tfor (var key in obj) {\r\n\t\tkey_values.push(obj[key]);\r\n\t}\r\n\treturn key_values;\r\n}\r\n\n},{}],21:[function(require,module,exports){\n\r\nvar toArray = require('../converters/toArray');\r\n\r\nmodule.exports = function _$$ (selector) {\r\n\tvar elements = document.querySelectorAll(selector);\r\n\treturn toArray(elements);\r\n}\r\n\n},{\"../converters/toArray\":8}],22:[function(require,module,exports){\n\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function next_segment ($input) {\r\n\ttraverse($input, 'next');\r\n}\r\n\n},{\"./traverse\":26}],23:[function(require,module,exports){\n\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function prev_segment ($input) {\r\n\ttraverse($input, 'prev');\r\n}\r\n\n},{\"./traverse\":26}],24:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('./select_segment');\r\n\r\nmodule.exports = function select_cursor_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tselect_segment($input, current_segment);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"./select_segment\":25}],25:[function(require,module,exports){\n\r\nmodule.exports = function select_segment ($input, segment) {\r\n\r\n\tset_input_type();\r\n\r\n\tvar actions = {\r\n\t\thrs: select(0, 2),\r\n\t\tmin: select(3, 5),\r\n\t\tmode: select(6, 8),\r\n\t};\r\n\r\n\tactions[segment]($input);\r\n\r\n\tfunction set_input_type() {\r\n\t\tvar type = segment === 'mode' ? 'text' : 'tel';\r\n\t\t$input.setAttribute('type', type);\r\n\t}\r\n\r\n\tfunction select (start, end) {\r\n\t\treturn function () {\r\n\t\t\t$input.setSelectionRange(start, end);\r\n\t\t}\r\n\t}\r\n}\r\n\n},{}],26:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar segments = require('../static-values/segments');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function traverse ($input, direction) {\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tvar modifier = direction === 'next' ? 1 : -1;\r\n\tvar next_segment_index = segments.indexOf(segment) + modifier;\r\n\r\n\tvar next_segment = {\r\n\t\tnext: segments[next_segment_index] || 'mode',\r\n\t\tprev: next_segment_index < 0 ? 'hrs' : segments[next_segment_index],\r\n\t}[direction];\r\n\r\n\tselect_segment($input, next_segment);\r\n\tmanual_entry_log.clear();\r\n\tupdate_a11y($input, ['select'])\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"../getters/get_current_segment\":15,\"../helpers/manual_entry_log\":19,\"../selectors/select_segment\":25,\"../static-values/segments\":47}],27:[function(require,module,exports){\n\r\n// I need to keep this separate from reset so that\r\n// I can reset without attracting focus\r\n\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function apply_default ($input) {\r\n\t$input.value = '--:-- --';\r\n\tset_data_attribute($input, '');\r\n\ttrigger_both_events($input);\r\n}\r\n\n},{\"../events/trigger_both_events\":12,\"../setters/set_data_attribute\":36}],28:[function(require,module,exports){\n\r\nvar set_segment = require('./set_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function clear_segment ($input, segment) {\r\n\tset_segment($input, segment, '--');\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"./set_segment\":38}],29:[function(require,module,exports){\n\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function decrement ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'PM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'down');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\n},{\"../accessibility/update_a11y\":2,\"./nudge_time_segment\":34,\"./switch_mode\":40}],30:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar decrement = require('../setters/decrement');\r\n\r\nmodule.exports = function decrement_current_segment ($input){\r\n\tvar current_segment = get_current_segment($input);\r\n\tdecrement($input, current_segment);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../setters/decrement\":29}],31:[function(require,module,exports){\n\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function increment ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'AM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'up');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\r\n\n},{\"../accessibility/update_a11y\":2,\"./nudge_time_segment\":34,\"./switch_mode\":40}],32:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar increment = require('../setters/increment');\r\n\r\nmodule.exports = function increment_current_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tincrement($input, current_segment);\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../setters/increment\":31}],33:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar sorted_number_keys = require('../static-values/sorted_number_keys');\r\n\r\nmodule.exports = function manual_number_entry($input, key) {\r\n\tvar key_value = sorted_number_keys[key];\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tif (segment !== 'mode') {\r\n\t\tvar entry_count = manual_entry_log.items().length;\r\n\r\n\t\tvar upper_limits = {\r\n\t\t\thrs: [1,2],\r\n\t\t\tmin: [5,9],\r\n\t\t}\r\n\t\tvar limit = upper_limits[segment][entry_count];\r\n\r\n\t\tif (entry_count < 2) {\r\n\t\t\tmanual_entry_log.add(key_value);\r\n\t\t}\r\n\r\n\t\tvar full_limit = parseInt(upper_limits[segment].join(''));\r\n\t\tvar full_entry = parseInt(manual_entry_log.items().join(''));\r\n\r\n\t\tif (full_limit >= full_entry) {\r\n\t\t\tset_segment($input, segment, full_entry);\r\n\t\t}\r\n\r\n\t\tvar at_limit = key_value > limit || manual_entry_log.items().length === 2;\r\n\r\n\t\tif (at_limit) {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"../helpers/manual_entry_log\":19,\"../selectors/next_segment\":22,\"../static-values/sorted_number_keys\":48,\"./set_segment\":38}],34:[function(require,module,exports){\n\r\nvar get_values = require('../getters/get_values');\r\nvar convert_hours_to_12hr_time = require('../converters/convert_hours_to_12hr_time');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function nudge_time_segment ($input, segment, direction) {\r\n\tvar current_values = get_values($input);\r\n\tvar time;\r\n\r\n\tvar modifier = direction === 'up' ? 1 : -1;\r\n\r\n\tif (current_values[segment] === '--') {\r\n\t\tvar current_time = new Date();\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_time.getHours()),\r\n\t\t\tmin: current_time.getMinutes(),\r\n\t\t}\r\n\t} else {\r\n\t\tvar minutes = {\r\n\t\t\tup : current_values.min < 59 ? current_values.min + modifier : 0,\r\n\t\t\tdown : current_values.min === 0 ? 59 : current_values.min + modifier,\r\n\t\t}\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_values.hrs + modifier),\r\n\t\t\tmin: minutes[direction],\r\n\t\t}\r\n\t}\r\n\r\n\tset_segment($input, segment, leading_zero(time[segment]) );\r\n}\r\n\n},{\"../converters/convert_hours_to_12hr_time\":3,\"../converters/leading_zero\":7,\"../getters/get_values\":18,\"./set_segment\":38}],35:[function(require,module,exports){\n\r\nvar apply_default = require('./apply_default');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nmodule.exports = function reset ($input) {\r\n\tapply_default($input);\r\n\tselect_segment($input, 'hrs');\r\n}\r\n\n},{\"../selectors/select_segment\":25,\"./apply_default\":27}],36:[function(require,module,exports){\n\r\nvar convert_to_24hr_time = require('../converters/convert_to_24hr_time')\r\n\r\nmodule.exports = function set_data_attribute($input, timeString_12hr){\r\n\tvar filteredString = timeString_12hr.indexOf('-') > -1 ? '' : timeString_12hr;\r\n\tvar time24hr = convert_to_24hr_time(filteredString);\r\n\t$input.setAttribute('data-value', time24hr);\r\n}\r\n\n},{\"../converters/convert_to_24hr_time\":6}],37:[function(require,module,exports){\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function set_mode ($input, type) {\r\n\tvar segment = get_current_segment($input);\r\n\tif (segment === 'mode') {\r\n\t\tset_segment($input, segment, type);\r\n\t}\r\n}\r\n\n},{\"../getters/get_current_segment\":15,\"./set_segment\":38}],38:[function(require,module,exports){\n\r\nvar get_values = require('../getters/get_values');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar select_segment = require('../selectors/select_segment');\r\nvar set_data_attribute = require('./set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function set_segment ($input, segment, value) {\r\n\tvar values = get_values($input);\r\n\tvalues[segment] = value;\r\n\tvar newInputVal = [\r\n\t\tleading_zero(values.hrs),':',\r\n\t\tleading_zero(values.min),' ',\r\n\t\tvalues.mode\r\n\t].join('');\r\n\t$input.value = newInputVal;\r\n\tselect_segment($input, segment);\r\n\tset_data_attribute($input, newInputVal);\r\n\ttrigger_both_events($input);\r\n}\r\n\n},{\"../converters/leading_zero\":7,\"../events/trigger_both_events\":12,\"../getters/get_values\":18,\"../selectors/select_segment\":25,\"./set_data_attribute\":36}],39:[function(require,module,exports){\n\r\nvar convert_to_12hr_time = require('../converters/convert_to_12hr_time');\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\n\r\nmodule.exports = function set_time($input, time_string_24hr) {\r\n\tvar twelveHr = convert_to_12hr_time(time_string_24hr);\r\n\t$input.value = twelveHr;\r\n\tset_data_attribute($input, time_string_24hr);\r\n}\r\n\n},{\"../converters/convert_to_12hr_time\":5,\"../setters/set_data_attribute\":36}],40:[function(require,module,exports){\n\r\nvar get_values = require('../getters/get_values');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function switch_mode ($input, default_mode) {\r\n\tdefault_mode = default_mode || 'AM';\r\n\tvar current_mode = get_values($input).mode;\r\n\tvar new_mode = {\r\n\t\t'--' : default_mode,\r\n\t\t'AM' : 'PM',\r\n\t\t'PM' : 'AM',\r\n\t}[current_mode];\r\n\tset_segment($input, 'mode', new_mode);\r\n}\r\n\n},{\"../getters/get_values\":18,\"./set_segment\":38}],41:[function(require,module,exports){\n\r\nvar switch_to_data_value = require('./switch_to_data_value');\r\nvar set_time = require('./set_time');\r\n\r\nmodule.exports = function switch_times ($input, format) {\r\n\tvar is12hr = /\\s/.test($input.value);\r\n\r\n\tif (format != 12 && format != 24) {\r\n\t\tformat = is12hr ? 24 : 12;\r\n\t}\r\n\r\n\tvar actions = {\r\n\t\t12: function(){\r\n\t\t\tif (!is12hr) {\r\n\t\t\t\tset_time($input, $input.dataset.value);\r\n\t\t\t}\r\n\t\t},\r\n\t\t24: function(){\r\n\t\t\tif (is12hr) {\r\n\t\t\t\tswitch_to_data_value($input);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tactions[format]();\r\n}\r\n\n},{\"./set_time\":39,\"./switch_to_data_value\":42}],42:[function(require,module,exports){\n\r\nmodule.exports = function($input) {\r\n\tvar replacementVal = $input.dataset.value;\r\n\t$input.value = replacementVal;\r\n}\r\n\n},{}],43:[function(require,module,exports){\n\r\nvar set_time = require('../setters/set_time');\r\n\r\nmodule.exports = function update_time($input) {\r\n\tset_time($input, $input.value);\r\n\treturn $input;\r\n}\r\n\n},{\"../setters/set_time\":39}],44:[function(require,module,exports){\nvar all_number_keys = [\r\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\r\n 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\r\n 96, 97, 98, 99,100,101,102,103,104,105\r\n];\r\n\r\nmodule.exports = all_number_keys;\r\n\n},{}],45:[function(require,module,exports){\nvar named_keys = {\r\n\tArrowDown: 40,\r\n\tArrowRight: 39,\r\n\tArrowUp: 38,\r\n\tArrowLeft: 37,\r\n\tBackspace: 8,\r\n\tDelete: 46,\r\n\tTab: 9,\r\n\tShift: 16,\r\n\tEscape: 27,\r\n\ta: 65,\r\n\tp: 80,\r\n}\r\n\r\nmodule.exports = named_keys;\r\n\n},{}],46:[function(require,module,exports){\n\r\nvar ranges = {\r\n\thrs : { start: 0, end: 2 },\r\n\tmin : { start: 3, end: 5 },\r\n\tmode : { start: 6, end: 8 },\r\n}\r\n\r\nmodule.exports = ranges;\r\n\n},{}],47:[function(require,module,exports){\n\r\nvar ranges = require('./ranges');\r\n\r\nvar segments = Object.keys(ranges);\r\n\r\nmodule.exports = segments;\r\n\n},{\"./ranges\":46}],48:[function(require,module,exports){\n\r\nvar all_number_keys = require('./all_number_keys');\r\n\r\nvar sorted_number_keys = {};\r\n// sorted_number_keys = { 48: 0, 49: 1, 96: 0, 97: 1, ... };\r\nall_number_keys.forEach(function(key, index) {\r\n\tvar number_val = index > 9 ? index - 10 : index;\r\n\tsorted_number_keys[key] = number_val;\r\n});\r\n\r\nmodule.exports = sorted_number_keys;\r\n\n},{\"./all_number_keys\":44}],49:[function(require,module,exports){\n\r\nvar apply_default = require('./core/setters/apply_default');\r\nvar update_time = require('./core/setters/update_time');\r\nvar set_data_attribute = require('./core/setters/set_data_attribute');\r\nvar bind_events = require('./core/events/bind_events');\r\nvar switch_times = require('./core/setters/switch_times');\r\nvar get_label = require('./core/getters/get_label');\r\n\r\nvar create_a11y_block = require('./core/accessibility/create_a11y_block');\r\n\r\nvar accessibility_block_created = false;\r\nvar $a11y;\r\n\r\nfunction TimePolyfill($input) {\r\n\r\n\t$input.setAttribute('autocomplete','off');\r\n\r\n\t// Prevent screen reader from announcing the default stuff\r\n\t$input.setAttribute('aria-hidden', true);\r\n\r\n\tif (!accessibility_block_created) {\r\n\t\t$a11y = create_a11y_block();\r\n\t\taccessibility_block_created = true;\r\n\t}\r\n\r\n\tvar label = get_label($input);\r\n\r\n\t$input.polyfill = {\r\n\t\t$a11y: $a11y,\r\n\t\tlabel: label,\r\n\t\tautoSwap: true,\r\n\t\tupdate: function() {\r\n\t\t\tupdate_time($input);\r\n\t\t},\r\n\t\tswap: function(forcedFormat) {\r\n\t\t\tswitch_times($input, forcedFormat);\r\n\t\t}\r\n\t}\r\n\r\n\tif ($input.value === '' || /--/.test($input.value)) {\r\n\t\tapply_default($input);\r\n\t\tset_data_attribute($input, '');\r\n\t} else {\r\n\t\tupdate_time($input);\r\n\t\tset_data_attribute($input, $input.value);\r\n\t}\r\n\r\n\tbind_events($input);\r\n}\r\n\r\nif (window) window.TimePolyfill = TimePolyfill;\r\nif (module) module.exports = TimePolyfill;\r\n\n},{\"./core/accessibility/create_a11y_block\":1,\"./core/events/bind_events\":9,\"./core/getters/get_label\":16,\"./core/setters/apply_default\":27,\"./core/setters/set_data_attribute\":36,\"./core/setters/switch_times\":41,\"./core/setters/update_time\":43}],50:[function(require,module,exports){\n\r\nmodule.exports = function($result, values){\r\n\tvar $list = $result.querySelector('.result__list');\r\n\tvar $close = $result.querySelector('.result__close');\r\n\r\n\tvar html = '';\r\n\tfor (var label in values) {\r\n\t\tvar value = values[label].replace(/^$/,'blank');\r\n\t\thtml = html + [\r\n\t\t\t'' + textArray.join('
') + '
';\r\n\t\thtml = html.replace(/\\$label/g, $input.polyfill.label);\r\n\t\thtml = html.replace(/\\$segmentName/g, segmentName);\r\n\t\thtml = html.replace(/\\$segmentValue/g, finalValue);\r\n\t\thtml = html.replace(/\\$fullValue/g, fullValue);\r\n\r\n\t\t$input.polyfill.$a11y.innerHTML = html;\r\n\t}, 1);\r\n}\r\n","\r\nmodule.exports = function convert_hours_to_12hr_time (hours) {\r\n\treturn hours <= 12 ? hours === 0 ? 12 : hours : hours - 12;\r\n}\r\n","\r\nmodule.exports = function convert_number (number) {\r\n\treturn isNaN(number) ? number : parseInt(number);\r\n}\r\n","\r\nvar convert_number = require('./convert_number');\r\nvar convert_hours_to_12hr_time = require('./convert_hours_to_12hr_time');\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_12hr_time (timeString_24hr) {\r\n\tif (timeString_24hr === '') return '--:-- --';\r\n\tvar twentyFour_regex = /([0-9]{2})\\:([0-9]{2})/;\r\n\tvar result = twentyFour_regex.exec(timeString_24hr);\r\n\tvar hrs_24 = convert_number(result[1]);\r\n\tvar min = result[2];\r\n\tvar hrs_12 = convert_hours_to_12hr_time(hrs_24);\r\n\tvar isPM = hrs_24 > 12;\r\n\tvar mode = isPM ? 'PM' : 'AM';\r\n\treturn [leading_zero(hrs_12), ':', min, ' ', mode].join('');\r\n}\r\n","\r\nvar leading_zero = require('./leading_zero');\r\n\r\nmodule.exports = function convert_to_24hr_time (timeString_12hr) {\r\n\tif (/-/.test(timeString_12hr)) return '';\r\n\tvar isPM = timeString_12hr.indexOf('PM') > -1;\r\n\tvar timeResult = /^([0-9]{2})/.exec(timeString_12hr);\r\n\tvar hrs = timeResult ? parseInt(timeResult[1]) : '';\r\n\tvar newHrs;\r\n\tif (hrs === 12) {\r\n\t\tnewHrs = isPM ? 12 : 00;\r\n\t} else {\r\n\t\tnewHrs = isPM ? hrs + 12 : hrs;\r\n\t}\r\n\tvar finalHrs = newHrs === 24 ? 0 : newHrs;\r\n\tvar timeRegEx = /^[0-9]{2}:([0-9]{2}) (AM|PM)/;\r\n\treturn timeString_12hr.replace(timeRegEx, leading_zero(finalHrs)+':$1');\r\n}\r\n","\r\nmodule.exports = function leading_zero (number) {\r\n\tif (isNaN(number)) return number;\r\n\tvar purified = parseInt(number);\r\n\treturn purified < 10 ? '0' + purified : number;\r\n}\r\n","\r\nmodule.exports = function(array){\r\n\treturn Array.prototype.slice.call(array, 0);\r\n}\r\n","\r\nvar values = require('../helpers/values');\r\n\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar next_segment = require('../selectors/next_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar select_cursor_segment = require('../selectors/select_cursor_segment');\r\n\r\nvar get_current_segment = require('../getters/get_current_segment');\r\n\r\nvar reset = require('../setters/reset');\r\nvar manual_number_entry = require('../setters/manual_number_entry');\r\nvar clear_segment = require('../setters/clear_segment');\r\nvar increment_current_segment = require('../setters/increment_current_segment');\r\nvar decrement_current_segment = require('../setters/decrement_current_segment');\r\nvar set_mode = require('../setters/set_mode');\r\nvar switch_times = require('../setters/switch_times');\r\n\r\nvar handle_tab = require('../events/handle_tab');\r\n\r\nvar all_number_keys = require('../static-values/all_number_keys');\r\nvar named_keys = require('../static-values/named_keys');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function bind_events ($input) {\r\n\r\n\tvar prev_value = '';\r\n\r\n\tvar shiftKey = false;\r\n\r\n\tdocument.addEventListener('keydown', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\tdocument.addEventListener('keyup', function(e){\r\n\t\tshiftKey = e.shiftKey;\r\n\t})\r\n\r\n\tif ($input.form) {\r\n\t\t$input.form.addEventListener('submit', function(){\r\n\t\t\tauto_swap($input);\r\n\t\t})\r\n\t}\r\n\r\n\tvar focused_via_click = false;\r\n\r\n\t$input.addEventListener('mousedown', function(){\r\n\t\tfocused_via_click = true;\r\n\t});\r\n\r\n\t// Turns the IE clear button into a reset button\r\n\t$input.addEventListener('mouseup', function(){\r\n\t\tsetTimeout(function(){\r\n\t\t\tif ($input.value === '') reset($input);\r\n\t\t}, 1)\r\n\t});\r\n\r\n\t$input.addEventListener('click', function(e){\r\n\t\tselect_cursor_segment($input);\r\n\t});\r\n\r\n\t$input.addEventListener('blur', function(){\r\n\t\tvar current_value = $input.dataset.value;\r\n\t\tif (current_value !== prev_value) {\r\n\t\t\tprev_value = current_value;\r\n\t\t}\r\n\t\tfocused_via_click = false;\r\n\t});\r\n\r\n\t$input.addEventListener('focus', function(e){\r\n\t\tif (!focused_via_click) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar segment = shiftKey ? 'mode' : 'hrs';\r\n\t\t\tselect_segment($input, segment);\r\n\t\t}\r\n\t\tupdate_a11y($input, [\r\n\t\t\t'initial',\r\n\t\t\t'select'\r\n\t\t])\r\n\t});\r\n\r\n\t$input.addEventListener('keydown', function(e) {\r\n\t\tvar is_enter_key = e.which === 13;\r\n\t\tif (is_enter_key) return true;\r\n\r\n\t\tvar is_number_key = all_number_keys.indexOf(e.which) > -1;\r\n\t\tvar is_named_key = values(named_keys).indexOf(e.which) > -1;\r\n\t\tvar is_arrow_key = [named_keys.ArrowDown, named_keys.ArrowRight, named_keys.ArrowUp, named_keys.ArrowLeft].indexOf(e.which) > -1;\r\n\t\tvar is_mode_key = [named_keys.a, named_keys.p].indexOf(e.which) > -1;\r\n\t\tvar is_delete_key = [named_keys.Delete, named_keys.Backspace].indexOf(e.which) > -1;\r\n\r\n\t\tif (!is_named_key || is_arrow_key || is_number_key || is_mode_key || is_delete_key) { e.preventDefault(); }\r\n\r\n\t\tif (is_number_key) {\r\n\t\t\tmanual_number_entry($input, e.which);\r\n\t\t}\r\n\r\n\t\tif (is_delete_key) {\r\n\t\t\tvar segment = get_current_segment($input);\r\n\t\t\tclear_segment($input, segment);\r\n\t\t}\r\n\r\n\t\tswitch (e.which) {\r\n\t\t\tcase named_keys.ArrowRight: next_segment($input); break;\r\n\t\t\tcase named_keys.ArrowLeft: prev_segment($input); break;\r\n\t\t\tcase named_keys.ArrowUp: increment_current_segment($input); break;\r\n\t\t\tcase named_keys.ArrowDown: decrement_current_segment($input); break;\r\n\t\t\tcase named_keys.Escape: reset($input); break;\r\n\t\t\tcase named_keys.a: set_mode($input, 'AM'); break;\r\n\t\t\tcase named_keys.p: set_mode($input, 'PM'); break;\r\n\t\t\tcase named_keys.Tab: handle_tab($input, e); break;\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction auto_swap($input) {\r\n\tif ($input.polyfill.autoSwap) {\r\n\t\tswitch_times($input, 24);\r\n\t\tsetTimeout(function(){\r\n\t\t\tswitch_times($input, 12);\r\n\t\t}, 1);\r\n\t}\r\n}\r\n","\r\nmodule.exports = function create_event(eventName){\r\n\tvar event = document.createEvent('Event');\r\n\tevent.initEvent(eventName, true, true);\r\n\treturn event;\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar prev_segment = require('../selectors/prev_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nmodule.exports = function handle_tab($input, e) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tvar backwards_and_first = e.shiftKey && current_segment === 'hrs';\r\n\tvar forwards_and_last = !e.shiftKey && current_segment === 'mode';\r\n\r\n\tif (!backwards_and_first && !forwards_and_last) {\r\n\t\te.preventDefault();\r\n\t\tif (e.shiftKey) {\r\n\t\t\tprev_segment($input);\r\n\t\t} else {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar trigger_event = require('./trigger_event');\r\n\r\n// It seems that oninput and onchange are treated the same way by browsers :/\r\nmodule.exports = function trigger_both_events($input) {\r\n\t// the event only ever fires if there is a full valid value available\r\n\ttrigger_event($input, 'input');\r\n\ttrigger_event($input,'change');\r\n}\r\n","\r\nvar create_event = require('./create_event');\r\n\r\nvar inputEvent = create_event('input');\r\nvar changeEvent = create_event('change');\r\n\r\nmodule.exports = function trigger_event($input, eventName) {\r\n\tvar event = {\r\n\t\tinput: inputEvent,\r\n\t\tchange: changeEvent,\r\n\t}[eventName];\r\n\r\n\tif (can_trigger_change($input)) {\r\n\t\t$input.dispatchEvent(event);\r\n\t}\r\n}\r\n\r\n// Browsers only send out input and change events if the time element has a full valid value\r\nfunction can_trigger_change ($input) {\r\n\treturn !/--/.test($input.value);\r\n}\r\n","// selector is optional, it allows for an early exit\r\nmodule.exports = function ($input, selectorString) {\r\n\tvar $elem = $input;\r\n\r\n\t// https://stackoverflow.com/a/8729274/1611058\r\n\tvar ancestors = [];\r\n\twhile ($elem) {\r\n\t\tancestors.push($elem);\r\n\t\tvar matchesSelector = $elem.msMatchesSelector ?\r\n\t\t\t$elem.msMatchesSelector(selectorString) :\r\n\t\t\t$elem.matches(selectorString);\r\n\t\tif (matchesSelector) {\r\n\t\t\treturn ancestors;\r\n\t\t}\r\n\t\t$elem = $elem.parentElement;\r\n\t}\r\n\r\n\treturn ancestors;\r\n}\r\n","\r\nvar ranges = require('../static-values/ranges');\r\nvar get_selected_range = require('./get_selected_range');\r\n\r\nmodule.exports = function get_current_segment ($input) {\r\n\tvar selection = get_selected_range($input);\r\n\tfor (var segment in ranges) {\r\n\t\tvar range = ranges[segment];\r\n\t\tvar aboveMin = range.start <= selection.start;\r\n\t\tvar belowMax = range.end >= selection.end;\r\n\t\tif (aboveMin && belowMax) {\r\n\t\t\treturn segment;\r\n\t\t}\r\n\t}\r\n\treturn 'hrs';\r\n}\r\n","\r\nvar get_ancestors = require('./get_ancestors');\r\n\r\nmodule.exports = function get_label ($input) {\r\n\r\n\tvar labelText =\r\n\t\taria_labelledby($input) ||\r\n\t\taria_label($input) ||\r\n\t\tfor_attribute($input) ||\r\n\t\tlabel_wrapper_element($input) ||\r\n\t\ttitle_attribute($input);\r\n\r\n\tif (labelText) return labelText;\r\n\r\n\tconsole.error('Label text for input not found.', $input);\r\n\tthrow new Error('Cannot polyfill time input due to a missing label.');\r\n}\r\n\r\nfunction aria_labelledby($input){\r\n\tvar ariaLabelByID = $input.getAttribute('aria-labelledby');\r\n\tif (ariaLabelByID) {\r\n\t\tvar $ariaLabelBy = document.getElementById(ariaLabelByID);\r\n\t\tif ($ariaLabelBy) return $ariaLabelBy.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction aria_label($input){\r\n\tvar ariaLabel = $input.getAttribute('aria-label');\r\n\tif (ariaLabel) return ariaLabel;\r\n\treturn false;\r\n}\r\n\r\nfunction for_attribute($input){\r\n\tif ($input.id) {\r\n\t\tvar $forLabel = document.querySelector('label[for=\"'+$input.id+'\"]');\r\n\t\tif ($forLabel) return $forLabel.textContent;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction label_wrapper_element($input){\r\n\tvar ancestors = get_ancestors($input, 'label');\r\n\tvar $parentLabel = ancestors[ancestors.length - 1];\r\n\tif ($parentLabel.nodeName == 'LABEL') return $parentLabel.textContent;\r\n\treturn false\r\n}\r\n\r\nfunction title_attribute($input){\r\n\tvar titleLabel = $input.getAttribute('title');\r\n\tif (titleLabel) return titleLabel;\r\n\treturn false\r\n}\r\n","\r\nmodule.exports = function get_selected_range ($input) {\r\n\treturn { start: $input.selectionStart, end: $input.selectionEnd };\r\n}\r\n","\r\nvar convert_number = require('../converters/convert_number');\r\n\r\nmodule.exports = function get_values ($input, timeString) {\r\n\tvar value = timeString ? timeString : $input.value;\r\n\tvar regEx = /([0-9-]{1,2})\\:([0-9-]{1,2})\\s?(AM|PM|\\-\\-)?/;\r\n\tvar result = regEx.exec(value);\r\n\r\n\treturn {\r\n\t\thrs: convert_number(result[1]),\r\n\t\tmin: convert_number(result[2]),\r\n\t\tmode: result[3],\r\n\t}\r\n}\r\n","\r\nvar manual_entry_log = [];\r\n\r\nfunction clear () {\r\n\tmanual_entry_log = [];\r\n}\r\n\r\nfunction add (entry) {\r\n\tmanual_entry_log.push(entry);\r\n}\r\n\r\nfunction items(){\r\n\treturn manual_entry_log;\r\n}\r\n\r\nmodule.exports = {\r\n\titems: items,\r\n\tclear: clear,\r\n\tadd: add,\r\n}\r\n","\r\n// IE11 doesn't support Object.values()\r\nmodule.exports = function values (obj) {\r\n\tvar key_values = [];\r\n\tfor (var key in obj) {\r\n\t\tkey_values.push(obj[key]);\r\n\t}\r\n\treturn key_values;\r\n}\r\n","\r\nvar toArray = require('../converters/toArray');\r\n\r\nmodule.exports = function _$$ (selector) {\r\n\tvar elements = document.querySelectorAll(selector);\r\n\treturn toArray(elements);\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function next_segment ($input) {\r\n\ttraverse($input, 'next');\r\n}\r\n","\r\nvar traverse = require('./traverse');\r\n\r\nmodule.exports = function prev_segment ($input) {\r\n\ttraverse($input, 'prev');\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('./select_segment');\r\n\r\nmodule.exports = function select_cursor_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tselect_segment($input, current_segment);\r\n}\r\n","\r\nmodule.exports = function select_segment ($input, segment) {\r\n\r\n\tset_input_type();\r\n\r\n\tvar actions = {\r\n\t\thrs: select(0, 2),\r\n\t\tmin: select(3, 5),\r\n\t\tmode: select(6, 8),\r\n\t};\r\n\r\n\tactions[segment]($input);\r\n\r\n\tfunction set_input_type() {\r\n\t\tvar type = segment === 'mode' ? 'text' : 'tel';\r\n\t\t$input.setAttribute('type', type);\r\n\t}\r\n\r\n\tfunction select (start, end) {\r\n\t\treturn function () {\r\n\t\t\t$input.setSelectionRange(start, end);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar segments = require('../static-values/segments');\r\n\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function traverse ($input, direction) {\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tvar modifier = direction === 'next' ? 1 : -1;\r\n\tvar next_segment_index = segments.indexOf(segment) + modifier;\r\n\r\n\tvar next_segment = {\r\n\t\tnext: segments[next_segment_index] || 'mode',\r\n\t\tprev: next_segment_index < 0 ? 'hrs' : segments[next_segment_index],\r\n\t}[direction];\r\n\r\n\tselect_segment($input, next_segment);\r\n\tmanual_entry_log.clear();\r\n\tupdate_a11y($input, ['select'])\r\n}\r\n","\r\n// I need to keep this separate from reset so that\r\n// I can reset without attracting focus\r\n\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function apply_default ($input) {\r\n\t$input.value = '--:-- --';\r\n\tset_data_attribute($input, '');\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar set_segment = require('./set_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function clear_segment ($input, segment) {\r\n\tset_segment($input, segment, '--');\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function decrement ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'PM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'down');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar decrement = require('../setters/decrement');\r\n\r\nmodule.exports = function decrement_current_segment ($input){\r\n\tvar current_segment = get_current_segment($input);\r\n\tdecrement($input, current_segment);\r\n}\r\n","\r\nvar switch_mode = require('./switch_mode');\r\nvar nudge_time_segment = require('./nudge_time_segment');\r\nvar update_a11y = require('../accessibility/update_a11y');\r\n\r\nmodule.exports = function increment ($input, segment) {\r\n\tif (segment === 'mode') {\r\n\t\tswitch_mode($input, 'AM')\r\n\t} else {\r\n\t\tnudge_time_segment($input, segment, 'up');\r\n\t}\r\n\tupdate_a11y($input, ['update']);\r\n}\r\n\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar increment = require('../setters/increment');\r\n\r\nmodule.exports = function increment_current_segment ($input) {\r\n\tvar current_segment = get_current_segment($input);\r\n\tincrement($input, current_segment);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\nvar next_segment = require('../selectors/next_segment');\r\n\r\nvar manual_entry_log = require('../helpers/manual_entry_log');\r\nvar sorted_number_keys = require('../static-values/sorted_number_keys');\r\n\r\nmodule.exports = function manual_number_entry($input, key) {\r\n\tvar key_value = sorted_number_keys[key];\r\n\tvar segment = get_current_segment($input);\r\n\r\n\tif (segment !== 'mode') {\r\n\t\tvar entry_count = manual_entry_log.items().length;\r\n\r\n\t\tvar upper_limits = {\r\n\t\t\thrs: [1,2],\r\n\t\t\tmin: [5,9],\r\n\t\t}\r\n\t\tvar limit = upper_limits[segment][entry_count];\r\n\r\n\t\tif (entry_count < 2) {\r\n\t\t\tmanual_entry_log.add(key_value);\r\n\t\t}\r\n\r\n\t\tvar full_limit = parseInt(upper_limits[segment].join(''));\r\n\t\tvar full_entry = parseInt(manual_entry_log.items().join(''));\r\n\r\n\t\tif (full_limit >= full_entry) {\r\n\t\t\tset_segment($input, segment, full_entry);\r\n\t\t}\r\n\r\n\t\tvar at_limit = key_value > limit || manual_entry_log.items().length === 2;\r\n\r\n\t\tif (at_limit) {\r\n\t\t\tnext_segment($input);\r\n\t\t}\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar convert_hours_to_12hr_time = require('../converters/convert_hours_to_12hr_time');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function nudge_time_segment ($input, segment, direction) {\r\n\tvar current_values = get_values($input);\r\n\tvar time;\r\n\r\n\tvar modifier = direction === 'up' ? 1 : -1;\r\n\r\n\tif (current_values[segment] === '--') {\r\n\t\tvar current_time = new Date();\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_time.getHours()),\r\n\t\t\tmin: current_time.getMinutes(),\r\n\t\t}\r\n\t} else {\r\n\t\tvar minutes = {\r\n\t\t\tup : current_values.min < 59 ? current_values.min + modifier : 0,\r\n\t\t\tdown : current_values.min === 0 ? 59 : current_values.min + modifier,\r\n\t\t}\r\n\t\ttime = {\r\n\t\t\thrs: convert_hours_to_12hr_time(current_values.hrs + modifier),\r\n\t\t\tmin: minutes[direction],\r\n\t\t}\r\n\t}\r\n\r\n\tset_segment($input, segment, leading_zero(time[segment]) );\r\n}\r\n","\r\nvar apply_default = require('./apply_default');\r\nvar select_segment = require('../selectors/select_segment');\r\n\r\nmodule.exports = function reset ($input) {\r\n\tapply_default($input);\r\n\tselect_segment($input, 'hrs');\r\n}\r\n","\r\nvar convert_to_24hr_time = require('../converters/convert_to_24hr_time')\r\n\r\nmodule.exports = function set_data_attribute($input, timeString_12hr){\r\n\tvar filteredString = timeString_12hr.indexOf('-') > -1 ? '' : timeString_12hr;\r\n\tvar time24hr = convert_to_24hr_time(filteredString);\r\n\t$input.setAttribute('data-value', time24hr);\r\n}\r\n","\r\nvar get_current_segment = require('../getters/get_current_segment');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function set_mode ($input, type) {\r\n\tvar segment = get_current_segment($input);\r\n\tif (segment === 'mode') {\r\n\t\tset_segment($input, segment, type);\r\n\t}\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar leading_zero = require('../converters/leading_zero');\r\nvar select_segment = require('../selectors/select_segment');\r\nvar set_data_attribute = require('./set_data_attribute');\r\nvar trigger_both_events = require('../events/trigger_both_events');\r\n\r\nmodule.exports = function set_segment ($input, segment, value) {\r\n\tvar values = get_values($input);\r\n\tvalues[segment] = value;\r\n\tvar newInputVal = [\r\n\t\tleading_zero(values.hrs),':',\r\n\t\tleading_zero(values.min),' ',\r\n\t\tvalues.mode\r\n\t].join('');\r\n\t$input.value = newInputVal;\r\n\tselect_segment($input, segment);\r\n\tset_data_attribute($input, newInputVal);\r\n\ttrigger_both_events($input);\r\n}\r\n","\r\nvar convert_to_12hr_time = require('../converters/convert_to_12hr_time');\r\nvar set_data_attribute = require('../setters/set_data_attribute');\r\n\r\nmodule.exports = function set_time($input, time_string_24hr) {\r\n\tvar twelveHr = convert_to_12hr_time(time_string_24hr);\r\n\t$input.value = twelveHr;\r\n\tset_data_attribute($input, time_string_24hr);\r\n}\r\n","\r\nvar get_values = require('../getters/get_values');\r\nvar set_segment = require('./set_segment');\r\n\r\nmodule.exports = function switch_mode ($input, default_mode) {\r\n\tdefault_mode = default_mode || 'AM';\r\n\tvar current_mode = get_values($input).mode;\r\n\tvar new_mode = {\r\n\t\t'--' : default_mode,\r\n\t\t'AM' : 'PM',\r\n\t\t'PM' : 'AM',\r\n\t}[current_mode];\r\n\tset_segment($input, 'mode', new_mode);\r\n}\r\n","\r\nvar switch_to_data_value = require('./switch_to_data_value');\r\nvar set_time = require('./set_time');\r\n\r\nmodule.exports = function switch_times ($input, format) {\r\n\tvar is12hr = /\\s/.test($input.value);\r\n\r\n\tif (format != 12 && format != 24) {\r\n\t\tformat = is12hr ? 24 : 12;\r\n\t}\r\n\r\n\tvar actions = {\r\n\t\t12: function(){\r\n\t\t\tif (!is12hr) {\r\n\t\t\t\tset_time($input, $input.dataset.value);\r\n\t\t\t}\r\n\t\t},\r\n\t\t24: function(){\r\n\t\t\tif (is12hr) {\r\n\t\t\t\tswitch_to_data_value($input);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tactions[format]();\r\n}\r\n","\r\nmodule.exports = function($input) {\r\n\tvar replacementVal = $input.dataset.value;\r\n\t$input.value = replacementVal;\r\n}\r\n","\r\nvar set_time = require('../setters/set_time');\r\n\r\nmodule.exports = function update_time($input) {\r\n\tset_time($input, $input.value);\r\n\treturn $input;\r\n}\r\n","var all_number_keys = [\r\n // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\r\n 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\r\n 96, 97, 98, 99,100,101,102,103,104,105\r\n];\r\n\r\nmodule.exports = all_number_keys;\r\n","var named_keys = {\r\n\tArrowDown: 40,\r\n\tArrowRight: 39,\r\n\tArrowUp: 38,\r\n\tArrowLeft: 37,\r\n\tBackspace: 8,\r\n\tDelete: 46,\r\n\tTab: 9,\r\n\tShift: 16,\r\n\tEscape: 27,\r\n\ta: 65,\r\n\tp: 80,\r\n}\r\n\r\nmodule.exports = named_keys;\r\n","\r\nvar ranges = {\r\n\thrs : { start: 0, end: 2 },\r\n\tmin : { start: 3, end: 5 },\r\n\tmode : { start: 6, end: 8 },\r\n}\r\n\r\nmodule.exports = ranges;\r\n","\r\nvar ranges = require('./ranges');\r\n\r\nvar segments = Object.keys(ranges);\r\n\r\nmodule.exports = segments;\r\n","\r\nvar all_number_keys = require('./all_number_keys');\r\n\r\nvar sorted_number_keys = {};\r\n// sorted_number_keys = { 48: 0, 49: 1, 96: 0, 97: 1, ... };\r\nall_number_keys.forEach(function(key, index) {\r\n\tvar number_val = index > 9 ? index - 10 : index;\r\n\tsorted_number_keys[key] = number_val;\r\n});\r\n\r\nmodule.exports = sorted_number_keys;\r\n","\r\nvar apply_default = require('./core/setters/apply_default');\r\nvar update_time = require('./core/setters/update_time');\r\nvar set_data_attribute = require('./core/setters/set_data_attribute');\r\nvar bind_events = require('./core/events/bind_events');\r\nvar switch_times = require('./core/setters/switch_times');\r\nvar get_label = require('./core/getters/get_label');\r\n\r\nvar create_a11y_block = require('./core/accessibility/create_a11y_block');\r\n\r\nvar accessibility_block_created = false;\r\nvar $a11y;\r\n\r\nfunction TimePolyfill($input) {\r\n\r\n\t$input.setAttribute('autocomplete','off');\r\n\r\n\t// Prevent screen reader from announcing the default stuff\r\n\t$input.setAttribute('aria-hidden', true);\r\n\r\n\tif (!accessibility_block_created) {\r\n\t\t$a11y = create_a11y_block();\r\n\t\taccessibility_block_created = true;\r\n\t}\r\n\r\n\tvar label = get_label($input);\r\n\r\n\t$input.polyfill = {\r\n\t\t$a11y: $a11y,\r\n\t\tlabel: label,\r\n\t\tautoSwap: true,\r\n\t\tupdate: function() {\r\n\t\t\tupdate_time($input);\r\n\t\t},\r\n\t\tswap: function(forcedFormat) {\r\n\t\t\tswitch_times($input, forcedFormat);\r\n\t\t}\r\n\t}\r\n\r\n\tif ($input.value === '' || /--/.test($input.value)) {\r\n\t\tapply_default($input);\r\n\t\tset_data_attribute($input, '');\r\n\t} else {\r\n\t\tupdate_time($input);\r\n\t\tset_data_attribute($input, $input.value);\r\n\t}\r\n\r\n\tbind_events($input);\r\n}\r\n\r\nif (window) window.TimePolyfill = TimePolyfill;\r\nif (module) module.exports = TimePolyfill;\r\n","\r\nmodule.exports = function($result, values){\r\n\tvar $list = $result.querySelector('.result__list');\r\n\tvar $close = $result.querySelector('.result__close');\r\n\r\n\tvar html = '';\r\n\tfor (var label in values) {\r\n\t\tvar value = values[label].replace(/^$/,'blank');\r\n\t\thtml = html + [\r\n\t\t\t'