import{g as j,j as o}from"./assertThisInitialized-ClXgY4BW.js";import{a as C}from"./utils-CkyKHvS2.js";import{s as R,M as L}from"./defaultI18nProvider-C_r1y4tu.js";import{r as l}from"./index-BP8_t0zE.js";import{u as O,s as u,T as k}from"./TextField-n0Myx-gm.js";import{T as D}from"./Typography-E7d16C50.js";import{L as F,R as B}from"./ReferenceArrayField-ctaku4-6.js";import{u as M}from"./Button-C3j8Wgdd.js";import{u as V}from"./useRecordContext-CmNI-aHo.js";import{u as $}from"./useGetList-Dit6Yzrj.js";import{L as W}from"./ListBase-CEqRUlEo.js";import{D as X}from"./Datagrid-BK2vyqjN.js";import{B as Y,E as z,N as G,R as K}from"./ReferenceField-BimPKO3B.js";import{D as U}from"./DateField-Csy-M8g5.js";var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},c.apply(this,arguments)},q=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},H=function(e){var t,n,r=e.className,a=e.emptyText,s=e.title,i=e.src,p=e.target,y=e.download,g=e.ping,v=e.rel,f=q(e,["className","emptyText","title","src","target","download","ping","rel"]),d=O(e),b=(n=(t=O(c(c({},e),{source:s})))===null||t===void 0?void 0:t.toString())!==null&&n!==void 0?n:s,A=M();return d?Array.isArray(d)?l.createElement(Q,c({className:r},u(f)),d.map(function(x,S){var _=s&&j(x,s,s),I=i?j(x,i,s):s;return l.createElement("li",{key:S},l.createElement(F,{href:I,title:_,target:p,download:y,ping:g,rel:v,variant:"body2",onClick:function(T){return T.stopPropagation()}},_))})):l.createElement(h,c({className:r},u(f)),l.createElement(F,{href:d==null?void 0:d.toString(),title:b,target:p,download:y,ping:g,rel:v,variant:"body2"},b)):a?l.createElement(D,c({component:"span",variant:"body2",className:r},u(f)),a&&A(a,{_:a})):l.createElement(h,c({className:r},u(f)))},J="RaFileField",h=R("div",{name:J,overridesResolver:function(e,t){return t.root}})({display:"inline-block"}),Q=R("ul")({display:"inline-block"}),m=function(){return m=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},m.apply(this,arguments)},Z=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},ee=function(e){var t=e.className,n=e.source,r=n===void 0?"":n,a=e.render,s=Z(e,["className","source","render"]),i=V(e);return l.useMemo(function(){return i?l.createElement(D,m({component:"span",variant:"body2",className:t},u(s)),a(i,r)):null},[t,i,r,a,s])};const{useArgs:re}=__STORYBOOK_MODULE_PREVIEW_API__,E={BooleanField:()=>o.jsx(Y,{source:"active",sortable:!1}),DateField:()=>o.jsx(U,{source:"date",sortable:!1}),EmailField:()=>o.jsx(z,{source:"email",sortable:!1}),FileField:()=>o.jsx(H,{source:"url",title:"Presentation",sortable:!1}),FunctionField:()=>{const e=t=>o.jsxs("div",{children:["Custom render: ",t.name]});return o.jsx(ee,{source:"name",render:e,sortable:!1})},NumberField:()=>o.jsx(G,{source:"day_offs",sortable:!1}),ReferenceArrayField:()=>o.jsx(B,{source:"role_ids",reference:"roles",sortable:!1}),ReferenceField:()=>o.jsx(K,{source:"department_id",reference:"departments",sortable:!1}),TextField:()=>o.jsx(k,{source:"city",sortable:!1})},N=e=>o.jsx(C,{children:o.jsx(L,{initialEntries:["/"],children:o.jsx(e,{})})}),w=(e,t)=>{const{data:n}=$("users",{sort:{field:"id",order:"ASC"}}),r=t.title.split("/").pop(),a=r?Object.keys(E).findIndex(s=>s===r):void 0;return o.jsx(W,{resource:"users",children:o.jsx(X,{sx:a!==void 0?{position:"fixed",top:"50%",left:"50%",transform:`translateX(calc(-232px * ${a+.5})) translateY(-100%)`,"& .MuiTableCell-root":{minWidth:200,maxWidth:200},[`& .RaDatagrid-headerCell:not(.column-${t.args.source})`]:{filter:"blur(1.5px)"},[`& .RaDatagrid-rowCell:not(.column-${t.args.source})`]:{filter:"blur(1.5px)"}}:{},data:n==null?void 0:n.slice(0,2),bulkActionButtons:!1,sort:{field:"id",order:"DESC"},children:Object.entries(E).map(([s,i])=>t.title.match(s)?e():i())})})},P=e=>{const[t,n,r]=re();return"sortable"in t||n({...t,sortable:!1}),o.jsx(e,{})},ge=[(e,t)=>w(e,t),e=>N(e),e=>P(e)];N.__docgenInfo={description:"",methods:[],displayName:"adminContextDecorator"};w.__docgenInfo={description:"",methods:[],displayName:"listDecorator"};P.__docgenInfo={description:"",methods:[],displayName:"shadowArgsDecorator"};export{H as F,ee as a,N as b,ge as f,w as l,P as s};
