import{r as c}from"./index-BP8_t0zE.js";import{R as j}from"./ResourceContextProvider-_t2ysSg2.js";import{e as z,Z as K,t as V,v as f}from"./defaultI18nProvider-C_r1y4tu.js";import{d as k}from"./debounce-0x2xWYwC.js";var M=function(e,r){r===void 0&&(r=250);var o=q(e,r),n=o[0],i=o[1],l=z();c.useEffect(function(){var u;n!=null&&((u=l.state)===null||u===void 0?void 0:u._scrollToTop)!==!0&&(i(void 0),window.scrollTo(0,n))},[])},q=function(e,r){r===void 0&&(r=250);var o=K(e),n=o[0],i=o[1];return c.useEffect(function(){if(!(typeof window>"u")){var l=k(function(){i(window.scrollY)},r);return window.addEventListener("scroll",l),function(){window.removeEventListener("scroll",l)}}},[r,i]),[n,i]},A=function(e){var r=e.children,o=e.storeKey,n=e.debounce,i=n===void 0?250:n;return M(o,i),r},x={exports:{}},t={};/**
 * @license React
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var $=Symbol.for("react.element"),R=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),v=Symbol.for("react.context"),N=Symbol.for("react.server_context"),h=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),P;P=Symbol.for("react.module.reference");function s(e){if(typeof e=="object"&&e!==null){var r=e.$$typeof;switch(r){case $:switch(e=e.type,e){case m:case y:case d:case S:case w:return e;default:switch(e=e&&e.$$typeof,e){case N:case v:case h:case b:case E:case p:return e;default:return r}}case R:return r}}}t.ContextConsumer=v;t.ContextProvider=p;t.Element=$;t.ForwardRef=h;t.Fragment=m;t.Lazy=b;t.Memo=E;t.Portal=R;t.Profiler=y;t.StrictMode=d;t.Suspense=S;t.SuspenseList=w;t.isAsyncMode=function(){return!1};t.isConcurrentMode=function(){return!1};t.isContextConsumer=function(e){return s(e)===v};t.isContextProvider=function(e){return s(e)===p};t.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===$};t.isForwardRef=function(e){return s(e)===h};t.isFragment=function(e){return s(e)===m};t.isLazy=function(e){return s(e)===b};t.isMemo=function(e){return s(e)===E};t.isPortal=function(e){return s(e)===R};t.isProfiler=function(e){return s(e)===y};t.isStrictMode=function(e){return s(e)===d};t.isSuspense=function(e){return s(e)===S};t.isSuspenseList=function(e){return s(e)===w};t.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===m||e===y||e===d||e===S||e===w||e===Y||typeof e=="object"&&e!==null&&(e.$$typeof===b||e.$$typeof===E||e.$$typeof===p||e.$$typeof===v||e.$$typeof===h||e.$$typeof===P||e.getModuleId!==void 0)};t.typeOf=s;x.exports=t;var Z=x.exports,g=function(e){var r=e.create,o=e.edit,n=e.list,i=e.name,l=e.show;return c.createElement(j,{value:i},c.createElement(V,null,r&&c.createElement(f,{path:"create/*",element:a(r)}),l&&c.createElement(f,{path:":id/show/*",element:a(l)}),o&&c.createElement(f,{path:":id/*",element:a(o)}),n&&c.createElement(f,{path:"/*",element:c.createElement(A,{storeKey:"".concat(i,".list.scrollPosition")},a(n))}),e.children))},a=function(e){if(c.isValidElement(e))return e;if(Z.isValidElementType(e)){var r=e;return c.createElement(r,null)}return null};g.raName="Resource";g.registerResource=function(e){var r=e.create,o=e.edit,n=e.icon,i=e.list,l=e.name,u=e.options,C=e.show,L=e.recordRepresentation,T=e.hasCreate,F=e.hasEdit,I=e.hasShow;return{name:l,options:u,hasList:!!i,hasCreate:!!r||!!T,hasEdit:!!o||!!F,hasShow:!!C||!!I,icon:n,recordRepresentation:L}};export{g as R};
