site-libsoc/Server/public/js/components/manifesto-component.js

1446 lines
36 KiB
JavaScript

(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
import { S as SvelteElement, i as init, a as attribute_to_object, b as insert_dev, s as safe_not_equal, d as dispatch_dev, v as validate_slots, c as validate_store, e as component_subscribe, o as onMount, g as globals, f as validate_each_argument, h as empty, n as noop, j as detach_dev, C as binding_callbacks, k as element, p as attr_dev, m as add_location, u as append_dev, t as text, l as space, q as src_url_equal, D as set_style, y as listen_dev, w as set_data_dev, x as destroy_each, H as is_function, I as HtmlTag } from './index-42a25c61.js';
import { w as writable } from './index-a1c185ea.js';
import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js';
import { px2rem } from '../../../../../../../../../js/libraries/miscTools.js';
/* src\manifesto-component.svelte generated by Svelte v3.52.0 */
const { Object: Object_1 } = globals;
const file = "src\\manifesto-component.svelte";
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[32] = list[i];
child_ctx[33] = list;
child_ctx[34] = i;
return child_ctx;
}
function get_each_context_2(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[35] = list[i];
return child_ctx;
}
function get_each_context_1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[35] = list[i];
return child_ctx;
}
function get_each_context_3(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[40] = list[i];
child_ctx[41] = list;
child_ctx[42] = i;
return child_ctx;
}
function get_each_context_4(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[43] = list[i];
child_ctx[44] = list;
child_ctx[45] = i;
return child_ctx;
}
// (168:4) {#if Object.keys($content).length!=0}
function create_if_block(ctx) {
let div1;
let div0;
let previous_key = /*key*/ ctx[0];
let key_block = create_key_block(ctx);
const block = {
c: function create() {
div1 = element("div");
div0 = element("div");
key_block.c();
attr_dev(div0, "id", "text-container");
add_location(div0, file, 169, 12, 6016);
attr_dev(div1, "id", "container");
add_location(div1, file, 168, 8, 5965);
},
m: function mount(target, anchor) {
insert_dev(target, div1, anchor);
append_dev(div1, div0);
key_block.m(div0, null);
/*div1_binding_1*/ ctx[27](div1);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*key*/ 1 && safe_not_equal(previous_key, previous_key = /*key*/ ctx[0])) {
key_block.d(1);
key_block = create_key_block(ctx);
key_block.c();
key_block.m(div0, null);
} else {
key_block.p(ctx, dirty);
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(div1);
key_block.d(detaching);
/*div1_binding_1*/ ctx[27](null);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block.name,
type: "if",
source: "(168:4) {#if Object.keys($content).length!=0}",
ctx
});
return block;
}
// (187:32) {:else}
function create_else_block_1(ctx) {
let div;
let button;
let t0_value = /*obj*/ ctx[40].name + "";
let t0;
let obj = /*obj*/ ctx[40];
let t1;
let mounted;
let dispose;
const assign_button = () => /*button_binding_2*/ ctx[20](button, obj);
const unassign_button = () => /*button_binding_2*/ ctx[20](null, obj);
function click_handler_2() {
return /*click_handler_2*/ ctx[21](/*obj*/ ctx[40]);
}
const block = {
c: function create() {
div = element("div");
button = element("button");
t0 = text(t0_value);
t1 = space();
attr_dev(button, "class", "level0 heading-button");
add_location(button, file, 188, 40, 7353);
attr_dev(div, "class", "heading-button-wrapper");
add_location(div, file, 187, 36, 7275);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, button);
append_dev(button, t0);
assign_button();
append_dev(div, t1);
if (!mounted) {
dispose = listen_dev(button, "click", click_handler_2, false, false, false);
mounted = true;
}
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
if (obj !== /*obj*/ ctx[40]) {
unassign_button();
obj = /*obj*/ ctx[40];
assign_button();
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
unassign_button();
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_else_block_1.name,
type: "else",
source: "(187:32) {:else}",
ctx
});
return block;
}
// (179:32) {#if Array.isArray(obj)}
function create_if_block_8(ctx) {
let each_1_anchor;
let each_value_4 = /*obj*/ ctx[40];
validate_each_argument(each_value_4);
let each_blocks = [];
for (let i = 0; i < each_value_4.length; i += 1) {
each_blocks[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
}
const block = {
c: function create() {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
each_1_anchor = empty();
},
m: function mount(target, anchor) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
}
insert_dev(target, each_1_anchor, anchor);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*buttons, contentHeadings, goToChapter*/ 18448) {
each_value_4 = /*obj*/ ctx[40];
validate_each_argument(each_value_4);
let i;
for (i = 0; i < each_value_4.length; i += 1) {
const child_ctx = get_each_context_4(ctx, each_value_4, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_4(child_ctx);
each_blocks[i].c();
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_4.length;
}
},
d: function destroy(detaching) {
destroy_each(each_blocks, detaching);
if (detaching) detach_dev(each_1_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_8.name,
type: "if",
source: "(179:32) {#if Array.isArray(obj)}",
ctx
});
return block;
}
// (180:36) {#each obj as obj2}
function create_each_block_4(ctx) {
let div;
let button;
let t0_value = /*obj2*/ ctx[43].name + "";
let t0;
let obj2 = /*obj2*/ ctx[43];
let t1;
let mounted;
let dispose;
const assign_button = () => /*button_binding_1*/ ctx[18](button, obj2);
const unassign_button = () => /*button_binding_1*/ ctx[18](null, obj2);
function click_handler_1() {
return /*click_handler_1*/ ctx[19](/*obj2*/ ctx[43]);
}
const block = {
c: function create() {
div = element("div");
button = element("button");
t0 = text(t0_value);
t1 = space();
attr_dev(button, "class", "level1 heading-button");
add_location(button, file, 181, 40, 6891);
attr_dev(div, "class", "heading-button-wrapper");
add_location(div, file, 180, 36, 6813);
},
m: function mount(target, anchor) {
insert_dev(target, div, anchor);
append_dev(div, button);
append_dev(button, t0);
assign_button();
append_dev(div, t1);
if (!mounted) {
dispose = listen_dev(button, "click", click_handler_1, false, false, false);
mounted = true;
}
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
if (obj2 !== /*obj2*/ ctx[43]) {
unassign_button();
obj2 = /*obj2*/ ctx[43];
assign_button();
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(div);
unassign_button();
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_4.name,
type: "each",
source: "(180:36) {#each obj as obj2}",
ctx
});
return block;
}
// (178:28) {#each contentHeadings as obj}
function create_each_block_3(ctx) {
let if_block_anchor;
function select_block_type(ctx, dirty) {
if (Array.isArray(/*obj*/ ctx[40])) return create_if_block_8;
return create_else_block_1;
}
let current_block_type = select_block_type(ctx);
let if_block = current_block_type(ctx);
const block = {
c: function create() {
if_block.c();
if_block_anchor = empty();
},
m: function mount(target, anchor) {
if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
},
p: function update(ctx, dirty) {
if_block.p(ctx, dirty);
},
d: function destroy(detaching) {
if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_3.name,
type: "each",
source: "(178:28) {#each contentHeadings as obj}",
ctx
});
return block;
}
// (199:28) {#if line!==""}
function create_if_block_1(ctx) {
let if_block_anchor;
function select_block_type_2(ctx, dirty) {
if (typeof (/*line*/ ctx[32] === 'object') && Object.keys(/*line*/ ctx[32])[0] == "ul") return create_if_block_2;
if (typeof (/*line*/ ctx[32] === 'object') && Object.keys(/*line*/ ctx[32])[0] == "ol") return create_if_block_3;
if (typeof (/*line*/ ctx[32] === 'object') && /*line*/ ctx[32].type == "h3") return create_if_block_4;
if (typeof (/*line*/ ctx[32] === 'object') && /*line*/ ctx[32].type == "h2") return create_if_block_5;
if (/*line*/ ctx[32][0] == "#") return create_if_block_6;
return create_else_block;
}
let current_block_type = select_block_type_2(ctx);
let if_block = current_block_type(ctx);
const block = {
c: function create() {
if_block.c();
if_block_anchor = empty();
},
m: function mount(target, anchor) {
if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
},
p: function update(ctx, dirty) {
if_block.p(ctx, dirty);
},
d: function destroy(detaching) {
if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_1.name,
type: "if",
source: "(199:28) {#if line!==\\\"\\\"}",
ctx
});
return block;
}
// (224:32) {:else}
function create_else_block(ctx) {
let p;
let html_tag;
let raw_value = /*line*/ ctx[32] + "";
let t;
const block = {
c: function create() {
p = element("p");
html_tag = new HtmlTag(false);
t = space();
html_tag.a = t;
attr_dev(p, "class", "margin-end");
add_location(p, file, 224, 36, 9751);
},
m: function mount(target, anchor) {
insert_dev(target, p, anchor);
html_tag.m(raw_value, p);
append_dev(p, t);
},
p: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(p);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_else_block.name,
type: "else",
source: "(224:32) {:else}",
ctx
});
return block;
}
// (222:55)
function create_if_block_6(ctx) {
let h1;
let raw_value = /*line*/ ctx[32].slice(2, /*line*/ ctx[32].length) + "";
const block = {
c: function create() {
h1 = element("h1");
add_location(h1, file, 222, 36, 9630);
},
m: function mount(target, anchor) {
insert_dev(target, h1, anchor);
h1.innerHTML = raw_value;
},
p: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(h1);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_6.name,
type: "if",
source: "(222:55) ",
ctx
});
return block;
}
// (218:90)
function create_if_block_5(ctx) {
let button;
let h2;
let raw_value = /*line*/ ctx[32].line + "";
let line = /*line*/ ctx[32];
let t;
let mounted;
let dispose;
const assign_h2 = () => /*h2_binding*/ ctx[25](h2, line);
const unassign_h2 = () => /*h2_binding*/ ctx[25](null, line);
const block = {
c: function create() {
button = element("button");
h2 = element("h2");
t = space();
attr_dev(h2, "id", /*line*/ ctx[32].id);
add_location(h2, file, 219, 40, 9412);
set_style(button, "display", "block");
set_style(button, "width", "100%");
add_location(button, file, 218, 36, 9259);
},
m: function mount(target, anchor) {
insert_dev(target, button, anchor);
append_dev(button, h2);
h2.innerHTML = raw_value;
assign_h2();
append_dev(button, t);
if (!mounted) {
dispose = listen_dev(
button,
"click",
function () {
if (is_function(/*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true))) /*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true).apply(this, arguments);
},
false,
false,
false
);
mounted = true;
}
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
if (line !== /*line*/ ctx[32]) {
unassign_h2();
line = /*line*/ ctx[32];
assign_h2();
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(button);
unassign_h2();
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_5.name,
type: "if",
source: "(218:90) ",
ctx
});
return block;
}
// (214:90)
function create_if_block_4(ctx) {
let button;
let h3;
let raw_value = /*line*/ ctx[32].line + "";
let line = /*line*/ ctx[32];
let t;
let mounted;
let dispose;
const assign_h3 = () => /*h3_binding*/ ctx[24](h3, line);
const unassign_h3 = () => /*h3_binding*/ ctx[24](null, line);
const block = {
c: function create() {
button = element("button");
h3 = element("h3");
t = space();
attr_dev(h3, "id", /*line*/ ctx[32].id);
add_location(h3, file, 215, 40, 9006);
set_style(button, "display", "block");
set_style(button, "width", "100%");
add_location(button, file, 214, 36, 8853);
},
m: function mount(target, anchor) {
insert_dev(target, button, anchor);
append_dev(button, h3);
h3.innerHTML = raw_value;
assign_h3();
append_dev(button, t);
if (!mounted) {
dispose = listen_dev(
button,
"click",
function () {
if (is_function(/*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true))) /*contentTable*/ ctx[6].scrollIntoView({ block: 'start' }, true).apply(this, arguments);
},
false,
false,
false
);
mounted = true;
}
},
p: function update(new_ctx, dirty) {
ctx = new_ctx;
if (line !== /*line*/ ctx[32]) {
unassign_h3();
line = /*line*/ ctx[32];
assign_h3();
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(button);
unassign_h3();
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_4.name,
type: "if",
source: "(214:90) ",
ctx
});
return block;
}
// (206:101)
function create_if_block_3(ctx) {
let ol;
let t;
let each_value_2 = /*line*/ ctx[32].ol;
validate_each_argument(each_value_2);
let each_blocks = [];
for (let i = 0; i < each_value_2.length; i += 1) {
each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
}
const block = {
c: function create() {
ol = element("ol");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
add_location(ol, file, 206, 36, 8397);
},
m: function mount(target, anchor) {
insert_dev(target, ol, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(ol, null);
}
append_dev(ol, t);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*manifesto*/ 1024) {
each_value_2 = /*line*/ ctx[32].ol;
validate_each_argument(each_value_2);
let i;
for (i = 0; i < each_value_2.length; i += 1) {
const child_ctx = get_each_context_2(ctx, each_value_2, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(ol, t);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_2.length;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(ol);
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_3.name,
type: "if",
source: "(206:101) ",
ctx
});
return block;
}
// (200:32) {#if typeof (line === 'object') && (Object.keys(line)[0]=="ul")}
function create_if_block_2(ctx) {
let ul;
let t;
let each_value_1 = /*line*/ ctx[32].ul;
validate_each_argument(each_value_1);
let each_blocks = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
}
const block = {
c: function create() {
ul = element("ul");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
t = space();
add_location(ul, file, 200, 36, 8032);
},
m: function mount(target, anchor) {
insert_dev(target, ul, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(ul, null);
}
append_dev(ul, t);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*manifesto*/ 1024) {
each_value_1 = /*line*/ ctx[32].ul;
validate_each_argument(each_value_1);
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1(ctx, each_value_1, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block_1(child_ctx);
each_blocks[i].c();
each_blocks[i].m(ul, t);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value_1.length;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(ul);
destroy_each(each_blocks, detaching);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_if_block_2.name,
type: "if",
source: "(200:32) {#if typeof (line === 'object') && (Object.keys(line)[0]==\\\"ul\\\")}",
ctx
});
return block;
}
// (208:40) {#each line.ol as line2}
function create_each_block_2(ctx) {
let li;
let raw_value = /*line2*/ ctx[35] + "";
const block = {
c: function create() {
li = element("li");
add_location(li, file, 208, 44, 8513);
},
m: function mount(target, anchor) {
insert_dev(target, li, anchor);
li.innerHTML = raw_value;
},
p: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(li);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_2.name,
type: "each",
source: "(208:40) {#each line.ol as line2}",
ctx
});
return block;
}
// (202:40) {#each line.ul as line2}
function create_each_block_1(ctx) {
let li;
let t_value = /*line2*/ ctx[35] + "";
let t;
const block = {
c: function create() {
li = element("li");
t = text(t_value);
add_location(li, file, 202, 44, 8148);
},
m: function mount(target, anchor) {
insert_dev(target, li, anchor);
append_dev(li, t);
},
p: noop,
d: function destroy(detaching) {
if (detaching) detach_dev(li);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block_1.name,
type: "each",
source: "(202:40) {#each line.ul as line2}",
ctx
});
return block;
}
// (198:24) {#each manifesto as line}
function create_each_block(ctx) {
let if_block_anchor;
function select_block_type_1(ctx, dirty) {
if (/*line*/ ctx[32] !== "") return create_if_block_1;
}
let current_block_type = select_block_type_1(ctx);
let if_block = current_block_type && current_block_type(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m: function mount(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
},
p: function update(ctx, dirty) {
if (if_block) if_block.p(ctx, dirty);
},
d: function destroy(detaching) {
if (if_block) {
if_block.d(detaching);
}
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_each_block.name,
type: "each",
source: "(198:24) {#each manifesto as line}",
ctx
});
return block;
}
// (171:16) {#key key}
function create_key_block(ctx) {
let div1;
let button;
let t0_value = /*$content*/ ctx[9].tableOfContents + "";
let t0;
let t1;
let img;
let img_src_value;
let t2;
let div0;
let t3;
let div2;
let mounted;
let dispose;
let each_value_3 = /*contentHeadings*/ ctx[11];
validate_each_argument(each_value_3);
let each_blocks_1 = [];
for (let i = 0; i < each_value_3.length; i += 1) {
each_blocks_1[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
}
let each_value = /*manifesto*/ ctx[10];
validate_each_argument(each_value);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
const block = {
c: function create() {
div1 = element("div");
button = element("button");
t0 = text(t0_value);
t1 = space();
img = element("img");
t2 = space();
div0 = element("div");
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t3 = space();
div2 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
if (!src_url_equal(img.src, img_src_value = "../assets/arrow_down.svg")) attr_dev(img, "src", img_src_value);
attr_dev(img, "alt", "arrow down");
set_style(img, "transform", "scaleY(-1)");
add_location(img, file, 174, 28, 6360);
attr_dev(button, "id", "toggle-content");
add_location(button, file, 172, 24, 6166);
attr_dev(div0, "class", "module");
set_style(div0, "display", "initial");
add_location(div0, file, 176, 24, 6529);
attr_dev(div1, "id", "table-content");
add_location(div1, file, 171, 20, 6091);
attr_dev(div2, "id", "main");
add_location(div2, file, 196, 20, 7768);
},
m: function mount(target, anchor) {
insert_dev(target, div1, anchor);
append_dev(div1, button);
append_dev(button, t0);
append_dev(button, t1);
append_dev(button, img);
/*img_binding*/ ctx[15](img);
/*button_binding*/ ctx[16](button);
append_dev(div1, t2);
append_dev(div1, div0);
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].m(div0, null);
}
/*div0_binding*/ ctx[22](div0);
/*div1_binding*/ ctx[23](div1);
insert_dev(target, t3, anchor);
insert_dev(target, div2, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(div2, null);
}
/*div2_binding*/ ctx[26](div2);
if (!mounted) {
dispose = listen_dev(button, "click", /*click_handler*/ ctx[17], false, false, false);
mounted = true;
}
},
p: function update(ctx, dirty) {
if (dirty[0] & /*$content*/ 512 && t0_value !== (t0_value = /*$content*/ ctx[9].tableOfContents + "")) set_data_dev(t0, t0_value);
if (dirty[0] & /*contentHeadings, buttons, goToChapter*/ 18448) {
each_value_3 = /*contentHeadings*/ ctx[11];
validate_each_argument(each_value_3);
let i;
for (i = 0; i < each_value_3.length; i += 1) {
const child_ctx = get_each_context_3(ctx, each_value_3, i);
if (each_blocks_1[i]) {
each_blocks_1[i].p(child_ctx, dirty);
} else {
each_blocks_1[i] = create_each_block_3(child_ctx);
each_blocks_1[i].c();
each_blocks_1[i].m(div0, null);
}
}
for (; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].d(1);
}
each_blocks_1.length = each_value_3.length;
}
if (dirty[0] & /*manifesto, contentTable, headingsObjects*/ 1120) {
each_value = /*manifesto*/ ctx[10];
validate_each_argument(each_value);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div2, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d: function destroy(detaching) {
if (detaching) detach_dev(div1);
/*img_binding*/ ctx[15](null);
/*button_binding*/ ctx[16](null);
destroy_each(each_blocks_1, detaching);
/*div0_binding*/ ctx[22](null);
/*div1_binding*/ ctx[23](null);
if (detaching) detach_dev(t3);
if (detaching) detach_dev(div2);
destroy_each(each_blocks, detaching);
/*div2_binding*/ ctx[26](null);
mounted = false;
dispose();
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_key_block.name,
type: "key",
source: "(171:16) {#key key}",
ctx
});
return block;
}
function create_fragment(ctx) {
let show_if = Object.keys(/*$content*/ ctx[9]).length != 0;
let if_block_anchor;
let if_block = show_if && create_if_block(ctx);
const block = {
c: function create() {
if (if_block) if_block.c();
if_block_anchor = empty();
this.c = noop;
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert_dev(target, if_block_anchor, anchor);
},
p: function update(ctx, dirty) {
if (dirty[0] & /*$content*/ 512) show_if = Object.keys(/*$content*/ ctx[9]).length != 0;
if (show_if) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block(ctx);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d: function destroy(detaching) {
if (if_block) if_block.d(detaching);
if (detaching) detach_dev(if_block_anchor);
}
};
dispatch_dev("SvelteRegisterBlock", {
block,
id: create_fragment.name,
type: "component",
source: "",
ctx
});
return block;
}
function hideBlock(arrow, block) {
if (block.style.display == "none" || block.style.display == "") {
block.style.display = "initial";
arrow.style.transform = "scaleY(-1)";
localStorage.setItem("manifesto-hide-content", "false");
} else {
block.style.display = "none";
arrow.style.transform = "";
localStorage.setItem("manifesto-hide-content", "true");
}
}
function instance($$self, $$props, $$invalidate) {
let $content;
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots('manifesto-component', slots, []);
let manifesto = [];
let key;
let contentButton;
let contentArrow;
let contentBlock;
let buttons = [];
let headingsObjects = {};
let contentHeadings = [];
let contentTable;
let lastTop = 0;
let margin = 0;
let root;
let main;
let loaded;
let content = writable({});
validate_store(content, 'content');
component_subscribe($$self, content, value => $$invalidate(9, $content = value));
let locale = loadLocaleContent(content, "manifesto-component", loaded);
const htmlDelims = ["ul", "ol"];
getData("/locales/" + locale + "/manifesto.txt", function (response) {
let splitText = response.split(/\r?\n/);
let currentChapter;
let cnt = 0;
for (let j = 0; j < splitText.length; j++) {
let line = splitText[j];
let delimInd = htmlDelims.map(x => line.includes("<" + x + ">")).findIndex(x => x);
if (delimInd != -1) {
let delim = htmlDelims[delimInd];
let obj = {};
obj[delim] = [];
let delimEndTag = "</" + delim + ">";
while (true) {
j += 1;
line = splitText[j];
if (line.includes(delimEndTag)) {
manifesto.push(obj);
break;
} else {
obj[delim].push(line);
}
}
} else {
if (line.slice(0, 3) == "###") {
let heading = line.slice(4, line.length);
let id = heading.toLowerCase().trim().replaceAll(" ", "-");
currentChapter.push({ id, name: heading, index: cnt });
cnt += 1;
manifesto.push({
type: "h3",
id,
line: heading,
index: cnt
});
} else if (line.slice(0, 2) == "##") {
let heading = line.slice(3, line.length);
let id = heading.toLowerCase().trim().replaceAll(" ", "-");
contentHeadings.push({
id: heading.toLowerCase().trim().replaceAll(" ", "-"),
name: heading,
index: cnt
});
cnt += 1;
currentChapter = [];
contentHeadings.push(currentChapter);
manifesto.push({
type: "h2",
id,
line: heading,
index: cnt
});
} else {
manifesto.push(line);
}
}
}
$$invalidate(0, key += 1);
});
function goToChapter(id) {
headingsObjects[id].scrollIntoView({ block: 'start' }, true);
}
addEventListener("scroll", event => {
if (window.innerWidth > 1080) {
let top = px2rem(window.scrollY);
let textBottom = px2rem(root.getBoundingClientRect().bottom + window.scrollY);
let tableBottom = px2rem(contentTable.getBoundingClientRect().bottom + window.scrollY);
if (top > lastTop && top < 5 || top < lastTop && top < 5) {
margin = -Math.min(px2rem(window.scrollY), 5);
} else if (tableBottom >= textBottom - 1.5) {
margin = margin - (tableBottom - (textBottom - 1.5));
} else {
if (margin > -5) {
margin = -5;
}
if (top < 5 && top != 0) {
let dif = px2rem(contentTable.offsetHeight - window.innerHeight);
margin = -Math.min(px2rem(window.scrollY), 5 + dif + 2.5);
} else if (top < lastTop || margin == 0) {
if (margin < -5) {
margin = margin + (lastTop - top);
} else {
margin = -5;
}
} else {
if (contentTable.offsetHeight > window.innerHeight) {
let dif = px2rem(contentTable.offsetHeight) - px2rem(window.innerHeight);
if (margin > -(dif + 8)) {
margin = margin + (lastTop - top);
} else {
margin = -(dif + 8);
}
}
}
}
$$invalidate(6, contentTable.style.marginTop = margin + "rem", contentTable);
lastTop = px2rem(window.scrollY);
} else {
$$invalidate(6, contentTable.style.marginTop = "0rem", contentTable);
}
});
onMount(() => {
let hideBool = localStorage.getItem("manifesto-hide-content");
if (hideBool != undefined && hideBool != null) {
if (hideBool == "true") {
hideBlock(contentArrow, contentBlock);
}
}
});
const writable_props = [];
Object_1.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<manifesto-component> was created with unknown prop '${key}'`);
});
function img_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
contentArrow = $$value;
$$invalidate(2, contentArrow);
});
}
function button_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
contentButton = $$value;
$$invalidate(1, contentButton);
});
}
const click_handler = () => hideBlock(contentArrow, contentBlock);
function button_binding_1($$value, obj2) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
buttons[obj2.index] = $$value;
$$invalidate(4, buttons);
});
}
const click_handler_1 = obj2 => goToChapter(obj2.id);
function button_binding_2($$value, obj) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
buttons[obj.index] = $$value;
$$invalidate(4, buttons);
});
}
const click_handler_2 = obj => goToChapter(obj.id);
function div0_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
contentBlock = $$value;
$$invalidate(3, contentBlock);
});
}
function div1_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
contentTable = $$value;
$$invalidate(6, contentTable);
});
}
function h3_binding($$value, line) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
headingsObjects[line.id] = $$value;
$$invalidate(5, headingsObjects);
});
}
function h2_binding($$value, line) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
headingsObjects[line.id] = $$value;
$$invalidate(5, headingsObjects);
});
}
function div2_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
main = $$value;
$$invalidate(8, main);
});
}
function div1_binding_1($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
root = $$value;
$$invalidate(7, root);
});
}
$$self.$capture_state = () => ({
onMount,
writable,
getData,
px2rem,
loadLocaleContent,
manifesto,
key,
contentButton,
contentArrow,
contentBlock,
buttons,
headingsObjects,
contentHeadings,
contentTable,
lastTop,
margin,
root,
main,
loaded,
content,
locale,
htmlDelims,
hideBlock,
goToChapter,
$content
});
$$self.$inject_state = $$props => {
if ('manifesto' in $$props) $$invalidate(10, manifesto = $$props.manifesto);
if ('key' in $$props) $$invalidate(0, key = $$props.key);
if ('contentButton' in $$props) $$invalidate(1, contentButton = $$props.contentButton);
if ('contentArrow' in $$props) $$invalidate(2, contentArrow = $$props.contentArrow);
if ('contentBlock' in $$props) $$invalidate(3, contentBlock = $$props.contentBlock);
if ('buttons' in $$props) $$invalidate(4, buttons = $$props.buttons);
if ('headingsObjects' in $$props) $$invalidate(5, headingsObjects = $$props.headingsObjects);
if ('contentHeadings' in $$props) $$invalidate(11, contentHeadings = $$props.contentHeadings);
if ('contentTable' in $$props) $$invalidate(6, contentTable = $$props.contentTable);
if ('lastTop' in $$props) lastTop = $$props.lastTop;
if ('margin' in $$props) margin = $$props.margin;
if ('root' in $$props) $$invalidate(7, root = $$props.root);
if ('main' in $$props) $$invalidate(8, main = $$props.main);
if ('loaded' in $$props) $$invalidate(12, loaded = $$props.loaded);
if ('content' in $$props) $$invalidate(13, content = $$props.content);
if ('locale' in $$props) locale = $$props.locale;
};
if ($$props && "$$inject" in $$props) {
$$self.$inject_state($$props.$$inject);
}
return [
key,
contentButton,
contentArrow,
contentBlock,
buttons,
headingsObjects,
contentTable,
root,
main,
$content,
manifesto,
contentHeadings,
loaded,
content,
goToChapter,
img_binding,
button_binding,
click_handler,
button_binding_1,
click_handler_1,
button_binding_2,
click_handler_2,
div0_binding,
div1_binding,
h3_binding,
h2_binding,
div2_binding,
div1_binding_1
];
}
class Manifesto_component extends SvelteElement {
constructor(options) {
super();
this.shadowRoot.innerHTML = `<style>@import '/css/common.css';#main b{color:#d50400}#table-content{position:fixed;display:flex;flex-direction:column;border:#cdcdcd 0.1rem solid;border-radius:1rem;padding:2rem;padding-top:1rem;padding-right:0.8rem;padding-bottom:1.5rem;margin-bottom:2rem;width:20rem;height:max-content}#toggle-content{position:relative;width:100%;font-size:1.2rem;font-family:var(--sans-serif,sans-serif);text-align:left;padding-bottom:1rem;font-weight:bold;padding-top:0.3rem}#toggle-content img{position:absolute;top:0.3rem;right:0.8rem;width:1.5rem}.module{position:relative;display:inline-block;width:100%;height:max-content;padding-right:1.2rem}.heading-button-wrapper{position:relative}.heading-button{color:black;height:auto;width:100%;padding-top:0.25rem;padding-bottom:0.35rem;text-align:left;font-family:var(--sans-serif,sans-serif);font-size:1.2rem}.level0{position:relative;padding-left:0.5rem;z-index:1}.level1{position:relative;padding-left:1.5rem;z-index:1;margin-left:1rem;width:calc(100% - 1rem);border-left:#cdcdcd 0.1rem solid}.heading-button:hover{background-color:hsla(344, 73%, 57%, 0.12)}.heading-button:active{background-color:hsla(344, 73%, 57%, 0.5)}h1{margin-bottom:1rem;font-size:2rem;text-align:center}h2{margin-bottom:1rem;text-align:center}h3{margin-bottom:1rem}#text-container{position:relative;display:grid;grid-template-columns:20rem 700px 20rem;grid-gap:2rem;max-width:calc(100vw - 4rem);margin:auto}#container{display:flex;align-content:center;margin:auto;max-width:min(1800px,100vw);margin-top:1rem;margin-bottom:4rem}#main{grid-column:2}#main>p{margin-bottom:1rem}#container p{text-align:justify}@media only screen and (max-width: 1210px){#text-container{position:relative;display:grid;grid-template-columns:auto;grid-gap:2rem;max-width:calc(1800px,100vw - 4rem);margin:auto}#toggle-content img{right:0}#table-content{position:relative;border:#a9a9a9 0.1rem solid;border-radius:1rem;padding:2rem;padding-bottom:1.5rem;margin-bottom:2rem;height:max-content;width:100%}.module{padding-right:0}#main{grid-column:1}#container{max-width:min(700px,100vw)}}</style>`;
init(
this,
{
target: this.shadowRoot,
props: attribute_to_object(this.attributes),
customElement: true
},
instance,
create_fragment,
safe_not_equal,
{},
null,
[-1, -1]
);
if (options) {
if (options.target) {
insert_dev(options.target, this, options.anchor);
}
}
}
}
customElements.define("manifesto-component", Manifesto_component);
export { Manifesto_component as default };