@jctrans-materials/comps-vue2 1.0.0 → 1.0.2

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.
@@ -1,17 +1,19 @@
1
1
  import { Ref } from 'vue';
2
2
  import { SearchItem } from '../type';
3
3
 
4
- export declare function useSearchHistory(historyKey: Ref<string>): {
4
+ export declare function useSearchHistory(historyKey: Ref<string | undefined | any>): {
5
5
  searchHistory: Ref<{
6
6
  [x: string]: any;
7
7
  id?: string | number | undefined;
8
8
  type: string;
9
9
  display?: string | undefined;
10
+ displayEn?: string | undefined;
11
+ displayCn?: string | undefined;
10
12
  name?: string | undefined;
11
13
  nameEn?: string | undefined;
12
14
  nameCn?: string | undefined;
13
15
  }[]>;
14
16
  saveToHistory: (item: SearchItem) => void;
15
17
  clearHistory: () => void;
16
- HasHistory: import('vue').ComputedRef<boolean | "">;
18
+ HasHistory: import('vue').ComputedRef<boolean>;
17
19
  };
@@ -7,6 +7,8 @@ export declare function useSearchLogic(query: Ref<string>, searchTypeList: Ref<s
7
7
  id?: string | number | undefined;
8
8
  type: string;
9
9
  display?: string | undefined;
10
+ displayEn?: string | undefined;
11
+ displayCn?: string | undefined;
10
12
  name?: string | undefined;
11
13
  nameEn?: string | undefined;
12
14
  nameCn?: string | undefined;
@@ -19,6 +19,22 @@ declare const _default: import('vue').DefineComponent<{
19
19
  type: StringConstructor;
20
20
  default: string;
21
21
  };
22
+ lang: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ placeholder: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ showSearchIcon: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ showItemTag: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
22
38
  }, {
23
39
  query: import('vue').Ref<string>;
24
40
  isSelected: import('vue').Ref<boolean>;
@@ -32,6 +48,8 @@ declare const _default: import('vue').DefineComponent<{
32
48
  id?: string | number | undefined;
33
49
  type: string;
34
50
  display?: string | undefined;
51
+ displayEn?: string | undefined;
52
+ displayCn?: string | undefined;
35
53
  name?: string | undefined;
36
54
  nameEn?: string | undefined;
37
55
  nameCn?: string | undefined;
@@ -41,6 +59,8 @@ declare const _default: import('vue').DefineComponent<{
41
59
  id?: string | number | undefined;
42
60
  type: string;
43
61
  display?: string | undefined;
62
+ displayEn?: string | undefined;
63
+ displayCn?: string | undefined;
44
64
  name?: string | undefined;
45
65
  nameEn?: string | undefined;
46
66
  nameCn?: string | undefined;
@@ -71,6 +91,7 @@ declare const _default: import('vue').DefineComponent<{
71
91
  }, {
72
92
  focusInput(): void;
73
93
  getItemLabel(item: any): any;
94
+ getItemType(type: any): any;
74
95
  isItemActive(item: any): boolean;
75
96
  selectItem(item: any): void;
76
97
  removeItem(item: any): void;
@@ -99,11 +120,31 @@ declare const _default: import('vue').DefineComponent<{
99
120
  type: StringConstructor;
100
121
  default: string;
101
122
  };
123
+ lang: {
124
+ type: StringConstructor;
125
+ default: string;
126
+ };
127
+ placeholder: {
128
+ type: StringConstructor;
129
+ default: string;
130
+ };
131
+ showSearchIcon: {
132
+ type: BooleanConstructor;
133
+ default: boolean;
134
+ };
135
+ showItemTag: {
136
+ type: BooleanConstructor;
137
+ default: boolean;
138
+ };
102
139
  }>>, {
103
140
  multiple: boolean;
104
141
  value: Record<string, any> | unknown[];
105
142
  collapseTags: boolean;
106
143
  searchTypeList: unknown[];
107
144
  historyKey: string;
145
+ lang: string;
146
+ placeholder: string;
147
+ showSearchIcon: boolean;
148
+ showItemTag: boolean;
108
149
  }>;
109
150
  export default _default;
package/dist/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("vue"),R=require("@jctrans-materials/shared"),D=require("jctrans-ui");A.util.warn;function Wt(e){const t=A.ref([]),n="_search_history_cache",o=typeof window<"u"&&typeof localStorage<"u",s=A.computed(()=>(e.value||"")+n),i=A.computed(()=>e.value&&e.value!==""),l=a=>{if(!a||!o)return;const c=t.value.filter(d=>d.id&&d.id!==a.id||d.display!==a.display);c.unshift(a);const u=c.slice(0,4);if(t.value=u,i.value)try{localStorage.setItem(s.value,JSON.stringify(u))}catch(d){console.warn("LocalStorage save failed:",d)}},r=()=>{t.value=[],o&&localStorage.removeItem(s.value)};return A.onMounted(()=>{if(o&&i.value){const a=localStorage.getItem(s.value);if(a)try{t.value=JSON.parse(a)}catch{t.value=[]}}}),{searchHistory:t,saveToHistory:l,clearHistory:r,HasHistory:i}}async function Gt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return R.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const Jt=(e,t)=>R.locationSearchV2.searchByIdWithType(e,t);function Kt(e,t){const n=A.ref([]),o=A.ref(!1),s=A.ref(!1),i=A.ref(1),l=A.ref(0),r=A.ref(10),a=A.computed(()=>l.value===0?!1:n.value.length>=l.value),c=A.computed(()=>{const m=[...t.value];return m.includes("Country")&&!m.includes("Region")&&m.push("Region"),m}),u=m=>!m||!Array.isArray(m)?[]:m.filter(f=>c.value.includes(f.type));return{searchResults:n,loading:o,isFetchingMore:s,isFinished:a,currentPage:i,total:l,fetchData:async(m=1,f=!1)=>{if(!e.value.trim()&&!f){n.value=[],l.value=0;return}if(!(f&&(s.value||a.value))&&!(!f&&o.value)){f?s.value=!0:(o.value=!0,i.value=1);try{const p=await Gt(e.value,t.value,{current:m,size:r.value}),h=p.records||[],v=u(h);f?n.value=[...n.value,...v]:n.value=v,l.value=p.total||0,i.value=m}catch(p){console.error("Failed to fetch search results:",p)}finally{o.value=!1,s.value=!1}}},filterByTypes:u}}const Y=Math.min,O=Math.max,st=Math.round,ot=Math.floor,F=e=>({x:e,y:e}),Yt={left:"right",right:"left",bottom:"top",top:"bottom"},jt={start:"end",end:"start"};function bt(e,t,n){return O(e,Y(t,n))}function tt(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function et(e){return e.split("-")[1]}function Tt(e){return e==="x"?"y":"x"}function kt(e){return e==="y"?"height":"width"}const Xt=new Set(["top","bottom"]);function Q(e){return Xt.has(q(e))?"y":"x"}function It(e){return Tt(Q(e))}function zt(e,t,n){n===void 0&&(n=!1);const o=et(e),s=It(e),i=kt(s);let l=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=it(l)),[l,it(l)]}function $t(e){const t=it(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>jt[t])}const xt=["left","right"],Ct=["right","left"],Zt=["top","bottom"],te=["bottom","top"];function ee(e,t,n){switch(e){case"top":case"bottom":return n?t?Ct:xt:t?xt:Ct;case"left":case"right":return t?Zt:te;default:return[]}}function ne(e,t,n,o){const s=et(e);let i=ee(q(e),n==="start",o);return s&&(i=i.map(l=>l+"-"+s),t&&(i=i.concat(i.map(mt)))),i}function it(e){return e.replace(/left|right|bottom|top/g,t=>Yt[t])}function oe(e){return{top:0,right:0,bottom:0,left:0,...e}}function se(e){return typeof e!="number"?oe(e):{top:e,right:e,bottom:e,left:e}}function lt(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Rt(e,t,n){let{reference:o,floating:s}=e;const i=Q(t),l=It(t),r=kt(l),a=q(t),c=i==="y",u=o.x+o.width/2-s.width/2,d=o.y+o.height/2-s.height/2,m=o[r]/2-s[r]/2;let f;switch(a){case"top":f={x:u,y:o.y-s.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-s.width,y:d};break;default:f={x:o.x,y:o.y}}switch(et(t)){case"start":f[l]-=m*(n&&c?-1:1);break;case"end":f[l]+=m*(n&&c?-1:1);break}return f}const ie=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:l}=n,r=i.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=Rt(c,o,a),m=o,f={},p=0;for(let h=0;h<r.length;h++){const{name:v,fn:g}=r[h],{x:y,y:w,data:C,reset:b}=await g({x:u,y:d,initialPlacement:o,placement:m,strategy:s,middlewareData:f,rects:c,platform:l,elements:{reference:e,floating:t}});u=y??u,d=w??d,f={...f,[v]:{...f[v],...C}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(c=b.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):b.rects),{x:u,y:d}=Rt(c,m,a)),h=-1)}return{x:u,y:d,placement:m,strategy:s,middlewareData:f}};async function ht(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:i,rects:l,elements:r,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=tt(t,e),p=se(f),v=r[m?d==="floating"?"reference":"floating":d],g=lt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(r.floating)),boundary:c,rootBoundary:u,strategy:a})),y=d==="floating"?{x:o,y:s,width:l.floating.width,height:l.floating.height}:l.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(r.floating)),C=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},b=lt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:y,offsetParent:w,strategy:a}):y);return{top:(g.top-b.top+p.top)/C.y,bottom:(b.bottom-g.bottom+p.bottom)/C.y,left:(g.left-b.left+p.left)/C.x,right:(b.right-g.right+p.right)/C.x}}const le=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:i,rects:l,initialPlacement:r,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...v}=tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=q(s),y=Q(r),w=q(r)===r,C=await(a.isRTL==null?void 0:a.isRTL(c.floating)),b=m||(w||!h?[it(r)]:$t(r)),E=p!=="none";!m&&E&&b.push(...ne(r,h,p,C));const _=[r,...b],P=await ht(t,v),N=[];let T=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&N.push(P[g]),d){const W=zt(s,l,C);N.push(P[W[0]],P[W[1]])}if(T=[...T,{placement:s,overflows:N}],!N.every(W=>W<=0)){var x,V;const W=(((x=i.flip)==null?void 0:x.index)||0)+1,ft=_[W];if(ft&&(!(d==="alignment"?y!==Q(ft):!1)||T.every(k=>Q(k.placement)===y?k.overflows[0]>0:!0)))return{data:{index:W,overflows:T},reset:{placement:ft}};let $=(V=T.filter(G=>G.overflows[0]<=0).sort((G,k)=>G.overflows[1]-k.overflows[1])[0])==null?void 0:V.placement;if(!$)switch(f){case"bestFit":{var z;const G=(z=T.filter(k=>{if(E){const H=Q(k.placement);return H===y||H==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(H=>H>0).reduce((H,Ut)=>H+Ut,0)]).sort((k,H)=>k[1]-H[1])[0])==null?void 0:z[0];G&&($=G);break}case"initialPlacement":$=r;break}if(s!==$)return{reset:{placement:$}}}return{}}}},re=new Set(["left","top"]);async function ae(e,t){const{placement:n,platform:o,elements:s}=e,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),l=q(n),r=et(n),a=Q(n)==="y",c=re.has(l)?-1:1,u=i&&a?-1:1,d=tt(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return r&&typeof p=="number"&&(f=r==="end"?p*-1:p),a?{x:f*u,y:m*c}:{x:m*c,y:f*u}}const ce=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:i,placement:l,middlewareData:r}=t,a=await ae(t,e);return l===((n=r.offset)==null?void 0:n.placement)&&(o=r.arrow)!=null&&o.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:l}}}}},ue=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:r={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...a}=tt(e,t),c={x:n,y:o},u=await ht(t,a),d=Q(q(s)),m=Tt(d);let f=c[m],p=c[d];if(i){const v=m==="y"?"top":"left",g=m==="y"?"bottom":"right",y=f+u[v],w=f-u[g];f=bt(y,f,w)}if(l){const v=d==="y"?"top":"left",g=d==="y"?"bottom":"right",y=p+u[v],w=p-u[g];p=bt(y,p,w)}const h=r.fn({...t,[m]:f,[d]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:i,[d]:l}}}}}},fe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:i,platform:l,elements:r}=t,{apply:a=()=>{},...c}=tt(e,t),u=await ht(t,c),d=q(s),m=et(s),f=Q(s)==="y",{width:p,height:h}=i.floating;let v,g;d==="top"||d==="bottom"?(v=d,g=m===(await(l.isRTL==null?void 0:l.isRTL(r.floating))?"start":"end")?"left":"right"):(g=d,v=m==="end"?"top":"bottom");const y=h-u.top-u.bottom,w=p-u.left-u.right,C=Y(h-u[v],y),b=Y(p-u[g],w),E=!t.middlewareData.shift;let _=C,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(_=y),E&&!m){const T=O(u.left,0),x=O(u.right,0),V=O(u.top,0),z=O(u.bottom,0);f?P=p-2*(T!==0||x!==0?T+x:O(u.left,u.right)):_=h-2*(V!==0||z!==0?V+z:O(u.top,u.bottom))}await a({...t,availableWidth:P,availableHeight:_});const N=await l.getDimensions(r.floating);return p!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function rt(){return typeof window<"u"}function X(e){return Lt(e)?(e.nodeName||"").toLowerCase():"#document"}function S(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function B(e){var t;return(t=(Lt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lt(e){return rt()?e instanceof Node||e instanceof S(e).Node:!1}function I(e){return rt()?e instanceof Element||e instanceof S(e).Element:!1}function M(e){return rt()?e instanceof HTMLElement||e instanceof S(e).HTMLElement:!1}function Dt(e){return!rt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof S(e).ShadowRoot}const de=new Set(["inline","contents"]);function nt(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!de.has(s)}const me=new Set(["table","td","th"]);function pe(e){return me.has(X(e))}const he=[":popover-open",":modal"];function at(e){return he.some(t=>{try{return e.matches(t)}catch{return!1}})}const ge=["transform","translate","scale","rotate","perspective"],ve=["transform","translate","scale","rotate","perspective","filter"],ye=["paint","layout","strict","content"];function gt(e){const t=vt(),n=I(e)?L(e):e;return ge.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ve.some(o=>(n.willChange||"").includes(o))||ye.some(o=>(n.contain||"").includes(o))}function Ae(e){let t=U(e);for(;M(t)&&!j(t);){if(gt(t))return t;if(at(t))return null;t=U(t)}return null}function vt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const we=new Set(["html","body","#document"]);function j(e){return we.has(X(e))}function L(e){return S(e).getComputedStyle(e)}function ct(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function U(e){if(X(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Dt(e)&&e.host||B(e);return Dt(t)?t.host:t}function Ft(e){const t=U(e);return j(t)?e.ownerDocument?e.ownerDocument.body:e.body:M(t)&&nt(t)?t:Ft(t)}function Z(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ft(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),l=S(s);if(i){const r=pt(l);return t.concat(l,l.visualViewport||[],nt(s)?s:[],r&&n?Z(r):[])}return t.concat(s,Z(s,[],n))}function pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=L(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=M(e),i=s?e.offsetWidth:n,l=s?e.offsetHeight:o,r=st(n)!==i||st(o)!==l;return r&&(n=i,o=l),{width:n,height:o,$:r}}function yt(e){return I(e)?e:e.contextElement}function K(e){const t=yt(e);if(!M(t))return F(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Mt(t);let l=(i?st(n.width):n.width)/o,r=(i?st(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!r||!Number.isFinite(r))&&(r=1),{x:l,y:r}}const be=F(0);function Bt(e){const t=S(e);return!vt()||!t.visualViewport?be:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==S(e)?!1:t}function J(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=yt(e);let l=F(1);t&&(o?I(o)&&(l=K(o)):l=K(e));const r=xe(i,n,o)?Bt(i):F(0);let a=(s.left+r.x)/l.x,c=(s.top+r.y)/l.y,u=s.width/l.x,d=s.height/l.y;if(i){const m=S(i),f=o&&I(o)?S(o):o;let p=m,h=pt(p);for(;h&&o&&f!==p;){const v=K(h),g=h.getBoundingClientRect(),y=L(h),w=g.left+(h.clientLeft+parseFloat(y.paddingLeft))*v.x,C=g.top+(h.clientTop+parseFloat(y.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=w,c+=C,p=S(h),h=pt(p)}}return lt({width:u,height:d,x:a,y:c})}function ut(e,t){const n=ct(e).scrollLeft;return t?t.left+n:J(B(e)).left+n}function Pt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ut(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function Ce(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",l=B(o),r=t?at(t.floating):!1;if(o===l||r&&i)return n;let a={scrollLeft:0,scrollTop:0},c=F(1);const u=F(0),d=M(o);if((d||!d&&!i)&&((X(o)!=="body"||nt(l))&&(a=ct(o)),M(o))){const f=J(o);c=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=l&&!d&&!i?Pt(l,a):F(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-a.scrollTop*c.y+u.y+m.y}}function Re(e){return Array.from(e.getClientRects())}function De(e){const t=B(e),n=ct(e),o=e.ownerDocument.body,s=O(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=O(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+ut(e);const r=-n.scrollTop;return L(o).direction==="rtl"&&(l+=O(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:l,y:r}}const Ot=25;function Oe(e,t){const n=S(e),o=B(e),s=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,r=0,a=0;if(s){i=s.width,l=s.height;const u=vt();(!u||u&&t==="fixed")&&(r=s.offsetLeft,a=s.offsetTop)}const c=ut(o);if(c<=0){const u=o.ownerDocument,d=u.body,m=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-d.clientWidth-f);p<=Ot&&(i-=p)}else c<=Ot&&(i+=c);return{width:i,height:l,x:r,y:a}}const Se=new Set(["absolute","fixed"]);function _e(e,t){const n=J(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,i=M(e)?K(e):F(1),l=e.clientWidth*i.x,r=e.clientHeight*i.y,a=s*i.x,c=o*i.y;return{width:l,height:r,x:a,y:c}}function St(e,t,n){let o;if(t==="viewport")o=Oe(e,n);else if(t==="document")o=De(B(e));else if(I(t))o=_e(t,n);else{const s=Bt(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lt(o)}function Nt(e,t){const n=U(e);return n===t||!I(n)||j(n)?!1:L(n).position==="fixed"||Nt(n,t)}function Ee(e,t){const n=t.get(e);if(n)return n;let o=Z(e,[],!1).filter(r=>I(r)&&X(r)!=="body"),s=null;const i=L(e).position==="fixed";let l=i?U(e):e;for(;I(l)&&!j(l);){const r=L(l),a=gt(l);!a&&r.position==="fixed"&&(s=null),(i?!a&&!s:!a&&r.position==="static"&&!!s&&Se.has(s.position)||nt(l)&&!a&&Nt(e,l))?o=o.filter(u=>u!==l):s=r,l=U(l)}return t.set(e,o),o}function Te(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const l=[...n==="clippingAncestors"?at(t)?[]:Ee(t,this._c):[].concat(n),o],r=l[0],a=l.reduce((c,u)=>{const d=St(t,u,s);return c.top=O(d.top,c.top),c.right=Y(d.right,c.right),c.bottom=Y(d.bottom,c.bottom),c.left=O(d.left,c.left),c},St(t,r,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function ke(e){const{width:t,height:n}=Mt(e);return{width:t,height:n}}function Ie(e,t,n){const o=M(t),s=B(t),i=n==="fixed",l=J(e,!0,i,t);let r={scrollLeft:0,scrollTop:0};const a=F(0);function c(){a.x=ut(s)}if(o||!o&&!i)if((X(t)!=="body"||nt(s))&&(r=ct(t)),o){const f=J(t,!0,i,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else s&&c();i&&!o&&s&&c();const u=s&&!o&&!i?Pt(s,r):F(0),d=l.left+r.scrollLeft-a.x-u.x,m=l.top+r.scrollTop-a.y-u.y;return{x:d,y:m,width:l.width,height:l.height}}function dt(e){return L(e).position==="static"}function _t(e,t){if(!M(e)||L(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return B(e)===n&&(n=n.ownerDocument.body),n}function Vt(e,t){const n=S(e);if(at(e))return n;if(!M(e)){let s=U(e);for(;s&&!j(s);){if(I(s)&&!dt(s))return s;s=U(s)}return n}let o=_t(e,t);for(;o&&pe(o)&&dt(o);)o=_t(o,t);return o&&j(o)&&dt(o)&&!gt(o)?n:o||Ae(e)||n}const Le=async function(e){const t=this.getOffsetParent||Vt,n=this.getDimensions,o=await n(e.floating);return{reference:Ie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Fe(e){return L(e).direction==="rtl"}const Me={convertOffsetParentRelativeRectToViewportRelativeRect:Ce,getDocumentElement:B,getClippingRect:Te,getOffsetParent:Vt,getElementRects:Le,getClientRects:Re,getDimensions:ke,getScale:K,isElement:I,isRTL:Fe};function Qt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Be(e,t){let n=null,o;const s=B(e);function i(){var r;clearTimeout(o),(r=n)==null||r.disconnect(),n=null}function l(r,a){r===void 0&&(r=!1),a===void 0&&(a=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=c;if(r||t(),!m||!f)return;const p=ot(d),h=ot(s.clientWidth-(u+m)),v=ot(s.clientHeight-(d+f)),g=ot(u),w={rootMargin:-p+"px "+-h+"px "+-v+"px "+-g+"px",threshold:O(0,Y(1,a))||1};let C=!0;function b(E){const _=E[0].intersectionRatio;if(_!==a){if(!C)return l();_?l(!1,_):o=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!Qt(c,e.getBoundingClientRect())&&l(),C=!1}try{n=new IntersectionObserver(b,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return l(!0),i}function Pe(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:r=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,c=yt(e),u=s||i?[...c?Z(c):[],...Z(t)]:[];u.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const d=c&&r?Be(c,n):null;let m=-1,f=null;l&&(f=new ResizeObserver(g=>{let[y]=g;y&&y.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!a&&f.observe(c),f.observe(t));let p,h=a?J(e):null;a&&v();function v(){const g=J(e);h&&!Qt(h,g)&&n(),h=g,p=requestAnimationFrame(v)}return n(),()=>{var g;u.forEach(y=>{s&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const Ne=ce,Ve=ue,Qe=le,He=fe,qe=(e,t,n)=>{const o=new Map,s={platform:Me,...n},i={...s.platform,_c:o};return ie(e,t,{...s,platform:i})};function Ue(e,t){const n=A.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let o=null;const s=()=>{!e.value||!t.value||qe(e.value,t.value,{placement:"bottom-start",strategy:"fixed",middleware:[Ne(6),Qe(),Ve({padding:10}),He({apply({rects:r,elements:a}){const c=`${r.reference.width}px`;Object.assign(a.floating.style,{width:c,minWidth:c,maxWidth:c})}})]}).then(({x:r,y:a})=>{Object.assign(n.value,{left:`${r}px`,top:`${a}px`})})},i=()=>{e.value&&t.value&&(o=Pe(e.value,t.value,s))},l=()=>{o&&(o(),o=null)};return A.onBeforeUnmount(l),{floatingStyles:n,startTrack:i,stopTrack:l}}const We="data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2534'%20width='200'%20height='200'%3e%3cpath%20d='M448%2085.333333a362.666667%20362.666667%200%201%200%20224.512%20647.509334l155.818667%20155.818666a42.666667%2042.666667%200%200%200%2060.330666-60.330666l-155.818666-155.818667A362.666667%20362.666667%200%200%200%20448%2085.333333zM170.666667%20448a277.333333%20277.333333%200%201%201%20554.666666%200%20277.333333%20277.333333%200%200%201-554.666666%200z'%20p-id='2535'%3e%3c/path%3e%3c/svg%3e",Ge="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOkVhOcZyepYndNpDpPvwAAAP//BVQJHAAAAAZJREFUAwDZWL4hub5xHQAAAABJRU5ErkJggg==",Je="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACC0lEQVR4AXxRv2tTURT+zk1iIjgoOMShkIJVNwf/gQYULOjQwaGvGl8TBMEMDg4ODgF17likvL4HIYm4OLg61K2CooWKDoKCDoJDHASb9N17POf5Enwk6eN+9/z+3nfvNZjxbYS9ymbYXlQ8CbvnZrRhKoEOFMl9zFHuuaJA/E4Jp5FMJTCwZWner/veCYX6ecQVsRNrKsFE1yGJ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70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",Xe=A.defineComponent({name:"GlobalSearch",model:{prop:"value",event:"input"},props:{value:{type:[Object,Array],default:null},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},searchTypeList:{type:Array,default:()=>["City","Seaport","Airport","Country"]},historyKey:{type:String,default:""}},setup(e,{emit:t}){const n=A.ref(""),o=A.ref(!1),s=A.ref(!1),i=A.ref(""),l=A.ref(null),r=A.ref(null),a=A.ref(null),c=A.ref(null),{searchHistory:u,saveToHistory:d,clearHistory:m}=Wt(A.toRef(e,"historyKey")),{searchResults:f,loading:p,isFetchingMore:h,isFinished:v,currentPage:g,fetchData:y,filterByTypes:w}=Kt(n,A.toRef(e,"searchTypeList")),{floatingStyles:C,startTrack:b,stopTrack:E}=Ue(a,c),_=async()=>{if(s.value=!0,console.log("🍉 ~ index.vue:210 ~ onFocus ~ searchResults.value:",f.value,o.value),!e.multiple&&o.value&&f.value.length===0){const x=e.value;if(console.log("🍉 ~ index.vue:221 ~ onFocus ~ val:",x),x?.id){p.value=!0;try{const V=await Jt(x.id,x.type);f.value=w(V.records)}finally{p.value=!1}}}},P=()=>{setTimeout(()=>{s.value=!1},200)},N=x=>{x.target.value===""&&!e.multiple&&(o.value=!1,t("input",null),t("update:value",null))},T=()=>{if(e.multiple&&!n.value&&e.value?.length>0){const x=[...e.value],V=x.pop();t("input",x),t("update:value",x),t("remove",V)}};return A.watch(s,x=>x?b():E()),A.watch(n,x=>{if(!x.trim()){f.value=[];return}l.value&&clearTimeout(l.value),l.value=setTimeout(()=>y(1,!1),300)}),A.onBeforeUnmount(E),{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:r,referenceRef:a,floatingRef:c,searchHistory:u,searchResults:f,loading:p,isFetchingMore:h,isFinished:v,currentPage:g,floatingStyles:C,saveToHistory:d,clearHistory:m,fetchData:y,filterByTypes:w,startTrack:b,stopTrack:E,onFocus:_,handleBlur:P,onInput:N,handleDelete:T,SearchIcon:We}},computed:{isEn(){let e="";try{if(typeof useCookie=="function"){const t=useCookie("jc-language").value;if(t)return/en/.test(t)||/en-US/.test(t)}}catch{}return process.client?e=document.cookie||"":process.server&&(e=useNuxtApp?.()?.ssrContext?.event.node.req.headers.cookie||""),/jc-language=en-US/.test(e)||/jc-language=en/.test(e)},selectedItems(){return this.value?Array.isArray(this.value)?this.value:[this.value]:[]},displayedTags(){return this.collapseTags?this.selectedItems.slice(0,1):this.selectedItems},hasValue(){return this.query||this.selectedItems.length>0},inputWidth(){return this.multiple?this.query?`${this.query.length*10+20}px`:"10px":"100%"},currentPlaceholder(){return this.multiple&&this.selectedItems.length>0?"":this.isSelected&&!this.multiple?this.selectedLabel:this.isEn?"Please enter...":"请输入..."}},methods:{focusInput(){this.$refs.inputRef?.focus()},getItemLabel(e){return e.display||e.nameEn||e.nameCn||""},isItemActive(e){return this.selectedItems.some(t=>t.id===e.id)},selectItem(e){this.saveToHistory(e),this.multiple?this.isItemActive(e)||(this.$emit("input",[...this.selectedItems,e]),this.$emit("update:value",[...this.selectedItems,e])):(this.isSelected=!0,this.selectedLabel=this.getItemLabel(e),this.$emit("input",e),this.$emit("update:value",e),this.isDropdownVisible=!1),this.query="",this.$emit("select",e)},removeItem(e){const t=this.selectedItems.filter(n=>n.id!==e.id);this.$emit("input",t),this.$emit("update:value",t),this.$emit("remove",e)},clearAll(){this.query="",this.isSelected=!1,this.selectedLabel="",this.$emit("input",this.multiple?[]:null),this.$emit("update:value",this.multiple?[]:null)},handleSearch(){const e=this.multiple?this.selectedItems:this.isSelected?this.value:{nameCn:this.query,type:"Manual"};this.$emit("submit-search",e),this.isDropdownVisible=!1},getIconUrl(e){return{City:Ge,Seaport:Je,Airport:Ke,Country:Ye}[e]||je},handleScroll(e){const{scrollTop:t,scrollHeight:n,clientHeight:o}=e.target;t+o>=n-20&&!this.loading&&!this.isFetchingMore&&!this.isFinished&&this.query&&this.fetchData(this.currentPage+1,!0)}}});function At(e,t,n,o,s,i,l,r){var a=typeof e=="function"?e.options:e;return t&&(a.render=t,a.staticRenderFns=n,a._compiled=!0),i&&(a._scopeId="data-v-"+i),{exports:e,options:a}}var ze=function(){var t=this,n=t._self._c;return t._self._setupProxy,n("div",{staticClass:"search-container"},[n("div",{ref:"referenceRef",staticClass:"search-input-wrapper",class:{"is-multiple":t.multiple},on:{click:t.focusInput}},[n("div",{staticClass:"selection-wrapper"},[t.multiple&&t.selectedItems.length>0?[t._l(t.displayedTags,function(o,s){return n("div",{key:o.id||s,staticClass:"search-tag"},[n("span",{staticClass:"tag-text"},[t._v(t._s(t.getItemLabel(o)))]),n("span",{staticClass:"tag-close",on:{click:function(i){return i.stopPropagation(),t.removeItem(o)}}},[t._v("×")])])}),t.collapseTags&&t.selectedItems.length>1?n("div",{staticClass:"search-tag collapse"},[t._v(" + "+t._s(t.selectedItems.length-1)+" ")]):t._e()]:t._e(),n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],ref:"inputRef",class:{"is-selected-state":t.isSelected&&!t.multiple},style:{width:t.inputWidth},attrs:{type:"text",placeholder:t.currentPlaceholder},domProps:{value:t.query},on:{focus:t.onFocus,blur:t.handleBlur,input:[function(o){o.target.composing||(t.query=o.target.value)},t.onInput],keydown:function(o){return!o.type.indexOf("key")&&t._k(o.keyCode,"delete",[8,46],o.key,["Backspace","Delete","Del"])?null:t.handleDelete.apply(null,arguments)}}})],2),n("div",{staticClass:"suffix-area"},[t.hasValue?n("span",{staticClass:"clear-icon",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearAll.apply(null,arguments)}}},[t._v("ⓧ")]):t._e(),t.loading&&!t.isFetchingMore?n("div",{staticClass:"loading-spinner"}):n("button",{staticClass:"search-btn",on:{click:t.handleSearch}},[n("span",{staticClass:"search-icon"},[n("img",{attrs:{src:t.SearchIcon,alt:"search"}})])])])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isDropdownVisible&&(t.searchResults.length>0||t.loading||t.query||t.searchHistory.length>0),expression:`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("vue"),C=require("@jctrans-materials/shared"),R=require("jctrans-ui");v.util.warn;function Gt(e){const t=v.ref([]),n="_search_history_cache",o=typeof window<"u"&&typeof localStorage<"u",s=v.computed(()=>(e.value||"")+n),i=v.computed(()=>!!e.value&&e.value!==""),r=a=>{if(!a||!o)return;const c=t.value.filter(d=>d.id&&d.id!==a.id||d.display!==a.display);c.unshift(a);const u=c.slice(0,4);if(i.value){t.value=u;try{localStorage.setItem(s.value,JSON.stringify(u))}catch(d){console.warn("LocalStorage save failed:",d)}}},l=()=>{t.value=[],o&&localStorage.removeItem(s.value)};return v.onMounted(()=>{if(o&&i.value){const a=localStorage.getItem(s.value);if(a)try{t.value=JSON.parse(a)}catch{t.value=[]}}}),{searchHistory:t,saveToHistory:r,clearHistory:l,HasHistory:i}}async function Jt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return C.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const Kt=(e,t)=>C.locationSearchV2.searchByIdWithType(e,t);function Yt(e,t){const n=v.ref([]),o=v.ref(!1),s=v.ref(!1),i=v.ref(1),r=v.ref(0),l=v.ref(10),a=v.computed(()=>r.value===0?!1:n.value.length>=r.value),c=v.computed(()=>{const m=[...t.value];return m.includes("Country")&&!m.includes("Region")&&m.push("Region"),m}),u=m=>!m||!Array.isArray(m)?[]:m.filter(f=>c.value.includes(f.type));return{searchResults:n,loading:o,isFetchingMore:s,isFinished:a,currentPage:i,total:r,fetchData:async(m=1,f=!1)=>{if(!e.value.trim()&&!f){n.value=[],r.value=0;return}if(!(f&&(s.value||a.value))&&!(!f&&o.value)){f?s.value=!0:(o.value=!0,i.value=1);try{const p=await Jt(e.value,t.value,{current:m,size:l.value}),h=p.records||[],y=u(h);f?n.value=[...n.value,...y]:n.value=y,r.value=p.total||0,i.value=m}catch(p){console.error("Failed to fetch search results:",p)}finally{o.value=!1,s.value=!1}}},filterByTypes:u}}const Y=Math.min,D=Math.max,st=Math.round,ot=Math.floor,F=e=>({x:e,y:e}),jt={left:"right",right:"left",bottom:"top",top:"bottom"},Xt={start:"end",end:"start"};function bt(e,t,n){return D(e,Y(t,n))}function tt(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function et(e){return e.split("-")[1]}function kt(e){return e==="x"?"y":"x"}function It(e){return e==="y"?"height":"width"}const zt=new Set(["top","bottom"]);function Q(e){return zt.has(q(e))?"y":"x"}function Lt(e){return kt(Q(e))}function $t(e,t,n){n===void 0&&(n=!1);const o=et(e),s=Lt(e),i=It(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(r=it(r)),[r,it(r)]}function Zt(e){const t=it(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>Xt[t])}const xt=["left","right"],Ct=["right","left"],te=["top","bottom"],ee=["bottom","top"];function ne(e,t,n){switch(e){case"top":case"bottom":return n?t?Ct:xt:t?xt:Ct;case"left":case"right":return t?te:ee;default:return[]}}function oe(e,t,n,o){const s=et(e);let i=ne(q(e),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),t&&(i=i.concat(i.map(mt)))),i}function it(e){return e.replace(/left|right|bottom|top/g,t=>jt[t])}function se(e){return{top:0,right:0,bottom:0,left:0,...e}}function ie(e){return typeof e!="number"?se(e):{top:e,right:e,bottom:e,left:e}}function rt(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function St(e,t,n){let{reference:o,floating:s}=e;const i=Q(t),r=Lt(t),l=It(r),a=q(t),c=i==="y",u=o.x+o.width/2-s.width/2,d=o.y+o.height/2-s.height/2,m=o[l]/2-s[l]/2;let f;switch(a){case"top":f={x:u,y:o.y-s.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-s.width,y:d};break;default:f={x:o.x,y:o.y}}switch(et(t)){case"start":f[r]-=m*(n&&c?-1:1);break;case"end":f[r]+=m*(n&&c?-1:1);break}return f}const re=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,l=i.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(t));let c=await r.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=St(c,o,a),m=o,f={},p=0;for(let h=0;h<l.length;h++){const{name:y,fn:g}=l[h],{x:A,y:w,data:S,reset:b}=await g({x:u,y:d,initialPlacement:o,placement:m,strategy:s,middlewareData:f,rects:c,platform:r,elements:{reference:e,floating:t}});u=A??u,d=w??d,f={...f,[y]:{...f[y],...S}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(c=b.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:s}):b.rects),{x:u,y:d}=St(c,m,a)),h=-1)}return{x:u,y:d,placement:m,strategy:s,middlewareData:f}};async function ht(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:i,rects:r,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=tt(t,e),p=ie(f),y=l[m?d==="floating"?"reference":"floating":d],g=rt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),A=d==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},b=rt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:A,offsetParent:w,strategy:a}):A);return{top:(g.top-b.top+p.top)/S.y,bottom:(b.bottom-g.bottom+p.bottom)/S.y,left:(g.left-b.left+p.left)/S.x,right:(b.right-g.right+p.right)/S.x}}const le=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...y}=tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=q(s),A=Q(l),w=q(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(c.floating)),b=m||(w||!h?[it(l)]:Zt(l)),_=p!=="none";!m&&_&&b.push(...oe(l,h,p,S));const E=[l,...b],P=await ht(t,y),N=[];let T=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&N.push(P[g]),d){const W=$t(s,r,S);N.push(P[W[0]],P[W[1]])}if(T=[...T,{placement:s,overflows:N}],!N.every(W=>W<=0)){var x,V;const W=(((x=i.flip)==null?void 0:x.index)||0)+1,ft=E[W];if(ft&&(!(d==="alignment"?A!==Q(ft):!1)||T.every(k=>Q(k.placement)===A?k.overflows[0]>0:!0)))return{data:{index:W,overflows:T},reset:{placement:ft}};let $=(V=T.filter(G=>G.overflows[0]<=0).sort((G,k)=>G.overflows[1]-k.overflows[1])[0])==null?void 0:V.placement;if(!$)switch(f){case"bestFit":{var z;const G=(z=T.filter(k=>{if(_){const H=Q(k.placement);return H===A||H==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(H=>H>0).reduce((H,Wt)=>H+Wt,0)]).sort((k,H)=>k[1]-H[1])[0])==null?void 0:z[0];G&&($=G);break}case"initialPlacement":$=l;break}if(s!==$)return{reset:{placement:$}}}return{}}}},ae=new Set(["left","top"]);async function ce(e,t){const{placement:n,platform:o,elements:s}=e,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=q(n),l=et(n),a=Q(n)==="y",c=ae.has(r)?-1:1,u=i&&a?-1:1,d=tt(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(f=l==="end"?p*-1:p),a?{x:f*u,y:m*c}:{x:m*c,y:f*u}}const ue=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:i,placement:r,middlewareData:l}=t,a=await ce(t,e);return r===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:r}}}}},fe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s}=t,{mainAxis:i=!0,crossAxis:r=!1,limiter:l={fn:y=>{let{x:g,y:A}=y;return{x:g,y:A}}},...a}=tt(e,t),c={x:n,y:o},u=await ht(t,a),d=Q(q(s)),m=kt(d);let f=c[m],p=c[d];if(i){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",A=f+u[y],w=f-u[g];f=bt(A,f,w)}if(r){const y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",A=p+u[y],w=p-u[g];p=bt(A,p,w)}const h=l.fn({...t,[m]:f,[d]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:i,[d]:r}}}}}},de=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:i,platform:r,elements:l}=t,{apply:a=()=>{},...c}=tt(e,t),u=await ht(t,c),d=q(s),m=et(s),f=Q(s)==="y",{width:p,height:h}=i.floating;let y,g;d==="top"||d==="bottom"?(y=d,g=m===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(g=d,y=m==="end"?"top":"bottom");const A=h-u.top-u.bottom,w=p-u.left-u.right,S=Y(h-u[y],A),b=Y(p-u[g],w),_=!t.middlewareData.shift;let E=S,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(E=A),_&&!m){const T=D(u.left,0),x=D(u.right,0),V=D(u.top,0),z=D(u.bottom,0);f?P=p-2*(T!==0||x!==0?T+x:D(u.left,u.right)):E=h-2*(V!==0||z!==0?V+z:D(u.top,u.bottom))}await a({...t,availableWidth:P,availableHeight:E});const N=await r.getDimensions(l.floating);return p!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function lt(){return typeof window<"u"}function X(e){return Ft(e)?(e.nodeName||"").toLowerCase():"#document"}function O(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function M(e){var t;return(t=(Ft(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ft(e){return lt()?e instanceof Node||e instanceof O(e).Node:!1}function I(e){return lt()?e instanceof Element||e instanceof O(e).Element:!1}function B(e){return lt()?e instanceof HTMLElement||e instanceof O(e).HTMLElement:!1}function Rt(e){return!lt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof O(e).ShadowRoot}const me=new Set(["inline","contents"]);function nt(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!me.has(s)}const pe=new Set(["table","td","th"]);function he(e){return pe.has(X(e))}const ge=[":popover-open",":modal"];function at(e){return ge.some(t=>{try{return e.matches(t)}catch{return!1}})}const ye=["transform","translate","scale","rotate","perspective"],ve=["transform","translate","scale","rotate","perspective","filter"],Ae=["paint","layout","strict","content"];function gt(e){const t=yt(),n=I(e)?L(e):e;return ye.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ve.some(o=>(n.willChange||"").includes(o))||Ae.some(o=>(n.contain||"").includes(o))}function we(e){let t=U(e);for(;B(t)&&!j(t);){if(gt(t))return t;if(at(t))return null;t=U(t)}return null}function yt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const be=new Set(["html","body","#document"]);function j(e){return be.has(X(e))}function L(e){return O(e).getComputedStyle(e)}function ct(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function U(e){if(X(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Rt(e)&&e.host||M(e);return Rt(t)?t.host:t}function Bt(e){const t=U(e);return j(t)?e.ownerDocument?e.ownerDocument.body:e.body:B(t)&&nt(t)?t:Bt(t)}function Z(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Bt(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),r=O(s);if(i){const l=pt(r);return t.concat(r,r.visualViewport||[],nt(s)?s:[],l&&n?Z(l):[])}return t.concat(s,Z(s,[],n))}function pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=L(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=B(e),i=s?e.offsetWidth:n,r=s?e.offsetHeight:o,l=st(n)!==i||st(o)!==r;return l&&(n=i,o=r),{width:n,height:o,$:l}}function vt(e){return I(e)?e:e.contextElement}function K(e){const t=vt(e);if(!B(t))return F(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Mt(t);let r=(i?st(n.width):n.width)/o,l=(i?st(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const xe=F(0);function Pt(e){const t=O(e);return!yt()||!t.visualViewport?xe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ce(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==O(e)?!1:t}function J(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=vt(e);let r=F(1);t&&(o?I(o)&&(r=K(o)):r=K(e));const l=Ce(i,n,o)?Pt(i):F(0);let a=(s.left+l.x)/r.x,c=(s.top+l.y)/r.y,u=s.width/r.x,d=s.height/r.y;if(i){const m=O(i),f=o&&I(o)?O(o):o;let p=m,h=pt(p);for(;h&&o&&f!==p;){const y=K(h),g=h.getBoundingClientRect(),A=L(h),w=g.left+(h.clientLeft+parseFloat(A.paddingLeft))*y.x,S=g.top+(h.clientTop+parseFloat(A.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,d*=y.y,a+=w,c+=S,p=O(h),h=pt(p)}}return rt({width:u,height:d,x:a,y:c})}function ut(e,t){const n=ct(e).scrollLeft;return t?t.left+n:J(M(e)).left+n}function Nt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ut(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function Se(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",r=M(o),l=t?at(t.floating):!1;if(o===r||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=F(1);const u=F(0),d=B(o);if((d||!d&&!i)&&((X(o)!=="body"||nt(r))&&(a=ct(o)),B(o))){const f=J(o);c=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=r&&!d&&!i?Nt(r,a):F(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-a.scrollTop*c.y+u.y+m.y}}function Re(e){return Array.from(e.getClientRects())}function De(e){const t=M(e),n=ct(e),o=e.ownerDocument.body,s=D(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=D(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ut(e);const l=-n.scrollTop;return L(o).direction==="rtl"&&(r+=D(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:l}}const Dt=25;function Oe(e,t){const n=O(e),o=M(e),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,l=0,a=0;if(s){i=s.width,r=s.height;const u=yt();(!u||u&&t==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const c=ut(o);if(c<=0){const u=o.ownerDocument,d=u.body,m=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-d.clientWidth-f);p<=Dt&&(i-=p)}else c<=Dt&&(i+=c);return{width:i,height:r,x:l,y:a}}const Ee=new Set(["absolute","fixed"]);function _e(e,t){const n=J(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,i=B(e)?K(e):F(1),r=e.clientWidth*i.x,l=e.clientHeight*i.y,a=s*i.x,c=o*i.y;return{width:r,height:l,x:a,y:c}}function Ot(e,t,n){let o;if(t==="viewport")o=Oe(e,n);else if(t==="document")o=De(M(e));else if(I(t))o=_e(t,n);else{const s=Pt(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return rt(o)}function Vt(e,t){const n=U(e);return n===t||!I(n)||j(n)?!1:L(n).position==="fixed"||Vt(n,t)}function Te(e,t){const n=t.get(e);if(n)return n;let o=Z(e,[],!1).filter(l=>I(l)&&X(l)!=="body"),s=null;const i=L(e).position==="fixed";let r=i?U(e):e;for(;I(r)&&!j(r);){const l=L(r),a=gt(r);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&Ee.has(s.position)||nt(r)&&!a&&Vt(e,r))?o=o.filter(u=>u!==r):s=l,r=U(r)}return t.set(e,o),o}function ke(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const r=[...n==="clippingAncestors"?at(t)?[]:Te(t,this._c):[].concat(n),o],l=r[0],a=r.reduce((c,u)=>{const d=Ot(t,u,s);return c.top=D(d.top,c.top),c.right=Y(d.right,c.right),c.bottom=Y(d.bottom,c.bottom),c.left=D(d.left,c.left),c},Ot(t,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ie(e){const{width:t,height:n}=Mt(e);return{width:t,height:n}}function Le(e,t,n){const o=B(t),s=M(t),i=n==="fixed",r=J(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=F(0);function c(){a.x=ut(s)}if(o||!o&&!i)if((X(t)!=="body"||nt(s))&&(l=ct(t)),o){const f=J(t,!0,i,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else s&&c();i&&!o&&s&&c();const u=s&&!o&&!i?Nt(s,l):F(0),d=r.left+l.scrollLeft-a.x-u.x,m=r.top+l.scrollTop-a.y-u.y;return{x:d,y:m,width:r.width,height:r.height}}function dt(e){return L(e).position==="static"}function Et(e,t){if(!B(e)||L(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return M(e)===n&&(n=n.ownerDocument.body),n}function Qt(e,t){const n=O(e);if(at(e))return n;if(!B(e)){let s=U(e);for(;s&&!j(s);){if(I(s)&&!dt(s))return s;s=U(s)}return n}let o=Et(e,t);for(;o&&he(o)&&dt(o);)o=Et(o,t);return o&&j(o)&&dt(o)&&!gt(o)?n:o||we(e)||n}const Fe=async function(e){const t=this.getOffsetParent||Qt,n=this.getDimensions,o=await n(e.floating);return{reference:Le(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Be(e){return L(e).direction==="rtl"}const Me={convertOffsetParentRelativeRectToViewportRelativeRect:Se,getDocumentElement:M,getClippingRect:ke,getOffsetParent:Qt,getElementRects:Fe,getClientRects:Re,getDimensions:Ie,getScale:K,isElement:I,isRTL:Be};function Ht(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Pe(e,t){let n=null,o;const s=M(e);function i(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function r(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=c;if(l||t(),!m||!f)return;const p=ot(d),h=ot(s.clientWidth-(u+m)),y=ot(s.clientHeight-(d+f)),g=ot(u),w={rootMargin:-p+"px "+-h+"px "+-y+"px "+-g+"px",threshold:D(0,Y(1,a))||1};let S=!0;function b(_){const E=_[0].intersectionRatio;if(E!==a){if(!S)return r();E?r(!1,E):o=setTimeout(()=>{r(!1,1e-7)},1e3)}E===1&&!Ht(c,e.getBoundingClientRect())&&r(),S=!1}try{n=new IntersectionObserver(b,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return r(!0),i}function Ne(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,c=vt(e),u=s||i?[...c?Z(c):[],...Z(t)]:[];u.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const d=c&&l?Pe(c,n):null;let m=-1,f=null;r&&(f=new ResizeObserver(g=>{let[A]=g;A&&A.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!a&&f.observe(c),f.observe(t));let p,h=a?J(e):null;a&&y();function y(){const g=J(e);h&&!Ht(h,g)&&n(),h=g,p=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(A=>{s&&A.removeEventListener("scroll",n),i&&A.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const Ve=ue,Qe=fe,He=le,qe=de,Ue=(e,t,n)=>{const o=new Map,s={platform:Me,...n},i={...s.platform,_c:o};return re(e,t,{...s,platform:i})};function We(e,t){const n=v.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let o=null;const s=()=>{!e.value||!t.value||Ue(e.value,t.value,{placement:"bottom-start",strategy:"fixed",middleware:[Ve(6),He(),Qe({padding:10}),qe({apply({rects:l,elements:a}){const c=`${l.reference.width}px`;Object.assign(a.floating.style,{width:c,minWidth:c,maxWidth:c})}})]}).then(({x:l,y:a})=>{Object.assign(n.value,{left:`${l}px`,top:`${a}px`})})},i=()=>{e.value&&t.value&&(o=Ne(e.value,t.value,s))},r=()=>{o&&(o(),o=null)};return v.onBeforeUnmount(r),{floatingStyles:n,startTrack:i,stopTrack:r}}const Ge="data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2534'%20width='200'%20height='200'%3e%3cpath%20d='M448%2085.333333a362.666667%20362.666667%200%201%200%20224.512%20647.509334l155.818667%20155.818666a42.666667%2042.666667%200%200%200%2060.330666-60.330666l-155.818666-155.818667A362.666667%20362.666667%200%200%200%20448%2085.333333zM170.666667%20448a277.333333%20277.333333%200%201%201%20554.666666%200%20277.333333%20277.333333%200%200%201-554.666666%200z'%20p-id='2535'%3e%3c/path%3e%3c/svg%3e",Je="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOk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IAHRHMH0Ly0tCBF3M5t+Aq6A0HPJSSyCeZAIz7BNAgQwqxNyc1NL7MCoeyH1xNWpuKsTcet7fv46QI0/zdoEtkmAwHGcHyFQj/Q57vuPzm7m+X5efB6HYj3kOCubuLVlApltfdbPX5uaetCmdeKVAqUN1mdy04XR3PTsqAHPWMztTb24myvEBBuRM+WlUnbzDEXeya2D4XC0zrJqnXwsO3pG3mCMGWMK6lQZk2A0hH2GMSxL9VlI6lVkd90RgGKkVFrrc+9REXubjLH9FxfbbVUVGG5v4i2p8LD8x9ax65C66KTfKGCSDc97fv6DJzuf9QtDtm+iqsM1ot70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",ze=v.defineComponent({name:"GlobalSearch",model:{prop:"value",event:"input"},props:{value:{type:[Object,Array],default:null},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},searchTypeList:{type:Array,default:()=>["City","Seaport","Airport","Country"]},historyKey:{type:String,default:""},lang:{type:String,default:""},placeholder:{type:String,default:""},showSearchIcon:{type:Boolean,default:!0},showItemTag:{type:Boolean,default:!0}},setup(e,{emit:t}){const n=v.ref(""),o=v.ref(!1),s=v.ref(!1),i=v.ref(""),r=v.ref(null),l=v.ref(null),a=v.ref(null),c=v.ref(null),{searchHistory:u,saveToHistory:d,clearHistory:m}=Gt(v.toRef(e,"historyKey")),{searchResults:f,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,fetchData:A,filterByTypes:w}=Yt(n,v.toRef(e,"searchTypeList")),{floatingStyles:S,startTrack:b,stopTrack:_}=We(a,c),E=async()=>{if(s.value=!0,console.log("🍉 ~ index.vue:210 ~ onFocus ~ searchResults.value:",f.value,o.value),!e.multiple&&o.value&&f.value.length===0){const x=e.value;if(console.log("🍉 ~ index.vue:221 ~ onFocus ~ val:",x),x?.id){p.value=!0;try{const V=await Kt(x.id,x.type);f.value=w(V.records)}finally{p.value=!1}}}},P=()=>{setTimeout(()=>{s.value=!1},200)},N=x=>{x.target.value===""&&!e.multiple&&(o.value=!1,t("input",null),t("update:value",null))},T=()=>{if(e.multiple&&!n.value&&e.value?.length>0){const x=[...e.value],V=x.pop();t("input",x),t("update:value",x),t("remove",V)}};return v.watch(s,x=>x?b():_()),v.watch(n,x=>{if(!x.trim()){f.value=[];return}r.value&&clearTimeout(r.value),r.value=setTimeout(()=>A(1,!1),300)}),v.onBeforeUnmount(_),{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:l,referenceRef:a,floatingRef:c,searchHistory:u,searchResults:f,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,floatingStyles:S,saveToHistory:d,clearHistory:m,fetchData:A,filterByTypes:w,startTrack:b,stopTrack:_,onFocus:E,handleBlur:P,onInput:N,handleDelete:T,SearchIcon:Ge}},computed:{isEn(){if(this.lang!=="")return this.lang==="en"||this.lang==="en-US";let e="";try{if(typeof useCookie=="function"){const t=useCookie("jc-language").value;if(t)return/en/.test(t)||/en-US/.test(t)}}catch{}return typeof process<"u"&&process.client?e=document.cookie||"":typeof process<"u"&&process.server&&(e=useNuxtApp?.()?.ssrContext?.event.node.req.headers.cookie||""),/jc-language=en-US/.test(e)||/jc-language=en/.test(e)},selectedItems(){return this.value?Array.isArray(this.value)?this.value:[this.value]:[]},displayedTags(){return this.collapseTags?this.selectedItems.slice(0,1):this.selectedItems},hasValue(){return this.query||this.selectedItems.length>0},inputWidth(){return this.multiple?this.query?`${this.query.length*10+20}px`:"10px":"100%"},currentPlaceholder(){return this.multiple&&this.selectedItems.length>0?"":this.isSelected&&!this.multiple?this.selectedLabel:this.placeholder||this.isEn?"Please enter...":"请输入..."}},methods:{focusInput(){this.$refs.inputRef?.focus()},getItemLabel(e){return this.isEn?e.displayEn||e.display||"":e.displayCn||e.display||""},getItemType(e){const t={City:{en:"City",cn:"城市"},Country:{en:"Country",cn:"国家"},Region:{en:"Region",cn:"区域"},Airport:{en:"Airport",cn:"机场"},Seaport:{en:"Seaport",cn:"港口"}};return this.isEn?t[e].en:t[e].cn},isItemActive(e){return this.selectedItems.some(t=>t.id===e.id)},selectItem(e){this.saveToHistory(e),this.multiple?this.isItemActive(e)||(this.$emit("input",[...this.selectedItems,e]),this.$emit("update:value",[...this.selectedItems,e])):(this.isSelected=!0,this.selectedLabel=this.getItemLabel(e),this.$emit("input",e),this.$emit("update:value",e),this.isDropdownVisible=!1),this.query="",this.$emit("select",e)},removeItem(e){const t=this.selectedItems.filter(n=>n.id!==e.id);this.$emit("input",t),this.$emit("update:value",t),this.$emit("remove",e)},clearAll(){this.query="",this.isSelected=!1,this.selectedLabel="",this.$emit("input",this.multiple?[]:null),this.$emit("update:value",this.multiple?[]:null)},handleSearch(){const e=this.multiple?this.selectedItems:this.isSelected?this.value:null;this.$emit("submit-search",e),this.isDropdownVisible=!1},getIconUrl(e){return{City:Je,Seaport:Ke,Airport:Ye,Country:je}[e]||Xe},handleScroll(e){const{scrollTop:t,scrollHeight:n,clientHeight:o}=e.target;t+o>=n-20&&!this.loading&&!this.isFetchingMore&&!this.isFinished&&this.query&&this.fetchData(this.currentPage+1,!0)}}});function At(e,t,n,o,s,i,r,l){var a=typeof e=="function"?e.options:e;return t&&(a.render=t,a.staticRenderFns=n,a._compiled=!0),i&&(a._scopeId="data-v-"+i),{exports:e,options:a}}var $e=function(){var t=this,n=t._self._c;return t._self._setupProxy,n("div",{staticClass:"search-container"},[n("div",{ref:"referenceRef",staticClass:"search-input-wrapper",class:{"is-multiple":t.multiple},on:{click:t.focusInput}},[n("div",{staticClass:"selection-wrapper"},[t.multiple&&t.selectedItems.length>0?[t._l(t.displayedTags,function(o,s){return n("div",{key:o.id||s,staticClass:"search-tag"},[n("span",{staticClass:"tag-text"},[t._v(t._s(t.getItemLabel(o)))]),n("span",{staticClass:"tag-close",on:{click:function(i){return i.stopPropagation(),t.removeItem(o)}}},[t._v("×")])])}),t.collapseTags&&t.selectedItems.length>1?n("div",{staticClass:"search-tag collapse"},[t._v(" + "+t._s(t.selectedItems.length-1)+" ")]):t._e()]:t._e(),n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],ref:"inputRef",class:{"is-selected-state":t.isSelected&&!t.multiple},style:{width:t.inputWidth},attrs:{type:"text",placeholder:t.currentPlaceholder},domProps:{value:t.query},on:{focus:t.onFocus,blur:t.handleBlur,input:[function(o){o.target.composing||(t.query=o.target.value)},t.onInput],keydown:function(o){return!o.type.indexOf("key")&&t._k(o.keyCode,"delete",[8,46],o.key,["Backspace","Delete","Del"])?null:t.handleDelete.apply(null,arguments)}}})],2),n("div",{staticClass:"suffix-area"},[t.hasValue?n("span",{staticClass:"clear-icon",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearAll.apply(null,arguments)}}},[t._v("ⓧ")]):t._e(),t.loading&&!t.isFetchingMore?n("div",{staticClass:"loading-spinner"}):!t.loading&&t.showSearchIcon?n("button",{staticClass:"search-btn",on:{click:function(o){return o.stopPropagation(),t.handleSearch.apply(null,arguments)}}},[n("span",{staticClass:"search-icon"},[n("img",{attrs:{src:t.SearchIcon,alt:"search"}})])]):t._e()])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isDropdownVisible&&(t.searchResults.length>0||t.loading||t.query||t.searchHistory.length>0),expression:`
2
2
  isDropdownVisible &&
3
3
  (searchResults.length > 0 ||
4
4
  loading ||
5
5
  query ||
6
6
  searchHistory.length > 0)
7
- `}],ref:"floatingRef",staticClass:"dropdown-list",style:t.floatingStyles,on:{scroll:t.handleScroll}},[t._t("history",function(){return[t.searchHistory.length>0&&!t.query?n("div",{staticClass:"history-section"},[n("div",{staticClass:"history-header"},[n("span",[t._v(t._s(t.isEn?"Recent search":"最近搜索"))]),n("span",{staticClass:"clear-btn",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearHistory.apply(null,arguments)}}},[t._v(" "+t._s(t.isEn?"Clear":"清空")+" ")])]),t._l(t.searchHistory,function(o,s){return n("div",{key:"hist-"+s,staticClass:"dropdown-item",on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag"},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(o.type))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])}),n("hr",{staticClass:"divider"})],2):t._e()]},{searchHistory:t.searchHistory}),t.loading&&!t.isFetchingMore?n("div",{staticClass:"status-msg"},[t._v(" "+t._s(t.isEn?"Searching...":"正在搜索中...")+" ")]):t.searchResults.length>0?[t._t("results",function(){return t._l(t.searchResults,function(o,s){return n("div",{key:s,staticClass:"dropdown-item",class:{"is-active":t.isItemActive(o)},on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag"},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(o.type))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])})},{searchResults:t.searchResults}),t.isFetchingMore?n("div",{staticClass:"load-more-msg"},[t._v(" "+t._s(t.isEn?"Loading more...":"正在加载更多...")+" ")]):t.isFinished&&t.query?n("div",{staticClass:"load-more-msg no-more"},[t._v(" "+t._s(t.isEn?"All results have been loaded":"已加载全部结果")+" ")]):t._e()]:t.query&&!t.loading?n("div",{staticClass:"status-msg"},[t._t("noData",function(){return[t._v(" "+t._s(t.isEn?`No results found related to "${t.query}".`:`未找到与 "${t.query}" 相关的结果`)+" ")]})],2):t._e()],2)])},$e=[],Ze=At(Xe,ze,$e,!1,null,"0a22c96d");const wt=Ze.exports,tn={__name:"ApplyDataDialog",props:{value:Boolean},emits:["update:value","confirm"],setup(e,{emit:t}){const n=e,o=["City","Port","Airport"],s=A.ref(null),i=A.reactive({name:"",type:"City",selectedCountry:null});return{__sfc:!0,props:n,emit:t,typeOptions:o,displayQuery:s,formData:i,handleClose:()=>{t("update:value",!1)},handleConfirm:()=>{if(!i.name||!s.value){alert("Please fill in all fields");return}t("confirm",{...i,selectedCountry:s.value})},Search:wt}}};var en=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return t.value?n("div",{staticClass:"modal-mask",on:{click:function(s){return s.target!==s.currentTarget?null:o.handleClose.apply(null,arguments)}}},[n("div",{staticClass:"modal-container"},[n("div",{staticClass:"modal-header"},[n("span",{staticClass:"header-title"},[t._v("Apply for data addition")]),n("div",{staticClass:"close-btn",on:{click:o.handleClose}},[t._v("×")])]),n("div",{staticClass:"modal-body"},[n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v("Data To Add")]),n("div",{staticClass:"input-box"},[n("input",{directives:[{name:"model",rawName:"v-model",value:o.formData.name,expression:"formData.name"}],staticClass:"custom-input",attrs:{type:"text",placeholder:"Please enter your data"},domProps:{value:o.formData.name},on:{input:function(s){s.target.composing||t.$set(o.formData,"name",s.target.value)}}})])]),n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v("Type")]),n("div",{staticClass:"type-group"},t._l(o.typeOptions,function(s){return n("div",{key:s,class:["type-btn",{active:o.formData.type===s}],on:{click:function(i){o.formData.type=s}}},[t._v(" "+t._s(s)+" "),o.formData.type===s?n("div",{staticClass:"check-mark"}):t._e()])}),0)]),n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v("Country")]),n(o.Search,{style:{margin:"0 auto"},attrs:{"search-type-list":["Country"]},model:{value:o.displayQuery,callback:function(s){o.displayQuery=s},expression:"displayQuery"}})],1)]),n("div",{staticClass:"modal-footer"},[n("button",{staticClass:"confirm-btn",on:{click:o.handleConfirm}},[t._v("Confirm")])])])]):t._e()},nn=[],on=At(tn,en,nn,!1,null,"55057429");const Ht=on.exports,sn={components:{[D.Dialog.name]:D.Dialog,[D.Form.name]:D.Form,[D.FormItem.name]:D.FormItem,[D.Input.name]:D.Input,[D.Button.name]:D.Button,[D.Checkbox.name]:D.Checkbox,[D.Row.name]:D.Row,[D.Col.name]:D.Col},data(){return{isVisible:!1,formData:{city:"",company:"",email:"",phone:"",name:"",agreement:!1},formRules:{city:[{required:!0,message:"请输入所在地城市",trigger:"blur"}],company:[{required:!0,message:"请输入公司名称",trigger:"blur"}],email:[{required:!0,message:"请输入邮箱",trigger:"blur"},{type:"email",message:"请输入有效的邮箱地址",trigger:"blur"}],agreement:[{validator:(e,t,n)=>{t?n():n(new Error("请同意隐私政策"))},trigger:"change"}]}}},mounted(){R.emitter.on(R.MODAL_ACTION.Open,this.handleOpen)},beforeDestroy(){R.emitter.off(R.MODAL_ACTION.Open,this.handleOpen)},methods:{handleOpen(){console.log("🍉 ~ GlobalModal.vue:150 ~ methods.handleOpen:",this.handleOpen),this.isVisible=!0},closeModal(){this.isVisible=!1,R.emitter.emit(R.MODAL_ACTION.Close),this.$refs.formRef.resetFields()},handleSubmit(){this.$refs.formRef.validate(e=>{e&&(R.emitter.emit(R.MODAL_ACTION.Submit,{...this.formData}),this.closeModal())})}}};var ln=function(){var t=this,n=t._self._c;return n("el-dialog",{attrs:{visible:t.isVisible,"before-close":t.closeModal,"show-close":!1,"close-on-click-modal":!0,width:"500px","custom-class":"global-modal-custom"},on:{"update:visible":function(o){t.isVisible=o}}},[n("div",{staticClass:"global-modal-header-custom",attrs:{slot:"title"},slot:"title"},[n("h2",[t._v("即刻链接全球货代")]),n("el-button",{staticClass:"close-button-custom",attrs:{type:"text"},on:{click:t.closeModal}},[n("span",{staticStyle:{"font-size":"2rem"}},[t._v("×")])])],1),n("div",{staticClass:"global-modal-body-custom"},[n("el-form",{ref:"formRef",attrs:{model:t.formData,rules:t.formRules,"label-position":"top"},nativeOn:{submit:function(o){o.preventDefault()}}},[n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"所在地(城市)",prop:"city"}},[n("el-input",{attrs:{placeholder:"请输入城市"},model:{value:t.formData.city,callback:function(o){t.$set(t.formData,"city",o)},expression:"formData.city"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"公司名称",prop:"company"}},[n("el-input",{attrs:{placeholder:"请输入公司名称"},model:{value:t.formData.company,callback:function(o){t.$set(t.formData,"company",o)},expression:"formData.company"}})],1)],1)],1),n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"邮箱",prop:"email"}},[n("el-input",{attrs:{placeholder:"请输入邮箱"},model:{value:t.formData.email,callback:function(o){t.$set(t.formData,"email",o)},expression:"formData.email"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"电话",prop:"phone"}},[n("el-input",{attrs:{placeholder:"请输入电话"},model:{value:t.formData.phone,callback:function(o){t.$set(t.formData,"phone",o)},expression:"formData.phone"}})],1)],1)],1),n("el-row",[n("el-col",{attrs:{span:24}},[n("el-form-item",{attrs:{label:"姓名",prop:"name"}},[n("el-input",{attrs:{placeholder:"请输入您的全名"},model:{value:t.formData.name,callback:function(o){t.$set(t.formData,"name",o)},expression:"formData.name"}})],1)],1)],1),n("el-form-item",{staticClass:"agreement-item",attrs:{prop:"agreement"}},[n("el-checkbox",{model:{value:t.formData.agreement,callback:function(o){t.$set(t.formData,"agreement",o)},expression:"formData.agreement"}},[t._v("我同意")]),n("a",{staticClass:"privacy-link",attrs:{href:"#"}},[t._v("隐私政策")])],1)],1)],1),n("div",{staticClass:"global-modal-footer-custom",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{staticClass:"submit-button-custom",attrs:{type:"primary"},on:{click:t.handleSubmit}},[t._v(" 加入会员 ")])],1)])},rn=[],an=At(sn,ln,rn,!1,null,null);const qt=an.exports;let cn={open(){R.emitter.emit(R.MODAL_ACTION.Open)},close(){R.emitter.emit(R.MODAL_ACTION.Close)},onSubmit(e){R.emitter.on(R.MODAL_ACTION.Submit,e)}};function un(){let e=!1;return{install(t){if(typeof window<"u"&&!e){const n=document.createElement("div");n.setAttribute("id","global-modal-root"),document.body.appendChild(n);const o=t.extend(qt);new o().$mount(n),e=!0}t.prototype.$globalModal=cn}}}const Et={ApplyDataDialog:Ht,JcSearch:wt},fn={install(e){Object.keys(Et).forEach(t=>{e.component(t,Et[t])})}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>R.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>R.emitter});exports.ApplyDataDialog=Ht;exports.GlobalModal=qt;exports.JcSearch=wt;exports.createGlobalModalPlugin=un;exports.default=fn;
7
+ `}],ref:"floatingRef",staticClass:"dropdown-list",style:t.floatingStyles,on:{scroll:t.handleScroll}},[t._t("history",function(){return[t.searchHistory.length>0&&!t.query?n("div",{staticClass:"history-section"},[n("div",{staticClass:"history-header"},[n("span",[t._v(t._s(t.isEn?"Recent search":"最近搜索"))]),n("span",{staticClass:"clear-btn",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearHistory.apply(null,arguments)}}},[t._v(" "+t._s(t.isEn?"Clear":"清空")+" ")])]),t._l(t.searchHistory,function(o,s){return n("div",{key:"hist-"+s,staticClass:"dropdown-item",on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag",style:t.showItemTag?{}:{display:"none"}},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(t.getItemType(o.type)))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])}),n("hr",{staticClass:"divider"})],2):t._e()]},{searchHistory:t.searchHistory}),t.loading&&!t.isFetchingMore?n("div",{staticClass:"status-msg"},[t._v(" "+t._s(t.isEn?"Searching...":"正在搜索中...")+" ")]):t.searchResults.length>0?[t._t("results",function(){return t._l(t.searchResults,function(o,s){return n("div",{key:s,staticClass:"dropdown-item",class:{"is-active":t.isItemActive(o)},on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag",style:t.showItemTag?{}:{display:"none"}},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(t.getItemType(o.type)))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])})},{searchResults:t.searchResults}),t.isFetchingMore?n("div",{staticClass:"load-more-msg"},[t._v(" "+t._s(t.isEn?"Loading more...":"正在加载更多...")+" ")]):t.isFinished&&t.query?n("div",{staticClass:"load-more-msg no-more"},[t._v(" "+t._s(t.isEn?"All results have been loaded":"已加载全部结果")+" ")]):t._e()]:t.query&&!t.loading?n("div",{staticClass:"status-msg"},[t._t("noData",function(){return[t._v(" "+t._s(t.isEn?`No results found related to "${t.query}".`:`未找到与 "${t.query}" 相关的结果`)+" ")]})],2):t._e()],2)])},Ze=[],tn=At(ze,$e,Ze,!1,null,"fbdd60f5");const wt=tn.exports,en={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:e=>["en","cn"].includes(e)},placeholder:{type:String,default:""}},emits:["update:value","confirm"],setup(e,{emit:t}){const n=e,o=[{typeCn:"城市",typeEn:"City",type:"City"},{typeCn:"海运港口",typeEn:"Port",type:"Seaport"},{typeCn:"机场",typeEn:"Airport",type:"Airport"}],s=v.ref(null),i=v.reactive({name:"",country:""}),r=v.reactive({name:"",type:"City"}),l=v.computed(()=>n.lang==="en"||n.lang==="en-US");return{__sfc:!0,props:n,emit:t,typeOptions:o,displayQuery:s,errors:i,formData:r,isEn:l,handleClose:()=>{i.name="",i.country="",t("update:value",!1)},handleConfirm:()=>{i.name="",i.country="";let u=!0;r.name.trim()||(i.name="Data name is required",u=!1),s.value||(i.country="Please select a country",u=!1),u&&(console.log("🍉 ~ ApplyDataDialog.vue:115 ~ handleConfirm ~ data:",{...r,country:s.value}),t("confirm",{...r,country:s.value}))},Search:wt}}};var nn=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return t.value?n("div",{staticClass:"modal-mask",on:{click:function(s){return s.target!==s.currentTarget?null:o.handleClose.apply(null,arguments)}}},[n("div",{staticClass:"modal-container"},[n("div",{staticClass:"modal-header"},[n("span",{staticClass:"header-title"},[t._v(t._s(o.isEn?"Apply for data addition":"申请补充数据"))]),n("div",{staticClass:"close-btn",on:{click:o.handleClose}},[t._v("×")])]),n("div",{staticClass:"modal-body"},[n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v(t._s(o.isEn?"Data To Add":"需补充的数据"))]),n("div",{staticClass:"input-box"},[n("input",{directives:[{name:"model",rawName:"v-model",value:o.formData.name,expression:"formData.name"}],class:["custom-input",{"input-error":o.errors.name}],attrs:{type:"text",placeholder:t.placeholder??(o.isEn?" Please enter":"请输入")},domProps:{value:o.formData.name},on:{input:[function(s){s.target.composing||t.$set(o.formData,"name",s.target.value)},function(s){o.errors.name=""}]}})]),o.errors.name?n("div",{staticClass:"error-message"},[t._v(t._s(o.errors.name))]):t._e()]),n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v(t._s(o.isEn?"Type":"所属类别"))]),n("div",{staticClass:"type-group"},t._l(o.typeOptions,function(s){return n("div",{key:s.type,class:["type-btn",{active:o.formData.type===s.type}],on:{click:function(i){o.formData.type=s.type}}},[t._v(" "+t._s(o.isEn?s.typeEn:s.typeCn)+" "),o.formData.type===s.type?n("div",{staticClass:"check-mark"}):t._e()])}),0)]),n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v(t._s(o.isEn?"Country":"国家"))]),n("div",{class:{"search-error-wrap":o.errors.country}},[n(o.Search,{style:{margin:"0 auto"},attrs:{"search-type-list":["Country"],lang:t.lang,placeholder:t.placeholder??(o.isEn?" Please enter":"请输入")},on:{"update:model-value":function(s){o.errors.country=""}},model:{value:o.displayQuery,callback:function(s){o.displayQuery=s},expression:"displayQuery"}})],1),o.errors.country?n("div",{staticClass:"error-message"},[t._v(" "+t._s(o.errors.country)+" ")]):t._e()])]),n("div",{staticClass:"modal-footer"},[n("button",{staticClass:"confirm-btn",on:{click:o.handleConfirm}},[t._v(" "+t._s(o.isEn?"Submit":"申请补充")+" ")])])])]):t._e()},on=[],sn=At(en,nn,on,!1,null,"3ca839c7");const qt=sn.exports,rn={components:{[R.Dialog.name]:R.Dialog,[R.Form.name]:R.Form,[R.FormItem.name]:R.FormItem,[R.Input.name]:R.Input,[R.Button.name]:R.Button,[R.Checkbox.name]:R.Checkbox,[R.Row.name]:R.Row,[R.Col.name]:R.Col},data(){return{isVisible:!1,formData:{city:"",company:"",email:"",phone:"",name:"",agreement:!1},formRules:{city:[{required:!0,message:"请输入所在地城市",trigger:"blur"}],company:[{required:!0,message:"请输入公司名称",trigger:"blur"}],email:[{required:!0,message:"请输入邮箱",trigger:"blur"},{type:"email",message:"请输入有效的邮箱地址",trigger:"blur"}],agreement:[{validator:(e,t,n)=>{t?n():n(new Error("请同意隐私政策"))},trigger:"change"}]}}},mounted(){C.emitter.on(C.MODAL_ACTION.Open,this.handleOpen)},beforeDestroy(){C.emitter.off(C.MODAL_ACTION.Open,this.handleOpen)},methods:{handleOpen(){console.log("🍉 ~ GlobalModal.vue:150 ~ methods.handleOpen:",this.handleOpen),this.isVisible=!0},closeModal(){this.isVisible=!1,C.emitter.emit(C.MODAL_ACTION.Close),this.$refs.formRef.resetFields()},handleSubmit(){this.$refs.formRef.validate(e=>{e&&(C.emitter.emit(C.MODAL_ACTION.Submit,{...this.formData}),this.closeModal())})}}};var ln=function(){var t=this,n=t._self._c;return n("el-dialog",{attrs:{visible:t.isVisible,"before-close":t.closeModal,"show-close":!1,"close-on-click-modal":!0,width:"500px","custom-class":"global-modal-custom"},on:{"update:visible":function(o){t.isVisible=o}}},[n("div",{staticClass:"global-modal-header-custom",attrs:{slot:"title"},slot:"title"},[n("h2",[t._v("即刻链接全球货代")]),n("el-button",{staticClass:"close-button-custom",attrs:{type:"text"},on:{click:t.closeModal}},[n("span",{staticStyle:{"font-size":"2rem"}},[t._v("×")])])],1),n("div",{staticClass:"global-modal-body-custom"},[n("el-form",{ref:"formRef",attrs:{model:t.formData,rules:t.formRules,"label-position":"top"},nativeOn:{submit:function(o){o.preventDefault()}}},[n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"所在地(城市)",prop:"city"}},[n("el-input",{attrs:{placeholder:"请输入城市"},model:{value:t.formData.city,callback:function(o){t.$set(t.formData,"city",o)},expression:"formData.city"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"公司名称",prop:"company"}},[n("el-input",{attrs:{placeholder:"请输入公司名称"},model:{value:t.formData.company,callback:function(o){t.$set(t.formData,"company",o)},expression:"formData.company"}})],1)],1)],1),n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"邮箱",prop:"email"}},[n("el-input",{attrs:{placeholder:"请输入邮箱"},model:{value:t.formData.email,callback:function(o){t.$set(t.formData,"email",o)},expression:"formData.email"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"电话",prop:"phone"}},[n("el-input",{attrs:{placeholder:"请输入电话"},model:{value:t.formData.phone,callback:function(o){t.$set(t.formData,"phone",o)},expression:"formData.phone"}})],1)],1)],1),n("el-row",[n("el-col",{attrs:{span:24}},[n("el-form-item",{attrs:{label:"姓名",prop:"name"}},[n("el-input",{attrs:{placeholder:"请输入您的全名"},model:{value:t.formData.name,callback:function(o){t.$set(t.formData,"name",o)},expression:"formData.name"}})],1)],1)],1),n("el-form-item",{staticClass:"agreement-item",attrs:{prop:"agreement"}},[n("el-checkbox",{model:{value:t.formData.agreement,callback:function(o){t.$set(t.formData,"agreement",o)},expression:"formData.agreement"}},[t._v("我同意")]),n("a",{staticClass:"privacy-link",attrs:{href:"#"}},[t._v("隐私政策")])],1)],1)],1),n("div",{staticClass:"global-modal-footer-custom",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{staticClass:"submit-button-custom",attrs:{type:"primary"},on:{click:t.handleSubmit}},[t._v(" 加入会员 ")])],1)])},an=[],cn=At(rn,ln,an,!1,null,null);const Ut=cn.exports;let un={open(){C.emitter.emit(C.MODAL_ACTION.Open)},close(){C.emitter.emit(C.MODAL_ACTION.Close)},onSubmit(e){C.emitter.on(C.MODAL_ACTION.Submit,e)}};function fn(){let e=!1;return{install(t){if(typeof window<"u"&&!e){const n=document.createElement("div");n.setAttribute("id","global-modal-root"),document.body.appendChild(n);const o=t.extend(Ut);new o().$mount(n),e=!0}t.prototype.$globalModal=un}}}const _t={ApplyDataDialog:qt,JcSearch:wt};let Tt=!1;const dn={install(e,t){Tt||(Tt=!0,t?.sharedConfig&&C.initSharedConfig(t.sharedConfig),Object.keys(_t).forEach(n=>{e.component(n,_t[n])}))}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>C.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>C.emitter});exports.ApplyDataDialog=qt;exports.GlobalModal=Ut;exports.JcSearch=wt;exports.createGlobalModalPlugin=fn;exports.default=dn;