(function(y,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],g):(y=typeof globalThis<"u"?globalThis:y||self,g(y["django-ai-assistant-client"]={},y.React))})(this,function(y,g){"use strict";var yr=Object.defineProperty;var gr=(y,g,x)=>g in y?yr(y,g,{enumerable:!0,configurable:!0,writable:!0,value:x}):y[g]=x;var C=(y,g,x)=>gr(y,typeof g!="symbol"?g+"":g,x);"use client";class x extends Error{constructor(r,n,s){super(s);C(this,"url");C(this,"status");C(this,"statusText");C(this,"body");C(this,"request");this.name="ApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.body=n.body,this.request=r}}class Se extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}class Re{constructor(t){C(this,"_isResolved");C(this,"_isRejected");C(this,"_isCancelled");C(this,"cancelHandlers");C(this,"promise");C(this,"_resolve");C(this,"_reject");this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((r,n)=>{this._resolve=r,this._reject=n;const s=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(a))},o=a=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(a))},i=a=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),t(s,o,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,r){return this.promise.then(t,r)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(const t of this.cancelHandlers)t()}catch(t){console.warn("Cancellation threw an error",t);return}this.cancelHandlers.length=0,this._reject&&this._reject(new Se("Request aborted"))}}get isCancelled(){return this._isCancelled}}class Ae{constructor(){C(this,"_fns");this._fns=[]}eject(t){const r=this._fns.indexOf(t);r!==-1&&(this._fns=[...this._fns.slice(0,r),...this._fns.slice(r+1)])}use(t){this._fns=[...this._fns,t]}}const A={BASE:"",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"0.1.1",WITH_CREDENTIALS:!1,interceptors:{request:new Ae,response:new Ae}},bt={properties:{id:{title:"Id",type:"string"},name:{title:"Name",type:"string"}},required:["id","name"],title:"Assistant",type:"object"},Et={properties:{id:{anyOf:[{type:"integer"},{type:"null"}],title:"ID"},name:{anyOf:[{maxLength:255,type:"string"},{type:"null"}],title:"Name"},assistant_id:{anyOf:[{maxLength:255,type:"string"},{type:"null"}],title:"Assistant Id"},created_at:{format:"date-time",title:"Created At",type:"string"},updated_at:{format:"date-time",title:"Updated At",type:"string"}},required:["created_at","updated_at"],title:"Thread",type:"object"},Tt={properties:{name:{title:"Name",type:"string"},assistant_id:{anyOf:[{type:"string"},{type:"null"}],title:"Assistant Id"}},title:"ThreadIn",type:"object"},St={properties:{id:{title:"Id",type:"string"},type:{$ref:"#/components/schemas/ThreadMessageTypeEnum"},content:{title:"Content",type:"string"}},required:["id","type","content"],title:"ThreadMessage",type:"object"},Rt={enum:["human","ai","generic","system","function","tool"],title:"ThreadMessageTypeEnum",type:"string"},At={properties:{assistant_id:{title:"Assistant Id",type:"string"},content:{title:"Content",type:"string"}},required:["assistant_id","content"],title:"ThreadMessageIn",type:"object"};function Oe(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ot}=Object.prototype,{getPrototypeOf:re}=Object,J=(e=>t=>{const r=Ot.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),N=e=>(e=e.toLowerCase(),t=>J(t)===e),V=e=>t=>typeof t===e,{isArray:k}=Array,H=V("undefined");function Ct(e){return e!==null&&!H(e)&&e.constructor!==null&&!H(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ce=N("ArrayBuffer");function _t(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ce(e.buffer),t}const Nt=V("string"),_=V("function"),_e=V("number"),W=e=>e!==null&&typeof e=="object",Pt=e=>e===!0||e===!1,G=e=>{if(J(e)!=="object")return!1;const t=re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Lt=N("Date"),Dt=N("File"),xt=N("Blob"),Ft=N("FileList"),jt=e=>W(e)&&_(e.pipe),Bt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_(e.append)&&((t=J(e))==="formdata"||t==="object"&&_(e.toString)&&e.toString()==="[object FormData]"))},Ut=N("URLSearchParams"),[kt,qt,Mt,Ht]=["ReadableStream","Request","Response","Headers"].map(N),It=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),k(e))for(n=0,s=e.length;n0;)if(s=r[n],t===s.toLowerCase())return s;return null}const Pe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Le=e=>!H(e)&&e!==Pe;function se(){const{caseless:e}=Le(this)&&this||{},t={},r=(n,s)=>{const o=e&&Ne(t,s)||s;G(t[o])&&G(n)?t[o]=se(t[o],n):G(n)?t[o]=se({},n):k(n)?t[o]=n.slice():t[o]=n};for(let n=0,s=arguments.length;n(I(t,(s,o)=>{r&&_(s)?e[o]=Oe(s,r):e[o]=s},{allOwnKeys:n}),e),$t=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zt=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Jt=(e,t,r,n)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!n||n(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=r!==!1&&re(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Vt=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},Wt=e=>{if(!e)return null;if(k(e))return e;let t=e.length;if(!_e(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Gt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&re(Uint8Array)),Kt=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=n.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Xt=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Qt=N("HTMLFormElement"),Zt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),De=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Yt=N("RegExp"),xe=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};I(r,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(n[o]=i||s)}),Object.defineProperties(e,n)},en=e=>{xe(e,(t,r)=>{if(_(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(_(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},tn=(e,t)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return k(e)?n(e):n(String(e).split(t)),r},nn=()=>{},rn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,ie="abcdefghijklmnopqrstuvwxyz",Fe="0123456789",je={DIGIT:Fe,ALPHA:ie,ALPHA_DIGIT:ie+ie.toUpperCase()+Fe},sn=(e=16,t=je.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function on(e){return!!(e&&_(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const an=e=>{const t=new Array(10),r=(n,s)=>{if(W(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[s]=n;const o=k(n)?[]:{};return I(n,(i,a)=>{const d=r(i,s+1);!H(d)&&(o[a]=d)}),t[s]=void 0,o}}return n};return r(e,0)},cn=N("AsyncFunction"),c={isArray:k,isArrayBuffer:Ce,isBuffer:Ct,isFormData:Bt,isArrayBufferView:_t,isString:Nt,isNumber:_e,isBoolean:Pt,isObject:W,isPlainObject:G,isReadableStream:kt,isRequest:qt,isResponse:Mt,isHeaders:Ht,isUndefined:H,isDate:Lt,isFile:Dt,isBlob:xt,isRegExp:Yt,isFunction:_,isStream:jt,isURLSearchParams:Ut,isTypedArray:Gt,isFileList:Ft,forEach:I,merge:se,extend:vt,trim:It,stripBOM:$t,inherits:zt,toFlatObject:Jt,kindOf:J,kindOfTest:N,endsWith:Vt,toArray:Wt,forEachEntry:Kt,matchAll:Xt,isHTMLForm:Qt,hasOwnProperty:De,hasOwnProp:De,reduceDescriptors:xe,freezeMethods:en,toObjectSet:tn,toCamelCase:Zt,noop:nn,toFiniteNumber:rn,findKey:Ne,global:Pe,isContextDefined:Le,ALPHABET:je,generateString:sn,isSpecCompliantForm:on,toJSONObject:an,isAsyncFn:cn,isThenable:e=>e&&(W(e)||_(e))&&_(e.then)&&_(e.catch)};function m(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s)}c.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Be=m.prototype,Ue={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ue[e]={value:e}}),Object.defineProperties(m,Ue),Object.defineProperty(Be,"isAxiosError",{value:!0}),m.from=(e,t,r,n,s,o)=>{const i=Object.create(Be);return c.toFlatObject(e,i,function(d){return d!==Error.prototype},a=>a!=="isAxiosError"),m.call(i,e.message,t,r,n,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const ln=null;function oe(e){return c.isPlainObject(e)||c.isArray(e)}function ke(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function qe(e,t,r){return e?e.concat(t).map(function(s,o){return s=ke(s),!r&&o?"["+s+"]":s}).join(r?".":""):t}function un(e){return c.isArray(e)&&!e.some(oe)}const dn=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function K(e,t,r){if(!c.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=c.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,S){return!c.isUndefined(S[p])});const n=r.metaTokens,s=r.visitor||l,o=r.dots,i=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(c.isDate(h))return h.toISOString();if(!d&&c.isBlob(h))throw new m("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(h)||c.isTypedArray(h)?d&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function l(h,p,S){let R=h;if(h&&!S&&typeof h=="object"){if(c.endsWith(p,"{}"))p=n?p:p.slice(0,-2),h=JSON.stringify(h);else if(c.isArray(h)&&un(h)||(c.isFileList(h)||c.endsWith(p,"[]"))&&(R=c.toArray(h)))return p=ke(p),R.forEach(function(E,z){!(c.isUndefined(E)||E===null)&&t.append(i===!0?qe([p],z,o):i===null?p:p+"[]",u(E))}),!1}return oe(h)?!0:(t.append(qe(S,p,o),u(h)),!1)}const f=[],w=Object.assign(dn,{defaultVisitor:l,convertValue:u,isVisitable:oe});function b(h,p){if(!c.isUndefined(h)){if(f.indexOf(h)!==-1)throw Error("Circular reference detected in "+p.join("."));f.push(h),c.forEach(h,function(R,L){(!(c.isUndefined(R)||R===null)&&s.call(t,R,c.isString(L)?L.trim():L,p,w))===!0&&b(R,p?p.concat(L):[L])}),f.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return b(e),t}function Me(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function ae(e,t){this._pairs=[],e&&K(e,this,t)}const He=ae.prototype;He.append=function(t,r){this._pairs.push([t,r])},He.toString=function(t){const r=t?function(n){return t.call(this,n,Me)}:Me;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function fn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ie(e,t,r){if(!t)return e;const n=r&&r.encode||fn,s=r&&r.serialize;let o;if(s?o=s(t,r):o=c.isURLSearchParams(t)?t.toString():new ae(t,r).toString(n),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ve{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(n){n!==null&&t(n)})}}const $e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},hn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ae,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ce=typeof window<"u"&&typeof document<"u",pn=(e=>ce&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yn=ce&&window.location.href||"http://localhost",P={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ce,hasStandardBrowserEnv:pn,hasStandardBrowserWebWorkerEnv:mn,origin:yn},Symbol.toStringTag,{value:"Module"})),...hn};function gn(e,t){return K(e,new P.classes.URLSearchParams,Object.assign({visitor:function(r,n,s,o){return P.isNode&&c.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function wn(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function bn(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n=r.length;return i=!i&&c.isArray(s)?s.length:i,d?(c.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!a):((!s[i]||!c.isObject(s[i]))&&(s[i]=[]),t(r,n,s[i],o)&&c.isArray(s[i])&&(s[i]=bn(s[i])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const r={};return c.forEachEntry(e,(n,s)=>{t(wn(n),s,r,0)}),r}return null}function En(e,t,r){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const v={transitional:$e,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=c.isObject(t);if(o&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return s?JSON.stringify(ze(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return gn(t,this.formSerializer).toString();if((a=c.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return K(a?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),En(t)):t}],transformResponse:[function(t){const r=this.transitional||v.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(a){if(i)throw a.name==="SyntaxError"?m.from(a,m.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],e=>{v.headers[e]={}});const Tn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Sn=e=>{const t={};let r,n,s;return e&&e.split(` `).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||t[r]&&Tn[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},Je=Symbol("internals");function $(e){return e&&String(e).trim().toLowerCase()}function X(e){return e===!1||e==null?e:c.isArray(e)?e.map(X):String(e)}function Rn(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const An=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function le(e,t,r,n,s){if(c.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!c.isString(t)){if(c.isString(n))return t.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(t)}}function On(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Cn(e,t){const r=c.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(s,o,i){return this[n].call(this,t,s,o,i)},configurable:!0})})}class O{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function o(a,d,u){const l=$(d);if(!l)throw new Error("header name must be a non-empty string");const f=c.findKey(s,l);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||d]=X(a))}const i=(a,d)=>c.forEach(a,(u,l)=>o(u,l,d));if(c.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(c.isString(t)&&(t=t.trim())&&!An(t))i(Sn(t),r);else if(c.isHeaders(t))for(const[a,d]of t.entries())o(d,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=$(t),t){const n=c.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Rn(s);if(c.isFunction(r))return r.call(this,s,n);if(c.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=$(t),t){const n=c.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||le(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function o(i){if(i=$(i),i){const a=c.findKey(n,i);a&&(!r||le(n,n[a],a,r))&&(delete n[a],s=!0)}}return c.isArray(t)?t.forEach(o):o(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!t||le(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const r=this,n={};return c.forEach(this,(s,o)=>{const i=c.findKey(n,o);if(i){r[i]=X(s),delete r[o];return}const a=t?On(o):String(o).trim();a!==o&&delete r[o],r[a]=X(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return c.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&c.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[Je]=this[Je]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=$(i);n[a]||(Cn(s,i),n[a]=!0)}return c.isArray(t)?t.forEach(o):o(t),this}}O.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.reduceDescriptors(O.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),c.freezeMethods(O);function ue(e,t){const r=this||v,n=t||r,s=O.from(n.headers);let o=n.data;return c.forEach(e,function(a){o=a.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ve(e){return!!(e&&e.__CANCEL__)}function q(e,t,r){m.call(this,e??"canceled",m.ERR_CANCELED,t,r),this.name="CanceledError"}c.inherits(q,m,{__CANCEL__:!0});function We(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new m("Request failed with status code "+r.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function _n(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Nn(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=n[o];i||(i=u),r[s]=d,n[s]=u;let f=o,w=0;for(;f!==s;)w+=r[f++],f=f%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-in)return s&&(clearTimeout(s),s=null),r=a,e.apply(null,arguments);s||(s=setTimeout(()=>(s=null,r=Date.now(),e.apply(null,arguments)),n-(a-r)))}}const Q=(e,t,r=3)=>{let n=0;const s=Nn(50,250);return Pn(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,d=i-n,u=s(d),l=i<=a;n=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a&&l?(a-i)/u:void 0,event:o,lengthComputable:a!=null};f[t?"download":"upload"]=!0,e(f)},r)},Ln=P.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function s(o){let i=o;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(i){const a=c.isString(i)?s(i):i;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}(),Dn=P.hasStandardBrowserEnv?{write(e,t,r,n,s,o){const i=[e+"="+encodeURIComponent(t)];c.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),c.isString(n)&&i.push("path="+n),c.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function xn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Fn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ge(e,t){return e&&!xn(t)?Fn(e,t):t}const Ke=e=>e instanceof O?{...e}:e;function B(e,t){t=t||{};const r={};function n(u,l,f){return c.isPlainObject(u)&&c.isPlainObject(l)?c.merge.call({caseless:f},u,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function s(u,l,f){if(c.isUndefined(l)){if(!c.isUndefined(u))return n(void 0,u,f)}else return n(u,l,f)}function o(u,l){if(!c.isUndefined(l))return n(void 0,l)}function i(u,l){if(c.isUndefined(l)){if(!c.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,f){if(f in t)return n(u,l);if(f in e)return n(void 0,u)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,l)=>s(Ke(u),Ke(l),!0)};return c.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=d[l]||s,w=f(e[l],t[l],l);c.isUndefined(w)&&f!==a||(r[l]=w)}),r}const Xe=e=>{const t=B({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;t.headers=i=O.from(i),t.url=Ie(Ge(t.baseURL,t.url),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let d;if(c.isFormData(r)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((d=i.getContentType())!==!1){const[u,...l]=d?d.split(";").map(f=>f.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...l].join("; "))}}if(P.hasStandardBrowserEnv&&(n&&c.isFunction(n)&&(n=n(t)),n||n!==!1&&Ln(t.url))){const u=s&&o&&Dn.read(o);u&&i.set(s,u)}return t},jn=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const s=Xe(e);let o=s.data;const i=O.from(s.headers).normalize();let{responseType:a}=s,d;function u(){s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let l=new XMLHttpRequest;l.open(s.method.toUpperCase(),s.url,!0),l.timeout=s.timeout;function f(){if(!l)return;const b=O.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),p={data:!a||a==="text"||a==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:b,config:e,request:l};We(function(R){r(R),u()},function(R){n(R),u()},p),l=null}"onloadend"in l?l.onloadend=f:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(f)},l.onabort=function(){l&&(n(new m("Request aborted",m.ECONNABORTED,s,l)),l=null)},l.onerror=function(){n(new m("Network Error",m.ERR_NETWORK,s,l)),l=null},l.ontimeout=function(){let h=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const p=s.transitional||$e;s.timeoutErrorMessage&&(h=s.timeoutErrorMessage),n(new m(h,p.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,s,l)),l=null},o===void 0&&i.setContentType(null),"setRequestHeader"in l&&c.forEach(i.toJSON(),function(h,p){l.setRequestHeader(p,h)}),c.isUndefined(s.withCredentials)||(l.withCredentials=!!s.withCredentials),a&&a!=="json"&&(l.responseType=s.responseType),typeof s.onDownloadProgress=="function"&&l.addEventListener("progress",Q(s.onDownloadProgress,!0)),typeof s.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Q(s.onUploadProgress)),(s.cancelToken||s.signal)&&(d=b=>{l&&(n(!b||b.type?new q(null,e,l):b),l.abort(),l=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const w=_n(s.url);if(w&&P.protocols.indexOf(w)===-1){n(new m("Unsupported protocol "+w+":",m.ERR_BAD_REQUEST,e));return}l.send(o||null)})},Bn=(e,t)=>{let r=new AbortController,n;const s=function(d){if(!n){n=!0,i();const u=d instanceof Error?d:this.reason;r.abort(u instanceof m?u:new q(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{s(new m(`timeout ${t} of ms exceeded`,m.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d&&(d.removeEventListener?d.removeEventListener("abort",s):d.unsubscribe(s))}),e=null)};e.forEach(d=>d&&d.addEventListener&&d.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=i,[a,()=>{o&&clearTimeout(o),o=null}]},Un=function*(e,t){let r=e.byteLength;if(!t||r{const o=kn(e,t,s);let i=0;return new ReadableStream({type:"bytes",async pull(a){const{done:d,value:u}=await o.next();if(d){a.close(),n();return}let l=u.byteLength;r&&r(i+=l),a.enqueue(new Uint8Array(u))},cancel(a){return n(a),o.return()}},{highWaterMark:2})},Ze=(e,t)=>{const r=e!=null;return n=>setTimeout(()=>t({lengthComputable:r,total:e,loaded:n}))},Z=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ye=Z&&typeof ReadableStream=="function",de=Z&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),qn=Ye&&(()=>{let e=!1;const t=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),et=64*1024,fe=Ye&&!!(()=>{try{return c.isReadableStream(new Response("").body)}catch{}})(),Y={stream:fe&&(e=>e.body)};Z&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Y[t]&&(Y[t]=c.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new m(`Response type '${t}' is not supported`,m.ERR_NOT_SUPPORT,n)})})})(new Response);const Mn=async e=>{if(e==null)return 0;if(c.isBlob(e))return e.size;if(c.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(c.isArrayBufferView(e))return e.byteLength;if(c.isURLSearchParams(e)&&(e=e+""),c.isString(e))return(await de(e)).byteLength},Hn=async(e,t)=>{const r=c.toFiniteNumber(e.getContentLength());return r??Mn(t)},he={http:ln,xhr:jn,fetch:Z&&(async e=>{let{url:t,method:r,data:n,signal:s,cancelToken:o,timeout:i,onDownloadProgress:a,onUploadProgress:d,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:w}=Xe(e);u=u?(u+"").toLowerCase():"text";let[b,h]=s||o||i?Bn([s,o],i):[],p,S;const R=()=>{!p&&setTimeout(()=>{b&&b.unsubscribe()}),p=!0};let L;try{if(d&&qn&&r!=="get"&&r!=="head"&&(L=await Hn(l,n))!==0){let j=new Request(t,{method:"POST",body:n,duplex:"half"}),M;c.isFormData(n)&&(M=j.headers.get("content-type"))&&l.setContentType(M),j.body&&(n=Qe(j.body,et,Ze(L,Q(d)),null,de))}c.isString(f)||(f=f?"cors":"omit"),S=new Request(t,{...w,signal:b,method:r.toUpperCase(),headers:l.normalize().toJSON(),body:n,duplex:"half",withCredentials:f});let E=await fetch(S);const z=fe&&(u==="stream"||u==="response");if(fe&&(a||z)){const j={};["status","statusText","headers"].forEach(wt=>{j[wt]=E[wt]});const M=c.toFiniteNumber(E.headers.get("content-length"));E=new Response(Qe(E.body,et,a&&Ze(M,Q(a,!0)),z&&R,de),j)}u=u||"text";let mr=await Y[c.findKey(Y,u)||"text"](E,e);return!z&&R(),h&&h(),await new Promise((j,M)=>{We(j,M,{data:mr,headers:O.from(E.headers),status:E.status,statusText:E.statusText,config:e,request:S})})}catch(E){throw R(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,e,S),{cause:E.cause||E}):m.from(E,E&&E.code,e,S)}})};c.forEach(he,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const tt=e=>`- ${e}`,In=e=>c.isFunction(e)||e===null||e===!1,nt={getAdapter:e=>{e=c.isArray(e)?e:[e];const{length:t}=e;let r,n;const s={};for(let o=0;o`adapter ${a} `+(d===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : `+o.map(tt).join(` `):" "+tt(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:he};function pe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new q(null,e)}function rt(e){return pe(e),e.headers=O.from(e.headers),e.data=ue.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),nt.getAdapter(e.adapter||v.adapter)(e).then(function(n){return pe(e),n.data=ue.call(e,e.transformResponse,n),n.headers=O.from(n.headers),n},function(n){return Ve(n)||(pe(e),n&&n.response&&(n.response.data=ue.call(e,e.transformResponse,n.response),n.response.headers=O.from(n.response.headers))),Promise.reject(n)})}const st="1.7.2",me={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{me[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const it={};me.transitional=function(t,r,n){function s(o,i){return"[Axios v"+st+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,a)=>{if(t===!1)throw new m(s(i," has been removed"+(r?" in "+r:"")),m.ERR_DEPRECATED);return r&&!it[i]&&(it[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,i,a):!0}};function vn(e,t,r){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const a=e[o],d=a===void 0||i(a,o,e);if(d!==!0)throw new m("option "+o+" must be "+d,m.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new m("Unknown option "+o,m.ERR_BAD_OPTION)}}const ye={assertOptions:vn,validators:me},F=ye.validators;class U{constructor(t){this.defaults=t,this.interceptors={request:new ve,response:new ve}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=` `+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=B(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&ye.assertOptions(n,{silentJSONParsing:F.transitional(F.boolean),forcedJSONParsing:F.transitional(F.boolean),clarifyTimeoutError:F.transitional(F.boolean)},!1),s!=null&&(c.isFunction(s)?r.paramsSerializer={serialize:s}:ye.assertOptions(s,{encode:F.function,serialize:F.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[r.method]);o&&c.forEach(["delete","get","head","post","put","patch","common"],h=>{delete o[h]}),r.headers=O.concat(i,o);const a=[];let d=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(d=d&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let l,f=0,w;if(!d){const h=[rt.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,u),w=h.length,l=Promise.resolve(r);f{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{n.subscribe(a),o=a}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},t(function(o,i,a){n.reason||(n.reason=new q(o,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new ge(function(s){t=s}),cancel:t}}}function $n(e){return function(r){return e.apply(null,r)}}function zn(e){return c.isObject(e)&&e.isAxiosError===!0}const we={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(we).forEach(([e,t])=>{we[t]=e});function ot(e){const t=new U(e),r=Oe(U.prototype.request,t);return c.extend(r,U.prototype,t,{allOwnKeys:!0}),c.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return ot(B(e,s))},r}const T=ot(v);T.Axios=U,T.CanceledError=q,T.CancelToken=ge,T.isCancel=Ve,T.VERSION=st,T.toFormData=K,T.AxiosError=m,T.Cancel=T.CanceledError,T.all=function(t){return Promise.all(t)},T.spread=$n,T.isAxiosError=zn,T.mergeConfig=B,T.AxiosHeaders=O,T.formToJSON=e=>ze(c.isHTMLForm(e)?new FormData(e):e),T.getAdapter=nt.getAdapter,T.HttpStatusCode=we,T.default=T;const ee=e=>typeof e=="string",be=e=>ee(e)&&e!=="",at=e=>e instanceof Blob,Jn=e=>e instanceof FormData,ct=e=>e>=200&&e<300,Vn=e=>{try{return btoa(e)}catch{return Buffer.from(e).toString("base64")}},Wn=e=>{const t=[],r=(s,o)=>{t.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(o))}`)},n=(s,o)=>{o!=null&&(o instanceof Date?r(s,o.toISOString()):Array.isArray(o)?o.forEach(i=>n(s,i)):typeof o=="object"?Object.entries(o).forEach(([i,a])=>n(`${s}[${i}]`,a)):r(s,o))};return Object.entries(e).forEach(([s,o])=>n(s,o)),t.length?`?${t.join("&")}`:""},Gn=(e,t)=>{const r=e.ENCODE_PATH||encodeURI,n=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(o,i)=>{var a;return(a=t.path)!=null&&a.hasOwnProperty(i)?r(String(t.path[i])):o}),s=e.BASE+n;return t.query?s+Wn(t.query):s},Kn=e=>{if(e.formData){const t=new FormData,r=(n,s)=>{ee(s)||at(s)?t.append(n,s):t.append(n,JSON.stringify(s))};return Object.entries(e.formData).filter(([,n])=>n!=null).forEach(([n,s])=>{Array.isArray(s)?s.forEach(o=>r(n,o)):r(n,s)}),t}},te=async(e,t)=>typeof t=="function"?t(e):t,Xn=async(e,t)=>{const[r,n,s,o]=await Promise.all([te(t,e.TOKEN),te(t,e.USERNAME),te(t,e.PASSWORD),te(t,e.HEADERS)]),i=Object.entries({Accept:"application/json",...o,...t.headers}).filter(([,a])=>a!=null).reduce((a,[d,u])=>({...a,[d]:String(u)}),{});if(be(r)&&(i.Authorization=`Bearer ${r}`),be(n)&&be(s)){const a=Vn(`${n}:${s}`);i.Authorization=`Basic ${a}`}return t.body!==void 0?t.mediaType?i["Content-Type"]=t.mediaType:at(t.body)?i["Content-Type"]=t.body.type||"application/octet-stream":ee(t.body)?i["Content-Type"]="text/plain":Jn(t.body)||(i["Content-Type"]="application/json"):t.formData!==void 0&&t.mediaType&&(i["Content-Type"]=t.mediaType),i},Qn=e=>{if(e.body)return e.body},Zn=async(e,t,r,n,s,o,i,a)=>{const d=new AbortController;let u={data:n??s,headers:o,method:t.method,signal:d.signal,url:r,withCredentials:e.WITH_CREDENTIALS};i(()=>d.abort());for(const l of e.interceptors.request._fns)u=await l(u);try{return await a.request(u)}catch(l){const f=l;if(f.response)return f.response;throw l}},Yn=(e,t)=>{if(t){const r=e.headers[t];if(ee(r))return r}},er=e=>{if(e.status!==204)return e.data},tr=(e,t)=>{const n={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...e.errors}[t.status];if(n)throw new x(e,t,n);if(!t.ok){const s=t.status??"unknown",o=t.statusText??"unknown",i=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new x(e,t,`Generic Error: status: ${s}; status text: ${o}; body: ${i}`)}},D=(e,t,r=T)=>new Re(async(n,s,o)=>{try{const i=Gn(e,t),a=Kn(t),d=Qn(t),u=await Xn(e,t);if(!o.isCancelled){let l=await Zn(e,t,i,d,a,u,o,r);for(const p of e.interceptors.response._fns)l=await p(l);const f=er(l),w=Yn(l,t.responseHeader);let b=f;t.responseTransformer&&ct(l.status)&&(b=t.responseTransformer(f));const h={url:i,ok:ct(l.status),status:l.status,statusText:l.statusText,body:w??b};tr(t,h),n(h.body)}}catch(i){s(i)}}),lt=()=>D(A,{method:"GET",url:"/assistants/"}),ut=e=>D(A,{method:"GET",url:"/assistants/{assistant_id}/",path:{assistant_id:e.assistantId}}),dt=(e={})=>D(A,{method:"GET",url:"/threads/",query:{assistant_id:e.assistantId}}),ft=e=>D(A,{method:"POST",url:"/threads/",body:e.requestBody,mediaType:"application/json"}),nr=e=>D(A,{method:"GET",url:"/threads/{thread_id}/",path:{thread_id:e.threadId}}),ht=e=>D(A,{method:"PATCH",url:"/threads/{thread_id}/",path:{thread_id:e.threadId},body:e.requestBody,mediaType:"application/json"}),pt=e=>D(A,{method:"DELETE",url:"/threads/{thread_id}/",path:{thread_id:e.threadId}}),mt=e=>D(A,{method:"GET",url:"/threads/{thread_id}/messages/",path:{thread_id:e.threadId}}),yt=e=>D(A,{method:"POST",url:"/threads/{thread_id}/messages/",path:{thread_id:e.threadId},body:e.requestBody,mediaType:"application/json"}),gt=e=>D(A,{method:"DELETE",url:"/threads/{thread_id}/messages/{message_id}/",path:{thread_id:e.threadId,message_id:e.messageId}});var Ee={};/*! * cookie * Copyright(c) 2012-2014 Roman Shtylman * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */Ee.parse=sr,Ee.serialize=ir;var rr=Object.prototype.toString,ne=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function sr(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var r={},n=t||{},s=n.decode||or,o=0;o{try{n(!0);const o=await lt();return t(o),o}finally{n(!1)}},[]),assistants:e,loadingFetchAssistants:r}}function fr({assistantId:e}){const[t,r]=g.useState(null),[n,s]=g.useState(!1);return{fetchAssistant:g.useCallback(async()=>{try{s(!0);const i=await ut({assistantId:e});return r(i),i}finally{s(!1)}},[e]),assistant:t,loadingFetchAssistant:n}}function hr({assistantId:e}={}){const[t,r]=g.useState(null),[n,s]=g.useState(!1),[o,i]=g.useState(!1),[a,d]=g.useState(!1),[u,l]=g.useState(!1),f=g.useCallback(async()=>{try{s(!0);const p=await dt({assistantId:e});return r(p),p}finally{s(!1)}},[e]),w=g.useCallback(async({name:p}={})=>{try{i(!0);const S=await ft({requestBody:{name:p,assistant_id:e}});return await f(),S}finally{i(!1)}},[f,e]),b=g.useCallback(async({threadId:p,name:S,shouldUpdateAssistantId:R})=>{try{d(!0);const L=await ht({threadId:p,requestBody:{name:S,assistant_id:R?e:void 0}});return await f(),L}finally{d(!1)}},[f,e]),h=g.useCallback(async({threadId:p})=>{try{l(!0),await pt({threadId:p}),await f()}finally{l(!1)}},[f]);return{fetchThreads:f,createThread:w,updateThread:b,deleteThread:h,threads:t,loadingFetchThreads:n,loadingCreateThread:o,loadingUpdateThread:a,loadingDeleteThread:u}}function Te(e,t="fetch"){return e==null?(console.warn(`threadId is null or undefined. Ignoring ${t} operation.`),!0):!1}function pr({threadId:e}){const[t,r]=g.useState(null),[n,s]=g.useState(!1),[o,i]=g.useState(!1),[a,d]=g.useState(!1),u=g.useCallback(async()=>{if(Te(e))return null;try{s(!0);const w=await mt({threadId:e});return r(w),w}finally{s(!1)}},[e]),l=g.useCallback(async({assistantId:w,messageTextValue:b})=>{if(!Te(e,"create"))try{i(!0),await yt({threadId:e,requestBody:{content:b,assistant_id:w}}),await u()}finally{i(!1)}},[u,e]),f=g.useCallback(async({messageId:w})=>{if(!Te(e,"delete"))try{d(!0),await gt({threadId:e,messageId:w}),await u()}finally{d(!1)}},[u,e]);return{fetchMessages:u,createMessage:l,deleteMessage:f,messages:t,loadingFetchMessages:n,loadingCreateMessage:o,loadingDeleteMessage:a}}y.$Assistant=bt,y.$Thread=Et,y.$ThreadIn=Tt,y.$ThreadMessage=St,y.$ThreadMessageIn=At,y.$ThreadMessageTypeEnum=Rt,y.ApiError=x,y.CancelError=Se,y.CancelablePromise=Re,y.OpenAPI=A,y.aiCreateThread=ft,y.aiCreateThreadMessage=yt,y.aiDeleteThread=pt,y.aiDeleteThreadMessage=gt,y.aiGetAssistant=ut,y.aiGetThread=nr,y.aiListAssistants=lt,y.aiListThreadMessages=mt,y.aiListThreads=dt,y.aiUpdateThread=ht,y.configAIAssistant=ur,y.useAssistant=fr,y.useAssistantList=dr,y.useMessageList=pr,y.useThreadList=hr,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});