1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1961,6052],{36052:(e,t,r)=>{r.r(t),r.d(t,{default:()=>c});var n=r(95039),i=r(41961),o=r(64586),a=r(48503),s=r(56092),l=r(28763);let u=a.use;function c(e){let{query:t,dataset:r,params:c={},perspective:p,projectId:f,stega:d}=e,h=(0,a.useCallback)(e=>(l.Hi.add(e),()=>l.Hi.delete(e)),[]),g=(0,a.useSyncExternalStore)(h,()=>l.sq,()=>null),[y,m]=(0,a.useState)(void 0),_=(0,s.J)(e=>{e.post("loader/query-listen",{projectId:f,dataset:r,perspective:p,query:t,params:c,heartbeat:1e4})}),$=(0,s.J)(n=>{if((0,o.j)({projectId:f,dataset:r,query:t,params:c},{projectId:n.projectId,dataset:n.dataset,query:n.query,params:n.params})){let{result:t,resultSourceMap:r,tags:o}=n,a=d?(0,i.stegaEncodeSourceMap)(t,r,{enabled:!0,studioUrl:"/"}):t;console.groupCollapsed("rendering with server action"),e.children({data:a,sourceMap:r,tags:o||[]}).then(e=>{console.log("setChildren(children)"),m(e)},e=>{console.error("rendering with server action: render children error",e)}).finally(()=>console.groupEnd())}});return(0,a.useEffect)(()=>{if(!g)return;let e=g.on("loader/query-change",$),t=setInterval(()=>_(g),1e4);return()=>{clearInterval(t),e()}},[g]),g&&void 0!==y?(0,n.jsx)(n.Fragment,{children:y}):u(e.initial)}c.displayName="SanityLiveStream"},41961:(e,t,r)=>{r.r(t),r.d(t,{encodeIntoResult:()=>c,stegaEncodeSourceMap:()=>m,stegaEncodeSourceMap$1:()=>_});var n=r(9127);let i=/_key\s*==\s*['"](.*)['"]/;function o(e){if(!Array.isArray(e))throw Error("Path is not an array");return e.reduce((e,t,r)=>{let n=typeof t;if("number"===n)return`${e}[${t}]`;if("string"===n)return`${e}${0===r?"":"."}${t}`;if(("string"==typeof t?i.test(t.trim()):"object"==typeof t&&"_key"in t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){let[r,n]=t;return`${e}[${r}:${n}]`}throw Error(`Unsupported path segment \`${JSON.stringify(t)}\``)},"")}let a={"\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","'":"\\'","\\":"\\\\"},s={"\\f":"\f","\\n":` 2`,"\\r":"\r","\\t":" ","\\'":"'","\\\\":"\\"};function l(e){let t,r=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;for(;null!==(t=n.exec(e));){if(void 0!==t[1]){let e=t[1].replace(/\\(\\|f|n|r|t|')/g,e=>s[e]);r.push(e);continue}if(void 0!==t[2]){r.push(parseInt(t[2],10));continue}if(void 0!==t[3]){let e=t[3].replace(/\\(\\')/g,e=>s[e]);r.push({_key:e,_index:-1});continue}}return r}function u(e){return e.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)})}function c(e,t,r){return function e(t,r,i=[]){if(null!==t&&Array.isArray(t))return t.map((t,o)=>{if((0,n.u4)(t)){let n=t._key;if("string"==typeof n)return e(t,r,i.concat({_key:n,_index:o}))}return e(t,r,i.concat(o))});if((0,n.u4)(t)){if("block"===t._type||"span"===t._type){let n={...t};return"block"===t._type?n.children=e(t.children,r,i.concat("children")):"span"===t._type&&(n.text=e(t.text,r,i.concat("text"))),n}return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n,r,i.concat(t))]))}return r(t,i)}(e,(e,n)=>{if("string"!=typeof e)return e;let i=function(e,t){var r;if(!t?.mappings)return;let n=(r=e.map(e=>{if("string"==typeof e||"number"==typeof e)return e;if(-1!==e._index)return e._index;throw Error(`invalid segment:${JSON.stringify(e)}`)}),`$${r.map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>a[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>a[e])}')]`:`[${e._index}]`).join("")}`);if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};let i=Object.entries(t.mappings).filter(([e])=>n.startsWith(e)).sort(([e],[t])=>t.length-e.length);if(0==i.length)return;let[o,s]=i[0],l=n.substring(o.length);return{mapping:s,matchedPath:o,pathSuffix:l}}(n,t);if(!i)return e;let{mapping:o,matchedPath:s}=i;if("value"!==o.type||"documentValue"!==o.source.type)return e;let u=t.documents[o.source.document],c=t.paths[o.source.path],p=l(s);return r({sourcePath:l(c).concat(n.slice(p.length)),sourceDocument:u,resultPath:n,value:e})})}let p="drafts.";function f(e){return e.startsWith(p)}function d(e){return e.startsWith("versions.")}let h=({sourcePath:e,resultPath:t,value:r})=>{if(function(e){return!!/^\d{4}-\d{2}-\d{2}/.test(e)&&!!Date.parse(e)}(r)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(r))return!1;let n=e.at(-1);return!("slug"===e.at(-2)&&"current"===n||"string"==typeof n&&(n.startsWith("_")||n.endsWith("Id"))||e.some(e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e)||y(e)||y(t)||"string"==typeof n&&g.has(n))},g=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","textTheme","unit","url","username","variant","website"]);function y(e){return e.some(e=>"string"==typeof e&&null!==e.match(/type/i))}function m(e,t,r){let{filter:a,logger:s,enabled:l}=r;if(!l){let n="config.enabled must be true, don't call this function otherwise";throw s?.error?.(`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),TypeError(n)}if(!t)return s?.error?.("[@sanity/client]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:r}),e;if(!r.studioUrl){let n="config.studioUrl must be defined";throw s?.error?.(`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),TypeError(n)}let g=[],y=[],m=c(e,t,({sourcePath:e,sourceDocument:t,resultPath:i,value:l})=>{var c;let m;if(("function"==typeof a?a({sourcePath:e,resultPath:i,filterDefault:h,sourceDocument:t,value:l}):h({sourcePath:e,resultPath:i,value:l}))===!1)return s&&y.push({path:o(u(e)),value:`${l.slice(0,20)}${l.length>20?"...":""}`,length:l.length}),l;s&&g.push({path:o(u(e)),value:`${l.slice(0,20)}${l.length>20?"...":""}`,length:l.length});let{baseUrl:_,workspace:$,tool:b}=("/"!==(m="string"==typeof(c="function"==typeof r.studioUrl?r.studioUrl(t):r.studioUrl)?c:c.baseUrl)&&(m=m.replace(/\/$/,"")),"string"==typeof c?{baseUrl:m}:{...c,baseUrl:m});if(!_)return l;let{_id:v,_type:k,_projectId:w,_dataset:E}=t;return(0,n.C)(l,{origin:"sanity.io",href:function(e){let{baseUrl:t,workspace:r="default",tool:n="default",id:i,type:a,path:s,projectId:l,dataset:c}=e;if(!t)throw Error("baseUrl is required");if(!s)throw Error("path is required");if(!i)throw Error("id is required");if("/"!==t&&t.endsWith("/"))throw Error("baseUrl must not end with a slash");let h="default"===r?void 0:r,g="default"===n?void 0:n,y=d(i)?i.split(".").slice(2).join("."):f(i)?i.slice(p.length):i,m=Array.isArray(s)?o(u(s)):s,_=new URLSearchParams({baseUrl:t,id:y,type:a,path:m});if(h&&_.set("workspace",h),g&&_.set("tool",g),l&&_.set("projectId",l),c&&_.set("dataset",c),f(i)||d(i)){if(d(i)){let e=function(e){if(!d(e))return;let[t,r,...n]=e.split(".");return r}(i);_.set("perspective",e)}}else _.set("perspective","published");let $=["/"===t?"":t];h&&$.push(h);let b=["mode=presentation",`id=${y}`,`type=${a}`,`path=${encodeURIComponent(m)}`];return g&&b.push(`tool=${g}`),$.push("intent","edit",`${b.join(";")}?${_}`),$.join("/")}({baseUrl:_,workspace:$,tool:b,id:v,type:k,path:e,...!r.omitCrossDatasetReferenceData&&{dataset:E,projectId:w}})},!1)});if(s){let e=y.length,t=g.length;if((e||t)&&((s?.groupCollapsed||s.log)?.("[@sanity/client]: Encoding source map into result"),s.log?.(`[@sanity/client]: Paths encoded: ${g.length}, skipped: ${y.length}`)),g.length>0&&(s?.log?.("[@sanity/client]: Table of encoded paths"),(s?.table||s.log)?.(g)),y.length>0){let e=new Set;for(let{path:t}of y)e.add(t.replace(i,"0").replace(/\[\d+\]/g,"[]"));s?.log?.("[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&s?.groupEnd?.()}return m}var _=Object.freeze({__proto__:null,stegaEncodeSourceMap:m})},64586:(e,t,r)=>{r.d(t,{j:()=>function e(t,r){var i,o;if(t===r)return!0;
2if(t&&r&&(i=t.constructor)===r.constructor){if(i===Date)return t.getTime()===r.getTime();if(i===RegExp)return t.toString()===r.toString();if(i===Array){if((o=t.length)===r.length)for(;o--&&e(t[o],r[o]););return -1===o}if(!i||"object"==typeof t){for(i in o=0,t)if(n.call(t,i)&&++o&&!n.call(r,i)||!(i in r)||!e(t[i],r[i]))return!1;return Object.keys(r).length===o}}return t!=t&&r!=r}});var n=Object.prototype.hasOwnProperty}}]);
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.