{"version":3,"file":"useLocaleRestrictedLinks.B-PTGmZH.mjs","names":["normalizeLocaleCode","DEFAULT_LOCALE_CODE","LOCALE_PREFIX_PATTERN","useCallback"],"sources":["https:/framerusercontent.com/modules/D9AcnAYPfO5WhgNmeoPL/Teo8M70nDlouCdikGONP/tricountBunqOnlyPages.js","https:/framerusercontent.com/modules/n2VyP1RdZHoPcZyqGy4V/lgg9y8vUdJnCKea5NTic/localeRestrictedPages.js","https:/framerusercontent.com/modules/7j8gznLw37VbFDq0204n/VfFoudFEpW9fq9ZxkOxB/useLocaleRestrictedLinks.js"],"sourcesContent":["const DEFAULT_LOCALE_CODE=\"en\";const TRICOUNT_BASE_URL=\"https://www.tricount.com\";const TRICOUNT_HOSTNAMES=new Set([\"www.tricount.com\",\"tricount.com\"]);const LOCALE_PREFIX_PATTERN=/^[a-z]{2}-[a-z]{2}$/i;const TRICOUNT_BUNQ_LICENSED_LOCALES=new Set([DEFAULT_LOCALE_CODE,\"nl-nl\",\"de-de\",\"fr-fr\",\"es-es\",\"it-it\",\"pt-pt\",\"pl-pl\"]);const TRICOUNT_BUNQ_ONLY_PATH_PREFIXES=[\"/free-credit-card\",\"/discover/free-credit-card\",\"/link/link-your-card\",\"/link/card\",\"/features/automatic-expense-tracking\"];function normalizeLocaleCode(localeCode){const trimmed=(localeCode??\"\").trim().toLowerCase().replace(/_/g,\"-\");return trimmed||DEFAULT_LOCALE_CODE;}function tricountPathnameOf(url){let parsed;try{parsed=new URL(url,`${TRICOUNT_BASE_URL}/`);}catch{return null;}if(!TRICOUNT_HOSTNAMES.has(parsed.hostname))return null;const segments=parsed.pathname.split(\"/\").filter(segment=>segment!==\"\");const hasLocalePrefix=segments.length>0&&LOCALE_PREFIX_PATTERN.test(segments[0]);const pathSegments=hasLocalePrefix?segments.slice(1):segments;return`/${pathSegments.join(\"/\")}`.toLowerCase();}function isBunqOnlyPath(pathname){return TRICOUNT_BUNQ_ONLY_PATH_PREFIXES.some(prefix=>pathname===prefix||pathname.startsWith(`${prefix}/`));}export function isTricountBunqOnlyLinkHiddenForLocale(url,localeCode){const trimmedUrl=url?.trim();if(!trimmedUrl)return false;const pathname=tricountPathnameOf(trimmedUrl);if(pathname===null)return false;if(!isBunqOnlyPath(pathname))return false;return!TRICOUNT_BUNQ_LICENSED_LOCALES.has(normalizeLocaleCode(localeCode));}// recompile: 1792505897503\n\nexport const __FramerMetadata__ = {\"exports\":{\"isTricountBunqOnlyLinkHiddenForLocale\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./tricountBunqOnlyPages.map","const DEFAULT_LOCALE_CODE=\"en\";const BUNQ_HOSTNAMES=new Set([\"www.bunq.com\",\"bunq.com\"]);const LOCALE_PREFIX_PATTERN=/^[a-z]{2}-[a-z]{2}$/;const NON_PAGE_URL_PATTERN=/^(#|mailto:|tel:|sms:|javascript:)/i;const LOCALE_RESTRICTED_PAGES=[{path:\"/business/use-cases/homeowners-association\",allowedLocales:new Set([DEFAULT_LOCALE_CODE,\"nl-nl\",\"en-nl\"])}];const LOCALE_PAGE_ALLOWLIST_MAINTENANCE=\"Each list must match the pages switched on for that locale in Framer (bunq.com page Localization status). Add a page here in the same change that switches it on for the locale, otherwise links to it stay hidden. To add a partial locale such as bg-bg, add an entry keyed by its lowercase locale code.\";const LOCALE_PAGE_ALLOWLISTS={\"sk-sk\":{maintenance:LOCALE_PAGE_ALLOWLIST_MAINTENANCE,issue:\"CIT/website#3282\",paths:new Set([\"/\",\"/download\",\"/about\",\"/about/imprint\",\"/about/reviews\",\"/about/security\",\"/about/sustainability\",\"/business\",\"/business/cards\",\"/business/features\",\"/business/plans\",\"/business/use-cases\",\"/personal/cards\",\"/personal/features\",\"/personal/features/atm-withdrawals-and-deposits\",\"/personal/features/bank-accounts\",\"/personal/features/budgeting\",\"/personal/features/crypto\",\"/personal/features/joint-accounts\",\"/personal/features/payments\",\"/personal/features/savings-accounts\",\"/personal/features/secure-banking\",\"/personal/features/stocks\",\"/personal/features/support\",\"/personal/features/term-deposits\",\"/personal/features/zero-fx\",\"/personal/plans\",\"/personal/plans/bunq-core\",\"/personal/plans/bunq-elite\",\"/personal/plans/bunq-free\",\"/personal/plans/bunq-pro\",\"/personal/use-cases\",\"/personal/use-cases/couples\",\"/personal/use-cases/expats\",\"/personal/use-cases/parents\",\"/personal/use-cases/students\"]),pathPrefixes:[\"/documents\"]},\"bg-bg\":{maintenance:LOCALE_PAGE_ALLOWLIST_MAINTENANCE,issue:\"CIT/website#3381\",paths:new Set([\"/\",\"/download\",\"/about\",\"/about/imprint\",\"/about/reviews\",\"/about/security\",\"/about/sustainability\",\"/business\",\"/business/cards\",\"/business/features\",\"/business/plans\",\"/business/use-cases\",\"/link/start-payment-investigation\",\"/personal/cards\",\"/personal/features\",\"/personal/features/atm-withdrawals-and-deposits\",\"/personal/features/bank-accounts\",\"/personal/features/budgeting\",\"/personal/features/crypto\",\"/personal/features/international-bank-accounts-and-foreign-currencies\",\"/personal/features/joint-accounts\",\"/personal/features/payments\",\"/personal/features/savings-accounts\",\"/personal/features/secure-banking\",\"/personal/features/support\",\"/personal/features/term-deposits\",\"/personal/features/zero-fx\",\"/personal/plans\",\"/personal/plans/bunq-core\",\"/personal/plans/bunq-elite\",\"/personal/plans/bunq-free\",\"/personal/plans/bunq-pro\",\"/personal/use-cases\",\"/personal/use-cases/couples\",\"/personal/use-cases/expats\",\"/personal/use-cases/parents\",\"/personal/use-cases/students\"]),pathPrefixes:[\"/documents\"],excludedPaths:new Set([\"/documents\",\"/documents/information\",\"/documents/policies-statements\",\"/documents/reports\",\"/documents/terms-conditions\"])}};const ABSOLUTE_OR_ROOT_RELATIVE_PATTERN=/^(?:[a-z][a-z0-9+.-]*:|\\/)/i;const BUNQ_ORIGIN=\"https://www.bunq.com\";function normalizeLocaleCode(localeCode){const normalized=(localeCode??\"\").trim().toLowerCase().replace(/_/g,\"-\");return normalized||DEFAULT_LOCALE_CODE;}export function isPageRelativeUrl(url){return!ABSOLUTE_OR_ROOT_RELATIVE_PATTERN.test(url.trim());}function stripLocalePrefix(pathname){const segments=pathname.split(\"/\").filter(segment=>segment!==\"\");const hasLocalePrefix=segments.length>0&&LOCALE_PREFIX_PATTERN.test(segments[0].toLowerCase());const pathSegments=hasLocalePrefix?segments.slice(1):segments;return`/${pathSegments.join(\"/\")}`;}function bunqPathnameOf(url,basePath){let parsed;try{const base=new URL(stripLocalePrefix(basePath),BUNQ_ORIGIN);parsed=new URL(url,base);}catch{return null;}if(!BUNQ_HOSTNAMES.has(parsed.hostname))return null;return stripLocalePrefix(parsed.pathname).toLowerCase();}function isPathOnAllowlist(pathname,allowlist){if(allowlist.excludedPaths?.has(pathname))return false;if(allowlist.paths.has(pathname))return true;return allowlist.pathPrefixes.some(prefix=>pathname===prefix||pathname.startsWith(`${prefix}/`));}function isHiddenByRestrictedPages(url,normalizedLocale,currentPagePath){const pathname=bunqPathnameOf(url,currentPagePath??\"/\");if(pathname===null)return false;const restriction=LOCALE_RESTRICTED_PAGES.find(page=>page.path===pathname);return restriction!==undefined&&!restriction.allowedLocales.has(normalizedLocale);}function isHiddenByAllowlist(url,normalizedLocale,options){if(options.brand===\"tricount\")return false;const allowlist=LOCALE_PAGE_ALLOWLISTS[normalizedLocale];if(!allowlist)return false;if(isPageRelativeUrl(url)&&options.currentPagePath===undefined)return false;const pathname=bunqPathnameOf(url,options.currentPagePath??\"/\");if(pathname===null)return false;return!isPathOnAllowlist(pathname,allowlist);}export function isLocaleRestrictedLinkHidden(url,localeCode,options={}){const trimmedUrl=url?.trim();if(!trimmedUrl)return false;if(NON_PAGE_URL_PATTERN.test(trimmedUrl))return false;const normalizedLocale=normalizeLocaleCode(localeCode);if(options.rules!==\"allowlist\"&&isHiddenByRestrictedPages(trimmedUrl,normalizedLocale,options.currentPagePath)){return true;}return isHiddenByAllowlist(trimmedUrl,normalizedLocale,options);}// recompile: 1792505897503\n\nexport const __FramerMetadata__ = {\"exports\":{\"isPageRelativeUrl\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LocaleRestrictedLinkOptions\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isLocaleRestrictedLinkHidden\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./localeRestrictedPages.map","import{useCallback}from\"react\";import{useLocaleInfo}from\"framer\";import{isFramerDesignEnvironment}from\"https://framerusercontent.com/modules/ftX3Jc41Y7LVySIwERQ6/Cl9pDI0KnsePkqBWjIGL/useInViewport.js\";import{collectRichTextHrefs}from\"https://framerusercontent.com/modules/F7Fck4UwyFDCOVGsDi2X/g02QmaozzaTd8IhutfP9/framerRichText.js\";import{getLinkUrl,useCurrentRoutePath}from\"https://framerusercontent.com/modules/Da10ki4vvDJiJ9Ja6o9D/4trqWfy4fex3Wv65m7ii/linkHelpers.js\";import{isLocaleRestrictedLinkHidden}from\"https://framerusercontent.com/modules/n2VyP1RdZHoPcZyqGy4V/lgg9y8vUdJnCKea5NTic/localeRestrictedPages.js\";export function useLocaleRestrictedLinkFilter(brand,options={}){const{activeLocale}=useLocaleInfo();const localeCode=activeLocale?.code;const currentPagePath=useCurrentRoutePath();const isEditor=isFramerDesignEnvironment();const rules=options.includeRestrictedPages===true?\"all\":\"allowlist\";return useCallback(link=>{if(isEditor)return false;return isLocaleRestrictedLinkHidden(getLinkUrl(link),localeCode,{brand,currentPagePath,rules});},[isEditor,localeCode,brand,currentPagePath,rules]);}export function useIsLinkHiddenInLocale(link,brand,options){return useLocaleRestrictedLinkFilter(brand,options)(link);}export function hasLocaleHiddenLink(isLinkHidden,link,richText){if(isLinkHidden(link))return true;if(richText===undefined||richText===null)return false;return collectRichTextHrefs(richText).some(href=>isLinkHidden(href));}// recompile: 1792506390748\n\nexport const __FramerMetadata__ = {\"exports\":{\"useLocaleRestrictedLinkFilter\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LocaleRestrictedLinkPredicate\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useIsLinkHiddenInLocale\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LocaleRestrictedLinkFilterOptions\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hasLocaleHiddenLink\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useLocaleRestrictedLinks.map"],"mappings":"qRAA4e,SAASA,EAAoB,EAAW,CAAuE,OAAvD,GAAY,GAAA,CAAI,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,KAAK,GAAkB,GAAGC,CAAoB,CAAC,SAAS,EAAmB,EAAI,CAAC,IAAI,EAAO,GAAG,CAAC,EAAO,IAAI,IAAI,EAAI,GAAG,EAAkB,EAAE,CAAE,MAAM,CAAC,OAAO,IAAK,CAAC,GAAG,CAAC,EAAmB,IAAI,EAAO,QAAQ,EAAE,OAAO,KAAK,IAAM,EAAS,EAAO,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,GAAS,IAAU,EAAE,EAAiJ,MAAM,KAA/H,EAAS,OAAO,GAAGC,EAAsB,KAAK,EAAS,EAAE,EAAqC,EAAS,MAAM,CAAC,EAAE,EAAA,CAAgC,KAAK,GAAG,IAAI,YAAY,CAAE,CAAC,SAAS,EAAe,EAAS,CAAC,OAAO,EAAiC,KAAK,GAAQ,IAAW,GAAQ,EAAS,WAAW,GAAG,EAAO,EAAE,CAAC,CAAE,CAAC,SAAgB,EAAsC,EAAI,EAAW,CAAC,IAAM,EAAW,GAAK,KAAK,EAAE,GAAG,CAAC,EAAW,MAAO,GAAM,IAAM,EAAS,EAAmB,CAAU,EAA4E,OAAvE,IAAW,MAAqB,CAAC,EAAe,CAAQ,EAAS,GAAY,CAAC,EAA+B,IAAIF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