@jctrans-materials/shared 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/baseSearch.d.ts +161 -0
- package/dist/api/searchV2.d.ts +143 -0
- package/dist/config/index.d.ts +16 -0
- package/dist/index.cjs.js +6 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.esm.js +2356 -0
- package/dist/utils/request/adapters/axios.d.ts +2 -0
- package/dist/utils/request/adapters/fetch.d.ts +2 -0
- package/dist/utils/request/index.d.ts +12 -0
- package/dist/utils/request/types.d.ts +13 -0
- package/package.json +33 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export type DisplayInfo = "Continent" | "Country" | "Province" | "City" | "Seaport" | "Airport";
|
|
2
|
+
export type AppointSearchName = "continentId" | "countryId" | "cityId" | "provinceId" | "seaportId" | "airportId" | "allCityByCountryId";
|
|
3
|
+
export interface AppointSearch {
|
|
4
|
+
name: AppointSearchName;
|
|
5
|
+
val: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CommonParams {
|
|
8
|
+
current?: number;
|
|
9
|
+
size?: number;
|
|
10
|
+
level?: 1 | 2 | 3 | 4;
|
|
11
|
+
searchContent?: string;
|
|
12
|
+
displayInfo?: DisplayInfo[];
|
|
13
|
+
sort?: "nameEn" | string;
|
|
14
|
+
appointSearch?: AppointSearch[];
|
|
15
|
+
_extra?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
export interface BaseResponse<T = any> {
|
|
18
|
+
records: T[];
|
|
19
|
+
total: number;
|
|
20
|
+
size: number;
|
|
21
|
+
current: number;
|
|
22
|
+
pages?: number;
|
|
23
|
+
[k: string]: any;
|
|
24
|
+
}
|
|
25
|
+
/** 归一化之后的实体 */
|
|
26
|
+
export interface UnifiedItem {
|
|
27
|
+
id: number | string;
|
|
28
|
+
type: DisplayInfo;
|
|
29
|
+
nameCn?: string;
|
|
30
|
+
nameEn?: string;
|
|
31
|
+
display?: string;
|
|
32
|
+
continent?: Record<string, any>;
|
|
33
|
+
country?: Record<string, any>;
|
|
34
|
+
city?: Record<string, any>;
|
|
35
|
+
province?: Record<string, any>;
|
|
36
|
+
raw?: any;
|
|
37
|
+
}
|
|
38
|
+
/** 通用后端调用(直接回 raw 后端格式) */
|
|
39
|
+
declare function rawFetch(params: CommonParams): Promise<BaseResponse<any>>;
|
|
40
|
+
/**
|
|
41
|
+
* 统一搜索接口
|
|
42
|
+
* - 支持 keyword(模糊), displayInfo(数组), ids(按 type), scope(countryId/cityId/provinceId)
|
|
43
|
+
* - 返回扁平化的 UnifiedItem 列表 + 分页信息
|
|
44
|
+
*/
|
|
45
|
+
export declare function search(params: {
|
|
46
|
+
keyword?: string;
|
|
47
|
+
displayInfo?: DisplayInfo[];
|
|
48
|
+
page?: number;
|
|
49
|
+
size?: number;
|
|
50
|
+
level?: 1 | 2 | 3 | 4;
|
|
51
|
+
sort?: string;
|
|
52
|
+
ids?: {
|
|
53
|
+
type: DisplayInfo;
|
|
54
|
+
ids: number[];
|
|
55
|
+
}[];
|
|
56
|
+
scope?: {
|
|
57
|
+
countryId?: number;
|
|
58
|
+
cityId?: number;
|
|
59
|
+
provinceId?: number;
|
|
60
|
+
};
|
|
61
|
+
extraAppoint?: AppointSearch[];
|
|
62
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
63
|
+
/**
|
|
64
|
+
* 按名称搜索指定类型
|
|
65
|
+
*/
|
|
66
|
+
export declare function searchByName(params: {
|
|
67
|
+
keyword: string;
|
|
68
|
+
types?: DisplayInfo[];
|
|
69
|
+
page?: number;
|
|
70
|
+
size?: number;
|
|
71
|
+
level?: 1 | 2 | 3 | 4;
|
|
72
|
+
sort?: string;
|
|
73
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
74
|
+
/** 按 type + ids 精确查询(回显/编辑页) */
|
|
75
|
+
export declare function getByIds(type: DisplayInfo, ids: number[] | number): Promise<UnifiedItem[]>;
|
|
76
|
+
/** 单 id 版本 */
|
|
77
|
+
export declare function getById(type: DisplayInfo, id: number): Promise<UnifiedItem | null>;
|
|
78
|
+
/** 国家 -> 城市(后端专门支持 allCityByCountryId 口径) */
|
|
79
|
+
export declare function getCitiesByCountry(countryId: number, opts?: {
|
|
80
|
+
page?: number;
|
|
81
|
+
size?: number;
|
|
82
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
83
|
+
/** 城市 -> 子实体(港口、机场 或 二者) */
|
|
84
|
+
export declare function getChildrenByCity(cityId: number, childTypes: Array<"Seaport" | "Airport">, opts?: {
|
|
85
|
+
page?: number;
|
|
86
|
+
size?: number;
|
|
87
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
88
|
+
export declare function searchCountryByName(keyword: string, opts?: {
|
|
89
|
+
page?: number;
|
|
90
|
+
size?: number;
|
|
91
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
92
|
+
export declare function searchCityByName(keyword: string, opts?: {
|
|
93
|
+
page?: number;
|
|
94
|
+
size?: number;
|
|
95
|
+
countryId?: number;
|
|
96
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
97
|
+
export declare function searchSeaportByName(keyword: string, opts?: {
|
|
98
|
+
page?: number;
|
|
99
|
+
size?: number;
|
|
100
|
+
cityId?: number;
|
|
101
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
102
|
+
export declare function searchAirportByName(keyword: string, opts?: {
|
|
103
|
+
page?: number;
|
|
104
|
+
size?: number;
|
|
105
|
+
cityId?: number;
|
|
106
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
107
|
+
/** 保留对外兼容函数:getContinent/getCountry/getCity/getProvince/getSeaport/getAirport */
|
|
108
|
+
export declare function getContinent(params?: {
|
|
109
|
+
page?: number;
|
|
110
|
+
size?: number;
|
|
111
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
112
|
+
export declare function getCountry(params?: {
|
|
113
|
+
page?: number;
|
|
114
|
+
size?: number;
|
|
115
|
+
ids?: number[];
|
|
116
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
117
|
+
export declare function getCity(params?: {
|
|
118
|
+
page?: number;
|
|
119
|
+
size?: number;
|
|
120
|
+
ids?: number[];
|
|
121
|
+
countryId?: number;
|
|
122
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
123
|
+
export declare function getProvince(params?: {
|
|
124
|
+
page?: number;
|
|
125
|
+
size?: number;
|
|
126
|
+
ids?: number[];
|
|
127
|
+
countryId?: number;
|
|
128
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
129
|
+
export declare function getSeaport(params?: {
|
|
130
|
+
page?: number;
|
|
131
|
+
size?: number;
|
|
132
|
+
ids?: number[];
|
|
133
|
+
cityId?: number;
|
|
134
|
+
countryId?: number;
|
|
135
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
136
|
+
export declare function getAirport(params?: {
|
|
137
|
+
page?: number;
|
|
138
|
+
size?: number;
|
|
139
|
+
ids?: number[];
|
|
140
|
+
cityId?: number;
|
|
141
|
+
countryId?: number;
|
|
142
|
+
}): Promise<BaseResponse<UnifiedItem>>;
|
|
143
|
+
declare const _default: {
|
|
144
|
+
search: typeof search;
|
|
145
|
+
getByIds: typeof getByIds;
|
|
146
|
+
getById: typeof getById;
|
|
147
|
+
getCitiesByCountry: typeof getCitiesByCountry;
|
|
148
|
+
getChildrenByCity: typeof getChildrenByCity;
|
|
149
|
+
searchCountryByName: typeof searchCountryByName;
|
|
150
|
+
searchCityByName: typeof searchCityByName;
|
|
151
|
+
searchAirportByName: typeof searchAirportByName;
|
|
152
|
+
searchSeaportByName: typeof searchSeaportByName;
|
|
153
|
+
getBaseData: typeof rawFetch;
|
|
154
|
+
getContinent: typeof getContinent;
|
|
155
|
+
getCountry: typeof getCountry;
|
|
156
|
+
getCity: typeof getCity;
|
|
157
|
+
getProvince: typeof getProvince;
|
|
158
|
+
getSeaport: typeof getSeaport;
|
|
159
|
+
getAirport: typeof getAirport;
|
|
160
|
+
};
|
|
161
|
+
export default _default;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export type LocationType = "Continent" | "Country" | "Region" | "Province" | "City" | "Seaport" | "Airport" | "Street" | "Town" | "Wharf";
|
|
2
|
+
export interface LocationUnifiedItem {
|
|
3
|
+
id: number | string;
|
|
4
|
+
type: LocationType;
|
|
5
|
+
nameCn?: string;
|
|
6
|
+
nameEn?: string;
|
|
7
|
+
display?: string;
|
|
8
|
+
continent?: Record<string, any>;
|
|
9
|
+
country?: Record<string, any>;
|
|
10
|
+
city?: Record<string, any>;
|
|
11
|
+
province?: Record<string, any>;
|
|
12
|
+
raw?: any;
|
|
13
|
+
}
|
|
14
|
+
export interface PageParams {
|
|
15
|
+
current?: number;
|
|
16
|
+
size?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SearchByNameParams extends PageParams {
|
|
19
|
+
keyword: string;
|
|
20
|
+
searchMode?: "0" | "1" | "2";
|
|
21
|
+
}
|
|
22
|
+
export interface SearchWithScopeParams extends SearchByNameParams {
|
|
23
|
+
countryId?: number;
|
|
24
|
+
cityId?: number;
|
|
25
|
+
provinceId?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface SearchGenericParams extends SearchByNameParams {
|
|
28
|
+
displayInfo: LocationType[];
|
|
29
|
+
}
|
|
30
|
+
export declare const locationSearchV2: {
|
|
31
|
+
SEARCH_VERSION: string;
|
|
32
|
+
searchByName: (params: SearchGenericParams) => Promise<{
|
|
33
|
+
records: LocationUnifiedItem[];
|
|
34
|
+
total: number;
|
|
35
|
+
current: number;
|
|
36
|
+
size: number;
|
|
37
|
+
}>;
|
|
38
|
+
searchByIdWithType: (id: number | string | Array<number | string>, type: LocationType) => Promise<{
|
|
39
|
+
records: LocationUnifiedItem[];
|
|
40
|
+
total: number;
|
|
41
|
+
current: number;
|
|
42
|
+
size: number;
|
|
43
|
+
}>;
|
|
44
|
+
country: {
|
|
45
|
+
searchByName: (params: SearchByNameParams) => Promise<{
|
|
46
|
+
records: LocationUnifiedItem[];
|
|
47
|
+
total: number;
|
|
48
|
+
current: number;
|
|
49
|
+
size: number;
|
|
50
|
+
}>;
|
|
51
|
+
getByIds: (ids: number[]) => Promise<{
|
|
52
|
+
records: LocationUnifiedItem[];
|
|
53
|
+
total: number;
|
|
54
|
+
current: number;
|
|
55
|
+
size: number;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
region: {
|
|
59
|
+
searchByName: (params: SearchByNameParams) => Promise<{
|
|
60
|
+
records: LocationUnifiedItem[];
|
|
61
|
+
total: number;
|
|
62
|
+
current: number;
|
|
63
|
+
size: number;
|
|
64
|
+
}>;
|
|
65
|
+
getByIds: (ids: number[]) => Promise<{
|
|
66
|
+
records: LocationUnifiedItem[];
|
|
67
|
+
total: number;
|
|
68
|
+
current: number;
|
|
69
|
+
size: number;
|
|
70
|
+
}>;
|
|
71
|
+
};
|
|
72
|
+
city: {
|
|
73
|
+
searchByName: (params: SearchWithScopeParams) => Promise<{
|
|
74
|
+
records: LocationUnifiedItem[];
|
|
75
|
+
total: number;
|
|
76
|
+
current: number;
|
|
77
|
+
size: number;
|
|
78
|
+
}>;
|
|
79
|
+
getByIds: (ids: number[]) => Promise<{
|
|
80
|
+
records: LocationUnifiedItem[];
|
|
81
|
+
total: number;
|
|
82
|
+
current: number;
|
|
83
|
+
size: number;
|
|
84
|
+
}>;
|
|
85
|
+
getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<{
|
|
86
|
+
records: LocationUnifiedItem[];
|
|
87
|
+
total: number;
|
|
88
|
+
current: number;
|
|
89
|
+
size: number;
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
seaport: {
|
|
93
|
+
searchByName: (params: SearchWithScopeParams) => Promise<{
|
|
94
|
+
records: LocationUnifiedItem[];
|
|
95
|
+
total: number;
|
|
96
|
+
current: number;
|
|
97
|
+
size: number;
|
|
98
|
+
}>;
|
|
99
|
+
getByIds: (ids: number[]) => Promise<{
|
|
100
|
+
records: LocationUnifiedItem[];
|
|
101
|
+
total: number;
|
|
102
|
+
current: number;
|
|
103
|
+
size: number;
|
|
104
|
+
}>;
|
|
105
|
+
};
|
|
106
|
+
airport: {
|
|
107
|
+
searchByName: (params: SearchWithScopeParams) => Promise<{
|
|
108
|
+
records: LocationUnifiedItem[];
|
|
109
|
+
total: number;
|
|
110
|
+
current: number;
|
|
111
|
+
size: number;
|
|
112
|
+
}>;
|
|
113
|
+
getByIds: (ids: number[]) => Promise<{
|
|
114
|
+
records: LocationUnifiedItem[];
|
|
115
|
+
total: number;
|
|
116
|
+
current: number;
|
|
117
|
+
size: number;
|
|
118
|
+
}>;
|
|
119
|
+
};
|
|
120
|
+
wharf: {
|
|
121
|
+
getByIds: (ids: string[]) => Promise<{
|
|
122
|
+
records: LocationUnifiedItem[];
|
|
123
|
+
total: number;
|
|
124
|
+
current: number;
|
|
125
|
+
size: number;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
/** 获取某个国家下的所有城市 */
|
|
129
|
+
getCitiesByCountry: (countryId: number, params?: PageParams) => Promise<{
|
|
130
|
+
records: LocationUnifiedItem[];
|
|
131
|
+
total: number;
|
|
132
|
+
current: number;
|
|
133
|
+
size: number;
|
|
134
|
+
}>;
|
|
135
|
+
/** 获取某个城市下的子实体(港口、机场、码头等) */
|
|
136
|
+
getChildrenByCity: (cityId: number, childTypes: Array<"Seaport" | "Airport" | "Wharf">, params?: PageParams) => Promise<{
|
|
137
|
+
records: LocationUnifiedItem[];
|
|
138
|
+
total: number;
|
|
139
|
+
current: number;
|
|
140
|
+
size: number;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
export default locationSearchV2;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SharedConfig {
|
|
2
|
+
basePath: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* 全局初始化方法,在项目入口调用
|
|
6
|
+
*/
|
|
7
|
+
export declare const initSharedConfig: (newConfig: Partial<SharedConfig>) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 获取当前配置
|
|
10
|
+
*/
|
|
11
|
+
export declare const getSharedConfig: () => SharedConfig;
|
|
12
|
+
/**
|
|
13
|
+
* 兼容全环境的语言判断方法
|
|
14
|
+
* 逻辑优先级:Nuxt Composables > 浏览器 Cookie > Nuxt SSR 上下文
|
|
15
|
+
*/
|
|
16
|
+
export declare const getIsEn: () => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ut=require("mitt");function nt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Dt}=Object.prototype,{getPrototypeOf:Te}=Object,{iterator:le,toStringTag:rt}=Symbol,de=(e=>t=>{const n=Dt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),x=e=>(e=e.toLowerCase(),t=>de(t)===e),fe=e=>t=>typeof t===e,{isArray:V}=Array,J=fe("undefined");function Q(e){return e!==null&&!J(e)&&e.constructor!==null&&!J(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const st=x("ArrayBuffer");function vt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&st(e.buffer),t}const zt=fe("string"),O=fe("function"),ot=fe("number"),Y=e=>e!==null&&typeof e=="object",qt=e=>e===!0||e===!1,ie=e=>{if(de(e)!=="object")return!1;const t=Te(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(rt in e)&&!(le in e)},jt=e=>{if(!Y(e)||Q(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},$t=x("Date"),Mt=x("File"),Ht=x("Blob"),Jt=x("FileList"),Vt=e=>Y(e)&&O(e.pipe),Wt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||O(e.append)&&((t=de(e))==="formdata"||t==="object"&&O(e.toString)&&e.toString()==="[object FormData]"))},Kt=x("URLSearchParams"),[Xt,Gt,Qt,Yt]=["ReadableStream","Request","Response","Headers"].map(x),Zt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),V(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Q(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function it(e,t){if(Q(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,at=e=>!J(e)&&e!==q;function Se(){const{caseless:e,skipUndefined:t}=at(this)&&this||{},n={},r=(s,o)=>{const i=e&&it(n,o)||o;ie(n[i])&&ie(s)?n[i]=Se(n[i],s):ie(s)?n[i]=Se({},s):V(s)?n[i]=s.slice():(!t||!J(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Z(arguments[s],r);return n}const en=(e,t,n,{allOwnKeys:r}={})=>(Z(t,(s,o)=>{n&&O(s)?e[o]=nt(s,n):e[o]=s},{allOwnKeys:r}),e),tn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),nn=(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)},rn=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&Te(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},sn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},on=e=>{if(!e)return null;if(V(e))return e;let t=e.length;if(!ot(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},an=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Te(Uint8Array)),cn=(e,t)=>{const r=(e&&e[le]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},un=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},ln=x("HTMLFormElement"),dn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),qe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),fn=x("RegExp"),ct=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Z(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},pn=e=>{ct(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(O(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},yn=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return V(e)?r(e):r(String(e).split(t)),n},hn=()=>{},mn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function gn(e){return!!(e&&O(e.append)&&e[rt]==="FormData"&&e[le])}const wn=e=>{const t=new Array(10),n=(r,s)=>{if(Y(r)){if(t.indexOf(r)>=0)return;if(Q(r))return r;if(!("toJSON"in r)){t[s]=r;const o=V(r)?[]:{};return Z(r,(i,c)=>{const f=n(i,s+1);!J(f)&&(o[c]=f)}),t[s]=void 0,o}}return r};return n(e,0)},bn=x("AsyncFunction"),Sn=e=>e&&(Y(e)||O(e))&&O(e.then)&&O(e.catch),ut=((e,t)=>e?setImmediate:t?((n,r)=>(q.addEventListener("message",({source:s,data:o})=>{s===q&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",O(q.postMessage)),En=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||ut,Cn=e=>e!=null&&O(e[le]),a={isArray:V,isArrayBuffer:st,isBuffer:Q,isFormData:Wt,isArrayBufferView:vt,isString:zt,isNumber:ot,isBoolean:qt,isObject:Y,isPlainObject:ie,isEmptyObject:jt,isReadableStream:Xt,isRequest:Gt,isResponse:Qt,isHeaders:Yt,isUndefined:J,isDate:$t,isFile:Mt,isBlob:Ht,isRegExp:fn,isFunction:O,isStream:Vt,isURLSearchParams:Kt,isTypedArray:an,isFileList:Jt,forEach:Z,merge:Se,extend:en,trim:Zt,stripBOM:tn,inherits:nn,toFlatObject:rn,kindOf:de,kindOfTest:x,endsWith:sn,toArray:on,forEachEntry:cn,matchAll:un,isHTMLForm:ln,hasOwnProperty:qe,hasOwnProp:qe,reduceDescriptors:ct,freezeMethods:pn,toObjectSet:yn,toCamelCase:dn,noop:hn,toFiniteNumber:mn,findKey:it,global:q,isContextDefined:at,isSpecCompliantForm:gn,toJSONObject:wn,isAsyncFn:bn,isThenable:Sn,setImmediate:ut,asap:En,isIterable:Cn};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const lt=m.prototype,dt={};["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=>{dt[e]={value:e}});Object.defineProperties(m,dt);Object.defineProperty(lt,"isAxiosError",{value:!0});m.from=(e,t,n,r,s,o)=>{const i=Object.create(lt);a.toFlatObject(e,i,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return m.call(i,c,f,n,r,s),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const An=null;function Ee(e){return a.isPlainObject(e)||a.isArray(e)}function ft(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function je(e,t,n){return e?e.concat(t).map(function(s,o){return s=ft(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function Rn(e){return a.isArray(e)&&!e.some(Ee)}const On=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function pe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,y){return!a.isUndefined(y[h])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,h,y){let b=d;if(d&&!y&&typeof d=="object"){if(a.endsWith(h,"{}"))h=r?h:h.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Rn(d)||(a.isFileList(d)||a.endsWith(h,"[]"))&&(b=a.toArray(d)))return h=ft(h),b.forEach(function(S,R){!(a.isUndefined(S)||S===null)&&t.append(i===!0?je([h],R,o):i===null?h:h+"[]",u(S))}),!1}return Ee(d)?!0:(t.append(je(y,h,o),u(d)),!1)}const p=[],g=Object.assign(On,{defaultVisitor:l,convertValue:u,isVisitable:Ee});function E(d,h){if(!a.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+h.join("."));p.push(d),a.forEach(d,function(b,T){(!(a.isUndefined(b)||b===null)&&s.call(t,b,a.isString(T)?T.trim():T,h,g))===!0&&E(b,h?h.concat(T):[T])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(e),t}function $e(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ne(e,t){this._pairs=[],e&&pe(e,this,t)}const pt=Ne.prototype;pt.append=function(t,n){this._pairs.push([t,n])};pt.toString=function(t){const n=t?function(r){return t.call(this,r,$e)}:$e;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function In(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yt(e,t,n){if(!t)return e;const r=n&&n.encode||In;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new Ne(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Me{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ht={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Tn=typeof URLSearchParams<"u"?URLSearchParams:Ne,Nn=typeof FormData<"u"?FormData:null,Bn=typeof Blob<"u"?Blob:null,xn={isBrowser:!0,classes:{URLSearchParams:Tn,FormData:Nn,Blob:Bn},protocols:["http","https","file","blob","url","data"]},Be=typeof window<"u"&&typeof document<"u",Ce=typeof navigator=="object"&&navigator||void 0,Pn=Be&&(!Ce||["ReactNative","NativeScript","NS"].indexOf(Ce.product)<0),Ln=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Fn=Be&&window.location.href||"http://localhost",_n=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Be,hasStandardBrowserEnv:Pn,hasStandardBrowserWebWorkerEnv:Ln,navigator:Ce,origin:Fn},Symbol.toStringTag,{value:"Module"})),C={..._n,...xn};function kn(e,t){return pe(e,new C.classes.URLSearchParams,{visitor:function(n,r,s,o){return C.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Un(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Dn(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function mt(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,f?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=Dn(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Un(r),s,n,0)}),n}return null}function vn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ee={transitional:ht,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(mt(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return kn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return pe(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),vn(t)):t}],transformResponse:[function(t){const n=this.transitional||ee.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:C.classes.FormData,Blob:C.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ee.headers[e]={}});const zn=a.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"]),qn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&zn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},He=Symbol("internals");function X(e){return e&&String(e).trim().toLowerCase()}function ae(e){return e===!1||e==null?e:a.isArray(e)?e.map(ae):String(e)}function jn(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}const $n=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ge(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function Mn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Hn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let I=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,f,u){const l=X(f);if(!l)throw new Error("header name must be a non-empty string");const p=a.findKey(s,l);(!p||s[p]===void 0||u===!0||u===void 0&&s[p]!==!1)&&(s[p||f]=ae(c))}const i=(c,f)=>a.forEach(c,(u,l)=>o(u,l,f));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!$n(t))i(qn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(f=c[u])?a.isArray(f)?[...f,l[1]]:[f,l[1]]:l[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=X(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return jn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=X(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ge(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=X(i),i){const c=a.findKey(r,i);c&&(!n||ge(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||ge(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=ae(s),delete n[o];return}const c=t?Mn(o):String(o).trim();c!==o&&delete n[o],n[c]=ae(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[He]=this[He]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=X(i);r[c]||(Hn(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};I.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(I.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(I);function we(e,t){const n=this||ee,r=t||n,s=I.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function gt(e){return!!(e&&e.__CANCEL__)}function W(e,t,n){m.call(this,e??"canceled",m.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(W,m,{__CANCEL__:!0});function wt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Jn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Vn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const u=Date.now(),l=r[o];i||(i=u),n[s]=f,r[s]=u;let p=o,g=0;for(;p!==s;)g+=n[p++],p=p%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const E=l&&u-l;return E?Math.round(g*1e3/E):void 0}}function Wn(e,t){let n=0,r=1e3/t,s,o;const i=(u,l=Date.now())=>{n=l,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),p=l-n;p>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-p)))},()=>s&&i(s)]}const ue=(e,t,n=3)=>{let r=0;const s=Vn(50,250);return Wn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,f=i-r,u=s(f),l=i<=c;r=i;const p={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},n)},Je=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ve=e=>(...t)=>a.asap(()=>e(...t)),Kn=C.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,C.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(C.origin),C.navigator&&/(msie|trident)/i.test(C.navigator.userAgent)):()=>!0,Xn=C.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Gn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function bt(e,t,n){let r=!Gn(t);return e&&(r||n==!1)?Qn(e,t):t}const We=e=>e instanceof I?{...e}:e;function $(e,t){t=t||{};const n={};function r(u,l,p,g){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:g},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,p,g){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u,p,g)}else return r(u,l,p,g)}function o(u,l){if(!a.isUndefined(l))return r(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function c(u,l,p){if(p in t)return r(u,l);if(p in e)return r(void 0,u)}const f={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(u,l,p)=>s(We(u),We(l),p,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const p=f[l]||s,g=p(e[l],t[l],l);a.isUndefined(g)&&p!==c||(n[l]=g)}),n}const St=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=I.from(i),t.url=yt(bt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(C.hasStandardBrowserEnv||C.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const f=n.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([l,p])=>{u.includes(l.toLowerCase())&&i.set(l,p)})}}if(C.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Kn(t.url))){const f=s&&o&&Xn.read(o);f&&i.set(s,f)}return t},Yn=typeof XMLHttpRequest<"u",Zn=Yn&&function(e){return new Promise(function(n,r){const s=St(e);let o=s.data;const i=I.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:u}=s,l,p,g,E,d;function h(){E&&E(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const S=I.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),B={data:!c||c==="text"||c==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:S,config:e,request:y};wt(function(N){n(N),h()},function(N){r(N),h()},B),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new m("Request aborted",m.ECONNABORTED,e,y)),y=null)},y.onerror=function(R){const B=R&&R.message?R.message:"Network Error",v=new m(B,m.ERR_NETWORK,e,y);v.event=R||null,r(v),y=null},y.ontimeout=function(){let R=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const B=s.transitional||ht;s.timeoutErrorMessage&&(R=s.timeoutErrorMessage),r(new m(R,B.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,y)),y=null},o===void 0&&i.setContentType(null),"setRequestHeader"in y&&a.forEach(i.toJSON(),function(R,B){y.setRequestHeader(B,R)}),a.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),c&&c!=="json"&&(y.responseType=s.responseType),u&&([g,d]=ue(u,!0),y.addEventListener("progress",g)),f&&y.upload&&([p,E]=ue(f),y.upload.addEventListener("progress",p),y.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(l=S=>{y&&(r(!S||S.type?new W(null,e,y):S),y.abort(),y=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const T=Jn(s.url);if(T&&C.protocols.indexOf(T)===-1){r(new m("Unsupported protocol "+T+":",m.ERR_BAD_REQUEST,e));return}y.send(o||null)})},er=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;r.abort(l instanceof m?l:new W(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new m(`timeout ${t} of ms exceeded`,m.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:f}=r;return f.unsubscribe=()=>a.asap(c),f}},tr=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},nr=async function*(e,t){for await(const n of rr(e))yield*tr(n,t)},rr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ke=(e,t,n,r)=>{const s=nr(e,t);let o=0,i,c=f=>{i||(i=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:u,value:l}=await s.next();if(u){c(),f.close();return}let p=l.byteLength;if(n){let g=o+=p;n(g)}f.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Xe=64*1024,{isFunction:oe}=a,sr=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Ge,TextEncoder:Qe}=a.global,Ye=(e,...t)=>{try{return!!e(...t)}catch{return!1}},or=e=>{e=a.merge.call({skipUndefined:!0},sr,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",o=oe(n),i=oe(r);if(!s)return!1;const c=s&&oe(Ge),f=s&&(typeof Qe=="function"?(d=>h=>d.encode(h))(new Qe):async d=>new Uint8Array(await new n(d).arrayBuffer())),u=o&&c&&Ye(()=>{let d=!1;const h=new n(C.origin,{body:new Ge,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!h}),l=i&&c&&Ye(()=>a.isReadableStream(new r("").body)),p={stream:l&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(h,y)=>{let b=h&&h[d];if(b)return b.call(h);throw new m(`Response type '${d}' is not supported`,m.ERR_NOT_SUPPORT,y)})});const g=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new n(C.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},E=async(d,h)=>{const y=a.toFiniteNumber(d.getContentLength());return y??g(h)};return async d=>{let{url:h,method:y,data:b,signal:T,cancelToken:S,timeout:R,onDownloadProgress:B,onUploadProgress:v,responseType:N,headers:he,withCredentials:ne="same-origin",fetchOptions:_e}=St(d),ke=t||fetch;N=N?(N+"").toLowerCase():"text";let re=er([T,S&&S.toAbortSignal()],R),K=null;const z=re&&re.unsubscribe&&(()=>{re.unsubscribe()});let Ue;try{if(v&&u&&y!=="get"&&y!=="head"&&(Ue=await E(he,b))!==0){let D=new n(h,{method:"POST",body:b,duplex:"half"}),M;if(a.isFormData(b)&&(M=D.headers.get("content-type"))&&he.setContentType(M),D.body){const[me,se]=Je(Ue,ue(Ve(v)));b=Ke(D.body,Xe,me,se)}}a.isString(ne)||(ne=ne?"include":"omit");const P=o&&"credentials"in n.prototype,De={..._e,signal:re,method:y.toUpperCase(),headers:he.normalize().toJSON(),body:b,duplex:"half",credentials:P?ne:void 0};K=o&&new n(h,De);let U=await(o?ke(K,_e):ke(h,De));const ve=l&&(N==="stream"||N==="response");if(l&&(B||ve&&z)){const D={};["status","statusText","headers"].forEach(ze=>{D[ze]=U[ze]});const M=a.toFiniteNumber(U.headers.get("content-length")),[me,se]=B&&Je(M,ue(Ve(B),!0))||[];U=new r(Ke(U.body,Xe,me,()=>{se&&se(),z&&z()}),D)}N=N||"text";let kt=await p[a.findKey(p,N)||"text"](U,d);return!ve&&z&&z(),await new Promise((D,M)=>{wt(D,M,{data:kt,headers:I.from(U.headers),status:U.status,statusText:U.statusText,config:d,request:K})})}catch(P){throw z&&z(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,d,K),{cause:P.cause||P}):m.from(P,P&&P.code,d,K)}}},ir=new Map,Et=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,f,u,l=ir;for(;c--;)f=o[c],u=l.get(f),u===void 0&&l.set(f,u=c?new Map:or(t)),l=u;return u};Et();const xe={http:An,xhr:Zn,fetch:{get:Et}};a.forEach(xe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ze=e=>`- ${e}`,ar=e=>a.isFunction(e)||e===null||e===!1;function cr(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!ar(r)&&(s=xe[(c=String(r)).toLowerCase()],s===void 0))throw new m(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
|
|
4
|
+
`+i.map(Ze).join(`
|
|
5
|
+
`):" "+Ze(i[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Ct={getAdapter:cr,adapters:xe};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new W(null,e)}function et(e){return be(e),e.headers=I.from(e.headers),e.data=we.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ct.getAdapter(e.adapter||ee.adapter,e)(e).then(function(r){return be(e),r.data=we.call(e,e.transformResponse,r),r.headers=I.from(r.headers),r},function(r){return gt(r)||(be(e),r&&r.response&&(r.response.data=we.call(e,e.transformResponse,r.response),r.response.headers=I.from(r.response.headers))),Promise.reject(r)})}const At="1.13.2",ye={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ye[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const tt={};ye.transitional=function(t,n,r){function s(o,i){return"[Axios v"+At+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new m(s(i," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!tt[i]&&(tt[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};ye.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function ur(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new m("option "+o+" must be "+f,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+o,m.ERR_BAD_OPTION)}}const ce={assertOptions:ur,validators:ye},L=ce.validators;let j=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Me,response:new Me}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ce.assertOptions(r,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ce.assertOptions(s,{encode:L.function,serialize:L.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ce.assertOptions(n,{baseUrl:L.spelling("baseURL"),withXsrfToken:L.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete o[d]}),n.headers=I.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(f=f&&h.synchronous,c.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let l,p=0,g;if(!f){const d=[et.bind(this),void 0];for(d.unshift(...c),d.push(...u),g=d.length,l=Promise.resolve(n);p<g;)l=l.then(d[p++],d[p++]);return l}g=c.length;let E=n;for(;p<g;){const d=c[p++],h=c[p++];try{E=d(E)}catch(y){h.call(this,y);break}}try{l=et.call(this,E)}catch(d){return Promise.reject(d)}for(p=0,g=u.length;p<g;)l=l.then(u[p++],u[p++]);return l}getUri(t){t=$(this.defaults,t);const n=bt(t.baseURL,t.url,t.allowAbsoluteUrls);return yt(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){j.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request($(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}j.prototype[t]=n(),j.prototype[t+"Form"]=n(!0)});let lr=class Rt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new W(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Rt(function(s){t=s}),cancel:t}}};function dr(e){return function(n){return e.apply(null,n)}}function fr(e){return a.isObject(e)&&e.isAxiosError===!0}const Ae={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ae).forEach(([e,t])=>{Ae[t]=e});function Ot(e){const t=new j(e),n=nt(j.prototype.request,t);return a.extend(n,j.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Ot($(e,s))},n}const w=Ot(ee);w.Axios=j;w.CanceledError=W;w.CancelToken=lr;w.isCancel=gt;w.VERSION=At;w.toFormData=pe;w.AxiosError=m;w.Cancel=w.CanceledError;w.all=function(t){return Promise.all(t)};w.spread=dr;w.isAxiosError=fr;w.mergeConfig=$;w.AxiosHeaders=I;w.formToJSON=e=>mt(a.isHTMLForm(e)?new FormData(e):e);w.getAdapter=Ct.getAdapter;w.HttpStatusCode=Ae;w.default=w;const{Axios:Jr,AxiosError:Vr,CanceledError:Wr,isCancel:Kr,CancelToken:Xr,VERSION:Gr,all:Qr,Cancel:Yr,isAxiosError:Zr,spread:es,toFormData:ts,AxiosHeaders:ns,HttpStatusCode:rs,formToJSON:ss,getAdapter:os,mergeConfig:is}=w,Re=w.create({timeout:15e3});Re.interceptors.response.use(e=>e,e=>Promise.reject(e));const It={async get(e,t){const n=await Re.get(e,{params:t?.params,headers:t?.headers});return{data:n.data,status:n.status,headers:n.headers}},async post(e,t,n){const r=await Re.post(e,t,{params:n?.params,headers:n?.headers});return{data:r.data,status:r.status,headers:r.headers}}};function pr(e){return{async get(t,n){const r=n?.params?"?"+new URLSearchParams(n.params).toString():"",s=await e(t+r,{method:"GET",headers:n?.headers});return{data:await s.json(),status:s.status}},async post(t,n,r){const s=r?.params?"?"+new URLSearchParams(r.params).toString():"",o=await e(t+s,{method:"POST",headers:{"Content-Type":"application/json",...r?.headers},body:n?JSON.stringify(n):void 0});return{data:await o.json(),status:o.status}}}}let G=It;function yr(e,t){return e==="fetch"?G=pr(t?.fetch??fetch):G=It,G}const Tt={get:(...e)=>G.get(...e),post:(...e)=>G.post(...e)};let Oe={basePath:"https://cloudapi-sit2.jctrans.net.cn/system/dms/fr/aggr/getLocationOptions"};const hr=e=>{Oe={...Oe,...e}},Pe=()=>Oe,Le=()=>{try{const n=globalThis.useCookie;if(typeof n=="function"){const r=n("jc-language").value;if(r)return/en/i.test(r)||/en-US/i.test(r)}}catch{}const e=typeof window<"u"&&typeof document<"u";let t="";if(e)t=document.cookie||"";else try{t=globalThis.useNuxtApp?.()?.ssrContext?.event?.node?.req?.headers?.cookie||""}catch{t=""}return/jc-language=en-US/i.test(t)||/jc-language=en/i.test(t)},mr=()=>Pe().basePath,gr={Continent:"continentId",Country:"countryId",City:"cityId",Province:"provinceId",Seaport:"seaportId",Airport:"airportId"},wr=["City","Seaport","Airport","Country","Region"].filter(Boolean);function H(e,t){return e==="allCityByCountryId"?Array.isArray(t)?String(t[0]):String(t):Array.isArray(t)?JSON.stringify(t):JSON.stringify([Number(t)])}function br(e){const t=[];if(e.ids)for(const n of e.ids){const r=gr[n.type];t.push({name:r,val:H(r,n.ids)})}return e.scope&&(e.scope.countryId!==void 0&&e.scope.countryId!==null&&t.push({name:"countryId",val:H("countryId",[e.scope.countryId])}),e.scope.cityId!==void 0&&e.scope.cityId!==null&&t.push({name:"cityId",val:H("cityId",[e.scope.cityId])}),e.scope.provinceId!==void 0&&e.scope.provinceId!==null&&t.push({name:"provinceId",val:H("provinceId",[e.scope.provinceId])})),t}function k(e){const t={current:e.page??1,size:e.size??10,level:e.level,searchContent:e.keyword??void 0,displayInfo:e.displayInfo??wr,sort:e.sort},n=br({ids:e.ids,scope:e.scope});return t.appointSearch=[...n,...e.extraAppoint||[]],Object.keys(t).forEach(r=>{t[r]===void 0&&delete t[r]}),t}function Sr(e,t,n){const r=Le(),s=(u,l)=>{if(!u)return"";const p=u.nameCn??u[`${l.toLowerCase()}NameCn`]??u.name,g=u.nameEn??u[`${l.toLowerCase()}NameEn`];return r?g||p||"":p||g||""},o=s(e,t),i=s(n.country,"country"),c=s(n.city,"city"),f=s(n.continent,"continent");switch(t){case"Seaport":case"Airport":const u=[c,i].filter(Boolean).join(", ");return u?`${o} (${u})`:o;case"City":case"Province":return i?`${o} (${i})`:o;case"Country":return f?`${o} (${f})`:o;default:return o}}function F(e=[],t=[]){const n=[];function r(o,i,c){if(!o||!t.includes(i))return;const f=o.id??o[i.toLowerCase()+"Id"]??null;if(f==null)return;const u=o.nameCn??o[`${i.toLowerCase()}NameCn`]??o.name??void 0,l=o.nameEn??o[`${i.toLowerCase()}NameEn`]??void 0,p=Sr(o,i,c)||u||l||"";n.push({id:f,type:i,nameCn:u,nameEn:l,display:p,continent:c.continent??void 0,country:c.country??void 0,city:c.city??void 0,province:c.province??void 0,raw:o})}for(const o of e){const i={continent:o.continent??void 0,country:o.country??void 0,city:o.city??void 0,province:o.province??void 0};let c=!1;if(["Continent","Country","Province","City","Seaport","Airport"].forEach(u=>{const l=u.toLowerCase();o[l]&&(r(o[l],u,i),c=!0)}),!c&&o.id!==void 0){let u;o.type&&t.includes(o.type)?u=o.type:t.length===1&&(u=t[0]),u&&r(o,u,i)}}const s=new Set;return n.filter(o=>{const i=`${o.type}_${o.id}`;return s.has(i)?!1:(s.add(i),!0)})}async function _(e){return(await Tt.post(mr(),e)).data}async function te(e){const t=k({keyword:e.keyword,displayInfo:e.displayInfo,page:e.page,size:e.size,level:e.level,sort:e.sort,ids:e.ids,scope:e.scope,extraAppoint:e.extraAppoint}),n=await _(t),r=F(n.data?.records||[],t.displayInfo||[]);return{...n,records:r}}async function Fe(e){if(!e.keyword?.trim())throw new Error("searchByName: keyword 不能为空");const t=e.types&&e.types.length>0?e.types:["Continent","Country","City","Province","Seaport","Airport"];return te({keyword:e.keyword.trim(),displayInfo:t,page:e.page,size:e.size,level:e.level,sort:e.sort})}async function Nt(e,t){const n=Array.isArray(t)?t:[t],r=[e],s=k({displayInfo:r,ids:[{type:e,ids:n}]}),o=await _(s);return F(o.records||[],r).filter(c=>c.type===e)}async function Er(e,t){return(await Nt(e,[t]))[0]??null}async function Cr(e,t){const n=["City"],r=k({displayInfo:n,page:t?.page??1,size:t?.size??1e3,extraAppoint:[{name:"allCityByCountryId",val:H("allCityByCountryId",e)}]}),s=await _(r);return{...s,records:F(s.records||[],n)}}async function Ar(e,t,n){if(!t||t.length===0)throw new Error("childTypes 必须至少包含一个:Seaport | Airport");const r=t,s=k({displayInfo:r,page:n?.page??1,size:n?.size??1e3,extraAppoint:[{name:"cityId",val:H("cityId",[e])}]}),o=await _(s);return{...o,records:F(o.records||[],r)}}function Rr(e,t){return Fe({keyword:e,types:["Country"],page:t?.page,size:t?.size})}function Or(e,t){return t?.countryId?te({keyword:e,displayInfo:["City"],scope:{countryId:t.countryId},page:t.page,size:t.size}):Fe({keyword:e,types:["City"],page:t?.page,size:t?.size})}function Ir(e,t){return te({keyword:e,displayInfo:["Seaport"],scope:t?.cityId?{cityId:t.cityId}:void 0,page:t?.page,size:t?.size})}function Tr(e,t){return te({keyword:e,displayInfo:["Airport"],scope:t?.cityId?{cityId:t.cityId}:void 0,page:t?.page,size:t?.size})}async function Nr(e={}){const t=["Continent"],n=await _({current:e.page??1,size:e.size??10,level:1,displayInfo:t});return{...n,records:F(n.records||[],t)}}async function Br(e={}){const t=["Country"],n=k({displayInfo:t,page:e.page??1,size:e.size??10,ids:e.ids?[{type:"Country",ids:e.ids}]:void 0}),r=await _(n);return{...r,records:F(r.records||[],t)}}async function xr(e={}){const t=["City"],n=k({displayInfo:t,page:e.page??1,size:e.size??10,ids:e.ids?[{type:"City",ids:e.ids}]:void 0,scope:e.countryId?{countryId:e.countryId}:void 0}),r=await _(n);return{...r,records:F(r.records||[],t)}}async function Pr(e={}){const t=["Province"],n=k({displayInfo:t,page:e.page??1,size:e.size??10,ids:e.ids?[{type:"Province",ids:e.ids}]:void 0,scope:e.countryId?{countryId:e.countryId}:void 0}),r=await _(n);return{...r,records:F(r.records||[],t)}}async function Lr(e={}){const t=["Seaport"],n=k({displayInfo:t,page:e.page??1,size:e.size??10,ids:e.ids?[{type:"Seaport",ids:e.ids}]:void 0,scope:e.cityId?{cityId:e.cityId}:e.countryId?{countryId:e.countryId}:void 0}),r=await _(n);return{...r,records:F(r.records||[],t)}}async function Fr(e={}){const t=["Airport"],n=k({displayInfo:t,page:e.page??1,size:e.size??10,ids:e.ids?[{type:"Airport",ids:e.ids}]:void 0,scope:e.cityId?{cityId:e.cityId}:e.countryId?{countryId:e.countryId}:void 0}),r=await _(n);return{...r,records:F(r.records||[],t)}}const _r="2.0",kr=()=>Pe().basePath;function Bt(e){let t=e.type;return t==="Country"&&e.region&&!e.country?{target:e.region,finalType:"Region"}:{target:e[t.toLowerCase()]||{},finalType:t}}function Ur(e){const t=Le(),{target:n,finalType:r}=Bt(e),s=u=>{if(!u)return"";const l=u.nameCn||u.displayNameCn||u.name||"",p=u.nameEn||u.displayNameEn||u.nameEnShow||"";return t?p||l:l||p},o=s(n),i=e.country||e.region,c=s(i),f=s(e.city);if(["Seaport","Airport","Wharf"].includes(r)){const u=[f,c].filter(Boolean).join(", ");return u?`${o} (${u})`:o}return["City","Province"].includes(r)&&c?`${o} (${c})`:o}function Dr(e=[]){return e.map(t=>{const{target:n,finalType:r}=Bt(t);return{id:n.id??t.id,type:r,nameCn:n.nameCn||n.name,nameEn:n.nameEn||n.nameEnShow,display:Ur(t),raw:t}})}async function A(e){const t={current:1,size:10,...e},r=(await Tt.post(kr(),t)).data.data||{};return{...r,records:Dr(r.records||[])}}const xt={searchByName:e=>A({searchContent:e.keyword,searchMode:e.searchMode,...e,displayInfo:["Country"]}),getByIds:e=>A({countryIds:e,displayInfo:["Country"]})},Pt={searchByName:e=>A({searchContent:e.keyword,searchMode:e.searchMode,...e,displayInfo:["Country"]}),getByIds:e=>A({countryIds:e,displayInfo:["Country"]})},Ie={searchByName:e=>A({searchContent:e.keyword,countryIds:e.countryId?[e.countryId]:void 0,...e,displayInfo:["City"]}),getByIds:e=>A({cityIds:e,displayInfo:["City"]}),getCitiesByCountry:(e,t)=>A({countryIds:[e],displayInfo:["City"],...t})},Lt={searchByName:e=>A({searchContent:e.keyword,cityIds:e.cityId?[e.cityId]:void 0,countryIds:e.countryId?[e.countryId]:void 0,...e,displayInfo:["Seaport"]}),getByIds:e=>A({seaportIds:e,displayInfo:["Seaport"]})},Ft={searchByName:e=>A({searchContent:e.keyword,countryIds:e.countryId?[e.countryId]:void 0,...e,displayInfo:["Airport"]}),getByIds:e=>A({airportIds:e,displayInfo:["Airport"]})},_t={getByIds:e=>A({wharfIds:e,displayInfo:["Wharf"]})},vr=e=>A({searchContent:e.keyword,...e}),zr=(e,t)=>{const n=Array.isArray(e)?e:[e];switch(t){case"Country":return xt.getByIds(n);case"Region":return Pt.getByIds(n);case"City":return Ie.getByIds(n);case"Seaport":return Lt.getByIds(n);case"Airport":return Ft.getByIds(n);case"Wharf":return _t.getByIds(n);default:return A({[`${t.toLowerCase()}Ids`]:n,displayInfo:[t]})}},qr={SEARCH_VERSION:_r,searchByName:vr,searchByIdWithType:zr,country:xt,region:Pt,city:Ie,seaport:Lt,airport:Ft,wharf:_t,getCitiesByCountry:Ie.getCitiesByCountry,getChildrenByCity:(e,t,n)=>A({cityIds:[e],displayInfo:t,...n})},jr={Open:"GLOBAL_MODAL_OPEN",Close:"GLOBAL_MODAL_CLOSE",Submit:"GLOBAL_MODAL_SUBMIT"},$r=Ut();exports.MODAL_ACTION=jr;exports.createRequest=yr;exports.emitter=$r;exports.getAirport=Fr;exports.getById=Er;exports.getByIds=Nt;exports.getChildrenByCity=Ar;exports.getCitiesByCountry=Cr;exports.getCity=xr;exports.getContinent=Nr;exports.getCountry=Br;exports.getIsEn=Le;exports.getProvince=Pr;exports.getSeaport=Lr;exports.getSharedConfig=Pe;exports.initSharedConfig=hr;exports.locationSearchV2=qr;exports.search=te;exports.searchAirportByName=Tr;exports.searchByName=Fe;exports.searchCityByName=Or;exports.searchCountryByName=Rr;exports.searchSeaportByName=Ir;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Emitter } from 'mitt';
|
|
2
|
+
export declare const MODAL_ACTION: {
|
|
3
|
+
readonly Open: "GLOBAL_MODAL_OPEN";
|
|
4
|
+
readonly Close: "GLOBAL_MODAL_CLOSE";
|
|
5
|
+
readonly Submit: "GLOBAL_MODAL_SUBMIT";
|
|
6
|
+
};
|
|
7
|
+
type ActionKeys = (typeof MODAL_ACTION)[keyof typeof MODAL_ACTION];
|
|
8
|
+
type ModalOpenCallback = () => void;
|
|
9
|
+
export type ModalEvents = Record<ActionKeys, any> & {
|
|
10
|
+
[MODAL_ACTION.Open]: ModalOpenCallback | undefined;
|
|
11
|
+
[MODAL_ACTION.Close]: undefined;
|
|
12
|
+
[MODAL_ACTION.Submit]: any;
|
|
13
|
+
};
|
|
14
|
+
declare const emitter: Emitter<ModalEvents>;
|
|
15
|
+
export * from './api/baseSearch';
|
|
16
|
+
export * from './utils/request';
|
|
17
|
+
export * from './api/searchV2';
|
|
18
|
+
export * from './config/index';
|
|
19
|
+
export { emitter };
|