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