@airma/react-effect
Advanced tools
Comparing version 15.3.1 to 16.0.0
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("@airma/react-state")):"function"==typeof define&&define.amd?define(["react","@airma/react-state"],r):"object"==typeof exports?exports["@airma/react-effect"]=r(require("react"),require("@airma/react-state")):t["@airma/react-effect"]=r(t.react,t["@airma/react-state"])}(self,(function(t,r){return function(){var n={4933:function(t,r,n){var e=n(6291),o=n(7073),i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not a function")}},8209:function(t,r,n){var e=n(1814),o=n(7073),i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not a constructor")}},9076:function(t,r,n){var e=n(6291),o=String,i=TypeError;t.exports=function(t){if("object"==typeof t||e(t))return t;throw i("Can't set "+o(t)+" as a prototype")}},2814:function(t,r,n){var e=n(6282),o=TypeError;t.exports=function(t,r){if(e(r,t))return t;throw o("Incorrect invocation")}},4905:function(t,r,n){var e=n(2366),o=String,i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not an object")}},5029:function(t,r,n){var e=n(678),o=n(6971),i=n(4821),u=function(t){return function(r,n,u){var c,a=e(r),f=i(a),s=o(u,f);if(t&&n!=n){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},9020:function(t,r,n){"use strict";var e=n(5061);t.exports=function(t,r){var n=[][t];return!!n&&e((function(){n.call(null,r||function(){return 1},1)}))}},2040:function(t,r,n){var e=n(4933),o=n(7615),i=n(2901),u=n(4821),c=TypeError,a=function(t){return function(r,n,a,f){e(n);var s=o(r),p=i(s),v=u(s),l=t?v-1:0,y=t?-1:1;if(a<2)for(;;){if(l in p){f=p[l],l+=y;break}if(l+=y,t?l<0:v<=l)throw c("Reduce of empty array with no initial value")}for(;t?l>=0:v>l;l+=y)l in p&&(f=n(f,p[l],l,s));return f}};t.exports={left:a(!1),right:a(!0)}},650:function(t,r,n){var e=n(936);t.exports=e([].slice)},3165:function(t,r,n){var e=n(6802)("iterator"),o=!1;try{var i=0,u={next:function(){return{done:!!i++}},return:function(){o=!0}};u[e]=function(){return this},Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,r){if(!r&&!o)return!1;var n=!1;try{var i={};i[e]=function(){return{next:function(){return{done:n=!0}}}},t(i)}catch(t){}return n}},5489:function(t,r,n){var e=n(936),o=e({}.toString),i=e("".slice);t.exports=function(t){return i(o(t),8,-1)}},486:function(t,r,n){var e=n(8171),o=n(6291),i=n(5489),u=n(6802)("toStringTag"),c=Object,a="Arguments"==i(function(){return arguments}());t.exports=e?i:function(t){var r,n,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,r){try{return t[r]}catch(t){}}(r=c(t),u))?n:a?i(r):"Object"==(e=i(r))&&o(r.callee)?"Arguments":e}},6810:function(t,r,n){var e=n(8382),o=n(2466),i=n(8117),u=n(6462);t.exports=function(t,r,n){for(var c=o(r),a=u.f,f=i.f,s=0;s<c.length;s++){var p=c[s];e(t,p)||n&&e(n,p)||a(t,p,f(r,p))}}},430:function(t,r,n){var e=n(1502),o=n(6462),i=n(6034);t.exports=e?function(t,r,n){return o.f(t,r,i(1,n))}:function(t,r,n){return t[r]=n,t}},6034:function(t){t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},5850:function(t,r,n){var e=n(6291),o=n(6462),i=n(7192),u=n(1756);t.exports=function(t,r,n,c){c||(c={});var a=c.enumerable,f=void 0!==c.name?c.name:r;if(e(n)&&i(n,f,c),c.global)a?t[r]=n:u(r,n);else{try{c.unsafe?t[r]&&(a=!0):delete t[r]}catch(t){}a?t[r]=n:o.f(t,r,{value:n,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return t}},1756:function(t,r,n){var e=n(5001),o=Object.defineProperty;t.exports=function(t,r){try{o(e,t,{value:r,configurable:!0,writable:!0})}catch(n){e[t]=r}return r}},1502:function(t,r,n){var e=n(5061);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},5178:function(t){var r="object"==typeof document&&document.all,n=void 0===r&&void 0!==r;t.exports={all:r,IS_HTMLDDA:n}},6009:function(t,r,n){var e=n(5001),o=n(2366),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},6837:function(t,r,n){var e=n(5065),o=n(566);t.exports=!e&&!o&&"object"==typeof window&&"object"==typeof document},5065:function(t){t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},1368:function(t,r,n){var e=n(9966),o=n(5001);t.exports=/ipad|iphone|ipod/i.test(e)&&void 0!==o.Pebble},311:function(t,r,n){var e=n(9966);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(e)},566:function(t,r,n){var e=n(5489),o=n(5001);t.exports="process"==e(o.process)},4832:function(t,r,n){var e=n(9966);t.exports=/web0s(?!.*chrome)/i.test(e)},9966:function(t,r,n){var e=n(3425);t.exports=e("navigator","userAgent")||""},2821:function(t,r,n){var e,o,i=n(5001),u=n(9966),c=i.process,a=i.Deno,f=c&&c.versions||a&&a.version,s=f&&f.v8;s&&(o=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!o&&u&&(!(e=u.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=u.match(/Chrome\/(\d+)/))&&(o=+e[1]),t.exports=o},2089:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},9638:function(t,r,n){var e=n(5001),o=n(8117).f,i=n(430),u=n(5850),c=n(1756),a=n(6810),f=n(1092);t.exports=function(t,r){var n,s,p,v,l,y=t.target,d=t.global,h=t.stat;if(n=d?e:h?e[y]||c(y,{}):(e[y]||{}).prototype)for(s in r){if(v=r[s],p=t.dontCallGetSet?(l=o(n,s))&&l.value:n[s],!f(d?s:y+(h?".":"#")+s,t.forced)&&void 0!==p){if(typeof v==typeof p)continue;a(v,p)}(t.sham||p&&p.sham)&&i(v,"sham",!0),u(n,s,v,t)}}},5061:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},5494:function(t,r,n){var e=n(8483),o=Function.prototype,i=o.apply,u=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(e?u.bind(i):function(){return u.apply(i,arguments)})},9918:function(t,r,n){var e=n(1017),o=n(4933),i=n(8483),u=e(e.bind);t.exports=function(t,r){return o(t),void 0===r?t:i?u(t,r):function(){return t.apply(r,arguments)}}},8483:function(t,r,n){var e=n(5061);t.exports=!e((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},3927:function(t,r,n){var e=n(8483),o=Function.prototype.call;t.exports=e?o.bind(o):function(){return o.apply(o,arguments)}},9873:function(t,r,n){var e=n(1502),o=n(8382),i=Function.prototype,u=e&&Object.getOwnPropertyDescriptor,c=o(i,"name"),a=c&&"something"===function(){}.name,f=c&&(!e||e&&u(i,"name").configurable);t.exports={EXISTS:c,PROPER:a,CONFIGURABLE:f}},1017:function(t,r,n){var e=n(5489),o=n(936);t.exports=function(t){if("Function"===e(t))return o(t)}},936:function(t,r,n){var e=n(8483),o=Function.prototype,i=o.call,u=e&&o.bind.bind(i,i);t.exports=e?u:function(t){return function(){return i.apply(t,arguments)}}},3425:function(t,r,n){var e=n(5001),o=n(6291),i=function(t){return o(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?i(e[t]):e[t]&&e[t][r]}},6354:function(t,r,n){var e=n(486),o=n(3815),i=n(860),u=n(501),c=n(6802)("iterator");t.exports=function(t){if(!i(t))return o(t,c)||o(t,"@@iterator")||u[e(t)]}},8437:function(t,r,n){var e=n(3927),o=n(4933),i=n(4905),u=n(7073),c=n(6354),a=TypeError;t.exports=function(t,r){var n=arguments.length<2?c(t):r;if(o(n))return i(e(n,t));throw a(u(t)+" is not iterable")}},3815:function(t,r,n){var e=n(4933),o=n(860);t.exports=function(t,r){var n=t[r];return o(n)?void 0:e(n)}},5001:function(t,r,n){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},8382:function(t,r,n){var e=n(936),o=n(7615),i=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,r){return i(o(t),r)}},2499:function(t){t.exports={}},3455:function(t,r,n){var e=n(5001);t.exports=function(t,r){var n=e.console;n&&n.error&&(1==arguments.length?n.error(t):n.error(t,r))}},2118:function(t,r,n){var e=n(3425);t.exports=e("document","documentElement")},7788:function(t,r,n){var e=n(1502),o=n(5061),i=n(6009);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},2901:function(t,r,n){var e=n(936),o=n(5061),i=n(5489),u=Object,c=e("".split);t.exports=o((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?c(t,""):u(t)}:u},685:function(t,r,n){var e=n(936),o=n(6291),i=n(9982),u=e(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return u(t)}),t.exports=i.inspectSource},684:function(t,r,n){var e,o,i,u=n(1899),c=n(5001),a=n(2366),f=n(430),s=n(8382),p=n(9982),v=n(1695),l=n(2499),y="Object already initialized",d=c.TypeError,h=c.WeakMap;if(u||p.state){var b=p.state||(p.state=new h);b.get=b.get,b.has=b.has,b.set=b.set,e=function(t,r){if(b.has(t))throw d(y);return r.facade=t,b.set(t,r),r},o=function(t){return b.get(t)||{}},i=function(t){return b.has(t)}}else{var g=v("state");l[g]=!0,e=function(t,r){if(s(t,g))throw d(y);return r.facade=t,f(t,g,r),r},o=function(t){return s(t,g)?t[g]:{}},i=function(t){return s(t,g)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(r){var n;if(!a(r)||(n=o(r)).type!==t)throw d("Incompatible receiver, "+t+" required");return n}}}},5557:function(t,r,n){var e=n(6802),o=n(501),i=e("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||u[i]===t)}},119:function(t,r,n){var e=n(5489);t.exports=Array.isArray||function(t){return"Array"==e(t)}},6291:function(t,r,n){var e=n(5178),o=e.all;t.exports=e.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},1814:function(t,r,n){var e=n(936),o=n(5061),i=n(6291),u=n(486),c=n(3425),a=n(685),f=function(){},s=[],p=c("Reflect","construct"),v=/^\s*(?:class|function)\b/,l=e(v.exec),y=!v.exec(f),d=function(t){if(!i(t))return!1;try{return p(f,s,t),!0}catch(t){return!1}},h=function(t){if(!i(t))return!1;switch(u(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return y||!!l(v,a(t))}catch(t){return!0}};h.sham=!0,t.exports=!p||o((function(){var t;return d(d.call)||!d(Object)||!d((function(){t=!0}))||t}))?h:d},1092:function(t,r,n){var e=n(5061),o=n(6291),i=/#|\.prototype\./,u=function(t,r){var n=a[c(t)];return n==s||n!=f&&(o(r)?e(r):!!r)},c=u.normalize=function(t){return String(t).replace(i,".").toLowerCase()},a=u.data={},f=u.NATIVE="N",s=u.POLYFILL="P";t.exports=u},860:function(t){t.exports=function(t){return null==t}},2366:function(t,r,n){var e=n(6291),o=n(5178),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:e(t)||t===i}:function(t){return"object"==typeof t?null!==t:e(t)}},13:function(t){t.exports=!1},6448:function(t,r,n){var e=n(3425),o=n(6291),i=n(6282),u=n(7558),c=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=e("Symbol");return o(r)&&i(r.prototype,c(t))}},8971:function(t,r,n){var e=n(9918),o=n(3927),i=n(4905),u=n(7073),c=n(5557),a=n(4821),f=n(6282),s=n(8437),p=n(6354),v=n(9200),l=TypeError,y=function(t,r){this.stopped=t,this.result=r},d=y.prototype;t.exports=function(t,r,n){var h,b,g,m,x,O,w,j=n&&n.that,S=!(!n||!n.AS_ENTRIES),P=!(!n||!n.IS_RECORD),E=!(!n||!n.IS_ITERATOR),T=!(!n||!n.INTERRUPTED),A=e(r,j),R=function(t){return h&&v(h,"normal",t),new y(!0,t)},C=function(t){return S?(i(t),T?A(t[0],t[1],R):A(t[0],t[1])):T?A(t,R):A(t)};if(P)h=t.iterator;else if(E)h=t;else{if(!(b=p(t)))throw l(u(t)+" is not iterable");if(c(b)){for(g=0,m=a(t);m>g;g++)if((x=C(t[g]))&&f(d,x))return x;return new y(!1)}h=s(t,b)}for(O=P?t.next:h.next;!(w=o(O,h)).done;){try{x=C(w.value)}catch(t){v(h,"throw",t)}if("object"==typeof x&&x&&f(d,x))return x}return new y(!1)}},9200:function(t,r,n){var e=n(3927),o=n(4905),i=n(3815);t.exports=function(t,r,n){var u,c;o(t);try{if(!(u=i(t,"return"))){if("throw"===r)throw n;return n}u=e(u,t)}catch(t){c=!0,u=t}if("throw"===r)throw n;if(c)throw u;return o(u),n}},501:function(t){t.exports={}},4821:function(t,r,n){var e=n(4479);t.exports=function(t){return e(t.length)}},7192:function(t,r,n){var e=n(5061),o=n(6291),i=n(8382),u=n(1502),c=n(9873).CONFIGURABLE,a=n(685),f=n(684),s=f.enforce,p=f.get,v=Object.defineProperty,l=u&&!e((function(){return 8!==v((function(){}),"length",{value:8}).length})),y=String(String).split("String"),d=t.exports=function(t,r,n){"Symbol("===String(r).slice(0,7)&&(r="["+String(r).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(r="get "+r),n&&n.setter&&(r="set "+r),(!i(t,"name")||c&&t.name!==r)&&(u?v(t,"name",{value:r,configurable:!0}):t.name=r),l&&n&&i(n,"arity")&&t.length!==n.arity&&v(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?u&&v(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var e=s(t);return i(e,"source")||(e.source=y.join("string"==typeof r?r:"")),t};Function.prototype.toString=d((function(){return o(this)&&p(this).source||a(this)}),"toString")},1367:function(t){var r=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?n:r)(e)}},3690:function(t,r,n){var e,o,i,u,c,a,f,s,p=n(5001),v=n(9918),l=n(8117).f,y=n(8680).set,d=n(311),h=n(1368),b=n(4832),g=n(566),m=p.MutationObserver||p.WebKitMutationObserver,x=p.document,O=p.process,w=p.Promise,j=l(p,"queueMicrotask"),S=j&&j.value;S||(e=function(){var t,r;for(g&&(t=O.domain)&&t.exit();o;){r=o.fn,o=o.next;try{r()}catch(t){throw o?u():i=void 0,t}}i=void 0,t&&t.enter()},d||g||b||!m||!x?!h&&w&&w.resolve?((f=w.resolve(void 0)).constructor=w,s=v(f.then,f),u=function(){s(e)}):g?u=function(){O.nextTick(e)}:(y=v(y,p),u=function(){y(e)}):(c=!0,a=x.createTextNode(""),new m(e).observe(a,{characterData:!0}),u=function(){a.data=c=!c})),t.exports=S||function(t){var r={fn:t,next:void 0};i&&(i.next=r),o||(o=r,u()),i=r}},7714:function(t,r,n){"use strict";var e=n(4933),o=TypeError,i=function(t){var r,n;this.promise=new t((function(t,e){if(void 0!==r||void 0!==n)throw o("Bad Promise constructor");r=t,n=e})),this.resolve=e(r),this.reject=e(n)};t.exports.f=function(t){return new i(t)}},6462:function(t,r,n){var e=n(1502),o=n(7788),i=n(5780),u=n(4905),c=n(1030),a=TypeError,f=Object.defineProperty,s=Object.getOwnPropertyDescriptor,p="enumerable",v="configurable",l="writable";r.f=e?i?function(t,r,n){if(u(t),r=c(r),u(n),"function"==typeof t&&"prototype"===r&&"value"in n&&l in n&&!n.writable){var e=s(t,r);e&&e.writable&&(t[r]=n.value,n={configurable:v in n?n.configurable:e.configurable,enumerable:p in n?n.enumerable:e.enumerable,writable:!1})}return f(t,r,n)}:f:function(t,r,n){if(u(t),r=c(r),u(n),o)try{return f(t,r,n)}catch(t){}if("get"in n||"set"in n)throw a("Accessors not supported");return"value"in n&&(t[r]=n.value),t}},8117:function(t,r,n){var e=n(1502),o=n(3927),i=n(9265),u=n(6034),c=n(678),a=n(1030),f=n(8382),s=n(7788),p=Object.getOwnPropertyDescriptor;r.f=e?p:function(t,r){if(t=c(t),r=a(r),s)try{return p(t,r)}catch(t){}if(f(t,r))return u(!o(i.f,t,r),t[r])}},9219:function(t,r,n){var e=n(3855),o=n(2089).concat("length","prototype");r.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},2822:function(t,r){r.f=Object.getOwnPropertySymbols},6282:function(t,r,n){var e=n(936);t.exports=e({}.isPrototypeOf)},3855:function(t,r,n){var e=n(936),o=n(8382),i=n(678),u=n(5029).indexOf,c=n(2499),a=e([].push);t.exports=function(t,r){var n,e=i(t),f=0,s=[];for(n in e)!o(c,n)&&o(e,n)&&a(s,n);for(;r.length>f;)o(e,n=r[f++])&&(~u(s,n)||a(s,n));return s}},9265:function(t,r){"use strict";var n={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!n.call({1:2},1);r.f=o?function(t){var r=e(this,t);return!!r&&r.enumerable}:n},2848:function(t,r,n){var e=n(936),o=n(4905),i=n(9076);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,n={};try{(t=e(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),r=n instanceof Array}catch(t){}return function(n,e){return o(n),i(e),r?t(n,e):n.__proto__=e,n}}():void 0)},379:function(t,r,n){var e=n(3927),o=n(6291),i=n(2366),u=TypeError;t.exports=function(t,r){var n,c;if("string"===r&&o(n=t.toString)&&!i(c=e(n,t)))return c;if(o(n=t.valueOf)&&!i(c=e(n,t)))return c;if("string"!==r&&o(n=t.toString)&&!i(c=e(n,t)))return c;throw u("Can't convert object to primitive value")}},2466:function(t,r,n){var e=n(3425),o=n(936),i=n(9219),u=n(2822),c=n(4905),a=o([].concat);t.exports=e("Reflect","ownKeys")||function(t){var r=i.f(c(t)),n=u.f;return n?a(r,n(t)):r}},7040:function(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},8410:function(t,r,n){var e=n(5001),o=n(7883),i=n(6291),u=n(1092),c=n(685),a=n(6802),f=n(6837),s=n(5065),p=n(13),v=n(2821),l=o&&o.prototype,y=a("species"),d=!1,h=i(e.PromiseRejectionEvent),b=u("Promise",(function(){var t=c(o),r=t!==String(o);if(!r&&66===v)return!0;if(p&&(!l.catch||!l.finally))return!0;if(!v||v<51||!/native code/.test(t)){var n=new o((function(t){t(1)})),e=function(t){t((function(){}),(function(){}))};if((n.constructor={})[y]=e,!(d=n.then((function(){}))instanceof e))return!0}return!r&&(f||s)&&!h}));t.exports={CONSTRUCTOR:b,REJECTION_EVENT:h,SUBCLASSING:d}},7883:function(t,r,n){var e=n(5001);t.exports=e.Promise},7504:function(t,r,n){var e=n(4905),o=n(2366),i=n(7714);t.exports=function(t,r){if(e(t),o(r)&&r.constructor===t)return r;var n=i.f(t);return(0,n.resolve)(r),n.promise}},3653:function(t,r,n){var e=n(7883),o=n(3165),i=n(8410).CONSTRUCTOR;t.exports=i||!o((function(t){e.all(t).then(void 0,(function(){}))}))},8791:function(t){var r=function(){this.head=null,this.tail=null};r.prototype={add:function(t){var r={item:t,next:null};this.head?this.tail.next=r:this.head=r,this.tail=r},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}},t.exports=r},4475:function(t,r,n){var e=n(860),o=TypeError;t.exports=function(t){if(e(t))throw o("Can't call method on "+t);return t}},3126:function(t,r,n){"use strict";var e=n(3425),o=n(6462),i=n(6802),u=n(1502),c=i("species");t.exports=function(t){var r=e(t),n=o.f;u&&r&&!r[c]&&n(r,c,{configurable:!0,get:function(){return this}})}},606:function(t,r,n){var e=n(6462).f,o=n(8382),i=n(6802)("toStringTag");t.exports=function(t,r,n){t&&!n&&(t=t.prototype),t&&!o(t,i)&&e(t,i,{configurable:!0,value:r})}},1695:function(t,r,n){var e=n(6809),o=n(1050),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},9982:function(t,r,n){var e=n(5001),o=n(1756),i="__core-js_shared__",u=e[i]||o(i,{});t.exports=u},6809:function(t,r,n){var e=n(13),o=n(9982);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.26.1",mode:e?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"})},3571:function(t,r,n){var e=n(4905),o=n(8209),i=n(860),u=n(6802)("species");t.exports=function(t,r){var n,c=e(t).constructor;return void 0===c||i(n=e(c)[u])?r:o(n)}},5947:function(t,r,n){var e=n(2821),o=n(5061);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))},8680:function(t,r,n){var e,o,i,u,c=n(5001),a=n(5494),f=n(9918),s=n(6291),p=n(8382),v=n(5061),l=n(2118),y=n(650),d=n(6009),h=n(7427),b=n(311),g=n(566),m=c.setImmediate,x=c.clearImmediate,O=c.process,w=c.Dispatch,j=c.Function,S=c.MessageChannel,P=c.String,E=0,T={},A="onreadystatechange";try{e=c.location}catch(t){}var R=function(t){if(p(T,t)){var r=T[t];delete T[t],r()}},C=function(t){return function(){R(t)}},D=function(t){R(t.data)},I=function(t){c.postMessage(P(t),e.protocol+"//"+e.host)};m&&x||(m=function(t){h(arguments.length,1);var r=s(t)?t:j(t),n=y(arguments,1);return T[++E]=function(){a(r,void 0,n)},o(E),E},x=function(t){delete T[t]},g?o=function(t){O.nextTick(C(t))}:w&&w.now?o=function(t){w.now(C(t))}:S&&!b?(u=(i=new S).port2,i.port1.onmessage=D,o=f(u.postMessage,u)):c.addEventListener&&s(c.postMessage)&&!c.importScripts&&e&&"file:"!==e.protocol&&!v(I)?(o=I,c.addEventListener("message",D,!1)):o=A in d("script")?function(t){l.appendChild(d("script")).onreadystatechange=function(){l.removeChild(this),R(t)}}:function(t){setTimeout(C(t),0)}),t.exports={set:m,clear:x}},6971:function(t,r,n){var e=n(9398),o=Math.max,i=Math.min;t.exports=function(t,r){var n=e(t);return n<0?o(n+r,0):i(n,r)}},678:function(t,r,n){var e=n(2901),o=n(4475);t.exports=function(t){return e(o(t))}},9398:function(t,r,n){var e=n(1367);t.exports=function(t){var r=+t;return r!=r||0===r?0:e(r)}},4479:function(t,r,n){var e=n(9398),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},7615:function(t,r,n){var e=n(4475),o=Object;t.exports=function(t){return o(e(t))}},6973:function(t,r,n){var e=n(3927),o=n(2366),i=n(6448),u=n(3815),c=n(379),a=n(6802),f=TypeError,s=a("toPrimitive");t.exports=function(t,r){if(!o(t)||i(t))return t;var n,a=u(t,s);if(a){if(void 0===r&&(r="default"),n=e(a,t,r),!o(n)||i(n))return n;throw f("Can't convert object to primitive value")}return void 0===r&&(r="number"),c(t,r)}},1030:function(t,r,n){var e=n(6973),o=n(6448);t.exports=function(t){var r=e(t,"string");return o(r)?r:r+""}},8171:function(t,r,n){var e={};e[n(6802)("toStringTag")]="z",t.exports="[object z]"===String(e)},7073:function(t){var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},1050:function(t,r,n){var e=n(936),o=0,i=Math.random(),u=e(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++o+i,36)}},7558:function(t,r,n){var e=n(5947);t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},5780:function(t,r,n){var e=n(1502),o=n(5061);t.exports=e&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},7427:function(t){var r=TypeError;t.exports=function(t,n){if(t<n)throw r("Not enough arguments");return t}},1899:function(t,r,n){var e=n(5001),o=n(6291),i=e.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},6802:function(t,r,n){var e=n(5001),o=n(6809),i=n(8382),u=n(1050),c=n(5947),a=n(7558),f=o("wks"),s=e.Symbol,p=s&&s.for,v=a?s:s&&s.withoutSetter||u;t.exports=function(t){if(!i(f,t)||!c&&"string"!=typeof f[t]){var r="Symbol."+t;c&&i(s,t)?f[t]=s[t]:f[t]=a&&p?p(r):v(r)}return f[t]}},2937:function(t,r,n){"use strict";var e=n(9638),o=n(2040).left,i=n(9020),u=n(2821),c=n(566);e({target:"Array",proto:!0,forced:!i("reduce")||!c&&u>79&&u<83},{reduce:function(t){var r=arguments.length;return o(this,t,r,r>1?arguments[1]:void 0)}})},8547:function(t,r,n){"use strict";var e=n(9638),o=n(936),i=n(119),u=o([].reverse),c=[1,2];e({target:"Array",proto:!0,forced:String(c)===String(c.reverse())},{reverse:function(){return i(this)&&(this.length=this.length),u(this)}})},5370:function(t,r,n){"use strict";var e=n(9638),o=n(3927),i=n(4933),u=n(7714),c=n(7040),a=n(8971);e({target:"Promise",stat:!0,forced:n(3653)},{all:function(t){var r=this,n=u.f(r),e=n.resolve,f=n.reject,s=c((function(){var n=i(r.resolve),u=[],c=0,s=1;a(t,(function(t){var i=c++,a=!1;s++,o(n,r,t).then((function(t){a||(a=!0,u[i]=t,--s||e(u))}),f)})),--s||e(u)}));return s.error&&f(s.value),n.promise}})},4139:function(t,r,n){"use strict";var e=n(9638),o=n(13),i=n(8410).CONSTRUCTOR,u=n(7883),c=n(3425),a=n(6291),f=n(5850),s=u&&u.prototype;if(e({target:"Promise",proto:!0,forced:i,real:!0},{catch:function(t){return this.then(void 0,t)}}),!o&&a(u)){var p=c("Promise").prototype.catch;s.catch!==p&&f(s,"catch",p,{unsafe:!0})}},9688:function(t,r,n){"use strict";var e,o,i,u=n(9638),c=n(13),a=n(566),f=n(5001),s=n(3927),p=n(5850),v=n(2848),l=n(606),y=n(3126),d=n(4933),h=n(6291),b=n(2366),g=n(2814),m=n(3571),x=n(8680).set,O=n(3690),w=n(3455),j=n(7040),S=n(8791),P=n(684),E=n(7883),T=n(8410),A=n(7714),R="Promise",C=T.CONSTRUCTOR,D=T.REJECTION_EVENT,I=T.SUBCLASSING,M=P.getterFor(R),_=P.set,F=E&&E.prototype,N=E,k=F,L=f.TypeError,U=f.document,z=f.process,K=A.f,q=K,G=!!(U&&U.createEvent&&f.dispatchEvent),B="unhandledrejection",H=function(t){var r;return!(!b(t)||!h(r=t.then))&&r},W=function(t,r){var n,e,o,i=r.value,u=1==r.state,c=u?t.ok:t.fail,a=t.resolve,f=t.reject,p=t.domain;try{c?(u||(2===r.rejection&&X(r),r.rejection=1),!0===c?n=i:(p&&p.enter(),n=c(i),p&&(p.exit(),o=!0)),n===t.promise?f(L("Promise-chain cycle")):(e=H(n))?s(e,n,a,f):a(n)):f(i)}catch(t){p&&!o&&p.exit(),f(t)}},V=function(t,r){t.notified||(t.notified=!0,O((function(){for(var n,e=t.reactions;n=e.get();)W(n,t);t.notified=!1,r&&!t.rejection&&$(t)})))},J=function(t,r,n){var e,o;G?((e=U.createEvent("Event")).promise=r,e.reason=n,e.initEvent(t,!1,!0),f.dispatchEvent(e)):e={promise:r,reason:n},!D&&(o=f["on"+t])?o(e):t===B&&w("Unhandled promise rejection",n)},$=function(t){s(x,f,(function(){var r,n=t.facade,e=t.value;if(Q(t)&&(r=j((function(){a?z.emit("unhandledRejection",e,n):J(B,n,e)})),t.rejection=a||Q(t)?2:1,r.error))throw r.value}))},Q=function(t){return 1!==t.rejection&&!t.parent},X=function(t){s(x,f,(function(){var r=t.facade;a?z.emit("rejectionHandled",r):J("rejectionhandled",r,t.value)}))},Y=function(t,r,n){return function(e){t(r,e,n)}},Z=function(t,r,n){t.done||(t.done=!0,n&&(t=n),t.value=r,t.state=2,V(t,!0))},tt=function(t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===r)throw L("Promise can't be resolved itself");var e=H(r);e?O((function(){var n={done:!1};try{s(e,r,Y(tt,n,t),Y(Z,n,t))}catch(r){Z(n,r,t)}})):(t.value=r,t.state=1,V(t,!1))}catch(r){Z({done:!1},r,t)}}};if(C&&(k=(N=function(t){g(this,k),d(t),s(e,this);var r=M(this);try{t(Y(tt,r),Y(Z,r))}catch(t){Z(r,t)}}).prototype,(e=function(t){_(this,{type:R,done:!1,notified:!1,parent:!1,reactions:new S,rejection:!1,state:0,value:void 0})}).prototype=p(k,"then",(function(t,r){var n=M(this),e=K(m(this,N));return n.parent=!0,e.ok=!h(t)||t,e.fail=h(r)&&r,e.domain=a?z.domain:void 0,0==n.state?n.reactions.add(e):O((function(){W(e,n)})),e.promise})),o=function(){var t=new e,r=M(t);this.promise=t,this.resolve=Y(tt,r),this.reject=Y(Z,r)},A.f=K=function(t){return t===N||undefined===t?new o(t):q(t)},!c&&h(E)&&F!==Object.prototype)){i=F.then,I||p(F,"then",(function(t,r){var n=this;return new N((function(t,r){s(i,n,t,r)})).then(t,r)}),{unsafe:!0});try{delete F.constructor}catch(t){}v&&v(F,k)}u({global:!0,constructor:!0,wrap:!0,forced:C},{Promise:N}),l(N,R,!1,!0),y(R)},3045:function(t,r,n){n(9688),n(5370),n(4139),n(7508),n(5858),n(1856)},7508:function(t,r,n){"use strict";var e=n(9638),o=n(3927),i=n(4933),u=n(7714),c=n(7040),a=n(8971);e({target:"Promise",stat:!0,forced:n(3653)},{race:function(t){var r=this,n=u.f(r),e=n.reject,f=c((function(){var u=i(r.resolve);a(t,(function(t){o(u,r,t).then(n.resolve,e)}))}));return f.error&&e(f.value),n.promise}})},5858:function(t,r,n){"use strict";var e=n(9638),o=n(3927),i=n(7714);e({target:"Promise",stat:!0,forced:n(8410).CONSTRUCTOR},{reject:function(t){var r=i.f(this);return o(r.reject,void 0,t),r.promise}})},1856:function(t,r,n){"use strict";var e=n(9638),o=n(3425),i=n(13),u=n(7883),c=n(8410).CONSTRUCTOR,a=n(7504),f=o("Promise"),s=i&&!c;e({target:"Promise",stat:!0,forced:i||c},{resolve:function(t){return a(s&&this===f?u:this,t)}})},7400:function(t){"use strict";t.exports=r},8156:function(r){"use strict";r.exports=t}},e={};function o(t){var r=e[t];if(void 0!==r)return r.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.d=function(t,r){for(var n in r)o.o(r,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function n(t,n){if(t){if("string"==typeof t)return r(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(t,n):void 0}}function e(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var e,o,i=[],u=!0,c=!1;try{for(n=n.call(t);!(u=(e=n.next()).done)&&(i.push(e.value),!r||i.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(c)throw o}}return i}}(t,r)||n(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}o.r(i),o.d(i,{ClientConfigProvider:function(){return w},ClientProvider:function(){return F},EffectConfigProvider:function(){return j},EffectProvider:function(){return _},Strategy:function(){return g},asyncEffect:function(){return d},client:function(){return y},useAsyncEffect:function(){return M},useClient:function(){return I},useMutation:function(){return D},useQuery:function(){return C},withClientProvider:function(){return k},withEffectProvider:function(){return N}});o(2937),o(8547),o(3045);var c=o(8156),a=o(7400);function f(t,r){if(null==t)return{};var n,e,o=function(t,r){if(null==t)return{};var n,e,o={},i=Object.keys(t);for(e=0;e<i.length;e++)n=i[e],r.indexOf(n)>=0||(o[n]=t[n]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(e=0;e<i.length;e++)n=i[e],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var s=["version"];function p(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function v(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?p(Object(e),!0).forEach((function(n){t(r,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):p(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function l(t){var r=t.version,n=f(t,s),e=function(t){return v(v({},t),{},{version:r})};return{state:n,version:r||0,setState:function(r){return e("function"!=typeof r?r:r(t))},trigger:function(){return v(v({},t),{},{version:(r||0)+1})}}}function y(t){var r=(0,a.factory)(l,{data:void 0,isError:!1,isFetching:!1,abandon:!1,triggerType:void 0});return r.effect=[function(){return t.apply(void 0,arguments)}],r}var d=y;function h(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function b(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?h(Object(e),!0).forEach((function(n){t(r,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):h(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}var g={debounce:function(t){var r="number"==typeof t?t:t.time;return function(t){var n=t.current,e=t.runner,o=t.store;if(o.current){var i=o.current,u=i.id,c=i.resolve;o.current=void 0,clearTimeout(u),c(b(b({},n()),{},{abandon:!0}))}return new Promise((function(t){var n=setTimeout((function(){t(e())}),r);o.current={id:n,resolve:t}}))}},once:function(){return function(t){var r=t.current,n=t.runner,e=t.store;return e.current?new Promise((function(t){t(b(b({},r()),{},{abandon:!0}))})):(e.current=!0,n().then((function(t){return t.isError&&(e.current=!1),t})))}},error:function(t,r){var n=(r||{}).withAbandoned;return function(r){return(0,r.runner)().then((function(r){return!r.isError||r.abandon&&!n||t(r.error),r}))}},success:function(t,r){var n=(r||{}).withAbandoned;return function(r){return(0,r.runner)().then((function(r){return r.isError||r.abandon&&!n||t(r.data),r}))}}};function m(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function x(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?m(Object(e),!0).forEach((function(n){t(r,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):m(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}var O=(0,c.createContext)(null);function w(t){var r=t.value,n=t.children;return(0,c.createElement)(O.Provider,{value:r},n)}var j=w;function S(){return(0,c.useContext)(O)}function P(t,r){if(!("function"==typeof t.pipe))return[l,t,r];var n=u(t.effect,2);return[t,n[0],n[1]||r]}function E(t){return function(r){var n=t(r);if(!n||"function"!=typeof n.then)throw new Error("The callback have to return a promise object.");return n.then((function(t){return{data:t,error:void 0,isError:!1}}),(function(t){return{error:t,isError:!0}}))}}function T(t,r){return e(r).reverse().reduce((function(r,n,e){var o=t[e]||{current:void 0};return function(t){if(null==n)return r(t);return n(x(x({},t),{},{store:o,runner:function(){return r(t)}}))}}),(function(t){return t.runner()}))}function A(t){return Array.isArray(t)?t:[t]}function R(t){var r=(0,c.useRef)(t);r.current=t;var n=(0,c.useRef)((function(){return r.current.apply(r,arguments)}));return n.current}function C(t,r){var n=u(P(t,Array.isArray(r)?{variables:r}:r),3),o=n[0],i=n[1],f=n[2],s=o===l?[o,{data:void 0,isError:!1,isFetching:!1,abandon:!1,triggerType:void 0}]:[o],p=a.useModel.apply(void 0,e(s)),v=f||{},y=v.variables,d=v.deps,h=v.manual,b=v.strategy,g=v.exact,m=S()||{},O=(g?{strategy:void 0}:m).strategy,w=!d&&!y||h,j=A(b),C=O?O(j,"query"):j,D=E((function(t){return i.apply(void 0,e(t||y||[]))})),I=(0,c.useRef)(!0),M=(0,c.useRef)({}),_=(0,c.useRef)(C.map((function(){return{current:void 0}}))),F=(0,c.useRef)(0),N=function(t,r){var n=F.current+1;F.current=n;var e=p.state;return(0,p.setState)(x(x({},e),{},{isFetching:!0,fetchingKey:M.current,triggerType:t})),D(r).then((function(r){var e=n!==F.current;return x(x(x({},p.state),r),{},{abandon:e,isFetching:!1,fetchingKey:void 0,triggerType:t})}))},k=function(t,r,n){var e={current:function(){return p.state},variables:n||y,runner:function(){return t(r,n)},store:_};return T(_.current,C)(e)},L=function(t){return k(N,"manual",t).then((function(t){return t.abandon||p.setState(t),t}))},U=R((function(){return L()})),z=R((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return L(r)}));(0,c.useLayoutEffect)((function(){var t=I.current;if(I.current=!1,!w){var r=p.state.fetchingKey;r&&r!==M.current||function(t){var r=p.state.fetchingKey;r&&r!==M.current||k(N,t?"mount":"update").then((function(t){return t.abandon||p.setState(t),t}))}(t)}}),d||y||[]);var K=(0,c.useRef)(p.version);return(0,c.useEffect)((function(){K.current!==p.version&&(K.current=p.version,L())}),[p.version]),[p.state,U,z]}function D(t,r){var n=u(P(t,Array.isArray(r)?{variables:r}:r),3),o=n[0],i=n[1],f=n[2],s=o===l?[o,{data:void 0,isError:!1,isFetching:!1,abandon:!1,triggerType:void 0}]:[o],p=a.useModel.apply(void 0,e(s)),v=f||{},y=v.variables,d=v.strategy,h=v.exact,b=S()||{},g=(h?{strategy:void 0}:b).strategy,m=A(d),O=g?g(m,"mutation"):m,w=E((function(t){return i.apply(void 0,e(t||y||[]))})),j=(0,c.useRef)(O.map((function(){return{current:void 0}}))),C=(0,c.useRef)({}),D=(0,c.useRef)(!1),I=function(t){if(D.current)return new Promise((function(t){t(x(x({},p.state),{},{abandon:!0,triggerType:"manual"}))}));D.current=!0;var r=p.state;return(0,p.setState)(x(x({},r),{},{isFetching:!0,fetchingKey:C.current,triggerType:"manual"})),w(t).then((function(t){return D.current=!1,x(x(x({},p.state),t),{},{isFetching:!1,fetchingKey:void 0,triggerType:"manual"})}))},M=function(t){return function(t,r){var n={current:function(){return p.state},variables:r||y,runner:function(){return t(r)},store:j};return T(j.current,O)(n)}(I,t).then((function(t){return t.abandon||p.setState(t),t}))},_=R((function(){return M()})),F=R((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return M(r)})),N=(0,c.useRef)(p.version);return(0,c.useEffect)((function(){N.current!==p.version&&(N.current=p.version,M())}),[p.version]),[p.state,_,F]}function I(t){return(0,a.useSelector)(t,(function(t){return[t.state,t.trigger]}))}var M=I,_=a.ModelProvider,F=a.ModelProvider,N=a.withModelProvider,k=a.withModelProvider}(),i}()})); | ||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("@airma/react-state")):"function"==typeof define&&define.amd?define(["react","@airma/react-state"],r):"object"==typeof exports?exports["@airma/react-effect"]=r(require("react"),require("@airma/react-state")):t["@airma/react-effect"]=r(t.react,t["@airma/react-state"])}(self,(function(t,r){return function(){var n={4933:function(t,r,n){var e=n(6291),o=n(7073),i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not a function")}},8209:function(t,r,n){var e=n(1814),o=n(7073),i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not a constructor")}},9076:function(t,r,n){var e=n(6291),o=String,i=TypeError;t.exports=function(t){if("object"==typeof t||e(t))return t;throw i("Can't set "+o(t)+" as a prototype")}},2814:function(t,r,n){var e=n(6282),o=TypeError;t.exports=function(t,r){if(e(r,t))return t;throw o("Incorrect invocation")}},4905:function(t,r,n){var e=n(2366),o=String,i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not an object")}},5029:function(t,r,n){var e=n(678),o=n(6971),i=n(4821),u=function(t){return function(r,n,u){var c,a=e(r),f=i(a),s=o(u,f);if(t&&n!=n){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},9020:function(t,r,n){"use strict";var e=n(5061);t.exports=function(t,r){var n=[][t];return!!n&&e((function(){n.call(null,r||function(){return 1},1)}))}},2040:function(t,r,n){var e=n(4933),o=n(7615),i=n(2901),u=n(4821),c=TypeError,a=function(t){return function(r,n,a,f){e(n);var s=o(r),p=i(s),l=u(s),v=t?l-1:0,d=t?-1:1;if(a<2)for(;;){if(v in p){f=p[v],v+=d;break}if(v+=d,t?v<0:l<=v)throw c("Reduce of empty array with no initial value")}for(;t?v>=0:l>v;v+=d)v in p&&(f=n(f,p[v],v,s));return f}};t.exports={left:a(!1),right:a(!0)}},650:function(t,r,n){var e=n(936);t.exports=e([].slice)},3165:function(t,r,n){var e=n(6802)("iterator"),o=!1;try{var i=0,u={next:function(){return{done:!!i++}},return:function(){o=!0}};u[e]=function(){return this},Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,r){if(!r&&!o)return!1;var n=!1;try{var i={};i[e]=function(){return{next:function(){return{done:n=!0}}}},t(i)}catch(t){}return n}},5489:function(t,r,n){var e=n(936),o=e({}.toString),i=e("".slice);t.exports=function(t){return i(o(t),8,-1)}},486:function(t,r,n){var e=n(8171),o=n(6291),i=n(5489),u=n(6802)("toStringTag"),c=Object,a="Arguments"==i(function(){return arguments}());t.exports=e?i:function(t){var r,n,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,r){try{return t[r]}catch(t){}}(r=c(t),u))?n:a?i(r):"Object"==(e=i(r))&&o(r.callee)?"Arguments":e}},6810:function(t,r,n){var e=n(8382),o=n(2466),i=n(8117),u=n(6462);t.exports=function(t,r,n){for(var c=o(r),a=u.f,f=i.f,s=0;s<c.length;s++){var p=c[s];e(t,p)||n&&e(n,p)||a(t,p,f(r,p))}}},430:function(t,r,n){var e=n(1502),o=n(6462),i=n(6034);t.exports=e?function(t,r,n){return o.f(t,r,i(1,n))}:function(t,r,n){return t[r]=n,t}},6034:function(t){t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},5850:function(t,r,n){var e=n(6291),o=n(6462),i=n(7192),u=n(1756);t.exports=function(t,r,n,c){c||(c={});var a=c.enumerable,f=void 0!==c.name?c.name:r;if(e(n)&&i(n,f,c),c.global)a?t[r]=n:u(r,n);else{try{c.unsafe?t[r]&&(a=!0):delete t[r]}catch(t){}a?t[r]=n:o.f(t,r,{value:n,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return t}},1756:function(t,r,n){var e=n(5001),o=Object.defineProperty;t.exports=function(t,r){try{o(e,t,{value:r,configurable:!0,writable:!0})}catch(n){e[t]=r}return r}},1502:function(t,r,n){var e=n(5061);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},5178:function(t){var r="object"==typeof document&&document.all,n=void 0===r&&void 0!==r;t.exports={all:r,IS_HTMLDDA:n}},6009:function(t,r,n){var e=n(5001),o=n(2366),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},6837:function(t,r,n){var e=n(5065),o=n(566);t.exports=!e&&!o&&"object"==typeof window&&"object"==typeof document},5065:function(t){t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},1368:function(t,r,n){var e=n(9966),o=n(5001);t.exports=/ipad|iphone|ipod/i.test(e)&&void 0!==o.Pebble},311:function(t,r,n){var e=n(9966);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(e)},566:function(t,r,n){var e=n(5489),o=n(5001);t.exports="process"==e(o.process)},4832:function(t,r,n){var e=n(9966);t.exports=/web0s(?!.*chrome)/i.test(e)},9966:function(t,r,n){var e=n(3425);t.exports=e("navigator","userAgent")||""},2821:function(t,r,n){var e,o,i=n(5001),u=n(9966),c=i.process,a=i.Deno,f=c&&c.versions||a&&a.version,s=f&&f.v8;s&&(o=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!o&&u&&(!(e=u.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=u.match(/Chrome\/(\d+)/))&&(o=+e[1]),t.exports=o},2089:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},9638:function(t,r,n){var e=n(5001),o=n(8117).f,i=n(430),u=n(5850),c=n(1756),a=n(6810),f=n(1092);t.exports=function(t,r){var n,s,p,l,v,d=t.target,y=t.global,h=t.stat;if(n=y?e:h?e[d]||c(d,{}):(e[d]||{}).prototype)for(s in r){if(l=r[s],p=t.dontCallGetSet?(v=o(n,s))&&v.value:n[s],!f(y?s:d+(h?".":"#")+s,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;a(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),u(n,s,l,t)}}},5061:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},5494:function(t,r,n){var e=n(8483),o=Function.prototype,i=o.apply,u=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(e?u.bind(i):function(){return u.apply(i,arguments)})},9918:function(t,r,n){var e=n(1017),o=n(4933),i=n(8483),u=e(e.bind);t.exports=function(t,r){return o(t),void 0===r?t:i?u(t,r):function(){return t.apply(r,arguments)}}},8483:function(t,r,n){var e=n(5061);t.exports=!e((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},3927:function(t,r,n){var e=n(8483),o=Function.prototype.call;t.exports=e?o.bind(o):function(){return o.apply(o,arguments)}},9873:function(t,r,n){var e=n(1502),o=n(8382),i=Function.prototype,u=e&&Object.getOwnPropertyDescriptor,c=o(i,"name"),a=c&&"something"===function(){}.name,f=c&&(!e||e&&u(i,"name").configurable);t.exports={EXISTS:c,PROPER:a,CONFIGURABLE:f}},1017:function(t,r,n){var e=n(5489),o=n(936);t.exports=function(t){if("Function"===e(t))return o(t)}},936:function(t,r,n){var e=n(8483),o=Function.prototype,i=o.call,u=e&&o.bind.bind(i,i);t.exports=e?u:function(t){return function(){return i.apply(t,arguments)}}},3425:function(t,r,n){var e=n(5001),o=n(6291),i=function(t){return o(t)?t:void 0};t.exports=function(t,r){return arguments.length<2?i(e[t]):e[t]&&e[t][r]}},6354:function(t,r,n){var e=n(486),o=n(3815),i=n(860),u=n(501),c=n(6802)("iterator");t.exports=function(t){if(!i(t))return o(t,c)||o(t,"@@iterator")||u[e(t)]}},8437:function(t,r,n){var e=n(3927),o=n(4933),i=n(4905),u=n(7073),c=n(6354),a=TypeError;t.exports=function(t,r){var n=arguments.length<2?c(t):r;if(o(n))return i(e(n,t));throw a(u(t)+" is not iterable")}},3815:function(t,r,n){var e=n(4933),o=n(860);t.exports=function(t,r){var n=t[r];return o(n)?void 0:e(n)}},5001:function(t,r,n){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},8382:function(t,r,n){var e=n(936),o=n(7615),i=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,r){return i(o(t),r)}},2499:function(t){t.exports={}},3455:function(t,r,n){var e=n(5001);t.exports=function(t,r){var n=e.console;n&&n.error&&(1==arguments.length?n.error(t):n.error(t,r))}},2118:function(t,r,n){var e=n(3425);t.exports=e("document","documentElement")},7788:function(t,r,n){var e=n(1502),o=n(5061),i=n(6009);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},2901:function(t,r,n){var e=n(936),o=n(5061),i=n(5489),u=Object,c=e("".split);t.exports=o((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?c(t,""):u(t)}:u},685:function(t,r,n){var e=n(936),o=n(6291),i=n(9982),u=e(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return u(t)}),t.exports=i.inspectSource},684:function(t,r,n){var e,o,i,u=n(1899),c=n(5001),a=n(2366),f=n(430),s=n(8382),p=n(9982),l=n(1695),v=n(2499),d="Object already initialized",y=c.TypeError,h=c.WeakMap;if(u||p.state){var b=p.state||(p.state=new h);b.get=b.get,b.has=b.has,b.set=b.set,e=function(t,r){if(b.has(t))throw y(d);return r.facade=t,b.set(t,r),r},o=function(t){return b.get(t)||{}},i=function(t){return b.has(t)}}else{var g=l("state");v[g]=!0,e=function(t,r){if(s(t,g))throw y(d);return r.facade=t,f(t,g,r),r},o=function(t){return s(t,g)?t[g]:{}},i=function(t){return s(t,g)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(r){var n;if(!a(r)||(n=o(r)).type!==t)throw y("Incompatible receiver, "+t+" required");return n}}}},5557:function(t,r,n){var e=n(6802),o=n(501),i=e("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||u[i]===t)}},119:function(t,r,n){var e=n(5489);t.exports=Array.isArray||function(t){return"Array"==e(t)}},6291:function(t,r,n){var e=n(5178),o=e.all;t.exports=e.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},1814:function(t,r,n){var e=n(936),o=n(5061),i=n(6291),u=n(486),c=n(3425),a=n(685),f=function(){},s=[],p=c("Reflect","construct"),l=/^\s*(?:class|function)\b/,v=e(l.exec),d=!l.exec(f),y=function(t){if(!i(t))return!1;try{return p(f,s,t),!0}catch(t){return!1}},h=function(t){if(!i(t))return!1;switch(u(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return d||!!v(l,a(t))}catch(t){return!0}};h.sham=!0,t.exports=!p||o((function(){var t;return y(y.call)||!y(Object)||!y((function(){t=!0}))||t}))?h:y},1092:function(t,r,n){var e=n(5061),o=n(6291),i=/#|\.prototype\./,u=function(t,r){var n=a[c(t)];return n==s||n!=f&&(o(r)?e(r):!!r)},c=u.normalize=function(t){return String(t).replace(i,".").toLowerCase()},a=u.data={},f=u.NATIVE="N",s=u.POLYFILL="P";t.exports=u},860:function(t){t.exports=function(t){return null==t}},2366:function(t,r,n){var e=n(6291),o=n(5178),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:e(t)||t===i}:function(t){return"object"==typeof t?null!==t:e(t)}},13:function(t){t.exports=!1},6448:function(t,r,n){var e=n(3425),o=n(6291),i=n(6282),u=n(7558),c=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var r=e("Symbol");return o(r)&&i(r.prototype,c(t))}},8971:function(t,r,n){var e=n(9918),o=n(3927),i=n(4905),u=n(7073),c=n(5557),a=n(4821),f=n(6282),s=n(8437),p=n(6354),l=n(9200),v=TypeError,d=function(t,r){this.stopped=t,this.result=r},y=d.prototype;t.exports=function(t,r,n){var h,b,g,m,x,O,w,j=n&&n.that,S=!(!n||!n.AS_ENTRIES),P=!(!n||!n.IS_RECORD),E=!(!n||!n.IS_ITERATOR),T=!(!n||!n.INTERRUPTED),A=e(r,j),R=function(t){return h&&l(h,"normal",t),new d(!0,t)},C=function(t){return S?(i(t),T?A(t[0],t[1],R):A(t[0],t[1])):T?A(t,R):A(t)};if(P)h=t.iterator;else if(E)h=t;else{if(!(b=p(t)))throw v(u(t)+" is not iterable");if(c(b)){for(g=0,m=a(t);m>g;g++)if((x=C(t[g]))&&f(y,x))return x;return new d(!1)}h=s(t,b)}for(O=P?t.next:h.next;!(w=o(O,h)).done;){try{x=C(w.value)}catch(t){l(h,"throw",t)}if("object"==typeof x&&x&&f(y,x))return x}return new d(!1)}},9200:function(t,r,n){var e=n(3927),o=n(4905),i=n(3815);t.exports=function(t,r,n){var u,c;o(t);try{if(!(u=i(t,"return"))){if("throw"===r)throw n;return n}u=e(u,t)}catch(t){c=!0,u=t}if("throw"===r)throw n;if(c)throw u;return o(u),n}},501:function(t){t.exports={}},4821:function(t,r,n){var e=n(4479);t.exports=function(t){return e(t.length)}},7192:function(t,r,n){var e=n(5061),o=n(6291),i=n(8382),u=n(1502),c=n(9873).CONFIGURABLE,a=n(685),f=n(684),s=f.enforce,p=f.get,l=Object.defineProperty,v=u&&!e((function(){return 8!==l((function(){}),"length",{value:8}).length})),d=String(String).split("String"),y=t.exports=function(t,r,n){"Symbol("===String(r).slice(0,7)&&(r="["+String(r).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(r="get "+r),n&&n.setter&&(r="set "+r),(!i(t,"name")||c&&t.name!==r)&&(u?l(t,"name",{value:r,configurable:!0}):t.name=r),v&&n&&i(n,"arity")&&t.length!==n.arity&&l(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?u&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var e=s(t);return i(e,"source")||(e.source=d.join("string"==typeof r?r:"")),t};Function.prototype.toString=y((function(){return o(this)&&p(this).source||a(this)}),"toString")},1367:function(t){var r=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?n:r)(e)}},3690:function(t,r,n){var e,o,i,u,c,a,f,s,p=n(5001),l=n(9918),v=n(8117).f,d=n(8680).set,y=n(311),h=n(1368),b=n(4832),g=n(566),m=p.MutationObserver||p.WebKitMutationObserver,x=p.document,O=p.process,w=p.Promise,j=v(p,"queueMicrotask"),S=j&&j.value;S||(e=function(){var t,r;for(g&&(t=O.domain)&&t.exit();o;){r=o.fn,o=o.next;try{r()}catch(t){throw o?u():i=void 0,t}}i=void 0,t&&t.enter()},y||g||b||!m||!x?!h&&w&&w.resolve?((f=w.resolve(void 0)).constructor=w,s=l(f.then,f),u=function(){s(e)}):g?u=function(){O.nextTick(e)}:(d=l(d,p),u=function(){d(e)}):(c=!0,a=x.createTextNode(""),new m(e).observe(a,{characterData:!0}),u=function(){a.data=c=!c})),t.exports=S||function(t){var r={fn:t,next:void 0};i&&(i.next=r),o||(o=r,u()),i=r}},7714:function(t,r,n){"use strict";var e=n(4933),o=TypeError,i=function(t){var r,n;this.promise=new t((function(t,e){if(void 0!==r||void 0!==n)throw o("Bad Promise constructor");r=t,n=e})),this.resolve=e(r),this.reject=e(n)};t.exports.f=function(t){return new i(t)}},6462:function(t,r,n){var e=n(1502),o=n(7788),i=n(5780),u=n(4905),c=n(1030),a=TypeError,f=Object.defineProperty,s=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",v="writable";r.f=e?i?function(t,r,n){if(u(t),r=c(r),u(n),"function"==typeof t&&"prototype"===r&&"value"in n&&v in n&&!n.writable){var e=s(t,r);e&&e.writable&&(t[r]=n.value,n={configurable:l in n?n.configurable:e.configurable,enumerable:p in n?n.enumerable:e.enumerable,writable:!1})}return f(t,r,n)}:f:function(t,r,n){if(u(t),r=c(r),u(n),o)try{return f(t,r,n)}catch(t){}if("get"in n||"set"in n)throw a("Accessors not supported");return"value"in n&&(t[r]=n.value),t}},8117:function(t,r,n){var e=n(1502),o=n(3927),i=n(9265),u=n(6034),c=n(678),a=n(1030),f=n(8382),s=n(7788),p=Object.getOwnPropertyDescriptor;r.f=e?p:function(t,r){if(t=c(t),r=a(r),s)try{return p(t,r)}catch(t){}if(f(t,r))return u(!o(i.f,t,r),t[r])}},9219:function(t,r,n){var e=n(3855),o=n(2089).concat("length","prototype");r.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},2822:function(t,r){r.f=Object.getOwnPropertySymbols},6282:function(t,r,n){var e=n(936);t.exports=e({}.isPrototypeOf)},3855:function(t,r,n){var e=n(936),o=n(8382),i=n(678),u=n(5029).indexOf,c=n(2499),a=e([].push);t.exports=function(t,r){var n,e=i(t),f=0,s=[];for(n in e)!o(c,n)&&o(e,n)&&a(s,n);for(;r.length>f;)o(e,n=r[f++])&&(~u(s,n)||a(s,n));return s}},9265:function(t,r){"use strict";var n={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!n.call({1:2},1);r.f=o?function(t){var r=e(this,t);return!!r&&r.enumerable}:n},2848:function(t,r,n){var e=n(936),o=n(4905),i=n(9076);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,n={};try{(t=e(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),r=n instanceof Array}catch(t){}return function(n,e){return o(n),i(e),r?t(n,e):n.__proto__=e,n}}():void 0)},379:function(t,r,n){var e=n(3927),o=n(6291),i=n(2366),u=TypeError;t.exports=function(t,r){var n,c;if("string"===r&&o(n=t.toString)&&!i(c=e(n,t)))return c;if(o(n=t.valueOf)&&!i(c=e(n,t)))return c;if("string"!==r&&o(n=t.toString)&&!i(c=e(n,t)))return c;throw u("Can't convert object to primitive value")}},2466:function(t,r,n){var e=n(3425),o=n(936),i=n(9219),u=n(2822),c=n(4905),a=o([].concat);t.exports=e("Reflect","ownKeys")||function(t){var r=i.f(c(t)),n=u.f;return n?a(r,n(t)):r}},7040:function(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},8410:function(t,r,n){var e=n(5001),o=n(7883),i=n(6291),u=n(1092),c=n(685),a=n(6802),f=n(6837),s=n(5065),p=n(13),l=n(2821),v=o&&o.prototype,d=a("species"),y=!1,h=i(e.PromiseRejectionEvent),b=u("Promise",(function(){var t=c(o),r=t!==String(o);if(!r&&66===l)return!0;if(p&&(!v.catch||!v.finally))return!0;if(!l||l<51||!/native code/.test(t)){var n=new o((function(t){t(1)})),e=function(t){t((function(){}),(function(){}))};if((n.constructor={})[d]=e,!(y=n.then((function(){}))instanceof e))return!0}return!r&&(f||s)&&!h}));t.exports={CONSTRUCTOR:b,REJECTION_EVENT:h,SUBCLASSING:y}},7883:function(t,r,n){var e=n(5001);t.exports=e.Promise},7504:function(t,r,n){var e=n(4905),o=n(2366),i=n(7714);t.exports=function(t,r){if(e(t),o(r)&&r.constructor===t)return r;var n=i.f(t);return(0,n.resolve)(r),n.promise}},3653:function(t,r,n){var e=n(7883),o=n(3165),i=n(8410).CONSTRUCTOR;t.exports=i||!o((function(t){e.all(t).then(void 0,(function(){}))}))},8791:function(t){var r=function(){this.head=null,this.tail=null};r.prototype={add:function(t){var r={item:t,next:null};this.head?this.tail.next=r:this.head=r,this.tail=r},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}},t.exports=r},4475:function(t,r,n){var e=n(860),o=TypeError;t.exports=function(t){if(e(t))throw o("Can't call method on "+t);return t}},3126:function(t,r,n){"use strict";var e=n(3425),o=n(6462),i=n(6802),u=n(1502),c=i("species");t.exports=function(t){var r=e(t),n=o.f;u&&r&&!r[c]&&n(r,c,{configurable:!0,get:function(){return this}})}},606:function(t,r,n){var e=n(6462).f,o=n(8382),i=n(6802)("toStringTag");t.exports=function(t,r,n){t&&!n&&(t=t.prototype),t&&!o(t,i)&&e(t,i,{configurable:!0,value:r})}},1695:function(t,r,n){var e=n(6809),o=n(1050),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},9982:function(t,r,n){var e=n(5001),o=n(1756),i="__core-js_shared__",u=e[i]||o(i,{});t.exports=u},6809:function(t,r,n){var e=n(13),o=n(9982);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.26.1",mode:e?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"})},3571:function(t,r,n){var e=n(4905),o=n(8209),i=n(860),u=n(6802)("species");t.exports=function(t,r){var n,c=e(t).constructor;return void 0===c||i(n=e(c)[u])?r:o(n)}},5947:function(t,r,n){var e=n(2821),o=n(5061);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))},8680:function(t,r,n){var e,o,i,u,c=n(5001),a=n(5494),f=n(9918),s=n(6291),p=n(8382),l=n(5061),v=n(2118),d=n(650),y=n(6009),h=n(7427),b=n(311),g=n(566),m=c.setImmediate,x=c.clearImmediate,O=c.process,w=c.Dispatch,j=c.Function,S=c.MessageChannel,P=c.String,E=0,T={},A="onreadystatechange";try{e=c.location}catch(t){}var R=function(t){if(p(T,t)){var r=T[t];delete T[t],r()}},C=function(t){return function(){R(t)}},D=function(t){R(t.data)},M=function(t){c.postMessage(P(t),e.protocol+"//"+e.host)};m&&x||(m=function(t){h(arguments.length,1);var r=s(t)?t:j(t),n=d(arguments,1);return T[++E]=function(){a(r,void 0,n)},o(E),E},x=function(t){delete T[t]},g?o=function(t){O.nextTick(C(t))}:w&&w.now?o=function(t){w.now(C(t))}:S&&!b?(u=(i=new S).port2,i.port1.onmessage=D,o=f(u.postMessage,u)):c.addEventListener&&s(c.postMessage)&&!c.importScripts&&e&&"file:"!==e.protocol&&!l(M)?(o=M,c.addEventListener("message",D,!1)):o=A in y("script")?function(t){v.appendChild(y("script")).onreadystatechange=function(){v.removeChild(this),R(t)}}:function(t){setTimeout(C(t),0)}),t.exports={set:m,clear:x}},6971:function(t,r,n){var e=n(9398),o=Math.max,i=Math.min;t.exports=function(t,r){var n=e(t);return n<0?o(n+r,0):i(n,r)}},678:function(t,r,n){var e=n(2901),o=n(4475);t.exports=function(t){return e(o(t))}},9398:function(t,r,n){var e=n(1367);t.exports=function(t){var r=+t;return r!=r||0===r?0:e(r)}},4479:function(t,r,n){var e=n(9398),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},7615:function(t,r,n){var e=n(4475),o=Object;t.exports=function(t){return o(e(t))}},6973:function(t,r,n){var e=n(3927),o=n(2366),i=n(6448),u=n(3815),c=n(379),a=n(6802),f=TypeError,s=a("toPrimitive");t.exports=function(t,r){if(!o(t)||i(t))return t;var n,a=u(t,s);if(a){if(void 0===r&&(r="default"),n=e(a,t,r),!o(n)||i(n))return n;throw f("Can't convert object to primitive value")}return void 0===r&&(r="number"),c(t,r)}},1030:function(t,r,n){var e=n(6973),o=n(6448);t.exports=function(t){var r=e(t,"string");return o(r)?r:r+""}},8171:function(t,r,n){var e={};e[n(6802)("toStringTag")]="z",t.exports="[object z]"===String(e)},7073:function(t){var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},1050:function(t,r,n){var e=n(936),o=0,i=Math.random(),u=e(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++o+i,36)}},7558:function(t,r,n){var e=n(5947);t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},5780:function(t,r,n){var e=n(1502),o=n(5061);t.exports=e&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},7427:function(t){var r=TypeError;t.exports=function(t,n){if(t<n)throw r("Not enough arguments");return t}},1899:function(t,r,n){var e=n(5001),o=n(6291),i=e.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},6802:function(t,r,n){var e=n(5001),o=n(6809),i=n(8382),u=n(1050),c=n(5947),a=n(7558),f=o("wks"),s=e.Symbol,p=s&&s.for,l=a?s:s&&s.withoutSetter||u;t.exports=function(t){if(!i(f,t)||!c&&"string"!=typeof f[t]){var r="Symbol."+t;c&&i(s,t)?f[t]=s[t]:f[t]=a&&p?p(r):l(r)}return f[t]}},2937:function(t,r,n){"use strict";var e=n(9638),o=n(2040).left,i=n(9020),u=n(2821),c=n(566);e({target:"Array",proto:!0,forced:!i("reduce")||!c&&u>79&&u<83},{reduce:function(t){var r=arguments.length;return o(this,t,r,r>1?arguments[1]:void 0)}})},8547:function(t,r,n){"use strict";var e=n(9638),o=n(936),i=n(119),u=o([].reverse),c=[1,2];e({target:"Array",proto:!0,forced:String(c)===String(c.reverse())},{reverse:function(){return i(this)&&(this.length=this.length),u(this)}})},5370:function(t,r,n){"use strict";var e=n(9638),o=n(3927),i=n(4933),u=n(7714),c=n(7040),a=n(8971);e({target:"Promise",stat:!0,forced:n(3653)},{all:function(t){var r=this,n=u.f(r),e=n.resolve,f=n.reject,s=c((function(){var n=i(r.resolve),u=[],c=0,s=1;a(t,(function(t){var i=c++,a=!1;s++,o(n,r,t).then((function(t){a||(a=!0,u[i]=t,--s||e(u))}),f)})),--s||e(u)}));return s.error&&f(s.value),n.promise}})},4139:function(t,r,n){"use strict";var e=n(9638),o=n(13),i=n(8410).CONSTRUCTOR,u=n(7883),c=n(3425),a=n(6291),f=n(5850),s=u&&u.prototype;if(e({target:"Promise",proto:!0,forced:i,real:!0},{catch:function(t){return this.then(void 0,t)}}),!o&&a(u)){var p=c("Promise").prototype.catch;s.catch!==p&&f(s,"catch",p,{unsafe:!0})}},9688:function(t,r,n){"use strict";var e,o,i,u=n(9638),c=n(13),a=n(566),f=n(5001),s=n(3927),p=n(5850),l=n(2848),v=n(606),d=n(3126),y=n(4933),h=n(6291),b=n(2366),g=n(2814),m=n(3571),x=n(8680).set,O=n(3690),w=n(3455),j=n(7040),S=n(8791),P=n(684),E=n(7883),T=n(8410),A=n(7714),R="Promise",C=T.CONSTRUCTOR,D=T.REJECTION_EVENT,M=T.SUBCLASSING,I=P.getterFor(R),_=P.set,F=E&&E.prototype,N=E,k=F,L=f.TypeError,U=f.document,K=f.process,q=A.f,z=q,G=!!(U&&U.createEvent&&f.dispatchEvent),B="unhandledrejection",H=function(t){var r;return!(!b(t)||!h(r=t.then))&&r},W=function(t,r){var n,e,o,i=r.value,u=1==r.state,c=u?t.ok:t.fail,a=t.resolve,f=t.reject,p=t.domain;try{c?(u||(2===r.rejection&&Q(r),r.rejection=1),!0===c?n=i:(p&&p.enter(),n=c(i),p&&(p.exit(),o=!0)),n===t.promise?f(L("Promise-chain cycle")):(e=H(n))?s(e,n,a,f):a(n)):f(i)}catch(t){p&&!o&&p.exit(),f(t)}},V=function(t,r){t.notified||(t.notified=!0,O((function(){for(var n,e=t.reactions;n=e.get();)W(n,t);t.notified=!1,r&&!t.rejection&&Y(t)})))},J=function(t,r,n){var e,o;G?((e=U.createEvent("Event")).promise=r,e.reason=n,e.initEvent(t,!1,!0),f.dispatchEvent(e)):e={promise:r,reason:n},!D&&(o=f["on"+t])?o(e):t===B&&w("Unhandled promise rejection",n)},Y=function(t){s(x,f,(function(){var r,n=t.facade,e=t.value;if($(t)&&(r=j((function(){a?K.emit("unhandledRejection",e,n):J(B,n,e)})),t.rejection=a||$(t)?2:1,r.error))throw r.value}))},$=function(t){return 1!==t.rejection&&!t.parent},Q=function(t){s(x,f,(function(){var r=t.facade;a?K.emit("rejectionHandled",r):J("rejectionhandled",r,t.value)}))},X=function(t,r,n){return function(e){t(r,e,n)}},Z=function(t,r,n){t.done||(t.done=!0,n&&(t=n),t.value=r,t.state=2,V(t,!0))},tt=function(t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===r)throw L("Promise can't be resolved itself");var e=H(r);e?O((function(){var n={done:!1};try{s(e,r,X(tt,n,t),X(Z,n,t))}catch(r){Z(n,r,t)}})):(t.value=r,t.state=1,V(t,!1))}catch(r){Z({done:!1},r,t)}}};if(C&&(k=(N=function(t){g(this,k),y(t),s(e,this);var r=I(this);try{t(X(tt,r),X(Z,r))}catch(t){Z(r,t)}}).prototype,(e=function(t){_(this,{type:R,done:!1,notified:!1,parent:!1,reactions:new S,rejection:!1,state:0,value:void 0})}).prototype=p(k,"then",(function(t,r){var n=I(this),e=q(m(this,N));return n.parent=!0,e.ok=!h(t)||t,e.fail=h(r)&&r,e.domain=a?K.domain:void 0,0==n.state?n.reactions.add(e):O((function(){W(e,n)})),e.promise})),o=function(){var t=new e,r=I(t);this.promise=t,this.resolve=X(tt,r),this.reject=X(Z,r)},A.f=q=function(t){return t===N||undefined===t?new o(t):z(t)},!c&&h(E)&&F!==Object.prototype)){i=F.then,M||p(F,"then",(function(t,r){var n=this;return new N((function(t,r){s(i,n,t,r)})).then(t,r)}),{unsafe:!0});try{delete F.constructor}catch(t){}l&&l(F,k)}u({global:!0,constructor:!0,wrap:!0,forced:C},{Promise:N}),v(N,R,!1,!0),d(R)},3045:function(t,r,n){n(9688),n(5370),n(4139),n(7508),n(5858),n(1856)},7508:function(t,r,n){"use strict";var e=n(9638),o=n(3927),i=n(4933),u=n(7714),c=n(7040),a=n(8971);e({target:"Promise",stat:!0,forced:n(3653)},{race:function(t){var r=this,n=u.f(r),e=n.reject,f=c((function(){var u=i(r.resolve);a(t,(function(t){o(u,r,t).then(n.resolve,e)}))}));return f.error&&e(f.value),n.promise}})},5858:function(t,r,n){"use strict";var e=n(9638),o=n(3927),i=n(7714);e({target:"Promise",stat:!0,forced:n(8410).CONSTRUCTOR},{reject:function(t){var r=i.f(this);return o(r.reject,void 0,t),r.promise}})},1856:function(t,r,n){"use strict";var e=n(9638),o=n(3425),i=n(13),u=n(7883),c=n(8410).CONSTRUCTOR,a=n(7504),f=o("Promise"),s=i&&!c;e({target:"Promise",stat:!0,forced:i||c},{resolve:function(t){return a(s&&this===f?u:this,t)}})},7400:function(t){"use strict";t.exports=r},8156:function(r){"use strict";r.exports=t}},e={};function o(t){var r=e[t];if(void 0!==r)return r.exports;var i=e[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.d=function(t,r){for(var n in r)o.o(r,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function n(t,n){if(t){if("string"==typeof t)return r(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(t,n):void 0}}function e(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var e,o,i=[],u=!0,c=!1;try{for(n=n.call(t);!(u=(e=n.next()).done)&&(i.push(e.value),!r||i.length!==r);u=!0);}catch(t){c=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(c)throw o}}return i}}(t,r)||n(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}o.r(i),o.d(i,{ClientConfigProvider:function(){return j},ClientProvider:function(){return k},EffectConfigProvider:function(){return S},EffectProvider:function(){return N},Strategy:function(){return m},asyncEffect:function(){return h},client:function(){return y},useAsyncEffect:function(){return F},useClient:function(){return I},useMutation:function(){return M},useQuery:function(){return D},useStatus:function(){return _},withClientProvider:function(){return U},withEffectProvider:function(){return L}});o(2937),o(8547),o(3045);var c=o(8156),a=o(7400);function f(t,r){if(null==t)return{};var n,e,o=function(t,r){if(null==t)return{};var n,e,o={},i=Object.keys(t);for(e=0;e<i.length;e++)n=i[e],r.indexOf(n)>=0||(o[n]=t[n]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(e=0;e<i.length;e++)n=i[e],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var s=["version"];function p(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function l(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?p(Object(e),!0).forEach((function(n){t(r,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):p(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function v(t){var r=t.version,n=f(t,s),e=function(t){return l(l({},t),{},{version:r})};return{state:n,version:r||0,setState:function(r){return e("function"!=typeof r?r:r(t))},trigger:function(){return l(l({},t),{},{version:(r||0)+1})}}}var d=function(t){return l({data:void 0,isError:!1,isFetching:!1,abandon:!1,triggerType:void 0,loaded:!1},t)};function y(t){var r={implemented:!1},n=(0,a.factory)(v,d());return n.effect=[function(){return t.apply(void 0,arguments)}],n.implement=function(t){r.implemented||(n.effect[0]=t,r.implemented=!0)},n}var h=y;function b(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function g(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?b(Object(e),!0).forEach((function(n){t(r,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):b(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}var m={debounce:function(t){var r="number"==typeof t?t:t.duration;return function(t){var n=t.current,e=t.runner,o=t.store;if(o.current){var i=o.current,u=i.id,c=i.resolve;o.current=void 0,clearTimeout(u),c(g(g({},n()),{},{abandon:!0}))}return new Promise((function(t){var n=setTimeout((function(){t(e())}),r);o.current={id:n,resolve:t}}))}},once:function(){return function(t){var r=t.current,n=t.runner,e=t.store;return e.current?new Promise((function(t){t(g(g({},r()),{},{abandon:!0}))})):(e.current=!0,n().then((function(t){return t.isError&&(e.current=!1),t})))}},error:function(t,r){var n=(r||{}).withAbandoned;return function(r){return(0,r.runner)().then((function(r){return!r.isError||r.abandon&&!n||t(r.error),r}))}},success:function(t,r){var n=(r||{}).withAbandoned;return function(r){return(0,r.runner)().then((function(r){return r.isError||r.abandon&&!n||t(r.data),r}))}}};function x(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function O(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?x(Object(e),!0).forEach((function(n){t(r,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):x(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}var w=(0,c.createContext)(null);function j(t){var r=t.value,n=t.children;return(0,c.createElement)(w.Provider,{value:r},n)}var S=j;function P(){return(0,c.useContext)(w)}function E(t,r){if(!("function"==typeof t.pipe))return[v,t,r];var n=u(t.effect,2);return[t,n[0],n[1]||r]}function T(t){return function(r){var n=t(r);if(!n||"function"!=typeof n.then)throw new Error("The callback have to return a promise object.");return n.then((function(t){return{data:t,error:void 0,isError:!1}}),(function(t){return{error:t,isError:!0}}))}}function A(t,r){var n=function(t){return t.runner()};return function(o){return e(r).reverse().reduce((function(r,n,e){var o=t[e]||{current:void 0};return function(t){if(null==n)return r(t);return n(O(O({},t),{},{store:o,runner:function(){return r(t)}}))}}),n)(o).then((function(t){var r=o.current().loaded,n=t.abandon,e=t.isError,i=t.isFetching,u=r||!n&&!e&&!i;return O(O({},t),{},{loaded:u})}))}}function R(t){return Array.isArray(t)?t:[t]}function C(t){var r=(0,c.useRef)(t);r.current=t;var n=(0,c.useRef)((function(){return r.current.apply(r,arguments)}));return n.current}function D(t,r){var n=u(E(t,Array.isArray(r)?{variables:r}:r),3),o=n[0],i=n[1],f=n[2],s=f||{},p=s.variables,l=s.deps,y=s.triggerOn,h=void 0===y?["mount","update","manual"]:y,b=s.manual,g=s.strategy,m=s.defaultData,x=s.exact,w=b?["manual"]:h,j=Object.prototype.hasOwnProperty.call(f||{},"defaultData"),S=o===v?[o,d(j?{data:m,loaded:!0}:void 0)]:j?[o,d({data:m,loaded:!0})]:[o],D=a.useModel.apply(void 0,e(S)),M=P()||{},I=(x?{strategy:void 0}:M).strategy,_=R(g),F=I?I(_,"query"):_,N=T((function(t){return i.apply(void 0,e(t||p||[]))})),k=(0,c.useRef)(!0),L=(0,c.useRef)({}),U=(0,c.useRef)(F.map((function(){return{current:void 0}}))),K=(0,c.useRef)(0),q=function(t,r){var n=K.current+1;K.current=n;var e=D.state;return(0,D.setState)(O(O({},e),{},{isFetching:!0,fetchingKey:L.current,triggerType:t})),N(r).then((function(r){var e=n!==K.current;return O(O(O({},D.state),r),{},{abandon:e,isFetching:!1,fetchingKey:void 0,triggerType:t})}))},z=function(t,r,n){var e={current:function(){return D.state},variables:n||p||[],runner:function(){return t(r,n)},store:U};return A(U.current,F)(e)},G=function(t){var r="manual";return w.indexOf(r)<0?new Promise((function(t){t(O(O({},D.state),{},{abandon:!0}))})):z(q,r,t).then((function(t){return t.abandon||D.setState(t),t}))},B=C((function(){return G()})),H=C((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return G(r)})),W=l||p||[];(0,c.useLayoutEffect)((function(){var t=k.current;k.current=!1;var r=D.state.fetchingKey;r&&r!==L.current||function(t){var r=D.state.fetchingKey;if(!r||r===L.current){var n=t?"mount":"update";w.indexOf(n)<0||z(q,n).then((function(t){return t.abandon||D.setState(t),t}))}}(t)}),e(W));var V=(0,c.useRef)(D.version);return(0,c.useEffect)((function(){V.current!==D.version&&(V.current=D.version,G())}),[D.version]),[D.state,B,H]}function M(t,r){var n=u(E(t,Array.isArray(r)?{variables:r}:r),3),o=n[0],i=n[1],f=n[2],s=f||{},p=s.variables,l=s.strategy,y=s.exact,h=s.defaultData,b=s.deps,g=s.triggerOn,m=void 0===g?["manual"]:g,x=Object.prototype.hasOwnProperty.call(f||{},"defaultData"),w=o===v?[o,d(x?{data:h,loaded:!0}:void 0)]:x?[o,d({data:h,loaded:!0})]:[o],j=a.useModel.apply(void 0,e(w)),S=P()||{},D=(y?{strategy:void 0}:S).strategy,M=R(l),I=D?D(M,"mutation"):M,_=T((function(t){return i.apply(void 0,e(t||p||[]))})),F=(0,c.useRef)(I.map((function(){return{current:void 0}}))),N=(0,c.useRef)(!0),k=(0,c.useRef)({}),L=(0,c.useRef)(!1),U=function(t){if(L.current)return new Promise((function(t){t(O(O({},j.state),{},{abandon:!0,triggerType:"manual"}))}));L.current=!0;var r=j.state;return(0,j.setState)(O(O({},r),{},{isFetching:!0,fetchingKey:k.current,triggerType:"manual"})),_(t).then((function(t){return L.current=!1,O(O(O({},j.state),t),{},{isFetching:!1,fetchingKey:void 0,triggerType:"manual"})}))},K=function(t,r,n){var e={current:function(){return j.state},variables:n||p||[],runner:function(){return t(n)},store:F};return A(F.current,I)(e)},q=function(t){var r="manual";return m.indexOf(r)<0?new Promise((function(t){t(O(O({},j.state),{},{abandon:!0}))})):K(U,0,t).then((function(t){return t.abandon||j.setState(t),t}))},z=C((function(){return q()})),G=C((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return q(r)})),B=(0,c.useRef)(j.version),H=b||p||[];return(0,c.useLayoutEffect)((function(){var t=N.current;N.current=!1;var r=j.state.fetchingKey;r&&r!==k.current||function(t){var r=j.state.fetchingKey;if(!r||r===k.current){var n=t?"mount":"update";m.indexOf(n)<0||K(U).then((function(t){return t.abandon||j.setState(t),t}))}}(t)}),e(H)),(0,c.useEffect)((function(){B.current!==j.version&&(B.current=j.version,q())}),[j.version]),[j.state,z,G]}function I(t,r){var n=(r||{}).loaded,e=(0,a.useSelector)(t,(function(t){return[t.state,t.trigger]}),a.shallowEqual),o=u(e,1)[0];if(n&&!o.loaded)throw new Error("You have set a loaded confirm config, but currently, this promise result has bot been loaded.");return e}function _(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(0,c.useMemo)((function(){var t=r.map((function(t){return u(Array.isArray(t)?t:[t],1)[0]})),n=t.some((function(t){return t.isFetching})),e=t.some((function(t){return t.isError})),o=t.every((function(t){return t.loaded}));return{isFetching:n,isError:e,isSuccess:!e&&o,loaded:o}}),r)}var F=I,N=a.ModelProvider,k=a.ModelProvider,L=a.withModelProvider,U=a.withModelProvider}(),i}()})); |
@@ -6,14 +6,31 @@ import { FactoryCollection, FactoryModel } from '@airma/react-state'; | ||
export declare type PromiseResult<T> = { | ||
data: T | undefined; | ||
declare type LoadedPromiseResult<T> = { | ||
data: T; | ||
error?: any; | ||
isError: boolean; | ||
isFetching: boolean; | ||
fetchingKey?: unknown; | ||
abandon: boolean; | ||
triggerType: undefined | TriggerType; | ||
loaded: true; | ||
}; | ||
declare type UnloadedPromiseResult = { | ||
data: undefined; | ||
error?: any; | ||
isError: boolean; | ||
isFetching: boolean; | ||
fetchingKey?: unknown; | ||
abandon: boolean; | ||
triggerType: undefined | TriggerType; | ||
loaded: false; | ||
}; | ||
export declare type PromiseResult<T> = | ||
| LoadedPromiseResult<T> | ||
| UnloadedPromiseResult; | ||
export declare type StrategyType<T = any> = (value: { | ||
current: () => PromiseResult<T>; | ||
variables?: any[]; | ||
variables: any[]; | ||
runner: () => Promise<PromiseResult<T>>; | ||
@@ -36,2 +53,3 @@ store: { current: any }; | ||
effect: [E]; | ||
implement: (c: E) => void; | ||
}; | ||
@@ -47,2 +65,3 @@ | ||
deps?: any[]; | ||
triggerOn?: TriggerType[]; | ||
variables?: Parameters<C>; | ||
@@ -54,3 +73,12 @@ strategy?: StrategyCollectionType<T>; | ||
declare type DefaultQueryConfig< | ||
T, | ||
C extends PromiseEffectCallback<T> | ||
> = QueryConfig<T, C> & { | ||
defaultData: T; | ||
}; | ||
export declare type MutationConfig<T, C extends PromiseEffectCallback<T>> = { | ||
deps?: any[]; | ||
triggerOn?: TriggerType[]; | ||
variables?: Parameters<C>; | ||
@@ -61,2 +89,9 @@ strategy?: StrategyCollectionType<T>; | ||
declare type DefaultMutationConfig< | ||
T, | ||
C extends PromiseEffectCallback<T> | ||
> = MutationConfig<T, C> & { | ||
defaultData: T; | ||
}; | ||
declare type PCR< | ||
@@ -82,2 +117,12 @@ T extends PromiseEffectCallback<any> | ModelPromiseEffectCallback<any> | ||
callback: D, | ||
config: DefaultQueryConfig<PCR<D>, MCC<D>> | ||
): [ | ||
LoadedPromiseResult<PCR<D>>, | ||
() => Promise<LoadedPromiseResult<PCR<D>>>, | ||
(...variables: Parameters<MCC<D>>) => Promise<LoadedPromiseResult<PCR<D>>> | ||
]; | ||
export declare function useQuery< | ||
D extends PromiseEffectCallback<any> | ModelPromiseEffectCallback<any> | ||
>( | ||
callback: D, | ||
config?: QueryConfig<PCR<D>, MCC<D>> | Parameters<MCC<D>> | ||
@@ -94,2 +139,12 @@ ): [ | ||
callback: D, | ||
config: DefaultMutationConfig<PCR<D>, MCC<D>> | ||
): [ | ||
LoadedPromiseResult<PCR<D>>, | ||
() => Promise<LoadedPromiseResult<PCR<D>>>, | ||
(...variables: Parameters<MCC<D>>) => Promise<LoadedPromiseResult<PCR<D>>> | ||
]; | ||
export declare function useMutation< | ||
D extends PromiseEffectCallback<any> | ModelPromiseEffectCallback<any> | ||
>( | ||
callback: D, | ||
config?: MutationConfig<PCR<D>, MCC<D>> | Parameters<MCC<D>> | ||
@@ -102,12 +157,24 @@ ): [ | ||
declare type LocalClientConfig = { | ||
loaded?: boolean; | ||
}; | ||
/** | ||
* @deprecated | ||
* @param factory | ||
* @param config | ||
*/ | ||
export declare function useAsyncEffect< | ||
D extends ModelPromiseEffectCallback<any> | ||
>(factory: D): [PromiseResult<PCR<D>>, () => void]; | ||
>(factory: D, config?: LocalClientConfig): [PromiseResult<PCR<D>>, () => void]; | ||
export declare function useClient<D extends ModelPromiseEffectCallback<any>>( | ||
factory: D | ||
factory: D, | ||
config: { | ||
loaded: true; | ||
} | ||
): [LoadedPromiseResult<PCR<D>>, () => void]; | ||
export declare function useClient<D extends ModelPromiseEffectCallback<any>>( | ||
factory: D, | ||
config?: LocalClientConfig | ||
): [PromiseResult<PCR<D>>, () => void]; | ||
@@ -129,2 +196,13 @@ | ||
declare type Status = { | ||
isFetching: boolean; | ||
loaded: boolean; | ||
isError: boolean; | ||
isSuccess: boolean; | ||
}; | ||
export declare function useStatus( | ||
...results: (PromiseResult | [PromiseResult, ...any])[] | ||
): Status; | ||
/** | ||
@@ -182,3 +260,3 @@ * @deprecated | ||
export declare const Strategy: { | ||
debounce: (op: { time: number } | number) => StrategyType; | ||
debounce: (op: { duration: number } | number) => StrategyType; | ||
once: () => StrategyType; | ||
@@ -190,5 +268,5 @@ error: ( | ||
success: <T>( | ||
process: (data: T | undefined) => any, | ||
process: (data: T) => any, | ||
option?: { withAbandoned?: boolean } | ||
) => StrategyType<T>; | ||
}; |
{ | ||
"private": false, | ||
"name": "@airma/react-effect", | ||
"version": "15.3.1", | ||
"version": "16.0.0", | ||
"description": "This is a react async state management tool", | ||
@@ -28,3 +28,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@airma/react-state": "^17.1.0", | ||
"@airma/react-state": "^17.1.8", | ||
"react": ">=16.8.0", | ||
@@ -31,0 +31,0 @@ "react-dom": ">=16.8.0" |
766
README.md
@@ -17,94 +17,21 @@ [![npm][npm-image]][npm-url] | ||
React hook system is designed for synchronous render usage. But asynchronous operations are often used in components, so, take the asynchronous code out of render is a good choice. That's why `useEffect` is useful in hook system, we can set the asynchronous in it, and run it out of the render time. | ||
Do asynchronous operations in `effects` is more effective. | ||
Good example: | ||
1. You can pre-render a default result for asynchronous operation before it is really resolved. | ||
2. It makes component render with less asynchronous effects spread in event handle callbacks. | ||
```ts | ||
import {useEffect, useState} from 'react'; | ||
import {query} from './service'; | ||
If you are ready to improve your react app codes with less asynchronous operation effects, please take minutes to read the [documents](https://filefoxper.github.io/airma/#/react-effect/index) of this tool. | ||
const useQueryEffect = (variables)=>{ | ||
const [data, setData] = useState(undefined); | ||
const [isFetching, setFetching] = useState(false); | ||
const [error, setError] = useState(undefined); | ||
## Basic Usage | ||
useEffect(()=>{ | ||
setFetching(true); | ||
// limit the asynchronous only in useEffect | ||
query(variables).then((d)=>{ | ||
// set the query result into state | ||
setData(d); | ||
setError(undefined); | ||
setFetching(false); | ||
},(e)=>{ | ||
setError(e); | ||
setFetching(false); | ||
}); | ||
},[variables]); // when variables change, run query | ||
The basic hook API `useQuery` and `useMutation` maintains a promise result state. It contains promise information `data`, `error` and status `isFetching`, `isError` for a render help. | ||
// return state information out for render usage | ||
return {data, isFetching, error}; | ||
}; | ||
### UseQuery | ||
const App = memo(()=>{ | ||
...... | ||
const {data, isFetching, error} = useQueryEffect(variables); | ||
This API is often used to query data with a promise returning callback and parameters for this callback. When `useQuery` is mounted, or the elements of parameters changed, it calls query callback. | ||
return ......; | ||
}); | ||
``` | ||
Not so good example: | ||
```ts | ||
import {memo, useState} from 'react'; | ||
import {query} from './service'; | ||
const App = memo(()=>{ | ||
const [data, setData] = useState(undefined); | ||
const [isFetching, setFetching] = useState(false); | ||
const [error, setError] = useState(undefined); | ||
// Use asynchronous callback directly | ||
// may affect the other operation codes, | ||
// and make asynchronous operations spread out in component | ||
const handleQuery = async (variables)=>{ | ||
setFetching(true); | ||
try { | ||
const d = await query(variables); | ||
setData(d); | ||
setError(undefined); | ||
} catch(e) { | ||
setError(e); | ||
} finally { | ||
setFetching(false); | ||
} | ||
}; | ||
// affected by asynchronous callback `handleQuery` | ||
const handleReset = async ()=>{ | ||
await handleQuery(defaultVariables); | ||
doSomething(); | ||
}; | ||
useEffect(()=>{ | ||
handleQuery(); | ||
},[]); | ||
return ......; | ||
}) | ||
``` | ||
Use asynchronous callback all over in component is not a good idea, we need concentrative controllers for limit asynchronous operations in less effects. Then we can have a simple synchronously render component. | ||
Now, Let's take some simple, but more powerful API to replace the code of good example above. | ||
## useQuery | ||
We can wrap a promise return callback to `useQuery`, when the dependecy varaibles change, it fetches data for you. | ||
```ts | ||
import React from 'react'; | ||
import {useQuery} from '@airma/react-effect'; | ||
import {client} from '@airma/restful'; | ||
import {User} from './type'; | ||
@@ -115,15 +42,13 @@ type UserQuery = { | ||
} | ||
// Prepare a callback which returns a promise. | ||
// We call it a query callback. | ||
const fetchUsers = (query: UserQuery):Promise<User[]> => | ||
Promise.resolve([]); | ||
const cli = client(); | ||
const App = ()=>{ | ||
const [query, setQuery] = useState({name:'', username:''}); | ||
const [result, execute] = useQuery( | ||
// query method | ||
(q: UserQuery)=> | ||
cli.rest('/api/user/list'). | ||
setParams(q). | ||
get<User[]>(), | ||
// dependency vairables change, | ||
// the query method runs with the newest variables. | ||
const [state, trigger, execute] = useQuery( | ||
// Use query callback | ||
fetchUsers, | ||
// Set parameters for query callback | ||
[query] | ||
@@ -139,4 +64,6 @@ ); | ||
// boolean | ||
isError | ||
} = result; | ||
isError, | ||
// boolean | ||
loaded | ||
} = state; | ||
@@ -147,21 +74,19 @@ ...... | ||
If you want to execute the query manually, you can set `manual:true` to the config. | ||
The hook API `useQuery` returns a tuple `[state, trigger, execute]`. Element `state` contains informations about this query action. Element `trigger` is a no parameter callback which returns a `state` promise, it should be used just like a query trigger. Element `execute` is a callback which accepts parameters, and returns a `state` promise. | ||
If you don't want the auto query action happens, when the parameters are changed or setted first time, you should set optional config `manual` to stop it. | ||
```ts | ||
import React from 'react'; | ||
import {useQuery} from '@airma/react-effect'; | ||
import {client} from '@airma/restful'; | ||
import {User} from './type'; | ||
const cli = client(); | ||
const fetchUsers = (query: UserQuery):Promise<User[]> => | ||
Promise.resolve([]); | ||
const App = ()=>{ | ||
const [query, setQuery] = useState({name:'', username:''}); | ||
const [result, execute] = useQuery( | ||
// query method | ||
()=> | ||
cli.rest('/api/user/list'). | ||
setParams(query). | ||
get<User[]>(), | ||
// set manual execution, | ||
// now, you need to call `execute` to query data. | ||
const [state, trigger] = useQuery( | ||
fetchUsers, | ||
// Set optional config manual | ||
{manual: true} | ||
@@ -177,4 +102,6 @@ ); | ||
// boolean | ||
isError | ||
} = result; | ||
isError, | ||
// boolean | ||
loaded | ||
} = state; | ||
@@ -194,4 +121,6 @@ const handleClick = async ()=>{ | ||
// if the execution is not the newest one. | ||
abandon | ||
} = await execute(); | ||
abandon, | ||
// boolean | ||
loaded | ||
} = await trigger(); | ||
} | ||
@@ -203,7 +132,7 @@ | ||
The manual execution is not recommend, you may accept an abandoned result, if the execution is not the newest one, in that case, you may have a different result with the hook `useQuery` result. And we have talked the problem about asynchronous code spread out in component. | ||
We do not recommend using the result promise returned by a `trigger` callback, and that's why we call it a `trigger`. | ||
### useMutation | ||
### UseMutation | ||
To execute a mutation, you can use `useMutation`. It only can be executed manually. | ||
It is often used to mutate data with a promise returning callback and its parameters. It is always triggered or executed manually. | ||
@@ -213,15 +142,12 @@ ```ts | ||
import {useMutation} from '@airma/react-effect'; | ||
import {client} from '@airma/restful'; | ||
import {User} from './type'; | ||
const cli = client(); | ||
const saveUser = (user: User): Promise<User> =>Promise.resolve(user); | ||
const App = ()=>{ | ||
const [user, setUser] = useState({name:'', username:''}); | ||
const [result, execute] = useMutation( | ||
// mutation method | ||
(u:User)=> | ||
cli.rest('/api/user'). | ||
setBody(u). | ||
post<User>(), | ||
// set variables | ||
const [state, trigger, execute] = useMutation( | ||
// Provide mutation callback | ||
saveUser, | ||
// Set parameters | ||
[user] | ||
@@ -238,8 +164,9 @@ ); | ||
isError | ||
} = result; | ||
// boolean | ||
loaded | ||
} = state; | ||
const handleClick = ()=>{ | ||
// it returns a promise result, | ||
// but we recommoned you using it as a void returning callback | ||
execute(); | ||
// Trigger it manually | ||
trigger(); | ||
} | ||
@@ -251,51 +178,32 @@ | ||
The different with `useQuery` is that the `useMutation` can not be truly executed again if the last execution is not finished, it returns the last result for you. | ||
It only works in `manual` mode, so you don't have to worry about the auto mutation happening. | ||
Sometimes we need an mutation only can be executed once. We can take a `Strategy` like `Strategy.once`. | ||
### Use Strategy | ||
Sometimes you want to control the running way about the promise callback. | ||
For example, we often save data oncely, and then unmount component immediately after saving success to prevent a repeat saving mistake. | ||
```ts | ||
import React from 'react'; | ||
import {useMutation, Strategy} from '@airma/react-effect'; | ||
import {client} from '@airma/restful'; | ||
import {User} from './type'; | ||
const cli = client(); | ||
const saveUser = (user:User):Promise<User> => | ||
Promise.resolve(user); | ||
const App = ()=>{ | ||
const [user, setUser] = useState({name:'', username:''}); | ||
const [result, execute] = useMutation( | ||
// mutation method | ||
(u:User)=> | ||
cli.rest('/api/user'). | ||
setBody(u). | ||
post<User>(), | ||
// set strategy | ||
const [state, trigger] = useMutation( | ||
saveUser, | ||
// Set variables and strategy | ||
{ | ||
variables: [user], | ||
// Set Strategy.once() | ||
strategy: Strategy.once() | ||
} | ||
); | ||
const { | ||
// User | undefined | ||
data, | ||
// boolean | ||
isFetching, | ||
// any | ||
error, | ||
// boolean | ||
isError | ||
} = result; | ||
const handleClick = async ()=>{ | ||
const { | ||
// User | undefined | ||
data, | ||
// boolean | ||
isFetching, | ||
// any | ||
error, | ||
// boolean | ||
isError, | ||
// boolean | ||
abandon | ||
} = await execute(); | ||
trigger(); | ||
} | ||
@@ -307,523 +215,57 @@ | ||
## state sharing | ||
## Share promise state changes | ||
We have provides a `ClientProvider` for sharing the state changes of `useQuery` and `useMutation`. | ||
There are steps you need to do for sharing promise state changes. | ||
1. Create a `client` for every promise callback. | ||
2. Set `clients` to `ClientProvider` for creating state store. | ||
3. Use `client` as a key to store in `ClientProvider`, and build a persistent link with the right state. | ||
```ts | ||
import React, {memo} from 'react'; | ||
import { client as restClient } from '@airma/restful'; | ||
import { useModel, useSelector, factory } from '@airma/react-state'; | ||
import { ClientProvider, client, useClient } from '@airma/react-effect'; | ||
import { | ||
ClientProvider, | ||
client, | ||
useClient, | ||
useQuery | ||
} from '@airma/react-effect'; | ||
import {User} from './type'; | ||
type UserQuery = {name: string, username: string}; | ||
const fetchLoginUser = (query:UserQuery):Promise<User>=> | ||
Promise.resolve({...}); | ||
const cli = restClient(); | ||
// Create a `client` | ||
const loginUser = client(fetchLoginUser); | ||
const userQueryModel = (state: UserQuery)=>{ | ||
const {name, username} = state; | ||
return { | ||
name, | ||
username, | ||
state, | ||
changeName(e: ChangeEvent){ | ||
return {username, name: e.target.value}; | ||
}, | ||
changeUsername(e: ChangeEvent){ | ||
return {name, username: e.target.value}; | ||
} | ||
} | ||
} | ||
const Child1 = memo(()=>{ | ||
// Query for current login user. | ||
// Update promise state into store | ||
// with client `loginUser` | ||
const [ state ] = useQuery(loginUser,[]); | ||
const queryUsers = (query:UserQuery)=> cli.rest('/api/user/list'). | ||
setParams(query). | ||
get<User[]>(); | ||
const models = { | ||
userQuery: factory(userQueryModel), // make a customized model key | ||
queryUsers: client(queryUsers) // make an effect model key | ||
}; | ||
const Condition = memo(()=>{ | ||
const { | ||
name, | ||
username, | ||
changeName, | ||
changeUsername | ||
} = useModel(models.userQuery); | ||
// useClient can accept the query state changes | ||
// from `models.queryUsers`, | ||
// it also can trigger it query again by `trigger`. | ||
const [{isFetching}, trigger] = useClient(models.queryUsers); | ||
return ( | ||
<div> | ||
<input type="text" value={name} onChange={changeName}/> | ||
<input | ||
type="text" | ||
value={username} | ||
onChange={changeUsername} | ||
/> | ||
{/* we disable query button, */} | ||
{/* when the query is fetching */} | ||
<button | ||
disabled={isFetching} | ||
onClick={trigger} | ||
> | ||
query | ||
</button> | ||
</div> | ||
) | ||
return ......; | ||
}); | ||
const Datasource = memo(()=>{ | ||
const q = useSelector(models.userQuery,s =>s.state); | ||
const Child2 = memo(()=>{ | ||
// Take and subscribe promise state changes | ||
// of client `loginUser` in store. | ||
const [ state ] = useClient(loginUser); | ||
const [ | ||
{ | ||
data, | ||
isFetching, | ||
error, | ||
isError | ||
} | ||
] = useQuery(models.queryUsers, [q]); | ||
return ......; | ||
return ......; | ||
}); | ||
const App = memo(()=>{ | ||
// yes, | ||
// ClientProvider is just the `ModelProvider` in | ||
// `@airma/react-state`, | ||
// you can choose any of them as you wish. | ||
return ( | ||
<ClientProvider value={models}> | ||
<Condition/> | ||
<Datasource/> | ||
</ClientProvider> | ||
); | ||
// Set client `loginUser` into `ClientProvider`, | ||
// and create a store inside. | ||
return ( | ||
<ClientProvider value={loginUser}> | ||
<Child1/> | ||
<Child2/> | ||
</ClientProvider> | ||
); | ||
}) | ||
``` | ||
Now, you can share the query or mutation state any where in a `ClientProvider`. Because the `ClientProvider` is `ModelProvider`, so, they have same features, for example, the useQuery or useAsynEffect find the key in parent Providers, the middle Provider will not block them. You can refer to [ModelProvider](https://filefoxper.github.io/airma/#/react-state/feature?id=scope-state) in [@airma/react-state](https://filefoxper.github.io/airma/#/react-state/index). | ||
## Summary | ||
## async execution result | ||
The promise result is a unitary result format for both useQuery and useMutation. | ||
```ts | ||
export declare type PromiseResult<T> = { | ||
// the promise result of the callback, | ||
// you provided for useQuery or useMutation | ||
data: T | undefined; | ||
// error of the promise | ||
error?: any; | ||
// is some errors happens, | ||
// it is marked when the promise is rejected. | ||
isError: boolean; | ||
// if the execution is not finished, it is true, | ||
// otherwise, it is false | ||
isFetching: boolean; | ||
// is the result is abandoned | ||
abandon: boolean; | ||
// the triggerType describes how this result came out. | ||
triggerType: undefined | 'mount' | 'update' | 'manual' | ||
}; | ||
``` | ||
## API | ||
### useQuery | ||
To execute a query promise callback. | ||
```ts | ||
function useQuery< | ||
D extends PromiseEffectCallback<any> | ModelPromiseEffectCallback<any> | ||
>( | ||
callback: D, | ||
config?: QueryConfig<PCR<D>, MCC<D>> | Parameters<MCC<D>> | ||
): [PromiseResult<PCR<D>>, () => Promise<PromiseResult<PCR<D>>>]; | ||
``` | ||
parameters: | ||
* callback - a callback returns a promise, or a effect model. When it is a `effect model`, the query result will be shared out to any place in a ClientProvider. | ||
* config - it is optional. If you set nothing, it means you want to execute it manually. It can be an tuple array as parameters for callback. It can be a config object to set features of this query. | ||
config: | ||
* variables - you can set an array as parameters for query, when the elements change, the query callback runs. | ||
* deps - you can set an array as dependencies, sometimes you may want to drive query callback running by the different dependencies with variables. | ||
* manual - set manual `true`, means you want to execute the query manually, then the deps and variables change will not affect the query callback running. | ||
* strategy - you can set a strategy function or a strategy array to make query callback running with the strategy you want, for example: `debounce`, `once`. If it is an array, the query follows running order from outside to inside. | ||
* exact - a boolean value, for ignore the affect from a global `ClientConfigProvider` config. | ||
returns: | ||
```ts | ||
[ | ||
result, | ||
execute, | ||
callback | ||
] | ||
``` | ||
The `execute` function has no parameters, it uses `variables` from `useQuery` as inner parameters. | ||
The `callback` function accepts parameters, you can set temporary parameters for executing again. | ||
Both of `execute` and `callback` works a `manual` triggerType. | ||
### useMutation | ||
To execute a mutation promise callback, it can only be drived manually by calling the returning method `execute`. | ||
```ts | ||
function useMutation< | ||
D extends PromiseEffectCallback<any> | ModelPromiseEffectCallback<any> | ||
>( | ||
callback: D, | ||
config?: MutationConfig<PCR<D>, MCC<D>> | Parameters<MCC<D>> | ||
): [PromiseResult<PCR<D>>, () => Promise<PromiseResult<PCR<D>>>]; | ||
``` | ||
parameters: | ||
* callback - a callback returns a promise, or a effect model. When it is a `effect model`, the query result will be shared out to any place in a ClientProvider. | ||
* config - it is optional. It can be an tuple array as parameters for callback. It can be a config object to set features of this mutation. | ||
config: | ||
* variables - you can set an array as parameters for query, when the elements change, the mutation callback runs. | ||
* strategy - you can set a strategy function or a strategy array to make query callback running with the strategy you want, for example: `debounce`, `once`. If it is an array, the query follows running order from outside to inside. | ||
* exact - a boolean value, for ignore the affect from a global `ClientConfigProvider` config. | ||
returns: | ||
```ts | ||
[ | ||
result, | ||
execute, | ||
callback | ||
] | ||
``` | ||
The `execute` function has no parameters, it uses `variables` from `useMutation` as inner parameters. | ||
The `callback` function accepts parameters, you can set temporary parameters for executing again. | ||
Both of `execute` and `callback` works a `manual` triggerType. | ||
### client ~~asyncEffect~~ | ||
It is used to generate a `effect model` with effect( promise ) callback. We can provide it as a key to `ClientProvider` or [ModelProvider](https://filefoxper.github.io/airma/#/react-state/api?id=modelprovider) in `@airma/react-state` for state sharing. And use `useQuery` or `useMutation` to link it, and fetching the query state. | ||
```ts | ||
function client< | ||
E extends (...params: any[]) => Promise<any>, | ||
T = E extends (...params: any[]) => Promise<infer R> ? R : never | ||
>(effectCallback: E): ModelPromiseEffectCallback<E>; | ||
``` | ||
parameters: | ||
* effectCallback - a callback returns a promise. | ||
returns | ||
A [react-state factory model](https://filefoxper.github.io/airma/#/react-state/api?id=factory) with effect( promise ) callback. | ||
### useClient ~~useAsyncEffect~~ | ||
It is used to accept the state change from `useQuery` or `useMutation` with a same `effect model`. | ||
```ts | ||
function useClient< | ||
D extends ModelPromiseEffectCallback<any> | ||
>(effectModel: D): [PromiseResult<PCR<D>>, () => void]; | ||
``` | ||
parameters: | ||
* effectModel - an `effect model` created by `client` API. | ||
returns: | ||
```ts | ||
[ | ||
result, | ||
trigger | ||
] | ||
``` | ||
The trigger method is different with `execute` method returned by `useQuery` and `useMutation`. It returns void, that means it can not be `await`. | ||
### CilentProvider ~~EffectProvider~~ | ||
You can refer it to [ModelProvider](https://filefoxper.github.io/airma/#/react-state/api?id=modelprovider) in `@airma/react-state`. | ||
### withClientProvider ~~withEffectProvider~~ | ||
You can refer it to [withModelProvider](https://filefoxper.github.io/airma/#/react-state/api?id=withmodelprovider) in `@airma/react-state`. | ||
### ClientConfigProvider ~~EffectConfigProvider~~ | ||
It is a react `Provider` for setting global config for every `useQuery` and `useMutation` in `children`, it can be ignored by the local config option `exact`. | ||
```ts | ||
import { | ||
ClientConfigProvider, | ||
Strategy, | ||
useQuery | ||
} from '@airma/react-effect'; | ||
import type {ClientConfig} from '@airma/react-effect'; | ||
// The ClientConfig only support rebuild strategy currently. | ||
const config: ClientConfig = { | ||
// The strategy is a callback, | ||
// it accepts a running effect strategy array, | ||
// and a effect type: 'query' | 'mutation'. | ||
// You can complete the running strategies | ||
// with padding strategies, | ||
// so, the running effect will work with these new strategies. | ||
// It can be ignored by a local effect config option: | ||
// `exact: true` | ||
strategy:( | ||
s:(StrategyType | undefined| null)[], type: 'query' | 'mutation' | ||
)=>[...s, Strategy.error((e)=>console.log(e))] | ||
} | ||
const App = ()=>{ | ||
// if the `fetchUsers` is failed, | ||
// the global config strategy `Strategy.error` works. | ||
useQuery(fetchUsers, [data]); | ||
useQuery(fetchGroups, { | ||
variables: [...ids], | ||
strategy: [ | ||
Strategy.debounce(300), | ||
Strategy.error(...) | ||
], | ||
// tell useQuery to use the current config exactly. | ||
exact: true | ||
}); | ||
...... | ||
} | ||
...... | ||
{/* Set a ClientConfig */} | ||
<ClientConfigProvider | ||
value={Strategy.error(e => console.log(e))} | ||
> | ||
</ClientConfigProvider> | ||
``` | ||
### Strategy | ||
It provides some useful effect running `Strategy` for you. | ||
```ts | ||
const Strategy:{ | ||
debounce: (op: { time: number } | number) => StrategyType, | ||
once: () => StrategyType | ||
error: ( | ||
process: (e: unknown) => any, | ||
option?: { withAbandoned?: boolean } | ||
) => StrategyType; | ||
}; | ||
``` | ||
You can use it to the config `strategy` in `useQuery` and `useMutation`. | ||
For example: | ||
```ts | ||
import { | ||
Strategy, | ||
useQuery | ||
} from '@airma/react-effect'; | ||
const useUserList = (...ids:number[])=>{ | ||
useQuery(fetchUsers, { | ||
variables: [...ids], | ||
strategy: [ | ||
Strategy.debounce(300), | ||
Strategy.error((e) =>console.log(e)) | ||
] | ||
}) | ||
}; | ||
``` | ||
#### debounce | ||
you can set a debounce running time to it. like: | ||
```ts | ||
useQuery(callback,{ | ||
variables:[...], | ||
strategy: Strategy.debounce({time:300}) | ||
}) | ||
``` | ||
Then the query callback runs with this debounce strategy. | ||
#### once | ||
It is used to force the query or mutation callback only runs once, if no error comes out. | ||
#### error | ||
You can set a callback to process the error information from promise rejection. | ||
Use it as a global effect config strategy can help you reduce the codes for dealing a common error process. | ||
```ts | ||
import { | ||
Strategy, | ||
ClientConfigProvider | ||
} from '@airma/react-effect'; | ||
const error = Strategy.error((e) =>console.log(e)); | ||
const config = { | ||
strategy: (s)=>[...s, error] | ||
} | ||
<ClientConfigProvider value={config}> | ||
...... | ||
</ClientConfigProvider> | ||
``` | ||
By the default, it only process the error result which is not abandoned. You can set `{withAbandoned: true}` for dealing includes the abandoned errors. | ||
```ts | ||
import { | ||
Strategy, | ||
ClientConfigProvider | ||
} from '@airma/react-effect'; | ||
const error = Strategy.error( | ||
(e) =>console.log(e), | ||
{withAbandoned: true} | ||
); | ||
const config = { | ||
strategy: (s)=>[...s, error] | ||
} | ||
<ClientConfigProvider value={config}> | ||
...... | ||
</ClientConfigProvider> | ||
``` | ||
#### success | ||
You can set a callback to process the data from promise resolve. | ||
```ts | ||
import React from 'react'; | ||
import { | ||
Strategy, | ||
useQuery | ||
} from '@airma/react-effect'; | ||
import service from './service'; | ||
const App = ()=>{ | ||
const [datasource, updateDatasource] = useState([]); | ||
useQuery(service.fetch,{ | ||
variables: [{name:'name'}], | ||
strategy: Strategy.success((d)=>updateDatasource(d||[])) | ||
}) | ||
return ......; | ||
} | ||
``` | ||
By the default, it only process the data result which is not abandoned. You can set `{withAbandoned: true}` for dealing includes the abandoned result. | ||
```ts | ||
import React from 'react'; | ||
import { | ||
Strategy, | ||
useQuery | ||
} from '@airma/react-effect'; | ||
import service from './service'; | ||
const App = ()=>{ | ||
const [datasource, updateDatasource] = useState([]); | ||
useQuery(service.fetch,{ | ||
variables: [{name:'name'}], | ||
strategy: Strategy.success((d)=>updateDatasource(d||[]),{ | ||
withAbandoned: true | ||
}) | ||
}) | ||
return ......; | ||
} | ||
``` | ||
We suggest you use `Strategy.success` without setting a `{withAbandoned: true}` config, for the abandoned data is not helpful, and it would not be exsit in the useQuery or useMutation render state history. | ||
## Write Strategy | ||
You can write Strategy yourself, it is a simple work. | ||
```ts | ||
export type StrategyType<T = any> = ( | ||
getCurrentState: () => PromiseResult<T>, | ||
runner: () => Promise<PromiseResult<T>>, | ||
storeRef: { current: any } | ||
) => Promise<PromiseResult<T>>; | ||
``` | ||
A Strategy function accepts a parameter with properties: | ||
* current - A callback returns a current promise result. | ||
* runner - The wrapped effect callback, returns a promise. | ||
* store - A store for your Strategy, you can store any thing which is helpful for your Strategy. | ||
* variables - The variables for current query or mutation. | ||
For example: | ||
```ts | ||
function once(): StrategyType { | ||
// this inner function is a Strategy | ||
return function oc(value: { | ||
current: () => PromiseResult; | ||
runner: () => Promise<PromiseResult>; | ||
store: { current?: boolean }; | ||
}) { | ||
const { current, runner, store } = value; | ||
// It store a boolean value to tell | ||
// if the effect callback is started. | ||
// If this value is true, | ||
// it returns a current state promise, | ||
// and mark it to abandoned. | ||
if (store.current) { | ||
return new Promise(resolve => { | ||
// use current callback to fetch the current data, | ||
// which is returned by the useQuery | ||
const currentState = current(); | ||
resolve({ ...currentState, abandon: true }); | ||
}); | ||
} | ||
// If the store value is false, | ||
// it marks it as started, | ||
// then truely start it. | ||
store.current = true; | ||
return runner().then(d => { | ||
if (d.isError) { | ||
// if the promise is error, | ||
// mark it to false again, | ||
// the the effect callback can be started again. | ||
store.current = false; | ||
} | ||
return d; | ||
}); | ||
}; | ||
}; | ||
``` | ||
The common usages about `@airma/react-effect` are listed above, if you want to know more about it, please take this [document](https://filefoxper.github.io/airma/#/react-effect/index). |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
229
54425
260
Updated@airma/react-state@^17.1.8