lgsso-sdk 1.1.6 → 1.1.7

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.
@@ -4139,49 +4139,125 @@ function createSSO() {
4139
4139
  if (!config || !isBrowser()) return;
4140
4140
  config.storage.removeItem(config.tokenKey);
4141
4141
  },
4142
-
4143
4142
  /**
4144
- * 退出登录
4145
- * @returns {Promise<Object>} 接口返回结果
4143
+ * 统一跳转逻辑(适配iOS)
4144
+ * @param {string} url - 跳转地址
4145
+ * @param {string} target - _self/_blank
4146
+ * @param {Window|null} newWindow - 提前创建的新窗口引用
4146
4147
  */
4147
- async logout() {
4148
+ _doJump(url, target, newWindow) {
4149
+ if (target === '_blank' && newWindow) {
4150
+ // 给提前创建的空窗口赋值URL(iOS 唯一能生效的方式)
4151
+ newWindow.location.href = url;
4152
+ // 兜底:如果新窗口被关闭,降级到当前页
4153
+ setTimeout(() => {
4154
+ if (newWindow.closed) {
4155
+ window.location.href = url;
4156
+ }
4157
+ }, 100);
4158
+ } else {
4159
+ // _self 跳转:iOS 兼容 - 强制替换历史记录,避免返回问题
4160
+ window.location.replace(url);
4161
+ // 兜底:replace 失效时用 href
4162
+ setTimeout(() => {
4163
+ if (window.location.href !== url) {
4164
+ window.location.href = url;
4165
+ }
4166
+ }, 0);
4167
+ }
4168
+ },
4169
+ /**
4170
+ * 用token换取新accessCode并跳转到指定URL(兼容iOS Safari)
4171
+ * @param {string} redirectUrl - 目标跳转地址(建议传绝对路径)
4172
+ * @param {string} target - 当前页面:_self、新页面打开:_blank,默认当前页_self
4173
+ * @returns {Promise<Object>} 接口返回结果
4174
+ */
4175
+ async toUrl(redirectUrl, target = '_self') {
4148
4176
  if (!config) {
4149
4177
  return { code: -101, msg: '请先调用init方法初始化', success: false };
4150
4178
  }
4151
4179
 
4152
- if (!config.logoutApi) {
4153
- return { code: -102, msg: '未配置logoutApi', success: false };
4180
+ if (!redirectUrl) {
4181
+ return { code: -104, msg: '请提供跳转地址', success: false };
4154
4182
  }
4155
4183
 
4156
- const token = this.getToken();
4157
- if (token) {
4184
+ // 验证target参数有效性
4185
+ if (!['_self', '_blank'].includes(target)) {
4186
+ return { code: -108, msg: 'target参数必须是"_self"或"_blank"', success: false };
4187
+ }
4188
+
4189
+ if (!config.refreshCodeApi) {
4190
+ return { code: -105, msg: '未配置refreshCodeApi', success: false };
4191
+ }
4192
+
4193
+ // ========== iOS 适配:提前创建新窗口(保留用户交互上下文) ==========
4194
+ let newWindow = null;
4195
+ if (target === '_blank' && isBrowser()) {
4196
+ // 同步阶段(用户交互内)先创建空窗口,避免异步后被拦截
4158
4197
  try {
4159
- const result = await request(
4160
- config.logoutApi,
4161
- {
4162
- method: 'POST',
4163
- headers: { ...config.headers, [config.tokenKey]: token },
4164
- timeout: config.timeout
4165
- }
4166
- );
4167
- this.removeToken();
4198
+ newWindow = window.open('', '_blank');
4199
+ // iOS Safari 中创建失败会返回 null,提前降级
4200
+ if (!newWindow) {
4201
+ target = '_self';
4202
+ }
4203
+ } catch (e) {
4204
+ target = '_self';
4205
+ }
4206
+ }
4168
4207
 
4208
+ const token = this.getToken();
4209
+ if (!token) {
4210
+ if (config.logOutUrl) {
4211
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4212
+ // 执行跳转(提前创建的窗口直接赋值URL)
4213
+ this._doJump(loginUrl, target, newWindow);
4214
+ }
4215
+ return { code: -106, msg: '未找到有效token', success: false };
4216
+ }
4217
+
4218
+ try {
4219
+ const result = await request(
4220
+ config.refreshCodeApi,
4221
+ {
4222
+ method: 'POST',
4223
+ headers: { ...config.headers, [config.tokenKey]: token },
4224
+ timeout: config.timeout
4225
+ }
4226
+ );
4227
+
4228
+ if (result.code === 0 && result.data && isBrowser()) {
4229
+ // ========== iOS 兼容:URL 解析(确保绝对路径) ==========
4230
+ let targetUrl = '';
4231
+ try {
4232
+ // 兼容相对路径:基于当前页面URL解析
4233
+ const baseUrl = window.location.origin + window.location.pathname;
4234
+ const url = new URL(redirectUrl, baseUrl);
4235
+ url.searchParams.set(config.accessCodeKey, result.data);
4236
+ targetUrl = url.toString();
4237
+ } catch (e) {
4238
+ // 解析失败时降级拼接
4239
+ targetUrl = redirectUrl + (redirectUrl.includes('?') ? '&' : '?') + `${config.accessCodeKey}=${result.data}`;
4240
+ }
4241
+ // 执行跳转
4242
+ this._doJump(targetUrl, target, newWindow);
4243
+ } else {
4169
4244
  if (isBrowser() && config.logOutUrl) {
4170
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
4245
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4246
+ this._doJump(loginUrl, target, newWindow);
4171
4247
  }
4172
- return result;
4173
- } catch (error) {
4174
- return { code: -103, msg: `退出失败: ${error.message}`, success: false };
4175
4248
  }
4176
- } else {
4177
- this.removeToken();
4249
+ return result;
4250
+ } catch (error) {
4178
4251
  if (config.logOutUrl) {
4179
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
4252
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4253
+ _doJump(loginUrl, target, newWindow);
4180
4254
  }
4181
- return { code: 0, msg: '已成功清除token', success: true };
4255
+ return { code: -107, msg: `跳转失败: ${error.message}`, success: false };
4182
4256
  }
4183
4257
  },
4184
4258
 
4259
+
4260
+
4185
4261
  /**
4186
4262
  * 用token换取新accessCode并跳转到指定URL
4187
4263
  * @param {string} redirectUrl - 目标跳转地址
@@ -4135,49 +4135,125 @@ function createSSO() {
4135
4135
  if (!config || !isBrowser()) return;
4136
4136
  config.storage.removeItem(config.tokenKey);
4137
4137
  },
4138
-
4139
4138
  /**
4140
- * 退出登录
4141
- * @returns {Promise<Object>} 接口返回结果
4139
+ * 统一跳转逻辑(适配iOS)
4140
+ * @param {string} url - 跳转地址
4141
+ * @param {string} target - _self/_blank
4142
+ * @param {Window|null} newWindow - 提前创建的新窗口引用
4142
4143
  */
4143
- async logout() {
4144
+ _doJump(url, target, newWindow) {
4145
+ if (target === '_blank' && newWindow) {
4146
+ // 给提前创建的空窗口赋值URL(iOS 唯一能生效的方式)
4147
+ newWindow.location.href = url;
4148
+ // 兜底:如果新窗口被关闭,降级到当前页
4149
+ setTimeout(() => {
4150
+ if (newWindow.closed) {
4151
+ window.location.href = url;
4152
+ }
4153
+ }, 100);
4154
+ } else {
4155
+ // _self 跳转:iOS 兼容 - 强制替换历史记录,避免返回问题
4156
+ window.location.replace(url);
4157
+ // 兜底:replace 失效时用 href
4158
+ setTimeout(() => {
4159
+ if (window.location.href !== url) {
4160
+ window.location.href = url;
4161
+ }
4162
+ }, 0);
4163
+ }
4164
+ },
4165
+ /**
4166
+ * 用token换取新accessCode并跳转到指定URL(兼容iOS Safari)
4167
+ * @param {string} redirectUrl - 目标跳转地址(建议传绝对路径)
4168
+ * @param {string} target - 当前页面:_self、新页面打开:_blank,默认当前页_self
4169
+ * @returns {Promise<Object>} 接口返回结果
4170
+ */
4171
+ async toUrl(redirectUrl, target = '_self') {
4144
4172
  if (!config) {
4145
4173
  return { code: -101, msg: '请先调用init方法初始化', success: false };
4146
4174
  }
4147
4175
 
4148
- if (!config.logoutApi) {
4149
- return { code: -102, msg: '未配置logoutApi', success: false };
4176
+ if (!redirectUrl) {
4177
+ return { code: -104, msg: '请提供跳转地址', success: false };
4150
4178
  }
4151
4179
 
4152
- const token = this.getToken();
4153
- if (token) {
4180
+ // 验证target参数有效性
4181
+ if (!['_self', '_blank'].includes(target)) {
4182
+ return { code: -108, msg: 'target参数必须是"_self"或"_blank"', success: false };
4183
+ }
4184
+
4185
+ if (!config.refreshCodeApi) {
4186
+ return { code: -105, msg: '未配置refreshCodeApi', success: false };
4187
+ }
4188
+
4189
+ // ========== iOS 适配:提前创建新窗口(保留用户交互上下文) ==========
4190
+ let newWindow = null;
4191
+ if (target === '_blank' && isBrowser()) {
4192
+ // 同步阶段(用户交互内)先创建空窗口,避免异步后被拦截
4154
4193
  try {
4155
- const result = await request(
4156
- config.logoutApi,
4157
- {
4158
- method: 'POST',
4159
- headers: { ...config.headers, [config.tokenKey]: token },
4160
- timeout: config.timeout
4161
- }
4162
- );
4163
- this.removeToken();
4194
+ newWindow = window.open('', '_blank');
4195
+ // iOS Safari 中创建失败会返回 null,提前降级
4196
+ if (!newWindow) {
4197
+ target = '_self';
4198
+ }
4199
+ } catch (e) {
4200
+ target = '_self';
4201
+ }
4202
+ }
4164
4203
 
4204
+ const token = this.getToken();
4205
+ if (!token) {
4206
+ if (config.logOutUrl) {
4207
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4208
+ // 执行跳转(提前创建的窗口直接赋值URL)
4209
+ this._doJump(loginUrl, target, newWindow);
4210
+ }
4211
+ return { code: -106, msg: '未找到有效token', success: false };
4212
+ }
4213
+
4214
+ try {
4215
+ const result = await request(
4216
+ config.refreshCodeApi,
4217
+ {
4218
+ method: 'POST',
4219
+ headers: { ...config.headers, [config.tokenKey]: token },
4220
+ timeout: config.timeout
4221
+ }
4222
+ );
4223
+
4224
+ if (result.code === 0 && result.data && isBrowser()) {
4225
+ // ========== iOS 兼容:URL 解析(确保绝对路径) ==========
4226
+ let targetUrl = '';
4227
+ try {
4228
+ // 兼容相对路径:基于当前页面URL解析
4229
+ const baseUrl = window.location.origin + window.location.pathname;
4230
+ const url = new URL(redirectUrl, baseUrl);
4231
+ url.searchParams.set(config.accessCodeKey, result.data);
4232
+ targetUrl = url.toString();
4233
+ } catch (e) {
4234
+ // 解析失败时降级拼接
4235
+ targetUrl = redirectUrl + (redirectUrl.includes('?') ? '&' : '?') + `${config.accessCodeKey}=${result.data}`;
4236
+ }
4237
+ // 执行跳转
4238
+ this._doJump(targetUrl, target, newWindow);
4239
+ } else {
4165
4240
  if (isBrowser() && config.logOutUrl) {
4166
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
4241
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4242
+ this._doJump(loginUrl, target, newWindow);
4167
4243
  }
4168
- return result;
4169
- } catch (error) {
4170
- return { code: -103, msg: `退出失败: ${error.message}`, success: false };
4171
4244
  }
4172
- } else {
4173
- this.removeToken();
4245
+ return result;
4246
+ } catch (error) {
4174
4247
  if (config.logOutUrl) {
4175
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
4248
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4249
+ _doJump(loginUrl, target, newWindow);
4176
4250
  }
4177
- return { code: 0, msg: '已成功清除token', success: true };
4251
+ return { code: -107, msg: `跳转失败: ${error.message}`, success: false };
4178
4252
  }
4179
4253
  },
4180
4254
 
4255
+
4256
+
4181
4257
  /**
4182
4258
  * 用token换取新accessCode并跳转到指定URL
4183
4259
  * @param {string} redirectUrl - 目标跳转地址
package/dist/lgsso-sdk.js CHANGED
@@ -4141,49 +4141,125 @@
4141
4141
  if (!config || !isBrowser()) return;
4142
4142
  config.storage.removeItem(config.tokenKey);
4143
4143
  },
4144
-
4145
4144
  /**
4146
- * 退出登录
4147
- * @returns {Promise<Object>} 接口返回结果
4145
+ * 统一跳转逻辑(适配iOS)
4146
+ * @param {string} url - 跳转地址
4147
+ * @param {string} target - _self/_blank
4148
+ * @param {Window|null} newWindow - 提前创建的新窗口引用
4148
4149
  */
4149
- async logout() {
4150
+ _doJump(url, target, newWindow) {
4151
+ if (target === '_blank' && newWindow) {
4152
+ // 给提前创建的空窗口赋值URL(iOS 唯一能生效的方式)
4153
+ newWindow.location.href = url;
4154
+ // 兜底:如果新窗口被关闭,降级到当前页
4155
+ setTimeout(() => {
4156
+ if (newWindow.closed) {
4157
+ window.location.href = url;
4158
+ }
4159
+ }, 100);
4160
+ } else {
4161
+ // _self 跳转:iOS 兼容 - 强制替换历史记录,避免返回问题
4162
+ window.location.replace(url);
4163
+ // 兜底:replace 失效时用 href
4164
+ setTimeout(() => {
4165
+ if (window.location.href !== url) {
4166
+ window.location.href = url;
4167
+ }
4168
+ }, 0);
4169
+ }
4170
+ },
4171
+ /**
4172
+ * 用token换取新accessCode并跳转到指定URL(兼容iOS Safari)
4173
+ * @param {string} redirectUrl - 目标跳转地址(建议传绝对路径)
4174
+ * @param {string} target - 当前页面:_self、新页面打开:_blank,默认当前页_self
4175
+ * @returns {Promise<Object>} 接口返回结果
4176
+ */
4177
+ async toUrl(redirectUrl, target = '_self') {
4150
4178
  if (!config) {
4151
4179
  return { code: -101, msg: '请先调用init方法初始化', success: false };
4152
4180
  }
4153
4181
 
4154
- if (!config.logoutApi) {
4155
- return { code: -102, msg: '未配置logoutApi', success: false };
4182
+ if (!redirectUrl) {
4183
+ return { code: -104, msg: '请提供跳转地址', success: false };
4156
4184
  }
4157
4185
 
4158
- const token = this.getToken();
4159
- if (token) {
4186
+ // 验证target参数有效性
4187
+ if (!['_self', '_blank'].includes(target)) {
4188
+ return { code: -108, msg: 'target参数必须是"_self"或"_blank"', success: false };
4189
+ }
4190
+
4191
+ if (!config.refreshCodeApi) {
4192
+ return { code: -105, msg: '未配置refreshCodeApi', success: false };
4193
+ }
4194
+
4195
+ // ========== iOS 适配:提前创建新窗口(保留用户交互上下文) ==========
4196
+ let newWindow = null;
4197
+ if (target === '_blank' && isBrowser()) {
4198
+ // 同步阶段(用户交互内)先创建空窗口,避免异步后被拦截
4160
4199
  try {
4161
- const result = await request(
4162
- config.logoutApi,
4163
- {
4164
- method: 'POST',
4165
- headers: { ...config.headers, [config.tokenKey]: token },
4166
- timeout: config.timeout
4167
- }
4168
- );
4169
- this.removeToken();
4200
+ newWindow = window.open('', '_blank');
4201
+ // iOS Safari 中创建失败会返回 null,提前降级
4202
+ if (!newWindow) {
4203
+ target = '_self';
4204
+ }
4205
+ } catch (e) {
4206
+ target = '_self';
4207
+ }
4208
+ }
4170
4209
 
4210
+ const token = this.getToken();
4211
+ if (!token) {
4212
+ if (config.logOutUrl) {
4213
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4214
+ // 执行跳转(提前创建的窗口直接赋值URL)
4215
+ this._doJump(loginUrl, target, newWindow);
4216
+ }
4217
+ return { code: -106, msg: '未找到有效token', success: false };
4218
+ }
4219
+
4220
+ try {
4221
+ const result = await request(
4222
+ config.refreshCodeApi,
4223
+ {
4224
+ method: 'POST',
4225
+ headers: { ...config.headers, [config.tokenKey]: token },
4226
+ timeout: config.timeout
4227
+ }
4228
+ );
4229
+
4230
+ if (result.code === 0 && result.data && isBrowser()) {
4231
+ // ========== iOS 兼容:URL 解析(确保绝对路径) ==========
4232
+ let targetUrl = '';
4233
+ try {
4234
+ // 兼容相对路径:基于当前页面URL解析
4235
+ const baseUrl = window.location.origin + window.location.pathname;
4236
+ const url = new URL(redirectUrl, baseUrl);
4237
+ url.searchParams.set(config.accessCodeKey, result.data);
4238
+ targetUrl = url.toString();
4239
+ } catch (e) {
4240
+ // 解析失败时降级拼接
4241
+ targetUrl = redirectUrl + (redirectUrl.includes('?') ? '&' : '?') + `${config.accessCodeKey}=${result.data}`;
4242
+ }
4243
+ // 执行跳转
4244
+ this._doJump(targetUrl, target, newWindow);
4245
+ } else {
4171
4246
  if (isBrowser() && config.logOutUrl) {
4172
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
4247
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4248
+ this._doJump(loginUrl, target, newWindow);
4173
4249
  }
4174
- return result;
4175
- } catch (error) {
4176
- return { code: -103, msg: `退出失败: ${error.message}`, success: false };
4177
4250
  }
4178
- } else {
4179
- this.removeToken();
4251
+ return result;
4252
+ } catch (error) {
4180
4253
  if (config.logOutUrl) {
4181
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
4254
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
4255
+ _doJump(loginUrl, target, newWindow);
4182
4256
  }
4183
- return { code: 0, msg: '已成功清除token', success: true };
4257
+ return { code: -107, msg: `跳转失败: ${error.message}`, success: false };
4184
4258
  }
4185
4259
  },
4186
4260
 
4261
+
4262
+
4187
4263
  /**
4188
4264
  * 用token换取新accessCode并跳转到指定URL
4189
4265
  * @param {string} redirectUrl - 目标跳转地址
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lgsso={})}(this,function(e){"use strict";function t(){return window.location.href}function n(e,t){return function(){return e.apply(t,arguments)}}const{toString:r}=Object.prototype,{getPrototypeOf:o}=Object,{iterator:s,toStringTag:i}=Symbol,a=(c=Object.create(null),e=>{const t=r.call(e);return c[t]||(c[t]=t.slice(8,-1).toLowerCase())});var c;const u=e=>(e=e.toLowerCase(),t=>a(t)===e),l=e=>t=>typeof t===e,{isArray:d}=Array,f=l("undefined");function h(e){return null!==e&&!f(e)&&null!==e.constructor&&!f(e.constructor)&&g(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const p=u("ArrayBuffer");const m=l("string"),g=l("function"),y=l("number"),w=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==a(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||i in e||s in e)},E=u("Date"),O=u("File"),R=u("Blob"),S=u("FileList"),T=u("URLSearchParams"),[A,C,v,P]=["ReadableStream","Request","Response","Headers"].map(u);function k(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),d(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(h(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function U(e,t){if(h(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,x=e=>!f(e)&&e!==j;const _=(N="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>N&&e instanceof N);var N;const L=u("HTMLFormElement"),F=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),B=u("RegExp"),D=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};k(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const K=u("AsyncFunction"),q=(I="function"==typeof setImmediate,$=g(j.postMessage),I?setImmediate:$?(M=`axios@${Math.random()}`,z=[],j.addEventListener("message",({source:e,data:t})=>{e===j&&t===M&&z.length&&z.shift()()},!1),e=>{z.push(e),j.postMessage(M,"*")}):e=>setTimeout(e));var I,$,M,z;const H="undefined"!=typeof queueMicrotask?queueMicrotask.bind(j):"undefined"!=typeof process&&process.nextTick||q;var J={isArray:d,isArrayBuffer:p,isBuffer:h,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||g(e.append)&&("formdata"===(t=a(e))||"object"===t&&g(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:m,isNumber:y,isBoolean:e=>!0===e||!1===e,isObject:w,isPlainObject:b,isEmptyObject:e=>{if(!w(e)||h(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:A,isRequest:C,isResponse:v,isHeaders:P,isUndefined:f,isDate:E,isFile:O,isBlob:R,isRegExp:B,isFunction:g,isStream:e=>w(e)&&g(e.pipe),isURLSearchParams:T,isTypedArray:_,isFileList:S,forEach:k,merge:function e(){const{caseless:t}=x(this)&&this||{},n={},r=(r,o)=>{const s=t&&U(n,o)||o;b(n[s])&&b(r)?n[s]=e(n[s],r):b(r)?n[s]=e({},r):d(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&k(arguments[e],r);return n},extend:(e,t,r,{allOwnKeys:o}={})=>(k(t,(t,o)=>{r&&g(t)?e[o]=n(t,r):e[o]=t},{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&o(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:a,kindOfTest:u,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(d(e))return e;let t=e.length;if(!y(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[s]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:L,hasOwnProperty:F,hasOwnProp:F,reduceDescriptors:D,freezeMethods:e=>{D(e,(t,n)=>{if(g(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];g(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return d(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:U,global:j,isContextDefined:x,isSpecCompliantForm:function(e){return!!(e&&g(e.append)&&"FormData"===e[i]&&e[s])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(w(e)){if(t.indexOf(e)>=0)return;if(h(e))return e;if(!("toJSON"in e)){t[r]=e;const o=d(e)?[]:{};return k(e,(e,t)=>{const s=n(e,r+1);!f(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:K,isThenable:e=>e&&(w(e)||g(e))&&g(e.then)&&g(e.catch),setImmediate:q,asap:H,isIterable:e=>null!=e&&g(e[s])};function W(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}J.inherits(W,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:J.toJSONObject(this.config),code:this.code,status:this.status}}});const V=W.prototype,G={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{G[e]={value:e}}),Object.defineProperties(W,G),Object.defineProperty(V,"isAxiosError",{value:!0}),W.from=(e,t,n,r,o,s)=>{const i=Object.create(V);return J.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),W.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function X(e){return J.isPlainObject(e)||J.isArray(e)}function Q(e){return J.endsWith(e,"[]")?e.slice(0,-2):e}function Z(e,t,n){return e?e.concat(t).map(function(e,t){return e=Q(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Y=J.toFlatObject(J,{},null,function(e){return/^is[A-Z]/.test(e)});function ee(e,t,n){if(!J.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=J.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!J.isUndefined(t[e])})).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&J.isSpecCompliantForm(t);if(!J.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(J.isDate(e))return e.toISOString();if(J.isBoolean(e))return e.toString();if(!a&&J.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(e)||J.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(J.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(J.isArray(e)&&function(e){return J.isArray(e)&&!e.some(X)}(e)||(J.isFileList(e)||J.endsWith(n,"[]"))&&(a=J.toArray(e)))return n=Q(n),a.forEach(function(e,r){!J.isUndefined(e)&&null!==e&&t.append(!0===i?Z([n],r,s):null===i?n:n+"[]",c(e))}),!1;return!!X(e)||(t.append(Z(o,n,s),c(e)),!1)}const l=[],d=Object.assign(Y,{defaultVisitor:u,convertValue:c,isVisitable:X});if(!J.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!J.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),J.forEach(n,function(n,s){!0===(!(J.isUndefined(n)||null===n)&&o.call(t,n,J.isString(s)?s.trim():s,r,d))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function te(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ne(e,t){this._pairs=[],e&&ee(e,this,t)}const re=ne.prototype;function oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function se(e,t,n){if(!t)return e;const r=n&&n.encode||oe;J.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):J.isURLSearchParams(t)?t.toString():new ne(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}re.append=function(e,t){this._pairs.push([e,t])},re.toString=function(e){const t=e?function(t){return e.call(this,t,te)}:te;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var ie=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,function(t){null!==t&&e(t)})}},ae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ce={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ne,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ue="undefined"!=typeof window&&"undefined"!=typeof document,le="object"==typeof navigator&&navigator||void 0,de=ue&&(!le||["ReactNative","NativeScript","NS"].indexOf(le.product)<0),fe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,he=ue&&window.location.href||"http://localhost";var pe={...Object.freeze({__proto__:null,hasBrowserEnv:ue,hasStandardBrowserEnv:de,hasStandardBrowserWebWorkerEnv:fe,navigator:le,origin:he}),...ce};function me(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&J.isArray(r)?r.length:s,a)return J.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&J.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&J.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(J.isFormData(e)&&J.isFunction(e.entries)){const n={};return J.forEachEntry(e,(e,r)=>{t(function(e){return J.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const ge={transitional:ae,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=J.isObject(e);o&&J.isHTMLForm(e)&&(e=new FormData(e));if(J.isFormData(e))return r?JSON.stringify(me(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ee(e,new pe.classes.URLSearchParams,{visitor:function(e,t,n,r){return pe.isNode&&J.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=J.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ee(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(J.isString(e))try{return(t||JSON.parse)(e),J.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ge.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw W.from(e,W.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],e=>{ge.headers[e]={}});var ye=ge;const we=J.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"]);const be=Symbol("internals");function Ee(e){return e&&String(e).trim().toLowerCase()}function Oe(e){return!1===e||null==e?e:J.isArray(e)?e.map(Oe):String(e)}function Re(e,t,n,r,o){return J.isFunction(r)?r.call(this,t,n):(o&&(t=n),J.isString(t)?J.isString(r)?-1!==t.indexOf(r):J.isRegExp(r)?r.test(t):void 0:void 0)}class Se{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Ee(t);if(!o)throw new Error("header name must be a non-empty string");const s=J.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Oe(e))}const s=(e,t)=>J.forEach(e,(e,n)=>o(e,n,t));if(J.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(J.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&we[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(J.isObject(e)&&J.isIterable(e)){let n,r,o={};for(const t of e){if(!J.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?J.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Ee(e)){const n=J.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(J.isFunction(t))return t.call(this,e,n);if(J.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ee(e)){const n=J.findKey(this,e);return!(!n||void 0===this[n]||t&&!Re(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Ee(e)){const o=J.findKey(n,e);!o||t&&!Re(0,n[o],o,t)||(delete n[o],r=!0)}}return J.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Re(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return J.forEach(this,(r,o)=>{const s=J.findKey(n,o);if(s)return t[s]=Oe(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=Oe(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return J.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&J.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[be]=this[be]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Ee(e);t[r]||(!function(e,t){const n=J.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return J.isArray(e)?e.forEach(r):r(e),this}}Se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(Se.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),J.freezeMethods(Se);var Te=Se;function Ae(e,t){const n=this||ye,r=t||n,o=Te.from(r.headers);let s=r.data;return J.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Ce(e){return!(!e||!e.__CANCEL__)}function ve(e,t,n){W.call(this,null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError"}function Pe(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}J.inherits(ve,W,{__CANCEL__:!0});const ke=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Ue=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},je=e=>(...t)=>J.asap(()=>e(...t));var xe=pe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,_e=pe.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];J.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),J.isString(r)&&i.push("path="+r),J.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ne(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Le=e=>e instanceof Te?{...e}:e;function Fe(e,t){t=t||{};const n={};function r(e,t,n,r){return J.isPlainObject(e)&&J.isPlainObject(t)?J.merge.call({caseless:r},e,t):J.isPlainObject(t)?J.merge({},t):J.isArray(t)?t.slice():t}function o(e,t,n,o){return J.isUndefined(t)?J.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!J.isUndefined(t))return r(void 0,t)}function i(e,t){return J.isUndefined(t)?J.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(Le(e),Le(t),0,!0)};return J.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||o,i=s(e[r],t[r],r);J.isUndefined(i)&&s!==a||(n[r]=i)}),n}var Be=e=>{const t=Fe({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=Te.from(a),t.url=se(Ne(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),J.isFormData(r))if(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(pe.hasStandardBrowserEnv&&(o&&J.isFunction(o)&&(o=o(t)),o||!1!==o&&xe(t.url))){const e=s&&i&&_e.read(i);e&&a.set(s,e)}return t};var De="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Be(e);let o=r.data;const s=Te.from(r.headers).normalize();let i,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Te.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Pe(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new W("Network Error",W.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||ae;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,o.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&J.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),J.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),h&&([c,l]=ke(h,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=ke(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new ve(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===pe.protocols.indexOf(y)?n(new W("Unsupported protocol "+y+":",W.ERR_BAD_REQUEST,e)):m.send(o||null)})};var Ke=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new ve(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new W(`timeout ${t} of ms exceeded`,W.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>J.asap(i),a}};const qe=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Ie=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},$e=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Ie(e))yield*qe(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},Me="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ze=Me&&"function"==typeof ReadableStream,He=Me&&("function"==typeof TextEncoder?(Je=new TextEncoder,e=>Je.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Je;const We=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ve=ze&&We(()=>{let e=!1;const t=new Request(pe.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ge=ze&&We(()=>J.isReadableStream(new Response("").body)),Xe={stream:Ge&&(e=>e.body)};var Qe;Me&&(Qe=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Xe[e]&&(Xe[e]=J.isFunction(Qe[e])?t=>t[e]():(t,n)=>{throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})}));const Ze=async(e,t)=>{const n=J.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(J.isBlob(e))return e.size;if(J.isSpecCompliantForm(e)){const t=new Request(pe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return J.isArrayBufferView(e)||J.isArrayBuffer(e)?e.byteLength:(J.isURLSearchParams(e)&&(e+=""),J.isString(e)?(await He(e)).byteLength:void 0)})(t):n};var Ye=Me&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:f}=Be(e);u=u?(u+"").toLowerCase():"text";let h,p=Ke([o,s&&s.toAbortSignal()],i);const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let g;try{if(c&&Ve&&"get"!==n&&"head"!==n&&0!==(g=await Ze(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(J.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=Ue(g,ke(je(c)));r=$e(n.body,65536,e,t)}}J.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;h=new Request(t,{...f,signal:p,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?d:void 0});let s=await fetch(h,f);const i=Ge&&("stream"===u||"response"===u);if(Ge&&(a||i&&m)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=J.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&Ue(t,ke(je(a),!0))||[];s=new Response($e(s.body,65536,n,()=>{r&&r(),m&&m()}),e)}u=u||"text";let y=await Xe[J.findKey(Xe,u)||"text"](s,e);return!i&&m&&m(),await new Promise((t,n)=>{Pe(t,n,{data:y,headers:Te.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:h})})}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,h),{cause:t.cause||t});throw W.from(t,t&&t.code,e,h)}});const et={http:null,xhr:De,fetch:Ye};J.forEach(et,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const tt=e=>`- ${e}`,nt=e=>J.isFunction(e)||null===e||!1===e;var rt=e=>{e=J.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!nt(n)&&(r=et[(t=String(n)).toLowerCase()],void 0===r))throw new W(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+s]=r}if(!r){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new W("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(tt).join("\n"):" "+tt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function ot(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ve(null,e)}function st(e){ot(e),e.headers=Te.from(e.headers),e.data=Ae.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return rt(e.adapter||ye.adapter)(e).then(function(t){return ot(e),t.data=Ae.call(e,e.transformResponse,t),t.headers=Te.from(t.headers),t},function(t){return Ce(t)||(ot(e),t&&t.response&&(t.response.data=Ae.call(e,e.transformResponse,t.response),t.response.headers=Te.from(t.response.headers))),Promise.reject(t)})}const it="1.11.0",at={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{at[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ct={};at.transitional=function(e,t,n){function r(e,t){return"[Axios v"+it+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new W(r(o," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!ct[o]&&(ct[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},at.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var ut={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new W("option "+s+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+s,W.ERR_BAD_OPTION)}},validators:at};const lt=ut.validators;class dt{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Fe(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ut.assertOptions(n,{silentJSONParsing:lt.transitional(lt.boolean),forcedJSONParsing:lt.transitional(lt.boolean),clarifyTimeoutError:lt.transitional(lt.boolean)},!1),null!=r&&(J.isFunction(r)?t.paramsSerializer={serialize:r}:ut.assertOptions(r,{encode:lt.function,serialize:lt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ut.assertOptions(t,{baseUrl:lt.spelling("baseURL"),withXsrfToken:lt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&J.merge(o.common,o[t.method]);o&&J.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Te.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[st.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let f=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=st.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return se(Ne((e=Fe(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}J.forEach(["delete","get","head","options"],function(e){dt.prototype[e]=function(t,n){return this.request(Fe(n||{},{method:e,url:t,data:(n||{}).data}))}}),J.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Fe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}dt.prototype[e]=t(),dt.prototype[e+"Form"]=t(!0)});var ft=dt;class ht{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ve(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ht(function(t){e=t}),cancel:e}}}var pt=ht;const mt={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(mt).forEach(([e,t])=>{mt[t]=e});var gt=mt;const yt=function e(t){const r=new ft(t),o=n(ft.prototype.request,r);return J.extend(o,ft.prototype,r,{allOwnKeys:!0}),J.extend(o,r,null,{allOwnKeys:!0}),o.create=function(n){return e(Fe(t,n))},o}(ye);yt.Axios=ft,yt.CanceledError=ve,yt.CancelToken=pt,yt.isCancel=Ce,yt.VERSION=it,yt.toFormData=ee,yt.AxiosError=W,yt.Cancel=yt.CanceledError,yt.all=function(e){return Promise.all(e)},yt.spread=function(e){return function(t){return e.apply(null,t)}},yt.isAxiosError=function(e){return J.isObject(e)&&!0===e.isAxiosError},yt.mergeConfig=Fe,yt.AxiosHeaders=Te,yt.formToJSON=e=>me(J.isHTMLForm(e)?new FormData(e):e),yt.getAdapter=rt,yt.HttpStatusCode=gt,yt.default=yt;var wt=yt;async function bt(e,{method:t="GET",data:n={},headers:r={},timeout:o=5e3}={}){return"fetch"in window&&"AbortController"in window?async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i=new AbortController,a=setTimeout(()=>i.abort(),s),c={method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},signal:i.signal};"GET"!==c.method&&r&&(c.body=JSON.stringify(r));try{const t=await fetch(e,c);if(clearTimeout(a),!t.ok)return{code:t.status,msg:`HTTP请求失败: ${t.statusText}`,success:!1};try{return await t.json()}catch(e){return{code:-201,msg:"响应数据不是有效的JSON格式",success:!1}}}catch(e){return clearTimeout(a),"AbortError"===e.name?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:t,data:n,headers:r,timeout:o}):async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i={url:e,method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},timeout:s,["GET"===n.toUpperCase()?"params":"data"]:r};try{return(await wt(i)).data}catch(e){return"ECONNABORTED"===e.code?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:e.response?{code:e.response.status,msg:`HTTP请求失败: ${e.response.statusText}`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:t,data:n,headers:r,timeout:o})}const Et={accessCodeKey:"accessCode",tokenKey:"scm_token",timeout:5e3,headers:{},tokenApi:"",refreshCodeApi:"",logoutApi:"",logOutUrl:"",storage:localStorage,oldPwdKey:"oldPwd",newPwdKey:"newPwd",changePasswordApi:"",sendCaptchaCodeApi:"",typeKey:"type",codeKey:"code"};let Ot=null;function Rt(){return{async init(e={}){try{Ot=function(e,t){if(!t)return{...e};const n={...e};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(Et,e),function(e){if("string"!=typeof e.accessCodeKey||""===e.accessCodeKey.trim())throw new Error("accessCodeKey必须是有效的字符串");if("string"!=typeof e.tokenKey||""===e.tokenKey.trim())throw new Error("tokenKey必须是有效的字符串");if(e.storage&&("function"!=typeof e.storage.setItem||"function"!=typeof e.storage.getItem))throw new Error("storage必须实现setItem和getItem方法")}(Ot);const n=function(e,t){const n=t||window.location.href,r=new URL(n);let o=r.searchParams.get(e);if(null!==o)return o;if(r.hash.includes("?")){const t=r.hash.split("?")[1];return new URLSearchParams(t).get(e)}return null}(Ot.accessCodeKey);if(!Ot.tokenApi)return{code:-100,msg:"缺少tokenApi配置",success:!1};if(n){const e=await bt(Ot.tokenApi,{method:"POST",data:{accessCode:n},headers:Ot.headers,timeout:Ot.timeout});return 0===e.code&&e.data&&(Ot.storage.setItem(Ot.tokenKey,e.data),function(e){const t=new URL(window.location.href);let n,r;if(t.hash.includes("?")){const[o,s]=t.hash.split("?");if(n=new URLSearchParams(s),n.has(e)){n.delete(e);const s=n.toString()?`${o}?${n.toString()}`:o;t.hash=s,r=t.toString()}}else n=new URLSearchParams(t.search),n.has(e)&&(n.delete(e),t.search=n.toString(),r=t.toString());r&&r!==window.location.href&&window.location.replace(r)}(Ot.accessCodeKey)),e}return this.getToken()||Ot.logOutUrl&&(window.location.href=`${Ot.logOutUrl}?redirect_uri=${encodeURIComponent(t())}`),{code:0,msg:"初始化成功",success:!0}}catch(e){return{code:-100,msg:`初始化失败: ${e.message}`,success:!1}}},getToken:()=>Ot?Ot.storage.getItem(Ot.tokenKey):null,removeToken(){Ot&&Ot.storage.removeItem(Ot.tokenKey)},async logout(){if(!Ot)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!Ot.logoutApi)return{code:-102,msg:"未配置logoutApi",success:!1};const e=this.getToken();if(!e)return this.removeToken(),Ot.logOutUrl&&(window.location.href=`${Ot.logOutUrl}?redirect_uri=${encodeURIComponent(t())}`),{code:0,msg:"已成功清除token",success:!0};try{const n=await bt(Ot.logoutApi,{method:"POST",headers:{...Ot.headers,[Ot.tokenKey]:e},timeout:Ot.timeout});return this.removeToken(),Ot.logOutUrl&&(window.location.href=`${Ot.logOutUrl}?redirect_uri=${encodeURIComponent(t())}`),n}catch(e){return{code:-103,msg:`退出失败: ${e.message}`,success:!1}}},async toUrl(e,t="_self"){if(!Ot)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!e)return{code:-104,msg:"请提供跳转地址",success:!1};if(!["_self","_blank"].includes(t))return{code:-108,msg:'target参数必须是"_self"或"_blank"',success:!1};if(!Ot.refreshCodeApi)return{code:-105,msg:"未配置refreshCodeApi",success:!1};const n=this.getToken();if(!n){if(Ot.logOutUrl){const n=`${Ot.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;"_blank"===t?window.open(n,"_blank"):window.location.href=n}return{code:-106,msg:"未找到有效token",success:!1}}try{const r=await bt(Ot.refreshCodeApi,{method:"POST",headers:{...Ot.headers,[Ot.tokenKey]:n},timeout:Ot.timeout});if(0===r.code&&r.data){const n=new URL(e);n.searchParams.set(Ot.accessCodeKey,r.data);const o=n.toString();"_blank"===t?window.open(o,"_blank"):window.location.href=o}else{const n=`${Ot.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;"_blank"===t?window.open(n,"_blank"):window.location.href=n}return r}catch(n){const r=`${Ot.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;return"_blank"===t?window.open(r,"_blank"):window.location.href=r,{code:-107,msg:`跳转失败: ${n.message}`,success:!1}}},async getAccessCode(){if(!Ot)return{code:-101,msg:"请先调用init方法初始化",success:!1};const e=this.getToken();return e?Ot.refreshCodeApi?bt(Ot.refreshCodeApi,{method:"POST",headers:{...Ot.headers,[Ot.tokenKey]:e},timeout:Ot.timeout}):{code:-105,msg:"未配置refreshCodeApi",success:!1}:{code:-106,msg:"未找到有效token",success:!1}},getConfig:()=>({...Ot}),async changePassword(e={}){if(!e[Ot.oldPwdKey]&&"CAPTCHA"!==e[Ot.typeKey])return{code:-1,msg:"请输入旧密码",success:!1};if(!e[Ot.newPwdKey])return{code:-1,msg:"请输入新密码",success:!1};if("CAPTCHA"===e[Ot.typeKey]&&!e[Ot.codeKey])return{code:-1,msg:"请输入验证码",success:!1};const t=this.getToken();return bt(Ot.changePasswordApi,{method:"POST",headers:{...Ot.headers,[Ot.tokenKey]:t},timeout:Ot.timeout,data:{[Ot.oldPwdKey]:e[Ot.oldPwdKey],[Ot.newPwdKey]:e[Ot.newPwdKey],...e}})},async getPhoneCode(){const e=this.getToken();return bt(Ot.sendCaptchaCodeApi,{method:"GET",headers:{...Ot.headers,[Ot.tokenKey]:e},timeout:Ot.timeout})}}}const St=Rt();e.createSSO=Rt,e.default=St,e.lgsso=St,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lgsso={})}(this,function(e){"use strict";function t(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:r}=Object,{iterator:o,toStringTag:s}=Symbol,i=(a=Object.create(null),e=>{const t=n.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>i(t)===e),u=e=>t=>typeof t===e,{isArray:l}=Array,d=u("undefined");function f(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&m(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const h=c("ArrayBuffer");const p=u("string"),m=u("function"),g=u("number"),y=e=>null!==e&&"object"==typeof e,w=e=>{if("object"!==i(e))return!1;const t=r(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||s in e||o in e)},b=c("Date"),E=c("File"),O=c("Blob"),R=c("FileList"),S=c("URLSearchParams"),[T,A,C,v]=["ReadableStream","Request","Response","Headers"].map(c);function U(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(f(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function _(e,t){if(f(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,k=e=>!d(e)&&e!==P;const j=(x="undefined"!=typeof Uint8Array&&r(Uint8Array),e=>x&&e instanceof x);var x;const N=c("HTMLFormElement"),L=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),F=c("RegExp"),B=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};U(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const D=c("AsyncFunction"),K=(q="function"==typeof setImmediate,I=m(P.postMessage),q?setImmediate:I?($=`axios@${Math.random()}`,M=[],P.addEventListener("message",({source:e,data:t})=>{e===P&&t===$&&M.length&&M.shift()()},!1),e=>{M.push(e),P.postMessage($,"*")}):e=>setTimeout(e));var q,I,$,M;const z="undefined"!=typeof queueMicrotask?queueMicrotask.bind(P):"undefined"!=typeof process&&process.nextTick||K;var J={isArray:l,isArrayBuffer:h,isBuffer:f,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||m(e.append)&&("formdata"===(t=i(e))||"object"===t&&m(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:p,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:w,isEmptyObject:e=>{if(!y(e)||f(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:T,isRequest:A,isResponse:C,isHeaders:v,isUndefined:d,isDate:b,isFile:E,isBlob:O,isRegExp:F,isFunction:m,isStream:e=>y(e)&&m(e.pipe),isURLSearchParams:S,isTypedArray:j,isFileList:R,forEach:U,merge:function e(){const{caseless:t}=k(this)&&this||{},n={},r=(r,o)=>{const s=t&&_(n,o)||o;w(n[s])&&w(r)?n[s]=e(n[s],r):w(r)?n[s]=e({},r):l(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&U(arguments[e],r);return n},extend:(e,n,r,{allOwnKeys:o}={})=>(U(n,(n,o)=>{r&&m(n)?e[o]=t(n,r):e[o]=n},{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,o)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&r(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!g(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[o]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:N,hasOwnProperty:L,hasOwnProp:L,reduceDescriptors:B,freezeMethods:e=>{B(e,(t,n)=>{if(m(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];m(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:_,global:P,isContextDefined:k,isSpecCompliantForm:function(e){return!!(e&&m(e.append)&&"FormData"===e[s]&&e[o])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(f(e))return e;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return U(e,(e,t)=>{const s=n(e,r+1);!d(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:D,isThenable:e=>e&&(y(e)||m(e))&&m(e.then)&&m(e.catch),setImmediate:K,asap:z,isIterable:e=>null!=e&&m(e[o])};function H(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}J.inherits(H,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:J.toJSONObject(this.config),code:this.code,status:this.status}}});const W=H.prototype,V={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{V[e]={value:e}}),Object.defineProperties(H,V),Object.defineProperty(W,"isAxiosError",{value:!0}),H.from=(e,t,n,r,o,s)=>{const i=Object.create(W);return J.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e),H.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function G(e){return J.isPlainObject(e)||J.isArray(e)}function X(e){return J.endsWith(e,"[]")?e.slice(0,-2):e}function Q(e,t,n){return e?e.concat(t).map(function(e,t){return e=X(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Z=J.toFlatObject(J,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!J.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=J.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!J.isUndefined(t[e])})).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&J.isSpecCompliantForm(t);if(!J.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(J.isDate(e))return e.toISOString();if(J.isBoolean(e))return e.toString();if(!a&&J.isBlob(e))throw new H("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(e)||J.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(J.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(J.isArray(e)&&function(e){return J.isArray(e)&&!e.some(G)}(e)||(J.isFileList(e)||J.endsWith(n,"[]"))&&(a=J.toArray(e)))return n=X(n),a.forEach(function(e,r){!J.isUndefined(e)&&null!==e&&t.append(!0===i?Q([n],r,s):null===i?n:n+"[]",c(e))}),!1;return!!G(e)||(t.append(Q(o,n,s),c(e)),!1)}const l=[],d=Object.assign(Z,{defaultVisitor:u,convertValue:c,isVisitable:G});if(!J.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!J.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),J.forEach(n,function(n,s){!0===(!(J.isUndefined(n)||null===n)&&o.call(t,n,J.isString(s)?s.trim():s,r,d))&&e(n,r?r.concat(s):[s])}),l.pop()}}(e),t}function ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function te(e,t){this._pairs=[],e&&Y(e,this,t)}const ne=te.prototype;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function oe(e,t,n){if(!t)return e;const r=n&&n.encode||re;J.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(s=o?o(t,n):J.isURLSearchParams(t)?t.toString():new te(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ne.append=function(e,t){this._pairs.push([e,t])},ne.toString=function(e){const t=e?function(t){return e.call(this,t,ee)}:ee;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var se=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,function(t){null!==t&&e(t)})}},ie={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:te,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ce="undefined"!=typeof window&&"undefined"!=typeof document,ue="object"==typeof navigator&&navigator||void 0,le=ce&&(!ue||["ReactNative","NativeScript","NS"].indexOf(ue.product)<0),de="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,fe=ce&&window.location.href||"http://localhost";var he={...Object.freeze({__proto__:null,hasBrowserEnv:ce,hasStandardBrowserEnv:le,hasStandardBrowserWebWorkerEnv:de,navigator:ue,origin:fe}),...ae};function pe(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&J.isArray(r)?r.length:s,a)return J.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&J.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&J.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if(J.isFormData(e)&&J.isFunction(e.entries)){const n={};return J.forEachEntry(e,(e,r)=>{t(function(e){return J.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const me={transitional:ie,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=J.isObject(e);o&&J.isHTMLForm(e)&&(e=new FormData(e));if(J.isFormData(e))return r?JSON.stringify(pe(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new he.classes.URLSearchParams,{visitor:function(e,t,n,r){return he.isNode&&J.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=J.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(J.isString(e))try{return(t||JSON.parse)(e),J.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||me.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw H.from(e,H.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:he.classes.FormData,Blob:he.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],e=>{me.headers[e]={}});var ge=me;const ye=J.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"]);const we=Symbol("internals");function be(e){return e&&String(e).trim().toLowerCase()}function Ee(e){return!1===e||null==e?e:J.isArray(e)?e.map(Ee):String(e)}function Oe(e,t,n,r,o){return J.isFunction(r)?r.call(this,t,n):(o&&(t=n),J.isString(t)?J.isString(r)?-1!==t.indexOf(r):J.isRegExp(r)?r.test(t):void 0:void 0)}class Re{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=be(t);if(!o)throw new Error("header name must be a non-empty string");const s=J.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=Ee(e))}const s=(e,t)=>J.forEach(e,(e,n)=>o(e,n,t));if(J.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(J.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ye[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(J.isObject(e)&&J.isIterable(e)){let n,r,o={};for(const t of e){if(!J.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?J.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=be(e)){const n=J.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(J.isFunction(t))return t.call(this,e,n);if(J.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=be(e)){const n=J.findKey(this,e);return!(!n||void 0===this[n]||t&&!Oe(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=be(e)){const o=J.findKey(n,e);!o||t&&!Oe(0,n[o],o,t)||(delete n[o],r=!0)}}return J.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Oe(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return J.forEach(this,(r,o)=>{const s=J.findKey(n,o);if(s)return t[s]=Ee(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=Ee(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return J.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&J.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[we]=this[we]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=be(e);t[r]||(!function(e,t){const n=J.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return J.isArray(e)?e.forEach(r):r(e),this}}Re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(Re.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),J.freezeMethods(Re);var Se=Re;function Te(e,t){const n=this||ge,r=t||n,o=Se.from(r.headers);let s=r.data;return J.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Ae(e){return!(!e||!e.__CANCEL__)}function Ce(e,t,n){H.call(this,null==e?"canceled":e,H.ERR_CANCELED,t,n),this.name="CanceledError"}function ve(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new H("Request failed with status code "+n.status,[H.ERR_BAD_REQUEST,H.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}J.inherits(Ce,H,{__CANCEL__:!0});const Ue=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},_e=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Pe=e=>(...t)=>J.asap(()=>e(...t));var ke=he.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,he.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(he.origin),he.navigator&&/(msie|trident)/i.test(he.navigator.userAgent)):()=>!0,je=he.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];J.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),J.isString(r)&&i.push("path="+r),J.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function xe(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ne=e=>e instanceof Se?{...e}:e;function Le(e,t){t=t||{};const n={};function r(e,t,n,r){return J.isPlainObject(e)&&J.isPlainObject(t)?J.merge.call({caseless:r},e,t):J.isPlainObject(t)?J.merge({},t):J.isArray(t)?t.slice():t}function o(e,t,n,o){return J.isUndefined(t)?J.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!J.isUndefined(t))return r(void 0,t)}function i(e,t){return J.isUndefined(t)?J.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(Ne(e),Ne(t),0,!0)};return J.forEach(Object.keys({...e,...t}),function(r){const s=c[r]||o,i=s(e[r],t[r],r);J.isUndefined(i)&&s!==a||(n[r]=i)}),n}var Fe=e=>{const t=Le({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=Se.from(a),t.url=oe(xe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),J.isFormData(r))if(he.hasStandardBrowserEnv||he.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map(e=>e.trim()).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(he.hasStandardBrowserEnv&&(o&&J.isFunction(o)&&(o=o(t)),o||!1!==o&&ke(t.url))){const e=s&&i&&je.read(i);e&&a.set(s,e)}return t};var Be="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Fe(e);let o=r.data;const s=Se.from(r.headers).normalize();let i,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Se.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ve(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new H("Request aborted",H.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new H("Network Error",H.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||ie;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new H(t,o.clarifyTimeoutError?H.ETIMEDOUT:H.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&J.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),J.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),h&&([c,l]=Ue(h,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=Ue(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Ce(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===he.protocols.indexOf(y)?n(new H("Unsupported protocol "+y+":",H.ERR_BAD_REQUEST,e)):m.send(o||null)})};var De=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof H?t:new Ce(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new H(`timeout ${t} of ms exceeded`,H.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>J.asap(i),a}};const Ke=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},qe=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ie=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of qe(e))yield*Ke(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},$e="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Me=$e&&"function"==typeof ReadableStream,ze=$e&&("function"==typeof TextEncoder?(Je=new TextEncoder,e=>Je.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Je;const He=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},We=Me&&He(()=>{let e=!1;const t=new Request(he.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ve=Me&&He(()=>J.isReadableStream(new Response("").body)),Ge={stream:Ve&&(e=>e.body)};var Xe;$e&&(Xe=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ge[e]&&(Ge[e]=J.isFunction(Xe[e])?t=>t[e]():(t,n)=>{throw new H(`Response type '${e}' is not supported`,H.ERR_NOT_SUPPORT,n)})}));const Qe=async(e,t)=>{const n=J.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(J.isBlob(e))return e.size;if(J.isSpecCompliantForm(e)){const t=new Request(he.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return J.isArrayBufferView(e)||J.isArrayBuffer(e)?e.byteLength:(J.isURLSearchParams(e)&&(e+=""),J.isString(e)?(await ze(e)).byteLength:void 0)})(t):n};var Ze=$e&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:f}=Fe(e);u=u?(u+"").toLowerCase():"text";let h,p=De([o,s&&s.toAbortSignal()],i);const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let g;try{if(c&&We&&"get"!==n&&"head"!==n&&0!==(g=await Qe(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});if(J.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body){const[e,t]=_e(g,Ue(Pe(c)));r=Ie(n.body,65536,e,t)}}J.isString(d)||(d=d?"include":"omit");const o="credentials"in Request.prototype;h=new Request(t,{...f,signal:p,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?d:void 0});let s=await fetch(h,f);const i=Ve&&("stream"===u||"response"===u);if(Ve&&(a||i&&m)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=s[t]});const t=J.toFiniteNumber(s.headers.get("content-length")),[n,r]=a&&_e(t,Ue(Pe(a),!0))||[];s=new Response(Ie(s.body,65536,n,()=>{r&&r(),m&&m()}),e)}u=u||"text";let y=await Ge[J.findKey(Ge,u)||"text"](s,e);return!i&&m&&m(),await new Promise((t,n)=>{ve(t,n,{data:y,headers:Se.from(s.headers),status:s.status,statusText:s.statusText,config:e,request:h})})}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new H("Network Error",H.ERR_NETWORK,e,h),{cause:t.cause||t});throw H.from(t,t&&t.code,e,h)}});const Ye={http:null,xhr:Be,fetch:Ze};J.forEach(Ye,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const et=e=>`- ${e}`,tt=e=>J.isFunction(e)||null===e||!1===e;var nt=e=>{e=J.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s<t;s++){let t;if(n=e[s],r=n,!tt(n)&&(r=Ye[(t=String(n)).toLowerCase()],void 0===r))throw new H(`Unknown adapter '${t}'`);if(r)break;o[t||"#"+s]=r}if(!r){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new H("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(et).join("\n"):" "+et(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function rt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ce(null,e)}function ot(e){rt(e),e.headers=Se.from(e.headers),e.data=Te.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nt(e.adapter||ge.adapter)(e).then(function(t){return rt(e),t.data=Te.call(e,e.transformResponse,t),t.headers=Se.from(t.headers),t},function(t){return Ae(t)||(rt(e),t&&t.response&&(t.response.data=Te.call(e,e.transformResponse,t.response),t.response.headers=Se.from(t.response.headers))),Promise.reject(t)})}const st="1.11.0",it={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{it[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const at={};it.transitional=function(e,t,n){function r(e,t){return"[Axios v"+st+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new H(r(o," has been removed"+(t?" in "+t:"")),H.ERR_DEPRECATED);return t&&!at[o]&&(at[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},it.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var ct={assertOptions:function(e,t,n){if("object"!=typeof e)throw new H("options must be an object",H.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new H("option "+s+" must be "+n,H.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new H("Unknown option "+s,H.ERR_BAD_OPTION)}},validators:it};const ut=ct.validators;class lt{constructor(e){this.defaults=e||{},this.interceptors={request:new se,response:new se}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Le(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ct.assertOptions(n,{silentJSONParsing:ut.transitional(ut.boolean),forcedJSONParsing:ut.transitional(ut.boolean),clarifyTimeoutError:ut.transitional(ut.boolean)},!1),null!=r&&(J.isFunction(r)?t.paramsSerializer={serialize:r}:ct.assertOptions(r,{encode:ut.function,serialize:ut.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ct.assertOptions(t,{baseUrl:ut.spelling("baseURL"),withXsrfToken:ut.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&J.merge(o.common,o[t.method]);o&&J.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Se.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[ot.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=i.length;let f=t;for(d=0;d<l;){const e=i[d++],t=i[d++];try{f=e(f)}catch(e){t.call(this,e);break}}try{u=ot.call(this,f)}catch(e){return Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return oe(xe((e=Le(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}J.forEach(["delete","get","head","options"],function(e){lt.prototype[e]=function(t,n){return this.request(Le(n||{},{method:e,url:t,data:(n||{}).data}))}}),J.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Le(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}lt.prototype[e]=t(),lt.prototype[e+"Form"]=t(!0)});var dt=lt;class ft{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Ce(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ft(function(t){e=t}),cancel:e}}}var ht=ft;const pt={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(pt).forEach(([e,t])=>{pt[t]=e});var mt=pt;const gt=function e(n){const r=new dt(n),o=t(dt.prototype.request,r);return J.extend(o,dt.prototype,r,{allOwnKeys:!0}),J.extend(o,r,null,{allOwnKeys:!0}),o.create=function(t){return e(Le(n,t))},o}(ge);gt.Axios=dt,gt.CanceledError=Ce,gt.CancelToken=ht,gt.isCancel=Ae,gt.VERSION=st,gt.toFormData=Y,gt.AxiosError=H,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=function(e){return function(t){return e.apply(null,t)}},gt.isAxiosError=function(e){return J.isObject(e)&&!0===e.isAxiosError},gt.mergeConfig=Le,gt.AxiosHeaders=Se,gt.formToJSON=e=>pe(J.isHTMLForm(e)?new FormData(e):e),gt.getAdapter=nt,gt.HttpStatusCode=mt,gt.default=gt;var yt=gt;async function wt(e,{method:t="GET",data:n={},headers:r={},timeout:o=5e3}={}){return"fetch"in window&&"AbortController"in window?async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i=new AbortController,a=setTimeout(()=>i.abort(),s),c={method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},signal:i.signal};"GET"!==c.method&&r&&(c.body=JSON.stringify(r));try{const t=await fetch(e,c);if(clearTimeout(a),!t.ok)return{code:t.status,msg:`HTTP请求失败: ${t.statusText}`,success:!1};try{return await t.json()}catch(e){return{code:-201,msg:"响应数据不是有效的JSON格式",success:!1}}}catch(e){return clearTimeout(a),"AbortError"===e.name?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:t,data:n,headers:r,timeout:o}):async function(e,t){const{method:n="GET",data:r={},headers:o={},timeout:s=5e3}=t,i={url:e,method:n.toUpperCase(),headers:{"Content-Type":"application/json",...o},timeout:s,["GET"===n.toUpperCase()?"params":"data"]:r};try{return(await yt(i)).data}catch(e){return"ECONNABORTED"===e.code?{code:-202,msg:`请求超时(${s}ms)`,success:!1}:e.response?{code:e.response.status,msg:`HTTP请求失败: ${e.response.statusText}`,success:!1}:{code:-203,msg:`网络请求失败: ${e.message}`,success:!1}}}(e,{method:t,data:n,headers:r,timeout:o})}const bt={accessCodeKey:"accessCode",tokenKey:"scm_token",timeout:5e3,headers:{},tokenApi:"",refreshCodeApi:"",logoutApi:"",logOutUrl:"",storage:localStorage,oldPwdKey:"oldPwd",newPwdKey:"newPwd",changePasswordApi:"",sendCaptchaCodeApi:"",typeKey:"type",codeKey:"code"};let Et=null;function Ot(){return{async init(e={}){try{Et=function(e,t){if(!t)return{...e};const n={...e};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(bt,e),function(e){if("string"!=typeof e.accessCodeKey||""===e.accessCodeKey.trim())throw new Error("accessCodeKey必须是有效的字符串");if("string"!=typeof e.tokenKey||""===e.tokenKey.trim())throw new Error("tokenKey必须是有效的字符串");if(e.storage&&("function"!=typeof e.storage.setItem||"function"!=typeof e.storage.getItem))throw new Error("storage必须实现setItem和getItem方法")}(Et);const t=function(e,t){const n=t||window.location.href,r=new URL(n);let o=r.searchParams.get(e);if(null!==o)return o;if(r.hash.includes("?")){const t=r.hash.split("?")[1];return new URLSearchParams(t).get(e)}return null}(Et.accessCodeKey);if(!Et.tokenApi)return{code:-100,msg:"缺少tokenApi配置",success:!1};if(t){const e=await wt(Et.tokenApi,{method:"POST",data:{accessCode:t},headers:Et.headers,timeout:Et.timeout});return 0===e.code&&e.data&&(Et.storage.setItem(Et.tokenKey,e.data),function(e){const t=new URL(window.location.href);let n,r;if(t.hash.includes("?")){const[o,s]=t.hash.split("?");if(n=new URLSearchParams(s),n.has(e)){n.delete(e);const s=n.toString()?`${o}?${n.toString()}`:o;t.hash=s,r=t.toString()}}else n=new URLSearchParams(t.search),n.has(e)&&(n.delete(e),t.search=n.toString(),r=t.toString());r&&r!==window.location.href&&window.location.replace(r)}(Et.accessCodeKey)),e}return this.getToken()||Et.logOutUrl&&(window.location.href=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(window.location.href)}`),{code:0,msg:"初始化成功",success:!0}}catch(e){return{code:-100,msg:`初始化失败: ${e.message}`,success:!1}}},getToken:()=>Et?Et.storage.getItem(Et.tokenKey):null,removeToken(){Et&&Et.storage.removeItem(Et.tokenKey)},_doJump(e,t,n){"_blank"===t&&n?(n.location.href=e,setTimeout(()=>{n.closed&&(window.location.href=e)},100)):(window.location.replace(e),setTimeout(()=>{window.location.href!==e&&(window.location.href=e)},0))},async toUrl(e,t="_self"){if(!Et)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!e)return{code:-104,msg:"请提供跳转地址",success:!1};if(!["_self","_blank"].includes(t))return{code:-108,msg:'target参数必须是"_self"或"_blank"',success:!1};if(!Et.refreshCodeApi)return{code:-105,msg:"未配置refreshCodeApi",success:!1};let n=null;if("_blank"===t)try{n=window.open("","_blank"),n||(t="_self")}catch(e){t="_self"}const r=this.getToken();if(!r){if(Et.logOutUrl){const r=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;this._doJump(r,t,n)}return{code:-106,msg:"未找到有效token",success:!1}}try{const o=await wt(Et.refreshCodeApi,{method:"POST",headers:{...Et.headers,[Et.tokenKey]:r},timeout:Et.timeout});if(0===o.code&&o.data){let r="";try{const t=window.location.origin+window.location.pathname,n=new URL(e,t);n.searchParams.set(Et.accessCodeKey,o.data),r=n.toString()}catch(t){r=e+(e.includes("?")?"&":"?")+`${Et.accessCodeKey}=${o.data}`}this._doJump(r,t,n)}else if(Et.logOutUrl){const r=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;this._doJump(r,t,n)}return o}catch(r){if(Et.logOutUrl){const r=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;_doJump(r,t,n)}return{code:-107,msg:`跳转失败: ${r.message}`,success:!1}}},async toUrl(e,t="_self"){if(!Et)return{code:-101,msg:"请先调用init方法初始化",success:!1};if(!e)return{code:-104,msg:"请提供跳转地址",success:!1};if(!["_self","_blank"].includes(t))return{code:-108,msg:'target参数必须是"_self"或"_blank"',success:!1};if(!Et.refreshCodeApi)return{code:-105,msg:"未配置refreshCodeApi",success:!1};const n=this.getToken();if(!n){if(Et.logOutUrl){const n=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;"_blank"===t?window.open(n,"_blank"):window.location.href=n}return{code:-106,msg:"未找到有效token",success:!1}}try{const r=await wt(Et.refreshCodeApi,{method:"POST",headers:{...Et.headers,[Et.tokenKey]:n},timeout:Et.timeout});if(0===r.code&&r.data){const n=new URL(e);n.searchParams.set(Et.accessCodeKey,r.data);const o=n.toString();"_blank"===t?window.open(o,"_blank"):window.location.href=o}else{const n=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;"_blank"===t?window.open(n,"_blank"):window.location.href=n}return r}catch(n){const r=`${Et.logOutUrl}?redirect_uri=${encodeURIComponent(e)}`;return"_blank"===t?window.open(r,"_blank"):window.location.href=r,{code:-107,msg:`跳转失败: ${n.message}`,success:!1}}},async getAccessCode(){if(!Et)return{code:-101,msg:"请先调用init方法初始化",success:!1};const e=this.getToken();return e?Et.refreshCodeApi?wt(Et.refreshCodeApi,{method:"POST",headers:{...Et.headers,[Et.tokenKey]:e},timeout:Et.timeout}):{code:-105,msg:"未配置refreshCodeApi",success:!1}:{code:-106,msg:"未找到有效token",success:!1}},getConfig:()=>({...Et}),async changePassword(e={}){if(!e[Et.oldPwdKey]&&"CAPTCHA"!==e[Et.typeKey])return{code:-1,msg:"请输入旧密码",success:!1};if(!e[Et.newPwdKey])return{code:-1,msg:"请输入新密码",success:!1};if("CAPTCHA"===e[Et.typeKey]&&!e[Et.codeKey])return{code:-1,msg:"请输入验证码",success:!1};const t=this.getToken();return wt(Et.changePasswordApi,{method:"POST",headers:{...Et.headers,[Et.tokenKey]:t},timeout:Et.timeout,data:{[Et.oldPwdKey]:e[Et.oldPwdKey],[Et.newPwdKey]:e[Et.newPwdKey],...e}})},async getPhoneCode(){const e=this.getToken();return wt(Et.sendCaptchaCodeApi,{method:"GET",headers:{...Et.headers,[Et.tokenKey]:e},timeout:Et.timeout})}}}const Rt=Ot();e.createSSO=Ot,e.default=Rt,e.lgsso=Rt,Object.defineProperty(e,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=lgsso-sdk.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lgsso-sdk",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "type": "module",
5
5
  "description": "无框架依赖的单点登录SDK",
6
6
  "main": "dist/lgsso-sdk.cjs",
package/src/sso.js CHANGED
@@ -110,49 +110,125 @@ export function createSSO() {
110
110
  if (!config || !isBrowser()) return;
111
111
  config.storage.removeItem(config.tokenKey);
112
112
  },
113
-
114
113
  /**
115
- * 退出登录
116
- * @returns {Promise<Object>} 接口返回结果
114
+ * 统一跳转逻辑(适配iOS)
115
+ * @param {string} url - 跳转地址
116
+ * @param {string} target - _self/_blank
117
+ * @param {Window|null} newWindow - 提前创建的新窗口引用
117
118
  */
118
- async logout() {
119
+ _doJump(url, target, newWindow) {
120
+ if (target === '_blank' && newWindow) {
121
+ // 给提前创建的空窗口赋值URL(iOS 唯一能生效的方式)
122
+ newWindow.location.href = url;
123
+ // 兜底:如果新窗口被关闭,降级到当前页
124
+ setTimeout(() => {
125
+ if (newWindow.closed) {
126
+ window.location.href = url;
127
+ }
128
+ }, 100);
129
+ } else {
130
+ // _self 跳转:iOS 兼容 - 强制替换历史记录,避免返回问题
131
+ window.location.replace(url);
132
+ // 兜底:replace 失效时用 href
133
+ setTimeout(() => {
134
+ if (window.location.href !== url) {
135
+ window.location.href = url;
136
+ }
137
+ }, 0);
138
+ }
139
+ },
140
+ /**
141
+ * 用token换取新accessCode并跳转到指定URL(兼容iOS Safari)
142
+ * @param {string} redirectUrl - 目标跳转地址(建议传绝对路径)
143
+ * @param {string} target - 当前页面:_self、新页面打开:_blank,默认当前页_self
144
+ * @returns {Promise<Object>} 接口返回结果
145
+ */
146
+ async toUrl(redirectUrl, target = '_self') {
119
147
  if (!config) {
120
148
  return { code: -101, msg: '请先调用init方法初始化', success: false };
121
149
  }
122
150
 
123
- if (!config.logoutApi) {
124
- return { code: -102, msg: '未配置logoutApi', success: false };
151
+ if (!redirectUrl) {
152
+ return { code: -104, msg: '请提供跳转地址', success: false };
125
153
  }
126
154
 
127
- const token = this.getToken();
128
- if (token) {
155
+ // 验证target参数有效性
156
+ if (!['_self', '_blank'].includes(target)) {
157
+ return { code: -108, msg: 'target参数必须是"_self"或"_blank"', success: false };
158
+ }
159
+
160
+ if (!config.refreshCodeApi) {
161
+ return { code: -105, msg: '未配置refreshCodeApi', success: false };
162
+ }
163
+
164
+ // ========== iOS 适配:提前创建新窗口(保留用户交互上下文) ==========
165
+ let newWindow = null;
166
+ if (target === '_blank' && isBrowser()) {
167
+ // 同步阶段(用户交互内)先创建空窗口,避免异步后被拦截
129
168
  try {
130
- const result = await request(
131
- config.logoutApi,
132
- {
133
- method: 'POST',
134
- headers: { ...config.headers, [config.tokenKey]: token },
135
- timeout: config.timeout
136
- }
137
- );
138
- this.removeToken();
169
+ newWindow = window.open('', '_blank');
170
+ // iOS Safari 中创建失败会返回 null,提前降级
171
+ if (!newWindow) {
172
+ target = '_self';
173
+ }
174
+ } catch (e) {
175
+ target = '_self';
176
+ }
177
+ }
139
178
 
179
+ const token = this.getToken();
180
+ if (!token) {
181
+ if (isBrowser() && config.logOutUrl) {
182
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
183
+ // 执行跳转(提前创建的窗口直接赋值URL)
184
+ this._doJump(loginUrl, target, newWindow);
185
+ }
186
+ return { code: -106, msg: '未找到有效token', success: false };
187
+ }
188
+
189
+ try {
190
+ const result = await request(
191
+ config.refreshCodeApi,
192
+ {
193
+ method: 'POST',
194
+ headers: { ...config.headers, [config.tokenKey]: token },
195
+ timeout: config.timeout
196
+ }
197
+ );
198
+
199
+ if (result.code === 0 && result.data && isBrowser()) {
200
+ // ========== iOS 兼容:URL 解析(确保绝对路径) ==========
201
+ let targetUrl = '';
202
+ try {
203
+ // 兼容相对路径:基于当前页面URL解析
204
+ const baseUrl = window.location.origin + window.location.pathname;
205
+ const url = new URL(redirectUrl, baseUrl);
206
+ url.searchParams.set(config.accessCodeKey, result.data);
207
+ targetUrl = url.toString();
208
+ } catch (e) {
209
+ // 解析失败时降级拼接
210
+ targetUrl = redirectUrl + (redirectUrl.includes('?') ? '&' : '?') + `${config.accessCodeKey}=${result.data}`;
211
+ }
212
+ // 执行跳转
213
+ this._doJump(targetUrl, target, newWindow);
214
+ } else {
140
215
  if (isBrowser() && config.logOutUrl) {
141
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
216
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
217
+ this._doJump(loginUrl, target, newWindow);
142
218
  }
143
- return result;
144
- } catch (error) {
145
- return { code: -103, msg: `退出失败: ${error.message}`, success: false };
146
219
  }
147
- } else {
148
- this.removeToken();
220
+ return result;
221
+ } catch (error) {
149
222
  if (isBrowser() && config.logOutUrl) {
150
- window.location.href = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(getCurrentUrlWithParams())}`;
223
+ const loginUrl = `${config.logOutUrl}?redirect_uri=${encodeURIComponent(redirectUrl)}`;
224
+ _doJump(loginUrl, target, newWindow);
151
225
  }
152
- return { code: 0, msg: '已成功清除token', success: true };
226
+ return { code: -107, msg: `跳转失败: ${error.message}`, success: false };
153
227
  }
154
228
  },
155
229
 
230
+
231
+
156
232
  /**
157
233
  * 用token换取新accessCode并跳转到指定URL
158
234
  * @param {string} redirectUrl - 目标跳转地址