PageSourceSearch

https://serverobotics.com/assets/enableLiveMode-HGV2tQpS.js

js serverobotics.com collected 2026-10-02 14:31:26 UTC 57,142 bytes, 14 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-D5lqYbg0.js","assets/chunk-WWGJGFF6-Kk94zoMq.js"])))=>i.map(i=>d[i]);
2import{_ as Ue,h as Ne,i as J,j as We,k as ze,l as He,n as Wt,o as $e}from"./use-layout-DnhLu8p8.js";import{d as Fe,m as j,s as zt,p as Ht,P as Be,x as Ft,E as Bt,S as Qt,A as Gt,O as z,l as y,f as he,t as Qe,a as H,c as ge,b as F,o as V,e as Ge,g as Jt,h as Kt,i as Yt,j as Xt,k as Zt,n as er,q as tr,r as rr,u as nr}from"./index.browser-C55k7eez.js";import{c as sr,a as ir,b as ar}from"./index-DgpucjFu.js";import"./chunk-WWGJGFF6-Kk94zoMq.js";import"./compiler-runtime-RTyagslI.js";import"./index-CScdRL0T.js";import"./tslib.es6-boky8MQ8.js";function ee(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var Je={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Ke={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(Ke[0])).join("");Object.fromEntries(Object.entries(Ke).map(r=>r.reverse()));Object.fromEntries(Object.entries(Je).map(r=>r.reverse()));var or=`${Object.values(Je).map(r=>`\\u{${r.toString(16)}}`).join("")}`,Ie=new RegExp(`[${or}]{4,}`,"gu");function cr(r){var e;return{cleaned:r.replace(Ie,""),encoded:((e=r.match(Ie))==null?void 0:e[0])||""}}function ur(r){return r&&JSON.parse(cr(JSON.stringify(r)).cleaned)}function dr(r){return ur(r)}const _e=/\r\n|[\n\r\u2028\u2029]/;function lr(r,e,t){const n=r.split(_e),s={start:Ae(e.start,n),end:e.end?Ae(e.end,n):void 0},{start:i,end:a,markerLines:o}=hr(s,n),u=`${a}`.length;return r.split(_e,a).slice(i,a).map((c,l)=>{const d=i+1+l,g=` ${` ${d}`.slice(-u)} |`,h=o[d],p=!o[d+1];if(!h)return` ${g}${c.length>0?` ${c}`:""}`;let f="";if(Array.isArray(h)){const $=c.slice(0,Math.max(h[0]-1,0)).replace(/[^\t]/g," "),A=h[1]||1;f=[`
3 `,g.replace(/\d/g," ")," ",$,"^".repeat(A)].join(""),p&&t&&(f+=" "+t)}return[">",g,c.length>0?` ${c}`:"",f].join("")}).join(`
4`)}function hr(r,e){const t={...r.start},n={...t,...r.end},s=2,i=3,a=t.line??-1,o=t.column??0,u=n.line,c=n.column;let l=Math.max(a-(s+1),0),d=Math.min(e.length,u+i);a===-1&&(l=0),u===-1&&(d=e.length);const g=u-a,h={};if(g)for(let p=0;p<=g;p++){const f=p+a;if(!o)h[f]=!0;else if(p===0){const $=e[f-1].length;h[f]=[o,$-o+1]}else if(p===g)h[f]=[0,c];else{const $=e[f-p].length;h[f]=[0,$]}}else o===c?o?h[a]=[o,0]:h[a]=!0:h[a]=[o,c-o];return{start:l,end:d,markerLines:h}}function Ae(r,e){let t=0;for(let n=0;n<e.length;n++){const s=e[n].length+1;if(t+s>r)return{line:n+1,column:r-t};t+=s}return{line:e.length,column:e[e.length-1]?.length??0}}const pe=5;class pr extends Error{response;statusCode=400;responseBody;details;constructor(e,t){const n=Ye(e,t);super(n.message),Object.assign(this,n)}}class fr extends Error{response;statusCode=500;responseBody;details;constructor(e){const t=Ye(e);super(t.message),Object.assign(this,t)}}function Ye(r,e){const t=r.body,n={response:r,statusCode:r.statusCode,responseBody:mr(t,r),message:"",details:void 0};if(!ee(t))return n.message=fe(r,t),n;const s=t.error;if(typeof s=="string"&&typeof t.message=="string")return n.message=`${s} - ${t.message}`,n;if(typeof s!="object"||s===null)return typeof s=="string"?n.message=s:typeof t.message=="string"?n.message=t.message:n.message=fe(r,t),n;if(yr(s)||gr(s)){const i=s.items||[],a=i.slice(0,pe).map(u=>u.error?.description).filter(Boolean);let o=a.length?`:
5- ${a.join(`
6- `)}`:"";return i.length>pe&&(o+=`
7...and ${i.length-pe} more`),n.message=`${s.description}${o}`,n.details=t.error,n}if(Xe(s)){const i=e?.options?.query?.tag;return n.message=Ze(s,i),n.details=t.error,n}return"description"in s&&typeof s.description=="string"?(n.message=s.description,n.details=s,n):(n.message=fe(r,t),n)}function yr(r){return"type"in r&&r.type==="mutationError"&&"description"in r&&typeof r.description=="string"}function gr(r){return"type"in r&&r.type==="actionError"&&"description"in r&&typeof r.description=="string"}function Xe(r){return ee(r)&&r.type==="queryParseError"&&typeof r.query=="string"&&typeof r.start=="number"&&typeof r.end=="number"}function Ze(r,e){const{query:t,start:n,end:s,description:i}=r;if(!t||typeof n>"u")return`GROQ query parse error: ${i}`;const a=e?`
8
9Tag: ${e}`:"";return`GROQ query parse error:
10${lr(t,{start:n,end:s},i)}${a}`}function fe(r,e){const t=typeof e=="string"?` (${wr(e,100)})`:"",n=r.statusMessage?` ${r.statusMessage}`:"";return`${r.method}-request to ${r.url} resulted in HTTP ${r.statusCode}${n}${t}`}function mr(r,e){return(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")!==-1?JSON.stringify(r,null,2):r}function wr(r,e){return r.length>e?`${r.slice(0,e)}…`:r}
10class br extends Error{projectId;addOriginUrl;constructor({projectId:e}){super("CorsOriginError"),this.name="CorsOriginError",this.projectId=e;const t=new URL(`https://sanity.io/manage/project/${e}/api`);if(typeof location<"u"){const{origin:n}=location;t.searchParams.set("cors","add"),t.searchParams.set("origin",n),this.addOriginUrl=t,this.message=`The current origin is not allowed to connect to the Live Content API. Add it here: ${t}`}else this.message=`The current origin is not allowed to connect to the Live Content API. Change your configuration here: ${t}`}}const vr={onResponse:(r,e)=>{if(r.statusCode>=500)throw new fr(r);if(r.statusCode>=400)throw new pr(r,e);return r}};function Er(r={}){const e={},t=n=>r.ignoreWarnings===void 0?!1:(Array.isArray(r.ignoreWarnings)?r.ignoreWarnings:[r.ignoreWarnings]).some(s=>typeof s=="string"?n.includes(s):s instanceof RegExp?s.test(n):!1);return{onResponse:n=>{const s=n.headers["x-sanity-warning"],i=Array.isArray(s)?s:[s];for(const a of i)!a||e[a]||t(a)||(e[a]=!0,console.warn(a));return n}}}function Se(r,e={}){return Ht([Be({shouldRetry:$r}),...r,Er(e),Ft(),Bt(),Qt(),vr,Gt({implementation:z})])}function $r(r,e,t){if(t.maxRetries===0)return!1;const n=t.method==="GET"||t.method==="HEAD",s=(t.uri||t.url).startsWith("/data/query"),i=r.response&&(r.response.statusCode===429||r.response.statusCode===502||r.response.statusCode===503);return(n||s)&&i?!0:Be.shouldRetry(r,e,t)}const Ir="https://www.sanity.io/help/";function me(r){return Ir+r}const je=["image","file"],Te=["before","after","replace"],et=r=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(r))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},_r=r=>{if(!/^[-a-z0-9]+$/i.test(r))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},Ar=r=>{if(je.indexOf(r)===-1)throw new Error(`Invalid asset type: ${r}. Must be one of ${je.join(", ")}`)},B=(r,e)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`${r}() takes an object of properties`)},te=(r,e)=>{if(typeof e!="string"||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(e)||e.includes(".."))throw new Error(`${r}(): "${e}" is not a valid document ID`)},N=(r,e)=>{if(!e._id)throw new Error(`${r}() requires that the document contains an ID ("_id" property)`);te(r,e._id)},Sr=(r,e)=>{if(typeof e!="string")throw new Error(`\`${r}()\`: \`${e}\` is not a valid document type`)},tt=(r,e)=>{if(!e._type)throw new Error(`\`${r}()\` requires that the document contains a type (\`_type\` property)`);Sr(r,e._type)},jr=(r,e)=>{if(e._id&&e._id!==r)throw new Error(`The provided document ID (\`${e._id}\`) does not match the generated version ID (\`${r}\`)`)},Tr=(r,e,t)=>{const n="insert(at, selector, items)";if(Te.indexOf(r)===-1){const s=Te.map(i=>`"${i}"`).join(", ");throw new Error(`${n} takes an "at"-argument which is one of: ${s}`)}if(typeof e!="string")throw new Error(`${n} takes a "selector"-argument which must be a string`);if(!Array.isArray(t))throw new Error(`${n} takes an "items"-argument which must be an array`)},O=r=>{if(!r.dataset)throw new Error("`dataset` must be provided to perform queries");return r.dataset||""},rt=r=>{if(typeof r!="string"||!/^[a-z0-9._-]{1,75}$/i.test(r))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return r},nt=r=>{if(!r["~experimental_resource"])throw new Error("`resource` must be provided to perform resource queries");const{type:e,id:t}=r["~experimental_resource"];switch(e){case"dataset":{if(t.split(".").length!==2)throw new Error('Dataset resource ID must be in the format "project.dataset"');return}case"dashboard":case"media-library":case"canvas":return;default:throw new Error(`Unsupported resource type: ${e.toString()}`)}},q=(r,e)=>{if(e["~experimental_resource"])throw new Error(`\`${r}\` does not support resource-based operations`)};function Cr(r){let e=!1,t;return(...n)=>(e||(t=r(...n),e=!0),t)}const D=r=>Cr((...e)=>console.warn(r.join(" "),...e)),Pr=D(["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"]),Rr=D(["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."]),xr=D(["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."]),Dr=D(["The `previewDrafts` perspective has been renamed to  `drafts` and will be removed in a future API version"]),qr=D(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${me("js-client-browser-token")} for more information and how to hide this warning.`]),kr=D(["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`."]),Or=D(["Using the Sanity client without specifying an API version is deprecated.",`See ${me("js-client-api-version")}`]),Mr=D(["You have called `createVersion()` with a defined `document`. The recommended approach is to provide a `baseId` and `releaseId` instead."]),Lr="apicdn.sanity.io",Q={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},Vr=["localhost","127.0.0.1","0.0.0.0"],Ur=r=>Vr.indexOf(r)!==-1;
10function Nr(r){if(r==="1"||r==="X")return;const e=new Date(r);if(!(/^\d{4}-\d{2}-\d{2}$/.test(r)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}function we(r){if(Array.isArray(r)&&r.length>1&&r.includes("raw"))throw new TypeError('Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives')}const st=(r,e)=>{const t={...e,...r,stega:{...typeof e.stega=="boolean"?{enabled:e.stega}:e.stega||Q.stega,...typeof r.stega=="boolean"?{enabled:r.stega}:r.stega||{}}};t.apiVersion||Or();const n={...Q,...t},s=n.useProjectHostname&&!n["~experimental_resource"];if(typeof Promise>"u"){const g=me("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${g}`)}if(s&&!n.projectId)throw new Error("Configuration must contain `projectId`");if(n["~experimental_resource"]&&nt(n),typeof n.perspective<"u"&&we(n.perspective),"encodeSourceMap"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if(typeof n.stega.enabled!="boolean")throw new Error(`stega.enabled must be a boolean, received ${n.stega.enabled}`);if(n.stega.enabled&&n.stega.studioUrl===void 0)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(n.stega.enabled&&typeof n.stega.studioUrl!="string"&&typeof n.stega.studioUrl!="function")throw new Error(`stega.studioUrl must be a string or a function, received ${n.stega.studioUrl}`);const i=typeof window<"u"&&window.location&&window.location.hostname,a=i&&Ur(window.location.hostname),o=!!n.token;n.withCredentials&&o&&(kr(),n.withCredentials=!1),i&&a&&o&&n.ignoreBrowserTokenWarning!==!0?qr():typeof n.useCdn>"u"&&Rr(),s&&_r(n.projectId),n.dataset&&et(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?rt(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion=`${n.apiVersion}`.replace(/^v/,""),n.isDefaultApi=n.apiHost===Q.apiHost,n.useCdn===!0&&n.withCredentials&&Pr(),n.useCdn=n.useCdn!==!1&&!n.withCredentials,Nr(n.apiVersion);const u=n.apiHost.split("://",2),c=u[0],l=u[1],d=n.isDefaultApi?Lr:l;return s?(n.url=`${c}://${n.projectId}.${l}/v${n.apiVersion}`,n.cdnUrl=`${c}://${n.projectId}.${d}/v${n.apiVersion}`):(n.url=`${n.apiHost}/v${n.apiVersion}`,n.cdnUrl=n.url),n};class it extends Error{name="ConnectionFailedError"}class Wr extends Error{name="DisconnectError";reason;constructor(e,t,n={}){super(e,n),this.reason=t}}class zr extends Error{name="ChannelError";data;constructor(e,t){super(e),this.data=t}}class Hr extends Error{name="MessageError";data;constructor(e,t,n={}){super(e,n),this.data=t}}class Ce extends Error{name="MessageParseError"}const Fr=["channelError","disconnect"];function at(r,e){return Fe(()=>{const t=r();return Yt(t)?t:V(t)}).pipe(F(t=>Br(t,e)))}function Br(r,e){return new z(t=>{const n=e.includes("open"),s=e.includes("reconnect");function i(c){if("data"in c){const[l,d]=Pe(c);t.error(l?new Ce("Unable to parse EventSource error message",{cause:d}):new Hr((d?.data).message,d));return}r.readyState===r.CLOSED?t.error(new it("EventSource connection failed")):s&&t.next({type:"reconnect"})}function a(){t.next({type:"open"})}function o(c){const[l,d]=Pe(c);if(l){t.error(new Ce("Unable to parse EventSource message",{cause:l}));return}if(c.type==="channelError"){const g=new URL(r.url).searchParams.get("tag");t.error(new zr(Qr(d?.data,g),d.data));return}if(c.type==="disconnect"){t.error(new Wr(`Server disconnected client: ${d.data?.reason||"unknown error"}`));return}t.next({type:c.type,id:c.lastEventId,...d.data?{data:d.data}:{}})}r.addEventListener("error",i),n&&r.addEventListener("open",a);const u=[...new Set([...Fr,...e])].filter(c=>c!=="error"&&c!=="open"&&c!=="reconnect");return u.forEach(c=>r.addEventListener(c,o)),()=>{r.removeEventListener("error",i),n&&r.removeEventListener("open",a),u.forEach(c=>r.removeEventListener(c,o)),r.close()}})}
10function Pe(r){try{const e=typeof r.data=="string"&&JSON.parse(r.data);return[null,{type:r.type,id:r.lastEventId,...Gr(e)?{}:{data:e}}]}catch(e){return[e,null]}}function Qr(r,e){const t=r.error;return t?Xe(t)?Ze(t,e):t.description?t.description:typeof t=="string"?t:JSON.stringify(t,null,2):r.message||"Unknown listener error"}function Gr(r){for(const e in r)return!1;return!0}function ot(r){if(typeof r=="string")return{id:r};if(Array.isArray(r))return{query:"*[_id in $ids]",params:{ids:r}};if(typeof r=="object"&&r!==null&&"query"in r&&typeof r.query=="string")return"params"in r&&typeof r.params=="object"&&r.params!==null?{query:r.query,params:r.params}:{query:r.query};const e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join(`
11`);throw new Error(`Unknown selection - must be one of:
12
13${e}`)}class ct{selection;operations;constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return B("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,n){return Tr(e,t,n),this._assign("insert",{[e]:t,items:n})}append(e,t){return this.insert("after",`${e}[-1]`,t)}prepend(e,t){return this.insert("before",`${e}[0]`,t)}splice(e,t,n,s){const i=typeof n>"u"||n===-1,a=t<0?t-1:t,o=i?-1:Math.max(0,t+n),u=a<0&&o>=0?"":o,c=`${e}[${a}:${u}]`;return this.insert("replace",c,s||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...ot(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,n=!0){return B(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},n&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}class k extends ct{#t;constructor(e,t,n){super(e,t),this.#t=n}clone(){return new k(this.selection,{...this.operations},this.#t)}commit(e){if(!this.#t)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t=typeof this.selection=="string",n=Object.assign({returnFirst:t,returnDocuments:!0},e);return this.#t.mutate({patch:this.serialize()},n)}}class x extends ct{#t;constructor(e,t,n){super(e,t),this.#t=n}clone(){return new x(this.selection,{...this.operations},this.#t)}commit(e){if(!this.#t)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t=typeof this.selection=="string",n=Object.assign({returnFirst:t,returnDocuments:!0},e);return this.#t.mutate({patch:this.serialize()},n)}}const ut={returnDocuments:!1};class dt{operations;trxId;constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return B("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return B(t,e),N(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return B(t,e),N(t,e),this._add({[t]:e})}delete(e){return te("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}class oe extends dt{#t;constructor(e,t,n){super(e,n),this.#t=t}clone(){return new oe([...this.operations],this.#t,this.trxId)}commit(e){if(!this.#t)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#t.mutate(this.serialize(),Object.assign({transactionId:this.trxId},ut,e||{}))}patch(e,t){const n=typeof t=="function",s=typeof e!="string"&&e instanceof x,i=typeof e=="object"&&("query"in e||"id"in e);if(s)return this._add({patch:e.serialize()});if(n){const a=t(new x(e,{},this.#t));if(!(a instanceof x))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:a.serialize()})}if(i){const a=new x(e,t||{},this.#t);return this._add({patch:a.serialize()})}return this._add({patch:{id:e,...t}})}}class ce extends dt{#t;constructor(e,t,n){super(e,n),this.#t=t}clone(){return new ce([...this.operations],this.#t,this.trxId)}commit(e){if(!this.#t)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#t.mutate(this.serialize(),Object.assign({transactionId:this.trxId},ut,e||{}))}patch(e,t){const n=typeof t=="function";if(typeof e!="string"&&e instanceof k)return this._add({patch:e.serialize()});if(n){const s=t(new k(e,{},this.#t));if(!(s instanceof k))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:s.serialize()})}return this._add({patch:{id:e,...t}})}}const Jr="X-Sanity-Project-ID";function Kr(r,e={}){const t={};r.headers&&Object.assign(t,r.headers);const n=e.token||r.token;n&&(t.Authorization=`Bearer ${n}`),!e.useGlobalApi&&!r.useProjectHostname&&r.projectId&&(t[Jr]=r.projectId);const s=!!(typeof e.withCredentials>"u"?r.withCredentials:e.withCredentials),i=typeof e.timeout>"u"?r.timeout:e.timeout;return Object.assign({},e,{headers:Object.assign({},t,e.headers||{}),timeout:typeof i>"u"?300*1e3:i,proxy:e.proxy||r.proxy,json:!0,withCredentials:s,fetch:typeof e.fetch=="object"&&typeof r.fetch=="object"?{...r.fetch,...e.fetch}:e.fetch||r.fetch})}const lt=({query:r,params:e={},options:t={}})=>{const n=new URLSearchParams,{tag:s,includeMutations:i,returnQuery:a,...o}=t;s&&n.append("tag",s),n.append("query",r);for(const[u,c]of Object.entries(e))c!==void 0&&n.append(`$${u}`,JSON.stringify(c));for(const[u,c]of Object.entries(o))c&&n.append(u,`${c}`);return a===!1&&n.append("returnQuery","false"),i===!1&&n.append("includeMutations","fal
13se"),`?${n}`},Yr=(r,e)=>r===!1?void 0:typeof r>"u"?e:r,Xr=(r={})=>({dryRun:r.dryRun,returnIds:!0,returnDocuments:Yr(r.returnDocuments,!0),visibility:r.visibility||"sync",autoGenerateArrayKeys:r.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:r.skipCrossDatasetReferenceValidation}),be=r=>r.type==="response",Zr=r=>r.body,en=(r,e)=>r.reduce((t,n)=>(t[e(n)]=n,t),Object.create(null)),tn=11264;function ht(r,e,t,n,s={},i={}){const a="stega"in i?{...t||{},...typeof i.stega=="boolean"?{enabled:i.stega}:i.stega||{}}:t,o=a.enabled?dr(s):s,u=i.filterResponse===!1?p=>p:p=>p.result,{cache:c,next:l,...d}={useAbortSignal:typeof i.signal<"u",resultSourceMap:a.enabled?"withKeyArraySelector":i.resultSourceMap,...i,returnQuery:i.filterResponse===!1&&i.returnQuery!==!1},g=typeof c<"u"||typeof l<"u"?{...d,fetch:{cache:c,next:l}}:d,h=M(r,e,"query",{query:n,params:o},g);return a.enabled?h.pipe(Jt(Kt(Ue(()=>Promise.resolve().then(()=>ys),void 0).then(function(p){return p.stegaEncodeSourceMap$1}).then(({stegaEncodeSourceMap:p})=>p))),j(([p,f])=>{const $=f(p.result,p.resultSourceMap,a);return u({...p,result:$})})):h.pipe(j(u))}function W(r,e,t,n={}){const s=(()=>{if(!n.releaseId)return t;const a=ze(t);if(!a){if(He(t))throw new Error(`The document ID (\`${t}\`) is a draft, but \`options.releaseId\` is set as \`${n.releaseId}\``);return J(t,n.releaseId)}if(a!==n.releaseId)throw new Error(`The document ID (\`${t}\`) is already a version of \`${a}\` release, but this does not match the provided \`options.releaseId\` (\`${n.releaseId}\`)`);return t})(),i={uri:T(r,"doc",s),json:!0,tag:n.tag,signal:n.signal,query:n.includeAllVersions!==void 0?{includeAllVersions:n.includeAllVersions}:void 0};return Y(r,e,i).pipe(H(be),j(a=>{const o=a.body.documents;return o?n.includeAllVersions?o:o[0]:n.includeAllVersions?[]:void 0}))}function pt(r,e,t,n={}){const s={uri:T(r,"doc",t.join(",")),json:!0,tag:n.tag,signal:n.signal};return Y(r,e,s).pipe(H(be),j(i=>{const a=en(i.body.documents||[],o=>o._id);return t.map(o=>a[o]||null)}))}function ft(r,e,t,n={}){return M(r,e,"query",{query:"*[sanity::partOfRelease($releaseId)]",params:{releaseId:t}},n)}function yt(r,e,t,n){return N("createIfNotExists",t),ue(r,e,t,"createIfNotExists",n)}function gt(r,e,t,n){return N("createOrReplace",t),ue(r,e,t,"createOrReplace",n)}function mt(r,e,t,n,s){return N("createVersion",t),tt("createVersion",t),Mr(),v(r,e,{actionType:"sanity.action.document.version.create",publishedId:n,document:t},s)}function wt(r,e,t,n,s,i,a){if(!n)throw new Error("`createVersion()` requires `baseId` when no `document` is provided");if(!t)throw new Error("`createVersion()` requires `publishedId` when `baseId` is provided");te("createVersion",n),te("createVersion",t);const o={actionType:"sanity.action.document.version.create",publishedId:t,baseId:n,versionId:s?J(t,s):We(t),ifBaseRevisionId:i};return v(r,e,o,a)}function bt(r,e,t,n){return M(r,e,"mutate",{mutations:[{delete:ot(t)}]},n)}function vt(r,e,t,n=!1,s){return v(r,e,{actionType:"sanity.action.document.version.discard",versionId:t,purge:n},s)}function Et(r,e,t,n){return N("replaceVersion",t),tt("replaceVersion",t),v(r,e,{actionType:"sanity.action.document.version.replace",document:t},n)}function $t(r,e,t,n,s){return v(r,e,{actionType:"sanity.action.document.version.unpublish",versionId:t,publishedId:n},s)}function It(r,e,t,n){let s;t instanceof x||t instanceof k?s={patch:t.serialize()}:t instanceof oe||t instanceof ce?s=t.serialize():s=t;const i=Array.isArray(s)?s:[s],a=n&&n.transactionId||void 0;return M(r,e,"mutate",{mutations:i,transactionId:a},n)}function v(r,e,t,n){const s=Array.isArray(t)?t:[t],i=n&&n.transactionId||void 0,a=n&&n.skipCrossDatasetReferenceValidation||void 0,o=n&&n.dryRun||void 0;return M(r,e,"actions",{actions:s,transactionId:i,skipCrossDatasetReferenceValidation:a,dryRun:o},n)}function M(r,e,t,n,s={}){const i=t==="mutate",a=t==="actions",o=t==="query",u=i||a?"":lt(n),c=!i&&!a&&u.length<tn,l=c?u:"",d=s.returnFirst,{timeout:g,token:h,tag:p,headers:f,returnQuery:$,lastLiveEventId:A,cacheMode:C}=s,I=T(r,t,l),m={method:c?"GET":"POST",uri:I,json:!0,body:c?void 0:n,query:i&&Xr(s),timeout:g,headers:f,token:h,tag:p,returnQuery:$,perspective:s.perspective,resultSourceMap:s.resultSourceMap,lastLiveEventId:Array.isArray(A)?A[0]:A,cacheMode:C,canUseCdn:o,signal:s.signal,fetch:s.fetch,useAbortSignal:s.useAbortSignal,useCdn:s.useCdn};return Y(r,e,m).pipe(H(be),j(Zr),j(w=>{if(!i)return w;const E=w.results||[];if(s.returnDocuments)return d?E[0]&&E[0].document:E.map(P=>P.document);const b=d?"documentId":"documentIds",S=d?E[0]&&E[0].id:E.map(P=>P.id);return{transactionId:w.transactionId,results:E,[b]:S}}))}function ue(r,e,t,n,s={}){const i={[n]:t},a=Object.assign({returnFirst:!0,returnDocuments:!0},s);return M(r,e,"mutate",{mutations:[i]},a)}const K=r=>r.config().dataset!==void 0&&r.config().projectId!==void 0||r.config()["~experimental_resource"]!==void 0,_t=(r,e)=>K(r)&&e.startsWith(T(r,"query")),rn=(r,e)=>K(r)&&e.startsWith(T(r,"mutate")),nn=(r,e)=>K(r)&&e.startsWith(T(r,"doc","")),sn=(r,e)=>K(r)&&e.startsWith(T(r,"listen")),an=(r,e)=>K(r)&&e.startsWith(T(r,"history","")),on=(r,e)=>e.startsWith("/data/")||_t(r,e)||rn(r,e)||nn(r,e)||sn(r,e)||an(r,e);function Y(r,e,t){const n=t.url||t.uri,s=r.config(),i=typeof t.canUseCdn>"u"?["GET","HEAD"].indexOf(t.method||"GET")>=0&&on(r,n):t.canUseCdn;let a=(t.useCdn??s.useCdn)&&i;const o=t.tag&&s.requestTagPrefix?[s.requestTagPrefix,t.tag].join("."):t.tag||s.requestTagPrefix;if(o&&t.tag!==null&&(t.query={tag:rt(o),...t.query}),["GET","HEAD","POST"].indexOf(t.method||"GET")>=0&&_t(r,n)){const l=t.resultSourceMap??s.resultSourceMap;l!==void 0&&l!==!1&&(t.query={resultSourceMap:l,...t.query});const d=t.perspective||s.perspective;typeof d<"u"&&(d==="previewDrafts"&&Dr(),we(d),t.query={perspective:Array.isArray(d)?d.join(","):d,...t.query},(Array.isArray(d)&&d.length>0||d==="previewDrafts"||d==="drafts")&&a&&(a=!1,xr())),t.lastLiveEventId&&(t.query={...t.query,lastLiveEventId:t.lastLiveEventId}),t.returnQuery===!1&&(t.query={returnQuery:"false",...t.query}),a&&t.cacheMode=="noStale"&&(t.query={cacheMode:"noStale",...t.query})}const u=Kr(s,Object.assign({},t,{url:ve(r,n,a)})),c=new z(l=>e(u,s.requester).subscribe(l));return t.signal?c.pipe(cn(t.signal)):c}function _(r,e,t){return Y(r,e,t).pipe(H(n=>n.type==="response"),j(n=>n.body))}function T(r,e,t){const n=r.config();if(n["~experimental_resource"]){nt(n);const a=ln(n),o=t!==void 0?`${e}/${t}`:e;return`${a}/${o}`.replace(/\/($|\?)/,"$1")}const s=O(n),i=`/${e}/${s}`;return`/data${t!==void 0?`${i}/${t}`:i}`.replace(/\/($|\?)/,"$1")}function ve(r,e,t=!1){const{url:n,cdnUrl:s}=r.config();return`${t?s:n}/${e.replace(/^\//,"")}`}function cn(r){return e=>new z(t=>{const n=()=>t.error(dn(r));if(r&&r.aborted){n();return}const s=e.subscribe(t);return r.addEventListener("abort",n),()=>{r.removeEventListener("abort",n),s.unsubscribe()}})}const un=!!globalThis.DOMException;function dn(r){if(un)return new DOMException(r?.reason??"The operation was aborted.","AbortError");const e=new Error(r?.reason??"The operation was aborted.");return e.name="AbortError",e}const ln=r=>{if(!r["~experimental_resource"])throw new Error("`resource` must be provided to perform resource queries");const{type:e,id:t}=r["~experimental_resource"];switch(e){case"dataset":{const n=t.split(".");if(n.length!==2)throw new Error('Dataset ID must be in the format "project.dataset"');return`/projects/${n[0]}/datasets/${n[1]}`}case"canvas":return`/canvases/${t}`;case"media-library":return`/media-libraries/${t}`;case"dashboard":return`/dashboards/${t}`;default:throw new Error(`Unsupported resource type: ${e.toString()}`)}};function At(r,e,t){const n=O(r.config());return _(r,e,{method:"POST",uri:`/agent/action/generate/${n}`,body:t})}function hn(r,e,t){const n=O(r.config());return _(r,e,{method:"POST",uri:`/agent/action/patch/${n}`,body:t})}function pn(r,e,t){const n=O(r.config());return _(r,e,{method:"POST",uri:`/agent/action/prompt/${n}`,body:t})}function St(r,e,t){const n=O(r.config());return _(r,e,{method:"POST",uri:`/agent/action/transform/${n}`,body:t})}function jt(r,e,t){const n=O(r.config());return _(r,e,{method:"POST",uri:`/agent/action/translate/${n}`,body:t})}class fn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}generate(e){return At(this.#t,this.#e,e)}transform(e){return St(this.#t,this.#e,e)}translate(e){return jt(this.#t,this.#e,e)}}class yn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}generate(e){return y(At(this.#t,this.#e,e))}transform(e){return y(St(this.#t,this.#e,e))}translate(e){return y(jt(this.#t,this.#e,e))}prompt(e){return y(pn(this.#t,this.#e,e))}patch(e){return y(hn(this.#t,this.#e,e))}}class gn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}upload(e,t,n){return Tt(this.#t,this.#e,e,t,n)}}class mn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}upload(e,t,n){const s=Tt(this.#t,this.#e,e,t,n);return y(s.pipe(H(i=>i.type==="response"),j(i=>i.body.document)))}}function Tt(r,e,t,n,s={}){Ar(t);let i=s.extract||void 0;i&&!i.length&&(i=["none"]);const a=r.config(),o=bn(s,n),{tag:u,label:c,title:l,description:d,creditLine:g,filename:h,source:p}=o,f={label:c,title:l,description:d,filename:h,meta:i,creditLine:g};return p&&(f.sourceId=p.id,f.sourceName=p.name,f.sourceUrl=p.url),Y(r,e,{tag:u,method:"POST",timeout:o.timeout||0,uri:wn(a,t),headers:o.contentType?{"Content-Type":o.contentType}:{},query:f,body:n})}function wn(r,e){const t=e==="image"?"images":"files";if(r["~experimental_resource"]){const{type:s,id:i}=r["~experimental_resource"];switch(s){case"dataset":throw new Error("Assets are not supported for dataset resources, yet. Configure the client with `{projectId: <projectId>, dataset: <datasetId>}` instead.");case"canvas":return`/canvases/${i}/assets/${t}`;case"media-library":return`/media-libraries/${i}/upload`;case"dashboard":return`/dashboards/${i}/assets/${t}`;default:throw new Error(`Unsupported resource type: ${s.toString()}`)}}const n=O(r);return`assets/${t}/${n}`}function bn(r,e){return typeof File>"u"||!(e instanceof File)?r:Object.assign({filename:r.preserveFilename===!1?void 0:e.name,contentType:e.type},r)}var vn=(r,e)=>Object.keys(e).concat(Object.keys(r)).reduce((t,n)=>(t[n]=typeof r[n]>"u"?e[n]:r[n],t),{});const En=(r,e)=>e.reduce((t,n)=>(typeof r[n]>"u"||(t[n]=r[n]),t),{}),Ct=Fe(()=>Ue(()=>import("./browser-D5lqYbg0.js").then(r=>r.b),__vite__mapDeps([0,1]))).pipe(j(({default:r})=>r),zt(1));function Pt(){return function(r){return r.pipe(ge((e,t)=>e instanceof it?Xt(V({type:"reconnect"}),Zt(1e3).pipe(F(()=>t))):Qe(()=>e)))}}const $n=14800,In=["includePreviousRevision","includeResult","includeMutations","includeAllVersions","visibility","effectFormat","tag"],_n={includeResult:!0};function Rt(r,e,t={}){const{url:n,token:s,withCredentials:i,requestTagPrefix:a,headers:o}=this.config(),u=t.tag&&a?[a,t.tag].join("."):t.tag,c={...vn(t,_n),tag:u},l=En(c,In),d=lt({query:r,params:e,options:{tag:u,...l}}),g=`${n}${T(this,"listen",d)}`;if(g.length>$n)return Qe(()=>new Error("Query too large for listener"));const h=c.events?c.events:["mutation"],p={};return i&&(p.withCredentials=!0),(s||o)&&(p.headers={},s&&(p.headers.Authorization=`Bearer ${s}`),o&&Object.assign(p.headers,o)),at(()=>(typeof EventSource>"u"||p.headers?Ct:V(EventSource)).pipe(j(f=>new f(g,p))),h).pipe(Pt(),H(f=>h.includes(f.type)),j(f=>({type:f.type,..."data"in f?f.data:{}})))}function An(r,e){return Sn(typeof r=="function"?{predicate:r,...e}:r)}function Sn(r){return e=>{let t,n=!1;const{predicate:s,...i}=r,a=e.pipe(er(u=>{r.predicate(u)&&(n=!0,t=u)}),Ge(()=>{n=!1,t=void 0}),tr(i)),o=new z(u=>{n&&u.next(t),u.complete()});return rr(a,o)}}const Re="2021-03-25";class xt{#t;constructor(e){this.#t=e}events({includeDrafts:e=!1,tag:t}={}){q("live",this.#t.config());const{projectId:n,apiVersion:s,token:i,withCredentials:a,requestTagPrefix:o,headers:u}=this.#t.config(),c=s.replace(/^v/,"");if(c!=="X"&&c<Re)throw new Error(`The live events API requires API version ${Re} or later. The current API version is ${c}. Please update your API version to use this feature.`);if(e&&!i&&!a)throw new Error("The live events API requires a token or withCredentials when 'includeDrafts: true'. Please update your client configuration. The token should have the lowest possible access role.");const l=T(this.#t,"live/events"),d=new URL(this.#t.getUrl(l,!1)),g=t&&o?[o,t].join("."):t;g&&d.searchParams.set("tag",g),e&&d.searchParams.set("includeDrafts","true");const h={};e&&a&&(h.withCredentials=!0),(e&&i||u)&&(h.headers={},e&&i&&(h.headers.Authorization=`Bearer ${i}`),u&&Object.assign(h.headers,u));const p=`${d.href}::${JSON.stringify(h)}`,f=ye.get(p);if(f)return f;const $=at(()=>(typeof EventSource>"u"||h.headers?Ct:V(EventSource)).pipe(j(I=>new I(d.href,h))),["message","restart","welcome","reconnect","goaway"]),A=jn(d,{method:"OPTIONS",mode:"cors",credentials:h.withCredentials?"include":"omit",headers:h.headers}).pipe(ge(()=>{throw new br({projectId:n})})),C=$.pipe(Pt(),F(I=>I.type==="reconnect"?A.pipe(F(()=>
13V(I))):V(I)),ge(I=>A.pipe(F(()=>{throw I}))),j(I=>{if(I.type==="message"){const{data:m,...w}=I;return{...w,tags:m.tags}}return I})).pipe(Ge(()=>ye.delete(p)),An({predicate:I=>I.type==="welcome"}));return ye.set(p,C),C}}function jn(r,e){return new z(t=>{const n=new AbortController,s=n.signal;return fetch(r,{...e,signal:n.signal}).then(i=>{t.next(i),t.complete()},i=>{s.aborted||t.error(i)}),()=>n.abort()})}const ye=new Map;class Tn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}create(e,t){return U(this.#t,this.#e,"PUT",e,t)}edit(e,t){return U(this.#t,this.#e,"PATCH",e,t)}delete(e){return U(this.#t,this.#e,"DELETE",e)}list(){q("dataset",this.#t.config());const e=this.#t.config(),t=e.projectId;let n="/datasets";return e.useProjectHostname===!1&&(n=`/projects/${t}/datasets`),_(this.#t,this.#e,{uri:n,tag:null})}}class Cn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}create(e,t){return q("dataset",this.#t.config()),y(U(this.#t,this.#e,"PUT",e,t))}edit(e,t){return q("dataset",this.#t.config()),y(U(this.#t,this.#e,"PATCH",e,t))}delete(e){return q("dataset",this.#t.config()),y(U(this.#t,this.#e,"DELETE",e))}list(){q("dataset",this.#t.config());const e=this.#t.config(),t=e.projectId;let n="/datasets";return e.useProjectHostname===!1&&(n=`/projects/${t}/datasets`),y(_(this.#t,this.#e,{uri:n,tag:null}))}}function U(r,e,t,n,s){return q("dataset",r.config()),et(n),_(r,e,{method:t,uri:`/datasets/${n}`,body:s,tag:null})}class Dt{#t;#e;constructor(e,t){this.#t=e,this.#e=t}getPlaybackInfo(e,t={}){const n=this.#t.config()["~experimental_resource"]?.id,{instanceId:s,library
13Id:i}=Dn(e),a=i||n;if(!a)throw new Error("Could not determine Media Library ID - you need to provide a valid Media Library ID in the client config or a Media Library GDR");const o=qn(s,a),u=kn(t);return _(this.#t,this.#e,{method:"GET",uri:o,query:u})}}class Pn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}getPlaybackInfo(e,t={}){return y(new Dt(this.#t.observable,this.#e).getPlaybackInfo(e,t))}}const Rn=/^media-library:(ml[^:]+):([^:]+)$/;function xn(r){return typeof r=="object"&&"_ref"in r}function Dn(r){const e=xn(r)?r._ref:r,t=Rn.exec(e);if(t){const[,n,s]=t;return{libraryId:n,instanceId:s}}if(typeof r=="string"&&r.startsWith("video-"))return{instanceId:r};throw new Error(`Invalid video asset instance identifier "${e}": must be a valid video instance id or a Global Dataset Reference (GDR) to the video asset in the Media Library`)}function qn(r,e){return`/media-libraries/${e}/video/${r}/playback-info`}function kn(r){const e={};if(r.transformations){const{thumbnail:t,animated:n,storyboard:s}=r.transformations;t&&(t.width&&(e.thumbnailWidth=t.width),t.height&&(e.thumbnailHeight=t.height),t.time!==void 0&&(e.thumbnailTime=t.time),t.fit&&(e.thumbnailFit=t.fit),t.format&&(e.thumbnailFormat=t.format)),n&&(n.width&&(e.animatedWidth=n.width),n.height&&(e.animatedHeight=n.height),n.start!==void 0&&(e.animatedStart=n.start),n.end!==void 0&&(e.animatedEnd=n.end),n.fps&&(e.animatedFps=n.fps),n.format&&(e.animatedFormat=n.format)),s&&s.format&&(e.storyboardFormat=s.format)}return r.expiration&&(e.expiration=r.expiration),e}class On{#t;#e;constructor(e,t){this.#t=e,this.#e=t}list(e){const t={},n="/projects";return e?.includeMembers===!1&&(t.includeMembers="false"),e?.organizationId&&(t.organizationId=e.organizationId),_(this.#t,this.#e,{uri:n,query:t})}getById(e){return _(this.#t,this.#e,{uri:`/projects/${e}`})}}class Mn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}list(e){const t={},n="/projects";return e?.includeMembers===!1&&(t.includeMembers="false"),e?.organizationId&&(t.organizationId=e.organizationId),y(_(this.#t,this.#e,{uri:n,query:t}))}getById(e){return y(_(this.#t,this.#e,{uri:`/projects/${e}`}))}}const xe=nr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",8),re=(r,e)=>e?J(r,e):We(r);function ne(r,{releaseId:e,publishedId:t,document:n}){if(t&&n._id){const s=re(t,e);return jr(s,n),s}if(n._id){const s=He(n._id),i=Wt(n._id);if(!s&&!i)throw new Error(`\`${r}()\` requires a document with an \`_id\` that is a version or draft ID`);if(e){if(s)throw new Error(`\`${r}()\` was called with a document ID (\`${n._id}\`) that is a draft ID, but a release ID (\`${e}\`) was also provided.`);const a=ze(n._id);if(a!==e)throw new Error(`\`${r}()\` was called with a document ID (\`${n._id}\`) that is a version ID, but the release ID (\`${e}\`) does not match the document's version ID (\`${a}\`).`)}return n._id}if(t)return re(t,e);throw new Error(`\`${r}()\` requires either a publishedId or a document with an \`_id\``)}const Ln=(r,e)=>{if(typeof r=="object"&&r!==null&&("releaseId"in r||"metadata"in r)){const{releaseId:t=xe(),metadata:n={}}=r;return[t,n,e]}return[xe(),{},r]},qt=(r,e)=>{const[t,n,s]=Ln(r,e),i={...n,releaseType:n.releaseType||"undecided"};return{action:{actionType:"sanity.action.release.create",releaseId:t,metadata:i},options:s}};class Vn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}get({releaseId:e},t){return W(this.#t,this.#e,`_.releases.${e}`,t)}create(e,t){const{action:n,options:s}=qt(e,t),{releaseId:i,metadata:a}=n;return v(this.#t,this.#e,n,s).pipe(j(o=>({...o,releaseId:i,metadata:a})))}edit({releaseId:e,patch:t},n){const s={actionType:"sanity.action.release.edit",releaseId:e,patch:t};return v(this.#t,this.#e,s,n)}publish({releaseId:e},t){const n={actionType:"sanity.action.release.publish",releaseId:e};return v(this.#t,this.#e,n,t)}archive({releaseId:e},t){const n={actionType:"sanity.action.release.archive",releaseId:e};return v(this.#t,this.#e,n,t)}unarchive({releaseId:e},t){const n={actionType:"sanity.action.release.unarchive",releaseId:e};return v(this.#t,this.#e,n,t)}schedule({releaseId:e,publishAt:t},n){const s={actionType:"sanity.action.release.schedule",releaseId:e,publishAt:t};return v(this.#t,this.#e,s,n)}unschedule({releaseId:e},t){const n={actionType:"sanity.action.release.unschedule",releaseId:e};return v(this.#t,this.#e,n,t)}delete({releaseId:e},t){const n={actionType:"sanity.action.release.delete",releaseId:e};return v(this.#t,this.#e,n,t)}fetchDocuments({releaseId:e},t){return ft(this.#t,this.#e,e,t)}}class Un{#t;#e;constructor(e,t){this.#t=e,this.#e=t}get({releaseId:e},t){return y(W(this.#t,this.#e,`_.releases.${e}`,t))}async create(e,t){const{action:n,options:s}=qt(e,t),{releaseId:i,metadata:a}=n;return{...await y(v(this.#t,this.#e,n,s)),releaseId:i,metadata:a}}edit({releaseId:e,patch:t},n){const s={actionType:"sanity.action.release.edit",releaseId:e,patch:t};return y(v(this.#t,this.#e,s,n))}publish({releaseId:e},t){const n={actionType:"sanity.action.release.publish",releaseId:e};return y(v(this.#t,this.#e,n,t))}archive({releaseId:e},t){const n={actionType:"sanity.action.release.archive",releaseId:e};return y(v(this.#t,this.#e,n,t))}unarchive({releaseId:e},t){const n={actionType:"sanity.action.release.unarchive",releaseId:e};return y(v(this.#t,this.#e,n,t))}schedule({releaseId:e,publishAt:t},n){const s={actionType:"sanity.action.release.schedule",releaseId:e,publishAt:t};return y(v(this.#t,this.#e,s,n))}unschedule({releaseId:e},t){const n={actionType:"sanity.action.release.unschedule",releaseId:e};return y(v(this.#t,this.#e,n,t))}delete({releaseId:e},t){const n={actionType:"sanity.action.release.delete",releaseId:e};return y(v(this.#t,this.#e,n,t))}fetchDocuments({releaseId:e},t){return y(ft(this.#t,this.#e,e,t))}}class Nn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}getById(e){return _(this.#t,this.#e,{uri:`/users/${e}`})}}
13class Wn{#t;#e;constructor(e,t){this.#t=e,this.#e=t}getById(e){return y(_(this.#t,this.#e,{uri:`/users/${e}`}))}}class se{assets;datasets;live;mediaLibrary;projects;users;agent;releases;#t;#e;listen=Rt;constructor(e,t=Q){this.config(t),this.#e=e,this.assets=new gn(this,this.#e),this.datasets=new Tn(this,this.#e),this.live=new xt(this),this.mediaLibrary={video:new Dt(this,this.#e)},this.projects=new On(this,this.#e),this.users=new Nn(this,this.#e),this.agent={action:new fn(this,this.#e)},this.releases=new Vn(this,this.#e)}clone(){return new se(this.#e,this.config())}config(e){if(e===void 0)return{...this.#t};if(this.#t&&this.#t.allowReconfigure===!1)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.#t=st(e,this.#t||{}),this}withConfig(e){const t=this.config();return new se(this.#e,{...t,...e,stega:{...t.stega||{},...typeof e?.stega=="boolean"?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,n){return ht(this,this.#e,this.#t.stega,e,t,n)}getDocument(e,t){if(t?.includeAllVersions===!0)return W(this,this.#e,e,{...t,includeAllVersions:!0});const n={signal:t?.signal,tag:t?.tag,releaseId:t?.releaseId,...t&&"includeAllVersions"in t?{includeAllVersions:!1}:{}};return W(this,this.#e,e,n)}getDocuments(e,t){return pt(this,this.#e,e,t)}create(e,t){return ue(this,this.#e,e,"create",t)}createIfNotExists(e,t){return yt(this,this.#e,e,t)}createOrReplace(e,t){return gt(this,this.#e,e,t)}createVersion({document:e,publishedId:t,releaseId:n,baseId:s,ifBaseRevisionId:i},a){if(!e)return wt(this,this.#e,t,s,n,i,a);const o=ne("createVersion",{document:e,publishedId:t,releaseId:n}),u={...e,_id:o},c=t||Ne(e._id);return mt(this,this.#e,u,c,a)}delete(e,t){return bt(this,this.#e,e,t)}discardVersion({releaseId:e,publishedId:t},n,s){const i=re(t,e);return vt(this,this.#e,i,n,s)}replaceVersion({document:e,publishedId:t,releaseId:n},s){const i=ne("replaceVersion",{document:e,publishedId:t,releaseId:n}),a={...e,_id:i};return Et(this,this.#e,a,s)}unpublishVersion({releaseId:e,publishedId:t},n){const s=J(t,e);return $t(this,this.#e,s,t,n)}mutate(e,t){return It(this,this.#e,e,t)}patch(e,t){return new k(e,t,this)}transaction(e){return new ce(e,this)}action(e,t){return v(this,this.#e,e,t)}request(e){return _(this,this.#e,e)}getUrl(e,t){return ve(this,e,t)}getDataUrl(e,t){return T(this,e,t)}}class ie{assets;datasets;live;mediaLibrary;projects;users;agent;releases;observable;#t;#e;listen=Rt;constructor(e,t=Q){this.config(t),this.#e=e,this.assets=new mn(this,this.#e),this.datasets=new Cn(this,this.#e),this.live=new xt(this),this.mediaLibrary={video:new Pn(this,this.#e)},this.projects=new Mn(this,this.#e),this.users=new Wn(this,this.#e),this.agent={action:new yn(this,this.#e)},this.releases=new Un(this,this.#e),this.observable=new se(e,t)}clone(){return new ie(this.#e,this.config())}config(e){if(e===void 0)return{...this.#t};if(this.#t&&this.#t.allowReconfigure===!1)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),this.#t=st(e,this.#t||{}),this}withConfig(e){const t=this.config();return new ie(this.#e,{...t,...e,stega:{...t.stega||{},...typeof e?.stega=="boolean"?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,n){return y(ht(this,this.#e,this.#t.stega,e,t,n))}getDocument(e,t){if(t?.includeAllVersions===!0)return y(W(this,this.#e,e,{...t,includeAllVersions:!0}));const n={signal:t?.signal,tag:t?.tag,releaseId:t?.releaseId,...t&&"includeAllVersions"in t?{includeAllVersions:!1}:{}};return y(W(this,this.#e,e,n))}getDocuments(e,t){return y(pt(this,this.#e,e,t))}create(e,t){return y(ue(this,this.#e,e,"create",t))}createIfNotExists(e,t){return y(yt(this,this.#e,e,t))}createOrReplace(e,t){return y(gt(this,this.#e,e,t))}createVersion({document:e,publishedId:t,releaseId:n,baseId:s,ifBaseRevisionId:i},a){if(!e)return he(wt(this,this.#e,t,s,n,i,a));const o=ne("createVersion",{document:e,publishedId:t,releaseId:n}),u={...e,_id:o},c=t||Ne(e._id);return he(mt(this,this.#e,u,c,a))}delete(e,t){return y(bt(this,this.#e,e,t))}discardVersion({releaseId:e,publishedId:t},n,s){const i=re(t,e);return y(vt(this,this.#e,i,n,s))}replaceVersion({document:e,publishedId:t,releaseId:n},s){const i=ne("replaceVersion",{document:e,publishedId:t,releaseId:n}),a={...e,_id:i};return he(Et(this,this.#e,a,s))}unpublishVersion({releaseId:e,publishedId:t},n){const s=J(t,e);return y($t(this,this.#e,s,t,n))}mutate(e,t){return y(It(this,this.#e,e,t))}patch(e,t){return new x(e,t,this)}transaction(e){return new oe(e,this)}action(e,t){return y(v(this,this.#e,e,t))}request(e){return y(_(this,this.#e,e))}dataRequest(e,t,n){return y(M(this,this.#e,e,t,n))}getUrl(e,t){return ve(this,e,t)}getDataUrl(e,t){return T(this,e,t)}}function zn(r,e){return{requester:Se(r),createClient:t=>{const n=Se(r,{ignoreWarnings:t.ignoreWarnings});return new e((s,i)=>(i||n)({maxRedirects:0,maxRetries:t.maxRetries,retryDelay:t.retryDelay,lineage:t.lineage,...s}),t)}}}var Hn=[];zn(Hn,ie);const kt=/_key\s*==\s*['"](.*)['"]/;function Fn(r){return typeof r=="string"?kt.test(r.trim()):typeof r=="object"&&"_key"in r}function Ot(r){if(!Array.isArray(r))throw new Error("Path is not an array");
13return r.reduce((e,t,n)=>{const s=typeof t;if(s==="number")return`${e}[${t}]`;if(s==="string")return`${e}${n===0?"":"."}${t}`;if(Fn(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){const[i,a]=t;return`${e}[${i}:${a}]`}throw new Error(`Unsupported path segment \`${JSON.stringify(t)}\``)},"")}const ae={"\f":"\\f","\n":"\\n","\r":"\\r","	":"\\t","'":"\\'","\\":"\\\\"},De={"\\f":"\f","\\n":`
14`,"\\r":"\r","\\t":"	","\\'":"'","\\\\":"\\"};function Bn(r){return`$${r.map(e=>typeof e=="string"?`['${e.replace(/[\f\n\r\t'\\]/g,t=>ae[t])}']`:typeof e=="number"?`[${e}]`:e._key!==""?`[?(@._key=='${e._key.replace(/['\\]/g,t=>ae[t])}')]`:`[${e._index}]`).join("")}`}function Qn(r){return r.map(e=>typeof e=="string"?`['${e.replace(/[\f\n\r\t'\\]/g,t=>ae[t])}']`:typeof e=="number"?`[${e}]`:e._key!==""?`[?(@._key=='${e._key.replace(/['\\]/g,t=>ae[t])}')]`:`[${e._index}]`)}function qe(r){const e=[],t=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let n;for(;(n=t.exec(r))!==null;){if(n[1]!==void 0){const s=n[1].replace(/\\(\\|f|n|r|t|')/g,i=>De[i]);e.push(s);continue}if(n[2]!==void 0){e.push(parseInt(n[2],10));continue}if(n[3]!==void 0){const s=n[3].replace(/\\(\\')/g,i=>De[i]);e.push({_key:s,_index:-1});continue}}return e}function Mt(r){return r.map(e=>{if(typeof e=="string"||typeof e=="number")return e;if(e._key!=="")return{_key:e._key};if(e._index!==-1)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)})}function ke(r){return r.map(e=>{if(typeof e=="string"||typeof e=="number")return e;if(e._index!==-1)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)})}function Gn(r,e){if(!e?.mappings)return;const t=Bn(ke(r));if(e.mappings[t]!==void 0)return{mapping:e.mappings[t],matchedPath:t,pathSuffix:""};const n=Qn(ke(r));for(let s=n.length-1;s>=0;s--){const i=`$${n.slice(0,s).join("")}`,a=e.mappings[i];if(a){const o=t.substring(i.length);return{mapping:a,matchedPath:i,pathSuffix:o}}}}function Jn(r){return r!==null&&Array.isArray(r)}function L(r,e,t=[]){if(Jn(r))return r.map((n,s)=>{if(ee(n)){const i=n._key;if(typeof i=="string")return L(n,e,t.concat({_key:i,_index:s}))}return L(n,e,t.concat(s))});if(ee(r)){if(r._type==="block"||r._type==="span"){const n={...r};return r._type==="block"?n.children=L(r.children,e,t.concat("children")):r._type==="span"&&(n.text=L(r.text,e,t.concat("text"))),n}return Object.fromEntries(Object.entries(r).map(([n,s])=>[n,L(s,e,t.concat(n))]))}return e(r,t)}function Lt(r,e,t){return L(r,(n,s)=>{if(typeof n!="string")return n;const i=Gn(s,e);if(!i)return n;const{mapping:a,matchedPath:o}=i;if(a.type!=="value"||a.source.type!=="documentValue")return n;const u=e.documents[a.source.document],c=e.paths[a.source.path],l=qe(o),d=qe(c).concat(s.slice(l.length));return t({sourcePath:d,sourceDocument:u,resultPath:s,value:n})})}const Kn="drafts",Yn="versions",G=".",Vt=`${Kn}${G}`,Xn=`${Yn}${G}`;function Ut(r){return r.startsWith(Vt)}function de(r){return r.startsWith(Xn)}function Zn(r){return!Ut(r)&&!de(r)}function es(r){if(!de(r))return;const[e,t,...n]=r.split(G);return t}function ts(r){return de(r)?r.split(G).slice(2).join(G):Ut(r)?r.slice(Vt.length):r}function rs(r){const{baseUrl:e,workspace:t="default",tool:n="default",id:s,type:i,path:a,projectId:o,dataset:u}=r;if(!e)throw new Error("baseUrl is required");if(!a)throw new Error("path is required");if(!s)throw new Error("id is required");if(e!=="/"&&e.endsWith("/"))throw new Error("baseUrl must not end with a slash");const c=t==="default"?void 0:t,l=n==="default"?void 0:n,d=ts(s),g=Array.isArray(a)?Ot(Mt(a)):a,h=new URLSearchParams({baseUrl:e,id:d,type:i,path:g});if(c&&h.set("workspace",c),l&&h.set("tool",l),o&&h.set("projectId",o),u&&h.set("dataset",u),Zn(s))h.set("perspective","published");else if(de(s)){const $=es(s);h.set("perspective",$)}const p=[e==="/"?"":e];c&&p.push(c);const f=["mode=presentation",`id=${d}`,`type=${i}`,`path=${encodeURIComponent(g)}`];return l&&f.push(`tool=${l}`),p.push("intent","edit",`${f.join(";")}?${h}`),p.join("/")}function ns(r){let e=typeof r=="string"?r:r.baseUrl;return e!=="/"&&(e=e.replace(/\/$/,"")),typeof r=="string"?{baseUrl:e}:{...r,baseUrl:e}}const Oe=({sourcePath:r,resultPath:e,value:t})=>{if(is(t)||os(t))return!1;const n=r.at(-1);return!(r.at(-2)==="slug"&&n==="current"||typeof n=="string"&&(n.startsWith("_")||n.endsWith("Id"))||r.some(s=>s==="meta"||s==="metadata"||s==="openGraph"||s==="seo")||Me(r)||Me(e)||typeof n=="string"&&ss.has(n))},ss=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 is(r){return/^\d{4}-\d{2}-\d{2}/.test(r)?!!Date.parse(r):!1}const as=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 os(r){try{const{protocol:e}=new URL(r,r.startsWith("/")?"https://acme.com":void 0);return as.has(e)||e.startsWith("web+")}catch{return!1}}function Me(r){return r.some(e=>typeof e=="string"&&e.match(/type/i)!==null)}const le=[8203,8204,8205,65279],X=le.map(r=>String.fromCharCode(r)),Nt=[8203,8204,8205,8290,8291,8288,65279,8289,119155,119156,119157,119158,119159,119160,119161,119162];Object.fromEntries(le.map((r,e)=>[r,e]));Object.fromEntries(Nt.map((r,e)=>[r,e.toString(16)]));const cs=String.fromCodePoint(le[0]).repeat(4),us=[...le,...Nt];us.map(r=>`\\u{${r.toString(16)}}`).join("");function ds(r){if(r===void 0)return"";const e=typeof r=="string"?r:JSON.stringify(r),t=new TextEncoder().encode(e);let n="";for(let s=0;s<t.length;s++){const i=t[s];n+=X[i>>6&3]+X[i>>4&3]+X[i>>2&3]+X[i&3]}return cs+n}function ls(r,e,t="auto"){return t===!0||t==="auto"&&!ps(r)&&!hs(r)?`${r}${ds(e)}`:r}function hs(r){try{return new URL(r,r.startsWith("/")?"https://example.com":void 0),!0}catch{return!1}}function ps(r){return!r||typeof r!="string"?!1:!!Date.parse(r)}const Z=20;function Ee(r,e,t){const{filter:n,logger:s,enabled:i}=t;if(!i){const u="config.enabled must be true, don't call this function otherwise";throw s?.error?.(`[@sanity/client]: ${u}`,{result:r,resultSourceMap:e,config:t}),new TypeError(u)}if(!e)return s?.error?.("[@sanity/client]: Missing Content Source Map from response body",{result:r,resultSourceMap:e,config:t}),r;if(!t.studioUrl){const u="config.studioUrl must be defined";throw s?.error?.(`[@sanity/client]: ${u}`,{result:r,resultSourceMap:e,config:t}),new TypeError(u)}const a={encoded:[],skipped:[]},o=Lt(r,e,({sourcePath:u,sourceDocument:c,resultPath:l,value:d})=>{if((typeof n=="function"?n({sourcePath:u,resultPath:l,filterDefault:Oe,sourceDocument:c,value:d}):Oe({sourcePath:u,resultPath:l,value:d}))===!1)return s&&a.skipped.push({path:Le(u),value:`${d.slice(0,Z)}${d.length>Z?"...":""}`,length:d.length}),d;s&&a.encoded.push({path:Le(u),value:`${d.slice(0,Z)}${d.length>Z?"...":""}`,length:d.length});const{baseUrl:g,workspace:h,tool:p}=ns(typeof t.studioUrl=="function"?t.studioUrl(c):t.studioUrl);if(!g)return d;const{_id:f,_type:$,_projectId:A,_dataset:C}=c;return ls(d,{origin:"sanity.io",href:rs({baseUrl:g,workspace:h,tool:p,id:f,type:$,path:u,...!t.omitCrossDatasetReferenceData&&{dataset:C,projectId:A}})},!0)});if(s){const u=a.skipped.length,c=a.encoded.length;if((u||c)&&((s?.groupCollapsed||s.log)?.("[@sanity/client]: Encoding source map into result"),s.log?.(`[@sanity/client]: Paths encoded: ${a.encoded.length}, skipped: ${a.skipped.length}`)),a.encoded.length>0&&(s?.log?.("[@sanity/client]: Table of encoded paths"),(s?.table||s.log)?.(a.encoded)),a.skipped.length>0){const l=new Set;for(const{path:d}of a.skipped)l.add(d.replace(kt,"0").replace(/\[\d+\]/g,"[]"));s?.log?.("[@sanity/client]: List of skipped paths",[...l.values()])}(u||c)&&s?.groupEnd?.()}return o}function Le(r){return Ot(Mt(r))}var fs=Object.freeze({__proto__:null,stegaEncodeSourceMap:Ee});const ys=Object.freeze(Object.defineProperty({__proto__:null,encodeIntoResult:Lt,stegaEncodeSourceMap:Ee,stegaEncodeSourceMap$1:fs},Symbol.toStringTag,{value:"Module"})),Ve=1e4;function Is(r){const{client:e,setFetcher:t,onConnect:n,onDisconnect:s,onPerspective:i}=r;if(!e)throw new Error(`Expected \`client\` to be an instance of SanityClient: ${JSON.stringify(e)}`);const{projectId:a,dataset:o,perspective:u}=e.config(),c=$e(u&&u!=="raw"?u:"drafts"),l=$e(!1),d=new Map,g=sr({name:"loaders",connectTo:"presentation"},ir().provide({actors:ar()}));g.onStatus(()=>{l.set(!0)},"connected"),g.on("loader/perspective",m=>{if(m.projectId===a&&m.dataset===o){we(m.perspective);const w=m.perspective==="raw"?"drafts":m.perspective;c.set(w),i?.(w),C()}}),g.on("loader/query-change",m=>{if(m.projectId===a&&m.dataset===o){const{perspective:w,query:E,params:b}=m;m.result!==void 0&&m.resultSourceMap!==void 0&&e.config().stega.enabled?d.set(JSON.stringify({perspective:w,query:E,params:b}),{...m,result:Ee(m.result,m.resultSourceMap,e.config().stega)}):d.set(JSON.stringify({perspective:w,query:E,params:b}),m),C()}});let h;const p=l.listen(m=>{m?(h=t({hydrate:(w,E,b)=>{const S=b?.perspective||c.get(),P=JSON.stringify({perspective:S,query:w,params:E}),R=d.get(P);return R?.result!==void 0&&R?.resultSourceMap!==void 0?{loading:!1,error:void 0,data:R.result,sourceMap:R.resultSourceMap,perspective:S}:{loading:l.value===!0&&b?.data===void 0||b?.sourceMap===void 0,error:void 0,data:b?.data,sourceMap:b?.sourceMap,perspective:b?.perspective||"published"}},fetch:(w,E,b,S)=>{try{const P=$(w,E,b);if(S.signal.addEventListener("abort",()=>{P(),C()},{once:!0}),C(),b.setKey("error",void 0),S.signal.aborted)return}catch(P){b.setKey("error",P),b.setKey("loading",!1)}}}),n?.()):(h?.(),s?.())}),f=new Set,$=(m,w,E)=>{const b={query:m,params:w,$fetch:E};f.add(b),A();const S=setInterval(()=>A(!0),Ve);return()=>{clearInterval(S),f.delete(b),A()}},A=m=>{if(!g)throw new Error("No connection");const w=c.get();for(const{query:E,params:b,$fetch:S}of f)g.post("loader/query-listen",{projectId:a,dataset:o,perspective:w,query:E,params:b,heartbeat:Ve}),!m&&l.value===!0&&S.setKey("loading",!0),S.setKey("perspective",w)};function C(){const m=c.get(),w=[];for(const{query:E,params:b,$fetch:S}of f){const P=JSON.stringify({perspective:m,query:E,params:b}),R=d.get(P);R&&(S.set({data:R.result,error:void 0,loading:!1,perspective:m,sourceMap:R.resultSourceMap}),w.push(...R.resultSourceMap?.documents??[]))}g.post("loader/documents",{projectId:a,dataset:o,perspective:m,documents:w})}const I=g.start();return()=>{h?.(),p(),I(),l.set(!1)}}export{Is as enableLiveMode};

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.