1"use strict";(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[1754],{11754:(e,t,r)=>{r.r(t),r.d(t,{default:()=>S,turboChargeResultIfSourceMap:()=>A});var s=r(87448),n=r(97783),a=r(5453);function i(e){return"https://www.sanity.io/help/"+e}let u=e=>(function(e){let t=!1,r;return(...s)=>(t||(r=e(...s),t=!0),r)})((...t)=>console.warn(e.join(" "),...t));u(["Because you set `withCredentials` to true, we will override your `useCdn`","setting to be false since (cookie-based) credentials are never set on the CDN"]),u(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),u(["The Sanity client is configured with the `perspective` set to `drafts` or `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),u(["The `previewDrafts` perspective has been renamed to `drafts` and will be removed in a future API version"]),u(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${i("js-client-browser-token")} for more information and how to hide this warning.`]),u(["You have configured Sanity client to use a token, but also provided `withCredentials: true`.","This is no longer supported - only token will be used - remove `withCredentials: true`."]),u(["Using the Sanity client without specifying an API version is deprecated.",`See ${i("js-client-api-version")}`]),u(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),u(["You have called `createVersion()` with a defined `document`. The recommended approach is to provide a `baseId` and `releaseId` instead."]);var o=r(44919),l=r(46858),c=r(24719),d=r(23796),p=r(30289),f=r(4257),h=r(9100),v=r(81681);function y(e,t){switch(t.type){case"message":return{...e,messages:[...e.messages,t]};case"reconnect":case"restart":return{...e,messages:[],resets:e.resets+1};case"welcome":return e;default:throw Error(`Unknown event: ${t.type}`,{cause:t})}}let w={messages:[],resets:0},b=(e,{previousValue:t})=>{if("string"==typeof t){if("number"==typeof e)return`${e}`;if(Array.isArray(e)){if(0===e.length)return"";if(e.some(e=>"object"==typeof e&&(0,v.IG)(e)))return(0,v.bo)(e)}}return e};function m(e,t){switch(t.type){case"query-listen":return function(e,{payload:t}){var r,s,n;let a=(r=t.perspective,s=t.query,n=t.params,`${r}:${s}:${JSON.stringify(n)}`),i={query:t.query,params:t.params,perspective:t.perspective},u=new Map(e.heartbeats);u.set(a,{receivedAt:Date.now(),heartbeat:t.heartbeat});let o=e.queries;return e.queries.has(a)&&c(e.queries.get(a),i)||(o=new Map(e.queries)).set(a,i),{heartbeats:u,queries:o}}(e,t);case"gc":if(e.queries.size<1)return e;let r=Date.now();if(!Array.from(e.heartbeats.values()).some(e=>!1!==e.heartbeat&&r>e.receivedAt+e.heartbeat))return e;let s=new Map,n=new Map;for(let[t,a]of e.heartbeats.entries())!1!==a.heartbeat&&r>a.receivedAt+a.heartbeat||(s.set(t,a),n.set(t,e.queries.get(t)));return{...e,queries:n,heartbeats:s};default:throw Error(`Unknown action: ${t.type}`,{cause:t})}}let g={queries:new Map,heartbeats:new Map};function S(e){let t,r,a,i,u,c,f,v,b=(0,n.c)(28),{controller:S,perspective:q,onLoadersConnection:A,onDocumentsOnPage:T}=e,[E,M]=(0,d.useState)(),[C,D]=function(){let e,t,r,s=(0,n.c)(4),[a,i]=(0,d.useReducer)(m,g);s[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=setInterval(()=>i({type:"gc"}),h.UR);return()=>clearInterval(e)},t=[],s[0]=e,s[1]=t):(e=s[0],t=s[1]),(0,d.useEffect)(e,t);let u=(0,d.useDeferredValue)(a.queries);return s[2]!==u?(r=[u,i],s[2]=u,s[3]=r):r=s[3],r}(),k=(0,p.M91)(),j=(0,p.EL1)();b[0]!==S||b[1]!==j||b[2]!==D||b[3]!==T||b[4]!==A||b[5]!==k?(t=()=>{if(S){let e=S.createChannel({name:"presentation",connectTo:"loaders",heartbeat:!0},(0,o.e3)().provide({actors:(0,l.jF)()}));return M(e),e.onStatus(A),e.on("loader/documents",e=>{e.projectId===k&&e.dataset===j&&T("loaders",e.perspective,e.documents)}),e.on("loader/query-listen",e=>{if(e.projectId===k&&e.dataset===j){if("number"==typeof e.heartbeat&&e.heartbeat<h.TG)throw Error(`Loader query listen heartbeat interval must be at least ${h.TG}ms`);D({type:"query-listen",payload:{perspective:e.perspective,query:e.query,params:e.params,heartbeat:e.heartbeat??!1}})}}),e.start()}return _},r=[S,j,D,T,A,k],b[0]=S,b[1]=j,b[2]=D,b[3]=T,b[4]=A,b[5]=k,b[6]=t,b[7]=r):(t=b[6],r=b[7]),(0,d.useEffect)(t,r),b[8]!==q?(a=(0,p.c7e)(q)?p.Ra0:{apiVersion:h.mG},b[8]=q,b[9]=a):a=b[9];let $=(0,p.tH7)(a);b[10]!==$?(i=$.withConfig({resultSourceMap:"withKeyArraySelector"}),b[10]=$,b[11]=i):i=b[11];let N=i;b[12]!==q||b[13]!==E||b[14]!==j||b[15]!==k?(u=()=>{E&&E.post("loader/perspective",{projectId:k,dataset:j,perspective:q})},c=[E,q,k,j],b[12]=q,b[13]=E,b[14]=j,b[15]=k,b[16]=u,b[17]=c):(u=b[16],c=b[17]),(0,d.useEffect)(u,c);let P=(0,d.useDeferredValue)(e.liveDocument),R=function(e){let t,r,s=(0,n.c)(3),[a,i]=(0,d.useReducer)(y,w),[u,o]=(0,d.useState)(null);if(null!==u)throw u;return s[0]!==e.live?(t=()=>{let t=e.live.events({includeDrafts:!0,tag:"presentation-loader"}).subscribe({next:i,error:e=>o(e instanceof Error?e:Error("Unexpected error in useLiveEvents",{cause:e}))});return()=>t.unsubscribe()},r=[e.live],s[0]=e.live,s[1]=t,s[2]=r):(t=s[1],r=s[2]),(0,d.useEffect)(t,r),(0,d.useDeferredValue)(a)}(N);return b[18]!==C?(f=[...C.entries()],b[18]=C,b[19]=f):f=b[19],b[20]!==N||b[21]!==E||b[22]!==j||b[23]!==P||b[24]!==R||b[25]!==k||b[26]!==f?(v=(0,s.jsx)(s.Fragment,{children:f.map(e=>{let[t,r]=e,{query:n,params:a,perspective:i}=r;return(0,s.jsx)(I,{projectId:k,dataset:j,perspective:i,query:n,params:a,comlink:E,client:N,liveDocument:P,liveEventsMessages:R.messages},`${R.resets}:${t}`)})}),b[20]=N,b[21]=E,b[22]=j,b[23]=P,b[24]=R,b[25]=k,b[26]=f,b[27]=v):v=b[27],v}function _(){}let I=(0,d.memo)(function(e){let t,r,s,a=(0,n.c)(20),{projectId:i,dataset:u,perspective:o,query:l,client:p,liveDocument:h,params:v,comlink:y,liveEventsMessages:w}=e,{result:b,resultSourceMap:m,syncTags:g}=function(e){let t,r,s,a,i,u=(0,n.c)(30),{liveDocument:o,client:l,query:p,params:f,perspective:h,liveEventsMessages:v}=e,[y,w]=(0,d.useState)(null),[b,m]=(0,d.useState)(null),[g,S]=(0,d.useState)(void 0);u[0]!==v?(t=()=>new Set(v.map(q)),u[0]=v,u[1]=t):t=u[1];let[_]=(0,d.useState)(t);if(u[2]!==v||u[3]!==_||u[4]!==g){let e,t;
1u[6]!==_?(e=e=>!_.has(e.id),u[6]=_,u[7]=e):e=u[7];let s=v.filter(e);u[8]!==g?(t=e=>e.tags.some(e=>g?.includes(e)),u[8]=g,u[9]=t):t=u[9],r=s.findLast(t),u[2]=v,u[3]=_,u[4]=g,u[5]=r}else r=u[5];let I=r?.id,[T,E]=(0,d.useState)(null);if(T)throw T;u[10]!==l||u[11]!==I||u[12]!==f||u[13]!==h||u[14]!==p?(s=()=>{let e=new AbortController;return l.fetch(p,f,{lastLiveEventId:I,tag:"presentation-loader",signal:e.signal,perspective:h,filterResponse:!1,returnQuery:!1}).then(e=>{(0,d.startTransition)(()=>{w(t=>c(t,e.result)?t:e.result),m(t=>c(t,e.resultSourceMap)?t:e.resultSourceMap),S(t=>c(t,e.syncTags)?t:e.syncTags)})}).catch(e=>{("object"!=typeof e||e?.name!=="AbortError")&&E(e)}),()=>{e.abort()}},a=[l,I,f,h,p],u[10]=l,u[11]=I,u[12]=f,u[13]=h,u[14]=p,u[15]=s,u[16]=a):(s=u[15],a=u[16]),(0,d.useEffect)(s,a);e:{let e;if(o&&b){let e,t;u[17]!==o||u[18]!==h||u[19]!==y||u[20]!==b?(e=A(o,y,h,b),u[17]=o,u[18]=h,u[19]=y,u[20]=b,u[21]=e):e=u[21],u[22]!==b||u[23]!==g||u[24]!==e?(t={result:e,resultSourceMap:b,syncTags:g},u[22]=b,u[23]=g,u[24]=e,u[25]=t):t=u[25],i=t;break e}u[26]!==y||u[27]!==b||u[28]!==g?(e={result:y,resultSourceMap:b,syncTags:g},u[26]=y,u[27]=b,u[28]=g,u[29]=e):e=u[29],i=e}return i}({client:p,liveDocument:h,params:v,perspective:o,query:l,liveEventsMessages:w})||{};a[0]!==u||a[1]!==i?(t=(e,t,r,s,n,a,o)=>{e?.post("loader/query-change",{projectId:i,dataset:u,perspective:t,query:r,params:s,result:n,resultSourceMap:a,tags:o})},a[0]=u,a[1]=i,a[2]=t):t=a[2];let S=(0,f.J)(t);return a[3]!==y||a[4]!==S||a[5]!==v||a[6]!==o||a[7]!==l||a[8]!==b||a[9]!==m||a[10]!==g?(r=()=>{m&&S(y,o,l,v,b,m,g)},a[3]=y,a[4]=S,a[5]=v,a[6]=o,a[7]=l,a[8]=b,a[9]=m,a[10]=g,a[11]=r):r=a[11],a[12]!==y||a[13]!==v||a[14]!==o||a[15]!==l||a[16]!==b||a[17]!==m||a[18]!==g?(s=[y,v,o,l,b,m,g],a[12]=y,a[13]=v,a[14]=o,a[15]=l,a[16]=b,a[17]=m,a[18]=g,a[19]=s):s=a[19],(0,d.useEffect)(r,s),null});function q(e){return e.id}function A(e,t,r,s){if("raw"===r)throw Error("turboChargeResultIfSourceMap does not support raw perspective");if(!s)return t;let n=function(e,t){let r=function(e){if(function(e){if(Array.isArray(e)&&e.length>1&&e.includes("raw"))throw TypeError('Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives')}(e),Array.isArray(e))return e.includes("published")?e:[...e,"published"];switch(e){case"previewDrafts":case"drafts":return["drafts","published"];default:return["published"]}}(t);return function(t){for(let s of r){let r=null;if(s.startsWith("r")&&(r=e({...t,_id:(0,a.ct)(t._id,s)})),"drafts"===s&&(r=e({...t,_id:(0,a.T4)(t._id)})),"published"===s&&(r=e({...t,_id:(0,a.IM)(t._id)})),r)return{...r,_id:(0,a.IM)(r._id),_originalId:r._id}}return null}}(t=>!t._projectId&&e?._id&&(0,a.IM)(e._id)===(0,a.IM)(t._id)?"string"==typeof e._id&&"string"==typeof t._type?e:{...e,_id:e._id||t._id,_type:e._type||t._type}:null,r),i=s.documents?.map?.(n)||[];return(0,a.KT)(JSON.parse(JSON.stringify(t)),(e,t)=>{let r=(0,a.fO)(t,s);if(!r)return e;let{mapping:n,pathSuffix:u}=r;if("value"!==n.type||"documentValue"!==n.source.type)return e;let o=s.documents[n.source.document],l=s.paths[n.source.path];if(o){let t=(0,a.Hf)(l+u),r=(0,a.dI)(t),s=i[n.source.document];if(!s)return e;let c=s?(0,a.Jt)(s,r,e):e;return e===c?e:b(c,{cachedDocument:s,previousValue:e,sourceDocument:o,sourcePath:t})}return e})}I.displayName="Memo(QuerySubscription)"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.