Socket
Socket
Sign inDemoInstall

@sanity/presentation

Package Overview
Dependencies
89
Maintainers
47
Versions
127
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.12.1 to 1.12.2

6

dist/_chunks-es/index.js

@@ -1,3 +0,3 @@

import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as i,useState as o,useEffect as r,useContext as a,useCallback as s,createElement as c,useRef as l,useMemo as d,lazy as u,Suspense as p}from"react";import{useDocumentStore as m,defineDocumentFieldAction as h,useWorkspace as f,pathToString as v,isRecord as y,getPublishedId as g,definePlugin as w,isDocumentSchemaType as b}from"sanity";import{ComposeIcon as x,ChevronRightIcon as P,DesktopIcon as T,InfoOutlineIcon as I,WarningOutlineIcon as _,ErrorOutlineIcon as j,MasterDetailIcon as z}from"@sanity/icons";import{Card as S,Flex as A,Box as D,Text as k,Stack as B,rem as O}from"@sanity/ui";import{styled as C}from"styled-components";import{useIntentLink as E,useRouter as $,encodeJsonParams as H,route as L}from"sanity/router";import{isObservable as N,of as U}from"rxjs";import{uuid as M}from"@sanity/uuid";const R=x,q="presentation",F="Presentation",G="sanity/structure/comments",J="presentation",K=3e3,Q="2023-10-16",V=1e3,W=100,X=2048,Y=i(null),Z={locations:[]};const ee={1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"},te={positive:I,caution:_,critical:j};function ne(i){const{documentId:l,options:d,schemaType:u,showPresentationTitle:p}=i,h=a(Y),{message:f,locations:v,tone:y}=function(e){const{id:t,locate:n,type:i}=e,a=m(),[s,c]=o(Z);return r((()=>{if(!n)return;const e=n({id:t,type:i},{documentStore:a}),o=(N(e)?e:U(e)).subscribe((e=>c(e||Z)));return()=>o.unsubscribe()}),[a,t,n,i]),s}({id:l,locate:d.locate,type:u.name}),g=(null==v?void 0:v.length)||0,[w,b]=o(!1),x=s((()=>b((e=>!e))),[]),T=f||(g?t(n,{children:["Used on ",ee[g]||g," ",e(n,1===g?{children:"page"}:{children:"pages"})]}):null);return 0!==g||T?e(S,{padding:1,radius:2,border:!0,tone:y,children:t("div",{style:{margin:-1},children:[!v&&t(A,{align:"flex-start",gap:3,padding:3,children:[y&&e(D,{flex:"none",children:e(k,{size:1,children:c(te[y])})}),e(D,{flex:1,children:t(k,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||F," · "]}),T]})})]}),v&&t(n,{children:[e(S,{as:"button",onClick:x,padding:3,radius:1,tone:"inherit",children:t(A,{gap:3,children:[e(D,{flex:"none",children:e(k,{size:1,children:e(P,{style:{transform:`rotate(${w?"90deg":0})`,transition:"transform 100ms ease-in-out"}})})}),e(D,{flex:1,children:t(k,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||F," · "]}),T]})})]})}),e(B,{hidden:!w,marginTop:1,space:1,children:v.map(((t,n)=>e(ie,{active:(d.name||q)===(null==h?void 0:h.name)&&t.href===(null==h?void 0:h.params.preview),documentId:l,documentType:u.name,node:t,toolName:d.name||q},n)))})]})]})}):null}function ie(n){const{documentId:i,documentType:o,node:r,active:l,toolName:d}=n,u=a(Y),p=null==u?void 0:u.navigate,m=E({intent:"edit",params:{id:i,type:o,mode:"presentation",presentation:d,...null==u?void 0:u.deskParams,preview:r.href}}),h=s((()=>{null==p||p({},{preview:r.href})}),[r.href,p]);return c(S,{...u?{}:m,as:u?"button":"a",key:r.href,onClick:h,padding:3,radius:1,pressed:l,tone:"inherit"},t(A,{gap:3,children:[e(D,{flex:"none",children:e(k,{size:1,children:e(T,{})})}),t(B,{flex:1,space:2,children:[e(k,{size:1,weight:"medium",children:r.title}),e(k,{muted:!0,size:1,textOverflow:"ellipsis",children:r.href})]})]}))}const oe=i(null),re=C(B)`
min-height: ${O(42)};
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as i,useState as o,useEffect as r,useContext as a,useCallback as s,createElement as c,useRef as l,useMemo as d,lazy as u,Suspense as p}from"react";import{useDocumentStore as m,defineDocumentFieldAction as h,useWorkspace as f,pathToString as v,isRecord as y,getPublishedId as g,definePlugin as w,isDocumentSchemaType as b}from"sanity";import{ComposeIcon as x,ChevronRightIcon as P,DesktopIcon as T,InfoOutlineIcon as I,WarningOutlineIcon as _,ErrorOutlineIcon as j,MasterDetailIcon as z}from"@sanity/icons";import{Card as S,Flex as A,Box as D,Text as B,Stack as O,rem as k}from"@sanity/ui";import{styled as C}from"styled-components";import{useIntentLink as E,useRouter as $,encodeJsonParams as H,route as L}from"sanity/router";import{isObservable as N,of as U}from"rxjs";import{uuid as M}from"@sanity/uuid";const R=x,q="presentation",F="Presentation",G="sanity/structure/comments",J="presentation",K=3e3,Q="2023-10-16",V=1e3,W=100,X=2048,Y=i(null),Z={locations:[]};const ee={1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"},te={positive:I,caution:_,critical:j};function ne(i){const{documentId:l,options:d,schemaType:u,showPresentationTitle:p}=i,h=a(Y),{message:f,locations:v,tone:y}=function(e){const{id:t,locate:n,type:i}=e,a=m(),[s,c]=o(Z);return r((()=>{if(!n)return;const e=n({id:t,type:i},{documentStore:a}),o=(N(e)?e:U(e)).subscribe((e=>c(e||Z)));return()=>o.unsubscribe()}),[a,t,n,i]),s}({id:l,locate:d.locate,type:u.name}),g=(null==v?void 0:v.length)||0,[w,b]=o(!1),x=s((()=>b((e=>!e))),[]),T=f||(g?t(n,{children:["Used on ",ee[g]||g," ",e(n,1===g?{children:"page"}:{children:"pages"})]}):null);return 0!==g||T?e(S,{padding:1,radius:2,border:!0,tone:y,children:t("div",{style:{margin:-1},children:[!v&&t(A,{align:"flex-start",gap:3,padding:3,children:[y&&e(D,{flex:"none",children:e(B,{size:1,children:c(te[y])})}),e(D,{flex:1,children:t(B,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||F," · "]}),T]})})]}),v&&t(n,{children:[e(S,{as:"button",onClick:x,padding:3,radius:1,tone:"inherit",children:t(A,{gap:3,children:[e(D,{flex:"none",children:e(B,{size:1,children:e(P,{style:{transform:`rotate(${w?"90deg":0})`,transition:"transform 100ms ease-in-out"}})})}),e(D,{flex:1,children:t(B,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||F," · "]}),T]})})]})}),e(O,{hidden:!w,marginTop:1,space:1,children:v.map(((t,n)=>e(ie,{active:(d.name||q)===(null==h?void 0:h.name)&&t.href===(null==h?void 0:h.params.preview),documentId:l,documentType:u.name,node:t,toolName:d.name||q},n)))})]})]})}):null}function ie(n){const{documentId:i,documentType:o,node:r,active:l,toolName:d}=n,u=a(Y),p=null==u?void 0:u.navigate,m=E({intent:"edit",params:{id:i,type:o,mode:"presentation",presentation:d,...null==u?void 0:u.structureParams,preview:r.href}}),h=s((()=>{null==p||p({},{preview:r.href})}),[r.href,p]);return c(S,{...u?{}:m,as:u?"button":"a",key:r.href,onClick:h,padding:3,radius:1,pressed:l,tone:"inherit"},t(A,{gap:3,children:[e(D,{flex:"none",children:e(B,{size:1,children:e(T,{})})}),t(O,{flex:1,space:2,children:[e(B,{size:1,weight:"medium",children:r.title}),e(B,{muted:!0,size:1,textOverflow:"ellipsis",children:r.href})]})]}))}const oe=i(null),re=C(O)`
min-height: ${k(42)};

@@ -7,2 +7,2 @@ & + &:empty {

}
`;function ae(t){var n;const{documentId:i,options:o,schemaType:r}=t,s=a(oe);if(s&&s.options[0]!==o)return e(re,{marginBottom:5,space:5});const c=(null==(n=null==s?void 0:s.options)?void 0:n.length)||0;return e(re,{marginBottom:5,space:5,children:e(B,{space:2,children:null==s?void 0:s.options.map(((t,n)=>e(ne,{documentId:i,options:t,schemaType:r,showPresentationTitle:c>1},n)))})})}function se(t){const{children:n,options:i}=t,c=a(oe),u=null==c?void 0:c.register,[p,m]=o((()=>[])),h=s((e=>u?u(e):(m((t=>[e].concat(t))),()=>{m((t=>t.filter((t=>t!==e))))})),[u]),f=l(h);f.current=h;const v=d((()=>({options:(null==c?void 0:c.options)||p,register:h})),[p,c,h]);return r((()=>f.current(i)),[i]),e(oe.Provider,{value:v,children:n})}const ce=h({name:"presentation/openInStructure",useAction({documentId:e,documentType:t,path:n}){const i=f(),{navigateIntent:o}=$(),r=a(Y),s=d((()=>function(e,t,n){var i;const o=e.map((e=>{var i;return{tool:e,match:null==(i=e.canHandleIntent)?void 0:i.call(e,"edit",{id:t,type:n,mode:"structure"},{})}})),r=o.filter((e=>y(e.match)&&e.match.mode));return r.length>0?r[0].tool:null==(i=o.filter((e=>e.match))[0])?void 0:i.tool}(i.tools,e,t)),[e,t,i.tools]);return{type:"action",hidden:!r||n.length>0||!s,icon:(null==s?void 0:s.icon)||z,title:`Open in ${(null==s?void 0:s.title)||"Structure"}`,onAction(){o("edit",{id:e,type:t,mode:"structure",path:v(n)})},renderAsButton:!0}}});function le(e,t,n,i){const{id:o,mode:r,path:a,presentation:s,type:c,...l}=t;return"edit"===e&&o?{type:c||"*",id:g(o),path:a,_searchParams:Object.entries(l)}:"create"===e?(l.preview=l.preview||new URLSearchParams(window.location.search).get("preview")||"/",i&&"object"==typeof i&&(l.templateParams=H(i)),{type:c||"*",id:o||M(),_searchParams:Object.entries(l)}):{intent:e,params:t,payload:i}}const de=L.create("/",{__unsafe_disableScopedSearchParams:!0},[L.intents("/intent"),L.create(":type",[L.create(":id",[L.create(":path")])])]),ue=u((()=>import("./PresentationTool.js"))),pe=u((()=>import("./BroadcastDisplayedDocument.js"))),me=w((n=>{const i=n.name||q;return{document:{unstable_fieldActions:e=>[...e.filter((e=>e.name!==ce.name)),ce]},form:{components:{input:function(i){const o=i.value,r=null!=o&&o._id?g(null==o?void 0:o._id):void 0;return b(i.schemaType)?t(se,{options:n,children:[n.locate&&r&&e(ae,{documentId:r,options:n,schemaType:i.schemaType}),i.renderDefault(i),e(p,{children:e(pe,{value:o})},"broadcast-displayed-document")]}):i.renderDefault(i)}}},tools:[{icon:n.icon||R,name:i,title:n.title,component:ue,options:n,canHandleIntent:(e,t)=>"create"===e?function(e){return"type"in e&&(!("presentation"in e)||e.presentation===i)&&(!("template"in e)||{template:!0})}(t):"edit"===e&&function(e){return"type"in e&&"id"in e&&(!("presentation"in e)||e.presentation===i)&&(!("mode"in e)||{mode:e.mode===J})}(t),getIntentState:le,router:de}]}})),he=i(null);function fe(){const e=a(he);if(!e)throw new Error("Presentation navigate context is missing");return e}const ve=i(null);function ye(){const e=a(ve);if(!e)throw new Error("Presentation params context is missing");return e}export{Q as A,G as C,q as D,J as E,X as L,K as M,Y as P,he as a,ve as b,V as c,W as d,ye as e,me as p,fe as u};//# sourceMappingURL=index.js.map
`;function ae(t){var n;const{documentId:i,options:o,schemaType:r}=t,s=a(oe);if(s&&s.options[0]!==o)return e(re,{marginBottom:5,space:5});const c=(null==(n=null==s?void 0:s.options)?void 0:n.length)||0;return e(re,{marginBottom:5,space:5,children:e(O,{space:2,children:null==s?void 0:s.options.map(((t,n)=>e(ne,{documentId:i,options:t,schemaType:r,showPresentationTitle:c>1},n)))})})}function se(t){const{children:n,options:i}=t,c=a(oe),u=null==c?void 0:c.register,[p,m]=o((()=>[])),h=s((e=>u?u(e):(m((t=>[e].concat(t))),()=>{m((t=>t.filter((t=>t!==e))))})),[u]),f=l(h);f.current=h;const v=d((()=>({options:(null==c?void 0:c.options)||p,register:h})),[p,c,h]);return r((()=>f.current(i)),[i]),e(oe.Provider,{value:v,children:n})}const ce=h({name:"presentation/openInStructure",useAction({documentId:e,documentType:t,path:n}){const i=f(),{navigateIntent:o}=$(),r=a(Y),s=d((()=>function(e,t,n){var i;const o=e.map((e=>{var i;return{tool:e,match:null==(i=e.canHandleIntent)?void 0:i.call(e,"edit",{id:t,type:n,mode:"structure"},{})}})),r=o.filter((e=>y(e.match)&&e.match.mode));return r.length>0?r[0].tool:null==(i=o.filter((e=>e.match))[0])?void 0:i.tool}(i.tools,e,t)),[e,t,i.tools]);return{type:"action",hidden:!r||n.length>0||!s,icon:(null==s?void 0:s.icon)||z,title:`Open in ${(null==s?void 0:s.title)||"Structure"}`,onAction(){o("edit",{id:e,type:t,mode:"structure",path:v(n)})},renderAsButton:!0}}});function le(e,t,n,i){const{id:o,mode:r,path:a,presentation:s,type:c,...l}=t;return"edit"===e&&o?{type:c||"*",id:g(o),path:a,_searchParams:Object.entries(l)}:"create"===e?(l.preview=l.preview||new URLSearchParams(window.location.search).get("preview")||"/",i&&"object"==typeof i&&(l.templateParams=H(i)),{type:c||"*",id:o||M(),_searchParams:Object.entries(l)}):{intent:e,params:t,payload:i}}const de=L.create("/",{__unsafe_disableScopedSearchParams:!0},[L.intents("/intent"),L.create(":type",[L.create(":id",[L.create(":path")])])]),ue=u((()=>import("./PresentationTool.js"))),pe=u((()=>import("./BroadcastDisplayedDocument.js"))),me=w((n=>{const i=n.name||q;return{document:{unstable_fieldActions:e=>[...e.filter((e=>e.name!==ce.name)),ce]},form:{components:{input:function(i){const o=i.value,r=null!=o&&o._id?g(null==o?void 0:o._id):void 0;return b(i.schemaType)?t(se,{options:n,children:[n.locate&&r&&e(ae,{documentId:r,options:n,schemaType:i.schemaType}),i.renderDefault(i),e(p,{children:e(pe,{value:o})},"broadcast-displayed-document")]}):i.renderDefault(i)}}},tools:[{icon:n.icon||R,name:i,title:n.title,component:ue,options:n,canHandleIntent:(e,t)=>"create"===e?function(e){return"type"in e&&(!("presentation"in e)||e.presentation===i)&&(!("template"in e)||{template:!0})}(t):"edit"===e&&function(e){return"type"in e&&"id"in e&&(!("presentation"in e)||e.presentation===i)&&(!("mode"in e)||{mode:e.mode===J})}(t),getIntentState:le,router:de}]}})),he=i(null);function fe(){const e=a(he);if(!e)throw new Error("Presentation navigate context is missing");return e}const ve=i(null);function ye(){const e=a(ve);if(!e)throw new Error("Presentation params context is missing");return e}export{Q as A,G as C,q as D,J as E,X as L,K as M,Y as P,he as a,ve as b,V as c,W as d,ye as e,me as p,fe as u};//# sourceMappingURL=index.js.map

@@ -1,4 +0,4 @@

var e=Object.defineProperty,t=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);import{jsx as n,jsxs as r,Fragment as i}from"react/jsx-runtime";import{studioPath as o}from"@sanity/client/csm";import{Card as a,Flex as s,Container as c,Stack as l,Text as d,Inline as u,Box as p,Button as h,Code as f,Label as m,ErrorBoundary as v,TextInput as g,MenuItem as y,useToast as w,Switch as b,usePrefersReducedMotion as k,TooltipDelayGroupProvider as x,Tooltip as P,MenuButton as E,Menu as S,Spinner as I,BoundaryElementProvider as z}from"@sanity/ui";import{useContext as C,forwardRef as D,useCallback as O,useMemo as R,useState as U,useEffect as $,createContext as j,useLayoutEffect as L,useRef as T,memo as A,createElement as _,startTransition as W,useReducer as M,Suspense as N,lazy as F}from"react";import{useUnique as V,getPublishedId as B,useActiveWorkspace as K,useClient as q,useCurrentUser as G,Hotkeys as J,useProjectId as H,useDataset as X,useWorkspace as Z}from"sanity";import{StateLink as Q,useRouter as Y,decodeJsonParams as ee}from"sanity/router";import{PaneRouterContext as te,PaneLayout as ne,StructureToolProvider as re,DocumentListPane as ie,DocumentPane as oe,CommentsIntentProvider as ae}from"sanity/structure";import{styled as se}from"styled-components";import{P as ce,a as le,b as de,A as ue,M as pe,c as he,C as fe,E as me,D as ve}from"./index.js";import{D as ge}from"./DisplayedDocumentBroadcaster.js";import{ResetIcon as ye,LaunchIcon as we,CopyIcon as be,PanelLeftIcon as ke,RefreshIcon as xe,ShareIcon as Pe,ChevronDownIcon as Ee,CheckmarkIcon as Se,DesktopIcon as Ie,MobileDeviceIcon as ze,EditIcon as Ce,PublishIcon as De}from"@sanity/icons";import{hasSecretSearchParams as Oe,setSecretSearchParams as Re,withoutSecretSearchParams as Ue}from"@sanity/preview-url-secret/without-secret-search-params";import{motion as $e,MotionConfig as je,AnimatePresence as Le}from"framer-motion";import{createPreviewSecret as Te}from"@sanity/preview-url-secret/create-secret";import Ae from"fast-deep-equal";import{definePreviewUrl as _e}from"@sanity/preview-url-secret/define-preview-url";import{suspend as We}from"suspend-react";let Me;const Ne=new Uint8Array(16);function Fe(){if(!Me&&(Me=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Me))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Me(Ne)}const Ve=[];for(let e=0;e<256;++e)Ve.push((e+256).toString(16).slice(1));var Be={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ke(e,t,n){if(Be.randomUUID&&!t&&!e)return Be.randomUUID();const r=(e=e||{}).random||(e.rng||Fe)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return Ve[e[t+0]]+Ve[e[t+1]]+Ve[e[t+2]]+Ve[e[t+3]]+"-"+Ve[e[t+4]]+Ve[e[t+5]]+"-"+Ve[e[t+6]]+Ve[e[t+7]]+"-"+Ve[e[t+8]]+Ve[e[t+9]]+"-"+Ve[e[t+10]]+Ve[e[t+11]]+Ve[e[t+12]]+Ve[e[t+13]]+Ve[e[t+14]]+Ve[e[t+15]]}(r)}const qe=1e3,Ge=1e3,Je=500,He=["handshake/syn","handshake/syn-ack","handshake/ack"],Xe=e=>He.some((t=>t===e)),Ze=({data:e={}})=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&!("domain"in e)&&["id","type","from","to"].every((t=>t in e))&&e.type.startsWith("handshake/");function Qe(e){const t=e.target,n=e.connectTo.map((e=>({buffer:[],config:e,id:"",handler:i,status:"connecting",interval:void 0,heartbeat:void 0})));function r(e){window.clearInterval(e.interval)}function i(e){const{data:t}=e;if(Xe(t.type)){const e=n.find((e=>e.config.id===t.from));e&&"handshake/syn-ack"===t.type&&(c(e,"connected"),l(e,"handshake/ack",{id:e.id}))}}const o=t=>{var r,i,o;const a=t.data;if(!Xe(a.type)&&n.find((e=>e.id===a.connectionId))){const t=n.find((e=>e.config.id===a.from));if(t){const n=[a.type,a.data];null==(i=(r=t.config).onEvent)||i.call(r,...n),null==(o=e.onEvent)||o.call(e,...n),d(t,"channel/response",{responseTo:a.id},!1)}}};function a(t){var r;if(Ze(t))console.error("Visual editing package mismatch detected! Please ensure you are using the latest version of Sanity Studio and any packages listed here:\nhttps://github.com/sanity-io/visual-editing");else if(function(t){const{data:r,origin:i}=t;return"sanity/channels"===r.domain&&r.to==e.id&&n.map((e=>e.config.id)).includes(r.from)&&"channel/response"!==r.type&&i===e.targetOrigin}(t)){const{data:e}=t;null==(r=n.find((t=>t.config.id===e.from)))||r.handler(t)}}function s(e){e.heartbeat&&window.clearInterval(e.heartbeat)}function c(t,n){var a,c,u;t.status=n,null==(c=(a=t.config).onStatusUpdate)||c.call(a,n,t.config.id),null==(u=e.onStatusUpdate)||u.call(e,n,t.config.id),"connecting"===n||"reconnecting"===n?(t.handler=i,s(t),function(e){e.id=Ke(),e.interval=window.setInterval((()=>{l(e,"handshake/syn",{id:e.id})}),Je)}(t)):"connected"===n?(t.handler=o,r(t),function(e){if(s(e),e.config.heartbeat){const t="number"==typeof e.config.heartbeat?e.config.heartbeat:Ge;e.heartbeat=window.setInterval((()=>{d(e,"channel/heartbeat")}),t)}}(t),function(e){const t=[...e.buffer];e.buffer.splice(0,e.buffer.length),t.forEach((({type:t,data:n})=>{d(e,t,n)}))}(t)):"disconnected"===n&&(t.id=null,t.handler=i,r(t),s(t))}function l(n,r,i){if(!n.id)throw new Error("No channel ID set");const o={connectionId:n.id,data:i,domain:"sanity/channels",from:e.id,id:Ke(),to:n.config.id,type:r};try{null==t||t.postMessage(o,{targetOrigin:"*"})}catch{throw new Error(`Failed to postMessage '${o.id}' on '${e.id}'`)}}function d(n,r,i,o=!0){const a=Ke();if("connecting"===n.status||"reconnecting"===n.status||"disconnected"===n.status)return void n.buffer.push({type:r,data:i});if(!n.id)throw new Error("No channel ID set");const s={connectionId:n.id,data:i,domain:"sanity/channels",from:e.id,id:a,to:n.config.id,type:r};if(o){const t=setTimeout((()=>{s.connectionId===n.id&&(window.removeEventListener("message",o,!1),"channel/heartbeat"!==r&&n.buffer.push({type:r,data:i}),c(n,"reconnecting"),console.warn(`Received no response to message '${s.type}' on client '${e.id}' (ID: '${s.id}').`))}),qe),o=e=>{var n;const{data:r}=e;"channel/response"===r.type&&null!=(n=r.data)&&n.responseTo&&r.data.responseTo===s.id&&(window.removeEventListener("message",o,!1),clearTimeout(t))};window.addEventListener("message",o,!1)}try{null==t||t.postMessage(s,{targetOrigin:e.targetOrigin})}catch{throw new Error(`Failed to postMessage '${s.id}' on client '${e.id}'`)}}return window.addEventListener("message",a,!1),n.forEach((e=>{c(e,"connecting")})),{destroy:function(){n.forEach((e=>{["disconnected"].includes(e.status)||(d(e,"channel/disconnect",{id:e.id},!1),c(e,"disconnected"))})),window.removeEventListener("message",a,!1),n.forEach((e=>{s(e),r(e)}))},send:function(e,t,r){(e?Array.isArray(e)?[...e]:[e]:n).forEach((e=>{const i=n.find((t=>t.config.id===e));if(!i)throw new Error("Invalid channel ID");d(i,t,r)}))}}}var Ye,et,tt,nt,rt=class extends Error{constructor(e){super(e[0].message),t(this,"issues"),this.name="ValiError",this.issues=e}};function it(e,t){return Array.isArray(e)?[void 0,e]:[e,t]}function ot(e,t,n,r,i){var o,a,s,c,l;const d=null!=(l=null!=(c=null!=(s=null!=(a=null!=(o=t.message)?o:function(e,t){var n;return null==(n=null==nt?void 0:nt.get(e))?void 0:n.get(t)}(n,i.lang))?a:e?(u=i.lang,null==tt?void 0:tt.get(u)):null)?s:null==r?void 0:r.message)?c:function(e){return null==et?void 0:et.get(e)}(i.lang))?l:i.message;var u;return"function"==typeof d?d(i):d}function at(e,t,n){return{typed:e,output:t,issues:n}}function st(e){let t=typeof e;return"object"===t&&(t=e?Object.getPrototypeOf(e).constructor.name:"null"),"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:t}function ct(e,t,n){var r;const i=null!=(r=n.received)?r:st(n.input),o={reason:e.type,context:n.context.type,expected:n.context.expects,received:i,message:`Invalid ${n.label}: ${n.context.expects?`Expected ${n.context.expects} but r`:"R"}eceived ${i}`,input:n.input,requirement:n.context.requirement,path:n.path,lang:null==t?void 0:t.lang,abortEarly:null==t?void 0:t.abortEarly,abortPipeEarly:null==t?void 0:t.abortPipeEarly,skipPipe:null==t?void 0:t.skipPipe};return o.message=ot(!1,n.context,n.reference,t,o),o}function lt(e,t,n,r){if(e.pipe&&(null==n||!n.skipPipe))for(const i of e.pipe){const o=i._parse(t);if(o.issues){for(const t of o.issues){const i=ct(e,n,t);r?r.push(i):r=[i]}if(null!=n&&n.abortEarly||null!=n&&n.abortPipeEarly)break}else t=o.output}return at(!0,t,r)}function dt(e,t,n,r,i){var o,a;const s=st(n),c=null!=(o=null==i?void 0:i.expected)?o:e.expects,l={reason:null!=(a=null==i?void 0:i.reason)?a:"type",context:e.type,expected:c,received:s,message:`Invalid type: Expected ${c} but received ${s}`,input:n,path:null==i?void 0:i.path,issues:null==i?void 0:i.issues,lang:null==r?void 0:r.lang,abortEarly:null==r?void 0:r.abortEarly,abortPipeEarly:null==r?void 0:r.abortPipeEarly,skipPipe:null==r?void 0:r.skipPipe};return l.message=ot(!0,e,t,r,l),{typed:!1,output:n,issues:[l]}}function ut(e,t){return{...e,fallback:t,_parse(t,n){const r=e._parse(t,n);return r.issues?at(!0,function(e,t){return"function"==typeof e.fallback?e.fallback(t):e.fallback}(this,{input:t,issues:r.issues})):r}}}function pt(e,t,n,r){const[i,o,a]=function(e,t,n){if(!e||"object"==typeof e&&!Array.isArray(e)){const[r,i]=it(t,n);return[e,r,i]}const[r,i]=it(e,t);return[void 0,r,i]}(t,n,r);let s;return{type:"object",expects:"Object",async:!1,entries:e,rest:i,message:o,pipe:a,_parse(e,t){if(e&&"object"==typeof e){s=null!=s?s:Object.entries(this.entries);let n,r=!0;const i={};for(const[o,a]of s){const s=e[o],c=a._parse(s,t);if(c.issues){const i={type:"object",origin:"value",input:e,key:o,value:s};for(const e of c.issues)e.path?e.path.unshift(i):e.path=[i],null==n||n.push(e);if(n||(n=c.issues),null!=t&&t.abortEarly){r=!1;break}}c.typed||(r=!1),(void 0!==c.output||o in e)&&(i[o]=c.output)}if(this.rest&&(null==t||!t.abortEarly||!n))for(const o in e)if(!(o in this.entries)){const a=e[o],s=this.rest._parse(a,t);if(s.issues){const i={type:"object",origin:"value",input:e,key:o,value:a};for(const e of s.issues)e.path?e.path.unshift(i):e.path=[i],null==n||n.push(e);if(n||(n=s.issues),null!=t&&t.abortEarly){r=!1;break}}s.typed||(r=!1),i[o]=s.output}return r?lt(this,i,t,n):at(!1,i,n)}return dt(this,pt,e,t)}}}function ht(e,t){return{type:"picklist",expects:e.map(st).join(" | "),async:!1,options:e,message:t,_parse(e,t){return this.options.includes(e)?at(!0,e):dt(this,ht,e,t)}}}function ft(e,t,n){const r=e._parse(t,function(e){var t,n,r,i;return{lang:null!=(t=null==e?void 0:e.lang)?t:null==Ye?void 0:Ye.lang,message:null==e?void 0:e.message,abortEarly:null!=(n=null==e?void 0:e.abortEarly)?n:null==Ye?void 0:Ye.abortEarly,abortPipeEarly:null!=(r=null==e?void 0:e.abortPipeEarly)?r:null==Ye?void 0:Ye.abortPipeEarly,skipPipe:null!=(i=null==e?void 0:e.skipPipe)?i:null==Ye?void 0:Ye.skipPipe}}(n));if(r.issues)throw new rt(r.issues);return r.output}const mt=/^([A-Za-z]+):([0-9]+)$/,vt=/^([A-Za-z]+):([0-9]+),([0-9]+)$/,gt=/^([A-Za-z]+):([a-z0-9]+)$/;const yt={alt:"altKey",ctrl:"ctrlKey",mod:typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function wt(e){return"Alt"===e.key}function bt(e){const{children:t,message:i,onRetry:o,onContinueAnyway:f,...m}=e,v=n(h,{fontSize:1,mode:"ghost",onClick:o,text:"Retry"}),g=n(h,{fontSize:1,mode:"ghost",tone:"critical",onClick:f,text:"Continue anyway"});return n(a,{height:"fill",...m,children:n(s,{align:"center",height:"fill",justify:"center",children:n(c,{padding:4,sizing:"border",width:0,children:r(l,{space:4,children:[r(l,{space:3,children:[n(d,{size:1,weight:"semibold",children:"An error occured"}),n(d,{muted:!0,size:1,children:i})]}),t,o&&f?r(u,{space:2,children:[v,g]}):o?n(p,{children:v}):f?n(p,{children:g}):null]})})})})}function kt(){const e=C(ce);if(!e)throw new Error("Presentation context is missing");return e}function xt(e){const t=["comment","inspect","instruction","pathKey","rev","since","template","view"];return function(e={}){const t=Object.entries(e).map((([e,t])=>`${e}=${t}`)).join("&");return t.length?`?${t}`:""}(Object.entries(e).filter((([e])=>t.includes(e))).reduce(((e,[t,n])=>null==n?e:{...e,[t]:n}),{}))}const Pt=D((function(e,t){const{deskParams:r,params:i}=kt();return n(Q,{...e,ref:t,state:{type:void 0,_searchParams:Object.entries({...r,preview:i.preview})},title:void 0})})),Et=D((function(e,t){const{documentId:r,documentType:i,parentRefPath:o,template:a,...s}=e;return n(Q,{...s,ref:t,state:{id:r,type:i,_searchParams:Object.entries({preview:e.previewUrl})},title:void 0})}));function St(e){const{children:t,params:r,onDeskParams:o,previewUrl:a,refs:s}=e,{state:c,resolvePathFromState:l}=Y(),d=V(Object.fromEntries(c._searchParams||[])),u=O((e=>`${l(c)}${xt({...d,...e})}`),[l,d,c]),p=R((()=>({index:0,groupIndex:0,siblingIndex:0,payload:{},params:r,hasGroupSiblings:!1,groupLength:1,routerPanesState:[],ChildLink:e=>{const{childId:t,...r}=e,i=null==s?void 0:s.find((e=>e._id===t||B(e._id)===t));return i?n(Q,{...r,state:{id:t,type:i._type,_searchParams:Object.entries({preview:a})}}):n("div",{...r})},BackLink:Pt,ReferenceChildLink:e=>n(Et,{...e,previewUrl:a}),ParameterizedLink:()=>n(i,{children:"ParameterizedLink"}),closeCurrentAndAfter:()=>{console.warn("closeCurrentAndAfter")},handleEditReference:e=>{console.warn("handleEditReference",e)},replaceCurrent:e=>{console.warn("replaceCurrent",e)},closeCurrent:()=>{console.warn("closeCurrent")},duplicateCurrent:e=>{console.warn("duplicateCurrent",e)},setView:e=>{console.warn("setView",e)},setParams:e=>{var t;o({...e,inspect:null!=(t=e.inspect)?t:void 0})},setPayload:e=>{console.warn("setPayload",e)},navigateIntent:(e,t,n)=>{console.warn("navigateIntent",e,t,n)},createPathWithParams:u})),[u,o,r,a,s]);return n(te.Provider,{value:p,children:t})}const It=se(ne)`
var e=Object.defineProperty,t=(t,n,r)=>(((t,n,r)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r})(t,"symbol"!=typeof n?n+"":n,r),r);import{jsx as n,jsxs as r,Fragment as i}from"react/jsx-runtime";import{studioPath as o}from"@sanity/client/csm";import{Card as a,Flex as s,Container as c,Stack as l,Text as d,Inline as u,Box as p,Button as h,Code as f,Label as m,ErrorBoundary as v,TextInput as g,MenuItem as y,useToast as w,Switch as b,usePrefersReducedMotion as x,TooltipDelayGroupProvider as P,Tooltip as E,MenuButton as k,Menu as S,Spinner as I,BoundaryElementProvider as z}from"@sanity/ui";import{useContext as C,forwardRef as O,useCallback as R,useMemo as U,useState as $,useEffect as j,createContext as L,useLayoutEffect as D,useRef as T,memo as A,createElement as _,startTransition as W,useReducer as M,Suspense as N,lazy as F}from"react";import{useUnique as V,getPublishedId as B,useActiveWorkspace as K,useClient as q,useCurrentUser as G,Hotkeys as J,useProjectId as H,useDataset as X,useWorkspace as Z}from"sanity";import{StateLink as Q,useRouter as Y,decodeJsonParams as ee}from"sanity/router";import{PaneRouterContext as te,PaneLayout as ne,StructureToolProvider as re,DocumentListPane as ie,DocumentPane as oe,CommentsIntentProvider as ae}from"sanity/structure";import{styled as se}from"styled-components";import{P as ce,a as le,b as de,A as ue,M as pe,c as he,C as fe,E as me,D as ve}from"./index.js";import{D as ge}from"./DisplayedDocumentBroadcaster.js";import{ResetIcon as ye,LaunchIcon as we,CopyIcon as be,PanelLeftIcon as xe,RefreshIcon as Pe,ShareIcon as Ee,ChevronDownIcon as ke,CheckmarkIcon as Se,DesktopIcon as Ie,MobileDeviceIcon as ze,EditIcon as Ce,PublishIcon as Oe}from"@sanity/icons";import{hasSecretSearchParams as Re,setSecretSearchParams as Ue,withoutSecretSearchParams as $e}from"@sanity/preview-url-secret/without-secret-search-params";import{motion as je,MotionConfig as Le,AnimatePresence as De}from"framer-motion";import{createPreviewSecret as Te}from"@sanity/preview-url-secret/create-secret";import Ae from"fast-deep-equal";import{definePreviewUrl as _e}from"@sanity/preview-url-secret/define-preview-url";import{suspend as We}from"suspend-react";let Me;const Ne=new Uint8Array(16);function Fe(){if(!Me&&(Me=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Me))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Me(Ne)}const Ve=[];for(let e=0;e<256;++e)Ve.push((e+256).toString(16).slice(1));var Be={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ke(e,t,n){if(Be.randomUUID&&!t&&!e)return Be.randomUUID();const r=(e=e||{}).random||(e.rng||Fe)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return Ve[e[t+0]]+Ve[e[t+1]]+Ve[e[t+2]]+Ve[e[t+3]]+"-"+Ve[e[t+4]]+Ve[e[t+5]]+"-"+Ve[e[t+6]]+Ve[e[t+7]]+"-"+Ve[e[t+8]]+Ve[e[t+9]]+"-"+Ve[e[t+10]]+Ve[e[t+11]]+Ve[e[t+12]]+Ve[e[t+13]]+Ve[e[t+14]]+Ve[e[t+15]]}(r)}const qe=1e3,Ge=1e3,Je=500,He=["handshake/syn","handshake/syn-ack","handshake/ack"],Xe=e=>He.some((t=>t===e)),Ze=({data:e={}})=>"object"==typeof e&&null!==e&&!Array.isArray(e)&&!("domain"in e)&&["id","type","from","to"].every((t=>t in e))&&e.type.startsWith("handshake/");function Qe(e){const t=e.target,n=e.connectTo.map((e=>({buffer:[],config:e,id:"",handler:i,status:"connecting",interval:void 0,heartbeat:void 0})));function r(e){window.clearInterval(e.interval)}function i(e){const{data:t}=e;if(Xe(t.type)){const e=n.find((e=>e.config.id===t.from));e&&"handshake/syn-ack"===t.type&&(c(e,"connected"),l(e,"handshake/ack",{id:e.id}))}}const o=t=>{var r,i,o;const a=t.data;if(!Xe(a.type)&&n.find((e=>e.id===a.connectionId))){const t=n.find((e=>e.config.id===a.from));if(t){const n=[a.type,a.data];null==(i=(r=t.config).onEvent)||i.call(r,...n),null==(o=e.onEvent)||o.call(e,...n),d(t,"channel/response",{responseTo:a.id},!1)}}};function a(t){var r;if(Ze(t))console.error("Visual editing package mismatch detected! Please ensure you are using the latest version of Sanity Studio and any packages listed here:\nhttps://github.com/sanity-io/visual-editing");else if(function(t){const{data:r,origin:i}=t;return"sanity/channels"===r.domain&&r.to==e.id&&n.map((e=>e.config.id)).includes(r.from)&&"channel/response"!==r.type&&i===e.targetOrigin}(t)){const{data:e}=t;null==(r=n.find((t=>t.config.id===e.from)))||r.handler(t)}}function s(e){e.heartbeat&&window.clearInterval(e.heartbeat)}function c(t,n){var a,c,u;t.status=n,null==(c=(a=t.config).onStatusUpdate)||c.call(a,n,t.config.id),null==(u=e.onStatusUpdate)||u.call(e,n,t.config.id),"connecting"===n||"reconnecting"===n?(t.handler=i,s(t),function(e){e.id=Ke(),e.interval=window.setInterval((()=>{l(e,"handshake/syn",{id:e.id})}),Je)}(t)):"connected"===n?(t.handler=o,r(t),function(e){if(s(e),e.config.heartbeat){const t="number"==typeof e.config.heartbeat?e.config.heartbeat:Ge;e.heartbeat=window.setInterval((()=>{d(e,"channel/heartbeat")}),t)}}(t),function(e){const t=[...e.buffer];e.buffer.splice(0,e.buffer.length),t.forEach((({type:t,data:n})=>{d(e,t,n)}))}(t)):"disconnected"===n&&(t.id=null,t.handler=i,r(t),s(t))}function l(n,r,i){if(!n.id)throw new Error("No channel ID set");const o={connectionId:n.id,data:i,domain:"sanity/channels",from:e.id,id:Ke(),to:n.config.id,type:r};try{null==t||t.postMessage(o,{targetOrigin:"*"})}catch{throw new Error(`Failed to postMessage '${o.id}' on '${e.id}'`)}}function d(n,r,i,o=!0){const a=Ke();if("connecting"===n.status||"reconnecting"===n.status||"disconnected"===n.status)return void n.buffer.push({type:r,data:i});if(!n.id)throw new Error("No channel ID set");const s={connectionId:n.id,data:i,domain:"sanity/channels",from:e.id,id:a,to:n.config.id,type:r};if(o){const t=setTimeout((()=>{s.connectionId===n.id&&(window.removeEventListener("message",o,!1),"channel/heartbeat"!==r&&n.buffer.push({type:r,data:i}),c(n,"reconnecting"),console.warn(`Received no response to message '${s.type}' on client '${e.id}' (ID: '${s.id}').`))}),qe),o=e=>{var n;const{data:r}=e;"channel/response"===r.type&&null!=(n=r.data)&&n.responseTo&&r.data.responseTo===s.id&&(window.removeEventListener("message",o,!1),clearTimeout(t))};window.addEventListener("message",o,!1)}try{null==t||t.postMessage(s,{targetOrigin:e.targetOrigin})}catch{throw new Error(`Failed to postMessage '${s.id}' on client '${e.id}'`)}}return window.addEventListener("message",a,!1),n.forEach((e=>{c(e,"connecting")})),{destroy:function(){n.forEach((e=>{["disconnected"].includes(e.status)||(d(e,"channel/disconnect",{id:e.id},!1),c(e,"disconnected"))})),window.removeEventListener("message",a,!1),n.forEach((e=>{s(e),r(e)}))},send:function(e,t,r){(e?Array.isArray(e)?[...e]:[e]:n).forEach((e=>{const i=n.find((t=>t.config.id===e));if(!i)throw new Error("Invalid channel ID");d(i,t,r)}))}}}var Ye,et,tt,nt,rt=class extends Error{constructor(e){super(e[0].message),t(this,"issues"),this.name="ValiError",this.issues=e}};function it(e,t){return Array.isArray(e)?[void 0,e]:[e,t]}function ot(e,t,n,r,i){var o,a,s,c,l;const d=null!=(l=null!=(c=null!=(s=null!=(a=null!=(o=t.message)?o:function(e,t){var n;return null==(n=null==nt?void 0:nt.get(e))?void 0:n.get(t)}(n,i.lang))?a:e?(u=i.lang,null==tt?void 0:tt.get(u)):null)?s:null==r?void 0:r.message)?c:function(e){return null==et?void 0:et.get(e)}(i.lang))?l:i.message;var u;return"function"==typeof d?d(i):d}function at(e,t,n){return{typed:e,output:t,issues:n}}function st(e){let t=typeof e;return"object"===t&&(t=e?Object.getPrototypeOf(e).constructor.name:"null"),"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:t}function ct(e,t,n){var r;const i=null!=(r=n.received)?r:st(n.input),o={reason:e.type,context:n.context.type,expected:n.context.expects,received:i,message:`Invalid ${n.label}: ${n.context.expects?`Expected ${n.context.expects} but r`:"R"}eceived ${i}`,input:n.input,requirement:n.context.requirement,path:n.path,lang:null==t?void 0:t.lang,abortEarly:null==t?void 0:t.abortEarly,abortPipeEarly:null==t?void 0:t.abortPipeEarly,skipPipe:null==t?void 0:t.skipPipe};return o.message=ot(!1,n.context,n.reference,t,o),o}function lt(e,t,n,r){if(e.pipe&&(null==n||!n.skipPipe))for(const i of e.pipe){const o=i._parse(t);if(o.issues){for(const t of o.issues){const i=ct(e,n,t);r?r.push(i):r=[i]}if(null!=n&&n.abortEarly||null!=n&&n.abortPipeEarly)break}else t=o.output}return at(!0,t,r)}function dt(e,t,n,r,i){var o,a;const s=st(n),c=null!=(o=null==i?void 0:i.expected)?o:e.expects,l={reason:null!=(a=null==i?void 0:i.reason)?a:"type",context:e.type,expected:c,received:s,message:`Invalid type: Expected ${c} but received ${s}`,input:n,path:null==i?void 0:i.path,issues:null==i?void 0:i.issues,lang:null==r?void 0:r.lang,abortEarly:null==r?void 0:r.abortEarly,abortPipeEarly:null==r?void 0:r.abortPipeEarly,skipPipe:null==r?void 0:r.skipPipe};return l.message=ot(!0,e,t,r,l),{typed:!1,output:n,issues:[l]}}function ut(e,t){return{...e,fallback:t,_parse(t,n){const r=e._parse(t,n);return r.issues?at(!0,function(e,t){return"function"==typeof e.fallback?e.fallback(t):e.fallback}(this,{input:t,issues:r.issues})):r}}}function pt(e,t,n,r){const[i,o,a]=function(e,t,n){if(!e||"object"==typeof e&&!Array.isArray(e)){const[r,i]=it(t,n);return[e,r,i]}const[r,i]=it(e,t);return[void 0,r,i]}(t,n,r);let s;return{type:"object",expects:"Object",async:!1,entries:e,rest:i,message:o,pipe:a,_parse(e,t){if(e&&"object"==typeof e){s=null!=s?s:Object.entries(this.entries);let n,r=!0;const i={};for(const[o,a]of s){const s=e[o],c=a._parse(s,t);if(c.issues){const i={type:"object",origin:"value",input:e,key:o,value:s};for(const e of c.issues)e.path?e.path.unshift(i):e.path=[i],null==n||n.push(e);if(n||(n=c.issues),null!=t&&t.abortEarly){r=!1;break}}c.typed||(r=!1),(void 0!==c.output||o in e)&&(i[o]=c.output)}if(this.rest&&(null==t||!t.abortEarly||!n))for(const o in e)if(!(o in this.entries)){const a=e[o],s=this.rest._parse(a,t);if(s.issues){const i={type:"object",origin:"value",input:e,key:o,value:a};for(const e of s.issues)e.path?e.path.unshift(i):e.path=[i],null==n||n.push(e);if(n||(n=s.issues),null!=t&&t.abortEarly){r=!1;break}}s.typed||(r=!1),i[o]=s.output}return r?lt(this,i,t,n):at(!1,i,n)}return dt(this,pt,e,t)}}}function ht(e,t){return{type:"picklist",expects:e.map(st).join(" | "),async:!1,options:e,message:t,_parse(e,t){return this.options.includes(e)?at(!0,e):dt(this,ht,e,t)}}}function ft(e,t,n){const r=e._parse(t,function(e){var t,n,r,i;return{lang:null!=(t=null==e?void 0:e.lang)?t:null==Ye?void 0:Ye.lang,message:null==e?void 0:e.message,abortEarly:null!=(n=null==e?void 0:e.abortEarly)?n:null==Ye?void 0:Ye.abortEarly,abortPipeEarly:null!=(r=null==e?void 0:e.abortPipeEarly)?r:null==Ye?void 0:Ye.abortPipeEarly,skipPipe:null!=(i=null==e?void 0:e.skipPipe)?i:null==Ye?void 0:Ye.skipPipe}}(n));if(r.issues)throw new rt(r.issues);return r.output}const mt=/^([A-Za-z]+):([0-9]+)$/,vt=/^([A-Za-z]+):([0-9]+),([0-9]+)$/,gt=/^([A-Za-z]+):([a-z0-9]+)$/;function yt(e,t){return`${e}-${"string"==typeof t?t:JSON.stringify(t)}`}const wt={alt:"altKey",ctrl:"ctrlKey",mod:typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function bt(e){return"Alt"===e.key}function xt(e){const{children:t,message:i,onRetry:o,onContinueAnyway:f,...m}=e,v=n(h,{fontSize:1,mode:"ghost",onClick:o,text:"Retry"}),g=n(h,{fontSize:1,mode:"ghost",tone:"critical",onClick:f,text:"Continue anyway"});return n(a,{height:"fill",...m,children:n(s,{align:"center",height:"fill",justify:"center",children:n(c,{padding:4,sizing:"border",width:0,children:r(l,{space:4,children:[r(l,{space:3,children:[n(d,{size:1,weight:"semibold",children:"An error occured"}),n(d,{muted:!0,size:1,children:i})]}),t,o&&f?r(u,{space:2,children:[v,g]}):o?n(p,{children:v}):f?n(p,{children:g}):null]})})})})}function Pt(){const e=C(ce);if(!e)throw new Error("Presentation context is missing");return e}function Et(e){const t=["comment","inspect","instruction","pathKey","rev","since","template","view"];return function(e={}){const t=Object.entries(e).map((([e,t])=>`${e}=${t}`)).join("&");return t.length?`?${t}`:""}(Object.entries(e).filter((([e])=>t.includes(e))).reduce(((e,[t,n])=>null==n?e:{...e,[t]:n}),{}))}const kt=O((function(e,t){const{params:r,structureParams:i}=Pt();return n(Q,{...e,ref:t,state:{type:void 0,_searchParams:Object.entries({...i,preview:r.preview})},title:void 0})})),St=O((function(e,t){const{documentId:r,documentType:i,parentRefPath:o,template:a,...s}=e;return n(Q,{...s,ref:t,state:{id:r,type:i,_searchParams:Object.entries({preview:e.previewUrl})},title:void 0})}));function It(e){const{children:t,onStructureParams:r,params:o,previewUrl:a,refs:s}=e,{state:c,resolvePathFromState:l}=Y(),d=V(Object.fromEntries(c._searchParams||[])),u=R((e=>`${l(c)}${Et({...d,...e})}`),[l,d,c]),p=U((()=>({index:0,groupIndex:0,siblingIndex:0,payload:{},params:o,hasGroupSiblings:!1,groupLength:1,routerPanesState:[],ChildLink:e=>{const{childId:t,...r}=e,i=null==s?void 0:s.find((e=>e._id===t||B(e._id)===t));return i?n(Q,{...r,state:{id:t,type:i._type,_searchParams:Object.entries({preview:a})}}):n("div",{...r})},BackLink:kt,ReferenceChildLink:e=>n(St,{...e,previewUrl:a}),ParameterizedLink:()=>n(i,{children:"ParameterizedLink"}),closeCurrentAndAfter:()=>{console.warn("closeCurrentAndAfter")},handleEditReference:e=>{console.warn("handleEditReference",e)},replaceCurrent:e=>{console.warn("replaceCurrent",e)},closeCurrent:()=>{console.warn("closeCurrent")},duplicateCurrent:e=>{console.warn("duplicateCurrent",e)},setView:e=>{console.warn("setView",e)},setParams:e=>{var t;r({...e,inspect:null!=(t=e.inspect)?t:void 0})},setPayload:e=>{console.warn("setPayload",e)},navigateIntent:(e,t,n)=>{console.warn("navigateIntent",e,t,n)},createPathWithParams:u})),[u,r,o,a,s]);return n(te.Provider,{value:p,children:t})}const zt=se(ne)`
height: 100%;
`,zt=se(s)`
`,Ct=se(s)`
& > div {

@@ -8,13 +8,13 @@ min-width: none !important;

}
`,Ct=se(f)`
`,Ot=se(f)`
white-space: pre-wrap;
`;function Dt(e){const{onDeskParams:t,previewUrl:i,refs:o}=e,{devMode:s}=kt(),c=R((()=>({id:"$root",options:{filter:"_id in $ids",params:{ids:o.map((e=>e._id))}},schemaTypeName:"",title:"Documents on this page",type:"documentList"})),[o]),[d,u]=U(null),p=O((()=>u(null)),[]),[h]=U((()=>({})));return $((()=>u(null)),[o]),d?n(bt,{flex:1,message:"Could not render the document list",onRetry:p,children:s&&n(a,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Error message"}),n(Ct,{size:1,children:d.error.message})]})})}):n(v,{onCatch:u,children:n(It,{children:n(re,{children:n(St,{params:h,onDeskParams:t,previewUrl:i,refs:o,children:n(zt,{direction:"column",flex:1,children:n(ie,{index:0,itemId:"$root",pane:c,paneKey:"$root"})})})})})})}const Ot=se(f)`
`;function Rt(e){const{onStructureParams:t,previewUrl:i,refs:o}=e,{devMode:s}=Pt(),c=U((()=>({id:"$root",options:{filter:"_id in $ids",params:{ids:o.map((e=>e._id))}},schemaTypeName:"",title:"Documents on this page",type:"documentList"})),[o]),[d,u]=$(null),p=R((()=>u(null)),[]),[h]=$((()=>({})));return j((()=>u(null)),[o]),d?n(xt,{flex:1,message:"Could not render the document list",onRetry:p,children:s&&n(a,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Error message"}),n(Ot,{size:1,children:d.error.message})]})})}):n(v,{onCatch:u,children:n(zt,{children:n(re,{children:n(It,{onStructureParams:t,params:h,previewUrl:i,refs:o,children:n(Ct,{direction:"column",flex:1,children:n(ie,{index:0,itemId:"$root",pane:c,paneKey:"$root"})})})})})})}const Ut=se(f)`
white-space: pre-wrap;
`;function Rt(e){const{documentId:t,documentType:i,params:o,onDeskParams:s,onFocusPath:c,previewUrl:d}=e,{template:u,templateParams:p}=o,{devMode:h}=kt(),f=R((()=>({id:t,options:{id:t,type:i,template:u,templateParameters:ee(p)},title:"",type:"document"})),[t,i,u,p]),[g,y]=U(null),w=O((()=>y(null)),[]);return $((()=>{y(null)}),[t,i,o]),g?n(bt,{flex:1,message:"Could not render the document editor",onRetry:w,children:h&&n(a,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Error message"}),n(Ot,{size:1,children:g.error.message})]})})}):n(v,{onCatch:y,children:n(ne,{style:{height:"100%"},children:n(St,{onDeskParams:s,params:o,previewUrl:d,children:n(oe,{paneKey:"document",index:1,itemId:"document",pane:f,onFocusPath:c})})})})}function Ut(e){const{deskParams:t,documentId:r,documentType:i,onDeskParams:o,onFocusPath:a,previewUrl:s}=e;return n(re,{children:n(Rt,{documentId:r,documentType:i,params:t,onDeskParams:o,onFocusPath:a,previewUrl:s})})}function $t(e){const{deskParams:t,documentId:r,documentType:i,onDeskParams:o,onFocusPath:a,previewUrl:s,refs:c}=e;return r&&i?n(Ut,{deskParams:t,documentId:r,documentType:i,onDeskParams:o,onFocusPath:a,previewUrl:s}):n(Dt,{onDeskParams:o,previewUrl:s,refs:c})}const jt=j(null);jt.displayName="PanelsContext";const Lt=se.div`
`;function $t(e){const{documentId:t,documentType:i,onFocusPath:o,onStructureParams:s,params:c,previewUrl:d}=e,{template:u,templateParams:p}=c,{devMode:h}=Pt(),f=U((()=>({id:t,options:{id:t,type:i,template:u,templateParameters:ee(p)},title:"",type:"document"})),[t,i,u,p]),[g,y]=$(null),w=R((()=>y(null)),[]);return j((()=>{y(null)}),[t,i,c]),g?n(xt,{flex:1,message:"Could not render the document editor",onRetry:w,children:h&&n(a,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Error message"}),n(Ut,{size:1,children:g.error.message})]})})}):n(v,{onCatch:y,children:n(ne,{style:{height:"100%"},children:n(It,{onStructureParams:s,params:c,previewUrl:d,children:n(oe,{paneKey:"document",index:1,itemId:"document",pane:f,onFocusPath:o})})})})}function jt(e){const{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,previewUrl:a,structureParams:s}=e;return n(re,{children:n($t,{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,params:s,previewUrl:a})})}function Lt(e){const{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,previewUrl:a,refs:s,structureParams:c}=e;return t&&r?n(jt,{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,previewUrl:a,structureParams:c}):n(Rt,{onStructureParams:o,previewUrl:a,refs:s})}const Dt=L(null);Dt.displayName="PanelsContext";const Tt=se.div`
overflow: hidden;
flex-basis: 0;
flex-shrink: 1;
`,Tt=function({children:e,defaultSize:t=null,id:r,minWidth:i,maxWidth:o,order:a=0}){const s=C(jt);if(null===s)throw Error("Panel components must be rendered within a PanelGroup container");const{getPanelStyle:c,registerElement:l,unregisterElement:d}=s,u=c(r);return L((()=>(l(r,{id:r,type:"panel",defaultSize:t,maxWidth:null!=o?o:null,minWidth:null!=i?i:0,order:a}),()=>{d(r)})),[r,t,a,o,i,l,d]),n(Lt,{style:u,children:e})};const At=se.div`
`,At=function({children:e,defaultSize:t=null,id:r,minWidth:i,maxWidth:o,order:a=0}){const s=C(Dt);if(null===s)throw Error("Panel components must be rendered within a PanelGroup container");const{getPanelStyle:c,registerElement:l,unregisterElement:d}=s,u=c(r);return D((()=>(l(r,{id:r,type:"panel",defaultSize:t,maxWidth:null!=o?o:null,minWidth:null!=i?i:0,order:a}),()=>{d(r)})),[r,t,a,o,i,l,d]),n(Tt,{style:u,children:e})};const _t=se.div`
position: relative;
`,_t=se.div`
`,Wt=se.div`
position: absolute;

@@ -40,3 +40,3 @@ top: 0;

${({$disabled:e})=>!e&&"\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 "}
`,Wt=function({id:e,order:t,disabled:i=!1}){const o=T(null),a=C(jt);if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const s=function(e){return T(e||Ke()).current}(e),{activeResizer:c,drag:l,startDragging:d,stopDragging:u,registerElement:p,unregisterElement:h}=a,f=c===s;if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const m=O((e=>{d(s,e.nativeEvent)}),[s,d]),v=O((e=>{l(s,e)}),[s,l]),g=O((()=>{o.current.blur(),u()}),[u]);return $((()=>{if(f&&!i)return window.addEventListener("mousemove",v),window.addEventListener("mouseup",g),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",g)}}),[i,f,v,g]),L((()=>(p(s,{id:s,order:t,type:"resizer",el:o}),()=>{h(s)})),[s,t,p,h]),n(At,{onMouseDown:m,ref:o,children:r(_t,{$disabled:i,children:[n("span",{}),n("span",{})]})})};function Mt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(e,r)}),t)}}const Nt="presentation/panels",Ft=()=>JSON.parse(localStorage.getItem(Nt)||"{}"),Vt=e=>e.map((e=>[e.id,e.order].join(":"))).join(",");function Bt(){return R((()=>{const e=(e,t)=>{(e=>{localStorage.setItem(Nt,JSON.stringify(e))})({...Ft(),[Vt(e)]:t})};return{get:e=>Ft()[Vt(e)],set:e,setDebounced:Mt(e,100)}}),[])}function Kt(e,t,n){const{maxWidth:r,minWidth:i}=e,o=null==r?100:r/n*100,a=i/n*100;return Math.min(o,Math.max(a,t))}function qt(e,t,n){if(1===e.length)return"100";const r=n[e.findIndex((e=>e.id===t))];return null==r?"0":r.toPrecision(10)}function Gt(e,t,n=0,r=null){return e.clientX-(r||t.getBoundingClientRect()).left-n}function Jt(e){return"panel"===e.type}function Ht(e){return"resizer"===e.type}function Xt(e){return Array.from(e.values()).sort((({order:e},{order:t})=>null==e&&null==t?0:null==e?-1:null==t?1:e-t))}function Zt(e,t,n){const r=t.reduce(((e,t)=>e+t),0),i=[...t].map((e=>e/r*100));let o=0;for(let t=0;t<e.length;t++){const r=e[t],a=i[t],s=Kt(r,a,n);a!=s&&(o+=a-s,i[t]=s)}if("0.000"!==o.toFixed(3))for(let t=0;t<e.length;t++){const r=e[t];let{maxWidth:a,minWidth:s}=r;s=s/n*100,null!=a&&(a=a/n*100);const c=Math.min(null!=a?a:100,Math.max(s,i[t]+o));if(c!==i[t]&&(o-=c-i[t],i[t]=c,"0.000"===Math.abs(o).toFixed(3)))break}return i}const Qt=se.div`
`,Mt=function({id:e,order:t,disabled:i=!1}){const o=T(null),a=C(Dt);if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const s=function(e){return T(e||Ke()).current}(e),{activeResizer:c,drag:l,startDragging:d,stopDragging:u,registerElement:p,unregisterElement:h}=a,f=c===s;if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const m=R((e=>{d(s,e.nativeEvent)}),[s,d]),v=R((e=>{l(s,e)}),[s,l]),g=R((()=>{o.current.blur(),u()}),[u]);return j((()=>{if(f&&!i)return window.addEventListener("mousemove",v),window.addEventListener("mouseup",g),()=>{window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",g)}}),[i,f,v,g]),D((()=>(p(s,{id:s,order:t,type:"resizer",el:o}),()=>{h(s)})),[s,t,p,h]),n(_t,{onMouseDown:m,ref:o,children:r(Wt,{$disabled:i,children:[n("span",{}),n("span",{})]})})};function Nt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(e,r)}),t)}}const Ft="presentation/panels",Vt=()=>JSON.parse(localStorage.getItem(Ft)||"{}"),Bt=e=>e.map((e=>[e.id,e.order].join(":"))).join(",");function Kt(){return U((()=>{const e=(e,t)=>{const n=Vt(),r=Bt(e);(e=>{localStorage.setItem(Ft,JSON.stringify(e))})({...n,[r]:t})};return{get:e=>Vt()[Bt(e)],set:e,setDebounced:Nt(e,100)}}),[])}function qt(e,t,n){const{maxWidth:r,minWidth:i}=e,o=null==r?100:r/n*100,a=i/n*100;return Math.min(o,Math.max(a,t))}function Gt(e,t,n){if(1===e.length)return"100";const r=n[e.findIndex((e=>e.id===t))];return null==r?"0":r.toPrecision(10)}function Jt(e,t,n=0,r=null){return e.clientX-(r||t.getBoundingClientRect()).left-n}function Ht(e){return"panel"===e.type}function Xt(e){return"resizer"===e.type}function Zt(e){return Array.from(e.values()).sort((({order:e},{order:t})=>null==e&&null==t?0:null==e?-1:null==t?1:e-t))}function Qt(e,t,n){const r=t.reduce(((e,t)=>e+t),0),i=[...t].map((e=>e/r*100));let o=0;for(let t=0;t<e.length;t++){const r=e[t],a=i[t],s=qt(r,a,n);a!=s&&(o+=a-s,i[t]=s)}if("0.000"!==o.toFixed(3))for(let t=0;t<e.length;t++){const r=e[t];let{maxWidth:a,minWidth:s}=r;s=s/n*100,null!=a&&(a=a/n*100);const c=Math.min(null!=a?a:100,Math.max(s,i[t]+o));if(c!==i[t]&&(o-=c-i[t],i[t]=c,"0.000"===Math.abs(o).toFixed(3)))break}return i}const Yt=se.div`
display: flex;

@@ -47,3 +47,3 @@ flex-direction: row;

width: 100%;
`,Yt=function({children:e}){const t=T(null),[r,i]=U(new Map),o=R((()=>Xt(r).filter(Jt)),[r]),[a,s]=U([]),[c,l]=U(null),d=T({elements:r,panels:o,widths:a}),u=O((e=>({flexGrow:qt(o,e,a),pointerEvents:null===c?void 0:"none"})),[c,o,a]),p=O(((e,t)=>{i((n=>{if(n.has(e))return n;const r=new Map(n);return r.set(e,t),r}))}),[]),h=O((e=>{i((t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}))}),[]),f=T({containerWidth:window.innerWidth,dragOffset:0,panelAfter:null,panelBefore:null,resizerIndex:-1,resizerRect:null,startX:0,widths:[]}),m=O(((e,t)=>{const n=Xt(r),i=n.findIndex((t=>t.id===e)),o=r.get(e);if(!o||!Ht(o))return;const a=o.el.current;a&&(f.current={resizerIndex:i,panelBefore:n.reduce(((e,t,n)=>Jt(t)&&n<i?t:e),null),panelAfter:n.reduce(((e,t,n)=>null===e&&Jt(t)&&n>i?t:e),null),containerWidth:window.innerWidth,startX:t.pageX,dragOffset:Gt(t,a),resizerRect:a.getBoundingClientRect(),widths:d.current.widths},l(e))}),[r]),v=O((()=>{l(null)}),[]),g=O(((e,n)=>{n.preventDefault(),n.stopPropagation();const{containerWidth:i,dragOffset:o,panelBefore:a,panelAfter:c,resizerRect:l}=f.current;if(null==a||null==c)return;const u=r.get(e);if(!u||!Ht(u))return;const p=u.el.current;if(!p)return;const h=Gt(n,p,o,l);if(0===h)return;const{widths:m}=d.current,v=function(e,t,n,r,i,o){const{panels:a,widths:s}=i,{widths:c}=o,l=c||s,d=[...l];{const i=e<0?r:n,o=l[a.findIndex((e=>e.id===i.id))],s=Kt(i,o+Math.abs(e),t);if(o===s)return l;e=e<0?o-s:s-o}let u=0,p=e<0?n:r,h=a.findIndex((e=>e.id===p.id));for(;;){const n=a[h],r=l[h],i=Kt(n,r-(Math.abs(e)-Math.abs(u)),t);if(r!==i&&(u+=r-i,d[h]=i,u.toPrecision(10).localeCompare(Math.abs(e).toPrecision(10),void 0,{numeric:!0})>=0))break;if(e<0){if(--h<0)break}else if(++h>=a.length)break}return 0===u?l:(p=e<0?r:n,h=a.findIndex((e=>e.id===p.id)),d[h]=l[h]+u,d)}(h/t.current.getBoundingClientRect().width*100,i,a,c,d.current,f.current);m.some(((e,t)=>e!==v[t]))&&s(v)}),[r]);L((()=>{d.current.elements=r,d.current.panels=o,d.current.widths=a}),[r,o,a]);const y=Bt();L((()=>{const{widths:e}=d.current;if(e.length===o.length)return;const t=y.get(o);if(t){const e=Zt(o,t,window.innerWidth);return void s(e)}const n=function(e){let t=e.length,n=100;const r=e.map((e=>e.defaultSize?(n-=e.defaultSize,t-=1,e.defaultSize):null)),i=n/t;return r.map((e=>null===e?i:e))}(o);s(n)}),[y,o]),$((()=>{a.length&&y.setDebounced(o,a)}),[y,o,a]),L((()=>{const e=new ResizeObserver((()=>{const{panels:e,widths:t}=d.current,n=Zt(e,t,window.innerWidth);t.some(((e,t)=>e!==n[t]))&&s(n)}));return e.observe(t.current),()=>{e.disconnect()}}),[]);const w=R((()=>({activeResizer:c,drag:g,getPanelStyle:u,registerElement:p,startDragging:m,stopDragging:v,unregisterElement:h})),[c,g,u,p,m,v,h]);return n(jt.Provider,{value:w,children:n(Qt,{ref:t,children:e})})},en=function(e){const{children:t,navigate:r}=e,i=O(((e,t=void 0)=>{r(t||{},e?{preview:e}:{})}),[r]);return n(le.Provider,{value:i,children:t})};function tn(e){const{unstable_navigator:t}=e,r=!(null==t||!t.component),[o,a]=function(e,t){const[n,r]=U((()=>{var n;return JSON.parse(null!=(n=localStorage.getItem(e))?n:JSON.stringify(t))}));return $((()=>{localStorage.setItem(e,JSON.stringify(n))}),[e,n]),[n,r]}("presentation/navigator",r),s=!!r&&o,c=R((()=>{if(r)return()=>a((e=>!e))}),[r,a]),l=O((function(){return n(i,{children:s&&n(nn,{...t})})}),[s,t]);return[{navigatorEnabled:s,toggleNavigator:c},l]}const nn=A((function(e){const{minWidth:t,maxWidth:o,component:a}=e,s=null!=t&&null!=o&&t===o;return r(i,{children:[n(Tt,{id:"navigator",minWidth:t,maxWidth:o,order:1,children:n(a,{})}),n(Wt,{order:2,disabled:s})]})})),rn=function(e){const{children:t,params:r}=e,i=R((()=>r),[r]);return n(de.Provider,{value:i,children:t})},on=function(e){const{children:t,deskParams:r,devMode:i,name:o,navigate:a,params:s}=e,c=R((()=>({deskParams:r,devMode:i,name:o,navigate:a,params:s})),[r,i,o,a,s]);return n(ce.Provider,{value:c,children:t})},an="ACTION_IFRAME_LOADED",sn="ACTION_IFRAME_REFRESH",cn="ACTION_IFRAME_RELOAD",ln="ACTION_PERSPECTIVE",dn="ACTION_VIEWPORT",un="ACTION_VISUAL_EDITING_OVERLAYS_TOGGLE",pn=(e,t)=>{switch(t.type){case an:return"loaded"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"loaded"}};case sn:return"refreshing"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"refreshing"}};case cn:return"reloading"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"reloading"}};case ln:return{...e,perspective:ft(mn,t.perspective)};case dn:return{...e,viewport:ft(vn,t.viewport)};case un:return hn(e,t);default:return e}},hn=(e,t)=>e.visualEditing.overlaysEnabled===t.enabled?e:{...e,visualEditing:{...e.visualEditing,overlaysEnabled:t.enabled}},fn=ht(["loading","loaded","refreshing","reloading"]),mn=ut(ht(["published","previewDrafts"]),"previewDrafts"),vn=ut(ht(["desktop","mobile"]),"desktop"),gn=pt({iframe:pt({status:fn}),perspective:mn,viewport:vn,visualEditing:pt({overlaysEnabled:function e(t,n){const[r,i]=it(t,n);return{type:"boolean",expects:"boolean",async:!1,message:r,pipe:i,_parse(t,n){return"boolean"==typeof t?lt(this,t,n):dt(this,e,t,n)}}}()})}),yn={iframe:{status:"loading"},perspective:"previewDrafts",viewport:"desktop",visualEditing:{overlaysEnabled:!1}};function wn(e){return ft(gn,{...yn,...e})}const bn=$e(se.iframe`
`,en=function({children:e}){const t=T(null),[r,i]=$(new Map),o=U((()=>Zt(r).filter(Ht)),[r]),[a,s]=$([]),[c,l]=$(null),d=T({elements:r,panels:o,widths:a}),u=R((e=>({flexGrow:Gt(o,e,a),pointerEvents:null===c?void 0:"none"})),[c,o,a]),p=R(((e,t)=>{i((n=>{if(n.has(e))return n;const r=new Map(n);return r.set(e,t),r}))}),[]),h=R((e=>{i((t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}))}),[]),f=T({containerWidth:window.innerWidth,dragOffset:0,panelAfter:null,panelBefore:null,resizerIndex:-1,resizerRect:null,startX:0,widths:[]}),m=R(((e,t)=>{const n=Zt(r),i=n.findIndex((t=>t.id===e)),o=r.get(e);if(!o||!Xt(o))return;const a=o.el.current;a&&(f.current={resizerIndex:i,panelBefore:n.reduce(((e,t,n)=>Ht(t)&&n<i?t:e),null),panelAfter:n.reduce(((e,t,n)=>null===e&&Ht(t)&&n>i?t:e),null),containerWidth:window.innerWidth,startX:t.pageX,dragOffset:Jt(t,a),resizerRect:a.getBoundingClientRect(),widths:d.current.widths},l(e))}),[r]),v=R((()=>{l(null)}),[]),g=R(((e,n)=>{n.preventDefault(),n.stopPropagation();const{containerWidth:i,dragOffset:o,panelBefore:a,panelAfter:c,resizerRect:l}=f.current;if(null==a||null==c)return;const u=r.get(e);if(!u||!Xt(u))return;const p=u.el.current;if(!p)return;const h=Jt(n,p,o,l);if(0===h)return;const{widths:m}=d.current,v=function(e,t,n,r,i,o){const{panels:a,widths:s}=i,{widths:c}=o,l=c||s,d=[...l];{const i=e<0?r:n,o=l[a.findIndex((e=>e.id===i.id))],s=qt(i,o+Math.abs(e),t);if(o===s)return l;e=e<0?o-s:s-o}let u=0,p=e<0?n:r,h=a.findIndex((e=>e.id===p.id));for(;;){const n=a[h],r=l[h],i=qt(n,r-(Math.abs(e)-Math.abs(u)),t);if(r!==i&&(u+=r-i,d[h]=i,u.toPrecision(10).localeCompare(Math.abs(e).toPrecision(10),void 0,{numeric:!0})>=0))break;if(e<0){if(--h<0)break}else if(++h>=a.length)break}return 0===u?l:(p=e<0?r:n,h=a.findIndex((e=>e.id===p.id)),d[h]=l[h]+u,d)}(h/t.current.getBoundingClientRect().width*100,i,a,c,d.current,f.current);m.some(((e,t)=>e!==v[t]))&&s(v)}),[r]);D((()=>{d.current.elements=r,d.current.panels=o,d.current.widths=a}),[r,o,a]);const y=Kt();D((()=>{const{widths:e}=d.current;if(e.length===o.length)return;const t=y.get(o);if(t){const e=Qt(o,t,window.innerWidth);return void s(e)}const n=function(e){let t=e.length,n=100;const r=e.map((e=>e.defaultSize?(n-=e.defaultSize,t-=1,e.defaultSize):null)),i=n/t;return r.map((e=>null===e?i:e))}(o);s(n)}),[y,o]),j((()=>{a.length&&y.setDebounced(o,a)}),[y,o,a]),D((()=>{const e=new ResizeObserver((()=>{const{panels:e,widths:t}=d.current,n=Qt(e,t,window.innerWidth);t.some(((e,t)=>e!==n[t]))&&s(n)}));return e.observe(t.current),()=>{e.disconnect()}}),[]);const w=U((()=>({activeResizer:c,drag:g,getPanelStyle:u,registerElement:p,startDragging:m,stopDragging:v,unregisterElement:h})),[c,g,u,p,m,v,h]);return n(Dt.Provider,{value:w,children:n(Yt,{ref:t,children:e})})},tn=function(e){const{children:t,navigate:r}=e,i=R(((e,t=void 0)=>{r(t||{},e?{preview:e}:{})}),[r]);return n(le.Provider,{value:i,children:t})};function nn(e){const{unstable_navigator:t}=e,r=!(null==t||!t.component),[o,a]=function(e,t){const[n,r]=$((()=>{var n;return JSON.parse(null!=(n=localStorage.getItem(e))?n:JSON.stringify(t))}));return j((()=>{localStorage.setItem(e,JSON.stringify(n))}),[e,n]),[n,r]}("presentation/navigator",r),s=!!r&&o,c=U((()=>{if(r)return()=>a((e=>!e))}),[r,a]),l=R((function(){return n(i,{children:s&&n(rn,{...t})})}),[s,t]);return[{navigatorEnabled:s,toggleNavigator:c},l]}const rn=A((function(e){const{minWidth:t,maxWidth:o,component:a}=e,s=null!=t&&null!=o&&t===o;return r(i,{children:[n(At,{id:"navigator",minWidth:t,maxWidth:o,order:1,children:n(a,{})}),n(Mt,{order:2,disabled:s})]})})),on=function(e){const{children:t,params:r}=e,i=U((()=>r),[r]);return n(de.Provider,{value:i,children:t})},an=function(e){const{children:t,devMode:r,name:i,navigate:o,params:a,structureParams:s}=e,c=U((()=>({devMode:r,name:i,navigate:o,params:a,structureParams:s})),[r,i,o,a,s]);return n(ce.Provider,{value:c,children:t})},sn="ACTION_IFRAME_LOADED",cn="ACTION_IFRAME_REFRESH",ln="ACTION_IFRAME_RELOAD",dn="ACTION_PERSPECTIVE",un="ACTION_VIEWPORT",pn="ACTION_VISUAL_EDITING_OVERLAYS_TOGGLE",hn=(e,t)=>{switch(t.type){case sn:return"loaded"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"loaded"}};case cn:return"refreshing"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"refreshing"}};case ln:return"reloading"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"reloading"}};case dn:return{...e,perspective:ft(vn,t.perspective)};case un:return{...e,viewport:ft(gn,t.viewport)};case pn:return fn(e,t);default:return e}},fn=(e,t)=>e.visualEditing.overlaysEnabled===t.enabled?e:{...e,visualEditing:{...e.visualEditing,overlaysEnabled:t.enabled}},mn=ht(["loading","loaded","refreshing","reloading"]),vn=ut(ht(["published","previewDrafts"]),"previewDrafts"),gn=ut(ht(["desktop","mobile"]),"desktop"),yn=pt({iframe:pt({status:mn}),perspective:vn,viewport:gn,visualEditing:pt({overlaysEnabled:function e(t,n){const[r,i]=it(t,n);return{type:"boolean",expects:"boolean",async:!1,message:r,pipe:i,_parse(t,n){return"boolean"==typeof t?lt(this,t,n):dt(this,e,t,n)}}}()})}),wn={iframe:{status:"loading"},perspective:"previewDrafts",viewport:"desktop",visualEditing:{overlaysEnabled:!1}};function bn(e){return ft(yn,{...wn,...e})}const xn=je(se.iframe`
border: 0;

@@ -53,3 +53,3 @@ max-height: 100%;

display: block;
`),kn=function(e){var t;const{basePath:r="/"}=(null==(t=K())?void 0:t.activeWorkspace)||{},{fontSize:o=1,onChange:a,origin:s,padding:c=3,value:l}=e,d=T(null),[u,p]=U(void 0),[h,f]=U(void 0),m=O((e=>{p(e.currentTarget.value)}),[]),v=O((e=>{var t;if("Enter"===e.key){if(void 0===u)return;const e=u.startsWith("/")||""===u?`${s}${u}`:u;if(!e.startsWith(s+"/")&&e!==s)return void f(`URL must start with ${s}`);if(!s&&(e.startsWith(`${r}/`)||e===r))return void f(`URL can't have the same base path as the Studio ${r}`);const n=e===s?s+"/":e;f(void 0),p(void 0),a(n.slice(s.length)),null==(t=d.current)||t.blur()}"Escape"===e.key&&(f(void 0),p(void 0))}),[r,a,s,u]),y=O((()=>{f(void 0),p(void 0)}),[]);$((()=>{f(void 0),p(void 0)}),[s,l]);const w=R((()=>({icon:ye})),[]);return n(i,{children:n(g,{clearButton:h?w:void 0,customValidity:h,fontSize:o,onBlur:y,onClear:()=>{f(void 0),p(s+l)},onChange:m,onKeyDownCapture:v,padding:c,style:{zIndex:1},radius:2,ref:d,space:c,value:void 0===u?`${s}${l}`:u})})};function xn(e){const{initialUrl:t,openPopup:o,previewLocationOrigin:a,previewLocationRoute:s}=e,c=O((e=>{e.preventDefault(),o(e.currentTarget.href)}),[o]);return r(i,{children:[n(Pn,{initialUrl:t,previewLocationOrigin:a,previewLocationRoute:s}),n(y,{icon:we,text:"Open preview",as:"a",href:`${a}${s}`,onClick:c,rel:"opener",target:"_blank"})]})}function Pn(e){const{initialUrl:t,previewLocationOrigin:r,previewLocationRoute:i}=e,{push:o}=w(),a=q({apiVersion:ue}),s=G(),[c,l]=U(!1);return n(y,{disabled:c,onClick:()=>{if(null==navigator||!navigator.clipboard)return o({closable:!0,status:"error",title:"Clipboard not supported"}),!1;l(!0);let e,n=`${r}${i}`;const c=()=>{o({id:e,closable:!0,status:"success",title:"The URL is copied to the clipboard"}),l(!1)},d=e=>{o({closable:!0,status:"error",title:"Copy failed",description:e.message||e.toString()}),l(!1)};if(Oe(t)&&typeof ClipboardItem<"u"){const r="text/plain",l=new ClipboardItem({[r]:(async()=>{e=o({closable:!0,title:"Copying URL to clipboard…"});const c=await Te(a,"@sanity/presentation",typeof window>"u"?"":location.href,null==s?void 0:s.id);return n=Re(t,c.secret,i).toString(),new Blob([n],{type:r})})()});navigator.clipboard.write([l]).then(c).catch(d)}else navigator.clipboard.writeText(n).then(c).catch(d)},text:"Copy link",icon:be})}const En=$e(s),Sn=se(b)`
`),Pn=function(e){var t;const{basePath:r="/"}=(null==(t=K())?void 0:t.activeWorkspace)||{},{fontSize:o=1,onChange:a,origin:s,padding:c=3,value:l}=e,d=T(null),[u,p]=$(void 0),[h,f]=$(void 0),m=R((e=>{p(e.currentTarget.value)}),[]),v=R((e=>{var t;if("Enter"===e.key){if(void 0===u)return;const e=u.startsWith("/")||""===u?`${s}${u}`:u;if(!e.startsWith(s+"/")&&e!==s)return void f(`URL must start with ${s}`);if(!s&&(e.startsWith(`${r}/`)||e===r))return void f(`URL can't have the same base path as the Studio ${r}`);const n=e===s?s+"/":e;f(void 0),p(void 0),a(n.slice(s.length)),null==(t=d.current)||t.blur()}"Escape"===e.key&&(f(void 0),p(void 0))}),[r,a,s,u]),y=R((()=>{f(void 0),p(void 0)}),[]);j((()=>{f(void 0),p(void 0)}),[s,l]);const w=U((()=>({icon:ye})),[]);return n(i,{children:n(g,{clearButton:h?w:void 0,customValidity:h,fontSize:o,onBlur:y,onClear:()=>{f(void 0),p(s+l)},onChange:m,onKeyDownCapture:v,padding:c,style:{zIndex:1},radius:2,ref:d,space:c,value:void 0===u?`${s}${l}`:u})})};function En(e){const{initialUrl:t,openPopup:o,previewLocationOrigin:a,previewLocationRoute:s}=e,c=R((e=>{e.preventDefault(),o(e.currentTarget.href)}),[o]);return r(i,{children:[n(kn,{initialUrl:t,previewLocationOrigin:a,previewLocationRoute:s}),n(y,{icon:we,text:"Open preview",as:"a",href:`${a}${s}`,onClick:c,rel:"opener",target:"_blank"})]})}function kn(e){const{initialUrl:t,previewLocationOrigin:r,previewLocationRoute:i}=e,{push:o}=w(),a=q({apiVersion:ue}),s=G(),[c,l]=$(!1);return n(y,{disabled:c,onClick:()=>{if(null==navigator||!navigator.clipboard)return o({closable:!0,status:"error",title:"Clipboard not supported"}),!1;l(!0);let e,n=`${r}${i}`;const c=()=>{o({id:e,closable:!0,status:"success",title:"The URL is copied to the clipboard"}),l(!1)},d=e=>{o({closable:!0,status:"error",title:"Copy failed",description:e.message||e.toString()}),l(!1)};if(Re(t)&&typeof ClipboardItem<"u"){const r="text/plain",l=async()=>{e=o({closable:!0,title:"Copying URL to clipboard…"});const c=await Te(a,"@sanity/presentation",typeof window>"u"?"":location.href,null==s?void 0:s.id);return n=Ue(t,c.secret,i).toString(),new Blob([n],{type:r})},u=new ClipboardItem({[r]:l()});navigator.clipboard.write([u]).then(c).catch(d)}else navigator.clipboard.writeText(n).then(c).catch(d)},text:"Copy link",icon:be})}const Sn=je(s),In=se(b)`
& > span {

@@ -78,4 +78,4 @@ width: 21px;

}
`,In={previewDrafts:"Drafts",published:"Published"},zn="caution",Cn="positive",Dn={previewDrafts:Ce,published:De},On=D((function(e,t){const{dispatch:o,iframe:c,initialUrl:u,loadersConnection:v,navigatorEnabled:g,onPathChange:w,onRefresh:b,openPopup:z,overlaysConnection:C,params:D,perspective:j,targetOrigin:L,toggleNavigator:T,toggleOverlay:A,viewport:W,visualEditing:{overlaysEnabled:M}}=e,{devMode:N}=kt(),F=k(),V=O((()=>o({type:dn,viewport:"desktop"})),[o]),B=O((()=>o({type:dn,viewport:"mobile"})),[o]),K="loading"===c.status||"reloading"===c.status,[q,G]=U(!1),H="refreshing"===c.status,[X,Z]=U(!1),Q=K||H||"connecting"===C,Y=R((()=>L===location.origin?"":L),[L]),ee=O((()=>{b((()=>{"function"==typeof t||null==t||!t.current||(o({type:cn}),t.current.src=`${L}${D.preview||"/"}`)}))}),[o,b,D.preview,L,t]),te=O((()=>{"function"==typeof t||null==t||!t.current||(t.current.src=u.toString(),o({type:cn}))}),[o,t,u]),ne=O((()=>{ie(!0)}),[]),[re,ie]=U(!1),[oe,ae]=U(!1);$((()=>{if(!(K||H||"connecting"!==C&&"reconnecting"!==C)){const e=setTimeout((()=>{ae(!0)}),1e3);return()=>clearTimeout(e)}}),[C,K,H]),$((()=>{if(!K&&!H&&oe){if("connected"===C&&(Z(!1),ae(!1),G(!1),ie(!1)),"connecting"===C){const e=setTimeout((()=>{G(!0),console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly")}),pe);return()=>clearTimeout(e)}if("reconnecting"===C){const e=setTimeout((()=>{G(!0),Z(!0)}),pe);return()=>clearTimeout(e)}"disconnected"===C&&Z(!0)}}),[K,C,H,oe]);const se=R((()=>{const e=new URL(D.preview||"/",L),{pathname:t,search:n}=Ue(e);return`${t}${n}`}),[D.preview,L]),ce=O((()=>{o({type:an})}),[o]);return $((()=>{if("function"==typeof t||null==t||!t.current)return;const e=t.current;function n(){e===document.activeElement&&e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0}))}return window.addEventListener("blur",n),()=>{window.removeEventListener("blur",n)}}),[t]),n(je,{transition:F?{duration:0}:void 0,children:r(x,{delay:1e3,children:[n(a,{flex:"none",padding:2,shadow:1,style:{position:"relative"},children:r(s,{align:"center",gap:2,style:{minHeight:0},children:[T&&n(P,{animate:!0,content:n(d,{size:1,children:"Toggle navigator"}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Toggle navigator",fontSize:1,icon:ke,mode:"bleed",onClick:T,padding:3,selected:g})}),n(P,{animate:!0,content:r(s,{align:"center",style:{whiteSpace:"nowrap"},children:[n(p,{padding:1,children:n(d,{size:1,children:M?"Disable edit overlay":"Enable edit overlay"})}),n(p,{paddingY:1,children:n(J,{keys:["Alt"],style:{marginTop:-4,marginBottom:-4}})})]}),fallbackPlacements:["bottom-start"],padding:1,placement:"bottom",portal:!0,children:n(a,{as:"label",flex:"none",padding:3,style:{lineHeight:0,borderRadius:999,userSelect:"none"},tone:M?"positive":void 0,children:r(s,{align:"center",gap:2,children:[n("div",{style:{margin:-2},children:n(Sn,{checked:M,onChange:A,disabled:"loading"===c.status||"connected"!==C})}),n(p,{children:n(d,{muted:!0,size:1,weight:"medium",children:"Edit"})})]})})}),n(P,{animate:!0,content:n(d,{size:1,children:"loading"===c.status?"Loading…":"reloading"===c.status||"refreshing"===c.status?"Refreshing…":"Refresh preview"}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Refresh preview",fontSize:1,icon:xe,mode:"bleed",loading:"reloading"===c.status||"refreshing"===c.status,onClick:ee,padding:3})}),n(p,{flex:1,children:n(kn,{onChange:w,origin:Y,value:se})}),n(s,{align:"center",flex:"none",gap:1,children:n(E,{button:n(h,{fontSize:1,iconRight:Pe,mode:"bleed",padding:3,space:2}),id:"location-menu",menu:n(S,{children:n(xn,{initialUrl:u,openPopup:z,previewLocationOrigin:Y,previewLocationRoute:se})}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),n(s,{align:"center",flex:"none",gap:1,children:n(E,{button:n(h,{fontSize:1,iconRight:Ee,mode:"bleed",padding:3,space:2,text:In["connected"===v?j:"previewDrafts"],loading:"reconnecting"===v&&"loaded"!==c.status,disabled:"connected"!==v}),id:"perspective-menu",menu:r(S,{style:{maxWidth:240},children:[n(y,{fontSize:1,onClick:()=>o({type:ln,perspective:"previewDrafts"}),padding:3,pressed:"previewDrafts"===j,tone:zn,children:r(s,{align:"flex-start",gap:3,children:[n(p,{flex:"none",children:n(d,{size:1,children:_(Dn.previewDrafts)})}),r(l,{flex:1,space:2,children:[n(d,{size:1,weight:"medium",children:In.previewDrafts}),n(d,{muted:!0,size:1,children:"View this page with latest draft content"})]}),n(p,{flex:"none",children:n(d,{muted:!0,size:1,style:{opacity:"previewDrafts"===j?1:0},children:n(Se,{})})})]})}),n(y,{fontSize:1,onClick:()=>o({type:ln,perspective:"published"}),padding:3,pressed:"published"===j,tone:Cn,children:r(s,{align:"flex-start",gap:3,children:[n(p,{flex:"none",children:n(d,{size:1,children:_(Dn.published)})}),r(l,{flex:1,space:2,children:[n(d,{size:1,weight:"medium",children:In.published}),n(d,{muted:!0,size:1,children:"View this page with published content"})]}),n(p,{flex:"none",children:n(d,{muted:!0,size:1,style:{opacity:"published"===j?1:0},children:n(Se,{})})})]})})]}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),r(s,{align:"center",flex:"none",gap:1,children:[n(P,{animate:!0,content:n(d,{size:1,children:"Full viewport"}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Full viewport",fontSize:1,icon:Ie,mode:"bleed",onClick:V,padding:3,selected:"desktop"===W})}),n(P,{animate:!0,content:n(d,{size:1,children:"Narrow viewport"}),padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Narrow viewport",fontSize:1,icon:ze,mode:"bleed",onClick:B,padding:3,selected:"mobile"===W})})]})]})}),n(a,{flex:1,tone:"transparent",children:r(s,{align:"center",height:"fill",justify:"center",padding:"desktop"===W?0:2,sizing:"border",style:{position:"relative",cursor:Q?"wait":void 0},children:[n(Le,{children:X||K||H||!oe||re?(K||"connecting"===C&&"refreshing"!==c.status)&&!re?n(En,{initial:"initial",animate:"animate",exit:"exit",variants:Un,justify:"center",align:"center",style:{inset:"0",position:"absolute"},children:r(s,{style:{...Rn[W]},justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(d,{muted:!0,size:1,children:"Loading…"})]})}):X&&!re?n(En,{initial:"initial",animate:"animate",exit:"exit",variants:$n,justify:"center",align:"center",style:{background:"var(--card-bg-color)",inset:"0",position:"absolute",borderTop:"1px solid transparent",boxShadow:"0 0 0 1px var(--card-border-color)"},children:n(bt,{flex:1,message:"Could not connect to the preview",onRetry:te,onContinueAnyway:ne,children:N&&r(i,{children:["connected"!==C&&n(a,{padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Overlay connection status"}),n(f,{size:1,children:C})]})}),"connected"!==v&&n(a,{padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Loader connection status"}),n(f,{size:1,children:v})]})})]})})}):null:n(En,{initial:"initial",animate:"animate",exit:"exit",variants:Un,justify:"center",align:"center",style:{inset:"0",position:"absolute",backdropFilter:q?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",transition:"backdrop-filter 0.2s ease-in-out",WebkitBackdropFilter:q?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",WebkitTransition:"-webkit-backdrop-filter 0.2s ease-in-out",zIndex:1},children:r(s,{style:{...Rn[W]},justify:"center",align:"center",direction:"column",gap:4,children:[q&&n(h,{disabled:!0,fontSize:1,mode:"ghost",text:"Continue anyway",style:{opacity:0}}),n(a,{radius:2,tone:q?"caution":"inherit",padding:4,shadow:1,children:r(s,{justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(d,{muted:!0,size:1,children:q?n(i,{children:"Unable to connect, check the browser console for more information."}):"Connecting…"})]})}),q&&n(h,{fontSize:1,tone:"critical",onClick:ne,text:"Continue anyway"})]})})}),n(bn,{ref:t,style:{pointerEvents:(K||"connecting"===C&&"refreshing"!==c.status)&&!re?"none":"auto",boxShadow:"0 0 0 1px var(--card-border-color)",borderTop:"1px solid transparent"},src:u.toString(),initial:["background"],variants:jn,animate:[(K||"connecting"===C&&"refreshing"!==c.status)&&!re?"background":"active",K?"reloading":"idle",W,oe&&!re?"timedOut":""],onLoad:ce})]})})]})})})),Rn={desktop:{width:"100%",height:"100%"},mobile:{width:375,height:650}},Un={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},$n={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},jn={desktop:{...Rn.desktop,boxShadow:"0 0 0 0px var(--card-border-color)"},mobile:{...Rn.mobile,boxShadow:"0 0 0 1px var(--card-border-color)"},background:{opacity:0,scale:1},idle:{scale:1},reloading:{scale:[1,1,1,.98]},active:{opacity:[0,0,1],scale:1},timedOut:{opacity:[0,0,1]}};let Ln=!1;function Tn(e){var t;if(void 0===e)return;const n=null==(t=decodeURIComponent(e))?void 0:t.split(".");return"drafts"===n[0]&&n.shift(),n.join(".")}function An(e){if(void 0!==e)return o.toString(function(e){const t=[];for(const n of e.split(".")){const e=mt.exec(n);if(e){t.push(e[1],Number(e[2]));continue}const r=vt.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}const i=gt.exec(n);i?t.push(i[1],{_key:i[2]}):t.push(n)}return t}(decodeURIComponent(e)))}function _n(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e&&""!==e&&null!==e)))}function Wn({initialPreviewUrl:e,routerNavigate:t,routerState:n,routerSearchParams:r,frameStateRef:i}){const o=R((()=>{const{id:t,path:i,type:o}={id:Tn((a=n).id),path:An(a.path),type:a.type};var a;return{id:t,type:o,path:i,preview:r.preview||`${e.pathname}${e.search}`,perspective:r.perspective,viewport:r.viewport,inspect:r.inspect,rev:r.rev,since:r.since,template:r.template,templateParams:r.templateParams,view:r.view,pathKey:r.pathKey,instruction:r.instruction,comment:r.comment}}),[n,r,e]),a=R((()=>_n({inspect:o.inspect,path:o.path,rev:o.rev,since:o.since,template:o.template,templateParams:o.templateParams,view:o.view,pathKey:o.pathKey,instruction:o.instruction,comment:o.comment})),[o.comment,o.inspect,o.instruction,o.path,o.pathKey,o.rev,o.since,o.template,o.templateParams,o.view]),s=T(n);$((()=>{s.current=n}),[n]);return{deskParams:a,navigate:R((()=>Mt(((e,n={},r)=>{e.id&&(e.id=B(e.id));const{_searchParams:o,...a}=s.current,c=(o||[]).reduce(((e,[t,n])=>(e[t]=n,e)),{}),l=_n({...a,...e}),d=_n({...c,...n});a.id!==l.id&&(delete d.template,delete d.templateParams),l._searchParams=Object.entries(d).reduce(((e,[t,n])=>[...e,[t,n]]),[]);const u=null!=r?r:d.preview===i.current.url;t(l,{replace:u})}),50)),[t,i]),params:o}}function Mn(e,t,n){var r,i;const o=q({apiVersion:ue}),a=K(),s=(null==(r=null==a?void 0:a.activeWorkspace)?void 0:r.basePath)||"/",c=(null==(i=null==a?void 0:a.activeWorkspace)?void 0:i.name)||"default",l=function(e,t,n){const r=G();return R((()=>["@sanity/presentation",t,n,e,null==r?void 0:r.id,Nn]),[t,null==r?void 0:r.id,e,n])}(t,s,c),d=function(e,t){const n=q({apiVersion:ue}),r=G(),[i,o]=U(""),a=e?We((async()=>await Te(n,"@sanity/presentation",typeof window>"u"?"":location.href,null==r?void 0:r.id)),[...t,i]):null;return $((()=>{if(!a)return;const e=setTimeout((()=>{W((()=>o(a.expiresAt.toString())))}),a.expiresAt.getTime()-Date.now());return()=>clearTimeout(e)}),[a]),(null==a?void 0:a.secret)||null}("object"==typeof e||"function"==typeof e,l);return We((async()=>{if("string"==typeof e){const t=new URL(e,location.origin);let r=t;try{if(n){const e=new URL(n,t);e.origin===t.origin&&(r=e)}else if(document.referrer){const e=new URL(document.referrer);e.origin===t.origin&&(r=e)}}catch{}return location.origin!==r.origin||!r.pathname.startsWith(`${s}/`)&&r.pathname!==s?r:t}const t=await("object"==typeof e?_e(e):e)({client:o,previewUrlSecret:d,previewSearchParam:n,referrer:typeof document>"u"?null:document.referrer,studioBasePath:s});return new URL(t,location.origin)}),[...l,d])}const Nn=Symbol();const Fn=F((()=>import("./LoaderQueries.js"))),Vn=F((()=>import("./PostMessageRefreshMutations.js"))),Bn=se(s)`
`,zn={previewDrafts:"Drafts",published:"Published"},Cn="caution",On="positive",Rn={previewDrafts:Ce,published:Oe},Un=O((function(e,t){const{dispatch:o,iframe:c,initialUrl:u,loadersConnection:v,navigatorEnabled:g,onPathChange:w,onRefresh:b,openPopup:z,overlaysConnection:C,params:O,perspective:L,targetOrigin:D,toggleNavigator:T,toggleOverlay:A,viewport:W,visualEditing:{overlaysEnabled:M}}=e,{devMode:N}=Pt(),F=x(),V=R((()=>o({type:un,viewport:"desktop"})),[o]),B=R((()=>o({type:un,viewport:"mobile"})),[o]),K="loading"===c.status||"reloading"===c.status,[q,G]=$(!1),H="refreshing"===c.status,[X,Z]=$(!1),Q=K||H||"connecting"===C,Y=U((()=>D===location.origin?"":D),[D]),ee=R((()=>{b((()=>{"function"==typeof t||null==t||!t.current||(o({type:ln}),t.current.src=`${D}${O.preview||"/"}`)}))}),[o,b,O.preview,D,t]),te=R((()=>{"function"==typeof t||null==t||!t.current||(t.current.src=u.toString(),o({type:ln}))}),[o,t,u]),ne=R((()=>{ie(!0)}),[]),[re,ie]=$(!1),[oe,ae]=$(!1);j((()=>{if(!(K||H||"connecting"!==C&&"reconnecting"!==C)){const e=setTimeout((()=>{ae(!0)}),1e3);return()=>clearTimeout(e)}}),[C,K,H]),j((()=>{if(!K&&!H&&oe){if("connected"===C&&(Z(!1),ae(!1),G(!1),ie(!1)),"connecting"===C){const e=setTimeout((()=>{G(!0),console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly")}),pe);return()=>clearTimeout(e)}if("reconnecting"===C){const e=setTimeout((()=>{G(!0),Z(!0)}),pe);return()=>clearTimeout(e)}"disconnected"===C&&Z(!0)}}),[K,C,H,oe]);const se=U((()=>{const e=new URL(O.preview||"/",D),{pathname:t,search:n}=$e(e);return`${t}${n}`}),[O.preview,D]),ce=R((()=>{o({type:sn})}),[o]);return j((()=>{if("function"==typeof t||null==t||!t.current)return;const e=t.current;function n(){e===document.activeElement&&e.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0}))}return window.addEventListener("blur",n),()=>{window.removeEventListener("blur",n)}}),[t]),n(Le,{transition:F?{duration:0}:void 0,children:r(P,{delay:1e3,children:[n(a,{flex:"none",padding:2,shadow:1,style:{position:"relative"},children:r(s,{align:"center",gap:2,style:{minHeight:0},children:[T&&n(E,{animate:!0,content:n(d,{size:1,children:"Toggle navigator"}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Toggle navigator",fontSize:1,icon:xe,mode:"bleed",onClick:T,padding:3,selected:g})}),n(E,{animate:!0,content:r(s,{align:"center",style:{whiteSpace:"nowrap"},children:[n(p,{padding:1,children:n(d,{size:1,children:M?"Disable edit overlay":"Enable edit overlay"})}),n(p,{paddingY:1,children:n(J,{keys:["Alt"],style:{marginTop:-4,marginBottom:-4}})})]}),fallbackPlacements:["bottom-start"],padding:1,placement:"bottom",portal:!0,children:n(a,{as:"label",flex:"none",padding:3,style:{lineHeight:0,borderRadius:999,userSelect:"none"},tone:M?"positive":void 0,children:r(s,{align:"center",gap:2,children:[n("div",{style:{margin:-2},children:n(In,{checked:M,onChange:A,disabled:"loading"===c.status||"connected"!==C})}),n(p,{children:n(d,{muted:!0,size:1,weight:"medium",children:"Edit"})})]})})}),n(E,{animate:!0,content:n(d,{size:1,children:"loading"===c.status?"Loading…":"reloading"===c.status||"refreshing"===c.status?"Refreshing…":"Refresh preview"}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Refresh preview",fontSize:1,icon:Pe,mode:"bleed",loading:"reloading"===c.status||"refreshing"===c.status,onClick:ee,padding:3})}),n(p,{flex:1,children:n(Pn,{onChange:w,origin:Y,value:se})}),n(s,{align:"center",flex:"none",gap:1,children:n(k,{button:n(h,{fontSize:1,iconRight:Ee,mode:"bleed",padding:3,space:2}),id:"location-menu",menu:n(S,{children:n(En,{initialUrl:u,openPopup:z,previewLocationOrigin:Y,previewLocationRoute:se})}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),n(s,{align:"center",flex:"none",gap:1,children:n(k,{button:n(h,{fontSize:1,iconRight:ke,mode:"bleed",padding:3,space:2,text:zn["connected"===v?L:"previewDrafts"],loading:"reconnecting"===v&&"loaded"!==c.status,disabled:"connected"!==v}),id:"perspective-menu",menu:r(S,{style:{maxWidth:240},children:[n(y,{fontSize:1,onClick:()=>o({type:dn,perspective:"previewDrafts"}),padding:3,pressed:"previewDrafts"===L,tone:Cn,children:r(s,{align:"flex-start",gap:3,children:[n(p,{flex:"none",children:n(d,{size:1,children:_(Rn.previewDrafts)})}),r(l,{flex:1,space:2,children:[n(d,{size:1,weight:"medium",children:zn.previewDrafts}),n(d,{muted:!0,size:1,children:"View this page with latest draft content"})]}),n(p,{flex:"none",children:n(d,{muted:!0,size:1,style:{opacity:"previewDrafts"===L?1:0},children:n(Se,{})})})]})}),n(y,{fontSize:1,onClick:()=>o({type:dn,perspective:"published"}),padding:3,pressed:"published"===L,tone:On,children:r(s,{align:"flex-start",gap:3,children:[n(p,{flex:"none",children:n(d,{size:1,children:_(Rn.published)})}),r(l,{flex:1,space:2,children:[n(d,{size:1,weight:"medium",children:zn.published}),n(d,{muted:!0,size:1,children:"View this page with published content"})]}),n(p,{flex:"none",children:n(d,{muted:!0,size:1,style:{opacity:"published"===L?1:0},children:n(Se,{})})})]})})]}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),r(s,{align:"center",flex:"none",gap:1,children:[n(E,{animate:!0,content:n(d,{size:1,children:"Full viewport"}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Full viewport",fontSize:1,icon:Ie,mode:"bleed",onClick:V,padding:3,selected:"desktop"===W})}),n(E,{animate:!0,content:n(d,{size:1,children:"Narrow viewport"}),padding:2,placement:"bottom",portal:!0,children:n(h,{"aria-label":"Narrow viewport",fontSize:1,icon:ze,mode:"bleed",onClick:B,padding:3,selected:"mobile"===W})})]})]})}),n(a,{flex:1,tone:"transparent",children:r(s,{align:"center",height:"fill",justify:"center",padding:"desktop"===W?0:2,sizing:"border",style:{position:"relative",cursor:Q?"wait":void 0},children:[n(De,{children:X||K||H||!oe||re?(K||"connecting"===C&&"refreshing"!==c.status)&&!re?n(Sn,{initial:"initial",animate:"animate",exit:"exit",variants:jn,justify:"center",align:"center",style:{inset:"0",position:"absolute"},children:r(s,{style:{...$n[W]},justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(d,{muted:!0,size:1,children:"Loading…"})]})}):X&&!re?n(Sn,{initial:"initial",animate:"animate",exit:"exit",variants:Ln,justify:"center",align:"center",style:{background:"var(--card-bg-color)",inset:"0",position:"absolute",borderTop:"1px solid transparent",boxShadow:"0 0 0 1px var(--card-border-color)"},children:n(xt,{flex:1,message:"Could not connect to the preview",onRetry:te,onContinueAnyway:ne,children:N&&r(i,{children:["connected"!==C&&n(a,{padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Overlay connection status"}),n(f,{size:1,children:C})]})}),"connected"!==v&&n(a,{padding:3,radius:2,tone:"critical",children:r(l,{space:3,children:[n(m,{muted:!0,size:0,children:"Loader connection status"}),n(f,{size:1,children:v})]})})]})})}):null:n(Sn,{initial:"initial",animate:"animate",exit:"exit",variants:jn,justify:"center",align:"center",style:{inset:"0",position:"absolute",backdropFilter:q?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",transition:"backdrop-filter 0.2s ease-in-out",WebkitBackdropFilter:q?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",WebkitTransition:"-webkit-backdrop-filter 0.2s ease-in-out",zIndex:1},children:r(s,{style:{...$n[W]},justify:"center",align:"center",direction:"column",gap:4,children:[q&&n(h,{disabled:!0,fontSize:1,mode:"ghost",text:"Continue anyway",style:{opacity:0}}),n(a,{radius:2,tone:q?"caution":"inherit",padding:4,shadow:1,children:r(s,{justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(d,{muted:!0,size:1,children:q?n(i,{children:"Unable to connect, check the browser console for more information."}):"Connecting…"})]})}),q&&n(h,{fontSize:1,tone:"critical",onClick:ne,text:"Continue anyway"})]})})}),n(xn,{ref:t,style:{pointerEvents:(K||"connecting"===C&&"refreshing"!==c.status)&&!re?"none":"auto",boxShadow:"0 0 0 1px var(--card-border-color)",borderTop:"1px solid transparent"},src:u.toString(),initial:["background"],variants:Dn,animate:[(K||"connecting"===C&&"refreshing"!==c.status)&&!re?"background":"active",K?"reloading":"idle",W,oe&&!re?"timedOut":""],onLoad:ce})]})})]})})})),$n={desktop:{width:"100%",height:"100%"},mobile:{width:375,height:650}},jn={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Ln={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Dn={desktop:{...$n.desktop,boxShadow:"0 0 0 0px var(--card-border-color)"},mobile:{...$n.mobile,boxShadow:"0 0 0 1px var(--card-border-color)"},background:{opacity:0,scale:1},idle:{scale:1},reloading:{scale:[1,1,1,.98]},active:{opacity:[0,0,1],scale:1},timedOut:{opacity:[0,0,1]}};let Tn=!1;function An(e){var t;if(void 0===e)return;const n=null==(t=decodeURIComponent(e))?void 0:t.split(".");return"drafts"===n[0]&&n.shift(),n.join(".")}function _n(e){if(void 0!==e)return o.toString(function(e){const t=[];for(const n of e.split(".")){const e=mt.exec(n);if(e){t.push(e[1],Number(e[2]));continue}const r=vt.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}const i=gt.exec(n);i?t.push(i[1],{_key:i[2]}):t.push(n)}return t}(decodeURIComponent(e)))}function Wn(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e&&""!==e&&null!==e)))}function Mn({initialPreviewUrl:e,routerNavigate:t,routerState:n,routerSearchParams:r,frameStateRef:i}){const o=U((()=>{const{id:t,path:i,type:o}={id:An((a=n).id),path:_n(a.path),type:a.type};var a;return{id:t,type:o,path:i,preview:r.preview||`${e.pathname}${e.search}`,perspective:r.perspective,viewport:r.viewport,inspect:r.inspect,rev:r.rev,since:r.since,template:r.template,templateParams:r.templateParams,view:r.view,pathKey:r.pathKey,instruction:r.instruction,comment:r.comment}}),[n,r,e]),a=U((()=>Wn({inspect:o.inspect,path:o.path,rev:o.rev,since:o.since,template:o.template,templateParams:o.templateParams,view:o.view,pathKey:o.pathKey,instruction:o.instruction,comment:o.comment})),[o.comment,o.inspect,o.instruction,o.path,o.pathKey,o.rev,o.since,o.template,o.templateParams,o.view]),s=T(n);j((()=>{s.current=n}),[n]);return{structureParams:a,navigate:U((()=>Nt(((e,n={},r)=>{e.id&&(e.id=B(e.id));const{_searchParams:o,...a}=s.current,c=(o||[]).reduce(((e,[t,n])=>(e[t]=n,e)),{}),l=Wn({...a,...e}),d=Wn({...c,...n});a.id!==l.id&&(delete d.template,delete d.templateParams),l._searchParams=Object.entries(d).reduce(((e,[t,n])=>[...e,[t,n]]),[]);const u=null!=r?r:d.preview===i.current.url;t(l,{replace:u})}),50)),[t,i]),params:o}}function Nn(e,t,n){var r,i;const o=q({apiVersion:ue}),a=K(),s=(null==(r=null==a?void 0:a.activeWorkspace)?void 0:r.basePath)||"/",c=(null==(i=null==a?void 0:a.activeWorkspace)?void 0:i.name)||"default",l=function(e,t,n){const r=G();return U((()=>["@sanity/presentation",t,n,e,null==r?void 0:r.id,Fn]),[t,null==r?void 0:r.id,e,n])}(t,s,c),d=function(e,t){const n=q({apiVersion:ue}),r=G(),[i,o]=$(""),a=e?We((async()=>await Te(n,"@sanity/presentation",typeof window>"u"?"":location.href,null==r?void 0:r.id)),[...t,i]):null;return j((()=>{if(!a)return;const e=setTimeout((()=>{W((()=>o(a.expiresAt.toString())))}),a.expiresAt.getTime()-Date.now());return()=>clearTimeout(e)}),[a]),(null==a?void 0:a.secret)||null}("object"==typeof e||"function"==typeof e,l);return We((async()=>{if("string"==typeof e){const t=new URL(e,location.origin);let r=t;try{if(n){const e=new URL(n,t);e.origin===t.origin&&(r=e)}else if(document.referrer){const e=new URL(document.referrer);e.origin===t.origin&&(r=e)}}catch{}return location.origin!==r.origin||!r.pathname.startsWith(`${s}/`)&&r.pathname!==s?r:t}const t=await("object"==typeof e?_e(e):e)({client:o,previewUrlSecret:d,previewSearchParam:n,referrer:typeof document>"u"?null:document.referrer,studioBasePath:s});return new URL(t,location.origin)}),[...l,d])}const Fn=Symbol();const Vn=F((()=>import("./LoaderQueries.js"))),Bn=F((()=>import("./PostMessageRefreshMutations.js"))),Kn=se(s)`
overflow-x: auto;
`;function Kn(e){var t;const{previewUrl:a,components:c}=null!=(t=e.tool.options)?t:{},l=e.tool.name||ve,{unstable_navigator:d}=c||{},{navigate:u,state:p}=Y(),h=V(Object.fromEntries(p._searchParams||[])),f=Mn(a||"/",l,h.preview||null),[m]=U((()=>{var t;const n=null==(t=e.tool.options)?void 0:t.devMode;return"function"==typeof n?n():"boolean"==typeof n?n:typeof window<"u"&&"localhost"===window.location.hostname})),v=R((()=>f.origin),[f.origin]),g=T(null),[y,w]=U(),[b,k]=U({}),x=T({title:void 0,url:void 0}),{params:P,deskParams:E,navigate:S}=Wn({initialPreviewUrl:f,routerNavigate:u,routerState:p,routerSearchParams:h,frameStateRef:x}),[I,C]=M(pn,{perspective:P.perspective,viewport:P.viewport},wn),[D,j]=function(e,t){if("published"!==e&&"previewDrafts"!==e)throw new Error(`Invalid perspective: ${e}`);const[n,r]=U({}),[i,o]=U({}),a=T(""),s=O(((e,n,i=[])=>{const s=i.filter((e=>"_projectId"in e&&e._projectId?(Ln||(console.warn("Cross dataset references are not supported yet, ignoring source document",e),Ln=!0),!1):e));("published"===n?r:o)((n=>{const r={};for(const e of s)r[e._id]=e;if(a.current!==t.current.url)return a.current=t.current.url,{[e]:r};const i=n[e];return Ae(i,r)?n:{...n,[e]:r}}))}),[t]);return[R((()=>{const t=Object.values("published"===e?n:i).reduce(((e,t)=>(Object.values(t).forEach((t=>{e[t._id]=t})),e)),{});return Object.values(t)}),[e,i,n]),s]}(I.perspective,x),L=H(),A=X();$((()=>{(I.perspective!==P.perspective||I.viewport!==P.viewport)&&S({},{perspective:"previewDrafts"===I.perspective?void 0:I.perspective,viewport:"desktop"===I.viewport?void 0:I.viewport})}),[P.perspective,I.perspective,S,I.viewport,P.viewport]);const[_,F]=U("connecting"),[B,K]=U("connecting"),[q,G]=U("connecting"),[J]=U((()=>new Set)),Q=O((e=>{const t=window.open(e,"_blank");t&&J.add(t)}),[J]);$((()=>{if(J.size&&y)for(const e of J)e&&"closed"in e&&!e.closed&&y.addSource(e)}),[y,J,J.size]),$((()=>{var e;const t=null==(e=g.current)?void 0:e.contentWindow;if(!t)return;const n=function(e){const{destroy:t,send:n}=Qe(e),r=new Set,i=new WeakMap,o=new Set;return{destroy:()=>{t();for(const e of o)e()},send:(e,...t)=>{n(e,...t);for(const n of r)n&&"closed"in n&&!n.closed&&i.has(n)&&i.get(n)(e,...t)},addSource(t){if(r.has(t))return;if(!("closed"in t))throw console.warn("Source is unsupported",{source:t}),new Error("Source is unsupported");if(t.closed)throw new Error("Source is closed");const{send:n,destroy:a}=Qe({...e,target:t,connectTo:e.connectTo.map((e=>{const{onStatusUpdate:t,onEvent:n,...r}=e;return{...r,onEvent:n?(...e)=>{const[t]=e;if("preview-kit/documents"!==t&&"overlay/navigate"!==t&&"loader/documents"!==t)return n(...e)}:void 0}}))});o.add(a),i.set(t,n),r.add(t)}}}({id:"presentation",target:t,targetOrigin:v,connectTo:[{id:"overlays",heartbeat:!0,onStatusUpdate:F,onEvent(e,t){if("visual-editing/focus"!==e&&"overlay/focus"!==e||!("id"in t))if("visual-editing/navigate"===e||"overlay/navigate"===e){const{title:e,url:n}=t;x.current.url!==n&&S({},{preview:n}),x.current={title:e,url:n}}else"visual-editing/meta"===e?x.current.title=t.title:"visual-editing/toggle"===e||"overlay/toggle"===e?C({type:un,enabled:t.enabled}):"visual-editing/documents"===e?j("visual-editing",t.perspective,t.documents):"visual-editing/refreshing"===e&&"manual"===t.source?clearTimeout(ye.current):"visual-editing/refreshing"===e&&"mutation"===t.source?C({type:sn}):"visual-editing/refreshed"===e&&C({type:an});else S({type:t.type,id:t.id,path:t.path})}},{id:"loaders",heartbeat:!0,onStatusUpdate:K,onEvent(e,t){if("loader/documents"===e&&t.projectId===L&&t.dataset===A)j("loaders",t.perspective,t.documents);else if("loader/query-listen"===e&&t.projectId===L&&t.dataset===A){if("number"==typeof t.heartbeat&&t.heartbeat<he)throw new Error(`Loader query listen heartbeat interval must be at least ${he}ms`);k((e=>{var n,r,i;return{...e,[(r=t.query,i=t.params,`${r}-${"string"==typeof i?i:JSON.stringify(i)}`)]:{perspective:t.perspective,query:t.query,params:t.params,receivedAt:Date.now(),heartbeat:null!=(n=t.heartbeat)&&n}}}))}}},{id:"preview-kit",heartbeat:!0,onStatusUpdate:G,onEvent(e,t){"preview-kit/documents"===e&&t.projectId===L&&t.dataset===A&&j("preview-kit",t.perspective,t.documents)}}]});return w(n),()=>{n.destroy(),w(void 0)}}),[A,L,j,S,v]),$((()=>{const e=setInterval((()=>W((()=>k((e=>{if(Object.keys(e).length<1)return e;const t=Date.now();if(!Object.values(e).some((e=>!1!==e.heartbeat&&t>e.receivedAt+e.heartbeat)))return e;const n={};for(const[r,i]of Object.entries(e))!1!==i.heartbeat&&t>i.receivedAt+i.heartbeat||(n[r]=i);return n}))))),he);return()=>clearInterval(e)}),[]);const ee=O((e=>{S({path:o.toString(e)},{},!0)}),[S]),te=O((e=>{const t=new URL(e,f.origin),n=t.pathname+t.search;t.origin===f.origin&&n!==P.preview&&S({},{preview:n})}),[f,P,S]),ne=O((e=>{S({},e)}),[S]);$((()=>{null==y||y.send("overlays","presentation/perspective",{perspective:I.perspective})}),[y,I.perspective]),$((()=>{P.id&&P.path?null==y||y.send("overlays","presentation/focus",{id:P.id,path:P.path}):null==y||y.send("overlays","presentation/blur",void 0)}),[y,P.id,P.path]),$((()=>{x.current.url&&P.preview&&x.current.url!==P.preview&&(x.current.url=P.preview,"connected"!==_&&g.current?g.current.src=`${v}${P.preview}`:null==y||y.send("overlays","presentation/navigate",{url:P.preview,type:"replace"}))}),[y,_,v,P.preview]);const re=O((()=>null==y?void 0:y.send("overlays","presentation/toggleOverlay",void 0)),[y]),[ie,oe]=U(null);$((()=>{const e=e=>{wt(e)&&re()},t=e=>{var t;wt(e)&&re(),t=e,["mod","\\"].every((e=>yt[e]?t[yt[e]]:t.key===e.toUpperCase()))&&re()};return window.addEventListener("keydown",t),window.addEventListener("keyup",e),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",e)}}),[re]);const[se,ce]=U(null),[{navigatorEnabled:le,toggleNavigator:de},ue]=tn({unstable_navigator:d}),pe=T(P.id);$((()=>{P.rev&&pe.current&&P.id!==pe.current&&S({},{rev:void 0}),pe.current=P.id}));const ye=T(),we=O((e=>{if(C({type:sn}),y)return ye.current=window.setTimeout(e,300),void y.send("overlays","presentation/refresh",{source:"manual",livePreviewEnabled:"connected"===q||"connected"===B});e()}),[y,B,q]),be=Z(),ke=O((({id:e,type:t,path:n})=>{if(x.current.url)return{title:x.current.title||x.current.url,name:"edit",params:{id:e,path:n,type:t,inspect:fe,workspace:be.name,mode:me,preview:P.preview}}}),[P.preview,be.name]);return r(i,{children:[n(on,{deskParams:E,devMode:m,name:l,params:P,navigate:S,children:n(en,{navigate:S,children:n(rn,{params:P,children:n(Bn,{height:"fill",children:r(Yt,{children:[n(ue,{}),n(Tt,{id:"preview",minWidth:325,defaultSize:le?50:75,order:3,children:n(s,{direction:"column",flex:1,height:"fill",ref:ce,children:n(z,{element:se,children:n(On,{dispatch:C,iframe:I.iframe,initialUrl:f,loadersConnection:B,navigatorEnabled:le,onPathChange:te,onRefresh:we,openPopup:Q,overlaysConnection:_,params:P,perspective:I.perspective,ref:g,targetOrigin:v,toggleNavigator:de,toggleOverlay:re,viewport:I.viewport,visualEditing:I.visualEditing})})})}),n(Wt,{order:4}),n(Tt,{id:"content",minWidth:325,order:5,children:n(ge,{documentId:P.id,setDisplayedDocument:oe,children:n(ae,{getIntent:ke,children:n($t,{refs:D,deskParams:E,documentId:P.id,documentType:P.type,onDeskParams:ne,onFocusPath:ee,previewUrl:P.preview})})})})]})})})})}),y&&n(N,{children:n(Fn,{channel:y,liveQueries:b,perspective:I.perspective,liveDocument:ie,documentsOnPage:D})}),y&&P.id&&P.type&&n(N,{children:n(Vn,{channel:y,id:P.id,type:P.type,loadersConnection:B,previewKitConnection:q})})]})}export{Kn as default};//# sourceMappingURL=PresentationTool.js.map
`;function qn(e){var t;const{previewUrl:a,components:c}=null!=(t=e.tool.options)?t:{},l=e.tool.name||ve,{unstable_navigator:d}=c||{},{navigate:u,state:p}=Y(),h=V(Object.fromEntries(p._searchParams||[])),f=Nn(a||"/",l,h.preview||null),[m]=$((()=>{var t;const n=null==(t=e.tool.options)?void 0:t.devMode;return"function"==typeof n?n():"boolean"==typeof n?n:typeof window<"u"&&"localhost"===window.location.hostname})),v=U((()=>f.origin),[f.origin]),g=T(null),[y,w]=$(),[b,x]=$({}),P=T({title:void 0,url:void 0}),{navigate:E,params:k,structureParams:S}=Mn({initialPreviewUrl:f,routerNavigate:u,routerState:p,routerSearchParams:h,frameStateRef:P}),[I,C]=M(hn,{perspective:k.perspective,viewport:k.viewport},bn),[O,L]=function(e,t){if("published"!==e&&"previewDrafts"!==e)throw new Error(`Invalid perspective: ${e}`);const[n,r]=$({}),[i,o]=$({}),a=T(""),s=R(((e,n,i=[])=>{const s=i.filter((e=>"_projectId"in e&&e._projectId?(Tn||(console.warn("Cross dataset references are not supported yet, ignoring source document",e),Tn=!0),!1):e));("published"===n?r:o)((n=>{const r={};for(const e of s)r[e._id]=e;if(a.current!==t.current.url)return a.current=t.current.url,{[e]:r};const i=n[e];return Ae(i,r)?n:{...n,[e]:r}}))}),[t]);return[U((()=>{const t=Object.values("published"===e?n:i).reduce(((e,t)=>(Object.values(t).forEach((t=>{e[t._id]=t})),e)),{});return Object.values(t)}),[e,i,n]),s]}(I.perspective,P),D=H(),A=X();j((()=>{(I.perspective!==k.perspective||I.viewport!==k.viewport)&&E({},{perspective:"previewDrafts"===I.perspective?void 0:I.perspective,viewport:"desktop"===I.viewport?void 0:I.viewport})}),[k.perspective,I.perspective,E,I.viewport,k.viewport]);const[_,F]=$("connecting"),[B,K]=$("connecting"),[q,G]=$("connecting"),[J]=$((()=>new Set)),Q=R((e=>{const t=window.open(e,"_blank");t&&J.add(t)}),[J]);j((()=>{if(J.size&&y)for(const e of J)e&&"closed"in e&&!e.closed&&y.addSource(e)}),[y,J,J.size]),j((()=>{var e;const t=null==(e=g.current)?void 0:e.contentWindow;if(!t)return;const n=function(e){const{destroy:t,send:n}=Qe(e),r=new Set,i=new WeakMap,o=new Set;return{destroy:()=>{t();for(const e of o)e()},send:(e,...t)=>{n(e,...t);for(const n of r)n&&"closed"in n&&!n.closed&&i.has(n)&&i.get(n)(e,...t)},addSource(t){if(r.has(t))return;if(!("closed"in t))throw console.warn("Source is unsupported",{source:t}),new Error("Source is unsupported");if(t.closed)throw new Error("Source is closed");const{send:n,destroy:a}=Qe({...e,target:t,connectTo:e.connectTo.map((e=>{const{onStatusUpdate:t,onEvent:n,...r}=e;return{...r,onEvent:n?(...e)=>{const[t]=e;if("preview-kit/documents"!==t&&"overlay/navigate"!==t&&"loader/documents"!==t)return n(...e)}:void 0}}))});o.add(a),i.set(t,n),r.add(t)}}}({id:"presentation",target:t,targetOrigin:v,connectTo:[{id:"overlays",heartbeat:!0,onStatusUpdate:F,onEvent(e,t){if("visual-editing/focus"!==e&&"overlay/focus"!==e||!("id"in t))if("visual-editing/navigate"===e||"overlay/navigate"===e){const{title:e,url:n}=t;P.current.url!==n&&E({},{preview:n}),P.current={title:e,url:n}}else"visual-editing/meta"===e?P.current.title=t.title:"visual-editing/toggle"===e||"overlay/toggle"===e?C({type:pn,enabled:t.enabled}):"visual-editing/documents"===e?L("visual-editing",t.perspective,t.documents):"visual-editing/refreshing"===e&&"manual"===t.source?clearTimeout(ye.current):"visual-editing/refreshing"===e&&"mutation"===t.source?C({type:cn}):"visual-editing/refreshed"===e&&C({type:sn});else E({type:t.type,id:t.id,path:t.path})}},{id:"loaders",heartbeat:!0,onStatusUpdate:K,onEvent(e,t){if("loader/documents"===e&&t.projectId===D&&t.dataset===A)L("loaders",t.perspective,t.documents);else if("loader/query-listen"===e&&t.projectId===D&&t.dataset===A){if("number"==typeof t.heartbeat&&t.heartbeat<he)throw new Error(`Loader query listen heartbeat interval must be at least ${he}ms`);x((e=>{var n;return{...e,[yt(t.query,t.params)]:{perspective:t.perspective,query:t.query,params:t.params,receivedAt:Date.now(),heartbeat:null!=(n=t.heartbeat)&&n}}}))}}},{id:"preview-kit",heartbeat:!0,onStatusUpdate:G,onEvent(e,t){"preview-kit/documents"===e&&t.projectId===D&&t.dataset===A&&L("preview-kit",t.perspective,t.documents)}}]});return w(n),()=>{n.destroy(),w(void 0)}}),[A,D,L,E,v]),j((()=>{const e=setInterval((()=>W((()=>x((e=>{if(Object.keys(e).length<1)return e;const t=Date.now();if(!Object.values(e).some((e=>!1!==e.heartbeat&&t>e.receivedAt+e.heartbeat)))return e;const n={};for(const[r,i]of Object.entries(e))!1!==i.heartbeat&&t>i.receivedAt+i.heartbeat||(n[r]=i);return n}))))),he);return()=>clearInterval(e)}),[]);const ee=R((e=>{E({path:o.toString(e)},{},!0)}),[E]),te=R((e=>{const t=new URL(e,f.origin),n=t.pathname+t.search;t.origin===f.origin&&n!==k.preview&&E({},{preview:n})}),[f,k,E]),ne=R((e=>{E({},e)}),[E]);j((()=>{null==y||y.send("overlays","presentation/perspective",{perspective:I.perspective})}),[y,I.perspective]),j((()=>{k.id&&k.path?null==y||y.send("overlays","presentation/focus",{id:k.id,path:k.path}):null==y||y.send("overlays","presentation/blur",void 0)}),[y,k.id,k.path]),j((()=>{P.current.url&&k.preview&&P.current.url!==k.preview&&(P.current.url=k.preview,"connected"!==_&&g.current?g.current.src=`${v}${k.preview}`:null==y||y.send("overlays","presentation/navigate",{url:k.preview,type:"replace"}))}),[y,_,v,k.preview]);const re=R((()=>null==y?void 0:y.send("overlays","presentation/toggleOverlay",void 0)),[y]),[ie,oe]=$(null);j((()=>{const e=e=>{bt(e)&&re()},t=e=>{var t;bt(e)&&re(),t=e,["mod","\\"].every((e=>wt[e]?t[wt[e]]:t.key===e.toUpperCase()))&&re()};return window.addEventListener("keydown",t),window.addEventListener("keyup",e),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",e)}}),[re]);const[se,ce]=$(null),[{navigatorEnabled:le,toggleNavigator:de},ue]=nn({unstable_navigator:d}),pe=T(k.id);j((()=>{k.rev&&pe.current&&k.id!==pe.current&&E({},{rev:void 0}),pe.current=k.id}));const ye=T(),we=R((e=>{if(C({type:cn}),y)return ye.current=window.setTimeout(e,300),void y.send("overlays","presentation/refresh",{source:"manual",livePreviewEnabled:"connected"===q||"connected"===B});e()}),[y,B,q]),be=Z(),xe=R((({id:e,type:t,path:n})=>{if(P.current.url)return{title:P.current.title||P.current.url,name:"edit",params:{id:e,path:n,type:t,inspect:fe,workspace:be.name,mode:me,preview:k.preview}}}),[k.preview,be.name]);return r(i,{children:[n(an,{devMode:m,name:l,navigate:E,params:k,structureParams:S,children:n(tn,{navigate:E,children:n(on,{params:k,children:n(Kn,{height:"fill",children:r(en,{children:[n(ue,{}),n(At,{id:"preview",minWidth:325,defaultSize:le?50:75,order:3,children:n(s,{direction:"column",flex:1,height:"fill",ref:ce,children:n(z,{element:se,children:n(Un,{dispatch:C,iframe:I.iframe,initialUrl:f,loadersConnection:B,navigatorEnabled:le,onPathChange:te,onRefresh:we,openPopup:Q,overlaysConnection:_,params:k,perspective:I.perspective,ref:g,targetOrigin:v,toggleNavigator:de,toggleOverlay:re,viewport:I.viewport,visualEditing:I.visualEditing})})})}),n(Mt,{order:4}),n(At,{id:"content",minWidth:325,order:5,children:n(ge,{documentId:k.id,setDisplayedDocument:oe,children:n(ae,{getIntent:xe,children:n(Lt,{documentId:k.id,documentType:k.type,onFocusPath:ee,onStructureParams:ne,previewUrl:k.preview,refs:O,structureParams:S})})})})]})})})})}),y&&n(N,{children:n(Vn,{channel:y,liveQueries:b,perspective:I.perspective,liveDocument:ie,documentsOnPage:O})}),y&&k.id&&k.type&&n(N,{children:n(Bn,{channel:y,id:k.id,type:k.type,loadersConnection:B,previewKitConnection:q})})]})}export{qn as default};//# sourceMappingURL=PresentationTool.js.map

@@ -13,15 +13,2 @@ /// <reference types="react" />

export declare interface DeskDocumentPaneParams {
inspect?: string
path?: string
rev?: string
since?: string
template?: string
templateParams?: string
view?: string
pathKey?: string
instruction?: string
comment?: string
}
export declare interface DocumentLocation {

@@ -97,3 +84,3 @@ title: string

extends PresentationStateParams,
DeskDocumentPaneParams {
StructureDocumentPaneParams {
id?: string

@@ -122,3 +109,3 @@ preview?: string

export declare interface PresentationSearchParams
extends DeskDocumentPaneParams {
extends StructureDocumentPaneParams {
preview?: string

@@ -146,2 +133,15 @@ perspective?: string

export declare interface StructureDocumentPaneParams {
inspect?: string
path?: string
rev?: string
since?: string
template?: string
templateParams?: string
view?: string
pathKey?: string
instruction?: string
comment?: string
}
export declare function usePresentationNavigate(): PresentationNavigateContextValue

@@ -148,0 +148,0 @@

{
"name": "@sanity/presentation",
"version": "1.12.1",
"version": "1.12.2",
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/presentation#readme",

@@ -100,5 +100,5 @@ "bugs": {

"dependencies": {
"@sanity/icons": "^2.11.4",
"@sanity/preview-url-secret": "^1.6.5",
"@sanity/ui": "^2.0.12",
"@sanity/icons": "^2.11.7",
"@sanity/preview-url-secret": "^1.6.6",
"@sanity/ui": "^2.0.14",
"@sanity/uuid": "3.0.2",

@@ -116,9 +116,9 @@ "@types/lodash.isequal": "^4.5.8",

"@sanity/channels": "0.4.0",
"@sanity/client": "^6.15.7",
"@sanity/pkg-utils": "^5.1.4",
"@sanity/visual-editing-helpers": "0.6.2",
"happy-dom": "^14.2.0",
"@sanity/client": "^6.15.10",
"@sanity/pkg-utils": "^5.1.11",
"@sanity/visual-editing-helpers": "0.6.3",
"happy-dom": "^14.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sanity": "^3.35.1",
"sanity": "^3.36.4",
"styled-components": "6.1.8",

@@ -129,3 +129,3 @@ "typescript": "5.4.2",

"peerDependencies": {
"@sanity/client": "^6.15.7"
"@sanity/client": "^6.15.10"
},

@@ -132,0 +132,0 @@ "engines": {

import type { ContentSourceMap } from '@sanity/client'
import LRUCache from 'mnemonist/lru-cache-with-delete'
import { SanityDocument } from 'sanity'
import type { SanityDocument } from 'sanity'
import { expect, test } from 'vitest'

@@ -5,0 +5,0 @@

import { createContext } from 'react'
import {
DeskDocumentPaneParams,
PresentationNavigate,
PresentationParams,
StructureDocumentPaneParams,
} from './types'
export interface PresentationContextValue {
deskParams: DeskDocumentPaneParams
devMode: boolean

@@ -15,2 +14,3 @@ name: string

params: PresentationParams
structureParams: StructureDocumentPaneParams
}

@@ -17,0 +17,0 @@

@@ -65,3 +65,3 @@ import type { ClientPerspective, QueryParams } from '@sanity/client'

export interface DeskDocumentPaneParams {
export interface StructureDocumentPaneParams {
inspect?: string

@@ -85,3 +85,3 @@ path?: string

extends PresentationStateParams,
DeskDocumentPaneParams {
StructureDocumentPaneParams {
id?: string

@@ -93,3 +93,3 @@ preview?: string

export interface PresentationSearchParams extends DeskDocumentPaneParams {
export interface PresentationSearchParams extends StructureDocumentPaneParams {
preview?: string

@@ -96,0 +96,0 @@ perspective?: string

@@ -8,3 +8,2 @@ import { MutableRefObject, useEffect, useMemo, useRef } from 'react'

import {
DeskDocumentPaneParams,
FrameState,

@@ -15,2 +14,3 @@ PresentationNavigate,

PresentationStateParams,
StructureDocumentPaneParams,
} from './types'

@@ -41,5 +41,5 @@

}): {
deskParams: DeskDocumentPaneParams
navigate: PresentationNavigate
params: PresentationParams
structureParams: StructureDocumentPaneParams
} {

@@ -72,3 +72,3 @@ const params = useMemo<PresentationParams>(() => {

const deskParams = useMemo<DeskDocumentPaneParams>(() => {
const structureParams = useMemo<StructureDocumentPaneParams>(() => {
const pruned = pruneObject({

@@ -161,3 +161,3 @@ inspect: params.inspect,

return {
deskParams,
structureParams,
navigate,

@@ -164,0 +164,0 @@ params,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc