+function hashparams() {
+ // location.hash is not encoded in firefox
+ const encodedhash = (window.location.href.split('#'))[1] || '';
+ return decodeURIComponent(encodedhash).split('#');
+}
+
+class Words {
+ constructor(data, root = undefined) {
+ this.data = data;
+ this.selection = root || this.data[''][3];
+ this.visible = new Set(root || Object.keys(data).flatMap(id => id && parseInt(id)));
+ if (root) {
+ let children = root;
+ for (let loop = 0; children.length && loop < 20; loop++) {
+ for (let child of children) this.visible.add(child);
+ children = children.map(cat => data[cat][3]).filter(is => is).flat();