@mic-rexjs/usecases
Version:
Usecases of Clean Architecture
2 lines • 22.6 kB
JavaScript
/*! For license information please see index.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.usecases=e():t.usecases=e()}(window,(()=>(()=>{var t={633:(t,e,r)=>{var n=r(738).default;function o(){"use strict";t.exports=o=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},i=Object.prototype,a=i.hasOwnProperty,u=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},f=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(e){p=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,i=Object.create(o.prototype),a=new I(n||[]);return u(i,"_invoke",{value:_(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=y;var v="suspendedStart",b="suspendedYield",d="executing",g="completed",m={};function w(){}function O(){}function j(){}var x={};p(x,f,(function(){return this}));var E=Object.getPrototypeOf,P=E&&E(E(C([])));P&&P!==i&&a.call(P,f)&&(x=P);var S=j.prototype=w.prototype=Object.create(x);function k(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,u,c){var f=h(t[o],t,i);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==n(l)&&a.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):e.resolve(l).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,c)}))}c(f.arg)}var o;u(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function _(t,r,n){var o=v;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=A(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=h(t,r,n);if("normal"===f.type){if(o=n.done?g:b,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function A(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,A(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function C(t){if(t||""===t){var r=t[f];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return O.prototype=j,u(S,"constructor",{value:j,configurable:!0}),u(j,"constructor",{value:O,configurable:!0}),O.displayName=p(j,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===O||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,p(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},r.awrap=function(t){return{__await:t}},k(L.prototype),p(L.prototype,s,(function(){return this})),r.AsyncIterator=L,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new L(y(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(S),p(S,l,"Generator"),p(S,f,(function(){return this})),p(S,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=C,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=a.call(i,"catchLoc"),f=a.call(i,"finallyLoc");if(c&&f){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:C(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},738:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},756:(t,e,r)=>{var n=r(633)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{EntityStore:()=>s,arrayUseCase:()=>A,createEntity:()=>m,createEntityReducers:()=>k,createUseCase:()=>w,dataListUseCase:()=>U,defaultRejectedError:()=>t,entityUseCase:()=>x,generateEntity:()=>g,objectUseCase:()=>G,rejectedErrorUseCase:()=>F});var t={code:"",msg:"",data:null,content:"null"};function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function o(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:String(r)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function a(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e){return t.get(function(t,e,r){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:r;throw new TypeError("Private element is not present on this object")}(t,e))}var f=new WeakMap,s=function(){function t(e){var r,n,o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o=[],function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(r=this,n=f),n.set(r,o),a(this,"value",void 0);var u=i.onChange;this.value=e,u&&this.watch(u)}var e,r;return e=t,(r=[{key:"setValue",value:function(t){var e=this.value;if(this.value=t,e!==t){var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}(c(f,this));try{for(n.s();!(r=n.n()).done;)(0,r.value)(t,e)}catch(t){n.e(t)}finally{n.f()}}}},{key:"unwatch",value:function(t){var e=c(f,this),r=e.indexOf(t);-1!==r&&e.splice(r,1)}},{key:"watch",value:function(t){c(f,this).push(t)}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,e)||p(t,e)||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.")}()}function h(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}var v=r(756),b=r.n(v),d=function(t,e){for(var r=0,n=e?[e]:[Symbol.iterator,Symbol.asyncIterator];r<n.length;r++){var o=null==t?void 0:t[n[r]];if("function"==typeof o&&o.call(t)===t)return!0}return!1},g=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=d(t,Symbol.asyncIterator),o=e.store,i=void 0===o?new s(void 0):o,a=e.onYield,u=void 0===a?function(t){return t}:a,c=e.onReturn,f=void 0===c?function(t){return t}:c,l=e.onGenerate,p=void 0===l?function(t,e){return[t,e]}:l,v=function(){var e,o=(e=b().mark((function e(){var o,a,c,s,l,p,y,h,v;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.next(i.value),a=o,c=o,!n){e.next=9;break}return e.next=6,c;case 6:e.t0=e.sent,e.next=10;break;case 9:e.t0=a;case 10:if(s=e.t0,l=s.value,p=s.done,y=i.value,!p){e.next=18;break}return h=f(l,y),r[0]=h,e.abrupt("return",[y,h]);case 18:v=u("function"==typeof l?l(y):l,y),i.setValue(v);case 20:e.next=0;break;case 22:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){h(i,n,o,a,u,"next",t)}function u(t){h(i,n,o,a,u,"throw",t)}a(void 0)}))});return function(){return o.apply(this,arguments)}}(),g=v();return r.length>0?p(i.value,r[0]):g.then((function(t){var e=y(t,2),r=e[0],n=e[1];return p(r,n)}))},m=function(t){if("function"==typeof t)return t();for(var e=Object.defineProperties({},Object.getOwnPropertyDescriptors(t)),r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];for(var i=0,a=n;i<a.length;i++){var u=a[i];Object.defineProperties(e,Object.getOwnPropertyDescriptors(u))}return e},w=function(t){return t()};function O(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(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 j(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var x=function(){return{setEntity:b().mark((function t(e,r){var n;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n="function"==typeof r?r(e):r,e!==n){t.next=4;break}return t.abrupt("return",e);case 4:return t.next=6,n;case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)}))}},E=["onYield","onReturn","onGenerate"];function P(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?P(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var k=function(t,e,r){var n="function"==typeof e,o=n?t:null,i=o instanceof s?o:new s(o),a=n?e:t,u=(n?r:e)||{},c=u.onYield,f=void 0===c?function(t){return t}:c,l=u.onReturn,p=u.onGenerate,h=j(u,E),v={},b=x(),m=a(h),w=S(S({},b),m),P=Object.keys(w),k=w.setEntity;return P.forEach((function(t){var e=w[t];v[t]=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var a=n?[i.value].concat(r):r,u=e.apply(void 0,O(a));return n||(i.value=r[0]),d(u)?g(u,{store:i,onYield:function(t,r){var n=t;return e!==k&&(n=y(g(k(r,t)),2)[1]),f(n)},onReturn:l,onGenerate:p}):u}})),v};function L(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?L(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var A=function(){var t=x(),e=b().mark((function t(e,r,n,o){var i;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(i=e.slice()).fill(r,n,o),t.next=4,i;case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})),r=b().mark((function t(e,r){return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.filter(r);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})),n=b().mark((function t(e){var r,n;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.slice(),n=r.pop(),t.next=4,r;case 4:return t.abrupt("return",n);case 5:case"end":return t.stop()}}),t)})),o=b().mark((function t(e){var r,n,o,i,a,u=arguments;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=u.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=u[o];return i=[].concat(O(e),n),a=i.length,t.next=5,i;case 5:return t.abrupt("return",a);case 6:case"end":return t.stop()}}),t)})),i=b().mark((function t(e){var r,n;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.slice(),n=r.shift(),t.next=4,r;case 4:return t.abrupt("return",n);case 5:case"end":return t.stop()}}),t)})),a=b().mark((function t(e){var r,n,o,i,a,u=arguments;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=e.slice(),n=u.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=u[i];return a=r.splice.apply(r,o),t.next=5,r;case 5:return t.abrupt("return",a);case 6:case"end":return t.stop()}}),t)})),u=b().mark((function t(e){var r,n,o,i,a,u=arguments;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=u.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=u[o];return i=[].concat(n,O(e)),a=i.length,t.next=5,i;case 5:return t.abrupt("return",a);case 6:case"end":return t.stop()}}),t)}));return _(_({},t),{},{extractEntity:function(t,e){return t.filter(e)},fillEntity:e,filterEntity:r,popEntity:n,pushEntity:o,shiftEntity:i,spliceEntity:a,unshiftEntity:u})},D=["set"],T=function(t){for(var e={},r=Object.getOwnPropertyDescriptors(t),n=0,o=Object.keys(r);n<o.length;n++){var i=o[n],a=r[i],u=(a.set,j(a,D));"function"==typeof u.get&&(e[i]=u)}return e};function I(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var G=function(){var t=!1,e=null,r=x(),n=b().mark((function r(n,o){var i;return b().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("function"!=typeof o){r.next=6;break}if(i=o(n),n!==i){r.next=4;break}return r.abrupt("return",i);case 4:r.next=7;break;case 6:i=C(C({},n),o);case 7:return null===e&&(e=T(n),t=Object.keys(e).length>0),t&&Object.defineProperties(i,e),r.next=11,i;case 11:return r.abrupt("return",r.sent);case 12:case"end":return r.stop()}}),r)}));return C(C({},r),{},{setEntity:n})},M=function(t){return Object.hasOwn(t,"id")?t.id:Object.hasOwn(t,"_id")?t._id:t.key};function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?N(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var U=function(){var t=A(),e=t.extractEntity,r=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e(t,(function(t){return M(t)===r===n}))},n=b().mark((function t(e,n,o){return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r(e,n,o);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}));return R(R({},t),{},{extractEntityBy:r,filterEntityBy:n,replaceEntity:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:M(e);return b().mark((function n(){var o,i,a;return b().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(-1!==(o=t.findIndex((function(t){return M(t)===r})))){n.next=3;break}return n.abrupt("return",null);case 3:return i=t[o],(a=t.slice())[o]=e,n.next=8,a;case 8:return n.abrupt("return",i);case 9:case"end":return n.stop()}}),n)}))()}})},F=w((function(){var t={};return function(){var r=function(r,n,o){var i,a,u={code:r,msg:n,data:o,content:"object"===e(o)&&(null==o?void 0:o.toString)===Object.prototype.toString?JSON.stringify(o):"".concat(o instanceof Error?o.stack:o)};return null===(i=(a=t).onReject)||void 0===i||i.call(a,u),Promise.reject(u)},n=function(t,e){return r(t,e,null)},o=function(t,e,r){return i(t,(function(t){return t}),e,r)},i=function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return Promise.resolve(t).then(e).catch((function(t){return r(n,o,t)}))};return{initRejectedError:function(e){t=e},reject:r,rejectCode:function(t){return r(t,"",null)},rejectData:function(t,e){return r(t,"",e)},rejectMsg:n,resolve:o,resolveId:function(t,e){return i(t,(function(t){if(t)return t;throw t}),e)},resolveNonNullable:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return null==t?n(e,r):o(t,e,r)},resolveWith:i}}}))})(),n})()));