text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("qs",[],t):"object"==typeof exports?exports.qs=t():e.qs=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,o){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,o,r){return o&&e(t.prototype,o),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e),this.options={storage:"local",prefix:"qs_",attribute:"qs",debug:!1},this.storage,this.initialize(t)}return n(e,[{key:"initialize",value:function(e){var t=this;this.options=Object.assign(this.options,e),"local"===this.options.storage?this.storage=window.localStorage:"session"===this.options.storage?this.storage=window.sessionStorage:console.error('QS - Unknown storage option. Please use either "session" or "local".'),this.$elms=document.querySelectorAll("[data-"+this.options.attribute+"]");for(var o=0;o<this.$elms.length;o++){var r=this.$elms[o];if(r.name||!0!==this.options.debug){var n=this.readFromStorage(r);""!==n&&(r.value=JSON.parse(n)),r.addEventListener("change",function(e){return t.writeToStorage(e.srcElement)})}else console.warn("QS - Form element needs a name attribute.",r)}}},{key:"writeToStorage",value:function(e){this.storage.setItem(this.getStorageKey(e),JSON.stringify(e.value))}},{key:"readFromStorage",value:function(e){return this.storage.getItem(this.getStorageKey(e))}},{key:"getStorageKey",value:function(e){return this.options.prefix+e.tagName.toLowerCase()+"#"+e.name}},{key:"removeFromStorage",value:function(e){e&&this.storage.removeItem(e)}},{key:"removeAll",value:function(){this.storage.clear()}}]),e}();t.default=i,e.exports=t.default}])});