/* eslint-disable no-undef */
class GetManager {
static PUBLISHER_ALIASES = new Map([
['arnnet', ['arn']],
['channelasia', ['ca']],
['reseller', ['rsl']],
]);
static VALID_PUBLISHERS = new Set([
'nww',
'iw',
'cw',
'arnnet',
'reseller',
'cso',
'cio',
'channelasia',
]);
static EDITION_ALIASES = new Map([
['uk', ['gb']],
['middle-east', ['me']],
['asean', ['as']],
['africa', ['af']],
]);
static VALID_EDITIONS = new Set([
'africa',
'asean',
'au',
'ca',
'es',
'ie',
'in',
'it',
'jp',
'kr',
'middle-east',
'nl',
'nz',
'uk',
'us',
'de',
'fr',
'pl',
'se',
]);
constructor() {
window.foundry_is_language = GetManager.foundry_is_language;
window.foundry_is_publisher = GetManager.foundry_is_publisher;
window.foundry_is_edition = GetManager.foundry_is_edition;
window.foundry_get_publisher = GetManager.foundry_get_publisher;
}
static getCanonicalPublisher(name) {
if (!name) return null;
const lowerName = name.toLowerCase();
const found = Array.from(GetManager.PUBLISHER_ALIASES.entries()).find(
([canonical, aliases]) => canonical === lowerName || aliases.includes(lowerName),
);
if (found) return found[0];
return GetManager.VALID_PUBLISHERS.has(lowerName) ? lowerName : null;
}
static getDocumentLanguage() {
const langAttr = document.documentElement.getAttribute('lang') || '';
return langAttr.split('-')[0].toLowerCase(); // Extracts the language without the region (e.g., "en" from "en-US")
}
static getDocumentEdition() {
const editionAttr = document.documentElement.getAttribute('data-edition') || '';
return editionAttr.toLowerCase();
}
static getCanonicalEdition(name) {
if (!name) return null;
const lowerName = name.toLowerCase();
const found = Array.from(GetManager.EDITION_ALIASES.entries()).find(
([canonical, aliases]) => canonical === lowerName || aliases.includes(lowerName),
);
if (found) return found[0];
return GetManager.VALID_EDITIONS.has(lowerName) ? lowerName : null;
}
static foundry_is_publisher(publisherNames) {
const brandAttr = document.documentElement.getAttribute('data-brand') || '';
if (!brandAttr) return false;
const canonicalBrand = brandAttr.toLowerCase();
if (Array.isArray(publisherNames)) {
return publisherNames.some(name => GetManager.getCanonicalPublisher(name) === canonicalBrand);
}
return GetManager.getCanonicalPublisher(publisherNames) === canonicalBrand;
}
static foundry_is_language(languages) {
const currentLang = GetManager.getDocumentLanguage();
if (!currentLang) return false;
const languageList = Array.isArray(languages)
? languages.map(lang => lang.toLowerCase())
: languages.split(',').map(lang => lang.trim().toLowerCase());
return languageList.includes(currentLang);
}
static foundry_is_edition(editionNames) {
const currentEdition = GetManager.getDocumentEdition();
if (!currentEdition) return false;
if (Array.isArray(editionNames)) {
return editionNames.some(name => GetManager.getCanonicalEdition(name) === currentEdition);
}
return GetManager.getCanonicalEdition(editionNames) === currentEdition;
}
static foundry_get_publisher() {
const brandAttr = document.documentElement.getAttribute('data-brand') || '';
if (!brandAttr) return null;
return brandAttr.trim().toLowerCase();
}
}
new GetManager(); // eslint-disable-line no-new;
function ToggleContentVisibilityParagraph() {
const elements = document.querySelectorAll('[data-readmore-length]');
if (elements.length === 0) return;
elements.forEach((element, index) => {
const uniqueId = `readmore-${index}`;
const modifiedElement = element;
modifiedElement.id = uniqueId;
const readMoreText = element.getAttribute('data-readmore-txt') || 'Read more';
const hasReadLess = element.hasAttribute('data-readless');
const readLessText = hasReadLess
? element.getAttribute('data-readless-txt') || readMoreText
: '';
const readMoreButton = document.createElement('button');
readMoreButton.textContent = readMoreText;
readMoreButton.classList.add('read-more-toggle', 'reset-button');
readMoreButton.setAttribute('aria-controls', uniqueId);
readMoreButton.setAttribute('aria-expanded', 'false');
element.insertAdjacentElement('afterend', readMoreButton);
readMoreButton.addEventListener('click', function () {
const isExpanded = readMoreButton.getAttribute('aria-expanded') === 'true';
readMoreButton.setAttribute('aria-expanded', !isExpanded);
element.setAttribute('data-expanded', !isExpanded);
if (!hasReadLess) {
readMoreButton.remove();
}
if (isExpanded) {
readMoreButton.textContent = readMoreText;
} else {
readMoreButton.textContent = readLessText;
}
});
});
}
document.addEventListener('DOMContentLoaded', ToggleContentVisibilityParagraph);
;
/**
* A class to handle the toggling of content visibility with options.
*/
class ToggleContentVisibility {
/**
* @param {Element} node - The DOM element to apply the toggle behavior.
* @param {Object} options - Configuration options for the class.
*/
constructor(node, options = {}) {
if (!(node instanceof Element)) {
throw new Error('Input node is not a valid DOM element.');
}
this.node = node;
this.options = this.setOptions(options);
this.elements = node.querySelectorAll(
Array.isArray(this.options.targetElements) ? this.options.targetElements.join(', ') : '',
);
this.showingMore = false;
this.readMoreButton = this.node.querySelector('.read-more');
this.readLessButton = this.node.querySelector('.read-less');
this.toggleContentBound = this.toggleContent.bind(this); // Bind method once
this.initialize();
}
setOptions(options) {
const defaults = {
initialIndex: 2,
showReadLess: false,
targetElements: [
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'p',
'blockquote',
'pre',
'address',
'figcaption',
'details',
'ul',
'ol',
'dl',
'table',
'img',
'video',
'audio',
'canvas',
'iframe',
'figure',
'script',
'noscript',
'style',
'form',
'hr',
'svg',
],
position: 'after',
readMoreText: 'Read more',
readLessText: 'Read less',
transitionEffect: null,
};
const readMoreAttribute = this.node.getAttribute('data-readmore');
const readLessAttribute = this.node.getAttribute('data-readless');
const readMoreCountAttribute = this.node.getAttribute('data-readmore-count');
const parsedCount = parseInt(readMoreCountAttribute, 10);
const initialIndex = Number.isNaN(parsedCount) ? defaults.initialIndex : parsedCount;
return {
...defaults,
...options,
initialIndex,
showReadLess: readLessAttribute !== 'false',
readMoreText: readMoreAttribute || defaults.readMoreText,
readLessText: readLessAttribute || defaults.readLessText,
};
}
initialize() {
if (this.elements.length === 0) return; // No elements, nothing to toggle
if (this.options.initialIndex >= this.elements.length) {
this.showingMore = true;
return;
}
if (!this.node.id) {
this.node.id = `readmore-${Math.random().toString(36).substr(2, 9)}`;
}
Array.from(this.elements).forEach((element, i) => {
element.classList.toggle('hidden', i >= this.options.initialIndex);
element.setAttribute('aria-hidden', i >= this.options.initialIndex);
});
this.showingMore = false;
if (!this.readMoreButton) {
this.readMoreButton = ToggleContentVisibility.createControlButton(
this.options.readMoreText,
['read-more'],
this.toggleContentBound,
);
this.appendControlButton(this.readMoreButton);
}
if (this.options.showReadLess && !this.readLessButton) {
this.readLessButton = ToggleContentVisibility.createControlButton(
this.options.readLessText,
['read-less'],
this.toggleContentBound,
);
this.appendControlButton(this.readLessButton);
}
this.node.setAttribute('aria-expanded', this.showingMore);
this.manageButtonState();
}
static initAll() {
const nodes = document.querySelectorAll('[data-readmore]');
nodes.forEach(node => {
new ToggleContentVisibility(node); // eslint-disable-line no-new
});
}
refresh() {
this.destroy();
this.initialize();
}
update(newOptions) {
this.options = this.setOptions({ ...this.options, ...newOptions });
this.refresh();
}
destroy() {
this.showingMore = false;
if (this.readMoreButton) {
this.readMoreButton.removeEventListener('click', this.toggleContentBound);
this.readMoreButton.remove();
this.readMoreButton = null;
}
if (this.readLessButton) {
this.readLessButton.removeEventListener('click', this.toggleContentBound);
this.readLessButton.remove();
this.readLessButton = null;
}
Array.from(this.elements).forEach(element => {
element.classList.remove('hidden');
element.removeAttribute('aria-hidden');
});
this.node.removeAttribute('aria-expanded');
}
toggleContent() {
if (this.node.getAttribute('data-readless') === null) {
this.showContent();
this.readMoreButton.remove();
if (this.readLessButton) {
this.readLessButton.remove();
this.readLessButton = null;
}
} else if (this.showingMore) {
this.hideContent();
} else {
this.showContent();
}
}
showContent() {
this.showingMore = true;
this.toggleElementsVisibility(true);
this.manageButtonState();
}
hideContent() {
this.showingMore = false;
this.toggleElementsVisibility(false);
this.manageButtonState();
}
toggleElementsVisibility(isVisible) {
Array.from(this.elements)
.slice(this.options.initialIndex)
.forEach(element => {
element.classList.toggle('hidden', !isVisible);
element.setAttribute('aria-hidden', !isVisible);
});
this.node.setAttribute('aria-expanded', isVisible);
}
manageButtonState() {
if (this.showingMore) {
this.configureReadLessButton();
} else {
this.configureReadMoreButton();
}
}
configureReadMoreButton() {
if (this.readMoreButton) {
this.readMoreButton.classList.remove('hidden');
this.readMoreButton.setAttribute('aria-hidden', 'false');
}
if (this.readLessButton) {
this.readLessButton.classList.add('hidden');
this.readLessButton.setAttribute('aria-hidden', 'true');
}
}
configureReadLessButton() {
if (this.readMoreButton) {
this.readMoreButton.classList.add('hidden');
this.readMoreButton.setAttribute('aria-hidden', 'true');
}
if (this.readLessButton) {
this.readLessButton.classList.remove('hidden');
this.readLessButton.setAttribute('aria-hidden', 'false');
}
}
static createControlButton(text, classNames, handler) {
const button = document.createElement('button');
button.textContent = text;
button.classList.add(...classNames);
button.addEventListener('click', handler);
return button;
}
appendControlButton(button) {
if (this.node.parentNode) {
this.node.appendChild(button);
}
}
}
ToggleContentVisibility.initAll();
;
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r.h="07196a11c38dbd7e5989",r.cn="nl-frontend-form-submission",r(r.s=253)}([,function(t,e,r){var n=r(60),o=r(29),i=r(124);n||o(Object.prototype,"toString",i,{unsafe:!0})},function(t,e,r){"use strict";var n=r(31),o=r(83),i=r(52),u=r(37),a=r(107),c=u.set,s=u.getterFor("Array Iterator");t.exports=a(Array,"Array",(function(t,e){c(this,{type:"Array Iterator",target:n(t),index:0,kind:e})}),(function(){var t=s(this),e=t.target,r=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values"),i.Arguments=i.Array,o("keys"),o("values"),o("entries")},function(t,e,r){"use strict";var n=r(88).charAt,o=r(37),i=r(107),u=o.set,a=o.getterFor("String Iterator");i(String,"String",(function(t){u(this,{type:"String Iterator",string:String(t),index:0})}),(function(){var t,e=a(this),r=e.string,o=e.index;return o>=r.length?{value:void 0,done:!0}:(t=n(r,o),e.index+=t.length,{value:t,done:!1})}))},,function(t,e,r){var n=r(6),o=r(100),i=r(2),u=r(25),a=r(7),c=a("iterator"),s=a("toStringTag"),f=i.values;for(var l in o){var p=n[l],h=p&&p.prototype;if(h){if(h[c]!==f)try{u(h,c,f)}catch(t){h[c]=f}if(h[s]||u(h,s,l),o[l])for(var v in i)if(h[v]!==i[v])try{u(h,v,i[v])}catch(t){h[v]=i[v]}}}},function(t,e,r){(function(e){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e&&e)||Function("return this")()}).call(this,r(85))},function(t,e,r){var n=r(6),o=r(68),i=r(16),u=r(69),a=r(70),c=r(95),s=o("wks"),f=n.Symbol,l=c?f:f&&f.withoutSetter||u;t.exports=function(t){return i(s,t)||(a&&i(f,t)?s[t]=f[t]:s[t]=l("Symbol."+t)),s[t]}},,,function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,r){var n=r(6),o=r(50).f,i=r(25),u=r(29),a=r(64),c=r(115),s=r(94);t.exports=function(t,e){var r,f,l,p,h,v=t.target,g=t.global,d=t.stat;if(r=g?n:d?n[v]||a(v,{}):(n[v]||{}).prototype)for(f in e){if(p=e[f],l=t.noTargetGet?(h=o(r,f))&&h.value:r[f],!s(g?f:v+(d?".":"#")+f,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;c(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),u(r,f,p,t)}}},,,,,function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e,r){var n=r(19);t.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,r){var n=r(10);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},,,,,function(t,e,r){"use strict";var n=r(11),o=r(98);n({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(t,e,r){var n=r(18),o=r(27),i=r(42);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e,r){"use strict";var n=r(29),o=r(17),i=r(10),u=r(111),a=RegExp.prototype,c=a.toString,s=i((function(){return"/a/b"!=c.call({source:"a",flags:"b"})})),f="toString"!=c.name;(s||f)&&n(RegExp.prototype,"toString",(function(){var t=o(this),e=String(t.source),r=t.flags;return"/"+e+"/"+String(void 0===r&&t instanceof RegExp&&!("flags"in a)?u.call(t):r)}),{unsafe:!0})},function(t,e,r){var n=r(18),o=r(86),i=r(17),u=r(47),a=Object.defineProperty;e.f=n?a:function(t,e,r){if(i(t),e=u(e,!0),i(r),o)try{return a(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},,function(t,e,r){var n=r(6),o=r(25),i=r(16),u=r(64),a=r(67),c=r(37),s=c.get,f=c.enforce,l=String(String).split("String");(t.exports=function(t,e,r,a){var c=!!a&&!!a.unsafe,s=!!a&&!!a.enumerable,p=!!a&&!!a.noTargetGet;"function"==typeof r&&("string"!=typeof e||i(r,"name")||o(r,"name",e),f(r).source=l.join("string"==typeof e?e:"")),t!==n?(c?!p&&t[e]&&(s=!0):delete t[e],s?t[e]=r:o(t,e,r)):s?t[e]=r:u(e,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&s(this).source||a(this)}))},,function(t,e,r){var n=r(63),o=r(41);t.exports=function(t){return n(o(t))}},,,,function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e,r){var n=r(41);t.exports=function(t){return Object(n(t))}},function(t,e,r){var n,o,i,u=r(114),a=r(6),c=r(19),s=r(25),f=r(16),l=r(57),p=r(58),h=a.WeakMap;if(u){var v=new h,g=v.get,d=v.has,y=v.set;n=function(t,e){return y.call(v,t,e),e},o=function(t){return g.call(v,t)||{}},i=function(t){return d.call(v,t)}}else{var m=l("state");p[m]=!0,n=function(t,e){return s(t,m,e),e},o=function(t){return f(t,m)?t[m]:{}},i=function(t){return f(t,m)}}t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(e){var r;if(!c(e)||(r=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},,,,function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){var n=r(65),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e){t.exports=!1},function(t,e,r){var n=r(117),o=r(6),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t])||i(o[t]):n[t]&&n[t][e]||o[t]&&o[t][e]}},,function(t,e,r){var n=r(19);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},,,function(t,e,r){var n=r(18),o=r(75),i=r(42),u=r(31),a=r(47),c=r(16),s=r(86),f=Object.getOwnPropertyDescriptor;e.f=n?f:function(t,e){if(t=u(t),e=a(e,!0),s)try{return f(t,e)}catch(t){}if(c(t,e))return i(!o.f.call(t,e),t[e])}},function(t,e,r){var n=r(27).f,o=r(16),i=r(7)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},function(t,e){t.exports={}},,function(t,e,r){var n,o=r(17),i=r(106),u=r(80),a=r(58),c=r(120),s=r(76),f=r(57),l=f("IE_PROTO"),p=function(){},h=function(t){return"