Rocky_Mountain_Vending/.pnpm-store/v10/files/b4/7d552ef20b1869ed954b8a97e1ce31f4be242eef367b54a075e93c2a83cf4f5fc926e99880b8ad88869057e680d1b85938e77cd163517d5111edef42f58aaf
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

74 lines
No EOL
2.5 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyCheckFunktionToDirectives = exports.matchWildcardUrls = exports.getHostname = exports.getSchemeFreeUrl = void 0;
function getSchemeFreeUrl(url) {
url = url.replace(/^\w[+\w.-]*:\/\//i, '');
url = url.replace(/^\/\//, '');
return url;
}
exports.getSchemeFreeUrl = getSchemeFreeUrl;
function getHostname(url) {
const hostname = new URL('https://' +
getSchemeFreeUrl(url)
.replace(':*', '')
.replace('*', 'wildcard_placeholder'))
.hostname.replace('wildcard_placeholder', '*');
const ipv6Regex = /^\[[\d:]+\]/;
if (getSchemeFreeUrl(url).match(ipv6Regex) && !hostname.match(ipv6Regex)) {
return '[' + hostname + ']';
}
return hostname;
}
exports.getHostname = getHostname;
function setScheme(u) {
if (u.startsWith('//')) {
return u.replace('//', 'https://');
}
return u;
}
function matchWildcardUrls(cspUrlString, listOfUrlStrings) {
const cspUrl = new URL(setScheme(cspUrlString
.replace(':*', '')
.replace('*', 'wildcard_placeholder')));
const listOfUrls = listOfUrlStrings.map(u => new URL(setScheme(u)));
const host = cspUrl.hostname.toLowerCase();
const hostHasWildcard = host.startsWith('wildcard_placeholder.');
const wildcardFreeHost = host.replace(/^\wildcard_placeholder/i, '');
const path = cspUrl.pathname;
const hasPath = path !== '/';
for (const url of listOfUrls) {
const domain = url.hostname;
if (!domain.endsWith(wildcardFreeHost)) {
continue;
}
if (!hostHasWildcard && host !== domain) {
continue;
}
if (hasPath) {
if (path.endsWith('/')) {
if (!url.pathname.startsWith(path)) {
continue;
}
}
else {
if (url.pathname !== path) {
continue;
}
}
}
return url;
}
return null;
}
exports.matchWildcardUrls = matchWildcardUrls;
function applyCheckFunktionToDirectives(parsedCsp, check) {
const directiveNames = Object.keys(parsedCsp.directives);
for (const directive of directiveNames) {
const directiveValues = parsedCsp.directives[directive];
if (directiveValues) {
check(directive, directiveValues);
}
}
}
exports.applyCheckFunktionToDirectives = applyCheckFunktionToDirectives;
//# sourceMappingURL=utils.js.map