PageSourceSearch

https://staging-ahm-site.vercel.app/_next/static/chunks/b4ce4373.bd0fc5ef225315b0.js

js staging-ahm-site.vercel.app collected 2026-10-03 07:49:20 UTC 77,408 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[824],{51941:function(e,n,t){t.r(n),t.d(n,{Delay:function(){return eE},DocumentPane:function(){return tL},DocumentPaneProvider:function(){return no},index:function(){return tN},useDeskTool:function(){return e$},useDeskToolSetting:function(){return nP}});var i,l,r,o,a,s,d,c,u,p,h,f,m,x,g,j,v,b,y,w,k,C,_,S,P,z,M,E,I=t(85893),L=t(67294),T=t(49688),R=t(35455),O=t(57557),Z=t.n(O),D=t(9141),W=t(40052),F=t(32817),N=t(1718),A=t(69243),B=t(9653),U=t(70003),X=t(23071),V=t(53416),K=t(40148),$=t(30218),q=t(34978),H=t(29127),Y=t(98430),J=t(26472),G=t(56542),Q=t(53741),ee=t(93833),en=t(46297),et=t(42965),ei=t(79878),el=t(42006),er=t(32932),eo=t(38063),ea=t(18446),es=t.n(ea),ed=t(933),ec=t(25934),eu=t(68777),ep=t(43747);t(68929),t(989),t(44908),t(21804),t(35937),t(13311),t(73955);var eh=t(59864);t(18029);var ef=t(18156),em=t(18266),ex=t(92212);t(81763),t(47037);var eg=t(58898),ej=t(36991),ev=t(42298),eb=t(11700),ey=t.n(eb),ew=t(34391),ek=t.n(ew),eC=t(70248),e_=t.n(eC),eS=t(94885),eP=t.n(eS),ez=t(57627);function eM(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function eE(e){let{children:n,ms:t=0}=e,[i,l]=(0,L.useState)(t<=0);return((0,L.useEffect)(()=>{if(t<=0)return;let e=setTimeout(()=>l(!0),t);return()=>{clearTimeout(e)}},[t]),i&&n)?"function"==typeof n?n():n:(0,I.jsx)(I.Fragment,{})}let eI=e=>{let{actions:n,children:t,actionProps:i,onActionComplete:l}=e;return(0,I.jsx)(er.duV,{onReset:l,hooks:n,args:i,children:t})},eL=e=>{let{badges:n,children:t,badgeProps:i,...l}=e;return(0,I.jsx)(er.duV,{...l,hooks:n,args:i,children:t})},eT=[];function eR(e){let{children:n,flatIndex:t,index:i,params:l,payload:r,siblingIndex:o}=e,{navigate:a,navigateIntent:s}=(0,ed.tv)(),d=(0,ed.z)(),c=(0,L.useMemo)(()=>(null==d?void 0:d.panes)||eT,[null==d?void 0:d.panes]),u=i-1,p=(0,L.useCallback)(e=>{let n=c[u]||[],t=n[o],i=e(n,t),l=[...c.slice(0,u),i,...c.slice(u+1)],r={...d||{},panes:l};return setTimeout(()=>a(r),0),r},[u,a,c,d,o]),h=(0,L.useCallback)(e=>{p((n,t)=>[...n.slice(0,o),{...t,payload:e},...n.slice(o+1)])},[p,o]),f=(0,L.useCallback)(e=>{p((n,t)=>[...n.slice(0,o),{...t,params:e},...n.slice(o+1)])},[p,o]),m=(0,L.useCallback)(e=>{let{id:n,parentRefPath:t,type:i,template:l}=e;a({panes:[...c.slice(0,u+1),[{id:n,params:{template:l.id,parentRefPath:(0,em.BB)(t),type:i},payload:l.params}]]})},[u,a,c]),x=(0,L.useMemo)(()=>({index:t,groupIndex:u,siblingIndex:o,payload:r,params:l,hasGroupSiblings:!!c[u]&&c[u].length>1,groupLength:c[u]?c[u].length:0,routerPanesState:c,ChildLink:R.aL,BackLink:R.hb,ReferenceChildLink:R.HZ,handleEditReference:m,ParameterizedLink:R.V$,replaceCurrent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(()=>[{id:e.id||"",payload:e.payload,params:e.params||{}}])},closeCurrent:()=>{p((e,n)=>e.length>1?e.filter(e=>e!==n):e)},duplicateCurrent:e=>{p((n,t)=>{let i={...t,payload:(null==e?void 0:e.payload)||t.payload,params:(null==e?void 0:e.params)||t.params};return[...n.slice(0,o),i,...n.slice(o)]})},setView:e=>{let n=Z()(l,"view");return f(e?{...n,view:e}:n)},setParams:f,setPayload:h,navigateIntent:s}),[t,u,m,p,s,l,r,c,f,h,o]);return(0,I.jsx)(R.ud.Provider,{value:x,children:n})}let eO=[];class eZ extends Error{constructor(e){let{message:n,context:t,helpId:i,cause:l}=e;super(n),this.context=t,this.helpId=i,this.cause=l}}let eD=new WeakMap;function eW(e){let n=eD.get(e);if(n)return n;let t=(0,V.x0)();return eD.set(e,t),t}let eF=new WeakMap;function eN(e,n){let t=eF.get(e)||new Map;if(t){let e=t.get(n);if(e)return e}let i=e[n];if("function"!=typeof i)throw Error("Expected property `".concat(n,"` to be a function but got ").concat(typeof i," instead."));let l=i.bind(e);return t.set(n,l),eF.set(e,t),l}let eA=e=>!!e&&"function"==typeof(null==e?void 0:e.then),eB=e=>!!(0,er.Uy$)(e)&&"function"==typeof e.serialize,eU=e=>(n,t,i)=>{try{return e(n,t,i)}catch(e){if(e instanceof eZ)throw e;throw new eZ({message:"string"==typeof(null==e?void 0:e.message)?e.message:"",context:t,cause:e})}},eX=e=>function(){return e(...arguments).pipe((0,K._)(1),(0,$.x)())};function eV(e){let n=eU(eX(e((e,t,i)=>{if(!e)throw new eZ({message:"Pane returned no child",context:t,helpId:"structure-item-returned-no-child"});return eA(e)||(0,D.b)(e)?(0,W.D)(e).pipe((0,q.w)(e=>n(e,t,i))):eB(e)?n(e.serialize(t),t,i):"function"==typeof e?n(e(t.i
1d,t),t,i):(0,F.of)(e)})));return n}async function eK(e){let n=new Map,t=e=>(t,i,l)=>{let r=t&&"".concat(eW(t),"-").concat(i.path.join("__")),o=r&&n.get(r);if(o)return o;let a=e(t,i,l);return r&&n.set(r,a),a},i=eV(t),l=[[{id:"__edit__".concat(e.params.id),params:{...Z()(e.params,["id"]),type:e.params.type},payload:e.payload}]];async function r(e){var n;let{currentId:t,flatIndex:l,intent:o,params:a,parent:s,path:d,payload:c,unresolvedPane:u,levelIndex:p,structureContext:h}=e;if(!u)return[];let{id:f,type:m,...x}=a,g=await (0,N.z)(i(u,{id:t,splitIndex:0,parent:s,path:d,index:l,params:{},payload:void 0,structureContext:h},l));return"document"===g.type&&g.id===f?[{panes:[...d.slice(0,d.length-1).map(e=>[{id:e}]),[{id:f,params:x,payload:c}]],depthIndex:d.length,levelIndex:p}]:(null==(n=g.canHandleIntent)?void 0:n.call(g,o,a,{pane:g,index:l}))||"documentList"===g.type&&g.schemaTypeName===m&&"_type == $type"===g.options.filter?[{panes:[...d.map(e=>[{id:e}]),[{id:a.id,params:x,payload:c}]],depthIndex:d.length,levelIndex:p}]:"list"===g.type&&g.child&&g.items?(await Promise.all(g.items.map((e,n)=>"divider"===e.type?Promise.resolve([]):r({currentId:e._id||e.id,flatIndex:l+1,intent:o,params:a,parent:g,path:[...d,e.id],payload:c,unresolvedPane:"function"==typeof g.child?eN(g,"child"):g.child,levelIndex:n,structureContext:h})))).flat():[]}let o=await r({currentId:"root",flatIndex:0,levelIndex:0,intent:e.intent,params:e.params,parent:null,path:[],payload:e.payload,unresolvedPane:e.rootPaneNode,structureContext:e.structureContext}),a=o.sort((e,n)=>e.depthIndex===n.depthIndex?e.levelIndex-n.levelIndex:e.depthIndex-n.depthIndex)[0];return a?a.panes:l}function e$(){let e=(0,L.useContext)(R.zJ);if(!e)throw Error("DeskTool: missing context value");return e}let eq=(e,n)=>{let t=e.replace(/^__edit__/,""),{params:i,payload:l,structureContext:{resolveDocumentNode:r}}=n,{type:o,template:a}=i;if(!o)throw Error("Document type for document with ID ".concat(t," was not provided in the router params."));let s=r({schemaType:o,documentId:t});return s=s.id("editor").title("Editor"),a&&(s=s.initialValueTemplate(a,l)),s.serialize()},eH=e=>{let n={type:e.type,id:e.routerPaneSibling.id,params:e.routerPaneSibling.params||{},payload:e.routerPaneSibling.payload||null,flatIndex:e.flatIndex,groupIndex:e.groupIndex,siblingIndex:e.siblingIndex,path:e.path,paneNode:"resolvedMeta"===e.type?eW(e.paneNode):null};return"metaHash(".concat(JSON.stringify(n),")")};function eY(e){let{panes:n}=e,{navigate:t}=(0,ed.tv)();return(0,L.useEffect)(()=>{t({panes:n},{replace:!0})},[t,n]),(0,I.jsx)(T.Zb,{height:"fill",children:(0,I.jsx)(eE,{ms:300,children:(0,I.jsxs)(T.kC,{align:"center",direction:"column",height:"fill",justify:"center",children:[(0,I.jsx)(T.$j,{muted:!0}),(0,I.jsx)(T.xu,{marginTop:3,children:(0,I.jsx)(T.xv,{muted:!0,size:1,children:"Redirecting…"})})]})})})}async function eJ(e,n,t){if(n&&t)return{id:n,type:t};if(!n&&t)return{id:(0,ec.Z)(),type:t};if(n&&!t){let t=await (0,N.z)(e.resolveTypeForDocument(n));return{id:n,type:t}}throw new eZ({message:"Neither document `id` or `type` was provided when trying to resolve intent."})}function eG(e){let{intent:n,params:t={},payload:i}=e,{rootPaneNode:l,structureContext:r}=e$(),o=(0,er.H__)(),a=(0,er.BoV)(t),s=(0,er.BoV)(i),[d,c]=(0,L.useState)(null),[u,p]=(0,L.use
1State)(null),h="string"==typeof a.id?a.id:void 0,f="string"==typeof a.type?a.type:void 0;if((0,L.useEffect)(()=>{let e={current:!1};return(async function(){let{id:e,type:t}=await eJ(o,h,f);return eK({intent:n,params:{...a,id:e,type:t},payload:s,rootPaneNode:l,structureContext:r})})().then(n=>{e.current||c(n)}).catch(p),()=>{e.current=!0}},[o,h,n,a,s,l,r,f]),u)throw u;return d?(0,I.jsx)(eY,{panes:d}):(0,I.jsx)(T.Zb,{height:"fill",children:(0,I.jsx)(eE,{ms:300,children:(0,I.jsxs)(T.kC,{align:"center",direction:"column",height:"fill",justify:"center",children:[(0,I.jsx)(T.$j,{muted:!0}),(0,I.jsx)(T.xu,{marginTop:3,children:(0,I.jsx)(T.xv,{align:"center",muted:!0,size:1,children:"Loading…"})})]})})})}let eQ=eu.ZP.span(i||(i=eM(["\n  &:not(:last-child)::after {\n    content: ' ➝ ';\n    opacity: 0.5;\n  }\n"])));function e0(e){let{error:n}=e;if(!(n instanceof eZ))throw n;let{cause:t}=n,i=(null==t?void 0:t.stack)||n.stack,l=i&&!(t instanceof R.zc)&&!n.message.includes("Module build failed:"),r=t instanceof R.zc?t.path:[],o=t instanceof R.zc&&t.helpId||n.helpId,a=(0,L.useCallback)(()=>{window.location.reload()},[]);return(0,I.jsx)(T.Zb,{height:"fill",overflow:"auto",padding:4,sizing:"border",tone:"critical",children:(0,I.jsxs)(T.W2,{children:[(0,I.jsx)(T.X6,{as:"h2",children:"Encountered an error while reading structure"}),(0,I.jsxs)(T.Zb,{marginTop:4,padding:4,radius:2,overflow:"auto",shadow:1,tone:"inherit",children:[r.length>0&&(0,I.jsxs)(T.Kq,{space:2,children:[(0,I.jsx)(T.__,{children:"Structure path"}),(0,I.jsx)(T.EK,{children:r.slice(1).map((e,n)=>(0,I.jsx)(eQ,{children:e},"".concat(e,"-").concat(n)))})]}),(0,I.jsxs)(T.Kq,{marginTop:4,space:2,children:[(0,I.jsx)(T.__,{children:"Error"}),(0,I.jsx)(T.EK,{children:l?i.replace(/\(\.\.\.\)\./g,"(...)\n  .").replace(/__WEBPACK_IMPORTED_MODULE_\d+_+/g,"").replace(/___default\./g,".").replace(RegExp(" \\(https?:\\/\\/".concat(window.location.host),"g")," ("):n.message})]}),o&&(0,I.jsx)(T.xu,{marginTop:4,children:(0,I.jsx)(T.xv,{children:(0,I.jsx)("a",{href:(0,eo.h)(o),rel:"noopener noreferrer",target:"_blank",children:"View documentation"})})}),(0,I.jsx)(T.xu,{marginTop:4,children:(0,I.jsx)(T.zx,{text:"Reload",icon:ep.bnu,tone:"primary",onClick:a})})]})]})})}function e1(e){let{isSelected:n,pane:t,paneKey:i}=e,l=(0,er.Uy$)(t)&&t.type||null;return(0,I.jsxs)(R.X6,{id:i,selected:n,children:[(0,I.jsx)(R.hX,{title:"Unknown pane type"}),(0,I.jsx)(R.Bh,{children:(0,I.jsx)(T.xu,{padding:4,children:"string"==typeof l?(0,I.jsxs)(T.xv,{as:"p",muted:!0,children:["Structure item of type ",(0,I.jsx)("code",{children:l})," is not a known entity."]}):(0,I.jsxs)(T.xv,{as:"p",muted:!0,children:["Structure item is missing required ",(0,I.jsx)("code",{children:"type"})," property."]})})})]})}function e2(e){let n=[{ms:300,message:"Loading…"},{ms:5e3,message:"Still loading…"}];if(er.r8Q){let t=["Check console for errors?","Is your observable/promise resolving?",e.length>0?"Structure path: ".concat(e.join(" ➝ ")):""];n.push({ms:1e4,message:t.join("\n")})}let t=(0,F.of)(null);return(0,X.T)(...n.map(e=>{let{ms:n,message:i}=e;return t.pipe((0,ee.h)(i),(0,en.g)(n))}))}let e3=(0,eu.ZP)(T.kC)(l||(l=eM(["\n  opacity: 0;\n  transition: opacity 200ms;\n\n  &[data-mounted] {\n    opacity: 1;\n  }\n"]))),e4=(0,L.memo)(e=>{let{delay:n=300,flex:t,message:i=e2,minWidth:l,paneKey:r,path:o,selected:a,title:s,tone:d}=e,c=(0,L.useMemo)(()=>"function"==typeof i?i(o?o.split(";
1"):[]):i,[i,o]),[u,p]=(0,L.useState)(()=>"string"==typeof c?c:"Loading…");(0,L.useEffect)(()=>{if("object"!=typeof c||"function"==typeof c.subscribe)return;let e=c.subscribe(p);return()=>e.unsubscribe()},[c]);let[h,f]=(0,L.useState)(null),[m,x]=(0,L.useState)(!1);(0,L.useEffect)(()=>{if(h)return(0,T.RE)(()=>x(!0))},[h]);let g=(0,I.jsxs)(e3,{align:"center","data-mounted":m?"":void 0,direction:"column",height:"fill",justify:"center",ref:f,children:[(0,I.jsx)(T.$j,{muted:!0}),(s||u)&&(0,I.jsx)(T.xu,{marginTop:3,children:(0,I.jsx)(T.xv,{align:"center",muted:!0,size:1,children:s||u})})]});return(0,I.jsx)(R.X6,{flex:t,id:r,minWidth:l,selected:a,tone:d,children:(0,I.jsx)(R.Bh,{children:g})})});e4.displayName="LoadingPane";let e5={component:(0,L.lazy)(()=>t.e(6085).then(t.bind(t,36085))),document:(0,L.lazy)(()=>t.e(3699).then(t.bind(t,39077))),documentList:(0,L.lazy)(()=>t.e(6136).then(t.bind(t,76136))),list:(0,L.lazy)(()=>t.e(2058).then(t.bind(t,42058)))},e8=(0,L.memo)(function(e){let{active:n,childItemId:t,groupIndex:i,index:l,itemId:r,pane:o,paneKey:a,params:s,payload:d,selected:c,siblingIndex:u}=e,p=e5[o.type]||e1;return(0,I.jsx)(eR,{flatIndex:l,index:i,params:s,payload:d,siblingIndex:u,children:(0,I.jsx)(L.Suspense,{fallback:(0,I.jsx)(e4,{paneKey:a}),children:(0,I.jsx)(p,{childItemId:t||"",index:l,itemId:r,isActive:n,isSelected:c,paneKey:a,pane:o})})})},(e,n)=>{let{params:t={},payload:i=null,...l}=e,{params:r={},payload:o=null,...a}=n;if(!es()(t,r)||!es()(i,o))return!1;let s=new Set([...Object.keys(l),...Object.keys(a)]);for(let e of s)if(l[e]!==a[e])return!1;return!0});function e6(e){let{children:n,flex:t,minWidth:i,paneKey:l,title:r="Error",tone:o="critical"}=e;return(0,I.jsxs)(R.X6,{flex:t,id:l,minWidth:i,tone:o,children:[(0,I.jsx)(R.hX,{title:r}),(0,I.jsx)(R.Bh,{overflow:"auto",children:(0,I.jsx)(T.xu,{paddingX:4,paddingY:5,children:n})})]})}let e9=["patch","commit"],e7=(0,L.memo)(function(){let{push:e}=(0,T.pm)(),{documentId:n,documentType:t}=(0,R.Z3)(),i=(0,er.E6V)(n,t),l=(0,L.useRef)(i);return(0,L.useEffect)(()=>{if(i&&i!==l.current){var n,t;"error"===i.type&&e({closable:!0,duration:3e4,status:"error",title:"delete"===(n=i.op)?"An error occurred while attempting to delete this document.\n      This usually means that there are other documents that refers to it.":"unpublish"===n?"An error occurred while attempting to unpublish this document.\n      This usually means that there are other documents that refers to it.":"An error occurred during ".concat(n),description:(0,I.jsxs)("details",{children:[(0,I.jsx)("summary",{children:"Details"}),i.error.message]})}),"success"!==i.type||e9.includes(i.op)||e({closable:!0,status:"success",title:"publish"===(t=i.op)?"The document was published":"unpublish"===t?"The document was unpublished. A draft has been created from the latest published version.":"discardChanges"===t?"All changes since last publish has now been discarded. The discarded draft can still be recovered from history":"delete"===t?"This document was deleted. It can still be recovered from history and if you continue editing it will be recreated.":"Successfully performed ".concat(t," on document")}),l.current=i}},[i,e]),null}),ne=e=>{let{features:n,hasValue:t,changesOpen:i}=e;return n.reviewChanges?{action:"reviewChanges",title:"Review changes",icon:ep.vaD,isDisabled:i||!t}:null},nn=e=>{let{hasValue:n}=e;return{action:"inspect",title:"Inspect",icon:ep.bg6,isDisabled:!n,shortcut:"Ctrl+Alt+I"}},nt=e=>{let{previewUrl:n}=e;return n?{action:"production-preview",title:"Open preview",icon:ep.YE8,shortcut:"Ctrl+Alt+O"}:null},ni=e=>{let n=[nt,ne,nn].filter(Boolean).map(n=>n(e));return n.filter(e=>null!==e)},nl=e=>(0,er.Uy$)(e)&&"string"==typeof e._id&&"string"==typeof e._type,nr={},no=(0,L.memo)(e=>{let{children:n,index:t,pane:i,paneKey:l}=e,r=(0,er.m85)(er.Dr7),o=(0,er.I_y)(),a=(0,er.zEW)(),{actions:s,badges:d,unstable_languageFilter:c}=(0,er.Lky)().document,u=(0,er.zaX)(),p=(0,er.ap5)(),h=(0,R.RL)(),{features:f}=e$(),{push:m}=(0,T.pm)(),{options:x,menuItemGroups:g,title:j=null,views:v=[]}=i,b=(0,er.BoV)(x),y=b.id,w=(0,er.vsM)(y),k=x.type,C=(0,er.BoV)(h.params),_=(0,er.BoV)(h.payload),{templateName:S,templateParams:P}=(0,L.useMemo)(()=>(function(e,n){let t=n.panePayload||{},i=n.templateName;n.urlTemplate&&i&&i!==n.urlTemplate&&console.warn('Conflicting templates: URL says "'.concat(n.urlTemplate,'", structure node says "').concat(i,'". Using "').concat(i,'".'));let l=i||n.urlTemplate,r=e.filter(e=>e.schemaType===n.documentType),o={...n.templateParams,..."object"==typeof t&&t||{}},a=l;return l||1!==r.length||(a=r[0].id),{templateName:a,templateParams:o}})(a,{documentType:k,templateName:b.template,templateParams:b.templateParameters,panePayload:_,urlTemplate:null==C?void 0:C.template}),[k,b,C,_,a]),z=(0,er.t2O)({documentId:w,documentType:k,templateName:S,templateParams:P}),M=(0,er.BoV)(z),{patch:E}
1=(0,er.d9t)(w,k),O=(0,er.iav)(w,k),{validation:D}=(0,er.a3k)(w,k),N=(0,er.z1O)(w,k),A=o.get(k),B=(null==O?void 0:O.draft)||(null==O?void 0:O.published)||M.value,U=(0,L.useMemo)(()=>s({schemaType:k,documentId:w}),[s,w,k]),X=(0,L.useMemo)(()=>d({schemaType:k,documentId:w}),[d,w,k]),V=(0,L.useMemo)(()=>c({schemaType:k,documentId:w}),[w,k,c]),K=(0,er.BoV)(D),$=(0,er.BoV)(v),H=h.params||nr,[Y,J]=(0,L.useState)(()=>H.path?(0,em.mL)(H.path):[]),G=H.view||$[0]&&$[0].id||null,Q=(0,L.useMemo)(()=>u.getTimeline({publishedId:w,enableTrace:er.r8Q}),[w,u]),[ee,en]=(0,L.useState)("closed"),{historyController:el}=(0,eg.m2)(()=>u.getTimelineController({client:r,documentId:w,documentType:k,timeline:Q}),[r,w,k,Q]);el.setRange(H.since||null,H.rev||null);let eo=el.changesPanelActive(),ea=function(e){let[n,t]=(0,L.useState)(void 0),[i,l]=(0,L.useState)(null),{resolveProductionUrl:r}=(0,er.Lky)().document,o=(0,eg.l)(e);if(i)throw i;return(0,L.useEffect)(()=>{o.pipe((0,et.b)(500),(0,q.w)(e=>nl(e)?(0,W.D)(r({document:e})):(0,F.of)(void 0)),(0,ei.K)(e=>{let n=(0,er.Uy$)(e)&&"string"==typeof e.message?e.message:"Unknown error";throw Error("An error was thrown while trying to get your preview url: ".concat(n))})).subscribe({next:t,error:l})},[r,o]),n}
1(B),[es,ed]=(0,L.useState)([]);(0,L.useEffect)(()=>{let e=p.documentPresence(w).subscribe(e=>{ed(e)});return()=>{e.unsubscribe()}},[w,p]);let ec=Boolean(B),eu=(0,L.useMemo)(()=>ni({features:f,hasValue:ec,changesOpen:eo,previewUrl:ea}),[f,ec,eo,ea]),ep="on"===H.inspect,eh=eo?el.sinceAttributes():(null==O?void 0:O.published)||null,ex="connected"===N&&O.ready,ev=el.onOlderRevision(),eb=(0,L.useMemo)(()=>ev?el.displayed()||{_id:B._id,_type:B._type}:B,[el,H.rev,H.since,B,ev]),ey=(0,L.useCallback)((e,n)=>{h.setParams({...h.params,since:e,rev:n||void 0})},[h]),ew=(0,L.useCallback)(e=>{J(e),p.setLocation([{type:"document",documentId:w,path:e,lastActiveAt:new Date().toISOString()}])},[w,p,J]),ek=(0,L.useCallback)(e=>{J([])},[J]),eC=(0,L.useRef)(()=>{throw Error("Nope")});eC.current=e=>{E.execute((0,er.GWp)(e.patches),M.value)};let e_=(0,L.useCallback)(e=>eC.current(e),[]),eS=(0,L.useCallback)(()=>{h.setParams({...H,since:void 0})},[h,H]),eP=(0,L.useCallback)(()=>{h.setParams({...H,since:"@lastPublished"})},[h,H]),ez=(0,L.useCallback)(()=>h.closeCurrent(),[h]),eM=(0,L.useCallback)(()=>h.duplicateCurrent(),[h]),eE=(0,L.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!ep;e?h.setParams({...H,inspect:"on"}):h.setParams(Z()(H,"inspect"))},[ep,h,H]),eI=(0,L.useCallback)(e=>"production-preview"===e.action&&ea?(window.open(ea),!0):"inspect"===e.action?(eE(!0),!0):"reviewChanges"===e.action&&(eP(),!0),[eP,ea,eE]),eL=(0,L.useCallback)(e=>{for(let n of eu)if(n.shortcut&&(0,ef.ZP)(n.shortcut,e)){e.preventDefault(),e.stopPropagation(),eI(n);return}},[eI,eu]),eT=(0,L.useCallback)(()=>
1eE(!1),[eE]),[eR,eO]=(0,L.useState)([]),[eZ,eD]=(0,L.useState)(),[eW,eF]=(0,L.useState)(),[eN,eA]=(0,L.useState)(),eB=(0,L.useCallback)((e,n)=>{eF(t=>(0,er.pt$)(t,e,n))},[]),eU=(0,L.useCallback)((e,n)=>{eA(t=>(0,er.pt$)(t,e,n))},[]),eX=(0,L.useCallback)((e,n)=>eD(t=>(0,er.pt$)(t,e,n)),[]),eV=B._createdAt?"update":"create",eK=(0,L.useMemo)(()=>Boolean(null==A?void 0:A.liveEdit),[k,o]),eq=B._id?B._id:"dummy-id",eH=(0,L.useMemo)(()=>({...B,_id:eK?(0,er.vsM)(eq):(0,er.qyu)(eq)}),[eK,B,eq]),[eY,eJ]=(0,er.vSY)({document:eH,permission:eV}),{revTime:eG}=el,eQ=!(null==B?void 0:B._id),e0=(0,L.useMemo)(()=>{let e=!eJ&&!(null==eY?void 0:eY.granted),n=!(0,ej.jA)(A,"update"),t=eQ&&!(0,ej.jA)(A,"create");return!ex||null!==eG||e||n||t||"reconnecting"===N},[N,eQ,eJ,null==eY?void 0:eY.granted,ex,eG,A]),e1=(0,er.clL)(A,{value:eb,readOnly:e0,comparisonValue:eh,focusPath:Y,openPath:eR,collapsedPaths:eW,presence:es,validation:K,collapsedFieldSets:eN,fieldGroupState:eZ,changesOpen:eo}),e2=(0,L.useRef)(e1);e2.current=e1;let e3=(0,L.useCallback)(e=>{let n=(0,er.C8M)(e2.current,e);n.forEach(e=>{"expandPath"===e.type&&eF(n=>(0,er.pt$)(n,e.path,!1)),"expandFieldSet"===e.type&&eA(n=>(0,er.pt$)(n,e.path,!1)),"setSelectedGroup"===e.type&&eD(n=>(0,er.pt$)(n,e.path,e.groupName))}),eO(e)},[e2]);return(0,L.useEffect)(()=>{"reconnecting"===N&&m({id:"sanity/desk/reconnecting",status:"warning",title:(0,I.jsx)(I.Fragment,{children:"Connection lost. Reconnecting…"})})},[N,m]),(0,L.useEffect)(()=>{J(H.path?(0,em.mL)(H.path):[]),eO([])},[H.path,w]),(0,I.jsx)(R.cO.Provider,{value:{actions:U,activeViewId:G,badges:X,changesOpen:eo,collapsedFieldSets:eN,collapsedPaths:eW,compareValue:eh,connectionState:N,displayed:eb,documentId:w,documentIdRaw:y,documentType:k,editState:O,focusPath:Y,menuItems:eu,onBlur:ek,onChange:e_,onFocus:ew,onPathOpen:e3,onHistoryClose:eS,onHistoryOpen:eP,onInspectClose:eT,onKeyUp:eL,onMenuAction:eI,onPaneClose:ez,onPaneSplit:eM,onSetActiveFieldGroup:eX,onSetCollapsedPath:eB,onSetCollapsedFieldSet:eU,historyController:el,index:t,inspectOpen:ep,validation:K,menuItemGroups:g||[],paneKey:l,previewUrl:ea,ready:ex,schemaType:A,isPermissionsLoading:eJ,permissions:eY,setTimelineMode:en,setTimelineRange:ey,timeline:Q,timelineMode:ee,title:j,value:B,views:$,formState:e1,unstable_languageFilter:V},children:n})});no.displayName="DocumentPaneProvider";let na={create:"created",delete:"deleted",discardDraft:"discarded draft",initial:"created",editDraft:"edited",editLive:"live edited",publish:"published",unpublish:"unpublished"},ns={create:ep.agZ,delete:ep.XHJ,discardDraft:ep.Two,initial:ep.agZ,editDraft:ep.dY8,editLive:ep.dY8,publish:ep.EI4,unpublish:ep.xEY};function nd(e){let{maxLength:n,userIds:t}=e;return(0,I.jsx)(T.Jh,{maxLength:n,children:t.map(e=>(0,I.jsx)(er.YtX,{user:e,withTooltip:!0},e))})}let nc=(0,eu.ZP)(T.kC)(e=>{var n;let{theme:t}=e,i=null==(n=t.sanity.color.base.skeleton)?void 0:n.from;return(0,eu.iv)(r||(r=eM(["\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)}),nu=(0,eu.ZP)(T.sN)(e=>{let{state:n="enabled",isHovered:t,theme:i}=e,{color:l}=i.sanity,r=l.button.default.primary.enabled;return(0,eu.iv)(o||(o=eM(["\n    position: relative;\n    min-width: 244px;\n\n    ","\n\n    ","\n\n      ","\n\n    // line styling \uD83D\uDC47\n      &:first-child ","::before {\n      height: 50%;\n      top: unset;\n      bottom: 0;\n    }\n\n    &:last-child ","::before {\n      height: 50%;\n    }\n\n    ","\n\n    // Remove timeline lines when using the keyboard to navigate timeline items\n    &:focus ","::before {\n      background: transparent;\n    }\n  "])),"selected"===n&&(0,eu.iv)(a||(a=eM(["\n      --card-bg-color: ",";\n      --card-fg-color: ",";\n      --card-muted-fg-color: ",";\n      --card-border-color: ",";\n      &:not([data-selection-bottom='true']) {\n        border-top-left-radius: 0;\n        border-top-right-radius: 0;\n      }\n    "])),r.bg,r.fg,r.muted,r.bg),"withinSelection"===n&&(0,eu.iv)(s||(s=eM(["\n      border-bottom-left-radius: 0;\n      border-bottom-right-radius: 0;\n      box-shadow: 0px 3px 0px 0px var(--card-bg-color);\n      &:not([data-selection-top='true']) {\n        border-radius: 0;\n      }\n\n      "," {\n        &::before {\n          background: var(--card-hairline-soft-color);\n        }\n      }\n    "])),nc),"disabled"===n&&(0,eu.iv)(d||(d=eM(["\n      [data-ui='Avatar'] {\n        opacity: 0.2;\n      }\n    "]))),nc,nc,(t||"selected"===n)&&(0,eu.iv)(c||(c=eM(["\n      ","::before {\n        background: transparent;\n      }\n    "])),nc),nc)}),np=(0,eu.ZP)(T.xu)(u||(u=eM(["\n  background: var(--card-bg-color);\n  border-radius: 50px;\n  position: relative;\n  z-index: 2;
1\n"]))),nh=(0,eu.ZP)(T.xv)(p||(p=eM(["\n  text-transform: capitalize;\n"]))),nf=(0,eu.ZP)(T.xu)(h||(h=eM(["\n  min-width: 1rem;\n  margin-left: ",";\n"])),e=>{let{theme:n}=e;return"-".concat((0,T.hO)(n.sanity.space[1]))}),nm={initial:"primary",create:"primary",publish:"positive",editLive:"caution",editDraft:"caution",unpublish:"critical",discardDraft:"critical",delete:"critical",withinSelection:"primary"};function nx(e){let{isSelectionBottom:n,isSelectionTop:t,state:i,onSelect:l,timestamp:r,chunk:o,type:a}=e,s=ns[a],d=Array.from(o.authors),c=(0,er.INm)(r,{minimal:!0}),u=(0,L.useMemo)(()=>{let e=new Date(r),n=(0,ev.Z)(e,"MMM d, yyyy, hh:mm a");return n},[r]),p="selected"===i,h="withinSelection"===i,[f,m]=(0,L.useState)(!1),x=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),l(o)},[l,o]);return(0,I.jsx)(nu,{"data-ui":"timelineItem",radius:2,"data-chunk-id":o.id,padding:0,tone:f||p||h?"default":nm[a],pressed:h,state:i,selected:p,isHovered:f,disabled:"disabled"===i,"data-selection-bottom":n,"data-selection-top":t,onClick:x,children:(0,I.jsx)(T.u,{portal:!0,placement:"left",fallbackPlacements:["bottom"],content:(0,I.jsx)(T.Kq,{padding:3,space:3,children:(0,I.jsx)(T.xv,{size:1,children:u})}),children:(0,I.jsx)(T.xu,{onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),paddingX:2,children:(0,I.jsxs)(T.kC,{align:"stretch",children:[(0,I.jsx)(nc,{align:"center",children:(0,I.jsx)(np,{padding:2,children:(0,I.jsx)(T.xv,{size:2,children:s&&(0,L.createElement)(s)})})}),(0,I.jsxs)(T.Kq,{space:2,margin:2,children:[(0,I.jsx)(T.xu,{children:(0,I.jsx)(nh,{size:1,weight:"medium",children:na[a]||(0,I.jsx)("code",{children:a})})}),(0,I.jsx)(nf,{paddingX:1,children:(0,I.jsx)(T.xv,{size:0,muted:!0,children:c})})]}),(0,I.jsx)(T.kC,{flex:1,justify:"flex-end",align:"center",children:(0,I.jsx)(nd,{maxLength:3,userIds:d})})]})})})})}let ng=(0,eu.ZP)(T.xu)(f||(f=eM(["\n  overflow: auto;\n  -webkit-overflow-scrolling: touch;\n"]))),nj=(0,eu.ZP)(T.Kq)(m||(m=eM(["\n  max-width: 200px;\n"]))),nv=(0,eu.ZP)(T.v2)(x||(x=eM(["\n  overflow: auto;\n  box-sizing: border-box;\n  max-height: calc(100vh - 198px);\n"]))),nb=e=>{let{timeline:n,disabledBeforeSelection:t,topSelection:i,bottomSelection:l,onSelect:r,onLoadMore:o}=e,a=(0,L.useRef)(null),s=(0,L.useRef)(null),[d,c]=(0,L.useState)(null),u=t?"disabled":"enabled",p=(0,L.useCallback)(()=>{let e=a.current;if(d&&e){let{offsetHeight:n,scrollTop:t}=e,i=d.offsetTop<n+t+20;i&&requestAnimationFrame(()=>o(i))}},[o,d]);return(0,L.useEffect)(p,[p]),(0,I.jsxs)(ng,{ref:a,onScroll:p,"data-ui":"timeline",children:[0===n.chunkCount&&(0,I.jsxs)(nj,{padding:3,space:3,children:[(0,I.jsx)(T.xv,{size:1,weight:"semibold",children:"No document history"}),(0,I.jsx)(T.xv,{muted:!0,size:1,children:"When changing the content of the document, the document versions will appear in this menu."})]}),n.chunkCount>0&&(0,I.jsx)(nv,{ref:s,padding:1,space:0,children:n.mapChunks(e=>{let n=i===e,t=l===e;n&&(u="withinSelection"),t&&(u="selected");let o=(0,I.jsx)(nx,{chunk:e,isSelectionBottom:t,isSelectionTop:n,state:u,onSelect:r,type:e.type,timestamp:e.endTimestamp},e.id);return"selected"===u&&(u="enabled"),o})}),!n.reachedEarliestEntry&&(0,I.jsx)(T.kC,{align:"center",justify:"center",padding:4,ref:c,children:(0,I.jsx)(T.$j,{muted:!0})})]})};nb.displayName="Timeline";let ny=(0,eu.ZP)(T.J2)(g||(g=eM(["\n  & > div {\n    display: flex;\n    flex-direction: column;\n\n    & > [data-ui='Card'] {\n      flex: 1;\n      min-height: 0;\n      display: flex;\n      flex-direction: column;\n\n      /* This is the scrollable container rendered by <Timeline /> */\n      & > div {\n        flex: 1;\n        min-height: 0;\n      }\n    }\n  }\n"])));function nw(e){var n,t;let{chunk:i,mode:l,placement:r}=e,{historyController:o,setTimelineRange:a,setTimelineMode:s,timeline:d,ready:c}
1=(0,R.Z3)(),[u,p]=(0,L.useState)(!1),[h,f]=(0,L.useState)(null),[m,x]=(0,L.useState)(null),g=(0,L.useCallback)(()=>{s(l),p(!0)},[l,s]),j=(0,L.useCallback)(()=>{s("closed"),p(!1)},[s]),v=(0,L.useCallback)(()=>{j()},[j]),b=(0,L.useCallback)(e=>{u&&("Escape"===e.key||"Tab"===e.key)&&(j(),null==h||h.focus())},[h,j,u]);(0,T.O8)(v,[m,h]),(0,T.qh)(b);let y=(0,L.useCallback)(e=>{let[n,t]=o.findRangeForNewRev(e);s("closed"),p(!1),a(n,t)},[o,s,a]),w=(0,L.useCallback)(e=>{let[n,t]=o.findRangeForNewSince(e);s("closed"),p(!1),a(n,t)},[o,s,a]),k=(0,L.useCallback)(e=>{o.setLoadMore(e)},[o]),C=u&&(0,I.jsx)("div",{ref:x,children:"rev"===l?(0,I.jsx)(nb,{onSelect:y,onLoadMore:k,timeline:d,topSelection:n=o.realRevChunk,bottomSelection:n}):(0,I.jsx)(nb,{onSelect:w,onLoadMore:k,timeline:d,...(t=o.sinceTime,{topSelection:o.realRevChunk,bottomSelection:t,disabledBeforeSelection:!0})})}),_=(0,er.INm)((null==i?void 0:i.endTimestamp)||"",{agoSuffix:!0}),S=i?"".concat(ey()(na[i.type])," ").concat(_):"Current version",P=i?"Since ".concat(na[i.type]," ").concat(_):"Since unknown version";return(0,I.jsx)(ny,{constrainSize:!0,content:C,"data-ui":"versionMenu",open:u,placement:r,portal:!0,children:(0,I.jsx)(T.zx,{disabled:!c,mode:"bleed",fontSize:1,padding:2,iconRight:ep.GVG,onClick:u?j:g,ref:f,selected:u,text:u?"rev"===l?"Select version":"Review changes since":"rev"===l?S:P})})}function nk(){return(0,I.jsxs)(T.kC,{align:"center",justify:"center",children:[(0,I.jsx)(T.$j,{muted:!0}),(0,I.jsx)(T.xu,{marginTop:3,children:(0,I.jsx)(T.xv,{align:"center",children:"Loading changes…"})})]})}let nC=(0,eu.ZP)(er.l$t)(j||(j=eM(["\n  height: 100%;\n  overflow: auto;\n  position: relative;\n  scroll-behavior: smooth;\n"])));function n_(){let{documentId:e,onHistoryClose:n,historyController:t,schemaType:i,value:l}=(0,R.Z3)(),{collapsed:r}=(0,R.ec)(),o=(0,L.useRef)(null),a=t.selectionState,s=t.sinceTime,d=t.currentObjectDiff(),c=!t.onOlderRevision(),u=L.useMemo(()=>({documentId:e,schemaType:i,FieldWrapper:er.MUX,rootDiff:d,isComparingCurrent:c,value:l}),[e,d,c,i,l]),p=L.useMemo(()=>d?function(e){let n=new Map;return(0,er.Z7x)(e,e=>{if("unchanged"===e.action||!("annotation"in e)||!e.annotation)return!0;let{author:t,timestamp:i}=e.annotation,l=n.get(t);return(!l||l.timestamp<i)&&n.set(t,e.annotation),!0}),Array.from(n.values()).sort((e,n)=>e.timestamp<n.timestamp?1:-1)}(d):[],[d]);return r?null:(0,I.jsxs)(T.kC,{direction:"column",flex:1,style:{borderLeft:"1px dashed var(--card-border-color)",overflow:"hidden",minWidth:320},"data-testid":"review-changes-pane",children:[(0,I.jsx)(R.hX,{actions:(0,I.jsx)(T.zx,{icon:ep.Two,mode:"bleed",onClick:n,padding:3,title:"Hide changes panel"}),subActions:p.length>0&&(0,I.jsx)(T.xu,{paddingRight:1,children:(0,I.jsx)(er.IIC,{annotations:p,description:"Changes by",placement:"bottom-end",children:(0,I.jsx)(T.Jh,{maxLength:4,children:p.map(e=>{let{author:n}=e;return(0,I.jsx)(er.YtX,{user:n},n)})})})}),tabs:(0,I.jsx)(nw,{mode:"since",chunk:s,placement:"bottom-start"}),title:"Changes"}),(0,I.jsx)(R.Bh,{children:(0,I.jsx)(T.NM,{element:o.current,children:(0,I.jsx)(nC,{"data-ui":"Scroller",ref:o,children:(0,I.jsx)(T.xu,{flex:1,padding:4,children:(0,I.jsx)(nS,{diff:d,documentContext:u,loading:"loading"===a})})})})})]})}function nS(e){let{diff:n,documentContext:t,loading:i}=e,{schemaType:l}=(0,R.Z3)();return i?(0,I.jsx)(nk,{}):n?(0,I.jsx)(er.H7Z.Provider,{value:t,children:(0,I.jsx)(er.EyJ,{diff:n,schemaType:l})}):(0,I.jsx)(er.kwM,{})}function nP(e,n,t){let i=(0,er.F2f)(),[l,r]=(0,L.useState)(t),o=(0,L.useMemo)(()=>i.forNamespace("desk-tool"),[i]),a=(0,L.useMemo)(()=>e?o.forNamespace(e).forKey(n):o.forKey(n),[o,e,n]);(0,L.useEffect)(()=>{let e=a.listen(t).subscribe({next:r});return()=>null==e?void 0:e.unsubscribe()},[t,n,e,a]);let s=(0,L.useCallback)(e=>{r(e),a.set(e)},[a]);return(0,L.useMemo)(()=>[l,s],[s,l])}let nz={id:"parsed",title:"Parsed"},nM={id:"raw",title:"Raw JSON"},nE=[nz,nM],nI=e_()(1e3);function nL(e){let{path:n}=e,t=nI.get(n);void 0!==t&&nI.set(n,!t)}function nT(e){let n=window.getSelection();if(n){let t=document.createRange();n.removeAllRanges(),t.selectNodeContents(e),n.addRange(t)}
1}function nR(e){nT(e.currentTarget)}function nO(e){let n=65===e.keyCode&&(e.metaKey||e.ctrlKey);n&&(e.preventDefault(),nT(e.currentTarget))}let nZ=eu.ZP.div(e=>{let{theme:n}=e,{color:t,fonts:i,space:l}=n.sanity;return(0,eu.iv)(v||(v=eM(["\n    & .json-inspector,\n    & .json-inspector .json-inspector__selection {\n      font-family: ",";\n      font-size: ","px;\n      line-height: ","px;\n      color: var(--card-code-fg-color);\n    }\n\n    & .json-inspector .json-inspector__leaf {\n      padding-left: ",";\n    }\n\n    & .json-inspector .json-inspector__leaf.json-inspector__leaf_root {\n      padding-top: ",";\n      padding-left: 0;\n    }\n\n    & .json-inspector > .json-inspector__leaf_root > .json-inspector__line > .json-inspector__key {\n      display: none;\n    }\n\n    & .json-inspector .json-inspector__line {\n      display: block;\n      position: relative;\n      cursor: default;\n    }\n\n    & .json-inspector .json-inspector__line::after {\n      content: '';\n      position: absolute;\n      top: 0;\n      left: -200px;\n      right: -50px;\n      bottom: 0;\n      z-index: -1;\n      pointer-events: none;\n    }\n\n    & .json-inspector .json-inspector__line:hover::after {\n      background: var(--card-code-bg-color);\n    }\n\n    & .json-inspector .json-inspector__leaf_composite > .json-inspector__line {\n      cursor: pointer;\n    }\n\n    & .json-inspector .json-inspector__leaf_composite > .json-inspector__line::before {\n      content: '▸ ';\n      margin-left: calc(0 - "," + 3px);\n      font-size: ","px;\n      line-height: ","px;\n    }\n\n    &\n      .json-inspector\n      .json-inspector__leaf_expanded.json-inspector__leaf_composite\n      > .json-inspector__line::before {\n      content: '▾ ';\n      font-size: ","px;\n      line-height: ","px;\n    }\n\n    & .json-inspector .json-inspector__radio,\n    & .json-inspector .json-inspector__flatpath {\n      display: none;\n    }\n\n    & .json-inspector .json-inspector__value {\n      margin-left: ",";\n    }\n\n    &\n      .json-inspector\n      > .json-inspector__leaf_root\n      > .json-inspector__line\n      > .json-inspector__key\n      + .json-inspector__value {\n      margin: 0;\n    }\n\n    & .json-inspector .json-inspector__key {\n      color: ",";\n    }\n\n    & .json-inspector .json-inspector__value_helper,\n    & .json-inspector .json-inspector__value_null {\n      color: ",";\n    }\n\n    & .json-inspector .json-inspector__not-found {\n      padding-top: ",";\n    }\n\n    & .json-inspector .json-inspector__value_string {\n      color: ",";\n    }\n\n    & .json-inspector .json-inspector__value_boolean {\n      color: ",";\n    }\n\n    & .json-inspector .json-inspector__value_number {\n      color: ",";\n    }\n\n    & .json-inspector .json-inspector__show-original {\n      display: inline-block;\n      padding: 0 6px;\n      cursor: pointer;\n    }\n\n    & .json-inspector .json-inspector__show-original:hover {\n      color: inherit;\n    }\n\n    & .json-inspector .json-inspector__show-original::before {\n      content: '↔';\n    }\n\n    & .json-inspector .json-inspector__show-original:hover::after {\n      content: ' expand';\n    }\n  "])),i.code.family,i.code.sizes[2].fontSize,i.code.sizes[2].lineHeight,(0,T.hO)(l[4]),(0,T.hO)(l[3]),(0,T.hO)(l[4]),i.code.sizes[2].fontSize,i.code.sizes[2].lineHeight,i.code.sizes[2].fontSize,i.code.sizes[2].lineHeight,(0,T.hO)(l[4]/2),t.syntax.property,t.syntax.constant,(0,T.hO)(l[3]),t.syntax.string,t.syntax.boolean,t.syntax.number)});function nD(e){let{onChange:n,query:t}=e,i=(0,L.useCallback)(e=>n(e.target.value),[n]);return(0,I.jsx)(T.oi,{icon:ep.W1M,onChange:i,placeholder:"Search",radius:2,value:t||""})}function nW(e){let{value:n}=e,{onInspectClose:t,paneKey:i}=(0,R.Z3)(),l="".concat(i,"_inspect_"),[r,o]=nP("desk-tool","inspect-view-preferred-view-mode-".concat(i),"parsed"),a=nE.find(e=>e.id===r),s=(0,L.useCallback)(()=>{o(nz.id)},[o]),d=(0,L.useCallback)(()=>{o(nM.id)},[o]);return(0,I.jsx)(T.Vq,{id:"".concat(l,"dialog"),header:(0,er.Uy$)(n)&&(0,er.HD0)(n._id)&&(0,er.HD0)(n._type)?(0,I.jsxs)(I.Fragment,{children:["Inspecting"," ",(0,I.jsx)("em",{children:(0,I.jsx)(R.lU,{document:n})})]}):(0,I.jsx)("em",{children:"No value"}),onClose:t,onClickOutside:t,width:3,children:(0,I.jsxs)(T.kC,{direction:"column",height:"fill",children:[(0,I.jsx)(T.Zb,{padding:3,shadow:1,style:{position:"sticky",bottom:0,zIndex:3},children:(0,I.jsxs)(T.td,{space:1,children:[(0,I.jsx)(T.OK,{"aria-controls":"".concat(l,"tabpanel"),fontSize:1,id:"".concat(l,"tab-").concat(nz.id),label:nz.title,onClick:s,selected:a===nz}),(0,I.jsx)(T.OK,{"aria-controls":"".concat(l,"tabpanel"),fontSize:1,id:"".concat(l,"tab-").concat(nM.id),label:nM.title,onClick:d,selected:a===nM})]})}),(0,I.jsxs)(T.x4,{"aria-labelledby":"".concat(l,"tab-").concat(r),flex:1,id:"".concat(l,"tabpanel"),overflow:"auto",padding:4,style:{outline:"none"},children:[a===nz&&(0,I.jsx)(nZ,{children:(0,I.jsx)(ek(),{data:n,isExpanded:function e(n,t){let i=nI.get(n);return void 0===i?(nI.set(n,Array.isArray(t)||(0,er.Uy$)(t)),e(n,t)):i},onClick:nL,search:nD})}),a===nM&&(0,I.jsx)(T.EK,{language:"json",tabIndex:0,onKeyDown:nO,onDoubleClick:nR,onFocus:nR,children:JSON.stringify(n,null,2)})]})]})})}let nF=(0,eu.ZP)(T.Zb)(b||(b=eM(["\n  position: relative;\n  z-index: 50;\n"]))),nN=(0,eu.ZP)(T.xv)(y||(y=eM(["\n  & > * {\n    overflow: hidden;\n    white-space: nowrap;\n    text-overflow: ellipsis;\n  }\n"]))),nA=(0,L.memo)(()=>{var e,n,t,i,l,r;let o=(0,er.rq_)(),{params:a,groupIndex:s,routerPanesState:d,replaceCurrent:c,BackLink:u}
1=(0,R.RL)(),p=null==(e=d[s])?void 0:e[0].id,h=d[s-1],f=null==h?void 0:h[0],m=null==f?void 0:f.id,x=Boolean(null==(n=null==f?void 0:f.params)?void 0:n.rev),g=(0,L.useMemo)(()=>(null==a?void 0:a.parentRefPath)&&(0,em.mL)(a.parentRefPath)||null,[null==a?void 0:a.parentRefPath]),j=(0,eg.m2)(()=>{let e=null==g?void 0:g[0];if(!m||!e||!g)return(0,F.of)({loading:!1});let n=(0,er.vsM)(m),t=(0,em.mL)(e),i=t.findIndex(e=>"object"==typeof e&&"_key"in e);return(0,A.z)((0,F.of)({loading:!0}),o.unstable_observePathsDocumentPair(n,-1===i?t:t.slice(0,i)).pipe((0,et.b)(750),(0,H.U)(e=>{var n;let{draft:t,published:i}=e;return{loading:!1,result:{availability:{draft:t.availability,published:i.availability},refValue:null==(n=(0,em.U2)(t.snapshot||i.snapshot,g))?void 0:n._ref}}})))},[m,g],{loading:!0}),v=(0,L.useCallback)(()=>{var e;!j.loading&&(null==(e=j.result)?void 0:e.refValue)&&c({id:j.result.refValue,params:a})},[j.loading,j.result,c,a]),b=!m||!g||x||j.loading||!(null==(t=j.result)?void 0:t.availability.draft.available)&&!(null==(i=j.result)?void 0:i.availability.published.available)||(null==(l=j.result)?void 0:l.refValue)===p;return b?null:(0,I.jsx)(nF,{shadow:1,tone:"caution","data-testid":"reference-changed-banner",children:(0,I.jsx)(T.W2,{paddingX:4,paddingY:2,sizing:"border",width:1,children:(0,I.jsxs)(T.kC,{align:"center",children:[(0,I.jsx)(T.xv,{size:1,children:(0,I.jsx)(ep.foC,{})}),(null==(r=j.result)?void 0:r.refValue)?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.xu,{flex:1,marginLeft:3,children:(0,I.jsx)(nN,{title:"This reference has changed since you opened it.",size:1,children:"This reference has changed since you opened it."})}),(0,I.jsx)(T.xu,{marginLeft:3,children:(0,I.jsx)(T.zx,{onClick:v,icon:ep.bnu,fontSize:1,mode:"ghost",padding:2,space:2,text:"Reload reference"})})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.xu,{flex:1,marginLeft:3,children:(0,I.jsx)(nN,{title:"This reference has been removed since you opened it.",size:1,children:"This reference has been removed since you opened it."})}),(0,I.jsx)(T.xu,{marginLeft:3,children:(0,I.jsx)(T.zx,{as:u,icon:ep.Two,fontSize:1,mode:"ghost",padding:2,space:2,text:"Close reference"})})]})]})})})});nA.displayName="ReferenceChangedBanner";let nB=(0,eu.ZP)(T.Zb)(w||(w=eM(["\n  position: relative;\n  z-index: 50;\n"])));function nU(e){var n,t;let{granted:i,requiredPermission:l}=e,r=(0,er.xJ)(),o=(null==(n=null==r?void 0:r.roles)?void 0:n.length)!==1,a=((null==(t=null==r?void 0:r.roles)?void 0:t.map(e=>(0,I.jsx)("code",{children:e.title},e.name)))||[]).reduce((e,n)=>null===e?[n]:e.concat([", ",n]),null);return i?null:(0,I.jsx)(nB,{"data-testid":"permission-check-banner",shadow:1,tone:"transparent",children:(0,I.jsx)(T.W2,{paddingX:4,paddingY:3,sizing:"border",width:1,children:(0,I.jsxs)(T.kC,{align:"flex-start",children:[(0,I.jsx)(T.xv,{size:1,children:(0,I.jsx)(ep.CPA,{})}),(0,I.jsx)(T.xu,{flex:1,marginLeft:3,children:(0,I.jsxs)(T.xv,{size:1,children:["Your role",o&&"s"," ",a," ",o?"do":"does"," not have permissions to"," ",l," this document."]})})]})})})}let nX=e=>e.preventDefault();function nV(e){var n;let{hidden:t,margins:i}=e,{collapsedFieldSets:l,collapsedPaths:r,displayed:o,editState:a,documentId:s,documentType:d,onChange:c,validation:u,ready:p,formState:h,onFocus:f,onBlur:m,onSetCollapsedPath:x,onPathOpen:g,onSetCollapsedFieldSet:j,onSetActiveFieldGroup:v}=(0,R.Z3)(),b=(0,er.H__)(),y=(0,er.Dqo)(s),w=(0,L.useMemo)(()=>(0,er.fm0)(),[]),k=null==(n=null==a?void 0:a.transactionSyncLock)?void 0:n.enabled;!function(e){let n=(0,T.pm)(),t=function(e){let n=(0,L.useRef)();return(0,L.useEffect)(()=>{n.current=e},[e]),n.current}(e.enabled);(0,L.useEffect)(()=>{!t&&e.enabled&&n.push({...e,duration:20736e5}),t&&!e.enabled&&n.push({...e,duration:.01})},[e,n,t])}({id:"sync-lock-".concat(s),status:"warning",enabled:k,title:"Syncing document…",description:"Please hold tight while the document is synced. This usually happens right after the document has been published, and it shouldn't take more than a few seconds"}),(0,L.useEffect)(()=>{let e=b.pair.documentEvents(s,d).pipe((0,el.b)(e=>{"mutation"===e.type&&w.publish(function(e){let n=e.mutations.map(e=>
1e.patch).filter(Boolean);return{type:"mutation",snapshot:e.document,patches:(0,er.Sis)(e.origin,n)}}(e)),"rebase"===e.type&&w.publish(function(e){let n=e.remoteMutations.map(e=>e.patch).filter(Boolean),t=e.localMutations.map(e=>e.patch).filter(Boolean);return{type:"rebase",snapshot:e.document,patches:(0,er.Sis)("remote",n).concat((0,er.Sis)("local",t))}}(e))})).subscribe();return()=>{e.unsubscribe()}},[s,b,d,w]);let C=Boolean(null==o?void 0:o._rev);(0,L.useEffect)(()=>{C&&w.publish({type:"mutation",patches:[],snapshot:o})},[C]);let _=(0,L.useRef)(null);return(0,L.useEffect)(()=>{(0,T.fo)(_.current)},[]),(0,I.jsx)(T.W2,{hidden:t,paddingX:4,paddingTop:5,paddingBottom:9,sizing:"border",width:1,children:(0,I.jsx)(er.$rW,{margins:i,children:(0,I.jsx)(T.xu,{as:"form",onSubmit:nX,ref:_,children:p?null===h?(0,I.jsx)(T.xu,{padding:2,children:(0,I.jsx)(T.xv,{children:"This form is hidden"})}):(0,I.jsx)(er.quP,{__internal_patchChannel:w,collapsedFieldSets:l,collapsedPaths:r,focusPath:h.focusPath,changed:h.changed,focused:h.focused,groups:h.groups,id:"root",members:h.members,onChange:c,onFieldGroupSelect:v,onPathBlur:m,onPathFocus:f,onPathOpen:g,onSetFieldSetCollapsed:j,onSetPathCollapsed:x,presence:y,readOnly:h.readOnly,schemaType:h.schemaType,validation:u,value:h.value}):(0,I.jsx)(eE,{ms:300,children:(0,I.jsxs)(T.kC,{align:"center",direction:"column",height:"fill",justify:"center",children:[(0,I.jsx)(T.$j,{muted:!0}),(0,I.jsx)(T.xu,{marginTop:3,children:(0,I.jsx)(T.xv,{align:"center",muted:!0,size:1,children:"Loading document"})})]})})})})})}function nK(){let{activeViewId:e,paneKey:n,views:t}=(0,R.Z3)(),i="".concat(n,"tabpanel");return(0,I.jsx)(T.td,{space:1,children:t.map((t,l)=>{var r;return(0,I.jsx)(n$,{icon:t.icon,id:"".concat(n,"tab-").concat(t.id),isActive:e===t.id,label:(0,I.jsx)(I.Fragment,{children:t.title}),tabPanelId:i,viewId:0===l?null:null!=(r=t.id)?r:null},t.id)})})}function n$(e){let{icon:n,id:t,isActive:i,label:l,tabPanelId:r,viewId:o}=e,{ready:a}=(0,R.Z3)(),{setView:s}=(0,R.RL)(),d=(0,L.useCallback)(()=>s(o),[s,o]);return(0,I.jsx)(T.OK,{"aria-controls":r,disabled:!a,fontSize:1,icon:n,id:t,selected:i,label:l,onClick:d})}let nq={error:{tone:"critical",icon:ep.uIy},warning:{tone:"caution",icon:ep.foC},info:{tone:"primary",icon:ep.hQ6}};function nH(e){let{boundaryElement:n,isOpen:t,setOpen:i}=e,{onFocus:l,onPathOpen:r,schemaType:o,validation:a}=(0,R.Z3)(),s=(0,L.useId)(),d=a.length>0,c=a.some(ex.YN),u=a.some(ex.WQ),p=a.some(ex.Ny),h=(0,L.useMemo)(()=>c?nq.error:u?nq.warning:p?nq.info:void 0,[c,p,u]),f=(0,L.useCallback)(e=>{r(e),l(e)},[l,r]),m=(0,L.useCallback)(()=>i(!1),[i]);return d?(0,I.jsx)(T.j2,{id:s||"",button:(0,I.jsx)(T.zx,{...h,title:"Show validation issues",mode:"bleed","data-testid":"validation-list-button"}),menu:(0,I.jsx)(T.v2,{open:t,children:(0,I.jsx)(er.$L,{documentType:o,validation:a,onClose:m,onFocus:f})}),popover:{portal:!0,boundaryElement:n,constrainSize:!0,preventOverflow:!0,width:0},placement:"bottom"}):null}function nY(){let{connectionState:e,schemaType:n,title:t,value:i}=(0,R.Z3)(),l=Boolean(i)&&"connected"===e,{error:r,value:o}=(0,er._2T)({enabled:l,schemaType:n,value:i});return"connected"!==e?(0,I.jsx)(I.Fragment,{}):i?l?r?(0,I.jsxs)(I.Fragment,{children:["Error: ",r.message]}):(0,I.jsx)(I.Fragment,{children:(null==o?void 0:o.title)||(0,I.jsx)("span",{style:{color:"var(--card-muted-fg-color)"},children:"Untitled"})}):(0,I.jsx)(I.Fragment,{children:t}):(0,I.jsxs)(I.Fragment,{children:["New ",(null==n?void 0:n.title)||(null==n?void 0:n.name)]})}let nJ=e=>Boolean(e.showAsAction),nG=eP()(nJ),nQ=(0,L.memo)((0,L.forwardRef)((e,n)=>{let{rootElement:t}=e,{onMenuAction:i,onPaneClose:l,onPaneSplit:r,historyController:o,validation:a,menuItems:s,menuItemGroups:d,schemaType:c,ready:u,views:p,unstable_languageFilter:h}=(0,R.Z3)(),{revTime:f}=o,{features:m}=e$(),{index:x,BackLink:g,hasGroupSiblings:j}=(0,R.RL)(),v=(0,L.useMemo)(()=>s.filter(nG),[s]),[b,y]=L.useState(!1),w=p.length>1,k=m.reviewChanges,C=m.splitViews&&r&&p.length>1,_=C&&j,S=!_&&!m.backButton;return(0,I.jsx)(R.hX,{ref:n,loading:!u,title:(0,I.jsx)(nY,{}),tabs:w&&(0,I.jsx)(nK,{}),backButton:m.backButton&&x>0&&(0,I.jsx)(T.zx,{as:g,"data-as":"a",icon:ep.Y4O,mode:"bleed"}),subActions:k&&(0,I.jsx)(nw,{chunk:f,mode:"rev",placement:"bottom-end"}),actions:(0,I.jsxs)(T.gF,{space:1,children:[h.length>0&&(0,I.jsx)(I.Fragment,{children:h.map((e,n)=>(0,L.createElement)(e,{key:"language-filter-".concat(n),schemaType:c}))}),a.length>0&&(0,I.jsx)(nH,{boundaryElement:t,isOpen:b,setOpen:y},"validation-menu"),(0,I.jsx)(R.eu,{itemGroups:d,items:v,onAction:i},"context-menu"),C&&(0,I.jsx)(T.zx,{icon:ep.iro,mode:"bleed",onClick:r,title:"Split pane right"},"split-pane-button"),_&&(0,I.jsx)(T.zx,{icon:ep.Two,mode:"bleed",onClick:l,title:"Close split pane"},"close-view-button"),S&&(0,I.jsx)(T.zx,{icon:ep.Two,mode:"bleed",title:"Close pane group",as:g},"close-view-button")]})})}));nQ.displayName="DocumentPanelHeader";let n0=(0,eu.ZP)(er.l$t)(e=>{let{$disabled:n}=e;return n?{height:"100%"}:(0,eu.iv)(k||(k=eM(["\n    height: 100%;\n    overflow: auto;\n    position: relative;\n    scroll-behavior: smooth;\n    outline: none;\n  "])))}),n1=function(e){let{footerHeight:n,isInspectOpen:t,rootElement:i,setDocumentPanelPortalElement:l}=e,{activeViewId:r,displayed:o,documentId:a,editState:s,value:d,views:c,ready:u,schemaType:p,permissions:h,isPermissionsLoading:f}=(0,R.Z3)(),{collapsed:m}=(0,R.Cc)(),x=(0,T.vI)(),{features:g}
1=e$(),[j,v]=(0,L.useState)(null),b=(0,T.XL)(j),y=(0,L.useRef)(null),[w,k]=(0,L.useState)(null),C=d._createdAt?"update":"create",_=(0,L.useMemo)(()=>c.find(e=>e.id===r)||c[0]||{type:"form"},[r,c]),S=g.splitPanes&&y.current||x.element,P=(0,L.useMemo)(()=>m?[(null==b?void 0:b.height)||0,0,n?n+2:2,0]:[0,0,2,0],[m,n,b]),z="form"!==_.type,M=(0,L.useMemo)(()=>"component"===_.type&&_.component&&(0,L.createElement)(_.component,{document:{draft:(null==s?void 0:s.draft)||null,displayed:o||d,historical:o,published:(null==s?void 0:s.published)||null},documentId:a,options:_.options,schemaType:p}),[_,o,a,null==s?void 0:s.draft,null==s?void 0:s.published,p,d]);(0,L.useEffect)(()=>{(null==w?void 0:w.scrollTo)&&w.scrollTo(0,0)},[a,w]),(0,L.useEffect)(()=>{S&&l(S)},[S,l]);let E=(0,L.useMemo)(()=>t?(0,I.jsx)(nW,{value:o||d}):null,[t,o,d]);return(0,I.jsxs)(T.kC,{direction:"column",flex:2,overflow:m?void 0:"hidden",children:[(0,I.jsx)(nQ,{rootElement:i,ref:v}),(0,I.jsx)(R.Bh,{children:(0,I.jsx)(T.Xp,{element:S,__unstable_elements:{documentScrollElement:w},children:(0,I.jsxs)(T.NM,{element:w,children:["form"===_.type&&!f&&u&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(nU,{granted:Boolean(null==h?void 0:h.granted),requiredPermission:C}),(0,I.jsx)(nA,{})]}),(0,I.jsxs)(n0,{$disabled:m||!1,"data-testid":"document-panel-scroller",ref:k,children:[(0,I.jsx)(nV,{hidden:z,margins:P},a+(u?"_ready":"_pending")),M]}),E,(0,I.jsx)("div",{"data-testid":"document-panel-portal",ref:y})]})})})]})},n2=["left","bottom"],n3={small:0,medium:1,large:2,full:"auto"};function n4(e){let{dialog:n,referenceElement:t}=e;return(0,I.jsx)(T.J2,{content:(0,I.jsx)(n5,{dialog:n}),fallbackPlacements:n2,open:!0,placement:"top",portal:!0,preventOverflow:!0,referenceElement:t})}function n5(e){let{dialog:n}=e,{cancelButtonIcon:t,cancelButtonText:i,confirmButtonIcon:l,confirmButtonText:r,message:o,onCancel:a,onConfirm:s,tone:d}=n,{isTopLayer:c}
1=(0,T.sJ)(),[u,p]=(0,L.useState)(null),h=(0,L.useCallback)(()=>{c&&a()},[c,a]),f=(0,L.useCallback)(e=>{"Escape"===e.key&&c&&a()},[c,a]);return(0,T.O8)(h,[u]),(0,T.qh)(f),(0,I.jsxs)(T.kC,{direction:"column",ref:p,style:{minWidth:304,maxWidth:400},children:[(0,I.jsx)(T.xu,{flex:1,overflow:"auto",padding:4,children:(0,I.jsx)(T.xv,{children:o})}),(0,I.jsx)(T.xu,{paddingX:4,paddingY:3,style:{borderTop:"1px solid var(--card-border-color)"},children:(0,I.jsxs)(T.rj,{columns:2,gap:2,children:[(0,I.jsx)(T.zx,{icon:t,onClick:a,mode:"ghost",text:i||"Cancel"}),(0,I.jsx)(T.zx,{icon:l,onClick:s,text:r||"Confirm",tone:d})]})})]})}function n8(e){let{dialog:n}=e,t=(0,L.useId)(),i=n.footer&&(0,I.jsx)(T.xu,{paddingX:4,paddingY:3,children:n.footer});return(0,I.jsx)(er.jr5,{zOffset:"fullscreen",children:(0,I.jsx)(T.Vq,{__unstable_hideCloseButton:!1===n.showCloseButton,footer:i,header:n.header,id:t,onClose:n.onClose,onClickOutside:n.onClose,width:void 0===n.width?1:n3[n.width],portal:"documentPanelPortalElement",children:(0,I.jsx)(T.xu,{padding:4,children:n.content})})})}function n6(e){let{dialog:n,referenceElement:t}=e;return(0,I.jsx)(T.J2,{content:(0,I.jsx)(n9,{dialog:n}),fallbackPlacements:n2,open:!0,placement:"top",portal:!0,preventOverflow:!0,referenceElement:t})}function n9(e){let{dialog:n}=e,{content:t,onClose:i}=n,{isTopLayer:l}=(0,T.sJ)(),[r,o]=(0,L.useState)(null),a=(0,L.useCallback)(()=>{l&&i()},[l,i]),s=(0,L.useCallback)(e=>{"Escape"===e.key&&l&&i()},[l,i]);return(0,T.O8)(a,[r]),(0,T.qh)(s),(0,I.jsx)("div",{ref:o,children:t})}function n7(e){let{dialog:n,referenceElement:t=null}=e,i=(0,L.useId)();return"confirm"===n.type?(0,I.jsx)(n4,{dialog:n,referenceElement:t}):"popover"===n.type?(0,I.jsx)(n6,{dialog:n,referenceElement:t}):"dialog"!==n.type&&n.type?(console.warn("Unsupported modal type ".concat(n.type)),(0,I.jsx)(T.Vq,{id:i,onClose:n.onClose,onClickOutside:n.onClose,width:2,children:(0,I.jsx)(T.xu,{padding:4,children:n.content||(0,I.jsxs)(I.Fragment,{children:["Unexpected modal type (",(0,I.jsx)("code",{children:n.type}),")"]})})})):(0,I.jsx)(n8,{dialog:n})}function te(e){let{actionStates:n,disabled:t}=e,i=(0,L.useId)(),l=(0,L.useRef)(null),[r,o]=(0,L.useState)(-1),[a,s]=(0,L.useState)(null),d=(0,L.useCallback)(e=>{o(e)},[]),c=(0,L.useMemo)(()=>({placement:"top-end",portal:!0,preventOverflow:!0}),[]),u=n[r];return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.j2,{id:"".concat(i,"-action-menu"),button:(0,I.jsx)(T.zx,{"data-testid":"action-menu-button","aria-label":"Open document actions",disabled:t,icon:ep.v4q,mode:"ghost",ref:l}),menu:(0,I.jsx)(T.v2,{padding:1,children:n.map((e,n)=>(0,I.jsx)(tn,{actionState:e,disabled:t,index:n,onAction:d},n))}),popover:c,ref:s}),u&&u.dialog&&(0,I.jsx)(er.jr5,{zOffset:"paneFooter",children:(0,I.jsx)(n7,{dialog:u.dialog,referenceElement:a})})]})}function tn(e){let{actionState:n,disabled:t,index:i,onAction:l}=e,{onHandle:r}=n,o=(0,L.useCallback)(()=>{l(i),r&&r()},[i,l,r]),a=n.title&&(0,I.jsx)(T.xu,{padding:2,children:(0,I.jsx)(T.xv,{size:1,children:n.title})});return(0,I.jsx)(T.sN,{"data-testid":"action-".concat(n.label.replace(" ","")),disabled:t||Boolean(n.disabled),onClick:o,padding:0,tone:n.tone,children:(0,I.jsx)(T.u,{content:a,disabled:!a,fallbackPlacements:["left","bottom"],placement:"top",portal:!0,children:(0,I.jsxs)(T.kC,{align:"center",paddingX:3,children:[(0,I.jsxs)(T.kC,{flex:1,paddingY:3,children:[n.icon&&(0,I.jsx)(T.xu,{marginRight:3,children:(0,I.jsxs)(T.xv,{children:[(0,L.isValidElement)(n.icon)&&n.icon,(0,eh.isValidElementType)(n.icon)&&(0,L.createElement)(n.icon)]})}),(0,I.jsx)(T.xv,{children:n.label})]}),n.shortcut&&(0,I.jsx)(T.xu,{marginLeft:3,children:(0,I.jsx)(T.p8,{keys:String(n.shortcut).split("+").map(e=>e.slice(0,1).toUpperCase()+e.slice(1))})})]})})})}function tt(e){let{disabled:n,showMenu:t,states:i}
1=e,[l,...r]=i,[o,a]=(0,L.useState)(null),s=(0,L.useMemo)(()=>l&&(l.title||l.shortcut)?(0,I.jsxs)(T.kC,{padding:2,style:{maxWidth:300},align:"center",children:[(0,I.jsx)(T.xv,{size:1,children:l.title}),l.shortcut&&(0,I.jsx)(T.xu,{marginLeft:l.title?2:0,children:(0,I.jsx)(T.p8,{keys:String(l.shortcut).split("+").map(e=>e.slice(0,1).toUpperCase()+e.slice(1).toLowerCase())})})]}):null,[l]);return(0,I.jsxs)(T.kC,{children:[l&&(0,I.jsx)(T.li,{zOffset:200,children:(0,I.jsx)(T.u,{disabled:!s,content:s,portal:!0,placement:"top",children:(0,I.jsx)(T.Kq,{flex:1,children:(0,I.jsx)(T.zx,{"data-testid":"action-".concat(l.label),disabled:n||Boolean(l.disabled),icon:l.icon,onClick:l.onHandle,ref:a,text:l.label,tone:l.tone||"primary"})})})}),t&&r.length>0&&(0,I.jsx)(T.xu,{marginLeft:1,children:(0,I.jsx)(te,{actionStates:r,disabled:n})}),l&&l.dialog&&(0,I.jsx)(n7,{dialog:l.dialog,referenceElement:o})]})}let ti=(0,L.memo)(function(){let{actions:e,connectionState:n,documentId:t,editState:i}=(0,R.Z3)();return e&&i?(0,I.jsx)(eI,{actions:e,actionProps:i,children:i=>{let{states:l}=i;return(0,I.jsx)(tt,{disabled:"connected"!==n,showMenu:e.length>1,states:l},t)}}):null}),tl=(0,L.memo)(function(){var e;let{connectionState:n,editState:t,historyController:i}=(0,R.Z3)(),l=(null==(e=i.revTime)?void 0:e.id)||"",r=((null==t?void 0:t.draft)||(null==t?void 0:t.published)||{})._rev===l,o=(0,L.useMemo)(()=>({...t||{},revision:l}),[t,l]),a=(0,L.useMemo)(()=>[R.Ty],[]);return(0,I.jsx)(eI,{actions:a,actionProps:o,children:e=>{let{states:t}=e;return(0,I.jsx)(tt,{disabled:"connected"!==n||Boolean(r),showMenu:!1,states:t})}})}),tr={primary:"primary",success:"positive",warning:"caution",danger:"critical"};function to(e){let{states:n}=e;return(0,I.jsx)(T.gF,{space:1,children:n.map((e,n)=>(0,I.jsx)(T.u,{content:e.title&&(0,I.jsx)(T.xu,{padding:2,children:(0,I.jsx)(T.xv,{size:1,children:e.title})}),disabled:!e.title,placement:"top",portal:!0,children:(0,I.jsx)(T.Ct,{fontSize:1,mode:"outline",paddingX:2,paddingY:1,radius:4,tone:e.color?tr[e.color]:void 0,style:{whiteSpace:"nowrap"},children:e.label})},String(n)))})}function ta(){let{badges:e,editState:n}=(0,R.Z3)();return n&&e?(0,I.jsx)(eL,{badges:e,badgeProps:n,children:e=>{let{states:n}=e;return(0,I.jsx)(to,{states:n})}}):null}let ts=(0,eu.ZP)(T.kC)(C||(C=eM(["\n  cursor: default;\n"])));function td(e){let{collapsed:n,disabled:t,lastPublished:i,lastUpdated:l,liveEdit:r}=e,o=(0,er.INm)(i||"",{minimal:!0,agoSuffix:!0}),a=(0,er.INm)(i||"",{minimal:!0}),s=(0,er.INm)(l||"",{minimal:!0,agoSuffix:!0}),d=(0,er.INm)(l||"",{minimal:!0});return(0,I.jsx)(ts,{align:"center","data-ui":"SessionLayout",sizing:"border",children:(0,I.jsx)(T.u,{placement:"top",portal:!0,content:(0,I.jsx)(T.Kq,{padding:3,space:3,children:(0,I.jsx)(T.xv,{size:1,muted:!0,children:r?(0,I.jsxs)(I.Fragment,{children:["Last updated ",l?s:o]}):(0,I.jsxs)(I.Fragment,{children:["Last published ",o]})})}),children:(0,I.jsx)(T.zx,{mode:"bleed",tone:r?"critical":"positive",tabIndex:-1,disabled:t,children:(0,I.jsxs)(T.kC,{align:"center",children:[(0,I.jsx)(T.xu,{marginRight:n?0:3,children:(0,I.jsx)(T.xv,{size:2,children:r?(0,I.jsx)(ep.o1U,{}):(0,I.jsx)(ep.EI4,{})})}),!n&&(0,I.jsx)(T.xv,{size:1,weight:"medium",children:r?(0,I.jsx)(I.Fragment,{children:l?d:a}):a})]})})})})}let tc=(0,eu.ZP)(ez.E.path)(_||(_=eM(["\n  transform-origin: center;
1\n"]))),tu=e=>(0,I.jsx)(ez.E.circle,{fill:"none",r:"8",cx:"12.5",cy:"12.5",strokeWidth:"1.2",...e}),tp=e=>(0,I.jsx)(tc,{fill:"none",d:"M14 17.5619L11.5 20.5L14.5 23.0619M11 7.43811L13.5 4.50001L10.5 1.93811",...e}),th=e=>(0,I.jsx)(ez.E.path,{d:"M9.5 12.1316L11.7414 14.5L16 10",...e}),tf=e=>(0,I.jsx)(ez.E.path,{d:"M15 7L18 10M6 19L7 15L17 5L20 8L10 18L6 19Z",...e}),tm=(0,eu.F4)(S||(S=eM(["\n  0% {\n    transform: rotate(0);\n  }\n  100% {\n    transform: rotate(360deg);\n  }\n"]))),tx=eu.ZP.g(P||(P=eM(["\n  transform-origin: center;\n\n  &[data-rotate] {\n    animation: "," 1s ease-in-out infinite;\n  }\n"])),tm),tg={syncing:{scale:1,transition:{duration:0}},saved:{scale:[1,.8,1.2,.9,1.1,.95,1.05,.99,1],transition:{duration:.5,delay:.2}},changes:{transition:{duration:0}}},tj={syncing:{strokeDasharray:"0, 0, 23, 3, 23, 3",strokeDashoffset:10,opacity:1,transition:{duration:0}},saved:{strokeDasharray:"0, 0, 23, 0, 23, 0",strokeDashoffset:10,opacity:1,transition:{duration:.2}},changes:{strokeDasharray:"0, 60, 23, 0, 23, 0",strokeDashoffset:0,opacity:0,transition:{duration:.5}}},tv={syncing:{opacity:1,transition:{duration:0}},saved:{opacity:0,transition:{duration:.2}},changes:{opacity:0}},tb={syncing:{pathLength:0,transition:{duration:0}},saved:{pathLength:1,transition:{delay:.4,duration:.3}},changes:{pathLength:0,transition:{duration:.2}}},ty={syncing:{pathLength:0,transition:{duration:0}},saved:{pathLength:0,transition:{duration:0}},changes:{pathLength:1,transition:{duration:.4,delay:.5}}};function tw(e){let{status:n}=e;return n?(0,I.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 25 25",fill:"none",stroke:"currentColor",strokeWidth:"1.2","data-sanity-icon":"",children:(0,I.jsxs)(ez.E.g,{variants:tg,initial:n,animate:n,children:[(0,I.jsxs)(tx,{"data-rotate":"changes"===n?void 0:"",children:[(0,I.jsx)(tp,{variants:tv,initial:n,animate:n}),(0,I.jsx)(tu,{variants:tj,initial:n,animate:n})]}),(0,I.jsx)(th,{variants:tb,initial:n,animate:n}),(0,I.jsx)(tf,{variants:ty,initial:n,animate:n})]})}):null}let tk=L.forwardRef(function(e,n){let{collapsed:t,status:i,lastUpdated:l,...r}=e,o=(0,er.INm)(l||"",{minimal:!0}),a=(0,er.INm)(l||"",{minimal:!0,agoSuffix:!0}),s=(0,L.useMemo)(()=>"syncing"===i?{text:"Saving...",tone:void 0}:"changes"===i?{text:o,tone:"caution"}:"saved"===i?{text:"Saved!",tone:"positive"}:{},[i,o]);return i?(0,I.jsx)(T.u,{placement:"top",portal:!0,disabled:"changes"!==i,content:(0,I.jsxs)(T.Kq,{padding:3,space:3,children:[(0,I.jsx)(T.xv,{size:1,weight:"semibold",children:"Review changes"}),(0,I.jsxs)(T.xv,{size:1,muted:!0,children:["Changes saved ",a]})]}),children:(0,I.jsx)(T.zx,{mode:"bleed",justify:"flex-start",tone:null==s?void 0:s.tone,...r,"data-testid":"review-changes-button",ref:n,children:(0,I.jsxs)(T.kC,{align:"center",children:[(0,I.jsx)(T.xu,{marginRight:t?0:3,children:(0,I.jsx)(T.xv,{children:(0,I.jsx)(tw,{status:i})})}),!t&&(0,I.jsx)(T.xv,{size:1,weight:"medium",children:null==s?void 0:s.text})]})})}):null}),tC=L.memo(tk),t_=(0,L.memo)(function(){var e;let{changesOpen:n,documentId:t,documentType:i,editState:l,onHistoryClose:r,onHistoryOpen:o,historyController:a,value:s}=(0,R.Z3)(),d=(0,er.nuD)(t,i),c=null==s?void 0:s._updatedAt,u=null==(e=null==l?void 0:l.published)?void 0:e._updatedAt,p=a.onOlderRevision(),h=Boolean(null==l?void 0:l.liveEdit),f=Boolean(null==l?void 0:l.published),m=Boolean(null==l?void 0:l.draft),[x,g]=(0,L.useState)(null),j=(0,T.XL)(x),v=!j||(null==j?void 0:j.width)<300,[b,y]=(0,L.useState)(null);(0,L.useEffect)(()=>{if("syncing"===b&&!d.isSyncing){let e=setTimeout(()=>y("saved"),1e3);return()=>clearTimeout(e)}if("saved"===b){let e=setTimeout(()=>y(null),3e3);return()=>clearTimeout(e)}},[b,c,d.isSyncing]),(0,L.useLayoutEffect)(()=>{y(null)},[t]),(0,L.useLayoutEffect)(()=>{d.isSyncing&&y("syncing")},[d.isSyncing,c]);let w=(0,L.useMemo)(()=>(0,I.jsx)(tC,{lastUpdated:c,status:b||(m?"changes":void 0),onClick:n?r:o,disabled:p,selected:n,collapsed:v}),[m,n,r,o,c,p,b,v]),k=(0,L.useMemo)(()=>(h||f)&&(0,I.jsx)(T.xu,{marginRight:1,children:(0,I.jsx)(td,{disabled:p,lastPublished:u,lastUpdated:c,liveEdit:h,collapsed:v})}),[v,u,c,h,f,p]);return(0,I.jsxs)(T.kC,{align:"center","data-ui":"DocumentSparkline",ref:g,children:[k,(0,I.jsxs)(T.kC,{align:"center",flex:1,children:[w,!v&&(0,I.jsx)(T.xu,{marginLeft:3,children:(0,I.jsx)(ta,{})})]})]})}),tS=(0,eu.ZP)(T.xu)(z||(z=eM(["\n  min-width: 10em;\n  max-width: 16em;\n"])));function tP(e){let{actionsBoxRef:n}=e,{badges:t,historyController:i}=(0,R.Z3)(),l=i.onOlderRevision();return(0,L.useMemo)(()=>(0,I.jsx)(T.xu,{paddingLeft:2,paddingRight:[2,3],paddingY:2,children:(0,I.jsxs)(T.kC,{align:"center",children:[(0,I.jsx)(T.xu,{flex:[1,2],children:t&&(0,I.jsx)(t_,{})}),(0,I.jsx)(tS,{flex:1,marginLeft:[1,3],ref:n,children:l?(0,I.jsx)(tl,{}):(0,I.jsx)(ti,{})})]})}),[n,t,l])}function tz(e){let{actionsBoxElement:n,activeIndex:t,children:i,id:l,onActionStart:r,onKeyDown:o,rootRef:a,states:s,...d}=e,c=s[t],u=(0,L.useCallback)(e=>{let n=s.filter(n=>n.shortcut&&(0,ef.ZP)(n.shortcut,e)),t=n[0];if(n.length>1&&console.warn('Keyboard shortcut conflict: More than one document action matches the shortcut "'.concat(t.shortcut,'"')),t&&!t.disabled&&t.onHandle){e.preventDefault(),t.onHandle(),r(s.indexOf(t));return}o&&o(e)},[r,o,s]);return(0,I.jsxs)(R.X6,{id:l,onKeyDown:u,tabIndex:-1,...d,ref:a,children:[i,c&&c.dialog&&(0,I.jsx)(er.jr5,{zOffset:"paneFooter",children:(0,I.jsx)(n7,{dialog:c.dialog,referenceElement:n})})]})}let tM=L.memo(e=>{let{actionsBoxElement:n,children:t,...i}=e,{actions:l,editState:r}
1=(0,R.Z3)(),[o,a]=(0,L.useState)(-1),s=(0,L.useCallback)(e=>{a(e)},[]),d=(0,L.useMemo)(()=>r&&{...r,onComplete:()=>void 0,revision:void 0},[r]);return d&&l?(0,I.jsx)(eI,{actionProps:d,actions:l,children:e=>{let{states:l}=e;return(0,I.jsx)(tz,{...i,activeIndex:o,actionsBoxElement:n,onActionStart:s,states:l,children:t})}}):null});tM.displayName="DocumentActionShortcuts";let tE=["fixed","absolute"],tI=(0,eu.ZP)(er.jbM)(M||(M=eM(["\n  flex: 1;\n  display: flex;\n  min-height: 0;\n  min-width: 0;\n"]))),tL=(0,L.memo)(function(e){let{name:n}=(0,er.Lky)();return(0,I.jsx)(er.cWh,{name:e.pane.source||n,children:(0,I.jsx)(tT,{...e})})});function tT(e){var n;let{pane:t,paneKey:i}=e,{resolveNewDocumentOptions:l}=(0,er.Lky)().document,r=(0,R.RL)(),o=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=(0,er.zEW)();return(0,L.useMemo)(()=>{if(e.type&&"*"!==e.type)return e;let i=e.template||n.template,l=i?t.find(e=>e.id===i):void 0,r=null==l?void 0:l.schemaType;return r?{...e,type:r}:e},[e,n.template,t])}(t.options,r.params),{documentType:a,isLoaded:s}=(0,er.Hdz)(o.id,o.type),d=(0,L.useMemo)(()=>l({type:"global"}),[l]),[c,u]=(0,er.UMU)({templateItems:d}),p=s&&!u,h=(0,L.useMemo)(()=>p&&a&&o.type!==a?{...e,pane:{...e.pane,options:{...o,type:a}}}:e,[e,a,p,o]),{ReferenceChildLink:f,handleEditReference:m,groupIndex:x,routerPanesState:g}=r,j=(null==(n=g[x+1])?void 0:n[0].params)||{},v=g.length,{parentRefPath:b}=j,y=(0,L.useMemo)(()=>b?{path:(0,em.mL)(b),state:x>=v-1?"none":x>=v-2?"selected":"pressed"}:{path:[],state:"none"},[b,x,v]);return"*"!==o.type||p?a?(0,I.jsx)(no,{...h,children:(0,I.jsx)(er.euX,{EditReferenceLinkComponent:f,onEditReference:m,initialValueTemplateItems:c,activePath:y,children:(0,I.jsx)(tR,{})})},a):(0,I.jsx)(e6,{flex:2.5,minWidth:320,paneKey:i,title:(0,I.jsx)(I.Fragment,{children:"The document was not found"}),children:(0,I.jsx)(T.Kq,{space:4,children:(0,I.jsxs)(T.xv,{as:"p",children:["The document type is not defined, and a document with the ",(0,I.jsx)("code",{children:o.id})," ","identifier could not be found."]})})}):(0,I.jsx)(e4,{flex:2.5,minWidth:320,paneKey:i,title:"Loading document…"})}function tR(){let{changesOpen:e,documentType:n,onFocus:t,onPathOpen:i,onHistoryOpen:l,onKeyUp:r,inspectOpen:o,paneKey:a,schemaType:s,value:d}=(0,R.Z3)(),{features:c}=e$(),{collapsed:u}=(0,R.Cc)(),p=(0,er.Cnp)(),[h,f]=(0,L.useState)(null),[m,x]=(0,L.useState)(null),[g,j]=(0,L.useState)(null),[v,b]=(0,L.useState)(null),y=(0,T.XL)(m),w=null==y?void 0:y.height,k=(0,L.useMemo)(()=>(0,I.jsx)(n1,{footerHeight:w||null,isInspectOpen:o,rootElement:h,setDocumentPanelPortalElement:b}),[w,h,o]),C=(0,L.useMemo)(()=>(0,I.jsx)(T.Xp,{__unstable_elements:{documentPanelPortalElement:v},children:(0,I.jsx)(T.Tu,{position:tE,zOffset:p.portal,children:(0,I.jsx)(R.PV,{ref:x,children:(0,I.jsx)(tP,{actionsBoxRef:j})})})}),[v,p.portal]),_=(0,L.useMemo)(()=>c.reviewChanges&&e?(0,I.jsx)(T.NM,{element:h,children:(0,I.jsx)(n_,{})}):null,[e,c.reviewChanges,h]),S=(0,L.useCallback)(e=>{i(e),t(e)},[i,t]),P=(0,L.useMemo)(()=>s?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.Tu,{position:tE,zOffset:p.portal,children:(0,I.jsx)(T.kC,{direction:"column",flex:1,height:u?void 0:"fill",children:(0,I.jsxs)(tI,{"data-testid":"change-connector-root",isReviewChangesOpen:e,onOpenReviewChanges:l,onSetFocus:S,children:[k,_]})})}),C,(0,I.jsx)(e7,{})]}):(0,I.jsx)(e6,{flex:2.5,minWidth:320,paneKey:a,title:(0,I.jsxs)(I.Fragment,{children:["Unknown document type: ",(0,I.jsx)("code",{children:n})]}),tone:"caution",children:(0,I.jsxs)(T.Kq,{space:4,children:[n&&(0,I.jsxs)(T.xv,{as:"p",children:["This document has the schema type ",(0,I.jsx)("code",{children:n}),", which is not defined as a type in the local content studio schema."]}),!n&&(0,I.jsx)(T.xv,{as:"p",children:"This document does not exist, and no schema type was specified for it."}),er.r8Q&&d&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.xv,{as:"p",children:"Here is the JSON representation of the document:"}),(0,I.jsx)(T.Zb,{padding:3,overflow:"auto",radius:2,shadow:1,tone:"inherit",children:(0,I.jsx)(T.EK,{language:"json",size:[1,1,2],children:JSON.stringify(d,null,2)})})]})]})}),[s,p.portal,u,e,l,S,k,_,C,a,n,d]);return(0,I.jsx)(tM,{actionsBoxElement:g,currentMinWidth:e?920:600,"data-testid":"document-pane",flex:2.5,id:a,minWidth:e?640:320,onKeyUp:r,rootRef:f,children:P})}function tO(){return(0,I.jsx)(T.Zb,{height:"fill",children:(0,I.jsx)(T.kC,{align:"center",height:"fill",justify:"center",padding:4,sizing:"border",children:(0,I.jsx)(T.W2,{width:0,children:(0,I.jsx)(T.Zb,{padding:4,radius:2,shadow:1,tone:"caution",children:(0,I.jsxs)(T.kC,{children:[(0,I.jsx)(T.xu,{children:(0,I.jsx)(T.xv,{size:1,children:(0,I.jsx)(ep.foC,{})})}),(0,I.jsxs)(T.Kq,{flex:1,marginLeft:3,space:3,children:[(0,I.jsx)(T.xv,{as:"h1",size:1,weight:"bold",children:"No document types"}),(0,I.jsx)(T.xv,{as:"p",muted:!0,size:1,children:"Please define at least one document type in your schema."}),(0,I.jsx)(T.xv,{as:"p",muted:!0,size:1,children:(0,I.jsx)("a",{href:"https://www.sanity.io/docs/create-a-schema-and-configure-sanity-studio",target:"_blank",rel:"noreferrer",children:"Learn how to add a document type →"})})]})]})})})})})}let tZ=(0,eu.ZP)(function(e){let{children:n,minWidth:t,onCollapse:i,onExpand:l,...r}=e,o=(0,L.useMemo)(()=>(function(){let e=[],n=[],t=new WeakMap,i=new Set,l={},r=null,o=0,a=null,s=new Map,d=!1;function c(e){i.delete(e),a=e,u()}return{collapse:function(e){i.add(e),a===e&&(a=null),u()},expand:c,mount:function(e,i){return t.set(e,{...i,original:i}),n.push(e),r&&function(e,n){let t=new WeakMap;for(let i of n)t.set(i,function(e,n){let t=[],i=n;for(;i!==e;){let n=i.parentElement;if(!n)break;let l=Array.from(n.childNodes),r=l.indexOf(i);if(t.unshift(r),n===e)break;i=n}return t}(e,i));let i=(e,n)=>{let i=t.get(e)||eO,l=t.get(n)||eO,r=Math.max(i.length,l.length);for(let e=0;e<r;e+=1){let n=i[e]||-1,t=l[e]||-1;if(n!==t)return n-t}return 0};n.sort(i)}(r,n),c(e),()=>{let i=n.indexOf(e);i>-1&&n.splice(i,1),t.delete(e),u()}},resize:function(e,i,r){var o,a,c,p;let h=n.indexOf(i),f=t.get(i);if(!f)return;let m=n[h+1],x=t.get(m);
1if(x){if("start"===e&&(d=!0,l.left={element:i,flex:f.flex||1,width:i.offsetWidth},l.right={element:m,flex:x.flex||1,width:m.offsetWidth},u()),"move"===e&&l.left&&l.right){s=new Map;let{leftW:e,rightW:n,leftFlex:t,rightFlex:o}=function(e,n,t,i){var l,r;let o={flex:e.left.flex+e.right.flex,width:e.left.width+e.right.width},a=null!=(l=n.minWidth)?l:R.nR,s=null!=(r=t.minWidth)?r:R.nR,d=Math.min(n.maxWidth||1/0,o.width-s),c=Math.min(t.maxWidth||1/0,o.width-a),u=a-e.left.width,p=e.right.width-c;u<p&&(u=p);let h=e.right.width-s,f=d-e.left.width;h>f&&(h=f);let m=Math.min(Math.max(i,u),h),x=e.left.width+m,g=e.right.width-m,j=x/o.width*o.flex,v=g/o.width*o.flex;return{leftFlex:j,leftW:x,rightFlex:v,rightW:g}}(l,f,x,r);s.set(i,{flex:t,width:e}),s.set(m,{flex:o,width:n}),u()}if("end"===e){d=!1;let e=s.get(i),n=s.get(m);t.set(i,{...f,currentMinWidth:0,currentMaxWidth:null!=(o=f.maxWidth)?o:1/0,flex:null!=(a=null==e?void 0:e.flex)?a:f.flex}),t.set(m,{...x,currentMinWidth:0,currentMaxWidth:null!=(c=f.maxWidth)?c:1/0,flex:null!=(p=null==n?void 0:n.flex)?p:x.flex}),s=new Map,delete l.left,delete l.right,u()}}},setRootElement:function(e){r=e},setRootWidth:function(e){o=e,u()},subscribe:function(n){return e.push(n),()=>{let t=e.push(n);t>-1&&e.splice(t,1)}}};function u(){var l,r,c,u;if(!o)return;let p=[];for(let e of n)e!==a&&p.unshift(e);a&&p.unshift(a);let h=new WeakMap,f=p.length,m=p[0],x=(f-1)*R.AA,g=o-x;for(let e of p){let n=t.get(e);if(!n)continue;let o=n.currentMinWidth||n.minWidth||R.nR,a=e===m,d=i.has(e),p=o>g,f=!a&&(d||p),x=s.get(e);h.set(e,{element:e,collapsed:f,currentMinWidth:null!=(l=null==x?void 0:x.width)?l:n.currentMinWidth,currentMaxWidth:null!=(r=null==x?void 0:x.width)?r:n.currentMaxWidth,flex:null!=(u=null!=(c=null==x?void 0:x.flex)?c:n.flex)?u:1}),f?g-=R.AA:g-=o-R.AA}let j=[];for(let e of n){let n=h.get(e);n&&j.push(n)}for(let t of e)t({expandedElement:a||n[n.length-1]||null,panes:j,resizing:d})}})(),[]),[a,s]=(0,L.useState)(null),d=(0,T.XL)(a),c=(null==d?void 0:d.width)||0,u=void 0!==c&&t?c<t:void 0,[p,h]=(0,L.useState)({expandedElement:null,panes:[],resizing:!1});(0,L.useEffect)(()=>o.setRootElement(a),[o,a]),(0,L.useEffect)(()=>o.setRootWidth(c),[o,c]),(0,L.useEffect)(()=>o.subscribe(h),[o]),(0,L.useEffect)(()=>{void 0!==u&&(u&&i&&i(),!u&&l&&l())},[u,i,l]);let f=(0,L.useMemo)(()=>({collapse:o.collapse,collapsed:u,expand:o.expand,expandedElement:p.expandedElement,mount:o.mount,panes:p.panes,resize:o.resize,resizing:p.resizing}),[u,o,p.expandedElement,p.panes,p.resizing]);return(0,I.jsx)(R.yq.Provider,{value:f,children:(0,I.jsx)(R.fC,{"data-ui":"PaneLayout",...r,"data-collapsed":u?"":void 0,"data-resizing":p.resizing?"":void 0,"data-mounted":c?"":void 0,ref:s,children:n})})})(E||(E=eM(["\n  min-height: 100%;\n  min-width: 320px;\n"]))),tD=(0,ef.ZP)("mod+s"),tW=(0,L.memo)(function(e){var n;let{onPaneChange:t}=e,{navigate:i}=(0,ed.tv)(),{push:l}=(0,T.pm)(),r=(0,er.I_y)(),o=(0,T.d2)(),{layoutCollapsed:a,setLayoutCollapsed:s}=e$(),{paneDataItems:d,resolvedPanes:c,routerPanes:u}=function(){let[e,n]=(0,L.useState)();if(e)throw e;let{structureContext:t,rootPaneNode:i}
1=e$(),[l,r]=(0,L.useState)({paneDataItems:[],resolvedPanes:[],routerPanes:[]}),o=function(){let e=(0,L.useMemo)(()=>new U.t(1),[]),n=(0,L.useMemo)(()=>e.asObservable().pipe((0,H.U)(e=>(null==e?void 0:e.panes)||[])),[e]),{state:t}=(0,ed.tv)();return(0,L.useEffect)(()=>{e.next(t)},[t,e]),n}();return(0,L.useEffect)(()=>{let e=(function(e){let{routerPanesStream:n,rootPaneNode:t,initialCacheState:i={cacheKeysByFlatIndex:[],flattenedRouterPanes:[],resolvedPaneCache:new Map,resolvePane:()=>B.C},structureContext:l}=e,r=n.pipe((0,H.U)(e=>[[{id:"root"}],...e]),(0,H.U)(e=>{let n=e.flatMap((e,n)=>e.map((e,t)=>({routerPaneSibling:e,groupIndex:n,siblingIndex:t}))).map((e,n)=>({...e,flatIndex:n}));return n}),(0,Y.O)([]),(0,J.G)(),(0,H.U)(e=>{let[n,t]=e;for(let e=0;e<t.length;e++){let i=n[e],l=t[e];if(!es()(i,l))return{flattenedRouterPanes:t,diffIndex:e}}return{flattenedRouterPanes:t,diffIndex:t.length}}),(0,G.R)((e,n)=>{let{cacheKeysByFlatIndex:t,resolvedPaneCache:i}=e,{flattenedRouterPanes:l,diffIndex:r}=n,o=t.slice(0,r+1),a=t.slice(r+1),s=new Set(o.flatMap(e=>Array.from(e))),d=a.flatMap(e=>Array.from(e)).filter(e=>!s.has(e));for(let e of d)i.delete(e);let c=e=>(n,l,r)=>{var o,a;let s=n&&"".concat(eW(n),"-").concat("contextHash(".concat(JSON.stringify({id:l.id,parentId:parent&&eW(parent),path:l.path,index:l.index,splitIndex:l.splitIndex,serializeOptionsIndex:null==(o=l.serializeOptions)?void 0:o.index,serializeOptionsPath:null==(a=l.serializeOptions)?void 0:a.path}),")")),d=s&&i.get(s);if(d)return d;let c=e(n,l,r);if(!s)return c;let u=t[r]||new Set;return u.add(s),t[r]=u,i.set(s,c),c};return{flattenedRouterPanes:l,cacheKeysByFlatIndex:t,resolvedPaneCache:i,resolvePane:eV(c)}},i),(0,q.w)(e=>{let{flattenedRouterPanes:n,resolvePane:i}=e;return function e(n){let{unresolvedPane:t,flattenedRouterPanes:i,parent:l,path:r,resolvePane:o,structureContext:a}=n,[s,...d]=i,c=d[0],u={id:s.routerPaneSibling.id,splitIndex:s.siblingIndex,parent:l,path:[...r,s.routerPaneSibling.id],index:s.flatIndex,params:s.routerPaneSibling.params||{},payload:s.routerPaneSibling.payload,structureContext:a};try{return o(t,u,s.flatIndex).pipe((0,q.w)(n=>{let i;let p={type:"resolvedMeta",...s,paneNode:n,path:u.path},h=d.map((e,n)=>{let t=[...u.path,...d.slice(n).map((n,t)=>"[".concat(e.flatIndex+t,"]"))],i={type:"loading",path:t,paneNode:null,...e};return i});return d.length?(i=(null==c?void 0:c.routerPaneSibling.id.startsWith("__edit__"))?e({unresolvedPane:eq,flattenedRouterPanes:d,parent:l,path:u.path,resolvePane:o,structureContext:a}):s.groupIndex===(null==c?void 0:c.groupIndex)?e({unresolvedPane:t,flattenedRouterPanes:d,parent:l,path:r,resolvePane:o,structureContext:a}):e({unresolvedPane:"function"==typeof n.child?eN(n,"child"):n.child,flattenedRouterPanes:d,parent:n,path:u.path,resolvePane:o,structureContext:a}),(0,A.z)((0,F.of)([p,...h]),i.pipe((0,H.U)(e=>[p,...e])))):(0,F.of)([p])}))}catch(e){if(e instanceof eZ&&(e.context&&console.warn("Pane resolution error at index ".concat(e.context.index).concat(e.context.splitIndex>0?" for split pane index ".concat(e.context.splitIndex):"",": ").concat(e.message).concat(e.helpId?" - see ".concat((0,eo.h)(e.helpId)):""),e),"structure-item-returned-no-child"===e.helpId))return(0,F.of)([]);throw e}}({unresolvedPane:t,flattenedRouterPanes:n,parent:null,path:[],resolvePane:i,structureContext:l})}));return r.pipe((0,G.R)((e,n)=>n.map((n,t)=>{let i=e[t];return i&&"loading"===n.type&&i.routerPaneSibling.id===n.routerPaneSibling.id?i:n}),[]),(0,Q.x)((e,n)=>{if(e.length!==n.length)return!1;for(let t=0;t<n.length;t++){let i=e[t],l=n[t];if(eH(i)!==eH(l))return!1}return!0}))})({rootPaneNode:i,routerPanesStream:o,structureContext:t}).pipe((0,H.U)(e=>{let n=e.reduce((e,n)=>{let t=e[n.groupIndex]||[];return t[n.siblingIndex]=n.routerPaneSibling,e[n.groupIndex]=t,e},[]),t=n.length,i=e.map(i=>{var l;let{groupIndex:r,flatIndex:o,siblingIndex:a,routerPaneSibling:s,path:d}=i,c=s.id,u=n[r+1],p={active:r===t-2,childItemId:null!=(l=null==u?void 0:u[0].id)?l:null,index:o,itemId:s.id,groupIndex:r,key:"".concat("loading"===i.type?"unknown":i.paneNode.id,"-").concat(c,"-").concat(a),pane:"loading"===i.type?R.PF:i.paneNode,params:s.params||{},path:d.join(";"),payload:s.payload,selected:o===e.length-1,siblingIndex:a};return p});return{paneDataItems:i,routerPanes:n,resolvedPanes:i.map(e=>e.pane)}})),l=e.subscribe({next:e=>r(e),error:e=>n(e)});return()=>l.unsubscribe()},[i,o,t]),l}
1(),[p,h]=(0,L.useState)(null),f=(0,L.useCallback)(()=>s(!0),[s]),m=(0,L.useCallback)(()=>s(!1),[s]);(0,L.useEffect)(()=>{c.length&&t(c)},[t,c]),(0,L.useEffect)(()=>{if(o>1||!a)return;let e=u.some(e=>e.length>1);if(!e)return;let n=u.map(e=>[e[0]]);i({panes:n},{replace:!0})},[o,i,a,u]),(0,L.useEffect)(()=>{let e=e=>{tD(e)&&(e.preventDefault(),l({closable:!0,id:"auto-save-message",status:"info",title:"Your work is automatically saved!",duration:4e3}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l]);let x=null==(n=r._original)?void 0:n.types.some(er.mPO);return x?(0,I.jsxs)(T.Xp,{element:p||null,children:[(0,I.jsx)(tZ,{flex:1,height:a?void 0:"fill",minWidth:512,onCollapse:f,onExpand:m,children:d.map(e=>{let{active:n,childItemId:t,groupIndex:i,itemId:l,key:r,pane:o,index:a,params:s,path:d,payload:c,siblingIndex:u,selected:p}=e;return(0,I.jsx)(L.Fragment,{children:o===R.PF?(0,I.jsx)(e4,{paneKey:r,path:d,selected:p}):(0,I.jsx)(e8,{active:n,groupIndex:i,index:a,pane:o,childItemId:t,itemId:l,paneKey:r,params:s,payload:c,selected:p,siblingIndex:u})},"".concat(o===R.PF?"loading":o.type,"-").concat(a))})}),(0,I.jsx)("div",{"data-portal":"",ref:h})]}):(0,I.jsx)(tO,{})}),tF={};var tN=Object.freeze({__proto__:null,default:function(e){let{tool:{options:n}}=e,{unstable_sources:t}=(0,er.cFj)(),[i]=t,{source:l,defaultDocumentNode:r,structure:o}=n||{},{state:a}=(0,ed.tv)(),s=(0,L.useMemo)(()=>{let e="string"==typeof a.intent?a.intent:void 0,n=(0,er.Uy$)(a.params)?a.params:tF,t=a.payload;return e?{intent:e,params:n,payload:t}:void 0},[a]);(0,L.useEffect)(()=>((0,R.aR)([]),()=>(0,R.aR)([])),[]);let[{error:d},c]=(0,L.useState)({error:null});return d?(0,I.jsx)(e0,{error:d}):(0,I.jsx)(T.SV,{onCatch:c,children:(0,I.jsx)(er.cWh,{name:l||i.name,children:(0,I.jsx)(R.Sg,{defaultDocumentNode:r,structure:o,children:s?(0,I.jsx)(eG,{...s}):(0,I.jsx)(tW,{onPaneChange:R.aR})})})})}})}}]);

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.