forked from marcuswestin/store.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.tests.min.js
3 lines (3 loc) · 33.9 KB
/
store.tests.min.js
1
2
3
/* store.js - Copyright (c) 2010-2017 Marcus Westin */
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.store=t()}}(function(){var define,module,exports;return function t(e,n,r){function o(i,a){if(!n[i]){if(!e[i]){var u="function"==typeof require&&require;if(!a&&u)return u(i,!0);if(s)return s(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[i]={exports:{}};e[i][0].call(f.exports,function(t){var n=e[i][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,e,n){"use strict";var r=t("../tests/tests");r.runTests()},{"../tests/tests":35}],2:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(l===setTimeout)return setTimeout(t,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function i(t){if(p===clearTimeout)return clearTimeout(t);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function a(){v&&g&&(v=!1,g.length?h=g.concat(h):m=-1,h.length&&u())}function u(){if(!v){var t=s(a);v=!0;for(var e=h.length;e;){for(g=h,h=[];++m<e;)g&&g[m].run();m=-1,e=h.length}g=null,v=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function f(){}var l,p,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(t){l=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(t){p=o}}();var g,h=[],v=!1,m=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];h.push(new c(t,e)),1!==h.length||v||s(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=f,d.addListener=f,d.once=f,d.off=f,d.removeListener=f,d.removeAllListeners=f,d.emit=f,d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],3:[function(t,e,n){(function(t){function n(t){return function(e){var n=e.replace(/</g,"<").replace(/>/g,">");return'<span style="color:'+t+'">'+n+"</span>"}}function r(t){var e=o[t];return function(t){return e[0]+t+e[1]}}var o=e.exports={grey:["[90m","[39m"],green:["[32m","[39m"],yellow:["[33m","[39m"],red:["[31m","[39m"]},s="undefined"!=typeof t.window;for(var i in o)o.hasOwnProperty(i)&&(o[i]=s?n(i):r(i))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e,n){(function(n){function r(t){o(m,t),S.t0=new Date,S._runNextTest()}function o(t,e,n,r){t||(t={});for(var o=1;o<arguments.length;o++){var s=arguments[o];for(var i in s)s.hasOwnProperty(i)&&(t[i]=s[i])}return t}function s(){return S.skipGroupStack[S.skipGroupStack.length-1]}function i(t,e){s()?S.tests.push({name:S.currentGroup+" - "+t,shouldSkip:!0}):S.tests.push({name:S.currentGroup+" - "+t,fn:e})}function a(t,e,n,r){if(!t){var o=Array.prototype.slice.call(arguments,1).join(" "),s="assert failed"+(o?": "+o:"");throw u(g.red(s)),new Error(s)}}function u(){if(_){m.outputEl||(m.outputEl=document.createElement("div"),o(m.outputEl.style,{fontFamily:"monaco,sans-serif",fontSize:"12px",padding:"10px",background:"black",color:"white"}),document.body.appendChild(m.outputEl));for(var t=Array.prototype.slice.call(arguments,0),e=0;e<t.length;e++)void 0===t[e]&&(t[e]="undefined"),"string"!=typeof t[e]&&(t[e]=JSON.stringify(t[e])),t[e]=t[e].replace(/\n/g,"<br/>");m.outputEl.appendChild(document.createElement("div")).innerHTML=t.join(" "),S.hasFailedTest||(document.documentElement.scrollTop=document.body.scrollTop=99999999)}else f.apply(this,arguments)}function c(){console.log=function(){var t=Array.prototype.slice.call(arguments);t.unshift(g.grey("console.log():")),u.apply(this,t)}}function f(){f.consoleLog.apply(console,arguments)}function l(){for(var t in v)"_old"!=t&&v.hasOwnProperty(t)&&(this[t]=v._old[t])}function p(t){d(),m.onDone?m.onDone(t):h.process&&h.process.exit&&n.exit(t)}function d(){for(var t=S.tests.length,e=S.failedTests.length,n=t-e,r=[],o=0;o<S.tests.length;o++){var s=S.tests[o];s.skipped||s.result||r.push({name:s.name||"",result:!!s.result,message:s.message||"",duration:s.duration||0})}h.global_test_results={total:t,failed:e,passed:n,duration:S.duration,tests:r}}var g=t("./color");e.exports={runTests:r,test:i,assert:a,print:u,noConflict:l,hijackConsoleLog:c};i.group=function(t,e){var n=S.currentGroup;S.currentGroup=(S.currentGroup?S.currentGroup+" - ":"")+t,S.skipGroupStack.push(s()),e(),S.skipGroupStack.pop(),S.currentGroup=n},i.skip=function(t){if(S.current)S.skipCurrentTest=!0;else{if(!S.currentGroup)throw new Error('test.skip() called outside of test and group. ("'+t+'")');S.skipGroupStack[S.skipGroupStack.length-1]=!0}};var h=function(){return this}();h.console||(console={},c()),f.consoleLog=console.log;var v={_old:{},assert:a,test:i,print:u},m={failFast:!1,outputEl:null,maxDuration:750};for(var b in v)"_old"!=b&&v.hasOwnProperty(b)&&(v._old[b]=h[b],h[b]=v[b]);var y=function(t){setTimeout(t,0)},_="undefined"!=typeof h.window;if(_){window.addEventListener&&window.addEventListener("error",function(t){S._onTestDone(t.error?t.error:t)},!1);var w=window.onerror||function(){};window.onError=function(t,e,n){return S._onTestDone(new Error(t+" ("+e+":"+n+")")),w.apply(this,arguments)}}else n.on("uncaughtException",function(t){S._onTestDone(t.error?t.error:t)});var S={currentGroup:"",skipGroupStack:[],tests:[],failedTests:[],skippedTests:[],current:null,testIndex:-1,t0:null,_runNextTest:function(){return S.testIndex+=1,S.testIndex==S.tests.length?void S._finish():(S.current=S.tests[S.testIndex],S.current.shouldSkip?(S.current.skipped=!0,u(g.grey("Skip: "+S.current.name)),void S._runNextTest()):(u(g.grey("Run: "+S.current.name)),S.current.t0=new Date,S.failTimeout=setTimeout(function(){S._onTestDone("Test timed out")},m.maxDuration),void S._runTest(S.current.fn)))},_runTest:function(t){try{if(1==S.current.fn.length)S.current.fn(function(t){S._onTestDone(t)});else{var e=S.current.fn();e?e.then(S._onTestDone,S._onTestDone):S._onTestDone()}}catch(n){S._onTestDone(n)}},_onTestDone:function(t){if(!S.current)return u(g.red("Error during tests setup:"),"\n",t.stack?t.stack:t.toString()),void p(1);clearTimeout(S.failTimeout);var e=new Date-S.current.t0;if(S.skipCurrentTest)S.current.skipped=!0;else if(t){a(!S.current.result);var n=t.stack?t.stack:t.toString();if(S.current.result=!1,S.current.message=n,S.current.duration=e,u(g.red("Fail "+e+"ms"),"\n",n),S.hasFailedTest=!0,m.failFast)return void S._finish()}else{S.current.result=!0,S.current.duration=e;var r=e<50?g.green:e<350?g.yellow:g.red;u(g.green("Pass"),r(e+"ms"))}S.skipCurrentTest=!1,y(S._runNextTest)},_finish:function(){S.duration=(new Date).getTime()-S.t0;for(var t=S.tests.length-S.testIndex,e=0;e<S.tests.length;e++){var n=S.tests[e];n.skipped?S.skippedTests.push(n):n.result||S.failedTests.push(n)}t&&u(g.yellow("Exited without running "+t+" tests")),S.failedTests.length&&u(g.red(S.failedTests.length+" tests failed")),S.skippedTests.length&&u(g.yellow(S.skippedTests.length+" tests skipped")),S.failedTests.length?p(1):0==S.tests.length?(u(g.yellow("No tests")),p(1)):(u(g.green("All done!"),S.tests.length,"tests passed."),p(0))}}}).call(this,t("_process"))},{"./color":3,_process:2}],5:[function(t,e,n){"use strict";e.exports={defaults:t("./defaults"),dump:t("./dump"),events:t("./events"),observe:t("./observe"),expire:t("./expire"),json2:t("./json2"),operations:t("./operations"),update:t("./update"),"v1-backcompat":t("./v1-backcompat")}},{"./defaults":7,"./dump":9,"./events":11,"./expire":13,"./json2":15,"./observe":18,"./operations":20,"./update":22,"./v1-backcompat":24}],6:[function(t,e,n){"use strict";e.exports={defaults:t("./defaults_test"),dump:t("./dump_test"),events:t("./events_test"),observe:t("./observe_test"),expire:t("./expire_test"),json2:t("./json2_test"),operations:t("./operations_test"),update:t("./update_test"),"v1-backcompat":t("./v1-backcompat_test")}},{"./defaults_test":8,"./dump_test":10,"./events_test":12,"./expire_test":14,"./json2_test":16,"./observe_test":19,"./operations_test":21,"./update_test":23,"./v1-backcompat_test":25}],7:[function(t,e,n){"use strict";function r(){function t(t,e){n=e}function e(t,e){var r=t();return void 0!==r?r:n[e]}var n={};return{defaults:t,get:e}}e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){test("defaults",function(){t.defaults({foo:"bar"}),assert("bar"==t.get("foo")),t.set("foo","bar2"),assert("bar2"==t.get("foo")),t.remove("foo"),assert("bar"==t.get("foo"))}),test("defaults + namespace",function(){t.defaults({foo:"bar"});var e=t.namespace("store2");t.namespace("store3");assert("bar"==e.get("foo")),e.defaults({foo:"bar2"}),assert("bar2"==e.get("foo"))})}t("./defaults"),e.exports={setup:r}},{"./defaults":7}],9:[function(t,e,n){"use strict";function r(){function t(t){var e={};return this.each(function(t,n){e[n]=t}),e}return{dump:t}}e.exports=r},{}],10:[function(t,e,n){"use strict";function r(t){test("dump",function(){var e={foo:"bar",cat:{mat:!0},hat:"bat"};s(e,function(e,n){t.set(n,e)}),assert(a(t.dump(),e)),t.clearAll(),assert(a(t.dump(),{}))})}var o=t("../src/util"),s=o.each,i=t("../tests/util"),a=i.deepEqual;e.exports={setup:r}},{"../src/util":27,"../tests/util":36}],11:[function(t,e,n){"use strict";function r(){function t(t,e,n){return c.on(e,i(this,n))}function e(t,e){c.off(e)}function n(t,e,n){c.once(e,i(this,n))}function r(t,e,n){var r=this.get(e);t(),c.fire(e,n,r)}function s(t,e){var n=this.get(e);t(),c.fire(e,void 0,n)}function u(t){var e={};this.each(function(t,n){e[n]=t}),t(),a(e,function(t,e){c.fire(e,void 0,t)})}var c=o();return{watch:t,unwatch:e,once:n,set:r,remove:s,clearAll:u}}function o(){return u(f,{_id:0,_subSignals:{},_subCallbacks:{}})}var s=t("../src/util"),i=s.bind,a=s.each,u=s.create,c=s.slice;e.exports=r;var f={_id:null,_subCallbacks:null,_subSignals:null,on:function(t,e){return this._subCallbacks[t]||(this._subCallbacks[t]={}),this._id+=1,this._subCallbacks[t][this._id]=e,this._subSignals[this._id]=t,this._id},off:function(t){var e=this._subSignals[t];delete this._subCallbacks[e][t],delete this._subSignals[t]},once:function(t,e){var n=this.on(t,i(this,function(){e.apply(this,arguments),this.off(n)}))},fire:function(t){var e=c(arguments,1);a(this._subCallbacks[t],function(t){t.apply(this,e)})}}},{"../src/util":27}],12:[function(t,e,n){"use strict";function r(t){function e(e,n,r){function o(t,e){s.count+=1,assert(s.values[s.count]==t),assert(s.values[s.count-1]==e)}var s={values:[n],count:0,add:function(t){this.values.push(t)},check:function(){assert(s.count+1==s.values.length)},unwatch:function(){t.unwatch(i)}},i=r?t.once(e,o):t.watch(e,o);return s}test("events",function(){t.set("foo","bar");var n=e("expectNone",void 0);t.watch("foo",function(){});var r=e("foo","bar"),o=e("foo","bar",!0);t.watch("foo",function(){}),r.add("bar2"),o.add("bar2"),t.set("foo","bar2"),r.add(void 0),t.remove("foo"),r.add("bar3"),t.set("foo","bar3");var s=e("foo","bar3");r.add(void 0),s.add(void 0),t.clearAll(),t.clearAll(),r.unwatch(),s.add("bar4"),t.set("foo","bar4"),r.check(),o.check(),s.check(),n.check(),s.unwatch()})}t("./events"),e.exports={setup:r}},{"./events":11}],13:[function(t,e,n){"use strict";function r(){function t(t,e,n,s){return this.hasNamespace(o)||r.set(e,s),t()}function e(t,e){if(!this.hasNamespace(o)){var n=r.get(e,Number.MAX_VALUE);n<=(new Date).getTime()&&this.remove(e)}return t()}function n(t,e){return this.hasNamespace(o)||r.remove(e),t()}var r=this.namespace(o);return{set:t,get:e,remove:n}}var o="expire_mixin";e.exports=r},{}],14:[function(t,e,n){"use strict";function r(t){test("expire",function(e){function n(t,e){r(e,function(r){return!!r||(t>0?(setTimeout(function(){n(t-1,2*e)},0),!1):assert(!1))})}function r(n,r){var o=(new Date).getTime()+n;t.set("foo","bar",o),r("bar"==t.get("foo"))&&setTimeout(function(){r((new Date).getTime()>o)&&r(void 0==t.get("foo"))&&(t.set("foo","bar"),setTimeout(function(){r("bar"==t.get("foo"))&&e()},5))},n)}n(5,10)})}t("./expire"),e.exports={setup:r}},{"./expire":13}],15:[function(t,e,n){"use strict";function r(){return t("./lib/json2"),{}}e.exports=r},{"./lib/json2":17}],16:[function(t,e,n){"use strict";function r(t){test("serialization with json2",function(){t.set("foo",{bar:"cat"}),assert("cat"===t.get("foo").bar)})}t("./json2"),e.exports={setup:r}},{"./json2":15}],17:[function(require,module,exports){"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};"object"!==("undefined"==typeof JSON?"undefined":_typeof(JSON))&&(JSON={}),function(){function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var n,r,o,s,i,a=gap,u=e[t];switch(u&&"object"===("undefined"==typeof u?"undefined":_typeof(u))&&"function"==typeof u.toJSON&&(u=u.toJSON(t)),"function"==typeof rep&&(u=rep.call(e,t,u)),"undefined"==typeof u?"undefined":_typeof(u)){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,i=[],"[object Array]"===Object.prototype.toString.apply(u)){for(s=u.length,n=0;n<s;n+=1)i[n]=str(n,u)||"null";return o=0===i.length?"[]":gap?"[\n"+gap+i.join(",\n"+gap)+"\n"+a+"]":"["+i.join(",")+"]",gap=a,o}if(rep&&"object"===("undefined"==typeof rep?"undefined":_typeof(rep)))for(s=rep.length,n=0;n<s;n+=1)"string"==typeof rep[n]&&(r=rep[n],o=str(r,u),o&&i.push(quote(r)+(gap?": ":":")+o));else for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(o=str(r,u),o&&i.push(quote(r)+(gap?": ":":")+o));return o=0===i.length?"{}":gap?"{\n"+gap+i.join(",\n"+gap)+"\n"+a+"}":"{"+i.join(",")+"}",gap=a,o}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(t,e,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;r<n;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=e,e&&"function"!=typeof e&&("object"!==("undefined"==typeof e?"undefined":_typeof(e))||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(t,e){var n,r,o=t[e];if(o&&"object"===("undefined"==typeof o?"undefined":_typeof(o)))for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r=walk(o,n),void 0!==r?o[n]=r:delete o[n]);return reviver.call(t,e,o)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},{}],18:[function(t,e,n){"use strict";function r(){function t(t,e,n){var r=this.watch(e,n);return n(this.get(e)),r}function e(t,e){this.unwatch(e)}return{observe:t,unobserve:e}}var o=t("./events");e.exports=[o,r]},{"./events":11}],19:[function(t,e,n){"use strict";function r(t){test("observe",function(){t.clearAll();var e=-1,n=[void 0],r=t.observe("foo",function(t,r){e+=1,assert(n[e]==t),assert(n[e-1]==r)});t.unobserve(r),n.push("bar"),t.set("foo","bar"),t.observe("foo",function(t,r){e+=1,assert(n[e]==t),assert(n[e-1]==r)}),n.push("bar2"),t.set("foo","bar2"),assert(e+1==n.length)})}t("./observe"),e.exports={setup:r}},{"./observe":18}],20:[function(t,e,n){"use strict";function r(){function t(t,e,n,r,o,s){return u.call(this,"push",arguments)}function e(t,e){return u.call(this,"pop",arguments)}function n(t,e){return u.call(this,"shift",arguments)}function r(t,e,n,r,o,s){return u.call(this,"unshift",arguments)}function s(t,e,n,r,s,u){var c=i(arguments,2);return this.update(e,{},function(t){if("object"!=("undefined"==typeof t?"undefined":o(t)))throw new Error('store.assign called for non-object value with key "'+e+'"');return c.unshift(t),a.apply(Object,c)})}function u(t,e){var n,r=e[1],o=i(e,2);return this.update(r,[],function(e){n=Array.prototype[t].apply(e,o)}),n}return{push:t,pop:e,shift:n,unshift:r,assign:s}}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=t("../src/util"),i=s.slice,a=s.assign,u=t("./update");e.exports=[u,r]},{"../src/util":27,"./update":22}],21:[function(t,e,n){"use strict";function r(t){function e(e,n,r){var o="test-"+e;t.set(o,n),n=n||[];var i=n[e],a=t[e];s(r,function(e){var r=i.apply(n,e),s=a.apply(t,[o].concat(e));assert(u(r,s));var c=t.get(o);assert(u(n,c))})}test("push",function(){e("push",[],[[],["a"],["b","c"],[null],[[],{}]])}),test("unshift",function(){e("unshift",void 0,[[],["a"],["b","c"],[null],[[],{}]])}),test("pop",function(){var t=["a","b","c",null,[[],{}]],n=i(t,function(){return[]}).concat([]);e("pop",t,n)}),test("shift",function(){var t=["a","b","c",null,[[],{}]],n=i(t,function(){return[]}).concat([]);e("shift",t,n)}),test("assign",function(){t.clearAll();var e={bar:"cat",mat:{hat:"bat",arr:[1,2,3]}};t.assign("foo",e),assert(u(t.get("foo"),e));var n={bar:"cat2",mat:{hat:"bat2"},newProp:"newProp"};t.assign("foo",n),s(n,function(t,n){e[n]=t}),assert(u(t.get("foo"),e))})}var o=t("../src/util"),s=o.each,i=o.map,a=t("../tests/util"),u=a.deepEqual;t("./operations"),e.exports={setup:r}},{"../src/util":27,"../tests/util":36,"./operations":20}],22:[function(t,e,n){"use strict";function r(){function t(t,e,n,r){3==arguments.length&&(r=n,n=void 0);var o=this.get(e,n),s=r(o);this.set(e,void 0!=s?s:o)}return{update:t}}e.exports=r},{}],23:[function(t,e,n){"use strict";function r(t){test("update",function(){t.set("foo",{cat:"mat"}),assert("mat"==t.get("foo").cat),t.update("foo",function(t){t.cat="mat2"}),assert("mat2"==t.get("foo").cat)}),test("update return value",function(){t.clearAll(),t.update("foo",function(t){return assert(void 0==t),{cat:"mat4"}}),assert("mat4"==t.get("foo").cat)}),test("update default value",function(){t.clearAll(),t.update("foo2",{},function(t){t.bar="cat"}),assert("cat"==t.get("foo2").bar)}),test("update default value + return",function(){t.clearAll(),t.update("foo2",[],function(t){return{bar2:"cat2"}}),assert("object"==o(t.get("foo2"))),assert(void 0==t.get("foo2").bar),assert("cat2"==t.get("foo2").bar2)})}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports={setup:r}},{}],24:[function(t,e,n){"use strict";function r(){return this.disabled=!this.enabled,{has:o,transact:s,clear:i,forEach:a,getAll:u,serialize:c,deserialize:f}}function o(t,e){return void 0!==this.get(e)}function s(t,e,n,r){null==r&&(r=n,n=null),null==n&&(n={});var o=this.get(e,n),s=r(o);this.set(e,void 0===s?o:s)}function i(t){return this.clearAll.call(this)}function a(t,e){return this.each.call(this,function(t,n){e(n,t)})}function u(t){return this.dump.call(this)}function c(t,e){return JSON.stringify(e)}function f(t,e){if("string"==typeof e)try{return JSON.parse(e)}catch(n){return e||void 0}}var l=t("./dump"),p=t("./json2");e.exports=[l,p,r]},{"./dump":9,"./json2":15}],25:[function(t,e,n){"use strict";function r(t){test("backwards compatability with v1",function(){t.clear(),assert("boolean"==typeof t.disabled),assert("boolean"==typeof t.enabled),assert("string"==typeof t.version),assert("function"==typeof t.set),assert("function"==typeof t.get),assert("function"==typeof t.has),assert("function"==typeof t.remove),assert("function"==typeof t.clear),assert("function"==typeof t.transact),assert("function"==typeof t.getAll),assert("function"==typeof t.forEach),assert("function"==typeof t.serialize),assert("function"==typeof t.deserialize),t.transact("foosact",function(t){assert("object"==("undefined"==typeof t?"undefined":o(t)),"new key is not an object at beginning of transaction"),t.foo="foo"}),t.transact("foosact",function(t){assert("foo"==t.foo,"first transaction did not register"),t.bar="bar"}),assert("foo"==t.getAll().foosact.foo);var e=!1;t.forEach(function(t,n){e=!0,assert("foosact"==t),assert("foo"==n.foo)}),assert(e),assert("{}"==t.serialize({})),assert("bar"==t.get("foosact").bar,"second transaction did not register")})}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports={setup:r}},{}],26:[function(t,e,n){"use strict";function r(t,e){var n={_seenPlugins:[],_namespacePrefix:"",_namespaceRegexp:null,_legalNamespace:/^[a-zA-Z0-9_\-]+$/,_storage:function(){if(!this.enabled)throw new Error("store.js: No supported storage has been added! Add one (e.g store.addStorage(require('store/storages/cookieStorage')) or use a build with more built-in storages (e.g https://github.com/marcuswestin/store.js/tree/master/dist/store.legacy.min.js)");return this._storage.resolved},_testStorage:function(t){try{var e="__storejs__test__";t.write(e,e);var n=t.read(e)===e;return t.remove(e),n}catch(r){return!1}},_assignPluginFnProp:function(t,e){var n=this[e];this[e]=function(){function e(){if(n){var t=n.apply(o,e.args);return delete e.args,t}}var r=Array.prototype.slice.call(arguments,0),o=this,s=[e].concat(r);return e.args=r,t.apply(o,s)}},_serialize:function(t){return JSON.stringify(t)},_deserialize:function(t,e){if(!t)return e;var n="";try{n=JSON.parse(t)}catch(r){n=t}return void 0!==n?n:e}},r=a(n,l);return i(t,function(t){r.addStorage(t)}),i(e,function(t){r.addPlugin(t)}),r}var o=t("./util"),s=o.pluck,i=o.each,a=o.create,u=o.isList,c=o.isFunction,f=o.isObject;e.exports={createStore:r};var l={version:"2.0.3",enabled:!1,storage:null,addStorage:function(t){this.enabled||this._testStorage(t)&&(this._storage.resolved=t,this.enabled=!0,this.storage=t.name)},addPlugin:function(t){var e=this;if(u(t))return void i(t,function(t){e.addPlugin(t)});var n=s(this._seenPlugins,function(e){return t===e});if(!n){if(this._seenPlugins.push(t),!c(t))throw new Error("Plugins must be function values that return objects");var r=t.call(this);if(!f(r))throw new Error("Plugins must return an object of function properties");i(r,function(n,r){if(!c(n))throw new Error("Bad plugin property: "+r+" from plugin "+t.name+". Plugins should only return functions.");e._assignPluginFnProp(n,r)})}},get:function(t,e){var n=this._storage().read(this._namespacePrefix+t);return this._deserialize(n,e)},set:function(t,e){return void 0===e?this.remove(t):(this._storage().write(this._namespacePrefix+t,this._serialize(e)),e)},remove:function(t){this._storage().remove(this._namespacePrefix+t)},each:function(t){var e=this;this._storage().each(function(n,r){t(e._deserialize(n),r.replace(e._namespaceRegexp,""))})},clearAll:function(){this._storage().clearAll()},hasNamespace:function(t){return this._namespacePrefix=="__storejs_"+t+"_"},namespace:function(t){if(!this._legalNamespace.test(t))throw new Error("store.js namespaces can only have alhpanumerics + underscores and dashes");var e="__storejs_"+t+"_";return a(this,{_namespacePrefix:e,_namespaceRegexp:e?new RegExp("^"+e):null})},createStore:function(t,e){return r(t,e)}}},{"./util":27}],27:[function(t,e,n){(function(t){"use strict";function n(){return Object.assign?Object.assign:function(t,e,n,r){for(var o=1;o<arguments.length;o++)a(Object(arguments[o]),function(e,n){t[n]=e});return t}}function r(){if(Object.create)return function(t,e,n,r){var o=i(arguments,1);return d.apply(this,[Object.create(t)].concat(o))};var t=function(){};return function(e,n,r,o){var s=i(arguments,1);return t.prototype=e,d.apply(this,[new t].concat(s))}}function o(){return String.prototype.trim?function(t){return String.prototype.trim.call(t)}:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function s(t,e){return function(){return e.apply(t,Array.prototype.slice.call(arguments,0))}}function i(t,e){return Array.prototype.slice.call(t,e||0)}function a(t,e){c(t,function(t,n){return e(t,n),!1})}function u(t,e){var n=f(t)?[]:{};return c(t,function(t,r){return n[r]=e(t,r),!1}),n}function c(t,e){if(f(t)){for(var n=0;n<t.length;n++)if(e(t[n],n))return t[n]}else for(var r in t)if(t.hasOwnProperty(r)&&e(t[r],r))return t[r]}function f(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length}function l(t){return t&&"[object Function]"==={}.toString.call(t)}function p(t){return t&&"[object Object]"==={}.toString.call(t)}var d=n(),g=r(),h=o(),v="undefined"!=typeof window?window:t;e.exports={assign:d,create:g,trim:h,bind:s,slice:i,each:a,map:u,pluck:c,isList:f,isFunction:l,isObject:p,Global:v}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],28:[function(t,e,n){"use strict";e.exports={localStorage:t("./localStorage"),"oldFF-globalStorage":t("./oldFF-globalStorage"),"oldIE-userDataStorage":t("./oldIE-userDataStorage"),cookieStorage:t("./cookieStorage"),sessionStorage:t("./sessionStorage"),memoryStorage:t("./memoryStorage")}},{"./cookieStorage":29,"./localStorage":30,"./memoryStorage":31,"./oldFF-globalStorage":32,"./oldIE-userDataStorage":33,"./sessionStorage":34}],29:[function(t,e,n){"use strict";function r(t){if(!t||!u(t))return null;var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(p.cookie.replace(new RegExp(e),"$1"))}function o(t){for(var e=p.cookie.split(/; ?/g),n=e.length-1;n>=0;n--)if(l(e[n])){var r=e[n].split("="),o=unescape(r[0]),s=unescape(r[1]);t(s,o)}}function s(t,e){t&&(p.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function i(t){t&&u(t)&&(p.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function a(){o(function(t,e){i(e)})}function u(t){return new RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(p.cookie)}var c=t("../src/util"),f=c.Global,l=c.trim;e.exports={name:"cookieStorage",read:r,write:s,each:o,remove:i,clearAll:a};var p=f.document},{"../src/util":27}],30:[function(t,e,n){"use strict";function r(){return f.localStorage}function o(t){return r().getItem(t)}function s(t,e){return r().setItem(t,e)}function i(t){for(var e=r().length-1;e>=0;e--){var n=r().key(e);t(o(n),n)}}function a(t){return r().removeItem(t)}function u(){return r().clear()}var c=t("../src/util"),f=c.Global;e.exports={name:"localStorage",read:o,write:s,each:i,remove:a,clearAll:u}},{"../src/util":27}],31:[function(t,e,n){"use strict";function r(t){return u[t]}function o(t,e){u[t]=e}function s(t){for(var e in u)u.hasOwnProperty(e)&&t(u[e],e)}function i(t){delete u[t]}function a(t){u={}}e.exports={name:"memoryStorage",read:r,write:o,each:s,remove:i,clearAll:a};var u={}},{}],32:[function(t,e,n){"use strict";function r(t){return f[t]}function o(t,e){f[t]=e}function s(t){for(var e=f.length-1;e>=0;e--){var n=f.key(e);t(f[n],n)}}function i(t){return f.removeItem(t)}function a(){s(function(t,e){delete f[t]})}var u=t("../src/util"),c=u.Global;e.exports={name:"oldFF-globalStorage",read:r,write:o,each:s,remove:i,clearAll:a};var f=c.globalStorage},{"../src/util":27}],33:[function(t,e,n){"use strict";function r(t,e){if(!h){var n=u(t);g(function(t){t.setAttribute(n,e),t.save(p)})}}function o(t){if(!h){var e=u(t),n=null;return g(function(t){n=t.getAttribute(e)}),n}}function s(t){g(function(e){for(var n=e.XMLDocument.documentElement.attributes,r=n.length-1;r>=0;r--){var o=n[r];t(e.getAttribute(o.name),o.name)}})}function i(t){var e=u(t);g(function(t){t.removeAttribute(e),t.save(p)})}function a(){g(function(t){var e=t.XMLDocument.documentElement.attributes;t.load(p);for(var n=e.length-1;n>=0;n--)t.removeAttribute(e[n].name);t.save(p)})}function u(t){return t.replace(/^d/,"___$&").replace(v,"___")}function c(){if(!d||!d.documentElement||!d.documentElement.addBehavior)return null;var t,e,n,r="script";try{e=new ActiveXObject("htmlfile"),e.open(),e.write("<"+r+">document.w=window</"+r+'><iframe src="/favicon.ico"></iframe>'),e.close(),t=e.w.frames[0].document,n=t.createElement("div")}catch(o){n=d.createElement("div"),t=d.body}return function(e){var r=[].slice.call(arguments,0);r.unshift(n),t.appendChild(n),n.addBehavior("#default#userData"),n.load(p),e.apply(this,r),t.removeChild(n)}}var f=t("../src/util"),l=f.Global;e.exports={name:"oldIE-userDataStorage",write:r,read:o,each:s,remove:i,clearAll:a};var p="storejs",d=l.document,g=c(),h=(l.navigator?l.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./),v=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g")},{"../src/util":27}],34:[function(t,e,n){"use strict";function r(){return f.sessionStorage}function o(t){return r().getItem(t)}function s(t,e){return r().setItem(t,e)}function i(t){for(var e=r().length-1;e>=0;e--){var n=r().key(e);t(o(n),n)}}function a(t){return r().removeItem(t)}function u(){return r().clear()}var c=t("../src/util"),f=c.Global;e.exports={name:"sessionStorage",read:o,write:s,each:i,remove:a,clearAll:u}},{"../src/util":27}],35:[function(t,e,n){"use strict";function r(){l(p,function(t){test.group(t.name,function(){o(t)||test.skip("disabled"),test("Storage tests",function(){var e=c();e.addStorage(t),s(e)}),l(g,function(e,n){var r=d[n];test.group("plugin: "+n,function(){var n=c();n.addStorage(t),n.addPlugin(r),e.setup(n)})})})}),a.runTests({failFast:!1})}function o(t){if(!t)return print("Skip unsupported storage:",t.name),!1;var e=c([t],[]);return!!e.enabled||(print("Skip disabled storage:",t.name),!1)}function s(t){assert(t.enabled&&t.enabled,"store should be enabled"),t.clearAll(),t.get("unsetValue"),t.set("foo","bar"),assert("bar"==t.get("foo"),"stored key 'foo' not equal to stored value 'bar'"),t.remove("foo"),assert(void 0===t.get("foo"),"removed key 'foo' not undefined"),assert(void 0===t.get("foo"),"key 'foo' exists when it shouldn't"),assert("value"==t.set("foo","value"),"store#set returns the stored value"),assert(void 0!==t.get("foo"),"key 'foo' doesn't exist when it should"),t.set("foo","bar1"),t.set("foo","bar2"),assert("bar2"==t.get("foo"),"key 'foo' is not equal to second value set 'bar2'"),t.set("foo","bar"),
t.set("bar","foo"),t.remove("foo"),assert(void 0===t.get("foo"),"key 'foo' exists when it shouldn't"),assert("foo"==t.get("bar"),"removing key 'foo' also removed key 'bar'"),t.set("foo","bar"),t.set("bar","foo"),t.clearAll(),assert(void 0===t.get("foo")&&void 0===t.get("bar"),"keys foo and bar not cleared after store cleared"),assert(123==t.get("defaultVal",123),"store.get should return default value"),t.set("foo",{name:"marcus",arr:[1,2,3]}),assert("object"==i(t.get("foo")),"type of stored object 'foo' is not 'object'"),assert(t.get("foo")instanceof Object,"stored object 'foo' is not an instance of Object"),assert("marcus"==t.get("foo").name,"property 'name' of stored object 'foo' is not 'marcus'"),assert(t.get("foo").arr instanceof Array,"Array property 'arr' of stored object 'foo' is not an instance of Array"),assert(3==t.get("foo").arr.length,"The length of Array property 'arr' stored on object 'foo' is not 3"),t.remove("circularReference");var e={},n={one:e};e.two=n;var r=!1;try{t.set("circularReference",e)}catch(o){r=!0}assert(r,"storing object with circular reference did not throw"),assert(!t.get("circularReference"),"attempting to store object with circular reference which should have faile affected store state");var s={"int":42,bool:!0,"float":3.141592653,string:"Don't Panic",odd_string:"{ZYX'} abc:;::)))"};for(var a in s)t._storage.resolved.write(a,s[a]),assert(t.get(a)==s[a],a+" was not correctly promoted to valid JSON"),t.remove(a);t.clearAll();var u=0;t.each(function(){u+=1}),assert(0===u)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=t("tinytest");a.hijackConsoleLog();var u=t("../src/store-engine"),c=u.createStore,f=t("../src/util"),l=f.each,p=t("../storages/all"),d=t("../plugins/all"),g=t("../plugins/all_tests");e.exports={output:null,outputError:null,runTests:r,failed:!1}},{"../plugins/all":5,"../plugins/all_tests":6,"../src/store-engine":26,"../src/util":27,"../storages/all":28,tinytest:4}],36:[function(t,e,n){"use strict";function r(t,e){if(("undefined"==typeof t?"undefined":o(t))!=("undefined"==typeof e?"undefined":o(e)))return!1;if("object"!=("undefined"==typeof t?"undefined":o(t)))return t===e;var n;for(n in t)if(!r(t[n],e[n]))return!1;for(n in e)if(!r(e[n],t[n]))return!1;return!0}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports={deepEqual:r}},{}]},{},[1])(1)});