import{j as x,k as l}from"./Ca9y1zsW.js";import{c as f,e as U}from"./Ch8OMI22.js";var n=[];for(var y=0;y<256;++y)n.push((y+256).toString(16).slice(1));function _(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}var g,R=new Uint8Array(16);function T(){if(!g&&(g=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!g))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return g(R)}var B=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const S={randomUUID:B};function V(e,t,a){if(S.randomUUID&&!t&&!e)return S.randomUUID();e=e||{};var o=e.random||(e.rng||T)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,_(o)}const k=x(),A=e=>/^-?\d+$/.test(e),C=e=>(console.log("split",k.query),String(k.query.spm).split(".")[e]),N=()=>k.path;function d(e,t,a=0,o,u){var b;const v=f(),c=l(0),i=l(""),r=l(""),s=l("c"),I=(t==null?void 0:t.tenantId)||localStorage.getItem("TenantId"),$=((b=v.value.loginUser)==null?void 0:b.merchantId)||0,w=(t==null?void 0:t.parentId)||0,p=(t==null?void 0:t.categoryId)||0,m=localStorage.getItem("UserId")||0,D=l(Date.now()/1e3);let h="";if(u&&(h=`&token=${localStorage.getItem("token")}`),t!=null&&t.articleId&&(s.value="a"),t!=null&&t.goodsId&&(s.value="g"),t!=null&&t.productId&&(s.value="p"),t!=null&&t.appId&&(s.value="app"),t!=null&&t.plugId&&(s.value="plug"),(t==null?void 0:t.itemId)>0?(i.value=t.path,c.value=t.itemId):(i.value=e,c.value=a),(t==null?void 0:t.model)==="links"){window.open(t.path,"_blank");return}if(r.value=`?spm=${s.value}.${I}.${$}.${w}.${p}.${c.value}.${m}.${D.value}${h}`,(t!=null&&t.account||t!=null&&t.password)&&(r.value+=`&account=${t.account}&password=${t.password}`),o){window.open(`${i.value}${r.value}`,"_blank");return}else{window.open(`${i.value}${r.value}`,"_top");return}}function E(){var o,u;const e=U(),t=(o=e.value)==null?void 0:o.userId,a=(u=e.value)==null?void 0:u.tenantId;d(`https://${a}.websoft.top/token-login`,void 0,t,!0,!0)}function H(e){var u;const t=U(),a=Number((u=t.value)==null?void 0:u.tenantId);if(!localStorage.getItem("token")){window.open(`https://${e.domain}`,"_blank");return}d(`https://${e.domain}/token-login`,void 0,a,!0,!0)}function L(e){var a;const t=U();Number((a=t.value)==null?void 0:a.tenantId),localStorage.getItem("token"),window.open(`https://${e.domain}`,"_blank")}function P(e,t,a=0){var p,m;const o=f(),u=l(""),v=l("c"),c=o.value.tenantId||0,i=((p=o.value.loginUser)==null?void 0:p.merchantId)||0,r=(t==null?void 0:t.parentId)||0,s=(t==null?void 0:t.categoryId)||0,I=((m=o.value.loginUser)==null?void 0:m.userId)||0,$=l(Date.now()/1e3);let w=V();return u.value=`?spm=${v.value}.${c}.${i}.${r}.${s}.${a}.${I}.${$.value}&token=${w}`,`${e}${u.value}`}function W(e){window.open(e,"_blank")}export{E as a,P as b,W as c,N as d,H as e,C as g,A as i,L as l,d as o};