useMenuSplit.Bbc75cEL.js 8.5 KB

1
  1. var e=Object.defineProperty,n=(n,a,t)=>(((n,a,t)=>{a in n?e(n,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[a]=t})(n,"symbol"!=typeof a?a+"":a,t),t);import{r as a,o as t,ax as i,u as o,a3 as l,c,aR as s,w as r,aV as p,aI as u}from"./index-eaRQzP70.js";import"./use-user-store.NW8aOPu0.js";import{u as m}from"./useRouter.CLF55_xS.js";function h(){return"undefined"!=typeof window?window.innerWidth:0}const d=class e{constructor(){n(this,"initialized",!1),this.initLiveChat()}static getInstance(){return e.instance||(e.instance=new e),e.instance}initLiveChat(){this.initialized||(window.__lc=window.__lc||{},window.__lc.license=18945964,function(e,n,a){function t(e){return i._h?i._h.apply(null,e):i._q.push(e)}var i={_q:[],_h:null,_v:"2.0",on:function(){t(["on",a.call(arguments)])},once:function(){t(["once",a.call(arguments)])},off:function(){t(["off",a.call(arguments)])},get:function(){if(!i._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return t(["get",a.call(arguments)])},call:function(){t(["call",a.call(arguments)])},init:function(){var e=n.createElement("script");e.async=!0,e.type="text/javascript",e.src="https://cdn.livechatinc.com/tracking.js",n.head.appendChild(e)}};!e.__lc.asyncInit&&i.init(),e.LiveChatWidget=e.LiveChatWidget||i,e.LiveChatWidget.call("hide"),LiveChatWidget.on("visibility_changed",(n=>{if("minimized"===n.visibility)e.LiveChatWidget.call("hide")}))}(window,document,[].slice),this.initialized=!0)}showChat(){window.LiveChatWidget&&window.LiveChatWidget.call("maximize")}setLanguage(e){window.LiveChatWidget&&window.LiveChatWidget.call("set_language","cn"===e?"zh_CN":"en")}adjustPosition(e){if(window.innerWidth>768){const n=document.getElementById("chat-widget-launcher"),a=document.getElementById("chat-widget-container");n&&(n.style.bottom=`${e}px`),a&&(a.style.bottom=`${e}px`)}}};n(d,"instance",null);const g=d.getInstance();function b(e){return e.map((e=>{var n;return{...e,children:e.children?b(e.children):[],isOpenMenu:e.isOpenMenu??!1,submenuHeight:48*((null==(n=e.children)?void 0:n.length)||0)+8}}))}function w(e){const{locale:n}=o(),d=l(),w=c((()=>d.mode)),f=function(e=0){const n=a(h());let o,l=null;const c=()=>{n.value=h()};return o=e>0?()=>{l&&clearTimeout(l),l=setTimeout((()=>{c(),l=null}),e)}:c,t((()=>{c(),"undefined"!=typeof window&&window.addEventListener("resize",o)})),i((()=>{l&&clearTimeout(l),"undefined"!=typeof window&&window.removeEventListener("resize",o)})),n}(300),y=c((()=>f.value<=991)),v=m(),M=p();a([]);let _=null;const H=c((()=>s.map((e=>({label:`language.${e}`,lang:e,type:"lang",path:"/"}))))),C=c((()=>({path:"/",isOpenMenu:!1,label:"language.index",icon:"cwg-lang",children:H.value,submenuHeight:48*H.value.length+8}))),L=c((()=>[{isOpenMenu:!1,submenuHeight:200,path:"/",label:"Shop.Index.Transaction",icon:"crm-trade",children:[{path:"/pages/customer/index",label:"Custom.Index.AccountList",icon:"icon-client"},{path:"/pages/customer/trade-history",label:"Ib.Report.Tit1",icon:"icon-transfer"},{path:"/pages/customer/trade-position",label:"Ib.Report.Tit4",icon:"icon-transfer"},{path:"/pages/customer/recording-history",label:"Home.page_customer.item7",icon:"icon-application"}]},{isOpenMenu:!1,submenuHeight:296,path:"/",label:"vu.item6",icon:"crm-payment",children:[{path:"/pages/customer/deposit-select",label:"Home.page_customer.item2",icon:"icon-deposit"},{path:"/pages/customer/withdrawal-select",label:"Home.page_customer.item3",icon:"icon-withdrawal"},{path:"/pages/customer/payment-history",label:"Home.page_customer.item4",icon:"icon-payment"},{path:"/pages/customer/transfer",label:"Custom.Index.Transfer",icon:"icon-transfer"},{path:"/pages/customer/wallet-transfer",label:"wallet.item62",icon:"icon-transfer"},{path:"/pages/customer/wallet-history",label:"wallet.item7",icon:"icon-transfer"}]},{path:"/pages/activities/index",isOpenMenu:!1,label:"Home.page_customer.item6",icon:"crm-hd",children:[],submenuHeight:0},{path:"/",isOpenMenu:!1,submenuHeight:104,label:"vu.item5",icon:"crm-chart-area",children:[{path:"/pages/analytics/analystViews",label:"News.Announcement",icon:"icon-application"},{path:"/pages/analytics/news",label:"News.NewsInformation",icon:"icon-application"}]},{path:"/pages/common/download",isOpenMenu:!1,label:"Downloadpage.item1",icon:"crm-download",children:[],submenuHeight:0},{path:"/pages/common/chat",isOpenMenu:!1,label:"Downloadpage.item16",icon:"crm-headset",children:[],type:"chat",submenuHeight:0},{path:"/",isOpenMenu:!1,submenuHeight:248,label:"Custom.Index.Settings",icon:"crm-sz",children:[{path:"/pages/mine/info?type=1",label:"PersonalManagement.Title.PersonalInformation",icon:"crm-headset"},{path:"/pages/mine/info?type=2",label:"PersonalManagement.Title.BankInformation",icon:"crm-headset"},{path:"/pages/mine/info?type=3",label:"PersonalManagement.Title.FileManagement",icon:"crm-headset"},{path:"/pages/mine/info?type=4",label:"PersonalManagement.Title.SecurityCenter",icon:"crm-headset"},{path:"/pages/common/notice",label:"News.Notice",icon:"crm-headset"}]}])),x=c((()=>[{isOpenMenu:!1,path:"/pages/ib/index",label:"Documentary.console.item1",icon:"crm-mb",submenuHeight:0},{path:"/",label:"Ib.Custom.Manage3",icon:"crm-bg",submenuHeight:200,children:[{path:"/pages/ib/customer",label:"Ib.Custom.Manage3",icon:"icon-deposit"},{path:"/pages/ib/subsList",label:"Ib.Custom.Manage2",icon:"icon-deposit"},{path:"/pages/ib/agentList",label:"Documentary.console.item23",icon:"icon-deposit"},{path:"/pages/ib/accountList",label:"Ib.Custom.Manage1",icon:"icon-deposit"}]},{isOpenMenu:!1,submenuHeight:200,path:"/",label:"vu.item6",icon:"crm-payment",children:[{path:"/pages/ib/transfer",label:"Home.page_ib.item4",icon:"icon-payment"},{path:"/pages/ib/withdraw-select",label:"Home.page_ib.item5",icon:"icon-transfer"},{path:"/pages/ib/agent-transfer",label:"Home.page_ib.item9",icon:"icon-transfer"},{path:"/pages/ib/recording",label:"Home.page_ib.item7",icon:"icon-application"}]},{isOpenMenu:!1,submenuHeight:104,path:"/",label:"Home.page_ib.item3",icon:"crm-newspaper",children:[{path:"/pages/ib/report",label:"Home.page_ib.item3",icon:"icon-withdrawal"},{path:"/pages/ib/complexReport",label:"Home.page_ib.item11",icon:"icon-withdrawal"}]}])),O=c((()=>[{isOpenMenu:!1,path:"/pages/follow/index",label:"Documentary.console.item1",icon:"crm-mb",submenuHeight:0},{isOpenMenu:!1,path:"/pages/follow/trading-center",label:"Documentary.page_doc.item2",icon:"crm-gd",submenuHeight:0},{isOpenMenu:!1,submenuHeight:56,path:"/",label:"Documentary.page_doc.item3",icon:"crm-newspaper",children:[{path:"/pages/follow/report",label:"Documentary.page_doc.item3",icon:"icon-client"}]},{isOpenMenu:!1,submenuHeight:104,path:"/",label:"Documentary.page_doc.item4",icon:"crm-payment",children:[{path:"/pages/follow/transfer",label:"Documentary.TundManagement.item2",icon:"icon-client"},{path:"/pages/follow/transfer-history",label:"Documentary.TundManagement.item3",icon:"icon-transfer"}]},{isOpenMenu:!1,submenuHeight:248,path:"/",label:"Documentary.page_doc.item5",icon:"crm-trade",children:[{path:"/pages/follow/trading-management",label:"Documentary.TundManagement.item11",icon:"icon-client"},{path:"/pages/follow/follow-list",label:"Documentary.TundManagement.item17",icon:"icon-client"},{path:"/pages/follow/account-management",label:"Documentary.TundManagement.item9",icon:"icon-transfer"},{path:"/pages/follow/subscribe-list",label:"Documentary.TundManagement.item45",icon:"icon-transfer"},{path:"/pages/follow/record",label:"Documentary.TundManagement.item10",icon:"icon-transfer"}]}])),I=a([]);return r(w,((e,n)=>{if(e!==n){let n=[];switch(e){case"follow":n=[...O.value];break;case"ib":n=[...x.value];break;case"customer":n=[...L.value]}y.value&&n.push(C.value),I.value=b(n)}}),{immediate:!0}),r(M,(()=>{const e=M.path;I.value.forEach(((n,a)=>{var t;if(null==(t=n.children)?void 0:t.length){n.children.some((n=>!n.isExternal&&"lang"!==n.type&&(e===n.path||e.startsWith(n.path+"?"))))&&(n.isOpenMenu=!0)}}))}),{immediate:!0}),t((()=>{})),{menus:I,mode:w,shouldShowLanguageMenu:y,windowWidth:f,setMode:function(e){switch(d.setMode(e),e){case"follow":v.reLaunch("/pages/follow/index");break;case"ib":v.reLaunch("/pages/ib/index");break;case"customer":v.reLaunch("/pages/customer/index")}"ib"===e&&u("open-ib")},setSubmenuRef:function(e,n){},handleClick:function(n){if(_)return;_=setTimeout((()=>{_=null}),300);const a=I.value[n];if(!a.children||0===a.children.length)return"chat"!==a.type||y.value?(y.value&&e(a),void v.push(a.path)):void(g&&g.showChat());a.isOpenMenu=!a.isOpenMenu},handleSubmenuClick:function(a){"lang"!==a.type?a.isExternal?window.open(a.path,"_blank"):(y.value&&e(a),v.push(a.path)):n.value=a.lang}}}export{w as u};