(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RTK = {})); })(this, (function (exports) { 'use strict'; var t,n,e,r=undefined&&undefined.__extends||(t=function(n,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n;}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);},t(n,e)},function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n;}t(n,e),n.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r);}),o=undefined&&undefined.__generator||function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]1?n-1:0),r=1;r3?n.i-4:n.i:Array.isArray(t)?1:A(t)?2:S(t)?3:0}function j(t,n){return 2===O(t)?t.has(n):Object.prototype.hasOwnProperty.call(t,n)}function P(t,n,e){var r=O(t);2===r?t.set(n,e):3===r?t.add(e):t[n]=e;}function E(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}function A(t){return Q&&t instanceof Map}function S(t){return Y&&t instanceof Set}function _(t){return t.o||t.t}function k(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var n=it(t);delete n[et];for(var e=ot(n),r=0;r1&&(t.set=t.add=t.clear=t.delete=I),Object.freeze(t),n&&w(t,(function(t,n){return x(n,!0)}),!0)),t}function I(){h(2);}function N(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function R(t){var n=ut[t];return n||h(18,t),n}function T(){return e}function C(t,n){n&&(R("Patches"),t.u=[],t.s=[],t.v=n);}function D(t){M(t),t.p.forEach(F),t.p=null;}function M(t){t===e&&(e=t.l);}function q(t){return e={p:[],l:e,h:t,m:!0,_:0}}function F(t){var n=t[et];0===n.i||1===n.i?n.j():n.g=!0;}function z(t,n){n._=n.p.length;var e=n.p[0],r=void 0!==t&&t!==e;return n.h.O||R("ES5").S(n,t,r),r?(e[et].P&&(D(n),h(4)),g(t)&&(t=L(n,t),n.l||K(n,t)),n.u&&R("Patches").M(e[et].t,t,n.u,n.s)):t=L(n,e,[]),D(n),n.u&&n.v(n.u,n.s),t!==tt?t:void 0}function L(t,n,e){if(N(n))return n;var r=n[et];if(!r)return w(n,(function(o,i){return U(t,r,n,o,i,e)}),!0),n;if(r.A!==t)return n;if(!r.P)return K(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=k(r.k):r.o,i=o,u=!1;3===r.i&&(i=new Set(o),o.clear(),u=!0),w(i,(function(n,i){return U(t,r,o,n,i,e,u)})),K(t,o,!1),e&&t.u&&R("Patches").N(r,e,t.u,t.s);}return r.o}function U(t,n,e,r,o,i,u){if(b(o)){var c=L(t,o,i&&n&&3!==n.i&&!j(n.R,r)?i.concat(r):void 0);if(P(e,r,c),!b(c))return;t.m=!1;}else u&&e.add(o);if(g(o)&&!N(o)){if(!t.h.D&&t._<1)return;L(t,o),n&&n.A.l||K(t,o);}}function K(t,n,e){void 0===e&&(e=!1),!t.l&&t.h.D&&t.m&&x(n,e);}function W(t,n){var e=t[et];return (e?_(e):t)[n]}function B(t,n){if(n in t)for(var e=Object.getPrototypeOf(t);e;){var r=Object.getOwnPropertyDescriptor(e,n);if(r)return r;e=Object.getPrototypeOf(e);}}function V(t){t.P||(t.P=!0,t.l&&V(t.l));}function X(t){t.o||(t.o=k(t.t));}function G(t,n,e){var r=A(n)?R("MapSet").F(n,e):S(n)?R("MapSet").T(n,e):t.O?function(t,n){var e=Array.isArray(t),r={i:e?1:0,A:n?n.A:T(),P:!1,I:!1,R:{},l:n,t:t,k:null,o:null,j:null,C:!1},o=r,i=ct;e&&(o=[r],i=at);var u=Proxy.revocable(o,i),c=u.revoke,a=u.proxy;return r.k=a,r.j=c,a}(n,e):R("ES5").J(n,e);return (e?e.A:T()).p.push(r),r}function J(t){return b(t)||h(22,t),function t(n){if(!g(n))return n;var e,r=n[et],o=O(n);if(r){if(!r.P&&(r.i<4||!R("ES5").K(r)))return r.t;r.I=!0,e=$(n,o),r.I=!1;}else e=$(n,o);return w(e,(function(n,o){r&&function(t,n){return 2===O(t)?t.get(n):t[n]}(r.t,n)===o||P(e,n,t(o));})),3===o?new Set(e):e}(t)}function $(t,n){switch(n){case 2:return new Map(t);case 3:return Array.from(t)}return k(t)}var H="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Q="undefined"!=typeof Map,Y="undefined"!=typeof Set,Z="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,tt=H?Symbol.for("immer-nothing"):((n={})["immer-nothing"]=!0,n),nt=H?Symbol.for("immer-draftable"):"__$immer_draftable",et=H?Symbol.for("immer-state"):"__$immer_state",rt=(""+Object.prototype.constructor),ot="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,it=Object.getOwnPropertyDescriptors||function(t){var n={};return ot(t).forEach((function(e){n[e]=Object.getOwnPropertyDescriptor(t,e);})),n},ut={},ct={get:function(t,n){if(n===et)return t;var e,r,o,i=_(t);if(!j(i,n))return e=t,(o=B(i,n))?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0;var u=i[n];return t.I||!g(u)?u:u===W(t.t,n)?(X(t),t.o[n]=G(t.A.h,u,t)):u},has:function(t,n){return n in _(t)},ownKeys:function(t){return Reflect.ownKeys(_(t))},set:function(t,n,e){var r=B(_(t),n);if(null==r?void 0:r.set)return r.set.call(t.k,e),!0;if(!t.P){var o=W(_(t),n),i=null==o?void 0:o[et];if(i&&i.t===e)return t.o[n]=e,t.R[n]=!1,!0;if(E(e,o)&&(void 0!==e||j(t.t,n)))return !0;X(t),V(t);}return t.o[n]===e&&(void 0!==e||n in t.o)||Number.isNaN(e)&&Number.isNaN(t.o[n])||(t.o[n]=e,t.R[n]=!0),!0},deleteProperty:function(t,n){return void 0!==W(t.t,n)||n in t.t?(t.R[n]=!1,X(t),V(t)):delete t.R[n],t.o&&delete t.o[n],!0},getOwnPropertyDescriptor:function(t,n){var e=_(t),r=Reflect.getOwnPropertyDescriptor(e,n);return r?{writable:!0,configurable:1!==t.i||"length"!==n,enumerable:r.enumerable,value:e[n]}:r},defineProperty:function(){h(11);},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){h(12);}},at={};w(ct,(function(t,n){at[t]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)};})),at.deleteProperty=function(t,n){return at.set.call(this,t,n,void 0)},at.set=function(t,n,e){return ct.set.call(this,t[0],n,e,t[0])};var ft=new(function(){function t(t){var n=this;this.O=Z,this.D=!0,this.produce=function(t,e,r){if("function"==typeof t&&"function"!=typeof e){var o=e;e=t;var i=n;return function(t){var n=this;void 0===t&&(t=o);for(var r=arguments.length,u=Array(r>1?r-1:0),c=1;c1?r-1:0),i=1;i=0;e--){var r=n[e];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}e>-1&&(n=n.slice(e+1));var o=R("Patches").$;return b(t)?o(t,n):this.produce(t,(function(t){return o(t,n)}))},t}()),lt=ft.produce,st=(ft.produceWithPatches.bind(ft),ft.setAutoFreeze.bind(ft),ft.setUseProxies.bind(ft),ft.applyPatches.bind(ft),ft.createDraft.bind(ft),ft.finishDraft.bind(ft),lt);function dt(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function pt(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r);}return e}function vt(t){for(var n=1;n-1){var o=e[r];return r>0&&(e.splice(r,1),e.unshift(o)),o.value}return "NOT_FOUND"}return {get:r,put:function(n,o){"NOT_FOUND"===r(n)&&(e.unshift({key:n,value:o}),e.length>t&&e.pop());},getEntries:function(){return e},clear:function(){e=[];}}}(a,l);function d(){var n=s.get(arguments);if("NOT_FOUND"===n){if(n=t.apply(null,arguments),f){var e=s.getEntries(),r=e.find((function(t){return f(t.value,n)}));r&&(n=r.value);}s.put(arguments,n);}return n}return d.clearCache=function(){return s.clear()},d}function xt(t){var n=Array.isArray(t[0])?t[0]:t;if(!n.every((function(t){return "function"==typeof t}))){var e=n.map((function(t){return "function"==typeof t?"function "+(t.name||"unnamed")+"()":typeof t})).join(", ");throw new Error("createSelector expects all input-selectors to be functions, but received the following types: ["+e+"]")}return n}function It(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r-1}function Bt(t){return ""+t}function Vt(t){return function(){return function(t){return function(n){return t(n)}}}}var Xt=function(t){function n(){for(var e=[],r=0;r",value:t};if("object"!=typeof t||null===t)return !1;if(null==i?void 0:i.has(t))return !1;for(var c=null!=r?r(t):Object.entries(t),a=o.length>0,f=function(t,c){var f=n?n+"."+t:t;return a&&o.some((function(t){return t instanceof RegExp?t.test(f):f===t}))?"continue":e(c)?"object"==typeof c&&(u=Ht(c,f,e,r,o,i))?{value:u}:void 0:{value:{keyPath:f,value:c}}},l=0,s=c;l0){var i=n.filter((function(n){return function(n,e,r){var o=Object.assign({},r.entities[e.id],e.changes),i=an(o,t),u=i!==e.id;return u&&(n[e.id]=i,delete r.entities[e.id]),r.entities[i]=o,u}(r,n,e)})).length>0;i&&(e.ids=Object.keys(e.entities));}}function u(n,r){var o=ln(n,t,r),u=o[0];i(o[1],r),e(u,r);}return {removeAll:(c=function(t){Object.assign(t,{ids:[],entities:{}});},a=cn((function(t,n){return c(n)})),function(t){return a(t,void 0)}),addOne:cn(n),addMany:cn(e),setOne:cn(r),setMany:cn((function(t,n){for(var e=0,o=t=fn(t);e-1;return e&&r}function En(t){return "function"==typeof t[0]&&"pending"in t[0]&&"fulfilled"in t[0]&&"rejected"in t[0]}function An(){for(var t=[],n=0;n0)for(var d=t.getState(),p=Array.from(e.values()),v=0,y=p;v=0;n--){var o=t[n][et];if(!o.P)switch(o.i){case 5:r(o)&&V(o);break;case 4:e(o)&&V(o);}}}function e(t){for(var n=t.t,e=t.k,r=ot(e),o=r.length-1;o>=0;o--){var i=r[o];if(i!==et){var u=n[i];if(void 0===u&&!j(n,i))return !0;var c=e[i],a=c&&c[et];if(a?a.t!==u:!E(c,u))return !0}}var f=!!n[et];return r.length!==ot(n).length+(f?0:1)}function r(t){var n=t.k;if(n.length!==t.t.length)return !0;var e=Object.getOwnPropertyDescriptor(n,n.length-1);if(e&&!e.get)return !0;for(var r=0;r