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