"use strict";(self.webpackChunk_components_admin_1_1_41=self.webpackChunk_components_admin_1_1_41||[]).push([[628,8247],{20628(e,t,n){n.r(t),n.d(t,{Global:()=>P,GlobalSetting:()=>h,GlobalValue:()=>_,Preset:()=>g,PresetProvider:()=>v,Provider:()=>c,SelectProvider:()=>x,context:()=>s,createContext:()=>u,default:()=>s,presetContext:()=>d,selectorContext:()=>f,useContext:()=>a,useGlobalContext:()=>i,useGlobalValue:()=>m,usePreset:()=>b,useSelectorContext:()=>C});var r=n(5544),l=n(13732),o=n.n(l);const u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,l.createContext)(e),n=t.Provider,r=t.Consumer;return{context:t,Provider:n,Consumer:r,useContext:()=>(0,l.useContext)(t)}},s=u({}),c=s.Provider,a=s.useContext,i=a,d=u({}),v=d.Provider,b=d.useContext,f=function(){const e=u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),t=e.context,n=e.Provider,r=e.useContext;return{context:t,Provider:e=>{let t=e.value,r=e.children;const u=(0,l.useRef)();let s=u.current;if(!s){const e=new Set;s={value:t,subscribe:t=>(e.add(t),()=>e.delete(t)),notify:()=>e.forEach(e=>e())},u.current=s}return(0,l.useEffect)(()=>{Object.is(s.value,t)||(s.value=t,s.notify())}),o().createElement(n,{value:s},r)},useContext:e=>{const t=r();return(0,l.useSyncExternalStore)(t.subscribe||(()=>{}),()=>e(t.value))}}}({}),x=f.Provider,C=f.useContext,P=e=>{let t=e.preset,n=e.children,u=e.initValue;const s=(0,l.useState)(Object.assign({},u)),a=(0,r.A)(s,2),i=a[0],d=a[1],b=(0,l.useCallback)((e,t)=>{d(n=>Object.assign({},n,{[e]:"function"===typeof t?t(n[e]):t}))},[]);return o().createElement(c,{value:{global:i,setGlobal:d,setGlobalValue:b}},o().createElement(v,{value:t},o().createElement(x,{value:i},n)))},h=e=>{let t=e.loader,n=e.needReady,o=void 0===n||n,u=e.children;const s=(0,l.useState)(!1),c=(0,r.A)(s,2),i=c[0],d=c[1],v=a(),b=v.global,f=v.setGlobal,x=(0,l.useRef)(null),C=(0,l.useRef)(t);return(0,l.useEffect)(()=>{Promise.resolve(C.current).then(e=>{f(t=>{const n=Object.assign({},t,e);return x.current=n,n})})},[]),(0,l.useEffect)(()=>{b===x.current&&d(!0)},[b]),o&&!i?null:u},m=e=>C(t=>null==t?void 0:t[e]),_=e=>{let t=e.globalKey;return(0,e.children)({value:m(t)})},g=e=>(0,e.children)(b())}}]);
//# sourceMappingURL=8247.6c76e481.chunk.js.map