1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5302],{65302:function(e,t,r){r.r(t),r.d(t,{encodeIntoResult:function(){return encodeIntoResult},stegaEncodeSourceMap:function(){return stegaEncodeSourceMap},stegaEncodeSourceMap$1:function(){return g}});var n=r(66468);let i=/_key\s*==\s*['"](.*)['"]/;function toString(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 o={"\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","'":"\\'","\\":"\\\\"},a={"\\f":"\f","\\n":` 2`,"\\r":"\r","\\t":" ","\\'":"'","\\\\":"\\"};function parseJsonPath(e){let t;let 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 jsonPathToStudioPath(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 jsonPathToMappingPath(e){return 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)}`)})}function encodeIntoResult(e,t,r){return function walkMap(e,t,r=[]){if(null!==e&&Array.isArray(e))return e.map((e,i)=>{if((0,n.Uy)(e)){let n=e._key;if("string"==typeof n)return walkMap(e,t,r.concat({_key:n,_index:i}))}return walkMap(e,t,r.concat(i))});if((0,n.Uy)(e)){if("block"===e._type||"span"===e._type){let n={...e};return"block"===e._type?n.children=walkMap(e.children,t,r.concat("children")):"span"===e._type&&(n.text=walkMap(e.text,t,r.concat("text"))),n}return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,walkMap(n,t,r.concat(e))]))}return t(e,r)}(e,(e,n)=>{if("string"!=typeof e)return e;let i=function(e,t){var r;if(!t?.mappings)return;let n=(r=jsonPathToMappingPath(e),`$${r.map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>o[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>o[e])}')]`:`[${e._index}]`).join("")}`);if(void 0!==t.mappings[n])return{mapping:t.mappings[n],matchedPath:n,pathSuffix:""};let i=jsonPathToMappingPath(e).map(e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,e=>o[e])}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,e=>o[e])}')]`:`[${e._index}]`);for(let e=i.length-1;e>=0;e--){let r=`$${i.slice(0,e).join("")}`,o=t.mappings[r];if(o){let e=n.substring(r.length);return{mapping:o,matchedPath:r,pathSuffix:e}}}}(n,t);if(!i)return e;let{mapping:a,matchedPath:s}=i;if("value"!==a.type||"documentValue"!==a.source.type)return e;let l=t.documents[a.source.document],p=t.paths[a.source.path],u=parseJsonPath(s),c=parseJsonPath(p).concat(n.slice(u.length));return r({sourcePath:c,sourceDocument:l,resultPath:n,value:e})})}let s="drafts.";function isDraftId(e){return e.startsWith(s)}function isVersionId(e){return e.startsWith("versions.")}let filterDefault=({sourcePath:e,resultPath:t,value:r})=>{if(/^\d{4}-\d{2}-\d{2}/.test(r)&&Date.parse(r)||function(e){try{let{protocol:t}=new URL(e,e.startsWith("/")?"https://acme.com":void 0);return p.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)||hasTypeLike(e)||hasTypeLike(t)||"string"==typeof n&&l.has(n))},l=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"]),p=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 hasTypeLike(e){return e.some(e=>"string"==typeof e&&null!==e.match(/type/i))}let u=[8203,8204,8205,65279],c=u.map(e=>String.fromCharCode(e)),f=[8203,8204,8205,8290,8291,8288,65279,8289,119155,119156,119157,119158,119159,119160,119161,119162];Object.fromEntries(u.map((e,t)=>[e,t])),Object.fromEntries(f.map((e,t)=>[e,t.toString(16)]));let d=String.fromCodePoint(u[0]).repeat(4),h=[...u,...f];function stegaEncodeSourceMap(e,t,r){let{filter:n,logger:o,enabled:a}=r;if(!a){let n="config.enabled must be true, don't call this function otherwise";throw o?.error?.(`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),TypeError(n)}if(!t)return o?.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 o?.error?.(`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),TypeError(n)}let l={encoded:[],skipped:[]},p=encodeIntoResult(e,t,({sourcePath:e,sourceDocument:t,resultPath:i,value:a})=>{var p;let u;if(("function"==typeof n?n({sourcePath:e,resultPath:i,filterDefault,sourceDocument:t,value:a}):filterDefault({sourcePath:e,resultPath:i,value:a}))===!1)return o&&l.skipped.push({path:toString(jsonPathToStudioPath(e)),value:`${a.slice(0,20)}${a.length>20?"...":""}`,length:a.length}),a;o&&l.encoded.push({path:toString(jsonPathToStudioPath(e)),value:`${a.slice(0,20)}${a.length>20?"...":""}`,length:a.length});let{baseUrl:f,workspace:h,tool:g}=("/"!==(u="string"==typeof(p="function"==typeof r.studioUrl?r.studioUrl(t):r.studioUrl)?p:p.baseUrl)&&(u=u.replace(/\/$/,"")),"string"==typeof p?{baseUrl:u}:{...p,baseUrl:u});if(!f)return a;let{_id:y,_type:m,_projectId:k,_dataset:$}=t;return function(e,t,r="auto"){return!0!==r&&("auto"!==r||e&&"string"==typeof e&&Date.parse(e)||function(e){try{return new URL(e,e.startsWith("/")?"https://example.com":void 0),!0}catch{return!1}}(e))?e:`${e}${function(e){if(void 0===e)return"";let t="string"==typeof e?e:JSON.stringify(e),r=new TextEncoder().encode(t),n="";for(let e=0;e<r.length;e++){let t=r[e];n+=c[t>>6&3]+c[t>>4&3]+c[t>>2&3]+c[3&t]}return d+n}(t)}`}(a,{origin:"sanity.io",href:function(e){let{baseUrl:t,workspace:r="default",tool:n="default",id:i,type:o,path:a,projectId:l,dataset:p}=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 u="default"===r?void 0:r,c="default"===n?void 0:n,f=isVersionId(i)?i.split(".").slice(2).join("."):isDraftId(i)?i.slice(s.length):i,d=Array.isArray(a)?toString(jsonPathToStudioPath(a)):a,h=new URLSearchParams({baseUrl:t,id:f,type:o,path:d});if(u&&h.set("workspace",u),c&&h.set("tool",c),l&&h.set("projectId",l),p&&h.set("dataset",p),isDraftId(i)||isVersionId(i)){if(isVersionId(i)){let e=function(e){if(!isVersionId(e))return;let[t,r,...n]=e.split(".");return r}(i);h.set("perspective",e)}}else h.set("perspective","published");let g=["/"===t?"":t];
2u&&g.push(u);let y=["mode=presentation",`id=${f}`,`type=${o}`,`path=${encodeURIComponent(d)}`];return c&&y.push(`tool=${c}`),g.push("intent","edit",`${y.join(";")}?${h}`),g.join("/")}({baseUrl:f,workspace:h,tool:g,id:y,type:m,path:e,...!r.omitCrossDatasetReferenceData&&{dataset:$,projectId:k}})},!0)});if(o){let e=l.skipped.length,t=l.encoded.length;if((e||t)&&((o?.groupCollapsed||o.log)?.("[@sanity/client]: Encoding source map into result"),o.log?.(`[@sanity/client]: Paths encoded: ${l.encoded.length}, skipped: ${l.skipped.length}`)),l.encoded.length>0&&(o?.log?.("[@sanity/client]: Table of encoded paths"),(o?.table||o.log)?.(l.encoded)),l.skipped.length>0){let e=new Set;for(let{path:t}of l.skipped)e.add(t.replace(i,"0").replace(/\[\d+\]/g,"[]"));o?.log?.("[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&o?.groupEnd?.()}return p}h.map(e=>`\\u{${e.toString(16)}}`).join("");var g=Object.freeze({__proto__:null,stegaEncodeSourceMap})}}]);
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.