"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),g=require("react/jsx-runtime");function _(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const p=_(C);function j(e,n=[]){let t=[];function s(i,o){const c=p.createContext(o),r=t.length;t=[...t,o];const l=a=>{const{scope:x,children:d,...f}=a,S=x?.[e]?.[r]||c,b=p.useMemo(()=>f,Object.values(f));return g.jsx(S.Provider,{value:b,children:d})};l.displayName=i+"Provider";function m(a,x){const d=x?.[e]?.[r]||c,f=p.useContext(d);if(f)return f;if(o!==void 0)return o;throw new Error(`\`${a}\` must be used within \`${i}\``)}return[l,m]}const u=()=>{const i=t.map(o=>p.createContext(o));return function(c){const r=c?.[e]||i;return p.useMemo(()=>({[`__scope${e}`]:{...c,[e]:r}}),[c,r])}};return u.scopeName=e,[s,v(u,...n)]}function v(...e){const n=e[0];if(e.length===1)return n;const t=()=>{const s=e.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(i){const o=s.reduce((c,{useScope:r,scopeName:l})=>{const a=r(i)[`__scope${l}`];return{...c,...a}},{});return p.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return t.scopeName=n.scopeName,t}exports.createContextScope=j;
//# sourceMappingURL=index.cjs.js.map
