1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3485,8570],{3485:(e,t,r)=>{r.r(t),r.d(t,{enableLiveMode:()=>l});var n=r(7916),i=r(6189),o=r(3768),s=r(7409),a=r(8889);function l(e){let t,{client:r,setFetcher:l,onConnect:p,onDisconnect:u,onPerspective:c}=e;if(!r)throw Error(`Expected \`client\` to be an instance of SanityClient: ${JSON.stringify(r)}`);let{projectId:d,dataset:f,perspective:h}=r.config(),g=(0,a.eU)(h&&"raw"!==h?h:"drafts"),y=(0,a.eU)(!1),m=new Map,v=(0,o.RM)({name:"loaders",connectTo:"presentation"},(0,o.Uc)().provide({actors:(0,s.jF)()}));v.onStatus(()=>{y.set(!0)},"connected"),v.on("loader/perspective",e=>{if(e.projectId===d&&e.dataset===f){(0,n.x_)(e.perspective);let t="raw"===e.perspective?"drafts":e.perspective;g.set(t),c?.(t),k()}}),v.on("loader/query-change",e=>{if(e.projectId===d&&e.dataset===f){let{perspective:t,query:n,params:o}=e;void 0!==e.result&&void 0!==e.resultSourceMap&&r.config().stega.enabled?m.set(JSON.stringify({perspective:t,query:n,params:o}),{...e,result:(0,i.stegaEncodeSourceMap)(e.result,e.resultSourceMap,r.config().stega)}):m.set(JSON.stringify({perspective:t,query:n,params:o}),e),k()}});let _=y.listen(e=>{e?(t=l({hydrate:(e,t,r)=>{let n=r?.perspective||g.get(),i=JSON.stringify({perspective:n,query:e,params:t}),o=m.get(i);return o?.result!==void 0&&o?.resultSourceMap!==void 0?{loading:!1,error:void 0,data:o.result,sourceMap:o.resultSourceMap,perspective:n}:{loading:!0===y.value&&r?.data===void 0||r?.sourceMap===void 0,error:void 0,data:r?.data,sourceMap:r?.sourceMap,perspective:r?.perspective||"published"}},fetch:(e,t,r,n)=>{try{let i=b(e,t,r);if(n.signal.addEventListener("abort",()=>{i(),k()},{once:!0}),k(),r.setKey("error",void 0),n.signal.aborted)return}catch(e){r.setKey("error",e),r.setKey("loading",!1)}}}),p?.()):(t?.(),u?.())}),$=new Set,b=(e,t,r)=>{let n={query:e,params:t,$fetch:r};$.add(n),w();let i=setInterval(()=>w(!0),1e4);return()=>{clearInterval(i),$.delete(n),w()}},w=e=>{if(!v)throw Error("No connection");let t=g.get();for(let{query:r,params:n,$fetch:i}of $)v.post("loader/query-listen",{projectId:d,dataset:f,perspective:t,query:r,params:n,heartbeat:1e4}),e||!0!==y.value||i.setKey("loading",!0),i.setKey("perspective",t)};function k(){let e=g.get(),t=[];for(let{query:r,params:n,$fetch:i}of $){let o=JSON.stringify({perspective:e,query:r,params:n}),s=m.get(o);s&&(i.set({data:s.result,error:void 0,loading:!1,perspective:e,sourceMap:s.resultSourceMap}),t.push(...s.resultSourceMap?.documents??[]))}v.post("loader/documents",{projectId:d,dataset:f,perspective:e,documents:t})}let S=v.start();return()=>{t?.(),_(),S(),y.set(!1)}}},6189:(e,t,r)=>{r.r(t),r.d(t,{encodeIntoResult:()=>u,stegaEncodeSourceMap:()=>v,stegaEncodeSourceMap$1:()=>_});var n=r(5604);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 s={"\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","'":"\\'","\\":"\\\\"},a={"\\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=>a[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=>a[e]);r.push({_key:e,_index:-1});continue}}return r}function p(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 u(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=>s[e])}']`:"number"==typeof e?`[${e}
2]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>s[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,a]=i[0],l=n.substring(o.length);return{mapping:a,matchedPath:o,pathSuffix:l}}(n,t);if(!i)return e;let{mapping:o,matchedPath:a}=i;if("value"!==o.type||"documentValue"!==o.source.type)return e;let p=t.documents[o.source.document],u=t.paths[o.source.path],c=l(a);return r({sourcePath:l(u).concat(n.slice(c.length)),sourceDocument:p,resultPath:n,value:e})})}let c="drafts.";function d(e){return e.startsWith(c)}function f(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{let{protocol:t}=new URL(e,e.startsWith("/")?"https://acme.com":void 0);return y.has(t)||t.startsWith("web+")}catch{return!1}}(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)||m(e)||m(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"]),y=new Set(["app:","data:","discord:","file:","ftp:","ftps:","geo:","http:","https:","imap:","javascript:","magnet:","mailto:","maps:","ms-excel:","ms-powerpoint:","ms-word:","slack:","sms:","spotify:","steam:","teams:","tel:","vscode:","zoom:"]);function m(e){return e.some(e=>"string"==typeof e&&null!==e.match(/type/i))}function v(e,t,r){let{filter:s,logger:a,enabled:l}=r;if(!l){let n="config.enabled must be true, don't call this function otherwise";throw a?.error?.(`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),TypeError(n)}if(!t)return a?.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 a?.error?.(`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),TypeError(n)}let g=[],y=[],m=u(e,t,({sourcePath:e,sourceDocument:t,resultPath:i,value:l})=>{var u;let m;if(("function"==typeof s?s({sourcePath:e,resultPath:i,filterDefault:h,sourceDocument:t,value:l}):h({sourcePath:e,resultPath:i,value:l}))===!1)return a&&y.push({path:o(p(e)),value:`${l.slice(0,20)}${l.length>20?"...":""}`,length:l.length}),l;a&&g.push({path:o(p(e)),value:`${l.slice(0,20)}${l.length>20?"...":""}`,length:l.length});let{baseUrl:v,workspace:_,tool:$}=("/"!==(m="string"==typeof(u="function"==typeof r.studioUrl?r.studioUrl(t):r.studioUrl)?u:u.baseUrl)&&(m=m.replace(/\/$/,"")),"string"==typeof u?{baseUrl:m}:{...u,baseUrl:m});if(!v)return l;let{_id:b,_type:w,_projectId:k,_dataset:S}=t;return(0,n.C)(l,{origin:"sanity.io",href:function(e){let{baseUrl:t,workspace:r="default",tool:n="default",id:i,type:s,path:a,projectId:l,dataset:u}=e;if(!t)throw Error("baseUrl is required");if(!a)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=f(i)?i.split(".").slice(2).join("."):d(i)?i.slice(c.length):i,m=Array.isArray(a)?o(p(a)):a,v=new URLSearchParams({baseUrl:t,id:y,type:s,path:m});if(h&&v.set("workspace",h),g&&v.set("tool",g),l&&v.set("projectId",l),u&&v.set("dataset",u),d(i)||f(i)){if(f(i)){let e=function(e){if(!f(e))return;let[t,r,...n]=e.split(".");return r}(i);v.set("perspective",e)}}else v.set("perspective","published");let _=["/"===t?"":t];h&&_.push(h);let $=["mode=presentation",`id=${y}`,`type=${s}`,`path=${encodeURIComponent(m)}`];return g&&$.push(`tool=${g}`),_.push("intent","edit",`${$.join(";")}?${v}`),_.join("/")}({baseUrl:v,workspace:_,tool:$,id:b,type:w,path:e,...!r.omitCrossDatasetReferenceData&&{dataset:S,projectId:k}})},!1)});if(a){let e=y.length,t=g.length;if((e||t)&&((a?.groupCollapsed||a.log)?.("[@sanity/client]: Encoding source map into result"),a.log?.(`[@sanity/client]: Paths encoded: ${g.length}, skipped: ${y.length}`)),g.length>0&&(a?.log?.("[@sanity/client]: Table of encoded paths"),(a?.table||a.log)?.(g)),y.length>0){let e=new Set;for(let{path:t}of y)e.add(t.replace(i,"0").replace(/\[\d+\]/g,"[]"));a?.log?.("[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&a?.groupEnd?.()}return m}var _=Object.freeze({__proto__:null,stegaEncodeSourceMap:v})}}]);
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.