PageSourceSearch

https://www.sergehillproject.co.uk/_next/static/chunks/266fba4e-e710513d39aeb86e.js

js sergehillproject.co.uk collected 2026-10-04 13:27:27 UTC 104,501 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{51776:function(e,t,n){n.d(t,{AA:function(){return Pt},BP:function(){return Dn},Bh:function(){return Bt},Cc:function(){return At},HZ:function(){return it},Hj:function(){return Ti},Ie:function(){return nn},Oo:function(){return _n},P0:function(){return Ri},PF:function(){return Pn},PV:function(){return Zt},RL:function(){return rt},Sg:function(){return jr},Ty:function(){return bn},V$:function(){return ot},VQ:function(){return Zn},X6:function(){return zt},Z3:function(){return jn},aL:function(){return nt},aR:function(){return Rn},c9:function(){return on},cN:function(){return Ve},cp:function(){return hn},ec:function(){return Ot},eu:function(){return Et},ez:function(){return ni},fC:function(){return tn},hX:function(){return Wt},hb:function(){return tt},iJ:function(){return Je},jE:function(){return Vn},k$:function(){return rn},lU:function(){return Ze},mE:function(){return Xt},nK:function(){return Hn},nR:function(){return Dt},oK:function(){return Ni},ud:function(){return et},xu:function(){return Jn},yq:function(){return Rt},zY:function(){return Fn},zc:function(){return Vi}});var i,o,r,s,a,l,c,d,u,p,h,m,f,y,x,g,v,b,w,j,I,C,T,k,_,E,P,D,S,R,A,M,L,U,z,O=n(40168),N=n(67294),B=n(85893),H=n(32932),V=n(11636),Z=n(14141),F=n(22401),q=n(6222),$=n(1545),G=n(32817),Q=n(40052),Y=n(98430),W=n(29127),X=n(53741),J=n(34978),K=n(68515),ee=n(79878),te=n(42965),ne=n(74855),ie=n.n(ne),oe=n(81763),re=n.n(oe),se=n(47037),ae=n.n(se),le=n(28440),ce=n(933),de=n(57557),ue=n.n(de),pe=n(66996),he=n(45578),me=n.n(he),fe=n(94885),ye=n.n(fe),xe=n(42930),ge=n(25934),ve=n(42298),be=n(11700),we=n.n(be),je=n(18156),Ie=n(30222),Ce=n(68929),Te=n.n(Ce),ke=n(989),_e=n.n(ke),Ee=n(44908),Pe=n.n(Ee),De=n(21804),Se=n.n(De),Re=n(35937),Ae=n.n(Re),Me=n(13311),Le=n.n(Me),Ue=n(73955),ze=n.n(Ue),Oe=n(59864),Ne=n(18029),Be=n.n(Ne);function He(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ve(e){let{children:t,ms:n=0}=e;const[i,o]=(0,N.useState)(n<=0);return(0,N.useEffect)((()=>{if(n<=0)return;const e=setTimeout((()=>o(!0)),n);return()=>{clearTimeout(e)}}),[n]),i&&t?"function"===typeof t?t():t:(0,B.jsx)(B.Fragment,{})}function Ze(e){const{document:t}=e,n=(0,H.I_y)().get(t._type),{error:i,value:o}=(0,H._2T)({schemaType:n,value:t});return n?i?(0,B.jsxs)(B.Fragment,{children:["Error: ",i.message]}):(0,B.jsx)(B.Fragment,{children:(null==o?void 0:o.title)||(0,B.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:"Untitled"})}):(0,B.jsxs)("code",{children:["Unknown schema type: ",t._type]})}function Fe(e){let{time:t}=e;const n=(0,H.INm)(t);return(0,B.jsxs)("span",{title:n,children:[n," ago"]})}let qe;const $e=()=>(qe||(qe=(0,F.R)(document,"visibilitychange").pipe((0,Y.O)(null),(0,W.U)((()=>"visible"===document.visibilityState)),(0,X.x)(),(0,J.w)((e=>e?(0,q.H)(0,5e3):$.E)),(0,K.d)({refCount:!0,bufferSize:1}))),qe);function Ge(e,t){const{versionedClient:n}=t;return $e().pipe((0,J.w)((()=>function(e,t){let{versionedClient:n}=t;const i=(0,H.qyu)(e),o=(0,H.vsM)(e),r={uri:n.getDataUrl("doc","".concat(i,",").concat(o)),json:!0,query:{excludeContent:"true"},tag:"use-referring-documents.document-existence"};return n.observable.request(r).pipe((0,W.U)((e=>{let{omitted:t}=e;const n=t.filter((e=>"existence"===e.reason));if(2!==n.length)return 0===n.length||n.some((e=>e.id===i))?o:i})))}(e,t))),(0,J.w)((e=>{if(!e)return(0,G.of)({totalCount:0,references:[]});const t=n.config().dataset;return n.observable.request({url:"/data/references/".concat(t,"/documents/").concat(e,"/to?excludeInternalReferences=true&excludePaths=true"),tag:"use-referring-documents.external"}).pipe((0,ee.K)((e=>{if(function(e){return"object"===typeof e&&!!e&&"statusCode"in e&&"response"in e}(e)&&404===e.statusCode)return(0,G.of)({totalCount:0,references:[]});throw e})))})))}const Qe=(0,H.ek8)((e=>{let[t,n]=e;const i='{"references":'.concat("*[references($documentId)][0...100]{_id,_type}",',"totalCount":').concat("count(*[references($documentId)])","}");return n.listenQuery({fetch:i,listen:"*[references($documentId)]"},{documentId:t},{tag:"use-referring-documents",transitions:["appear","disappear"],throttleTime:5e3})})),Ye=(0,H.ek8)((e=>{let[t,n]=e;return $e().pipe((0,J.w)((()=>Ge(t,{versionedClient:n}))))}));function We(e){const{document:t}=e,n=t&&"_updatedAt"in t&&t._updatedAt;return(0,B.jsx)(V.u,{portal:!0,content:(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(V.xv,{size:1,children:t?(0,B.jsxs)(B.Fragment,{children:["Published ",n&&(0,B.jsx)(Fe,{time:n})]}):(0,B.jsx)(B.Fragment,{children:"Not published"})})}),children:(0,B.jsx)(H.LPT,{tone:"positive",dimmed:!t,muted:!t,size:1,children:(0,B.jsx)(O.EI4,{})})})}function Xe(e){const{document:t}=e,n=t&&"_updatedAt"in t&&t._updatedAt;return(0,B.jsx)(V.u,{portal:!0,content:(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(V.xv,{size:1,children:t?(0,B.jsxs)(B.Fragment,{children:["Edited ",n&&(0,B.jsx)(Fe,{time:n})]}):(0,B.jsx)(B.Fragment,{children:"No unpublished edits"})})}),children:(0,B.jsx)(H.LPT,{tone:"caution",dimmed:!t,muted:!t,size:1,children:(0,B.jsx)(O.dY8,{})})})}function Je(e){const{icon:t,layout:n,presence:i,schemaType:o,value:r}=e,s=(0,H.Uy$)(r.title)&&(0,N.isValidElement)(r.title)||ae()(r.title)||re()(r.title)?r.title:null,{draft:a,published:l,isLoading:c}=(0,le.m2)((()=>(0,H.eLL)(e.documentPreviewStore,o,r._id,s)),[e.documentPreviewStore,o,r._id,s]),d=c?null:(0,B.jsxs)(V.gF,{space:4,children:[i&&i.length>0&&(0,B.jsx)(H.mEJ,{presence:i}),(0,B.jsx)(We,{document:l}),(0,B.jsx)(Xe,{document:a})]});return(0,B.jsx)(H.ogX,{...(0,H.L_b)({value:r,draft:a,published:l}),isPlaceholder:c,icon:t,layout:n,status:d})}function Ke(){throw new Error("Pane is missing router context")}const et=(0,N.createContext)({index:0,groupIndex:0,siblingIndex:0,payload:void 0,params:{},hasGroupSiblings:!1,groupLength:0,routerPanesState:[],BackLink:()=>Ke(),ChildLink:()=>Ke(),ReferenceChildLink:()=>Ke(),handleEditReference:()=>Ke(),ParameterizedLink:()=>Ke(),replaceCurrent:()=>Ke(),closeCurrent:()=>Ke(),duplicateCurrent:()=>
1Ke(),setView:()=>Ke(),setParams:()=>Ke(),setPayload:()=>Ke(),navigateIntent:()=>Ke()}),tt=(0,N.forwardRef)((function(e,t){const{routerPanesState:n,groupIndex:i}=(0,N.useContext)(et),o=(0,N.useMemo)((()=>n.slice(0,i)),[i,n]),r=(0,N.useMemo)((()=>({panes:o})),[o]);return(0,B.jsx)(ce.Px,{...e,ref:t,state:r})})),nt=(0,N.forwardRef)((function(e,t){const{childId:n,childPayload:i,childParameters:o,...r}=e,{routerPanesState:s,groupIndex:a}=(0,N.useContext)(et);return(0,B.jsx)(ce.Px,{...r,ref:t,state:{panes:[...s.slice(0,a+1),[{id:n,params:o,payload:i}]]}})})),it=(0,N.forwardRef)((function(e,t){let{documentId:n,documentType:i,parentRefPath:o,children:r,template:s,...a}=e;return(0,B.jsx)(nt,{...a,ref:t,childId:n,childPayload:null==s?void 0:s.params,childParameters:{type:i,parentRefPath:(0,pe.BB)(o),...s&&{template:null==s?void 0:s.id}},children:r})})),ot=(0,N.forwardRef)((function(e,t){const{routerPanesState:n,groupIndex:i,siblingIndex:o}=(0,N.useContext)(et),{params:r,payload:s,...a}=e,l=(0,H.BoV)(r),c=(0,H.BoV)(s),d=(0,N.useMemo)((()=>{const e=n[i],t=e[o],r={...t,params:null!=l?l:t.params,payload:null!=c?c:t.payload},s=[...e.slice(0,o),r,...e.slice(o+1)];return{panes:[...n.slice(0,i),s,...n.slice(i+1)]}}
1),[n,i,l,c,o]);return(0,B.jsx)(ce.Px,{ref:t,...a,state:d})}));function rt(){return(0,N.useContext)(et)}const st=[];function at(e){const{onClick:t,type:n,value:i}=e,o=(0,H.vsM)(null==i?void 0:i._id),r=(0,H.Dqo)(o),s=(0,H.rq_)(),{ReferenceChildLink:a}=rt(),l=(0,N.useCallback)((function(e){return(0,B.jsx)(a,{documentId:null==i?void 0:i._id,documentType:null==n?void 0:n.name,parentRefPath:st,...e})}),[a,null==n?void 0:n.name,null==i?void 0:i._id]);return(0,B.jsx)(H.oUE,{__unstable_focusRing:!0,as:l,"data-as":"a",onClick:t,padding:2,radius:2,children:(0,B.jsx)(Je,{documentPreviewStore:s,icon:null==n?void 0:n.icon,layout:"default",presence:(null==r?void 0:r.length)>0?r:st,schemaType:n,value:i})})}const lt=(0,Z.ZP)(V.xu)(i||(i=He(["\n  margin-left: auto;\n"]))),ct=Z.ZP.details(o||(o=He(["\n  flex: none;\n\n  &[open] "," {\n    transform: rotate(180deg);\n  }\n"])),lt),dt=Z.ZP.summary(r||(r=He(["\n  list-style: none;\n\n  &::-webkit-details-marker {\n    display: none;\n  }\n"]))),ut=(0,Z.ZP)(V.xu).attrs({paddingX:2,paddingBottom:2})(s||(s=He(["\n  overflow: auto;\n  max-height: 150px;\n"]))),pt=Z.ZP.table(a||(a=He(["\n  width: 100%;\n  text-align: left;\n  padding: 0 ",";\n  border-collapse: collapse;\n\n  th {\n    padding: ",";\n  }\n\n  thead > tr {\n    position: sticky;\n    top: 0;\n    background: var(--card-bg-color);\n    z-index: 1;\n  }\n\n  td {\n    padding: 0 ",";\n  }\n\n  tr > *:last-child {\n    text-align: right;\n  }\n"])),(e=>{let{theme:t}=e;return(0,V.hO)(t.sanity.space[2])}),(e=>{let{theme:t}=e;return(0,V.hO)(t.sanity.space[1])}),(e=>{let{theme:t}=e;return(0,V.hO)(t.sanity.space[1])})),ht=(0,Z.ZP)(V.kC)(l||(l=He(["\n  min-height: 35px;\n"]))),mt=(0,Z.ZP)(V.Zb).attrs({radius:2,shadow:1,marginBottom:4,flex:"auto"})(c||(c=He(["\n  overflow: hidden;\n  overflow: clip;\n  min-height: 150px;\n"]))),ft=e=>{const t=e.totalCount-e.references.length;return t?(0,B.jsxs)(V.gF,{space:2,children:[(0,B.jsxs)(V.xv,{size:1,muted:!0,children:[t," other reference",1===t?"":"s"," not shown"," "]}),(0,B.jsx)(V.u,{portal:!0,placement:"top",content:(0,B.jsx)(V.W2,{width:0,children:(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(V.xv,{size:1,children:"We can't show metadata about these references because no token with access to the datasets they are in was found."})})}),children:(0,B.jsx)(V.xv,{size:1,muted:!0,children:(0,B.jsx)(O.hQ6,{})})})]}):null};function yt(e){let{crossDatasetReferences:t,internalReferences:n,documentTitle:i,totalCount:o,action:r,datasetNames:s,hasUnknownDatasetNames:a,onReferenceLinkClick:l}=e;const c=(0,H.I_y)(),d=(0,V.pm)(),u=(0,N.useCallback)((e=>{const t=c.get(e._type);return t?(0,B.jsx)(at,{type:t,value:e,onClick:l}):(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(H.ogX,{icon:O.Tzq,title:"Preview Unavailable",subtitle:"ID: ".concat(e._id),layout:"default"})})}),[c,l]);if(0===(null==n?void 0:n.totalCount)&&0===(null==t?void 0:t.totalCount))return(0,B.jsxs)(V.xv,{as:"p",children:["Are you sure you want to ",r," ",(0,B.jsxs)("strong",{children:["\u201c",i,"\u201d"]}),"?"]});const p=1===t.totalCount?"1 document":"".concat(t.totalCount.toLocaleString()," documents"),h=[...s,...a?["unavailable"]:[]],m=1===h.length?"another dataset":"".concat(h.length," datasets");let f="Dataset".concat(1===h.length?"":"s",": ").concat(h.join(", "));return a&&1===h.length&&(f="Unavailable dataset"),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V.Zb,{padding:3,radius:2,tone:"caution",marginBottom:4,flex:"none",children:(0,B.jsxs)(V.kC,{children:[(0,B.jsx)(V.xv,{"aria-hidden":"true",size:1,children:(0,B.jsx)(O.foC,{})}),(0,B.jsx)(V.xu,{flex:1,marginLeft:3,children:(0,B.jsx)(V.xv,{size:1,children:1===o?(0,B.jsxs)(B.Fragment,{children:["1 document refers to \u201c",i,"\u201d"]}):(0,B.jsxs)(B.Fragment,{children:[o.toLocaleString()," documents refer to \u201c",i,"\u201d"]})})})]})}),(0,B.jsx)(V.xu,{flex:"none",marginBottom:4,children:(0,B.jsxs)(V.xv,{children:["You may not be able to ",r," \u201c",i,"\u201d because the following documents refer to it:"]})}),(0,B.jsx)(mt,{children:(0,B.jsxs)(V.kC,{direction:"column",height:"fill",children:[n.totalCount>0&&(0,B.jsxs)(V.Kq,{as:"ul",padding:3,space:3,overflow:"auto","data-testid":"internal-references",children:[null==n?void 0:n.references.map((e=>(0,B.jsx)(V.xu,{as:"li",children:u(e)},e._id))),n.totalCount>n.references.length&&(0,B.jsx)(V.xu,{as:"li",padding:3,children:(0,B.jsx)(ft,{...n})})]}),t.totalCount>0&&(0,B.jsxs)(ct,{"data-testid":"cross-dataset-references",style:{borderTop:n.totalCount>0?"1px solid var(--card-shadow-outline-color)":void 0},children:[(0,B.jsx)(dt,{children:(0,B.jsxs)(V.kC,{padding:4,align:"center",children:[(0,B.jsx)(V.xu,{marginRight:4,children:(0,B.jsx)(V.xv,{size:3,children:(0,B.jsx)(O.TAM,{})})}),(0,B.jsxs)(V.kC,{marginRight:4,direction:"column",children:[(0,B.jsx)(V.xu,{marginBottom:2,children:(0,B.jsxs)(V.xv,{children:[p," in ",m]})}),(0,B.jsx)(V.xu,{children:(0,B.jsx)(V.xv,{title:f,textOverflow:"ellipsis",size:1,muted:!0,children:f})})]}),(0,B.jsx)(lt,{children:(0,B.jsx)(V.xv,{muted:!0,children:(0,B.jsx)(O.v4q,{})})})]})}),(0,B.jsxs)(ut,{children:[(0,B.jsxs)(pt,{children:[(0,B.jsx)("thead",{children:(0,B.jsxs)("tr",{children:[(0,B.jsx)("th",{children:(0,B.jsx)(V.__,{muted:!0,size:0,children:"Project ID"})}),(0,B.jsx)("th",{children:(0,B.jsx)(V.__,{muted:!0,size:0,children:"Dataset"})}),(0,B.jsx)("th",{children:(0,B.jsx)(V.__,{muted:!0,size:0,children:"Document ID"})})]})}),(0,B.jsx)("tbody",{children:t.references.filter((e=>"projectId"in e)).map(((e,t)=>{let{projectId:n,datasetName:i,documentId:o}=e;return(0,B.jsxs)("tr",{children:[(0,B.jsx)("td",{children:(0,B.jsx)(V.xv,{size:1,children:n})}),(0,B.jsx)("td",{children:(0,B.jsx)(V.xv,{size:1,children:i||"unavailable"})}),(0,B.jsx)("td",{children:(0,B.jsxs)(ht,{align:"center",gap:2,justify:"flex-end",children:[(0,B.jsx)(V.xv,{textOverflow:"ellipsis",size:1,children:o||"unavailable"}),o&&(0,B.jsx)(ie(),{text:o,onCopy:()=>{d.push({title:"Copied document ID to clipboard!",status:"success"})},children:(0,B.jsx)(V.zx,{title:"Copy ID to clipboard",mode:"bleed",icon:O.Kmg,fontSize:0})})]})})]},"".concat(o,"-").concat(t))}))})]}),(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(ft,{...t})})]})]})]})}),(0,B.jsx)(V.xu,{flex:"none",children:(0,B.jsxs)(V.xv,{children:["If you ",r," this document, documents that refer to it will no longer be able to access it."]})})]})}const xt=(0,Z.ZP)(V.kC).attrs({padding:4,direction:"column",height:"fill"})(d||(d=He(["\n  box-sizing: border-box;\n"]))),gt=(0,Z.ZP)(V.kC).attrs({align:"center",direction:"column",justify:"center"})(u||(u=He(["\n  height: 300px;\n"])));function vt(e){let{id:t,type:n,action:i="delete",onCancel:o,onConfirm:r}=e;
1const s="deletion-confirmation-".concat((0,N.useId)()),{internalReferences:a,crossDatasetReferences:l,isLoading:c,totalCount:d,projectIds:u,datasetNames:p,hasUnknownDatasetNames:h}=function(e){const t=(0,H.m85)(H.Dr7),n=(0,H.H__)(),i=(0,H.vsM)(e),[o,r]=Qe((0,N.useMemo)((()=>[i,n]),[n,i])),[s,a]=Ye((0,N.useMemo)((()=>[i,t]),[i,t])),l=(0,N.useMemo)((()=>Array.from(new Set(null==s?void 0:s.references.map((e=>e.projectId)).filter(Boolean))).sort()),[null==s?void 0:s.references]),c=(0,N.useMemo)((()=>Array.from(new Set(null==s?void 0:s.references.map((e=>(null==e?void 0:e.datasetName)||"")).filter((e=>Boolean(e)&&""!==e)))).sort()),[null==s?void 0:s.references]),d=(0,N.useMemo)((()=>Boolean(null==s?void 0:s.references.some((e=>"string"!==typeof e.datasetName)))),[null==s?void 0:s.references]);return{totalCount:((null==o?void 0:o.totalCount)||0)+((null==s?void 0:s.totalCount)||0),projectIds:l,datasetNames:c,hasUnknownDatasetNames:d,internalReferences:o,crossDatasetReferences:s,isLoading:r||a}}(t),m="".concat(i.substring(0,1).toUpperCase()).concat(i.substring(1)),f=(0,B.jsx)(Ze,{document:(0,N.useMemo)((()=>({_id:t,_type:n})),[t,n])}),y=!c;return(0,B.jsx)(V.Vq,{width:1,id:s,header:"".concat(m," document?"),footer:(0,B.jsxs)(V.rj,{columns:y?2:1,gap:2,paddingX:4,paddingY:3,children:[(0,B.jsx)(V.zx,{mode:"ghost",onClick:o,text:"Cancel"}),y&&(0,B.jsx)(V.zx,{"data-testid":"confirm-delete-button",text:"".concat(m,d>0?" anyway":" now"),tone:"critical",onClick:r})]}),onClose:o,onClickOutside:o,children:(0,B.jsx)(xt,{children:l&&a&&!c?(0,B.jsx)(yt,{crossDatasetReferences:l,internalReferences:a,documentTitle:f,isLoading:c,totalCount:d,action:i,projectIds:u,datasetNames:p,hasUnknownDatasetNames:h,onReferenceLinkClick:o}):(0,B.jsxs)(gt,{"data-testid":"loading-container",children:[(0,B.jsx)(V.$j,{muted:!0}),(0,B.jsx)(V.xu,{marginTop:3,children:(0,B.jsx)(V.xv,{align:"center",muted:!0,size:1,children:"Looking for referring documents\u2026"})})]})})})}function bt(e){const t=(0,N.useId)(),[n,i]=(0,N.useState)(null),o=(0,N.useCallback)((()=>i(null)),[]);return n?(0,B.jsx)(V.Vq,{id:"dialog-error-".concat(t),"data-testid":"confirm-delete-error-dialog",header:"Error",footer:(0,B.jsx)(V.kC,{paddingX:4,paddingY:3,direction:"column",children:(0,B.jsx)(V.zx,{mode:"ghost",text:"Retry",onClick:o})}),onClose:e.onCancel,children:(0,B.jsx)(V.xu,{padding:4,children:(0,B.jsx)(V.xv,{children:"An error occurred while loading referencing documents."})})}):(0,B.jsx)(V.SV,{onCatch:i,children:(0,B.jsx)(vt,{...e})})}const wt={constrainSize:!0,placement:"left-start",portal:!0};function jt(e){const{disabled:t,isAfterGroup:n,node:i}=e;return"divider"===i.type?(0,B.jsx)(V.R,{}):"group"===i.type?0===i.children.length?null:i.expanded?(0,B.jsxs)(B.Fragment,{children:[n&&(0,B.jsx)(V.R,{}),i.title&&(0,B.jsx)(V.xu,{padding:2,paddingBottom:1,children:(0,B.jsx)(V.__,{muted:!0,size:0,children:i.title})}),i.children.map(((e,n)=>{var o;return(0,B.jsx)(jt,{disabled:t||Boolean(i.disabled),isAfterGroup:"group"===(null==(o=i.children[n-1])?void 0:o.type),node:e},e.key)}))]}):(0,B.jsxs)(B.Fragment,{children:[n&&(0,B.jsx)(V.R,{}),(0,B.jsx)(V.kS,{disabled:t,icon:i.icon,popover:wt,text:i.title,children:i.children.map(((e,n)=>{var o;return(0,B.jsx)(jt,{disabled:t||Boolean(i.disabled),isAfterGroup:"group"===(null==(o=i.children[n-1])?void 0:o.type),node:e},e.key)}))})]}):(0,B.jsxs)(B.Fragment,{children:[n&&(0,B.jsx)(V.R,{}),(0,B.jsx)(It,{disabled:t,node:i})]})}function It(e){const{node:t}=e;return t.intent?(0,B.jsx)(Tt,{...e,intent:t.intent}):(0,B.jsx)(Ct,{...e})}function Ct(e){var t;const{disabled:n,node:i}=e,o="object"===typeof i.disabled&&(0,B.jsx)(V.xv,{size:1,children:i.disabled.reason});return(0,B.jsx)(H.xMr,{content:o,placement:"left",children:(0,B.jsx)(V.sN,{disabled:n||Boolean(i.disabled),hotkeys:null==(t=i.hotkey)?void 0:t.split("+"),icon:i.icon,iconRight:i.iconRight||i.selected&&O.KML,onClick:i.onAction,pressed:i.selected,text:i.title,tone:i.tone})})}function Tt(e){var t;const{disabled:n,intent:i,node:o}=e,r="object"===typeof o.disabled&&(0,B.jsx)(V.xv,{size:1,children:o.disabled.reason}),s=(0,ce.PM)({intent:i.type,params:i.params}),a=(0,N.useCallback)((e=>{s.onClick(e),o.onAction()}),[s,o]);return(0,B.jsx)(H.xMr,{content:r,placement:"left",children:(0,B.jsx)(V.sN,{as:"a",disabled:n||Boolean(o.disabled),hotkeys:null==(t=o.hotkey)?void 0:t.split("+"),href:s.href,icon:o.icon,iconRight:o.selected?O.KML:void 0,onClick:a,pressed:o.selected,text:o.title,tone:o.tone})})}const kt={constrainSize:!0,placement:"bottom",portal:!0};function _t(e,t){return e.some((e=>"item"===e.type&&e.tone===t||"group"===e.type&&_t(e.children,t)))}function Et(e){const{nodes:t}=e,n=(0,N.useId)(),i=_t(t,"critical"),o=_t(t,"caution");return(0,B.jsx)(V.j2,{button:(0,B.jsx)(H.YG6,{icon:O.zGg,mode:"bleed",title:"Show menu",tone:i?"critical":o?"caution":void 0}),id:n,menu:(0,B.jsx)(V.v2,{children:t.map(((e,n)=>{var i;const o="group"===(null==(i=t[n-1])?void 0:i.type);return(0,B.jsx)(jt,{isAfterGroup:o,node:e},e.key)}))}),popover:kt})}const Pt=51,Dt=4*Pt,St=(0,N.createContext)(null),Rt=(0,N.createContext)(null);function At(){const e=(0,N.useContext)(Rt);if(!e)throw new Error("PaneLayout: missing context value");return e}const Mt=(0,Z.ZP)(V.mh)(p||(p=He(["\n  position: relative;\n  width: 1px;\n  min-width: 1px;\n\n  &:before {\n    content: '';\n    display: block;\n    position: absolute;\n    top: 0;\n    left: 0;\n    bottom: 0;\n    width: 1px;\n    background-color: var(--card-border-color);\n  }\n\n  &:not([data-disabled]) {\n    cursor: ew-resize;\n    width: 9px;\n    min-width: 9px;\n    margin: 0 -4px;\n\n    &:before {\n      left: 4px;\n    }\n\n    &:after {\n      content: '';\n      display: block;\n      position: absolute;\n      top: 0;\n      left: 0;\n      width: 9px;\n      bottom: 0;\n      background-color: var(--card-border-color);\n      opacity: 0;\n      transition: opacity 150ms;\n    }\n\n    &[data-dragging]:after,\n    &:hover:after {\n      opacity: 0.2;\n    }\n  }\n"])));function Lt(e){let{disabled:t,element:n}=e;const{resize:i}=At(),[o,r]=(0,N.useState)(!1),s=(0,N.useCallback)((e=>{if(!n)return;r(!0),e.preventDefault();const t=e.pageX;i("start",n,0);const o=e=>{e.preventDefault();const o=e.pageX-t;i("move",n,o)},s=e=>{e.preventDefault(),r(!1),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",s),i("end",n,0)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",s)}),[n,i]);return(0,B.jsx)(Mt,{"data-disabled":t?"":void 0,"data-dragging":o?"":void 0,onMouseDown:s})}const Ut=(0,Z.ZP)(V.Zb)(h||(h=He(["\n  outline: none;\n\n  // NOTE: This will render a border to the right side of each pane\n  // without taking up physical space.\n  box-shadow: 1px 0 0 var(--card-border-color);\n"]))),zt=(0,N.forwardRef)((function(e,t){var n,i,o;const{children:r,currentMinWidth:s,currentMaxWidth:a,flex:l=1,id:c,minWidth:d,maxWidth:u,selected:p=!1,...h}=e,[m,f]=(0,N.useState)(null),{collapse:y,collapsed:x,expand:g,expandedElement:v,mount:b,panes:w}=At(),j=w.find((e=>e.element===m)),I=j&&w.indexOf(j),C="number"===typeof I?w[I+1]:void 0,T=I===w.length-1,k=!x&&((null==j?void 0:j.collapsed)||!1),_=(null==C?void 0:C.collapsed)||!1,E=(0,V.ts)(t),P=null!=(n=null==j?void 0:j.flex)?n:l,D=null!=(i=null==j?void 0:j.currentMinWidth)?i:s,S=null!=(o=null==j?void 0:j.currentMaxWidth)?o:a,R=(0,N.useCallback)((e=>{f(e),E.current=e}),[E]);(0,N.useEffect)((()=>
1{if(m)return b(m,{currentMinWidth:s,currentMaxWidth:a,flex:l,id:c,minWidth:d,maxWidth:u})}),[s,a,l,c,d,u,b,m]);const A=(0,N.useCallback)((()=>{m&&y(m)}),[y,m]),M=(0,N.useCallback)((()=>{m&&g(m)}),[g,m]),L=(0,N.useMemo)((()=>({collapse:A,collapsed:!x&&k,expand:M,index:I,isLast:T,rootElement:m})),[k,A,M,T,x,I,m]),U=(0,N.useMemo)((()=>{if(!x)return k?Pt:0===D||T?d||Dt:D||d||Dt}),[k,D,T,x,d]),z=(0,N.useMemo)((()=>k?Pt:x&&T?void 0:T?u?null!=S?S:u:void 0:null!=S?S:u),[k,S,T,x,u]),O=x&&!T,Z=(0,N.useMemo)((()=>!T&&!x&&(0,B.jsx)(H.jr5,{zOffset:"paneResizer",children:(0,B.jsx)(Lt,{disabled:k||_,element:m})})),[k,T,x,_,m]),F=(0,N.useMemo)((()=>({flex:P,minWidth:U,maxWidth:z===1/0?void 0:z})),[P,U,z]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(H.jr5,{zOffset:"pane",children:(0,B.jsx)(St.Provider,{value:L,children:(0,B.jsxs)(Ut,{"data-testid":"pane","data-ui":"Pane",tone:"inherit",hidden:O,id:c,overflow:x?void 0:"hidden",...h,"data-pane-collapsed":k?"":void 0,"data-pane-index":I,"data-pane-selected":p?"":void 0,ref:R,style:F,children:[false,(0,B.jsx)(V.NM,{element:m,children:!O&&(0,B.jsx)(V.kC,{direction:"column",height:"fill",children:r})})]})})}),Z]})}));function Ot(){const e=(0,N.useContext)(St);if(!e)throw new Error("Pane: missing context value");return e}const Nt=(0,Z.ZP)(V.Zb)(m||(m=He(["\n  position: relative;\n  outline: none;\n"])));Nt.displayName="PaneContent__root";const Bt=(0,N.forwardRef)((function(e,t){const{as:n,children:i,overflow:o,padding:r,...s}=e,{collapsed:a}=Ot(),{collapsed:l}=At();return(0,B.jsx)(Nt,{"data-testid":"pane-content",forwardedAs:n,...s,flex:1,hidden:a,overflow:l?void 0:o,padding:r,ref:t,tone:"inherit",children:i})})),Ht=(0,Z.ZP)(V.mh)(f||(f=He(["\n  position: sticky;\n  bottom: 0;\n\n  &:before {\n    content: '';\n    display: block;\n    position: absolute;\n    left: 0;\n    right: 0;\n    top: -1px;\n    border-bottom: 1px solid var(--card-shadow-outline-color);\n  }\n"]))),Vt=(0,Z.ZP)(V.Zb)(y||(y=He(["\n  padding-bottom: env(safe-area-inset-bottom);\n"]))),Zt=(0,N.forwardRef)((function(e,t){const{children:n,padding:i}=e,{collapsed:o}=Ot();return(0,B.jsx)(H.jr5,{zOffset:"paneFooter",children:(0,B.jsx)(Ht,{"data-testid":"pane-footer",hidden:o,ref:t,children:(0,B.jsx)(Vt,{tone:"inherit",children:(0,B.jsx)(V.xu,{padding:i,children:n})})})})})),Ft=(0,Z.ZP)(V.mh)(x||(x=He(["\n  line-height: 0;\n  position: sticky;\n  top: 0;\n\n  &:not([data-collapsed]):after {\n    content: '';\n    display: block;\n    position: absolute;\n    left: 0;\n    right: 0;\n    bottom: -1px;\n    border-bottom: 1px solid var(--card-shadow-outline-color);\n  }\n"]))),qt=(0,Z.ZP)(V.kC)(g||(g=He(["\n  transform-origin: calc(51px / 2);\n\n  [data-collapsed] > div > & {\n    transform: rotate(90deg);\n  }\n"]))),$t=(0,Z.ZP)(V.Zb)((e=>{let{theme:t}=e;const{fg:n,bg:i}=t.sanity.color.card.enabled;return(0,Z.iv)(v||(v=He(["\n    background-color: ",";\n\n    [data-ui='Text'] {\n      color: ",";\n    }\n  "])),i,n)})),Gt=(0,Z.ZP)(V.Qr)(b||(b=He(["\n  width: 66%;\n  max-width: 175px;\n"]))),Qt=(0,Z.ZP)(V.xv)(w||(w=He(["\n  cursor: default;\n  outline: none;\n"]))),Yt=(0,Z.ZP)(V.xu)((e=>{let{theme:t}=e;const{color:n,space:i}=t.sanity;return(0,Z.iv)(j||(j=He(["\n    overflow: hidden;\n    overflow: clip;\n    position: relative;\n\n    & > div {\n      white-space: nowrap;\n      overflow: auto;\n      /* Hide scrollbars */\n      scrollbar-width: none;\n      &::-webkit-scrollbar {\n        width: 0;\n        height: 0;\n      }\n    }\n\n    /* right padding */\n    & > div:after {\n      content: '';\n      display: inline-block;\n      top: 0;\n      right: 0;\n      bottom: 0;\n      width: ","px;\n      height: 1px;\n    }\n\n    /* Gradient that makes it look like tabs disappear into nothing (looks nicer) */\n    &:after {\n      content: '';\n      display: block;\n      position: absolute;\n      top: 0;\n      right: 0;\n      bottom: 0;\n      background: linear-gradient(to right, ",", var(--card-bg-color));\n      width: ","px;\n      pointer-events: none;\n    }\n  "])),i[3],(0,V.m4)(n.base.bg,0),i[3])})),Wt=(0,N.forwardRef)((function(e,t){const{actions:n,backButton:i,contentAfter:o,loading:r,subActions:s,tabs:a,tabIndex:l,title:c}=e,{collapse:d,collapsed:u,expand:p,rootElement:h}=Ot(),m=(0,V.XL)(h||null),f=(0,N.useMemo)((()=>({width:u?(null==m?void 0:m.height)||window.innerHeight:void 0})),[u,m]),y=(0,N.useCallback)((()=>{u||d()}),[d,u]),x=(0,N.useCallback)((()=>{u&&p()}),[u,p]),g=Boolean(!u&&(a||s));return(0,B.jsx)(V.li,{zOffset:100,children:(0,B.jsx)(Ft,{"data-collapsed":u?"":void 0,"data-testid":"pane-header",ref:t,children:(0,B.jsx)(H.jr5,{zOffset:"paneHeader",children:(0,B.jsxs)(V.Zb,{"data-collapsed":u?"":void 0,tone:"inherit",children:[(0,B.jsxs)(qt,{onClick:x,padding:2,sizing:"border",style:f,children:[i&&(0,B.jsx)(V.xu,{flex:"none",padding:1,children:i}),(0,B.jsxs)($t,{__unstable_focusRing:!0,flex:1,forwardedAs:"button",marginRight:n?1:0,onClick:y,paddingLeft:i?1:3,paddingY:3,tabIndex:l,children:[r&&(0,B.jsx)(Gt,{animated:!0,radius:1}),!r&&(0,B.jsx)(Qt,{textOverflow:"ellipsis",weight:"semibold",children:c})]}),n&&(0,B.jsx)(V.xu,{flex:"none",hidden:u,children:(0,B.jsx)(H.jr5,{zOffset:"paneHeader",children:n})})]}),g&&(0,B.jsxs)(V.kC,{align:"center",hidden:u,overflow:"auto",paddingBottom:3,paddingX:3,paddingTop:1,children:[(0,B.jsx)(Yt,{flex:1,marginRight:s?3:0,children:a}),s&&s]}),!u&&o&&o]})})})})}));function Xt(e){const{node:t,padding:n}=e;return"item"===t.type?(0,B.jsx)(Jt,{node:t,padding:n}):"group"===t.type?(0,B.jsx)(en,{node:t,padding:n}):(console.warn('unknown menu node (expected `type: "item" | "group"`):',t),null)}function Jt(e){var t;const{node:n,padding:i}=e;if(n.intent)return(0,B.jsx)(Kt,{...e,intent:n.intent});const o="object"===typeof n.disabled&&(0,B.jsx)(V.xv,{size:1,children:n.disabled.reason});return(0,B.jsx)(H.xMr,{content:o,placement:"bottom",children:(0,B.jsx)(H.YG6,{disabled:Boolean(n.disabled),hotkey:null==(t=n.hotkey)?void 0:t.split("+"),icon:n.icon,label:o?void 0:n.title,onClick:n.onAction,padding:i,selected:n.selected,tone:n.tone})})}function Kt(e){var t;const{intent:n,node:i,padding:o}=e,r="object"===typeof i.disabled&&(0,B.jsx)(V.xv,{size:1,children:i.disabled.reason}),s=(0,ce.PM)({intent:n.type,params:n.params}),a=(0,N.useCallback)((e=>{s.onClick(e),i.onAction()}),[s,i]);return(0,B.jsx)(H.xMr,{content:r,placement:"bottom",children:(0,B.jsx)(H.YG6,{as:"a",disabled:Boolean(i.disabled),hotkey:null==(t=i.hotkey)?void 0:t.split("+"),href:s.href,icon:i.icon,label:r?void 0:i.title,onClick:a,padding:o,selected:i.selected,tone:i.tone})})}function en(e){var t;const{node:n,padding:i}=e;return(0,B.jsx)(V.j2,{button:(0,B.jsx)(H.YG6,{disabled:n.disabled,icon:null!=(t=n.icon)?t:O.Tzq,label:n.title,padding:i}),id:(0,N.useId)(),menu:(0,B.jsx)(V.v2,{children:n.children.map(((e,t)=>{var i;return(0,B.jsx)(jt,{disabled:Boolean(n.disabled),isAfterGroup:"group"===(null==(i=n.children[t-1])?void 0:i.type),node:e},e.key)}))})})}const tn=(0,Z.ZP)(V.Zb)(I||(I=He(["\n  transition: opacity 200ms;\n  position: relative;\n  z-index: 1;\n  padding-left: env(safe-area-inset-left);\n  padding-right: env(safe-area-inset-right);\n  opacity: 0;\n\n  &:not([hidden]) {\n    display: flex;\n  }\n\n  &:not([data-collapsed]) {\n    overflow: auto;\n  }\n\n  &[data-mounted] {\n    opacity: 1;\n  }\n\n  &[data-resizing] {\n    pointer-events: none;\n  }\n"])));function nn(e){return("item"===e.type||"group"===e.type)&&e.renderAsButton}const on=ye()(nn);function rn(e){var t,n;const{fieldActions:i=[],menuItems:o,menuItemGroups:r}=e,s=[];let a=0;for(let d=0;d<i.length;d+=1){const e=i[d];s.push(sn(e,"".concat(d,"-").concat(e.type)))}a+=s.length;const l=[];for(const d of r){l.find((e=>e.key===d.id))||l.push({type:"group",key:d.id,children:[],expanded:!0,renderAsButton:!1,title:d.title})}const c=[];for(let d=0;d<o.length;d+=1){const i=o[d];let r=i.group&&l.find((e=>e.key===i.group));i.group&&!r&&(r={type:"group",key:i.group,expanded:!0,icon:i.icon,title:i.group,children:[],renderAsButton:!1},l.push(r)),r?r.children.push({type:"item",key:"".concat(a+d,"-item"),hotkey:i.shortcut,icon:i.icon,onAction:()=>e.actionHandler(i),renderAsButton:null!=(t=i.showAsAction)&&t,selected:i.selected,title:i.title,tone:i.tone}):c.push({type:"item",key:"".concat(a+d,"-item"),hotkey:i.shortcut,icon:i.icon,onAction:()=>e.actionHandler(i),renderAsButton:null!=(n=i.showAsAction)&&n,selected:i.selected,title:i.title,tone:i.tone})}return[...c,...l,...s]}function sn(e,t){var n,i,o;return"divider"===e.type?{type:"divider",key:t}:"group"===e.type?{type:"group",key:t,children:e.children.map(((e,n)=>sn(e,"".concat(t,"-").concat(n,"-").concat(e.type)))),disabled:e.disabled,expanded:null==(n=e.expanded)||n,icon:e.icon,title:e.title,renderAsButton:null!=(i=e.renderAsButton)&&i}:{type:"item",key:t,disabled:e.disabled,icon:e.icon,iconRight:e.iconRight,onAction:e.onAction,renderAsButton:null!=(o=e.renderAsButton)&&o,selected:e.selected,title:e.title,tone:e.tone}}const an=(0,N.forwardRef)((function(e,t){const{intent:n,...i}=e,o=(0,N.useMemo)((()=>(0,N.forwardRef)((function(e,t){return(0,B.jsx)(ce.nR,{...e,intent:n.type,params:n.params,ref:t})}))),[n]);return e.disabled?(0,B.jsx)(V.zx,{...e,as:"a",role:"link","aria-disabled":"true"}):(0,B.jsx)(V.zx,{...i,as:o,"data-as":"a",ref:t})}));function ln(e){let{reveal:t,loading:n,children:i}=e;const o=(0,H.xJ)();return t?(0,B.jsx)(V.u,{content:n?(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(V.xv,{children:"Loading\u2026"})}):(0,B.jsx)(H.FMn,{currentUser:o}),portal:!0,children:(0,B.jsx)("div",{children:i})}):(0,B.jsx)(B.Fragment,{children:i})}const cn={constrainSize:!0,placement:"bottom",portal:!0},dn=(e,t,n)=>{var i;const o=null==(i=t.find((e=>e.id===n.templateId)))?void 0:i.schemaType;if(!o)return null;const r={template:n.templateId,type:o,id:n.initialDocumentId};return{type:"create",params:n.parameters?[r,n.parameters]:r}};function un(e){let{templateItems:t}=e;(0,H.I_y)();const n=(0,H.zEW)(),[i,o]=(0,H.UMU)({templateItems:t}),r=(0,N.useMemo)((()=>!o&&(null==i?void 0:i.every((e=>!e.granted)))),[o,i]),s=(0,N.useMemo)((()=>i?i.reduce(((e,t)=>(e[t.id]=t,e)),{}):{}),[i]);if(r)return(0,B.jsx)(ln,{reveal:!0,loading:o,children:(0,B.jsx)(V.zx,{"aria-label":"Insufficient permissions",icon:O.j29,mode:"bleed",disabled:!0,"data-testid":"action-intent-button"})});if(1===t.length){const e=t[0],i=s[e.id],r=!(null==i?void 0:i.granted),a=dn(0,n,e);return a?(0,B.jsx)(ln,{reveal:r,loading:o,children:(0,B.jsx)(an,{"aria-label":e.title,icon:e.icon||O.j29,intent:a,mode:"bleed",disabled:r,"data-testid":"action-intent-button"})}):null}return(0,B.jsx)(V.j2,{button:(0,B.jsx)(V.zx,{icon:O.j29,mode:"bleed","data-testid":"multi-action-intent-button"}),id:"create-menu",menu:(0,B.jsxs)(V.v2,{children:[(0,B.jsx)(V.xu,{paddingX:3,paddingTop:3,paddingBottom:2,children:(0,B.jsx)(V.__,{muted:!0,children:"Create"})}),t.map(((e,t)=>{const i=s[e.id],r=!(null==i?void 0:i.granted),a=dn(0,n,e),l=n.find((t=>t.id===e.templateId));if(!l||!a)return null;const c=(0,N.forwardRef)(((e,t)=>r?(0,B.jsx)("button",{type:"button",disabled:!0,...e,ref:t}):(0,B.jsx)(ce.nR,{...e,intent:a.type,params:a.params,ref:t})));return c.displayName="Link",(0,B.jsx)(ln,{reveal:r,loading:o,children:(0,B.jsx)(V.sN,{as:c,"data-as":r?"button":"a",text:e.title||l.title,"aria-label":r?"Insufficient permissions":e.title||l.title,disabled:r,"data-testid":"action-intent-button-".concat(t)})},e.id)}))]}),popover:cn})}function pn(e){return null!==e&&void 0!==e}const hn=(0,N.memo)((function(e){const{initialValueTemplateItems:t=H.LZ8,menuItems:n=H.LZ8,menuItemGroups:i=H.LZ8,actionHandlers:o=H.NuZ}=e,r=(0,H.zEW)(),s=(0,N.useCallback)((e=>{if("string"===typeof e.action&&!(e.action in o))return console.warn("No handler for action:",e.action),!1;const t="function"===typeof e.action?e.action:"string"===typeof e.action?o[e.action]:null;return!!t&&(t(e.params),!0)}),[o]),a=(0,N.useMemo)((()=>rn({actionHandler:s,menuItemGroups:i,menuItems:n.filter((e=>{var t;return"create"!==(null==(t=e.intent)?void 0:t.type)}))})),[s,i,n]),l=(0,N.useMemo)((()=>a.filter(nn)),[a]),c=(0,N.useMemo)((()=>
1a.filter(on)),[a]),d=(0,N.useMemo)((()=>n.map(((e,t)=>{var n;if("create"!==(null==(n=e.intent)?void 0:n.type))return null;const{params:i}=e.intent;if(!i)return null;const o=Array.isArray(i)?i[0]:i,s=Array.isArray(i)?i[1]:void 0,a=o.template||o.type;if(!a)return null;const l=r.find((e=>e.id===a));if(!l)return null;return{item:e,template:l,templateParams:s,menuItemIndex:t,initialDocumentId:o.id}})).filter(pn).map((e=>{let{initialDocumentId:t,item:n,template:i,menuItemIndex:o,templateParams:r}=e;return{id:"menuItem".concat(o),initialDocumentId:t,templateId:i.id,type:"initialValueTemplateItem",title:n.title||i.title,icon:n.icon,description:i.description,parameters:r,schemaType:i.schemaType}}))),[n,r]),u=(0,N.useMemo)((()=>me()([...d,...t],(e=>(e=>{const t=e=>"object"===typeof e&&e?Array.isArray(e)?e.map(t):Object.entries(e).sort(((e,t)=>{let[n]=e,[i]=t;return n.localeCompare(i,"en")})):e;return JSON.stringify(t((n=e,JSON.parse(JSON.stringify(n)))));var n})([e.initialDocumentId,e.templateId,e.parameters])))),[d,t]);return(0,B.jsxs)(V.kC,{gap:1,children:[u.length>0&&(0,B.jsx)(un,{templateItems:u}),l.map((e=>(0,B.jsx)(Xt,{node:e},e.key))),c.length>0&&(0,B.jsx)(Et,{nodes:c})]})})),mn={NOTHING_TO_DELETE:"This document doesn\u2019t yet exist or is already deleted"},fn=e=>{let{id:t,type:n,draft:i,onComplete:o}=e;const{delete:r}=(0,H.d9t)(t,n),[s,a]=(0,N.useState)(!1),[l,c]=(0,N.useState)(!1),d=(0,N.useCallback)((()=>{c(!1),o()}),[o]),u=(0,N.useCallback)((()=>{a(!0),c(!1),r.execute(),o()}),[r,o]),p=(0,N.useCallback)((()=>{c(!0)}),[]),[h,m]=(0,H.hHf)({id:t,type:n,permission:"delete"}),f=(0,H.xJ)();return m||(null==h?void 0:h.granted)?{tone:"critical",icon:O.XHJ,disabled:s||Boolean(r.disabled)||m,title:r.disabled&&mn[r.disabled]||"",label:s?"Deleting\u2026":"Delete",shortcut:"Ctrl+Alt+D",onHandle:p,dialog:l&&{type:"custom",component:(0,B.jsx)(bt,{action:"delete",id:(null==i?void 0:i._id)||t,type:n,onCancel:d,onConfirm:u})}}:{tone:"critical",icon:O.XHJ,disabled:!0,label:"Delete",title:(0,B.jsx)(H.FMn,{operationLabel:"delete this document",currentUser:f})}};fn.action="delete";const yn={NO_CHANGES:"This document has no unpublished changes",NOT_PUBLISHED:"This document is not published"},xn=e=>{let{id:t,type:n,published:i,liveEdit:o,onComplete:r}=e;const{discardChanges:s}=(0,H.d9t)(t,n),[a,l]=(0,N.useState)(!1),[c,d]=(0,H.hHf)({id:t,type:n,permission:"discardDraft"}),u=(0,H.xJ)(),p=(0,N.useCallback)((()=>{s.execute(),r()}),[s,r]),h=(0,N.useCallback)((()=>{l(!0)}),[]),m=(0,N.useMemo)((()=>a&&{type:"confirm",tone:"critical",onCancel:r,onConfirm:p,message:(0,B.jsx)(B.Fragment,{children:"Are you sure you want to discard all changes since last published?"})}),[p,a,r]);return!i||o?null:d||(null==c?void 0:c.granted)?{tone:"critical",icon:O.X5P,disabled:Boolean(s.disabled)||d,title:s.disabled&&yn[s.disabled]||"",label:"Discard changes",onHandle:h,dialog:m}:{tone:"critical",icon:O.X5P,disabled:!0,label:"Discard changes",title:(0,B.jsx)(H.FMn,{operationLabel:"discard changes in this document",currentUser:u})}};xn.action="discardChanges";const gn={NOTHING_TO_DUPLICATE:"This document doesn\u2019t yet exist so there\u2018s nothing to duplicate"},vn=e=>{let{id:t,type:n,onComplete:i}=e;const{duplicate:o}=(0,H.d9t)(t,n),{navigateIntent:r}=(0,ce.tv)(),[s,a]=(0,N.useState)(!1),[l,c]=(0,H.hHf)({id:t,type:n,permission:"duplicate"}),d=(0,H.xJ)(),u=(0,N.useCallback)((()=>{const e=(0,ge.Z)();a(!0),o.execute(e),r("edit",{id:e,type:n}),i()}),[o,r,i,n]);return c||(null==l?void 0:l.granted)?{icon:O.TIy,disabled:s||Boolean(o.disabled)||c,label:s?"Duplicating\u2026":"Duplicate",title:o.disabled&&gn[o.disabled]||"",onHandle:u}:{icon:O.TIy,disabled:!0,label:"Duplicate",title:(0,B.jsx)(H.FMn,{operationLabel:"duplicate this document",currentUser:d})}};vn.action="duplicate";const bn=e=>{let{id:t,type:n,revision:i,onComplete:o}=e;const{restore:r}=(0,H.d9t)(t,n),{navigateIntent:s}=(0,ce.tv)(),[a,l]=(0,N.useState)(!1),c=(0,N.useCallback)((()=>{r.execute(i),s("edit",{id:t,type:n}),o()}),[r,i,s,t,n,o]),d=(0,N.useCallback)((()=>{l(!0)}),[]),u=(0,N.useMemo)((()=>a?{type:"confirm",tone:"critical",onCancel:o,onConfirm:c,message:(0,B.jsx)(B.Fragment,{children:"Are you sure you want to restore this document?"})}:null),[c,a,o]),p="@initial"===i;return void 0===i?null:{label:"Restore",color:"primary",onHandle:d,title:p?"You can't restore to the initial version":"Restore to this version",icon:O.vaD,dialog:u,disabled:p}};bn.action="restore";const wn=(0,N.createContext)(null);function jn(){const e=(0,N.useContext)(wn);if(!e)throw new Error("DocumentPane: missing context value");return e}const In={LIVE_EDIT_ENABLED:"Cannot publish since liveEdit is enabled for this document type",ALREADY_PUBLISHED:"Already published",NO_CHANGES:"No unpublished changes",NOT_READY:"Operation not ready"};const Cn=e=>{var t;const{id:n,type:i,liveEdit:o,draft:r,published:s}=e,[a,l]=(0,N.useState)(null),{publish:c}
1=(0,H.d9t)(n,i),d=(0,H.a3k)(n,i),u=(0,H.nuD)(n,i),{changesOpen:p,onHistoryOpen:h,documentId:m,documentType:f}=jn(),y=(0,H.iav)(m,f),x=((null==y?void 0:y.draft)||(null==y?void 0:y.published)||{})._rev,g=d.validation.some(xe.YN),[v,b]=(0,N.useState)(!1),w=u.isSyncing,j=d.isValidating,[I,C]=(0,H.hHf)({id:n,type:i,permission:"publish"}),T=(0,H.xJ)(),k=c.disabled?(_=c.disabled,E=(s||{})._updatedAt,("ALREADY_PUBLISHED"===_&&E?(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)("span",{children:["Published ",(0,B.jsx)(Fe,{time:E})]})}):In[_])||""):g?"There are validation errors that need to be fixed before this document can be published":"";var _,E;const P=Boolean(r),D=(0,N.useCallback)((()=>{c.execute(),l("publishing")}),[c]);(0,N.useEffect)((()=>{const e=!1===d.isValidating&&d.revision!==x;v&&!w&&e&&(g||D(),b(!1))}),[w,D,g,v,d.revision,x,j,d.isValidating]),(0,N.useEffect)((()=>{const e="publishing"===a&&!P;e&&p&&h();const t=e?"published":null,n=setTimeout((()=>{l(t)}),e?200:4e3);return()=>clearTimeout(n)}),[p,a,P,h]);const S=(0,N.useCallback)((()=>{u.isSyncing||d.isValidating||d.revision!==x?b(!0):D()}),[u.isSyncing,d.isValidating,d.revision,x,D]);
1if(o)return{tone:"positive",label:"Publish",title:"Live Edit is enabled for this content type and publishing happens automatically as you make changes",disabled:!0};if(!C&&!(null==I?void 0:I.granted))return{tone:"positive",label:"Publish",title:(0,B.jsx)(H.FMn,{operationLabel:"publish this document",currentUser:T}),disabled:!0};const R=Boolean(v||(null==(t=null==y?void 0:y.transactionSyncLock)?void 0:t.enabled)||"publishing"===a||"published"===a||g||c.disabled);return{disabled:R||C,tone:"positive",label:"published"===a?"Published":v||"publishing"===a?"Publishing\u2026":"Publish",icon:"published"===a?O.KML:O.EI4,title:v?"Waiting for tasks to finish before publishing":"published"===a||"publishing"===a?null:k,shortcut:R||v?null:"Ctrl+Alt+P",onHandle:S}};Cn.action="publish";const Tn={NOT_PUBLISHED:"This document is not published"},kn=e=>{let{id:t,type:n,draft:i,onComplete:o,liveEdit:r}=e;const{unpublish:s}=(0,H.d9t)(t,n),[a,l]=(0,N.useState)(!1),[c,d]=(0,H.hHf)({id:t,type:n,permission:"unpublish"}),u=(0,H.xJ)(),p=(0,N.useCallback)((()=>{l(!1),o()}),[o]),h=(0,N.useCallback)((()=>{l(!1),s.execute(),o()}),[o,s]),m=(0,N.useMemo)((()=>a?{type:"dialog",onClose:o,content:(0,B.jsx)(bt,{id:(null==i?void 0:i._id)||t,type:n,action:"unpublish",onCancel:p,onConfirm:h})}:null),[i,t,p,h,a,o,n]);return r?null:d||(null==c?void 0:c.granted)?{tone:"critical",icon:O.xEY,disabled:Boolean(s.disabled)||d,label:"Unpublish",title:s.disabled?Tn[s.disabled]:"",onHandle:()=>l(!0),dialog:m}:{tone:"critical",icon:O.xEY,label:"Unpublish",title:(0,B.jsx)(H.FMn,{operationLabel:"unpublish this document",currentUser:u}),disabled:!0}};kn.action="unpublish";const _n=!1,En={},Pn=Symbol("LOADING_PANE"),Dn="documentPanelPortalElement",Sn={activePanes:[]};function Rn(e){Sn.activePanes=e}function An(e,t,n,i){var o;const r=(null==n?void 0:n.panes)||[],s=Sn.activePanes||[],a=t.id||(0,ge.Z)(),l="create"===e&&t.template;for(let c=s.length-1;c>=0;c--){const n=s[c];if("object"===typeof n&&((null==(o=n.canHandleIntent)?void 0:o.call(n,e,t,{pane:n,index:c}))||"documentList"===n.type&&n.schemaTypeName===t.type&&"_type == $type"===n.options.filter)){const e=l?{template:t.template}:En;return{panes:r.slice(0,c).concat([[{id:a,params:e,payload:i}]])}}}return{intent:e,params:t,payload:i}}const Mn={};const Ln=ce.BC.create("/",[ce.BC.intents("/intent"),ce.BC.create("/edit/:type/:editDocumentId",[ce.BC.create({path:"/:params",transform:{params:{toState:function(e){try{return JSON.parse(decodeURIComponent(e))}catch(t){return console.warn("Failed to parse JSON parameters"),{}}},toPath:function(e){return JSON.stringify(e)}}}})]),ce.BC.create({path:"/:panes",children:[ce.BC.create("/:action",ce.BC.create("/:legacyEditDocumentId"))],transform:{panes:{toState:function(e){return function(e){if(-1!==e.indexOf(",{"))return function(e){const t=[];let n=e;for(;n.length;){const[e,i,o]=n.match(Un)||[];if(!e){n=n.slice(1);continue}const r=o&&Bn(o);t.push({id:i,payload:r}),n=n.slice(e.length)}return[t]}(e);return e.split(";").map((e=>{const[t,...n]=e.split("|").map((e=>{const[t,...n]=e.split(",");return function(e,t){return e.reduce(((e,t)=>{if((e=>/^[a-z0-9]+=[^=]+/i.test(e))(t)){const n=t.slice(0,t.indexOf("=")),i=t.slice(n.length+1);e.params={...e.params,[decodeURIComponent(n)]:decodeURIComponent(i)}}else(e=>/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e))(t)?e.payload=(n=t)?Bn(atob(n)):void 0:console.warn("Unknown pane segment: %s - skipping",t);var n;return e}),{...t,params:Mn,payload:void 0})}(n,{id:t})}));return[t,...n.map((e=>({...t,...e,id:e.id||t.id,params:{...ue()(t.params,zn),...e.params},payload:e.payload||t.payload})))]})).filter((e=>e.length>0))}(decodeURIComponent(e))},toPath:function(e){return function(e){return(e||[]).map((e=>e.map(Nn).join("|"))).map(encodeURIComponent).join(";")}(e)}}}})]),Un=/^([.a-z0-9_-]+),?({.*?})?(?:(;|$))/i,zn=["view","since","rev","inspect"],On=Boolean;function Nn(e,t,n){const{payload:i,params:o={},id:r}=e,[s]=n,a=e===s,l=0!==t&&r===s.id,c="undefined"===typeof i?void 0:btoa(JSON.stringify(i)),d=Object.entries(o).filter((e=>{var t;const[n,i]=e;if(!i)return!1;if(a)return!0;return!(i===(null==(t=s.params)?void 0:t[n])&&!zn.includes(n))})).map((e=>{let[t,n]=e;return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n))}));return[l?"":r].concat([d.length>0&&d,c].filter(On).flat()).join(",")||","}function Bn(e){try{return JSON.parse(e)}catch(t){return void console.warn("Failed to parse parameters: ".concat(t.message))}}const Hn=320,Vn=600,Zn=320,Fn=540,qn={},$n="inspect:",Gn=[{id:"inspectors"},{id:"links"}],Qn="sanity/desk/history",Yn=(0,Z.ZP)(V.Zb)({position:"relative",zIndex:1,lineHeight:0,"&:after":{content:'""',dis
1play:"block",position:"absolute",left:0,bottom:-1,right:0,borderBottom:"1px solid var(--card-border-color)",opacity:.5}});function Wn(e){const{as:t,children:n,closeButtonLabel:i,onClose:o,title:r,...s}=e;return(0,B.jsxs)(Yn,{...s,as:t,children:[(0,B.jsxs)(V.kC,{padding:2,children:[(0,B.jsx)(V.xu,{flex:1,padding:3,children:(0,B.jsx)(V.xv,{as:"h1",size:1,weight:"semibold",children:r})}),(0,B.jsx)(V.xu,{flex:"none",padding:1,children:(0,B.jsx)(V.zx,{"aria-label":i,fontSize:1,icon:O.Two,mode:"bleed",onClick:o,padding:2})})]}),n]})}const Xn=(0,N.createContext)(null);function Jn(){const e=(0,N.useContext)(Xn);if(!e)throw new Error("DeskTool: missing context value");return e}const Kn=Z.ZP.div(C||(C=He(["\n  position: absolute;\n  top: 0;\n  left: -4px;\n  bottom: 0;\n  width: 9px;\n  z-index: 201;\n  cursor: ew-resize;\n\n  /* Border */\n  & > span:nth-child(1) {\n    display: block;\n    border-left: 1px solid var(--card-border-color);\n    position: absolute;\n    top: 0;\n    left: 4px;\n    bottom: 0;\n    transition: opacity 200ms;\n    opacity: 0.5;\n  }\n\n  /* Hover effect */\n  & > span:nth-child(2) {\n    display: block;\n    position: absolute;\n    top: 0;\n    left: 0;\n    width: 9px;\n    bottom: 0;\n    background-color: var(--card-border-color);\n    opacity: 0;\n    transition: opacity 150ms;\n  }\n\n  @media (hover: hover) {\n    &:hover > span:nth-child(2) {\n      opacity: 0.2;\n    }\n  }\n"])));function ei(e){const{onResize:t,onResizeStart:n}=e,i=(0,N.useRef)(0),o=(0,N.useCallback)((e=>{e.preventDefault(),i.current=e.pageX,n();const o=e=>{e.preventDefault(),t(e.pageX-i.current)},r=()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",r)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",r)}),[t,n]);return(0,B.jsxs)(Kn,{onMouseDown:o,children:[(0,B.jsx)("span",{}),(0,B.jsx)("span",{})]})}const ti=(0,Z.ZP)(V.xu)(T||(T=He(["\n  position: relative;\n  flex: 1;\n  padding-left: 1px;\n"])));function ni(e){const{as:t,children:n,minWidth:i,maxWidth:o,...r}=e,[s,a]=(0,N.useState)(null),l=(0,N.useRef)(),[c,d]=(0,N.useState)(),u=(0,N.useCallback)((()=>{l.current=null==s?void 0:s.offsetWidth}),[s]),p=(0,N.useCallback)((e=>{const t=l.current;t&&d(Math.min(Math.max(t-e,i),o))}),[i,o]),h=(0,N.useMemo)((()=>c?{flex:"none",width:c}:{minWidth:i,maxWidth:o}),[i,o,c]);return(0,B.jsxs)(ti,{as:t,...r,ref:a,style:h,children:[n,(0,B.jsx)(ei,{onResize:p,onResizeStart:u})]})}const ii={error:O.uIy,warning:O.foC,info:O.hQ6},oi={error:"critical",warning:"caution",info:"primary"};function ri(e){const{marker:t,onOpen:n,schemaType:i,value:o}=e,r=(0,N.useCallback)((()=>n(t.path)),[t,n]),[s,a]=(0,N.useState)(null);return(0,B.jsxs)(V.SV,{onCatch:a,children:[s&&(0,B.jsx)(V.Zb,{padding:3,radius:2,tone:"critical",children:(0,B.jsxs)(V.xv,{size:1,children:["ERROR: ",s.error.message]})}),!s&&(0,B.jsx)(V.Zb,{__unstable_focusRing:!0,as:"button",onClick:r,padding:3,radius:2,tone:oi[t.level],children:(0,B.jsxs)(V.kC,{align:"flex-start",gap:3,children:[(0,B.jsx)(V.xu,{flex:"none",children:(0,B.jsx)(V.xv,{size:1,children:(0,N.createElement)(ii[t.level])})}),(0,B.jsxs)(V.Kq,{flex:1,space:2,children:[(0,B.jsx)(si,{path:t.path,schemaType:i,value:o}),(0,B.jsx)(V.xv,{muted:!0,size:1,children:t.item.message})]})]})})]})}function si(e){const{path:t,schemaType:n,value:i}=e,o=(0,N.useMemo)((()=>function(e){const{path:t,schemaType:n,value:i}=e,o=[];let r=n,s=i;for(const a of t)if("string"!==typeof a)if("number"!==typeof a){if(!(0,H.Uy$)(a)||!a._key)throw new Error("Invalid path segment: ".concat(JSON.stringify(a)));{if(!(0,H.kJL)(s))throw new Error("Parent value is not an anrray, cannot get path segment: [_key == ".concat(a,"]"));if("array"!==r.jsonType)throw new Error("Parent type is not an array schema type, cannot get path segment: .".concat(a));if(s=(null!=s?s:[]).find((e=>(0,H.Uy$)(e)&&e._key===a._key)),!(0,H.Uy$)(s))throw new Error("Array item not found: [_key == ".concat(a._key,"]"));const e=r.of.find((e=>(0,H.Uy$)(s)&&e.name===(null==s?void 0:s._type)));if(!e)throw new Error("Array item type not found: .".concat(null==s?void 0:s._type));r=e,o.push(r)}}else{if(!(0,H.kJL)(s)&&void 0!==s)throw new Error("Parent value is not an array, cannot get path segment: [".concat(a,"]"));if("array"!==r.jsonType)throw new Error("Parent type is not an array schema type, cannot get path segment: [".concat(a,"]"));s=null==s?void 0:s[a];const e=r.of.find((e=>"string"===typeof s?"string"===e.jsonType:"number"===typeof s?"number"===e.jsonType:"boolean"===typeof s?"boolean"===e.jsonType:!!(0,H.Uy$)(s)&&e.name===(null==s?void 0:s._type)));if(!e)throw new Error("Item type not found: [".concat(a,"]"));r=e,o.push(r)}else{if(!(0,H.Uy$)(s)&&void 0!==s)throw new Error("Parent value is not an object, cannot get path segment: .".concat(a));if("object"!==r.jsonType)throw new Error("Parent type is not an object schema type, cannot get path segment: .".concat(a));s=null==s?void 0:s[a];const e=r.fields.find((e=>e.name===a));if(!e)throw new Error("Field type not found: .".concat(a));r=e.type,o.push(r)}return o}({path:t,schemaType:n,value:i})),[t,n,i]);return(0,B.jsx)(V.xv,{size:1,children:o.map(((e,t)=>(0,B.jsxs)(N.Fragment,{children:[t>0&&(0,B.jsx)("span",{style:{color:"var(--card-muted-fg-color)",opacity:.5},children:" / "}),(0,B.jsx)("span",{style:{fontWeight:500},children:e.title||e.name})]},t)))})}const ai={name:"sanity/desk/validation",component:function(e){const{onClose:t}
1=e,{onFocus:n,onPathOpen:i,schemaType:o,validation:r,value:s}=jn(),a=(0,N.useCallback)((e=>{i(e),n(e)}),[n,i]);return(0,B.jsxs)(V.kC,{direction:"column",height:"fill",overflow:"hidden",children:[(0,B.jsx)(Wn,{as:"header",closeButtonLabel:"Close validation",flex:"none",onClose:t,title:"Validation"}),(0,B.jsxs)(V.Zb,{flex:1,overflow:"auto",padding:3,children:[0===r.length&&(0,B.jsx)(V.xu,{padding:2,children:(0,B.jsx)(V.xv,{muted:!0,size:1,children:"No validation errors"})}),r.length>0&&(0,B.jsx)(V.Kq,{space:2,children:r.map((e=>(0,B.jsx)(ri,{marker:e,onOpen:a,schemaType:o,value:s},(0,H.va7)(e.path))))})]})]})},useMenuItem:function(e){const{documentId:t,documentType:n}=e,{validation:i}=(0,H.a3k)(t,n),o=(0,N.useMemo)((()=>i.map((e=>({level:e.level,message:e.item.message,path:e.path})))),[i]),r=o.some(H.z12),s=o.some(H.AY8),a=(0,N.useMemo)((()=>r?O.uIy:s?O.foC:O.nSX),[r,s]),l=(0,N.useMemo)((()=>r?"critical":s?"caution":"positive"),[r,s]);return{hidden:0===o.length,icon:a,title:"Validation",tone:l,showAsAction:!0}}},li={create:"created",delete:"deleted",discardDraft:"discarded draft",initial:"created",editDraft:"edited",editLive:"live edited",publish:"published",unpublish:"unpublished"},ci={create:O.agZ,delete:O.XHJ,discardDraft:O.Two,initial:O.agZ,editDraft:O.dY8,editLive:O.dY8,publish:O.EI4,unpublish:O.xEY};function di(e){return li[e]}function ui(e){let{maxLength:t,userIds:n}=e;return(0,B.jsx)(V.Jh,{maxLength:t,children:n.map((e=>(0,B.jsx)(H.YtX,{user:e,withTooltip:!0},e)))})}const pi=(0,Z.ZP)(V.kC)((e=>{let{theme:t}=e;var n;const i=null==(n=t.sanity.color.base.skeleton)?void 0:n.from;return(0,Z.iv)(k||(k=He(["\n    --timeline-hairline-width: 1px;\n    position: relative;\n    z-index: 2;\n    margin: 0;\n    padding: 0;\n\n    &::before {\n      position: absolute;\n      content: '';\n      height: 100%;\n      width: var(--timeline-hairline-width);\n      background: ",";\n      top: 0;\n      left: calc((100% - var(--timeline-hairline-width)) / 2);\n      z-index: 1;\n    }\n  "])),i)})),hi=(0,Z.ZP)(V.zx)((e=>{let{$selected:t}=e;return(0,Z.iv)(_||(_=He(["\n    position: relative;\n    width: 100%;\n\n    /* Line styling */\n    &[data-first] ","::before {\n      height: 50%;\n      top: unset;\n      bottom: 0;\n    }\n\n    &[data-last] ","::before {\n      height: 50%;\n    }\n\n    ","\n  "])),pi,pi,t&&(0,Z.iv)(E||(E=He(["\n      ","::before {\n        background: transparent;\n      }\n    "])),pi))})),mi=(0,Z.ZP)(V.xu)(P||(P=He(["\n  background: var(--card-bg-color);\n  border-radius: 50px;\n  position: relative;\n  z-index: 2;\n"]))),fi=(0,Z.ZP)(V.xv)(D||(D=He(["\n  text-transform: capitalize;\n"]))),yi=(0,Z.ZP)(V.xu)(S||(S=He(["\n  min-width: 1rem;\n  margin-left: ",";\n"])),(e=>{let{theme:t}=e;return"-".concat((0,V.hO)(t.sanity.space[1]))})),xi={initial:"primary",create:"primary",publish:"positive",editLive:"caution",editDraft:"caution",unpublish:"critical",discardDraft:"critical",delete:"critical",withinSelection:"primary"};function gi(e){let{chunk:t,isFirst:n,isLast:i,isLatest:o,isSelected:r,onSelect:s,timestamp:a,type:l}=e;const c=function(e){return ci[e]}(l),d=Array.from(t.authors),u=(0,N.useMemo)((()=>{const e=new Date(a);return(0,ve.Z)(e,"MMM d, yyyy, hh:mm a")}),[a]),p=(0,N.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),s(t)}),[s,t]);return(0,B.jsx)(hi,{$selected:r,"data-chunk-id":t.id,"data-first":!!n||void 0,"data-last":!!i||void 0,"data-ui":"timelineItem",mode:r?"default":"bleed",onClick:p,padding:0,radius:2,tone:r?"primary":xi[t.type],children:(0,B.jsx)(V.xu,{paddingX:2,children:(0,B.jsxs)(V.kC,{align:"stretch",children:[(0,B.jsx)(pi,{align:"center",children:(0,B.jsx)(mi,{padding:2,children:(0,B.jsx)(V.xv,{size:2,children:c&&(0,N.createElement)(c)})})}),(0,B.jsxs)(V.Kq,{space:2,margin:2,children:[o&&(0,B.jsx)(V.kC,{children:(0,B.jsx)(V.Zb,{padding:1,radius:2,shadow:1,tone:r?"primary":xi[t.type],children:(0,B.jsx)(V.__,{muted:!0,size:0,children:"Latest"})})}),(0,B.jsx)(V.xu,{children:(0,B.jsx)(fi,{size:1,weight:"medium",children:di(l)||(0,B.jsx)("code",{children:l})})}),(0,B.jsx)(yi,{paddingX:1,children:(0,B.jsx)(V.xv,{size:0,muted:!0,children:u})})]}),(0,B.jsx)(V.kC,{flex:1,justify:"flex-end",align:"center",children:(0,B.jsx)(ui,{maxLength:3,userIds:d})})]})})})}const vi=(0,Z.ZP)(V.Kq)(R||(R=He(["\n  max-width: 200px;\n"]))),bi=(0,Z.ZP)(V.kC)(A||(A=He(["\n  max-height: calc(100vh - 198px);\n  min-width: 244px;\n"]))),wi=(0,Z.ZP)(V.xu)((e=>{let{$visible:t}=e;return(0,Z.iv)(M||(M=He(["\n    opacity: 0;\n    pointer-events: none;\n\n    ","\n  "])),t&&(0,Z.iv)(L||(L=He(["\n      opacity: 1;\n      pointer-events: auto;\n    "]))))})),ji=e=>{let{chunks:t,disabledBeforeFirstChunk:n,hasMoreChunks:i,lastChunk:o,onLoadMore:r,onSelect:s,firstChunk:a}=e;const[l,c]=(0,N.useState)(!1),d=(0,N.useMemo)((()=>t.filter((e=>!n||!a||e.index<a.index))),[t,n,a]),u=(0,N.useMemo)((()=>(null==o?void 0:o.id)?d.findIndex((e=>
1e.id===o.id)):-1),[null==o?void 0:o.id,d]),p=(0,N.useCallback)(((e,t)=>{let{activeIndex:o}=t;const r=0===o,a=d&&o===d.length-1||!1;return(0,B.jsxs)(V.xu,{paddingBottom:a?1:0,paddingTop:r?1:0,paddingX:1,children:[(0,B.jsx)(gi,{chunk:e,isFirst:r,isLast:a,isLatest:0===o&&!n,isSelected:o===u,onSelect:s,timestamp:e.endTimestamp,type:e.type}),o===d.length-1&&i&&(0,B.jsx)(V.kC,{align:"center",justify:"center",padding:4,children:(0,B.jsx)(V.$j,{muted:!0})})]})}),[n,d,i,s,u]);return(0,N.useEffect)((()=>c(!0)),[]),(0,B.jsxs)(wi,{$visible:!u||l,"data-ui":"timeline",children:[0===d.length&&(0,B.jsxs)(vi,{padding:3,space:3,children:[(0,B.jsx)(V.xv,{size:1,weight:"semibold",children:"No document history"}),(0,B.jsx)(V.xv,{muted:!0,size:1,children:"When changing the content of the document, the document versions will appear in this menu."})]}),d.length>0&&(0,B.jsx)(bi,{direction:"column",children:(0,B.jsx)(H.e8h,{activeItemDataAttr:"data-hovered",ariaLabel:"Document revisions",autoFocus:"list",initialIndex:u,initialScrollAlign:"center",itemHeight:40,items:d,onEndReached:r,onEndReachedIndexOffset:20,overscan:5,renderItem:p,wrapAround:!1})})]})};function Ii(){return(0,B.jsxs)(V.kC,{align:"flex-start",gap:3,padding:4,children:[(0,B.jsx)(H.LPT,{tone:"critical",children:(0,B.jsx)(O.uIy,{})}),(0,B.jsxs)(V.Kq,{space:4,children:[(0,B.jsx)(H.LPT,{size:1,tone:"critical",weight:"semibold",children:"An error occurred whilst retrieving document changes."}),(0,B.jsx)(H.LPT,{size:1,tone:"critical",children:"Document history transactions have not been affected."})]})]})}ji.displayName="Timeline";const Ci=(0,Z.ZP)(V.J2)(U||(U=He(["\n  overflow: hidden;\n  overflow: clip;\n"])));function Ti(e){let{chunk:t,mode:n,placement:i}=e;const{setTimelineRange:o,setTimelineMode:r,timelineError:s,ready:a,timelineStore:l}=jn(),[c,d]=(0,N.useState)(!1),[u,p]=(0,N.useState)(null),[h,m]=(0,N.useState)(null),f=(0,V.pm)(),y=(0,H.P08)(l,(e=>e.chunks)),x=(0,H.P08)(l,(e=>e.isLoading)),g=(0,H.P08)(l,(e=>e.hasMoreChunks)),v=(0,H.P08)(l,(e=>e.realRevChunk)),b=(0,H.P08)(l,(e=>e.sinceTime)),w=(0,N.useCallback)((()=>{r(n),d(!0)}),[n,r]),j=(0,N.useCallback)((()=>{r("closed"),d(!1)}),[r]),I=(0,N.useCallback)((()=>{c&&j()}),[j,c]),C=(0,N.useCallback)((e=>{!c||"Escape"!==e.key&&"Tab"!==e.key||(j(),null==u||u.focus())}),[u,j,c]);
1(0,V.O8)(I,[u,h]),(0,V.qh)(C);const T=(0,N.useCallback)((e=>{try{const[t,n]=l.findRangeForRev(e);r("closed"),o(t,n)}catch(t){f.push({closable:!0,description:t.message,status:"error",title:"Unable to load revision"})}}),[r,o,l,f]),k=(0,N.useCallback)((e=>{try{const[t,n]=l.findRangeForSince(e);r("closed"),o(t,n)}catch(t){f.push({closable:!0,description:t.message,status:"error",title:"Unable to load revision"})}}),[r,o,l,f]),_=(0,N.useCallback)((()=>{x||l.loadMore()}),[x,l]),E=s?(0,B.jsx)(Ii,{}):(0,B.jsxs)(B.Fragment,{children:["rev"===n&&(0,B.jsx)(ji,{chunks:y,firstChunk:v,hasMoreChunks:g,lastChunk:v,onLoadMore:_,onSelect:T}),"since"===n&&(0,B.jsx)(ji,{chunks:y,disabledBeforeFirstChunk:!0,firstChunk:v,hasMoreChunks:g,lastChunk:b,onLoadMore:_,onSelect:k})]}),P=(D=(null==t?void 0:t.endTimestamp)||"",(0,N.useMemo)((()=>{const e=D?new Date(D):new Date;return(0,ve.Z)(e,"MMM d, yyyy, hh:mm a")}),[D]));var D;const S=t?"".concat(we()(di(t.type)),": ").concat(P):"Latest version",R=t?"Since: ".concat(P):"Since: unknown version",A="rev"===n?S:R;return(0,B.jsx)(Ci,{constrainSize:!0,content:c&&E,"data-ui":"versionMenu",open:c,placement:i,portal:!0,ref:m,children:(0,B.jsx)(V.zx,{disabled:!a,mode:"bleed",fontSize:1,padding:2,iconRight:O.GVG,onClick:c?j:w,ref:p,selected:c,style:{maxWidth:"100%"},text:a?A:"Loading history"})})}function ki(){return(0,B.jsx)(Ve,{ms:300,children:(0,B.jsxs)(V.kC,{align:"center",direction:"column",height:"fill",justify:"center",paddingTop:3,children:[(0,B.jsx)(V.$j,{muted:!0}),(0,B.jsx)(V.xu,{marginTop:3,children:(0,B.jsx)(V.xv,{align:"center",muted:!0,size:1,children:"Loading changes"})})]})})}const _i=(0,Z.ZP)(H.l$t)(z||(z=He(["\n  height: 100%;\n  overflow: auto;\n  position: relative;\n  scroll-behavior: smooth;\n"])));function Ei(e){let{error:t,diff:n,documentContext:i,loading:o,schemaType:r}=e;return t?(0,B.jsx)(H.kwM,{}):o?(0,B.jsx)(ki,{}):n?(0,B.jsx)(H.H7Z.Provider,{value:i,children:(0,B.jsx)(H.EyJ,{diff:n,schemaType:r})}):(0,B.jsx)(H.kwM,{})}const Pi={name:Qn,useMenuItem:()=>{const{features:e}=Jn();return{hidden:!e.reviewChanges,icon:O.vaD,title:"Review changes"}},component:function(e){const{onClose:t}=e,{documentId:n,schemaType:i,timelineError:o,timelineStore:r,value:s}=jn(),a=(0,N.useRef)(null),l=(0,H.P08)(r,(e=>e.diff)),c=(0,H.P08)(r,(e=>e.onOlderRevision)),d=(0,H.P08)(r,(e=>e.selectionState)),u=(0,H.P08)(r,(e=>e.sinceTime)),p="loading"===d,h=!c,m=N.useMemo((()=>({documentId:n,schemaType:i,FieldWrapper:H.MUX,rootDiff:l,isComparingCurrent:h,value:s})),[n,l,h,i,s]),f=N.useMemo((()=>l?function(e){const t=new Map;return(0,H.Z7x)(e,(e=>{if("unchanged"===e.action||!("annotation"in e)||!e.annotation)return!0;const{author:n,timestamp:i}=e.annotation,o=t.get(n);return(!o||o.timestamp<i)&&t.set(n,e.annotation),!0})),Array.from(t.values()).sort(((e,t)=>e.timestamp<t.timestamp?1:-1))}(l):[]),[l]);return(0,B.jsxs)(V.kC,{"data-testid":"review-changes-pane",direction:"column",height:"fill",overflow:"hidden",children:[(0,B.jsx)(Wn,{as:"header",closeButtonLabel:"Close review changes",flex:"none",onClose:t,title:"Review changes",children:(0,B.jsxs)(V.kC,{gap:1,padding:3,paddingTop:0,paddingBottom:2,children:[(0,B.jsx)(V.xu,{flex:1,children:(0,B.jsx)(Ti,{mode:"since",chunk:u,placement:"bottom-start"})}),(0,B.jsx)(V.xu,{flex:"none",children:(0,B.jsx)(H.IIC,{annotations:f,description:"Changes by",portal:!0,children:(0,B.jsx)(V.Jh,{maxLength:4,children:f.map((e=>{let{author:t}=e;return(0,B.jsx)(H.YtX,{user:t},t)}))})})})]})}),(0,B.jsx)(V.Zb,{flex:1,children:(0,B.jsx)(V.NM,{element:a.current,children:(0,B.jsx)(_i,{"data-ui":"Scroller",ref:a,children:(0,B.jsx)(V.xu,{flex:1,padding:4,children:(0,B.jsx)(Ei,{diff:l,documentContext:m,error:o,loading:p,schemaType:i})})})})})]})},onClose:e=>{let{params:t}=e;return{params:{...t,since:void 0}}},onOpen:e=>{let{params:t}=e;return{params:{...t,since:"@lastPublished"}}}},Di=[Cn,kn,xn,vn,fn,bn],Si=[e=>{const{liveEdit:t}=e;return t?{label:"Live",color:"danger"}:null}],Ri=(0,H.Cw0)((e=>({name:"@sanity/desk-tool",document:{actions:e=>{const t=e.slice(0);for(const n of Di)t.includes(n)||t.push(n);return t},badges:e=>{const t=e.slice(0);for(const n of Si)t.includes(n)||t.push(n);return t},inspectors:[ai,Pi]},tools:[{name:(null==e?void 0:e.name)||"desk",title:(null==e?void 0:e.title)||"Desk",icon:(null==e?void 0:e.icon)||O.kLv,component:(0,N.lazy)((()=>Promise.all([n.e(245),n.e(817)]).then(n.bind(n,22847)).then((function(e){return e.index})))),canHandleIntent:(e,t)=>
1Boolean("edit"===e&&t.id||"create"===e&&t.type||"create"===e&&t.template),getIntentState:An,options:e,router:Ln}]})));function Ai(e){let{hasValue:t}=e;return{action:"inspect",group:"inspectors",title:"Inspect",icon:O.bg6,isDisabled:!t,shortcut:"Ctrl+Alt+I"}}function Mi(e){let{previewUrl:t}=e;return t?{action:"production-preview",group:"links",title:"Open preview",icon:O.YE8,shortcut:"Ctrl+Alt+O"}:null}function Li(e){const t=function(e){let{currentInspector:t,hasValue:n,inspectors:i,inspectorMenuItems:o}=e;return i.map(((e,i)=>{var r;const s=o[i];return!s||s.hidden?null:{action:"".concat($n).concat(e.name),group:s.showAsAction?void 0:"inspectors",icon:s.icon,isDisabled:!n,selected:(null==t?void 0:t.name)===e.name,shortcut:null==(r=s.hotkeys)?void 0:r.join("+"),showAsAction:s.showAsAction,title:s.title,tone:s.tone}})).filter(Boolean)}(e),n=[Mi(e)].filter(Boolean);return[...t,Ai(e),...n]}function Ui(e){const[t,n]=(0,N.useState)(void 0),[i,o]=(0,N.useState)(null),{resolveProductionUrl:r}=(0,H.Lky)().document,s=(0,le.l)(e);if(i)throw i;return(0,N.useEffect)((()=>{s.pipe((0,te.b)(500),(0,J.w)((e=>(e=>(0,H.Uy$)(e)&&"string"===typeof e._id&&"string"===typeof e._type)(e)?(0,Q.D)(r({document:e})):(0,G.of)(void 0))),(0,ee.K)((e=>{const t=(0,H.Uy$)(e)&&"string"===typeof e.message?e.message:"Unknown error";throw new Error("An error was thrown while trying to get your preview url: ".concat(t))}))).subscribe({next:n,error:o})}),[r,s]),t}const zi=(0,N.memo)((function(e){const{documentId:t,documentType:n,index:i,setMenuItem:o,useMenuItem:r}=e,s=(0,H.BoV)(r({documentId:t,documentType:n}));return(0,N.useEffect)((()=>{o(i,s)}),[i,s,o]),(0,B.jsx)(B.Fragment,{})}));function Oi(e){const{documentId:t,documentType:n,inspectors:i,onMenuItems:o}=e,r=i.length,s=(0,N.useRef)(r),[a,l]=(0,N.useState)((()=>Array.from(new Array(r)))),c=(0,N.useRef)(a);(0,N.useEffect)((()=>{if(s.current!==r){const e=Array.from(new Array(r));for(let t=0;t<r;t++)e[t]=c.current[t];s.current=r,l((()=>(c.current=e,e)))}}),[r]);const d=(0,N.useCallback)(((e,t)=>{l((n=>{const i=[...n];return i[e]=t,c.current=i,i}))}),[]);return(0,N.useEffect)((()=>{o(a.filter(Boolean))}),[a,o]),(0,B.jsx)(B.Fragment,{children:i.map(((e,i)=>e.useMenuItem&&(0,B.jsx)(zi,{documentId:t,documentType:n,index:i,setMenuItem:d,useMenuItem:e.useMenuItem},e.name)))})}const Ni=(0,N.memo)((e=>{const{children:t,index:n,pane:i,paneKey:o}=e,r=(0,H.I_y)(),s=(0,H.zEW)(),{actions:a,badges:l,unstable_fieldActions:c,unstable_languageFilter:d,inspectors:u}=(0,H.Lky)().document,p=(0,H.ap5)(),h=rt(),m=h.setParams,{features:f}=Jn(),{push:y}=(0,V.pm)(),{options:x,menuItemGroups:g=Gn,title:v=null,views:b=[]}=i,w=(0,H.BoV)(x),j=w.id,I=(0,H.vsM)(j),C=x.type,T=(0,H.BoV)(h.params)||qn,k=(0,H.BoV)(h.payload),{templateName:_,templateParams:E}=(0,N.useMemo)((()=>function(e,t){const n=t.panePayload||{},i=t.templateName;t.urlTemplate&&i&&i!==t.urlTemplate&&console.warn('Conflicting templates: URL says "'.concat(t.urlTemplate,'", structure node says "').concat(i,'". Using "').concat(i,'".'));const o=i||t.urlTemplate,r=e.filter((e=>e.schemaType===t.documentType)),s={...t.templateParams,..."object"===typeof n&&n||{}};let a=o;return o||1!==r.length||(a=r[0].id),{templateName:a,templateParams:s}}(s,{documentType:C,templateName:w.template,templateParams:w.templateParameters,panePayload:k,urlTemplate:T.template})),[C,w,T,k,s]),P=(0,H.t2O)({documentId:I,documentType:C,templateName:_,templateParams:E}),D=(0,H.BoV)(P),{patch:S}=(0,H.d9t)(I,C),R=(0,H.iav)(I,C),{validation:A}=(0,H.a3k)(I,C),M=(0,H.z1O)(I,C),L=r.get(C),U=(null==R?void 0:R.draft)||(null==R?void 0:R.published)||D.value,[z,O]=(0,N.useState)([]),Z=(0,N.useMemo)((()=>a({schemaType:C,documentId:I})),[a,I,C]),F=(0,N.useMemo)((()=>l({schemaType:C,documentId:I})),[l,I,C]),q=(0,N.useMemo)((()=>d({schemaType:C,documentId:I})),[I,C,d]),$=(0,H.BoV)(A),G=(0,H.BoV)(b),[Q,Y]=(0,N.useState)((()=>T.path?(0,pe.mL)(T.path):[])),W=T.view||G[0]&&G[0].id||null,[X,J]=(0,N.useState)("closed"),[K,ee]=(0,N.useState)(null),te=(0,H.Dab)({documentId:I,documentType:C,onError:ee,rev:T.rev,since:T.since}),ne=(0,H.P08)(te,(e=>e.onOlderRevision)),ie=(0,H.P08)(te,(e=>e.revTime)),oe=(0,H.P08)(te,(e=>e.sinceAttributes)),re=(0,H.P08)(te,(e=>e.timelineDisplayed)),se=(0,H.P08)(te,(e=>e.timelineReady)),ae=Ui(U),[le,ce]=(0,N.useState)([]);(0,N.useEffect)((()=>{const e=p.documentPresence(I).subscribe((e=>{ce(e)}));return()=>{e.unsubscribe()}}),[I,p]);const de=(0,N.useMemo)((()=>u({documentId:I,documentType:C})),[I,C,u]),[he,me]=(0,N.useState)((()=>T.inspect||null)),fe=(0,N.useRef)(T.inspect);(0,N.useEffect)((()=>{fe.current!==T.inspect&&(fe.current=T.inspect,me(T.inspect||null))}),[T.inspect]);const ye=null==de?void 0:de.find((e=>e.name===he)),xe=de.find((e=>e.name===Qn)),ge=(null==ye?void 0:ye.name)===Qn,ve=Boolean(U),be=(0,N.useMemo)((()=>Li({currentInspector:ye,features:f,hasValue:ve,inspectorMenuItems:z,inspectors:de,previewUrl:ae})),[ye,f,ve,z,de,ae]),we="on"===T.inspect,Ce=ge?oe:(null==R?void 0:R.published)||null,Te=(0,N.useMemo)((()=>L?c({documentId:I,documentType:C,schemaType:L}):[]),[I,C,c,L]),ke="connected"===M&&R.ready&&(se||!!K),_e=(0,N.useMemo)((()=>ne?re||{_id:U._id,_type:U._type}:U),[ne,re,U]),Ee=(0,N.useCallback)(((e,t)=>{m({...T,since:e,rev:t||void 0})}),[T,m]),Pe=(0,N.useCallback)((e=>{Y(e),p.setLocation([{type:"document",documentId:I,path:e,lastActiveAt:(new Date).toISOString()}])}),[I,p,Y]),De=(0,N.useCallback)((e=>{Y([])}),[Y]),Se=(0,N.useRef)((()=>{throw new Error("Nope")}));Se.current=e=>{S.execute((0,H.GWp)(e.patches),D.value)};const Re=(0,N.useCallback)((e=>Se.current(e)),[]),Ae=(0,N.useCallback)((e=>{var t,n,i,o;const r=e&&de.find((t=>t.name===e));if(!e||r){if(ye){if(r){const e=null!=(n=null==(t=r.onClose)?void 0:t.call(r,{params:T}))?n:{params:T};return me(null),fe.current=void 0,void m({...e.params,inspect:void 0})}if(ye){const e=null!=(o=null==(i=ye.onClose)?void 0:i.call(ye,{params:T}))?o:{params:T};me(null),fe.current=void 0,m({...e.params,inspect:void 0})}}}else console.warn('No inspector named "'.concat(e,'"'))}),[ye,de,T,m]),Me=(0,N.useCallback)(((e,t)=>{var n,i,o,r;const s=de.find((t=>t.name===e));if(!s)return void console.warn('No inspector named "'.concat(e,'"'));if((null==ye?void 0:ye.name)===s.name)return void m({...T,...t,inspect:s.name});let a=T;if(ye){a=(null!=(i=null==(n=s.onClose)?void 0:n.call(s,{params:a}))?i:{params:a}).params}const l=null!=(r=null==(o=s.onOpen)?void 0:o.call(s,{params:a}))?r:{params:a};me(s.name),fe.current=s.name,m({...l.params,...t,inspect:s.name})}),[ye,de,T,m]),Le=(0,N.useCallback)((()=>{xe&&Ae(xe.name)}
1),[Ae,xe]),Ue=(0,N.useCallback)((()=>{f.reviewChanges&&xe&&Me(xe.name)}),[f.reviewChanges,Me,xe]),ze=(0,N.useCallback)((()=>h.closeCurrent()),[h]),Oe=(0,N.useCallback)((()=>h.duplicateCurrent()),[h]),Ne=(0,N.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!we;m(e?{...T,inspect:"on"}:ue()(T,"inspect"))}),[we,T,m]),Be=(0,N.useCallback)((e=>{if("production-preview"===e.action&&ae)return window.open(ae),!0;if("inspect"===e.action)return Ne(!0),!0;if("reviewChanges"===e.action)return Ue(),!0;if("string"===typeof e.action&&e.action.startsWith($n)){const t=e.action.slice($n.length),n=de.find((e=>e.name===t));if(n)return n.name===he?Ae(n.name):Me(n.name),!0}return!1}),[Ae,Ue,he,de,Me,ae,Ne]),He=(0,N.useCallback)((e=>{for(const t of be)if(t.shortcut&&(0,je.ZP)(t.shortcut,e))return e.preventDefault(),e.stopPropagation(),void Be(t)}),[Be,be]),Ve=(0,N.useCallback)((()=>Ne(!1)),[Ne]),[Ze,Fe]=(0,N.useState)([]),[qe,$e]=(0,N.useState)(),[Ge,Qe]=(0,N.useState)(),[Ye,We]=(0,N.useState)(),Xe=(0,N.useCallback)(((e,t)=>{Qe((n=>(0,H.pt$)(n,e,t)))}),[]),Je=(0,N.useCallback)(((e,t)=>{We((n=>(0,H.pt$)(n,e,t)))}),[]),Ke=(0,N.useCallback)(((e,t)=>$e((n=>(0,H.pt$)(n,e,t)))),[]),et=U._createdAt?"update":"create",tt=Boolean(null==L?void 0:L.liveEdit),nt=U._id?U._id:"dummy-id",it=(0,N.useMemo)((()=>({...U,_id:tt?(0,H.vsM)(nt):(0,H.qyu)(nt)})),[tt,U,nt]),[ot,st]=(0,H.vSY)({document:it,permission:et}),at=!(null==U?void 0:U._id),lt=(0,N.useMemo)((()=>{var e;const t=!st&&!(null==ot?void 0:ot.granted),n=!(0,Ie.jA)(L,"update"),i=at&&!(0,Ie.jA)(L,"create"),o="reconnecting"===M,r=null==(e=R.transactionSyncLock)?void 0:e.enabled;return!ke||null!==ie||t||n||i||o||r}),[M,at,st,null==ot?void 0:ot.granted,ke,ie,L,R.transactionSyncLock]),ct=(0,H.clL)(L,{value:_e,readOnly:lt,comparisonValue:Ce,focusPath:Q,openPath:Ze,collapsedPaths:Ge,presence:le,validation:$,collapsedFieldSets:Ye,fieldGroupState:qe,changesOpen:ge}),dt=(0,N.useRef)(ct);dt.current=ct;const ut=(0,N.useCallback)((e=>{(0,H.C8M)(dt.current,e).forEach((e=>{"expandPath"===e.type&&Qe((t=>(0,H.pt$)(t,e.path,!1))),"expandFieldSet"===e.type&&We((t=>(0,H.pt$)(t,e.path,!1))),"setSelectedGroup"===e.type&&$e((t=>(0,H.pt$)(t,e.path,e.groupName)))})),Fe(e)}),[dt]),pt={actions:Z,activeViewId:W,badges:F,changesOpen:ge,closeInspector:Ae,collapsedFieldSets:Ye,collapsedPaths:Ge,compareValue:Ce,connectionState:M,displayed:_e,documentId:I,documentIdRaw:j,documentType:C,editState:R,fieldActions:Te,focusPath:Q,inspector:ye||null,inspectors:de,menuItems:be,onBlur:De,onChange:Re,onFocus:Pe,onPathOpen:ut,onHistoryClose:Le,onHistoryOpen:Ue,onInspectClose:Ve,onKeyUp:He,onMenuAction:Be,onPaneClose:ze,onPaneSplit:Oe,onSetActiveFieldGroup:Ke,onSetCollapsedPath:Xe,onSetCollapsedFieldSet:Je,openInspector:Me,index:n,inspectOpen:we,validation:$,menuItemGroups:g||[],paneKey:o,previewUrl:ae,ready:ke,schemaType:L,isPermissionsLoading:st,permissions:ot,setTimelineMode:J,setTimelineRange:Ee,timelineError:K,timelineMode:X,timelineStore:te,title:v,value:U,views:G,formState:ct,unstable_languageFilter:q};(0,N.useEffect)((()=>{"reconnecting"===M&&y({id:"sanity/desk/reconnecting",status:"warning",title:(0,B.jsx)(B.Fragment,{children:"Connection lost. Reconnecting\u2026"})})}),[M,y]),(0,N.useEffect)((()=>{var e;if(ke&&T.path){const{path:t,...n}=T,i=(0,pe.vW)(null==(e=dt.current)?void 0:e.value,(0,pe.mL)(t));Y(i),ut(i),h.setParams(n)}}),[T,I,ut,ke,h]);const[ht,mt]=(0,N.useState)([]);return(0,B.jsxs)(wn.Provider,{value:pt,children:[de.length>0&&(0,B.jsx)(Oi,{documentId:I,documentType:C,inspectors:de,onMenuItems:O}),Te.length>0&&L&&(0,B.jsx)(H.QMc,{actions:Te,documentId:I,documentType:C,onActions:mt,path:H.LZ8,schemaType:L}),(0,B.jsx)(H.kNp,{actions:ht,path:H.LZ8,children:t})]})}));Ni.displayName="DocumentPaneProvider";var Bi=Object.defineProperty,Hi=(e,t,n)=>(((e,t,n)=>{t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class Vi extends Error{constructor(e,t,n,i){super(e),Hi(this,"path"),Hi(this,"helpId");const o="undefined"===typeof n?"<unknown>":"".concat(n);this.path=(t||[]).concat(i?"".concat(o," (").concat(i,")"):o)}withHelpUrl(e){return this.helpId=e,this}}var Zi=(e=>(e.ID_REQUIRED="structure-node-id-required",e.TITLE_REQUIRED="structure-title-required",e.FILTER_REQUIRED="structure-filter-required",e.INVALID_LIST_ITEM="structure-invalid-list-item",e.COMPONENT_REQUIRED="structure-view-component-required",e.DOCUMENT_ID_REQUIRED="structure-document-id-required",e.DOCUMENT_TYPE_REQUIRED="structure-document-type-required",e.SCHEMA_TYPE_REQUIRED="structure-schema-type-required",e.SCHEMA_TYPE_NOT_FOUND="structure-schema-type-not-found",e.
1LIST_ITEMS_MUST_BE_ARRAY="structure-list-items-must-be-array",e.QUERY_PROVIDED_FOR_FILTER="structure-query-provided-for-filter",e.ACTION_OR_INTENT_REQUIRED="structure-action-or-intent-required",e.LIST_ITEM_IDS_MUST_BE_UNIQUE="structure-list-item-ids-must-be-unique",e.ACTION_AND_INTENT_MUTUALLY_EXCLUSIVE="structure-action-and-intent-mutually-exclusive",e))(Zi||{});const Fi=["_id","_type","_createdAt","_updatedAt","_rev"];function qi(e,t){const[n,...i]=t;if(!("fields"in e))return"";const o=e.fields.find((e=>e.name===n));if(!o)return Fi.includes(n)||console.warn('The current ordering config targeted the nonexistent field "%s" on schema type "%s". It should be one of %o',n,e.name,e.fields.map((e=>e.name))),"";if("to"in o.type&&"reference"===o.type.name){const e=o.type.to;return"".concat(n,"->{").concat(e.map((e=>qi(e,i))).join(","),"}")}const r=i.length>0&&qi(o.type,i),s=r?"{".concat(r,"}"):"";return i.length>0?"".concat(n).concat(s):n}function $i(e,t){return t.map((t=>qi(e,t.field.split(".")))).join(", ")}const Gi={title:"Last edited",name:"lastEditedDesc",by:[{field:"_updatedAt",direction:"desc"}]},Qi=Gi,Yi=[Gi,{title:"Created",name:"lastCreatedDesc",by:[{field:"_createdAt",direction:"desc"}]}];var Wi=Object.defineProperty,Xi=(e,t,n)=>(((e,t,n)=>{t in e?Wi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);function Ji(e,t,n){return e instanceof Ki?e.serialize({path:n,index:t}):e}class Ki{constructor(e,t){this._context=e,Xi(this,"spec"),this.spec=t||{}}action(e){return this.clone({action:e})}getAction(){return this.spec.action}intent(e){return this.clone({intent:e})}getIntent(){return this.spec.intent}title(e){return this.clone({title:e})}getTitle(){return this.spec.title}group(e){return this.clone({group:e})}getGroup(){return this.spec.group}icon(e){return this.clone({icon:e})}getIcon(){return this.spec.icon}params(e){return this.clone({params:e})}getParams(){return this.spec.params}showAsAction(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.clone({showAsAction:Boolean(e)})}getShowAsAction(){return this.spec.showAsAction}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const{title:t,action:n,intent:i}=this.spec;if(!t){const t="string"===typeof n?'action: "'.concat(n,'"'):void 0;throw new Vi("`title` is required for menu item",e.path,e.index,t).withHelpUrl(Zi.TITLE_REQUIRED)}if(!n&&!i)throw new Vi("`action` or `intent` required for menu item with title ".concat(this.spec.title),e.path,e.index,'"'.concat(t,'"')).withHelpUrl(Zi.ACTION_OR_INTENT_REQUIRED);if(i&&n)throw new Vi("cannot set both `action` AND `intent`",e.path,e.index,'"'.concat(t,'"')).withHelpUrl(Zi.ACTION_AND_INTENT_MUTUALLY_EXCLUSIVE);return{...this.spec,title:t}}clone(e){const t=new Ki(this._context);return t.spec={...this.spec,...e||{}},t}}function eo(e,t,n){return new Ki(e).group("sorting").title("Sort by ".concat(t.title)).icon(O.fzI).action("setSortOrder").params({by:t.by,extendedProjection:n})}function to(e,t){const{schema:n}=e,i="string"===typeof t?n.get(t):t;return i&&"orderings"in i?(i.orderings?i.orderings.concat(Yi):Yi).map((t=>eo(e,t,$i(i,t.by)))):[]}var no=Object.defineProperty,io=(e,t,n)=>(((e,t,n)=>{t in e?no(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);function oo(e,t,n){return e instanceof ro?e.serialize({path:n,index:t}):e}class ro{constructor(e,t){this._context=e,io(this,"_id"),io(this,"_title"),this._id=t?t.id:"",this._title=t?t.title:""}id(e){return new ro(this._context,{id:e,title:this._title})}getId(){return this._id}title(e){return new ro(this._context,{id:this._id,title:e})}getTitle(){return this._title}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const{_id:t,_title:n}=this;if(!t)throw new Vi("`id` is required for a menu item group",e.path,e.index,n).withHelpUrl(Zi.ID_REQUIRED);if(!n)throw new Vi("`title` is required for a menu item group",e.path,t).withHelpUrl(Zi.TITLE_REQUIRED);return{id:t,title:n}}}const so=/([^A-Za-z0-9-_.])/;
1function ao(e,t,n){if("string"!==typeof e)throw new Vi("Structure node id must be of type string, got ".concat(typeof e),t,n);const[i]=e.match(so)||[];if(i)throw new Vi('Structure node id cannot contain character "'.concat(i,'"'),t,n);if(e.startsWith("__edit__"))throw new Vi("Structure node id cannot start with __edit__",t,n);return e}function lo(e,t){if(t)return t;const n=Te()(e);return so.test(n)?Te()(_e()(e)):n}var co=Object.defineProperty,uo=(e,t,n)=>(((e,t,n)=>{t in e?co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class po{constructor(e){uo(this,"spec"),this.spec={options:{},...e||{}}}id(e){return this.clone({id:e})}getId(){return this.spec.id}title(e){return this.clone({title:e,id:lo(e,this.spec.id)})}getTitle(){return this.spec.title}child(e){return this.clone({child:e})}getChild(){return this.spec.child}component(e){return this.clone({component:e})}getComponent(){return this.spec.component}options(e){return this.clone({options:e})}getOptions(){return this.spec.options||{}}menuItems(e){return this.clone({menuItems:e})}getMenuItems(){return this.spec.menuItems}menuItemGroups(e){return this.clone({menuItemGroups:e})}getMenuItemGroups(){return this.spec.menuItemGroups}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const{id:t,title:n,child:i,options:o,component:r}=this.spec;if(!t)throw new Vi("`id` is required for `component` structure item",e.path,e.index).withHelpUrl(Zi.ID_REQUIRED);if(!r)throw new Vi("`component` is required for `component` structure item",e.path,e.index).withHelpUrl(Zi.ID_REQUIRED);return{id:ao(t,e.path,e.index),title:n,type:"component",child:i,component:r,options:o||{},menuItems:(this.spec.menuItems||[]).map(((t,n)=>Ji(t,n,e.path))),menuItemGroups:(this.spec.menuItemGroups||[]).map(((t,n)=>oo(t,n,e.path)))}}clone(e){const t=new po;return t.spec={...this.spec,...e||{}},t}}async function ho(e,t){const n=(0,H.vsM)(t),i=(0,H.qyu)(t);return(await e(H.Dr7).fetch("*[_id in [$documentId, $draftId]]._type",{documentId:n,draftId:i},{tag:"structure.resolve-type"}))[0]}var mo=Object.defineProperty,fo=(e,t,n)=>(((e,t,n)=>{t in e?mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class yo{constructor(){fo(this,"spec",{})}id(e){return this.clone({id:e})}getId(){return this.spec.id}title(e){return this.clone({title:e,id:this.spec.id||Se()(e)})}getTitle(){return this.spec.title}icon(e){return this.clone({icon:e})}getIcon(){return this.spec.icon}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const{id:t,title:n,icon:i}=this.spec;if(!t)throw new Vi("`id` is required for view item",e.path,e.index).withHelpUrl(Zi.ID_REQUIRED);if(!n)throw new Vi("`title` is required for view item",e.path,e.index).withHelpUrl(Zi.TITLE_REQUIRED);return{id:ao(t,e.path,e.index),title:n,icon:i}}}function xo(e,t,n){return"function"===typeof e.serialize?e.serialize({path:n,index:t}):e}var go=Object.defineProperty,vo=(e,t,n)=>(((e,t,n)=>{t in e?go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class bo extends yo{constructor(e){const t=(e=>(0,H.Uy$)(e)&&"component"===e.type)(e)?{...e}:{options:{}};super(),vo(this,"spec"),this.spec=t;const n="function"===typeof e?e:this.spec.component;n&&(this.spec=this.component(n).spec)}component(e){return this.clone({component:e})}getComponent(){return this.spec.component}options(e){return this.clone({options:e})}getOptions(){return this.spec.options||{}}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const t=super.serialize(e),n=this.spec.component;if("function"!==typeof n)throw new Vi("`component` is required and must be a function for `component()` view item",e.path,e.index).withHelpUrl(Zi.COMPONENT_REQUIRED);return{...t,component:n,options:this.spec.options||{},type:"component"}}clone(e){const t=new bo;return t.spec={...this.spec,...e||{}},t}}var wo=Object.defineProperty,jo=(e,t,n)=>(((e,t,n)=>{t in e?wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class Io extends yo{constructor(e){super(),jo(this,"spec"),this.spec={id:"editor",title:"Editor",...e||{}}}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};return{...super.serialize(e),type:"form"}}clone(e){const t=new Io;return t.spec={...this.spec,...e||{}},t}}const Co=e=>
1new Io(e);var To=Object.freeze({__proto__:null,ComponentViewBuilder:bo,FormViewBuilder:Io,GenericViewBuilder:yo,component:e=>new bo(e),form:Co,maybeSerializeView:xo}),ko=Object.defineProperty,_o=(e,t,n)=>(((e,t,n)=>{t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);const Eo=e=>{let{resolveDocumentNode:t,getClient:n}=e;return async(e,i)=>{let{params:o,path:r}=i,s=o.type;const a=r.slice(0,r.length-1),l=r[r.length-1];if(s||(s=await ho(n,e)),!s)throw new Vi("Failed to resolve document, and no type provided in parameters.",a,l);return t({documentId:e,schemaType:s})}};class Po{constructor(e,t){this._context=e,_o(this,"spec"),this.spec=t||{}}id(e){return this.clone({id:e})}getId(){return this.spec.id}title(e){return this.clone({title:e,id:lo(e,this.spec.id)})}getTitle(){return this.spec.title}child(e){return this.clone({child:e})}getChild(){return this.spec.child}documentId(e){const t=this.spec.id||e;return this.clone({id:t,options:{...this.spec.options||{},id:e}})}getDocumentId(){var e;return null==(e=this.spec.options)?void 0:e.id}schemaType(e){return this.clone({options:{...this.spec.options||{},type:"string"===typeof e?e:e.name}})}getSchemaType(){var e;return null==(e=this.spec.options)?void 0:e.type}initialValueTemplate(e,t){return this.clone({options:{...this.spec.options||{},template:e,templateParameters:t}})}getInitialValueTemplate(){var e;return null==(e=this.spec.options)?void 0:e.template}getInitialValueTemplateParameters(){var e;return null==(e=this.spec.options)?void 0:e.templateParameters}views(e){return this.clone({views:e})}getViews(){return this.spec.views||[]}serialize(){let{path:e=[],index:t,hint:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const i=e[t||e.length-1],o=this.spec.id||i&&"".concat(i)||"",r={id:o,type:void 0,template:void 0,templateParameters:void 0,...this.spec.options};if("string"!==typeof o||!o)throw new Vi("`id` is required for document nodes",e,t,n).withHelpUrl(Zi.ID_REQUIRED);if(!r||!r.id)throw new Vi("document id (`id`) is required for document nodes",e,o,n).withHelpUrl(Zi.DOCUMENT_ID_REQUIRED);if(!r||!r.type)throw new Vi("document type (`schemaType`) is required for document nodes",e,o,n);const s=(this.spec.views&&this.spec.views.length>0?this.spec.views:[Co()]).map(((t,n)=>xo(t,n,e))),a=s.map((e=>e.id)),l=Pe()(a.filter(((e,t)=>a.includes(e,t+1))));if(l.length>0)throw new Vi("document node has views with duplicate IDs: ".concat(l.join(",  ")),e,o,n);return{...this.spec,child:this.spec.child||Eo(this._context),id:ao(o,e,t),type:"document",options:Do(r),views:s}}clone(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=new Po(this._context),n={...this.spec.options||{},...e.options||{}};return t.spec={...this.spec,...e,options:n},t}}function Do(e){const t={id:e.id||"",type:e.type||"*"};return e.template&&(t.template=e.template),e.templateParameters&&(t.templateParameters=e.templateParameters),t}function So(e,t){let n=(null==t?void 0:t.type)?e.resolveDocumentNode({schemaType:t.type}):new Po(e);if(!t)return n;const{id:i,type:o,template:r,templateParameters:s}=t.options;return n=n.id(t.id).documentId(i),o&&(n=n.schemaType(o)),r&&(n=n.initialValueTemplate(r,s)),t.child&&(n=n.child(t.child)),n}function Ro(e,t,n){let{resolveDocumentNode:i,templates:o}=e;const r=o.find((e=>e.id===t));if(!r)throw new Error('Template with ID "'.concat(t,'" not defined'));return i({schemaType:r.schemaType}).initialValueTemplate(t,n)}const Ao=["default","card","media","detail","block"],Mo=Symbol("Document type list canHandleIntent"),Lo=(e,t,n)=>{let{pane:i}=n;var o,r;const s="edit"===e,a="create"===e,l=i,c=(null==(o=l.options)?void 0:o.filter)||"",d=(null==(r=l.options)?void 0:r.params)||{},u=l.schemaTypeName?[l.schemaTypeName]:Wo(c,d),p=l.initialValueTemplates||[];return a&&t.template?p.some((e=>e.templateId===t.template)):s&&t.id&&u.includes(t.type)||a&&u.includes(t.type)};Lo.identity=Mo;var Uo=Object.defineProperty,zo=(e,t,n)=>(((e,t,n)=>{t in e?Uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class Oo{constructor(e,t){this._context=e,zo(this,"spec"),this.spec=t||{}}id(e){return this.clone({id:e})}getId(){return this.spec.id}
1title(e){return this.clone({title:e})}getTitle(){return this.spec.title}description(e){return this.clone({description:e})}getDescription(){return this.spec.description}templateId(e){const t=this.spec.id||e;return this.clone({id:t,templateId:e})}getTemplateId(){return this.spec.templateId}parameters(e){return this.clone({parameters:e})}getParameters(){return this.spec.parameters}serialize(){let{path:e=[],index:t,hint:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const{spec:i,_context:o}=this,{templates:r}=o;if("string"!==typeof i.id||!i.id)throw new Vi("`id` is required for initial value template item nodes",e,t,n).withHelpUrl(Zi.ID_REQUIRED);if(!i.templateId)throw new Vi("template id (`templateId`) is required for initial value template item nodes",e,i.id,n).withHelpUrl(Zi.ID_REQUIRED);const s=r.find((e=>e.id===i.templateId));if(!s)throw new Vi("template id (`templateId`) is required for initial value template item nodes",e,i.id,n).withHelpUrl(Zi.ID_REQUIRED);return{id:i.id,templateId:i.id,schemaType:s.schemaType,type:"initialValueTemplateItem",description:i.description||s.description,title:i.title||s.title,subtitle:i.subtitle,icon:i.icon||s.icon,initialDocumentId:i.initialDocumentId,parameters:i.parameters}}clone(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=new Oo(this._context);return t.spec={...this.spec,...e},t}}function No(e){const{schema:t,getStructureBuilder:n,templates:i}=e,o=t.getTypeNames();return i.filter((e=>{var t;return!(null==(t=e.parameters)?void 0:t.length)})).sort(((e,t)=>o.indexOf(e.schemaType)-o.indexOf(t.schemaType))).map((e=>n().initialValueTemplateItem(e.id)))}function Bo(e,t){const{schema:n,templates:i}=e;return t.map((t=>{const o=i.find((e=>e.id===t.templateId)),r=t.title||(null==o?void 0:o.title)||"Create new",s=Ae()({type:o&&o.schemaType,template:t.templateId},Boolean),a=t.parameters?[s,t.parameters]:s,l=o&&n.get(o.schemaType);return new Ki(e).title(r).icon(o&&o.icon||(null==l?void 0:l.icon)||O.j29).intent({type:"create",params:a}).serialize()}))}var Ho=Object.defineProperty,Vo=(e,t,n)=>(((e,t,n)=>{t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);function Zo(){}const Fo=(e,t,n)=>{let{pane:i,index:o}=n;return o<=1&&Lo(e,t,{pane:i,index:o})};class qo{constructor(){Vo(this,"initialValueTemplatesSpecified",!1),Vo(this,"spec",{})}id(e){return this.clone({id:e})}getId(){return this.spec.id}title(e){return this.clone({title:e,id:lo(e,this.spec.id)})}getTitle(){return this.spec.title}defaultLayout(e){return this.clone({defaultLayout:e})}getDefaultLayout(){return this.spec.defaultLayout}menuItems(e){return this.clone({menuItems:e})}getMenuItems(){return this.spec.menuItems}menuItemGroups(e){return this.clone({menuItemGroups:e})}getMenuItemGroups(){return this.spec.menuItemGroups}child(e){return this.clone({child:e})}getChild(){return this.spec.child}canHandleIntent(e){return this.clone({canHandleIntent:e})}getCanHandleIntent(){return this.spec.canHandleIntent}showIcons(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.clone({displayOptions:{...this.spec.displayOptions||{},showIcons:e}})}getShowIcons(){return this.spec.displayOptions?this.spec.displayOptions.showIcons:void 0}initialValueTemplates(e){return this.initialValueTemplatesSpecified=!0,this.clone({initialValueTemplates:Array.isArray(e)?e:[e]})}getInitialValueTemplates(){return this.spec.initialValueTemplates}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const t=this.spec.id||"",n=e.path,i=this.spec.defaultLayout;if(i&&!Ao.includes(i))throw new Vi("`layout` must be one of ".concat(Ao.map((e=>'"'.concat(e,'"'))).join(", ")),n,t||e.index,this.spec.title);const o=(this.spec.initialValueTemplates||[]).map(((e,t)=>function(e,t,n){return e instanceof Oo?e.serialize({path:n,index:t}):e}(e,t,n)));return{id:ao(t,e.path,t||e.index),title:this.spec.title,type:"genericList",defaultLayout:i,child:this.spec.child||Zo,canHandleIntent:this.spec.canHandleIntent||Fo,displayOptions:this.spec.displayOptions,initialValueTemplates:o,menuItems:(this.spec.menuItems||[]).map(((e,t)=>Ji(e,t,n))),menuItemGroups:(this.spec.menuItemGroups||[]).map(((e,t)=>oo(e,t,n)))}}}var $o=Object.defineProperty,Go=(e,t,n)=>(((e,t,n)=>{t in e?$o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);const Qo=(e,t)=>{var n;const i=(null==(n=e.options)?void 0:n.filter.trim())||"";if(["*","{"].includes(i[0]))throw new Vi("`filter` cannot start with `".concat(i[0],"` - looks like you are providing a query, not a filter"),t.path,e.id,e.title).withHelpUrl(Zi.QUERY_PROVIDED_FOR_FILTER);return i};class Yo extends qo{constructor(e,t){super(),this._context=e,Go(this,"spec"),this.spec=t||{},this.initialValueTemplatesSpecified=Boolean(null==t?void 0:t.initialValueTemplates)}apiVersion(e){return this.clone({options:{...this.spec.options||{filter:""},apiVersion:e}})}getApiVersion(){var e;return null==(e=this.spec.options)?void 0:e.apiVersion}filter(e){return this.clone({options:{...this.spec.options||{},filter:e}})}getFilter(){var e;return null==(e=this.spec.options)?void 0:e.filter}schemaType(e){const t="string"===typeof e?e:e.name;return this.clone({schemaTypeName:t})}getSchemaType(){return this.spec.schemaTypeName}params(e){return this.clone({options:{...this.spec.options||{filter:""},params:e}})}getParams(){var e;return null==(e=this.spec.options)?void 0:e.params}defaultOrdering(e){if(!Array.isArray(e))throw new Error("`defaultOrdering` must be an array of order clauses");return this.clone({options:{...this.spec.options||{filter:""},defaultOrdering:e}})}getDefaultOrdering(){var e;return null==(e=this.spec.options)?void 0:e.defaultOrdering}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};var t,n;if("string"!==typeof this.spec.id||!this.spec.id)throw new Vi("`id` is required for document lists",e.path,e.index,this.spec.title).withHelpUrl(Zi.ID_REQUIRED);if(!this.spec.options||!this.spec.options.filter)throw new Vi("`filter` is required for document lists",e.path,this.spec.id,this.spec.title).withHelpUrl(Zi.FILTER_REQUIRED);
1return{...super.serialize(e),type:"documentList",schemaTypeName:this.spec.schemaTypeName,child:this.spec.child||(n=this._context,(e,t)=>{var i;const o=t.parent,r=(null==(i=t.params)?void 0:i.template)?n.templates.find((e=>e.id===t.params.template)):void 0,s=r?r.schemaType:o.schemaTypeName||ho(n.getClient,e);return Promise.resolve(s).then((t=>t?n.resolveDocumentNode({schemaType:t,documentId:e}):new Po(n).id("editor").documentId(e).schemaType("")))}),options:{...this.spec.options,apiVersion:this.spec.options.apiVersion||("_type == $type"===(null==(t=this.spec.options)?void 0:t.filter)?"2021-06-07":"1"),filter:Qo(this.spec,e)}}}clone(e){const t=new Yo(this._context);return t.spec={...this.spec,...e||{}},this.initialValueTemplatesSpecified||(t.spec.initialValueTemplates=function(e,t){const{document:n}=e,{schemaTypeName:i,options:o}=t,{filter:r,params:s}=o||{filter:"",params:{}},a=i?[i]:Array.from(new Set(Wo(r,s)));if(0===a.length)return;return a.flatMap((e=>n.resolveNewDocumentOptions({type:"structure",schemaType:e}))).map((e=>({...e,icon:O.j29})))}(this._context,t.spec)),t.spec.schemaTypeName||(t.spec.schemaTypeName=function(e){const{options:t}=e,{filter:n,params:i}=t||{filter:"",params:{}},o=Wo(n,i);return 1===o.length?o[0]:void 0}(t.spec)),t}getSpec(){return this.spec}}function Wo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Xo(e,t);return 0===n.length&&(n=Jo(e,t)),n}function Xo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=/\b_type\s*==\s*(['"].*?['"]|\$.*?(?:\s|$))|\B(['"].*?['"]|\$.*?(?:\s|$))\s*==\s*_type/g,i=[];let o;for(;null!==(o=n.exec(e));)i.push(o[1]||o[2]);return i.map((e=>(("$"===e[0]?t[e.slice(1)]:e)||"").trim().replace(/^["']|["']$/g,""))).filter(Boolean)}function Jo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=/\b_type\s+in\s+\[(.*?)\]/,i=e.match(n);return i?i[1].split(/,\s*/).map((e=>e.trim().replace(/^["']+|["']+$/g,""))).map((e=>"$"===e[0]?t[e.slice(1)]:e)).filter(Boolean):[]}var Ko=Object.defineProperty,er=(e,t,n)=>(((e,t,n)=>{t in e?Ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);const tr=e=>e instanceof rr?"ListBuilder":function(e){return(0,H.Uy$)(e)&&"function"===typeof e.then}(e)?"Promise":Array.isArray(e)?"array":typeof e,nr=e=>"listItem"===e.type,ir=(e,t,n)=>(n.pane.items||[]).filter(pr).some((e=>e.schemaType.name===t.type&&e._id===t.id))||Fo(e,t,n),or=(e,t)=>{const n=(t.parent.items.filter(nr).find((t=>t.id===e))||{child:void 0}).child;return n&&"function"===typeof n&&"function"===typeof n?n(e,t):n};class rr extends qo{constructor(e,t){super(),this._context=e,er(this,"spec"),this.spec=t||{},this.initialValueTemplatesSpecified=Boolean(t&&t.initialValueTemplates)}items(e){return this.clone({items:e})}getItems(){return this.spec.items}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const t=this.spec.id;if("string"!==typeof t||!t)throw new Vi("`id` is required for lists",e.path,e.index).withHelpUrl(Zi.ID_REQUIRED);const n="undefined"===typeof this.spec.items?[]:this.spec.items;if(!Array.isArray(n))throw new Vi("`items` must be an array of items",e.path,e.index).withHelpUrl(Zi.LIST_ITEMS_MUST_BE_ARRAY);const i=(e.path||[]).concat(t),o=n.map(((e,t)=>function(e,t,n){if(e instanceof lr)return e.serialize({path:n,index:t});const i=e;if(i&&"divider"===i.type)return e;if(!i||"listItem"!==i.type){const e=i&&i.type||tr(i),o="array"===e?" - did you forget to spread (...moreItems)?":"";throw new Vi('List items must be of type "listItem", got "'.concat(e,'"').concat(o),n,t).withHelpUrl(Zi.INVALID_LIST_ITEM)}return e}(e,t,i))),r=o.filter(((e,t)=>Le()(o,{id:e.id},t+1)));if(r.length>0){const t=r.map((e=>e.id)).slice(0,5),n=r.length>5?"".concat(t.join(", "),"..."):t.join(", ");throw new Vi("List items with same ID found (".concat(n,")"),e.path,e.index).withHelpUrl(Zi.LIST_ITEM_IDS_MUST_BE_UNIQUE)}return{...super.serialize(e),type:"list",canHandleIntent:this.spec.canHandleIntent||ir,child:this.spec.child||or,items:o}}clone(e){const t=new rr(this._context);return t.spec={...this.spec,...e||{}},t}}
1var sr=Object.defineProperty,ar=(e,t,n)=>(((e,t,n)=>{t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class lr{constructor(e,t){this._context=e,ar(this,"spec"),this.spec=t||{}}id(e){return this.clone({id:e})}getId(){return this.spec.id}title(e){return this.clone({title:e,id:lo(e,this.spec.id)})}getTitle(){return this.spec.title}icon(e){return this.clone({icon:e})}showIcon(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.clone({displayOptions:{...this.spec.displayOptions||{},showIcon:e}})}getShowIcon(){return this.spec.displayOptions?this.spec.displayOptions.showIcon:void 0}getIcon(){return this.spec.icon}child(e){return this.clone({child:e})}getChild(){return this.spec.child}schemaType(e){return this.clone({schemaType:e})}getSchemaType(){const e=this.spec.schemaType;return"string"===typeof e?this._context.schema.get(e):this.spec.schemaType}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const{id:t,title:n,child:i}=this.spec;if("string"!==typeof t||!t)throw new Vi("`id` is required for list items",e.path,e.index).withHelpUrl(Zi.ID_REQUIRED);if(!e.titleIsOptional&&("string"!==typeof n||!n))throw new Vi("`title` is required for list items",e.path,t).withHelpUrl(Zi.TITLE_REQUIRED);let o=this.spec.schemaType;if("string"===typeof o){const n=this._context.schema.get(o);if(!n)throw new Vi('Could not find type "'.concat(o,'" in schema'),e.path,t).withHelpUrl(Zi.SCHEMA_TYPE_NOT_FOUND);o=n}const r={path:e.path.concat(t),hint:"child"};let s=i instanceof po||i instanceof Yo||i instanceof Po||i instanceof rr?i.serialize(r):i;if("function"===typeof s){const e=s;s=(t,n)=>e(t,{...n,serializeOptions:r})}return{...this.spec,id:ao(t,e.path,e.index),schemaType:o,child:s,title:n,type:"listItem"}}clone(e){const t=new lr(this._context);return t.spec={...this.spec,...e||{}},t}}var cr=Object.defineProperty,dr=(e,t,n)=>(((e,t,n)=>{t in e?cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class ur extends lr{constructor(e,t){super(e,t),this._context=e,dr(this,"spec"),this.spec=t||{}}serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{path:[]};const t=super.serialize({...e,titleIsOptional:!0});if(!t.schemaType)throw new Vi("`schemaType` is required for document list items",e.path,e.index).withHelpUrl(Zi.SCHEMA_TYPE_REQUIRED);const n=t.child||((e,t)=>n=>{const i=t.schemaType&&("string"===typeof t.schemaType?t.schemaType:t.schemaType.name);return i?e.resolveDocumentNode({schemaType:i,documentId:n}):new Po(e).id("documentEditor").documentId(n)})(this._context,t);return{...t,child:n,schemaType:t.schemaType,_id:t.id}}clone(e){const t=new ur(this._context);return t.spec={...this.spec,...e||{}},t}}function pr(e){return(0,H.Uy$)(e)&&"undefined"!==typeof e.schemaType&&"string"===typeof e._id}var hr=Object.defineProperty,mr=(e,t,n)=>(((e,t,n)=>{t in e?hr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!==typeof t?t+"":t,n),n);class fr extends Yo{constructor(e,t){super(e),this._context=e,mr(this,"spec"),this.spec=t||{}}child(e){return this.cloneWithoutDefaultIntentHandler({child:e})}clone(e){const t=super.clone(e),n=new fr(this._context);return n.spec={...this.spec,...t.getSpec(),...e||{}},n}cloneWithoutDefaultIntentHandler(e){const t=super.clone(e),n=new fr(this._context),i=this.spec.canHandleIntent,o=i&&i.identity===Mo?{canHandleIntent:void 0}:{};return n.spec={...t.getSpec(),...this.spec,...e||{},...o},n}}const yr=["sanity.imageAsset","sanity.fileAsset"];function xr(e){let{schema:t}=e;return t.getTypeNames().filter((e=>{const n=t.get(e);return n&&function(e){var t;return"document"===(null==(t=e.type)?void 0:t.name)}(n)})).filter((e=>{return t=e,!yr.includes(t);var t}))}function gr(e){return xr(e).map((t=>vr(e,t)))}function vr(e,t){const{schema:n}=e,i=n.get(t);if(!i)throw new Error('Schema type with name "'.concat(t,'" not found'));const o=i.title||Be()(t);return new lr(e).id(t).title(o).schemaType(i).child(((n,i)=>{const o=i.parent,r="list"===o.type?o.items.find((e=>e.id===n)):null;let s=br(e,t);return r&&r.title&&(s=s.title(r.title)),s}))}function br(e,t){const{schema:n,resolveDocumentNode:i}
1=e,o="string"===typeof t?t:t.schemaType,r="string"===typeof o?o:o.name,s="string"===typeof t?{schemaType:o}:t,a=n.get(r);if(!a)throw new Error('Schema type with name "'.concat(r,'" not found'));const l=a.title||Be()(r),c=function(e){const t=e.preview;return Boolean(t&&(t.prepare||t.select&&t.select.media))}(a);return new fr(e).id(s.id||r).title(s.title||l).filter("_type == $type").params({type:r}).schemaType(a).showIcons(c).defaultOrdering(Qi.by).menuItemGroups(s.menuItemGroups||[{id:"sorting",title:"Sort"},{id:"layout",title:"Layout"},{id:"actions",title:"Actions"}]).child(s.child||(e=>i({schemaType:r,documentId:e}))).canHandleIntent(s.canHandleIntent||Lo).menuItems(s.menuItems||[...to(e,a),new Ki(e).group("layout").title("Compact view").icon(O.reJ).action("setLayout").params({layout:"default"}),new Ki(e).group("layout").title("Detailed view").icon(O.cMY).action("setLayout").params({layout:"detail"})])}function wr(e){const t=gr(e);return new rr(e).id("__root__").title("Content").items(t).showIcons(t.some((e=>{return!(!(t=e.getSchemaType())||"string"===typeof t)&&Boolean(t.icon);var t})))}function jr(e){let{defaultDocumentNode:t,structure:n,children:i}=e;const[o,r]=(0,N.useState)(!1),s=(0,H.Lky)(),a=(0,H.Q3k)(s),l=(0,H.H__)(),c=(0,N.useMemo)((()=>function(e){let{defaultDocumentNode:t,source:n}=e;const i=(0,H.nqf)(n),o={...n,getStructureBuilder:()=>r,resolveDocumentNode:e=>{let n=(null==t?void 0:t(r,{...e,...i}))||new Po(o);return n.getId()||(n=n.id("documentEditor")),e.documentId&&(n=n.documentId((0,H.vsM)(e.documentId))),n.schemaType(e.schemaType)}},r={defaults:()=>wr(o),documentTypeList:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return br(o,...t)},documentTypeListItem:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return vr(o,...t)},documentTypeListItems:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return gr(o,...t)},document:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new Po(o,...t)},documentWithInitialValueTemplate:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ro(o,...t)},defaultDocument:o.resolveDocumentNode,list:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new rr(o,...t)},listItem:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new lr(o,...t)},menuItem:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new Ki(o,...t)},menuItemGroup:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new ro(o,...t)},menuItemsFromInitialValueTemplateItems:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Bo(o,...t)},documentList:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new Yo(o,...t)},documentListItem:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new ur(o,...t)},orderingMenuItem:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return eo(o,...t)},orderingMenuItemsForType:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return to(o,...t)},editor:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return So(o,...t)},defaultInitialValueTemplateItems:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return No(o,...t)},initialValueTemplateItem:(e,t)=>new Oo(o,{id:e,parameters:t,templateId:e}),component:e=>(0,Oe.isValidElementType)(e)?(new po).component(e):new po(e),divider:()=>({id:ze()("__divider__"),type:"divider"}),view:To,context:o};return r}({defaultDocumentNode:t,source:s})),[t,s]),d=(0,N.useMemo)((()=>n?n(c,{...a,documentStore:l}):c.defaults()),[c,n,a,l]),u=(0,N.useMemo)((()=>({backButton:o,resizablePanes:!o,reviewChanges:!o,splitPanes:!o,splitViews:!o})),[o]),p=(0,N.useMemo)((()=>
1({features:u,layoutCollapsed:o,setLayoutCollapsed:r,rootPaneNode:d,structureContext:c.context})),[u,o,d,c.context]);return(0,B.jsx)(Xn.Provider,{value:p,children:i})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.