import{n as e}from"./chunk-B3pr0VN8.js";import{r as t}from"./norm-CeclA1Tu.js";var n=e({getWebAppBase:()=>c,getWebAppBaseSync:()=>s,normalizeWebAppBase:()=>o,setWebAppBase:()=>l}),r=`web_app_url`,i=e=>t(e).split(`#`)[0].trim(),a=e=>String(e||``).replace(/\/+$/g,``),o=e=>{let t=a(i(e));return!t||!/^https?:\/\//i.test(t)?``:t},s=()=>{let e=t(``);if(e)return o(e);try{let e=window.location.protocol;if(e===`http:`||e===`https:`)return o(window.location.origin)}catch{}try{return o(localStorage.getItem(r)||``)}catch{}return``},c=async()=>{let e=s();if(e)return e;try{let e=globalThis?.chrome?.storage?.local;return e?.get?o((await new Promise(t=>e.get({[r]:``},e=>t(e))))?.[r]||``):``}catch{return``}},l=async e=>{let t=o(e);try{localStorage.setItem(r,t)}catch{}try{let e=globalThis?.chrome?.storage?.local;e?.set&&await new Promise(n=>e.set({[r]:t},()=>n()))}catch{}return t};export{s as n,n as r,c as t};