import{iv as T,hH as ae,h_ as _,hQ as we,hL as B,iW as re,iz as Me,hV as Te,hI as Ve,fH as e,bq as Fe,ck as y,cI as W,bd as U,bf as Ae,bg as Le,_ as Re,bc as De,bb as Pe,gH as V,jD as oe,G as ke,hU as le,an as $,bU as x,D as G,eW as Se,cv as Be,aD as p,bn as Q,Y as Z,cG as Y,aZ as de,jB as ze,gm as He,gJ as Ee,gv as Ne,ix as ce,eM as Oe,cz as z,eL as Ue,ef as qe,e2 as _e,iF as We,iY as $e,iG as Ge,iP as k,iH as J,iQ as ue,bJ as me,dx as K,jG as X,cx as Qe,aw as Ze,K as Ye,bp as Je,fP as O,i as H,eP as Ke,c0 as Xe,a$ as ge,hj as et,ee as tt,dG as nt,bA as st,bL as L,az as ee,X as it,hJ as at,hK as rt,i3 as ot,dO as lt,bo as te,h0 as dt}from"./strapi-ye6TfKul.js";import{a as he}from"./hooks-HNhkYcAB.js";const E=oe(ke).attrs({closeLabel:"Close",onClose:()=>{},shadow:"none"})`
  button {
    display: none;
  }
`,ct=oe(Y)`
  display: block;

  & > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
`,ut=n=>{const{formatMessage:s}=T(),i=le(n.name);let a;if(i&&(a=Array.isArray(i.value)?{results:i.value,meta:{missingCount:0}}:i.value),!a||a.results.length===0&&a.meta.missingCount===0)return e.jsxs(e.Fragment,{children:[e.jsx(W.Label,{action:n.labelAction,children:n.label}),e.jsx(x,{marginTop:1,children:e.jsx(E,{variant:"default",children:s({id:"content-manager.history.content.no-relations",defaultMessage:"No relations."})})})]});const{results:t,meta:r}=a;return e.jsxs(x,{children:[e.jsx(W.Label,{children:n.label}),t.length>0&&e.jsx(y,{direction:"column",gap:2,marginTop:1,alignItems:"stretch",children:t.map(o=>{const{targetModel:l}=n.attribute,c=`../${G}/${l}/${o.documentId}`,g=Se(o,n.mainField),j=l==="admin::user";return e.jsxs(y,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderColor:"neutral200",background:"neutral150",justifyContent:"space-between",children:[e.jsx(x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4,children:e.jsx(Be,{label:g,children:j?e.jsx(p,{children:g}):e.jsx(ct,{tag:Q,to:c,children:g})})}),e.jsx(Z,{status:o.status})]},o.documentId??o.id)})}),r.missingCount>0&&e.jsx(E,{marginTop:1,variant:"warning",title:s({id:"content-manager.history.content.missing-relations.title",defaultMessage:"{number, plural, =1 {Missing relation} other {{number} missing relations}}"},{number:r.missingCount}),children:s({id:"content-manager.history.content.missing-relations.message",defaultMessage:"{number, plural, =1 {It has} other {They have}} been deleted and can't be restored."},{number:r.missingCount})})]})},mt=(n,s)=>{const i=n.split("."),a={};let t=a;return i.forEach((r,o)=>{r==="__proto__"||r==="constructor"||(o===i.length-1?t[r]=s:t[r]=t[r]||{},t=t[r])}),a},gt=n=>{const{value:s}=le(n.name),i=s?.results??[],a=s?.meta??{missingCount:0},{formatMessage:t}=T(),o=re("CustomMediaInput",l=>l.fields).media;return e.jsxs(y,{direction:"column",gap:2,alignItems:"stretch",children:[e.jsx($,{method:"PUT",disabled:!0,initialValues:mt(n.name,i),children:e.jsx(o,{...n,disabled:!0,multiple:i.length>1})}),a.missingCount>0&&e.jsx(E,{variant:"warning",closeLabel:"Close",onClose:()=>{},title:t({id:"content-manager.history.content.missing-assets.title",defaultMessage:"{number, plural, =1 {Missing asset} other {{number} missing assets}}"},{number:a.missingCount}),children:t({id:"content-manager.history.content.missing-assets.message",defaultMessage:"{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored."},{number:a.missingCount})})]})},ht=n=>{if(!V.isValidElement(n))return n;const s=n.props.title.id;return s==="i18n.Field.localized"?V.cloneElement(n,{...n.props,title:{id:"history.content.localized",defaultMessage:"This value is specific to this locale. If you restore this version, the content will not be replaced for other locales."}}):s==="i18n.Field.not-localized"?V.cloneElement(n,{...n.props,title:{id:"history.content.not-localized",defaultMessage:"This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales."}}):n},N=({visible:n,hint:s,shouldIgnoreRBAC:i=!1,labelAction:a,...t})=>{const r=ht(a),{formatMessage:o}=T(),l=I("VersionContent",d=>d.selectedVersion),c=I("VersionContent",d=>d.configuration),g=he(d=>d["content-manager"].app.fieldSizes),{id:j,components:w}=ae(),u=_("InputRenderer",d=>d.disabled),f=we("isInDynamicZone",d=>d.isInDynamicZone),h=B("InputRenderer",d=>d.canCreateFields),F=B("InputRenderer",d=>d.canReadFields),M=B("InputRenderer",d=>d.canUpdateFields),A=B("InputRenderer",d=>d.canUserAction),b=j?M:h,R=j?F:h,D=A(t.name,R,t.type),m=A(t.name,b,t.type),S=re("InputRenderer",d=>d.fields),{lazyComponentStore:xe}=Me(q(t.attribute)?[t.attribute.customField]:void 0),v=Te(s,t.attribute),{edit:{components:pe}}=Ve();if(!n)return null;if(!i&&!D&&!f)return e.jsx(Fe,{hint:v,...t});const C=!m&&!f||t.disabled||u,je=l.meta.unknownAttributes.added;if(Object.keys(je).includes(t.name))return e.jsxs(y,{direction:"column",alignItems:"flex-start",gap:1,children:[e.jsx(W.Label,{children:t.label}),e.jsx(E,{width:"100%",closeLabel:"Close",onClose:()=>{},variant:"warning",title:o({id:"content-manager.history.content.new-field.title",defaultMessage:"New field"}),children:o({id:"content-manager.history.content.new-field.message",defaultMessage:"This field didn't exist when this version was saved. If you restore this version, it will be empty."})})]});if(q(t.attribute)){const d=xe[t.attribute.customField];return d?e.jsx(d,{...t,hint:v,labelAction:r,disabled:C}):e.jsx(U,{...t,hint:v,labelAction:r,type:t.attribute.customField,disabled:C})}if(t.type==="media")return e.jsx(gt,{...t,labelAction:r,disabled:C});const ve=Object.keys(S);if(!q(t.attribute)&&ve.includes(t.type)){const d=S[t.type];return e.jsx(d,{...t,hint:v,labelAction:r,disabled:C})}switch(t.type){case"blocks":return e.jsx(Pe,{...t,hint:v,type:t.type,disabled:C});case"component":const{layout:d}=pe[t.attribute.component],[Ce]=ye({layout:[d],metadatas:c.components[t.attribute.component].metadatas,fieldSizes:g,schemaAttributes:w[t.attribute.component].attributes});return e.jsx(De,{...t,layout:[...d,...Ce||[]],hint:v,labelAction:r,disabled:C,children:P=>e.jsx(N,{...P,shouldIgnoreRBAC:!0})});case"dynamiczone":return e.jsx(Re,{...t,hint:v,labelAction:r,disabled:C,children:P=>e.jsx(N,{...P,shouldIgnoreRBAC:!0})});case"relation":return e.jsx(ut,{...t,hint:v,labelAction:r,disabled:C});case"richtext":return e.jsx(Le,{...t,hint:v,type:t.type,labelAction:r,disabled:C});case"uid":return e.jsx(Ae,{...t,hint:v,type:t.type,labelAction:r,disabled:C});case"enumeration":return e.jsx(U,{...t,hint:v,labelAction:r,options:t.attribute.enum.map(P=>({value:P})),type:t.customField?"custom-field":t.type,disabled:C});default:const{unique:Ft,mainField:At,...Ie}=t;return e.jsx(U,{...Ie,hint:v,labelAction:r,type:t.customField?"custom-field":t.type,disabled:C})}},q=n=>"customField"in n&&typeof n.customField=="string",fe=n=>n.reduce((s,i)=>i.type==="dynamiczone"?(s.push([i]),s):(s[s.length-1]||s.push([]),s[s.length-1].push(i),s),[]).map(s=>[s]);function ye({layout:n,metadatas:s,schemaAttributes:i,fieldSizes:a}){const t=n.flatMap(o=>o.flatMap(l=>l.flatMap(c=>c.name))),r=Object.entries(s).reduce((o,[l,c])=>{if(!t.includes(l)&&c.edit.visible===!0){const g=i[l];o.push({attribute:g,type:g.type,visible:!0,disabled:!0,label:c.edit.label||l,name:l,size:a[g.type].default??12})}return o},[]);return fe(r)}const ft=qe(),yt=n=>{const s=new Set;for(const i of n)for(const a of i){const t=a.attribute?.conditions?.visible;if(!t)continue;const r=Ue(t);if(r===null)return null;for(const o of r)s.add(o)}return[...s].sort()},ne=({panel:n})=>{const s=ce(),i=V.useMemo(()=>yt(n),[n]),a=_("FormPanel",l=>l.getValues),t=_("FormPanel",l=>Oe(l.values,i)),r=i===null?t:a(),o=V.useCallback(l=>{const c=l.attribute?.conditions?.visible;return c?ft.evaluate(c,r):!0},[r]);if(n.some(l=>l.some(c=>c.type==="dynamiczone"))){const[l]=n,[c]=l;return o(c)?e.jsx(z.Root,{gap:4,children:e.jsx(z.Item,{xs:12,direction:"column",alignItems:"stretch",children:e.jsx(N,{...c})})},c.name):null}return e.jsx(x,{hasRadius:!s,background:{initial:"transparent",medium:"neutral0"},shadow:{initial:"none",medium:"tableShadow"},padding:{initial:0,medium:6},borderColor:{initial:"transparent",medium:"neutral150"},children:e.jsx(y,{direction:"column",alignItems:"stretch",gap:6,children:n.map((l,c)=>{const g=l.filter(o);return g.length===0?null:e.jsx(z.Root,{gap:{initial:6,medium:4},children:g.map(({size:j,...w})=>e.jsx(z.Item,{col:j,xs:12,direction:"column",alignItems:"stretch",children:e.jsx(N,{...w})},w.name))},c)})})})},bt=()=>{const{formatMessage:n}=T(),{fieldSizes:s}=he(u=>u["content-manager"].app),i=I("VersionContent",u=>u.selectedVersion),a=I("VersionContent",u=>u.layout),t=I("VersionContent",u=>u.configuration),r=I("VersionContent",u=>u.schema),o=i.meta.unknownAttributes.removed,l=Object.entries(o).map(([u,f])=>({attribute:f,shouldIgnoreRBAC:!0,type:f.type,visible:!0,disabled:!0,label:u,name:u,size:s[f.type].default??12})),c=fe(l),g=ye({metadatas:t.contentType.metadatas,layout:a,schemaAttributes:r.attributes,fieldSizes:s}),{components:j}=ae(),w=V.useMemo(()=>((f,h={})=>F=>{const M={attributes:f};return He(Ee(M),Ne(M,h))(F)})(i.schema,j)(i.data),[j,i.data,i.schema]);return e.jsx(de.Content,{children:e.jsxs(x,{paddingBottom:{initial:0,large:8},children:[e.jsx($,{disabled:!0,method:"PUT",initialValues:w,children:e.jsx(y,{direction:"column",alignItems:"stretch",gap:6,position:"relative",children:[...a,...g].map((u,f)=>e.jsx(ne,{panel:u},f))})},i.id),l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(x,{paddingTop:{initial:4,large:0},children:e.jsx(ze,{})}),e.jsxs(x,{paddingTop:{initial:4,large:8},children:[e.jsxs(y,{direction:"column",alignItems:"flex-start",paddingBottom:{initial:4,large:6},gap:1,children:[e.jsx(p,{variant:"delta",children:n({id:"content-manager.history.content.unknown-fields.title",defaultMessage:"Unknown fields"})}),e.jsx(p,{variant:"pi",children:n({id:"content-manager.history.content.unknown-fields.message",defaultMessage:"These fields have been deleted or renamed in the Content-Type Builder. <b>These fields will not be restored.</b>"},{b:u=>e.jsx(p,{variant:"pi",fontWeight:"bold",children:u})})})]}),e.jsx($,{disabled:!0,method:"PUT",initialValues:i.data,children:e.jsx(y,{direction:"column",alignItems:"stretch",gap:6,position:"relative",children:c.map((u,f)=>e.jsx(ne,{panel:u},f))})},`${i.id}-unknownFields`)]})]})]})})},xt=_e.injectEndpoints({endpoints:n=>({getHistoryVersions:n.query({query(s){return{url:"/content-manager/history-versions",method:"GET",config:{params:s}}},providesTags:["HistoryVersion"]}),restoreVersion:n.mutation({query({params:s,body:i}){return{url:`/content-manager/history-versions/${s.versionId}/restore`,method:"PUT",data:i}},invalidatesTags:(s,i,{documentId:a,collectionType:t,params:r})=>["HistoryVersion",{type:"Document",id:t===G?`${r.contentType}_${a}`:r.contentType}]})})}),{useGetHistoryVersionsQuery:pt,useRestoreVersionMutation:jt}=xt,vt=({headerId:n})=>{const[s,i]=V.useState(!1),a=We(),{formatMessage:t,formatDate:r}=T(),{trackUsage:o}=$e(),{toggleNotification:l}=Ge(),[{query:c}]=k(),{collectionType:g,slug:j}=J(),[w,{isLoading:u}]=jt(),{allowedActions:f}=ue(me.map(m=>({action:m,subject:j}))),h=I("VersionHeader",m=>m.selectedVersion),F=I("VersionHeader",m=>m.mainField),M=I("VersionHeader",m=>m.schema),A=I("VersionHeader",m=>m.page===1&&m.versions.data[0].id===m.selectedVersion.id),b=h.data[F],R=()=>({pathname:"..",search:O.stringify({plugins:c.plugins},{encode:!1})}),D=async()=>{try{const m=await w({documentId:h.relatedDocumentId,collectionType:g,params:{versionId:h.id,contentType:h.contentType},body:{contentType:h.contentType}});"data"in m&&(a(R(),{relative:"path"}),l({type:"success",title:t({id:"content-manager.restore.success.title",defaultMessage:"Version restored."}),message:t({id:"content-manager.restore.success.message",defaultMessage:"A past version of the content was restored."})}),o("didRestoreHistoryVersion")),"error"in m&&l({type:"danger",message:t({id:"content-manager.history.restore.error.message",defaultMessage:"Could not restore version."})})}catch{l({type:"danger",message:t({id:"notification.error",defaultMessage:"An error occurred"})})}};return e.jsxs(K.Root,{open:s,onOpenChange:i,children:[e.jsx(de.BaseHeader,{id:n,title:r(new Date(h.createdAt),{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}),secondaryAction:e.jsx(Ze,{label:t({id:"components.premiumFeature.title",defaultMessage:"Premium feature"})}),subtitle:e.jsx(p,{variant:"epsilon",textColor:"neutral600",children:t({id:"content-manager.history.version.subtitle",defaultMessage:"{hasLocale, select, true {{subtitle}, in {locale}} other {{subtitle}}}"},{hasLocale:!!h.locale,subtitle:`${b||""} (${M.info.singularName})`.trim(),locale:h.locale?.name})}),navigationAction:e.jsx(Y,{startIcon:e.jsx(Qe,{}),tag:Q,to:R(),relative:"path",isExternal:!1,children:t({id:"global.back",defaultMessage:"Back"})}),sticky:!1,primaryAction:e.jsx(K.Trigger,{children:e.jsx(X,{disabled:!f.canUpdate||A,onClick:()=>{i(!0)},fullWidth:!0,children:t({id:"content-manager.history.restore.confirm.button",defaultMessage:"Restore"})})})}),e.jsx(Ye,{onConfirm:D,endAction:e.jsx(X,{fullWidth:!0,variant:"secondary",onClick:D,loading:u,children:t({id:"content-manager.history.restore.confirm.button",defaultMessage:"Restore"})}),children:e.jsxs(y,{direction:"column",alignItems:"center",justifyContent:"center",gap:2,textAlign:"center",children:[e.jsx(y,{justifyContent:"center",children:e.jsx(Je,{width:"24px",height:"24px",fill:"danger600"})}),e.jsx(p,{children:t({id:"content-manager.history.restore.confirm.title",defaultMessage:"Are you sure you want to restore this version?"})}),e.jsx(p,{children:t({id:"content-manager.history.restore.confirm.message",defaultMessage:"{isDraft, select, true {The restored content will override your draft.} other {The restored content won't be published, it will override the draft and be saved as pending changes. You'll be able to publish the changes at anytime.}}"},{isDraft:h.status==="draft"})})]})})]})},Ct=n=>e.jsx(p,{textColor:"primary600",variant:"pi",children:n}),be=({version:n,isCurrent:s})=>{const{formatMessage:i}=T(),a=n.createdBy&&Ke(n.createdBy);return e.jsx(e.Fragment,{children:i({id:"content-manager.history.sidebar.versionDescription",defaultMessage:"{distanceToNow}{isAnonymous, select, true {} other { by {author}}}{isCurrent, select, true { <b>(current)</b>} other {}}"},{distanceToNow:e.jsx(Xe,{timestamp:new Date(n.createdAt)}),author:a,isAnonymous:!n.createdBy,isCurrent:s,b:Ct})})},It=({version:n,isCurrent:s})=>{const{formatDate:i}=T(),[{query:a}]=k(),t=et("VersionCard",l=>l?.setIsOpen,!1),r=a.id===n.id.toString(),o=()=>{t?.(!1)};return e.jsxs(y,{direction:"column",alignItems:"flex-start",gap:3,hasRadius:!0,borderWidth:"1px",borderStyle:"solid",borderColor:r?"primary600":"neutral200",color:"neutral800",padding:5,tag:ge,to:`?${O.stringify({...a,id:n.id})}`,style:{textDecoration:"none"},onClick:o,children:[e.jsxs(y,{direction:"column",gap:1,alignItems:"flex-start",children:[e.jsx(p,{tag:"h3",fontWeight:"semiBold",children:i(n.createdAt,{day:"numeric",month:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}),e.jsx(p,{tag:"p",variant:"pi",textColor:"neutral600",children:e.jsx(be,{version:n,isCurrent:s})})]}),n.status&&e.jsx(Z,{status:n.status,size:"XS"})]})},se=({page:n,children:s})=>{const[{query:i}]=k(),{id:a,...t}=i;return e.jsx(ge,{to:{search:O.stringify({...t,page:n})},style:{textDecoration:"none"},children:e.jsx(p,{variant:"omega",textColor:"primary600",children:s})})},ie=()=>{const{formatMessage:n}=T(),{versions:s,page:i}=I("VersionsListItems",a=>({versions:a.versions,page:a.page}));return e.jsxs(x,{flex:1,overflow:"auto",children:[s.meta.pagination.page>1&&e.jsx(x,{paddingTop:4,textAlign:"center",children:e.jsx(se,{page:i-1,children:n({id:"content-manager.history.sidebar.show-newer",defaultMessage:"Show newer versions"})})}),e.jsx(y,{direction:"column",gap:3,padding:{initial:0,medium:4},tag:"ul",alignItems:"stretch",children:s.data.map((a,t)=>e.jsx("li",{"aria-label":n({id:"content-manager.history.sidebar.title.version-card.aria-label",defaultMessage:"Version card"}),children:e.jsx(It,{version:a,isCurrent:i===1&&t===0})},a.id))}),s.meta.pagination.page<s.meta.pagination.pageCount&&e.jsx(x,{paddingBottom:4,textAlign:"center",children:e.jsx(se,{page:i+1,children:n({id:"content-manager.history.sidebar.show-older",defaultMessage:"Show older versions"})})})]})},wt=()=>{const{formatMessage:n}=T(),{versions:s,page:i}=I("VersionsList",o=>({versions:o.versions,page:o.page})),a=ce(),[{query:t}]=k(),r=s.data.find(o=>o.id.toString()===t.id);return a?e.jsxs(e.Fragment,{children:[e.jsxs(H.Root,{hasContent:!0,hasSideNav:!0,children:[e.jsx(H.Overlay,{}),e.jsx(H.Header,{children:r&&e.jsxs(y,{gap:2,overflow:"hidden",children:[e.jsx(x,{flex:1,overflow:"hidden",children:e.jsx(p,{display:"block",variant:"omega",textColor:"neutral600",overflow:"hidden",style:{textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.jsx(be,{version:r,isCurrent:i===1&&s.data.indexOf(r)===0})})}),r.status&&e.jsx(Z,{status:r.status,size:"XS"})]})}),e.jsx(H.Content,{children:e.jsx(ie,{})})]}),e.jsx(x,{width:"100%",height:"5.7rem"})]}):e.jsxs(y,{shrink:0,direction:"column",alignItems:"stretch",width:{initial:"28rem",large:"32rem"},height:"100%",overflow:"hidden",background:"neutral0",borderColor:"neutral200",borderWidth:"0 0 0 1px",borderStyle:"solid",tag:"aside",children:[e.jsxs(y,{direction:"row",justifyContent:"space-between",padding:4,borderColor:"neutral200",borderWidth:"0 0 1px",borderStyle:"solid",tag:"header",role:"banner",children:[e.jsx(p,{tag:"h2",variant:"omega",fontWeight:"semiBold",children:n({id:"content-manager.history.sidebar.title",defaultMessage:"Versions"})}),e.jsx(x,{background:"neutral150",hasRadius:!0,padding:1,children:e.jsx(p,{variant:"sigma",textColor:"neutral600",children:s.meta.pagination.total})})]}),e.jsx(ie,{})]})},[Mt,I]=tt("HistoryPage"),Tt=()=>{const n=V.useId(),{formatMessage:s}=T(),{slug:i,id:a,collectionType:t}=J(),{isLoading:r,schema:o}=at({collectionType:t,model:i}),{isLoading:l,edit:{layout:c,settings:{displayName:g,mainField:j}}}=rt(i),{data:w,isLoading:u}=ot(i),[{query:f}]=k(),{id:h,...F}=f,M=lt(F),A=M.page?Number(M.page):1,b=pt({contentType:i,...a?{documentId:a}:{},...M},{refetchOnMountOrArgChange:!0}),R=V.useRef(b.requestId),D=b.requestId===R.current;if(!i||t===G&&!a)return e.jsx(te,{to:"/content-manager"});if(r||l||b.isFetching||D||u)return e.jsx(L.Loading,{});if(!b.isError&&!b.data?.data?.length)return e.jsx(e.Fragment,{children:e.jsx(L.NoData,{action:e.jsx(Y,{tag:Q,to:`/content-manager/${t}/${i}${a?`/${a}`:""}`,children:s({id:"global.back",defaultMessage:"Back"})})})});if(b.data?.data?.length&&!h)return e.jsx(te,{to:{search:O.stringify({...f,id:b.data.data[0].id})},replace:!0});const m=b.data?.data?.find(S=>S.id.toString()===h);return b.isError||!c||!o||!m||!w||b.data.error?e.jsx(L.Error,{}):e.jsxs(e.Fragment,{children:[e.jsx(L.Title,{children:s({id:"content-manager.history.page-title",defaultMessage:"{contentType} history"},{contentType:g})}),e.jsx(Mt,{contentType:i,id:a,schema:o,layout:c,configuration:w,selectedVersion:m,versions:b.data,page:A,mainField:j,children:e.jsxs(y,{direction:{initial:"column",medium:"row"},alignItems:"flex-start",height:"100%",overflow:"hidden",children:[e.jsxs(dt,{grow:1,width:"100%",height:"100%",background:"neutral100",paddingBottom:6,overflow:"hidden auto",labelledBy:n,children:[e.jsx(vt,{headerId:n}),e.jsx(bt,{})]}),e.jsx(wt,{})]})})]})},Vt=()=>{const{slug:n}=J(),{permissions:s=[],isLoading:i,error:a}=ue(me.map(t=>({action:t,subject:n})));return i?e.jsx(L.Loading,{}):a||!n?e.jsx(x,{width:"100dvw",position:"fixed",top:{initial:ee,large:0},bottom:0,left:0,zIndex:{initial:2,large:4},background:"neutral0",children:e.jsx(L.Error,{})}):e.jsx(x,{width:"100dvw",position:"fixed",top:{initial:ee,large:0},bottom:0,left:0,zIndex:{initial:2,large:4},background:"neutral0",children:e.jsx(L.Protect,{permissions:s,children:({permissions:t})=>e.jsx(it,{permissions:t,children:e.jsx(Tt,{})})})})},Dt=()=>e.jsx(nt,{children:e.jsx(st,{children:e.jsx(Vt,{})})});export{Mt as HistoryProvider,Dt as ProtectedHistoryPage,I as useHistoryContext};
