@machinemetrics/mm-react-tools 3.2.0 → 3.2.1

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.
@@ -19256,14 +19256,14 @@ const fi = /* @__PURE__ */ W0(bD), O_ = Fs.createContext(), T_ = Fs.createContex
19256
19256
  );
19257
19257
  return /* @__PURE__ */ ur.jsx(A_.Provider, { value: f, children: r });
19258
19258
  }, ja = Fs.createContext(), Z2 = (r, e, t = (i) => i, n = (i) => i) => {
19259
- const [i, a] = ai(A_), c = i[r] ?? e;
19260
- return [c && t(c), (d) => {
19261
- if (typeof d == "function") {
19262
- const g = i[r];
19263
- d = d(t(g ?? e));
19264
- }
19265
- const y = n(d);
19266
- a({ [r]: y });
19259
+ const [i, a] = ai(A_), u = i[r];
19260
+ return [u ? t(u) : e, (h) => {
19261
+ if (typeof h == "function") {
19262
+ const y = i[r];
19263
+ h = h(t(y ?? e));
19264
+ }
19265
+ const d = n(h);
19266
+ a({ [r]: d });
19267
19267
  }];
19268
19268
  }, nl = async (r, e, t) => {
19269
19269
  cr(() => {
@@ -109,7 +109,7 @@ __p += '`),St&&(pe+=`' +
109
109
  function print() { __p += __j.call(arguments, '') }
110
110
  `:`;
111
111
  `)+pe+`return __p
112
- }`;var ht=ax(function(){return Ft(T,$e+"return "+pe).apply(t,N)});if(ht.source=pe,bp(ht))throw ht;return ht}function HF(s){return $t(s).toLowerCase()}function GF(s){return $t(s).toUpperCase()}function QF(s,o,l){if(s=$t(s),s&&(l||o===t))return mw(s);if(!s||!(o=An(o)))return s;var p=ii(s),v=ii(o),T=yw(p,v),N=gw(p,v)+1;return hs(p,T,N).join("")}function JF(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,bw(s)+1);if(!s||!(o=An(o)))return s;var p=ii(s),v=gw(p,ii(o))+1;return hs(p,0,v).join("")}function YF(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(kr,"");if(!s||!(o=An(o)))return s;var p=ii(s),v=yw(p,ii(o));return hs(p,v).join("")}function KF(s,o){var l=fe,p=ge;if(lr(o)){var v="separator"in o?o.separator:v;l="length"in o?lt(o.length):l,p="omission"in o?An(o.omission):p}s=$t(s);var T=s.length;if(Aa(s)){var N=ii(s);T=N.length}if(l>=T)return s;var L=l-ka(p);if(L<1)return p;var $=N?hs(N,0,L).join(""):s.slice(0,L);if(v===t)return $+p;if(N&&(L+=$.length-L),wp(v)){if(s.slice(L).search(v)){var se,oe=$;for(v.global||(v=Fd(v.source,$t(Ue.exec(v))+"g")),v.lastIndex=0;se=v.exec(oe);)var pe=se.index;$=$.slice(0,pe===t?L:pe)}}else if(s.indexOf(An(v),L)!=L){var ke=$.lastIndexOf(v);ke>-1&&($=$.slice(0,ke))}return $+p}function ZF(s){return s=$t(s),s&&Ur.test(s)?s.replace(Mt,AP):s}var XF=Ma(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Sp=o_("toUpperCase");function sx(s,o,l){return s=$t(s),o=l?t:o,o===t?xP(s)?CP(s):dP(s):s.match(o)||[]}var ax=dt(function(s,o){try{return On(s,t,o)}catch(l){return bp(l)?l:new at(l)}}),e2=Ni(function(s,o){return Bn(o,function(l){l=di(l),Ci(s,l,gp(s[l],s))}),s});function t2(s){var o=s==null?0:s.length,l=He();return s=o?sr(s,function(p){if(typeof p[1]!="function")throw new Vn(u);return[l(p[0]),p[1]]}):[],dt(function(p){for(var v=-1;++v<o;){var T=s[v];if(On(T[0],this,p))return On(T[1],this,p)}})}function r2(s){return AN(zn(s,y))}function Ep(s){return function(){return s}}function n2(s,o){return s==null||s!==s?o:s}var i2=c_(),s2=c_(!0);function pn(s){return s}function Op(s){return qw(typeof s=="function"?s:zn(s,y))}function a2(s){return $w(zn(s,y))}function o2(s,o){return Bw(s,zn(o,y))}var u2=dt(function(s,o){return function(l){return Ho(l,s,o)}}),c2=dt(function(s,o){return function(l){return Ho(s,l,o)}});function Tp(s,o,l){var p=Lr(o),v=Uc(o,p);l==null&&!(lr(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=Uc(o,Lr(o)));var T=!(lr(l)&&"chain"in l)||!!l.chain,N=Di(s);return Bn(v,function(L){var $=o[L];s[L]=$,N&&(s.prototype[L]=function(){var se=this.__chain__;if(T||se){var oe=s(this.__wrapped__),pe=oe.__actions__=fn(this.__actions__);return pe.push({func:$,args:arguments,thisArg:s}),oe.__chain__=se,oe}return $.apply(s,as([this.value()],arguments))})}),s}function l2(){return Br._===this&&(Br._=FP),this}function Ap(){}function f2(s){return s=lt(s),dt(function(o){return Vw(o,s)})}var h2=ip(sr),d2=ip(lw),p2=ip(Id);function ox(s){return fp(s)?Cd(di(s)):WN(s)}function m2(s){return function(o){return s==null?t:Fs(s,o)}}var y2=f_(),g2=f_(!0);function kp(){return[]}function Ip(){return!1}function v2(){return{}}function b2(){return""}function w2(){return!0}function _2(s,o){if(s=lt(s),s<1||s>ce)return[];var l=Oe,p=Gr(s,Oe);o=He(o),s-=Oe;for(var v=Rd(p,o);++l<s;)o(l);return v}function x2(s){return ut(s)?sr(s,di):kn(s)?[s]:fn(A_($t(s)))}function S2(s){var o=++DP;return $t(s)+o}var E2=Hc(function(s,o){return s+o},0),O2=sp("ceil"),T2=Hc(function(s,o){return s/o},1),A2=sp("floor");function k2(s){return s&&s.length?qc(s,pn,Wd):t}function I2(s,o){return s&&s.length?qc(s,He(o,2),Wd):t}function C2(s){return dw(s,pn)}function P2(s,o){return dw(s,He(o,2))}function N2(s){return s&&s.length?qc(s,pn,Qd):t}function R2(s,o){return s&&s.length?qc(s,He(o,2),Qd):t}var D2=Hc(function(s,o){return s*o},1),M2=sp("round"),F2=Hc(function(s,o){return s-o},0);function L2(s){return s&&s.length?Nd(s,pn):0}function j2(s,o){return s&&s.length?Nd(s,He(o,2)):0}return S.after=aM,S.ary=j_,S.assign=GM,S.assignIn=Z_,S.assignInWith=sl,S.assignWith=QM,S.at=JM,S.before=q_,S.bind=gp,S.bindAll=e2,S.bindKey=U_,S.castArray=vM,S.chain=M_,S.chunk=AR,S.compact=kR,S.concat=IR,S.cond=t2,S.conforms=r2,S.constant=Ep,S.countBy=LD,S.create=YM,S.curry=$_,S.curryRight=B_,S.debounce=V_,S.defaults=KM,S.defaultsDeep=ZM,S.defer=oM,S.delay=uM,S.difference=CR,S.differenceBy=PR,S.differenceWith=NR,S.drop=RR,S.dropRight=DR,S.dropRightWhile=MR,S.dropWhile=FR,S.fill=LR,S.filter=qD,S.flatMap=BD,S.flatMapDeep=VD,S.flatMapDepth=WD,S.flatten=P_,S.flattenDeep=jR,S.flattenDepth=qR,S.flip=cM,S.flow=i2,S.flowRight=s2,S.fromPairs=UR,S.functions=sF,S.functionsIn=aF,S.groupBy=zD,S.initial=BR,S.intersection=VR,S.intersectionBy=WR,S.intersectionWith=zR,S.invert=uF,S.invertBy=cF,S.invokeMap=GD,S.iteratee=Op,S.keyBy=QD,S.keys=Lr,S.keysIn=dn,S.map=Xc,S.mapKeys=fF,S.mapValues=hF,S.matches=a2,S.matchesProperty=o2,S.memoize=tl,S.merge=dF,S.mergeWith=X_,S.method=u2,S.methodOf=c2,S.mixin=Tp,S.negate=rl,S.nthArg=f2,S.omit=pF,S.omitBy=mF,S.once=lM,S.orderBy=JD,S.over=h2,S.overArgs=fM,S.overEvery=d2,S.overSome=p2,S.partial=vp,S.partialRight=W_,S.partition=YD,S.pick=yF,S.pickBy=ex,S.property=ox,S.propertyOf=m2,S.pull=JR,S.pullAll=R_,S.pullAllBy=YR,S.pullAllWith=KR,S.pullAt=ZR,S.range=y2,S.rangeRight=g2,S.rearg=hM,S.reject=XD,S.remove=XR,S.rest=dM,S.reverse=mp,S.sampleSize=tM,S.set=vF,S.setWith=bF,S.shuffle=rM,S.slice=eD,S.sortBy=sM,S.sortedUniq=oD,S.sortedUniqBy=uD,S.split=BF,S.spread=pM,S.tail=cD,S.take=lD,S.takeRight=fD,S.takeRightWhile=hD,S.takeWhile=dD,S.tap=kD,S.throttle=mM,S.thru=Zc,S.toArray=J_,S.toPairs=tx,S.toPairsIn=rx,S.toPath=x2,S.toPlainObject=K_,S.transform=wF,S.unary=yM,S.union=pD,S.unionBy=mD,S.unionWith=yD,S.uniq=gD,S.uniqBy=vD,S.uniqWith=bD,S.unset=_F,S.unzip=yp,S.unzipWith=D_,S.update=xF,S.updateWith=SF,S.values=ja,S.valuesIn=EF,S.without=wD,S.words=sx,S.wrap=gM,S.xor=_D,S.xorBy=xD,S.xorWith=SD,S.zip=ED,S.zipObject=OD,S.zipObjectDeep=TD,S.zipWith=AD,S.entries=tx,S.entriesIn=rx,S.extend=Z_,S.extendWith=sl,Tp(S,S),S.add=E2,S.attempt=ax,S.camelCase=kF,S.capitalize=nx,S.ceil=O2,S.clamp=OF,S.clone=bM,S.cloneDeep=_M,S.cloneDeepWith=xM,S.cloneWith=wM,S.conformsTo=SM,S.deburr=ix,S.defaultTo=n2,S.divide=T2,S.endsWith=IF,S.eq=ai,S.escape=CF,S.escapeRegExp=PF,S.every=jD,S.find=UD,S.findIndex=I_,S.findKey=XM,S.findLast=$D,S.findLastIndex=C_,S.findLastKey=eF,S.floor=A2,S.forEach=F_,S.forEachRight=L_,S.forIn=tF,S.forInRight=rF,S.forOwn=nF,S.forOwnRight=iF,S.get=_p,S.gt=EM,S.gte=OM,S.has=oF,S.hasIn=xp,S.head=N_,S.identity=pn,S.includes=HD,S.indexOf=$R,S.inRange=TF,S.invoke=lF,S.isArguments=qs,S.isArray=ut,S.isArrayBuffer=TM,S.isArrayLike=hn,S.isArrayLikeObject=gr,S.isBoolean=AM,S.isBuffer=ds,S.isDate=kM,S.isElement=IM,S.isEmpty=CM,S.isEqual=PM,S.isEqualWith=NM,S.isError=bp,S.isFinite=RM,S.isFunction=Di,S.isInteger=z_,S.isLength=nl,S.isMap=H_,S.isMatch=DM,S.isMatchWith=MM,S.isNaN=FM,S.isNative=LM,S.isNil=qM,S.isNull=jM,S.isNumber=G_,S.isObject=lr,S.isObjectLike=pr,S.isPlainObject=Zo,S.isRegExp=wp,S.isSafeInteger=UM,S.isSet=Q_,S.isString=il,S.isSymbol=kn,S.isTypedArray=La,S.isUndefined=$M,S.isWeakMap=BM,S.isWeakSet=VM,S.join=HR,S.kebabCase=NF,S.last=Gn,S.lastIndexOf=GR,S.lowerCase=RF,S.lowerFirst=DF,S.lt=WM,S.lte=zM,S.max=k2,S.maxBy=I2,S.mean=C2,S.meanBy=P2,S.min=N2,S.minBy=R2,S.stubArray=kp,S.stubFalse=Ip,S.stubObject=v2,S.stubString=b2,S.stubTrue=w2,S.multiply=D2,S.nth=QR,S.noConflict=l2,S.noop=Ap,S.now=el,S.pad=MF,S.padEnd=FF,S.padStart=LF,S.parseInt=jF,S.random=AF,S.reduce=KD,S.reduceRight=ZD,S.repeat=qF,S.replace=UF,S.result=gF,S.round=M2,S.runInContext=q,S.sample=eM,S.size=nM,S.snakeCase=$F,S.some=iM,S.sortedIndex=tD,S.sortedIndexBy=rD,S.sortedIndexOf=nD,S.sortedLastIndex=iD,S.sortedLastIndexBy=sD,S.sortedLastIndexOf=aD,S.startCase=VF,S.startsWith=WF,S.subtract=F2,S.sum=L2,S.sumBy=j2,S.template=zF,S.times=_2,S.toFinite=Mi,S.toInteger=lt,S.toLength=Y_,S.toLower=HF,S.toNumber=Qn,S.toSafeInteger=HM,S.toString=$t,S.toUpper=GF,S.trim=QF,S.trimEnd=JF,S.trimStart=YF,S.truncate=KF,S.unescape=ZF,S.uniqueId=S2,S.upperCase=XF,S.upperFirst=Sp,S.each=F_,S.eachRight=L_,S.first=N_,Tp(S,function(){var s={};return fi(S,function(o,l){Bt.call(S.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),S.VERSION=n,Bn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){S[s].placeholder=S}),Bn(["drop","take"],function(s,o){bt.prototype[s]=function(l){l=l===t?1:Cr(lt(l),0);var p=this.__filtered__&&!o?new bt(this):this.clone();return p.__filtered__?p.__takeCount__=Gr(l,p.__takeCount__):p.__views__.push({size:Gr(l,Oe),type:s+(p.__dir__<0?"Right":"")}),p},bt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),Bn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==Ie||l==Be;bt.prototype[s]=function(v){var T=this.clone();return T.__iteratees__.push({iteratee:He(v,3),type:l}),T.__filtered__=T.__filtered__||p,T}}),Bn(["head","last"],function(s,o){var l="take"+(o?"Right":"");bt.prototype[s]=function(){return this[l](1).value()[0]}}),Bn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");bt.prototype[s]=function(){return this.__filtered__?new bt(this):this[l](1)}}),bt.prototype.compact=function(){return this.filter(pn)},bt.prototype.find=function(s){return this.filter(s).head()},bt.prototype.findLast=function(s){return this.reverse().find(s)},bt.prototype.invokeMap=dt(function(s,o){return typeof s=="function"?new bt(this):this.map(function(l){return Ho(l,s,o)})}),bt.prototype.reject=function(s){return this.filter(rl(He(s)))},bt.prototype.slice=function(s,o){s=lt(s);var l=this;return l.__filtered__&&(s>0||o<0)?new bt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=lt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},bt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},bt.prototype.toArray=function(){return this.take(Oe)},fi(bt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=S[p?"take"+(o=="last"?"Right":""):o],T=p||/^find/.test(o);v&&(S.prototype[o]=function(){var N=this.__wrapped__,L=p?[1]:arguments,$=N instanceof bt,se=L[0],oe=$||ut(N),pe=function(gt){var St=v.apply(S,as([gt],L));return p&&ke?St[0]:St};oe&&l&&typeof se=="function"&&se.length!=1&&($=oe=!1);var ke=this.__chain__,$e=!!this.__actions__.length,Qe=T&&!ke,ht=$&&!$e;if(!T&&oe){N=ht?N:new bt(this);var Je=s.apply(N,L);return Je.__actions__.push({func:Zc,args:[pe],thisArg:t}),new Wn(Je,ke)}return Qe&&ht?s.apply(this,L):(Je=this.thru(pe),Qe?p?Je.value()[0]:Je.value():Je)})}),Bn(["pop","push","shift","sort","splice","unshift"],function(s){var o=Ec[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);S.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var T=this.value();return o.apply(ut(T)?T:[],v)}return this[l](function(N){return o.apply(ut(N)?N:[],v)})}}),fi(bt.prototype,function(s,o){var l=S[o];if(l){var p=l.name+"";Bt.call(Na,p)||(Na[p]=[]),Na[p].push({name:o,func:l})}}),Na[zc(t,w).name]=[{name:"wrapper",func:t}],bt.prototype.clone=ZP,bt.prototype.reverse=XP,bt.prototype.value=eN,S.prototype.at=ID,S.prototype.chain=CD,S.prototype.commit=PD,S.prototype.next=ND,S.prototype.plant=DD,S.prototype.reverse=MD,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=FD,S.prototype.first=S.prototype.head,qo&&(S.prototype[qo]=RD),S},Ia=PP();Ps?((Ps.exports=Ia)._=Ia,Od._=Ia):Br._=Ia}).call(pi)}(ec,ec.exports);var eA=ec.exports;const ci=Pp(eA),Wv=me.createContext(),zv=me.createContext(),Hv=me.createContext(),tA=({children:r})=>{const[e,t]=mn.useSearchParams(),[n,i]=me.useState(Object.fromEntries(e.entries())),[a,u]=me.useState({});me.useEffect(()=>{const h=Object.fromEntries(e.entries());i(h)},[e]),me.useEffect(()=>{Object.keys(a).length>0&&(t(h=>{const d=new URLSearchParams(h);return Object.entries(a).forEach(([y,g])=>{g==null||g===""?d.delete(y):d.set(y,g)}),d}),u({}))},[a,t]);const c=h=>{i(d=>({...d,...h})),u(d=>({...d,...h}))},f=me.useMemo(()=>[Object.fromEntries(e.entries()),c],[e]);return ar.jsx(Hv.Provider,{value:f,children:r})},fa=me.createContext(),rA=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=me.useContext(Hv),c=i[r]??e;return[c&&t(c),d=>{if(typeof d=="function"){const g=i[r];d=d(t(g??e))}const y=n(d);a({[r]:y})}]},bo=async(r,e,t)=>{me.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},nA=(r,e,t)=>{const n=me.useRef(r);me.useEffect(()=>{n.current=r},[r]);const i=me.useCallback(ci.throttle(()=>{n.current()},e),[]);me.useEffect(i,[...t])},wo=(r,e=null,t)=>{const n=me.useRef(r);me.useEffect(()=>{n.current=r},[r]),bo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},Gv=(r,e,t)=>{const[n,i]=me.useState(),[a,u]=me.useState(!0),[c,f]=me.useState(),{urls:h,request:d}=ti();return wo(async y=>{try{const g={signal:y,...e||{}};if(g.skip)return;const m=await d(`${h.apiUrl}${r}`,g);i(m)}catch(g){f(g)}u(!1)},t,[r,e]),{data:n,error:c,loading:a}},iA=(r,e)=>{const[t,n]=me.useState(),[i,a]=me.useState(!0),[u,c]=me.useState(null),[f,h]=me.useState(),{urls:d,request:y}=ti();return me.useEffect(()=>{a(u===null||u>0)},[u]),wo(async g=>{try{if(!r)return;c(b=>(b||0)+1);const m=await y(`${d.apiUrl}/reports/production`,{method:"POST",body:r,signal:g});h(null),n(m)}catch(m){m.name!=="AbortError"&&h(m)}c(m=>m-1)},e,[r]),{data:t,error:f,loading:i}},sA=({machineRef:r,key:e,skip:t})=>{const[n,i]=me.useState(),[a,u]=me.useState(),[c,f]=me.useState(),[h,d]=me.useState(),[y,g]=me.useState(),[m,b]=me.useState(),A=Qi`
112
+ }`;var ht=ax(function(){return Ft(T,$e+"return "+pe).apply(t,N)});if(ht.source=pe,bp(ht))throw ht;return ht}function HF(s){return $t(s).toLowerCase()}function GF(s){return $t(s).toUpperCase()}function QF(s,o,l){if(s=$t(s),s&&(l||o===t))return mw(s);if(!s||!(o=An(o)))return s;var p=ii(s),v=ii(o),T=yw(p,v),N=gw(p,v)+1;return hs(p,T,N).join("")}function JF(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,bw(s)+1);if(!s||!(o=An(o)))return s;var p=ii(s),v=gw(p,ii(o))+1;return hs(p,0,v).join("")}function YF(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(kr,"");if(!s||!(o=An(o)))return s;var p=ii(s),v=yw(p,ii(o));return hs(p,v).join("")}function KF(s,o){var l=fe,p=ge;if(lr(o)){var v="separator"in o?o.separator:v;l="length"in o?lt(o.length):l,p="omission"in o?An(o.omission):p}s=$t(s);var T=s.length;if(Aa(s)){var N=ii(s);T=N.length}if(l>=T)return s;var L=l-ka(p);if(L<1)return p;var $=N?hs(N,0,L).join(""):s.slice(0,L);if(v===t)return $+p;if(N&&(L+=$.length-L),wp(v)){if(s.slice(L).search(v)){var se,oe=$;for(v.global||(v=Fd(v.source,$t(Ue.exec(v))+"g")),v.lastIndex=0;se=v.exec(oe);)var pe=se.index;$=$.slice(0,pe===t?L:pe)}}else if(s.indexOf(An(v),L)!=L){var ke=$.lastIndexOf(v);ke>-1&&($=$.slice(0,ke))}return $+p}function ZF(s){return s=$t(s),s&&Ur.test(s)?s.replace(Mt,AP):s}var XF=Ma(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Sp=o_("toUpperCase");function sx(s,o,l){return s=$t(s),o=l?t:o,o===t?xP(s)?CP(s):dP(s):s.match(o)||[]}var ax=dt(function(s,o){try{return On(s,t,o)}catch(l){return bp(l)?l:new at(l)}}),e2=Ni(function(s,o){return Bn(o,function(l){l=di(l),Ci(s,l,gp(s[l],s))}),s});function t2(s){var o=s==null?0:s.length,l=He();return s=o?sr(s,function(p){if(typeof p[1]!="function")throw new Vn(u);return[l(p[0]),p[1]]}):[],dt(function(p){for(var v=-1;++v<o;){var T=s[v];if(On(T[0],this,p))return On(T[1],this,p)}})}function r2(s){return AN(zn(s,y))}function Ep(s){return function(){return s}}function n2(s,o){return s==null||s!==s?o:s}var i2=c_(),s2=c_(!0);function pn(s){return s}function Op(s){return qw(typeof s=="function"?s:zn(s,y))}function a2(s){return $w(zn(s,y))}function o2(s,o){return Bw(s,zn(o,y))}var u2=dt(function(s,o){return function(l){return Ho(l,s,o)}}),c2=dt(function(s,o){return function(l){return Ho(s,l,o)}});function Tp(s,o,l){var p=Lr(o),v=Uc(o,p);l==null&&!(lr(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=Uc(o,Lr(o)));var T=!(lr(l)&&"chain"in l)||!!l.chain,N=Di(s);return Bn(v,function(L){var $=o[L];s[L]=$,N&&(s.prototype[L]=function(){var se=this.__chain__;if(T||se){var oe=s(this.__wrapped__),pe=oe.__actions__=fn(this.__actions__);return pe.push({func:$,args:arguments,thisArg:s}),oe.__chain__=se,oe}return $.apply(s,as([this.value()],arguments))})}),s}function l2(){return Br._===this&&(Br._=FP),this}function Ap(){}function f2(s){return s=lt(s),dt(function(o){return Vw(o,s)})}var h2=ip(sr),d2=ip(lw),p2=ip(Id);function ox(s){return fp(s)?Cd(di(s)):WN(s)}function m2(s){return function(o){return s==null?t:Fs(s,o)}}var y2=f_(),g2=f_(!0);function kp(){return[]}function Ip(){return!1}function v2(){return{}}function b2(){return""}function w2(){return!0}function _2(s,o){if(s=lt(s),s<1||s>ce)return[];var l=Oe,p=Gr(s,Oe);o=He(o),s-=Oe;for(var v=Rd(p,o);++l<s;)o(l);return v}function x2(s){return ut(s)?sr(s,di):kn(s)?[s]:fn(A_($t(s)))}function S2(s){var o=++DP;return $t(s)+o}var E2=Hc(function(s,o){return s+o},0),O2=sp("ceil"),T2=Hc(function(s,o){return s/o},1),A2=sp("floor");function k2(s){return s&&s.length?qc(s,pn,Wd):t}function I2(s,o){return s&&s.length?qc(s,He(o,2),Wd):t}function C2(s){return dw(s,pn)}function P2(s,o){return dw(s,He(o,2))}function N2(s){return s&&s.length?qc(s,pn,Qd):t}function R2(s,o){return s&&s.length?qc(s,He(o,2),Qd):t}var D2=Hc(function(s,o){return s*o},1),M2=sp("round"),F2=Hc(function(s,o){return s-o},0);function L2(s){return s&&s.length?Nd(s,pn):0}function j2(s,o){return s&&s.length?Nd(s,He(o,2)):0}return S.after=aM,S.ary=j_,S.assign=GM,S.assignIn=Z_,S.assignInWith=sl,S.assignWith=QM,S.at=JM,S.before=q_,S.bind=gp,S.bindAll=e2,S.bindKey=U_,S.castArray=vM,S.chain=M_,S.chunk=AR,S.compact=kR,S.concat=IR,S.cond=t2,S.conforms=r2,S.constant=Ep,S.countBy=LD,S.create=YM,S.curry=$_,S.curryRight=B_,S.debounce=V_,S.defaults=KM,S.defaultsDeep=ZM,S.defer=oM,S.delay=uM,S.difference=CR,S.differenceBy=PR,S.differenceWith=NR,S.drop=RR,S.dropRight=DR,S.dropRightWhile=MR,S.dropWhile=FR,S.fill=LR,S.filter=qD,S.flatMap=BD,S.flatMapDeep=VD,S.flatMapDepth=WD,S.flatten=P_,S.flattenDeep=jR,S.flattenDepth=qR,S.flip=cM,S.flow=i2,S.flowRight=s2,S.fromPairs=UR,S.functions=sF,S.functionsIn=aF,S.groupBy=zD,S.initial=BR,S.intersection=VR,S.intersectionBy=WR,S.intersectionWith=zR,S.invert=uF,S.invertBy=cF,S.invokeMap=GD,S.iteratee=Op,S.keyBy=QD,S.keys=Lr,S.keysIn=dn,S.map=Xc,S.mapKeys=fF,S.mapValues=hF,S.matches=a2,S.matchesProperty=o2,S.memoize=tl,S.merge=dF,S.mergeWith=X_,S.method=u2,S.methodOf=c2,S.mixin=Tp,S.negate=rl,S.nthArg=f2,S.omit=pF,S.omitBy=mF,S.once=lM,S.orderBy=JD,S.over=h2,S.overArgs=fM,S.overEvery=d2,S.overSome=p2,S.partial=vp,S.partialRight=W_,S.partition=YD,S.pick=yF,S.pickBy=ex,S.property=ox,S.propertyOf=m2,S.pull=JR,S.pullAll=R_,S.pullAllBy=YR,S.pullAllWith=KR,S.pullAt=ZR,S.range=y2,S.rangeRight=g2,S.rearg=hM,S.reject=XD,S.remove=XR,S.rest=dM,S.reverse=mp,S.sampleSize=tM,S.set=vF,S.setWith=bF,S.shuffle=rM,S.slice=eD,S.sortBy=sM,S.sortedUniq=oD,S.sortedUniqBy=uD,S.split=BF,S.spread=pM,S.tail=cD,S.take=lD,S.takeRight=fD,S.takeRightWhile=hD,S.takeWhile=dD,S.tap=kD,S.throttle=mM,S.thru=Zc,S.toArray=J_,S.toPairs=tx,S.toPairsIn=rx,S.toPath=x2,S.toPlainObject=K_,S.transform=wF,S.unary=yM,S.union=pD,S.unionBy=mD,S.unionWith=yD,S.uniq=gD,S.uniqBy=vD,S.uniqWith=bD,S.unset=_F,S.unzip=yp,S.unzipWith=D_,S.update=xF,S.updateWith=SF,S.values=ja,S.valuesIn=EF,S.without=wD,S.words=sx,S.wrap=gM,S.xor=_D,S.xorBy=xD,S.xorWith=SD,S.zip=ED,S.zipObject=OD,S.zipObjectDeep=TD,S.zipWith=AD,S.entries=tx,S.entriesIn=rx,S.extend=Z_,S.extendWith=sl,Tp(S,S),S.add=E2,S.attempt=ax,S.camelCase=kF,S.capitalize=nx,S.ceil=O2,S.clamp=OF,S.clone=bM,S.cloneDeep=_M,S.cloneDeepWith=xM,S.cloneWith=wM,S.conformsTo=SM,S.deburr=ix,S.defaultTo=n2,S.divide=T2,S.endsWith=IF,S.eq=ai,S.escape=CF,S.escapeRegExp=PF,S.every=jD,S.find=UD,S.findIndex=I_,S.findKey=XM,S.findLast=$D,S.findLastIndex=C_,S.findLastKey=eF,S.floor=A2,S.forEach=F_,S.forEachRight=L_,S.forIn=tF,S.forInRight=rF,S.forOwn=nF,S.forOwnRight=iF,S.get=_p,S.gt=EM,S.gte=OM,S.has=oF,S.hasIn=xp,S.head=N_,S.identity=pn,S.includes=HD,S.indexOf=$R,S.inRange=TF,S.invoke=lF,S.isArguments=qs,S.isArray=ut,S.isArrayBuffer=TM,S.isArrayLike=hn,S.isArrayLikeObject=gr,S.isBoolean=AM,S.isBuffer=ds,S.isDate=kM,S.isElement=IM,S.isEmpty=CM,S.isEqual=PM,S.isEqualWith=NM,S.isError=bp,S.isFinite=RM,S.isFunction=Di,S.isInteger=z_,S.isLength=nl,S.isMap=H_,S.isMatch=DM,S.isMatchWith=MM,S.isNaN=FM,S.isNative=LM,S.isNil=qM,S.isNull=jM,S.isNumber=G_,S.isObject=lr,S.isObjectLike=pr,S.isPlainObject=Zo,S.isRegExp=wp,S.isSafeInteger=UM,S.isSet=Q_,S.isString=il,S.isSymbol=kn,S.isTypedArray=La,S.isUndefined=$M,S.isWeakMap=BM,S.isWeakSet=VM,S.join=HR,S.kebabCase=NF,S.last=Gn,S.lastIndexOf=GR,S.lowerCase=RF,S.lowerFirst=DF,S.lt=WM,S.lte=zM,S.max=k2,S.maxBy=I2,S.mean=C2,S.meanBy=P2,S.min=N2,S.minBy=R2,S.stubArray=kp,S.stubFalse=Ip,S.stubObject=v2,S.stubString=b2,S.stubTrue=w2,S.multiply=D2,S.nth=QR,S.noConflict=l2,S.noop=Ap,S.now=el,S.pad=MF,S.padEnd=FF,S.padStart=LF,S.parseInt=jF,S.random=AF,S.reduce=KD,S.reduceRight=ZD,S.repeat=qF,S.replace=UF,S.result=gF,S.round=M2,S.runInContext=q,S.sample=eM,S.size=nM,S.snakeCase=$F,S.some=iM,S.sortedIndex=tD,S.sortedIndexBy=rD,S.sortedIndexOf=nD,S.sortedLastIndex=iD,S.sortedLastIndexBy=sD,S.sortedLastIndexOf=aD,S.startCase=VF,S.startsWith=WF,S.subtract=F2,S.sum=L2,S.sumBy=j2,S.template=zF,S.times=_2,S.toFinite=Mi,S.toInteger=lt,S.toLength=Y_,S.toLower=HF,S.toNumber=Qn,S.toSafeInteger=HM,S.toString=$t,S.toUpper=GF,S.trim=QF,S.trimEnd=JF,S.trimStart=YF,S.truncate=KF,S.unescape=ZF,S.uniqueId=S2,S.upperCase=XF,S.upperFirst=Sp,S.each=F_,S.eachRight=L_,S.first=N_,Tp(S,function(){var s={};return fi(S,function(o,l){Bt.call(S.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),S.VERSION=n,Bn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){S[s].placeholder=S}),Bn(["drop","take"],function(s,o){bt.prototype[s]=function(l){l=l===t?1:Cr(lt(l),0);var p=this.__filtered__&&!o?new bt(this):this.clone();return p.__filtered__?p.__takeCount__=Gr(l,p.__takeCount__):p.__views__.push({size:Gr(l,Oe),type:s+(p.__dir__<0?"Right":"")}),p},bt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),Bn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==Ie||l==Be;bt.prototype[s]=function(v){var T=this.clone();return T.__iteratees__.push({iteratee:He(v,3),type:l}),T.__filtered__=T.__filtered__||p,T}}),Bn(["head","last"],function(s,o){var l="take"+(o?"Right":"");bt.prototype[s]=function(){return this[l](1).value()[0]}}),Bn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");bt.prototype[s]=function(){return this.__filtered__?new bt(this):this[l](1)}}),bt.prototype.compact=function(){return this.filter(pn)},bt.prototype.find=function(s){return this.filter(s).head()},bt.prototype.findLast=function(s){return this.reverse().find(s)},bt.prototype.invokeMap=dt(function(s,o){return typeof s=="function"?new bt(this):this.map(function(l){return Ho(l,s,o)})}),bt.prototype.reject=function(s){return this.filter(rl(He(s)))},bt.prototype.slice=function(s,o){s=lt(s);var l=this;return l.__filtered__&&(s>0||o<0)?new bt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=lt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},bt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},bt.prototype.toArray=function(){return this.take(Oe)},fi(bt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=S[p?"take"+(o=="last"?"Right":""):o],T=p||/^find/.test(o);v&&(S.prototype[o]=function(){var N=this.__wrapped__,L=p?[1]:arguments,$=N instanceof bt,se=L[0],oe=$||ut(N),pe=function(gt){var St=v.apply(S,as([gt],L));return p&&ke?St[0]:St};oe&&l&&typeof se=="function"&&se.length!=1&&($=oe=!1);var ke=this.__chain__,$e=!!this.__actions__.length,Qe=T&&!ke,ht=$&&!$e;if(!T&&oe){N=ht?N:new bt(this);var Je=s.apply(N,L);return Je.__actions__.push({func:Zc,args:[pe],thisArg:t}),new Wn(Je,ke)}return Qe&&ht?s.apply(this,L):(Je=this.thru(pe),Qe?p?Je.value()[0]:Je.value():Je)})}),Bn(["pop","push","shift","sort","splice","unshift"],function(s){var o=Ec[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);S.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var T=this.value();return o.apply(ut(T)?T:[],v)}return this[l](function(N){return o.apply(ut(N)?N:[],v)})}}),fi(bt.prototype,function(s,o){var l=S[o];if(l){var p=l.name+"";Bt.call(Na,p)||(Na[p]=[]),Na[p].push({name:o,func:l})}}),Na[zc(t,w).name]=[{name:"wrapper",func:t}],bt.prototype.clone=ZP,bt.prototype.reverse=XP,bt.prototype.value=eN,S.prototype.at=ID,S.prototype.chain=CD,S.prototype.commit=PD,S.prototype.next=ND,S.prototype.plant=DD,S.prototype.reverse=MD,S.prototype.toJSON=S.prototype.valueOf=S.prototype.value=FD,S.prototype.first=S.prototype.head,qo&&(S.prototype[qo]=RD),S},Ia=PP();Ps?((Ps.exports=Ia)._=Ia,Od._=Ia):Br._=Ia}).call(pi)}(ec,ec.exports);var eA=ec.exports;const ci=Pp(eA),Wv=me.createContext(),zv=me.createContext(),Hv=me.createContext(),tA=({children:r})=>{const[e,t]=mn.useSearchParams(),[n,i]=me.useState(Object.fromEntries(e.entries())),[a,u]=me.useState({});me.useEffect(()=>{const h=Object.fromEntries(e.entries());i(h)},[e]),me.useEffect(()=>{Object.keys(a).length>0&&(t(h=>{const d=new URLSearchParams(h);return Object.entries(a).forEach(([y,g])=>{g==null||g===""?d.delete(y):d.set(y,g)}),d}),u({}))},[a,t]);const c=h=>{i(d=>({...d,...h})),u(d=>({...d,...h}))},f=me.useMemo(()=>[Object.fromEntries(e.entries()),c],[e]);return ar.jsx(Hv.Provider,{value:f,children:r})},fa=me.createContext(),rA=(r,e,t=i=>i,n=i=>i)=>{const[i,a]=me.useContext(Hv),u=i[r];return[u?t(u):e,h=>{if(typeof h=="function"){const y=i[r];h=h(t(y??e))}const d=n(h);a({[r]:d})}]},bo=async(r,e,t)=>{me.useEffect(()=>{const n=new window.AbortController;async function i(){return await r(n.signal)}return i(),()=>{n.abort(),t&&t()}},[...e])},nA=(r,e,t)=>{const n=me.useRef(r);me.useEffect(()=>{n.current=r},[r]);const i=me.useCallback(ci.throttle(()=>{n.current()},e),[]);me.useEffect(i,[...t])},wo=(r,e=null,t)=>{const n=me.useRef(r);me.useEffect(()=>{n.current=r},[r]),bo(async i=>{let a;const u=async()=>{await n.current(i),e!==null&&(a=setTimeout(u,e))};return u(),()=>a&&clearTimeout(a)},[e,...t])},Gv=(r,e,t)=>{const[n,i]=me.useState(),[a,u]=me.useState(!0),[c,f]=me.useState(),{urls:h,request:d}=ti();return wo(async y=>{try{const g={signal:y,...e||{}};if(g.skip)return;const m=await d(`${h.apiUrl}${r}`,g);i(m)}catch(g){f(g)}u(!1)},t,[r,e]),{data:n,error:c,loading:a}},iA=(r,e)=>{const[t,n]=me.useState(),[i,a]=me.useState(!0),[u,c]=me.useState(null),[f,h]=me.useState(),{urls:d,request:y}=ti();return me.useEffect(()=>{a(u===null||u>0)},[u]),wo(async g=>{try{if(!r)return;c(b=>(b||0)+1);const m=await y(`${d.apiUrl}/reports/production`,{method:"POST",body:r,signal:g});h(null),n(m)}catch(m){m.name!=="AbortError"&&h(m)}c(m=>m-1)},e,[r]),{data:t,error:f,loading:i}},sA=({machineRef:r,key:e,skip:t})=>{const[n,i]=me.useState(),[a,u]=me.useState(),[c,f]=me.useState(),[h,d]=me.useState(),[y,g]=me.useState(),[m,b]=me.useState(),A=Qi`
113
113
  subscription MMToolsQuantityStreamSubscription {
114
114
  currentQuantities(
115
115
  where: { machineRef: { _eq: ${y} }, key: { _eq: "${m}" } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-react-tools",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Components, hooks, and helper functions for writing React apps using MachineMetrics APIs.",
5
5
  "author": "machinemetrics",
6
6
  "license": "MIT",