frappe-react-sdk
Version:
React hooks for Frappe Framework
6 lines • 120 kB
JavaScript
(function(N,ye){typeof exports=="object"&&typeof module<"u"?ye(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],ye):(N=typeof globalThis<"u"?globalThis:N||self,ye(N["Frappe React"]={},N.jsxRuntime,N.React))})(this,function(N,ye,S){"use strict";var fa=Object.defineProperty;var ha=(N,ye,S)=>ye in N?fa(N,ye,{enumerable:!0,configurable:!0,writable:!0,value:S}):N[ye]=S;var Je=(N,ye,S)=>ha(N,typeof ye!="symbol"?ye+"":ye,S);var Or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ke={},ct={},Ee={},Jn;function Kn(){if(Jn)return Ee;Jn=1;var t=Ee&&Ee.__assign||function(){return t=Object.assign||function(o){for(var c,a=1,d=arguments.length;a<d;a++){c=arguments[a];for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(o[h]=c[h])}return o},t.apply(this,arguments)},e=Ee&&Ee.__awaiter||function(o,c,a,d){function h(f){return f instanceof a?f:new a(function(y){y(f)})}return new(a||(a=Promise))(function(f,y){function b(v){try{m(d.next(v))}catch(O){y(O)}}function E(v){try{m(d.throw(v))}catch(O){y(O)}}function m(v){v.done?f(v.value):h(v.value).then(b,E)}m((d=d.apply(o,c||[])).next())})},n=Ee&&Ee.__generator||function(o,c){var a={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},d,h,f,y;return y={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function b(m){return function(v){return E([m,v])}}function E(m){if(d)throw new TypeError("Generator is already executing.");for(;y&&(y=0,m[0]&&(a=0)),a;)try{if(d=1,h&&(f=m[0]&2?h.return:m[0]?h.throw||((f=h.return)&&f.call(h),0):h.next)&&!(f=f.call(h,m[1])).done)return f;switch(h=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return a.label++,{value:m[1],done:!1};case 5:a.label++,h=m[1],m=[0];continue;case 7:m=a.ops.pop(),a.trys.pop();continue;default:if(f=a.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){a=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){a.label=m[1];break}if(m[0]===6&&a.label<f[1]){a.label=f[1],f=m;break}if(f&&a.label<f[2]){a.label=f[2],a.ops.push(m);break}f[2]&&a.ops.pop(),a.trys.pop();continue}m=c.call(o,a)}catch(v){m=[6,v],h=0}finally{d=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.FrappeCall=void 0;var s=function(){function o(c,a,d,h,f){this.appURL=c,this.axios=a,this.useToken=d??!1,this.token=h,this.tokenType=f}return o.prototype.get=function(c,a){return e(this,void 0,void 0,function(){var d;return n(this,function(h){return d=new URLSearchParams,a&&Object.entries(a).forEach(function(f){var y=f[0],b=f[1];if(b!=null){var E=typeof b=="object"?JSON.stringify(b):b;d.set(y,E)}}),[2,this.axios.get("/api/method/".concat(c),{params:d}).then(function(f){return f.data}).catch(function(f){var y,b;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(y=f.response.data.message)!==null&&y!==void 0?y:"There was an error.",exception:(b=f.response.data.exception)!==null&&b!==void 0?b:""})})]})})},o.prototype.post=function(c,a){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.post("/api/method/".concat(c),t({},a)).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error.",exception:(y=h.response.data.exception)!==null&&y!==void 0?y:""})})]})})},o.prototype.put=function(c,a){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.put("/api/method/".concat(c),t({},a)).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error.",exception:(y=h.response.data.exception)!==null&&y!==void 0?y:""})})]})})},o.prototype.delete=function(c,a){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.delete("/api/method/".concat(c),{params:a}).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error.",exception:(y=h.response.data.exception)!==null&&y!==void 0?y:""})})]})})},o}();return Ee.FrappeCall=s,Ee}var Te={},Gn;function Xn(){if(Gn)return Te;Gn=1;var t=Te&&Te.__assign||function(){return t=Object.assign||function(o){for(var c,a=1,d=arguments.length;a<d;a++){c=arguments[a];for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(o[h]=c[h])}return o},t.apply(this,arguments)},e=Te&&Te.__awaiter||function(o,c,a,d){function h(f){return f instanceof a?f:new a(function(y){y(f)})}return new(a||(a=Promise))(function(f,y){function b(v){try{m(d.next(v))}catch(O){y(O)}}function E(v){try{m(d.throw(v))}catch(O){y(O)}}function m(v){v.done?f(v.value):h(v.value).then(b,E)}m((d=d.apply(o,c||[])).next())})},n=Te&&Te.__generator||function(o,c){var a={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},d,h,f,y;return y={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function b(m){return function(v){return E([m,v])}}function E(m){if(d)throw new TypeError("Generator is already executing.");for(;y&&(y=0,m[0]&&(a=0)),a;)try{if(d=1,h&&(f=m[0]&2?h.return:m[0]?h.throw||((f=h.return)&&f.call(h),0):h.next)&&!(f=f.call(h,m[1])).done)return f;switch(h=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return a.label++,{value:m[1],done:!1};case 5:a.label++,h=m[1],m=[0];continue;case 7:m=a.ops.pop(),a.trys.pop();continue;default:if(f=a.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){a=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){a.label=m[1];break}if(m[0]===6&&a.label<f[1]){a.label=f[1],f=m;break}if(f&&a.label<f[2]){a.label=f[2],a.ops.push(m);break}f[2]&&a.ops.pop(),a.trys.pop();continue}m=c.call(o,a)}catch(v){m=[6,v],h=0}finally{d=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(Te,"__esModule",{value:!0}),Te.FrappeDB=void 0;var s=function(){function o(c,a,d,h,f){this.appURL=c,this.axios=a,this.useToken=d??!1,this.token=h,this.tokenType=f}return o.prototype.getDoc=function(c,a){return a===void 0&&(a=""),e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.get("/api/resource/".concat(c,"/").concat(encodeURIComponent(a))).then(function(h){return h.data.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while fetching the document.",exception:(y=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},o.prototype.getDocList=function(c,a){var d;return e(this,void 0,void 0,function(){var h,f,y,b,E,m,v,O,j,R,Y;return n(this,function(z){return h={},a&&(f=a.fields,y=a.filters,b=a.orFilters,E=a.orderBy,m=a.limit,v=a.limit_start,O=a.groupBy,j=a.asDict,R=j===void 0?!0:j,Y=E?"".concat(String(E==null?void 0:E.field)," ").concat((d=E==null?void 0:E.order)!==null&&d!==void 0?d:"asc"):"",h={fields:f?JSON.stringify(f):void 0,filters:y?JSON.stringify(y):void 0,or_filters:b?JSON.stringify(b):void 0,order_by:Y,group_by:O,limit:m,limit_start:v,as_dict:R}),[2,this.axios.get("/api/resource/".concat(c),{params:h}).then(function(H){return H.data.data}).catch(function(H){var I,J;throw t(t({},H.response.data),{httpStatus:H.response.status,httpStatusText:H.response.statusText,message:"There was an error while fetching the documents.",exception:(J=(I=H.response.data.exception)!==null&&I!==void 0?I:H.response.data.exc_type)!==null&&J!==void 0?J:""})})]})})},o.prototype.createDoc=function(c,a){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.post("/api/resource/".concat(c),t({},a)).then(function(h){return h.data.data}).catch(function(h){var f,y,b;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error while creating the document.",exception:(b=(y=h.response.data.exception)!==null&&y!==void 0?y:h.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},o.prototype.updateDoc=function(c,a,d){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.put("/api/resource/".concat(c,"/").concat(a&&encodeURIComponent(a)),t({},d)).then(function(f){return f.data.data}).catch(function(f){var y,b,E;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(y=f.response.data.message)!==null&&y!==void 0?y:"There was an error while updating the document.",exception:(E=(b=f.response.data.exception)!==null&&b!==void 0?b:f.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},o.prototype.deleteDoc=function(c,a){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.delete("/api/resource/".concat(c,"/").concat(a&&encodeURIComponent(a))).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while deleting the document.",exception:(y=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},o.prototype.getCount=function(c,a,d,h){return d===void 0&&(d=!1),h===void 0&&(h=!1),e(this,void 0,void 0,function(){var f;return n(this,function(y){return f={doctype:c,filters:[]},d&&(f.cache=d),h&&(f.debug=h),a&&(f.filters=a?JSON.stringify(a):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:f}).then(function(b){return b.data.message}).catch(function(b){var E,m;throw t(t({},b.response.data),{httpStatus:b.response.status,httpStatusText:b.response.statusText,message:"There was an error while getting the count.",exception:(m=(E=b.response.data.exception)!==null&&E!==void 0?E:b.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},o.prototype.getLastDoc=function(c,a){return e(this,void 0,void 0,function(){var d,h;return n(this,function(f){switch(f.label){case 0:return d={orderBy:{field:"creation",order:"desc"}},a&&(d=t(t({},d),a)),[4,this.getDocList(c,t(t({},d),{limit:1,fields:["name"]}))];case 1:return h=f.sent(),h.length>0?[2,this.getDoc(c,h[0].name)]:[2,{}]}})})},o}();return Te.FrappeDB=s,Te}var Oe={},Ue={};/*! Axios v1.8.2 Copyright (c) 2025 Matt Zabriskie and contributors */var Yt,Yn;function Cr(){if(Yn)return Yt;Yn=1;function t(r,i){return function(){return r.apply(i,arguments)}}const{toString:e}=Object.prototype,{getPrototypeOf:n}=Object,s=(r=>i=>{const u=e.call(i);return r[u]||(r[u]=u.slice(8,-1).toLowerCase())})(Object.create(null)),o=r=>(r=r.toLowerCase(),i=>s(i)===r),c=r=>i=>typeof i===r,{isArray:a}=Array,d=c("undefined");function h(r){return r!==null&&!d(r)&&r.constructor!==null&&!d(r.constructor)&&E(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const f=o("ArrayBuffer");function y(r){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(r):i=r&&r.buffer&&f(r.buffer),i}const b=c("string"),E=c("function"),m=c("number"),v=r=>r!==null&&typeof r=="object",O=r=>r===!0||r===!1,j=r=>{if(s(r)!=="object")return!1;const i=n(r);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},R=o("Date"),Y=o("File"),z=o("Blob"),H=o("FileList"),I=r=>v(r)&&E(r.pipe),J=r=>{let i;return r&&(typeof FormData=="function"&&r instanceof FormData||E(r.append)&&((i=s(r))==="formdata"||i==="object"&&E(r.toString)&&r.toString()==="[object FormData]"))},Fe=o("URLSearchParams"),[B,de,V,ae]=["ReadableStream","Request","Response","Headers"].map(o),be=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function G(r,i,{allOwnKeys:u=!1}={}){if(r===null||typeof r>"u")return;let l,p;if(typeof r!="object"&&(r=[r]),a(r))for(l=0,p=r.length;l<p;l++)i.call(null,r[l],l,r);else{const g=u?Object.getOwnPropertyNames(r):Object.keys(r),w=g.length;let T;for(l=0;l<w;l++)T=g[l],i.call(null,r[T],T,r)}}function ce(r,i){i=i.toLowerCase();const u=Object.keys(r);let l=u.length,p;for(;l-- >0;)if(p=u[l],i===p.toLowerCase())return p;return null}const ue=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Or,Ne=r=>!d(r)&&r!==ue;function Q(){const{caseless:r}=Ne(this)&&this||{},i={},u=(l,p)=>{const g=r&&ce(i,p)||p;j(i[g])&&j(l)?i[g]=Q(i[g],l):j(l)?i[g]=Q({},l):a(l)?i[g]=l.slice():i[g]=l};for(let l=0,p=arguments.length;l<p;l++)arguments[l]&&G(arguments[l],u);return i}const ge=(r,i,u,{allOwnKeys:l}={})=>(G(i,(p,g)=>{u&&E(p)?r[g]=t(p,u):r[g]=p},{allOwnKeys:l}),r),Ve=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),gt=(r,i,u,l)=>{r.prototype=Object.create(i.prototype,l),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:i.prototype}),u&&Object.assign(r.prototype,u)},Be=(r,i,u,l)=>{let p,g,w;const T={};if(i=i||{},r==null)return i;do{for(p=Object.getOwnPropertyNames(r),g=p.length;g-- >0;)w=p[g],(!l||l(w,r,i))&&!T[w]&&(i[w]=r[w],T[w]=!0);r=u!==!1&&n(r)}while(r&&(!u||u(r,i))&&r!==Object.prototype);return i},se=(r,i,u)=>{r=String(r),(u===void 0||u>r.length)&&(u=r.length),u-=i.length;const l=r.indexOf(i,u);return l!==-1&&l===u},$e=r=>{if(!r)return null;if(a(r))return r;let i=r.length;if(!m(i))return null;const u=new Array(i);for(;i-- >0;)u[i]=r[i];return u},He=(r=>i=>r&&i instanceof r)(typeof Uint8Array<"u"&&n(Uint8Array)),Xe=(r,i)=>{const l=(r&&r[Symbol.iterator]).call(r);let p;for(;(p=l.next())&&!p.done;){const g=p.value;i.call(r,g[0],g[1])}},rt=(r,i)=>{let u;const l=[];for(;(u=r.exec(i))!==null;)l.push(u);return l},Pt=o("HTMLFormElement"),Nn=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(u,l,p){return l.toUpperCase()+p}),Ut=(({hasOwnProperty:r})=>(i,u)=>r.call(i,u))(Object.prototype),Ye=o("RegExp"),wt=(r,i)=>{const u=Object.getOwnPropertyDescriptors(r),l={};G(u,(p,g)=>{let w;(w=i(p,g,r))!==!1&&(l[g]=w||p)}),Object.defineProperties(r,l)},Zs=r=>{wt(r,(i,u)=>{if(E(r)&&["arguments","caller","callee"].indexOf(u)!==-1)return!1;const l=r[u];if(E(l)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+u+"'")})}})},$=(r,i)=>{const u={},l=p=>{p.forEach(g=>{u[g]=!0})};return a(r)?l(r):l(String(r).split(i)),u},M=()=>{},le=(r,i)=>r!=null&&Number.isFinite(r=+r)?r:i;function K(r){return!!(r&&E(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}const _e=r=>{const i=new Array(10),u=(l,p)=>{if(v(l)){if(i.indexOf(l)>=0)return;if(!("toJSON"in l)){i[p]=l;const g=a(l)?[]:{};return G(l,(w,T)=>{const A=u(w,p+1);!d(A)&&(g[T]=A)}),i[p]=void 0,g}}return l};return u(r,0)},We=o("AsyncFunction"),re=r=>r&&(v(r)||E(r))&&E(r.then)&&E(r.catch),fe=((r,i)=>r?setImmediate:i?((u,l)=>(ue.addEventListener("message",({source:p,data:g})=>{p===ue&&g===u&&l.length&&l.shift()()},!1),p=>{l.push(p),ue.postMessage(u,"*")}))(`axios@${Math.random()}`,[]):u=>setTimeout(u))(typeof setImmediate=="function",E(ue.postMessage)),Ae=typeof queueMicrotask<"u"?queueMicrotask.bind(ue):typeof process<"u"&&process.nextTick||fe;var _={isArray:a,isArrayBuffer:f,isBuffer:h,isFormData:J,isArrayBufferView:y,isString:b,isNumber:m,isBoolean:O,isObject:v,isPlainObject:j,isReadableStream:B,isRequest:de,isResponse:V,isHeaders:ae,isUndefined:d,isDate:R,isFile:Y,isBlob:z,isRegExp:Ye,isFunction:E,isStream:I,isURLSearchParams:Fe,isTypedArray:He,isFileList:H,forEach:G,merge:Q,extend:ge,trim:be,stripBOM:Ve,inherits:gt,toFlatObject:Be,kindOf:s,kindOfTest:o,endsWith:se,toArray:$e,forEachEntry:Xe,matchAll:rt,isHTMLForm:Pt,hasOwnProperty:Ut,hasOwnProp:Ut,reduceDescriptors:wt,freezeMethods:Zs,toObjectSet:$,toCamelCase:Nn,noop:M,toFiniteNumber:le,findKey:ce,global:ue,isContextDefined:Ne,isSpecCompliantForm:K,toJSONObject:_e,isAsyncFn:We,isThenable:re,setImmediate:fe,asap:Ae};function F(r,i,u,l,p){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",i&&(this.code=i),u&&(this.config=u),l&&(this.request=l),p&&(this.response=p,this.status=p.status?p.status:null)}_.inherits(F,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:_.toJSONObject(this.config),code:this.code,status:this.status}}});const bt=F.prototype,me={};["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(r=>{me[r]={value:r}}),Object.defineProperties(F,me),Object.defineProperty(bt,"isAxiosError",{value:!0}),F.from=(r,i,u,l,p,g)=>{const w=Object.create(bt);return _.toFlatObject(r,w,function(A){return A!==Error.prototype},T=>T!=="isAxiosError"),F.call(w,r.message,i,u,l,p),w.cause=r,w.name=r.name,g&&Object.assign(w,g),w};var ke=null;function Qe(r){return _.isPlainObject(r)||_.isArray(r)}function qt(r){return _.endsWith(r,"[]")?r.slice(0,-2):r}function it(r,i,u){return r?r.concat(i).map(function(p,g){return p=qt(p),!u&&g?"["+p+"]":p}).join(u?".":""):i}function _o(r){return _.isArray(r)&&!r.some(Qe)}const vo=_.toFlatObject(_,{},null,function(i){return/^is[A-Z]/.test(i)});function It(r,i,u){if(!_.isObject(r))throw new TypeError("target must be an object");i=i||new FormData,u=_.toFlatObject(u,{metaTokens:!0,dots:!1,indexes:!1},!1,function(U,L){return!_.isUndefined(L[U])});const l=u.metaTokens,p=u.visitor||x,g=u.dots,w=u.indexes,A=(u.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(i);if(!_.isFunction(p))throw new TypeError("visitor must be a function");function C(D){if(D===null)return"";if(_.isDate(D))return D.toISOString();if(!A&&_.isBlob(D))throw new F("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(D)||_.isTypedArray(D)?A&&typeof Blob=="function"?new Blob([D]):Buffer.from(D):D}function x(D,U,L){let Z=D;if(D&&!L&&typeof D=="object"){if(_.endsWith(U,"{}"))U=l?U:U.slice(0,-2),D=JSON.stringify(D);else if(_.isArray(D)&&_o(D)||(_.isFileList(D)||_.endsWith(U,"[]"))&&(Z=_.toArray(D)))return U=qt(U),Z.forEach(function(he,Ie){!(_.isUndefined(he)||he===null)&&i.append(w===!0?it([U],Ie,g):w===null?U:U+"[]",C(he))}),!1}return Qe(D)?!0:(i.append(it(L,U,g),C(D)),!1)}const k=[],W=Object.assign(vo,{defaultVisitor:x,convertValue:C,isVisitable:Qe});function ie(D,U){if(!_.isUndefined(D)){if(k.indexOf(D)!==-1)throw Error("Circular reference detected in "+U.join("."));k.push(D),_.forEach(D,function(Z,oe){(!(_.isUndefined(Z)||Z===null)&&p.call(i,Z,_.isString(oe)?oe.trim():oe,U,W))===!0&&ie(Z,U?U.concat(oe):[oe])}),k.pop()}}if(!_.isObject(r))throw new TypeError("data must be an object");return ie(r),i}function er(r){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(l){return i[l]})}function Bn(r,i){this._pairs=[],r&&It(r,this,i)}const tr=Bn.prototype;tr.append=function(i,u){this._pairs.push([i,u])},tr.toString=function(i){const u=i?function(l){return i.call(this,l,er)}:er;return this._pairs.map(function(p){return u(p[0])+"="+u(p[1])},"").join("&")};function So(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nr(r,i,u){if(!i)return r;const l=u&&u.encode||So;_.isFunction(u)&&(u={serialize:u});const p=u&&u.serialize;let g;if(p?g=p(i,u):g=_.isURLSearchParams(i)?i.toString():new Bn(i,u).toString(l),g){const w=r.indexOf("#");w!==-1&&(r=r.slice(0,w)),r+=(r.indexOf("?")===-1?"?":"&")+g}return r}class Eo{constructor(){this.handlers=[]}use(i,u,l){return this.handlers.push({fulfilled:i,rejected:u,synchronous:l?l.synchronous:!1,runWhen:l?l.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){_.forEach(this.handlers,function(l){l!==null&&i(l)})}}var sr=Eo,rr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},To=typeof URLSearchParams<"u"?URLSearchParams:Bn,Oo=typeof FormData<"u"?FormData:null,Co=typeof Blob<"u"?Blob:null,xo={isBrowser:!0,classes:{URLSearchParams:To,FormData:Oo,Blob:Co},protocols:["http","https","file","blob","url","data"]};const Pn=typeof window<"u"&&typeof document<"u",Un=typeof navigator=="object"&&navigator||void 0,Ro=Pn&&(!Un||["ReactNative","NativeScript","NS"].indexOf(Un.product)<0),Ao=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ko=Pn&&window.location.href||"http://localhost";var Do=Object.freeze({__proto__:null,hasBrowserEnv:Pn,hasStandardBrowserWebWorkerEnv:Ao,hasStandardBrowserEnv:Ro,navigator:Un,origin:ko}),pe={...Do,...xo};function Lo(r,i){return It(r,new pe.classes.URLSearchParams,Object.assign({visitor:function(u,l,p,g){return pe.isNode&&_.isBuffer(u)?(this.append(l,u.toString("base64")),!1):g.defaultVisitor.apply(this,arguments)}},i))}function Fo(r){return _.matchAll(/\w+|\[(\w*)]/g,r).map(i=>i[0]==="[]"?"":i[1]||i[0])}function No(r){const i={},u=Object.keys(r);let l;const p=u.length;let g;for(l=0;l<p;l++)g=u[l],i[g]=r[g];return i}function ir(r){function i(u,l,p,g){let w=u[g++];if(w==="__proto__")return!0;const T=Number.isFinite(+w),A=g>=u.length;return w=!w&&_.isArray(p)?p.length:w,A?(_.hasOwnProp(p,w)?p[w]=[p[w],l]:p[w]=l,!T):((!p[w]||!_.isObject(p[w]))&&(p[w]=[]),i(u,l,p[w],g)&&_.isArray(p[w])&&(p[w]=No(p[w])),!T)}if(_.isFormData(r)&&_.isFunction(r.entries)){const u={};return _.forEachEntry(r,(l,p)=>{i(Fo(l),p,u,0)}),u}return null}function Bo(r,i,u){if(_.isString(r))try{return(i||JSON.parse)(r),_.trim(r)}catch(l){if(l.name!=="SyntaxError")throw l}return(u||JSON.stringify)(r)}const qn={transitional:rr,adapter:["xhr","http","fetch"],transformRequest:[function(i,u){const l=u.getContentType()||"",p=l.indexOf("application/json")>-1,g=_.isObject(i);if(g&&_.isHTMLForm(i)&&(i=new FormData(i)),_.isFormData(i))return p?JSON.stringify(ir(i)):i;if(_.isArrayBuffer(i)||_.isBuffer(i)||_.isStream(i)||_.isFile(i)||_.isBlob(i)||_.isReadableStream(i))return i;if(_.isArrayBufferView(i))return i.buffer;if(_.isURLSearchParams(i))return u.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let T;if(g){if(l.indexOf("application/x-www-form-urlencoded")>-1)return Lo(i,this.formSerializer).toString();if((T=_.isFileList(i))||l.indexOf("multipart/form-data")>-1){const A=this.env&&this.env.FormData;return It(T?{"files[]":i}:i,A&&new A,this.formSerializer)}}return g||p?(u.setContentType("application/json",!1),Bo(i)):i}],transformResponse:[function(i){const u=this.transitional||qn.transitional,l=u&&u.forcedJSONParsing,p=this.responseType==="json";if(_.isResponse(i)||_.isReadableStream(i))return i;if(i&&_.isString(i)&&(l&&!this.responseType||p)){const w=!(u&&u.silentJSONParsing)&&p;try{return JSON.parse(i)}catch(T){if(w)throw T.name==="SyntaxError"?F.from(T,F.ERR_BAD_RESPONSE,this,null,this.response):T}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],r=>{qn.headers[r]={}});var In=qn;const Po=_.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"]);var Uo=r=>{const i={};let u,l,p;return r&&r.split(`
`).forEach(function(w){p=w.indexOf(":"),u=w.substring(0,p).trim().toLowerCase(),l=w.substring(p+1).trim(),!(!u||i[u]&&Po[u])&&(u==="set-cookie"?i[u]?i[u].push(l):i[u]=[l]:i[u]=i[u]?i[u]+", "+l:l)}),i};const or=Symbol("internals");function _t(r){return r&&String(r).trim().toLowerCase()}function jt(r){return r===!1||r==null?r:_.isArray(r)?r.map(jt):String(r)}function qo(r){const i=Object.create(null),u=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let l;for(;l=u.exec(r);)i[l[1]]=l[2];return i}const Io=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function jn(r,i,u,l,p){if(_.isFunction(l))return l.call(this,i,u);if(p&&(i=u),!!_.isString(i)){if(_.isString(l))return i.indexOf(l)!==-1;if(_.isRegExp(l))return l.test(i)}}function jo(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,u,l)=>u.toUpperCase()+l)}function Mo(r,i){const u=_.toCamelCase(" "+i);["get","set","has"].forEach(l=>{Object.defineProperty(r,l+u,{value:function(p,g,w){return this[l].call(this,i,p,g,w)},configurable:!0})})}class Mt{constructor(i){i&&this.set(i)}set(i,u,l){const p=this;function g(T,A,C){const x=_t(A);if(!x)throw new Error("header name must be a non-empty string");const k=_.findKey(p,x);(!k||p[k]===void 0||C===!0||C===void 0&&p[k]!==!1)&&(p[k||A]=jt(T))}const w=(T,A)=>_.forEach(T,(C,x)=>g(C,x,A));if(_.isPlainObject(i)||i instanceof this.constructor)w(i,u);else if(_.isString(i)&&(i=i.trim())&&!Io(i))w(Uo(i),u);else if(_.isHeaders(i))for(const[T,A]of i.entries())g(A,T,l);else i!=null&&g(u,i,l);return this}get(i,u){if(i=_t(i),i){const l=_.findKey(this,i);if(l){const p=this[l];if(!u)return p;if(u===!0)return qo(p);if(_.isFunction(u))return u.call(this,p,l);if(_.isRegExp(u))return u.exec(p);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,u){if(i=_t(i),i){const l=_.findKey(this,i);return!!(l&&this[l]!==void 0&&(!u||jn(this,this[l],l,u)))}return!1}delete(i,u){const l=this;let p=!1;function g(w){if(w=_t(w),w){const T=_.findKey(l,w);T&&(!u||jn(l,l[T],T,u))&&(delete l[T],p=!0)}}return _.isArray(i)?i.forEach(g):g(i),p}clear(i){const u=Object.keys(this);let l=u.length,p=!1;for(;l--;){const g=u[l];(!i||jn(this,this[g],g,i,!0))&&(delete this[g],p=!0)}return p}normalize(i){const u=this,l={};return _.forEach(this,(p,g)=>{const w=_.findKey(l,g);if(w){u[w]=jt(p),delete u[g];return}const T=i?jo(g):String(g).trim();T!==g&&delete u[g],u[T]=jt(p),l[T]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const u=Object.create(null);return _.forEach(this,(l,p)=>{l!=null&&l!==!1&&(u[p]=i&&_.isArray(l)?l.join(", "):l)}),u}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,u])=>i+": "+u).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...u){const l=new this(i);return u.forEach(p=>l.set(p)),l}static accessor(i){const l=(this[or]=this[or]={accessors:{}}).accessors,p=this.prototype;function g(w){const T=_t(w);l[T]||(Mo(p,w),l[T]=!0)}return _.isArray(i)?i.forEach(g):g(i),this}}Mt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_.reduceDescriptors(Mt.prototype,({value:r},i)=>{let u=i[0].toUpperCase()+i.slice(1);return{get:()=>r,set(l){this[u]=l}}}),_.freezeMethods(Mt);var De=Mt;function Mn(r,i){const u=this||In,l=i||u,p=De.from(l.headers);let g=l.data;return _.forEach(r,function(T){g=T.call(u,g,p.normalize(),i?i.status:void 0)}),p.normalize(),g}function ar(r){return!!(r&&r.__CANCEL__)}function ot(r,i,u){F.call(this,r??"canceled",F.ERR_CANCELED,i,u),this.name="CanceledError"}_.inherits(ot,F,{__CANCEL__:!0});function cr(r,i,u){const l=u.config.validateStatus;!u.status||!l||l(u.status)?r(u):i(new F("Request failed with status code "+u.status,[F.ERR_BAD_REQUEST,F.ERR_BAD_RESPONSE][Math.floor(u.status/100)-4],u.config,u.request,u))}function Vo(r){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return i&&i[1]||""}function $o(r,i){r=r||10;const u=new Array(r),l=new Array(r);let p=0,g=0,w;return i=i!==void 0?i:1e3,function(A){const C=Date.now(),x=l[g];w||(w=C),u[p]=A,l[p]=C;let k=g,W=0;for(;k!==p;)W+=u[k++],k=k%r;if(p=(p+1)%r,p===g&&(g=(g+1)%r),C-w<i)return;const ie=x&&C-x;return ie?Math.round(W*1e3/ie):void 0}}function Ho(r,i){let u=0,l=1e3/i,p,g;const w=(C,x=Date.now())=>{u=x,p=null,g&&(clearTimeout(g),g=null),r.apply(null,C)};return[(...C)=>{const x=Date.now(),k=x-u;k>=l?w(C,x):(p=C,g||(g=setTimeout(()=>{g=null,w(p)},l-k)))},()=>p&&w(p)]}const Vt=(r,i,u=3)=>{let l=0;const p=$o(50,250);return Ho(g=>{const w=g.loaded,T=g.lengthComputable?g.total:void 0,A=w-l,C=p(A),x=w<=T;l=w;const k={loaded:w,total:T,progress:T?w/T:void 0,bytes:A,rate:C||void 0,estimated:C&&T&&x?(T-w)/C:void 0,event:g,lengthComputable:T!=null,[i?"download":"upload"]:!0};r(k)},u)},ur=(r,i)=>{const u=r!=null;return[l=>i[0]({lengthComputable:u,total:r,loaded:l}),i[1]]},lr=r=>(...i)=>_.asap(()=>r(...i));var Wo=pe.hasStandardBrowserEnv?((r,i)=>u=>(u=new URL(u,pe.origin),r.protocol===u.protocol&&r.host===u.host&&(i||r.port===u.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,zo=pe.hasStandardBrowserEnv?{write(r,i,u,l,p,g){const w=[r+"="+encodeURIComponent(i)];_.isNumber(u)&&w.push("expires="+new Date(u).toGMTString()),_.isString(l)&&w.push("path="+l),_.isString(p)&&w.push("domain="+p),g===!0&&w.push("secure"),document.cookie=w.join("; ")},read(r){const i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Jo(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function Ko(r,i){return i?r.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):r}function fr(r,i,u){let l=!Jo(i);return r&&l||u==!1?Ko(r,i):i}const hr=r=>r instanceof De?{...r}:r;function Ze(r,i){i=i||{};const u={};function l(C,x,k,W){return _.isPlainObject(C)&&_.isPlainObject(x)?_.merge.call({caseless:W},C,x):_.isPlainObject(x)?_.merge({},x):_.isArray(x)?x.slice():x}function p(C,x,k,W){if(_.isUndefined(x)){if(!_.isUndefined(C))return l(void 0,C,k,W)}else return l(C,x,k,W)}function g(C,x){if(!_.isUndefined(x))return l(void 0,x)}function w(C,x){if(_.isUndefined(x)){if(!_.isUndefined(C))return l(void 0,C)}else return l(void 0,x)}function T(C,x,k){if(k in i)return l(C,x);if(k in r)return l(void 0,C)}const A={url:g,method:g,data:g,baseURL:w,transformRequest:w,transformResponse:w,paramsSerializer:w,timeout:w,timeoutMessage:w,withCredentials:w,withXSRFToken:w,adapter:w,responseType:w,xsrfCookieName:w,xsrfHeaderName:w,onUploadProgress:w,onDownloadProgress:w,decompress:w,maxContentLength:w,maxBodyLength:w,beforeRedirect:w,transport:w,httpAgent:w,httpsAgent:w,cancelToken:w,socketPath:w,responseEncoding:w,validateStatus:T,headers:(C,x,k)=>p(hr(C),hr(x),k,!0)};return _.forEach(Object.keys(Object.assign({},r,i)),function(x){const k=A[x]||p,W=k(r[x],i[x],x);_.isUndefined(W)&&k!==T||(u[x]=W)}),u}var dr=r=>{const i=Ze({},r);let{data:u,withXSRFToken:l,xsrfHeaderName:p,xsrfCookieName:g,headers:w,auth:T}=i;i.headers=w=De.from(w),i.url=nr(fr(i.baseURL,i.url),r.params,r.paramsSerializer),T&&w.set("Authorization","Basic "+btoa((T.username||"")+":"+(T.password?unescape(encodeURIComponent(T.password)):"")));let A;if(_.isFormData(u)){if(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv)w.setContentType(void 0);else if((A=w.getContentType())!==!1){const[C,...x]=A?A.split(";").map(k=>k.trim()).filter(Boolean):[];w.setContentType([C||"multipart/form-data",...x].join("; "))}}if(pe.hasStandardBrowserEnv&&(l&&_.isFunction(l)&&(l=l(i)),l||l!==!1&&Wo(i.url))){const C=p&&g&&zo.read(g);C&&w.set(p,C)}return i},Go=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(u,l){const p=dr(r);let g=p.data;const w=De.from(p.headers).normalize();let{responseType:T,onUploadProgress:A,onDownloadProgress:C}=p,x,k,W,ie,D;function U(){ie&&ie(),D&&D(),p.cancelToken&&p.cancelToken.unsubscribe(x),p.signal&&p.signal.removeEventListener("abort",x)}let L=new XMLHttpRequest;L.open(p.method.toUpperCase(),p.url,!0),L.timeout=p.timeout;function Z(){if(!L)return;const he=De.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),we={data:!T||T==="text"||T==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:he,config:r,request:L};cr(function(et){u(et),U()},function(et){l(et),U()},we),L=null}"onloadend"in L?L.onloadend=Z:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(Z)},L.onabort=function(){L&&(l(new F("Request aborted",F.ECONNABORTED,r,L)),L=null)},L.onerror=function(){l(new F("Network Error",F.ERR_NETWORK,r,L)),L=null},L.ontimeout=function(){let Ie=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded";const we=p.transitional||rr;p.timeoutErrorMessage&&(Ie=p.timeoutErrorMessage),l(new F(Ie,we.clarifyTimeoutError?F.ETIMEDOUT:F.ECONNABORTED,r,L)),L=null},g===void 0&&w.setContentType(null),"setRequestHeader"in L&&_.forEach(w.toJSON(),function(Ie,we){L.setRequestHeader(we,Ie)}),_.isUndefined(p.withCredentials)||(L.withCredentials=!!p.withCredentials),T&&T!=="json"&&(L.responseType=p.responseType),C&&([W,D]=Vt(C,!0),L.addEventListener("progress",W)),A&&L.upload&&([k,ie]=Vt(A),L.upload.addEventListener("progress",k),L.upload.addEventListener("loadend",ie)),(p.cancelToken||p.signal)&&(x=he=>{L&&(l(!he||he.type?new ot(null,r,L):he),L.abort(),L=null)},p.cancelToken&&p.cancelToken.subscribe(x),p.signal&&(p.signal.aborted?x():p.signal.addEventListener("abort",x)));const oe=Vo(p.url);if(oe&&pe.protocols.indexOf(oe)===-1){l(new F("Unsupported protocol "+oe+":",F.ERR_BAD_REQUEST,r));return}L.send(g||null)})},Xo=(r,i)=>{const{length:u}=r=r?r.filter(Boolean):[];if(i||u){let l=new AbortController,p;const g=function(C){if(!p){p=!0,T();const x=C instanceof Error?C:this.reason;l.abort(x instanceof F?x:new ot(x instanceof Error?x.message:x))}};let w=i&&setTimeout(()=>{w=null,g(new F(`timeout ${i} of ms exceeded`,F.ETIMEDOUT))},i);const T=()=>{r&&(w&&clearTimeout(w),w=null,r.forEach(C=>{C.unsubscribe?C.unsubscribe(g):C.removeEventListener("abort",g)}),r=null)};r.forEach(C=>C.addEventListener("abort",g));const{signal:A}=l;return A.unsubscribe=()=>_.asap(T),A}};const Yo=function*(r,i){let u=r.byteLength;if(u<i){yield r;return}let l=0,p;for(;l<u;)p=l+i,yield r.slice(l,p),l=p},Qo=async function*(r,i){for await(const u of Zo(r))yield*Yo(u,i)},Zo=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const i=r.getReader();try{for(;;){const{done:u,value:l}=await i.read();if(u)break;yield l}}finally{await i.cancel()}},pr=(r,i,u,l)=>{const p=Qo(r,i);let g=0,w,T=A=>{w||(w=!0,l&&l(A))};return new ReadableStream({async pull(A){try{const{done:C,value:x}=await p.next();if(C){T(),A.close();return}let k=x.byteLength;if(u){let W=g+=k;u(W)}A.enqueue(new Uint8Array(x))}catch(C){throw T(C),C}},cancel(A){return T(A),p.return()}},{highWaterMark:2})},$t=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",mr=$t&&typeof ReadableStream=="function",ea=$t&&(typeof TextEncoder=="function"?(r=>i=>r.encode(i))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),yr=(r,...i)=>{try{return!!r(...i)}catch{return!1}},ta=mr&&yr(()=>{let r=!1;const i=new Request(pe.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!i}),gr=64*1024,Vn=mr&&yr(()=>_.isReadableStream(new Response("").body)),Ht={stream:Vn&&(r=>r.body)};$t&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(i=>{!Ht[i]&&(Ht[i]=_.isFunction(r[i])?u=>u[i]():(u,l)=>{throw new F(`Response type '${i}' is not supported`,F.ERR_NOT_SUPPORT,l)})})})(new Response);const na=async r=>{if(r==null)return 0;if(_.isBlob(r))return r.size;if(_.isSpecCompliantForm(r))return(await new Request(pe.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(_.isArrayBufferView(r)||_.isArrayBuffer(r))return r.byteLength;if(_.isURLSearchParams(r)&&(r=r+""),_.isString(r))return(await ea(r)).byteLength},sa=async(r,i)=>{const u=_.toFiniteNumber(r.getContentLength());return u??na(i)};var ra=$t&&(async r=>{let{url:i,method:u,data:l,signal:p,cancelToken:g,timeout:w,onDownloadProgress:T,onUploadProgress:A,responseType:C,headers:x,withCredentials:k="same-origin",fetchOptions:W}=dr(r);C=C?(C+"").toLowerCase():"text";let ie=Xo([p,g&&g.toAbortSignal()],w),D;const U=ie&&ie.unsubscribe&&(()=>{ie.unsubscribe()});let L;try{if(A&&ta&&u!=="get"&&u!=="head"&&(L=await sa(x,l))!==0){let we=new Request(i,{method:"POST",body:l,duplex:"half"}),ze;if(_.isFormData(l)&&(ze=we.headers.get("content-type"))&&x.setContentType(ze),we.body){const[et,Gt]=ur(L,Vt(lr(A)));l=pr(we.body,gr,et,Gt)}}_.isString(k)||(k=k?"include":"omit");const Z="credentials"in Request.prototype;D=new Request(i,{...W,signal:ie,method:u.toUpperCase(),headers:x.normalize().toJSON(),body:l,duplex:"half",credentials:Z?k:void 0});let oe=await fetch(D);const he=Vn&&(C==="stream"||C==="response");if(Vn&&(T||he&&U)){const we={};["status","statusText","headers"].forEach(Tr=>{we[Tr]=oe[Tr]});const ze=_.toFiniteNumber(oe.headers.get("content-length")),[et,Gt]=T&&ur(ze,Vt(lr(T),!0))||[];oe=new Response(pr(oe.body,gr,et,()=>{Gt&&Gt(),U&&U()}),we)}C=C||"text";let Ie=await Ht[_.findKey(Ht,C)||"text"](oe,r);return!he&&U&&U(),await new Promise((we,ze)=>{cr(we,ze,{data:Ie,headers:De.from(oe.headers),status:oe.status,statusText:oe.statusText,config:r,request:D})})}catch(Z){throw U&&U(),Z&&Z.name==="TypeError"&&/fetch/i.test(Z.message)?Object.assign(new F("Network Error",F.ERR_NETWORK,r,D),{cause:Z.cause||Z}):F.from(Z,Z&&Z.code,r,D)}});const $n={http:ke,xhr:Go,fetch:ra};_.forEach($n,(r,i)=>{if(r){try{Object.defineProperty(r,"name",{value:i})}catch{}Object.defineProperty(r,"adapterName",{value:i})}});const wr=r=>`- ${r}`,ia=r=>_.isFunction(r)||r===null||r===!1;var br={getAdapter:r=>{r=_.isArray(r)?r:[r];const{length:i}=r;let u,l;const p={};for(let g=0;g<i;g++){u=r[g];let w;if(l=u,!ia(u)&&(l=$n[(w=String(u)).toLowerCase()],l===void 0))throw new F(`Unknown adapter '${w}'`);if(l)break;p[w||"#"+g]=l}if(!l){const g=Object.entries(p).map(([T,A])=>`adapter ${T} `+(A===!1?"is not supported by the environment":"is not available in the build"));let w=i?g.length>1?`since :
`+g.map(wr).join(`
`):" "+wr(g[0]):"as no adapter specified";throw new F("There is no suitable adapter to dispatch the request "+w,"ERR_NOT_SUPPORT")}return l},adapters:$n};function Hn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new ot(null,r)}function _r(r){return Hn(r),r.headers=De.from(r.headers),r.data=Mn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),br.getAdapter(r.adapter||In.adapter)(r).then(function(l){return Hn(r),l.data=Mn.call(r,r.transformResponse,l),l.headers=De.from(l.headers),l},function(l){return ar(l)||(Hn(r),l&&l.response&&(l.response.data=Mn.call(r,r.transformResponse,l.response),l.response.headers=De.from(l.response.headers))),Promise.reject(l)})}const vr="1.8.2",Wt={};["object","boolean","number","function","string","symbol"].forEach((r,i)=>{Wt[r]=function(l){return typeof l===r||"a"+(i<1?"n ":" ")+r}});const Sr={};Wt.transitional=function(i,u,l){function p(g,w){return"[Axios v"+vr+"] Transitional option '"+g+"'"+w+(l?". "+l:"")}return(g,w,T)=>{if(i===!1)throw new F(p(w," has been removed"+(u?" in "+u:"")),F.ERR_DEPRECATED);return u&&!Sr[w]&&(Sr[w]=!0,console.warn(p(w," has been deprecated since v"+u+" and will be removed in the near future"))),i?i(g,w,T):!0}},Wt.spelling=function(i){return(u,l)=>(console.warn(`${l} is likely a misspelling of ${i}`),!0)};function oa(r,i,u){if(typeof r!="object")throw new F("options must be an object",F.ERR_BAD_OPTION_VALUE);const l=Object.keys(r);let p=l.length;for(;p-- >0;){const g=l[p],w=i[g];if(w){const T=r[g],A=T===void 0||w(T,g,r);if(A!==!0)throw new F("option "+g+" must be "+A,F.ERR_BAD_OPTION_VALUE);continue}if(u!==!0)throw new F("Unknown option "+g,F.ERR_BAD_OPTION)}}var zt={assertOptions:oa,validators:Wt};const Pe=zt.validators;class Jt{constructor(i){this.defaults=i,this.interceptors={request:new sr,response:new sr}}async request(i,u){try{return await this._request(i,u)}catch(l){if(l instanceof Error){let p={};Error.captureStackTrace?Error.captureStackTrace(p):p=new Error;const g=p.stack?p.stack.replace(/^.+\n/,""):"";try{l.stack?g&&!String(l.stack).endsWith(g.replace(/^.+\n.+\n/,""))&&(l.stack+=`
`+g):l.stack=g}catch{}}throw l}}_request(i,u){typeof i=="string"?(u=u||{},u.url=i):u=i||{},u=Ze(this.defaults,u);const{transitional:l,paramsSerializer:p,headers:g}=u;l!==void 0&&zt.assertOptions(l,{silentJSONParsing:Pe.transitional(Pe.boolean),forcedJSONParsing:Pe.transitional(Pe.boolean),clarifyTimeoutError:Pe.transitional(Pe.boolean)},!1),p!=null&&(_.isFunction(p)?u.paramsSerializer={serialize:p}:zt.assertOptions(p,{encode:Pe.function,serialize:Pe.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),zt.assertOptions(u,{baseUrl:Pe.spelling("baseURL"),withXsrfToken:Pe.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let w=g&&_.merge(g.common,g[u.method]);g&&_.forEach(["delete","get","head","post","put","patch","common"],D=>{delete g[D]}),u.headers=De.concat(w,g);const T=[];let A=!0;this.interceptors.request.forEach(function(U){typeof U.runWhen=="function"&&U.runWhen(u)===!1||(A=A&&U.synchronous,T.unshift(U.fulfilled,U.rejected))});const C=[];this.interceptors.response.forEach(function(U){C.push(U.fulfilled,U.rejected)});let x,k=0,W;if(!A){const D=[_r.bind(this),void 0];for(D.unshift.apply(D,T),D.push.apply(D,C),W=D.length,x=Promise.resolve(u);k<W;)x=x.then(D[k++],D[k++]);return x}W=T.length;let ie=u;for(k=0;k<W;){const D=T[k++],U=T[k++];try{ie=D(ie)}catch(L){U.call(this,L);break}}try{x=_r.call(this,ie)}catch(D){return Promise.reject(D)}for(k=0,W=C.length;k<W;)x=x.then(C[k++],C[k++]);return x}getUri(i){i=Ze(this.defaults,i);const u=fr(i.baseURL,i.url,i.allowAbsoluteUrls);return nr(u,i.params,i.paramsSerializer)}}_.forEach(["delete","get","head","options"],function(i){Jt.prototype[i]=function(u,l){return this.request(Ze(l||{},{method:i,url:u,data:(l||{}).data}))}}),_.forEach(["post","put","patch"],function(i){function u(l){return function(g,w,T){return this.request(Ze(T||{},{method:i,headers:l?{"Content-Type":"multipart/form-data"}:{},url:g,data:w}))}}Jt.prototype[i]=u(),Jt.prototype[i+"Form"]=u(!0)});var Kt=Jt;class Wn{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(g){u=g});const l=this;this.promise.then(p=>{if(!l._listeners)return;let g=l._listeners.length;for(;g-- >0;)l._listeners[g](p);l._listeners=null}),this.promise.then=p=>{let g;const w=new Promise(T=>{l.subscribe(T),g=T}).then(p);return w.cancel=function(){l.unsubscribe(g)},w},i(function(g,w,T){l.reason||(l.reason=new ot(g,w,T),u(l.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const i=new AbortController,u=l=>{i.abort(l)};return this.subscribe(u),i.signal.unsubscribe=()=>this.unsubscribe(u),i.signal}static source(){let i;return{token:new Wn(function(p){i=p}),cancel:i}}}var aa=Wn;function ca(r){return function(u){return r.apply(null,u)}}function ua(r){return _.isObject(r)&&r.isAxiosError===!0}const zn={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(zn).forEach(([r,i])=>{zn[i]=r});var la=zn;function Er(r){const i=new Kt(r),u=t(Kt.prototype.request,i);return _.extend(u,Kt.prototype,i,{allOwnKeys:!0}),_.extend(u,i,null,{allOwnKeys:!0}),u.create=function(p){return Er(Ze(r,p))},u}const te=Er(In);return te.Axios=Kt,te.CanceledError=ot,te.CancelToken=aa,te.isCancel=ar,te.VERSION=vr,te.toFormData=It,te.AxiosError=F,te.Cancel=te.CanceledError,te.all=function(i){return Promise.all(i)},te.spread=ca,te.isAxiosError=ua,te.mergeConfig=Ze,te.AxiosHeaders=De,te.formToJSON=r=>ir(_.isHTMLForm(r)?new FormData(r):r),te.getAdapter=br.getAdapter,te.HttpStatusCode=la,te.default=te,Yt=te,Yt}var Qn;function Zn(){if(Qn)return Ue;Qn=1;var t=Ue&&Ue.__assign||function(){return t=Object.assign||function(o){for(var c,a=1,d=arguments.length;a<d;a++){c=arguments[a];for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(o[h]=c[h])}return o},t.apply(this,arguments)};Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.getRequestHeaders=Ue.getAxiosClient=void 0;var e=Cr();function n(o,c,a,d,h){return e.default.create({baseURL:o,headers:s(c,d,a,o,h),withCredentials:!0})}Ue.getAxiosClient=n;function s(o,c,a,d,h){o===void 0&&(o=!1);var f={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return o&&c&&a&&(f.Authorization="".concat(c," ").concat(a())),typeof window<"u"&&typeof document<"u"&&(window.location&&(d&&d!==window.location.origin||(f["X-Frappe-Site-Name"]=window.location.hostname)),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(f["X-Frappe-CSRF-Token"]=window.csrf_token)),t(t({},f),h??{})}return Ue.getRequestHeaders=s,Ue}var es;function ts(){if(es)return Oe;es=1;var t=Oe&&Oe.__assign||function(){return t=Object.assign||function(c){for(var a,d=1,h=arguments.length;d<h;d++){a=arguments[d];for(var f in a)Object.prototype.hasOwnProperty.call(a,f)&&(c[f]=a[f])}return c},t.apply(this,arguments)},e=Oe&&Oe.__awaiter||function(c,a,d,h){function f(y){return y instanceof d?y:new d(function(b){b(y)})}return new(d||(d=Promise))(function(y,b){function E(O){try{v(h.next(O))}catch(j){b(j)}}function m(O){try{v(h.throw(O))}catch(j){b(j)}}function v(O){O.done?y(O.value):f(O.value).then(E,m)}v((h=h.apply(c,a||[])).next())})},n=Oe&&Oe.__generator||function(c,a){var d={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},h,f,y,b;return b={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function E(v){return function(O){return m([v,O])}}function m(v){if(h)throw new TypeError("Generator is already executing.");for(;b&&(b=0,v[0]&&(d=0)),d;)try{if(h=1,f&&(y=v[0]&2?f.return:v[0]?f.throw||((y=f.return)&&y.call(f),0):f.next)&&!(y=y.call(f,v[1])).done)return y;switch(f=0,y&&(v=[v[0]&2,y.value]),v[0]){case 0:case 1:y=v;break;case 4:return d.label++,{value:v[1],done:!1};case 5:d.label++,f=v[1],v=[0];continue;case 7:v=d.ops.pop(),d.trys.pop();continue;default:if(y=d.trys,!(y=y.length>0&&y[y.length-1])&&(v[0]===6||v[0]===2)){d=0;continue}if(v[0]===3&&(!y||v[1]>y[0]&&v[1]<y[3])){d.label=v[1];break}if(v[0]===6&&d.label<y[1]){d.label=y[1],y=v;break}if(y&&d.label<y[2]){d.label=y[2],d.ops.push(v);break}y[2]&&d.ops.pop(),d.trys.pop();continue}v=a.call(c,d)}catch(O){v=[6,O],f=0}finally{h=y=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.FrappeFileUpload=void 0;var s=Zn(),o=function(){function c(a,d,h,f,y,b){this.appURL=a,this.axios=d,this.useToken=h??!1,this.token=f,this.tokenType=y,this.customHeaders=b}return c.prototype.uploadFile=function(a,d,h,f){return f===void 0&&(f="upload_file"),e(this,void 0,void 0,function(){var y,b,E,m,v,O,j,R;return n(this,function(Y){return y=new FormData,a&&y.append("file",a,a.name),b=d.isPrivate,E=d.folder,m=d.file_url,v=d.doctype,O=d.docname,j=d.fieldname,R=d.otherData,b&&y.append("is_private","1"),E&&y.append("folder",E),m&&y.append("file_url",m),v&&O&&(y.append("doctype",v),y.append("docname",O),j&&y.append("fieldname",j)),R&&Object.keys(R).forEach(function(z){var H=R[z];y.append(z,H)}),[2,this.axios.post("/api/method/".concat(f),y,{onUploadProgress:function(z){h&&h(z.loaded,z.total,z)},headers:t(t({},(0,s.getRequestHeaders)(this.useToken,this.tokenType,this.token,this.appURL,this.customHeaders)),{"Content-Type":"multipart/form-data"})}).catch(function(z){var H,I;throw t(t({},z.response.data),{httpStatus:z.response.status,httpStatusText:z.response.statusText,message:(H=z.response.data.message)!==null&&H!==void 0?H:"There was an error while uploading the file.",exception:(I=z.response.data.exception)!==null&&I!==void 0?I:""})})]})})},c}();return Oe.FrappeFileUpload=o,Oe}var ns;function xr(){if(ns)return ct;ns=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.FrappeApp=void 0;var t=is(),e=Kn(),n=Xn(),s=ts(),o=Zn(),c=function(){function a(d,h,f,y){var b,E;t