1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96305,71096,62095,31755,e=>{"use strict";function t(e){if("object"!=typeof e)return e;if(null===e)return null;if(Array.isArray(e))return e.map(t);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){var r;let t=/^\/(.*)\/([gimyu]*)$/.exec(e.toString());if(!t)throw Error("Invalid RegExp");return new RegExp(null!=(r=t[1])?r:"",t[2])}let s={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=t(e[r]));return s}class r{setResult(e){return this.result=e,this.hasResult=!0,this}exit(){return this.exiting=!0,this}push(e,t){if(e.parent=this,void 0!==t&&(e.childName=t),e.root=this.root||this,e.options=e.options||this.options,this.children){let t;if(0===this.children.length)throw Error("Expected a non-empty array");(t=this.children)[t.length-1].next=e,this.children.push(e)}else this.children=[e],this.nextAfterChildren=this.next||null,this.next=e;return e.next=this,this}}let s=class extends r{constructor(e,t){super(),this.left=e,this.right=t,this.pipe="diff"}prepareDeltaResult(e){var r,s,i,n;if("object"==typeof e&&((null==(r=this.options)?void 0:r.omitRemovedValues)&&Array.isArray(e)&&e.length>1&&(2===e.length||0===e[2]||3===e[2])&&(e[0]=0),null==(s=this.options)?void 0:s.cloneDiffValues)){let r="function"==typeof(null==(i=this.options)?void 0:i.cloneDiffValues)?null==(n=this.options)?void 0:n.cloneDiffValues:t;"object"==typeof e[0]&&(e[0]=r(e[0])),"object"==typeof e[1]&&(e[1]=r(e[1]))}return e}setResult(e){return this.prepareDeltaResult(e),super.setResult(e)}},i=class extends r{constructor(e,t){super(),this.left=e,this.delta=t,this.pipe="patch"}},n=class extends r{constructor(e){super(),this.delta=e,this.pipe="reverse"}},a=class{constructor(e){this.name=e,this.filters=[]}process(e){if(!this.processor)throw Error("add this pipe to a processor before using it");let t=this.debug,r=this.filters.length;for(let s=0;s<r;s++){let r=this.filters[s];if(r&&(t&&this.log(`filter: ${r.filterName}`),r(e),"object"==typeof e&&e.exiting)){e.exiting=!1;break}}!e.next&&this.resultCheck&&this.resultCheck(e)}log(e){console.log(`[jsondiffpatch] ${this.name} pipe, ${e}`)}append(...e){return this.filters.push(...e),this}prepend(...e){return this.filters.unshift(...e),this}indexOf(e){if(!e)throw Error("a filter name is required");for(let t=0;t<this.filters.length;t++){let r=this.filters[t];if((null==r?void 0:r.filterName)===e)return t}throw Error(`filter not found: ${e}`)}list(){return this.filters.map(e=>e.filterName)}after(e,...t){let r=this.indexOf(e);return this.filters.splice(r+1,0,...t),this}before(e,...t){let r=this.indexOf(e);return this.filters.splice(r,0,...t),this}replace(e,...t){let r=this.indexOf(e);return this.filters.splice(r,1,...t),this}remove(e){let t=this.indexOf(e);return this.filters.splice(t,1),this}clear(){return this.filters.length=0,this}shouldHaveResult(e){return!1===e?this.resultCheck=null:this.resultCheck||(this.resultCheck=e=>{if(!e.hasResult){console.log(e);let t=Error(`${this.name} failed`);throw t.noResult=!0,t}}),this}},l=class{constructor(e){this.selfOptions=e||{},this.pipes={}}options(e){return e&&(this.selfOptions=e),this.selfOptions}pipe(e,t){let r=t;if("string"==typeof e){if(void 0===r)return this.pipes[e];this.pipes[e]=r}if(e&&e.name){if((r=e).processor===this)return r;this.pipes[r.name]=r}if(!r)throw Error(`pipe is not defined: ${e}`);return r.processor=this,r}process(e,t){let r,s=e;s.options=this.options();let i=t||e.pipe||"default";for(;i;)void 0!==s.nextAfterChildren&&(s.next=s.nextAfterChildren,s.nextAfterChildren=null),"string"==typeof i&&(i=this.pipe(i)),i.process(s),r=i,i=null,s&&s.next&&(i=(s=s.next).pipe||r);return s.hasResult?s.result:void 0}},o=(e,t,r,s)=>e[r]===t[s];function c(e,t,r,s,i){let n=e[r],a=t[s];if(n===a)return!0;if("object"!=typeof n||"object"!=typeof a)return!1;let l=i.objectHash;if(!l)return i.matchByPosition&&r===s;i.hashCache1=i.hashCache1||[];let o=i.hashCache1[r];if(void 0===o&&(i.hashCache1[r]=o=l(n,r)),void 0===o)return!1;i.hashCache2=i.hashCache2||[];let c=i.hashCache2[s];return void 0===c&&(i.hashCache2[s]=c=l(a,s)),void 0!==c&&o===c}let d=function(e){var t,r,i,n,a,l,d;let h,u,p,y,f,m;if(!e.leftIsArray)return;let b={objectHash:null==(t=e.options)?void 0:t.objectHash,matchByPosition:null==(r=e.options)?void 0:r.matchByPosition},g=0,v=0,w=e.left,k=e.right,x=w.length,A=k.length;for(x>0&&A>0&&!b.objectHash&&"boolean"!=typeof b.matchByPosition&&(b.matchByPosition=!function(e,t,r,s){for(let i=0;i<r;i++){let r=e[i];for(let e=0;e<s;e++){let s=t[e];if(i!==e&&r===s)return!0}}return!1}(w,k,x,A));g<x&&g<A&&c(w,k,g,g,b);)y=new s(w[h=g],k[h]),e.push(y,h),g++;for(;v+g<x&&v+g<A&&c(w,k,x-1-v,A-1-v,b);)u=x-1-v,p=A-1-v,y=new s(w[u],k[p]),e.push(y,p),v++;
1if(g+v===x){if(x===A)return void e.setResult(void 0).exit();for(f=f||{_t:"a"},h=g;h<A-v;h++)f[h]=[k[h]],e.prepareDeltaResult(f[h]);return void e.setResult(f).exit()}if(g+v===A){for(f=f||{_t:"a"},h=g;h<x-v;h++){let t=`_${h}`;f[t]=[w[h],0,0],e.prepareDeltaResult(f[t])}e.setResult(f).exit();return}b.hashCache1=void 0,b.hashCache2=void 0;let I=w.slice(g,x-v),T=k.slice(g,A-v),j=((e,t,r,s)=>{let i=t.length,n=r.length,a={sequence:[],indices1:[],indices2:[]};for(;0!==i&&0!==n;){if(void 0===e.match)throw Error("LCS matrix match function is undefined");if(e.match(t,r,i-1,n-1,s))a.sequence.unshift(t[i-1]),a.indices1.unshift(i-1),a.indices2.unshift(n-1),--i,--n;else{let t=e[i];if(void 0===t)throw Error("LCS matrix row is undefined");let r=t[n-1];if(void 0===r)throw Error("LCS matrix value is undefined");let s=e[i-1];if(void 0===s)throw Error("LCS matrix row is undefined");let a=s[n];if(void 0===a)throw Error("LCS matrix value is undefined");r>a?--n:--i}}return a})(((e,t,r,s)=>{var i,n,a;let l,o,c=e.length,d=t.length,h=Array(c+1);for(l=0;l<c+1;l++){let e=Array(d+1);for(o=0;o<d+1;o++)e[o]=0;h[l]=e}for(h.match=r,l=1;l<c+1;l++){let c=h[l];if(void 0===c)throw Error("LCS matrix row is undefined");let u=h[l-1];if(void 0===u)throw Error("LCS matrix row is undefined");for(o=1;o<d+1;o++)r(e,t,l-1,o-1,s)?c[o]=(null!=(i=u[o-1])?i:0)+1:c[o]=Math.max(null!=(n=u[o])?n:0,null!=(a=c[o-1])?a:0)}return h})(l=I,d=T,c||o,m=b||{}),l,d,m),R=[];for(f=f||{_t:"a"},h=g;h<x-v;h++)if(0>j.indices1.indexOf(h-g)){let t=`_${h}`;f[t]=[w[h],0,0],e.prepareDeltaResult(f[t]),R.push(h)}let C=!0;(null==(i=e.options)?void 0:i.arrays)&&!1===e.options.arrays.detectMove&&(C=!1);let S=!1;(null==(a=null==(n=e.options)?void 0:n.arrays)?void 0:a.includeValueOnMove)&&(S=!0);let E=R.length;for(h=g;h<A-v;h++){let t=j.indices2.indexOf(h-g);if(t<0){let t=!1;if(C&&E>0)for(let r=0;r<E;r++){let i=void 0===(u=R[r])?void 0:f[`_${u}`];if(void 0!==u&&i&&c(I,T,u-g,h-g,b)){i.splice(1,2,h,3),i.splice(1,2,h,3),S||(i[0]=""),p=h,y=new s(w[u],k[p]),e.push(y,p),R.splice(r,1),t=!0;break}}t||(f[h]=[k[h]],e.prepareDeltaResult(f[h]))}else{if(void 0===j.indices1[t])throw Error(`Invalid indexOnArray2: ${t}, seq.indices1: ${j.indices1}`);if(u=j.indices1[t]+g,void 0===j.indices2[t])throw Error(`Invalid indexOnArray2: ${t}, seq.indices2: ${j.indices2}`);p=j.indices2[t]+g,y=new s(w[u],k[p]),e.push(y,p)}}e.setResult(f).exit()};d.filterName="arrays";let h=(e,t)=>e-t,u=function(e){var t;let r,s,n;if(!e.nested)return;let a=e.delta;if("a"!==a._t)return;let l=e.left,o=[],c=[],d=[];for(r in a)if("_t"!==r)if("_"===r[0]){let e=r;if(void 0!==a[e]&&(0===a[e][2]||3===a[e][2]))o.push(Number.parseInt(r.slice(1),10));else throw Error(`only removal or move can be applied at original array indices, invalid diff type: ${null==(t=a[e])?void 0:t[2]}`)}else{let e=r;1===a[e].length?c.push({index:Number.parseInt(e,10),value:a[e][0]}):d.push({index:Number.parseInt(e,10),delta:a[e]})}for(r=(o=o.sort(h)).length-1;r>=0;r--){if(void 0===(s=o[r]))continue;let e=a[`_${s}`],t=l.splice(s,1)[0];(null==e?void 0:e[2])===3&&c.push({index:e[1],value:t})}let u=(c=c.sort((n="index",(e,t)=>e[n]-t[n]))).length;for(r=0;r<u;r++){let e=c[r];void 0!==e&&l.splice(e.index,0,e.value)}let p=d.length;if(p>0)for(r=0;r<p;r++){let t=d[r];if(void 0===t)continue;let s=new i(l[t.index],t.delta);e.push(s,t.index)}e.children?e.exit():e.setResult(l).exit()};u.filterName="arrays";let p=function(e){if(!e||!e.children||"a"!==e.delta._t)return;let t=e.left,r=e.children.length;for(let s=0;s<r;s++){let r=e.children[s];void 0!==r&&(t[r.childName]=r.result)}e.setResult(t).exit()};p.filterName="arraysCollectChildren";let y=function(e){if(!e.nested){let t=e.delta;3===t[2]&&(e.newName=`_${t[1]}`,e.setResult([t[0],Number.parseInt(e.childName.substring(1),10),3]).exit());return}let t=e.delta;if("a"===t._t){for(let r in t){if("_t"===r)continue;let s=new n(t[r]);e.push(s,r)}e.exit()}};y.filterName="arrays";let f=(e,t,r)=>{if("string"==typeof t&&"_"===t[0])return Number.parseInt(t.substring(1),10);if(Array.isArray(r)&&0===r[2])return`_${t}`;let s=+t;for(let r in e){let i=e[r];if(Array.isArray(i))if(3===i[2]){let e=Number.parseInt(r.substring(1),10),n=i[1];if(n===+t)return e;e<=s&&n>s?s++:e>=s&&n<s&&s--}else 0===i[2]?Number.parseInt(r.substring(1),10)<=s&&s++:1===i.length&&Number.parseInt(r,10)<=s&&s--}return s},m=e=>{if(!e||!e.children)return;let t=e.delta;if("a"!==t._t)return;let r=e.children.length,s={_t:"a"};for(let i=0;i<r;i++){let r=e.children[i];if(void 0===r)continue;let n=r.newName;if(void 0===n){if(void 0===r.childName)throw Error("child.childName is undefined");n=f(t,r.childName,r.result)}s[n]!==r.result&&(s[n]=r.result)}e.setResult(s).exit()};m.filterName="arraysCollectChildren";let b=function(e){e.left instanceof Date?(e.right instanceof Date?e.left.getTime()!==e.right.getTime()?e.setRe
1sult([e.left,e.right]):e.setResult(void 0):e.setResult([e.left,e.right]),e.exit()):e.right instanceof Date&&e.setResult([e.left,e.right]).exit()};b.filterName="dates";let g=new Set(["__proto__"]),v=e=>{if(!e||!e.children)return;let t=e.children.length,r=e.result;for(let s=0;s<t;s++){let t=e.children[s];if(void 0!==t&&void 0!==t.result){if(r=r||{},void 0===t.childName)throw Error("diff child.childName is undefined");r[t.childName]=t.result}}r&&e.leftIsArray&&(r._t="a"),e.setResult(r).exit()};v.filterName="collectChildren";let w=e=>{var t;if(e.leftIsArray||"object"!==e.leftType)return;let r=e.left,i=e.right,n=null==(t=e.options)?void 0:t.propertyFilter;for(let t in r){if(!Object.prototype.hasOwnProperty.call(r,t)||n&&!n(t,e))continue;let a=new s(r[t],i[t]);e.push(a,t)}for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&(!n||n(t,e))&&void 0===r[t]){let r=new s(void 0,i[t]);e.push(r,t)}e.children&&0!==e.children.length?e.exit():e.setResult(void 0).exit()};w.filterName="objects";let k=function(e){if(!e.nested)return;let t=e.delta;if(t._t)return;let r=!1;for(let s in t){if(g.has(s)||!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e.left,a=new i(null!==n&&"object"==typeof n&&Object.prototype.hasOwnProperty.call(n,s)?n[s]:void 0,t[s]);e.push(a,s),r=!0}r?e.exit():e.setResult(e.left).exit()};k.filterName="objects";let x=function(e){if(!e||!e.children||e.delta._t)return;if(null===e.left||"object"!=typeof e.left)return void e.setResult(e.left).exit();let t=e.left,r=e.children.length;for(let s=0;s<r;s++){let r=e.children[s];if(void 0===r)continue;let i=r.childName;g.has(i)||(Object.prototype.hasOwnProperty.call(e.left,i)&&void 0===r.result?delete t[i]:t[i]!==r.result&&(t[i]=r.result))}e.setResult(t).exit()};x.filterName="collectChildren";let A=function(e){if(!e.nested||e.delta._t)return;let t=e.delta,r=!1;for(let s in t){if(g.has(s)||!Object.prototype.hasOwnProperty.call(t,s))continue;let i=new n(t[s]);e.push(i,s),r=!0}r?e.exit():e.setResult({}).exit()};A.filterName="objects";let I=e=>{if(!e||!e.children||e.delta._t)return;let t=e.children.length,r={};for(let s=0;s<t;s++){let t=e.children[s];if(void 0===t)continue;let i=t.childName;g.has(i)||r[i]!==t.result&&(r[i]=t.result)}e.setResult(r).exit()};I.filterName="collectChildren";let T=null;function j(e,t){var r;if(!T){let s;if(null==(r=null==e?void 0:e.textDiff)?void 0:r.diffMatchPatch)s=new e.textDiff.diffMatchPatch;else{if(!t)return null;let e=Error("The diff-match-patch library was not provided. Pass the library in through the options or use the `jsondiffpatch/with-text-diffs` entry-point.");throw e.diff_match_patch_not_found=!0,e}T={diff:(e,t)=>s.patch_toText(s.patch_make(e,t)),patch:(e,t)=>{let r=s.patch_apply(s.patch_fromText(t),e);for(let e of r[1])if(!e){let e=Error("text patch failed");throw e.textPatchFailed=!0,e}return r[0]}}}return T}let R=function(e){var t,r;if("string"!==e.leftType)return;let s=e.left,i=e.right,n=(null==(r=null==(t=e.options)?void 0:t.textDiff)?void 0:r.minLength)||60;if(s.length<n||i.length<n)return void e.setResult([s,i]).exit();let a=j(e.options);if(!a)return void e.setResult([s,i]).exit();let l=a.diff;e.setResult([l(s,i),0,2]).exit()};R.filterName="texts";let C=function(e){if(e.nested)return;let t=e.delta;if(2!==t[2])return;let r=j(e.options,!0).patch;e.setResult(r(e.left,t[0])).exit()};C.filterName="texts";let S=function(e){if(e.nested)return;let t=e.delta;2!==t[2]||e.setResult([(e=>{var t,r,s;let i=/^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/,n=e.split("\n");for(let e=0;e<n.length;e++){let a=n[e];if(void 0===a)continue;let l=a.slice(0,1);if("@"===l){let t=i.exec(a);null!==t&&(n[e]=`@@ -${t[3]},${t[4]} +${t[1]},${t[2]} @@`)}else if("+"===l){if(n[e]=`-${null==(t=n[e])?void 0:t.slice(1)}`,(null==(r=n[e-1])?void 0:r.slice(0,1))==="+"){let t=n[e];n[e]=n[e-1],n[e-1]=t}}else"-"===l&&(n[e]=`+${null==(s=n[e])?void 0:s.slice(1)}`)}return n.join("\n")})(t[0]),0,2]).exit()};S.filterName="texts";let E=function(e){if(e.left===e.right)return void e.setResult(void 0).exit();if(void 0===e.left){if("function"==typeof e.right)throw Error("functions are not supported");
1e.setResult([e.right]).exit();return}if(void 0===e.right)return void e.setResult([e.left,0,0]).exit();if("function"==typeof e.left||"function"==typeof e.right)throw Error("functions are not supported");(e.leftType=null===e.left?"null":typeof e.left,e.rightType=null===e.right?"null":typeof e.right,e.leftType!==e.rightType||"boolean"===e.leftType||"number"===e.leftType||("object"===e.leftType&&(e.leftIsArray=Array.isArray(e.left)),"object"===e.rightType&&(e.rightIsArray=Array.isArray(e.right)),e.leftIsArray!==e.rightIsArray))?e.setResult([e.left,e.right]).exit():e.left instanceof RegExp&&(e.right instanceof RegExp?e.setResult([e.left.toString(),e.right.toString()]).exit():e.setResult([e.left,e.right]).exit())};E.filterName="trivial";let D=function(e){if(void 0===e.delta)return void e.setResult(e.left).exit();if(e.nested=!Array.isArray(e.delta),e.nested)return;let t=e.delta;if(1===t.length)return void e.setResult(t[0]).exit();if(2===t.length){if(e.left instanceof RegExp){let r=/^\/(.*)\/([gimyu]+)$/.exec(t[1]);if(null==r?void 0:r[1])return void e.setResult(new RegExp(r[1],r[2])).exit()}e.setResult(t[1]).exit();return}3===t.length&&0===t[2]&&e.setResult(void 0).exit()};D.filterName="trivial";let q=function(e){if(void 0===e.delta)return void e.setResult(e.delta).exit();if(e.nested=!Array.isArray(e.delta),e.nested)return;let t=e.delta;
11===t.length?e.setResult([t[0],0,0]).exit():2===t.length?e.setResult([t[1],t[0]]).exit():3===t.length&&0===t[2]&&e.setResult([t[0]]).exit()};q.filterName="trivial";let O=class{constructor(e){this.processor=new l(e),this.processor.pipe(new a("diff").append(v,E,b,R,w,d).shouldHaveResult()),this.processor.pipe(new a("patch").append(x,p,D,C,k,u).shouldHaveResult()),this.processor.pipe(new a("reverse").append(I,m,q,S,A,y).shouldHaveResult())}options(e){return this.processor.options(e)}diff(e,t){return this.processor.process(new s(e,t))}patch(e,t){return this.processor.process(new i(e,t))}reverse(e){return this.processor.process(new n(e))}unpatch(e,t){return this.patch(e,this.reverse(t))}clone(e){return t(e)}},$={bodySerializer:e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)},N=Object.entries({$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"}),_=(e,t)=>{for(let r of(t||=new Map,e))"in"in r?r.key&&t.set(r.key,{in:r.in,map:r.map}):"key"in r?t.set(r.key,{map:r.map}):r.args&&_(r.args,t);return t},P=(e,t)=>{let r={body:{},headers:{},path:{},query:{}},s=_(t),i;for(let[n,a]of e.entries())if(t[n]&&(i=t[n]),i)if("in"in i)if(i.key){let e=s.get(i.key),t=e.map||i.key;e.in&&(r[e.in][t]=a)}else r.body=a;else for(let[e,t]of Object.entries(a??{})){let n=s.get(e);if(n)if(n.in){let s=n.map||e;r[n.in][s]=t}else r[n.map]=t;else{let s=N.find(([t])=>e.startsWith(t));if(s){let[i,n]=s;r[n][e.slice(i.length)]=t}else if("allowExtra"in i&&i.allowExtra){for(let[s,n]of Object.entries(i.allowExtra))if(n){r[s][e]=t;break}}}}return(e=>{for(let[t,r]of Object.entries(e))!r||"object"!=typeof r||Array.isArray(r)||Object.keys(r).length||delete e[t]})(r),r},U=({allowReserved:e,explode:t,name:r,style:s,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join((e=>{switch(e){case"form":default:return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20"}})(s));switch(s){case"label":return`.${t}`;case"matrix":return`;${r}=${t}`;case"simple":return t;default:return`${r}=${t}`}}let n=(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}})(s),a=i.map(t=>"label"===s||"simple"===s?e?t:encodeURIComponent(t):z({allowReserved:e,name:r,value:t})).join(n);return"label"===s||"matrix"===s?n+a:a},z=({allowReserved:e,name:t,value:r})=>{if(null==r)return"";if("object"==typeof r)throw Error("Deeply-nested arrays/objects arenât supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?r:encodeURIComponent(r)}`},B=({allowReserved:e,explode:t,name:r,style:s,value:i,valueOnly:n})=>{if(i instanceof Date)return n?i.toISOString():`${r}=${i.toISOString()}`;if("deepObject"!==s&&!t){let t=[];Object.entries(i).forEach(([r,s])=>{t=[...t,r,e?s:encodeURIComponent(s)]});let n=t.join(",");switch(s){case"form":return`${r}=${n}`;case"label":return`.${n}`;case"matrix":return`;${r}=${n}`;default:return n}}let a=(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}})(s),l=Object.entries(i).map(([t,i])=>z({allowReserved:e,name:"deepObject"===s?`${r}[${t}]`:t,value:i})).join(a);return"label"===s||"matrix"===s?a+l:l},H=/\{[^{}]+\}/g;function L(e){let t=void 0!==e.body;return t&&e.bodySerializer?"serializedBody"in e?void 0!==e.serializedBody&&""!==e.serializedBody?e.serializedBody:null:""===e.body?null:e.body:t?e.body:void 0}let F=async(e,t)=>{let r="function"==typeof t?await t(e):t;if(r)return"bearer"===e.scheme?`Bearer ${r}`:"basic"===e.scheme?`Basic ${btoa(r)}`:r},W=({parameters:e={},...t}={})=>r=>{let s=[];if(r&&"object"==typeof r)for(let i in r){let n=r[i];if(null==n)continue;let a=e[i]||t;if(Array.isArray(n)){let e=U({allowReserved:a.allowReserved,explode:!0,name:i,style:"form",value:n,...a.array});e&&s.push(e)}else if("object"==typeof n){let e=B({allowReserved:a.allowReserved,explode:!0,name:i,style:"deepObject",value:n,...a.object});e&&s.push(e)}else{let e=z({allowReserved:a.allowReserved,name:i,value:n});e&&s.push(e)}}return s.join("&")},V=(e,t)=>!!t&&!!(e.headers.has(t)||e.query?.[t]||e.headers.get("Cookie")?.includes(`${t}=`)),M=async({security:e,...t})=>{for(let r of e){if(V(t,r.name))continue;let e=await F(r,t.auth);if(!e)continue;let s=r.name??"Authorization";switch(r.in){case"query":t.query||={},t.query[s]=e;break;case"cookie":t.headers.append("Cookie",`${s}=${e}`);break;default:t.headers.set(s,e)}}},K=e=>(({baseUrl:e,path:t,query:r,querySerializer:s,url:i})=>{let n=(e??"")+(i.startsWith("/")?i:`/${i}`);t&&(n=(({path:e,url:t})=>{let r=t,s=t.match(H);if(s)for(let t of s){let s=!1,i=t.substring(1,t.length-1),n="simple";i.endsWith("*")&&(s=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),n="label"):i.startsWith(";")&&(i=i.substring(1),n="matrix");let a=e[i];if(null==a)continue;if(Array.isArray(a)){r=r.replace(t,U({explode:s,name:i,style:n,value:a}));continue}if("object"==typeof a){r=r.replace(t,B({explode:s,name:i,style:n,value:a,valueOnly:!0}));continue}if("matrix"===n){r=r.replace(t,`;${z({name:i,value:a})}`);continue}let l=encodeURIComponent("label"===n?`.${a}`:a);r=r.replace(t,l)}return r})({path:t,url:n}));let a=r?s(r):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(n+=`?${a}`),n})({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:"function"==typeof e.querySerializer?e.querySerializer:W(e.querySerializer),url:e.url}),J=(e,t)=>
1{let r={...e,...t};return r.baseUrl?.endsWith("/")&&(r.baseUrl=r.baseUrl.substring(0,r.baseUrl.length-1)),r.headers=X(e.headers,t.headers),r},G=e=>{let t=[];return e.forEach((e,r)=>{t.push([r,e])}),t},X=(...e)=>{let t=new Headers;for(let r of e)if(r)for(let[e,s]of r instanceof Headers?G(r):Object.entries(r))if(null===s)t.delete(e);else if(Array.isArray(s))for(let r of s)t.append(e,r);else void 0!==s&&t.set(e,"object"==typeof s?JSON.stringify(s):s);return t};var Z=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return"number"==typeof e?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let r=this.getInterceptorIndex(e);return!!this.fns[r]&&(this.fns[r]=t,e)}use(e){return this.fns.push(e),this.fns.length-1}};let Q=W({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),Y={"Content-Type":"application/json"},ee=(e={})=>({...$,headers:Y,parseAs:"auto",querySerializer:Q,...e}),et=(e={})=>{let t=J(ee(),e),r=()=>({...t}),s={error:new Z,request:new Z,response:new Z},i=async e=>{let r={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:X(t.headers,e.headers),serializedBody:void 0};return r.security&&await M({...r,security:r.security}),r.requestValidator&&await r.requestValidator(r),void 0!==r.body&&r.bodySerializer&&(r.serializedBody=r.bodySerializer(r.body)),(void 0===r.body||""===r.serializedBody)&&r.headers.delete("Content-Type"),{opts:r,url:K(r)}
1},n=async e=>{let{opts:t,url:r}=await i(e),n=new Request(r,{redirect:"follow",...t,body:L(t)});for(let e of s.request.fns)e&&(n=await e(n,t));let a=t.fetch,l;try{l=await a(n)}catch(r){let e=r;for(let i of s.error.fns)i&&(e=await i(r,void 0,n,t));if(e||={},t.throwOnError)throw e;return"data"===t.responseStyle?void 0:{error:e,request:n,response:void 0}}for(let e of s.response.fns)e&&(l=await e(l,n,t));let o={request:n,response:l};if(l.ok){let e,r=("auto"===t.parseAs?(e=>{if(!e)return"stream";let t=e.split(";")[0]?.trim();if(t){if(t.startsWith("application/json")||t.endsWith("+json"))return"json";if("multipart/form-data"===t)return"formData";if(["application/","audio/","image/","video/"].some(e=>t.startsWith(e)))return"blob";if(t.startsWith("text/"))return"text"}})(l.headers.get("Content-Type")):t.parseAs)??"json";if(204===l.status||"0"===l.headers.get("Content-Length")){let e;switch(r){case"arrayBuffer":case"blob":case"text":e=await l[r]();break;case"formData":e=new FormData;break;case"stream":e=l.body;break;default:e={}}return"data"===t.responseStyle?e:{data:e,...o}}switch(r){case"arrayBuffer":case"blob":case"formData":case"text":e=await l[r]();break;case"json":{let t=await l.text();e=t?JSON.parse(t):{};break}case"stream":return"data"===t.responseStyle?l.body:{data:l.body,...o}}return"json"===r&&(t.responseValidator&&await t.responseValidator(e),t.responseTransformer&&(e=await t.responseTransformer(e))),"data"===t.responseStyle?e:{data:e,...o}}let c=await l.text(),d;try{d=JSON.parse(c)}catch{}let h=d??c,u=h;for(let e of s.error.fns)e&&(u=await e(h,l,n,t));if(u||={},t.throwOnError)throw u;return"data"===t.responseStyle?void 0:{error:u,...o}},a=e=>t=>n({...t,method:e}),l=e=>async t=>{let{opts:r,url:n}=await i(t);return(({onRequest:e,onSseError:t,onSseEvent:r,responseTransformer:s,responseValidator:i,sseDefaultRetryDelay:n,sseMaxRetryAttempts:a,sseMaxRetryDelay:l,sseSleepFn:o,url:c,...d})=>{let h,u=o??(e=>new Promise(t=>setTimeout(t,e)));return{stream:async function*(){let o=n??3e3,p=0,y=d.signal??new AbortController().signal;for(;!y.aborted;){p++;let n=d.headers instanceof Headers?d.headers:new Headers(d.headers);void 0!==h&&n.set("Last-Event-ID",h);try{let t={redirect:"follow",...d,body:d.serializedBody,headers:n,signal:y},a=new Request(c,t);e&&(a=await e(c,t));let l=await (d.fetch??globalThis.fetch)(a);if(!l.ok)throw Error(`SSE failed: ${l.status} ${l.statusText}`);if(!l.body)throw Error("No body in SSE response");let u=l.body.pipeThrough(new TextDecoderStream).getReader(),p="",f=()=>{try{u.cancel()}catch{}};y.addEventListener("abort",f);try{for(;;){let{done:e,value:t}=await u.read();if(e)break;p+=t;let n=(p=p.replace(/\r\n/g,` 2`).replace(/\r/g,` 3`)).split(` 4 5`);for(let e of(p=n.pop()??"",n)){let t=e.split(` 6`),n=[],a;for(let e of t)if(e.startsWith("data:"))n.push(e.replace(/^data:\s*/,""));else if(e.startsWith("event:"))a=e.replace(/^event:\s*/,"");else if(e.startsWith("id:"))h=e.replace(/^id:\s*/,"");else if(e.startsWith("retry:")){let t=Number.parseInt(e.replace(/^retry:\s*/,""),10);Number.isNaN(t)||(o=t)}let l,c=!1;if(n.length){let e=n.join(` 7`);try{l=JSON.parse(e),c=!0}catch{l=e}}c&&(i&&await i(l),s&&(l=await s(l))),r?.({data:l,event:a,id:h,retry:o}),n.length&&(yield l)}}}finally{y.removeEventListener("abort",f),u.releaseLock()}break}catch(e){if(t?.(e),void 0!==a&&p>=a)break;await u(Math.min(o*2**(p-1),l??3e4))}}}()}})({...r,body:r.body,headers:r.headers,method:e,onRequest:async(e,t)=>{let i=new Request(e,t);for(let e of s.request.fns)e&&(i=await e(i,r));return i},serializedBody:L(r),url:n})};return{buildUrl:e=>K({...t,...e}),connect:a("CONNECT"),delete:a("DELETE"),get:a("GET"),getConfig:r,head:a("HEAD"),interceptors:s,options:a("OPTIONS"),patch:a("PATCH"),post:a("POST"),put:a("PUT"),request:n,setConfig:e=>(t=J(t,e),r()),sse:{connect:l("CONNECT"),delete:l("DELETE"),get:l("GET"),head:l("HEAD"),options:l("OPTIONS"),patch:l("PATCH"),post:l("POST"),put:l("PUT"),trace:l("TRACE")},trace:a("TRACE")}},er=et(ee({baseUrl:"https://api.v0.dev/v2"})),es=async e=>(e.chats=e.chats.map(e=>(e.createdAt=new Date(e.createdAt),e.updatedAt&&=new Date(e.updatedAt),e)),e),ei=e=>(e.chat.createdAt=new Date(e.chat.createdAt),e.chat.updatedAt&&(e.chat.updatedAt=new Date(e.chat.updatedAt)),e),en=async e=>e=ei(e),ea=async e=>e=ei(e),el=async e=>e=ei(e),eo=async e=>e=ei(e),ec=async e=>e=ei(e),ed=async e=>{let t;return(t=e).messages=t.messages.map(e=>(e.createdAt=new Date(e.createdAt),e.updatedAt=new Date(e.updatedAt),e.parts=e.parts.map(e=>(e.startedAt&&=new Date(e.startedAt),e.finishedAt&&=new Date(e.finishedAt),e)),e)),e=t},eh=e=>(e.createdAt=new Date(e.createdAt),e.updatedAt=new Date(e.updatedAt),e.parts=e.parts.map(e=>(e.startedAt&&=new Date(e.startedAt),e.finishedAt&&=new Date(e.finishedAt),e)),e),eu=async e=>e=eh(e),ep=async e=>e=eh(e),ey=async e=>e=eh(e),ef=e=>(e.createdAt=new Date(e.createdAt),e.updatedAt&&=new Date(e.updatedAt),e),em=async e=>e=ef(e),eb=async e=>e=ef(e),eg=async e=>(e&&(e.expiresAt=new Date(e.expiresAt)),e),ev=async e=>(e.messages=e.messages.map(e=>(e.createdAt=new Date(e.createdAt),e.updatedAt=new Date(e.updatedAt),e.parts=e.parts.map(e=>(e.startedAt&&=new Date(e.startedAt),e.finishedAt&&=new Date(e.finishedAt),e)),e)),e),ew=async e=>(e.messages=e.messages.map(e=>(e.createdAt=new Date(e.createdAt),e.updatedAt=new Date(e.updatedAt),e.parts=e.parts.map(e=>(e.startedAt&&=new Date(e.startedAt),e.finishedAt&&=new Date(e.finishedAt),e)),e)),e),ek=async e=>e=ef(e),ex=async e=>e=e.map(e=>(e.createdAt=new Date(e.createdAt),e.updatedAt=new Date(e.updatedAt),e)),eA=e=>(e.createdAt=new Date(e.createdAt),e.updatedAt=new Date(e.updatedAt),e),eI=async e=>e=eA(e),eT=async e=>e=eA(e),ej=async e=>e=eA(e),eR=async e=>{let t;return(t=e).range.start=new Date(t.range.start),t.range.end=new Date(t.range.end),t.dataAsOf&&=new Date(t.dataAsOf),e=t},eC=async e=>{let t;return(t=e).range.start=new Date(t.range.start),t.range.end=new Date(t.range.end),t.data=t.data.map(e=>(e.createdAt=new Date(e.createdAt),e)),e=t},eS=async e=>{let t;return(t=e).range.start=new Date(t.range.start),t.range.end=new Date(t.range.end),t.projects=t.projects.map(e=>(e.firstActivity=new Date(e.firstActivity),e.lastActivity=new Date(e.lastActivity),e)),t.chats=t.chats.map(e=>(e.firstActivity=new Date(e.firstActivity),e.lastActivity=new Date(e.lastActivity),e)),e=t},eE=e=>(e.createdAt=new Date(e.createdAt),e),eD=async e=>e=eE(e),eq=async e=>e=eE(e),eO=async e=>e=eE(e);var e$=class{client;constructor(e){this.client=e?.client??er}},eN=class{defaultKey="default";instances=new Map;get(e){let t=this.instances.get(e??this.defaultKey);if(!t)throw Error('No SDK client found. Create one with "new V0Sdk()" to fix this error.');return t}set(e,t){this.instances.set(t??this.defaultKey,e)}},e_=class extends e${list(e,t){let r=P([e],[{args:[{in:"query",key:"limit"},{in:"query",key:"cursor"},{in:"query",key:"authorId"},{in:"query",key:"vercelProjectId"},{in:"query",key:"metadata"}]}]);return(t?.client??this.client).get({responseTransformer:es,security:[{scheme:"bearer",type:"http"}],url:"/chats",...t,...r})}create(e,t){let r=P([e],[{args:[{in:"body",key:"message"},{in:"body",key:"systemPrompt"},{in:"body",key:"modelConfiguration"},{in:"body",key:"attachments"},{in:"body",key:"mcpServerIds"},{in:"body",key:"skills"},{in:"body",key:"privacy"},{in:"body",key:"title"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).post({responseTransformer:en,security:[{scheme:"bearer",type:"http"}],url:"/chats",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}createFromFiles(e,t){let r=P([e],[{args:[{in:"body",key:"files"},{in:"body",key:"privacy"},{in:"body",key:"title"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).post({responseTransformer:ea,security:[{scheme:"bearer",type:"http"}],url:"/chats/from-files",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}createFromZip(e,t){let r=P([e],[{args:[{in:"body",key:"url"},{in:"body",key:"privacy"},{in:"body",key:"title"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).post({responseTransformer:el,security:[{scheme:"bearer",type:"http"}],url:"/chats/from-zip",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}createFromRepo(e,t){let r=P([e],[{args:[{in:"body",key:"repo"},{in:"body",key:"privacy"},{in:"body",key:"title"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).post({responseTransformer:eo,security:[{scheme:"bearer",type:"http"}],url:"/chats/from-repo",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}createFromVercelProject(e,t){let r=P([e],[{args:[{in:"body",key:"vercelProjectId"},{in:"body",key:"baseBranch"}]}]);return(t?.client??this.client).post({responseTransformer:ec,security:[{scheme:"bearer",type:"http"}],url:"/chats/from-vercel-project",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}createStream(e,t){let r=P([e],[{args:[{in:"body",key:"message"},{in:"body",key:"systemPrompt"},{in:"body",key:"modelConfiguration"},{in:"body",key:"attachments"},{in:"body",key:"mcpServerIds"},{in:"body",key:"skills"},{in:"body",key:"privacy"},{in:"body",key:"title"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).sse.post({security:[{scheme:"bearer",type:"http"}],url:"/chats/stream",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}createAsync(e,t){let r=P([e],[{args:[{in:"body",key:"message"},{in:"body",key:"systemPrompt"},{in:"body",key:"modelConfiguration"},{in:"body",key:"attachments"},{in:"body",key:"mcpServerIds"},{in:"body",key:"skills"},{in:"body",key:"privacy"},{in:"body",key:"title"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).post({security:[{scheme:"bearer",type:"http"}],url:"/chats/async",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}delete(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).delete({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}",...t,...r})}get(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).get({responseTransformer:em,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}",...t,...r})}update(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"title"},{in:"body",key:"privacy"},{in:"body",key:"metadata"}]}]);return(t?.client??this.client).patch({responseTransformer:eb,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}getPreview(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).get({responseTransformer:eg,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/preview",...t,...r})}getFiles(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).get({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/files",...t,...r})}updateFiles(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"files"}]}]);return(t?.client??this.client).patch({responseTransformer:ev,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/files",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}
7downloadFiles(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).get({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/files/download",...t,...r})}getConnectStatus(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"query",key:"requestId"}]}]);return(t?.client??this.client).get({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/connect/status",...t,...r})}restoreMessage(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"messageId"}]}]);return(t?.client??this.client).post({responseTransformer:ew,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/restore-message",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}duplicate(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"privacy"},{in:"body",key:"title"}]}]);return(t?.client??this.client).post({responseTransformer:ek,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/duplicate",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}deploy(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/deploy",...t,...r})}createVercelProject(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"name"}]}]);return(t?.client??this.client).post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/vercel-project",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}resume(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"}]}]);return(t?.client??this.client).sse.post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/resume",...t,...r})}},eP=class extends e${list(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"query",key:"limit"},{in:"query",key:"cursor"}]}]);return(t?.client??this.client).get({responseTransformer:ed,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages",...t,...r})}send(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"message"},{in:"body",key:"systemPrompt"},{in:"body",key:"modelConfiguration"},{in:"body",key:"mcpServerIds"},{in:"body",key:"attachments"},{in:"body",key:"skills"}]}]);return(t?.client??this.client).post({responseTransformer:eu,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}get(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"path",key:"messageId"}]}]);return(t?.client??this.client).get({responseTransformer:ep,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/{messageId}",...t,...r})}sendStream(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"message"},{in:"body",key:"systemPrompt"},{in:"body",key:"modelConfiguration"},{in:"body",key:"mcpServerIds"},{in:"body",key:"attachments"},{in:"body",key:"skills"}]}]);return(t?.client??this.client).sse.post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/stream",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}sendAsync(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"message"},{in:"body",key:"systemPrompt"},{in:"body",key:"modelConfiguration"},{in:"body",key:"mcpServerIds"},{in:"body",key:"attachments"},{in:"body",key:"skills"}]}]);return(t?.client??this.client).post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/async",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}resolve(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"task"},{in:"body",key:"modelConfiguration"}]}]);return(t?.client??this.client).post({responseTransformer:ey,security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/resolve",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}resolveStream(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"task"},{in:"body",key:"modelConfiguration"}]}]);return(t?.client??this.client).sse.post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/resolve/stream",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}resolveAsync(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"body",key:"task"},{in:"body",key:"modelConfiguration"}]}]);return(t?.client??this.client).post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/resolve/async",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}stop(e,t){let r=P([e],[{args:[{in:"path",key:"chatId"},{in:"path",key:"messageId"}]}]);return(t?.client??this.client).post({security:[{scheme:"bearer",type:"http"}],url:"/chats/{chatId}/messages/{messageId}/stop",...t,...r})}},eU=class extends e${list(e){return(e?.client??this.client).get({responseTransformer:ex,security:[{scheme:"bearer",type:"http"}],url:"/mcp-servers",...e})}create(e,t){let r=P([e],[{args:[{in:"body",key:"name"},{in:"body",key:"url"},{in:"body",key:"description"},{in:"body",key:"enabled"},{in:"body",key:"auth"},{in:"body",key:"scope"}]}]);return(t?.client??this.client).post({responseTransformer:eI,security:[{scheme:"bearer",type:"http"}],url:"/mcp-servers",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}delete(e,t){let r=P([e],[{args:[{in:"path",key:"mcpServerId"}]}]);return(t?.client??this.client).delete({security:[{scheme:"bearer",type:"http"}],url:"/mcp-servers/{mcpServerId}",...t,...r})}get(e,t){let r=P([e],[{args:[{in:"path",key:"mcpServerId"}]}]);return(t?.client??this.client).get({responseTransformer:eT,security:[{scheme:"bearer",type:"http"}],url:"/mcp-servers/{mcpServerId}",...t,...r})}update(e,t){let r=P([e],[{args:[{in:"path",key:"mcpServerId"},{in:"body",key:"name"},{in:"body",key:"url"},{in:"body",key:"description"},{in:"body",key:"enabled"},{in:"body",key:"auth"},{in:"body",key:"scope"}]}]);return(t?.client??this.client).patch({responseTransformer:ej,security:[{scheme:"bearer",type:"http"}],url:"/mcp-servers/{mcpServerId}",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}},ez=class extends e${getPreviewHosts(e){return(e?.client??this.client).get({security:[{scheme:"bearer",type:"http"}],url:"/settings/preview-hosts",...e})}setPreviewHosts(e,t){let r=P([e],[{args:[{in:"body",key:"hosts"}]}]);return(t?.client??this.client).put({security:[{scheme:"bearer",type:"http"}],url:"/settings/preview-hosts",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}},eB=class extends e${getSummary(e,t){let r=P([e],[{args:[{in:"query",key:"start"},{in:"query",key:"end"},{in:"query",key:"userId"}]}]);return(t?.client??this.client).get({responseTransformer:eR,security:[{scheme:"bearer",type:"http"}],url:"/usage/summary",...t,...r})}listEvents(e,t){let r=P([e],[{args:[{in:"query",key:"start"},{in:"query",key:"end"},{in:"query",key:"userId"},{in:"query",key:"chatId"},{in:"query",key:"messageId"},{in:"query",key:"limit"},{in:"query",key:"cursor"}]}]);return(t?.client??this.client).get({responseTransformer:eC,security:[{scheme:"bearer",type:"http"}],url:"/usage/events",...t,...r})}getActivity(e,t){let r=P([e],[{args:[{in:"query",key:"start"},{in:"query",key:"end"},{in:"query",key:"userId"}]}]);return(t?.client??this.client).get({responseTransformer:eS,security:[{scheme:"bearer",type:"http"}],url:"/usage/activity",...t,...r})}},eH=class extends e${list(e){return(e?.client??this.client).get({security:[{scheme:"bearer",type:"http"}],url:"/hooks",...e})}create(e,t){let r=P([e],[{args:[{in:"body",key:"name"},{in:"body",key:"events"},{in:"body",key:"url"},{in:"body",key:"chatId"}]}]);return(t?.client??this.client).post({responseTransformer:eD,security:[{scheme:"bearer",type:"http"}],url:"/hooks",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}delete(e,t){let r=P([e],[{args:[{in:"path",key:"hookId"}]}]);return(t?.client??this.client).delete({security:[{scheme:"bearer",type:"http"}],url:"/hooks/{hookId}",...t,...r})}get(e,t){let r=P([e],[{args:[{in:"path",key:"hookId"}]}]);return(t?.client??this.client).get({responseTransformer:eq,security:[{scheme:"bearer",type:"http"}],url:"/hooks/{hookId}",...t,...r})}update(e,t){let r=P([e],[{args:[{in:"path",key:"hookId"},{in:"body",key:"name"},{in:"body",key:"events"},{in:"body",key:"url"}]}]);return(t?.client??this.client).patch({responseTransformer:eO,security:[{scheme:"bearer",type:"http"}],url:"/hooks/{hookId}",...t,...r,headers:{"Content-Type":"application/json",...t?.headers,...r.headers}})}},eL=class e extends e${static __registry=new eN;constructor(t){super(t),e.__registry.set(this,t?.key)}_chats;get chats(){return this._chats??=new e_({client:this.client})}_messages;get messages(){return this._messages??=new eP({client:this.client})}_mcpServers;get mcpServers(){return this._mcpServers??=new eU({client:this.client})}_settings;get settings(){return this._settings??=new ez({client:this.client})}_usage;get usage(){return this._usage??=new eB({client:this.client})}_webhooks;get webhooks(){return this._webhooks??=new eH({client:this.client})}};new O({});
7var eF=class extends Error{code;id;constructor(e,t={}){super(e),this.name="V0StreamError",this.code=t.code,this.id=t.id}},eW=class{stream;history=[];subscribers=new Set;finalPromise;started=!1;finished=!1;failure;resolveFinal;rejectFinal;constructor(e){this.run=e,this.finalPromise=new Promise((e,t)=>{this.resolveFinal=e,this.rejectFinal=t}),this.finalPromise.catch(()=>{}),this.stream={[Symbol.asyncIterator]:()=>this.subscribe()}}get final(){return this.start(),this.finalPromise}toResponse(e={}){let t=new TextEncoder,r=this,s=new ReadableStream({async start(e){try{for await(let s of r.stream)e.enqueue(t.encode(eV("update",s)));e.enqueue(t.encode(eV("done",await r.final)))}catch(r){var s;e.enqueue(t.encode(eV("error",(s=r)instanceof eF?{message:s.message,code:s.code,id:s.id}:s instanceof Error?{message:s.message}:{message:"v0 stream failed"})))}finally{e.close()}}}),i=new Headers(e.headers);return i.has("Content-Type")||i.set("Content-Type","text/event-stream; charset=utf-8"),i.has("Cache-Control")||i.set("Cache-Control","no-cache, no-transform"),i.has("Connection")||i.set("Connection","keep-alive"),i.has("X-Accel-Buffering")||i.set("X-Accel-Buffering","no"),new Response(s,{...e,headers:i})}async *subscribe(){let e={queue:[...this.history],notify:void 0};this.subscribers.add(e),this.start();try{for(;;){if(e.queue.length>0){yield e.queue.shift();continue}if(this.failure)throw this.failure;if(this.finished)return;await new Promise(t=>{e.notify=t}),e.notify=void 0}}finally{this.subscribers.delete(e)}}start(){this.started||(this.started=!0,this.run(e=>this.publish(e),e=>this.finish(e)).catch(e=>this.fail(e)))}publish(e){for(let t of(this.history.push(e),this.subscribers))t.queue.push(e),t.notify?.()}finish(e){this.finished||(this.finished=!0,this.resolveFinal(e),this.notifySubscribers())}fail(e){this.finished||(this.finished=!0,this.failure=e,this.rejectFinal(e),this.notifySubscribers())}notifySubscribers(){for(let e of this.subscribers)e.notify?.()}};function eV(e,t){return`event: ${e} 8data: ${JSON.stringify(t)} 9 10`}async function*eM(e){if(!e.ok)throw new eF(`v0 stream request failed: ${e.status} ${e.statusText}`);if(!e.body)throw new eF("v0 stream response did not include a body");let t=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){let{done:e,value:s}=await t.read();if(e)break;r+=s;let i=(r=r.replace(/\r\n/g,` 11`).replace(/\r/g,` 12`)).split(` 13 14`);for(let e of(r=i.pop()??"",i)){let t=eK(e);t&&(yield t)}}let e=r.trim();if(e){let t=eK(e);t&&(yield t)}}finally{t.releaseLock()}}function eK(e){let t="message",r=[];for(let s of e.split(` 15`)){if(s.startsWith("event:")){t=s.replace(/^event:\s*/,"");continue}s.startsWith("data:")&&r.push(s.replace(/^data:\s*/,""))}if(0===r.length)return null;let s=JSON.parse(r.join(` 16`));return("update"===t||"message"===t)&&eJ(s)?{event:"update",data:s}:"done"===t&&eJ(s)?{event:"done",data:s}:"error"===t&&eJ(s)?{event:"error",data:s}:null}function eJ(e){return"object"==typeof e&&!!e}e.s(["A",0,eR,"C",0,ex,"D",0,ey,"E",0,ed,"I",0,et,"L",0,ee,"M",0,eD,"N",0,eq,"O",0,eu,"P",0,eO,"R",0,X,"S",0,eT,"T",0,ep,"_",0,es,"a",0,eU,"b",0,eb,"c",0,eH,"d",0,ec,"f",0,el,"g",0,em,"h",0,eg,"i",0,e_,"j",0,eC,"k",0,eS,"l",0,ea,"m",0,ek,"o",0,eP,"p",0,en,"r",0,function(e){return new eW(async(t,r)=>{let s;for await(let i of eM(await e)){if("update"===i.event){s=i.data,t(i.data);continue}if("done"===i.event)return void r(i.data);throw new eF("string"==typeof i.data.message?i.data.message:"v0 stream failed",{code:"string"==typeof i.data.code?i.data.code:void 0,id:"string"==typeof i.data.id?i.data.id:void 0})}if(!s)throw new eF("v0 stream ended before sending an event");r({...s,status:"done"})})},"s",0,eL,"t",0,eF,"u",0,eo,"v",0,ew,"w",0,ej,"x",0,eI,"y",0,ev],71096),e.s([],62095);var eG=class extends Error{status;statusText;body;response;constructor(e,t,r){super(r??function(e,t){return"object"==typeof t&&t&&"message"in t&&"string"==typeof t.message?t.message:"string"==typeof t&&t.trim()?t:`v0 proxy request failed: ${e.status} ${e.statusText}`.trim()}(e,t)),this.name="V0ResponseError",this.status=e.status,this.statusText=e.statusText,this.body=t,this.response=e}};async function eX(e,t,r,s={}){let i,n=((i=et(ee({...function(e){return e}(s)}))).interceptors.error.use((e,t)=>
16!t||e instanceof eG?e:new eG(t,e)),i),a=function(e,t,r){var s,i;let n=(s=t,/^[a-z][a-z\d+.-]*:/i.test(s)),a=new URL(t,n?void 0:"http://v0.local"),l=new URL(e.buildUrl({baseUrl:n?a.origin:"",query:"object"==typeof(i=r)&&i?r:void 0,url:a.pathname}),n?void 0:"http://v0.local");for(let[e,t]of a.searchParams)l.searchParams.append(e,t);return{baseUrl:n?l.origin:"",path:`${l.pathname}${l.search}`}}(n,e,"GET"===t.method?r:void 0),l=await n.request({...s,baseUrl:a.baseUrl,body:"GET"===t.method?void 0:r,method:t.method,parseAs:"stream"===t.response?"stream":"blob"===t.response?"blob":"auto",responseStyle:"fields",throwOnError:!0,url:a.path});return"stream"===t.response?l.response:"blob"===t.response?l.data:t.transform?t.transform(l.data):l.data}e.s(["n",0,eX,"t",0,eG],31755);var eZ=e.i(86356),eQ=e.i(47200);function eY(e,t){if(e&&"object"==typeof e&&t in e){let r=e[t];return"string"==typeof r?r:void 0}}e.s(["describeChatError",0,function(e){let t,r,s="Something went wrong. Please try again.";return e instanceof eG?(r=e.status,t=eY(e.body,"code"),s=eY(e.body,"error")??eY(e.body,"message")??s):e instanceof eQ.ApiRequestError?(r=e.status,t=e.code,s=e.message):e instanceof Error&&e.message&&(s="TypeError"===e.name&&/fetch/i.test(e.message)?"Couldn't reach the server. Check your connection.":e.message),{message:s,code:t,status:r,wasRejected:void 0!==r,needsApiKey:(0,eZ.isApiKeyErrorCode)(t)}}],96305)}]);
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.