|
1
|
|
-import{S as o}from"./Str.js?ver=1.3.21";import{A as h}from"./Arr.js?ver=1.3.21";import{a as p}from"./vue-router.js?ver=1.3.21";class U{static appendQueryParams(r,t={}){const e=new URL(r);return Object.entries(t).forEach(([n,s])=>{s!=null&&e.searchParams.append(n,s.toString())}),e.toString()}static join(r,t,e={}){return o.endsWith(r,"/")||(r=r+"/"),o.startsWith(t,"/")&&(t=t.substring(1)),this.appendQueryParams(r+t,e)}static addParam(r,t,e){const n=new URL(r);return n.searchParams.append(t,e),n.toString()}static getParam(r,t){return new URL(r??window.location.href).searchParams.get(t)}static removeParam(r,t){const e=new URL(r);return e.searchParams.delete(t),e.toString()}static pushToVueUrl(r=null,t={}){const e=this.appendToVueUrl(r,t);e&&window.history.replaceState({},"",e)}static appendToVueUrl(r=null,t={}){if(typeof window>"u")return;const e=r??window.location.href,n=new URL(e),s=e.split("#")[0],a=n.hash;if(!a.includes("?")){const i=a.replace(/\/?$/,"/")+"?"+new URLSearchParams(t).toString();return`${s}${i}`}const[u,l]=a.slice(1).split("?"),c=new URLSearchParams(l||"");Object.entries(t).forEach(([i,m])=>{c.set(i,m.toString())});const d=`#${u}?${c.toString()}`;return`${s}${d}`}static getAdminRoute(r=""){return h.get(window,"fluentCartAdminApp.admin_url")+r}static getVueParams(r){var e;const t=p();return((e=t==null?void 0:t.query)==null?void 0:e[r])??(t==null?void 0:t.query)??null}}export{U}; |
|
1
|
+import{S as o}from"./Str.js?ver=1.6.5";import{A as f}from"./Arr.js?ver=1.6.5";import{a as w}from"./vue-router.js?ver=1.6.5";class S{static appendQueryParams(e,t={}){const r=new URL(e);return Object.entries(t).forEach(([n,s])=>{s!=null&&r.searchParams.append(n,s.toString())}),r.toString()}static join(e,t,r={}){return o.endsWith(e,"/")||(e=e+"/"),o.startsWith(t,"/")&&(t=t.substring(1)),this.appendQueryParams(e+t,r)}static addParam(e,t,r){const n=new URL(e);return n.searchParams.append(t,r),n.toString()}static getParam(e,t){return new URL(e??window.location.href).searchParams.get(t)}static removeParam(e,t){const r=new URL(e);return r.searchParams.delete(t),r.toString()}static pushToVueUrl(e=null,t={}){const r=this.appendToVueUrl(e,t);r&&window.history.replaceState({},"",r)}static appendToVueUrl(e=null,t={}){if(typeof window>"u")return;const r=e??window.location.href,n=new URL(r),s=r.split("#")[0],i=n.hash;if(!i.includes("?")){const a=(i||"#").replace(/\/?$/,"/")+"?"+new URLSearchParams(t).toString();return`${s}${a}`}const[l,u]=i.slice(1).split("?"),c=new URLSearchParams(u||"");Object.entries(t).forEach(([a,m])=>{c.set(a,m.toString())});const d=`#${l}?${c.toString()}`;return`${s}${d}`}static getAdminRoute(e=""){return f.get(window,"fluentCartAdminApp.admin_url")+e}static getVueParams(e){var r;const t=w();return((r=t==null?void 0:t.query)==null?void 0:r[e])??(t==null?void 0:t.query)??null}static scrollToHashSection(e){const t=e!=null&&e.startsWith("#")?e.slice(1):e||"";if(!t)return;const r=document.getElementById(t);r&&(r.scrollIntoView({behavior:"smooth",block:"start"}),r.classList.add("fct-scroll-highlight"),r.addEventListener("animationend",()=>r.classList.remove("fct-scroll-highlight"),{once:!0}))}}export{S as U}; |