@superutils/rx 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- this.superutils=this.superutils||{};this.superutils.rx=(function(exports){'use strict';var T=(e,r=true)=>!!e&&typeof e=="object"&&(!r||[Object.prototype,null].includes(Object.getPrototypeOf(e))),br=T,A=e=>Array.isArray(e);var yr=e=>A(e)&&e.every(A),vr=e=>A(e)||e instanceof Set||e instanceof Map;var gr=e=>Number.isInteger(e);var X=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),ge=e=>gr(e)&&e>0,F=e=>X(e)&&e>0,se=(e,r=false,t=false)=>{if(e==null)return true;switch(typeof e){case "number":return !X(e);case "string":return !e.replaceAll(" ","").trim().length;case "boolean":case "bigint":case "symbol":case "function":return false}if(e instanceof Date)return Number.isNaN(e.getTime());if(e instanceof Map||e instanceof Set)return !e.size;if(Array.isArray(e)||e instanceof Uint8Array)return !e.length;if(e instanceof Error)return !e.message.length;let o=typeof e=="object"&&Object.getPrototypeOf(e);return o===Object.prototype||o===null?r?!Object.getOwnPropertyNames(e).length:!Object.keys(e).length:t};function Be(){}var m=e=>typeof e=="function";var De=m,I=e=>e instanceof Map;var ze=e=>typeof e=="boolean"||e instanceof Boolean;var Ke=e=>e instanceof Error,xe=e=>e instanceof Promise,Y=e=>e instanceof RegExp,xr=e=>e instanceof Set,Z=e=>typeof e=="string",ae=(e,r=false)=>br(e,false)&&De(e.subscribe)&&De(e.next)&&(!r||"value"in e),Sr=e=>typeof e=="symbol";var h=(e,r,t)=>{try{let o=m(e)?e(...m(r)?r():r):e;return xe(o)?o.catch(n=>m(t)?t(n):t):o}catch(o){return m(t)?t(o):t}},U=h;new Date().getTime();var wr=(e,r=true,t=true)=>U(()=>[...t&&Object.getOwnPropertySymbols(e)||[],...r?Object.keys(e).sort():Object.keys(e)],[],[]),_r=wr,G=(e,r="null")=>JSON.parse(U(JSON.stringify,[e],r)),N=(e,r,t,o=false,n=true)=>{let i=T(r,false)||m(r)?r:{};if(!T(e,false)&&!m(r))return i;let s=new Set(t!=null?t:[]),a=_r(e,true,true).filter(u=>!s.has(u));for(let u of a){let c=u,l=e[c];if(i.hasOwnProperty(c)&&(o==="empty"?!se(i[c]):m(o)?!o(c,i[c],l):true))continue;if([void 0,null,1/0,NaN].includes(l)||!T(l,false)){i[c]=l;continue}i[c]=(()=>{switch(Object.getPrototypeOf(l)){case Array.prototype:return G(l,"[]");case ArrayBuffer.prototype:return l.slice(0);case Date.prototype:return new Date(l.getTime());case Map.prototype:return new Map(G(Array.from(l),"[]"));case RegExp.prototype:return new RegExp(l);case Set.prototype:return new Set(G(Array.from(l)));case Uint8Array.prototype:return new Uint8Array([...l]);case URL.prototype:return new URL(l);}if(Sr(c)||!n)return G(l);let b=[...s].map(v=>String(v).startsWith(String(c).concat("."))&&String(v).split(String(c).concat("."))[1]).filter(Boolean);return b.length?N(l,i[c],b,o,n):G(l)})();}return i},Er=(e=[],r=[],t)=>{T(t)||(t={});for(let o=0;o<(A(e)?e:[]).length;o++)t[e[o]]=r==null?void 0:r[o];return t};var Le=(e,r=true,t=false)=>A(e)?(t&&(e=[...e]),r?e.reverse():e):[];var ue=(e,r=0)=>A(e)?Array.from(new Set(e.flat(r))):[],ie=(e,r=50,t={})=>{let{leading:o=ie.defaults.leading,onError:n=ie.defaults.onError,thisArg:i}=t,{tid:s}=t;i!==void 0&&(e=e.bind(i));let a=(...l)=>U(e,l,n),u=null,c=o==="global";return (...l)=>{clearTimeout(s),s=setTimeout(()=>{u!==l&&a(...l),u=c?true:null;},r),!(!o||u)&&(u=l,a(...l));}};ie.defaults={leading:false,onError:void 0};var Tr=ie,Se=(e,r=50,t={})=>{let{defaults:o}=Se,{onError:n=o.onError,trailing:i=o.trailing,thisArg:s}=t,{tid:a}=t,u=(...l)=>U(s!==void 0?e.bind(s):e,l,m(n)?f=>U(n,[f],void 0):void 0),c=null;return (...l)=>{if(a){c=l;return}a=setTimeout(()=>{if(a=void 0,!i)return;let f=c;c=null,f&&f!==l&&u(...f);},r),u(...l);}};Se.defaults={onError:void 0,trailing:false};var Or=Se,z=(e,r=50,t={})=>t.throttle?Or(e,r,t):Tr(e,r,t),we=(e,r,t,o,n)=>{var i;I(n)||(n=new Map),ge(t)||(t=1/0);for(let[s,a]of ((i=e==null?void 0:e.entries)==null?void 0:i.call(e))||[]){if(n.size>=t)break;U(r!=null?r:a,[a,s,e],false)&&n.set(s,a);}return o?[...n.values()]:n},jr=we,Ar=e=>{if(!e)return 0;try{let r="size"in e?e.size:"length"in e?e.length:0;return X(r)?r:0}catch(r){return 0}},Cr=Ar,Pr=e=>{var r;return [...((r=e==null?void 0:e.values)==null?void 0:r.call(e))||[]]},Ve=Pr,B=(e,r)=>{var t;let o=!Cr(e)||se(r==null?void 0:r.query),n=I(r==null?void 0:r.result)?r.result:new Map,i=(t=r==null?void 0:r.asMap)!=null?t:B.defaults.asMap;if(o)return i?n:Ve(n);r=N(B.defaults,r,[],"empty");let{ignoreCase:s,limit:a=1/0,matchAll:u,matchExact:c,ranked:l}=r,{query:f}=r,p=Z(f),b=Y(f),v=U(Object.keys,[f],[]);if(s&&!c&&!b&&(f=p?f.toLowerCase():Er(v,Object.values(f).map(d=>Y(d)?d:`${d}`.toLowerCase()))),r.query=f,l){let d=[];for(let[g,S]of e.entries()){let j=-1;if(p||b){j=ne(r,S,void 0),j>=0&&d.push([j,g,S]);continue}let O=[];v[u?"every":"some"](y=>{let w=ne(r,S,y);return O.push(w),w>=0})&&(j=O.sort((y,w)=>y-w).filter(y=>y!==-1)[0],j>=0&&d.push([j,g,S]));}d.sort((g,S)=>g[0]-S[0]).slice(0,a).forEach(([g,S,j])=>n.set(S,j));}else for(let[d,g]of e.entries()){if(n.size>=a)break;(p||b?ne(r,g,void 0)>=0:v[u?"every":"some"](j=>ne(r,g,j)>=0))&&n.set(d,g);}return i?n:Ve(n)};B.defaults={asMap:true,ignoreCase:true,limit:1/0,matchAll:false,ranked:false,transform:true};function ne({query:e,ignoreCase:r,matchExact:t,transform:o=true},n,i){var s,a;let u=Z(e)||Y(e)||i===void 0,c=u?e:e[i],l=u||!T(n)?n:n[i],f=U(()=>m(o)?o(n,u?void 0:l,i):t&&o===!1?l:T(l,!1)?JSON.stringify(vr(l)?[...l.values()]:Object.values(l)):String(l!=null?l:""),[],"");if(f===c)return 0;if(t&&!Y(c))return -1;let p=String(f);return p.trim()?Y(c)?(a=(s=p.match(c))==null?void 0:s.index)!=null?a:-1:(r&&(p=p.toLowerCase()),p.indexOf(String(c))):-1}var Ir=B;function $e(e,r){return (m(r)?jr(e,r,1):Ir(e,{...r,asMap:true,limit:1}))[r!=null&&r.includeKey?"entries":"values"]().next().value}var We=e=>{var r;return [...((r=e==null?void 0:e.entries)==null?void 0:r.call(e))||[]]},qe=e=>{var r;return [...((r=e==null?void 0:e.keys)==null?void 0:r.call(e))||[]]};function le(e,r,t){let o=A(e)?1:I(e)?2:xr(e)?3:0;if(!o)return e;let{asString:n,ignoreCase:i,newInstance:s,reverse:a,undefinedFirst:u}={...le.defaults,...T(t)?t:T(r)?r:{}};if(o===1&&m(r))return Le(e.sort(r),a,s);let c=n?u?"":"Z".repeat(10):u?-1/0:1/0,l=m(r)?Le([...e.entries()].sort(r),a,false):(()=>{let f=1,p=d=>{let g=T(d)&&f!==0?d[r]:d;if(!n)return g;let S=`${g!=null?g:c}`;return i?S.toLowerCase():S},[b,v]=a?[-1,1]:[1,-1];return [1,3].includes(o)?(o===3||s?[...e]:e).sort((d,g)=>p(d)>p(g)?b:v):(f=r===true?0:1,[...e.entries()].sort((d,g)=>p(d==null?void 0:d[f])>p(g==null?void 0:g[f])?b:v))})();if(o===1)return l;if(s)return o===2?new Map(l):new Set(l);e.clear();for(let f of l)o===2?e.set(...f):e.add(f);return e}le.defaults={asString:true,ignoreCase:true,newInstance:false,reverse:false,undefinedFirst:false};var He=(...e)=>{var r;return new Map((r=e==null?void 0:e.flatMap)==null?void 0:r.call(e,t=>I(t)?Array.from(t.entries()):yr(t)?t:[]))};var K=globalThis.Promise,_=class extends K{constructor(r){let t,o,n=false,i=(s,a=true,u)=>{if(!n)return queueMicrotask(()=>i(s,a,u));s(u),this._state=a?1:2,this.onFinalize.forEach(c=>h(c,a?[u]:[void 0,u],void 0));};super((s,a)=>{o=u=>i(a,false,u),t=u=>i(s,true,u),m(r)?h(r,[t,o],o):xe(r)?r.then(t,o):r!==void 0&&t(r);}),this._state=0,this.onEarlyFinalize=[],this.onFinalize=[],this.resolve=s=>{var a,u;this.pending&&((a=this._resolve)==null||a.call(this,s),(u=this.onEarlyFinalize)==null||u.forEach(c=>{h(c,[true,s],void 0);}));},this.reject=s=>{var a,u;this.pending&&((a=this._reject)==null||a.call(this,s),(u=this.onEarlyFinalize)==null||u.forEach(c=>{h(c,[false,s],void 0);}));},n=true,this._resolve=t,this._reject=o;}get pending(){return this.state===0}get rejected(){return this.state===2}get resolved(){return this.state===1}get state(){return this._state}};_.all=e=>new _(K.all(e));_.allSettled=e=>new _(K.allSettled(e));_.any=e=>new _(K.any(e));_.race=e=>new _(K.race(e));_.reject=e=>{let r=new _;return queueMicrotask(()=>r.reject(e)),r};_.resolve=e=>new _(K.resolve(e));_.try=(e,...r)=>new _(h(e,r,t=>_.reject(t)));_.withResolvers=()=>{let e=new _;return {promise:e,reject:e.reject,resolve:e.resolve}};var Rr=_,C=Rr;function _e(e={}){let r=0;e=N(_e.defaults,e,[],"empty");let{onError:t,onIgnore:o,onResult:n}=e,{delay:i=0,ignoreStale:s,resolveError:a,resolveIgnored:u,thisArg:c,throttle:l}=e,f=null,p,b=new Map,v=!F(i);c!==void 0&&(t=t==null?void 0:t.bind(c),o=o==null?void 0:o.bind(c),n=n==null?void 0:n.bind(c));let d=O=>{for(let[x,y]of O){b.delete(x);let w=s&&y.sequence<p.sequence;if(!(y.resolved||y.started&&!w))switch(y.started&&(y.getPromise=(()=>y.result)),h(o,[y.getPromise],0),u){case "WITH_UNDEFINED":y.resolve(void 0);break;case "WITH_LAST":p==null||p.then(y.resolve,y.reject);break;}}b.size||(r=0);},g=O=>{if(f=null,v){b.delete(O);let[y,w]=[...b.entries()][0]||[];return y&&w&&j(y,w)}let x=[...b.entries()];if(l===true&&e.trailing){let y=x.findIndex(([w])=>w===O);x=x.slice(0,y);}else l||(x=x.slice(0,-1));d(x),b.delete(O);},S=async(O,x)=>{var y;try{x.started=!0,p=x,f=x,(y=x.result)!=null||(x.result=C.try(x.getPromise));let w=await x.result;if(!!s&&x.sequence<p.sequence)return d([[O,x]]);x.resolve(w),n&&h(n,[w],void 0);}catch(w){switch(t&&h(t,[w],void 0),a){case "REJECT":x.reject(w);case "NEVER":break;case "RESOLVE_UNDEFINED":x.resolve(void 0);break;case "RESOLVE_ERROR":x.resolve(w);break}}g(O);},j=v?S:z(S,i,e);return O=>{let x=Symbol("deferred-queue-item-id"),y=new C;return y.getPromise=m(O)?O:()=>O,y.started=false,y.sequence=++r,b.set(x,y),(!f||!v)&&j(x,y),y}}_e.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var Je=_e;function Fr(e,r={}){let{thisArg:t}=r;t!==void 0&&(e=e.bind(t));let o=Je(r);return (...n)=>o(()=>e(...n))}var Mr=Fr;function ce(e=ce.defaults.duration,r,t=false){let o=new C,n=i=>{let s=h(async()=>{let a=await(m(i)?i():i);return t?a!=null?a:new Error(`${ce.defaults.delayTimeoutMsg} ${e}ms`):a!=null?a:e},[],a=>Promise.reject(a));t?s.then(o.reject,o.reject):o.resolve(s);};return o.timeoutId=setTimeout(()=>n(r),e),o.pause=()=>clearTimeout(o.timeoutId),o.catch(()=>{}).finally(()=>o.pause()),o.onEarlyFinalize.push(()=>o.pause()),o}ce.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var Ee=ce;function kr(e,r){return Ee(e,r,true)}var Ge=kr,Te=(e,r)=>{let t=false,o=C.try(async()=>{var n,i;r=N(Te.defaults,r!=null?r:{},[],(g,S)=>{switch(g){case "retry":case "retryDelay":case "retryDelayJitterMax":return S!==0&&!ge(S)}return !!se(S)});let{retry:s,retryBackOff:a,retryDelay:u,retryDelayJitter:c,retryDelayJitterMax:l}=r,f=u,p=-1,b,v,d=false;do{if(p++,a==="exponential"&&p>1&&(f*=2),c&&(f+=Math.floor(Math.random()*l)),!t&&p>0&&await Ee(f),!t)try{v=void 0,b=await e();}catch(g){v=g!=null?g:new Error(g);}if(t||s===0||p>=s)break;d=!!((i=await h((n=r.retryIf)!=null?n:v,[b,p,v],v))!=null?i:v);}while(d);return v!==void 0?Promise.reject(v):b});return o.onEarlyFinalize.push(()=>{t=true;}),o};Te.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var Ur=Te,Ye=1e4,Oe=2147483647,Nr=class extends C{constructor(e,r,t,o){super(e),this.started=new Date,this._setup=()=>{var n,i,s,a;this._signals=ue([(i=(n=this.options)==null?void 0:n.abortCtrl)==null?void 0:i.signal,(s=this.options)==null?void 0:s.signal].filter(Boolean)),!this.onEarlyFinalize.includes(this._handleEarlyFinalize)&&this.onEarlyFinalize.push(this._handleEarlyFinalize),!this.onFinalize.includes(this._handleFinalize)&&this.onFinalize.push(this._handleFinalize),(a=this._signals)==null||a.forEach(u=>u==null?void 0:u.addEventListener("abort",this._handleAbort));},this._handleAbort=async()=>{var n;let s=await h((n=this.options)==null?void 0:n.onAbort,[],void 0);s!=null||(s=new Error(`Aborted after ${new Date().getTime()-this.started.getTime()}ms`)),(s.name)!=null||(s.name="AbortError"),this.reject(s);},this._handleEarlyFinalize=()=>{var n,i,s,a;(n=this.options)!=null&&n.abortOnEarlyFinalize&&((a=(s=(i=this.options)==null?void 0:i.abortCtrl)==null?void 0:s.abort)==null||a.call(s));},this._handleFinalize=((n,i)=>{var s,a,u,c,l;this.cancelAbort(),this.clearTimeout(),!(!this.timeout.rejected&&!((s=this._signals)!=null&&s.find(f=>f==null?void 0:f.aborted)))&&((c=(u=(a=this.options)==null?void 0:a.abortCtrl)==null?void 0:u.signal)==null?void 0:c.aborted)===false&&((l=this.options)==null||l.abortCtrl.abort(i));}),this.data=e,this.options=T(t)?t:{},this.timeout=r,this._signals=o,this._setup();}get abortCtrl(){return this.options.abortCtrl}get aborted(){var e;return this.rejected&&!this.timeout.rejected&&!!((e=this._signals)!=null&&e.find(r=>r==null?void 0:r.aborted))}cancelAbort(){var e;(e=this._signals)==null||e.forEach(r=>r==null?void 0:r.removeEventListener("abort",this._handleAbort));}clearTimeout(){clearTimeout(this.timeout.timeoutId);}get timedout(){return this.rejected&&this.timeout.rejected}},Dr=Nr;function je(e,...r){var t;let o=N(je.defaults,X(e)?{timeout:e}:T(e)?e:{},[],"empty");o.timeout=Math.min(F(o.timeout)?o.timeout:Ye,Oe);let n=r.map(a=>m(a)?C.try(a):a),i=n.length<=1?n[0]instanceof C?n[0]:new C(n[0]):(m(C[o.batchFunc])?C[o.batchFunc]:C.all)(n),s=Ge(o.timeout,o.onTimeout);return new Dr(C.race([i,s]),s,o,ue([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}je.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:Ye};var Lr=je,L=class extends C{};L.deferred=Je;L.deferredCallback=Mr;L.delay=Ee;L.delayReject=Ge;L.retry=Ur;L.timeout=Lr;var Vr=L,fe=Vr;var Ae=function(e,r){return Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o;}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);},Ae(e,r)};function M(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Ae(e,r);function t(){this.constructor=e;}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t);}function Q(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return {next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var o=t.call(e),n,i=[],s;try{for(;(r===void 0||r-- >0)&&!(n=o.next()).done;)i.push(n.value);}catch(a){s={error:a};}finally{try{n&&!n.done&&(t=o.return)&&t.call(o);}finally{if(s)throw s.error}}return i}function W(e,r,t){if(arguments.length===2)for(var o=0,n=r.length,i;o<n;o++)(i||!(o in r))&&(i||(i=Array.prototype.slice.call(r,0,o)),i[o]=r[o]);return e.concat(i||Array.prototype.slice.call(r))}function E(e){return typeof e=="function"}function pe(e){var r=function(o){Error.call(o),o.stack=new Error().stack;},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var de=pe(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
1
+ this.superutils=this.superutils||{};this.superutils.rx=(function(exports){'use strict';var T=(e,r=true)=>!!e&&typeof e=="object"&&(!r||[Object.prototype,null].includes(Object.getPrototypeOf(e))),br=T,A=e=>Array.isArray(e);var vr=e=>A(e)&&e.every(A),gr=e=>A(e)||e instanceof Set||e instanceof Map;var xr=e=>Number.isInteger(e);var X=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),ge=e=>xr(e)&&e>0,F=e=>X(e)&&e>0,se=(e,r=false,t=false)=>{if(e==null)return true;switch(typeof e){case "number":return !X(e);case "string":return !e.replaceAll(" ","").trim().length;case "boolean":case "bigint":case "symbol":case "function":return false}if(e instanceof Date)return Number.isNaN(e.getTime());if(e instanceof Map||e instanceof Set)return !e.size;if(Array.isArray(e)||e instanceof Uint8Array)return !e.length;if(e instanceof Error)return !e.message.length;let o=typeof e=="object"&&Object.getPrototypeOf(e);return o===Object.prototype||o===null?r?!Object.getOwnPropertyNames(e).length:!Object.keys(e).length:t};function Ke(){}var m=e=>typeof e=="function";var Le=m,I=e=>e instanceof Map;var ze=e=>typeof e=="boolean"||e instanceof Boolean;var $e=e=>e instanceof Error,xe=e=>e instanceof Promise,Y=e=>e instanceof RegExp,Sr=e=>e instanceof Set,Z=e=>typeof e=="string",ae=(e,r=false)=>br(e,false)&&Le(e.subscribe)&&Le(e.next)&&(!r||"value"in e),wr=e=>typeof e=="symbol";var h=(e,r,t)=>{try{let o=m(e)?e(...m(r)?r():r):e;return xe(o)?o.catch(n=>m(t)?t(n):t):o}catch(o){return m(t)?t(o):t}},U=h;new Date().getTime();var _r=(e,r=true,t=true)=>U(()=>[...t&&Object.getOwnPropertySymbols(e)||[],...r?Object.keys(e).sort():Object.keys(e)],[],[]),Er=_r,G=(e,r="null")=>JSON.parse(U(JSON.stringify,[e],r)),N=(e,r,t,o=false,n=true)=>{let i=T(r,false)||m(r)?r:{};if(!T(e,false)&&!m(r))return i;let s=new Set(t!=null?t:[]),a=Er(e,true,true).filter(u=>!s.has(u));for(let u of a){let c=u,l=e[c];if(i.hasOwnProperty(c)&&(o==="empty"?!se(i[c]):m(o)?!o(c,i[c],l):true))continue;if([void 0,null,1/0,NaN].includes(l)||!T(l,false)){i[c]=l;continue}i[c]=(()=>{switch(Object.getPrototypeOf(l)){case Array.prototype:return G(l,"[]");case ArrayBuffer.prototype:return l.slice(0);case Date.prototype:return new Date(l.getTime());case Map.prototype:return new Map(G(Array.from(l),"[]"));case RegExp.prototype:return new RegExp(l);case Set.prototype:return new Set(G(Array.from(l)));case Uint8Array.prototype:return new Uint8Array([...l]);case URL.prototype:return new URL(l);}if(wr(c)||!n)return G(l);let y=[...s].map(v=>String(v).startsWith(String(c).concat("."))&&String(v).split(String(c).concat("."))[1]).filter(Boolean);return y.length?N(l,i[c],y,o,n):G(l)})();}return i},Tr=(e=[],r=[],t)=>{T(t)||(t={});for(let o=0;o<(A(e)?e:[]).length;o++)t[e[o]]=r==null?void 0:r[o];return t};var Ve=(e,r=true,t=false)=>A(e)?(t&&(e=[...e]),r?e.reverse():e):[];var ue=(e,r=0)=>A(e)?Array.from(new Set(e.flat(r))):[],ie=(e,r=50,t={})=>{let{leading:o=ie.defaults.leading,onError:n=ie.defaults.onError,thisArg:i}=t,{tid:s}=t;i!==void 0&&(e=e.bind(i));let a=(...l)=>U(e,l,n),u=null,c=o==="global";return (...l)=>{clearTimeout(s),s=setTimeout(()=>{u!==l&&a(...l),u=c?true:null;},r),!(!o||u)&&(u=l,a(...l));}};ie.defaults={leading:false,onError:void 0};var Or=ie,Se=(e,r=50,t={})=>{let{defaults:o}=Se,{onError:n=o.onError,trailing:i=o.trailing,thisArg:s}=t,{tid:a}=t,u=(...l)=>U(s!==void 0?e.bind(s):e,l,m(n)?f=>U(n,[f],void 0):void 0),c=null;return (...l)=>{if(a){c=l;return}a=setTimeout(()=>{if(a=void 0,!i)return;let f=c;c=null,f&&f!==l&&u(...f);},r),u(...l);}};Se.defaults={onError:void 0,trailing:false};var jr=Se,K=(e,r=50,t={})=>t.throttle?jr(e,r,t):Or(e,r,t),we=(e,r,t,o,n)=>{var i;I(n)||(n=new Map),ge(t)||(t=1/0);for(let[s,a]of ((i=e==null?void 0:e.entries)==null?void 0:i.call(e))||[]){if(n.size>=t)break;U(r!=null?r:a,[a,s,e],false)&&n.set(s,a);}return o?[...n.values()]:n},Ar=we,Cr=e=>{if(!e)return 0;try{let r="size"in e?e.size:"length"in e?e.length:0;return X(r)?r:0}catch(r){return 0}},Pr=Cr,_e=e=>{var r;return [...((r=e==null?void 0:e.values)==null?void 0:r.call(e))||[]]},Be=_e,B=(e,r)=>{var t;let o=!Pr(e)||se(r==null?void 0:r.query),n=I(r==null?void 0:r.result)?r.result:new Map,i=(t=r==null?void 0:r.asMap)!=null?t:B.defaults.asMap;if(o)return i?n:Be(n);r=N(B.defaults,r,[],"empty");let{ignoreCase:s,limit:a=1/0,matchAll:u,matchExact:c,ranked:l}=r,{query:f}=r,p=Z(f),y=Y(f),v=U(Object.keys,[f],[]);if(s&&!c&&!y&&(f=p?f.toLowerCase():Tr(v,Object.values(f).map(d=>Y(d)?d:`${d}`.toLowerCase()))),r.query=f,l){let d=[];for(let[g,S]of e.entries()){let j=-1;if(p||y){j=ne(r,S,void 0),j>=0&&d.push([j,g,S]);continue}let O=[];v[u?"every":"some"](b=>{let w=ne(r,S,b);return O.push(w),w>=0})&&(j=O.sort((b,w)=>b-w).filter(b=>b!==-1)[0],j>=0&&d.push([j,g,S]));}d.sort((g,S)=>g[0]-S[0]).slice(0,a).forEach(([g,S,j])=>n.set(S,j));}else for(let[d,g]of e.entries()){if(n.size>=a)break;(p||y?ne(r,g,void 0)>=0:v[u?"every":"some"](j=>ne(r,g,j)>=0))&&n.set(d,g);}return i?n:Be(n)};B.defaults={asMap:true,ignoreCase:true,limit:1/0,matchAll:false,ranked:false,transform:true};function ne({query:e,ignoreCase:r,matchExact:t,transform:o=true},n,i){var s,a;let u=Z(e)||Y(e)||i===void 0,c=u?e:e[i],l=u||!T(n)?n:n[i],f=U(()=>m(o)?o(n,u?void 0:l,i):t&&o===!1?l:T(l,!1)?JSON.stringify(gr(l)?[...l.values()]:Object.values(l)):String(l!=null?l:""),[],"");if(f===c)return 0;if(t&&!Y(c))return -1;let p=String(f);return p.trim()?Y(c)?(a=(s=p.match(c))==null?void 0:s.index)!=null?a:-1:(r&&(p=p.toLowerCase()),p.indexOf(String(c))):-1}var Ir=B;function We(e,r){return (m(r)?Ar(e,r,1):Ir(e,{...r,asMap:true,limit:1}))[r!=null&&r.includeKey?"entries":"values"]().next().value}var qe=e=>{var r;return [...((r=e==null?void 0:e.entries)==null?void 0:r.call(e))||[]]},He=e=>{var r;return [...((r=e==null?void 0:e.keys)==null?void 0:r.call(e))||[]]};function le(e,r,t){let o=A(e)?1:I(e)?2:Sr(e)?3:0;if(!o)return e;let{asString:n,ignoreCase:i,newInstance:s,reverse:a,undefinedFirst:u}={...le.defaults,...T(t)?t:T(r)?r:{}};if(o===1&&m(r))return Ve(e.sort(r),a,s);let c=n?u?"":"Z".repeat(10):u?-1/0:1/0,l=m(r)?Ve([...e.entries()].sort(r),a,false):(()=>{let f=1,p=d=>{let g=T(d)&&f!==0?d[r]:d;if(!n)return g;let S=`${g!=null?g:c}`;return i?S.toLowerCase():S},[y,v]=a?[-1,1]:[1,-1];return [1,3].includes(o)?(o===3||s?[...e]:e).sort((d,g)=>p(d)>p(g)?y:v):(f=r===true?0:1,[...e.entries()].sort((d,g)=>p(d==null?void 0:d[f])>p(g==null?void 0:g[f])?y:v))})();if(o===1)return l;if(s)return o===2?new Map(l):new Set(l);e.clear();for(let f of l)o===2?e.set(...f):e.add(f);return e}le.defaults={asString:true,ignoreCase:true,newInstance:false,reverse:false,undefinedFirst:false};var Je=(...e)=>{var r;return new Map((r=e==null?void 0:e.flatMap)==null?void 0:r.call(e,t=>I(t)?Array.from(t.entries()):vr(t)?t:[]))};var z=globalThis.Promise,_=class extends z{constructor(r){let t,o,n=false,i=(s,a=true,u)=>{if(!n)return queueMicrotask(()=>i(s,a,u));s(u),this._state=a?1:2,this.onFinalize.forEach(c=>h(c,a?[u]:[void 0,u],void 0));};super((s,a)=>{o=u=>i(a,false,u),t=u=>i(s,true,u),m(r)?h(r,[t,o],o):xe(r)?r.then(t,o):r!==void 0&&t(r);}),this._state=0,this.onEarlyFinalize=[],this.onFinalize=[],this.resolve=s=>{var a,u;this.pending&&((a=this._resolve)==null||a.call(this,s),(u=this.onEarlyFinalize)==null||u.forEach(c=>{h(c,[true,s],void 0);}));},this.reject=s=>{var a,u;this.pending&&((a=this._reject)==null||a.call(this,s),(u=this.onEarlyFinalize)==null||u.forEach(c=>{h(c,[false,s],void 0);}));},n=true,this._resolve=t,this._reject=o;}get pending(){return this.state===0}get rejected(){return this.state===2}get resolved(){return this.state===1}get state(){return this._state}};_.all=e=>new _(z.all(e));_.allSettled=e=>new _(z.allSettled(e));_.any=e=>new _(z.any(e));_.race=e=>new _(z.race(e));_.reject=e=>{let r=new _;return queueMicrotask(()=>r.reject(e)),r};_.resolve=e=>new _(z.resolve(e));_.try=(e,...r)=>new _(h(e,r,t=>_.reject(t)));_.withResolvers=()=>{let e=new _;return {promise:e,reject:e.reject,resolve:e.resolve}};var Rr=_,C=Rr;function Ee(e={}){let r=0;e=N(Ee.defaults,e,[],"empty");let{onError:t,onIgnore:o,onResult:n}=e,{delay:i=0,ignoreStale:s,resolveError:a,resolveIgnored:u,thisArg:c,throttle:l}=e,f=null,p,y=new Map,v=!F(i);c!==void 0&&(t=t==null?void 0:t.bind(c),o=o==null?void 0:o.bind(c),n=n==null?void 0:n.bind(c));let d=O=>{for(let[x,b]of O){y.delete(x);let w=s&&b.sequence<p.sequence;if(!(b.resolved||b.started&&!w))switch(b.started&&(b.getPromise=(()=>b.result)),h(o,[b.getPromise],0),u){case "WITH_UNDEFINED":b.resolve(void 0);break;case "WITH_LAST":p==null||p.then(b.resolve,b.reject);break;}}y.size||(r=0);},g=O=>{if(f=null,v){y.delete(O);let[b,w]=[...y.entries()][0]||[];return b&&w&&j(b,w)}let x=[...y.entries()];if(l===true&&e.trailing){let b=x.findIndex(([w])=>w===O);x=x.slice(0,b);}else l||(x=x.slice(0,-1));d(x),y.delete(O);},S=async(O,x)=>{var b;try{x.started=!0,p=x,f=x,(b=x.result)!=null||(x.result=C.try(x.getPromise));let w=await x.result;if(!!s&&x.sequence<p.sequence)return d([[O,x]]);x.resolve(w),n&&h(n,[w],void 0);}catch(w){switch(t&&h(t,[w],void 0),a){case "REJECT":x.reject(w);case "NEVER":break;case "RESOLVE_UNDEFINED":x.resolve(void 0);break;case "RESOLVE_ERROR":x.resolve(w);break}}g(O);},j=v?S:K(S,i,e);return O=>{let x=Symbol("deferred-queue-item-id"),b=new C;return b.getPromise=m(O)?O:()=>O,b.started=false,b.sequence=++r,y.set(x,b),(!f||!v)&&j(x,b),b}}Ee.defaults={delay:100,resolveError:"REJECT",resolveIgnored:"WITH_LAST"};var Ge=Ee;function Fr(e,r={}){let{thisArg:t}=r;t!==void 0&&(e=e.bind(t));let o=Ge(r);return (...n)=>o(()=>e(...n))}var Mr=Fr;function ce(e=ce.defaults.duration,r,t=false){let o=new C,n=i=>{let s=h(async()=>{let a=await(m(i)?i():i);return t?a!=null?a:new Error(`${ce.defaults.delayTimeoutMsg} ${e}ms`):a!=null?a:e},[],a=>Promise.reject(a));t?s.then(o.reject,o.reject):o.resolve(s);};return o.timeoutId=setTimeout(()=>n(r),e),o.pause=()=>clearTimeout(o.timeoutId),o.catch(()=>{}).finally(()=>o.pause()),o.onEarlyFinalize.push(()=>o.pause()),o}ce.defaults={duration:100,delayTimeoutMsg:"Timed out after"};var Te=ce;function kr(e,r){return Te(e,r,true)}var Ye=kr,Oe=(e,r)=>{let t=false,o=C.try(async()=>{var n,i;r=N(Oe.defaults,r!=null?r:{},[],(g,S)=>{switch(g){case "retry":case "retryDelay":case "retryDelayJitterMax":return S!==0&&!ge(S)}return !!se(S)});let{retry:s,retryBackOff:a,retryDelay:u,retryDelayJitter:c,retryDelayJitterMax:l}=r,f=u,p=-1,y,v,d=false;do{if(p++,a==="exponential"&&p>1&&(f*=2),c&&(f+=Math.floor(Math.random()*l)),!t&&p>0&&await Te(f),!t)try{v=void 0,y=await e();}catch(g){v=g!=null?g:new Error(g);}if(t||s===0||p>=s)break;d=!!((i=await h((n=r.retryIf)!=null?n:v,[y,p,v],v))!=null?i:v);}while(d);return v!==void 0?Promise.reject(v):y});return o.onEarlyFinalize.push(()=>{t=true;}),o};Oe.defaults={retry:1,retryBackOff:"exponential",retryDelay:300,retryDelayJitter:true,retryDelayJitterMax:100};var Ur=Oe,Xe=1e4,je=2147483647,Nr=class extends C{constructor(e,r,t,o){super(e),this.started=new Date,this._setup=()=>{var n,i,s,a;this._signals=ue([(i=(n=this.options)==null?void 0:n.abortCtrl)==null?void 0:i.signal,(s=this.options)==null?void 0:s.signal].filter(Boolean)),!this.onEarlyFinalize.includes(this._handleEarlyFinalize)&&this.onEarlyFinalize.push(this._handleEarlyFinalize),!this.onFinalize.includes(this._handleFinalize)&&this.onFinalize.push(this._handleFinalize),(a=this._signals)==null||a.forEach(u=>u==null?void 0:u.addEventListener("abort",this._handleAbort));},this._handleAbort=async()=>{var n;let s=await h((n=this.options)==null?void 0:n.onAbort,[],void 0);s!=null||(s=new Error(`Aborted after ${new Date().getTime()-this.started.getTime()}ms`)),(s.name)!=null||(s.name="AbortError"),this.reject(s);},this._handleEarlyFinalize=()=>{var n,i,s,a;(n=this.options)!=null&&n.abortOnEarlyFinalize&&((a=(s=(i=this.options)==null?void 0:i.abortCtrl)==null?void 0:s.abort)==null||a.call(s));},this._handleFinalize=((n,i)=>{var s,a,u,c,l;this.cancelAbort(),this.clearTimeout(),!(!this.timeout.rejected&&!((s=this._signals)!=null&&s.find(f=>f==null?void 0:f.aborted)))&&((c=(u=(a=this.options)==null?void 0:a.abortCtrl)==null?void 0:u.signal)==null?void 0:c.aborted)===false&&((l=this.options)==null||l.abortCtrl.abort(i));}),this.data=e,this.options=T(t)?t:{},this.timeout=r,this._signals=o,this._setup();}get abortCtrl(){return this.options.abortCtrl}get aborted(){var e;return this.rejected&&!this.timeout.rejected&&!!((e=this._signals)!=null&&e.find(r=>r==null?void 0:r.aborted))}cancelAbort(){var e;(e=this._signals)==null||e.forEach(r=>r==null?void 0:r.removeEventListener("abort",this._handleAbort));}clearTimeout(){clearTimeout(this.timeout.timeoutId);}get timedout(){return this.rejected&&this.timeout.rejected}},Dr=Nr;function Ae(e,...r){var t;let o=N(Ae.defaults,X(e)?{timeout:e}:T(e)?e:{},[],"empty");o.timeout=Math.min(F(o.timeout)?o.timeout:Xe,je);let n=r.map(a=>m(a)?C.try(a):a),i=n.length<=1?n[0]instanceof C?n[0]:new C(n[0]):(m(C[o.batchFunc])?C[o.batchFunc]:C.all)(n),s=Ye(o.timeout,o.onTimeout);return new Dr(C.race([i,s]),s,o,ue([(t=o.abortCtrl)==null?void 0:t.signal,o.signal].filter(Boolean)))}Ae.defaults={abortOnEarlyFinalize:true,batchFunc:"all",timeout:Xe};var Lr=Ae,L=class extends C{};L.deferred=Ge;L.deferredCallback=Mr;L.delay=Te;L.delayReject=Ye;L.retry=Ur;L.timeout=Lr;var Vr=L,fe=Vr;var Ce=function(e,r){return Ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o;}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);},Ce(e,r)};function M(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Ce(e,r);function t(){this.constructor=e;}e.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t);}function Q(e){var r=typeof Symbol=="function"&&Symbol.iterator,t=r&&e[r],o=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return {next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(e,r){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var o=t.call(e),n,i=[],s;try{for(;(r===void 0||r-- >0)&&!(n=o.next()).done;)i.push(n.value);}catch(a){s={error:a};}finally{try{n&&!n.done&&(t=o.return)&&t.call(o);}finally{if(s)throw s.error}}return i}function W(e,r,t){if(arguments.length===2)for(var o=0,n=r.length,i;o<n;o++)(i||!(o in r))&&(i||(i=Array.prototype.slice.call(r,0,o)),i[o]=r[o]);return e.concat(i||Array.prototype.slice.call(r))}function E(e){return typeof e=="function"}function pe(e){var r=function(o){Error.call(o),o.stack=new Error().stack;},t=e(r);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var de=pe(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription:
2
2
  `+t.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=t;}});function ee(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1);}}var k=(function(){function e(r){this.initialTeardown=r,this.closed=false,this._parentage=null,this._finalizers=null;}return e.prototype.unsubscribe=function(){var r,t,o,n,i;if(!this.closed){this.closed=true;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Q(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this);}}catch(d){r={error:d};}finally{try{u&&!u.done&&(t=a.return)&&t.call(a);}finally{if(r)throw r.error}}else s.remove(this);var l=this.initialTeardown;if(E(l))try{l();}catch(d){i=d instanceof de?d.errors:[d];}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=Q(f),b=p.next();!b.done;b=p.next()){var v=b.value;try{Xe(v);}catch(d){i=i!=null?i:[],d instanceof de?i=W(W([],$(i)),$(d.errors)):i.push(d);}}}catch(d){o={error:d};}finally{try{b&&!b.done&&(n=p.return)&&n.call(p);}finally{if(o)throw o.error}}}if(i)throw new de(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)Xe(r);else {if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r);}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r;},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&ee(t,r);},e.prototype.remove=function(r){var t=this._finalizers;t&&ee(t,r),r instanceof e&&r._removeParent(this);},e.EMPTY=(function(){var r=new e;return r.closed=true,r})(),e})();var Ce=k.EMPTY;function he(e){return e instanceof k||e&&"closed"in e&&E(e.remove)&&E(e.add)&&E(e.unsubscribe)}function Xe(e){E(e)?e():e.unsubscribe();}var R={Promise:void 0};var q={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,W([e,r],$(t)))},clearTimeout:function(e){return (clearTimeout)(e)},delegate:void 0};function Ze(e){q.setTimeout(function(){throw e});}function Pe(){}function H(e){e();}var re=(function(e){M(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=false,t?(o.destination=t,he(t)&&t.add(o)):o.destination=$r,o}return r.create=function(t,o,n){return new be(t,o,n)},r.prototype.next=function(t){this.isStopped?Fe():this._next(t);},r.prototype.error=function(t){this.isStopped?Fe():(this.isStopped=true,this._error(t));},r.prototype.complete=function(){this.isStopped?Fe():(this.isStopped=true,this._complete());},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=true,e.prototype.unsubscribe.call(this),this.destination=null);},r.prototype._next=function(t){this.destination.next(t);},r.prototype._error=function(t){try{this.destination.error(t);}finally{this.unsubscribe();}},r.prototype._complete=function(){try{this.destination.complete();}finally{this.unsubscribe();}},r})(k);var zr=(function(){function e(r){this.partialObserver=r;}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r);}catch(o){me(o);}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r);}catch(o){me(o);}else me(r);},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete();}catch(t){me(t);}},e})(),be=(function(e){M(r,e);function r(t,o,n){var i=e.call(this)||this,s;if(E(t)||!t)s={next:t!=null?t:void 0,error:o!=null?o:void 0,complete:n!=null?n:void 0};else {s=t;}return i.destination=new zr(s),i}return r})(re);function me(e){Ze(e);}function Kr(e){throw e}function Fe(e,r){}var $r={closed:true,next:Pe,error:Kr,complete:Pe};var or=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function nr(e){return e}function ir(e){return e.length===0?nr:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var te=(function(){function e(r){r&&(this._subscribe=r);}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,o){var n=this,i=qr(r)?r:new be(r,t,o);return H(function(){var s=n,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?n._subscribe(i):n._trySubscribe(i));}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t);}},e.prototype.forEach=function(r,t){var o=this;return t=sr(t),new t(function(n,i){var s=new be({next:function(a){try{r(a);}catch(u){i(u),s.unsubscribe();}},error:i,complete:n});o.subscribe(s);})},e.prototype._subscribe=function(r){var t;return (t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[or]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return ir(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=sr(r),new r(function(o,n){var i;t.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)});})},e.create=function(r){return new e(r)},e})();function sr(e){var r;return (r=e!=null?e:R.Promise)!==null&&r!==void 0?r:Promise}function Wr(e){return e&&E(e.next)&&E(e.error)&&E(e.complete)}function qr(e){return e&&e instanceof re||Wr(e)&&he(e)}function Hr(e){return E(e==null?void 0:e.lift)}function ar(e){return function(r){if(Hr(r))return r.lift(function(t){try{return e(t,this)}catch(o){this.error(o);}});throw new TypeError("Unable to lift unknown Observable type")}}function ur(e,r,t,o,n){return new Jr(e,r,t,o,n)}var Jr=(function(e){M(r,e);function r(t,o,n,i,s,a){var u=e.call(this,t)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=o?function(c){try{o(c);}catch(l){t.error(l);}}:e.prototype._next,u._error=i?function(c){try{i(c);}catch(l){t.error(l);}finally{this.unsubscribe();}}:e.prototype._error,u._complete=n?function(){try{n();}catch(c){t.error(c);}finally{this.unsubscribe();}}:e.prototype._complete,u}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this));}},r})(re);var lr=pe(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var D=(function(e){M(r,e);function r(){var t=e.call(this)||this;return t.closed=false,t.currentObservers=null,t.observers=[],t.isStopped=false,t.hasError=false,t.thrownError=null,t}return r.prototype.lift=function(t){var o=new cr(this,this);return o.operator=t,o},r.prototype._throwIfClosed=function(){if(this.closed)throw new lr},r.prototype.next=function(t){var o=this;H(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=Q(o.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(t);}}catch(c){n={error:c};}finally{try{a&&!a.done&&(i=s.return)&&i.call(s);}finally{if(n)throw n.error}}}});},r.prototype.error=function(t){var o=this;H(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=true,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t);}});},r.prototype.complete=function(){var t=this;H(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=true;for(var o=t.observers;o.length;)o.shift().complete();}});},r.prototype.unsubscribe=function(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:false,configurable:true}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Ce:(this.currentObservers=null,a.push(t),new k(function(){o.currentObservers=null,ee(a,t);}))},r.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?t.error(i):s&&t.complete();},r.prototype.asObservable=function(){var t=new te;return t.source=this,t},r.create=function(t,o){return new cr(t,o)},r})(te);var cr=(function(e){M(r,e);function r(t,o){var n=e.call(this)||this;return n.destination=t,n.source=o,n}return r.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t);},r.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t);},r.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t);},r.prototype._subscribe=function(t){var o,n;return (n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Ce},r})(D);var P=(function(e){M(r,e);function r(t){var o=e.call(this)||this;return o._value=t,o}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:false,configurable:true}),r.prototype._subscribe=function(t){var o=e.prototype._subscribe.call(this,t);return !o.closed&&t.next(this._value),o},r.prototype.getValue=function(){var t=this,o=t.hasError,n=t.thrownError,i=t._value;if(o)throw n;return this._throwIfClosed(),i},r.prototype.next=function(t){e.prototype.next.call(this,this._value=t);},r})(D);function ye(e){return !!e&&(e instanceof te||E(e.lift)&&E(e.subscribe))}function fr(e,r){return ar(function(t,o){var n=0;t.subscribe(ur(o,function(i){return e.call(r,i,n++)&&o.next(i)}));})}function J(e){return fr(function(r,t){return e<=t})}var Vo=(e,r,t)=>{if(!ae(e)&&!ye(e))return fe.reject(new Error("subject must be an instance of BehaviorSubject"));let o,n=T(t)?t:{timeout:t};n.timeout=F(n.timeout)?n.timeout:Oe;let i=fe.timeout({...n,onTimeout:async()=>{let{onTimeout:s,timeoutMsg:a}=n,u=await h(s,[],void 0);return u!=null?u:Ke(a)?a:new Error(a!=null?a:"request timed out before an expected value is received")}},new fe(s=>{o=e.subscribe(a=>{(a===r||r===void 0||m(r)&&h(r,[a],false))&&s(a);});}));return i.onFinalize.push(()=>{var s;(s=o==null?void 0:o.unsubscribe)==null||s.call(o);}),i};var Gr=(e,r=false)=>ae(e,r),oe=Gr;var Yr=(e,r=false)=>{if(e instanceof k)return true;let t=e;return !r&&!!t&&ze(t.closed)&&m(t.unsubscribe)},pr=Yr;var ve=(e={},r)=>{if(e)try{if(m(e))return e();if(pr(e))return e.unsubscribe();Object.values(e).forEach(t=>ve(t,r));}catch(t){r==null||r(t);}},Me=ve;var ke=Symbol("ignore-rx-update");function Ue(e,r,t,o){var l;r=oe(r)?r:new P(void 0),o={...Ue.defaults,...o!=null?o:{}};let n=oe(e)?[e]:A(e)?e:[e],i=new Map(n.map((f,p)=>[p,oe(f)?f.value:f])),s=()=>{let f=A(e)?[...i.values()]:i.get(0);if(!m(t))return r.next(f);let p=h(t,[f,void 0,r],b=>{var v;return h((v=o.onError)==null?void 0:v.bind(o.thisArg),[b],void 0),ke});p!==ke&&r.next(p);},a=F(o.delay)?z(s,o.delay,o):s,u=n.map((f,p)=>{if(!(!oe(f)||f.closed))return (f instanceof P?f.pipe(J(1)):f).subscribe(b=>{i.set(p,b),a();})}).filter(Boolean),c=(l=r==null?void 0:r.unsubscribe)==null?void 0:l.bind(r);return r.unsubscribe=(...f)=>{c==null||c(...f),ve(u),i.clear();},s(),r}Ue.defaults={delay:0,throttle:false};Ue.IGNORE_UPDATE_SYMBOL=ke;var dr=new D,Ne=class{constructor(r,t){this.initialized=false;this.subscriptions={subject:void 0,forceUpdateCache:void 0};this.clear=()=>(this.setAll(new Map,true),this);this.delete=r=>{A(r)||(r=[r]);let t=this.getAll();for(let o of r)t.delete(o);return this.setAll(t,true),this};this.find=r=>$e(this.getAll(),r);this.filter=(r,t,o,n)=>we(this.getAll(),r,t,o,n);this.get=r=>this.getAll().get(r);this.getAll=(r=false)=>{var n;let t=this.initialized;if(t||this.init(),this.cacheDisabled||this.name&&r){let i=this.read();return (r||!t&&i.size)&&this.subject.next(i),i}return (n=this.subject)==null?void 0:n.value};this.has=r=>this.getAll().has(r);this.init=r=>{var n,i;if(this.initialized)return false;this.initialized=true,this.subject instanceof P&&this.subject.next(this.read()),Me(this.subscriptions),this.cacheDisabled||(this.subscriptions.forceUpdateCache=dr.subscribe(s=>{if(!(this.name?A(s)?s.includes(this.name):Z(s)?s===this.name:s===true:false))return;let u=this.read();this.subject.next(u);})),!((i=(n=this.subject)==null?void 0:n.value)!=null&&i.size)&&I(r)&&(r!=null&&r.size)&&this.setAll(r);let t=this.subject.pipe(J(this.cacheDisabled||r!=null&&r.size?0:1)),o=s=>{if(!I(s))return this.subject.next(new Map);this.write(s),h(async()=>{var a;return await((a=this.onChange)==null?void 0:a.call(this,s))},[],this.triggerOnError("onChange"));};return this.delay>0&&(o=z(o,this.delay,this.delayOptions)),this.subscriptions.subject=t.subscribe(o),true};this.keys=()=>qe(this.getAll());this.map=r=>this.toArray().map(([t,o],n,i)=>r(o,t,i,n));this.read=()=>{var o,n;let r=(n=(o=this.storage)==null?void 0:o.getItem(this.name))!=null?n:"[]",t=m(this.parse)&&h(this.parse,[r],this.triggerOnError("parse"));return I(t)?t:new Map(h(()=>JSON.parse(r),[],this.triggerOnError("parse-json")))};this.search=r=>B(this.getAll(),r);this.set=(r,t)=>(this.setAll(new Map([[r,t]]),false),this);this.setAll=(r=new Map,t=false)=>I(r)?(r=t?r:He(this.getAll(),r),this.subject.next(new Map(r)),this):this;this.sort=((r,t)=>{let o=le(this.getAll(),r,t);return t!=null&&t.save&&this.setAll(o,true),o});this.toArray=()=>We(this.getAll());this.toJSON=(r,t=this.spaces,o=this.getAll())=>{let n=Array.from(o),i=h(()=>{var s;return (s=this.stringify)==null?void 0:s.call(this,o)},[],this.triggerOnError("stringify"));return Z(i)?i:h(()=>JSON.stringify(n,r,t),[],this.triggerOnError("stringify-json"))};this.toString=r=>this.toJSON(void 0,void 0,r);this.triggerOnError=r=>t=>{this.onError&&h(this.onError,[t,r],"");};this.unsubscribe=()=>Me(this.subscriptions);this.values=()=>[...this.getAll().values()];this.write=r=>{try{return !this.initialized&&this.init(),r!=null||(r=this.subject.value),!this.name||!this.storage||!I(r)?!1:(this.storage.setItem(this.name,this.toString(r)),!0)}catch(t){return this.triggerOnError("write")(t),false}};let{cacheDisabled:o=false,delay:n,delayOptions:i,initialValue:s,onError:a,onChange:u,parse:c,spaces:l,storage:f,stringify:p}=t!=null?t:{};if(this.delay=o?0:n===0||F(n)?n:300,this.name=`${r!=null?r:""}`.trim(),this.onError=a,this.onChange=u,this.parse=c,this.storage=f===null?null:f!=null?f:h(()=>globalThis.localStorage,[],void 0),this.name&&!this.storage)throw new Error("options.storage: LocalStorage instance or equivalent required");this.cacheDisabled=!!this.storage&&o,this.stringify=p,this.spaces=l,this.subject=this.cacheDisabled?new D:new P(void 0),this.delayOptions=i,I(s)&&s.size&&this.init(s);}get size(){return this.getAll().size}};Ne.forceUpdateCache=r=>{dr.next(r);};var hr=class extends P{constructor(t,o=1e3,n=0,i=1){super(n);this.autoStart=t;this._delay=o;this.initialValue=n;this.incrementBy=i;this._running=false;this.pause=()=>(clearInterval(this._intervalId),this._running=false,this);this.resume=()=>this.start();this.start=()=>(this._running||(this._running=true,this._intervalId=setInterval(()=>this.next(this.value+this.incrementBy),this._delay)),this);this.stop=()=>(this.pause(),this.next(0),this);this.autoStart&&this.start();}get delay(){return this._delay}set delay(t){this._running||(this._delay=t);}get running(){return this._running}};var mr=class{constructor(r,t,o,n=true,i=true){this.taskFn=r;this.taskArgs=t;this.sequential=n;this.preExecute=i;this.minIntervalMs=1e3;this.runCount=0;this.started=false;this.clearInterval=()=>{this.sequential?clearTimeout(this.idInterval):clearInterval(this.idInterval),this.idInterval=void 0;};this.executeTask=async(r=false)=>{var n;let t,o;(this.sequential||r)&&this.clearInterval();try{++this.runCount,await((n=this.onBeforeExec)==null?void 0:n.call(this,this.runCount,r)),o=await this.taskFn.apply(void 0,this.taskArgs),this.lastResult=o;}catch(i){t=i;}return h(this.onResult,[t!=null?t:null,o,this.runCount,r],void 0),!r&&this.sequential&&this.intervalMs$.value>this.minIntervalMs&&(this.idInterval=setTimeout(this.executeTask,this.intervalMs$.value)),this.lastResult};this.executeOnce=async()=>await this.executeTask(true);this.isStarted=()=>this.started;this.restart=(r=false)=>this.onResult?(this.stop(r),this.start(this.onResult,this.onBeforeExec),true):false;this.start=(r,t)=>{if(!r||(this.onResult=r,this.onBeforeExec=t,this.started))return false;this.started=true;let o;return this.subscription=this.intervalMs$.subscribe(n=>{var s;if(o===n&&n!==void 0)return;o=Math.max((s=n!=null?n:o)!=null?s:0,this.minIntervalMs),this.clearInterval();let i=this.lastResult===void 0&&this.preExecute;i&&this.executeTask().catch(Be),this.idInterval=this.sequential?i?void 0:setTimeout(this.executeTask,o):setInterval(this.executeTask,o);}),true};this.stop=(r=false)=>{var t,o;return r&&(this.runCount=0),this.started=false,(o=(t=this.subscription)==null?void 0:t.unsubscribe)==null||o.call(t),this.clearInterval(),this};this.intervalMs$=o instanceof P?o:new P(o);}};exports.BehaviorSubject=P;exports.DataStorage=Ne;exports.IGNORE_UPDATE_SYMBOL=ke;exports.IntervalRunner=mr;exports.IntervalSubject=hr;exports.Subject=D;exports.Subscription=k;exports.asPromise=Vo;exports.copyRxSubject=Ue;exports.forceUpdateCache$=dr;exports.isObservable=ye;exports.isSubjectLike=Gr;exports.isSubscriptionLike=Yr;exports.skip=J;exports.unsubscribeAll=ve;return exports;})({});//# sourceMappingURL=index.min.js.map
3
+ `):"",this.name="UnsubscriptionError",this.errors=t;}});function ee(e,r){if(e){var t=e.indexOf(r);0<=t&&e.splice(t,1);}}var k=(function(){function e(r){this.initialTeardown=r,this.closed=false,this._parentage=null,this._finalizers=null;}return e.prototype.unsubscribe=function(){var r,t,o,n,i;if(!this.closed){this.closed=true;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Q(s),u=a.next();!u.done;u=a.next()){var c=u.value;c.remove(this);}}catch(d){r={error:d};}finally{try{u&&!u.done&&(t=a.return)&&t.call(a);}finally{if(r)throw r.error}}else s.remove(this);var l=this.initialTeardown;if(E(l))try{l();}catch(d){i=d instanceof de?d.errors:[d];}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=Q(f),y=p.next();!y.done;y=p.next()){var v=y.value;try{Ze(v);}catch(d){i=i!=null?i:[],d instanceof de?i=W(W([],$(i)),$(d.errors)):i.push(d);}}}catch(d){o={error:d};}finally{try{y&&!y.done&&(n=p.return)&&n.call(p);}finally{if(o)throw o.error}}}if(i)throw new de(i)}},e.prototype.add=function(r){var t;if(r&&r!==this)if(this.closed)Ze(r);else {if(r instanceof e){if(r.closed||r._hasParent(this))return;r._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(r);}},e.prototype._hasParent=function(r){var t=this._parentage;return t===r||Array.isArray(t)&&t.includes(r)},e.prototype._addParent=function(r){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(r),t):t?[t,r]:r;},e.prototype._removeParent=function(r){var t=this._parentage;t===r?this._parentage=null:Array.isArray(t)&&ee(t,r);},e.prototype.remove=function(r){var t=this._finalizers;t&&ee(t,r),r instanceof e&&r._removeParent(this);},e.EMPTY=(function(){var r=new e;return r.closed=true,r})(),e})();var Pe=k.EMPTY;function he(e){return e instanceof k||e&&"closed"in e&&E(e.remove)&&E(e.add)&&E(e.unsubscribe)}function Ze(e){E(e)?e():e.unsubscribe();}var R={Promise:void 0};var q={setTimeout:function(e,r){for(var t=[],o=2;o<arguments.length;o++)t[o-2]=arguments[o];return setTimeout.apply(void 0,W([e,r],$(t)))},clearTimeout:function(e){return (clearTimeout)(e)},delegate:void 0};function Qe(e){q.setTimeout(function(){throw e});}function Ie(){}function H(e){e();}var re=(function(e){M(r,e);function r(t){var o=e.call(this)||this;return o.isStopped=false,t?(o.destination=t,he(t)&&t.add(o)):o.destination=$r,o}return r.create=function(t,o,n){return new ye(t,o,n)},r.prototype.next=function(t){this.isStopped?Me():this._next(t);},r.prototype.error=function(t){this.isStopped?Me():(this.isStopped=true,this._error(t));},r.prototype.complete=function(){this.isStopped?Me():(this.isStopped=true,this._complete());},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=true,e.prototype.unsubscribe.call(this),this.destination=null);},r.prototype._next=function(t){this.destination.next(t);},r.prototype._error=function(t){try{this.destination.error(t);}finally{this.unsubscribe();}},r.prototype._complete=function(){try{this.destination.complete();}finally{this.unsubscribe();}},r})(k);var Kr=(function(){function e(r){this.partialObserver=r;}return e.prototype.next=function(r){var t=this.partialObserver;if(t.next)try{t.next(r);}catch(o){me(o);}},e.prototype.error=function(r){var t=this.partialObserver;if(t.error)try{t.error(r);}catch(o){me(o);}else me(r);},e.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete();}catch(t){me(t);}},e})(),ye=(function(e){M(r,e);function r(t,o,n){var i=e.call(this)||this,s;if(E(t)||!t)s={next:t!=null?t:void 0,error:o!=null?o:void 0,complete:n!=null?n:void 0};else {s=t;}return i.destination=new Kr(s),i}return r})(re);function me(e){Qe(e);}function zr(e){throw e}function Me(e,r){}var $r={closed:true,next:Ie,error:zr,complete:Ie};var nr=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ir(e){return e}function sr(e){return e.length===0?ir:e.length===1?e[0]:function(t){return e.reduce(function(o,n){return n(o)},t)}}var te=(function(){function e(r){r&&(this._subscribe=r);}return e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.subscribe=function(r,t,o){var n=this,i=qr(r)?r:new ye(r,t,o);return H(function(){var s=n,a=s.operator,u=s.source;i.add(a?a.call(i,u):u?n._subscribe(i):n._trySubscribe(i));}),i},e.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(t){r.error(t);}},e.prototype.forEach=function(r,t){var o=this;return t=ar(t),new t(function(n,i){var s=new ye({next:function(a){try{r(a);}catch(u){i(u),s.unsubscribe();}},error:i,complete:n});o.subscribe(s);})},e.prototype._subscribe=function(r){var t;return (t=this.source)===null||t===void 0?void 0:t.subscribe(r)},e.prototype[nr]=function(){return this},e.prototype.pipe=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return sr(r)(this)},e.prototype.toPromise=function(r){var t=this;return r=ar(r),new r(function(o,n){var i;t.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)});})},e.create=function(r){return new e(r)},e})();function ar(e){var r;return (r=e!=null?e:R.Promise)!==null&&r!==void 0?r:Promise}function Wr(e){return e&&E(e.next)&&E(e.error)&&E(e.complete)}function qr(e){return e&&e instanceof re||Wr(e)&&he(e)}function Hr(e){return E(e==null?void 0:e.lift)}function ur(e){return function(r){if(Hr(r))return r.lift(function(t){try{return e(t,this)}catch(o){this.error(o);}});throw new TypeError("Unable to lift unknown Observable type")}}function lr(e,r,t,o,n){return new Jr(e,r,t,o,n)}var Jr=(function(e){M(r,e);function r(t,o,n,i,s,a){var u=e.call(this,t)||this;return u.onFinalize=s,u.shouldUnsubscribe=a,u._next=o?function(c){try{o(c);}catch(l){t.error(l);}}:e.prototype._next,u._error=i?function(c){try{i(c);}catch(l){t.error(l);}finally{this.unsubscribe();}}:e.prototype._error,u._complete=n?function(){try{n();}catch(c){t.error(c);}finally{this.unsubscribe();}}:e.prototype._complete,u}return r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;e.prototype.unsubscribe.call(this),!o&&((t=this.onFinalize)===null||t===void 0||t.call(this));}},r})(re);var cr=pe(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed";}});var D=(function(e){M(r,e);function r(){var t=e.call(this)||this;return t.closed=false,t.currentObservers=null,t.observers=[],t.isStopped=false,t.hasError=false,t.thrownError=null,t}return r.prototype.lift=function(t){var o=new fr(this,this);return o.operator=t,o},r.prototype._throwIfClosed=function(){if(this.closed)throw new cr},r.prototype.next=function(t){var o=this;H(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=Q(o.currentObservers),a=s.next();!a.done;a=s.next()){var u=a.value;u.next(t);}}catch(c){n={error:c};}finally{try{a&&!a.done&&(i=s.return)&&i.call(s);}finally{if(n)throw n.error}}}});},r.prototype.error=function(t){var o=this;H(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=true,o.thrownError=t;for(var n=o.observers;n.length;)n.shift().error(t);}});},r.prototype.complete=function(){var t=this;H(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=true;for(var o=t.observers;o.length;)o.shift().complete();}});},r.prototype.unsubscribe=function(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:false,configurable:true}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Pe:(this.currentObservers=null,a.push(t),new k(function(){o.currentObservers=null,ee(a,t);}))},r.prototype._checkFinalizedStatuses=function(t){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?t.error(i):s&&t.complete();},r.prototype.asObservable=function(){var t=new te;return t.source=this,t},r.create=function(t,o){return new fr(t,o)},r})(te);var fr=(function(e){M(r,e);function r(t,o){var n=e.call(this)||this;return n.destination=t,n.source=o,n}return r.prototype.next=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,t);},r.prototype.error=function(t){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,t);},r.prototype.complete=function(){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||o===void 0||o.call(t);},r.prototype._subscribe=function(t){var o,n;return (n=(o=this.source)===null||o===void 0?void 0:o.subscribe(t))!==null&&n!==void 0?n:Pe},r})(D);var P=(function(e){M(r,e);function r(t){var o=e.call(this)||this;return o._value=t,o}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:false,configurable:true}),r.prototype._subscribe=function(t){var o=e.prototype._subscribe.call(this,t);return !o.closed&&t.next(this._value),o},r.prototype.getValue=function(){var t=this,o=t.hasError,n=t.thrownError,i=t._value;if(o)throw n;return this._throwIfClosed(),i},r.prototype.next=function(t){e.prototype.next.call(this,this._value=t);},r})(D);function be(e){return !!e&&(e instanceof te||E(e.lift)&&E(e.subscribe))}function pr(e,r){return ur(function(t,o){var n=0;t.subscribe(lr(o,function(i){return e.call(r,i,n++)&&o.next(i)}));})}function J(e){return pr(function(r,t){return e<=t})}var Vo=(e,r,t)=>{if(!ae(e)&&!be(e))return fe.reject(new Error("subject must be an instance of BehaviorSubject"));let o,n=T(t)?t:{timeout:t};n.timeout=F(n.timeout)?n.timeout:je;let i=fe.timeout({...n,onTimeout:async()=>{let{onTimeout:s,timeoutMsg:a}=n,u=await h(s,[],void 0);return u!=null?u:$e(a)?a:new Error(a!=null?a:"request timed out before an expected value is received")}},new fe(s=>{o=e.subscribe(a=>{(a===r||r===void 0||m(r)&&h(r,[a],false))&&s(a);});}));return i.onFinalize.push(()=>{var s;(s=o==null?void 0:o.unsubscribe)==null||s.call(o);}),i};var Gr=(e,r=false)=>ae(e,r),oe=Gr;var Yr=(e,r=false)=>{if(e instanceof k)return true;let t=e;return !r&&!!t&&ze(t.closed)&&m(t.unsubscribe)},dr=Yr;var ve=(e={},r)=>{if(e)try{if(m(e))return e();if(dr(e))return e.unsubscribe();Object.values(e).forEach(t=>ve(t,r));}catch(t){r==null||r(t);}},ke=ve;var Ue=Symbol("ignore-rx-update");function Ne(e,r,t,o){var l;r=oe(r)?r:new P(void 0),o={...Ne.defaults,...o!=null?o:{}};let n=oe(e)?[e]:A(e)?e:[e],i=new Map(n.map((f,p)=>[p,oe(f)?f.value:f])),s=()=>{let f=A(e)?[...i.values()]:i.get(0);if(!m(t))return r.next(f);let p=h(t,[f,void 0,r],y=>{var v;return h((v=o.onError)==null?void 0:v.bind(o.thisArg),[y],void 0),Ue});p!==Ue&&r.next(p);},a=F(o.delay)?K(s,o.delay,o):s,u=n.map((f,p)=>{if(!(!oe(f)||f.closed))return (f instanceof P?f.pipe(J(1)):f).subscribe(y=>{i.set(p,y),a();})}).filter(Boolean),c=(l=r==null?void 0:r.unsubscribe)==null?void 0:l.bind(r);return r.unsubscribe=(...f)=>{c==null||c(...f),ve(u),i.clear();},s(),r}Ne.defaults={delay:0,throttle:false};Ne.IGNORE_UPDATE_SYMBOL=Ue;var hr=new D,De=class{constructor(r,t){this.initialized=false;this.subscriptions={subject:void 0,forceUpdateCache:void 0};this.clear=()=>(this.setAll(new Map,true),this);this.delete=r=>{A(r)||(r=[r]);let t=this.getAll();for(let o of r)t.delete(o);return this.setAll(t,true),this};this.find=r=>We(this.getAll(),r);this.filter=(r,t,o,n)=>we(this.getAll(),r,t,o,n);this.get=r=>this.getAll().get(r);this.getAll=(r=false)=>{var n;let t=this.initialized;if(t||this.init(),this.cacheDisabled||this.name&&r){let i=this.read();return (r||!t&&i.size)&&this.subject.next(i),i}return (n=this.subject)==null?void 0:n.value};this.has=r=>this.getAll().has(r);this.init=r=>{var n,i;if(this.initialized)return false;this.initialized=true,this.subject instanceof P&&this.subject.next(this.read()),ke(this.subscriptions),this.cacheDisabled||(this.subscriptions.forceUpdateCache=hr.subscribe(s=>{if(!(this.name?A(s)?s.includes(this.name):Z(s)?s===this.name:s===true:false))return;let u=this.read();this.subject.next(u);})),!((i=(n=this.subject)==null?void 0:n.value)!=null&&i.size)&&I(r)&&(r!=null&&r.size)&&this.setAll(r);let t=this.subject.pipe(J(this.cacheDisabled||r!=null&&r.size?0:1)),o=s=>{if(!I(s))return this.subject.next(new Map);this.write(s),h(()=>{var a;return (a=this.onChange)==null?void 0:a.call(this,s)},[],this.triggerOnError("onChange"));};return this.delay>0&&(o=K(o,this.delay,this.delayOptions)),this.subscriptions.subject=t.subscribe(o),true};this.keys=()=>He(this.getAll());this.map=r=>this.toArray().map(([t,o],n,i)=>r(o,t,i,n));this.read=()=>{var o,n;let r=(n=(o=this.storage)==null?void 0:o.getItem(this.name))!=null?n:"[]",t=m(this.parse)&&h(this.parse,[r],this.triggerOnError("parse"));return I(t)?t:new Map(h(()=>JSON.parse(r),[],this.triggerOnError("parse-json")))};this.search=r=>B(this.getAll(),r);this.set=(r,t)=>(this.setAll(new Map([[r,t]]),false),this);this.setAll=(r=new Map,t=false)=>I(r)?(r=t?r:Je(this.getAll(),r),this.subject.next(new Map(r)),this):this;this.sort=((r,t)=>{let o=le(this.getAll(),r,t);return t!=null&&t.save&&this.setAll(o,true),o});this.toArray=()=>qe(this.getAll());this.toJSON=(r,t=this.spaces,o=this.getAll())=>{let n=Array.from(o),i=h(()=>{var s;return (s=this.stringify)==null?void 0:s.call(this,o)},[],this.triggerOnError("stringify"));return Z(i)?i:h(()=>JSON.stringify(n,r,t),[],this.triggerOnError("stringify-json"))};this.toObject=()=>{let r={};for(let[t,o]of this.getAll())r[t]=o;return r};this.toString=r=>this.toJSON(void 0,void 0,r);this.triggerOnError=r=>t=>{this.onError&&h(this.onError,[t,r],"");};this.unsubscribe=()=>ke(this.subscriptions);this.values=()=>_e(this.getAll());this.write=r=>{try{return !this.initialized&&this.init(),r!=null||(r=this.subject.value),!this.name||!this.storage||!I(r)?!1:(this.storage.setItem(this.name,this.toString(r)),!0)}catch(t){return this.triggerOnError("write")(t),false}};let{cacheDisabled:o=false,delay:n,delayOptions:i,initialValue:s,onError:a,onChange:u,parse:c,spaces:l,storage:f,stringify:p}=t!=null?t:{};if(this.delay=o?0:n===0||F(n)?n:300,this.name=`${r!=null?r:""}`.trim(),this.onError=a,this.onChange=u,this.parse=c,this.storage=f===null?null:f!=null?f:h(()=>globalThis.localStorage,[],void 0),this.name&&!this.storage)throw new Error("options.storage: LocalStorage instance or equivalent required");this.cacheDisabled=!!this.storage&&o,this.stringify=p,this.spaces=l,this.subject=this.cacheDisabled?new D:new P(void 0),this.delayOptions=i,I(s)&&s.size&&this.init(s);}get size(){return this.getAll().size}};De.forceUpdateCache=r=>{hr.next(r);};var mr=class extends P{constructor(t,o=1e3,n=0,i=1){super(n);this.autoStart=t;this._delay=o;this.initialValue=n;this.incrementBy=i;this._running=false;this.pause=()=>(clearInterval(this._intervalId),this._running=false,this);this.resume=()=>this.start();this.start=()=>(this._running||(this._running=true,this._intervalId=setInterval(()=>this.next(this.value+this.incrementBy),this._delay)),this);this.stop=()=>(this.pause(),this.next(0),this);this.autoStart&&this.start();}get delay(){return this._delay}set delay(t){this._running||(this._delay=t);}get running(){return this._running}};var yr=class{constructor(r,t,o,n=true,i=true){this.taskFn=r;this.taskArgs=t;this.sequential=n;this.preExecute=i;this.minIntervalMs=1e3;this.runCount=0;this.started=false;this.clearInterval=()=>{this.sequential?clearTimeout(this.idInterval):clearInterval(this.idInterval),this.idInterval=void 0;};this.executeTask=async(r=false)=>{var n;let t,o;(this.sequential||r)&&this.clearInterval();try{++this.runCount,await((n=this.onBeforeExec)==null?void 0:n.call(this,this.runCount,r)),o=await this.taskFn.apply(void 0,this.taskArgs),this.lastResult=o;}catch(i){t=i;}return h(this.onResult,[t!=null?t:null,o,this.runCount,r],void 0),!r&&this.sequential&&this.intervalMs$.value>this.minIntervalMs&&(this.idInterval=setTimeout(this.executeTask,this.intervalMs$.value)),this.lastResult};this.executeOnce=async()=>await this.executeTask(true);this.isStarted=()=>this.started;this.restart=(r=false)=>this.onResult?(this.stop(r),this.start(this.onResult,this.onBeforeExec),true):false;this.start=(r,t)=>{if(!r||(this.onResult=r,this.onBeforeExec=t,this.started))return false;this.started=true;let o;return this.subscription=this.intervalMs$.subscribe(n=>{var s;if(o===n&&n!==void 0)return;o=Math.max((s=n!=null?n:o)!=null?s:0,this.minIntervalMs),this.clearInterval();let i=this.lastResult===void 0&&this.preExecute;i&&this.executeTask().catch(Ke),this.idInterval=this.sequential?i?void 0:setTimeout(this.executeTask,o):setInterval(this.executeTask,o);}),true};this.stop=(r=false)=>{var t,o;return r&&(this.runCount=0),this.started=false,(o=(t=this.subscription)==null?void 0:t.unsubscribe)==null||o.call(t),this.clearInterval(),this};this.intervalMs$=o instanceof P?o:new P(o);}};exports.BehaviorSubject=P;exports.DataStorage=De;exports.IGNORE_UPDATE_SYMBOL=Ue;exports.IntervalRunner=yr;exports.IntervalSubject=mr;exports.Subject=D;exports.Subscription=k;exports.asPromise=Vo;exports.copyRxSubject=Ne;exports.forceUpdateCache$=hr;exports.isObservable=be;exports.isSubjectLike=Gr;exports.isSubscriptionLike=Yr;exports.skip=J;exports.unsubscribeAll=ve;return exports;})({});//# sourceMappingURL=index.min.js.map
4
4
  //# sourceMappingURL=index.min.js.map