"use strict";(globalThis.webpackChunk_palladium_ethiopia_esm_patient_medications_app=globalThis.webpackChunk_palladium_ethiopia_esm_patient_medications_app||[]).push([["2152"],{52470(e,t,r){r.r(t),r.d(t,{default:()=>k,infinite:()=>m,unstable_serialize:()=>b});var a=r(93763),l=r(85216),i=r(90549),n=r(42372),u=r(58139);let s=()=>{},o=s(),c=Object,f=e=>e===o,p=new WeakMap,_=(e,t)=>e===`[object ${t}]`,d=0,g=e=>{let t,r,a=typeof e,l=c.prototype.toString.call(e),i=_(l,"Date"),n=_(l,"RegExp"),u=_(l,"Object");if(c(e)!==e||i||n)t=i?e.toJSON():"symbol"==a?e.toString():"string"==a?JSON.stringify(e):""+e;else{if(t=p.get(e))return t;if(t=++d+"~",p.set(e,t),Array.isArray(e)){for(r=0,t="@";r<e.length;r++)t+=g(e[r])+",";p.set(e,t)}if(u){t="#";let a=c.keys(e).sort();for(;!f(r=a.pop());)f(e[r])||(t+=r+":"+g(e[r])+",");p.set(e,t)}}return t},y=e=>(e=>{if("function"==typeof e)try{e=e()}catch(t){e=""}let t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?g(e):"",t]})(e?e(0,null):null)[0],b=e=>"$inf$"+y(e),h=Promise.resolve(),m=e=>(t,r,l)=>{let n,s=(0,a.useRef)(!1),{cache:o,initialSize:c=1,revalidateAll:f=!1,persistSize:p=!1,revalidateFirstPage:_=!0,revalidateOnMount:d=!1,parallel:g=!1}=l,[,,,b]=i.b.get(i.c);try{(n=y(t))&&(n="$inf$"+n)}catch(e){}let[m,k,z]=(0,i.z)(o,n),v=(0,a.useCallback)(()=>(0,i.e)(m()._l)?c:m()._l,[o,n,c]);(0,u.useSyncExternalStore)((0,a.useCallback)(e=>n?z(n,()=>{e()}):()=>{},[o,n]),v,v);let w=(0,a.useCallback)(()=>{let e=m()._l;return(0,i.e)(e)?c:e},[n,c]),C=(0,a.useRef)(w());(0,i.u)(()=>{if(!s.current){s.current=!0;return}n&&k({_l:p?C.current:w()})},[n,o]);let S=d&&!s.current,A=e(n,async e=>{let a=m()._i,n=m()._r;k({_r:i.U});let u=[],s=w(),[c]=(0,i.z)(o,e),p=c().data,d=[],y=null;for(let e=0;e<s;++e){let[s,c]=(0,i.s)(t(e,g?null:y));if(!s)break;let[h,m]=(0,i.z)(o,s),k=h().data,z=f||a||(0,i.e)(k)||_&&!e&&!(0,i.e)(p)||S||p&&!(0,i.e)(p[e])&&!l.compare(p[e],k);if(r&&("function"==typeof n?n(k,c):z)){let t=async()=>{if(s in b){let e=b[s];delete b[s],k=await e}else k=await r(c);m({data:k,_k:c}),u[e]=k};g?d.push(t):await t()}else u[e]=k;g||(y=k)}return g&&await Promise.all(d.map(e=>e())),k({_i:i.U}),u},l),$=(0,a.useCallback)(function(e,t){let r="boolean"==typeof t?{revalidate:t}:t||{},a=!1!==r.revalidate;return n?(a&&((0,i.e)(e)?k({_i:!0,_r:r.revalidate}):k({_i:!1,_r:r.revalidate})),arguments.length?A.mutate(e,{...r,revalidate:a}):A.mutate()):h},[n,o]),O=(0,a.useCallback)(e=>{let r;if(!n)return h;let[,a]=(0,i.z)(o,n);if((0,i.a)(e)?r=e(w()):"number"==typeof e&&(r=e),"number"!=typeof r)return h;a({_l:r}),C.current=r;let l=[],[u]=(0,i.z)(o,n),s=null;for(let e=0;e<r;++e){let[r]=(0,i.s)(t(e,s)),[a]=(0,i.z)(o,r),n=r?a().data:i.U;if((0,i.e)(n))return $(u().data);l.push(n),s=n}return $(l)},[n,o,$,w]);return{size:w(),setSize:O,mutate:$,get data(){return A.data},get error(){return A.error},get isValidating(){return A.isValidating},get isLoading(){return A.isLoading}}},k=(0,n.Ht)(l.Ay,m)}}]);