Socket
Socket
Sign inDemoInstall

@sanity/presentation

Package Overview
Dependencies
Maintainers
55
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/presentation - npm Package Compare versions

Comparing version 1.16.2 to 1.16.3

src/RevisionSwitcher.tsx

2

dist/_chunks-es/BroadcastDisplayedDocument.js

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

import{jsx as e}from"react/jsx-runtime";import{memo as t,useEffect as l}from"react";import{useDocumentPane as u}from"sanity/structure";import{d as r}from"./index.js";import{u as i}from"./DisplayedDocumentBroadcaster.js";var s=t((function(t){const u=i(),s=r(!1);return l((()=>{if("published"!==(null==s?void 0:s.perspective)){const e=setTimeout((()=>null==u?void 0:u(t.value)),10);return()=>clearTimeout(e)}}),[null==s?void 0:s.perspective,t.value,u]),"published"===(null==s?void 0:s.perspective)?e(o,{params:s,setDisplayedDocument:u,value:t.value}):null}));function o(e){const{params:t,setDisplayedDocument:r,value:i}=e,{editState:s}=u();return l((()=>{if(null!=s&&s.published&&(null==t||!t.prefersLatestPublished)||null==s||!s.published){const e=setTimeout((()=>null==r?void 0:r(i)),100);return()=>clearTimeout(e)}}),[null==s?void 0:s.published,null==t?void 0:t.prefersLatestPublished,r,i]),null}export{s as default};//# sourceMappingURL=BroadcastDisplayedDocument.js.map
import{memo as e,useEffect as r}from"react";import{d as t}from"./index.js";import{u as o}from"./DisplayedDocumentBroadcaster.js";var u=e((function(e){const u=o(),a=t(!1);return r((()=>{const r=setTimeout((()=>null==u?void 0:u(e.value)),10);return()=>clearTimeout(r)}),[null==a?void 0:a.perspective,e.value,u]),null}));export{u as default};//# sourceMappingURL=BroadcastDisplayedDocument.js.map

@@ -1,2 +0,2 @@

import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useMemo as o,useEffect as r,createContext as s,useContext as c,useCallback as a,createElement as l,useRef as d,useLayoutEffect as u,lazy as p,Suspense as m}from"react";import{useDocumentStore as f,isRecord as h,isReference as v,defineLocaleResourceBundle as y,useTranslation as g,defineDocumentFieldAction as w,useWorkspace as b,pathToString as _,getPublishedId as P,definePlugin as j,isDocumentSchemaType as x}from"sanity";import{ComposeIcon as I,InfoOutlineIcon as T,ChevronRightIcon as S,DesktopIcon as O,WarningOutlineIcon as k,ErrorOutlineIcon as z,MasterDetailIcon as D}from"@sanity/icons";import{Card as A,Flex as E,Box as $,Text as C,Spinner as B,Stack as R,rem as U}from"@sanity/ui";import{styled as H}from"styled-components";import L from"lodash.get";import{Observable as N,switchMap as M,isObservable as Q,from as q,map as F,of as G,combineLatest as J,mergeAll as K,scan as V}from"rxjs";import{useIntentLink as W,useRouter as X,encodeJsonParams as Y,route as Z}from"sanity/router";import{uuid as ee}from"@sanity/uuid";const te=I,ne="presentation",ie="Presentation",oe="sanity/structure/comments",re="presentation",se=3e3,ce="2023-10-16",ae=1e3,le=100,de=2048;function ue(e,t,n){return{...e,[t]:n}}function pe(e={}){return t=>new N((e=>t.subscribe(e))).pipe(M((t=>{const n=(i=t,Object.keys(i)).map((e=>{const n=t[e];return Q(n)?q(n).pipe(F((t=>[e,t]))):G([e,n])}));var i;return e.wait?J(n).pipe(F((e=>e.reduce(((e,[t,n])=>ue(e,t,n)),{})))):q(n).pipe(K(),V(((e,[t,n])=>ue(e,t,n)),{}))})))}const me={locations:[]};function fe(e,t,n){if(!e||"object"!=typeof e)return G(e);const i=function(e){return v(e)?e._ref:"_id"in e?e._id:void 0}(e),o=function(e,t){const n=e?{...t,_id:e}:{...t};return"reference"===n._type&&(delete n._type,delete n._ref,delete n._weak,delete n._dataset,delete n._projectId,delete n._strengthenOnPublish),n}(i,e),r=t.filter((e=>!(e[0]in o)));if(i&&r.length){return function(e,t,n){const i=`*[_id==$id][0]{${t.join(", ")}}`,o={id:e};return n.listenQuery(i,o,{perspective:"previewDrafts"})}(i,[...new Set(r.map((e=>e[0])))],n).pipe(M((e=>e?fe(e,t,n):G(null))))}const s={};t.forEach((e=>{const[t,...n]=e;s[t]||(s[t]=[]),s[t].push(n)}));const c=Object.keys(s).reduce(((t,i)=>{const o=s[i].filter((e=>e.length>0));return 0===o.length?t[i]=h(e)?e[i]:void 0:t[i]=fe(e[i],o,n),t}),o);return G(c).pipe(pe({wait:!0}))}function he(e){const{id:t,resolvers:n,type:s}=e,c=f(),[a,l]=i(me),d=n&&("function"==typeof n?n:n[s]),[u,p]=i(d?"resolving":"empty"),m=o((()=>{if(d){if("function"==typeof d){const e=d({id:t,type:s},{documentStore:c});return Q(e)?e:G(e)}return"select"in d&&"resolve"in d?function(e,t,n){if(!t)return G(void 0);const{id:i,type:o}=e;if("function"==typeof t){const e=t({id:i,type:o},{documentStore:n});return Q(e)?e:G(e)}if("select"in t&&"resolve"in t){const{select:e}=t;return fe({_type:"reference",_ref:i},Object.values(e).map((e=>String(e).split(".")))||[],n).pipe(F((t=>Object.keys(e).reduce(((n,i)=>(n[i]=L(t,e[i]),n)),{}))),F(t.resolve))}return G(t)}({id:t,type:s},d,c):G(d)}}),[c,t,d,s]);return r((()=>{const e=null==m?void 0:m.subscribe((e=>{l(e||me),p(e?"resolved":"empty")}));return()=>null==e?void 0:e.unsubscribe()}),[m]),{state:a,status:u}}const ve="presentation",ye=y({locale:"en-US",namespace:ve,resources:()=>import("./resources.js")}),ge=s(null);function we(){const e=c(ge);if(!e)throw new Error("Presentation context is missing");return e}const be={positive:T,caution:k,critical:z};function _e(o){const{documentId:r,isResolving:s,options:d,schemaType:u,showPresentationTitle:p}=o,{locations:m,message:f,tone:h}=o.state,v=(null==m?void 0:m.length)||0,{t:y}=g(ve),w=c(ge),[b,_]=i(!1),P=a((()=>{v&&_((e=>!e))}),[v]),j=s?y("locations-banner.resolving.text"):f||y("locations-banner.locations-count",{count:v});return e(A,{padding:1,radius:2,border:!0,tone:h,children:t("div",{style:{margin:-1},children:[!m&&t(E,{align:"flex-start",gap:3,padding:3,children:[h&&e($,{flex:"none",children:e(C,{size:1,children:l(be[h])})}),e($,{flex:1,children:t(C,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||ie," · "]}),j]})})]}),m&&t(n,{children:[e(A,{as:v?"button":void 0,onClick:P,padding:3,radius:1,tone:"inherit",children:t(E,{gap:3,children:[e($,{flex:"none",children:s?e(B,{size:1}):e(C,{size:1,children:0===v?e(T,{}):e(S,{style:{transform:`rotate(${b?"90deg":0})`,transition:"transform 100ms ease-in-out"}})})}),e($,{flex:1,children:t(C,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||ie," · "]}),j]})})]})}),e(R,{hidden:!b,marginTop:1,space:1,children:m.map(((t,n)=>e(Pe,{active:(d.name||ne)===(null==w?void 0:w.name)&&t.href===(null==w?void 0:w.params.preview),documentId:r,documentType:u.name,node:t,toolName:d.name||ne},n)))})]})]})})}function Pe(n){const{documentId:i,documentType:o,node:r,active:s,toolName:d}=n,u=c(ge),p=d===function(){try{return we().name}catch{return}}(),m=null==u?void 0:u.navigate,f=W({intent:"edit",params:{id:i,type:o,mode:"presentation",presentation:d,...null==u?void 0:u.structureParams,preview:r.href}}),h=a((()=>{null==m||m({},{preview:r.href})}),[r.href,m]);return l(A,{...p?{}:f,as:"a",key:r.href,onClick:p?h:f.onClick,padding:3,radius:1,pressed:s,tone:"inherit"},t(E,{gap:3,children:[e($,{flex:"none",children:e(C,{size:1,children:e(O,{})})}),t(R,{flex:1,space:2,children:[e(C,{size:1,weight:"medium",children:r.title}),e(C,{muted:!0,size:1,textOverflow:"ellipsis",children:r.href})]})]}))}const je=s(null),xe=H(R)`
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useMemo as r,useEffect as o,createContext as s,useContext as a,useCallback as c,createElement as l,useRef as d,useLayoutEffect as u,lazy as p,Suspense as m}from"react";import{useDocumentStore as h,isRecord as f,isReference as v,defineLocaleResourceBundle as y,useTranslation as g,defineDocumentFieldAction as w,useWorkspace as b,pathToString as _,getPublishedId as P,definePlugin as j,isDocumentSchemaType as x}from"sanity";import{ComposeIcon as I,InfoOutlineIcon as T,ChevronRightIcon as S,DesktopIcon as O,WarningOutlineIcon as k,ErrorOutlineIcon as z,MasterDetailIcon as D}from"@sanity/icons";import{Card as A,Flex as E,Box as $,Text as C,Spinner as B,Stack as R,rem as U}from"@sanity/ui";import{styled as H}from"styled-components";import L from"lodash.get";import{Observable as N,switchMap as M,isObservable as Q,from as q,map as F,of as G,combineLatest as J,mergeAll as K,scan as V}from"rxjs";import{useIntentLink as W,useRouter as X,encodeJsonParams as Y,route as Z}from"sanity/router";import{uuid as ee}from"@sanity/uuid";const te=I,ne="presentation",ie="Presentation",re="sanity/structure/comments",oe="presentation",se=3e3,ae="2023-10-16",ce=1e3,le=100,de=2048;function ue(e,t,n){return{...e,[t]:n}}function pe(e={}){return t=>new N((e=>t.subscribe(e))).pipe(M((t=>{const n=(i=t,Object.keys(i)).map((e=>{const n=t[e];return Q(n)?q(n).pipe(F((t=>[e,t]))):G([e,n])}));var i;return e.wait?J(n).pipe(F((e=>e.reduce(((e,[t,n])=>ue(e,t,n)),{})))):q(n).pipe(K(),V(((e,[t,n])=>ue(e,t,n)),{}))})))}const me={locations:[]};function he(e,t,n){if(!e||"object"!=typeof e)return G(e);const i=function(e){return v(e)?e._ref:"_id"in e?e._id:void 0}(e),r=function(e,t){const n=e?{...t,_id:e}:{...t};return"reference"===n._type&&(delete n._type,delete n._ref,delete n._weak,delete n._dataset,delete n._projectId,delete n._strengthenOnPublish),n}(i,e),o=t.filter((e=>!(e[0]in r)));if(i&&o.length){return function(e,t,n){const i=`*[_id==$id][0]{${t.join(", ")}}`,r={id:e};return n.listenQuery(i,r,{perspective:"previewDrafts"})}(i,[...new Set(o.map((e=>e[0])))],n).pipe(M((e=>e?he(e,t,n):G(null))))}const s={};t.forEach((e=>{const[t,...n]=e;s[t]||(s[t]=[]),s[t].push(n)}));const a=Object.keys(s).reduce(((t,i)=>{const r=s[i].filter((e=>e.length>0));return 0===r.length?t[i]=f(e)?e[i]:void 0:t[i]=he(e[i],r,n),t}),r);return G(a).pipe(pe({wait:!0}))}function fe(e){const{id:t,resolvers:n,type:s}=e,a=h(),[c,l]=i(me),d=n&&("function"==typeof n?n:n[s]),[u,p]=i(d?"resolving":"empty"),m=r((()=>{if(d){if("function"==typeof d){const e=d({id:t,type:s},{documentStore:a});return Q(e)?e:G(e)}return"select"in d&&"resolve"in d?function(e,t,n){const{select:i}=t;return he({_type:"reference",_ref:e},Object.values(i).map((e=>String(e).split(".")))||[],n).pipe(F((e=>Object.keys(i).reduce(((t,n)=>(t[n]=L(e,i[n]),t)),{}))),F(t.resolve))}(t,d,a):G(d)}}),[a,t,d,s]);return o((()=>{const e=null==m?void 0:m.subscribe((e=>{l(e||me),p(e?"resolved":"empty")}));return()=>null==e?void 0:e.unsubscribe()}),[m]),{state:c,status:u}}const ve="presentation",ye=y({locale:"en-US",namespace:ve,resources:()=>import("./resources.js")}),ge=s(null);function we(){const e=a(ge);if(!e)throw new Error("Presentation context is missing");return e}const be={positive:T,caution:k,critical:z};function _e(r){const{documentId:o,isResolving:s,options:d,schemaType:u,showPresentationTitle:p}=r,{locations:m,message:h,tone:f}=r.state,v=(null==m?void 0:m.length)||0,{t:y}=g(ve),w=a(ge),[b,_]=i(!1),P=c((()=>{v&&_((e=>!e))}),[v]),j=s?y("locations-banner.resolving.text"):h||y("locations-banner.locations-count",{count:v});return e(A,{padding:1,radius:2,border:!0,tone:f,children:t("div",{style:{margin:-1},children:[!m&&t(E,{align:"flex-start",gap:3,padding:3,children:[f&&e($,{flex:"none",children:e(C,{size:1,children:l(be[f])})}),e($,{flex:1,children:t(C,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||ie," · "]}),j]})})]}),m&&t(n,{children:[e(A,{as:v?"button":void 0,onClick:P,padding:3,radius:1,tone:"inherit",children:t(E,{gap:3,children:[e($,{flex:"none",children:s?e(B,{size:1}):e(C,{size:1,children:0===v?e(T,{}):e(S,{style:{transform:`rotate(${b?"90deg":0})`,transition:"transform 100ms ease-in-out"}})})}),e($,{flex:1,children:t(C,{size:1,weight:"medium",children:[p&&t(n,{children:[d.title||ie," · "]}),j]})})]})}),e(R,{hidden:!b,marginTop:1,space:1,children:m.map(((t,n)=>e(Pe,{active:(d.name||ne)===(null==w?void 0:w.name)&&t.href===(null==w?void 0:w.params.preview),documentId:o,documentType:u.name,node:t,toolName:d.name||ne},n)))})]})]})})}function Pe(n){const{documentId:i,documentType:r,node:o,active:s,toolName:d}=n,u=a(ge),p=d===function(){try{return we().name}catch{return}}(),m=null==u?void 0:u.navigate,h=W({intent:"edit",params:{id:i,type:r,mode:"presentation",presentation:d,...null==u?void 0:u.structureParams,preview:o.href}}),f=c((()=>{null==m||m({},{preview:o.href})}),[o.href,m]);return l(A,{...p?{}:h,as:"a",key:o.href,onClick:p?f:h.onClick,padding:3,radius:1,pressed:s,tone:"inherit"},t(E,{gap:3,children:[e($,{flex:"none",children:e(C,{size:1,children:e(O,{})})}),t(R,{flex:1,space:2,children:[e(C,{size:1,weight:"medium",children:o.title}),e(C,{muted:!0,size:1,textOverflow:"ellipsis",children:o.href})]})]}))}const je=s(null),xe=H(R)`
min-height: ${U(42)};

@@ -7,2 +7,2 @@

}
`;function Ie(t){var n;const{documentId:i,options:o,schemaType:r}=t,s=c(je),{state:a,status:l}=he({id:i,resolvers:(null==(n=o.resolve)?void 0:n.locations)||o.locate,type:r.name});if(s&&s.options[0]!==o||"empty"===l)return null;const d=(null==s?void 0:s.options)||[];return e(xe,{marginBottom:5,space:5,children:e(R,{space:2,children:d.map(((t,n)=>e(_e,{documentId:i,isResolving:"resolving"===l,options:t,schemaType:r,showPresentationTitle:d.length>1,state:a},n)))})})}function Te(t){const{children:n,options:r}=t,s=c(je),l=null==s?void 0:s.register,[p,m]=i((()=>[])),f=a((e=>l?l(e):(m((t=>[e].concat(t))),()=>{m((t=>t.filter((t=>t!==e))))})),[l]),h=d(f);h.current=f;const v=o((()=>({options:(null==s?void 0:s.options)||p,register:f})),[p,s,f]);return u((()=>h.current(r)),[r]),e(je.Provider,{value:v,children:n})}const Se=w({name:"presentation/openInStructure",useAction({documentId:e,documentType:t,path:n}){const i=b(),{navigateIntent:r}=X(),s=c(ge),a=o((()=>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=>h(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:!s||n.length>0||!a,icon:(null==a?void 0:a.icon)||D,title:`Open in ${(null==a?void 0:a.title)||"Structure"}`,onAction(){r("edit",{id:e,type:t,mode:"structure",path:_(n)})},renderAsButton:!0}}});function Oe(e,t,n,i){const{id:o,mode:r,path:s,presentation:c,type:a,...l}=t;return"edit"===e&&o?{type:a||"*",id:P(o),path:s,_searchParams:Object.entries(l)}:"create"===e?(l.preview=l.preview||new URLSearchParams(window.location.search).get("preview")||"/",i&&"object"==typeof i&&(l.templateParams=Y(i)),{type:a||"*",id:o||ee(),_searchParams:Object.entries(l)}):{intent:e,params:t,payload:i}}const ke=Z.create("/",{__unsafe_disableScopedSearchParams:!0},[Z.intents("/intent"),Z.create(":type",[Z.create(":id",[Z.create(":path")])])]),ze=p((()=>import("./PresentationTool.js"))),De=p((()=>import("./BroadcastDisplayedDocument.js")));function Ae(e){return e}function Ee(e){return e}const $e=j((n=>{var i;const o=n.name||ne;"locate"in n&&console.warn("Presentation’s `locate` option is deprecated. Use `resolve.locations` instead.");const r=!!(null!=(i=n.resolve)&&i.locations||n.locate);return{i18n:{bundles:[ye]},document:{unstable_fieldActions:e=>[...e.filter((e=>e.name!==Se.name)),Se]},form:{components:{input:function(i){const o=i.value,s=null!=o&&o._id?P(null==o?void 0:o._id):void 0;return x(i.schemaType)?t(Te,{options:n,children:[r&&s&&e(Ie,{documentId:s,options:n,schemaType:i.schemaType}),i.renderDefault(i),e(m,{children:e(De,{value:o},s)},"broadcast-displayed-document")]}):i.renderDefault(i)}}},tools:[{icon:n.icon||te,name:o,title:n.title,component:ze,options:n,canHandleIntent:(e,t)=>"create"===e?function(e){return"type"in e&&(!("presentation"in e)||e.presentation===o)&&(!("template"in e)||{template:!0})}(t):"edit"===e&&function(e){return"type"in e&&"id"in e&&(!("presentation"in e)||e.presentation===o)&&(!("mode"in e)||{mode:e.mode===re})}(t),getIntentState:Oe,router:ke}]}})),Ce=s(null);function Be(){const e=c(Ce);if(!e)throw new Error("Presentation navigate context is missing");return e}const Re=s(null);function Ue(e=!0){const t=c(Re);if(e&&!t)throw new Error("Presentation params context is missing");return t}export{ce as A,oe as C,ne as D,re as E,de as L,se as M,Ce as P,Re as a,ge as b,ae as c,Ue as d,le as e,Be as f,Ae as g,Ee as h,$e as i,ve as p,we as u};//# sourceMappingURL=index.js.map
`;function Ie(t){var n;const{documentId:i,options:r,schemaType:o}=t,s=a(je),{state:c,status:l}=fe({id:i,resolvers:(null==(n=r.resolve)?void 0:n.locations)||r.locate,type:o.name});if(s&&s.options[0]!==r||"empty"===l)return null;const d=(null==s?void 0:s.options)||[];return e(xe,{marginBottom:5,space:5,children:e(R,{space:2,children:d.map(((t,n)=>e(_e,{documentId:i,isResolving:"resolving"===l,options:t,schemaType:o,showPresentationTitle:d.length>1,state:c},n)))})})}function Te(t){const{children:n,options:o}=t,s=a(je),l=null==s?void 0:s.register,[p,m]=i((()=>[])),h=c((e=>l?l(e):(m((t=>[e].concat(t))),()=>{m((t=>t.filter((t=>t!==e))))})),[l]),f=d(h);f.current=h;const v=r((()=>({options:(null==s?void 0:s.options)||p,register:h})),[p,s,h]);return u((()=>f.current(o)),[o]),e(je.Provider,{value:v,children:n})}const Se=w({name:"presentation/openInStructure",useAction({documentId:e,documentType:t,path:n}){const i=b(),{navigateIntent:o}=X(),s=a(ge),c=r((()=>function(e,t,n){var i;const r=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"},{})}})),o=r.filter((e=>f(e.match)&&e.match.mode));return o.length>0?o[0].tool:null==(i=r.filter((e=>e.match))[0])?void 0:i.tool}(i.tools,e,t)),[e,t,i.tools]);return{type:"action",hidden:!s||n.length>0||!c,icon:(null==c?void 0:c.icon)||D,title:`Open in ${(null==c?void 0:c.title)||"Structure"}`,onAction(){o("edit",{id:e,type:t,mode:"structure",path:_(n)})},renderAsButton:!0}}});const Oe=["preview","perspective","viewport"];function ke(e,t,n,i){const{id:r,mode:o,path:s,presentation:a,type:c,...l}=t,d={...((null==n?void 0:n._searchParams)||[]).filter((([e])=>Oe.includes(e))).reduce(((e,[t,n])=>({...e,[t]:n})),{}),...l};return"edit"===e&&r?{type:c||"*",id:P(r),path:s,_searchParams:Object.entries(d)}:"create"===e?(d.preview=d.preview||new URLSearchParams(window.location.search).get("preview")||"/",i&&"object"==typeof i&&(d.templateParams=Y(i)),{type:c||"*",id:r||ee(),_searchParams:Object.entries(d)}):{intent:e,params:t,payload:i}}const ze=Z.create("/",{__unsafe_disableScopedSearchParams:!0},[Z.intents("/intent"),Z.create(":type",[Z.create(":id",[Z.create(":path")])])]),De=p((()=>import("./PresentationTool.js"))),Ae=p((()=>import("./BroadcastDisplayedDocument.js")));function Ee(e){return e}function $e(e){return e}const Ce=j((n=>{var i;const r=n.name||ne;"locate"in n&&console.warn("Presentation’s `locate` option is deprecated. Use `resolve.locations` instead.");const o=!!(null!=(i=n.resolve)&&i.locations||n.locate);return{i18n:{bundles:[ye]},document:{unstable_fieldActions:e=>[...e.filter((e=>e.name!==Se.name)),Se]},form:{components:{input:function(i){const r=i.value,s=null!=r&&r._id?P(null==r?void 0:r._id):void 0;return x(i.schemaType)?t(Te,{options:n,children:[o&&s&&e(Ie,{documentId:s,options:n,schemaType:i.schemaType}),i.renderDefault(i),e(m,{children:e(Ae,{value:r},s)},"broadcast-displayed-document")]}):i.renderDefault(i)}}},tools:[{icon:n.icon||te,name:r,title:n.title,component:De,options:n,canHandleIntent:(e,t)=>"create"===e?function(e){return"type"in e&&(!("presentation"in e)||e.presentation===r)&&(!("template"in e)||{template:!0})}(t):"edit"===e&&function(e){return"type"in e&&"id"in e&&(!("presentation"in e)||e.presentation===r)&&(!("mode"in e)||{mode:e.mode===oe})}(t),getIntentState:ke,router:ze}]}})),Be=s(null);function Re(){const e=a(Be);if(!e)throw new Error("Presentation navigate context is missing");return e}const Ue=s(null);function He(e=!0){const t=a(Ue);if(e&&!t)throw new Error("Presentation params context is missing");return t}export{ae as A,re as C,ne as D,oe as E,de as L,se as M,Be as P,Ue as a,ge as b,ce as c,He as d,le as e,Re as f,Ee as g,$e as h,Ce as i,ve as p,we as u};//# sourceMappingURL=index.js.map

@@ -1,6 +0,6 @@

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);import{jsx as n,jsxs as r,Fragment as i}from"react/jsx-runtime";import{studioPath as o}from"@sanity/client/csm";import{Button as a,Card as s,Flex as c,Container as l,Stack as d,Text as u,Inline as p,Box as m,Code as h,Label as f,ErrorBoundary as v,TextInput as g,MenuItem as y,useToast as b,usePrefersReducedMotion as w,TooltipDelayGroupProvider as P,Tooltip as x,Switch as k,MenuButton as E,Menu as S,Spinner as I,BoundaryElementProvider as _}from"@sanity/ui";import{createContext as z,useContext as D,useLayoutEffect as L,useMemo as C,useRef as O,useState as $,useCallback as j,useEffect as R,forwardRef as T,memo as U,createElement as A,startTransition as W,useReducer as M,Suspense as N,lazy as F}from"react";import{useTranslation as K,useUnique as V,getPublishedId as B,useDocumentPreviewStore as q,getPreviewStateObservable as G,useSchema as H,SanityDefaultPreview as J,getPreviewValueWithFallback as X,PreviewCard as Z,Translate as Q,CommentsIntentProvider as Y,useActiveWorkspace as ee,useClient as te,useCurrentUser as ne,Hotkeys as re,useProjectId as ie,useDataset as oe,useWorkspace as ae}from"sanity";import{StateLink as se,useRouter as ce,decodeJsonParams as le}from"sanity/router";import{styled as de}from"styled-components";import{p as ue,u as pe,P as me,a as he,b as fe,A as ve,M as ge,c as ye,C as be,E as we,D as Pe}from"./index.js";import{WarningOutlineIcon as xe,ResetIcon as ke,LaunchIcon as Ee,CopyIcon as Se,PanelLeftIcon as Ie,RefreshIcon as _e,ShareIcon as ze,ChevronDownIcon as De,CheckmarkIcon as Le,MobileDeviceIcon as Ce,DesktopIcon as Oe,EditIcon as $e,PublishIcon as je}from"@sanity/icons";import{PaneRouterContext as Re,PaneLayout as Te,StructureToolProvider as Ue,DocumentListPane as Ae,DocumentPane as We}from"sanity/structure";import{D as Me}from"./DisplayedDocumentBroadcaster.js";import{hasSecretSearchParams as Ne,setSecretSearchParams as Fe,withoutSecretSearchParams as Ke}from"@sanity/preview-url-secret/without-secret-search-params";import{motion as Ve,MotionConfig as Be,AnimatePresence as qe}from"framer-motion";import{createPreviewSecret as Ge}from"@sanity/preview-url-secret/create-secret";import He from"fast-deep-equal";import{match as Je}from"path-to-regexp";import{definePreviewUrl as Xe}from"@sanity/preview-url-secret/define-preview-url";import{suspend as Ze}from"suspend-react";let Qe;const Ye=new Uint8Array(16);function et(){if(!Qe&&(Qe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Qe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qe(Ye)}const tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1));var nt={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function rt(e,t,n){if(nt.randomUUID&&!t&&!e)return nt.randomUUID();const r=(e=e||{}).random||(e.rng||et)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return tt[e[t+0]]+tt[e[t+1]]+tt[e[t+2]]+tt[e[t+3]]+"-"+tt[e[t+4]]+tt[e[t+5]]+"-"+tt[e[t+6]]+tt[e[t+7]]+"-"+tt[e[t+8]]+tt[e[t+9]]+"-"+tt[e[t+10]]+tt[e[t+11]]+tt[e[t+12]]+tt[e[t+13]]+tt[e[t+14]]+tt[e[t+15]]}(r)}const it=1e3,ot=1e3,at=500,st=["handshake/syn","handshake/syn-ack","handshake/ack"],ct=e=>st.some((t=>t===e)),lt=({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 dt(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(ct(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(!ct(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(lt(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=rt(),e.interval=window.setInterval((()=>{l(e,"handshake/syn",{id:e.id})}),at)}(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:ot;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:rt(),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=rt();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}').`))}),it),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 ut,pt,mt,ht;function ft(e){var t,n,r;let i=typeof e;return"object"===i&&(i=null!=(r=e&&(null==(n=null==(t=Object.getPrototypeOf(e))?void 0:t.constructor)?void 0:n.name))?r:"null"),"string"===i?`"${e}"`:"number"===i||"bigint"===i||"boolean"===i?`${e}`:i}function vt(e,t,n,r,i){var o,a,s,c,l,d;const u=i&&"input"in i?i.input:n.value,p=null!=(o=null==i?void 0:i.expected)?o:e.expects,m=null!=(a=null==i?void 0:i.received)?a:ft(u),h={kind:e.kind,type:e.type,input:u,expected:p,received:m,message:`Invalid ${t}: ${p?`Expected ${p} but r`:"R"}eceived ${m}`,requirement:e.requirement,path:null==i?void 0:i.path,issues:null==i?void 0:i.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly,skipPipe:r.skipPipe},f="schema"===e.kind,v=null!=(d=null!=(l=null!=(c=null!=(s=e.message)?s:function(e,t){var n;return null==(n=null==ht?void 0:ht.get(e))?void 0:n.get(t)}(e.reference,h.lang))?c:f?(g=h.lang,null==mt?void 0:mt.get(g)):null)?l:r.message)?d:function(e){return null==pt?void 0:pt.get(e)}(h.lang);var g;v&&(h.message="function"==typeof v?v(h):v),f&&(n.typed=!1),n.issues?n.issues.push(h):n.issues=[h]}function gt(e){return"__proto__"!==e&&"prototype"!==e&&"constructor"!==e}var yt=class extends Error{constructor(e){super(e[0].message),t(this,"issues"),this.name="ValiError",this.issues=e}};function bt(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function wt(e){return{kind:"schema",type:"boolean",reference:wt,expects:"boolean",async:!1,message:e,_run(e,t){return"boolean"==typeof e.value?e.typed=!0:vt(this,"type",e,t),e}}}function Pt(e,t){return{kind:"schema",type:"object",reference:Pt,expects:"Object",async:!1,entries:e,message:t,_run(e,t){var n;const r=e.value;if(r&&"object"==typeof r){e.typed=!0,e.value={};for(const i in this.entries){const o=r[i],a=this.entries[i]._run({typed:!1,value:o},t);if(a.issues){const s={type:"object",origin:"value",input:r,key:i,value:o};for(const t of a.issues)t.path?t.path.unshift(s):t.path=[s],null==(n=e.issues)||n.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),(void 0!==a.value||i in r)&&(e.value[i]=a.value)}}else vt(this,"type",e,t);return e}}}function xt(e,...t){const n={kind:"schema",type:"optional",reference:xt,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(e,t){return void 0===e.value&&("default"in this&&(e.value=function(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped._run(e,t)}};return 0 in t&&(n.default=t[0]),n}function kt(e){return{kind:"schema",type:"string",reference:kt,expects:"string",async:!1,message:e,_run(e,t){return"string"==typeof e.value?e.typed=!0:vt(this,"type",e,t),e}}}function Et(e,t,n){const r=e._run({typed:!1,value:t},function(e){var t,n,r;return{lang:null!=(t=null==e?void 0:e.lang)?t:null==ut?void 0:ut.lang,message:null==e?void 0:e.message,abortEarly:null!=(n=null==e?void 0:e.abortEarly)?n:null==ut?void 0:ut.abortEarly,abortPipeEarly:null!=(r=null==e?void 0:e.abortPipeEarly)?r:null==ut?void 0:ut.abortPipeEarly,skipPipe:null==e?void 0:e.skipPipe}}(n));if(r.issues)throw new yt(r.issues);return r.value}const St=/^([A-Za-z]+):([0-9]+)$/,It=/^([A-Za-z]+):([0-9]+),([0-9]+)$/,_t=/^([A-Za-z]+):([a-z0-9]+)$/;const zt=function(...e){return{...e[0],pipe:e,_run(t,n){for(let r=0;r<e.length;r++){t=e[r]._run(t,n);const i=e[r+1];if(n.skipPipe||t.issues&&(n.abortEarly||n.abortPipeEarly||"schema"===(null==i?void 0:i.kind)||"transformation"===(null==i?void 0:i.kind))){t.typed=!1;break}}return t}}}(kt(),function e(t,n){return{kind:"validation",type:"min_length",reference:e,async:!1,expects:`>=${t}`,requirement:t,message:n,_run(e,t){return e.typed&&e.value.length<this.requirement&&vt(this,"length",e,t,{received:`${e.value.length}`}),e}}}(1)),Dt=xt(zt);function Lt(e,t){return`${e}-${"string"==typeof t?t:JSON.stringify(t)}`}Pt({baseUrl:zt,dataset:Dt,id:zt,path:zt,projectId:Dt,tool:Dt,type:Dt,workspace:Dt,isDraft:xt(kt())}),Pt({origin:zt,href:zt,data:xt(function e(t,n,r){return{kind:"schema",type:"record",reference:e,expects:"Object",async:!1,key:t,value:n,message:r,_run(e,t){var n,r;const i=e.value;if(i&&"object"==typeof i){e.typed=!0,e.value={};for(const o in i)if(gt(o)){const a=i[o],s=this.key._run({typed:!1,value:o},t);if(s.issues){const r={type:"record",origin:"key",input:i,key:o,value:a};for(const t of s.issues)t.path=[r],null==(n=e.issues)||n.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}const c=this.value._run({typed:!1,value:a},t);if(c.issues){const n={type:"record",origin:"value",input:i,key:o,value:a};for(const t of c.issues)t.path?t.path.unshift(n):t.path=[n],null==(r=e.issues)||r.push(t);if(e.issues||(e.issues=c.issues),t.abortEarly){e.typed=!1;break}}(!s.typed||!c.typed)&&(e.typed=!1),s.typed&&(e.value[s.value]=c.value)}}else vt(this,"type",e,t);return e}}}(kt(),function e(){return{kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,_run:e=>(e.typed=!0,e)}}()))});const Ct={alt:"altKey",ctrl:"ctrlKey",mod:typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function Ot(e){return"Alt"===e.key}function $t(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(e,r)}),t)}}const jt=z(null);jt.displayName="PanelsContext";const Rt=de.div`
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);import{jsx as n,jsxs as r,Fragment as i}from"react/jsx-runtime";import{studioPath as o}from"@sanity/client/csm";import{Button as a,Card as s,Flex as c,Container as l,Stack as d,Text as u,Inline as p,Box as m,Code as h,Label as f,ErrorBoundary as v,TextInput as g,MenuItem as y,useToast as w,usePrefersReducedMotion as b,TooltipDelayGroupProvider as x,Tooltip as P,Switch as k,MenuButton as E,Menu as S,Spinner as I,BoundaryElementProvider as _}from"@sanity/ui";import{createContext as z,useContext as D,useLayoutEffect as C,useMemo as $,useRef as O,useState as R,useCallback as j,useEffect as L,forwardRef as T,memo as U,createElement as A,startTransition as W,useReducer as M,Suspense as N,lazy as F}from"react";import{useTranslation as K,useUnique as V,getPublishedId as B,useDocumentPreviewStore as q,getPreviewStateObservable as G,useSchema as H,SanityDefaultPreview as J,getPreviewValueWithFallback as X,PreviewCard as Z,Translate as Q,CommentsIntentProvider as Y,useActiveWorkspace as ee,useClient as te,useCurrentUser as ne,Hotkeys as re,useEditState as ie,useProjectId as oe,useDataset as ae,useWorkspace as se}from"sanity";import{StateLink as ce,useRouter as le,decodeJsonParams as de}from"sanity/router";import{styled as ue}from"styled-components";import{p as pe,u as me,P as he,a as fe,b as ve,A as ge,M as ye,c as we,C as be,E as xe,D as Pe}from"./index.js";import{WarningOutlineIcon as ke,ResetIcon as Ee,LaunchIcon as Se,CopyIcon as Ie,PanelLeftIcon as _e,RefreshIcon as ze,ShareIcon as De,ChevronDownIcon as Ce,CheckmarkIcon as $e,MobileDeviceIcon as Oe,DesktopIcon as Re,EditIcon as je,PublishIcon as Le}from"@sanity/icons";import{PaneRouterContext as Te,PaneLayout as Ue,StructureToolProvider as Ae,DocumentListPane as We,DocumentPane as Me}from"sanity/structure";import{D as Ne}from"./DisplayedDocumentBroadcaster.js";import{hasSecretSearchParams as Fe,setSecretSearchParams as Ke,withoutSecretSearchParams as Ve}from"@sanity/preview-url-secret/without-secret-search-params";import{motion as Be,MotionConfig as qe,AnimatePresence as Ge}from"framer-motion";import{createPreviewSecret as He}from"@sanity/preview-url-secret/create-secret";import Je from"fast-deep-equal";import{match as Xe}from"path-to-regexp";import{definePreviewUrl as Ze}from"@sanity/preview-url-secret/define-preview-url";import{suspend as Qe}from"suspend-react";let Ye;const et=new Uint8Array(16);function tt(){if(!Ye&&(Ye=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ye))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ye(et)}const nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));var rt={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function it(e,t,n){if(rt.randomUUID&&!t&&!e)return rt.randomUUID();const r=(e=e||{}).random||(e.rng||tt)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]}(r)}const ot=1e3,at=1e3,st=500,ct=["handshake/syn","handshake/syn-ack","handshake/ack"],lt=e=>ct.some((t=>t===e)),dt=({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 ut(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(lt(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(!lt(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(dt(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=it(),e.interval=window.setInterval((()=>{l(e,"handshake/syn",{id:e.id})}),st)}(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:at;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:it(),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=it();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}').`))}),ot),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 pt,mt,ht,ft;function vt(e){var t,n,r;let i=typeof e;return"object"===i&&(i=null!=(r=e&&(null==(n=null==(t=Object.getPrototypeOf(e))?void 0:t.constructor)?void 0:n.name))?r:"null"),"string"===i?`"${e}"`:"number"===i||"bigint"===i||"boolean"===i?`${e}`:i}function gt(e,t,n,r,i){var o,a,s,c,l,d;const u=i&&"input"in i?i.input:n.value,p=null!=(o=null==i?void 0:i.expected)?o:e.expects,m=null!=(a=null==i?void 0:i.received)?a:vt(u),h={kind:e.kind,type:e.type,input:u,expected:p,received:m,message:`Invalid ${t}: ${p?`Expected ${p} but r`:"R"}eceived ${m}`,requirement:e.requirement,path:null==i?void 0:i.path,issues:null==i?void 0:i.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly,skipPipe:r.skipPipe},f="schema"===e.kind,v=null!=(d=null!=(l=null!=(c=null!=(s=e.message)?s:function(e,t){var n;return null==(n=null==ft?void 0:ft.get(e))?void 0:n.get(t)}(e.reference,h.lang))?c:f?(g=h.lang,null==ht?void 0:ht.get(g)):null)?l:r.message)?d:function(e){return null==mt?void 0:mt.get(e)}(h.lang);var g;v&&(h.message="function"==typeof v?v(h):v),f&&(n.typed=!1),n.issues?n.issues.push(h):n.issues=[h]}function yt(e){return"__proto__"!==e&&"prototype"!==e&&"constructor"!==e}var wt=class extends Error{constructor(e){super(e[0].message),t(this,"issues"),this.name="ValiError",this.issues=e}};function bt(e,t,n){return"function"==typeof e.fallback?e.fallback(t,n):e.fallback}function xt(e){return{kind:"schema",type:"boolean",reference:xt,expects:"boolean",async:!1,message:e,_run(e,t){return"boolean"==typeof e.value?e.typed=!0:gt(this,"type",e,t),e}}}function Pt(e,t){return{kind:"schema",type:"object",reference:Pt,expects:"Object",async:!1,entries:e,message:t,_run(e,t){var n;const r=e.value;if(r&&"object"==typeof r){e.typed=!0,e.value={};for(const i in this.entries){const o=r[i],a=this.entries[i]._run({typed:!1,value:o},t);if(a.issues){const s={type:"object",origin:"value",input:r,key:i,value:o};for(const t of a.issues)t.path?t.path.unshift(s):t.path=[s],null==(n=e.issues)||n.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),(void 0!==a.value||i in r)&&(e.value[i]=a.value)}}else gt(this,"type",e,t);return e}}}function kt(e,...t){const n={kind:"schema",type:"optional",reference:kt,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(e,t){return void 0===e.value&&("default"in this&&(e.value=function(e,t,n){return"function"==typeof e.default?e.default(t,n):e.default}(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped._run(e,t)}};return 0 in t&&(n.default=t[0]),n}function Et(e){return{kind:"schema",type:"string",reference:Et,expects:"string",async:!1,message:e,_run(e,t){return"string"==typeof e.value?e.typed=!0:gt(this,"type",e,t),e}}}function St(e,t,n){const r=e._run({typed:!1,value:t},function(e){var t,n,r;return{lang:null!=(t=null==e?void 0:e.lang)?t:null==pt?void 0:pt.lang,message:null==e?void 0:e.message,abortEarly:null!=(n=null==e?void 0:e.abortEarly)?n:null==pt?void 0:pt.abortEarly,abortPipeEarly:null!=(r=null==e?void 0:e.abortPipeEarly)?r:null==pt?void 0:pt.abortPipeEarly,skipPipe:null==e?void 0:e.skipPipe}}(n));if(r.issues)throw new wt(r.issues);return r.value}const It=/^([A-Za-z]+):([0-9]+)$/,_t=/^([A-Za-z]+):([0-9]+),([0-9]+)$/,zt=/^([A-Za-z]+):([a-z0-9]+)$/;const Dt=function(...e){return{...e[0],pipe:e,_run(t,n){for(let r=0;r<e.length;r++){t=e[r]._run(t,n);const i=e[r+1];if(n.skipPipe||t.issues&&(n.abortEarly||n.abortPipeEarly||"schema"===(null==i?void 0:i.kind)||"transformation"===(null==i?void 0:i.kind))){t.typed=!1;break}}return t}}}(Et(),function e(t,n){return{kind:"validation",type:"min_length",reference:e,async:!1,expects:`>=${t}`,requirement:t,message:n,_run(e,t){return e.typed&&e.value.length<this.requirement&&gt(this,"length",e,t,{received:`${e.value.length}`}),e}}}(1)),Ct=kt(Dt);function $t(e,t){return`${e}-${"string"==typeof t?t:JSON.stringify(t)}`}Pt({baseUrl:Dt,dataset:Ct,id:Dt,path:Dt,projectId:Ct,tool:Ct,type:Ct,workspace:Ct,isDraft:kt(Et())}),Pt({origin:Dt,href:Dt,data:kt(function e(t,n,r){return{kind:"schema",type:"record",reference:e,expects:"Object",async:!1,key:t,value:n,message:r,_run(e,t){var n,r;const i=e.value;if(i&&"object"==typeof i){e.typed=!0,e.value={};for(const o in i)if(yt(o)){const a=i[o],s=this.key._run({typed:!1,value:o},t);if(s.issues){const r={type:"record",origin:"key",input:i,key:o,value:a};for(const t of s.issues)t.path=[r],null==(n=e.issues)||n.push(t);if(e.issues||(e.issues=s.issues),t.abortEarly){e.typed=!1;break}}const c=this.value._run({typed:!1,value:a},t);if(c.issues){const n={type:"record",origin:"value",input:i,key:o,value:a};for(const t of c.issues)t.path?t.path.unshift(n):t.path=[n],null==(r=e.issues)||r.push(t);if(e.issues||(e.issues=c.issues),t.abortEarly){e.typed=!1;break}}(!s.typed||!c.typed)&&(e.typed=!1),s.typed&&(e.value[s.value]=c.value)}}else gt(this,"type",e,t);return e}}}(Et(),function e(){return{kind:"schema",type:"unknown",reference:e,expects:"unknown",async:!1,_run:e=>(e.typed=!0,e)}}()))});const Ot={alt:"altKey",ctrl:"ctrlKey",mod:typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"metaKey":"ctrlKey",shift:"shiftKey"};function Rt(e){return"Alt"===e.key}function jt(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(e,r)}),t)}}const Lt=z(null);Lt.displayName="PanelsContext";const Tt=ue.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=D(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(Rt,{style:u,children:e})},Ut="presentation/panels",At=()=>JSON.parse(localStorage.getItem(Ut)||"{}"),Wt=e=>e.map((e=>[e.id,e.order].join(":"))).join(",");function Mt(){return C((()=>{const e=(e,t)=>{const n=At(),r=Wt(e);(e=>{localStorage.setItem(Ut,JSON.stringify(e))})({...n,[r]:t})};return{get:e=>{const t=At(),n=Wt(e);return Array.isArray(t[n])&&t[n].some((e=>null===e))?void 0:t[n]},set:e,setDebounced:$t(e,100)}}),[])}function Nt(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 Ft(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 Kt(e,t,n=0,r=null){return e.clientX-(r||t.getBoundingClientRect()).left-n}function Vt(e){return"panel"===e.type}function Bt(e){return"resizer"===e.type}function qt(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 Gt(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=Nt(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 Ht=de.div`
`,Ut=function({children:e,defaultSize:t=null,id:r,minWidth:i,maxWidth:o,order:a=0}){const s=D(Lt);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 C((()=>(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})},At="presentation/panels",Wt=()=>JSON.parse(localStorage.getItem(At)||"{}"),Mt=e=>e.map((e=>[e.id,e.order].join(":"))).join(",");function Nt(){return $((()=>{const e=(e,t)=>{const n=Wt(),r=Mt(e);(e=>{localStorage.setItem(At,JSON.stringify(e))})({...n,[r]:t})};return{get:e=>{const t=Wt(),n=Mt(e);return Array.isArray(t[n])&&t[n].some((e=>null===e))?void 0:t[n]},set:e,setDebounced:jt(e,100)}}),[])}function Ft(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 Kt(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 Vt(e,t,n=0,r=null){return e.clientX-(r||t.getBoundingClientRect()).left-n}function Bt(e){return"panel"===e.type}function qt(e){return"resizer"===e.type}function Gt(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 Ht(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=Ft(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 Jt=ue.div`
display: flex;

@@ -11,5 +11,5 @@ flex-direction: row;

width: 100%;
`,Jt=function({children:e}){const t=O(null),[r,i]=$(new Map),o=C((()=>qt(r).filter(Vt)),[r]),[a,s]=$([]),[c,l]=$(null),d=O({elements:r,panels:o,widths:a}),u=j((e=>({flexGrow:Ft(o,e,a),pointerEvents:null===c?void 0:"none"})),[c,o,a]),p=j(((e,t)=>{i((n=>{if(n.has(e))return n;const r=new Map(n);return r.set(e,t),r}))}),[]),m=j((e=>{i((t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}))}),[]),h=O({containerWidth:window.innerWidth,dragOffset:0,panelAfter:null,panelBefore:null,resizerIndex:-1,resizerRect:null,startX:0,widths:[]}),f=j(((e,t)=>{const n=qt(r),i=n.findIndex((t=>t.id===e)),o=r.get(e);if(!o||!Bt(o))return;const a=o.el.current;a&&(h.current={resizerIndex:i,panelBefore:n.reduce(((e,t,n)=>Vt(t)&&n<i?t:e),null),panelAfter:n.reduce(((e,t,n)=>null===e&&Vt(t)&&n>i?t:e),null),containerWidth:window.innerWidth,startX:t.pageX,dragOffset:Kt(t,a),resizerRect:a.getBoundingClientRect(),widths:d.current.widths},l(e))}),[r]),v=j((()=>{l(null)}),[]),g=j(((e,n)=>{n.preventDefault(),n.stopPropagation();const{containerWidth:i,dragOffset:o,panelBefore:a,panelAfter:c,resizerRect:l}=h.current;if(null==a||null==c)return;const u=r.get(e);if(!u||!Bt(u))return;const p=u.el.current;if(!p)return;const m=Kt(n,p,o,l);if(0===m)return;const{widths:f}=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=Nt(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,m=a.findIndex((e=>e.id===p.id));for(;;){const n=a[m],r=l[m],i=Nt(n,r-(Math.abs(e)-Math.abs(u)),t);if(r!==i&&(u+=r-i,d[m]=i,u.toPrecision(10).localeCompare(Math.abs(e).toPrecision(10),void 0,{numeric:!0})>=0))break;if(e<0){if(--m<0)break}else if(++m>=a.length)break}return 0===u?l:(p=e<0?r:n,m=a.findIndex((e=>e.id===p.id)),d[m]=l[m]+u,d)}(m/t.current.getBoundingClientRect().width*100,i,a,c,d.current,h.current);f.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=Mt();L((()=>{const{widths:e}=d.current;if(e.length===o.length)return;const t=y.get(o);if(t){const e=Gt(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]),R((()=>{a.length&&y.setDebounced(o,a)}),[y,o,a]),L((()=>{const e=new ResizeObserver((()=>{const{panels:e,widths:t}=d.current,n=Gt(e,t,window.innerWidth);t.some(((e,t)=>e!==n[t]))&&s(n)}));return e.observe(t.current),()=>{e.disconnect()}}),[]);const b=C((()=>({activeResizer:c,drag:g,getPanelStyle:u,registerElement:p,startDragging:f,stopDragging:v,unregisterElement:m})),[c,g,u,p,f,v,m]);return n(jt.Provider,{value:b,children:n(Ht,{ref:t,children:e})})};function Xt(e){const{children:t,message:i,onRetry:o,onContinueAnyway:h,...f}=e,{t:v}=K(ue),g=n(a,{fontSize:1,mode:"ghost",onClick:o,text:v("error-card.retry-button.text")}),y=n(a,{fontSize:1,mode:"ghost",tone:"critical",onClick:h,text:v("error-card.continue-button.text")});return n(s,{height:"fill",...f,children:n(c,{align:"center",height:"fill",justify:"center",children:n(l,{padding:4,sizing:"border",width:0,children:r(d,{space:4,children:[r(d,{space:3,children:[n(u,{size:1,weight:"semibold",children:v("error-card.title")}),n(u,{muted:!0,size:1,children:i})]}),t,o&&h?r(p,{space:2,children:[g,y]}):o?n(m,{children:g}):h?n(m,{children:y}):null]})})})})}function Zt(e){const t=["comment","inspect","instruction","pathKey","rev","since","template","prefersLatestPublished","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 Qt=T((function(e,t){const{searchParams:r,...i}=e;return n(se,{...i,ref:t,state:{type:void 0,_searchParams:Object.entries(r)},title:void 0})})),Yt=T((function(e,t){const{documentId:r,documentType:i,parentRefPath:o,template:a,searchParams:s,...c}=e;return n(se,{...c,ref:t,state:{id:r,type:i,_searchParams:Object.entries({...s,prefersLatestPublished:"published"===s.perspective?"true":void 0})},title:void 0})}));function en(e){const{children:t,onStructureParams:r,structureParams:o,searchParams:a,refs:s}=e,{state:c,resolvePathFromState:l}=ce(),d=V(Object.fromEntries(c._searchParams||[])),u=j((e=>`${l(c)}${Zt({...d,...e})}`),[l,d,c]),p=C((()=>({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(se,{...r,state:{id:t,type:i._type,_searchParams:Object.entries({...a,prefersLatestPublished:"published"===(null==a?void 0:a.perspective)?"true":void 0})}}):n("div",{...r})},BackLink:e=>n(Qt,{...e,searchParams:a}),ReferenceChildLink:e=>n(Yt,{...e,searchParams: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,s,a,o]);return n(Re.Provider,{value:p,children:t})}const tn=de(Te)`
`,Xt=function({children:e}){const t=O(null),[r,i]=R(new Map),o=$((()=>Gt(r).filter(Bt)),[r]),[a,s]=R([]),[c,l]=R(null),d=O({elements:r,panels:o,widths:a}),u=j((e=>({flexGrow:Kt(o,e,a),pointerEvents:null===c?void 0:"none"})),[c,o,a]),p=j(((e,t)=>{i((n=>{if(n.has(e))return n;const r=new Map(n);return r.set(e,t),r}))}),[]),m=j((e=>{i((t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}))}),[]),h=O({containerWidth:window.innerWidth,dragOffset:0,panelAfter:null,panelBefore:null,resizerIndex:-1,resizerRect:null,startX:0,widths:[]}),f=j(((e,t)=>{const n=Gt(r),i=n.findIndex((t=>t.id===e)),o=r.get(e);if(!o||!qt(o))return;const a=o.el.current;a&&(h.current={resizerIndex:i,panelBefore:n.reduce(((e,t,n)=>Bt(t)&&n<i?t:e),null),panelAfter:n.reduce(((e,t,n)=>null===e&&Bt(t)&&n>i?t:e),null),containerWidth:window.innerWidth,startX:t.pageX,dragOffset:Vt(t,a),resizerRect:a.getBoundingClientRect(),widths:d.current.widths},l(e))}),[r]),v=j((()=>{l(null)}),[]),g=j(((e,n)=>{n.preventDefault(),n.stopPropagation();const{containerWidth:i,dragOffset:o,panelBefore:a,panelAfter:c,resizerRect:l}=h.current;if(null==a||null==c)return;const u=r.get(e);if(!u||!qt(u))return;const p=u.el.current;if(!p)return;const m=Vt(n,p,o,l);if(0===m)return;const{widths:f}=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=Ft(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,m=a.findIndex((e=>e.id===p.id));for(;;){const n=a[m],r=l[m],i=Ft(n,r-(Math.abs(e)-Math.abs(u)),t);if(r!==i&&(u+=r-i,d[m]=i,u.toPrecision(10).localeCompare(Math.abs(e).toPrecision(10),void 0,{numeric:!0})>=0))break;if(e<0){if(--m<0)break}else if(++m>=a.length)break}return 0===u?l:(p=e<0?r:n,m=a.findIndex((e=>e.id===p.id)),d[m]=l[m]+u,d)}(m/t.current.getBoundingClientRect().width*100,i,a,c,d.current,h.current);f.some(((e,t)=>e!==v[t]))&&s(v)}),[r]);C((()=>{d.current.elements=r,d.current.panels=o,d.current.widths=a}),[r,o,a]);const y=Nt();C((()=>{const{widths:e}=d.current;if(e.length===o.length)return;const t=y.get(o);if(t){const e=Ht(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]),L((()=>{a.length&&y.setDebounced(o,a)}),[y,o,a]),C((()=>{const e=new ResizeObserver((()=>{const{panels:e,widths:t}=d.current,n=Ht(e,t,window.innerWidth);t.some(((e,t)=>e!==n[t]))&&s(n)}));return e.observe(t.current),()=>{e.disconnect()}}),[]);const w=$((()=>({activeResizer:c,drag:g,getPanelStyle:u,registerElement:p,startDragging:f,stopDragging:v,unregisterElement:m})),[c,g,u,p,f,v,m]);return n(Lt.Provider,{value:w,children:n(Jt,{ref:t,children:e})})};function Zt(e){const{children:t,message:i,onRetry:o,onContinueAnyway:h,...f}=e,{t:v}=K(pe),g=n(a,{fontSize:1,mode:"ghost",onClick:o,text:v("error-card.retry-button.text")}),y=n(a,{fontSize:1,mode:"ghost",tone:"critical",onClick:h,text:v("error-card.continue-button.text")});return n(s,{height:"fill",...f,children:n(c,{align:"center",height:"fill",justify:"center",children:n(l,{padding:4,sizing:"border",width:0,children:r(d,{space:4,children:[r(d,{space:3,children:[n(u,{size:1,weight:"semibold",children:v("error-card.title")}),n(u,{muted:!0,size:1,children:i})]}),t,o&&h?r(p,{space:2,children:[g,y]}):o?n(m,{children:g}):h?n(m,{children:y}):null]})})})})}function Qt(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 Yt=T((function(e,t){const{searchParams:r,...i}=e;return n(ce,{...i,ref:t,state:{type:void 0,_searchParams:Object.entries(r)},title:void 0})})),en=T((function(e,t){const{documentId:r,documentType:i,parentRefPath:o,template:a,searchParams:s,...c}=e;return n(ce,{...c,ref:t,state:{id:r,type:i,_searchParams:Object.entries(s)},title:void 0})}));function tn(e){const{children:t,onStructureParams:r,structureParams:o,searchParams:a,refs:s}=e,{state:c,resolvePathFromState:l}=le(),d=V(Object.fromEntries(c._searchParams||[])),u=j((e=>`${l(c)}${Qt({...d,...e})}`),[l,d,c]),p=$((()=>({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(ce,{...r,state:{id:t,type:i._type,_searchParams:Object.entries(a)}}):n("div",{...r})},BackLink:e=>n(Yt,{...e,searchParams:a}),ReferenceChildLink:e=>n(en,{...e,searchParams: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,s,a,o]);return n(Te.Provider,{value:p,children:t})}const nn=ue(Ue)`
height: 100%;
`,nn=de(c)`
`,rn=ue(c)`
& > div {

@@ -19,9 +19,9 @@ min-width: none !important;

}
`,rn=de(h)`
`,on=ue(h)`
white-space: pre-wrap;
`;function on(e){const{mainDocumentState:t,onStructureParams:i,searchParams:o,refs:a}=e,{t:c}=K(ue),{devMode:l}=pe(),u=C((()=>a.filter((e=>{var n;return B(e._id)!==(null==(n=null==t?void 0:t.document)?void 0:n._id)})).map((e=>e._id))),[t,a]),p=C((()=>({id:"$root",options:{filter:"_id in $ids",params:{ids:u}},schemaTypeName:"",title:c("document-list-pane.document-list.title"),type:"documentList"})),[u,c]),[m,h]=$(null),g=j((()=>h(null)),[]),[y]=$((()=>({})));return R((()=>h(null)),[a]),m?n(Xt,{flex:1,message:c("document-list-pane.error.text"),onRetry:g,children:l&&n(s,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:c("presentation-error.label")}),n(rn,{size:1,children:m.error.message})]})})}):n(v,{onCatch:h,children:n(tn,{children:n(Ue,{children:n(en,{onStructureParams:i,structureParams:y,searchParams:o,refs:a,children:n(nn,{direction:"column",flex:1,children:n(Ae,{index:0,itemId:"$root",pane:p,paneKey:"$root"})})})})})})}const an=de(h)`
`;function an(e){const{mainDocumentState:t,onStructureParams:i,searchParams:o,refs:a}=e,{t:c}=K(pe),{devMode:l}=me(),u=$((()=>a.filter((e=>{var n;return B(e._id)!==(null==(n=null==t?void 0:t.document)?void 0:n._id)})).map((e=>e._id))),[t,a]),p=$((()=>({id:"$root",options:{filter:"_id in $ids",params:{ids:u}},schemaTypeName:"",title:c("document-list-pane.document-list.title"),type:"documentList"})),[u,c]),[m,h]=R(null),g=j((()=>h(null)),[]),[y]=R((()=>({})));return L((()=>h(null)),[a]),m?n(Zt,{flex:1,message:c("document-list-pane.error.text"),onRetry:g,children:l&&n(s,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:c("presentation-error.label")}),n(on,{size:1,children:m.error.message})]})})}):n(v,{onCatch:h,children:n(nn,{children:n(Ae,{children:n(tn,{onStructureParams:i,structureParams:y,searchParams:o,refs:a,children:n(rn,{direction:"column",flex:1,children:n(We,{index:0,itemId:"$root",pane:p,paneKey:"$root"})})})})})})}const sn=ue(h)`
white-space: pre-wrap;
`;function sn(e){const{documentId:t,documentType:i,onFocusPath:o,onStructureParams:a,searchParams:c,structureParams:l}=e,{template:u,templateParams:p}=l,{t:m}=K(ue),{devMode:h}=pe(),g=C((()=>({id:t,options:{id:t,type:i,template:u,templateParameters:le(p)},title:"",type:"document"})),[t,i,u,p]),[y,b]=$(null),w=j((()=>b(null)),[]);return R((()=>{b(null)}),[t,i,l]),y?n(Xt,{flex:1,message:m("document-pane.error.text"),onRetry:w,children:h&&n(s,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:m("presentation-error.label")}),n(an,{size:1,children:y.error.message})]})})}):n(v,{onCatch:b,children:n(Te,{style:{height:"100%"},children:n(en,{searchParams:c,onStructureParams:a,structureParams:l,children:n(We,{paneKey:"document",index:1,itemId:"document",pane:g,onFocusPath:o})})})})}function cn(e){const{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,searchParams:a,structureParams:s}=e;return n(Ue,{children:n(sn,{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,searchParams:a,structureParams:s})})}function ln(e){var t;const{documentId:i,documentType:o,mainDocumentState:a,onFocusPath:l,onStructureParams:d,refs:p,searchParams:h,structureParams:f}=e,{t:v}=K(ue),g=H(),y=j((e=>n(se,{...e,state:{id:a.document._id,type:a.document._type,_searchParams:Object.entries({...h,prefersLatestPublished:"published"===(null==h?void 0:h.perspective)?"true":void 0})}})),[a,h]),b=C((()=>{var e;return g.get((null==(e=null==a?void 0:a.document)?void 0:e._type)||"shoe")}),[a,g]),w=function(e,t){const n=q(),[r,i]=$({});return R((()=>{if(!t)return;const r=G(n,t,e,"").subscribe((e=>{i(e)}));return()=>{null==r||r.unsubscribe()}}),[n,t,e]),r}((null==(t=null==a?void 0:a.document)?void 0:t._id)||"",b),P=C((()=>null!=a&&a.document?n(J,{...X({value:a.document,published:w.published,draft:w.draft}),schemaType:b,status:n(s,{padding:1,radius:2,shadow:1,children:n(u,{muted:!0,size:0,weight:"medium",children:v("main-document.label")})})}):null),[a,b,v,w]);return i&&o?n(cn,{documentId:i,documentType:o,onFocusPath:l,onStructureParams:d,searchParams:h,structureParams:f}):r(c,{direction:"column",flex:1,height:"fill",children:[a&&n(s,{padding:3,tone:a.document?"inherit":"caution",children:a.document?n(Z,{__unstable_focusRing:!0,as:y,"data-as":"a",radius:2,sizing:"border",tone:"inherit",children:P}):n(s,{padding:2,radius:2,tone:"inherit",children:r(c,{gap:3,children:[n(m,{flex:"none",children:n(u,{size:1,children:n(xe,{})})}),n(m,{flex:1,children:n(u,{size:1,children:n(Q,{t:v,i18nKey:"main-document.missing.text",components:{Code:"code"},values:{path:a.path}})})})]})})}),n(on,{mainDocumentState:a,onStructureParams:d,searchParams:h,refs:p})]})}const dn=de.div`
`;function cn(e){const{documentId:t,documentType:i,onFocusPath:o,onStructureParams:a,searchParams:c,structureParams:l}=e,{template:u,templateParams:p}=l,{t:m}=K(pe),{devMode:h}=me(),g=$((()=>({id:t,options:{id:t,type:i,template:u,templateParameters:de(p)},title:"",type:"document"})),[t,i,u,p]),[y,w]=R(null),b=j((()=>w(null)),[]);return L((()=>{w(null)}),[t,i,l]),y?n(Zt,{flex:1,message:m("document-pane.error.text"),onRetry:b,children:h&&n(s,{overflow:"auto",padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:m("presentation-error.label")}),n(sn,{size:1,children:y.error.message})]})})}):n(v,{onCatch:w,children:n(Ue,{style:{height:"100%"},children:n(tn,{searchParams:c,onStructureParams:a,structureParams:l,children:n(Me,{paneKey:"document",index:1,itemId:"document",pane:g,onFocusPath:o})})})})}function ln(e){const{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,searchParams:a,structureParams:s}=e;return n(Ae,{children:n(cn,{documentId:t,documentType:r,onFocusPath:i,onStructureParams:o,searchParams:a,structureParams:s})})}function dn(e){var t;const{documentId:i,documentType:o,mainDocumentState:a,onFocusPath:l,onStructureParams:d,refs:p,searchParams:h,structureParams:f}=e,{t:v}=K(pe),g=H(),y=j((e=>n(ce,{...e,state:{id:a.document._id,type:a.document._type,_searchParams:Object.entries(h)}})),[a,h]),w=$((()=>{var e;return g.get((null==(e=null==a?void 0:a.document)?void 0:e._type)||"shoe")}),[a,g]),b=function(e,t){const n=q(),[r,i]=R({});return L((()=>{if(!t)return;const r=G(n,t,e,"").subscribe((e=>{i(e)}));return()=>{null==r||r.unsubscribe()}}),[n,t,e]),r}((null==(t=null==a?void 0:a.document)?void 0:t._id)||"",w),x=$((()=>null!=a&&a.document?n(J,{...X({value:a.document,published:b.published,draft:b.draft}),schemaType:w,status:n(s,{padding:1,radius:2,shadow:1,children:n(u,{muted:!0,size:0,weight:"medium",children:v("main-document.label")})})}):null),[a,w,v,b]);return i&&o?n(ln,{documentId:i,documentType:o,onFocusPath:l,onStructureParams:d,searchParams:h,structureParams:f}):r(c,{direction:"column",flex:1,height:"fill",children:[a&&n(s,{padding:3,tone:a.document?"inherit":"caution",children:a.document?n(Z,{__unstable_focusRing:!0,as:y,"data-as":"a",radius:2,sizing:"border",tone:"inherit",children:x}):n(s,{padding:2,radius:2,tone:"inherit",children:r(c,{gap:3,children:[n(m,{flex:"none",children:n(u,{size:1,children:n(ke,{})})}),n(m,{flex:1,children:n(u,{size:1,children:n(Q,{t:v,i18nKey:"main-document.missing.text",components:{Code:"code"},values:{path:a.path}})})})]})})}),n(an,{mainDocumentState:a,onStructureParams:d,searchParams:h,refs:p})]})}const un=ue.div`
position: relative;
`,un=de.div`
`,pn=ue.div`
position: absolute;

@@ -47,3 +47,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 "}
`,pn=function({id:e,order:t,disabled:i=!1}){const o=O(null),a=D(jt);if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const s=function(e){return O(e||rt()).current}(e),{activeResizer:c,drag:l,startDragging:d,stopDragging:u,registerElement:p,unregisterElement:m}=a,h=c===s;if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const f=j((e=>{d(s,e.nativeEvent)}),[s,d]),v=j((e=>{l(s,e)}),[s,l]),g=j((()=>{o.current.blur(),u()}),[u]);return R((()=>{if(!h||i)return;const e=function(){const e=document.body.style,t=document.documentElement.style,{cursor:n}=t,{userSelect:r}=e;return t.cursor="ew-resize",e.userSelect="none",()=>{n?t.cursor=n:t.removeProperty("cursor"),r?e.userSelect=r:e.removeProperty("user-select")}}();return window.addEventListener("mousemove",v),window.addEventListener("mouseup",g),window.addEventListener("contextmenu",g),()=>{e(),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",g),window.removeEventListener("contextmenu",g)}}),[i,h,v,g]),L((()=>(p(s,{id:s,order:t,type:"resizer",el:o}),()=>{m(s)})),[s,t,p,m]),n(dn,{onMouseDown:f,ref:o,children:r(un,{$disabled:i,children:[n("span",{}),n("span",{})]})})},mn=e=>{const{documentId:t,setDisplayedDocument:o,getCommentIntent:a}=e;return r(i,{children:[n(pn,{order:4}),n(Tt,{id:"content",minWidth:325,order:5,children:n(Me,{documentId:t,setDisplayedDocument:o,children:n(Y,{getIntent:a,children:e.children})})})]})},hn=e=>{const{documentId:t,documentsOnPage:r,documentType:i,getCommentIntent:o,mainDocumentState:a,onFocusPath:s,onStructureParams:c,searchParams:l,setDisplayedDocument:d,structureParams:u}=e;return n(mn,{documentId:t,getCommentIntent:o,setDisplayedDocument:d,children:n(ln,{documentId:t,documentType:i,mainDocumentState:a,onFocusPath:s,onStructureParams:c,refs:r,searchParams:l,structureParams:u})})},fn=function(e){const{children:t,navigate:r}=e,i=j(((e,t=void 0)=>{r(t||{},e?{preview:e}:{})}),[r]);return n(me.Provider,{value:i,children:t})};function vn(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 R((()=>{localStorage.setItem(e,JSON.stringify(n))}),[e,n]),[n,r]}("presentation/navigator",r),s=!!r&&o,c=C((()=>{if(r)return()=>a((e=>!e))}),[r,a]),l=j((function(){return n(i,{children:s&&n(gn,{...t})})}),[s,t]);return[{navigatorEnabled:s,toggleNavigator:c},l]}const gn=U((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(pn,{order:2,disabled:s})]})})),yn=function(e){const{children:t,params:r}=e,i=C((()=>r),[r]);return n(he.Provider,{value:i,children:t})},bn=function(e){const{children:t,devMode:r,name:i,navigate:o,params:a,searchParams:s,structureParams:c}=e,l=C((()=>({devMode:r,name:i,navigate:o,params:a,searchParams:s,structureParams:c})),[r,i,o,a,s,c]);return n(fe.Provider,{value:l,children:t})},wn="ACTION_IFRAME_LOADED",Pn="ACTION_IFRAME_REFRESH",xn="ACTION_IFRAME_RELOAD",kn="ACTION_VISUAL_EDITING_OVERLAYS_TOGGLE",En=(e,t)=>{switch(t.type){case wn:return"loaded"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"loaded"}};case Pn:return"refreshing"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"refreshing"}};case xn:return"reloading"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"reloading"}};case kn:return Sn(e,t);default:return e}},Sn=(e,t)=>e.visualEditing.overlaysEnabled===t.enabled?e:{...e,visualEditing:{...e.visualEditing,overlaysEnabled:t.enabled}},In=(Ln=wt(),Cn=!1,{...Ln,fallback:Cn,_run(e,t){return Ln._run(e,t),e.issues?{typed:!0,value:bt(this,e,t)}:e}}),_n=function e(t,n){return{kind:"schema",type:"picklist",reference:e,expects:t.map(ft).join(" | ")||"never",async:!1,options:t,message:n,_run(e,t){return this.options.includes(e.value)?e.typed=!0:vt(this,"type",e,t),e}}}(["loading","loaded","refreshing","reloading"]),zn=Pt({mainDocument:In,iframe:Pt({status:_n}),visualEditing:Pt({overlaysEnabled:wt()})}),Dn={mainDocument:!1,iframe:{status:"loading"},visualEditing:{overlaysEnabled:!1}};var Ln,Cn;function On(e){return Et(zn,{...Dn,...e})}const $n=Ve(de.iframe`
`,mn=function({id:e,order:t,disabled:i=!1}){const o=O(null),a=D(Lt);if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const s=function(e){return O(e||it()).current}(e),{activeResizer:c,drag:l,startDragging:d,stopDragging:u,registerElement:p,unregisterElement:m}=a,h=c===s;if(null===a)throw Error("Panel components must be rendered within a PanelGroup container");const f=j((e=>{d(s,e.nativeEvent)}),[s,d]),v=j((e=>{l(s,e)}),[s,l]),g=j((()=>{o.current.blur(),u()}),[u]);return L((()=>{if(!h||i)return;const e=function(){const e=document.body.style,t=document.documentElement.style,{cursor:n}=t,{userSelect:r}=e;return t.cursor="ew-resize",e.userSelect="none",()=>{n?t.cursor=n:t.removeProperty("cursor"),r?e.userSelect=r:e.removeProperty("user-select")}}();return window.addEventListener("mousemove",v),window.addEventListener("mouseup",g),window.addEventListener("contextmenu",g),()=>{e(),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",g),window.removeEventListener("contextmenu",g)}}),[i,h,v,g]),C((()=>(p(s,{id:s,order:t,type:"resizer",el:o}),()=>{m(s)})),[s,t,p,m]),n(un,{onMouseDown:f,ref:o,children:r(pn,{$disabled:i,children:[n("span",{}),n("span",{})]})})},hn=e=>{const{documentId:t,setDisplayedDocument:o,getCommentIntent:a}=e;return r(i,{children:[n(mn,{order:4}),n(Ut,{id:"content",minWidth:325,order:5,children:n(Ne,{documentId:t,setDisplayedDocument:o,children:n(Y,{getIntent:a,children:e.children})})})]})},fn=e=>{const{documentId:t,documentsOnPage:r,documentType:i,getCommentIntent:o,mainDocumentState:a,onFocusPath:s,onStructureParams:c,searchParams:l,setDisplayedDocument:d,structureParams:u}=e;return n(hn,{documentId:t,getCommentIntent:o,setDisplayedDocument:d,children:n(dn,{documentId:t,documentType:i,mainDocumentState:a,onFocusPath:s,onStructureParams:c,refs:r,searchParams:l,structureParams:u})})},vn=function(e){const{children:t,navigate:r}=e,i=j(((e,t=void 0)=>{r(t||{},e?{preview:e}:{})}),[r]);return n(he.Provider,{value:i,children:t})};function gn(e){const{unstable_navigator:t}=e,r=!(null==t||!t.component),[o,a]=function(e,t){const[n,r]=R((()=>{var n;return JSON.parse(null!=(n=localStorage.getItem(e))?n:JSON.stringify(t))}));return L((()=>{localStorage.setItem(e,JSON.stringify(n))}),[e,n]),[n,r]}("presentation/navigator",r),s=!!r&&o,c=$((()=>{if(r)return()=>a((e=>!e))}),[r,a]),l=j((function(){return n(i,{children:s&&n(yn,{...t})})}),[s,t]);return[{navigatorEnabled:s,toggleNavigator:c},l]}const yn=U((function(e){const{minWidth:t,maxWidth:o,component:a}=e,s=null!=t&&null!=o&&t===o;return r(i,{children:[n(Ut,{id:"navigator",minWidth:t,maxWidth:o,order:1,children:n(a,{})}),n(mn,{order:2,disabled:s})]})})),wn=function(e){const{children:t,params:r}=e,i=$((()=>r),[r]);return n(fe.Provider,{value:i,children:t})},bn=function(e){const{children:t,devMode:r,name:i,navigate:o,params:a,searchParams:s,structureParams:c}=e,l=$((()=>({devMode:r,name:i,navigate:o,params:a,searchParams:s,structureParams:c})),[r,i,o,a,s,c]);return n(ve.Provider,{value:l,children:t})},xn="ACTION_IFRAME_LOADED",Pn="ACTION_IFRAME_REFRESH",kn="ACTION_IFRAME_RELOAD",En="ACTION_VISUAL_EDITING_OVERLAYS_TOGGLE",Sn=(e,t)=>{switch(t.type){case xn:return"loaded"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"loaded"}};case Pn:return"refreshing"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"refreshing"}};case kn:return"reloading"===e.iframe.status?e:{...e,iframe:{...e.iframe,status:"reloading"}};case En:return In(e,t);default:return e}},In=(e,t)=>e.visualEditing.overlaysEnabled===t.enabled?e:{...e,visualEditing:{...e.visualEditing,overlaysEnabled:t.enabled}},_n=($n=xt(),On=!1,{...$n,fallback:On,_run(e,t){return $n._run(e,t),e.issues?{typed:!0,value:bt(this,e,t)}:e}}),zn=function e(t,n){return{kind:"schema",type:"picklist",reference:e,expects:t.map(vt).join(" | ")||"never",async:!1,options:t,message:n,_run(e,t){return this.options.includes(e.value)?e.typed=!0:gt(this,"type",e,t),e}}}(["loading","loaded","refreshing","reloading"]),Dn=Pt({mainDocument:_n,iframe:Pt({status:zn}),visualEditing:Pt({overlaysEnabled:xt()})}),Cn={mainDocument:!1,iframe:{status:"loading"},visualEditing:{overlaysEnabled:!1}};var $n,On;function Rn(e){return St(Dn,{...Cn,...e})}const jn=Be(ue.iframe`
box-shadow: 0 0 0 1px var(--card-border-color);

@@ -56,8 +56,8 @@ border-top: 1px solid transparent;

width: 100%;
`),jn=de(m)`
`),Ln=ue(m)`
position: absolute;
inset: 0;
background: transparent;
`,Rn=T((function(e,t){const{animate:o,initial:a,onLoad:s,preventClick:c,src:l,variants:d}=e;return r(i,{children:[n($n,{animate:o,initial:a,onLoad:s,ref:t,src:l,variants:d}),c&&n(jn,{})]})})),Tn=function(e){var t;const{fontSize:r=1,onChange:o,origin:a,padding:s=3,prefix:c,suffix:l,value:d}=e,{t:u}=K(ue),{basePath:p="/"}=(null==(t=ee())?void 0:t.activeWorkspace)||{},m=O(null),[h,f]=$(void 0),[v,y]=$(void 0),b=j((e=>{f(e.currentTarget.value)}),[]),w=j((e=>{var t;if("Enter"===e.key){if(void 0===h)return;const e=h.startsWith("/")||""===h?`${a}${h}`:h;if(!e.startsWith(a+"/")&&e!==a)return void y(u("preview-location-input.error",{origin:a,context:"missing-origin"}));if(!a&&(e.startsWith(`${p}/`)||e===p))return void y(u("preview-location-input.error",{basePath:p,context:"same-base-path"}));const n=e===a?a+"/":e;y(void 0),f(void 0),o(n.slice(a.length)),null==(t=m.current)||t.blur()}"Escape"===e.key&&(y(void 0),f(void 0))}),[p,o,a,h,u]),P=j((()=>{y(void 0),f(void 0)}),[]);R((()=>{y(void 0),f(void 0)}),[a,d]);const x=C((()=>({icon:ke})),[]);return n(i,{children:n(g,{clearButton:v?x:void 0,customValidity:v,fontSize:r,onBlur:P,onClear:()=>{y(void 0),f(a+d)},onChange:b,onKeyDownCapture:w,padding:s,prefix:c,style:{zIndex:1},radius:2,ref:m,space:s,suffix:l,value:void 0===h?`${a}${d}`:h})})};function Un(e){const{initialUrl:t,openPopup:o,previewLocationOrigin:a,previewLocationRoute:s}=e,{t:c}=K(ue),l=j((e=>{e.preventDefault(),o(e.currentTarget.href)}),[o]);return r(i,{children:[n(An,{initialUrl:t,previewLocationOrigin:a,previewLocationRoute:s}),n(y,{icon:Ee,text:c("share-url.menu-item.open.text"),as:"a",href:`${a}${s}`,onClick:l,rel:"opener",target:"_blank"})]})}function An(e){const{initialUrl:t,previewLocationOrigin:r,previewLocationRoute:i}=e,{t:o}=K(ue),{push:a}=b(),s=te({apiVersion:ve}),c=ne(),[l,d]=$(!1);return n(y,{disabled:l,onClick:()=>{if(null==navigator||!navigator.clipboard)return a({closable:!0,status:"error",title:o("share-url.clipboard.status",{context:"unsupported"})}),!1;let e;d(!0);const n=`${r}${i}`,l=()=>{a({id:e,closable:!0,status:"success",title:o("share-url.clipboard.status",{context:"success"})}),d(!1)},u=e=>{a({closable:!0,status:"error",title:o("share-url.clipboard.status",{context:"failed"}),description:e.message||e.toString()}),d(!1)};if(Ne(t)){const n=async()=>{e=a({closable:!0,title:o("share-url.clipboard.status",{context:"copying"})});const n=await Ge(s,"@sanity/presentation",typeof window>"u"?"":location.href,null==c?void 0:c.id);return Fe(t,n.secret,i).toString()};if(typeof ClipboardItem<"u"){const e="text/plain",t=new ClipboardItem({[e]:n().then((t=>new Blob([t],{type:e})))});navigator.clipboard.write([t]).then(l).catch(u)}else n().then((e=>navigator.clipboard.writeText(e))).then(l).catch(u)}else navigator.clipboard.writeText(n).then(l).catch(u)},text:o("share-url.menu-item.copy.text"),icon:Se})}const Wn=Ve(c),Mn={previewDrafts:"preview-frame.perspective.previewDrafts.title",published:"preview-frame.perspective.published.title"},Nn="caution",Fn="positive",Kn={previewDrafts:$e,published:je},Vn=T((function(e,t){const{dispatch:o,iframe:l,initialUrl:p,loadersConnection:v,navigatorEnabled:g,onPathChange:b,onRefresh:_,openPopup:z,overlaysConnection:D,perspective:L,previewUrl:O,setPerspective:T,setViewport:U,targetOrigin:W,toggleNavigator:M,toggleOverlay:N,viewport:F,visualEditing:{overlaysEnabled:V}}=e,{t:B}=K(ue),{devMode:q}=pe(),G=w(),H=j((()=>U("desktop"===F?"mobile":"desktop")),[U,F]),J="loading"===l.status||"reloading"===l.status,[X,Z]=$(!1),Q="refreshing"===l.status,[Y,ee]=$(!1),te=J||Q||"connecting"===D,ne=C((()=>W===location.origin?"":W),[W]),ie=j((()=>{_((()=>{"function"==typeof t||null==t||!t.current||(o({type:xn}),t.current.src=`${W}${O||"/"}`)}))}),[o,_,O,W,t]),oe=j((()=>{"function"==typeof t||null==t||!t.current||(t.current.src=p.toString(),o({type:xn}))}),[o,t,p]),ae=j((()=>{ce(!0)}),[]),[se,ce]=$(!1),[le,de]=$(!1);R((()=>{if(!(J||Q||"connecting"!==D&&"reconnecting"!==D)){const e=setTimeout((()=>{de(!0)}),1e3);return()=>clearTimeout(e)}}),[D,J,Q]),R((()=>{if(!J&&!Q&&le){if("connected"===D&&(ee(!1),de(!1),Z(!1),ce(!1)),"connecting"===D){const e=setTimeout((()=>{Z(!0),console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly")}),ge);return()=>clearTimeout(e)}if("reconnecting"===D){const e=setTimeout((()=>{Z(!0),ee(!0)}),ge);return()=>clearTimeout(e)}"disconnected"===D&&ee(!0)}}),[J,D,Q,le]);const me=C((()=>{const e=new URL(O||"/",W),{pathname:t,search:n}=Ke(e);return`${t}${n}`}),[O,W]),he=j((()=>{o({type:wn})}),[o]);R((()=>{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]);const fe=C((()=>(J||"connecting"===D&&"refreshing"!==l.status)&&!se),[se,l.status,J,D]),ve=C((()=>[fe?"background":"active",J?"reloading":"idle",F,le&&!se?"timedOut":""]),[se,J,fe,le,F]);return n(Be,{transition:G?{duration:0}:void 0,children:r(P,{delay:1e3,children:[n(s,{flex:"none",padding:2,shadow:1,style:{position:"relative"},children:r(c,{align:"center",style:{minHeight:0},children:[M&&n(m,{flex:"none",marginRight:1,padding:1,children:n(x,{animate:!0,content:n(u,{size:1,children:B("preview-frame.navigator.toggle-button.tooltip")}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(a,{"aria-label":B("preview-frame.navigator.toggle-button.aria-label"),fontSize:1,icon:Ie,mode:"bleed",onClick:M,padding:2,selected:g})})}),n(x,{animate:!0,content:r(c,{align:"center",style:{whiteSpace:"nowrap"},children:[n(m,{padding:1,children:n(u,{size:1,children:B("preview-frame.overlay.toggle-button.tooltip",{context:V?"disable":"enable"})})}),n(m,{paddingY:1,children:n(re,{keys:["Alt"],style:{marginTop:-4,marginBottom:-4}})})]}),fallbackPlacements:["bottom-start"],padding:1,placement:"bottom",portal:!0,children:n(s,{as:"label",flex:"none",marginRight:1,padding:3,style:{lineHeight:0,borderRadius:999,userSelect:"none"},tone:V?"transparent":void 0,children:r(c,{align:"center",gap:3,children:[n("div",{style:{margin:-4},children:n(k,{checked:V,onChange:N,disabled:"loading"===l.status||"connected"!==D})}),n(m,{children:n(u,{muted:!V,size:1,weight:"medium",children:B("preview-frame.overlay.toggle-button.text")})})]})})}),n(m,{flex:1,marginX:1,children:n(Tn,{prefix:n(m,{padding:1,children:n(x,{animate:!0,content:n(u,{size:1,children:"loaded"===l.status?B("preview-frame.refresh-button.tooltip"):B("preview-frame.status",{context:l.status})}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(a,{"aria-label":B("preview-frame.refresh-button.aria-label"),fontSize:1,icon:_e,mode:"bleed",loading:"reloading"===l.status||"refreshing"===l.status,onClick:ie,padding:2})})}),onChange:b,origin:ne,suffix:n(m,{padding:1,children:n(E,{button:n(a,{fontSize:1,iconRight:ze,mode:"bleed",padding:2,space:2}),id:"location-menu",menu:n(S,{children:n(Un,{initialUrl:p,openPopup:z,previewLocationOrigin:ne,previewLocationRoute:me})}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),value:me})}),n(c,{align:"center",flex:"none",gap:1,padding:1,children:n(E,{button:n(a,{fontSize:1,iconRight:De,mode:"bleed",padding:2,space:2,text:B(Mn["connected"===v?L:"previewDrafts"]),loading:"reconnecting"===v&&"loaded"!==l.status,disabled:"connected"!==v}),id:"perspective-menu",menu:r(S,{style:{maxWidth:240},children:[n(y,{fontSize:1,onClick:()=>T("previewDrafts"),padding:3,pressed:"previewDrafts"===L,tone:Nn,children:r(c,{align:"flex-start",gap:3,children:[n(m,{flex:"none",children:n(u,{size:1,children:A(Kn.previewDrafts)})}),r(d,{flex:1,space:2,children:[n(u,{size:1,weight:"medium",children:B(Mn.previewDrafts)}),n(u,{muted:!0,size:1,children:B("preview-frame.perspective.previewDrafts.text")})]}),n(m,{flex:"none",children:n(u,{muted:!0,size:1,style:{opacity:"previewDrafts"===L?1:0},children:n(Le,{})})})]})}),n(y,{fontSize:1,onClick:()=>T("published"),padding:3,pressed:"published"===L,tone:Fn,children:r(c,{align:"flex-start",gap:3,children:[n(m,{flex:"none",children:n(u,{size:1,children:A(Kn.published)})}),r(d,{flex:1,space:2,children:[n(u,{size:1,weight:"medium",children:B(Mn.published)}),n(u,{muted:!0,size:1,children:B("preview-frame.perspective.published.text")})]}),n(m,{flex:"none",children:n(u,{muted:!0,size:1,style:{opacity:"published"===L?1:0},children:n(Le,{})})})]})})]}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),n(c,{align:"center",flex:"none",gap:1,children:n(x,{animate:!0,content:n(u,{size:1,children:B("preview-frame.viewport-button.tooltip",{context:"desktop"===F?"narrow":"full"})}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(a,{"aria-label":B("preview-frame.viewport-button.aria-label"),fontSize:1,icon:"desktop"===F?Ce:Oe,mode:"bleed",onClick:H,padding:2})})})]})}),n(s,{flex:1,tone:"transparent",children:r(c,{align:"center",height:"fill",justify:"center",padding:"desktop"===F?0:2,sizing:"border",style:{position:"relative",cursor:te?"wait":void 0},children:[n(qe,{children:Y||J||Q||!le||se?(J||"connecting"===D&&"refreshing"!==l.status)&&!se?n(Wn,{initial:"initial",animate:"animate",exit:"exit",variants:qn,justify:"center",align:"center",style:{inset:"0",position:"absolute"},children:r(c,{style:{...Bn[F]},justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(u,{muted:!0,size:1,children:B("preview-frame.status",{context:"loading"})})]})}):Y&&!se?n(Wn,{initial:"initial",animate:"animate",exit:"exit",variants:Gn,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:B("preview-frame.connection.error.text"),onRetry:oe,onContinueAnyway:ae,children:q&&r(i,{children:["connected"!==D&&n(s,{padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:B("preview-frame.overlay.connection-status.label")}),n(h,{size:1,children:B("channel.status",{context:D})})]})}),"connected"!==v&&n(s,{padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:B("preview-frame.loader.connection-status.label")}),n(h,{size:1,children:B("channel.status",{context:v})})]})})]})})}):null:n(Wn,{initial:"initial",animate:"animate",exit:"exit",variants:qn,justify:"center",align:"center",style:{inset:"0",position:"absolute",backdropFilter:X?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",transition:"backdrop-filter 0.2s ease-in-out",WebkitBackdropFilter:X?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",WebkitTransition:"-webkit-backdrop-filter 0.2s ease-in-out",zIndex:1},children:r(c,{style:{...Bn[F]},justify:"center",align:"center",direction:"column",gap:4,children:[X&&n(a,{disabled:!0,fontSize:1,mode:"ghost",text:B("preview-frame.continue-button.text"),style:{opacity:0}}),n(s,{radius:2,tone:X?"caution":"inherit",padding:4,shadow:1,children:r(c,{justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(u,{muted:!0,size:1,children:B("preview-frame.status",X?{context:"timeout"}:{context:"connecting"})})]})}),X&&n(a,{fontSize:1,tone:"critical",onClick:ae,text:B("preview-frame.continue-button.text")})]})})}),n(Rn,{animate:ve,initial:["background"],onLoad:he,preventClick:fe,ref:t,src:p.toString(),variants:Hn})]})})]})})})),Bn={desktop:{width:"100%",height:"100%"},mobile:{width:375,height:650}},qn={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Gn={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Hn={desktop:{...Bn.desktop,boxShadow:"0 0 0 0px var(--card-border-color)"},mobile:{...Bn.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 Jn=!1;function Xn(e,t){return e instanceof Function?e(t):e}function Zn(e,t){const n=Array.isArray(e)?e:[e];for(e of n){let n,r=e;if("string"==typeof e)try{const t=new URL(e);n=t.origin,r=t.pathname}catch{}if(!n||t.origin===n)try{const e=Je(r,{decode:decodeURIComponent})(t.pathname);if(e){const{params:t,path:r}=e;return{origin:n,params:t,path:r}}}catch{throw new Error(`"${e}" is not a valid route pattern`)}}}function Qn(e){const{navigate:t,navigationHistory:n,path:r,previewUrl:i,resolvers:o=[]}=e,{state:a}=ce(),s=te({apiVersion:ve}),[c,l]=$(void 0),d=O(void 0),u=C((()=>{var e,t;const n=r||(null==(t=null==(e=a._searchParams)?void 0:e.find((([e])=>"preview"===e)))?void 0:t[1])||"",o="string"==typeof i?i:"object"==typeof i&&(null==i?void 0:i.origin)||location.origin;return new URL(n,o)}),[r,i,a._searchParams]),p=j((()=>{l(void 0),d.current=void 0}),[]);return R((()=>{if(o.length&&u){let p;for(const e of o){const t=Zn(e.route,u);if(t){p={context:t,resolver:e};break}}if(p){const o=function(e,t){var n;if(e.resolve){const r=null==(n=e.resolve(t))?void 0:n.filter;return r?`*[${r}][0]{_id, _type}`:void 0}return"type"in e?`*[_type == "${e.type}"][0]{_id, _type}`:`*[${Xn(e.filter,t)}][0]{_id, _type}`}(p.resolver,p.context),m=(e=p.resolver,r=p.context,e.resolve?null!=(a=null==(i=e.resolve(r))?void 0:i.params)?a:r.params:"type"in e?{}:null!=(c=Xn(e.params,r))?c:r.params);if(o){const e=new AbortController,r={perspective:"previewDrafts",signal:e.signal};return s.fetch(o,m,r).then((e=>{var r,i;(!e||d.current!==e._id)&&(l({document:e,path:u.pathname}),d.current=null==e?void 0:e._id,(null==(r=n.at(-1))?void 0:r.id)===(null==(i=n.at(-2))?void 0:i.id)&&(null==t||t({id:null==e?void 0:e._id,type:null==e?void 0:e._type})))})).catch((e=>{e instanceof Error&&"AbortError"===e.name||(l({document:void 0,path:u.pathname}),d.current=void 0)})),()=>{e.abort()}}}}var e,r,i,a,c;p()}),[s,p,t,n,o,u]),c}function Yn(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 er(e){if(void 0!==e)return o.toString(function(e){const t=[];for(const n of e.split(".")){const e=St.exec(n);if(e){t.push(e[1],Number(e[2]));continue}const r=It.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}const i=_t.exec(n);i?t.push(i[1],{_key:i[2]}):t.push(n)}return t}(decodeURIComponent(e)))}function tr(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e&&""!==e&&null!==e)))}function nr({initialPreviewUrl:e,routerNavigate:t,routerState:n,routerSearchParams:r,frameStateRef:i}){const o=C((()=>{const{id:t,path:i,type:o}={id:Yn((a=n).id),path:er(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,prefersLatestPublished:r.prefersLatestPublished,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=C((()=>tr({inspect:o.inspect,path:o.path,rev:o.rev,prefersLatestPublished:o.prefersLatestPublished,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.prefersLatestPublished,o.rev,o.since,o.template,o.templateParams,o.view]),s=C((()=>tr({perspective:o.perspective,preview:o.preview,viewport:o.viewport})),[o.perspective,o.preview,o.viewport]),c=O(n);R((()=>{c.current=n}),[n]);const[l,d]=$([n]);return{navigate:j(((e,n={},r)=>{e.id&&(e.id=B(e.id));const{_searchParams:o,...a}=c.current,s=(o||[]).reduce(((e,[t,n])=>(e[t]=n,e)),{}),l=tr({...a,...e}),u=tr({...s,...n});a.id!==l.id&&(delete u.template,delete u.templateParams),l._searchParams=Object.entries(u).reduce(((e,[t,n])=>[...e,[t,n]]),[]);const p=null!=r?r:u.preview===i.current.url;d((e=>[...e,l])),t(l,{replace:p})}),[t,i]),navigationHistory:l,params:o,searchParams:s,structureParams:a}}function rr(e,t,n){var r,i;const o=te({apiVersion:ve}),a=ee(),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,r){const[i,o]=$((()=>r||"")),a=O(0);R((()=>{if(i&&r)return window.clearTimeout(a.current),()=>{a.current=window.setTimeout((()=>{o("")}),100)}}),[i,r]);const s=ne();return C((()=>["@sanity/presentation",t,n,e,null==s?void 0:s.id,ir,i]),[t,null==s?void 0:s.id,e,n,i])}(t,s,c,n),d=function(e,t){const n=te({apiVersion:ve}),r=ne(),[i,o]=$(""),a=e?Ze((async()=>await Ge(n,"@sanity/presentation",typeof window>"u"?"":location.href,null==r?void 0:r.id)),[...t,i]):null;return R((()=>{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 Ze((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?Xe(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 ir=Symbol();const or=F((()=>import("./LoaderQueries.js"))),ar=F((()=>import("./PostMessageRefreshMutations.js"))),sr=de(c)`
`,Tn=T((function(e,t){const{animate:o,initial:a,onLoad:s,preventClick:c,src:l,variants:d}=e;return r(i,{children:[n(jn,{animate:o,initial:a,onLoad:s,ref:t,src:l,variants:d}),c&&n(Ln,{})]})})),Un=function(e){var t;const{fontSize:r=1,onChange:o,origin:a,padding:s=3,prefix:c,suffix:l,value:d}=e,{t:u}=K(pe),{basePath:p="/"}=(null==(t=ee())?void 0:t.activeWorkspace)||{},m=O(null),[h,f]=R(void 0),[v,y]=R(void 0),w=j((e=>{f(e.currentTarget.value)}),[]),b=j((e=>{var t;if("Enter"===e.key){if(void 0===h)return;const e=h.startsWith("/")||""===h?`${a}${h}`:h;if(!e.startsWith(a+"/")&&e!==a)return void y(u("preview-location-input.error",{origin:a,context:"missing-origin"}));if(!a&&(e.startsWith(`${p}/`)||e===p))return void y(u("preview-location-input.error",{basePath:p,context:"same-base-path"}));const n=e===a?a+"/":e;y(void 0),f(void 0),o(n.slice(a.length)),null==(t=m.current)||t.blur()}"Escape"===e.key&&(y(void 0),f(void 0))}),[p,o,a,h,u]),x=j((()=>{y(void 0),f(void 0)}),[]);L((()=>{y(void 0),f(void 0)}),[a,d]);const P=$((()=>({icon:Ee})),[]);return n(i,{children:n(g,{clearButton:v?P:void 0,customValidity:v,fontSize:r,onBlur:x,onClear:()=>{y(void 0),f(a+d)},onChange:w,onKeyDownCapture:b,padding:s,prefix:c,style:{zIndex:1},radius:2,ref:m,space:s,suffix:l,value:void 0===h?`${a}${d}`:h})})};function An(e){const{initialUrl:t,openPopup:o,previewLocationOrigin:a,previewLocationRoute:s}=e,{t:c}=K(pe),l=j((e=>{e.preventDefault(),o(e.currentTarget.href)}),[o]);return r(i,{children:[n(Wn,{initialUrl:t,previewLocationOrigin:a,previewLocationRoute:s}),n(y,{icon:Se,text:c("share-url.menu-item.open.text"),as:"a",href:`${a}${s}`,onClick:l,rel:"opener",target:"_blank"})]})}function Wn(e){const{initialUrl:t,previewLocationOrigin:r,previewLocationRoute:i}=e,{t:o}=K(pe),{push:a}=w(),s=te({apiVersion:ge}),c=ne(),[l,d]=R(!1);return n(y,{disabled:l,onClick:()=>{if(null==navigator||!navigator.clipboard)return a({closable:!0,status:"error",title:o("share-url.clipboard.status",{context:"unsupported"})}),!1;let e;d(!0);const n=`${r}${i}`,l=()=>{a({id:e,closable:!0,status:"success",title:o("share-url.clipboard.status",{context:"success"})}),d(!1)},u=e=>{a({closable:!0,status:"error",title:o("share-url.clipboard.status",{context:"failed"}),description:e.message||e.toString()}),d(!1)};if(Fe(t)){const n=async()=>{e=a({closable:!0,title:o("share-url.clipboard.status",{context:"copying"})});const n=await He(s,"@sanity/presentation",typeof window>"u"?"":location.href,null==c?void 0:c.id);return Ke(t,n.secret,i).toString()};if(typeof ClipboardItem<"u"){const e="text/plain",t=new ClipboardItem({[e]:n().then((t=>new Blob([t],{type:e})))});navigator.clipboard.write([t]).then(l).catch(u)}else n().then((e=>navigator.clipboard.writeText(e))).then(l).catch(u)}else navigator.clipboard.writeText(n).then(l).catch(u)},text:o("share-url.menu-item.copy.text"),icon:Ie})}const Mn=Be(c),Nn={previewDrafts:"preview-frame.perspective.previewDrafts.title",published:"preview-frame.perspective.published.title"},Fn="caution",Kn="positive",Vn={previewDrafts:je,published:Le},Bn=T((function(e,t){const{dispatch:o,iframe:l,initialUrl:p,loadersConnection:v,navigatorEnabled:g,onPathChange:w,onRefresh:_,openPopup:z,overlaysConnection:D,perspective:C,previewUrl:O,setPerspective:T,setViewport:U,targetOrigin:W,toggleNavigator:M,toggleOverlay:N,viewport:F,visualEditing:{overlaysEnabled:V}}=e,{t:B}=K(pe),{devMode:q}=me(),G=b(),H=j((()=>U("desktop"===F?"mobile":"desktop")),[U,F]),J="loading"===l.status||"reloading"===l.status,[X,Z]=R(!1),Q="refreshing"===l.status,[Y,ee]=R(!1),te=J||Q||"connecting"===D,ne=$((()=>W===location.origin?"":W),[W]),ie=j((()=>{_((()=>{"function"==typeof t||null==t||!t.current||(o({type:kn}),t.current.src=`${W}${O||"/"}`)}))}),[o,_,O,W,t]),oe=j((()=>{"function"==typeof t||null==t||!t.current||(t.current.src=p.toString(),o({type:kn}))}),[o,t,p]),ae=j((()=>{ce(!0)}),[]),[se,ce]=R(!1),[le,de]=R(!1);L((()=>{if(!(J||Q||"connecting"!==D&&"reconnecting"!==D)){const e=setTimeout((()=>{de(!0)}),1e3);return()=>clearTimeout(e)}}),[D,J,Q]),L((()=>{if(!J&&!Q&&le){if("connected"===D&&(ee(!1),de(!1),Z(!1),ce(!1)),"connecting"===D){const e=setTimeout((()=>{Z(!0),console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly")}),ye);return()=>clearTimeout(e)}if("reconnecting"===D){const e=setTimeout((()=>{Z(!0),ee(!0)}),ye);return()=>clearTimeout(e)}"disconnected"===D&&ee(!0)}}),[J,D,Q,le]);const ue=$((()=>{const e=new URL(O||"/",W),{pathname:t,search:n}=Ve(e);return`${t}${n}`}),[O,W]),he=j((()=>{o({type:xn})}),[o]);L((()=>{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]);const fe=$((()=>(J||"connecting"===D&&"refreshing"!==l.status)&&!se),[se,l.status,J,D]),ve=$((()=>[fe?"background":"active",J?"reloading":"idle",F,le&&!se?"timedOut":""]),[se,J,fe,le,F]);return n(qe,{transition:G?{duration:0}:void 0,children:r(x,{delay:1e3,children:[n(s,{flex:"none",padding:2,shadow:1,style:{position:"relative"},children:r(c,{align:"center",style:{minHeight:0},children:[M&&n(m,{flex:"none",marginRight:1,padding:1,children:n(P,{animate:!0,content:n(u,{size:1,children:B("preview-frame.navigator.toggle-button.tooltip")}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(a,{"aria-label":B("preview-frame.navigator.toggle-button.aria-label"),fontSize:1,icon:_e,mode:"bleed",onClick:M,padding:2,selected:g})})}),n(P,{animate:!0,content:r(c,{align:"center",style:{whiteSpace:"nowrap"},children:[n(m,{padding:1,children:n(u,{size:1,children:B("preview-frame.overlay.toggle-button.tooltip",{context:V?"disable":"enable"})})}),n(m,{paddingY:1,children:n(re,{keys:["Alt"],style:{marginTop:-4,marginBottom:-4}})})]}),fallbackPlacements:["bottom-start"],padding:1,placement:"bottom",portal:!0,children:n(s,{as:"label",flex:"none",marginRight:1,padding:3,style:{lineHeight:0,borderRadius:999,userSelect:"none"},tone:V?"transparent":void 0,children:r(c,{align:"center",gap:3,children:[n("div",{style:{margin:-4},children:n(k,{checked:V,onChange:N,disabled:"loading"===l.status||"connected"!==D})}),n(m,{children:n(u,{muted:!V,size:1,weight:"medium",children:B("preview-frame.overlay.toggle-button.text")})})]})})}),n(m,{flex:1,marginX:1,children:n(Un,{prefix:n(m,{padding:1,children:n(P,{animate:!0,content:n(u,{size:1,children:"loaded"===l.status?B("preview-frame.refresh-button.tooltip"):B("preview-frame.status",{context:l.status})}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(a,{"aria-label":B("preview-frame.refresh-button.aria-label"),fontSize:1,icon:ze,mode:"bleed",loading:"reloading"===l.status||"refreshing"===l.status,onClick:ie,padding:2})})}),onChange:w,origin:ne,suffix:n(m,{padding:1,children:n(E,{button:n(a,{fontSize:1,iconRight:De,mode:"bleed",padding:2,space:2}),id:"location-menu",menu:n(S,{children:n(An,{initialUrl:p,openPopup:z,previewLocationOrigin:ne,previewLocationRoute:ue})}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),value:ue})}),n(c,{align:"center",flex:"none",gap:1,padding:1,children:n(E,{button:n(a,{fontSize:1,iconRight:Ce,mode:"bleed",padding:2,space:2,text:B(Nn["connected"===v?C:"previewDrafts"]),loading:"reconnecting"===v&&"loaded"!==l.status,disabled:"connected"!==v}),id:"perspective-menu",menu:r(S,{style:{maxWidth:240},children:[n(y,{fontSize:1,onClick:()=>T("previewDrafts"),padding:3,pressed:"previewDrafts"===C,tone:Fn,children:r(c,{align:"flex-start",gap:3,children:[n(m,{flex:"none",children:n(u,{size:1,children:A(Vn.previewDrafts)})}),r(d,{flex:1,space:2,children:[n(u,{size:1,weight:"medium",children:B(Nn.previewDrafts)}),n(u,{muted:!0,size:1,children:B("preview-frame.perspective.previewDrafts.text")})]}),n(m,{flex:"none",children:n(u,{muted:!0,size:1,style:{opacity:"previewDrafts"===C?1:0},children:n($e,{})})})]})}),n(y,{fontSize:1,onClick:()=>T("published"),padding:3,pressed:"published"===C,tone:Kn,children:r(c,{align:"flex-start",gap:3,children:[n(m,{flex:"none",children:n(u,{size:1,children:A(Vn.published)})}),r(d,{flex:1,space:2,children:[n(u,{size:1,weight:"medium",children:B(Nn.published)}),n(u,{muted:!0,size:1,children:B("preview-frame.perspective.published.text")})]}),n(m,{flex:"none",children:n(u,{muted:!0,size:1,style:{opacity:"published"===C?1:0},children:n($e,{})})})]})})]}),popover:{animate:!0,constrainSize:!0,placement:"bottom",portal:!0}})}),n(c,{align:"center",flex:"none",gap:1,children:n(P,{animate:!0,content:n(u,{size:1,children:B("preview-frame.viewport-button.tooltip",{context:"desktop"===F?"narrow":"full"})}),fallbackPlacements:["bottom-start"],padding:2,placement:"bottom",portal:!0,children:n(a,{"aria-label":B("preview-frame.viewport-button.aria-label"),fontSize:1,icon:"desktop"===F?Oe:Re,mode:"bleed",onClick:H,padding:2})})})]})}),n(s,{flex:1,tone:"transparent",children:r(c,{align:"center",height:"fill",justify:"center",padding:"desktop"===F?0:2,sizing:"border",style:{position:"relative",cursor:te?"wait":void 0},children:[n(Ge,{children:Y||J||Q||!le||se?(J||"connecting"===D&&"refreshing"!==l.status)&&!se?n(Mn,{initial:"initial",animate:"animate",exit:"exit",variants:Gn,justify:"center",align:"center",style:{inset:"0",position:"absolute"},children:r(c,{style:{...qn[F]},justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(u,{muted:!0,size:1,children:B("preview-frame.status",{context:"loading"})})]})}):Y&&!se?n(Mn,{initial:"initial",animate:"animate",exit:"exit",variants:Hn,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(Zt,{flex:1,message:B("preview-frame.connection.error.text"),onRetry:oe,onContinueAnyway:ae,children:q&&r(i,{children:["connected"!==D&&n(s,{padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:B("preview-frame.overlay.connection-status.label")}),n(h,{size:1,children:B("channel.status",{context:D})})]})}),"connected"!==v&&n(s,{padding:3,radius:2,tone:"critical",children:r(d,{space:3,children:[n(f,{muted:!0,size:0,children:B("preview-frame.loader.connection-status.label")}),n(h,{size:1,children:B("channel.status",{context:v})})]})})]})})}):null:n(Mn,{initial:"initial",animate:"animate",exit:"exit",variants:Gn,justify:"center",align:"center",style:{inset:"0",position:"absolute",backdropFilter:X?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",transition:"backdrop-filter 0.2s ease-in-out",WebkitBackdropFilter:X?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",WebkitTransition:"-webkit-backdrop-filter 0.2s ease-in-out",zIndex:1},children:r(c,{style:{...qn[F]},justify:"center",align:"center",direction:"column",gap:4,children:[X&&n(a,{disabled:!0,fontSize:1,mode:"ghost",text:B("preview-frame.continue-button.text"),style:{opacity:0}}),n(s,{radius:2,tone:X?"caution":"inherit",padding:4,shadow:1,children:r(c,{justify:"center",align:"center",direction:"column",gap:4,children:[n(I,{muted:!0}),n(u,{muted:!0,size:1,children:B("preview-frame.status",X?{context:"timeout"}:{context:"connecting"})})]})}),X&&n(a,{fontSize:1,tone:"critical",onClick:ae,text:B("preview-frame.continue-button.text")})]})})}),n(Tn,{animate:ve,initial:["background"],onLoad:he,preventClick:fe,ref:t,src:p.toString(),variants:Jn})]})})]})})})),qn={desktop:{width:"100%",height:"100%"},mobile:{width:375,height:650}},Gn={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Hn={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Jn={desktop:{...qn.desktop,boxShadow:"0 0 0 0px var(--card-border-color)"},mobile:{...qn.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]}};const Xn=function(e){const{documentId:t,documentType:n,navigate:r,perspective:i,documentRevision:o}=e,a=ie(t,n);return function(e,t,n,r,i){const o=O(r),a=j(t,n);L((()=>{const t=o.current;if(o.current=e,e!==t)return a(e,t)}),[a,i,e])}(i,(e=>{let t;if("published"===e&&a.published){const{_updatedAt:e,_rev:n}=a.published;t=`${e}/${n}`}o!==t&&r({},{rev:t},!0)}),[a,r,o]),null};let Zn=!1;function Qn(e,t){return e instanceof Function?e(t):e}function Yn(e,t){const n=Array.isArray(e)?e:[e];for(e of n){let n,r=e;if("string"==typeof e)try{const t=new URL(e);n=t.origin,r=t.pathname}catch{}if(!n||t.origin===n)try{const e=Xe(r,{decode:decodeURIComponent})(t.pathname);if(e){const{params:t,path:r}=e;return{origin:n,params:t,path:r}}}catch{throw new Error(`"${e}" is not a valid route pattern`)}}}function er(e){const{navigate:t,navigationHistory:n,path:r,previewUrl:i,resolvers:o=[]}=e,{state:a}=le(),s=te({apiVersion:ge}),[c,l]=R(void 0),d=O(void 0),u=$((()=>{var e,t;const n=r||(null==(t=null==(e=a._searchParams)?void 0:e.find((([e])=>"preview"===e)))?void 0:t[1])||"",o="string"==typeof i?i:"object"==typeof i&&(null==i?void 0:i.origin)||location.origin;return new URL(n,o)}),[r,i,a._searchParams]),p=j((()=>{l(void 0),d.current=void 0}),[]);return L((()=>{if(o.length&&u){let p;for(const e of o){const t=Yn(e.route,u);if(t){p={context:t,resolver:e};break}}if(p){const o=function(e,t){var n;if(e.resolve){const r=null==(n=e.resolve(t))?void 0:n.filter;return r?`*[${r}][0]{_id, _type}`:void 0}return"type"in e?`*[_type == "${e.type}"][0]{_id, _type}`:`*[${Qn(e.filter,t)}][0]{_id, _type}`}(p.resolver,p.context),m=(e=p.resolver,r=p.context,e.resolve?null!=(a=null==(i=e.resolve(r))?void 0:i.params)?a:r.params:"type"in e?{}:null!=(c=Qn(e.params,r))?c:r.params);if(o){const e=new AbortController,r={perspective:"previewDrafts",signal:e.signal};return s.fetch(o,m,r).then((e=>{var r,i;(!e||d.current!==e._id)&&(l({document:e,path:u.pathname}),d.current=null==e?void 0:e._id,(null==(r=n.at(-1))?void 0:r.id)===(null==(i=n.at(-2))?void 0:i.id)&&(null==t||t({id:null==e?void 0:e._id,type:null==e?void 0:e._type})))})).catch((e=>{e instanceof Error&&"AbortError"===e.name||(l({document:void 0,path:u.pathname}),d.current=void 0)})),()=>{e.abort()}}}}var e,r,i,a,c;p()}),[s,p,t,n,o,u]),c}function tr(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 nr(e){if(void 0!==e)return o.toString(function(e){const t=[];for(const n of e.split(".")){const e=It.exec(n);if(e){t.push(e[1],Number(e[2]));continue}const r=_t.exec(n);if(r){t.push(r[1],[Number(r[2]),Number(r[3])]);continue}const i=zt.exec(n);i?t.push(i[1],{_key:i[2]}):t.push(n)}return t}(decodeURIComponent(e)))}function rr(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e&&""!==e&&null!==e)))}function ir({initialPreviewUrl:e,routerNavigate:t,routerState:n,routerSearchParams:r,frameStateRef:i}){const o=$((()=>{const{id:t,path:i,type:o}={id:tr((a=n).id),path:nr(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=$((()=>rr({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=$((()=>rr({perspective:o.perspective,preview:o.preview,viewport:o.viewport})),[o.perspective,o.preview,o.viewport]),c=O(n);L((()=>{c.current=n}),[n]);const[l,d]=R([n]);return{navigate:j(((e,n={},r)=>{e.id&&(e.id=B(e.id));const{_searchParams:o,...a}=c.current,s=(o||[]).reduce(((e,[t,n])=>(e[t]=n,e)),{}),l=rr({...a,...e}),u=rr({...s,...n});a.id!==l.id&&(delete u.template,delete u.templateParams),l._searchParams=Object.entries(u).reduce(((e,[t,n])=>[...e,[t,n]]),[]);const p=null!=r?r:u.preview===i.current.url;d((e=>[...e,l])),t(l,{replace:p})}),[t,i]),navigationHistory:l,params:o,searchParams:s,structureParams:a}}function or(e,t,n){var r,i;const o=te({apiVersion:ge}),a=ee(),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,r){const[i,o]=R((()=>r||"")),a=O(0);L((()=>{if(i&&r)return window.clearTimeout(a.current),()=>{a.current=window.setTimeout((()=>{o("")}),100)}}),[i,r]);const s=ne();return $((()=>["@sanity/presentation",t,n,e,null==s?void 0:s.id,ar,i]),[t,null==s?void 0:s.id,e,n,i])}(t,s,c,n),d=function(e,t){const n=te({apiVersion:ge}),r=ne(),[i,o]=R(""),a=e?Qe((async()=>await He(n,"@sanity/presentation",typeof window>"u"?"":location.href,null==r?void 0:r.id)),[...t,i]):null;return L((()=>{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 Qe((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?Ze(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 ar=Symbol();const sr=F((()=>import("./LoaderQueries.js"))),cr=F((()=>import("./PostMessageRefreshMutations.js"))),lr=ue(c)`
overflow-x: auto;
`;function cr(e){var t,a,s,l;const{previewUrl:d,components:u}=null!=(t=e.tool.options)?t:{},p=e.tool.name||Pe,{unstable_navigator:m}=u||{},{navigate:h,state:f}=ce(),v=V(Object.fromEntries(f._searchParams||[])),g=rr(d||"/",p,v.preview||null),[y]=$((()=>{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})),b=C((()=>g.origin),[g.origin]),w=O(null),[P,x]=$(),[k,E]=$({}),S=O({title:void 0,url:void 0}),{navigate:I,navigationHistory:z,params:D,searchParams:L,structureParams:T}=nr({initialPreviewUrl:g,routerNavigate:h,routerState:f,routerSearchParams:v,frameStateRef:S}),U=C((()=>$t(I,50)),[I]),[A,W]=M(En,{},On),F=C((()=>D.perspective?"published":"previewDrafts"),[D.perspective]),K=C((()=>D.viewport?"mobile":"desktop"),[D.viewport]),[B,q]=function(e,t){if("published"!==e&&"previewDrafts"!==e)throw new Error(`Invalid perspective: ${e}`);const[n,r]=$({}),[i,o]=$({}),a=O(""),s=j(((e,n,i=[])=>{const s=i.filter((e=>"_projectId"in e&&e._projectId?(Jn||(console.warn("Cross dataset references are not supported yet, ignoring source document",e),Jn=!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 He(i,r)?n:{...n,[e]:r}}))}),[t]);return[C((()=>{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]}(F,S),G=ie(),H=oe(),J=Qn({navigate:I,navigationHistory:z,path:D.preview,previewUrl:null==(a=e.tool.options)?void 0:a.previewUrl,resolvers:null==(l=null==(s=e.tool.options)?void 0:s.resolve)?void 0:l.mainDocuments}),[X,Z]=$("connecting"),[Q,Y]=$("connecting"),[ee,te]=$("connecting"),[ne]=$((()=>new Set)),re=j((e=>{const t=window.open(e,"_blank");t&&ne.add(t)}),[ne]);R((()=>{if(ne.size&&P)for(const e of ne)e&&"closed"in e&&!e.closed&&P.addSource(e)}),[P,ne,ne.size]);const se=O(F);R((()=>{se.current=F}),[F]),R((()=>{var e;const t=null==(e=w.current)?void 0:e.contentWindow;if(!t)return;const n=function(e){const{destroy:t,send:n}=dt(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}=dt({...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:b,connectTo:[{id:"overlays",heartbeat:!0,onStatusUpdate:Z,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;S.current.url!==n&&U({},{preview:n}),S.current={title:e,url:n}}else"visual-editing/meta"===e?S.current.title=t.title:"visual-editing/toggle"===e||"overlay/toggle"===e?W({type:kn,enabled:t.enabled}):"visual-editing/documents"===e?q("visual-editing",t.perspective,t.documents):"visual-editing/refreshing"===e&&"manual"===t.source?clearTimeout(Ie.current):"visual-editing/refreshing"===e&&"mutation"===t.source?W({type:Pn}):"visual-editing/refreshed"===e&&W({type:wn});else U({type:t.type,id:t.id,path:t.path},{prefersLatestPublished:"isDraft"in t||"previewDrafts"===se.current?void 0:"true"})}},{id:"loaders",heartbeat:!0,onStatusUpdate:Y,onEvent(e,t){if("loader/documents"===e&&t.projectId===G&&t.dataset===H)q("loaders",t.perspective,t.documents);else if("loader/query-listen"===e&&t.projectId===G&&t.dataset===H){if("number"==typeof t.heartbeat&&t.heartbeat<ye)throw new Error(`Loader query listen heartbeat interval must be at least ${ye}ms`);E((e=>{var n;return{...e,[Lt(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:te,onEvent(e,t){"preview-kit/documents"===e&&t.projectId===G&&t.dataset===H&&q("preview-kit",t.perspective,t.documents)}}]});return x(n),()=>{n.destroy(),x(void 0)}}),[H,G,q,U,b]),R((()=>{const e=setInterval((()=>E((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}))),ye);return()=>clearInterval(e)}),[]);const le=j((e=>{U({path:o.toString(e)},{},!0)}),[U]),de=j((e=>{const t=new URL(e,g.origin),n=t.pathname+t.search;t.origin===g.origin&&n!==D.preview&&U({},{preview:n})}),[g,D,U]),ue=j((e=>{U({},{...e,prefersLatestPublished:void 0})}),[U]);R((()=>{null==P||P.send("overlays","presentation/perspective",{perspective:F})}),[P,F]),R((()=>{D.id&&D.path?null==P||P.send("overlays","presentation/focus",{id:D.id,path:D.path}):null==P||P.send("overlays","presentation/blur",void 0)}),[P,D.id,D.path]);const pe=O(void 0);R((()=>{"published"===F&&D.id&&D.id!==pe.current&&!D.rev&&!D.prefersLatestPublished&&U({},{prefersLatestPublished:"true"},!0),pe.current=D.id}),[U,D.id,D.prefersLatestPublished,D.rev,F]),R((()=>{S.current.url&&D.preview&&S.current.url!==D.preview&&(S.current.url=D.preview,"connected"!==X&&w.current?w.current.src=`${b}${D.preview}`:null==P||P.send("overlays","presentation/navigate",{url:D.preview,type:"replace"}))}),[P,X,b,D.preview]);const me=j((()=>null==P?void 0:P.send("overlays","presentation/toggleOverlay",void 0)),[P]),[he,fe]=$(null);R((()=>{const e=e=>{Ot(e)&&me()},t=e=>{var t;Ot(e)&&me(),t=e,["mod","\\"].every((e=>Ct[e]?t[Ct[e]]:t.key===e.toUpperCase()))&&me()};return window.addEventListener("keydown",t),window.addEventListener("keyup",e),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",e)}}),[me]);const[ve,ge]=$(null),[{navigatorEnabled:xe,toggleNavigator:ke},Ee]=vn({unstable_navigator:m}),Se=O(D.id);R((()=>{D.rev&&Se.current&&D.id!==Se.current&&U({},{rev:void 0}),Se.current=D.id}));const Ie=O(),_e=j((e=>{if(W({type:Pn}),P)return Ie.current=window.setTimeout(e,300),void P.send("overlays","presentation/refresh",{source:"manual",livePreviewEnabled:"connected"===ee||"connected"===Q});e()}),[P,Q,ee]),ze=ae(),De=j((({id:e,type:t,path:n})=>{if(S.current.url)return{title:S.current.title||S.current.url,name:"edit",params:{id:e,path:n,type:t,inspect:be,workspace:ze.name,mode:we,preview:D.preview}}}),[D.preview,ze.name]),Le=j((e=>{U({},{viewport:"desktop"===e?void 0:"mobile"},!0)}),[U]),Ce=j((e=>{U({},{perspective:"previewDrafts"===e?void 0:e})}),[U]);return r(i,{children:[n(bn,{devMode:y,name:p,navigate:U,params:D,searchParams:L,structureParams:T,children:n(fn,{navigate:U,children:n(yn,{params:D,children:n(sr,{height:"fill",children:r(Jt,{children:[n(Ee,{}),n(Tt,{id:"preview",minWidth:325,defaultSize:xe?50:75,order:3,children:n(c,{direction:"column",flex:1,height:"fill",ref:ge,children:n(_,{element:ve,children:n(Vn,{dispatch:W,iframe:A.iframe,initialUrl:g,loadersConnection:Q,navigatorEnabled:xe,onPathChange:de,onRefresh:_e,openPopup:re,overlaysConnection:X,previewUrl:D.preview,perspective:F,ref:w,setPerspective:Ce,setViewport:Le,targetOrigin:b,toggleNavigator:ke,toggleOverlay:me,viewport:K,visualEditing:A.visualEditing})})})}),n(hn,{documentId:D.id,documentsOnPage:B,documentType:D.type,getCommentIntent:De,mainDocumentState:J,onFocusPath:le,onStructureParams:ue,searchParams:L,setDisplayedDocument:fe,structureParams:T})]})})})})}),P&&n(N,{children:n(or,{channel:P,liveQueries:k,perspective:F,liveDocument:he,documentsOnPage:B})}),P&&D.id&&D.type&&n(N,{children:n(ar,{channel:P,id:D.id,type:D.type,loadersConnection:Q,previewKitConnection:ee})})]})}export{cr as default};//# sourceMappingURL=PresentationTool.js.map
`;function dr(e){var t,a,s,l;const{previewUrl:d,components:u}=null!=(t=e.tool.options)?t:{},p=e.tool.name||Pe,{unstable_navigator:m}=u||{},{navigate:h,state:f}=le(),v=V(Object.fromEntries(f._searchParams||[])),g=or(d||"/",p,v.preview||null),[y]=R((()=>{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})),w=$((()=>g.origin),[g.origin]),b=O(null),[x,P]=R(),[k,E]=R({}),S=O({title:void 0,url:void 0}),{navigate:I,navigationHistory:z,params:D,searchParams:C,structureParams:T}=ir({initialPreviewUrl:g,routerNavigate:h,routerState:f,routerSearchParams:v,frameStateRef:S}),U=$((()=>jt(I,50)),[I]),[A,W]=M(Sn,{},Rn),F=$((()=>D.perspective?"published":"previewDrafts"),[D.perspective]),K=$((()=>D.viewport?"mobile":"desktop"),[D.viewport]),[B,q]=function(e,t){if("published"!==e&&"previewDrafts"!==e)throw new Error(`Invalid perspective: ${e}`);const[n,r]=R({}),[i,o]=R({}),a=O(""),s=j(((e,n,i=[])=>{const s=i.filter((e=>"_projectId"in e&&e._projectId?(Zn||(console.warn("Cross dataset references are not supported yet, ignoring source document",e),Zn=!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 Je(i,r)?n:{...n,[e]:r}}))}),[t]);return[$((()=>{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]}(F,S),G=oe(),H=ae(),J=er({navigate:I,navigationHistory:z,path:D.preview,previewUrl:null==(a=e.tool.options)?void 0:a.previewUrl,resolvers:null==(l=null==(s=e.tool.options)?void 0:s.resolve)?void 0:l.mainDocuments}),[X,Z]=R("connecting"),[Q,Y]=R("connecting"),[ee,te]=R("connecting"),[ne]=R((()=>new Set)),re=j((e=>{const t=window.open(e,"_blank");t&&ne.add(t)}),[ne]);L((()=>{if(ne.size&&x)for(const e of ne)e&&"closed"in e&&!e.closed&&x.addSource(e)}),[x,ne,ne.size]),L((()=>{var e;const t=null==(e=b.current)?void 0:e.contentWindow;if(!t)return;const n=function(e){const{destroy:t,send:n}=ut(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}=ut({...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:w,connectTo:[{id:"overlays",heartbeat:!0,onStatusUpdate:Z,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;S.current.url!==n&&U({},{preview:n}),S.current={title:e,url:n}}else"visual-editing/meta"===e?S.current.title=t.title:"visual-editing/toggle"===e||"overlay/toggle"===e?W({type:En,enabled:t.enabled}):"visual-editing/documents"===e?q("visual-editing",t.perspective,t.documents):"visual-editing/refreshing"===e&&"manual"===t.source?clearTimeout(Ee.current):"visual-editing/refreshing"===e&&"mutation"===t.source?W({type:Pn}):"visual-editing/refreshed"===e&&W({type:xn});else U({type:t.type,id:t.id,path:t.path})}},{id:"loaders",heartbeat:!0,onStatusUpdate:Y,onEvent(e,t){if("loader/documents"===e&&t.projectId===G&&t.dataset===H)q("loaders",t.perspective,t.documents);else if("loader/query-listen"===e&&t.projectId===G&&t.dataset===H){if("number"==typeof t.heartbeat&&t.heartbeat<we)throw new Error(`Loader query listen heartbeat interval must be at least ${we}ms`);E((e=>{var n;return{...e,[$t(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:te,onEvent(e,t){"preview-kit/documents"===e&&t.projectId===G&&t.dataset===H&&q("preview-kit",t.perspective,t.documents)}}]});return P(n),()=>{n.destroy(),P(void 0)}}),[H,G,q,U,w]),L((()=>{const e=setInterval((()=>E((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}))),we);return()=>clearInterval(e)}),[]);const ie=j((e=>{U({path:o.toString(e)},{},!0)}),[U]),ce=j((e=>{const t=new URL(e,g.origin),n=t.pathname+t.search;t.origin===g.origin&&n!==D.preview&&U({},{preview:n})}),[g,D,U]),de=j((e=>{U({},e)}),[U]);L((()=>{null==x||x.send("overlays","presentation/perspective",{perspective:F})}),[x,F]),L((()=>{D.id&&D.path?null==x||x.send("overlays","presentation/focus",{id:D.id,path:D.path}):null==x||x.send("overlays","presentation/blur",void 0)}),[x,D.id,D.path]),L((()=>{S.current.url&&D.preview&&S.current.url!==D.preview&&(S.current.url=D.preview,"connected"!==X&&b.current?b.current.src=`${w}${D.preview}`:null==x||x.send("overlays","presentation/navigate",{url:D.preview,type:"replace"}))}),[x,X,w,D.preview]);const ue=j((()=>null==x?void 0:x.send("overlays","presentation/toggleOverlay",void 0)),[x]),[pe,me]=R(null);L((()=>{const e=e=>{Rt(e)&&ue()},t=e=>{var t;Rt(e)&&ue(),t=e,["mod","\\"].every((e=>Ot[e]?t[Ot[e]]:t.key===e.toUpperCase()))&&ue()};return window.addEventListener("keydown",t),window.addEventListener("keyup",e),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",e)}}),[ue]);const[he,fe]=R(null),[{navigatorEnabled:ve,toggleNavigator:ge},ye]=gn({unstable_navigator:m}),ke=O(D.id);L((()=>{D.rev&&ke.current&&D.id!==ke.current&&U({},{rev:void 0}),ke.current=D.id}));const Ee=O(),Se=j((e=>{if(W({type:Pn}),x)return Ee.current=window.setTimeout(e,300),void x.send("overlays","presentation/refresh",{source:"manual",livePreviewEnabled:"connected"===ee||"connected"===Q});e()}),[x,Q,ee]),Ie=se(),_e=j((({id:e,type:t,path:n})=>{if(S.current.url)return{title:S.current.title||S.current.url,name:"edit",params:{id:e,path:n,type:t,inspect:be,workspace:Ie.name,mode:xe,preview:D.preview}}}),[D.preview,Ie.name]),ze=j((e=>{U({},{viewport:"desktop"===e?void 0:"mobile"},!0)}),[U]),De=j((e=>{U({},{perspective:"previewDrafts"===e?void 0:e})}),[U]);return r(i,{children:[n(bn,{devMode:y,name:p,navigate:U,params:D,searchParams:C,structureParams:T,children:n(vn,{navigate:U,children:n(wn,{params:D,children:n(lr,{height:"fill",children:r(Xt,{children:[n(ye,{}),n(Ut,{id:"preview",minWidth:325,defaultSize:ve?50:75,order:3,children:n(c,{direction:"column",flex:1,height:"fill",ref:fe,children:n(_,{element:he,children:n(Bn,{dispatch:W,iframe:A.iframe,initialUrl:g,loadersConnection:Q,navigatorEnabled:ve,onPathChange:ce,onRefresh:Se,openPopup:re,overlaysConnection:X,previewUrl:D.preview,perspective:F,ref:b,setPerspective:De,setViewport:ze,targetOrigin:w,toggleNavigator:ge,toggleOverlay:ue,viewport:K,visualEditing:A.visualEditing})})})}),n(fn,{documentId:D.id,documentsOnPage:B,documentType:D.type,getCommentIntent:_e,mainDocumentState:J,onFocusPath:ie,onStructureParams:de,searchParams:C,setDisplayedDocument:me,structureParams:T})]})})})})}),x&&n(N,{children:n(sr,{channel:x,liveQueries:k,perspective:F,liveDocument:pe,documentsOnPage:B})}),x&&D.id&&D.type&&n(N,{children:n(cr,{channel:x,id:D.id,type:D.type,loadersConnection:Q,previewKitConnection:ee})}),D.id&&D.type&&n(Xn,{documentId:D.id,documentRevision:D.rev,documentType:D.type,navigate:U,perspective:F})]})}export{dr as default};//# sourceMappingURL=PresentationTool.js.map

@@ -294,3 +294,2 @@ /// <reference types="react" />

rev?: string
prefersLatestPublished?: string
since?: string

@@ -297,0 +296,0 @@ template?: string

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

@@ -94,3 +94,3 @@ "bugs": {

"@sanity/icons": "^3.2.0",
"@sanity/preview-url-secret": "^1.6.18",
"@sanity/preview-url-secret": "^1.6.19",
"@sanity/ui": "^2.6.1",

@@ -111,4 +111,4 @@ "@sanity/uuid": "3.0.2",

"@repo/channels": "0.4.0",
"@repo/visual-editing-helpers": "0.6.18",
"@sanity/client": "^6.20.1",
"@repo/visual-editing-helpers": "0.6.19",
"@sanity/client": "^6.21.1",
"@sanity/pkg-utils": "6.9.3",

@@ -126,3 +126,3 @@ "@types/lodash.get": "^4.4.9",

"peerDependencies": {
"@sanity/client": "^6.20.1"
"@sanity/client": "^6.21.1"
},

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

import {uuid} from '@sanity/uuid'
import {type SearchParam} from 'sanity/router'
import {type RouterState, type SearchParam} from 'sanity/router'
import {encodeJsonParams, getPublishedId} from './internals'
import type {PresentationStateParams} from './types'
import type {PresentationSearchParams, PresentationStateParams} from './types'
const preservedSearchParamKeys: Array<keyof PresentationSearchParams> = [
'preview',
'perspective',
'viewport',
]
/**

@@ -13,3 +19,3 @@ * @internal

params: Record<string, string>,
_routerState: undefined,
routerState: RouterState | undefined,
payload: unknown,

@@ -22,2 +28,12 @@ ):

const preservedSearchParams = (routerState?._searchParams || [])
// @todo Casting https://github.com/microsoft/TypeScript/issues/14520
.filter(([key]) => preservedSearchParamKeys.includes(key as keyof PresentationSearchParams))
.reduce((acc, [key, value]) => ({...acc, [key]: value}), {} as Record<string, string>)
const _searchParams = {
...preservedSearchParams,
...searchParams,
}
if (intent === 'edit' && id) {

@@ -28,3 +44,3 @@ return {

path,
_searchParams: Object.entries(searchParams),
_searchParams: Object.entries(_searchParams),
}

@@ -34,7 +50,7 @@ }

if (intent === 'create') {
searchParams['preview'] =
searchParams['preview'] || new URLSearchParams(window.location.search).get('preview') || '/'
_searchParams['preview'] =
_searchParams['preview'] || new URLSearchParams(window.location.search).get('preview') || '/'
if (payload && typeof payload === 'object') {
searchParams['templateParams'] = encodeJsonParams(payload as Record<string, unknown>)
_searchParams['templateParams'] = encodeJsonParams(payload as Record<string, unknown>)
}

@@ -45,3 +61,3 @@

id: id || uuid(),
_searchParams: Object.entries(searchParams),
_searchParams: Object.entries(_searchParams),
}

@@ -48,0 +64,0 @@ }

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

rev?: string
prefersLatestPublished?: string
since?: string

@@ -191,0 +190,0 @@ template?: string

@@ -103,39 +103,18 @@ import get from 'lodash.get'

function observeForLocations(
doc: {id: string; type: string},
resolver:
| DocumentLocationsState
| DocumentLocationResolver
| DocumentLocationResolverObject<string>
| undefined,
documentId: string,
resolver: DocumentLocationResolverObject<string>,
documentStore: DocumentStore,
) {
if (!resolver) return of(undefined)
const {id, type} = doc
// Original/advanced resolver which requires explicit use of Observables
if (typeof resolver === 'function') {
const params = {id, type}
const context = {documentStore}
const _result = resolver(params, context)
return isObservable(_result) ? _result : of(_result)
}
// Simplified resolver pattern which abstracts away Observable logic
if ('select' in resolver && 'resolve' in resolver) {
const {select} = resolver
const paths = Object.values(select).map((value) => String(value).split('.')) || []
const doc = {_type: 'reference', _ref: id}
return observeDocument(doc, paths, documentStore).pipe(
map((doc) => {
return Object.keys(select).reduce<Record<string, unknown>>((acc, key) => {
acc[key] = get(doc, select[key])
return acc
}, {})
}),
map(resolver.resolve),
)
}
// Resolver is explicitly provided state
return of(resolver)
const {select} = resolver
const paths = Object.values(select).map((value) => String(value).split('.')) || []
const doc = {_type: 'reference', _ref: documentId}
return observeDocument(doc, paths, documentStore).pipe(
map((doc) => {
return Object.keys(select).reduce<Record<string, unknown>>((acc, key) => {
acc[key] = get(doc, select[key])
return acc
}, {})
}),
map(resolver.resolve),
)
}

@@ -174,3 +153,3 @@

if ('select' in resolver && 'resolve' in resolver) {
return observeForLocations({id, type}, resolver, documentStore)
return observeForLocations(id, resolver, documentStore)
}

@@ -177,0 +156,0 @@

@@ -58,3 +58,2 @@ import {type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState} from 'react'

rev: routerSearchParams['rev'],
prefersLatestPublished: routerSearchParams['prefersLatestPublished'],
since: routerSearchParams['since'],

@@ -77,3 +76,2 @@ template: routerSearchParams['template'],

rev: params.rev,
prefersLatestPublished: params.prefersLatestPublished,
since: params.since,

@@ -96,3 +94,2 @@ template: params.template,

params.pathKey,
params.prefersLatestPublished,
params.rev,

@@ -99,0 +96,0 @@ params.since,

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc