function i(r){if(!r)return!1;try{const t=decodeURIComponent(r);if(t.match(/^(javascript|data|vbscript|file|about):/i))return!1;if(t.startsWith("/")&&!t.startsWith("//"))return!t.includes(":");let e;try{e=new URL(t)}catch{return!1}return!!["http:","https:"].includes(e.protocol)}catch{return!1}}function s(r,t="/"){return i(r)?r:t}export{s};