import{t as m}from"./chunk-DZLz74EQ.js";var x=m((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,t.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,t.htmlCtrlEntityRegex=/&(newline|tab);/gi,t.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,t.urlSchemeRegex=/^.+(:|&colon;)/gim,t.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,t.relativeFirstCharacters=[".","/"],t.BLANK_URL="about:blank"})),C=m((t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=x();function g(r){return e.relativeFirstCharacters.indexOf(r[0])>-1}function R(r){return r.replace(e.ctrlCharactersRegex,"").replace(e.htmlEntitiesRegex,function(o,a){return String.fromCharCode(a)})}function f(r){return URL.canParse(r)}function s(r){try{return decodeURIComponent(r)}catch{return r}}function p(r){if(!r)return e.BLANK_URL;var o,a=s(r.trim());do a=R(a).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),a=s(a),o=a.match(e.ctrlCharactersRegex)||a.match(e.htmlEntitiesRegex)||a.match(e.htmlCtrlEntityRegex)||a.match(e.whitespaceEscapeCharsRegex);while(o&&o.length>0);var i=a;if(!i)return e.BLANK_URL;if(g(i))return i;var u=i.trimStart(),h=u.match(e.urlSchemeRegex);if(!h)return i;var n=h[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(n))return e.BLANK_URL;var l=u.replace(/\\/g,"/");if(n==="mailto:"||n.includes("://"))return l;if(n==="http:"||n==="https:"){if(!f(l))return e.BLANK_URL;var c=new URL(l);return c.protocol=c.protocol.toLowerCase(),c.hostname=c.hostname.toLowerCase(),c.toString()}return l}t.sanitizeUrl=p}));export{C as t};
