@azrico/global 1.3.20 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.delete_cache=delete_cache,exports.delete_cache_sync=delete_cache_sync,exports.get_cache=get_cache,exports.get_cacheFunc=get_cacheFunc,exports.get_cache_sync=get_cache_sync,exports.set_cache=set_cache,exports.set_cacheFunc=set_cacheFunc,exports.set_cache_sync=set_cache_sync;var _core=_interopRequireDefault(require("../core")),_index=require("../../index");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}var sname="cache",name_pending="pending_cache_loads",lname="list_cache",lname_f="list_cache_func";function get_cache(){return _get_cache.apply(this,arguments)}function _get_cache(){return _get_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h;return _regeneratorRuntime().wrap(function i(d){for(;1;)switch(d.prev=d.next){case 0:if(a=_core["default"].fixKey(a),e="cache-pending-".concat(a),f=_core["default"].Global_get(name_pending,e),!f){d.next=7;break}return d.next=6,f;case 6:return d.abrupt("return",d.sent);case 7:return g=_get_cache_local(a,b,c),_core["default"].Global_set(name_pending,e,g),d.next=11,g;case 11:return h=d.sent,_core["default"].Global_set(name_pending,e,void 0),d.abrupt("return",h);case 14:case"end":return d.stop()}},d)})),_get_cache.apply(this,arguments)}function _get_cache_local(a,b,c){return _get_cache_local2.apply(this,arguments)}function _get_cache_local2(){return _get_cache_local2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h,i,j,k;return _regeneratorRuntime().wrap(function l(d){for(;1;)switch(d.prev=d.next){case 0:return c||(c={}),e="".concat(sname,"-").concat(a),f="",g=!1,c.session||c.storage||c.local_storage||(null!==(h=window)&&void 0!==h&&h.sessionStorage?c.session=!0:c.local_storage=!0),d.next=7,_index.gstorage.get_var(e,{local_storage:c.local_storage,session:c.session,storage:c.storage});case 7:if(f=d.sent,f){d.next=20;break}if(i=null,"function"==typeof b?i=b:null==i&&(i=get_cacheFunc(a)),"function"!=typeof i){d.next=20;break}return d.t0=JSON,d.t1=convert_to_cacheObject,d.next=16,i(c);case 16:d.t2=d.sent,d.t3=(0,d.t1)(d.t2),f=d.t0.stringify.call(d.t0,d.t3),g=!0;case 20:if(j=load_cacheObject(f),k=get_cacheValue(j),!(g&&null!=k)){d.next=25;break}return d.next=25,set_cache(a,k,c);case 25:if(c.search){d.next=27;break}return d.abrupt("return",k);case 27:return d.abrupt("return",searchResult(k,c.search));case 28:case"end":return d.stop()}},d)})),_get_cache_local2.apply(this,arguments)}function set_cache(a,b,c){return _set_cache.apply(this,arguments)}function _set_cache(){return _set_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g;return _regeneratorRuntime().wrap(function h(d){for(;1;)switch(d.prev=d.next){case 0:return c||(c={}),a=_core["default"].fixKey(a),e="".concat(sname,"-").concat(a),f=null==b?b:JSON.stringify(convert_to_cacheObject(b)),c.session||c.storage||c.local_storage||(null!==(g=window)&&void 0!==g&&g.sessionStorage?c.session=!0:c.local_storage=!0),d.next=7,_index.gstorage.set_var(e,f,{local_storage:c.local_storage,session:c.session,storage:c.storage});case 7:return d.abrupt("return",b);case 8:case"end":return d.stop()}},d)})),_set_cache.apply(this,arguments)}function delete_cache(a,b){return _delete_cache.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */function _delete_cache(){return _delete_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,set_cache(a,void 0,b);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop()}},c)})),_delete_cache.apply(this,arguments)}function set_cache_sync(a,b){if(null==b)return _core["default"].Global_set(lname,a,b);var c=JSON.stringify(convert_to_cacheObject(b));return _core["default"].Global_set(lname,a,c)}function get_cache_sync(a,b,c){c||(c={}),a=_core["default"].fixKey(a);/* -------------------------------------------------------------------------- */ /* get the cache */ /* -------------------------------------------------------------------------- */var d="",e=!1;/* -------------------------------------------------------------------------- */ /* if cache not found use the cache func */ /* -------------------------------------------------------------------------- */if(d=_core["default"].Global_get(lname,a),!d){var f=null;"function"==typeof b?f=b:null==f&&(f=get_cacheFunc(a)),"function"==typeof f&&(d=JSON.stringify(convert_to_cacheObject(f(c))),e=!0)}var g=load_cacheObject(d),h=get_cacheValue(g);/* -------------------------------------------------------------------------- */ /* return */ /* -------------------------------------------------------------------------- */return e&&null!=h&&set_cache_sync(a,h),c.search?searchResult(h,c.search):h}function delete_cache_sync(a){return _delete_cache_sync.apply(this,arguments)}function _delete_cache_sync(){return _delete_cache_sync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,set_cache_sync(a,void 0);case 2:return b.abrupt("return",b.sent);case 3:case"end":return b.stop()}},b)})),_delete_cache_sync.apply(this,arguments)}function get_cacheFunc(a){return _core["default"].Global_get(lname_f,a)}function set_cacheFunc(a,b){return _core["default"].Global_set(lname_f,a,b)}/* -------------------------------------------------------------------------- */function convert_to_cacheObject(a){var b=_typeof(a),c=stringify_cacheValue(a);return{original_type:b,raw_data:c}}function load_cacheObject(a){if(null===a||a===void 0)return null;if("object"===_typeof(a))return{original_type:a.original_type,raw_data:a.raw_data};if("string"==typeof a)try{return load_cacheObject(JSON.parse(a))}catch(a){}return null}function get_cacheValue(a){if(null===a||a===void 0)return null;if("object"===_typeof(a)){var b=a.original_type,c=a.raw_data;return"string"===b?c:JSON.parse(c)}return null}function stringify_cacheValue(a){return null==a?"":"string"==typeof a?a:JSON.stringify(a)}/* -------------------------------------------------------------------------- */function searchResult(a,b){if("object"!=_typeof(a)||"object"!=_typeof(b))return a;//cant search in non objects
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.delete_cache=delete_cache,exports.delete_cache_sync=delete_cache_sync,exports.get_cache=get_cache,exports.get_cacheFunc=get_cacheFunc,exports.get_cache_sync=get_cache_sync,exports.set_cache=set_cache,exports.set_cacheFunc=set_cacheFunc,exports.set_cache_sync=set_cache_sync;var _core=_interopRequireDefault(require("../core")),_index=require("../../index");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}var sname="cache",name_pending="pending_cache_loads",lname="list_cache",lname_f="list_cache_func",isBrowser="undefined"!=typeof window;function get_cache(){return _get_cache.apply(this,arguments)}function _get_cache(){return _get_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h;return _regeneratorRuntime().wrap(function i(d){for(;1;)switch(d.prev=d.next){case 0:if(a=_core["default"].fixKey(a),e="cache-pending-".concat(a),f=_core["default"].Global_get(name_pending,e),!f){d.next=7;break}return d.next=6,f;case 6:return d.abrupt("return",d.sent);case 7:return g=_get_cache_local(a,b,c),_core["default"].Global_set(name_pending,e,g),d.next=11,g;case 11:return h=d.sent,_core["default"].Global_set(name_pending,e,void 0),d.abrupt("return",h);case 14:case"end":return d.stop()}},d)})),_get_cache.apply(this,arguments)}function _get_cache_local(a,b,c){return _get_cache_local2.apply(this,arguments)}function _get_cache_local2(){return _get_cache_local2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h,i,j;return _regeneratorRuntime().wrap(function k(d){for(;1;)switch(d.prev=d.next){case 0:return c||(c={}),e="".concat(sname,"-").concat(a),f="",g=!1,c.session||c.storage||c.local_storage||!isBrowser||(c.session=!0),d.next=7,_index.gstorage.get_var(e,{local_storage:c.local_storage,session:c.session,storage:c.storage});case 7:if(f=d.sent,f){d.next=20;break}if(h=null,"function"==typeof b?h=b:null==h&&(h=get_cacheFunc(a)),"function"!=typeof h){d.next=20;break}return d.t0=JSON,d.t1=convert_to_cacheObject,d.next=16,h(c);case 16:d.t2=d.sent,d.t3=(0,d.t1)(d.t2),f=d.t0.stringify.call(d.t0,d.t3),g=!0;case 20:if(i=load_cacheObject(f),j=get_cacheValue(i),!(g&&null!=j)){d.next=25;break}return d.next=25,set_cache(a,j,c);case 25:if(c.search){d.next=27;break}return d.abrupt("return",j);case 27:return d.abrupt("return",searchResult(j,c.search));case 28:case"end":return d.stop()}},d)})),_get_cache_local2.apply(this,arguments)}function set_cache(a,b,c){return _set_cache.apply(this,arguments)}function _set_cache(){return _set_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f;return _regeneratorRuntime().wrap(function g(d){for(;1;)switch(d.prev=d.next){case 0:return c||(c={}),a=_core["default"].fixKey(a),e="".concat(sname,"-").concat(a),f=null==b?b:JSON.stringify(convert_to_cacheObject(b)),c.session||c.storage||c.local_storage||!isBrowser||(c.session=!0),d.next=7,_index.gstorage.set_var(e,f,{local_storage:c.local_storage,session:c.session,storage:c.storage});case 7:return d.abrupt("return",b);case 8:case"end":return d.stop()}},d)})),_set_cache.apply(this,arguments)}function delete_cache(a,b){return _delete_cache.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */function _delete_cache(){return _delete_cache=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){return _regeneratorRuntime().wrap(function d(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,set_cache(a,void 0,b);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop()}},c)})),_delete_cache.apply(this,arguments)}function set_cache_sync(a,b){if(null==b)return _core["default"].Global_set(lname,a,b);var c=JSON.stringify(convert_to_cacheObject(b));return _core["default"].Global_set(lname,a,c)}function get_cache_sync(a,b,c){c||(c={}),a=_core["default"].fixKey(a);/* -------------------------------------------------------------------------- */ /* get the cache */ /* -------------------------------------------------------------------------- */var d="",e=!1;/* -------------------------------------------------------------------------- */ /* if cache not found use the cache func */ /* -------------------------------------------------------------------------- */if(d=_core["default"].Global_get(lname,a),!d){var f=null;"function"==typeof b?f=b:null==f&&(f=get_cacheFunc(a)),"function"==typeof f&&(d=JSON.stringify(convert_to_cacheObject(f(c))),e=!0)}var g=load_cacheObject(d),h=get_cacheValue(g);/* -------------------------------------------------------------------------- */ /* return */ /* -------------------------------------------------------------------------- */return e&&null!=h&&set_cache_sync(a,h),c.search?searchResult(h,c.search):h}function delete_cache_sync(a){return _delete_cache_sync.apply(this,arguments)}function _delete_cache_sync(){return _delete_cache_sync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,set_cache_sync(a,void 0);case 2:return b.abrupt("return",b.sent);case 3:case"end":return b.stop()}},b)})),_delete_cache_sync.apply(this,arguments)}function get_cacheFunc(a){return _core["default"].Global_get(lname_f,a)}function set_cacheFunc(a,b){return _core["default"].Global_set(lname_f,a,b)}/* -------------------------------------------------------------------------- */function convert_to_cacheObject(a){var b=_typeof(a),c=stringify_cacheValue(a);return{original_type:b,raw_data:c}}function load_cacheObject(a){if(null===a||a===void 0)return null;if("object"===_typeof(a))return{original_type:a.original_type,raw_data:a.raw_data};if("string"==typeof a)try{return load_cacheObject(JSON.parse(a))}catch(a){}return null}function get_cacheValue(a){if(null===a||a===void 0)return null;if("object"===_typeof(a)){var b=a.original_type,c=a.raw_data;return"string"===b?c:JSON.parse(c)}return null}function stringify_cacheValue(a){return null==a?"":"string"==typeof a?a:JSON.stringify(a)}/* -------------------------------------------------------------------------- */function searchResult(a,b){if("object"!=_typeof(a)||"object"!=_typeof(b))return a;//cant search in non objects
|
|
2
2
|
if(null==a)return a;if(!isNaN(b._per_page)&&0>=b._per_page)return null;var c=[];if(Array.isArray(a))for(var d,e=0;e<a.length;e++)d=gMatch(a[e],b),d&&c.push(d);else{var f=gMatch(a,b);if(f)return f}return isNaN(b._per_page)||(c=c.slice(0,+b._per_page)),c}function gMatch(a,b){if("object"!=_typeof(a)||"object"!=_typeof(b))return a;//cant search in non objects
|
|
3
3
|
var c=!0;for(var d in b)if(d&&!d.startsWith("_")&&Object.hasOwnProperty.call(b,d)&&Object.hasOwnProperty.call(a,d)){var e=!1,f=b[d],g=a[d];if(g===f)continue;if(!isNaN(g)&&!isNaN(f)){e=!1,c=!1;break}var h=f+"";if(h.startsWith("!")?(h=h.substr(1),e=(g+"").toLowerCase()==h.toLowerCase()):e=(g+"").toLowerCase().includes((h+"").toLowerCase()),!e){c=!1;break}}return c?a:null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_var=add_var,exports.get_var=get_var,exports.get_var_sync=get_var_sync,exports.hold_var=hold_var,exports.set_var=set_var,exports.set_var_sync=set_var_sync;var _asyncStorage=_interopRequireDefault(require("@react-native-async-storage/async-storage")),_react=_interopRequireDefault(require("react")),_core=_interopRequireDefault(require("../core"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}var crypto,lname="list_var";try{crypto=require("@azrico/crypto")}catch(a){}function add_var(){return _add_var.apply(this,arguments)}function _add_var(){return _add_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e;return _regeneratorRuntime().wrap(function f(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,get_var(a,c);case 2:return e=d.sent,Array.isArray(e)||(e=[]),e.push(b),d.next=7,set_var(a,e,c);case 7:return d.abrupt("return",e);case 8:case"end":return d.stop()}},d)})),_add_var.apply(this,arguments)}function get_var_sync(a){var b=_core["default"].Global_get(lname,a),c="string"==typeof b;return c?(b=_optional_dec(b),b):b}function set_var_sync(a,b){var c=b,d="string"==typeof c;return d&&(c=_optional_enc(c)),_core["default"].Global_set(lname,a,c),c}function get_var(a,b){return _get_var.apply(this,arguments)}function _get_var(){return _get_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g,h,i;return _regeneratorRuntime().wrap(function j(c){for(;1;)switch(c.prev=c.next){case 0:if(b||(b={}),d=b.json,e=null,e=_core["default"].Global_get(lname,a),null==e&&b.local_storage&&(f="list_var_"+a,e=localStorage[f]),!(null==e&&b.session)){c.next=14;break}if(h=null===(g=window)||void 0===g?void 0:g.sessionStorage,!h){c.next=13;break}return c.next=10,h.getItem(a);case 10:e=c.sent,c.next=14;break;case 13:throw new Error("session storage is not defined.");case 14:if(!(null==e&&b.storage)){c.next=18;break}return c.next=17,_asyncStorage["default"].getItem(a);case 17:e=c.sent;case 18:if(null!=e){c.next=20;break}return c.abrupt("return",null);case 20:if(i="string"==typeof e,i){c.next=23;break}return c.abrupt("return",e);case 23:return c.next=25,_optional_dec(e);case 25:if(e=c.sent,d)try{e=JSON.parse(e)}catch(a){}return c.abrupt("return",e);case 28:case"end":return c.stop()}},c)})),_get_var.apply(this,arguments)}function set_var(a,b,c){return _set_var.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* if we have crypto support use it, dont throw error otherwise */ /* -------------------------------------------------------------------------- */function _set_var(){return _set_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h,i,j;return _regeneratorRuntime().wrap(function k(d){for(;1;)switch(d.prev=d.next){case 0:if(c||(c={}),e=b,f=c.json&&"function"!=typeof e,f)try{e=JSON.stringify(e)}catch(a){}if((null===e||void 0===e)&&(e=""),g="string"==typeof e,g&&(e=_optional_enc(e)),_core["default"].Global_set(lname,a,e),!c.local_storage){d.next=13;break}if(g){d.next=11;break}throw new Error("You cant save non-string values in local_storage !");case 11:h="list_var_"+a,localStorage[h]=e;case 13:if(!c.session){d.next=22;break}if(g){d.next=16;break}throw new Error("You cant save non-string values in session !");case 16:if(j=null===(i=window)||void 0===i?void 0:i.sessionStorage,!j){d.next=21;break}""===e?j.removeItem(a):j.setItem(a,e),d.next=22;break;case 21:throw new Error("session storage is not defined.");case 22:if(!c.storage){d.next=32;break}if(g){d.next=25;break}throw new Error("You cant save non-string values in AsyncStorage !");case 25:if(""===e){d.next=30;break}return d.next=28,_asyncStorage["default"].setItem(a,e);case 28:d.next=32;break;case 30:return d.next=32,_asyncStorage["default"].removeItem(a);case 32:return d.abrupt("return",e);case 33:case"end":return d.stop()}},d)})),_set_var.apply(this,arguments)}function _optional_dec(a){return crypto?crypto.decrypt(a):a}function _optional_enc(a){return crypto?crypto.encrypt(a):a}/* -------------------------------------------------------------------------- */function hold_var(a,b,c){return _react["default"].useEffect(function(){return set_var(a,b,c),function(){set_var(a,null,c)}},[b]),b}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.add_var=add_var,exports.get_var=get_var,exports.get_var_sync=get_var_sync,exports.hold_var=hold_var,exports.set_var=set_var,exports.set_var_sync=set_var_sync;var _asyncStorage=_interopRequireDefault(require("@react-native-async-storage/async-storage")),_react=_interopRequireDefault(require("react")),_core=_interopRequireDefault(require("../core"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator["return"]&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}var crypto,lname="list_var";try{crypto=require("@azrico/crypto")}catch(a){}var isBrowser="undefined"!=typeof window;function add_var(){return _add_var.apply(this,arguments)}function _add_var(){return _add_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e;return _regeneratorRuntime().wrap(function f(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,get_var(a,c);case 2:return e=d.sent,Array.isArray(e)||(e=[]),e.push(b),d.next=7,set_var(a,e,c);case 7:return d.abrupt("return",e);case 8:case"end":return d.stop()}},d)})),_add_var.apply(this,arguments)}function get_var_sync(a){var b=_core["default"].Global_get(lname,a),c="string"==typeof b;return c?(b=_optional_dec(b),b):b}function set_var_sync(a,b){var c=b,d="string"==typeof c;return d&&(c=_optional_enc(c)),_core["default"].Global_set(lname,a,c),c}function get_var(a,b){return _get_var.apply(this,arguments)}function _get_var(){return _get_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g;return _regeneratorRuntime().wrap(function h(c){for(;1;)switch(c.prev=c.next){case 0:if(b||(b={}),d=b.json,e=null,e=_core["default"].Global_get(lname,a),!(null==e&&b.local_storage)){c.next=9;break}if(f="list_var_"+a,isBrowser){c.next=8;break}throw new Error("you cant use localStorage storage in node");case 8:e=localStorage[f];case 9:if(!(null==e&&b.session)){c.next=15;break}if(isBrowser){c.next=12;break}throw new Error("you cant use session storage in node");case 12:return c.next=14,window.sessionStorage.getItem(a);case 14:e=c.sent;case 15:if(!(null==e&&b.storage)){c.next=19;break}return c.next=18,_asyncStorage["default"].getItem(a);case 18:e=c.sent;case 19:if(null!=e){c.next=21;break}return c.abrupt("return",null);case 21:if(g="string"==typeof e,g){c.next=24;break}return c.abrupt("return",e);case 24:return c.next=26,_optional_dec(e);case 26:if(e=c.sent,d)try{e=JSON.parse(e)}catch(a){}return c.abrupt("return",e);case 29:case"end":return c.stop()}},c)})),_get_var.apply(this,arguments)}function set_var(a,b,c){return _set_var.apply(this,arguments)}/* -------------------------------------------------------------------------- */ /* if we have crypto support use it, dont throw error otherwise */ /* -------------------------------------------------------------------------- */function _set_var(){return _set_var=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function d(a,b,c){var e,f,g,h;return _regeneratorRuntime().wrap(function i(d){for(;1;)switch(d.prev=d.next){case 0:if(c||(c={}),e=b,f=c.json&&"function"!=typeof e,f)try{e=JSON.stringify(e)}catch(a){}if((null===e||void 0===e)&&(e=""),g="string"==typeof e,g&&(e=_optional_enc(e)),_core["default"].Global_set(lname,a,e),!c.local_storage){d.next=15;break}if(isBrowser){d.next=11;break}throw new Error("you cant use localStorage storage in node");case 11:if(g){d.next=13;break}throw new Error("You cant save non-string values in local_storage !");case 13:h="list_var_"+a,localStorage[h]=e;case 15:if(!c.session){d.next=23;break}if(g){d.next=18;break}throw new Error("You cant save non-string values in session !");case 18:if(!isBrowser){d.next=22;break}""===e?window.sessionStorage.removeItem(a):window.sessionStorage.setItem(a,e),d.next=23;break;case 22:throw new Error("you cant use session storage in node");case 23:if(!c.storage){d.next=33;break}if(g){d.next=26;break}throw new Error("You cant save non-string values in AsyncStorage !");case 26:if(""===e){d.next=31;break}return d.next=29,_asyncStorage["default"].setItem(a,e);case 29:d.next=33;break;case 31:return d.next=33,_asyncStorage["default"].removeItem(a);case 33:return d.abrupt("return",e);case 34:case"end":return d.stop()}},d)})),_set_var.apply(this,arguments)}function _optional_dec(a){return crypto?crypto.decrypt(a):a}function _optional_enc(a){return crypto?crypto.encrypt(a):a}/* -------------------------------------------------------------------------- */function hold_var(a,b,c){return _react["default"].useEffect(function(){return set_var(a,b,c),function(){set_var(a,null,c)}},[b]),b}
|