frappe-react-sdk 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -7
- package/dist/frappe-react-sdk.es.js +20 -20
- package/dist/frappe-react-sdk.umd.js +6 -6
- package/dist/lib/index.d.ts +2 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ React hooks library for a [Frappe Framework](https://frappeframework.com) backen
|
|
|
4
4
|
|
|
5
5
|
<br />
|
|
6
6
|
<p align="center">
|
|
7
|
-
<a href="https://github.com/
|
|
8
|
-
<a href="https://github.com/
|
|
7
|
+
<a href="https://github.com/The-Commit-Company/frappe-react-sdk"><img src="https://img.shields.io/maintenance/yes/2026?style=flat-square" /></a>
|
|
8
|
+
<a href="https://github.com/The-Commit-Company/frappe-react-sdk"><img src="https://img.shields.io/github/license/The-Commit-Company/frappe-react-sdk?style=flat-square" /></a>
|
|
9
9
|
<a href="https://www.npmjs.com/package/frappe-react-sdk"><img src="https://img.shields.io/npm/v/frappe-react-sdk?style=flat-square" /></a>
|
|
10
10
|
<a href="https://www.npmjs.com/package/frappe-react-sdk"><img src="https://img.shields.io/npm/dw/frappe-react-sdk?style=flat-square" /></a>
|
|
11
11
|
</p>
|
|
@@ -37,7 +37,7 @@ The hooks in the library use the default configuration for useSWR but you will b
|
|
|
37
37
|
|
|
38
38
|
## Looking for a Frappe frontend library for other Javascript frameworks?
|
|
39
39
|
|
|
40
|
-
You can use [frappe-js-sdk](https://github.com/
|
|
40
|
+
You can use [frappe-js-sdk](https://github.com/The-Commit-Company/frappe-js-sdk) to interface your frontend web app with Frappe.
|
|
41
41
|
|
|
42
42
|
<br/>
|
|
43
43
|
|
|
@@ -350,9 +350,8 @@ Parameters:
|
|
|
350
350
|
| --- | --------- | ------------------ | -------- | -------------------------------------------------------------- |
|
|
351
351
|
| 1. | `doctype` | `string` | ✅ | Name of the doctype |
|
|
352
352
|
| 2. | `filters` | `Filter[]` | - | optional parameter to filter the result |
|
|
353
|
-
| 3. | `cache` | `boolean` | - | Whether to cache the value on the server - default: `false` |
|
|
354
353
|
| 3. | `debug` | `boolean` | - | Whether to log debug messages on the server - default: `false` |
|
|
355
|
-
|
|
|
354
|
+
| 4. | `config` | `SWRConfiguration` | - | SWR Configuration Options |
|
|
356
355
|
|
|
357
356
|
```tsx
|
|
358
357
|
export const DocumentCount = () => {
|
|
@@ -360,8 +359,6 @@ export const DocumentCount = () => {
|
|
|
360
359
|
'User',
|
|
361
360
|
/** Filters **/
|
|
362
361
|
[['enabled', '=', true]],
|
|
363
|
-
/** Cache the result on server **/
|
|
364
|
-
false,
|
|
365
362
|
/** Print debug logs on server **/
|
|
366
363
|
false,
|
|
367
364
|
{
|
|
@@ -337,18 +337,18 @@ function yr() {
|
|
|
337
337
|
})];
|
|
338
338
|
});
|
|
339
339
|
});
|
|
340
|
-
}, a.prototype.getCount = function(c, o, h
|
|
341
|
-
return h === void 0 && (h = !1),
|
|
342
|
-
var
|
|
343
|
-
return n(this, function(
|
|
344
|
-
return
|
|
340
|
+
}, a.prototype.getCount = function(c, o, h) {
|
|
341
|
+
return h === void 0 && (h = !1), e(this, void 0, void 0, function() {
|
|
342
|
+
var f;
|
|
343
|
+
return n(this, function(l) {
|
|
344
|
+
return f = {
|
|
345
345
|
doctype: c,
|
|
346
346
|
filters: []
|
|
347
|
-
}, h && (
|
|
348
|
-
return
|
|
349
|
-
}).catch(function(
|
|
350
|
-
var
|
|
351
|
-
throw t(t({},
|
|
347
|
+
}, h && (f.debug = h), o && (f.filters = o ? JSON.stringify(o) : void 0), [2, this.axios.get("/api/method/frappe.client.get_count", { params: f }).then(function(m) {
|
|
348
|
+
return m.data.message;
|
|
349
|
+
}).catch(function(m) {
|
|
350
|
+
var b, E;
|
|
351
|
+
throw t(t({}, m.response.data), { httpStatus: m.response.status, httpStatusText: m.response.statusText, message: "There was an error while getting the count.", exception: (E = (b = m.response.data.exception) !== null && b !== void 0 ? b : m.response.data.exc_type) !== null && E !== void 0 ? E : "" });
|
|
352
352
|
})];
|
|
353
353
|
});
|
|
354
354
|
});
|
|
@@ -5775,17 +5775,17 @@ function rn(t) {
|
|
|
5775
5775
|
e.push(encodeURIComponent(n) + "=" + encodeURIComponent(t[n]));
|
|
5776
5776
|
return e.join("&");
|
|
5777
5777
|
}
|
|
5778
|
-
const Ia = (t, e, n = !1, s
|
|
5779
|
-
const { url:
|
|
5780
|
-
return ht(
|
|
5781
|
-
const
|
|
5782
|
-
return `${
|
|
5783
|
-
})() :
|
|
5784
|
-
}, ja = (t, e, n = !1, s
|
|
5785
|
-
const { db:
|
|
5778
|
+
const Ia = (t, e, n = !1, s, a) => {
|
|
5779
|
+
const { url: c, db: o } = X(re);
|
|
5780
|
+
return ht(s === void 0 ? (() => {
|
|
5781
|
+
const l = rn({ doctype: t, filters: e ?? [], debug: n });
|
|
5782
|
+
return `${c}/api/method/frappe.client.get_count?${l}`;
|
|
5783
|
+
})() : s, () => o.getCount(t, e, n), a);
|
|
5784
|
+
}, ja = (t, e, n = !1, s) => {
|
|
5785
|
+
const { db: a, url: c } = X(re), o = s === void 0 ? `${c}/api/method/frappe.client.get_count?${rn({ doctype: t, filters: e ?? [], debug: n })}` : s;
|
|
5786
5786
|
return I(() => {
|
|
5787
|
-
tn(
|
|
5788
|
-
}, [
|
|
5787
|
+
tn(o, () => a.getCount(t, e, !1));
|
|
5788
|
+
}, [o, t, e]);
|
|
5789
5789
|
}, Ea = (t, e, n, s, a = "GET") => {
|
|
5790
5790
|
const { call: c } = X(re), o = rn(e ?? {}), h = `${t}?${o}`;
|
|
5791
5791
|
return {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(B,de){typeof exports=="object"&&typeof module<"u"?de(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],de):(B=typeof globalThis<"u"?globalThis:B||self,de(B["Frappe React"]={},B.jsxRuntime,B.React))})(this,function(B,de,S){"use strict";var Da=Object.defineProperty;var La=(B,de,S)=>de in B?Da(B,de,{enumerable:!0,configurable:!0,writable:!0,value:S}):B[de]=S;var Xe=(B,de,S)=>La(B,typeof de!="symbol"?de+"":de,S);var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ye={},ht={},Oe={},ns;function ss(){if(ns)return Oe;ns=1;var t=Oe&&Oe.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Oe&&Oe.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(_){try{y(h.next(_))}catch(O){m(O)}}function E(_){try{y(h.throw(_))}catch(O){m(O)}}function y(_){_.done?l(_.value):f(_.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Oe&&Oe.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(_){return E([y,_])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(_){y=[6,_],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.FrappeCall=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.get=function(c,o){return e(this,void 0,void 0,function(){var h;return n(this,function(f){return h=new URLSearchParams,o&&Object.entries(o).forEach(function(l){var m=l[0],b=l[1];if(b!=null){var E=typeof b=="object"?JSON.stringify(b):b;h.set(m,E)}}),[2,this.axios.get("/api/method/".concat(c),{params:h}).then(function(l){return l.data}).catch(function(l){var m,b;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:(m=l.response.data.message)!==null&&m!==void 0?m:"There was an error.",exception:(b=l.response.data.exception)!==null&&b!==void 0?b:""})})]})})},a.prototype.post=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/method/".concat(c),t({},o)).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a.prototype.put=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.put("/api/method/".concat(c),t({},o)).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a.prototype.delete=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.delete("/api/method/".concat(c),{params:o}).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a}();return Oe.FrappeCall=s,Oe}var Ce={},rs;function is(){if(rs)return Ce;rs=1;var t=Ce&&Ce.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Ce&&Ce.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(_){try{y(h.next(_))}catch(O){m(O)}}function E(_){try{y(h.throw(_))}catch(O){m(O)}}function y(_){_.done?l(_.value):f(_.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Ce&&Ce.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(_){return E([y,_])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(_){y=[6,_],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.FrappeDB=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.getDoc=function(c,o){return o===void 0&&(o=""),e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.get("/api/resource/".concat(c,"/").concat(encodeURIComponent(o))).then(function(f){return f.data.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while fetching the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getDocList=function(c,o){var h;return e(this,void 0,void 0,function(){var f,l,m,b,E,y,_,O,I,R,K;return n(this,function(G){return f={},o&&(l=o.fields,m=o.filters,b=o.orFilters,E=o.orderBy,y=o.limit,_=o.limit_start,O=o.groupBy,I=o.asDict,R=I===void 0?!0:I,K=E?"".concat(String(E==null?void 0:E.field)," ").concat((h=E==null?void 0:E.order)!==null&&h!==void 0?h:"asc"):"",f={fields:l?JSON.stringify(l):void 0,filters:m?JSON.stringify(m):void 0,or_filters:b?JSON.stringify(b):void 0,order_by:K,group_by:O,limit:y,limit_start:_,as_dict:R}),[2,this.axios.get("/api/resource/".concat(c),{params:f}).then(function(H){return H.data.data}).catch(function(H){var j,Z;throw t(t({},H.response.data),{httpStatus:H.response.status,httpStatusText:H.response.statusText,message:"There was an error while fetching the documents.",exception:(Z=(j=H.response.data.exception)!==null&&j!==void 0?j:H.response.data.exc_type)!==null&&Z!==void 0?Z:""})})]})})},a.prototype.createDoc=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/resource/".concat(c),t({},o)).then(function(f){return f.data.data}).catch(function(f){var l,m,b;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error while creating the document.",exception:(b=(m=f.response.data.exception)!==null&&m!==void 0?m:f.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},a.prototype.updateDoc=function(c,o,h){return e(this,void 0,void 0,function(){return n(this,function(f){return[2,this.axios.put("/api/resource/".concat(c,"/").concat(o&&encodeURIComponent(o)),t({},h)).then(function(l){return l.data.data}).catch(function(l){var m,b,E;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:(m=l.response.data.message)!==null&&m!==void 0?m:"There was an error while updating the document.",exception:(E=(b=l.response.data.exception)!==null&&b!==void 0?b:l.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.deleteDoc=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.delete("/api/resource/".concat(c,"/").concat(o&&encodeURIComponent(o))).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while deleting the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getCount=function(c,o,h,f){return h===void 0&&(h=!1),f===void 0&&(f=!1),e(this,void 0,void 0,function(){var l;return n(this,function(m){return l={doctype:c,filters:[]},h&&(l.cache=h),f&&(l.debug=f),o&&(l.filters=o?JSON.stringify(o):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:l}).then(function(b){return b.data.message}).catch(function(b){var E,y;throw t(t({},b.response.data),{httpStatus:b.response.status,httpStatusText:b.response.statusText,message:"There was an error while getting the count.",exception:(y=(E=b.response.data.exception)!==null&&E!==void 0?E:b.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a.prototype.getLastDoc=function(c,o){return e(this,void 0,void 0,function(){var h,f;return n(this,function(l){switch(l.label){case 0:return h={orderBy:{field:"creation",order:"desc"}},o&&(h=t(t({},h),o)),[4,this.getDocList(c,t(t({},h),{limit:1,fields:["name"]}))];case 1:return f=l.sent(),f.length>0?[2,this.getDoc(c,f[0].name)]:[2,{}]}})})},a.prototype.renameDoc=function(c,o,h,f){return f===void 0&&(f=!1),e(this,void 0,void 0,function(){return n(this,function(l){return[2,this.axios.post("/api/method/frappe.client.rename_doc",{doctype:c,old_name:o,new_name:h,merge:f}).then(function(m){return m.data}).catch(function(m){var b,E,y;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:(b=m.response.data.message)!==null&&b!==void 0?b:"There was an error while renaming the document.",exception:(y=(E=m.response.data.exception)!==null&&E!==void 0?E:m.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a.prototype.getValue=function(c,o,h,f,l,m){return f===void 0&&(f=!0),l===void 0&&(l=!1),m===void 0&&(m=null),e(this,void 0,void 0,function(){var b;return n(this,function(E){return b={doctype:c,fieldname:"[]",filters:[],as_dict:f,debug:l,parent:null},o&&(b.fieldname=typeof o=="object"?JSON.stringify(o):o),h&&(b.filters=h?JSON.stringify(h):void 0),m&&(b.parent=m),[2,this.axios.get("/api/method/frappe.client.get_value",{params:b}).then(function(y){return y.data}).catch(function(y){var _,O;throw t(t({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:"There was an error while getting the value.",exception:(O=(_=y.response.data.exception)!==null&&_!==void 0?_:y.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},a.prototype.setValue=function(c,o,h,f){return e(this,void 0,void 0,function(){return n(this,function(l){return h!==null&&typeof h=="object"&&!Array.isArray(h)&&(f=void 0),[2,this.axios.post("/api/method/frappe.client.set_value",{doctype:c,name:o,fieldname:h,value:f}).then(function(m){return m.data}).catch(function(m){var b,E;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:"There was an error while setting the value.",exception:(E=(b=m.response.data.exception)!==null&&b!==void 0?b:m.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.getSingleValue=function(c,o){return e(this,void 0,void 0,function(){var h;return n(this,function(f){return h={doctype:c,field:o},[2,this.axios.get("/api/method/frappe.client.get_single_value",{params:h}).then(function(l){return l.data}).catch(function(l){var m,b;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:"There was an error while getting the value of single doctype.",exception:(b=(m=l.response.data.exception)!==null&&m!==void 0?m:l.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},a.prototype.submit=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/frappe.client.submit",{doc:c}).then(function(h){return h.data.message}).catch(function(h){var f,l;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while submitting the document.",exception:(l=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&l!==void 0?l:""})})]})})},a.prototype.cancel=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/method/frappe.client.cancel",{doctype:c,name:o}).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while cancelling the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a}();return Ce.FrappeDB=s,Ce}var xe={},je={};/*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */var nn,os;function Hr(){if(os)return nn;os=1;function t(r,i){return function(){return r.apply(i,arguments)}}const{toString:e}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:s,toStringTag:a}=Symbol,c=(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=>c(i)===r),h=r=>i=>typeof i===r,{isArray:f}=Array,l=h("undefined");function m(r){return r!==null&&!l(r)&&r.constructor!==null&&!l(r.constructor)&&_(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const b=o("ArrayBuffer");function E(r){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(r):i=r&&r.buffer&&b(r.buffer),i}const y=h("string"),_=h("function"),O=h("number"),I=r=>r!==null&&typeof r=="object",R=r=>r===!0||r===!1,K=r=>{if(c(r)!=="object")return!1;const i=n(r);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(a in r)&&!(s in r)},G=r=>{if(!I(r)||m(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},H=o("Date"),j=o("File"),Z=o("Blob"),pe=o("FileList"),P=r=>I(r)&&_(r.pipe),le=r=>{let i;return r&&(typeof FormData=="function"&&r instanceof FormData||_(r.append)&&((i=c(r))==="formdata"||i==="object"&&_(r.toString)&&r.toString()==="[object FormData]"))},V=o("URLSearchParams"),[ae,Pe,me,W]=["ReadableStream","Request","Response","Headers"].map(o),ge=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function we(r,i,{allOwnKeys:u=!1}={}){if(r===null||typeof r>"u")return;let d,p;if(typeof r!="object"&&(r=[r]),f(r))for(d=0,p=r.length;d<p;d++)i.call(null,r[d],d,r);else{if(m(r))return;const w=u?Object.getOwnPropertyNames(r):Object.keys(r),g=w.length;let T;for(d=0;d<g;d++)T=w[d],i.call(null,r[T],T,r)}}function ee(r,i){if(m(r))return null;i=i.toLowerCase();const u=Object.keys(r);let d=u.length,p;for(;d-- >0;)if(p=u[d],i===p.toLowerCase())return p;return null}const te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:$r,Ve=r=>!l(r)&&r!==te;function Ze(){const{caseless:r,skipUndefined:i}=Ve(this)&&this||{},u={},d=(p,w)=>{const g=r&&ee(u,w)||w;K(u[g])&&K(p)?u[g]=Ze(u[g],p):K(p)?u[g]=Ze({},p):f(p)?u[g]=p.slice():(!i||!l(p))&&(u[g]=p)};for(let p=0,w=arguments.length;p<w;p++)arguments[p]&&we(arguments[p],d);return u}const Ue=(r,i,u,{allOwnKeys:d}={})=>(we(i,(p,w)=>{u&&_(p)?r[w]=t(p,u):r[w]=p},{allOwnKeys:d}),r),re=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),We=(r,i,u,d)=>{r.prototype=Object.create(i.prototype,d),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:i.prototype}),u&&Object.assign(r.prototype,u)},ze=(r,i,u,d)=>{let p,w,g;const T={};if(i=i||{},r==null)return i;do{for(p=Object.getOwnPropertyNames(r),w=p.length;w-- >0;)g=p[w],(!d||d(g,r,i))&&!T[g]&&(i[g]=r[g],T[g]=!0);r=u!==!1&&n(r)}while(r&&(!u||u(r,i))&&r!==Object.prototype);return i},et=(r,i,u)=>{r=String(r),(u===void 0||u>r.length)&&(u=r.length),u-=i.length;const d=r.indexOf(i,u);return d!==-1&&d===u},at=r=>{if(!r)return null;if(f(r))return r;let i=r.length;if(!O(i))return null;const u=new Array(i);for(;i-- >0;)u[i]=r[i];return u},It=(r=>i=>r&&i instanceof r)(typeof Uint8Array<"u"&&n(Uint8Array)),In=(r,i)=>{const d=(r&&r[s]).call(r);let p;for(;(p=d.next())&&!p.done;){const w=p.value;i.call(r,w[0],w[1])}},jn=(r,i)=>{let u;const d=[];for(;(u=r.exec(i))!==null;)d.push(u);return d},tt=o("HTMLFormElement"),jt=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(u,d,p){return d.toUpperCase()+p}),Mn=(({hasOwnProperty:r})=>(i,u)=>r.call(i,u))(Object.prototype),M=o("RegExp"),z=(r,i)=>{const u=Object.getOwnPropertyDescriptors(r),d={};we(u,(p,w)=>{let g;(g=i(p,w,r))!==!1&&(d[w]=g||p)}),Object.defineProperties(r,d)},ne=r=>{z(r,(i,u)=>{if(_(r)&&["arguments","caller","callee"].indexOf(u)!==-1)return!1;const d=r[u];if(_(d)){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={},d=p=>{p.forEach(w=>{u[w]=!0})};return f(r)?d(r):d(String(r).split(i)),u},be=()=>{},Je=(r,i)=>r!=null&&Number.isFinite(r=+r)?r:i;function ie(r){return!!(r&&_(r.append)&&r[a]==="FormData"&&r[s])}const ue=r=>{const i=new Array(10),u=(d,p)=>{if(I(d)){if(i.indexOf(d)>=0)return;if(m(d))return d;if(!("toJSON"in d)){i[p]=d;const w=f(d)?[]:{};return we(d,(g,T)=>{const k=u(g,p+1);!l(k)&&(w[T]=k)}),i[p]=void 0,w}}return d};return u(r,0)},De=o("AsyncFunction"),Mt=r=>r&&(I(r)||_(r))&&_(r.then)&&_(r.catch),_t=((r,i)=>r?setImmediate:i?((u,d)=>(te.addEventListener("message",({source:p,data:w})=>{p===te&&w===u&&d.length&&d.shift()()},!1),p=>{d.push(p),te.postMessage(u,"*")}))(`axios@${Math.random()}`,[]):u=>setTimeout(u))(typeof setImmediate=="function",_(te.postMessage)),Vt=typeof queueMicrotask<"u"?queueMicrotask.bind(te):typeof process<"u"&&process.nextTick||_t;var v={isArray:f,isArrayBuffer:b,isBuffer:m,isFormData:le,isArrayBufferView:E,isString:y,isNumber:O,isBoolean:R,isObject:I,isPlainObject:K,isEmptyObject:G,isReadableStream:ae,isRequest:Pe,isResponse:me,isHeaders:W,isUndefined:l,isDate:H,isFile:j,isBlob:Z,isRegExp:M,isFunction:_,isStream:P,isURLSearchParams:V,isTypedArray:It,isFileList:pe,forEach:we,merge:Ze,extend:Ue,trim:ge,stripBOM:re,inherits:We,toFlatObject:ze,kindOf:c,kindOfTest:o,endsWith:et,toArray:at,forEachEntry:In,matchAll:jn,isHTMLForm:tt,hasOwnProperty:Mn,hasOwnProp:Mn,reduceDescriptors:z,freezeMethods:ne,toObjectSet:$,toCamelCase:jt,noop:be,toFiniteNumber:Je,findKey:ee,global:te,isContextDefined:Ve,isSpecCompliantForm:ie,toJSONObject:ue,isAsyncFn:De,isThenable:Mt,setImmediate:_t,asap:Vt,isIterable:r=>r!=null&&_(r[s])};function N(r,i,u,d,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),d&&(this.request=d),p&&(this.response=p,this.status=p.status?p.status:null)}v.inherits(N,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:v.toJSONObject(this.config),code:this.code,status:this.status}}});const $t=N.prototype,ct={};["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=>{ct[r]={value:r}}),Object.defineProperties(N,ct),Object.defineProperty($t,"isAxiosError",{value:!0}),N.from=(r,i,u,d,p,w)=>{const g=Object.create($t);v.toFlatObject(r,g,function(C){return C!==Error.prototype},A=>A!=="isAxiosError");const T=r&&r.message?r.message:"Error",k=i==null&&r?r.code:i;return N.call(g,T,k,u,d,p),r&&g.cause==null&&Object.defineProperty(g,"cause",{value:r,configurable:!0}),g.name=r&&r.name||"Error",w&&Object.assign(g,w),g};var jo=null;function Vn(r){return v.isPlainObject(r)||v.isArray(r)}function ur(r){return v.endsWith(r,"[]")?r.slice(0,-2):r}function lr(r,i,u){return r?r.concat(i).map(function(p,w){return p=ur(p),!u&&w?"["+p+"]":p}).join(u?".":""):i}function Mo(r){return v.isArray(r)&&!r.some(Vn)}const Vo=v.toFlatObject(v,{},null,function(i){return/^is[A-Z]/.test(i)});function Ht(r,i,u){if(!v.isObject(r))throw new TypeError("target must be an object");i=i||new FormData,u=v.toFlatObject(u,{metaTokens:!0,dots:!1,indexes:!1},!1,function(F,D){return!v.isUndefined(D[F])});const d=u.metaTokens,p=u.visitor||C,w=u.dots,g=u.indexes,k=(u.Blob||typeof Blob<"u"&&Blob)&&v.isSpecCompliantForm(i);if(!v.isFunction(p))throw new TypeError("visitor must be a function");function A(x){if(x===null)return"";if(v.isDate(x))return x.toISOString();if(v.isBoolean(x))return x.toString();if(!k&&v.isBlob(x))throw new N("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(x)||v.isTypedArray(x)?k&&typeof Blob=="function"?new Blob([x]):Buffer.from(x):x}function C(x,F,D){let oe=x;if(x&&!D&&typeof x=="object"){if(v.endsWith(F,"{}"))F=d?F:F.slice(0,-2),x=JSON.stringify(x);else if(v.isArray(x)&&Mo(x)||(v.isFileList(x)||v.endsWith(F,"[]"))&&(oe=v.toArray(x)))return F=ur(F),oe.forEach(function(ce,ye){!(v.isUndefined(ce)||ce===null)&&i.append(g===!0?lr([F],ye,w):g===null?F:F+"[]",A(ce))}),!1}return Vn(x)?!0:(i.append(lr(D,F,w),A(x)),!1)}const L=[],J=Object.assign(Vo,{defaultVisitor:C,convertValue:A,isVisitable:Vn});function he(x,F){if(!v.isUndefined(x)){if(L.indexOf(x)!==-1)throw Error("Circular reference detected in "+F.join("."));L.push(x),v.forEach(x,function(oe,Ee){(!(v.isUndefined(oe)||oe===null)&&p.call(i,oe,v.isString(Ee)?Ee.trim():Ee,F,J))===!0&&he(oe,F?F.concat(Ee):[Ee])}),L.pop()}}if(!v.isObject(r))throw new TypeError("data must be an object");return he(r),i}function fr(r){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(d){return i[d]})}function $n(r,i){this._pairs=[],r&&Ht(r,this,i)}const hr=$n.prototype;hr.append=function(i,u){this._pairs.push([i,u])},hr.toString=function(i){const u=i?function(d){return i.call(this,d,fr)}:fr;return this._pairs.map(function(p){return u(p[0])+"="+u(p[1])},"").join("&")};function $o(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function dr(r,i,u){if(!i)return r;const d=u&&u.encode||$o;v.isFunction(u)&&(u={serialize:u});const p=u&&u.serialize;let w;if(p?w=p(i,u):w=v.isURLSearchParams(i)?i.toString():new $n(i,u).toString(d),w){const g=r.indexOf("#");g!==-1&&(r=r.slice(0,g)),r+=(r.indexOf("?")===-1?"?":"&")+w}return r}class Ho{constructor(){this.handlers=[]}use(i,u,d){return this.handlers.push({fulfilled:i,rejected:u,synchronous:d?d.synchronous:!1,runWhen:d?d.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){v.forEach(this.handlers,function(d){d!==null&&i(d)})}}var pr=Ho,mr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wo=typeof URLSearchParams<"u"?URLSearchParams:$n,zo=typeof FormData<"u"?FormData:null,Jo=typeof Blob<"u"?Blob:null,Ko={isBrowser:!0,classes:{URLSearchParams:Wo,FormData:zo,Blob:Jo},protocols:["http","https","file","blob","url","data"]};const Hn=typeof window<"u"&&typeof document<"u",Wn=typeof navigator=="object"&&navigator||void 0,Go=Hn&&(!Wn||["ReactNative","NativeScript","NS"].indexOf(Wn.product)<0),Xo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yo=Hn&&window.location.href||"http://localhost";var Qo=Object.freeze({__proto__:null,hasBrowserEnv:Hn,hasStandardBrowserWebWorkerEnv:Xo,hasStandardBrowserEnv:Go,navigator:Wn,origin:Yo}),fe={...Qo,...Ko};function Zo(r,i){return Ht(r,new fe.classes.URLSearchParams,{visitor:function(u,d,p,w){return fe.isNode&&v.isBuffer(u)?(this.append(d,u.toString("base64")),!1):w.defaultVisitor.apply(this,arguments)},...i})}function ea(r){return v.matchAll(/\w+|\[(\w*)]/g,r).map(i=>i[0]==="[]"?"":i[1]||i[0])}function ta(r){const i={},u=Object.keys(r);let d;const p=u.length;let w;for(d=0;d<p;d++)w=u[d],i[w]=r[w];return i}function yr(r){function i(u,d,p,w){let g=u[w++];if(g==="__proto__")return!0;const T=Number.isFinite(+g),k=w>=u.length;return g=!g&&v.isArray(p)?p.length:g,k?(v.hasOwnProp(p,g)?p[g]=[p[g],d]:p[g]=d,!T):((!p[g]||!v.isObject(p[g]))&&(p[g]=[]),i(u,d,p[g],w)&&v.isArray(p[g])&&(p[g]=ta(p[g])),!T)}if(v.isFormData(r)&&v.isFunction(r.entries)){const u={};return v.forEachEntry(r,(d,p)=>{i(ea(d),p,u,0)}),u}return null}function na(r,i,u){if(v.isString(r))try{return(i||JSON.parse)(r),v.trim(r)}catch(d){if(d.name!=="SyntaxError")throw d}return(u||JSON.stringify)(r)}const zn={transitional:mr,adapter:["xhr","http","fetch"],transformRequest:[function(i,u){const d=u.getContentType()||"",p=d.indexOf("application/json")>-1,w=v.isObject(i);if(w&&v.isHTMLForm(i)&&(i=new FormData(i)),v.isFormData(i))return p?JSON.stringify(yr(i)):i;if(v.isArrayBuffer(i)||v.isBuffer(i)||v.isStream(i)||v.isFile(i)||v.isBlob(i)||v.isReadableStream(i))return i;if(v.isArrayBufferView(i))return i.buffer;if(v.isURLSearchParams(i))return u.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let T;if(w){if(d.indexOf("application/x-www-form-urlencoded")>-1)return Zo(i,this.formSerializer).toString();if((T=v.isFileList(i))||d.indexOf("multipart/form-data")>-1){const k=this.env&&this.env.FormData;return Ht(T?{"files[]":i}:i,k&&new k,this.formSerializer)}}return w||p?(u.setContentType("application/json",!1),na(i)):i}],transformResponse:[function(i){const u=this.transitional||zn.transitional,d=u&&u.forcedJSONParsing,p=this.responseType==="json";if(v.isResponse(i)||v.isReadableStream(i))return i;if(i&&v.isString(i)&&(d&&!this.responseType||p)){const g=!(u&&u.silentJSONParsing)&&p;try{return JSON.parse(i,this.parseReviver)}catch(T){if(g)throw T.name==="SyntaxError"?N.from(T,N.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:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],r=>{zn.headers[r]={}});var Jn=zn;const sa=v.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 ra=r=>{const i={};let u,d,p;return r&&r.split(`
|
|
2
|
-
`).forEach(function(g){p=g.indexOf(":"),u=g.substring(0,p).trim().toLowerCase(),d=g.substring(p+1).trim(),!(!u||i[u]&&sa[u])&&(u==="set-cookie"?i[u]?i[u].push(d):i[u]=[d]:i[u]=i[u]?i[u]+", "+d:d)}),i};const gr=Symbol("internals");function St(r){return r&&String(r).trim().toLowerCase()}function Wt(r){return r===!1||r==null?r:
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...u){const d=new this(i);return u.forEach(p=>d.set(p)),d}static accessor(i){const d=(this[gr]=this[gr]={accessors:{}}).accessors,p=this.prototype;function w(g){const T=St(g);d[T]||(ca(p,g),d[T]=!0)}return v.isArray(i)?i.forEach(w):w(i),this}}zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),v.reduceDescriptors(zt.prototype,({value:r},i)=>{let u=i[0].toUpperCase()+i.slice(1);return{get:()=>r,set(d){this[u]=d}}}),v.freezeMethods(zt);var Le=zt;function Gn(r,i){const u=this||Jn,d=i||u,p=Le.from(d.headers);let w=d.data;return v.forEach(r,function(T){w=T.call(u,w,p.normalize(),i?i.status:void 0)}),p.normalize(),w}function wr(r){return!!(r&&r.__CANCEL__)}function ut(r,i,u){N.call(this,r??"canceled",N.ERR_CANCELED,i,u),this.name="CanceledError"}v.inherits(ut,N,{__CANCEL__:!0});function br(r,i,u){const d=u.config.validateStatus;!u.status||!d||d(u.status)?r(u):i(new N("Request failed with status code "+u.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(u.status/100)-4],u.config,u.request,u))}function ua(r){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return i&&i[1]||""}function la(r,i){r=r||10;const u=new Array(r),d=new Array(r);let p=0,w=0,g;return i=i!==void 0?i:1e3,function(k){const A=Date.now(),C=d[w];g||(g=A),u[p]=k,d[p]=A;let L=w,J=0;for(;L!==p;)J+=u[L++],L=L%r;if(p=(p+1)%r,p===w&&(w=(w+1)%r),A-g<i)return;const he=C&&A-C;return he?Math.round(J*1e3/he):void 0}}function fa(r,i){let u=0,d=1e3/i,p,w;const g=(A,C=Date.now())=>{u=C,p=null,w&&(clearTimeout(w),w=null),r(...A)};return[(...A)=>{const C=Date.now(),L=C-u;L>=d?g(A,C):(p=A,w||(w=setTimeout(()=>{w=null,g(p)},d-L)))},()=>p&&g(p)]}const Jt=(r,i,u=3)=>{let d=0;const p=la(50,250);return fa(w=>{const g=w.loaded,T=w.lengthComputable?w.total:void 0,k=g-d,A=p(k),C=g<=T;d=g;const L={loaded:g,total:T,progress:T?g/T:void 0,bytes:k,rate:A||void 0,estimated:A&&T&&C?(T-g)/A:void 0,event:w,lengthComputable:T!=null,[i?"download":"upload"]:!0};r(L)},u)},vr=(r,i)=>{const u=r!=null;return[d=>i[0]({lengthComputable:u,total:r,loaded:d}),i[1]]},_r=r=>(...i)=>v.asap(()=>r(...i));var ha=fe.hasStandardBrowserEnv?((r,i)=>u=>(u=new URL(u,fe.origin),r.protocol===u.protocol&&r.host===u.host&&(i||r.port===u.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,da=fe.hasStandardBrowserEnv?{write(r,i,u,d,p,w){const g=[r+"="+encodeURIComponent(i)];v.isNumber(u)&&g.push("expires="+new Date(u).toGMTString()),v.isString(d)&&g.push("path="+d),v.isString(p)&&g.push("domain="+p),w===!0&&g.push("secure"),document.cookie=g.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 pa(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function ma(r,i){return i?r.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):r}function Sr(r,i,u){let d=!pa(i);return r&&(d||u==!1)?ma(r,i):i}const Er=r=>r instanceof Le?{...r}:r;function nt(r,i){i=i||{};const u={};function d(A,C,L,J){return v.isPlainObject(A)&&v.isPlainObject(C)?v.merge.call({caseless:J},A,C):v.isPlainObject(C)?v.merge({},C):v.isArray(C)?C.slice():C}function p(A,C,L,J){if(v.isUndefined(C)){if(!v.isUndefined(A))return d(void 0,A,L,J)}else return d(A,C,L,J)}function w(A,C){if(!v.isUndefined(C))return d(void 0,C)}function g(A,C){if(v.isUndefined(C)){if(!v.isUndefined(A))return d(void 0,A)}else return d(void 0,C)}function T(A,C,L){if(L in i)return d(A,C);if(L in r)return d(void 0,A)}const k={url:w,method:w,data:w,baseURL:g,transformRequest:g,transformResponse:g,paramsSerializer:g,timeout:g,timeoutMessage:g,withCredentials:g,withXSRFToken:g,adapter:g,responseType:g,xsrfCookieName:g,xsrfHeaderName:g,onUploadProgress:g,onDownloadProgress:g,decompress:g,maxContentLength:g,maxBodyLength:g,beforeRedirect:g,transport:g,httpAgent:g,httpsAgent:g,cancelToken:g,socketPath:g,responseEncoding:g,validateStatus:T,headers:(A,C,L)=>p(Er(A),Er(C),L,!0)};return v.forEach(Object.keys({...r,...i}),function(C){const L=k[C]||p,J=L(r[C],i[C],C);v.isUndefined(J)&&L!==T||(u[C]=J)}),u}var Tr=r=>{const i=nt({},r);let{data:u,withXSRFToken:d,xsrfHeaderName:p,xsrfCookieName:w,headers:g,auth:T}=i;if(i.headers=g=Le.from(g),i.url=dr(Sr(i.baseURL,i.url,i.allowAbsoluteUrls),r.params,r.paramsSerializer),T&&g.set("Authorization","Basic "+btoa((T.username||"")+":"+(T.password?unescape(encodeURIComponent(T.password)):""))),v.isFormData(u)){if(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv)g.setContentType(void 0);else if(v.isFunction(u.getHeaders)){const k=u.getHeaders(),A=["content-type","content-length"];Object.entries(k).forEach(([C,L])=>{A.includes(C.toLowerCase())&&g.set(C,L)})}}if(fe.hasStandardBrowserEnv&&(d&&v.isFunction(d)&&(d=d(i)),d||d!==!1&&ha(i.url))){const k=p&&w&&da.read(w);k&&g.set(p,k)}return i},ya=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(u,d){const p=Tr(r);let w=p.data;const g=Le.from(p.headers).normalize();let{responseType:T,onUploadProgress:k,onDownloadProgress:A}=p,C,L,J,he,x;function F(){he&&he(),x&&x(),p.cancelToken&&p.cancelToken.unsubscribe(C),p.signal&&p.signal.removeEventListener("abort",C)}let D=new XMLHttpRequest;D.open(p.method.toUpperCase(),p.url,!0),D.timeout=p.timeout;function oe(){if(!D)return;const ce=Le.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),Fe={data:!T||T==="text"||T==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:ce,config:r,request:D};br(function(Te){u(Te),F()},function(Te){d(Te),F()},Fe),D=null}"onloadend"in D?D.onloadend=oe:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(oe)},D.onabort=function(){D&&(d(new N("Request aborted",N.ECONNABORTED,r,D)),D=null)},D.onerror=function(ye){const Fe=ye&&ye.message?ye.message:"Network Error",st=new N(Fe,N.ERR_NETWORK,r,D);st.event=ye||null,d(st),D=null},D.ontimeout=function(){let ye=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded";const Fe=p.transitional||mr;p.timeoutErrorMessage&&(ye=p.timeoutErrorMessage),d(new N(ye,Fe.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,r,D)),D=null},w===void 0&&g.setContentType(null),"setRequestHeader"in D&&v.forEach(g.toJSON(),function(ye,Fe){D.setRequestHeader(Fe,ye)}),v.isUndefined(p.withCredentials)||(D.withCredentials=!!p.withCredentials),T&&T!=="json"&&(D.responseType=p.responseType),A&&([J,x]=Jt(A,!0),D.addEventListener("progress",J)),k&&D.upload&&([L,he]=Jt(k),D.upload.addEventListener("progress",L),D.upload.addEventListener("loadend",he)),(p.cancelToken||p.signal)&&(C=ce=>{D&&(d(!ce||ce.type?new ut(null,r,D):ce),D.abort(),D=null)},p.cancelToken&&p.cancelToken.subscribe(C),p.signal&&(p.signal.aborted?C():p.signal.addEventListener("abort",C)));const Ee=ua(p.url);if(Ee&&fe.protocols.indexOf(Ee)===-1){d(new N("Unsupported protocol "+Ee+":",N.ERR_BAD_REQUEST,r));return}D.send(w||null)})},ga=(r,i)=>{const{length:u}=r=r?r.filter(Boolean):[];if(i||u){let d=new AbortController,p;const w=function(A){if(!p){p=!0,T();const C=A instanceof Error?A:this.reason;d.abort(C instanceof N?C:new ut(C instanceof Error?C.message:C))}};let g=i&&setTimeout(()=>{g=null,w(new N(`timeout ${i} of ms exceeded`,N.ETIMEDOUT))},i);const T=()=>{r&&(g&&clearTimeout(g),g=null,r.forEach(A=>{A.unsubscribe?A.unsubscribe(w):A.removeEventListener("abort",w)}),r=null)};r.forEach(A=>A.addEventListener("abort",w));const{signal:k}=d;return k.unsubscribe=()=>v.asap(T),k}};const wa=function*(r,i){let u=r.byteLength;if(u<i){yield r;return}let d=0,p;for(;d<u;)p=d+i,yield r.slice(d,p),d=p},ba=async function*(r,i){for await(const u of va(r))yield*wa(u,i)},va=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const i=r.getReader();try{for(;;){const{done:u,value:d}=await i.read();if(u)break;yield d}}finally{await i.cancel()}},Or=(r,i,u,d)=>{const p=ba(r,i);let w=0,g,T=k=>{g||(g=!0,d&&d(k))};return new ReadableStream({async pull(k){try{const{done:A,value:C}=await p.next();if(A){T(),k.close();return}let L=C.byteLength;if(u){let J=w+=L;u(J)}k.enqueue(new Uint8Array(C))}catch(A){throw T(A),A}},cancel(k){return T(k),p.return()}},{highWaterMark:2})},Cr=64*1024,{isFunction:Kt}=v,_a=(({Request:r,Response:i})=>({Request:r,Response:i}))(v.global),{ReadableStream:xr,TextEncoder:Ar}=v.global,Rr=(r,...i)=>{try{return!!r(...i)}catch{return!1}},Sa=r=>{r=v.merge.call({skipUndefined:!0},_a,r);const{fetch:i,Request:u,Response:d}=r,p=i?Kt(i):typeof fetch=="function",w=Kt(u),g=Kt(d);if(!p)return!1;const T=p&&Kt(xr),k=p&&(typeof Ar=="function"?(x=>F=>x.encode(F))(new Ar):async x=>new Uint8Array(await new u(x).arrayBuffer())),A=w&&T&&Rr(()=>{let x=!1;const F=new u(fe.origin,{body:new xr,method:"POST",get duplex(){return x=!0,"half"}}).headers.has("Content-Type");return x&&!F}),C=g&&T&&Rr(()=>v.isReadableStream(new d("").body)),L={stream:C&&(x=>x.body)};p&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!L[x]&&(L[x]=(F,D)=>{let oe=F&&F[x];if(oe)return oe.call(F);throw new N(`Response type '${x}' is not supported`,N.ERR_NOT_SUPPORT,D)})});const J=async x=>{if(x==null)return 0;if(v.isBlob(x))return x.size;if(v.isSpecCompliantForm(x))return(await new u(fe.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(v.isArrayBufferView(x)||v.isArrayBuffer(x))return x.byteLength;if(v.isURLSearchParams(x)&&(x=x+""),v.isString(x))return(await k(x)).byteLength},he=async(x,F)=>{const D=v.toFiniteNumber(x.getContentLength());return D??J(F)};return async x=>{let{url:F,method:D,data:oe,signal:Ee,cancelToken:ce,timeout:ye,onDownloadProgress:Fe,onUploadProgress:st,responseType:Te,headers:es,withCredentials:Zt="same-origin",fetchOptions:Ur}=Tr(x),qr=i||fetch;Te=Te?(Te+"").toLowerCase():"text";let en=ga([Ee,ce&&ce.toAbortSignal()],ye),Et=null;const rt=en&&en.unsubscribe&&(()=>{en.unsubscribe()});let Ir;try{if(st&&A&&D!=="get"&&D!=="head"&&(Ir=await he(es,oe))!==0){let Ge=new u(F,{method:"POST",body:oe,duplex:"half"}),lt;if(v.isFormData(oe)&&(lt=Ge.headers.get("content-type"))&&es.setContentType(lt),Ge.body){const[ts,tn]=vr(Ir,Jt(_r(st)));oe=Or(Ge.body,Cr,ts,tn)}}v.isString(Zt)||(Zt=Zt?"include":"omit");const Ie=w&&"credentials"in u.prototype,jr={...Ur,signal:en,method:D.toUpperCase(),headers:es.normalize().toJSON(),body:oe,duplex:"half",credentials:Ie?Zt:void 0};Et=w&&new u(F,jr);let Ke=await(w?qr(Et,Ur):qr(F,jr));const Mr=C&&(Te==="stream"||Te==="response");if(C&&(Fe||Mr&&rt)){const Ge={};["status","statusText","headers"].forEach(Vr=>{Ge[Vr]=Ke[Vr]});const lt=v.toFiniteNumber(Ke.headers.get("content-length")),[ts,tn]=Fe&&vr(lt,Jt(_r(Fe),!0))||[];Ke=new d(Or(Ke.body,Cr,ts,()=>{tn&&tn(),rt&&rt()}),Ge)}Te=Te||"text";let ka=await L[v.findKey(L,Te)||"text"](Ke,x);return!Mr&&rt&&rt(),await new Promise((Ge,lt)=>{br(Ge,lt,{data:ka,headers:Le.from(Ke.headers),status:Ke.status,statusText:Ke.statusText,config:x,request:Et})})}catch(Ie){throw rt&&rt(),Ie&&Ie.name==="TypeError"&&/Load failed|fetch/i.test(Ie.message)?Object.assign(new N("Network Error",N.ERR_NETWORK,x,Et),{cause:Ie.cause||Ie}):N.from(Ie,Ie&&Ie.code,x,Et)}}},Ea=new Map,kr=r=>{let i=r?r.env:{};const{fetch:u,Request:d,Response:p}=i,w=[d,p,u];let g=w.length,T=g,k,A,C=Ea;for(;T--;)k=w[T],A=C.get(k),A===void 0&&C.set(k,A=T?new Map:Sa(i)),C=A;return A};kr();const Xn={http:jo,xhr:ya,fetch:{get:kr}};v.forEach(Xn,(r,i)=>{if(r){try{Object.defineProperty(r,"name",{value:i})}catch{}Object.defineProperty(r,"adapterName",{value:i})}});const Dr=r=>`- ${r}`,Ta=r=>v.isFunction(r)||r===null||r===!1;var Lr={getAdapter:(r,i)=>{r=v.isArray(r)?r:[r];const{length:u}=r;let d,p;const w={};for(let g=0;g<u;g++){d=r[g];let T;if(p=d,!Ta(d)&&(p=Xn[(T=String(d)).toLowerCase()],p===void 0))throw new N(`Unknown adapter '${T}'`);if(p&&(v.isFunction(p)||(p=p.get(i))))break;w[T||"#"+g]=p}if(!p){const g=Object.entries(w).map(([k,A])=>`adapter ${k} `+(A===!1?"is not supported by the environment":"is not available in the build"));let T=u?g.length>1?`since :
|
|
1
|
+
(function(B,de){typeof exports=="object"&&typeof module<"u"?de(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],de):(B=typeof globalThis<"u"?globalThis:B||self,de(B["Frappe React"]={},B.jsxRuntime,B.React))})(this,function(B,de,S){"use strict";var Da=Object.defineProperty;var La=(B,de,S)=>de in B?Da(B,de,{enumerable:!0,configurable:!0,writable:!0,value:S}):B[de]=S;var Xe=(B,de,S)=>La(B,typeof de!="symbol"?de+"":de,S);var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ye={},ht={},Oe={},ns;function ss(){if(ns)return Oe;ns=1;var t=Oe&&Oe.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Oe&&Oe.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(v){try{y(h.next(v))}catch(O){m(O)}}function E(v){try{y(h.throw(v))}catch(O){m(O)}}function y(v){v.done?l(v.value):f(v.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Oe&&Oe.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(v){return E([y,v])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(v){y=[6,v],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.FrappeCall=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.get=function(c,o){return e(this,void 0,void 0,function(){var h;return n(this,function(f){return h=new URLSearchParams,o&&Object.entries(o).forEach(function(l){var m=l[0],b=l[1];if(b!=null){var E=typeof b=="object"?JSON.stringify(b):b;h.set(m,E)}}),[2,this.axios.get("/api/method/".concat(c),{params:h}).then(function(l){return l.data}).catch(function(l){var m,b;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:(m=l.response.data.message)!==null&&m!==void 0?m:"There was an error.",exception:(b=l.response.data.exception)!==null&&b!==void 0?b:""})})]})})},a.prototype.post=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/method/".concat(c),t({},o)).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a.prototype.put=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.put("/api/method/".concat(c),t({},o)).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a.prototype.delete=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.delete("/api/method/".concat(c),{params:o}).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a}();return Oe.FrappeCall=s,Oe}var Ce={},rs;function is(){if(rs)return Ce;rs=1;var t=Ce&&Ce.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Ce&&Ce.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(v){try{y(h.next(v))}catch(O){m(O)}}function E(v){try{y(h.throw(v))}catch(O){m(O)}}function y(v){v.done?l(v.value):f(v.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Ce&&Ce.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(v){return E([y,v])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(v){y=[6,v],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.FrappeDB=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.getDoc=function(c,o){return o===void 0&&(o=""),e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.get("/api/resource/".concat(c,"/").concat(encodeURIComponent(o))).then(function(f){return f.data.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while fetching the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getDocList=function(c,o){var h;return e(this,void 0,void 0,function(){var f,l,m,b,E,y,v,O,I,R,K;return n(this,function(G){return f={},o&&(l=o.fields,m=o.filters,b=o.orFilters,E=o.orderBy,y=o.limit,v=o.limit_start,O=o.groupBy,I=o.asDict,R=I===void 0?!0:I,K=E?"".concat(String(E==null?void 0:E.field)," ").concat((h=E==null?void 0:E.order)!==null&&h!==void 0?h:"asc"):"",f={fields:l?JSON.stringify(l):void 0,filters:m?JSON.stringify(m):void 0,or_filters:b?JSON.stringify(b):void 0,order_by:K,group_by:O,limit:y,limit_start:v,as_dict:R}),[2,this.axios.get("/api/resource/".concat(c),{params:f}).then(function(H){return H.data.data}).catch(function(H){var j,Z;throw t(t({},H.response.data),{httpStatus:H.response.status,httpStatusText:H.response.statusText,message:"There was an error while fetching the documents.",exception:(Z=(j=H.response.data.exception)!==null&&j!==void 0?j:H.response.data.exc_type)!==null&&Z!==void 0?Z:""})})]})})},a.prototype.createDoc=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/resource/".concat(c),t({},o)).then(function(f){return f.data.data}).catch(function(f){var l,m,b;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error while creating the document.",exception:(b=(m=f.response.data.exception)!==null&&m!==void 0?m:f.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},a.prototype.updateDoc=function(c,o,h){return e(this,void 0,void 0,function(){return n(this,function(f){return[2,this.axios.put("/api/resource/".concat(c,"/").concat(o&&encodeURIComponent(o)),t({},h)).then(function(l){return l.data.data}).catch(function(l){var m,b,E;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:(m=l.response.data.message)!==null&&m!==void 0?m:"There was an error while updating the document.",exception:(E=(b=l.response.data.exception)!==null&&b!==void 0?b:l.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.deleteDoc=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.delete("/api/resource/".concat(c,"/").concat(o&&encodeURIComponent(o))).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while deleting the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getCount=function(c,o,h){return h===void 0&&(h=!1),e(this,void 0,void 0,function(){var f;return n(this,function(l){return f={doctype:c,filters:[]},h&&(f.debug=h),o&&(f.filters=o?JSON.stringify(o):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:f}).then(function(m){return m.data.message}).catch(function(m){var b,E;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:"There was an error while getting the count.",exception:(E=(b=m.response.data.exception)!==null&&b!==void 0?b:m.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.getLastDoc=function(c,o){return e(this,void 0,void 0,function(){var h,f;return n(this,function(l){switch(l.label){case 0:return h={orderBy:{field:"creation",order:"desc"}},o&&(h=t(t({},h),o)),[4,this.getDocList(c,t(t({},h),{limit:1,fields:["name"]}))];case 1:return f=l.sent(),f.length>0?[2,this.getDoc(c,f[0].name)]:[2,{}]}})})},a.prototype.renameDoc=function(c,o,h,f){return f===void 0&&(f=!1),e(this,void 0,void 0,function(){return n(this,function(l){return[2,this.axios.post("/api/method/frappe.client.rename_doc",{doctype:c,old_name:o,new_name:h,merge:f}).then(function(m){return m.data}).catch(function(m){var b,E,y;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:(b=m.response.data.message)!==null&&b!==void 0?b:"There was an error while renaming the document.",exception:(y=(E=m.response.data.exception)!==null&&E!==void 0?E:m.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a.prototype.getValue=function(c,o,h,f,l,m){return f===void 0&&(f=!0),l===void 0&&(l=!1),m===void 0&&(m=null),e(this,void 0,void 0,function(){var b;return n(this,function(E){return b={doctype:c,fieldname:"[]",filters:[],as_dict:f,debug:l,parent:null},o&&(b.fieldname=typeof o=="object"?JSON.stringify(o):o),h&&(b.filters=h?JSON.stringify(h):void 0),m&&(b.parent=m),[2,this.axios.get("/api/method/frappe.client.get_value",{params:b}).then(function(y){return y.data}).catch(function(y){var v,O;throw t(t({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:"There was an error while getting the value.",exception:(O=(v=y.response.data.exception)!==null&&v!==void 0?v:y.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},a.prototype.setValue=function(c,o,h,f){return e(this,void 0,void 0,function(){return n(this,function(l){return h!==null&&typeof h=="object"&&!Array.isArray(h)&&(f=void 0),[2,this.axios.post("/api/method/frappe.client.set_value",{doctype:c,name:o,fieldname:h,value:f}).then(function(m){return m.data}).catch(function(m){var b,E;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:"There was an error while setting the value.",exception:(E=(b=m.response.data.exception)!==null&&b!==void 0?b:m.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.getSingleValue=function(c,o){return e(this,void 0,void 0,function(){var h;return n(this,function(f){return h={doctype:c,field:o},[2,this.axios.get("/api/method/frappe.client.get_single_value",{params:h}).then(function(l){return l.data}).catch(function(l){var m,b;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:"There was an error while getting the value of single doctype.",exception:(b=(m=l.response.data.exception)!==null&&m!==void 0?m:l.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},a.prototype.submit=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/frappe.client.submit",{doc:c}).then(function(h){return h.data.message}).catch(function(h){var f,l;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while submitting the document.",exception:(l=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&l!==void 0?l:""})})]})})},a.prototype.cancel=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/method/frappe.client.cancel",{doctype:c,name:o}).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while cancelling the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a}();return Ce.FrappeDB=s,Ce}var xe={},je={};/*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */var nn,os;function Hr(){if(os)return nn;os=1;function t(r,i){return function(){return r.apply(i,arguments)}}const{toString:e}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:s,toStringTag:a}=Symbol,c=(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=>c(i)===r),h=r=>i=>typeof i===r,{isArray:f}=Array,l=h("undefined");function m(r){return r!==null&&!l(r)&&r.constructor!==null&&!l(r.constructor)&&v(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const b=o("ArrayBuffer");function E(r){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(r):i=r&&r.buffer&&b(r.buffer),i}const y=h("string"),v=h("function"),O=h("number"),I=r=>r!==null&&typeof r=="object",R=r=>r===!0||r===!1,K=r=>{if(c(r)!=="object")return!1;const i=n(r);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(a in r)&&!(s in r)},G=r=>{if(!I(r)||m(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},H=o("Date"),j=o("File"),Z=o("Blob"),pe=o("FileList"),P=r=>I(r)&&v(r.pipe),le=r=>{let i;return r&&(typeof FormData=="function"&&r instanceof FormData||v(r.append)&&((i=c(r))==="formdata"||i==="object"&&v(r.toString)&&r.toString()==="[object FormData]"))},V=o("URLSearchParams"),[ae,Pe,me,W]=["ReadableStream","Request","Response","Headers"].map(o),ge=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function we(r,i,{allOwnKeys:u=!1}={}){if(r===null||typeof r>"u")return;let d,p;if(typeof r!="object"&&(r=[r]),f(r))for(d=0,p=r.length;d<p;d++)i.call(null,r[d],d,r);else{if(m(r))return;const w=u?Object.getOwnPropertyNames(r):Object.keys(r),g=w.length;let T;for(d=0;d<g;d++)T=w[d],i.call(null,r[T],T,r)}}function ee(r,i){if(m(r))return null;i=i.toLowerCase();const u=Object.keys(r);let d=u.length,p;for(;d-- >0;)if(p=u[d],i===p.toLowerCase())return p;return null}const te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:$r,Ve=r=>!l(r)&&r!==te;function Ze(){const{caseless:r,skipUndefined:i}=Ve(this)&&this||{},u={},d=(p,w)=>{const g=r&&ee(u,w)||w;K(u[g])&&K(p)?u[g]=Ze(u[g],p):K(p)?u[g]=Ze({},p):f(p)?u[g]=p.slice():(!i||!l(p))&&(u[g]=p)};for(let p=0,w=arguments.length;p<w;p++)arguments[p]&&we(arguments[p],d);return u}const Ue=(r,i,u,{allOwnKeys:d}={})=>(we(i,(p,w)=>{u&&v(p)?r[w]=t(p,u):r[w]=p},{allOwnKeys:d}),r),re=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),We=(r,i,u,d)=>{r.prototype=Object.create(i.prototype,d),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:i.prototype}),u&&Object.assign(r.prototype,u)},ze=(r,i,u,d)=>{let p,w,g;const T={};if(i=i||{},r==null)return i;do{for(p=Object.getOwnPropertyNames(r),w=p.length;w-- >0;)g=p[w],(!d||d(g,r,i))&&!T[g]&&(i[g]=r[g],T[g]=!0);r=u!==!1&&n(r)}while(r&&(!u||u(r,i))&&r!==Object.prototype);return i},et=(r,i,u)=>{r=String(r),(u===void 0||u>r.length)&&(u=r.length),u-=i.length;const d=r.indexOf(i,u);return d!==-1&&d===u},at=r=>{if(!r)return null;if(f(r))return r;let i=r.length;if(!O(i))return null;const u=new Array(i);for(;i-- >0;)u[i]=r[i];return u},It=(r=>i=>r&&i instanceof r)(typeof Uint8Array<"u"&&n(Uint8Array)),In=(r,i)=>{const d=(r&&r[s]).call(r);let p;for(;(p=d.next())&&!p.done;){const w=p.value;i.call(r,w[0],w[1])}},jn=(r,i)=>{let u;const d=[];for(;(u=r.exec(i))!==null;)d.push(u);return d},tt=o("HTMLFormElement"),jt=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(u,d,p){return d.toUpperCase()+p}),Mn=(({hasOwnProperty:r})=>(i,u)=>r.call(i,u))(Object.prototype),M=o("RegExp"),z=(r,i)=>{const u=Object.getOwnPropertyDescriptors(r),d={};we(u,(p,w)=>{let g;(g=i(p,w,r))!==!1&&(d[w]=g||p)}),Object.defineProperties(r,d)},ne=r=>{z(r,(i,u)=>{if(v(r)&&["arguments","caller","callee"].indexOf(u)!==-1)return!1;const d=r[u];if(v(d)){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={},d=p=>{p.forEach(w=>{u[w]=!0})};return f(r)?d(r):d(String(r).split(i)),u},be=()=>{},Je=(r,i)=>r!=null&&Number.isFinite(r=+r)?r:i;function ie(r){return!!(r&&v(r.append)&&r[a]==="FormData"&&r[s])}const ue=r=>{const i=new Array(10),u=(d,p)=>{if(I(d)){if(i.indexOf(d)>=0)return;if(m(d))return d;if(!("toJSON"in d)){i[p]=d;const w=f(d)?[]:{};return we(d,(g,T)=>{const k=u(g,p+1);!l(k)&&(w[T]=k)}),i[p]=void 0,w}}return d};return u(r,0)},De=o("AsyncFunction"),Mt=r=>r&&(I(r)||v(r))&&v(r.then)&&v(r.catch),vt=((r,i)=>r?setImmediate:i?((u,d)=>(te.addEventListener("message",({source:p,data:w})=>{p===te&&w===u&&d.length&&d.shift()()},!1),p=>{d.push(p),te.postMessage(u,"*")}))(`axios@${Math.random()}`,[]):u=>setTimeout(u))(typeof setImmediate=="function",v(te.postMessage)),Vt=typeof queueMicrotask<"u"?queueMicrotask.bind(te):typeof process<"u"&&process.nextTick||vt;var _={isArray:f,isArrayBuffer:b,isBuffer:m,isFormData:le,isArrayBufferView:E,isString:y,isNumber:O,isBoolean:R,isObject:I,isPlainObject:K,isEmptyObject:G,isReadableStream:ae,isRequest:Pe,isResponse:me,isHeaders:W,isUndefined:l,isDate:H,isFile:j,isBlob:Z,isRegExp:M,isFunction:v,isStream:P,isURLSearchParams:V,isTypedArray:It,isFileList:pe,forEach:we,merge:Ze,extend:Ue,trim:ge,stripBOM:re,inherits:We,toFlatObject:ze,kindOf:c,kindOfTest:o,endsWith:et,toArray:at,forEachEntry:In,matchAll:jn,isHTMLForm:tt,hasOwnProperty:Mn,hasOwnProp:Mn,reduceDescriptors:z,freezeMethods:ne,toObjectSet:$,toCamelCase:jt,noop:be,toFiniteNumber:Je,findKey:ee,global:te,isContextDefined:Ve,isSpecCompliantForm:ie,toJSONObject:ue,isAsyncFn:De,isThenable:Mt,setImmediate:vt,asap:Vt,isIterable:r=>r!=null&&v(r[s])};function N(r,i,u,d,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),d&&(this.request=d),p&&(this.response=p,this.status=p.status?p.status:null)}_.inherits(N,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 $t=N.prototype,ct={};["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=>{ct[r]={value:r}}),Object.defineProperties(N,ct),Object.defineProperty($t,"isAxiosError",{value:!0}),N.from=(r,i,u,d,p,w)=>{const g=Object.create($t);_.toFlatObject(r,g,function(C){return C!==Error.prototype},A=>A!=="isAxiosError");const T=r&&r.message?r.message:"Error",k=i==null&&r?r.code:i;return N.call(g,T,k,u,d,p),r&&g.cause==null&&Object.defineProperty(g,"cause",{value:r,configurable:!0}),g.name=r&&r.name||"Error",w&&Object.assign(g,w),g};var jo=null;function Vn(r){return _.isPlainObject(r)||_.isArray(r)}function ur(r){return _.endsWith(r,"[]")?r.slice(0,-2):r}function lr(r,i,u){return r?r.concat(i).map(function(p,w){return p=ur(p),!u&&w?"["+p+"]":p}).join(u?".":""):i}function Mo(r){return _.isArray(r)&&!r.some(Vn)}const Vo=_.toFlatObject(_,{},null,function(i){return/^is[A-Z]/.test(i)});function Ht(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(F,D){return!_.isUndefined(D[F])});const d=u.metaTokens,p=u.visitor||C,w=u.dots,g=u.indexes,k=(u.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(i);if(!_.isFunction(p))throw new TypeError("visitor must be a function");function A(x){if(x===null)return"";if(_.isDate(x))return x.toISOString();if(_.isBoolean(x))return x.toString();if(!k&&_.isBlob(x))throw new N("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(x)||_.isTypedArray(x)?k&&typeof Blob=="function"?new Blob([x]):Buffer.from(x):x}function C(x,F,D){let oe=x;if(x&&!D&&typeof x=="object"){if(_.endsWith(F,"{}"))F=d?F:F.slice(0,-2),x=JSON.stringify(x);else if(_.isArray(x)&&Mo(x)||(_.isFileList(x)||_.endsWith(F,"[]"))&&(oe=_.toArray(x)))return F=ur(F),oe.forEach(function(ce,ye){!(_.isUndefined(ce)||ce===null)&&i.append(g===!0?lr([F],ye,w):g===null?F:F+"[]",A(ce))}),!1}return Vn(x)?!0:(i.append(lr(D,F,w),A(x)),!1)}const L=[],J=Object.assign(Vo,{defaultVisitor:C,convertValue:A,isVisitable:Vn});function he(x,F){if(!_.isUndefined(x)){if(L.indexOf(x)!==-1)throw Error("Circular reference detected in "+F.join("."));L.push(x),_.forEach(x,function(oe,Ee){(!(_.isUndefined(oe)||oe===null)&&p.call(i,oe,_.isString(Ee)?Ee.trim():Ee,F,J))===!0&&he(oe,F?F.concat(Ee):[Ee])}),L.pop()}}if(!_.isObject(r))throw new TypeError("data must be an object");return he(r),i}function fr(r){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(d){return i[d]})}function $n(r,i){this._pairs=[],r&&Ht(r,this,i)}const hr=$n.prototype;hr.append=function(i,u){this._pairs.push([i,u])},hr.toString=function(i){const u=i?function(d){return i.call(this,d,fr)}:fr;return this._pairs.map(function(p){return u(p[0])+"="+u(p[1])},"").join("&")};function $o(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function dr(r,i,u){if(!i)return r;const d=u&&u.encode||$o;_.isFunction(u)&&(u={serialize:u});const p=u&&u.serialize;let w;if(p?w=p(i,u):w=_.isURLSearchParams(i)?i.toString():new $n(i,u).toString(d),w){const g=r.indexOf("#");g!==-1&&(r=r.slice(0,g)),r+=(r.indexOf("?")===-1?"?":"&")+w}return r}class Ho{constructor(){this.handlers=[]}use(i,u,d){return this.handlers.push({fulfilled:i,rejected:u,synchronous:d?d.synchronous:!1,runWhen:d?d.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(d){d!==null&&i(d)})}}var pr=Ho,mr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wo=typeof URLSearchParams<"u"?URLSearchParams:$n,zo=typeof FormData<"u"?FormData:null,Jo=typeof Blob<"u"?Blob:null,Ko={isBrowser:!0,classes:{URLSearchParams:Wo,FormData:zo,Blob:Jo},protocols:["http","https","file","blob","url","data"]};const Hn=typeof window<"u"&&typeof document<"u",Wn=typeof navigator=="object"&&navigator||void 0,Go=Hn&&(!Wn||["ReactNative","NativeScript","NS"].indexOf(Wn.product)<0),Xo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yo=Hn&&window.location.href||"http://localhost";var Qo=Object.freeze({__proto__:null,hasBrowserEnv:Hn,hasStandardBrowserWebWorkerEnv:Xo,hasStandardBrowserEnv:Go,navigator:Wn,origin:Yo}),fe={...Qo,...Ko};function Zo(r,i){return Ht(r,new fe.classes.URLSearchParams,{visitor:function(u,d,p,w){return fe.isNode&&_.isBuffer(u)?(this.append(d,u.toString("base64")),!1):w.defaultVisitor.apply(this,arguments)},...i})}function ea(r){return _.matchAll(/\w+|\[(\w*)]/g,r).map(i=>i[0]==="[]"?"":i[1]||i[0])}function ta(r){const i={},u=Object.keys(r);let d;const p=u.length;let w;for(d=0;d<p;d++)w=u[d],i[w]=r[w];return i}function yr(r){function i(u,d,p,w){let g=u[w++];if(g==="__proto__")return!0;const T=Number.isFinite(+g),k=w>=u.length;return g=!g&&_.isArray(p)?p.length:g,k?(_.hasOwnProp(p,g)?p[g]=[p[g],d]:p[g]=d,!T):((!p[g]||!_.isObject(p[g]))&&(p[g]=[]),i(u,d,p[g],w)&&_.isArray(p[g])&&(p[g]=ta(p[g])),!T)}if(_.isFormData(r)&&_.isFunction(r.entries)){const u={};return _.forEachEntry(r,(d,p)=>{i(ea(d),p,u,0)}),u}return null}function na(r,i,u){if(_.isString(r))try{return(i||JSON.parse)(r),_.trim(r)}catch(d){if(d.name!=="SyntaxError")throw d}return(u||JSON.stringify)(r)}const zn={transitional:mr,adapter:["xhr","http","fetch"],transformRequest:[function(i,u){const d=u.getContentType()||"",p=d.indexOf("application/json")>-1,w=_.isObject(i);if(w&&_.isHTMLForm(i)&&(i=new FormData(i)),_.isFormData(i))return p?JSON.stringify(yr(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(w){if(d.indexOf("application/x-www-form-urlencoded")>-1)return Zo(i,this.formSerializer).toString();if((T=_.isFileList(i))||d.indexOf("multipart/form-data")>-1){const k=this.env&&this.env.FormData;return Ht(T?{"files[]":i}:i,k&&new k,this.formSerializer)}}return w||p?(u.setContentType("application/json",!1),na(i)):i}],transformResponse:[function(i){const u=this.transitional||zn.transitional,d=u&&u.forcedJSONParsing,p=this.responseType==="json";if(_.isResponse(i)||_.isReadableStream(i))return i;if(i&&_.isString(i)&&(d&&!this.responseType||p)){const g=!(u&&u.silentJSONParsing)&&p;try{return JSON.parse(i,this.parseReviver)}catch(T){if(g)throw T.name==="SyntaxError"?N.from(T,N.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:fe.classes.FormData,Blob:fe.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=>{zn.headers[r]={}});var Jn=zn;const sa=_.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 ra=r=>{const i={};let u,d,p;return r&&r.split(`
|
|
2
|
+
`).forEach(function(g){p=g.indexOf(":"),u=g.substring(0,p).trim().toLowerCase(),d=g.substring(p+1).trim(),!(!u||i[u]&&sa[u])&&(u==="set-cookie"?i[u]?i[u].push(d):i[u]=[d]:i[u]=i[u]?i[u]+", "+d:d)}),i};const gr=Symbol("internals");function St(r){return r&&String(r).trim().toLowerCase()}function Wt(r){return r===!1||r==null?r:_.isArray(r)?r.map(Wt):String(r)}function ia(r){const i=Object.create(null),u=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let d;for(;d=u.exec(r);)i[d[1]]=d[2];return i}const oa=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Kn(r,i,u,d,p){if(_.isFunction(d))return d.call(this,i,u);if(p&&(i=u),!!_.isString(i)){if(_.isString(d))return i.indexOf(d)!==-1;if(_.isRegExp(d))return d.test(i)}}function aa(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,u,d)=>u.toUpperCase()+d)}function ca(r,i){const u=_.toCamelCase(" "+i);["get","set","has"].forEach(d=>{Object.defineProperty(r,d+u,{value:function(p,w,g){return this[d].call(this,i,p,w,g)},configurable:!0})})}class zt{constructor(i){i&&this.set(i)}set(i,u,d){const p=this;function w(T,k,A){const C=St(k);if(!C)throw new Error("header name must be a non-empty string");const L=_.findKey(p,C);(!L||p[L]===void 0||A===!0||A===void 0&&p[L]!==!1)&&(p[L||k]=Wt(T))}const g=(T,k)=>_.forEach(T,(A,C)=>w(A,C,k));if(_.isPlainObject(i)||i instanceof this.constructor)g(i,u);else if(_.isString(i)&&(i=i.trim())&&!oa(i))g(ra(i),u);else if(_.isObject(i)&&_.isIterable(i)){let T={},k,A;for(const C of i){if(!_.isArray(C))throw TypeError("Object iterator must return a key-value pair");T[A=C[0]]=(k=T[A])?_.isArray(k)?[...k,C[1]]:[k,C[1]]:C[1]}g(T,u)}else i!=null&&w(u,i,d);return this}get(i,u){if(i=St(i),i){const d=_.findKey(this,i);if(d){const p=this[d];if(!u)return p;if(u===!0)return ia(p);if(_.isFunction(u))return u.call(this,p,d);if(_.isRegExp(u))return u.exec(p);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,u){if(i=St(i),i){const d=_.findKey(this,i);return!!(d&&this[d]!==void 0&&(!u||Kn(this,this[d],d,u)))}return!1}delete(i,u){const d=this;let p=!1;function w(g){if(g=St(g),g){const T=_.findKey(d,g);T&&(!u||Kn(d,d[T],T,u))&&(delete d[T],p=!0)}}return _.isArray(i)?i.forEach(w):w(i),p}clear(i){const u=Object.keys(this);let d=u.length,p=!1;for(;d--;){const w=u[d];(!i||Kn(this,this[w],w,i,!0))&&(delete this[w],p=!0)}return p}normalize(i){const u=this,d={};return _.forEach(this,(p,w)=>{const g=_.findKey(d,w);if(g){u[g]=Wt(p),delete u[w];return}const T=i?aa(w):String(w).trim();T!==w&&delete u[w],u[T]=Wt(p),d[T]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const u=Object.create(null);return _.forEach(this,(d,p)=>{d!=null&&d!==!1&&(u[p]=i&&_.isArray(d)?d.join(", "):d)}),u}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,u])=>i+": "+u).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...u){const d=new this(i);return u.forEach(p=>d.set(p)),d}static accessor(i){const d=(this[gr]=this[gr]={accessors:{}}).accessors,p=this.prototype;function w(g){const T=St(g);d[T]||(ca(p,g),d[T]=!0)}return _.isArray(i)?i.forEach(w):w(i),this}}zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_.reduceDescriptors(zt.prototype,({value:r},i)=>{let u=i[0].toUpperCase()+i.slice(1);return{get:()=>r,set(d){this[u]=d}}}),_.freezeMethods(zt);var Le=zt;function Gn(r,i){const u=this||Jn,d=i||u,p=Le.from(d.headers);let w=d.data;return _.forEach(r,function(T){w=T.call(u,w,p.normalize(),i?i.status:void 0)}),p.normalize(),w}function wr(r){return!!(r&&r.__CANCEL__)}function ut(r,i,u){N.call(this,r??"canceled",N.ERR_CANCELED,i,u),this.name="CanceledError"}_.inherits(ut,N,{__CANCEL__:!0});function br(r,i,u){const d=u.config.validateStatus;!u.status||!d||d(u.status)?r(u):i(new N("Request failed with status code "+u.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(u.status/100)-4],u.config,u.request,u))}function ua(r){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return i&&i[1]||""}function la(r,i){r=r||10;const u=new Array(r),d=new Array(r);let p=0,w=0,g;return i=i!==void 0?i:1e3,function(k){const A=Date.now(),C=d[w];g||(g=A),u[p]=k,d[p]=A;let L=w,J=0;for(;L!==p;)J+=u[L++],L=L%r;if(p=(p+1)%r,p===w&&(w=(w+1)%r),A-g<i)return;const he=C&&A-C;return he?Math.round(J*1e3/he):void 0}}function fa(r,i){let u=0,d=1e3/i,p,w;const g=(A,C=Date.now())=>{u=C,p=null,w&&(clearTimeout(w),w=null),r(...A)};return[(...A)=>{const C=Date.now(),L=C-u;L>=d?g(A,C):(p=A,w||(w=setTimeout(()=>{w=null,g(p)},d-L)))},()=>p&&g(p)]}const Jt=(r,i,u=3)=>{let d=0;const p=la(50,250);return fa(w=>{const g=w.loaded,T=w.lengthComputable?w.total:void 0,k=g-d,A=p(k),C=g<=T;d=g;const L={loaded:g,total:T,progress:T?g/T:void 0,bytes:k,rate:A||void 0,estimated:A&&T&&C?(T-g)/A:void 0,event:w,lengthComputable:T!=null,[i?"download":"upload"]:!0};r(L)},u)},_r=(r,i)=>{const u=r!=null;return[d=>i[0]({lengthComputable:u,total:r,loaded:d}),i[1]]},vr=r=>(...i)=>_.asap(()=>r(...i));var ha=fe.hasStandardBrowserEnv?((r,i)=>u=>(u=new URL(u,fe.origin),r.protocol===u.protocol&&r.host===u.host&&(i||r.port===u.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,da=fe.hasStandardBrowserEnv?{write(r,i,u,d,p,w){const g=[r+"="+encodeURIComponent(i)];_.isNumber(u)&&g.push("expires="+new Date(u).toGMTString()),_.isString(d)&&g.push("path="+d),_.isString(p)&&g.push("domain="+p),w===!0&&g.push("secure"),document.cookie=g.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 pa(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function ma(r,i){return i?r.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):r}function Sr(r,i,u){let d=!pa(i);return r&&(d||u==!1)?ma(r,i):i}const Er=r=>r instanceof Le?{...r}:r;function nt(r,i){i=i||{};const u={};function d(A,C,L,J){return _.isPlainObject(A)&&_.isPlainObject(C)?_.merge.call({caseless:J},A,C):_.isPlainObject(C)?_.merge({},C):_.isArray(C)?C.slice():C}function p(A,C,L,J){if(_.isUndefined(C)){if(!_.isUndefined(A))return d(void 0,A,L,J)}else return d(A,C,L,J)}function w(A,C){if(!_.isUndefined(C))return d(void 0,C)}function g(A,C){if(_.isUndefined(C)){if(!_.isUndefined(A))return d(void 0,A)}else return d(void 0,C)}function T(A,C,L){if(L in i)return d(A,C);if(L in r)return d(void 0,A)}const k={url:w,method:w,data:w,baseURL:g,transformRequest:g,transformResponse:g,paramsSerializer:g,timeout:g,timeoutMessage:g,withCredentials:g,withXSRFToken:g,adapter:g,responseType:g,xsrfCookieName:g,xsrfHeaderName:g,onUploadProgress:g,onDownloadProgress:g,decompress:g,maxContentLength:g,maxBodyLength:g,beforeRedirect:g,transport:g,httpAgent:g,httpsAgent:g,cancelToken:g,socketPath:g,responseEncoding:g,validateStatus:T,headers:(A,C,L)=>p(Er(A),Er(C),L,!0)};return _.forEach(Object.keys({...r,...i}),function(C){const L=k[C]||p,J=L(r[C],i[C],C);_.isUndefined(J)&&L!==T||(u[C]=J)}),u}var Tr=r=>{const i=nt({},r);let{data:u,withXSRFToken:d,xsrfHeaderName:p,xsrfCookieName:w,headers:g,auth:T}=i;if(i.headers=g=Le.from(g),i.url=dr(Sr(i.baseURL,i.url,i.allowAbsoluteUrls),r.params,r.paramsSerializer),T&&g.set("Authorization","Basic "+btoa((T.username||"")+":"+(T.password?unescape(encodeURIComponent(T.password)):""))),_.isFormData(u)){if(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv)g.setContentType(void 0);else if(_.isFunction(u.getHeaders)){const k=u.getHeaders(),A=["content-type","content-length"];Object.entries(k).forEach(([C,L])=>{A.includes(C.toLowerCase())&&g.set(C,L)})}}if(fe.hasStandardBrowserEnv&&(d&&_.isFunction(d)&&(d=d(i)),d||d!==!1&&ha(i.url))){const k=p&&w&&da.read(w);k&&g.set(p,k)}return i},ya=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(u,d){const p=Tr(r);let w=p.data;const g=Le.from(p.headers).normalize();let{responseType:T,onUploadProgress:k,onDownloadProgress:A}=p,C,L,J,he,x;function F(){he&&he(),x&&x(),p.cancelToken&&p.cancelToken.unsubscribe(C),p.signal&&p.signal.removeEventListener("abort",C)}let D=new XMLHttpRequest;D.open(p.method.toUpperCase(),p.url,!0),D.timeout=p.timeout;function oe(){if(!D)return;const ce=Le.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),Fe={data:!T||T==="text"||T==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:ce,config:r,request:D};br(function(Te){u(Te),F()},function(Te){d(Te),F()},Fe),D=null}"onloadend"in D?D.onloadend=oe:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(oe)},D.onabort=function(){D&&(d(new N("Request aborted",N.ECONNABORTED,r,D)),D=null)},D.onerror=function(ye){const Fe=ye&&ye.message?ye.message:"Network Error",st=new N(Fe,N.ERR_NETWORK,r,D);st.event=ye||null,d(st),D=null},D.ontimeout=function(){let ye=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded";const Fe=p.transitional||mr;p.timeoutErrorMessage&&(ye=p.timeoutErrorMessage),d(new N(ye,Fe.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,r,D)),D=null},w===void 0&&g.setContentType(null),"setRequestHeader"in D&&_.forEach(g.toJSON(),function(ye,Fe){D.setRequestHeader(Fe,ye)}),_.isUndefined(p.withCredentials)||(D.withCredentials=!!p.withCredentials),T&&T!=="json"&&(D.responseType=p.responseType),A&&([J,x]=Jt(A,!0),D.addEventListener("progress",J)),k&&D.upload&&([L,he]=Jt(k),D.upload.addEventListener("progress",L),D.upload.addEventListener("loadend",he)),(p.cancelToken||p.signal)&&(C=ce=>{D&&(d(!ce||ce.type?new ut(null,r,D):ce),D.abort(),D=null)},p.cancelToken&&p.cancelToken.subscribe(C),p.signal&&(p.signal.aborted?C():p.signal.addEventListener("abort",C)));const Ee=ua(p.url);if(Ee&&fe.protocols.indexOf(Ee)===-1){d(new N("Unsupported protocol "+Ee+":",N.ERR_BAD_REQUEST,r));return}D.send(w||null)})},ga=(r,i)=>{const{length:u}=r=r?r.filter(Boolean):[];if(i||u){let d=new AbortController,p;const w=function(A){if(!p){p=!0,T();const C=A instanceof Error?A:this.reason;d.abort(C instanceof N?C:new ut(C instanceof Error?C.message:C))}};let g=i&&setTimeout(()=>{g=null,w(new N(`timeout ${i} of ms exceeded`,N.ETIMEDOUT))},i);const T=()=>{r&&(g&&clearTimeout(g),g=null,r.forEach(A=>{A.unsubscribe?A.unsubscribe(w):A.removeEventListener("abort",w)}),r=null)};r.forEach(A=>A.addEventListener("abort",w));const{signal:k}=d;return k.unsubscribe=()=>_.asap(T),k}};const wa=function*(r,i){let u=r.byteLength;if(u<i){yield r;return}let d=0,p;for(;d<u;)p=d+i,yield r.slice(d,p),d=p},ba=async function*(r,i){for await(const u of _a(r))yield*wa(u,i)},_a=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const i=r.getReader();try{for(;;){const{done:u,value:d}=await i.read();if(u)break;yield d}}finally{await i.cancel()}},Or=(r,i,u,d)=>{const p=ba(r,i);let w=0,g,T=k=>{g||(g=!0,d&&d(k))};return new ReadableStream({async pull(k){try{const{done:A,value:C}=await p.next();if(A){T(),k.close();return}let L=C.byteLength;if(u){let J=w+=L;u(J)}k.enqueue(new Uint8Array(C))}catch(A){throw T(A),A}},cancel(k){return T(k),p.return()}},{highWaterMark:2})},Cr=64*1024,{isFunction:Kt}=_,va=(({Request:r,Response:i})=>({Request:r,Response:i}))(_.global),{ReadableStream:xr,TextEncoder:Ar}=_.global,Rr=(r,...i)=>{try{return!!r(...i)}catch{return!1}},Sa=r=>{r=_.merge.call({skipUndefined:!0},va,r);const{fetch:i,Request:u,Response:d}=r,p=i?Kt(i):typeof fetch=="function",w=Kt(u),g=Kt(d);if(!p)return!1;const T=p&&Kt(xr),k=p&&(typeof Ar=="function"?(x=>F=>x.encode(F))(new Ar):async x=>new Uint8Array(await new u(x).arrayBuffer())),A=w&&T&&Rr(()=>{let x=!1;const F=new u(fe.origin,{body:new xr,method:"POST",get duplex(){return x=!0,"half"}}).headers.has("Content-Type");return x&&!F}),C=g&&T&&Rr(()=>_.isReadableStream(new d("").body)),L={stream:C&&(x=>x.body)};p&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!L[x]&&(L[x]=(F,D)=>{let oe=F&&F[x];if(oe)return oe.call(F);throw new N(`Response type '${x}' is not supported`,N.ERR_NOT_SUPPORT,D)})});const J=async x=>{if(x==null)return 0;if(_.isBlob(x))return x.size;if(_.isSpecCompliantForm(x))return(await new u(fe.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(_.isArrayBufferView(x)||_.isArrayBuffer(x))return x.byteLength;if(_.isURLSearchParams(x)&&(x=x+""),_.isString(x))return(await k(x)).byteLength},he=async(x,F)=>{const D=_.toFiniteNumber(x.getContentLength());return D??J(F)};return async x=>{let{url:F,method:D,data:oe,signal:Ee,cancelToken:ce,timeout:ye,onDownloadProgress:Fe,onUploadProgress:st,responseType:Te,headers:es,withCredentials:Zt="same-origin",fetchOptions:Ur}=Tr(x),qr=i||fetch;Te=Te?(Te+"").toLowerCase():"text";let en=ga([Ee,ce&&ce.toAbortSignal()],ye),Et=null;const rt=en&&en.unsubscribe&&(()=>{en.unsubscribe()});let Ir;try{if(st&&A&&D!=="get"&&D!=="head"&&(Ir=await he(es,oe))!==0){let Ge=new u(F,{method:"POST",body:oe,duplex:"half"}),lt;if(_.isFormData(oe)&&(lt=Ge.headers.get("content-type"))&&es.setContentType(lt),Ge.body){const[ts,tn]=_r(Ir,Jt(vr(st)));oe=Or(Ge.body,Cr,ts,tn)}}_.isString(Zt)||(Zt=Zt?"include":"omit");const Ie=w&&"credentials"in u.prototype,jr={...Ur,signal:en,method:D.toUpperCase(),headers:es.normalize().toJSON(),body:oe,duplex:"half",credentials:Ie?Zt:void 0};Et=w&&new u(F,jr);let Ke=await(w?qr(Et,Ur):qr(F,jr));const Mr=C&&(Te==="stream"||Te==="response");if(C&&(Fe||Mr&&rt)){const Ge={};["status","statusText","headers"].forEach(Vr=>{Ge[Vr]=Ke[Vr]});const lt=_.toFiniteNumber(Ke.headers.get("content-length")),[ts,tn]=Fe&&_r(lt,Jt(vr(Fe),!0))||[];Ke=new d(Or(Ke.body,Cr,ts,()=>{tn&&tn(),rt&&rt()}),Ge)}Te=Te||"text";let ka=await L[_.findKey(L,Te)||"text"](Ke,x);return!Mr&&rt&&rt(),await new Promise((Ge,lt)=>{br(Ge,lt,{data:ka,headers:Le.from(Ke.headers),status:Ke.status,statusText:Ke.statusText,config:x,request:Et})})}catch(Ie){throw rt&&rt(),Ie&&Ie.name==="TypeError"&&/Load failed|fetch/i.test(Ie.message)?Object.assign(new N("Network Error",N.ERR_NETWORK,x,Et),{cause:Ie.cause||Ie}):N.from(Ie,Ie&&Ie.code,x,Et)}}},Ea=new Map,kr=r=>{let i=r?r.env:{};const{fetch:u,Request:d,Response:p}=i,w=[d,p,u];let g=w.length,T=g,k,A,C=Ea;for(;T--;)k=w[T],A=C.get(k),A===void 0&&C.set(k,A=T?new Map:Sa(i)),C=A;return A};kr();const Xn={http:jo,xhr:ya,fetch:{get:kr}};_.forEach(Xn,(r,i)=>{if(r){try{Object.defineProperty(r,"name",{value:i})}catch{}Object.defineProperty(r,"adapterName",{value:i})}});const Dr=r=>`- ${r}`,Ta=r=>_.isFunction(r)||r===null||r===!1;var Lr={getAdapter:(r,i)=>{r=_.isArray(r)?r:[r];const{length:u}=r;let d,p;const w={};for(let g=0;g<u;g++){d=r[g];let T;if(p=d,!Ta(d)&&(p=Xn[(T=String(d)).toLowerCase()],p===void 0))throw new N(`Unknown adapter '${T}'`);if(p&&(_.isFunction(p)||(p=p.get(i))))break;w[T||"#"+g]=p}if(!p){const g=Object.entries(w).map(([k,A])=>`adapter ${k} `+(A===!1?"is not supported by the environment":"is not available in the build"));let T=u?g.length>1?`since :
|
|
4
4
|
`+g.map(Dr).join(`
|
|
5
5
|
`):" "+Dr(g[0]):"as no adapter specified";throw new N("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return p},adapters:Xn};function Yn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new ut(null,r)}function Fr(r){return Yn(r),r.headers=Le.from(r.headers),r.data=Gn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Lr.getAdapter(r.adapter||Jn.adapter,r)(r).then(function(d){return Yn(r),d.data=Gn.call(r,r.transformResponse,d),d.headers=Le.from(d.headers),d},function(d){return wr(d)||(Yn(r),d&&d.response&&(d.response.data=Gn.call(r,r.transformResponse,d.response),d.response.headers=Le.from(d.response.headers))),Promise.reject(d)})}const Nr="1.12.2",Gt={};["object","boolean","number","function","string","symbol"].forEach((r,i)=>{Gt[r]=function(d){return typeof d===r||"a"+(i<1?"n ":" ")+r}});const Br={};Gt.transitional=function(i,u,d){function p(w,g){return"[Axios v"+Nr+"] Transitional option '"+w+"'"+g+(d?". "+d:"")}return(w,g,T)=>{if(i===!1)throw new N(p(g," has been removed"+(u?" in "+u:"")),N.ERR_DEPRECATED);return u&&!Br[g]&&(Br[g]=!0,console.warn(p(g," has been deprecated since v"+u+" and will be removed in the near future"))),i?i(w,g,T):!0}},Gt.spelling=function(i){return(u,d)=>(console.warn(`${d} is likely a misspelling of ${i}`),!0)};function Oa(r,i,u){if(typeof r!="object")throw new N("options must be an object",N.ERR_BAD_OPTION_VALUE);const d=Object.keys(r);let p=d.length;for(;p-- >0;){const w=d[p],g=i[w];if(g){const T=r[w],k=T===void 0||g(T,w,r);if(k!==!0)throw new N("option "+w+" must be "+k,N.ERR_BAD_OPTION_VALUE);continue}if(u!==!0)throw new N("Unknown option "+w,N.ERR_BAD_OPTION)}}var Xt={assertOptions:Oa,validators:Gt};const qe=Xt.validators;class Yt{constructor(i){this.defaults=i||{},this.interceptors={request:new pr,response:new pr}}async request(i,u){try{return await this._request(i,u)}catch(d){if(d instanceof Error){let p={};Error.captureStackTrace?Error.captureStackTrace(p):p=new Error;const w=p.stack?p.stack.replace(/^.+\n/,""):"";try{d.stack?w&&!String(d.stack).endsWith(w.replace(/^.+\n.+\n/,""))&&(d.stack+=`
|
|
6
|
-
`+w):d.stack=w}catch{}}throw d}}_request(i,u){typeof i=="string"?(u=u||{},u.url=i):u=i||{},u=nt(this.defaults,u);const{transitional:d,paramsSerializer:p,headers:w}=u;d!==void 0&&Xt.assertOptions(d,{silentJSONParsing:qe.transitional(qe.boolean),forcedJSONParsing:qe.transitional(qe.boolean),clarifyTimeoutError:qe.transitional(qe.boolean)},!1),p!=null&&(v.isFunction(p)?u.paramsSerializer={serialize:p}:Xt.assertOptions(p,{encode:qe.function,serialize:qe.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),Xt.assertOptions(u,{baseUrl:qe.spelling("baseURL"),withXsrfToken:qe.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let g=w&&v.merge(w.common,w[u.method]);w&&v.forEach(["delete","get","head","post","put","patch","common"],x=>{delete w[x]}),u.headers=Le.concat(g,w);const T=[];let k=!0;this.interceptors.request.forEach(function(F){typeof F.runWhen=="function"&&F.runWhen(u)===!1||(k=k&&F.synchronous,T.unshift(F.fulfilled,F.rejected))});const A=[];this.interceptors.response.forEach(function(F){A.push(F.fulfilled,F.rejected)});let C,L=0,J;if(!k){const x=[Fr.bind(this),void 0];for(x.unshift(...T),x.push(...A),J=x.length,C=Promise.resolve(u);L<J;)C=C.then(x[L++],x[L++]);return C}J=T.length;let he=u;for(;L<J;){const x=T[L++],F=T[L++];try{he=x(he)}catch(D){F.call(this,D);break}}try{C=Fr.call(this,he)}catch(x){return Promise.reject(x)}for(L=0,J=A.length;L<J;)C=C.then(A[L++],A[L++]);return C}getUri(i){i=nt(this.defaults,i);const u=Sr(i.baseURL,i.url,i.allowAbsoluteUrls);return dr(u,i.params,i.paramsSerializer)}}v.forEach(["delete","get","head","options"],function(i){Yt.prototype[i]=function(u,d){return this.request(nt(d||{},{method:i,url:u,data:(d||{}).data}))}}),v.forEach(["post","put","patch"],function(i){function u(d){return function(w,g,T){return this.request(nt(T||{},{method:i,headers:d?{"Content-Type":"multipart/form-data"}:{},url:w,data:g}))}}Yt.prototype[i]=u(),Yt.prototype[i+"Form"]=u(!0)});var Qt=Yt;class Qn{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(w){u=w});const d=this;this.promise.then(p=>{if(!d._listeners)return;let w=d._listeners.length;for(;w-- >0;)d._listeners[w](p);d._listeners=null}),this.promise.then=p=>{let w;const g=new Promise(T=>{d.subscribe(T),w=T}).then(p);return g.cancel=function(){d.unsubscribe(w)},g},i(function(w,g,T){d.reason||(d.reason=new ut(w,g,T),u(d.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=d=>{i.abort(d)};return this.subscribe(u),i.signal.unsubscribe=()=>this.unsubscribe(u),i.signal}static source(){let i;return{token:new Qn(function(p){i=p}),cancel:i}}}var Ca=Qn;function xa(r){return function(u){return r.apply(null,u)}}function Aa(r){return v.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 Ra=Zn;function Pr(r){const i=new Qt(r),u=t(Qt.prototype.request,i);return v.extend(u,Qt.prototype,i,{allOwnKeys:!0}),v.extend(u,i,null,{allOwnKeys:!0}),u.create=function(p){return Pr(nt(r,p))},u}const se=Pr(Jn);return se.Axios=Qt,se.CanceledError=ut,se.CancelToken=Ca,se.isCancel=wr,se.VERSION=Nr,se.toFormData=Ht,se.AxiosError=N,se.Cancel=se.CanceledError,se.all=function(i){return Promise.all(i)},se.spread=xa,se.isAxiosError=Aa,se.mergeConfig=nt,se.AxiosHeaders=Le,se.formToJSON=r=>yr(v.isHTMLForm(r)?new FormData(r):r),se.getAdapter=Lr.getAdapter,se.HttpStatusCode=Ra,se.default=se,nn=se,nn}var as;function cs(){if(as)return je;as=1;var t=je&&je.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)};Object.defineProperty(je,"__esModule",{value:!0}),je.getRequestHeaders=je.getAxiosClient=void 0;var e=Hr();function n(a,c,o,h,f){var l=e.default.create({baseURL:a,headers:s(c,h,o,a,f),withCredentials:!0});return l.interceptors.request.use(function(m){return typeof window<"u"&&window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(m.headers["X-Frappe-CSRF-Token"]=window.csrf_token),c&&h&&o&&(m.headers.Authorization="".concat(h," ").concat(o())),m}),l}je.getAxiosClient=n;function s(a,c,o,h,f){a===void 0&&(a=!1);var l={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return a&&c&&o&&(l.Authorization="".concat(c," ").concat(o())),typeof window<"u"&&typeof document<"u"&&(window.location&&(h&&h!==window.location.origin||(l["X-Frappe-Site-Name"]=window.location.hostname)),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(l["X-Frappe-CSRF-Token"]=window.csrf_token)),t(t({},l),f??{})}return je.getRequestHeaders=s,je}var us;function ls(){if(us)return xe;us=1;var t=xe&&xe.__assign||function(){return t=Object.assign||function(c){for(var o,h=1,f=arguments.length;h<f;h++){o=arguments[h];for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&(c[l]=o[l])}return c},t.apply(this,arguments)},e=xe&&xe.__awaiter||function(c,o,h,f){function l(m){return m instanceof h?m:new h(function(b){b(m)})}return new(h||(h=Promise))(function(m,b){function E(O){try{_(f.next(O))}catch(I){b(I)}}function y(O){try{_(f.throw(O))}catch(I){b(I)}}function _(O){O.done?m(O.value):l(O.value).then(E,y)}_((f=f.apply(c,o||[])).next())})},n=xe&&xe.__generator||function(c,o){var h={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},f,l,m,b;return b={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function E(_){return function(O){return y([_,O])}}function y(_){if(f)throw new TypeError("Generator is already executing.");for(;b&&(b=0,_[0]&&(h=0)),h;)try{if(f=1,l&&(m=_[0]&2?l.return:_[0]?l.throw||((m=l.return)&&m.call(l),0):l.next)&&!(m=m.call(l,_[1])).done)return m;switch(l=0,m&&(_=[_[0]&2,m.value]),_[0]){case 0:case 1:m=_;break;case 4:return h.label++,{value:_[1],done:!1};case 5:h.label++,l=_[1],_=[0];continue;case 7:_=h.ops.pop(),h.trys.pop();continue;default:if(m=h.trys,!(m=m.length>0&&m[m.length-1])&&(_[0]===6||_[0]===2)){h=0;continue}if(_[0]===3&&(!m||_[1]>m[0]&&_[1]<m[3])){h.label=_[1];break}if(_[0]===6&&h.label<m[1]){h.label=m[1],m=_;break}if(m&&h.label<m[2]){h.label=m[2],h.ops.push(_);break}m[2]&&h.ops.pop(),h.trys.pop();continue}_=o.call(c,h)}catch(O){_=[6,O],l=0}finally{f=m=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}};Object.defineProperty(xe,"__esModule",{value:!0}),xe.FrappeFileUpload=void 0;var s=cs(),a=function(){function c(o,h,f,l,m,b){this.appURL=o,this.axios=h,this.useToken=f??!1,this.token=l,this.tokenType=m,this.customHeaders=b}return c.prototype.uploadFile=function(o,h,f,l){return l===void 0&&(l="upload_file"),e(this,void 0,void 0,function(){var m,b,E,y,_,O,I,R;return n(this,function(K){return m=new FormData,o&&m.append("file",o,o.name),b=h.isPrivate,E=h.folder,y=h.file_url,_=h.doctype,O=h.docname,I=h.fieldname,R=h.otherData,b&&m.append("is_private","1"),E&&m.append("folder",E),y&&m.append("file_url",y),_&&O&&(m.append("doctype",_),m.append("docname",O),I&&m.append("fieldname",I)),R&&Object.keys(R).forEach(function(G){var H=R[G];m.append(G,H)}),[2,this.axios.post("/api/method/".concat(l),m,{onUploadProgress:function(G){f&&f(G.loaded,G.total,G)},headers:t(t({},(0,s.getRequestHeaders)(this.useToken,this.tokenType,this.token,this.appURL,this.customHeaders)),{"Content-Type":"multipart/form-data"})}).catch(function(G){var H,j;throw t(t({},G.response.data),{httpStatus:G.response.status,httpStatusText:G.response.statusText,message:(H=G.response.data.message)!==null&&H!==void 0?H:"There was an error while uploading the file.",exception:(j=G.response.data.exception)!==null&&j!==void 0?j:""})})]})})},c}();return xe.FrappeFileUpload=a,xe}var fs;function Wr(){if(fs)return ht;fs=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.FrappeApp=void 0;var t=ps(),e=ss(),n=is(),s=ls(),a=cs(),c=function(){function o(h,f,l,m){var b,E;this.url=h,this.name=l??"FrappeApp",this.useToken=(b=f==null?void 0:f.useToken)!==null&&b!==void 0?b:!1,this.token=f==null?void 0:f.token,this.tokenType=(E=f==null?void 0:f.type)!==null&&E!==void 0?E:"Bearer",this.customHeaders=m,this.axios=(0,a.getAxiosClient)(this.url,this.useToken,this.token,this.tokenType,this.customHeaders)}return o.prototype.auth=function(){return new t.FrappeAuth(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.db=function(){return new n.FrappeDB(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.file=function(){return new s.FrappeFileUpload(this.url,this.axios,this.useToken,this.token,this.tokenType,this.customHeaders)},o.prototype.call=function(){return new e.FrappeCall(this.url,this.axios,this.useToken,this.token,this.tokenType)},o}();return ht.FrappeApp=c,ht}var Ae={},hs;function zr(){if(hs)return Ae;hs=1;var t=Ae&&Ae.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Ae&&Ae.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(_){try{y(h.next(_))}catch(O){m(O)}}function E(_){try{y(h.throw(_))}catch(O){m(O)}}function y(_){_.done?l(_.value):f(_.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Ae&&Ae.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(_){return E([y,_])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(_){y=[6,_],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.FrappeAuth=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.loginWithUsernamePassword=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/login",{usr:c.username,pwd:c.password,otp:c.otp,tmp_id:c.tmp_id,device:c.device}).then(function(h){return h.data}).catch(function(h){var f,l;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 logging in",exception:(l=h.response.data.exception)!==null&&l!==void 0?l:""})})]})})},a.prototype.getLoggedInUser=function(){return e(this,void 0,void 0,function(){return n(this,function(c){return[2,this.axios.get("/api/method/frappe.auth.get_logged_user").then(function(o){return o.data.message}).catch(function(o){var h;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:"There was an error while fetching the logged in user",exception:(h=o.response.data.exception)!==null&&h!==void 0?h:""})})]})})},a.prototype.logout=function(){return e(this,void 0,void 0,function(){return n(this,function(c){return[2,this.axios.post("/api/method/logout",{}).then(function(){}).catch(function(o){var h,f;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:(h=o.response.data.message)!==null&&h!==void 0?h:"There was an error while logging out",exception:(f=o.response.data.exception)!==null&&f!==void 0?f:""})})]})})},a.prototype.forgetPassword=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/",{cmd:"frappe.core.doctype.user.user.reset_password",user:c}).then(function(){}).catch(function(h){var f,l;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 sending password reset email.",exception:(l=h.response.data.exception)!==null&&l!==void 0?l:""})})]})})},a}();return Ae.FrappeAuth=s,Ae}var ds;function ps(){return ds||(ds=1,function(t){var e=Ye&&Ye.__createBinding||(Object.create?function(s,a,c,o){o===void 0&&(o=c);var h=Object.getOwnPropertyDescriptor(a,c);(!h||("get"in h?!a.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(s,o,h)}:function(s,a,c,o){o===void 0&&(o=c),s[o]=a[c]}),n=Ye&&Ye.__exportStar||function(s,a){for(var c in s)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&e(a,s,c)};Object.defineProperty(t,"__esModule",{value:!0}),n(Wr(),t),n(zr(),t),n(is(),t),n(ls(),t),n(ss(),t)}(Ye)),Ye}var Jr=ps(),Tt={exports:{}},sn={};/**
|
|
6
|
+
`+w):d.stack=w}catch{}}throw d}}_request(i,u){typeof i=="string"?(u=u||{},u.url=i):u=i||{},u=nt(this.defaults,u);const{transitional:d,paramsSerializer:p,headers:w}=u;d!==void 0&&Xt.assertOptions(d,{silentJSONParsing:qe.transitional(qe.boolean),forcedJSONParsing:qe.transitional(qe.boolean),clarifyTimeoutError:qe.transitional(qe.boolean)},!1),p!=null&&(_.isFunction(p)?u.paramsSerializer={serialize:p}:Xt.assertOptions(p,{encode:qe.function,serialize:qe.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),Xt.assertOptions(u,{baseUrl:qe.spelling("baseURL"),withXsrfToken:qe.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let g=w&&_.merge(w.common,w[u.method]);w&&_.forEach(["delete","get","head","post","put","patch","common"],x=>{delete w[x]}),u.headers=Le.concat(g,w);const T=[];let k=!0;this.interceptors.request.forEach(function(F){typeof F.runWhen=="function"&&F.runWhen(u)===!1||(k=k&&F.synchronous,T.unshift(F.fulfilled,F.rejected))});const A=[];this.interceptors.response.forEach(function(F){A.push(F.fulfilled,F.rejected)});let C,L=0,J;if(!k){const x=[Fr.bind(this),void 0];for(x.unshift(...T),x.push(...A),J=x.length,C=Promise.resolve(u);L<J;)C=C.then(x[L++],x[L++]);return C}J=T.length;let he=u;for(;L<J;){const x=T[L++],F=T[L++];try{he=x(he)}catch(D){F.call(this,D);break}}try{C=Fr.call(this,he)}catch(x){return Promise.reject(x)}for(L=0,J=A.length;L<J;)C=C.then(A[L++],A[L++]);return C}getUri(i){i=nt(this.defaults,i);const u=Sr(i.baseURL,i.url,i.allowAbsoluteUrls);return dr(u,i.params,i.paramsSerializer)}}_.forEach(["delete","get","head","options"],function(i){Yt.prototype[i]=function(u,d){return this.request(nt(d||{},{method:i,url:u,data:(d||{}).data}))}}),_.forEach(["post","put","patch"],function(i){function u(d){return function(w,g,T){return this.request(nt(T||{},{method:i,headers:d?{"Content-Type":"multipart/form-data"}:{},url:w,data:g}))}}Yt.prototype[i]=u(),Yt.prototype[i+"Form"]=u(!0)});var Qt=Yt;class Qn{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(w){u=w});const d=this;this.promise.then(p=>{if(!d._listeners)return;let w=d._listeners.length;for(;w-- >0;)d._listeners[w](p);d._listeners=null}),this.promise.then=p=>{let w;const g=new Promise(T=>{d.subscribe(T),w=T}).then(p);return g.cancel=function(){d.unsubscribe(w)},g},i(function(w,g,T){d.reason||(d.reason=new ut(w,g,T),u(d.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=d=>{i.abort(d)};return this.subscribe(u),i.signal.unsubscribe=()=>this.unsubscribe(u),i.signal}static source(){let i;return{token:new Qn(function(p){i=p}),cancel:i}}}var Ca=Qn;function xa(r){return function(u){return r.apply(null,u)}}function Aa(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 Ra=Zn;function Pr(r){const i=new Qt(r),u=t(Qt.prototype.request,i);return _.extend(u,Qt.prototype,i,{allOwnKeys:!0}),_.extend(u,i,null,{allOwnKeys:!0}),u.create=function(p){return Pr(nt(r,p))},u}const se=Pr(Jn);return se.Axios=Qt,se.CanceledError=ut,se.CancelToken=Ca,se.isCancel=wr,se.VERSION=Nr,se.toFormData=Ht,se.AxiosError=N,se.Cancel=se.CanceledError,se.all=function(i){return Promise.all(i)},se.spread=xa,se.isAxiosError=Aa,se.mergeConfig=nt,se.AxiosHeaders=Le,se.formToJSON=r=>yr(_.isHTMLForm(r)?new FormData(r):r),se.getAdapter=Lr.getAdapter,se.HttpStatusCode=Ra,se.default=se,nn=se,nn}var as;function cs(){if(as)return je;as=1;var t=je&&je.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)};Object.defineProperty(je,"__esModule",{value:!0}),je.getRequestHeaders=je.getAxiosClient=void 0;var e=Hr();function n(a,c,o,h,f){var l=e.default.create({baseURL:a,headers:s(c,h,o,a,f),withCredentials:!0});return l.interceptors.request.use(function(m){return typeof window<"u"&&window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(m.headers["X-Frappe-CSRF-Token"]=window.csrf_token),c&&h&&o&&(m.headers.Authorization="".concat(h," ").concat(o())),m}),l}je.getAxiosClient=n;function s(a,c,o,h,f){a===void 0&&(a=!1);var l={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return a&&c&&o&&(l.Authorization="".concat(c," ").concat(o())),typeof window<"u"&&typeof document<"u"&&(window.location&&(h&&h!==window.location.origin||(l["X-Frappe-Site-Name"]=window.location.hostname)),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(l["X-Frappe-CSRF-Token"]=window.csrf_token)),t(t({},l),f??{})}return je.getRequestHeaders=s,je}var us;function ls(){if(us)return xe;us=1;var t=xe&&xe.__assign||function(){return t=Object.assign||function(c){for(var o,h=1,f=arguments.length;h<f;h++){o=arguments[h];for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&(c[l]=o[l])}return c},t.apply(this,arguments)},e=xe&&xe.__awaiter||function(c,o,h,f){function l(m){return m instanceof h?m:new h(function(b){b(m)})}return new(h||(h=Promise))(function(m,b){function E(O){try{v(f.next(O))}catch(I){b(I)}}function y(O){try{v(f.throw(O))}catch(I){b(I)}}function v(O){O.done?m(O.value):l(O.value).then(E,y)}v((f=f.apply(c,o||[])).next())})},n=xe&&xe.__generator||function(c,o){var h={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},f,l,m,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 y([v,O])}}function y(v){if(f)throw new TypeError("Generator is already executing.");for(;b&&(b=0,v[0]&&(h=0)),h;)try{if(f=1,l&&(m=v[0]&2?l.return:v[0]?l.throw||((m=l.return)&&m.call(l),0):l.next)&&!(m=m.call(l,v[1])).done)return m;switch(l=0,m&&(v=[v[0]&2,m.value]),v[0]){case 0:case 1:m=v;break;case 4:return h.label++,{value:v[1],done:!1};case 5:h.label++,l=v[1],v=[0];continue;case 7:v=h.ops.pop(),h.trys.pop();continue;default:if(m=h.trys,!(m=m.length>0&&m[m.length-1])&&(v[0]===6||v[0]===2)){h=0;continue}if(v[0]===3&&(!m||v[1]>m[0]&&v[1]<m[3])){h.label=v[1];break}if(v[0]===6&&h.label<m[1]){h.label=m[1],m=v;break}if(m&&h.label<m[2]){h.label=m[2],h.ops.push(v);break}m[2]&&h.ops.pop(),h.trys.pop();continue}v=o.call(c,h)}catch(O){v=[6,O],l=0}finally{f=m=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}};Object.defineProperty(xe,"__esModule",{value:!0}),xe.FrappeFileUpload=void 0;var s=cs(),a=function(){function c(o,h,f,l,m,b){this.appURL=o,this.axios=h,this.useToken=f??!1,this.token=l,this.tokenType=m,this.customHeaders=b}return c.prototype.uploadFile=function(o,h,f,l){return l===void 0&&(l="upload_file"),e(this,void 0,void 0,function(){var m,b,E,y,v,O,I,R;return n(this,function(K){return m=new FormData,o&&m.append("file",o,o.name),b=h.isPrivate,E=h.folder,y=h.file_url,v=h.doctype,O=h.docname,I=h.fieldname,R=h.otherData,b&&m.append("is_private","1"),E&&m.append("folder",E),y&&m.append("file_url",y),v&&O&&(m.append("doctype",v),m.append("docname",O),I&&m.append("fieldname",I)),R&&Object.keys(R).forEach(function(G){var H=R[G];m.append(G,H)}),[2,this.axios.post("/api/method/".concat(l),m,{onUploadProgress:function(G){f&&f(G.loaded,G.total,G)},headers:t(t({},(0,s.getRequestHeaders)(this.useToken,this.tokenType,this.token,this.appURL,this.customHeaders)),{"Content-Type":"multipart/form-data"})}).catch(function(G){var H,j;throw t(t({},G.response.data),{httpStatus:G.response.status,httpStatusText:G.response.statusText,message:(H=G.response.data.message)!==null&&H!==void 0?H:"There was an error while uploading the file.",exception:(j=G.response.data.exception)!==null&&j!==void 0?j:""})})]})})},c}();return xe.FrappeFileUpload=a,xe}var fs;function Wr(){if(fs)return ht;fs=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.FrappeApp=void 0;var t=ps(),e=ss(),n=is(),s=ls(),a=cs(),c=function(){function o(h,f,l,m){var b,E;this.url=h,this.name=l??"FrappeApp",this.useToken=(b=f==null?void 0:f.useToken)!==null&&b!==void 0?b:!1,this.token=f==null?void 0:f.token,this.tokenType=(E=f==null?void 0:f.type)!==null&&E!==void 0?E:"Bearer",this.customHeaders=m,this.axios=(0,a.getAxiosClient)(this.url,this.useToken,this.token,this.tokenType,this.customHeaders)}return o.prototype.auth=function(){return new t.FrappeAuth(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.db=function(){return new n.FrappeDB(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.file=function(){return new s.FrappeFileUpload(this.url,this.axios,this.useToken,this.token,this.tokenType,this.customHeaders)},o.prototype.call=function(){return new e.FrappeCall(this.url,this.axios,this.useToken,this.token,this.tokenType)},o}();return ht.FrappeApp=c,ht}var Ae={},hs;function zr(){if(hs)return Ae;hs=1;var t=Ae&&Ae.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Ae&&Ae.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(v){try{y(h.next(v))}catch(O){m(O)}}function E(v){try{y(h.throw(v))}catch(O){m(O)}}function y(v){v.done?l(v.value):f(v.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Ae&&Ae.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(v){return E([y,v])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(v){y=[6,v],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.FrappeAuth=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.loginWithUsernamePassword=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/login",{usr:c.username,pwd:c.password,otp:c.otp,tmp_id:c.tmp_id,device:c.device}).then(function(h){return h.data}).catch(function(h){var f,l;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 logging in",exception:(l=h.response.data.exception)!==null&&l!==void 0?l:""})})]})})},a.prototype.getLoggedInUser=function(){return e(this,void 0,void 0,function(){return n(this,function(c){return[2,this.axios.get("/api/method/frappe.auth.get_logged_user").then(function(o){return o.data.message}).catch(function(o){var h;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:"There was an error while fetching the logged in user",exception:(h=o.response.data.exception)!==null&&h!==void 0?h:""})})]})})},a.prototype.logout=function(){return e(this,void 0,void 0,function(){return n(this,function(c){return[2,this.axios.post("/api/method/logout",{}).then(function(){}).catch(function(o){var h,f;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:(h=o.response.data.message)!==null&&h!==void 0?h:"There was an error while logging out",exception:(f=o.response.data.exception)!==null&&f!==void 0?f:""})})]})})},a.prototype.forgetPassword=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/",{cmd:"frappe.core.doctype.user.user.reset_password",user:c}).then(function(){}).catch(function(h){var f,l;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 sending password reset email.",exception:(l=h.response.data.exception)!==null&&l!==void 0?l:""})})]})})},a}();return Ae.FrappeAuth=s,Ae}var ds;function ps(){return ds||(ds=1,function(t){var e=Ye&&Ye.__createBinding||(Object.create?function(s,a,c,o){o===void 0&&(o=c);var h=Object.getOwnPropertyDescriptor(a,c);(!h||("get"in h?!a.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(s,o,h)}:function(s,a,c,o){o===void 0&&(o=c),s[o]=a[c]}),n=Ye&&Ye.__exportStar||function(s,a){for(var c in s)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&e(a,s,c)};Object.defineProperty(t,"__esModule",{value:!0}),n(Wr(),t),n(zr(),t),n(is(),t),n(ls(),t),n(ss(),t)}(Ye)),Ye}var Jr=ps(),Tt={exports:{}},sn={};/**
|
|
7
7
|
* @license React
|
|
8
8
|
* use-sync-external-store-shim.production.js
|
|
9
9
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/var ms;function Kr(){if(ms)return sn;ms=1;var t=S;function e(b,E){return b===E&&(b!==0||1/b===1/E)||b!==b&&E!==E}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,c=t.useLayoutEffect,o=t.useDebugValue;function h(b,E){var y=E(),
|
|
14
|
+
*/var ms;function Kr(){if(ms)return sn;ms=1;var t=S;function e(b,E){return b===E&&(b!==0||1/b===1/E)||b!==b&&E!==E}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,c=t.useLayoutEffect,o=t.useDebugValue;function h(b,E){var y=E(),v=s({inst:{value:y,getSnapshot:E}}),O=v[0].inst,I=v[1];return c(function(){O.value=y,O.getSnapshot=E,f(O)&&I({inst:O})},[b,y,E]),a(function(){return f(O)&&I({inst:O}),b(function(){f(O)&&I({inst:O})})},[b]),o(y),y}function f(b){var E=b.getSnapshot;b=b.value;try{var y=E();return!n(b,y)}catch{return!0}}function l(b,E){return E()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:h;return sn.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:m,sn}var rn={};/**
|
|
15
15
|
* @license React
|
|
16
16
|
* use-sync-external-store-shim.development.js
|
|
17
17
|
*
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var ys;function Gr(){return ys||(ys=1,process.env.NODE_ENV!=="production"&&function(){function t(y,_){return y===_&&(y!==0||1/y===1/_)||y!==y&&_!==_}function e(y,_){m||a.startTransition===void 0||(m=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var O=_();if(!b){var I=_();c(O,I)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),b=!0)}I=o({inst:{value:O,getSnapshot:_}});var R=I[0].inst,K=I[1];return f(function(){R.value=O,R.getSnapshot=_,n(R)&&K({inst:R})},[y,O,_]),h(function(){return n(R)&&K({inst:R}),y(function(){n(R)&&K({inst:R})})},[y]),l(O),O}function n(y){var _=y.getSnapshot;y=y.value;try{var O=_();return!c(y,O)}catch{return!0}}function s(y,_){return _()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=S,c=typeof Object.is=="function"?Object.is:t,o=a.useState,h=a.useEffect,f=a.useLayoutEffect,l=a.useDebugValue,m=!1,b=!1,E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:e;rn.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:E,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),rn}var gs;function Xr(){return gs||(gs=1,process.env.NODE_ENV==="production"?Tt.exports=Kr():Tt.exports=Gr()),Tt.exports}var ws=Xr();const bs=0,vs=1,_s=2,Ss=3;var Es=Object.prototype.hasOwnProperty;function on(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&on(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(Es.call(t,n)&&++s&&!Es.call(e,n)||!(n in e)||!on(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const Re=new WeakMap,$e=()=>{},Y=$e(),Ot=Object,U=t=>t===Y,_e=t=>typeof t=="function",Me=(t,e)=>({...t,...e}),Ts=t=>_e(t.then),an={},Ct={},cn="undefined",dt=typeof window!=cn,un=typeof document!=cn,Yr=dt&&"Deno"in window,Qr=()=>dt&&typeof window.requestAnimationFrame!=cn,He=(t,e)=>{const n=Re.get(t);return[()=>!U(e)&&t.get(e)||an,s=>{if(!U(e)){const a=t.get(e);e in Ct||(Ct[e]=a),n[5](e,Me(a,s),a||an)}},n[6],()=>!U(e)&&e in Ct?Ct[e]:!U(e)&&t.get(e)||an]};let ln=!0;const Zr=()=>ln,[fn,hn]=dt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[$e,$e],ei=()=>{const t=un&&document.visibilityState;return U(t)||t!=="hidden"},ti=t=>(un&&document.addEventListener("visibilitychange",t),fn("focus",t),()=>{un&&document.removeEventListener("visibilitychange",t),hn("focus",t)}),ni=t=>{const e=()=>{ln=!0,t()},n=()=>{ln=!1};return fn("online",e),fn("offline",n),()=>{hn("online",e),hn("offline",n)}},si={isOnline:Zr,isVisible:ei},ri={initFocus:ti,initReconnect:ni},Os=!S.useId,pt=!dt||Yr,ii=t=>Qr()?window.requestAnimationFrame(t):setTimeout(t,1),mt=pt?S.useEffect:S.useLayoutEffect,dn=typeof navigator<"u"&&navigator.connection,Cs=!pt&&dn&&(["slow-2g","2g"].includes(dn.effectiveType)||dn.saveData),xt=new WeakMap,oi=t=>Ot.prototype.toString.call(t),pn=(t,e)=>t===`[object ${e}]`;let ai=0;const mn=t=>{const e=typeof t,n=oi(t),s=pn(n,"Date"),a=pn(n,"RegExp"),c=pn(n,"Object");let o,h;if(Ot(t)===t&&!s&&!a){if(o=xt.get(t),o)return o;if(o=++ai+"~",xt.set(t,o),Array.isArray(t)){for(o="@",h=0;h<t.length;h++)o+=mn(t[h])+",";xt.set(t,o)}if(c){o="#";const f=Ot.keys(t).sort();for(;!U(h=f.pop());)U(t[h])||(o+=h+":"+mn(t[h])+",");xt.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},it=t=>{if(_e(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?mn(t):"",[t,e]};let ci=0;const yn=()=>++ci;async function xs(...t){const[e,n,s,a]=t,c=Me({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let o=c.populateCache;const h=c.rollbackOnError;let f=c.optimisticData;const l=E=>typeof h=="function"?h(E):h!==!1,m=c.throwOnError;if(_e(n)){const E=n,y=[],_=e.keys();for(const O of _)!/^\$(inf|sub)\$/.test(O)&&E(e.get(O)._k)&&y.push(O);return Promise.all(y.map(b))}return b(n);async function b(E){const[y]=it(E);if(!y)return;const[_,O]=He(e,y),[I,R,K,G]=Re.get(e),H=()=>{const W=I[y];return(_e(c.revalidate)?c.revalidate(_().data,E):c.revalidate!==!1)&&(delete K[y],delete G[y],W&&W[0])?W[0](_s).then(()=>_().data):_().data};if(t.length<3)return H();let j=s,Z,pe=!1;const P=yn();R[y]=[P,0];const le=!U(f),V=_(),ae=V.data,Pe=V._c,me=U(Pe)?ae:Pe;if(le&&(f=_e(f)?f(me,ae):f,O({data:f,_c:me})),_e(j))try{j=j(me)}catch(W){Z=W,pe=!0}if(j&&Ts(j))if(j=await j.catch(W=>{Z=W,pe=!0}),P!==R[y][0]){if(pe)throw Z;return j}else pe&&le&&l(Z)&&(o=!0,O({data:me,_c:Y}));if(o&&!pe)if(_e(o)){const W=o(j,me);O({data:W,error:Y,_c:Y})}else O({data:j,error:Y,_c:Y});if(R[y][1]=yn(),Promise.resolve(H()).then(()=>{O({_c:Y})}),pe){if(m)throw Z;return}return j}}const As=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Rs=(t,e)=>{if(!Re.has(t)){const n=Me(ri,e),s=Object.create(null),a=xs.bind(Y,t);let c=$e;const o=Object.create(null),h=(m,b)=>{const E=o[m]||[];return o[m]=E,E.push(b),()=>E.splice(E.indexOf(b),1)},f=(m,b,E)=>{t.set(m,b);const y=o[m];if(y)for(const _ of y)_(b,E)},l=()=>{if(!Re.has(t)&&(Re.set(t,[s,Object.create(null),Object.create(null),Object.create(null),a,f,h]),!pt)){const m=n.initFocus(setTimeout.bind(Y,As.bind(Y,s,bs))),b=n.initReconnect(setTimeout.bind(Y,As.bind(Y,s,vs)));c=()=>{m&&m(),b&&b(),Re.delete(t)}}};return l(),[t,a,l,c]}return[t,Re.get(t)[4]]},ui=(t,e,n,s,a)=>{const c=n.errorRetryCount,o=a.retryCount,h=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!U(c)&&o>c||setTimeout(s,h,a)},li=on,[yt,fi]=Rs(new Map),ks=Me({onLoadingSlow:$e,onSuccess:$e,onError:$e,onErrorRetry:ui,onDiscarded:$e,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Cs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Cs?5e3:3e3,compare:li,isPaused:()=>!1,cache:yt,mutate:fi,fallback:{}},si),Ds=(t,e)=>{const n=Me(t,e);if(e){const{use:s,fallback:a}=t,{use:c,fallback:o}=e;s&&c&&(n.use=s.concat(c)),a&&o&&(n.fallback=Me(a,o))}return n},gn=S.createContext({}),hi=t=>{const{value:e}=t,n=S.useContext(gn),s=_e(e),a=S.useMemo(()=>s?e(n):e,[s,n,e]),c=S.useMemo(()=>s?a:Ds(n,a),[s,n,a]),o=a&&a.provider,h=S.useRef(Y);o&&!h.current&&(h.current=Rs(o(c.cache||yt),a));const f=h.current;return f&&(c.cache=f[0],c.mutate=f[1]),mt(()=>{if(f)return f[2]&&f[2](),f[3]},[]),S.createElement(gn.Provider,Me(t,{value:c}))},Ls="$inf$",Fs=dt&&window.__SWR_DEVTOOLS_USE__,di=Fs?window.__SWR_DEVTOOLS_USE__:[],pi=()=>{Fs&&(window.__SWR_DEVTOOLS_REACT__=S)},Ns=t=>_e(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Bs=()=>{const t=S.useContext(gn);return S.useMemo(()=>Me(ks,t),[t])},gt=(t,e)=>{const[n,s]=it(t),[,,,a]=Re.get(yt);if(a[n])return a[n];const c=e(s);return a[n]=c,c},mi=t=>(e,n,s)=>t(e,n&&((...c)=>{const[o]=it(e),[,,,h]=Re.get(yt);if(o.startsWith(Ls))return n(...c);const f=h[o];return U(f)?n(...c):(delete h[o],f)}),s),yi=di.concat(mi),gi=t=>function(...n){const s=Bs(),[a,c,o]=Ns(n),h=Ds(s,o);let f=t;const{use:l}=h,m=(l||[]).concat(yi);for(let b=m.length;b--;)f=m[b](f);return f(a,c||h.fetcher||null,h)},wi=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const a=s.indexOf(n);a>=0&&(s[a]=s[s.length-1],s.pop())}},bi=(t,e)=>(...n)=>{const[s,a,c]=Ns(n),o=(c.use||[]).concat(e);return t(s,a,{...c,use:o})};pi();const wn=S.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),bn={dedupe:!0},Ps=Promise.resolve(Y),vi=(t,e,n)=>{const{cache:s,compare:a,suspense:c,fallbackData:o,revalidateOnMount:h,revalidateIfStale:f,refreshInterval:l,refreshWhenHidden:m,refreshWhenOffline:b,keepPreviousData:E}=n,[y,_,O,I]=Re.get(s),[R,K]=it(t),G=S.useRef(!1),H=S.useRef(!1),j=S.useRef(R),Z=S.useRef(e),pe=S.useRef(n),P=()=>pe.current,le=()=>P().isVisible()&&P().isOnline(),[V,ae,Pe,me]=He(s,R),W=S.useRef({}).current,ge=U(o)?U(n.fallback)?Y:n.fallback[R]:o,we=(M,z)=>{for(const ne in W){const $=ne;if($==="data"){if(!a(M[$],z[$])&&(!U(M[$])||!a(et,z[$])))return!1}else if(z[$]!==M[$])return!1}return!0},ee=S.useMemo(()=>{const M=!R||!e?!1:U(h)?P().isPaused()||c?!1:f!==!1:h,z=ue=>{const De=Me(ue);return delete De._k,M?{isValidating:!0,isLoading:!0,...De}:De},ne=V(),$=me(),be=z(ne),Je=ne===$?be:z($);let ie=be;return[()=>{const ue=z(V());return we(ue,ie)?(ie.data=ue.data,ie.isLoading=ue.isLoading,ie.isValidating=ue.isValidating,ie.error=ue.error,ie):(ie=ue,ue)},()=>Je]},[s,R]),te=ws.useSyncExternalStore(S.useCallback(M=>Pe(R,(z,ne)=>{we(ne,z)||M()}),[s,R]),ee[0],ee[1]),Ve=!G.current,Ze=y[R]&&y[R].length>0,Ue=te.data,re=U(Ue)?ge&&Ts(ge)?wn(ge):ge:Ue,We=te.error,ze=S.useRef(re),et=E?U(Ue)?U(ze.current)?re:ze.current:Ue:re,at=Ze&&!U(We)?!1:Ve&&!U(h)?h:P().isPaused()?!1:c?U(re)?!1:f:U(re)||f,It=!!(R&&e&&Ve&&at),In=U(te.isValidating)?It:te.isValidating,jn=U(te.isLoading)?It:te.isLoading,tt=S.useCallback(async M=>{const z=Z.current;if(!R||!z||H.current||P().isPaused())return!1;let ne,$,be=!0;const Je=M||{},ie=!O[R]||!Je.dedupe,ue=()=>Os?!H.current&&R===j.current&&G.current:R===j.current,De={isValidating:!1,isLoading:!1},Mt=()=>{ae(De)},_t=()=>{const ve=O[R];ve&&ve[1]===$&&delete O[R]},Vt={isValidating:!0};U(V().data)&&(Vt.isLoading=!0);try{if(ie&&(ae(Vt),n.loadingTimeout&&U(V().data)&&setTimeout(()=>{be&&ue()&&P().onLoadingSlow(R,n)},n.loadingTimeout),O[R]=[z(K),yn()]),[ne,$]=O[R],ne=await ne,ie&&setTimeout(_t,n.dedupingInterval),!O[R]||O[R][1]!==$)return ie&&ue()&&P().onDiscarded(R),!1;De.error=Y;const ve=_[R];if(!U(ve)&&($<=ve[0]||$<=ve[1]||ve[1]===0))return Mt(),ie&&ue()&&P().onDiscarded(R),!1;const v=V().data;De.data=a(v,ne)?v:ne,ie&&ue()&&P().onSuccess(ne,R,n)}catch(ve){_t();const v=P(),{shouldRetryOnError:N}=v;v.isPaused()||(De.error=ve,ie&&ue()&&(v.onError(ve,R,v),(N===!0||_e(N)&&N(ve))&&(!P().revalidateOnFocus||!P().revalidateOnReconnect||le())&&v.onErrorRetry(ve,R,v,$t=>{const ct=y[R];ct&&ct[0]&&ct[0](Ss,$t)},{retryCount:(Je.retryCount||0)+1,dedupe:!0})))}return be=!1,Mt(),!0},[R,s]),jt=S.useCallback((...M)=>xs(s,j.current,...M),[]);if(mt(()=>{Z.current=e,pe.current=n,U(Ue)||(ze.current=Ue)}),mt(()=>{if(!R)return;const M=tt.bind(Y,bn);let z=0;P().revalidateOnFocus&&(z=Date.now()+P().focusThrottleInterval);const $=wi(R,y,(be,Je={})=>{if(be==bs){const ie=Date.now();P().revalidateOnFocus&&ie>z&&le()&&(z=ie+P().focusThrottleInterval,M())}else if(be==vs)P().revalidateOnReconnect&&le()&&M();else{if(be==_s)return tt();if(be==Ss)return tt(Je)}});return H.current=!1,j.current=R,G.current=!0,ae({_k:K}),at&&(O[R]||(U(re)||pt?M():ii(M))),()=>{H.current=!0,$()}},[R]),mt(()=>{let M;function z(){const $=_e(l)?l(V().data):l;$&&M!==-1&&(M=setTimeout(ne,$))}function ne(){!V().error&&(m||P().isVisible())&&(b||P().isOnline())?tt(bn).then(z):z()}return z(),()=>{M&&(clearTimeout(M),M=-1)}},[l,m,b,R]),S.useDebugValue(et),c){const M=R&&U(re);if(!Os&&pt&&M)throw new Error("Fallback data is required when using Suspense in SSR.");M&&(Z.current=e,pe.current=n,H.current=!1);const z=I[R],ne=!U(z)&&M?jt(z):Ps;if(wn(ne),!U(We)&&M)throw We;const $=M?tt(bn):Ps;!U(et)&&M&&($.status="fulfilled",$.value=!0),wn($)}return{mutate:jt,get data(){return W.data=!0,et},get error(){return W.error=!0,We},get isValidating(){return W.isValidating=!0,In},get isLoading(){return W.isLoading=!0,jn}}},_i=Ot.defineProperty(hi,"defaultValue",{value:ks}),Qe=gi(vi),Si=void 0,vn=Object,Us=t=>t===Si,Ei=t=>typeof t=="function",At=new WeakMap,Ti=t=>vn.prototype.toString.call(t),_n=(t,e)=>t===`[object ${e}]`;let Oi=0;const Sn=t=>{const e=typeof t,n=Ti(t),s=_n(n,"Date"),a=_n(n,"RegExp"),c=_n(n,"Object");let o,h;if(vn(t)===t&&!s&&!a){if(o=At.get(t),o)return o;if(o=++Oi+"~",At.set(t,o),Array.isArray(t)){for(o="@",h=0;h<t.length;h++)o+=Sn(t[h])+",";At.set(t,o)}if(c){o="#";const f=vn.keys(t).sort();for(;!Us(h=f.pop());)Us(t[h])||(o+=h+":"+Sn(t[h])+",");At.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},Ci=t=>{if(Ei(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Sn(t):"",[t,e]},xi=t=>Ci(t?t(0,null):null)[0],En=Promise.resolve(),Ai=bi(Qe,t=>(e,n,s)=>{const a=S.useRef(!1),{cache:c,initialSize:o=1,revalidateAll:h=!1,persistSize:f=!1,revalidateFirstPage:l=!0,revalidateOnMount:m=!1,parallel:b=!1}=s,[,,,E]=Re.get(yt);let y;try{y=xi(e),y&&(y=Ls+y)}catch{}const[_,O,I]=He(c,y),R=S.useCallback(()=>U(_()._l)?o:_()._l,[c,y,o]);ws.useSyncExternalStore(S.useCallback(P=>y?I(y,()=>{P()}):()=>{},[c,y]),R,R);const K=S.useCallback(()=>{const P=_()._l;return U(P)?o:P},[y,o]),G=S.useRef(K());mt(()=>{if(!a.current){a.current=!0;return}y&&O({_l:f?G.current:K()})},[y,c]);const H=m&&!a.current,j=t(y,async P=>{const le=_()._i,V=_()._r;O({_r:Y});const ae=[],Pe=K(),[me]=He(c,P),W=me().data,ge=[];let we=null;for(let ee=0;ee<Pe;++ee){const[te,Ve]=it(e(ee,b?null:we));if(!te)break;const[Ze,Ue]=He(c,te);let re=Ze().data;const We=h||le||U(re)||l&&!ee&&!U(W)||H||W&&!U(W[ee])&&!s.compare(W[ee],re);if(n&&(typeof V=="function"?V(re,Ve):We)){const ze=async()=>{if(!(te in E))re=await n(Ve);else{const at=E[te];delete E[te],re=await at}Ue({data:re,_k:Ve}),ae[ee]=re};b?ge.push(ze):await ze()}else ae[ee]=re;b||(we=re)}return b&&await Promise.all(ge.map(ee=>ee())),O({_i:Y}),ae},s),Z=S.useCallback(function(P,le){const V=typeof le=="boolean"?{revalidate:le}:le||{},ae=V.revalidate!==!1;return y?(ae&&(U(P)?O({_i:!0,_r:V.revalidate}):O({_i:!1,_r:V.revalidate})),arguments.length?j.mutate(P,{...V,revalidate:ae}):j.mutate()):En},[y,c]),pe=S.useCallback(P=>{if(!y)return En;const[,le]=He(c,y);let V;if(_e(P)?V=P(K()):typeof P=="number"&&(V=P),typeof V!="number")return En;le({_l:V}),G.current=V;const ae=[],[Pe]=He(c,y);let me=null;for(let W=0;W<V;++W){const[ge]=it(e(W,me)),[we]=He(c,ge),ee=ge?we().data:Y;if(U(ee))return Z(Pe().data);ae.push(ee),me=ee}return Z(ae)},[y,c,Z,K]);return{size:K(),setSize:pe,mutate:Z,get data(){return j.data},get error(){return j.error},get isValidating(){return j.isValidating},get isLoading(){return j.isLoading}}}),Ne=Object.create(null);Ne.open="0",Ne.close="1",Ne.ping="2",Ne.pong="3",Ne.message="4",Ne.upgrade="5",Ne.noop="6";const Rt=Object.create(null);Object.keys(Ne).forEach(t=>{Rt[Ne[t]]=t});const Tn={type:"error",data:"parser error"},qs=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Is=typeof ArrayBuffer=="function",js=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,On=({type:t,data:e},n,s)=>qs&&e instanceof Blob?n?s(e):Ms(e,s):Is&&(e instanceof ArrayBuffer||js(e))?n?s(e):Ms(new Blob([e]),s):s(Ne[t]+(e||"")),Ms=(t,e)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];e("b"+(s||""))},n.readAsDataURL(t)};function Vs(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Cn;function Ri(t,e){if(qs&&t.data instanceof Blob)return t.data.arrayBuffer().then(Vs).then(e);if(Is&&(t.data instanceof ArrayBuffer||js(t.data)))return e(Vs(t.data));On(t,!1,n=>{Cn||(Cn=new TextEncoder),e(Cn.encode(n))})}const $s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<$s.length;t++)wt[$s.charCodeAt(t)]=t;const ki=t=>{let e=t.length*.75,n=t.length,s,a=0,c,o,h,f;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),m=new Uint8Array(l);for(s=0;s<n;s+=4)c=wt[t.charCodeAt(s)],o=wt[t.charCodeAt(s+1)],h=wt[t.charCodeAt(s+2)],f=wt[t.charCodeAt(s+3)],m[a++]=c<<2|o>>4,m[a++]=(o&15)<<4|h>>2,m[a++]=(h&3)<<6|f&63;return l},Di=typeof ArrayBuffer=="function",xn=(t,e)=>{if(typeof t!="string")return{type:"message",data:Hs(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Li(t.substring(1),e)}:Rt[n]?t.length>1?{type:Rt[n],data:t.substring(1)}:{type:Rt[n]}:Tn},Li=(t,e)=>{if(Di){const n=ki(t);return Hs(n,e)}else return{base64:!0,data:t}},Hs=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Ws="",Fi=(t,e)=>{const n=t.length,s=new Array(n);let a=0;t.forEach((c,o)=>{On(c,!1,h=>{s[o]=h,++a===n&&e(s.join(Ws))})})},Ni=(t,e)=>{const n=t.split(Ws),s=[];for(let a=0;a<n.length;a++){const c=xn(n[a],e);if(s.push(c),c.type==="error")break}return s};function Bi(){return new TransformStream({transform(t,e){Ri(t,n=>{const s=n.length;let a;if(s<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,s);else if(s<65536){a=new Uint8Array(3);const c=new DataView(a.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{a=new Uint8Array(9);const c=new DataView(a.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(n)})}})}let An;function kt(t){return t.reduce((e,n)=>e+n.length,0)}function Dt(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let s=0;for(let a=0;a<e;a++)n[a]=t[0][s++],s===t[0].length&&(t.shift(),s=0);return t.length&&s<t[0].length&&(t[0]=t[0].slice(s)),n}function Pi(t,e){An||(An=new TextDecoder);const n=[];let s=0,a=-1,c=!1;return new TransformStream({transform(o,h){for(n.push(o);;){if(s===0){if(kt(n)<1)break;const f=Dt(n,1);c=(f[0]&128)===128,a=f[0]&127,a<126?s=3:a===126?s=1:s=2}else if(s===1){if(kt(n)<2)break;const f=Dt(n,2);a=new DataView(f.buffer,f.byteOffset,f.length).getUint16(0),s=3}else if(s===2){if(kt(n)<8)break;const f=Dt(n,8),l=new DataView(f.buffer,f.byteOffset,f.length),m=l.getUint32(0);if(m>Math.pow(2,21)-1){h.enqueue(Tn);break}a=m*Math.pow(2,32)+l.getUint32(4),s=3}else{if(kt(n)<a)break;const f=Dt(n,a);h.enqueue(xn(c?f:An.decode(f),e)),s=0}if(a===0||a>t){h.enqueue(Tn);break}}}})}const zs=4;function Q(t){if(t)return Ui(t)}function Ui(t){for(var e in Q.prototype)t[e]=Q.prototype[e];return t}Q.prototype.on=Q.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Q.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},Q.prototype.off=Q.prototype.removeListener=Q.prototype.removeAllListeners=Q.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var s,a=0;a<n.length;a++)if(s=n[a],s===e||s.fn===e){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+t],this},Q.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,a=n.length;s<a;++s)n[s].apply(this,e)}return this},Q.prototype.emitReserved=Q.prototype.emit,Q.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Q.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Se=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Js(t,...e){return e.reduce((n,s)=>(t.hasOwnProperty(s)&&(n[s]=t[s]),n),{})}const qi=Se.setTimeout,Ii=Se.clearTimeout;function Lt(t,e){e.useNativeTimers?(t.setTimeoutFn=qi.bind(Se),t.clearTimeoutFn=Ii.bind(Se)):(t.setTimeoutFn=Se.setTimeout.bind(Se),t.clearTimeoutFn=Se.clearTimeout.bind(Se))}const ji=1.33;function Mi(t){return typeof t=="string"?Vi(t):Math.ceil((t.byteLength||t.size)*ji)}function Vi(t){let e=0,n=0;for(let s=0,a=t.length;s<a;s++)e=t.charCodeAt(s),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(s++,n+=4);return n}function $i(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Hi(t){let e={},n=t.split("&");for(let s=0,a=n.length;s<a;s++){let c=n[s].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class Wi extends Error{constructor(e,n,s){super(e),this.description=n,this.context=s,this.type="TransportError"}}class Rn extends Q{constructor(e){super(),this.writable=!1,Lt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,s){return super.emitReserved("error",new Wi(e,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=xn(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=$i(e);return n.length?"?"+n:""}}const Ks="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),kn=64,zi={};let Gs=0,Ft=0,Xs;function Ys(t){let e="";do e=Ks[t%kn]+e,t=Math.floor(t/kn);while(t>0);return e}function Qs(){const t=Ys(+new Date);return t!==Xs?(Gs=0,Xs=t):t+"."+Ys(Gs++)}for(;Ft<kn;Ft++)zi[Ks[Ft]]=Ft;let Zs=!1;try{Zs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ji=Zs;function er(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ji))return new XMLHttpRequest}catch{}if(!e)try{return new Se[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ba(){}function Ki(){}const Gi=function(){return new er({xdomain:!1}).responseType!=null}();class Xi extends Rn{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||a!==e.port}const n=e&&e.forceBase64;this.supportsBinary=Gi&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let s=0;this.polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Ni(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Fi(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Qs()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Be(this.uri(),e)}doWrite(e,n){const s=this.request({method:"POST",data:e});s.on("success",n),s.on("error",(a,c)=>{this.onError("xhr post error",a,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=e}}class Be extends Q{constructor(e,n){super(),Lt(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=Js(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const s=this.xhr=new er(n);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let a in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(a)&&s.setRequestHeader(a,this.opts.extraHeaders[a])}}catch{}if(this.method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var a;s.readyState===3&&((a=this.opts.cookieJar)===null||a===void 0||a.parseCookies(s)),s.readyState===4&&(s.status===200||s.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof s.status=="number"?s.status:0)},0))},s.send(this.data)}catch(a){this.setTimeoutFn(()=>{this.onError(a)},0);return}typeof document<"u"&&(this.index=Be.requestsCount++,Be.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Ki,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Be.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Be.requestsCount=0,Be.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",tr);else if(typeof addEventListener=="function"){const t="onpagehide"in Se?"pagehide":"unload";addEventListener(t,tr,!1)}}function tr(){for(let t in Be.requests)Be.requests.hasOwnProperty(t)&&Be.requests[t].abort()}const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Nt=Se.WebSocket||Se.MozWebSocket,nr=!0,Yi="arraybuffer",sr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Qi extends Rn{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,s=sr?{}:Js(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=nr&&!sr?n?new Nt(e,n):new Nt(e):new Nt(e,n,s)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;On(s,this.supportsBinary,c=>{const o={};try{nr&&this.ws.send(c)}catch{}a&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Qs()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}check(){return!!Nt}}class Zi extends Rn{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const n=Pi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(n).getReader(),a=Bi();a.readable.pipeTo(e.writable),this.writer=a.writable.getWriter();const c=()=>{s.read().then(({done:h,value:f})=>{h||(this.onPacket(f),c())}).catch(h=>{})};c();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;this.writer.write(s).then(()=>{a&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const eo={websocket:Qi,webtransport:Zi,polling:Xi},to=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,no=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ln(t){if(t.length>2e3)throw"URI too long";const e=t,n=t.indexOf("["),s=t.indexOf("]");n!=-1&&s!=-1&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));let a=to.exec(t||""),c={},o=14;for(;o--;)c[no[o]]=a[o]||"";return n!=-1&&s!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=so(c,c.path),c.queryKey=ro(c,c.query),c}function so(t,e){const n=/\/{2,9}/g,s=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function ro(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,a,c){a&&(n[a]=c)}),n}let rr=class ft extends Q{constructor(e,n={}){super(),this.binaryType=Yi,this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Ln(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Ln(n.host).host),Lt(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Hi(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=zs,n.transport=e,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new eo[e](s)}open(){let e;if(this.opts.rememberUpgrade&&ft.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),s=!1;ft.priorWebsocketSuccess=!1;const a=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ft.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const E=new Error("probe error");E.transport=n.name,this.emitReserved("upgradeError",E)}}))};function c(){s||(s=!0,m(),n.close(),n=null)}const o=b=>{const E=new Error("probe error: "+b);E.transport=n.name,c(),this.emitReserved("upgradeError",E)};function h(){o("transport closed")}function f(){o("socket closed")}function l(b){n&&b.name!==n.name&&c()}const m=()=>{n.removeListener("open",a),n.removeListener("error",o),n.removeListener("close",h),this.off("close",f),this.off("upgrading",l)};n.once("open",a),n.once("error",o),n.once("close",h),this.once("close",f),this.once("upgrading",l),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onOpen(){if(this.readyState="open",ft.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const a=this.writeBuffer[s].data;if(a&&(n+=Mi(a)),s>0&&n>this.maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}write(e,n,s){return this.sendPacket("message",e,n,s),this}send(e,n,s){return this.sendPacket("message",e,n,s),this}sendPacket(e,n,s,a){if(typeof n=="function"&&(a=n,n=void 0),typeof s=="function"&&(a=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:e,data:n,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}onError(e){ft.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let s=0;const a=e.length;for(;s<a;s++)~this.transports.indexOf(e[s])&&n.push(e[s]);return n}};rr.protocol=zs;function io(t,e="",n){let s=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),s=Ln(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+e,s.href=s.protocol+"://"+c+(n&&n.port===s.port?"":":"+s.port),s}const oo=typeof ArrayBuffer=="function",ao=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,co=typeof Blob=="function"||typeof Blob<"u"&&ir.call(Blob)==="[object BlobConstructor]",uo=typeof File=="function"||typeof File<"u"&&ir.call(File)==="[object FileConstructor]";function Fn(t){return oo&&(t instanceof ArrayBuffer||ao(t))||co&&t instanceof Blob||uo&&t instanceof File}function Bt(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,s=t.length;n<s;n++)if(Bt(t[n]))return!0;return!1}if(Fn(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Bt(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Bt(t[n]))return!0;return!1}function lo(t){const e=[],n=t.data,s=t;return s.data=Nn(n,e),s.attachments=e.length,{packet:s,buffers:e}}function Nn(t,e){if(!t)return t;if(Fn(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=Nn(t[s],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=Nn(t[s],e));return n}return t}function fo(t,e){return t.data=Bn(t.data,e),delete t.attachments,t}function Bn(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Bn(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Bn(t[n],e));return t}const ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],po=5;var q;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(q||(q={}));class mo{constructor(e){this.replacer=e}encode(e){return(e.type===q.EVENT||e.type===q.ACK)&&Bt(e)?this.encodeAsBinary({type:e.type===q.EVENT?q.BINARY_EVENT:q.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===q.BINARY_EVENT||e.type===q.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=lo(e),s=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(s),a}}function or(t){return Object.prototype.toString.call(t)==="[object Object]"}class Pn extends Q{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const s=n.type===q.BINARY_EVENT;s||n.type===q.BINARY_ACK?(n.type=s?q.EVENT:q.ACK,this.reconstructor=new yo(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Fn(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const s={type:Number(e.charAt(0))};if(q[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===q.BINARY_EVENT||s.type===q.BINARY_ACK){const c=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const o=e.substring(c,n);if(o!=Number(o)||e.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(n+1)==="/"){const c=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););s.nsp=e.substring(c,n)}else s.nsp="/";const a=e.charAt(n+1);if(a!==""&&Number(a)==a){const c=n+1;for(;++n;){const o=e.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===e.length)break}s.id=Number(e.substring(c,n+1))}if(e.charAt(++n)){const c=this.tryParse(e.substr(n));if(Pn.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case q.CONNECT:return or(n);case q.DISCONNECT:return n===void 0;case q.CONNECT_ERROR:return typeof n=="string"||or(n);case q.EVENT:case q.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ho.indexOf(n[0])===-1);case q.ACK:case q.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class yo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=fo(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const go=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Pn,Encoder:mo,get PacketType(){return q},protocol:po},Symbol.toStringTag,{value:"Module"}));function ke(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const wo=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ar extends Q{constructor(e,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ke(e,"open",this.onopen.bind(this)),ke(e,"packet",this.onpacket.bind(this)),ke(e,"error",this.onerror.bind(this)),ke(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(wo.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:q.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const o=this.ids++,h=n.pop();this._registerAckCallback(o,h),s.id=o}const a=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!a||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,n){var s;const a=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(a===void 0){this.acks[e]=n;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},a);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(c),n.apply(this,[null,...o])}}emitWithAck(e,...n){const s=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((a,c)=>{n.push((o,h)=>s?o?c(o):a(h):a(o)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...c)=>s!==this._queue[0]?void 0:(a!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:q.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case q.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case q.EVENT:case q.BINARY_EVENT:this.onevent(e);break;case q.ACK:case q.BINARY_ACK:this.onack(e);break;case q.DISCONNECT:this.ondisconnect();break;case q.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let s=!1;return function(...a){s||(s=!0,n.packet({type:q.ACK,id:e,data:a}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:q.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,e.data)}}}function ot(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}ot.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0},ot.prototype.reset=function(){this.attempts=0},ot.prototype.setMin=function(t){this.ms=t},ot.prototype.setMax=function(t){this.max=t},ot.prototype.setJitter=function(t){this.jitter=t};class Un extends Q{constructor(e,n){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Lt(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new ot({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const a=n.parser||go;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new rr(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const a=ke(n,"open",function(){s.onopen(),e&&e()}),c=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},o=ke(n,"error",c);if(this._timeout!==!1){const h=this._timeout,f=this.setTimeoutFn(()=>{a(),c(new Error("timeout")),n.close()},h);this.opts.autoUnref&&f.unref(),this.subs.push(()=>{this.clearTimeoutFn(f)})}return this.subs.push(a),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ke(e,"ping",this.onping.bind(this)),ke(e,"data",this.ondata.bind(this)),ke(e,"error",this.onerror.bind(this)),ke(e,"close",this.onclose.bind(this)),ke(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ar(this,e,n),this.nsps[e]=s),s}_destroy(e){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let s=0;s<n.length;s++)this.engine.write(n[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const bt={};function Pt(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=io(t,e.path||"/socket.io"),s=n.source,a=n.id,c=n.path,o=bt[a]&&c in bt[a].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let f;return h?f=new Un(s,e):(bt[a]||(bt[a]=new Un(s,e)),f=bt[a]),n.query&&!e.query&&(e.query=n.queryKey),f.socket(n.path,e)}Object.assign(Pt,{Manager:Un,Socket:ar,io:Pt,connect:Pt});class bo{constructor(e,n,s,a){Xe(this,"socket_port");Xe(this,"host");Xe(this,"port");Xe(this,"protocol");Xe(this,"url");Xe(this,"site_name");Xe(this,"socket");var c,o,h,f;if(this.socket_port=s??"9000",this.host=(c=window.location)==null?void 0:c.hostname,this.port=(o=window.location)!=null&&o.port?`:${this.socket_port}`:"",this.protocol=((h=window.location)==null?void 0:h.protocol)==="https:"?"https":"http",e){let l=new URL(e);l.port="",s?(l.port=s,this.url=l.toString()):this.url=l.toString()}else this.url=`${this.protocol}://${this.host}${this.port}/`;n&&(this.url=`${this.url}${n}`),this.site_name=n,this.socket=Pt(`${this.url}`,{withCredentials:!0,secure:this.protocol==="https",extraHeaders:a&&a.useToken===!0?{Authorization:`${a.type} ${(f=a.token)==null?void 0:f.call(a)}`}:{}})}}const X=S.createContext(null),vo=({url:t="",tokenParams:e,socketPort:n,swrConfig:s,siteName:a,enableSocket:c=!0,children:o,customHeaders:h})=>{const f=S.useMemo(()=>{const l=new Jr.FrappeApp(t,e,void 0,h);return{url:t,tokenParams:e,app:l,auth:l.auth(),db:l.db(),call:l.call(),file:l.file(),socket:c?new bo(t,a,n,e).socket:void 0,enableSocket:c,socketPort:n}},[t,e,n,c,h]);return de.jsx(X.Provider,{value:f,children:de.jsx(_i,{value:s,children:o})})},_o=t=>{const{url:e,auth:n,tokenParams:s}=S.useContext(X),[a,c]=S.useState(),o=S.useCallback(()=>{const _=document.cookie.split(";").find(O=>O.trim().startsWith("user_id="));if(_){const O=_.split("=")[1];c(O&&O!=="Guest"?O:null)}else c(null)},[]);S.useEffect(()=>{s&&s.useToken?c(null):o()},[]);const{data:h,error:f,isLoading:l,isValidating:m,mutate:b}=Qe(()=>s&&s.useToken||a?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>n.getLoggedInUser(),{onError:()=>{c(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...t}),E=S.useCallback(async _=>n.loginWithUsernamePassword(_).then(O=>(o(),O)),[]),y=S.useCallback(async()=>n.logout().then(()=>b(null)).then(()=>c(null)),[]);return{isLoading:a===void 0||l,currentUser:h,isValidating:m,error:f,login:E,logout:y,updateCurrentUser:b,getUserCookie:o}},vt=(t,e,n)=>{let s=`${e}/api/resource/`;return n?s+=`${t}/${n}`:s+=`${t}`,s},So=(t,e,n,s)=>{const{url:a,db:c}=S.useContext(X);return Qe(n===void 0?vt(t,a,e):n,()=>c.getDoc(t,e),s)},Eo=(t,e,n,s)=>{const{db:a,url:c}=S.useContext(X),o=n===void 0?vt(t,c,e):n;return S.useCallback(()=>{gt(o,()=>a.getDoc(t,e))},[o,t,e])},qn=t=>{var n,s;let e="";if(t!=null&&t.fields&&(e+="fields="+JSON.stringify(t==null?void 0:t.fields)+"&"),t!=null&&t.filters&&(e+="filters="+JSON.stringify(t==null?void 0:t.filters)+"&"),t!=null&&t.orFilters&&(e+="or_filters="+JSON.stringify(t==null?void 0:t.orFilters)+"&"),t!=null&&t.limit_start&&(e+="limit_start="+JSON.stringify(t==null?void 0:t.limit_start)+"&"),t!=null&&t.limit&&(e+="limit="+JSON.stringify(t==null?void 0:t.limit)+"&"),t!=null&&t.groupBy&&(e+="group_by="+String(t.groupBy)+"&"),t!=null&&t.orderBy){const a=`${String((n=t.orderBy)==null?void 0:n.field)} ${((s=t.orderBy)==null?void 0:s.order)??"asc"}`;e+="order_by="+a+"&"}return t!=null&&t.asDict&&(e+="as_dict="+t.asDict),e},To=(t,e,n,s)=>{const{url:a,db:c}=S.useContext(X);return Qe(n===void 0?`${vt(t,a)}?${qn(e)}`:n,()=>c.getDocList(t,e),s)},Oo=(t,e,n)=>{const{db:s,url:a}=S.useContext(X),c=n===void 0?`${vt(t,a)}?${qn(e)}`:n;return S.useCallback(()=>{gt(c,()=>s.getDocList(t,e))},[c,t,e])},Co=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{createDoc:S.useCallback(async(l,m)=>(a(null),o(!1),n(!0),t.createDoc(l,m).then(b=>(n(!1),o(!0),b)).catch(b=>{throw n(!1),o(!1),a(b),b})),[]),loading:e,error:s,isCompleted:c,reset:h}},xo=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{updateDoc:S.useCallback(async(l,m,b)=>(a(null),o(!1),n(!0),t.updateDoc(l,m,b).then(E=>(n(!1),o(!0),E)).catch(E=>{throw n(!1),o(!1),a(E),E})),[]),loading:e,error:s,reset:h,isCompleted:c}},Ao=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{deleteDoc:S.useCallback(async(l,m)=>(a(null),o(!1),n(!0),t.deleteDoc(l,m).then(b=>(n(!1),o(!0),b)).catch(b=>{throw n(!1),o(!1),a(b),b})),[]),loading:e,error:s,reset:h,isCompleted:c}};function Ut(t){const e=[];for(let n in t)e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}const Ro=(t,e,n=!1,s=!1,a,c)=>{const{url:o,db:h}=S.useContext(X);return Qe(a===void 0?(()=>{const m=Ut(n?{doctype:t,filters:e??[],cache:n,debug:s}:{doctype:t,filters:e??[],debug:s});return`${o}/api/method/frappe.client.get_count?${m}`})():a,()=>h.getCount(t,e,n,s),c)},ko=(t,e,n=!1,s=!1,a)=>{const{db:c,url:o}=S.useContext(X),h=a===void 0?`${o}/api/method/frappe.client.get_count?${Ut({doctype:t,filters:e??[],cache:n,debug:s})}`:a;return S.useCallback(()=>{gt(h,()=>c.getCount(t,e,!1,!1))},[h,t,e])},cr=(t,e,n,s,a="GET")=>{const{call:c}=S.useContext(X),o=Ut(e??{}),h=`${t}?${o}`;return{...Qe(n===void 0?h:n,a==="GET"?()=>c.get(t,e):()=>c.post(t,e),s)}},Do=(t,e,n,s="GET")=>{const{call:a}=S.useContext(X),c=Ut(e??{}),o=`${t}?${c}`;return S.useCallback(()=>{gt(n??o,s==="GET"?()=>a.get(t,e):()=>a.post(t,e))},[o,t,e,n])},Lo=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.post(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},Fo=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.put(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},No=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.delete(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},Bo=()=>{const{file:t}=S.useContext(X),[e,n]=S.useState(0),[s,a]=S.useState(!1),[c,o]=S.useState(null),[h,f]=S.useState(!1),l=S.useCallback(async(b,E,y)=>(m(),a(!0),t.uploadFile(b,E,(_,O)=>{O&&n(Math.round(_/O*100))},y).then(_=>(f(!0),n(100),a(!1),_.data.message)).catch(_=>{throw console.error(_),o(_),a(!1),_})),[]),m=S.useCallback(()=>{n(0),a(!1),o(null),f(!1)},[]);return{upload:l,progress:e,loading:s,isCompleted:h,error:c,reset:m}},Po=(t,e,n=[],s=20,a=250)=>{const c=Uo(e,a);return cr("frappe.desk.search.search_link",{doctype:t,page_length:s,txt:c,filters:JSON.stringify(n??[])})},Uo=(t,e)=>{const[n,s]=S.useState(t);return S.useEffect(()=>{const a=setTimeout(()=>{s(t)},e);return()=>{clearTimeout(a)}},[t,e]),n},qt=(t,e)=>{const{socket:n}=S.useContext(X);S.useEffect(()=>{n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider.");let s=n==null?void 0:n.on(t,e);return()=>{s==null||s.off(t)}},[t,e])},qo=(t,e,n,s=!0)=>{const{socket:a}=S.useContext(X),[c,o]=S.useState([]);S.useEffect(()=>(a===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),a==null||a.emit("doc_subscribe",t,e),a==null||a.io.on("reconnect",()=>{a==null||a.emit("doc_subscribe",t,e)}),s&&(a==null||a.emit("doc_open",t,e)),()=>{a==null||a.emit("doc_unsubscribe",t,e),s&&(a==null||a.emit("doc_close",t,e))}),[t,e,s]),qt("doc_update",n);const h=S.useCallback(()=>{a==null||a.emit("doc_open",t,e)},[t,e]),f=S.useCallback(()=>{a==null||a.emit("doc_close",t,e)},[t,e]),l=S.useCallback(m=>{m.doctype===t&&m.docname===e&&o(m.users)},[t,e]);return qt("doc_viewers",l),{viewers:c,emitDocOpen:h,emitDocClose:f}},Io=(t,e)=>{const{socket:n}=S.useContext(X);S.useEffect(()=>(n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),n==null||n.emit("doctype_subscribe",t),n==null||n.io.on("reconnect",()=>{n==null||n.emit("doctype_subscribe",t)}),()=>{n==null||n.emit("doctype_unsubscribe",t)}),[t]),qt("list_update",e)};B.FrappeContext=X,B.FrappeProvider=vo,B.getDocListQueryString=qn,B.getRequestURL=vt,B.preload=gt,B.useFrappeAuth=_o,B.useFrappeCreateDoc=Co,B.useFrappeDeleteCall=No,B.useFrappeDeleteDoc=Ao,B.useFrappeDocTypeEventListener=Io,B.useFrappeDocumentEventListener=qo,B.useFrappeEventListener=qt,B.useFrappeFileUpload=Bo,B.useFrappeGetCall=cr,B.useFrappeGetDoc=So,B.useFrappeGetDocCount=Ro,B.useFrappeGetDocList=To,B.useFrappePostCall=Lo,B.useFrappePrefetchCall=Do,B.useFrappePrefetchDoc=Eo,B.useFrappePrefetchDocCount=ko,B.useFrappePrefetchDocList=Oo,B.useFrappePutCall=Fo,B.useFrappeUpdateDoc=xo,B.useSWR=Qe,B.useSWRConfig=Bs,B.useSWRInfinite=Ai,B.useSearch=Po,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
*/var ys;function Gr(){return ys||(ys=1,process.env.NODE_ENV!=="production"&&function(){function t(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}function e(y,v){m||a.startTransition===void 0||(m=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var O=v();if(!b){var I=v();c(O,I)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),b=!0)}I=o({inst:{value:O,getSnapshot:v}});var R=I[0].inst,K=I[1];return f(function(){R.value=O,R.getSnapshot=v,n(R)&&K({inst:R})},[y,O,v]),h(function(){return n(R)&&K({inst:R}),y(function(){n(R)&&K({inst:R})})},[y]),l(O),O}function n(y){var v=y.getSnapshot;y=y.value;try{var O=v();return!c(y,O)}catch{return!0}}function s(y,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=S,c=typeof Object.is=="function"?Object.is:t,o=a.useState,h=a.useEffect,f=a.useLayoutEffect,l=a.useDebugValue,m=!1,b=!1,E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:e;rn.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:E,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),rn}var gs;function Xr(){return gs||(gs=1,process.env.NODE_ENV==="production"?Tt.exports=Kr():Tt.exports=Gr()),Tt.exports}var ws=Xr();const bs=0,_s=1,vs=2,Ss=3;var Es=Object.prototype.hasOwnProperty;function on(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&on(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(Es.call(t,n)&&++s&&!Es.call(e,n)||!(n in e)||!on(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const Re=new WeakMap,$e=()=>{},Y=$e(),Ot=Object,U=t=>t===Y,ve=t=>typeof t=="function",Me=(t,e)=>({...t,...e}),Ts=t=>ve(t.then),an={},Ct={},cn="undefined",dt=typeof window!=cn,un=typeof document!=cn,Yr=dt&&"Deno"in window,Qr=()=>dt&&typeof window.requestAnimationFrame!=cn,He=(t,e)=>{const n=Re.get(t);return[()=>!U(e)&&t.get(e)||an,s=>{if(!U(e)){const a=t.get(e);e in Ct||(Ct[e]=a),n[5](e,Me(a,s),a||an)}},n[6],()=>!U(e)&&e in Ct?Ct[e]:!U(e)&&t.get(e)||an]};let ln=!0;const Zr=()=>ln,[fn,hn]=dt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[$e,$e],ei=()=>{const t=un&&document.visibilityState;return U(t)||t!=="hidden"},ti=t=>(un&&document.addEventListener("visibilitychange",t),fn("focus",t),()=>{un&&document.removeEventListener("visibilitychange",t),hn("focus",t)}),ni=t=>{const e=()=>{ln=!0,t()},n=()=>{ln=!1};return fn("online",e),fn("offline",n),()=>{hn("online",e),hn("offline",n)}},si={isOnline:Zr,isVisible:ei},ri={initFocus:ti,initReconnect:ni},Os=!S.useId,pt=!dt||Yr,ii=t=>Qr()?window.requestAnimationFrame(t):setTimeout(t,1),mt=pt?S.useEffect:S.useLayoutEffect,dn=typeof navigator<"u"&&navigator.connection,Cs=!pt&&dn&&(["slow-2g","2g"].includes(dn.effectiveType)||dn.saveData),xt=new WeakMap,oi=t=>Ot.prototype.toString.call(t),pn=(t,e)=>t===`[object ${e}]`;let ai=0;const mn=t=>{const e=typeof t,n=oi(t),s=pn(n,"Date"),a=pn(n,"RegExp"),c=pn(n,"Object");let o,h;if(Ot(t)===t&&!s&&!a){if(o=xt.get(t),o)return o;if(o=++ai+"~",xt.set(t,o),Array.isArray(t)){for(o="@",h=0;h<t.length;h++)o+=mn(t[h])+",";xt.set(t,o)}if(c){o="#";const f=Ot.keys(t).sort();for(;!U(h=f.pop());)U(t[h])||(o+=h+":"+mn(t[h])+",");xt.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},it=t=>{if(ve(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?mn(t):"",[t,e]};let ci=0;const yn=()=>++ci;async function xs(...t){const[e,n,s,a]=t,c=Me({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let o=c.populateCache;const h=c.rollbackOnError;let f=c.optimisticData;const l=E=>typeof h=="function"?h(E):h!==!1,m=c.throwOnError;if(ve(n)){const E=n,y=[],v=e.keys();for(const O of v)!/^\$(inf|sub)\$/.test(O)&&E(e.get(O)._k)&&y.push(O);return Promise.all(y.map(b))}return b(n);async function b(E){const[y]=it(E);if(!y)return;const[v,O]=He(e,y),[I,R,K,G]=Re.get(e),H=()=>{const W=I[y];return(ve(c.revalidate)?c.revalidate(v().data,E):c.revalidate!==!1)&&(delete K[y],delete G[y],W&&W[0])?W[0](vs).then(()=>v().data):v().data};if(t.length<3)return H();let j=s,Z,pe=!1;const P=yn();R[y]=[P,0];const le=!U(f),V=v(),ae=V.data,Pe=V._c,me=U(Pe)?ae:Pe;if(le&&(f=ve(f)?f(me,ae):f,O({data:f,_c:me})),ve(j))try{j=j(me)}catch(W){Z=W,pe=!0}if(j&&Ts(j))if(j=await j.catch(W=>{Z=W,pe=!0}),P!==R[y][0]){if(pe)throw Z;return j}else pe&&le&&l(Z)&&(o=!0,O({data:me,_c:Y}));if(o&&!pe)if(ve(o)){const W=o(j,me);O({data:W,error:Y,_c:Y})}else O({data:j,error:Y,_c:Y});if(R[y][1]=yn(),Promise.resolve(H()).then(()=>{O({_c:Y})}),pe){if(m)throw Z;return}return j}}const As=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Rs=(t,e)=>{if(!Re.has(t)){const n=Me(ri,e),s=Object.create(null),a=xs.bind(Y,t);let c=$e;const o=Object.create(null),h=(m,b)=>{const E=o[m]||[];return o[m]=E,E.push(b),()=>E.splice(E.indexOf(b),1)},f=(m,b,E)=>{t.set(m,b);const y=o[m];if(y)for(const v of y)v(b,E)},l=()=>{if(!Re.has(t)&&(Re.set(t,[s,Object.create(null),Object.create(null),Object.create(null),a,f,h]),!pt)){const m=n.initFocus(setTimeout.bind(Y,As.bind(Y,s,bs))),b=n.initReconnect(setTimeout.bind(Y,As.bind(Y,s,_s)));c=()=>{m&&m(),b&&b(),Re.delete(t)}}};return l(),[t,a,l,c]}return[t,Re.get(t)[4]]},ui=(t,e,n,s,a)=>{const c=n.errorRetryCount,o=a.retryCount,h=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!U(c)&&o>c||setTimeout(s,h,a)},li=on,[yt,fi]=Rs(new Map),ks=Me({onLoadingSlow:$e,onSuccess:$e,onError:$e,onErrorRetry:ui,onDiscarded:$e,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Cs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Cs?5e3:3e3,compare:li,isPaused:()=>!1,cache:yt,mutate:fi,fallback:{}},si),Ds=(t,e)=>{const n=Me(t,e);if(e){const{use:s,fallback:a}=t,{use:c,fallback:o}=e;s&&c&&(n.use=s.concat(c)),a&&o&&(n.fallback=Me(a,o))}return n},gn=S.createContext({}),hi=t=>{const{value:e}=t,n=S.useContext(gn),s=ve(e),a=S.useMemo(()=>s?e(n):e,[s,n,e]),c=S.useMemo(()=>s?a:Ds(n,a),[s,n,a]),o=a&&a.provider,h=S.useRef(Y);o&&!h.current&&(h.current=Rs(o(c.cache||yt),a));const f=h.current;return f&&(c.cache=f[0],c.mutate=f[1]),mt(()=>{if(f)return f[2]&&f[2](),f[3]},[]),S.createElement(gn.Provider,Me(t,{value:c}))},Ls="$inf$",Fs=dt&&window.__SWR_DEVTOOLS_USE__,di=Fs?window.__SWR_DEVTOOLS_USE__:[],pi=()=>{Fs&&(window.__SWR_DEVTOOLS_REACT__=S)},Ns=t=>ve(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Bs=()=>{const t=S.useContext(gn);return S.useMemo(()=>Me(ks,t),[t])},gt=(t,e)=>{const[n,s]=it(t),[,,,a]=Re.get(yt);if(a[n])return a[n];const c=e(s);return a[n]=c,c},mi=t=>(e,n,s)=>t(e,n&&((...c)=>{const[o]=it(e),[,,,h]=Re.get(yt);if(o.startsWith(Ls))return n(...c);const f=h[o];return U(f)?n(...c):(delete h[o],f)}),s),yi=di.concat(mi),gi=t=>function(...n){const s=Bs(),[a,c,o]=Ns(n),h=Ds(s,o);let f=t;const{use:l}=h,m=(l||[]).concat(yi);for(let b=m.length;b--;)f=m[b](f);return f(a,c||h.fetcher||null,h)},wi=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const a=s.indexOf(n);a>=0&&(s[a]=s[s.length-1],s.pop())}},bi=(t,e)=>(...n)=>{const[s,a,c]=Ns(n),o=(c.use||[]).concat(e);return t(s,a,{...c,use:o})};pi();const wn=S.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),bn={dedupe:!0},Ps=Promise.resolve(Y),_i=(t,e,n)=>{const{cache:s,compare:a,suspense:c,fallbackData:o,revalidateOnMount:h,revalidateIfStale:f,refreshInterval:l,refreshWhenHidden:m,refreshWhenOffline:b,keepPreviousData:E}=n,[y,v,O,I]=Re.get(s),[R,K]=it(t),G=S.useRef(!1),H=S.useRef(!1),j=S.useRef(R),Z=S.useRef(e),pe=S.useRef(n),P=()=>pe.current,le=()=>P().isVisible()&&P().isOnline(),[V,ae,Pe,me]=He(s,R),W=S.useRef({}).current,ge=U(o)?U(n.fallback)?Y:n.fallback[R]:o,we=(M,z)=>{for(const ne in W){const $=ne;if($==="data"){if(!a(M[$],z[$])&&(!U(M[$])||!a(et,z[$])))return!1}else if(z[$]!==M[$])return!1}return!0},ee=S.useMemo(()=>{const M=!R||!e?!1:U(h)?P().isPaused()||c?!1:f!==!1:h,z=ue=>{const De=Me(ue);return delete De._k,M?{isValidating:!0,isLoading:!0,...De}:De},ne=V(),$=me(),be=z(ne),Je=ne===$?be:z($);let ie=be;return[()=>{const ue=z(V());return we(ue,ie)?(ie.data=ue.data,ie.isLoading=ue.isLoading,ie.isValidating=ue.isValidating,ie.error=ue.error,ie):(ie=ue,ue)},()=>Je]},[s,R]),te=ws.useSyncExternalStore(S.useCallback(M=>Pe(R,(z,ne)=>{we(ne,z)||M()}),[s,R]),ee[0],ee[1]),Ve=!G.current,Ze=y[R]&&y[R].length>0,Ue=te.data,re=U(Ue)?ge&&Ts(ge)?wn(ge):ge:Ue,We=te.error,ze=S.useRef(re),et=E?U(Ue)?U(ze.current)?re:ze.current:Ue:re,at=Ze&&!U(We)?!1:Ve&&!U(h)?h:P().isPaused()?!1:c?U(re)?!1:f:U(re)||f,It=!!(R&&e&&Ve&&at),In=U(te.isValidating)?It:te.isValidating,jn=U(te.isLoading)?It:te.isLoading,tt=S.useCallback(async M=>{const z=Z.current;if(!R||!z||H.current||P().isPaused())return!1;let ne,$,be=!0;const Je=M||{},ie=!O[R]||!Je.dedupe,ue=()=>Os?!H.current&&R===j.current&&G.current:R===j.current,De={isValidating:!1,isLoading:!1},Mt=()=>{ae(De)},vt=()=>{const _e=O[R];_e&&_e[1]===$&&delete O[R]},Vt={isValidating:!0};U(V().data)&&(Vt.isLoading=!0);try{if(ie&&(ae(Vt),n.loadingTimeout&&U(V().data)&&setTimeout(()=>{be&&ue()&&P().onLoadingSlow(R,n)},n.loadingTimeout),O[R]=[z(K),yn()]),[ne,$]=O[R],ne=await ne,ie&&setTimeout(vt,n.dedupingInterval),!O[R]||O[R][1]!==$)return ie&&ue()&&P().onDiscarded(R),!1;De.error=Y;const _e=v[R];if(!U(_e)&&($<=_e[0]||$<=_e[1]||_e[1]===0))return Mt(),ie&&ue()&&P().onDiscarded(R),!1;const _=V().data;De.data=a(_,ne)?_:ne,ie&&ue()&&P().onSuccess(ne,R,n)}catch(_e){vt();const _=P(),{shouldRetryOnError:N}=_;_.isPaused()||(De.error=_e,ie&&ue()&&(_.onError(_e,R,_),(N===!0||ve(N)&&N(_e))&&(!P().revalidateOnFocus||!P().revalidateOnReconnect||le())&&_.onErrorRetry(_e,R,_,$t=>{const ct=y[R];ct&&ct[0]&&ct[0](Ss,$t)},{retryCount:(Je.retryCount||0)+1,dedupe:!0})))}return be=!1,Mt(),!0},[R,s]),jt=S.useCallback((...M)=>xs(s,j.current,...M),[]);if(mt(()=>{Z.current=e,pe.current=n,U(Ue)||(ze.current=Ue)}),mt(()=>{if(!R)return;const M=tt.bind(Y,bn);let z=0;P().revalidateOnFocus&&(z=Date.now()+P().focusThrottleInterval);const $=wi(R,y,(be,Je={})=>{if(be==bs){const ie=Date.now();P().revalidateOnFocus&&ie>z&&le()&&(z=ie+P().focusThrottleInterval,M())}else if(be==_s)P().revalidateOnReconnect&&le()&&M();else{if(be==vs)return tt();if(be==Ss)return tt(Je)}});return H.current=!1,j.current=R,G.current=!0,ae({_k:K}),at&&(O[R]||(U(re)||pt?M():ii(M))),()=>{H.current=!0,$()}},[R]),mt(()=>{let M;function z(){const $=ve(l)?l(V().data):l;$&&M!==-1&&(M=setTimeout(ne,$))}function ne(){!V().error&&(m||P().isVisible())&&(b||P().isOnline())?tt(bn).then(z):z()}return z(),()=>{M&&(clearTimeout(M),M=-1)}},[l,m,b,R]),S.useDebugValue(et),c){const M=R&&U(re);if(!Os&&pt&&M)throw new Error("Fallback data is required when using Suspense in SSR.");M&&(Z.current=e,pe.current=n,H.current=!1);const z=I[R],ne=!U(z)&&M?jt(z):Ps;if(wn(ne),!U(We)&&M)throw We;const $=M?tt(bn):Ps;!U(et)&&M&&($.status="fulfilled",$.value=!0),wn($)}return{mutate:jt,get data(){return W.data=!0,et},get error(){return W.error=!0,We},get isValidating(){return W.isValidating=!0,In},get isLoading(){return W.isLoading=!0,jn}}},vi=Ot.defineProperty(hi,"defaultValue",{value:ks}),Qe=gi(_i),Si=void 0,_n=Object,Us=t=>t===Si,Ei=t=>typeof t=="function",At=new WeakMap,Ti=t=>_n.prototype.toString.call(t),vn=(t,e)=>t===`[object ${e}]`;let Oi=0;const Sn=t=>{const e=typeof t,n=Ti(t),s=vn(n,"Date"),a=vn(n,"RegExp"),c=vn(n,"Object");let o,h;if(_n(t)===t&&!s&&!a){if(o=At.get(t),o)return o;if(o=++Oi+"~",At.set(t,o),Array.isArray(t)){for(o="@",h=0;h<t.length;h++)o+=Sn(t[h])+",";At.set(t,o)}if(c){o="#";const f=_n.keys(t).sort();for(;!Us(h=f.pop());)Us(t[h])||(o+=h+":"+Sn(t[h])+",");At.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},Ci=t=>{if(Ei(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Sn(t):"",[t,e]},xi=t=>Ci(t?t(0,null):null)[0],En=Promise.resolve(),Ai=bi(Qe,t=>(e,n,s)=>{const a=S.useRef(!1),{cache:c,initialSize:o=1,revalidateAll:h=!1,persistSize:f=!1,revalidateFirstPage:l=!0,revalidateOnMount:m=!1,parallel:b=!1}=s,[,,,E]=Re.get(yt);let y;try{y=xi(e),y&&(y=Ls+y)}catch{}const[v,O,I]=He(c,y),R=S.useCallback(()=>U(v()._l)?o:v()._l,[c,y,o]);ws.useSyncExternalStore(S.useCallback(P=>y?I(y,()=>{P()}):()=>{},[c,y]),R,R);const K=S.useCallback(()=>{const P=v()._l;return U(P)?o:P},[y,o]),G=S.useRef(K());mt(()=>{if(!a.current){a.current=!0;return}y&&O({_l:f?G.current:K()})},[y,c]);const H=m&&!a.current,j=t(y,async P=>{const le=v()._i,V=v()._r;O({_r:Y});const ae=[],Pe=K(),[me]=He(c,P),W=me().data,ge=[];let we=null;for(let ee=0;ee<Pe;++ee){const[te,Ve]=it(e(ee,b?null:we));if(!te)break;const[Ze,Ue]=He(c,te);let re=Ze().data;const We=h||le||U(re)||l&&!ee&&!U(W)||H||W&&!U(W[ee])&&!s.compare(W[ee],re);if(n&&(typeof V=="function"?V(re,Ve):We)){const ze=async()=>{if(!(te in E))re=await n(Ve);else{const at=E[te];delete E[te],re=await at}Ue({data:re,_k:Ve}),ae[ee]=re};b?ge.push(ze):await ze()}else ae[ee]=re;b||(we=re)}return b&&await Promise.all(ge.map(ee=>ee())),O({_i:Y}),ae},s),Z=S.useCallback(function(P,le){const V=typeof le=="boolean"?{revalidate:le}:le||{},ae=V.revalidate!==!1;return y?(ae&&(U(P)?O({_i:!0,_r:V.revalidate}):O({_i:!1,_r:V.revalidate})),arguments.length?j.mutate(P,{...V,revalidate:ae}):j.mutate()):En},[y,c]),pe=S.useCallback(P=>{if(!y)return En;const[,le]=He(c,y);let V;if(ve(P)?V=P(K()):typeof P=="number"&&(V=P),typeof V!="number")return En;le({_l:V}),G.current=V;const ae=[],[Pe]=He(c,y);let me=null;for(let W=0;W<V;++W){const[ge]=it(e(W,me)),[we]=He(c,ge),ee=ge?we().data:Y;if(U(ee))return Z(Pe().data);ae.push(ee),me=ee}return Z(ae)},[y,c,Z,K]);return{size:K(),setSize:pe,mutate:Z,get data(){return j.data},get error(){return j.error},get isValidating(){return j.isValidating},get isLoading(){return j.isLoading}}}),Ne=Object.create(null);Ne.open="0",Ne.close="1",Ne.ping="2",Ne.pong="3",Ne.message="4",Ne.upgrade="5",Ne.noop="6";const Rt=Object.create(null);Object.keys(Ne).forEach(t=>{Rt[Ne[t]]=t});const Tn={type:"error",data:"parser error"},qs=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Is=typeof ArrayBuffer=="function",js=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,On=({type:t,data:e},n,s)=>qs&&e instanceof Blob?n?s(e):Ms(e,s):Is&&(e instanceof ArrayBuffer||js(e))?n?s(e):Ms(new Blob([e]),s):s(Ne[t]+(e||"")),Ms=(t,e)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];e("b"+(s||""))},n.readAsDataURL(t)};function Vs(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Cn;function Ri(t,e){if(qs&&t.data instanceof Blob)return t.data.arrayBuffer().then(Vs).then(e);if(Is&&(t.data instanceof ArrayBuffer||js(t.data)))return e(Vs(t.data));On(t,!1,n=>{Cn||(Cn=new TextEncoder),e(Cn.encode(n))})}const $s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<$s.length;t++)wt[$s.charCodeAt(t)]=t;const ki=t=>{let e=t.length*.75,n=t.length,s,a=0,c,o,h,f;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),m=new Uint8Array(l);for(s=0;s<n;s+=4)c=wt[t.charCodeAt(s)],o=wt[t.charCodeAt(s+1)],h=wt[t.charCodeAt(s+2)],f=wt[t.charCodeAt(s+3)],m[a++]=c<<2|o>>4,m[a++]=(o&15)<<4|h>>2,m[a++]=(h&3)<<6|f&63;return l},Di=typeof ArrayBuffer=="function",xn=(t,e)=>{if(typeof t!="string")return{type:"message",data:Hs(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Li(t.substring(1),e)}:Rt[n]?t.length>1?{type:Rt[n],data:t.substring(1)}:{type:Rt[n]}:Tn},Li=(t,e)=>{if(Di){const n=ki(t);return Hs(n,e)}else return{base64:!0,data:t}},Hs=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Ws="",Fi=(t,e)=>{const n=t.length,s=new Array(n);let a=0;t.forEach((c,o)=>{On(c,!1,h=>{s[o]=h,++a===n&&e(s.join(Ws))})})},Ni=(t,e)=>{const n=t.split(Ws),s=[];for(let a=0;a<n.length;a++){const c=xn(n[a],e);if(s.push(c),c.type==="error")break}return s};function Bi(){return new TransformStream({transform(t,e){Ri(t,n=>{const s=n.length;let a;if(s<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,s);else if(s<65536){a=new Uint8Array(3);const c=new DataView(a.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{a=new Uint8Array(9);const c=new DataView(a.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(n)})}})}let An;function kt(t){return t.reduce((e,n)=>e+n.length,0)}function Dt(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let s=0;for(let a=0;a<e;a++)n[a]=t[0][s++],s===t[0].length&&(t.shift(),s=0);return t.length&&s<t[0].length&&(t[0]=t[0].slice(s)),n}function Pi(t,e){An||(An=new TextDecoder);const n=[];let s=0,a=-1,c=!1;return new TransformStream({transform(o,h){for(n.push(o);;){if(s===0){if(kt(n)<1)break;const f=Dt(n,1);c=(f[0]&128)===128,a=f[0]&127,a<126?s=3:a===126?s=1:s=2}else if(s===1){if(kt(n)<2)break;const f=Dt(n,2);a=new DataView(f.buffer,f.byteOffset,f.length).getUint16(0),s=3}else if(s===2){if(kt(n)<8)break;const f=Dt(n,8),l=new DataView(f.buffer,f.byteOffset,f.length),m=l.getUint32(0);if(m>Math.pow(2,21)-1){h.enqueue(Tn);break}a=m*Math.pow(2,32)+l.getUint32(4),s=3}else{if(kt(n)<a)break;const f=Dt(n,a);h.enqueue(xn(c?f:An.decode(f),e)),s=0}if(a===0||a>t){h.enqueue(Tn);break}}}})}const zs=4;function Q(t){if(t)return Ui(t)}function Ui(t){for(var e in Q.prototype)t[e]=Q.prototype[e];return t}Q.prototype.on=Q.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Q.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},Q.prototype.off=Q.prototype.removeListener=Q.prototype.removeAllListeners=Q.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var s,a=0;a<n.length;a++)if(s=n[a],s===e||s.fn===e){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+t],this},Q.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,a=n.length;s<a;++s)n[s].apply(this,e)}return this},Q.prototype.emitReserved=Q.prototype.emit,Q.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Q.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Se=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Js(t,...e){return e.reduce((n,s)=>(t.hasOwnProperty(s)&&(n[s]=t[s]),n),{})}const qi=Se.setTimeout,Ii=Se.clearTimeout;function Lt(t,e){e.useNativeTimers?(t.setTimeoutFn=qi.bind(Se),t.clearTimeoutFn=Ii.bind(Se)):(t.setTimeoutFn=Se.setTimeout.bind(Se),t.clearTimeoutFn=Se.clearTimeout.bind(Se))}const ji=1.33;function Mi(t){return typeof t=="string"?Vi(t):Math.ceil((t.byteLength||t.size)*ji)}function Vi(t){let e=0,n=0;for(let s=0,a=t.length;s<a;s++)e=t.charCodeAt(s),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(s++,n+=4);return n}function $i(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Hi(t){let e={},n=t.split("&");for(let s=0,a=n.length;s<a;s++){let c=n[s].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class Wi extends Error{constructor(e,n,s){super(e),this.description=n,this.context=s,this.type="TransportError"}}class Rn extends Q{constructor(e){super(),this.writable=!1,Lt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,s){return super.emitReserved("error",new Wi(e,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=xn(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=$i(e);return n.length?"?"+n:""}}const Ks="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),kn=64,zi={};let Gs=0,Ft=0,Xs;function Ys(t){let e="";do e=Ks[t%kn]+e,t=Math.floor(t/kn);while(t>0);return e}function Qs(){const t=Ys(+new Date);return t!==Xs?(Gs=0,Xs=t):t+"."+Ys(Gs++)}for(;Ft<kn;Ft++)zi[Ks[Ft]]=Ft;let Zs=!1;try{Zs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ji=Zs;function er(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ji))return new XMLHttpRequest}catch{}if(!e)try{return new Se[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ba(){}function Ki(){}const Gi=function(){return new er({xdomain:!1}).responseType!=null}();class Xi extends Rn{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||a!==e.port}const n=e&&e.forceBase64;this.supportsBinary=Gi&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let s=0;this.polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Ni(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Fi(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Qs()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Be(this.uri(),e)}doWrite(e,n){const s=this.request({method:"POST",data:e});s.on("success",n),s.on("error",(a,c)=>{this.onError("xhr post error",a,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=e}}class Be extends Q{constructor(e,n){super(),Lt(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=Js(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const s=this.xhr=new er(n);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let a in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(a)&&s.setRequestHeader(a,this.opts.extraHeaders[a])}}catch{}if(this.method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var a;s.readyState===3&&((a=this.opts.cookieJar)===null||a===void 0||a.parseCookies(s)),s.readyState===4&&(s.status===200||s.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof s.status=="number"?s.status:0)},0))},s.send(this.data)}catch(a){this.setTimeoutFn(()=>{this.onError(a)},0);return}typeof document<"u"&&(this.index=Be.requestsCount++,Be.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Ki,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Be.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Be.requestsCount=0,Be.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",tr);else if(typeof addEventListener=="function"){const t="onpagehide"in Se?"pagehide":"unload";addEventListener(t,tr,!1)}}function tr(){for(let t in Be.requests)Be.requests.hasOwnProperty(t)&&Be.requests[t].abort()}const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Nt=Se.WebSocket||Se.MozWebSocket,nr=!0,Yi="arraybuffer",sr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Qi extends Rn{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,s=sr?{}:Js(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=nr&&!sr?n?new Nt(e,n):new Nt(e):new Nt(e,n,s)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;On(s,this.supportsBinary,c=>{const o={};try{nr&&this.ws.send(c)}catch{}a&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Qs()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}check(){return!!Nt}}class Zi extends Rn{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const n=Pi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(n).getReader(),a=Bi();a.readable.pipeTo(e.writable),this.writer=a.writable.getWriter();const c=()=>{s.read().then(({done:h,value:f})=>{h||(this.onPacket(f),c())}).catch(h=>{})};c();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;this.writer.write(s).then(()=>{a&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const eo={websocket:Qi,webtransport:Zi,polling:Xi},to=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,no=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ln(t){if(t.length>2e3)throw"URI too long";const e=t,n=t.indexOf("["),s=t.indexOf("]");n!=-1&&s!=-1&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));let a=to.exec(t||""),c={},o=14;for(;o--;)c[no[o]]=a[o]||"";return n!=-1&&s!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=so(c,c.path),c.queryKey=ro(c,c.query),c}function so(t,e){const n=/\/{2,9}/g,s=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function ro(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,a,c){a&&(n[a]=c)}),n}let rr=class ft extends Q{constructor(e,n={}){super(),this.binaryType=Yi,this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Ln(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Ln(n.host).host),Lt(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Hi(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=zs,n.transport=e,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new eo[e](s)}open(){let e;if(this.opts.rememberUpgrade&&ft.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),s=!1;ft.priorWebsocketSuccess=!1;const a=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ft.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const E=new Error("probe error");E.transport=n.name,this.emitReserved("upgradeError",E)}}))};function c(){s||(s=!0,m(),n.close(),n=null)}const o=b=>{const E=new Error("probe error: "+b);E.transport=n.name,c(),this.emitReserved("upgradeError",E)};function h(){o("transport closed")}function f(){o("socket closed")}function l(b){n&&b.name!==n.name&&c()}const m=()=>{n.removeListener("open",a),n.removeListener("error",o),n.removeListener("close",h),this.off("close",f),this.off("upgrading",l)};n.once("open",a),n.once("error",o),n.once("close",h),this.once("close",f),this.once("upgrading",l),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onOpen(){if(this.readyState="open",ft.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const a=this.writeBuffer[s].data;if(a&&(n+=Mi(a)),s>0&&n>this.maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}write(e,n,s){return this.sendPacket("message",e,n,s),this}send(e,n,s){return this.sendPacket("message",e,n,s),this}sendPacket(e,n,s,a){if(typeof n=="function"&&(a=n,n=void 0),typeof s=="function"&&(a=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:e,data:n,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}onError(e){ft.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let s=0;const a=e.length;for(;s<a;s++)~this.transports.indexOf(e[s])&&n.push(e[s]);return n}};rr.protocol=zs;function io(t,e="",n){let s=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),s=Ln(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+e,s.href=s.protocol+"://"+c+(n&&n.port===s.port?"":":"+s.port),s}const oo=typeof ArrayBuffer=="function",ao=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,co=typeof Blob=="function"||typeof Blob<"u"&&ir.call(Blob)==="[object BlobConstructor]",uo=typeof File=="function"||typeof File<"u"&&ir.call(File)==="[object FileConstructor]";function Fn(t){return oo&&(t instanceof ArrayBuffer||ao(t))||co&&t instanceof Blob||uo&&t instanceof File}function Bt(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,s=t.length;n<s;n++)if(Bt(t[n]))return!0;return!1}if(Fn(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Bt(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Bt(t[n]))return!0;return!1}function lo(t){const e=[],n=t.data,s=t;return s.data=Nn(n,e),s.attachments=e.length,{packet:s,buffers:e}}function Nn(t,e){if(!t)return t;if(Fn(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=Nn(t[s],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=Nn(t[s],e));return n}return t}function fo(t,e){return t.data=Bn(t.data,e),delete t.attachments,t}function Bn(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Bn(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Bn(t[n],e));return t}const ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],po=5;var q;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(q||(q={}));class mo{constructor(e){this.replacer=e}encode(e){return(e.type===q.EVENT||e.type===q.ACK)&&Bt(e)?this.encodeAsBinary({type:e.type===q.EVENT?q.BINARY_EVENT:q.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===q.BINARY_EVENT||e.type===q.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=lo(e),s=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(s),a}}function or(t){return Object.prototype.toString.call(t)==="[object Object]"}class Pn extends Q{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const s=n.type===q.BINARY_EVENT;s||n.type===q.BINARY_ACK?(n.type=s?q.EVENT:q.ACK,this.reconstructor=new yo(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Fn(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const s={type:Number(e.charAt(0))};if(q[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===q.BINARY_EVENT||s.type===q.BINARY_ACK){const c=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const o=e.substring(c,n);if(o!=Number(o)||e.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(n+1)==="/"){const c=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););s.nsp=e.substring(c,n)}else s.nsp="/";const a=e.charAt(n+1);if(a!==""&&Number(a)==a){const c=n+1;for(;++n;){const o=e.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===e.length)break}s.id=Number(e.substring(c,n+1))}if(e.charAt(++n)){const c=this.tryParse(e.substr(n));if(Pn.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case q.CONNECT:return or(n);case q.DISCONNECT:return n===void 0;case q.CONNECT_ERROR:return typeof n=="string"||or(n);case q.EVENT:case q.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ho.indexOf(n[0])===-1);case q.ACK:case q.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class yo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=fo(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const go=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Pn,Encoder:mo,get PacketType(){return q},protocol:po},Symbol.toStringTag,{value:"Module"}));function ke(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const wo=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ar extends Q{constructor(e,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ke(e,"open",this.onopen.bind(this)),ke(e,"packet",this.onpacket.bind(this)),ke(e,"error",this.onerror.bind(this)),ke(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(wo.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:q.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const o=this.ids++,h=n.pop();this._registerAckCallback(o,h),s.id=o}const a=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!a||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,n){var s;const a=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(a===void 0){this.acks[e]=n;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},a);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(c),n.apply(this,[null,...o])}}emitWithAck(e,...n){const s=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((a,c)=>{n.push((o,h)=>s?o?c(o):a(h):a(o)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...c)=>s!==this._queue[0]?void 0:(a!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:q.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case q.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case q.EVENT:case q.BINARY_EVENT:this.onevent(e);break;case q.ACK:case q.BINARY_ACK:this.onack(e);break;case q.DISCONNECT:this.ondisconnect();break;case q.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let s=!1;return function(...a){s||(s=!0,n.packet({type:q.ACK,id:e,data:a}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:q.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,e.data)}}}function ot(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}ot.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0},ot.prototype.reset=function(){this.attempts=0},ot.prototype.setMin=function(t){this.ms=t},ot.prototype.setMax=function(t){this.max=t},ot.prototype.setJitter=function(t){this.jitter=t};class Un extends Q{constructor(e,n){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Lt(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new ot({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const a=n.parser||go;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new rr(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const a=ke(n,"open",function(){s.onopen(),e&&e()}),c=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},o=ke(n,"error",c);if(this._timeout!==!1){const h=this._timeout,f=this.setTimeoutFn(()=>{a(),c(new Error("timeout")),n.close()},h);this.opts.autoUnref&&f.unref(),this.subs.push(()=>{this.clearTimeoutFn(f)})}return this.subs.push(a),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ke(e,"ping",this.onping.bind(this)),ke(e,"data",this.ondata.bind(this)),ke(e,"error",this.onerror.bind(this)),ke(e,"close",this.onclose.bind(this)),ke(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ar(this,e,n),this.nsps[e]=s),s}_destroy(e){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let s=0;s<n.length;s++)this.engine.write(n[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const bt={};function Pt(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=io(t,e.path||"/socket.io"),s=n.source,a=n.id,c=n.path,o=bt[a]&&c in bt[a].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let f;return h?f=new Un(s,e):(bt[a]||(bt[a]=new Un(s,e)),f=bt[a]),n.query&&!e.query&&(e.query=n.queryKey),f.socket(n.path,e)}Object.assign(Pt,{Manager:Un,Socket:ar,io:Pt,connect:Pt});class bo{constructor(e,n,s,a){Xe(this,"socket_port");Xe(this,"host");Xe(this,"port");Xe(this,"protocol");Xe(this,"url");Xe(this,"site_name");Xe(this,"socket");var c,o,h,f;if(this.socket_port=s??"9000",this.host=(c=window.location)==null?void 0:c.hostname,this.port=(o=window.location)!=null&&o.port?`:${this.socket_port}`:"",this.protocol=((h=window.location)==null?void 0:h.protocol)==="https:"?"https":"http",e){let l=new URL(e);l.port="",s?(l.port=s,this.url=l.toString()):this.url=l.toString()}else this.url=`${this.protocol}://${this.host}${this.port}/`;n&&(this.url=`${this.url}${n}`),this.site_name=n,this.socket=Pt(`${this.url}`,{withCredentials:!0,secure:this.protocol==="https",extraHeaders:a&&a.useToken===!0?{Authorization:`${a.type} ${(f=a.token)==null?void 0:f.call(a)}`}:{}})}}const X=S.createContext(null),_o=({url:t="",tokenParams:e,socketPort:n,swrConfig:s,siteName:a,enableSocket:c=!0,children:o,customHeaders:h})=>{const f=S.useMemo(()=>{const l=new Jr.FrappeApp(t,e,void 0,h);return{url:t,tokenParams:e,app:l,auth:l.auth(),db:l.db(),call:l.call(),file:l.file(),socket:c?new bo(t,a,n,e).socket:void 0,enableSocket:c,socketPort:n}},[t,e,n,c,h]);return de.jsx(X.Provider,{value:f,children:de.jsx(vi,{value:s,children:o})})},vo=t=>{const{url:e,auth:n,tokenParams:s}=S.useContext(X),[a,c]=S.useState(),o=S.useCallback(()=>{const v=document.cookie.split(";").find(O=>O.trim().startsWith("user_id="));if(v){const O=v.split("=")[1];c(O&&O!=="Guest"?O:null)}else c(null)},[]);S.useEffect(()=>{s&&s.useToken?c(null):o()},[]);const{data:h,error:f,isLoading:l,isValidating:m,mutate:b}=Qe(()=>s&&s.useToken||a?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>n.getLoggedInUser(),{onError:()=>{c(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...t}),E=S.useCallback(async v=>n.loginWithUsernamePassword(v).then(O=>(o(),O)),[]),y=S.useCallback(async()=>n.logout().then(()=>b(null)).then(()=>c(null)),[]);return{isLoading:a===void 0||l,currentUser:h,isValidating:m,error:f,login:E,logout:y,updateCurrentUser:b,getUserCookie:o}},_t=(t,e,n)=>{let s=`${e}/api/resource/`;return n?s+=`${t}/${n}`:s+=`${t}`,s},So=(t,e,n,s)=>{const{url:a,db:c}=S.useContext(X);return Qe(n===void 0?_t(t,a,e):n,()=>c.getDoc(t,e),s)},Eo=(t,e,n,s)=>{const{db:a,url:c}=S.useContext(X),o=n===void 0?_t(t,c,e):n;return S.useCallback(()=>{gt(o,()=>a.getDoc(t,e))},[o,t,e])},qn=t=>{var n,s;let e="";if(t!=null&&t.fields&&(e+="fields="+JSON.stringify(t==null?void 0:t.fields)+"&"),t!=null&&t.filters&&(e+="filters="+JSON.stringify(t==null?void 0:t.filters)+"&"),t!=null&&t.orFilters&&(e+="or_filters="+JSON.stringify(t==null?void 0:t.orFilters)+"&"),t!=null&&t.limit_start&&(e+="limit_start="+JSON.stringify(t==null?void 0:t.limit_start)+"&"),t!=null&&t.limit&&(e+="limit="+JSON.stringify(t==null?void 0:t.limit)+"&"),t!=null&&t.groupBy&&(e+="group_by="+String(t.groupBy)+"&"),t!=null&&t.orderBy){const a=`${String((n=t.orderBy)==null?void 0:n.field)} ${((s=t.orderBy)==null?void 0:s.order)??"asc"}`;e+="order_by="+a+"&"}return t!=null&&t.asDict&&(e+="as_dict="+t.asDict),e},To=(t,e,n,s)=>{const{url:a,db:c}=S.useContext(X);return Qe(n===void 0?`${_t(t,a)}?${qn(e)}`:n,()=>c.getDocList(t,e),s)},Oo=(t,e,n)=>{const{db:s,url:a}=S.useContext(X),c=n===void 0?`${_t(t,a)}?${qn(e)}`:n;return S.useCallback(()=>{gt(c,()=>s.getDocList(t,e))},[c,t,e])},Co=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{createDoc:S.useCallback(async(l,m)=>(a(null),o(!1),n(!0),t.createDoc(l,m).then(b=>(n(!1),o(!0),b)).catch(b=>{throw n(!1),o(!1),a(b),b})),[]),loading:e,error:s,isCompleted:c,reset:h}},xo=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{updateDoc:S.useCallback(async(l,m,b)=>(a(null),o(!1),n(!0),t.updateDoc(l,m,b).then(E=>(n(!1),o(!0),E)).catch(E=>{throw n(!1),o(!1),a(E),E})),[]),loading:e,error:s,reset:h,isCompleted:c}},Ao=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{deleteDoc:S.useCallback(async(l,m)=>(a(null),o(!1),n(!0),t.deleteDoc(l,m).then(b=>(n(!1),o(!0),b)).catch(b=>{throw n(!1),o(!1),a(b),b})),[]),loading:e,error:s,reset:h,isCompleted:c}};function Ut(t){const e=[];for(let n in t)e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}const Ro=(t,e,n=!1,s,a)=>{const{url:c,db:o}=S.useContext(X);return Qe(s===void 0?(()=>{const l=Ut({doctype:t,filters:e??[],debug:n});return`${c}/api/method/frappe.client.get_count?${l}`})():s,()=>o.getCount(t,e,n),a)},ko=(t,e,n=!1,s)=>{const{db:a,url:c}=S.useContext(X),o=s===void 0?`${c}/api/method/frappe.client.get_count?${Ut({doctype:t,filters:e??[],debug:n})}`:s;return S.useCallback(()=>{gt(o,()=>a.getCount(t,e,!1))},[o,t,e])},cr=(t,e,n,s,a="GET")=>{const{call:c}=S.useContext(X),o=Ut(e??{}),h=`${t}?${o}`;return{...Qe(n===void 0?h:n,a==="GET"?()=>c.get(t,e):()=>c.post(t,e),s)}},Do=(t,e,n,s="GET")=>{const{call:a}=S.useContext(X),c=Ut(e??{}),o=`${t}?${c}`;return S.useCallback(()=>{gt(n??o,s==="GET"?()=>a.get(t,e):()=>a.post(t,e))},[o,t,e,n])},Lo=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.post(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},Fo=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.put(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},No=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.delete(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},Bo=()=>{const{file:t}=S.useContext(X),[e,n]=S.useState(0),[s,a]=S.useState(!1),[c,o]=S.useState(null),[h,f]=S.useState(!1),l=S.useCallback(async(b,E,y)=>(m(),a(!0),t.uploadFile(b,E,(v,O)=>{O&&n(Math.round(v/O*100))},y).then(v=>(f(!0),n(100),a(!1),v.data.message)).catch(v=>{throw console.error(v),o(v),a(!1),v})),[]),m=S.useCallback(()=>{n(0),a(!1),o(null),f(!1)},[]);return{upload:l,progress:e,loading:s,isCompleted:h,error:c,reset:m}},Po=(t,e,n=[],s=20,a=250)=>{const c=Uo(e,a);return cr("frappe.desk.search.search_link",{doctype:t,page_length:s,txt:c,filters:JSON.stringify(n??[])})},Uo=(t,e)=>{const[n,s]=S.useState(t);return S.useEffect(()=>{const a=setTimeout(()=>{s(t)},e);return()=>{clearTimeout(a)}},[t,e]),n},qt=(t,e)=>{const{socket:n}=S.useContext(X);S.useEffect(()=>{n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider.");let s=n==null?void 0:n.on(t,e);return()=>{s==null||s.off(t)}},[t,e])},qo=(t,e,n,s=!0)=>{const{socket:a}=S.useContext(X),[c,o]=S.useState([]);S.useEffect(()=>(a===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),a==null||a.emit("doc_subscribe",t,e),a==null||a.io.on("reconnect",()=>{a==null||a.emit("doc_subscribe",t,e)}),s&&(a==null||a.emit("doc_open",t,e)),()=>{a==null||a.emit("doc_unsubscribe",t,e),s&&(a==null||a.emit("doc_close",t,e))}),[t,e,s]),qt("doc_update",n);const h=S.useCallback(()=>{a==null||a.emit("doc_open",t,e)},[t,e]),f=S.useCallback(()=>{a==null||a.emit("doc_close",t,e)},[t,e]),l=S.useCallback(m=>{m.doctype===t&&m.docname===e&&o(m.users)},[t,e]);return qt("doc_viewers",l),{viewers:c,emitDocOpen:h,emitDocClose:f}},Io=(t,e)=>{const{socket:n}=S.useContext(X);S.useEffect(()=>(n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),n==null||n.emit("doctype_subscribe",t),n==null||n.io.on("reconnect",()=>{n==null||n.emit("doctype_subscribe",t)}),()=>{n==null||n.emit("doctype_unsubscribe",t)}),[t]),qt("list_update",e)};B.FrappeContext=X,B.FrappeProvider=_o,B.getDocListQueryString=qn,B.getRequestURL=_t,B.preload=gt,B.useFrappeAuth=vo,B.useFrappeCreateDoc=Co,B.useFrappeDeleteCall=No,B.useFrappeDeleteDoc=Ao,B.useFrappeDocTypeEventListener=Io,B.useFrappeDocumentEventListener=qo,B.useFrappeEventListener=qt,B.useFrappeFileUpload=Bo,B.useFrappeGetCall=cr,B.useFrappeGetDoc=So,B.useFrappeGetDocCount=Ro,B.useFrappeGetDocList=To,B.useFrappePostCall=Lo,B.useFrappePrefetchCall=Do,B.useFrappePrefetchDoc=Eo,B.useFrappePrefetchDocCount=ko,B.useFrappePrefetchDocList=Oo,B.useFrappePutCall=Fo,B.useFrappeUpdateDoc=xo,B.useSWR=Qe,B.useSWRConfig=Bs,B.useSWRInfinite=Ai,B.useSearch=Po,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -253,7 +253,6 @@ export declare const useFrappeDeleteDoc: () => {
|
|
|
253
253
|
*
|
|
254
254
|
* @param doctype - The doctype to fetch
|
|
255
255
|
* @param filters - filters to apply to the query
|
|
256
|
-
* @param cache - Whether to cache the result or not. Defaults to false
|
|
257
256
|
* @param debug - Whether to log debug messages or not. Defaults to false
|
|
258
257
|
* @param options [Optional] SWRConfiguration options for fetching data
|
|
259
258
|
* @returns an object (SWRResponse) with the following properties: data (number), error, isValidating, and mutate
|
|
@@ -263,12 +262,11 @@ export declare const useFrappeDeleteDoc: () => {
|
|
|
263
262
|
* const { data, error, isLoading, mutate } = useFrappeGetDocCount("User")
|
|
264
263
|
*
|
|
265
264
|
*/
|
|
266
|
-
export declare const useFrappeGetDocCount: <T = any>(doctype: string, filters?: Filter<T>[] | undefined,
|
|
265
|
+
export declare const useFrappeGetDocCount: <T = any>(doctype: string, filters?: Filter<T>[] | undefined, debug?: boolean, swrKey?: Key, options?: SWRConfiguration) => SWRResponse<number, Error>;
|
|
267
266
|
/**
|
|
268
267
|
* Hook to prefetch the number of documents from the database
|
|
269
268
|
* @param doctype - The doctype to fetch
|
|
270
269
|
* @param filters - filters to apply to the query
|
|
271
|
-
* @param cache - Whether to cache the result or not. Defaults to false
|
|
272
270
|
* @param debug - Whether to log debug messages or not. Defaults to false
|
|
273
271
|
* @param swrKey - The SWRKey to use for caching the result - optional
|
|
274
272
|
* @returns A function to prefetch the number of documents
|
|
@@ -282,7 +280,7 @@ export declare const useFrappeGetDocCount: <T = any>(doctype: string, filters?:
|
|
|
282
280
|
* preloadCount()
|
|
283
281
|
* }
|
|
284
282
|
*/
|
|
285
|
-
export declare const useFrappePrefetchDocCount: <T = any>(doctype: string, filters?: Filter<T>[] | undefined,
|
|
283
|
+
export declare const useFrappePrefetchDocCount: <T = any>(doctype: string, filters?: Filter<T>[] | undefined, debug?: boolean, swrKey?: Key) => () => void;
|
|
286
284
|
/**
|
|
287
285
|
* Hook to make a GET request to the server
|
|
288
286
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frappe-react-sdk",
|
|
3
3
|
"description": "React hooks for Frappe Framework",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "The Commit Company",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"frappe-js-sdk": "^1.
|
|
85
|
+
"frappe-js-sdk": "^1.12.0",
|
|
86
86
|
"socket.io-client": "4.7.1",
|
|
87
87
|
"swr": "^2.3.6"
|
|
88
88
|
}
|