From 41e12135662eb53bdc754d6dc68e27b3d159405a Mon Sep 17 00:00:00 2001 From: a-ill Date: Tue, 1 Aug 2023 15:56:41 +0300 Subject: [PATCH] Finished groups --- .../AuthenticationController.jl | 2 +- .../app/resources/groups/GroupsController.jl | 214 ++- Server/app/svelte/public/css/auth.css | 9 + Server/app/svelte/public/css/navbar.css | 268 +++ .../svelte/public/js/libraries/authTools.js | 5 +- .../svelte/public/js/libraries/mapTools.js | 82 +- .../app/svelte/src/auth/auth-component.svelte | 5 +- .../svelte/src/auth/login-component.svelte | 6 +- .../svelte/src/auth/signup-component.svelte | 6 +- .../app/svelte/src/communes-component.svelte | 5 +- .../src/components/map-component.svelte | 1 + .../svelte/src/cooperatives-component.svelte | 5 +- .../svelte/src/groups-add-component.svelte | 387 +++-- .../app/svelte/src/landing-component.svelte | 11 +- .../svelte/src/navbar/navbar-logged.svelte | 270 +-- .../src/navbar/navbar-not-logged.svelte | 271 +-- .../src/profile/profile-communes.svelte | 9 + .../src/profile/profile-component.svelte | 117 +- .../svelte/src/profile/profile-coops.svelte | 9 + .../svelte/src/profile/profile-general.svelte | 22 +- .../svelte/src/profile/profile-groups.svelte | 345 ++-- .../svelte/src/profile/profile-parties.svelte | 9 + .../2022026611846565_create_table_groups.jl | 3 + ...6611846569_create_table_groups_requests.jl | 6 +- ...2026611846577_create_table_users_groups.jl | 27 + Server/lib/DatabaseSupport.jl | 27 +- Server/public/assets/groups.json | 2 +- Server/public/css/auth.css | 9 + Server/public/css/navbar.css | 137 +- Server/public/js/components/auth-component.js | 230 +-- .../js/components/communes-add-component.js | 736 +------- .../js/components/communes-component.js | 647 +------ .../public/js/components/compass-component.js | 715 +------- .../js/components/confirmation-component.js | 362 +--- Server/public/js/components/cookies-dialog.js | 100 +- .../components/cooperatives-add-component.js | 684 +------- .../js/components/cooperatives-component.js | 815 +-------- .../public/js/components/footer-component.js | 348 +--- .../js/components/groups-add-component.js | 684 +------- .../public/js/components/groups-component.js | 623 +------ Server/public/js/components/index-0f28c1ea.js | 53 + Server/public/js/components/index-720c0a59.js | 1 + Server/public/js/components/index-db20528a.js | 1 + Server/public/js/components/index-e7d4b1a1.js | 524 ++++++ .../public/js/components/join-us-component.js | 628 +------ .../public/js/components/landing-component.js | 621 +------ .../public/js/components/legend-component.js | 363 +--- .../js/components/loadscreen-component.js | 116 +- .../public/js/components/login-component.js | 449 +---- .../js/components/manifesto-component.js | 1491 +---------------- Server/public/js/components/map-component.js | 176 +- Server/public/js/components/navbar-logged.js | 688 +------- .../public/js/components/navbar-not-logged.js | 688 +------- Server/public/js/components/pane-aligner.js | 302 +--- .../js/components/parties-add-component.js | 684 +------- .../public/js/components/parties-component.js | 733 +------- .../js/components/partners-add-component.js | 651 +------ .../js/components/partners-component.js | 732 +------- .../public/js/components/profile-communes.js | 1 + .../public/js/components/profile-component.js | 599 +------ Server/public/js/components/profile-coops.js | 1 + .../public/js/components/profile-general.js | 662 +------- Server/public/js/components/profile-groups.js | 705 +------- .../public/js/components/profile-parties.js | 1 + .../public/js/components/select-component.js | 594 +------ .../public/js/components/signup-component.js | 604 +------ .../public/js/components/switch-component.js | 210 +-- Server/public/js/libraries/authTools.js | 5 +- Server/public/js/libraries/mapTools.js | 82 +- Server/routes.jl | 11 +- 70 files changed, 2033 insertions(+), 18556 deletions(-) create mode 100644 Server/app/svelte/public/css/navbar.css create mode 100644 Server/db/migrations/2022026611846577_create_table_users_groups.jl create mode 100644 Server/public/js/components/index-0f28c1ea.js create mode 100644 Server/public/js/components/index-720c0a59.js create mode 100644 Server/public/js/components/index-db20528a.js create mode 100644 Server/public/js/components/index-e7d4b1a1.js create mode 100644 Server/public/js/components/profile-communes.js create mode 100644 Server/public/js/components/profile-coops.js create mode 100644 Server/public/js/components/profile-parties.js diff --git a/Server/app/resources/authentication/AuthenticationController.jl b/Server/app/resources/authentication/AuthenticationController.jl index 45d7f43..f2729bf 100644 --- a/Server/app/resources/authentication/AuthenticationController.jl +++ b/Server/app/resources/authentication/AuthenticationController.jl @@ -91,7 +91,7 @@ const auth_info = Dict( controller = "authentication" const dict_layouts = Dict( :auth => generate_layout_html("main",controller,"auth",libraries=["GoogleAuth"]), - :profile => generate_layout_html("main",controller,"profile"), + :profile => generate_layout_html("main",controller,"profile",libraries=["Leaflet"]), :email_confirmation => generate_layout_html("main",controller,"email_confirmation"), ) diff --git a/Server/app/resources/groups/GroupsController.jl b/Server/app/resources/groups/GroupsController.jl index bf2432a..d6cf7b5 100644 --- a/Server/app/resources/groups/GroupsController.jl +++ b/Server/app/resources/groups/GroupsController.jl @@ -1,10 +1,10 @@ module GroupsController -using Genie, Genie.Renderer, Genie.Renderer.Html, Genie.Requests, GenieAuthentication +using Genie, Genie.Renderer, Genie.Renderer.Html, Genie.Requests, GenieAuthentication, DataFrames using JSON3 -using SearchLight -using Server.DatabaseSupport, Server.TemplateEditor -import Server.DatabaseSupport: select_from_table +using SearchLight,SearchLightPostgreSQL, LibPQ, JSON3 +using Server.DatabaseSupport, Server.TemplateEditor, Server.Users +import Server.DatabaseSupport: select_from_table, insert_into_table, delete_from_table, exist_in_table controller = "groups" dict_layouts = Dict( @@ -34,8 +34,61 @@ function get_locale() end end +#---Helpers----------------------------------------------------------- + + +function table_to_json(name,df) + ar = [] + for df_row in eachrow(df) + dict = Dict() + for id in names(df_row) + dict[id] = df_row[id] + end + push!(ar,dict) + end + open("public/assets/"*name*".json", "w") do io + JSON3.write(io, ar) + end +end + +function compile(name) + df = select_from_table([name => ["*"]]) + table_to_json(name,df) +end + +function move_requests(name) + df_requests = select_from_table(["$(name)_requests" => ["*"]], where_data=["verified" => true, "added" => false]) + df = select_from_table([name => ["*"]]) + latitudes = df.latitude + longitudes = df.longitude + for df_row in eachrow(df_requests) + ind_id_given = ismissing(df_row.id_given) ? nothing : findfirst(df_row.id_given.==df.id) + if (!isnothing(ind_id_given)) + id = df[ind_id_given,:id] + row_found = df[ind_id_given,Not(:id)] + dict = Dict(zip(names(row_found),values(row_found))) + dict["members"] += 1 + update_table(name,dict, where_data=["id" => id]) + else + id = df_row.id + dict_update = Dict("added" => true) + update_table("$(name)_requests",dict_update, where_data=["id" => id]) + + df_row_to_add = df_row[Not(:id_given)] + df_row_to_add = df_row_to_add[Not(:verified)] + df_row_to_add = df_row_to_add[Not(:added)] + df_row_to_add = df_row_to_add[Not(:id)] + dict = Dict(zip(names(df_row_to_add),values(df_row_to_add))) + dict["members"] = 1 + insert_into_table(name,dict) + end + end +end + #---Functions--------------------------------------------------------- +current_user() = findone(Users.User, id = get_authentication()) + function groups() locale = get_locale() html(:groups,:groups, layout = dict_layouts[:groups], context = @__MODULE__, @@ -53,17 +106,156 @@ function groups_add() end function groups_add_post() - data = jsonpayload() - insert_into_table("groups_requests",data) + data = copy(jsonpayload()) + mode = data["mode"] + delete!(data,"mode") + user = current_user() + user_id = user.id + if mode==0 # Create + if user.verified + existing_user_group_data = select_from_table(["users_groups" => ["*"]], where_data=["user_id" => user_id]) + has_group = !isempty(existing_user_group_data) + delete!(data,"group_id") + group_id = insert_into_table("groups",data, "RETURNING id")[1,1] + if has_group + user_groups_id = existing_user_group_data[1,"id"] + prev_group_id = existing_user_group_data[1,"group_id"] + update_table("users_groups",Dict("group_id" => group_id), where_data=["id" => user_groups_id]) + members = select_from_table(["groups" => ["members"]], where_data=["id" => prev_group_id])[1,1] + if (members==1) + delete_from_table("groups",["id" => prev_group_id]) + else + update_table("groups",Dict("members" => members - 1), where_data=["id" => id]) + end + else + dict_users_groups = Dict("user_id" => user.id, "group_id" => group_id) + insert_into_table("users_groups",dict_users_groups) + end + compile("groups") + else + data["status"] = 0 + data["user_id"] = user_id + insert_into_table("groups_requests",data) + end + elseif mode==1 # Join + data["user_id"] = user_id + if exist_in_table("users_groups",["group_id" => data["group_id"]]) + if exist_in_table("groups_requests",["user_id" => user_id]) + delete_from_table("groups_requests",["user_id" => user_id]) + end + data["status"] = 0 + insert_into_table("groups_requests",data) + else + group_id = data["group_id"] + members = select_from_table("groups" => ["members"], where_data = ["id" => group_id])[1,1] + dict = Dict("members" => members + 1) + update_table("groups",dict, where_data=["id" => group_id]) + dict_users_groups = Dict("user_id" => user_id, "group_id" => group_id) + insert_into_table("users_groups",dict_users_groups) + end + + elseif mode==2 # Move + existing_user_group_data = select_from_table(["users_groups" => ["*"]], where_data=["user_id" => user_id]) + group_id = existing_user_group_data[1,"group_id"] + delete!(data,"group_id") + delete!(data,"members") + delete!(data,"contact") + update_table("groups",data, where_data=["id" => group_id]) + compile("groups") + elseif mode==3 # Leave + existing_user_group_data = select_from_table(["users_groups" => ["*"]], where_data=["user_id" => user_id]) + if size(existing_user_group_data,1)==0 + if exist_in_table("groups_requests",["user_id" => user_id]) + delete_from_table("groups_requests",["user_id" => user_id]) + end + else + delete_from_table("users_groups",["user_id" => user_id]) + end + end + return nothing end function get_user_groups() + local data_dicts user_id = get_authentication() - data = select_from_table("groups" => ["*"], - where_data = ["user_id" => user_id]) - ns = names(data) - data_dict = map(x -> Dict(zip(ns,values(x))),eachrow(data)) - return JSON3.write(data_dict) + groups_ids = select_from_table("users_groups" => ["group_id"], where_data = ["user_id" => user_id])[:,1] + group_id = isempty(groups_ids) ? nothing : groups_ids[1] + data_dicts = [] + if isnothing(group_id) + local data + data = select_from_table("groups_requests" => ["*"], where_data = ["user_id" => user_id,"status" => 0]) + if size(data,1)==0 + data = select_from_table("groups_requests" => ["*"], where_data = ["user_id" => user_id,"status" => 2]) + if size(data,1)!=0 + data = data[[end],:] + end + end + for row in eachrow(data) + dict = Dict(zip(names(row),values(row))) + if (!ismissing(row["group_id"])) + extra_data = select_from_table("groups" => ["*"], where_data = ["id" => row["group_id"]]) + merge!(dict, Dict(zip(names(extra_data[1,:]),values(extra_data[1,:])))) + end + push!(data_dicts, dict) + end + else + group_data = select_from_table("groups" => ["*"], where_data = ["id" => group_id]) + ns = names(group_data) + data_dicts = map(x -> Dict(zip(ns,values(x))),eachrow(group_data)) + end + return JSON3.write(data_dicts) +end + +function get_group_requests() + user_id = get_authentication() + groups_ids = select_from_table("users_groups" => ["group_id"], where_data = ["user_id" => user_id])[:,1] + group_id = isempty(groups_ids) ? nothing : groups_ids[1] + data_dicts = [] + if !isnothing(group_id) + user_ids = select_from_table("groups_requests" => ["user_id"], where_data = ["group_id" => group_id, "status" => 0])[:,1] + for user2_id in user_ids + email = select_from_table("users" => ["email"], where_data = ["id" => user2_id])[1,1] + push!(data_dicts,Dict("email" => email, "user_id" => user2_id)) + end + end + return JSON3.write(data_dicts) +end + +function approve_request() + data = copy(jsonpayload()) + user_id = get_authentication() + groups_ids = select_from_table("users_groups" => ["group_id"], where_data = ["user_id" => user_id])[:,1] + group_id = isempty(groups_ids) ? nothing : groups_ids[1] + members = select_from_table("groups" => ["members"], where_data = ["id" => group_id])[1,1] + dict = Dict("members" => members + 1) + update_table("groups",dict, where_data=["id" => group_id]) + update_table("groups_requests",Dict("status" => 1), where_data=["group_id" => group_id, "user_id" => data["user_id"]]) + dict_users_groups = Dict("user_id" => data["user_id"], "group_id" => group_id) + insert_into_table("users_groups",dict_users_groups) + return nothing +end + +function reject_request() + data = copy(jsonpayload()) + user_id = get_authentication() + groups_ids = select_from_table("users_groups" => ["group_id"], where_data = ["user_id" => user_id])[:,1] + group_id = isempty(groups_ids) ? nothing : groups_ids[1] + update_table("groups_requests",Dict("status" => 2), where_data=["group_id" => group_id, "user_id" => data["user_id"]]) + return nothing +end + +function add_verified_groups() + groups_create_requests_verified = select_from_table("groups_requests" => ["*"], where_data = ["group_id" => nothing, "status" => 1]) + data = Dict(zip(names(groups_create_requests_verified),groups_create_requests_verified[end,:])) + user_id = data["user_id"] + delete!(data,"group_id") + delete!(data,"user_id") + delete!(data,"id") + delete!(data,"status") + group_id = insert_into_table("groups",data, "RETURNING id")[1,1] + dict_users_groups = Dict("user_id" => user_id, "group_id" => group_id) + insert_into_table("users_groups",dict_users_groups) + delete_from_table("groups_requests",["user_id" => user_id]) end end diff --git a/Server/app/svelte/public/css/auth.css b/Server/app/svelte/public/css/auth.css index e619dd9..bad03a9 100644 --- a/Server/app/svelte/public/css/auth.css +++ b/Server/app/svelte/public/css/auth.css @@ -169,3 +169,12 @@ label { margin-top: -0.2rem; color: #5f5f5f; } + +#content { + position: relative; + display: flex; + justify-content: space-between; + flex-direction: column; + height: 100%; + min-height: 100vh; +} \ No newline at end of file diff --git a/Server/app/svelte/public/css/navbar.css b/Server/app/svelte/public/css/navbar.css new file mode 100644 index 0000000..67b76b3 --- /dev/null +++ b/Server/app/svelte/public/css/navbar.css @@ -0,0 +1,268 @@ + /* Header */ + #navbar{ + position: relative; + top: 0; + width: min(100%,116rem); + z-index: 1000000000; + height: 5.26rem; + padding-left: 0rem; + padding-right: 0rem; +} + +#navbar * { + font-family: var(--sans-serif, sans-serif); +} + +/* Logo */ +#logo-container { + display: flex; + position: absolute; + margin-left: 1rem; + height: 100%; + max-height: 5.26rem; + color: black; + z-index: 1; + flex-direction: row; + flex-wrap: nowrap; + align-items: center; +} + +#navbar-logo { + height: 3.5rem; + width: 3.5rem; + object-fit: contain; + border-radius: 10rem; +} + +#navbar-logo-text { + position: relative; + word-wrap: normal; + height: 100%; + line-height: 400%; + font-size: 1.4rem; + color: #292222; + font-family: var(--sans-serif, sans-serif); + font-weight: 400; + padding-left: 1.2rem; +} + +/* Nav menu */ +#nav { + position: fixed; + width: 100%; + height: 100%; + background-color: white; + overflow: hidden; + z-index: 0; +} +#menu > li > a, .options-button { + display: block; + padding: 1.2rem; + padding-top: 1rem; + padding-bottom: 1rem; + color: black; + font-size: 1.4rem; +} + +#menu > li > a:active{ + +} + +#menu li { + list-style-type: none; +} + +#nav{ + max-height: 0; + /*transition: max-height .5s ease-out;*/ +} + +/* Menu Icon */ +#hamb{ + position: absolute; + cursor: pointer; + right: 0rem; + padding: 2.8rem 2rem; + z-index: 9999; +}/* Style label tag */ + +#hamb-line { + background: black; + display: block; + height: 2px; + position: relative; + width: 24px; + +} /* Style span tag */ + +#hamb-line::before, +#hamb-line::after{ + background: black; + content: ''; + display: block; + height: 100%; + position: absolute; + transition: all .2s ease-out; + width: 100%; +} +#hamb-line::before{ + top: 5px; +} +#hamb-line::after{ + top: -5px; +} + +#side-menu { + display: none; +} /* Hide checkbox */ + +/* Toggle menu icon */ +#side-menu:checked ~ nav { + display: block; + max-height: 100%; + padding-top: 5.625rem; +} + +#side-menu:checked ~ #logo-container { + position: fixed; +} + +#side-menu:checked ~ #hamb { + position: fixed; +} + +#side-menu:checked ~ #logo-container { + position: fixed; +} + +#side-menu:checked ~ #hamb #hamb-line { + background: transparent; +} + +#side-menu:checked ~ #hamb #hamb-line::before { + transform: rotate(-45deg); + top: 0; +} + +#side-menu:checked ~ #hamb #hamb-line::after { + transform: rotate(45deg); + top: 0; +} + +/* Options */ + +.options-dropdown { + position: absolute; + display: none; + top: 5.6rem; + right: 1.8rem; + border: #404040 solid 0.1rem; + background-color: white; + z-index: 10; +} + +.options-dropdown button, .options-dropdown a { + display: block; + font-family: var(--sans-serif,sans-serif); + font-size: 1.2rem; + width: 100%; + padding: 1rem; + text-align: left; +} + +.options-dropdown button:hover, .options-dropdown a:hover { + background-color: var(--red); + color: white; +} + +.options-button { + width: 100%; + text-align: left; +} + +/* Localization */ + +#locales { + position: relative; +} + +#locales button { + width: 100%; + text-align: left; + height: 4rem; +} + +#locales button:hover { + opacity: 0.5; +} + +#locales-img { + position: relative; + top: 0rem; + height: 2rem; + margin-left: 1.2rem; +} + +/* +#options-dropdown>:first-child { + padding-bottom: 0.5rem; +} + +#options-dropdown>:nth-child(2) { + padding-top: 0.5rem; +} +*/ + +/* Responsiveness */ +@media only screen and (min-width: 1200px) { + + #navbar { + position: relative; + width: min(100%,116rem); + left: 50%; + transform: translateX(-50%); + padding-right: 4rem; + padding-left: 4rem; + } + + #nav { + max-height: none; + top: 0; + position: relative; + float: right; + width: fit-content; + background-color: transparent; + overflow: visible; + } + + #side-menu:checked ~ nav { + padding-top: 0; + } + + #menu li { + float: left; + } + + #menu > li > a:hover, .options-button:hover, #navbar-logo-text:hover { + color: rgb(127, 127, 127); + } + + #menu > li > a, .options-button { + padding: 0.9rem; + padding-top: 1.9rem; + padding-bottom: 1.9rem; + } + + #hamb { + display: none; + } + + #locales { + position: relative; + margin-right: 1.8rem; + } + + #locales-img { + top: 0.9rem; + } +} \ No newline at end of file diff --git a/Server/app/svelte/public/js/libraries/authTools.js b/Server/app/svelte/public/js/libraries/authTools.js index c1b98d0..e7aa71b 100644 --- a/Server/app/svelte/public/js/libraries/authTools.js +++ b/Server/app/svelte/public/js/libraries/authTools.js @@ -1,12 +1,15 @@ import {getData, sendData} from "/js/libraries/serverTools.js" -export function getUser(user,callbackOuter) { +export function getUser(user,loaded,callbackOuter) { let callback = function(response) { Object.assign(user,JSON.parse(response)) if(callbackOuter!=undefined) { callbackOuter() } + loaded.update((val) => { + return val + 1 + }) } getData("/xx/get-user",callback) } diff --git a/Server/app/svelte/public/js/libraries/mapTools.js b/Server/app/svelte/public/js/libraries/mapTools.js index 1f9cfb4..1995190 100644 --- a/Server/app/svelte/public/js/libraries/mapTools.js +++ b/Server/app/svelte/public/js/libraries/mapTools.js @@ -10,7 +10,7 @@ export function translate(content, x) { } } -function addMarkersToLayer(g,layer,content,locale,addPinContent,markerColor) { +function addMarkersToLayer(g,layer,content,locale,addPinContent,markerColor,options) { let {text,coordinates} = addPinContent(g,content,locale) var markerIcon = new L.Icon({ iconUrl: 'https://www.libsoc.org/img/common/markers/marker-' + markerColor + '.png', @@ -21,57 +21,69 @@ function addMarkersToLayer(g,layer,content,locale,addPinContent,markerColor) { shadowSize: [41, 41] }) let marker = L.marker(coordinates, {icon: markerIcon}) + marker.id = g.id + marker.members = g.members + marker.contact = g.contact marker.addTo(layer).bindPopup(text) + + if (options.pinCallback!=undefined) { + marker.on('click', (event) => options.pinCallback(marker,event)) + } } -export function addMarkersEntries(entries,entriesByCountry,map,content,locale,addPinContent,markerColor) { +export function addMarkersEntries(entries,entriesByCountry,map,content,locale,addPinContent,markerColor,options) { let entriesMarkersLayer = L.layerGroup() let entriesMarkersLayerOut = L.layerGroup() let entriesMarkersLayerIn = L.layerGroup() for (let g of entries) { if (g.country!="Online" && g.country!="Worldwide") { - addMarkersToLayer(g,entriesMarkersLayerIn,content,locale,addPinContent,markerColor) + addMarkersToLayer(g,entriesMarkersLayerIn,content,locale,addPinContent,markerColor,options) } } - for (let gs of Object.values(entriesByCountry)) { - if (gs.length==1) { - let g = {...gs[0]} - g.country = [g.country] - if (g.country!="Online" && g.country!="Worldwide") { - addMarkersToLayer(g,entriesMarkersLayerOut,content,locale,addPinContent,markerColor) + if (options.enableCountryGrouping) { + for (let gs of Object.values(entriesByCountry)) { + if (gs.length==1) { + let g = {...gs[0]} + g.country = [g.country] + if (g.country!="Online" && g.country!="Worldwide") { + addMarkersToLayer(g,entriesMarkersLayerOut,content,locale,addPinContent,markerColor,options) + } } - } - else { - if (gs[0].country!="Online" && gs[0].country!="Worldwide") { - let locationName = gs[0].country - let locationCoordinates = [0,0] - let members = 0 - let contact = gs[0].contact - for (let g of gs) { - locationCoordinates[0] += g.latitude - locationCoordinates[1] += g.longitude - members += g.members - if (g.contact[0]!=gs[0].contact[0]) { - contact = contactGeneral + else { + if (gs[0].country!="Online" && gs[0].country!="Worldwide") { + let locationName = gs[0].country + let locationCoordinates = [0,0] + let members = 0 + let contact = gs[0].contact + for (let g of gs) { + locationCoordinates[0] += g.latitude + locationCoordinates[1] += g.longitude + members += g.members + if (g.contact[0]!=gs[0].contact[0]) { + contact = contactGeneral + } } + locationCoordinates[0] = locationCoordinates[0]/gs.length + locationCoordinates[1] = locationCoordinates[1]/gs.length + let gNew = { + country: locationName, + latitude: locationCoordinates[0], + longitude: locationCoordinates[1], + members: members, + contact: contact + } + addMarkersToLayer(gNew,entriesMarkersLayerOut,content,locale,addPinContent,markerColor,options) } - locationCoordinates[0] = locationCoordinates[0]/gs.length - locationCoordinates[1] = locationCoordinates[1]/gs.length - let gNew = { - country: locationName, - latitude: locationCoordinates[0], - longitude: locationCoordinates[1], - members: members, - contact: contact - } - addMarkersToLayer(gNew,entriesMarkersLayerOut,content,locale,addPinContent,markerColor) } } + entriesMarkersLayerOut.addTo(entriesMarkersLayer) + map.on("zoomend", () => onZoomEnd(map,entriesMarkersLayer,entriesMarkersLayerOut,entriesMarkersLayerIn)) + } + else { + entriesMarkersLayerIn.addTo(entriesMarkersLayer) } - - entriesMarkersLayerOut.addTo(entriesMarkersLayer) entriesMarkersLayer.addTo(map) - map.on("zoomend", () => onZoomEnd(map,entriesMarkersLayer,entriesMarkersLayerOut,entriesMarkersLayerIn)) + return entriesMarkersLayer } diff --git a/Server/app/svelte/src/auth/auth-component.svelte b/Server/app/svelte/src/auth/auth-component.svelte index 8d4013d..416dc2c 100644 --- a/Server/app/svelte/src/auth/auth-component.svelte +++ b/Server/app/svelte/src/auth/auth-component.svelte @@ -67,6 +67,7 @@ \ No newline at end of file diff --git a/Server/app/svelte/src/navbar/navbar-not-logged.svelte b/Server/app/svelte/src/navbar/navbar-not-logged.svelte index aeb48d3..e3004ae 100644 --- a/Server/app/svelte/src/navbar/navbar-not-logged.svelte +++ b/Server/app/svelte/src/navbar/navbar-not-logged.svelte @@ -147,274 +147,5 @@ \ No newline at end of file diff --git a/Server/app/svelte/src/profile/profile-communes.svelte b/Server/app/svelte/src/profile/profile-communes.svelte index 5593cb7..e5d2619 100644 --- a/Server/app/svelte/src/profile/profile-communes.svelte +++ b/Server/app/svelte/src/profile/profile-communes.svelte @@ -14,7 +14,16 @@ +

Under development

+ +

Visit https://discord.gg/Qk8KUk787z and ask for your commune to be added.

\ No newline at end of file diff --git a/Server/app/svelte/src/profile/profile-component.svelte b/Server/app/svelte/src/profile/profile-component.svelte index 42daeaf..373d078 100644 --- a/Server/app/svelte/src/profile/profile-component.svelte +++ b/Server/app/svelte/src/profile/profile-component.svelte @@ -4,6 +4,7 @@ // Import libraries import { onMount, afterUpdate, setContext } from 'svelte' + import { writable } from 'svelte/store' import * as AuthTools from "/js/libraries/authTools.js" import {svgFromObject} from "/js/libraries/miscTools.js" @@ -11,6 +12,10 @@ import "/js/components/pane-aligner.js" import "/js/components/profile-general.js" import "/js/components/profile-groups.js" + import "/js/components/profile-communes.js" + import "/js/components/profile-coops.js" + import "/js/components/profile-parties.js" + import "/js/components/groups-add-component.js" // Main code AuthTools.redirectNotLogged() @@ -22,6 +27,7 @@ let coops let parties let panes + let groupsAdd let generalButton let groupsButton @@ -29,11 +35,17 @@ let coopsButton let partiesButton let buttons + + let currentPaneIndex = 0 let locationPopup + let maps = {} + let user = {} - AuthTools.getUser(user) + let loaded = writable(0) + let reloadTriggerVal = writable(0) + AuthTools.getUser(user,loaded) function changePane(pane,button) { for (let p of panes) { @@ -48,10 +60,24 @@ } function styleField(div,weight,color) { - div.style.fontWeight = weight let svgObject = div.querySelector("object") - let svgItem = svgFromObject(svgObject) - svgItem.setAttribute("fill", color) + if (svgObject==null) { + let f = () => styleField(div,weight,color) + setTimeout(f,100) + } + else { + let svgItem = svgFromObject(svgObject) + if (svgItem==null) { + let f = () => styleField(div,weight,color) + setTimeout(f,100) + } + else { + div.style.fontWeight = weight + svgItem.setAttribute("fill", color) + } + } + + } function fillFields() { @@ -59,37 +85,54 @@ for (let b of buttons) { styleField(b,400,"#636363") } - styleField(generalButton,500,"#c52a28") + styleField(buttons[currentPaneIndex],500,"#c52a28") } else { setTimeout(fillFields, 100) } } - function showLocationOverlay() { - locationPopup.style.display = "block" + function valid(el) { + return (el!=undefined) && (el!=null) } - setContext("profile-component",showLocationOverlay) - - onMount(() => { - general.user = user - + function init() { panes = [general,groups,communes,coops,parties] buttons = [generalButton,groupsButton,communesButton,coopsButton,partiesButton] + if ($loaded==1 && panes.every(x => valid(x)) && buttons.every(x => valid(x))) { + panes = [general,groups,communes,coops,parties] + buttons = [generalButton,groupsButton,communesButton,coopsButton,partiesButton] - fillFields() - general.style.display = "initial" + fillFields() + general.style.display = "initial" + } + else { + let f = () => init() + setTimeout(f,100) + } + } + + function reloadTrigger() { + reloadTriggerVal.update((val) => { + return val + 1 + }) + } + + setContext("profile-component",{user,maps,reloadTrigger}) + + onMount(() => { + init() }) +
- - - - - + {#key $loaded} + {#if $loaded==1} + + + + + + {/if} + {/key}
@@ -131,34 +178,6 @@ @import '/css/common.css'; - #location-overlay-content { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - height: 40rem; - width: 40rem; - background: white; - z-index: 10000; - } - - .overlay { - top: 0; - position: absolute; - width: 100%; - height: 100%; - z-index: 10000; - } - - .overlay-button { - position: absolute; - background: gray; - opacity: 0.5; - width: 100vw; - height: 100vh; - z-index: 1000; - } - #general-img { top: 0rem; } diff --git a/Server/app/svelte/src/profile/profile-coops.svelte b/Server/app/svelte/src/profile/profile-coops.svelte index 4a9e106..5c98721 100644 --- a/Server/app/svelte/src/profile/profile-coops.svelte +++ b/Server/app/svelte/src/profile/profile-coops.svelte @@ -14,7 +14,16 @@ +

Under development

+ +

Visit https://discord.gg/Qk8KUk787z and ask for your cooperative to be added.

\ No newline at end of file diff --git a/Server/app/svelte/src/profile/profile-general.svelte b/Server/app/svelte/src/profile/profile-general.svelte index a3b08b6..bbe6470 100644 --- a/Server/app/svelte/src/profile/profile-general.svelte +++ b/Server/app/svelte/src/profile/profile-general.svelte @@ -3,7 +3,7 @@ {#key $loaded} - {#if $loaded==1} - -

Groups

-

My group

-
+ {#if $loaded==numLoaded} +
+

Groups

-
- Location: -
- +

My group

+ +
+
+
+
+ Location: +
+ +
-
-
-
- Members: -
- - showSaveButton(saveMembersButton)}> - +
+
+ Members: +
+
+ +
+ showSaveButton(saveMembersButton,membersInput)}> + +
-
-
-
- Contact: -
- - showSaveButton(saveContactButton)}> - +
+
+ Contact: +
+
+ +
+ showSaveButton(saveContactButton,contactInput)}> + +
-
-
-

Requests

-
- -
+ +

Requests

+
+ {#key keyRequests} + {#each groupsRequests as req,ind} +
+
+ {req.email} +
+ + +
+
+
+ {/each} + {/key} +
+ + + {/if} {/key} @@ -163,10 +298,42 @@ \ No newline at end of file diff --git a/Server/app/svelte/src/profile/profile-parties.svelte b/Server/app/svelte/src/profile/profile-parties.svelte index a21ff29..e4dcc3b 100644 --- a/Server/app/svelte/src/profile/profile-parties.svelte +++ b/Server/app/svelte/src/profile/profile-parties.svelte @@ -14,7 +14,16 @@ +

Under development

+ +

Visit https://discord.gg/Qk8KUk787z and ask for your party to be added.

\ No newline at end of file diff --git a/Server/db/migrations/2022026611846565_create_table_groups.jl b/Server/db/migrations/2022026611846565_create_table_groups.jl index 3d07cdc..24dd9d3 100644 --- a/Server/db/migrations/2022026611846565_create_table_groups.jl +++ b/Server/db/migrations/2022026611846565_create_table_groups.jl @@ -2,6 +2,9 @@ module CreateTableGroups import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table +include("../../lib/DatabaseSupport.jl") +import .DatabaseSupport: add_foreign_key, add_index + function up() create_table(:groups) do [ diff --git a/Server/db/migrations/2022026611846569_create_table_groups_requests.jl b/Server/db/migrations/2022026611846569_create_table_groups_requests.jl index 8f208aa..dba2823 100644 --- a/Server/db/migrations/2022026611846569_create_table_groups_requests.jl +++ b/Server/db/migrations/2022026611846569_create_table_groups_requests.jl @@ -4,6 +4,7 @@ import SearchLight.Migrations: create_table, column, primary_key, add_index, dro include("../../lib/DatabaseSupport.jl") using .DatabaseSupport +import .DatabaseSupport: add_foreign_key, add_index, set_default function up() create_table(:groups_requests) do @@ -17,8 +18,10 @@ function up() column(:contact, :string) column(:latitude, :float) column(:longitude, :float) - column(:verified, :bool) + column(:longitude, :float) + column(:members,:integer) column(:added, :bool) + column(:status,:Integer) ] end @@ -27,7 +30,6 @@ function up() add_index(:groups_requests, :user_id) - set_default("groups_requests","verified",false) set_default("groups_requests","added",false) end diff --git a/Server/db/migrations/2022026611846577_create_table_users_groups.jl b/Server/db/migrations/2022026611846577_create_table_users_groups.jl new file mode 100644 index 0000000..dae9e57 --- /dev/null +++ b/Server/db/migrations/2022026611846577_create_table_users_groups.jl @@ -0,0 +1,27 @@ +module CreateTableUsersGroups + +import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table + +include("../../lib/DatabaseSupport.jl") +import .DatabaseSupport: add_foreign_key, add_index + +function up() + create_table(:users_groups) do + [ + primary_key() + column(:user_id, :int) + column(:group_id, :int) + ] + end + + add_foreign_key(:users_groups,:user_id,:users,:id) + add_foreign_key(:users_groups,:group_id,:groups,:id) + add_index(:users_groups, :user_id) + add_index(:users_groups, :group_id) +end + +function down() + drop_table(:users_groups) +end + +end \ No newline at end of file diff --git a/Server/lib/DatabaseSupport.jl b/Server/lib/DatabaseSupport.jl index ee30e3e..69e4a45 100644 --- a/Server/lib/DatabaseSupport.jl +++ b/Server/lib/DatabaseSupport.jl @@ -4,7 +4,7 @@ module DatabaseSupport using SearchLight, SearchLightPostgreSQL, LibPQ using DataFrames -export exist_in_table, insert_into_table, update_table, select_from_table, add_foreign_key, set_default +export exist_in_table, insert_into_table, update_table, select_from_table, delete_from_table, add_foreign_key, set_default options = SearchLight.Configuration.read_db_connection_data("db/connection.yml") conn = SearchLight.connect(options) @@ -19,15 +19,22 @@ function format(x) end end -function insert_into_table(table_name,dict_values) +function insert_into_table(table_name,dict_values,other="") names_string = join(keys(dict_values),", ") vals_raw = values(dict_values) vals = map(x -> format(x),vals_raw) vals_string = join(values(vals),", ") - query = "INSERT INTO $table_name ($names_string) VALUES ($vals_string)" + query = "INSERT INTO $table_name ($names_string) VALUES ($vals_string) " * other + return SearchLight.query(query) +end + +function delete_from_table(table_name,where_data) + query = "DELETE FROM $table_name" + if !isnothing(where_data) + query *= where_query(where_data) + end SearchLight.query(query) - return nothing end function update_table(table_name,dict_values; where_data=nothing) @@ -46,13 +53,21 @@ function update_table(table_name,dict_values; where_data=nothing) end function where_query(pair::Pair) - return " WHERE $(pair[1]) = $(pair[2])" + if isnothing(pair[2]) + return " WHERE $(pair[1]) is null" + else + return " WHERE $(pair[1]) = $(pair[2])" + end end function where_query(data::Vector{<:Pair}) conds = String[] for pair in data - push!(conds,"$(pair[1]) = $(pair[2])") + if isnothing(pair[2]) + push!(conds, "$(pair[1]) is null") + else + push!(conds,"$(pair[1]) = $(pair[2])") + end end query = " WHERE "*join(conds," AND ") return query diff --git a/Server/public/assets/groups.json b/Server/public/assets/groups.json index 837d187..6a9f5ff 100644 --- a/Server/public/assets/groups.json +++ b/Server/public/assets/groups.json @@ -1 +1 @@ -[{"town":"Atlanta","contact":null,"latitude":33.7243396617476,"longitude":-84.39697265625,"id":9,"members":1,"country":"United States","state":"Georgia"},{"town":null,"contact":null,"latitude":39.98855476000615,"longitude":-105.2105712890625,"id":10,"members":1,"country":"United States","state":"Colorado"},{"town":null,"contact":null,"latitude":28.27955105276024,"longitude":-81.47460937500001,"id":11,"members":1,"country":"United States","state":"Florida"},{"town":"Dublin","contact":null,"latitude":40.13360099478965,"longitude":-83.10607910156251,"id":12,"members":1,"country":"United States","state":"Ohio"},{"town":"Toronto","contact":null,"latitude":43.68959002213805,"longitude":-79.36523437500001,"id":13,"members":1,"country":"Canada","state":"Ontario"},{"town":"Halifax","contact":null,"latitude":44.64996307546047,"longitude":-63.60809326171876,"id":14,"members":1,"country":"Canada","state":"Nova Scotia"},{"town":null,"contact":null,"latitude":53.353612430518126,"longitude":-8.085937500000002,"id":15,"members":1,"country":"Ireland","state":null},{"town":"Cham","contact":null,"latitude":47.18444711300418,"longitude":8.461189270019533,"id":16,"members":1,"country":"Switzerland","state":"Zug"},{"town":"Wiesbaden","contact":null,"latitude":50.085975903187155,"longitude":8.240432739257814,"id":17,"members":1,"country":"Germany","state":"Hesse"},{"town":"Copenhagen","contact":null,"latitude":55.68832070332783,"longitude":12.568359375000002,"id":18,"members":1,"country":"Denmark","state":"Capital Region of Denmark"},{"town":"Kolding","contact":null,"latitude":55.5095568556412,"longitude":9.486694335937502,"id":19,"members":1,"country":"Denmark","state":null},{"town":"Municipal Unit of Moschato","contact":null,"latitude":37.950275539773436,"longitude":23.673992156982425,"id":20,"members":1,"country":"Greece","state":"Attica"},{"town":"Varna","contact":null,"latitude":43.18381722560103,"longitude":27.905273437500004,"id":21,"members":1,"country":"Bulgaria","state":null},{"town":"Riga","contact":null,"latitude":56.966939887376796,"longitude":24.142456054687504,"id":22,"members":1,"country":"Latvia","state":"Vidzeme"},{"town":"Kohtla-Järve linn","contact":null,"latitude":59.40196127188141,"longitude":27.28042602539063,"id":23,"members":1,"country":"Estonia","state":null},{"town":"Tallinn","contact":null,"latitude":59.39656672058008,"longitude":24.72610473655427,"id":24,"members":1,"country":"Estonia","state":null},{"town":"Chiang Mai","contact":null,"latitude":18.796128352413316,"longitude":98.98753015423392,"id":25,"members":1,"country":"Thailand","state":null}] \ No newline at end of file +[{"town":null,"contact":null,"latitude":52.16045455774706,"longitude":36.21093750000001,"id":39,"members":1,"country":"Russia","state":"Kursk Oblast"}] \ No newline at end of file diff --git a/Server/public/css/auth.css b/Server/public/css/auth.css index e619dd9..bad03a9 100644 --- a/Server/public/css/auth.css +++ b/Server/public/css/auth.css @@ -169,3 +169,12 @@ label { margin-top: -0.2rem; color: #5f5f5f; } + +#content { + position: relative; + display: flex; + justify-content: space-between; + flex-direction: column; + height: 100%; + min-height: 100vh; +} \ No newline at end of file diff --git a/Server/public/css/navbar.css b/Server/public/css/navbar.css index edb7355..67b76b3 100644 --- a/Server/public/css/navbar.css +++ b/Server/public/css/navbar.css @@ -1,11 +1,12 @@ - -/* Header */ -#navbar{ + /* Header */ + #navbar{ position: relative; top: 0; width: min(100%,116rem); - z-index: 1000; + z-index: 1000000000; height: 5.26rem; + padding-left: 0rem; + padding-right: 0rem; } #navbar * { @@ -35,11 +36,9 @@ #navbar-logo-text { position: relative; - width: auto; + word-wrap: normal; height: 100%; line-height: 400%; - white-space: nowrap; - text-align: center; font-size: 1.4rem; color: #292222; font-family: var(--sans-serif, sans-serif); @@ -56,20 +55,17 @@ overflow: hidden; z-index: 0; } -#menu a { +#menu > li > a, .options-button { display: block; - padding: 1.9rem; + padding: 1.2rem; padding-top: 1rem; padding-bottom: 1rem; color: black; font-size: 1.4rem; } -#menu a:hover { - background-color: rgb(220, 220, 220); -} -#menu a:active{ - background-color: #f7aec0; +#menu > li > a:active{ + } #menu li { @@ -145,49 +141,88 @@ #side-menu:checked ~ #hamb #hamb-line::before { transform: rotate(-45deg); - top:0; + top: 0; } #side-menu:checked ~ #hamb #hamb-line::after { transform: rotate(45deg); - top:0; + top: 0; } -#cart-icon { - height: 1.8rem; - pointer-events: none; +/* Options */ + +.options-dropdown { + position: absolute; + display: none; + top: 5.6rem; + right: 1.8rem; + border: #404040 solid 0.1rem; + background-color: white; + z-index: 10; } -#menu a:hover div { - filter: saturate(50%) brightness(140%); +.options-dropdown button, .options-dropdown a { + display: block; + font-family: var(--sans-serif,sans-serif); + font-size: 1.2rem; + width: 100%; + padding: 1rem; + text-align: left; } -#menu a:hover svg { - stroke: rgb(127, 127, 127);; -} - -#cart-counter { - position: relative; - top: -2.8rem; - left: 1.6rem; - width: 1.3rem; - height: 1.3rem; - border-radius: 3.4rem; - font-family: var(--sans-serif, sans-serif); - font-size: 1rem; - text-align: center; +.options-dropdown button:hover, .options-dropdown a:hover { + background-color: var(--red); color: white; - background: var(--pink); } +.options-button { + width: 100%; + text-align: left; +} + +/* Localization */ + +#locales { + position: relative; +} + +#locales button { + width: 100%; + text-align: left; + height: 4rem; +} + +#locales button:hover { + opacity: 0.5; +} + +#locales-img { + position: relative; + top: 0rem; + height: 2rem; + margin-left: 1.2rem; +} + +/* +#options-dropdown>:first-child { + padding-bottom: 0.5rem; +} + +#options-dropdown>:nth-child(2) { + padding-top: 0.5rem; +} +*/ /* Responsiveness */ -@media only screen and (min-width: 1500px) { +@media only screen and (min-width: 1200px) { #navbar { + position: relative; + width: min(100%,116rem); left: 50%; - -ms-transform: translateX(-50%); transform: translateX(-50%); + padding-right: 4rem; + padding-left: 4rem; } #nav { @@ -197,23 +232,37 @@ float: right; width: fit-content; background-color: transparent; + overflow: visible; } + + #side-menu:checked ~ nav { + padding-top: 0; + } + #menu li { float: left; } - #menu a:hover { - background-color: transparent; + #menu > li > a:hover, .options-button:hover, #navbar-logo-text:hover { color: rgb(127, 127, 127); } - #menu a { - padding: 1.9rem; + #menu > li > a, .options-button { + padding: 0.9rem; + padding-top: 1.9rem; + padding-bottom: 1.9rem; } - - #hamb { display: none; } + + #locales { + position: relative; + margin-right: 1.8rem; + } + + #locales-img { + top: 0.9rem; + } } \ No newline at end of file diff --git a/Server/public/js/components/auth-component.js b/Server/public/js/components/auth-component.js index d44a68a..c9a6d21 100644 --- a/Server/public/js/components/auth-component.js +++ b/Server/public/js/components/auth-component.js @@ -1,229 +1 @@ - -(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 setContext, o as onMount, g as getContext, e as globals, f as element, h as space, n as noop, j as add_location, k as attr_dev, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks } from './index-998178c7.js'; -import { sendText } from '../../../../../../../../../js/libraries/serverTools.js'; -import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js'; -import '../../../../../../../../../js/components/login-component.js'; -import '../../../../../../../../../js/components/signup-component.js'; - -/* src\auth\auth-component.svelte generated by Svelte v3.52.0 */ - -const { console: console_1 } = globals; -const file = "src\\auth\\auth-component.svelte"; - -function create_fragment(ctx) { - let div2; - let div0; - let login_component; - let t0; - let signup_component; - let t1; - let div1; - let span; - let mounted; - let dispose; - - const block = { - c: function create() { - div2 = element("div"); - div0 = element("div"); - login_component = element("login-component"); - t0 = space(); - signup_component = element("signup-component"); - t1 = space(); - div1 = element("div"); - span = element("span"); - span.textContent = "OR"; - this.c = noop; - add_location(login_component, file, 59, 8, 1652); - add_location(signup_component, file, 60, 8, 1791); - attr_dev(div0, "id", "auth-grid-group"); - add_location(div0, file, 58, 4, 1616); - add_location(span, file, 63, 8, 1983); - attr_dev(div1, "id", "auth-or"); - attr_dev(div1, "class", "pane"); - add_location(div1, file, 62, 4, 1942); - attr_dev(div2, "id", "auth-group"); - add_location(div2, file, 57, 0, 1589); - }, - 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) { - insert_dev(target, div2, anchor); - append_dev(div2, div0); - append_dev(div0, login_component); - /*login_component_binding*/ ctx[3](login_component); - append_dev(div0, t0); - append_dev(div0, signup_component); - /*signup_component_binding*/ ctx[5](signup_component); - append_dev(div2, t1); - append_dev(div2, div1); - append_dev(div1, span); - - if (!mounted) { - dispose = [ - listen_dev(login_component, "click", /*click_handler*/ ctx[4], false, false, false), - listen_dev(login_component, "keydown", keydown_handler, false, false, false), - listen_dev(signup_component, "click", /*click_handler_1*/ ctx[6], false, false, false), - listen_dev(signup_component, "keydown", keydown_handler_1, false, false, false) - ]; - - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div2); - /*login_component_binding*/ ctx[3](null); - /*signup_component_binding*/ ctx[5](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -const keydown_handler = () => ""; -const keydown_handler_1 = () => ""; - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('auth-component', slots, []); - AuthTools.redirectLogged(); - let loginComponent; - let signupComponent; - let context = { googleInit: false }; - setContext("auth", context); - - function switchFocus(component) { - if (component == loginComponent) { - $$invalidate(0, loginComponent.focused = true, loginComponent); - $$invalidate(1, signupComponent.focused = false, signupComponent); - } else { - $$invalidate(0, loginComponent.focused = false, loginComponent); - $$invalidate(1, signupComponent.focused = true, signupComponent); - } - } - - function callbackGoogle(data) { - console.log(data); - sendText("/signup-google", data.credential, response => AuthTools.processLoginResponse(response, context.msgs, context.remember.checked)); - } - - function initGoogle() { - if (typeof google != 'undefined') { - google.accounts.id.initialize({ - client_id: '93612176787-sr8qjqem4e3kok4msrnj8s1illt85a9g.apps.googleusercontent.com', - callback: callbackGoogle, - auto_select: true, - context: "signin" - }); - - context.googleInit = true; - } else { - setTimeout(initGoogle, 100); - } - } - - initGoogle(); - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(` was created with unknown prop '${key}'`); - }); - - function login_component_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - loginComponent = $$value; - $$invalidate(0, loginComponent); - }); - } - - const click_handler = () => switchFocus(loginComponent); - - function signup_component_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - signupComponent = $$value; - $$invalidate(1, signupComponent); - }); - } - - const click_handler_1 = () => switchFocus(signupComponent); - - $$self.$capture_state = () => ({ - onMount, - setContext, - getContext, - sendText, - AuthTools, - loginComponent, - signupComponent, - context, - switchFocus, - callbackGoogle, - initGoogle - }); - - $$self.$inject_state = $$props => { - if ('loginComponent' in $$props) $$invalidate(0, loginComponent = $$props.loginComponent); - if ('signupComponent' in $$props) $$invalidate(1, signupComponent = $$props.signupComponent); - if ('context' in $$props) context = $$props.context; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - loginComponent, - signupComponent, - switchFocus, - login_component_binding, - click_handler, - signup_component_binding, - click_handler_1 - ]; -} - -class Auth_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("auth-component", Auth_component); - -export { Auth_component as default }; +import{S as t,i as o,a as e,b as s,s as n,e as i,c as r,n as a,d as u,f as c,l as m,g as l,r as g,h as p,j as d}from"./index-db20528a.js";import{sendText as f}from"../../../../../../../../../js/libraries/serverTools.js";import*as h from"../../../../../../../../../js/libraries/authTools.js";import"../../../../../../../../../js/components/login-component.js";import"../../../../../../../../../js/components/signup-component.js";function j(t){let o,e,n,p,d,f,h,j,w;return{c(){o=i("div"),e=i("div"),n=i("login-component"),p=r(),d=i("signup-component"),f=r(),h=i("div"),h.innerHTML="OR",this.c=a,u(e,"id","auth-grid-group"),u(h,"id","auth-or"),u(h,"class","pane"),u(o,"id","auth-group")},m(i,r){s(i,o,r),c(o,e),c(e,n),t[3](n),c(e,p),c(e,d),t[5](d),c(o,f),c(o,h),j||(w=[m(n,"click",t[4]),m(n,"keydown",y),m(d,"click",t[6]),m(d,"keydown",b)],j=!0)},p:a,i:a,o:a,d(e){e&&l(o),t[3](null),t[5](null),j=!1,g(w)}}}const y=()=>"",b=()=>"";function w(t,o,e){let s,n;h.redirectLogged();let i={googleInit:!1};function r(t){t==s?(e(0,s.focused=!0,s),e(1,n.focused=!1,n)):(e(0,s.focused=!1,s),e(1,n.focused=!0,n))}function a(t){console.log(t),f("/signup-google",t.credential,(t=>h.processLoginResponse(t,i.msgs,i.remember.checked)))}p("auth",i),function t(){"undefined"!=typeof google?(google.accounts.id.initialize({client_id:"93612176787-sr8qjqem4e3kok4msrnj8s1illt85a9g.apps.googleusercontent.com",callback:a,auto_select:!0,context:"signin"}),i.googleInit=!0):setTimeout(t,100)}();return[s,n,r,function(t){d[t?"unshift":"push"]((()=>{s=t,e(0,s)}))},()=>r(s),function(t){d[t?"unshift":"push"]((()=>{n=t,e(1,n)}))},()=>r(n)]}class k extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},w,j,n,{},null),t&&t.target&&s(t.target,this,t.anchor)}}customElements.define("auth-component",k);export{k as default}; diff --git a/Server/public/js/components/communes-add-component.js b/Server/public/js/components/communes-add-component.js index a588ddc..ea53896 100644 --- a/Server/public/js/components/communes-add-component.js +++ b/Server/public/js/components/communes-add-component.js @@ -1,735 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, m as listen_dev, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { getData, loadLocaleContent, sendData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import '../../../../../../../../../js/components/map-component.js'; -import '../../../../../../../../../js/components/select-component.js'; - -/* src\communes-add-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\communes-add-component.svelte"; - -// (226:4) {#if $loaded==3} -function create_if_block(ctx) { - let div10; - let div9; - let h1; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t4; - let ol; - let li0; - let t6; - let li1; - let t8; - let li2; - let t10; - let li3; - let t12; - let div2; - let label0; - let t14; - let div1; - let input0; - let t15; - let div0; - let t16; - let div5; - let label1; - let t18; - let div4; - let input1; - let t19; - let div3; - let t20; - let div8; - let label2; - let t22; - let div7; - let select_component; - let t23; - let div6; - let t24; - let button; - let t26; - let p1; - let t27; - let map_component; - let map_component_callback_value; - let mounted; - let dispose; - - const block = { - c: function create() { - div10 = element("div"); - div9 = element("div"); - h1 = element("h1"); - h1.textContent = "Add a Commune"; - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - p0.textContent = "If there are no communes near you who you can join and you want to start your own then do the following:"; - t4 = space(); - ol = element("ol"); - li0 = element("li"); - li0.textContent = "Click on the map to show us where you are located;"; - t6 = space(); - li1 = element("li"); - li1.textContent = "Add a way to contact you or leave blank for a pin to point to our discord;"; - t8 = space(); - li2 = element("li"); - li2.textContent = "Press \"Submit\" to add yourself to our map;"; - t10 = space(); - li3 = element("li"); - li3.textContent = "Verify yourself by having a chat with us at our Discord server to show on the map;"; - t12 = space(); - div2 = element("div"); - label0 = element("label"); - label0.textContent = "Location:"; - t14 = space(); - div1 = element("div"); - input0 = element("input"); - t15 = space(); - div0 = element("div"); - t16 = space(); - div5 = element("div"); - label1 = element("label"); - label1.textContent = "Contact:"; - t18 = space(); - div4 = element("div"); - input1 = element("input"); - t19 = space(); - div3 = element("div"); - t20 = space(); - div8 = element("div"); - label2 = element("label"); - label2.textContent = "Status:"; - t22 = space(); - div7 = element("div"); - select_component = element("select-component"); - t23 = space(); - div6 = element("div"); - t24 = space(); - button = element("button"); - button.textContent = "Submit"; - t26 = space(); - p1 = element("p"); - t27 = space(); - map_component = element("map-component"); - add_location(h1, file, 229, 16, 7620); - attr_dev(img, "id", "communes-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/communes.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "communes"); - add_location(img, file, 230, 16, 7660); - attr_dev(p0, "class", "description"); - add_location(p0, file, 231, 16, 7747); - add_location(li0, file, 233, 20, 7922); - add_location(li1, file, 234, 20, 8003); - add_location(li2, file, 235, 20, 8108); - add_location(li3, file, 236, 20, 8181); - add_location(ol, file, 232, 16, 7896); - attr_dev(label0, "for", "address-input"); - add_location(label0, file, 239, 20, 8395); - attr_dev(input0, "id", "address-input"); - attr_dev(input0, "type", "text"); - input0.readOnly = true; - add_location(input0, file, 241, 24, 8515); - attr_dev(div0, "class", "ghost-input"); - add_location(div0, file, 242, 24, 8656); - attr_dev(div1, "class", "input-wrapper"); - add_location(div1, file, 240, 20, 8462); - attr_dev(div2, "id", "address-input-wrapper"); - attr_dev(div2, "class", "input-label-wrapper"); - add_location(div2, file, 238, 16, 8313); - attr_dev(label1, "for", "contact-input"); - add_location(label1, file, 246, 20, 8812); - attr_dev(input1, "id", "contact-input"); - attr_dev(input1, "type", "text"); - add_location(input1, file, 248, 24, 8931); - attr_dev(div3, "class", "ghost-input"); - add_location(div3, file, 249, 24, 9063); - attr_dev(div4, "class", "input-wrapper"); - add_location(div4, file, 247, 20, 8878); - attr_dev(div5, "class", "input-label-wrapper"); - add_location(div5, file, 245, 16, 8757); - attr_dev(label2, "for", "contact-input"); - add_location(label2, file, 253, 20, 9245); - set_custom_element_data(select_component, "id", "status-input"); - set_custom_element_data(select_component, "options", ["forming", "growing", "not growing"]); - add_location(select_component, file, 255, 24, 9363); - attr_dev(div6, "class", "ghost-input"); - add_location(div6, file, 256, 24, 9515); - attr_dev(div7, "class", "input-wrapper"); - add_location(div7, file, 254, 20, 9310); - attr_dev(div8, "id", "status-input-wrapper"); - attr_dev(div8, "class", "input-label-wrapper"); - add_location(div8, file, 252, 16, 9164); - attr_dev(button, "id", "submit-button"); - add_location(button, file, 259, 16, 9616); - attr_dev(p1, "id", "confirmation-msg"); - add_location(p1, file, 260, 16, 9702); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[17]); - add_location(map_component, file, 261, 16, 9777); - attr_dev(div9, "id", "text-container"); - add_location(div9, file, 228, 12, 7577); - attr_dev(div10, "id", "container"); - add_location(div10, file, 226, 8, 7474); - }, - m: function mount(target, anchor) { - insert_dev(target, div10, anchor); - append_dev(div10, div9); - append_dev(div9, h1); - append_dev(div9, t1); - append_dev(div9, img); - append_dev(div9, t2); - append_dev(div9, p0); - append_dev(div9, t4); - append_dev(div9, ol); - append_dev(ol, li0); - append_dev(ol, t6); - append_dev(ol, li1); - append_dev(ol, t8); - append_dev(ol, li2); - append_dev(ol, t10); - append_dev(ol, li3); - append_dev(div9, t12); - append_dev(div9, div2); - append_dev(div2, label0); - append_dev(div2, t14); - append_dev(div2, div1); - append_dev(div1, input0); - /*input0_binding*/ ctx[11](input0); - append_dev(div1, t15); - append_dev(div1, div0); - append_dev(div9, t16); - append_dev(div9, div5); - append_dev(div5, label1); - append_dev(div5, t18); - append_dev(div5, div4); - append_dev(div4, input1); - /*input1_binding*/ ctx[13](input1); - append_dev(div4, t19); - append_dev(div4, div3); - append_dev(div9, t20); - append_dev(div9, div8); - append_dev(div8, label2); - append_dev(div8, t22); - append_dev(div8, div7); - append_dev(div7, select_component); - /*select_component_binding*/ ctx[15](select_component); - append_dev(div7, t23); - append_dev(div7, div6); - append_dev(div9, t24); - append_dev(div9, button); - append_dev(div9, t26); - append_dev(div9, p1); - /*p1_binding*/ ctx[16](p1); - append_dev(div9, t27); - append_dev(div9, map_component); - - if (!mounted) { - dispose = [ - listen_dev(input0, "input", /*input_handler*/ ctx[12], false, false, false), - listen_dev(input1, "input", /*input_handler_1*/ ctx[14], false, false, false), - listen_dev(button, "click", /*submitLocation*/ ctx[10], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 32 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[17])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div10); - /*input0_binding*/ ctx[11](null); - /*input1_binding*/ ctx[13](null); - /*select_component_binding*/ ctx[15](null); - /*p1_binding*/ ctx[16](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(226:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (225:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[4] == 3 && create_if_block(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 (/*$loaded*/ ctx[4] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(225:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[4]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 16 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[4])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function createPin(lat, lng) { - let markerIcon = new L.Icon({ - iconUrl: '/img/common/markers/marker-black.png', - shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - shadowSize: [41, 41] - }); - - return L.marker([lat, lng], { icon: markerIcon }); -} - -function updatePin(marker, lat, lng) { - let newLatLng = L.latLng(lat, lng); // Replace with the desired coordinates - marker.setLatLng(newLatLng); -} - -function resizeInput(el) { - el.nextElementSibling.innerHTML = el.value; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('communes-add-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(4, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(5, $content = value)); - let entries; - let entriesByCountry; - - let callback = response => { - entries = JSON.parse(response); - entriesByCountry = {}; - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - entriesByCountry[country] = [g]; - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/communes.json", callback); - let confirmationMsg; - let addressInput; - let contactInput; - let statusInput; - let addressVec; - let userPinLat = 0; - let userPinLng = 0; - let userPin = createPin(0, 0); - userPin.setOpacity(0); - let locale = loadLocaleContent(content, "communes-component", loaded); - loadLocaleContent(content, "countries", loaded); - - function reverseGeocodeLocal(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - let fullAddress = country; - - if (state != undefined) { - fullAddress += ", " + state; - } else { - state = ""; - } - - if (city != undefined) { - fullAddress += ", " + city; - } else { - city = ""; - } - - $$invalidate(1, addressInput.value = fullAddress, addressInput); - resizeInput(addressInput); - }; - - getData(url, callback); - } - - function reverseGeocode(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2&accept-language=en`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - - if (state != undefined) ; else { - state = ""; - } - - if (city != undefined) ; else { - city = ""; - } - - addressVec = [country, state, city]; - }; - - getData(url, callback); - } - - function addGroupPinContent(g, content, locale) { - let coordinates; - let text = "" + content["Group"] + "
"; - - for (let field of ["location", "members", "contact"]) { - let fieldText = content[field] + ": "; - - if (field == "contact") { - text += fieldText + "" + g.contact + ""; - } else if (field == "location") { - let location = [g.country, g.state, g.town].filter(x => x != null && x != undefined); - let locationString; - - if (locale == "en") { - locationString = location.map(x => x).join(", "); - } else { - locationString = location.map(x => translate(content, x)).join(", "); - } - - text += fieldText + locationString + "
"; - coordinates = [g.latitude, g.longitude]; - } else { - text += fieldText + g[field] + "
"; - } - } - - return { text, coordinates }; - } - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addGroupPinContent, "green"); - userPin.addTo(map); - - map.on('click', function (event) { - let lat = event.latlng.lat; - let lng = event.latlng.lng; - userPinLat = lat; - userPinLng = lng; - updatePin(userPin, lat, lng); - userPin.setOpacity(1); - reverseGeocodeLocal(lat, lng); - reverseGeocode(lat, lng); - }); - } - - function updateConfirmationMsg(response) { - if (response !== false) { - $$invalidate(0, confirmationMsg.innerHTML = "You have been added to our database! Now go to our Discord to verify yourself.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "green", confirmationMsg); - } else { - $$invalidate(0, confirmationMsg.innerHTML = "Something went wrong.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "red", confirmationMsg); - } - } - - function submitLocation() { - if (addressVec != undefined) { - let data = { - country: addressVec[0], - state: addressVec[1], - town: addressVec[2], - latitude: userPinLat, - longitude: userPinLng, - contact: contactInput.value, - status: statusInput.value - }; - - if (data.state == "") { - data.state = null; - } - - if (data.town == "") { - data.town = null; - } - - if (data.contact == "") { - data.contact = null; - } - - let url = "/" + locale + "/communes-add-post/"; - sendData(url, data, updateConfirmationMsg); - } - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - addressInput = $$value; - $$invalidate(1, addressInput); - }); - } - - const input_handler = () => resizeInput(addressInput); - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - contactInput = $$value; - $$invalidate(2, contactInput); - }); - } - - const input_handler_1 = () => resizeInput(contactInput); - - function select_component_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - statusInput = $$value; - $$invalidate(3, statusInput); - }); - } - - function p1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationMsg = $$value; - $$invalidate(0, confirmationMsg); - }); - } - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - sendData, - addMarkersEntries, - translate, - loaded, - content, - entries, - entriesByCountry, - callback, - confirmationMsg, - addressInput, - contactInput, - statusInput, - addressVec, - userPinLat, - userPinLng, - userPin, - locale, - createPin, - updatePin, - reverseGeocodeLocal, - reverseGeocode, - addGroupPinContent, - mapCallback, - updateConfirmationMsg, - submitLocation, - resizeInput, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(6, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(7, content = $$props.content); - if ('entries' in $$props) entries = $$props.entries; - if ('entriesByCountry' in $$props) entriesByCountry = $$props.entriesByCountry; - if ('callback' in $$props) callback = $$props.callback; - if ('confirmationMsg' in $$props) $$invalidate(0, confirmationMsg = $$props.confirmationMsg); - if ('addressInput' in $$props) $$invalidate(1, addressInput = $$props.addressInput); - if ('contactInput' in $$props) $$invalidate(2, contactInput = $$props.contactInput); - if ('statusInput' in $$props) $$invalidate(3, statusInput = $$props.statusInput); - if ('addressVec' in $$props) addressVec = $$props.addressVec; - if ('userPinLat' in $$props) userPinLat = $$props.userPinLat; - if ('userPinLng' in $$props) userPinLng = $$props.userPinLng; - if ('userPin' in $$props) userPin = $$props.userPin; - if ('locale' in $$props) $$invalidate(8, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - confirmationMsg, - addressInput, - contactInput, - statusInput, - $loaded, - $content, - loaded, - content, - locale, - mapCallback, - submitLocation, - input0_binding, - input_handler, - input1_binding, - input_handler_1, - select_component_binding, - p1_binding, - func - ]; -} - -class Communes_add_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("communes-add-component", Communes_add_component); - -export { Communes_add_component as default }; +import{S as t,i as n,a as e,b as o,s as i,p as a,n as r,g as s,q as l,o as m,j as c,e as u,c as p,d,t as f,u as g,f as h,l as b,r as w}from"./index-db20528a.js";import{w as y}from"./index-720c0a59.js";import{getData as v,loadLocaleContent as x,sendData as k}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as j,translate as S}from"../../../../../../../../../js/libraries/mapTools.js";import"../../../../../../../../../js/components/map-component.js";import"../../../../../../../../../js/components/select-component.js";function z(t){let n,e,i,a,r,l,m,c,y,v,x,k,j,L,S,z,C,T,N,O,H,M,A,$,q,E,J,U,D,I,R,G,K,P,Q,V,Y,_,B,F,W,X,Z;return{c(){n=u("div"),e=u("div"),i=u("h1"),i.textContent="Add a Commune",a=p(),r=u("img"),m=p(),c=u("p"),c.textContent="If there are no communes near you who you can join and you want to start your own then do the following:",y=p(),v=u("ol"),v.innerHTML="
  • Click on the map to show us where you are located;
  • \n
  • Add a way to contact you or leave blank for a pin to point to our discord;
  • \n
  • Press "Submit" to add yourself to our map;
  • \n
  • Verify yourself by having a chat with us at our Discord server to show on the map;
  • ",x=p(),k=u("div"),j=u("label"),j.textContent="Location:",L=p(),S=u("div"),z=u("input"),C=p(),T=u("div"),N=p(),O=u("div"),H=u("label"),H.textContent="Contact:",M=p(),A=u("div"),$=u("input"),q=p(),E=u("div"),J=p(),U=u("div"),D=u("label"),D.textContent="Status:",I=p(),R=u("div"),G=u("select-component"),K=p(),P=u("div"),Q=p(),V=u("button"),V.textContent="Submit",Y=p(),_=u("p"),B=p(),F=u("map-component"),d(r,"id","communes-img"),f(r.src,l="/img/common/communes.svg")||d(r,"src","/img/common/communes.svg"),d(r,"alt","communes"),d(c,"class","description"),d(j,"for","address-input"),d(z,"id","address-input"),d(z,"type","text"),z.readOnly=!0,d(T,"class","ghost-input"),d(S,"class","input-wrapper"),d(k,"id","address-input-wrapper"),d(k,"class","input-label-wrapper"),d(H,"for","contact-input"),d($,"id","contact-input"),d($,"type","text"),d(E,"class","ghost-input"),d(A,"class","input-wrapper"),d(O,"class","input-label-wrapper"),d(D,"for","contact-input"),g(G,"id","status-input"),g(G,"options",["forming","growing","not growing"]),d(P,"class","ghost-input"),d(R,"class","input-wrapper"),d(U,"id","status-input-wrapper"),d(U,"class","input-label-wrapper"),d(V,"id","submit-button"),d(_,"id","confirmation-msg"),g(F,"id","map"),g(F,"callback",W=t[17]),d(e,"id","text-container"),d(n,"id","container")},m(s,l){o(s,n,l),h(n,e),h(e,i),h(e,a),h(e,r),h(e,m),h(e,c),h(e,y),h(e,v),h(e,x),h(e,k),h(k,j),h(k,L),h(k,S),h(S,z),t[11](z),h(S,C),h(S,T),h(e,N),h(e,O),h(O,H),h(O,M),h(O,A),h(A,$),t[13]($),h(A,q),h(A,E),h(e,J),h(e,U),h(U,D),h(U,I),h(U,R),h(R,G),t[15](G),h(R,K),h(R,P),h(e,Q),h(e,V),h(e,Y),h(e,_),t[16](_),h(e,B),h(e,F),X||(Z=[b(z,"input",t[12]),b($,"input",t[14]),b(V,"click",t[10])],X=!0)},p(t,n){32&n&&W!==(W=t[17])&&g(F,"callback",W)},d(e){e&&s(n),t[11](null),t[13](null),t[15](null),t[16](null),X=!1,w(Z)}}}function C(t){let n,e=3==t[4]&&z(t);return{c(){e&&e.c(),n=a()},m(t,i){e&&e.m(t,i),o(t,n,i)},p(t,o){3==t[4]?e?e.p(t,o):(e=z(t),e.c(),e.m(n.parentNode,n)):e&&(e.d(1),e=null)},d(t){e&&e.d(t),t&&s(n)}}}function T(t){let n,e=t[4],l=C(t);return{c(){l.c(),n=a(),this.c=r},m(t,e){l.m(t,e),o(t,n,e)},p(t,[o]){16&o&&i(e,e=t[4])?(l.d(1),l=C(t),l.c(),l.m(n.parentNode,n)):l.p(t,o)},i:r,o:r,d(t){t&&s(n),l.d(t)}}}function N(t){t.nextElementSibling.innerHTML=t.value}function O(t,n,e){let o,i,a=y(0);l(t,a,(t=>e(4,o=t)));let r,s,u=y({});l(t,u,(t=>e(5,i=t)));let p,d,f,g,h;v("/assets/communes.json",(t=>{r=JSON.parse(t),s={};for(let t of r){let n=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),n in s?s[n].push(t):s[n]=[t]}a.update((t=>t+1))}));let b=0,w=0,z=function(t,n){let e=new L.Icon({iconUrl:"/img/common/markers/marker-black.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});return L.marker([t,n],{icon:e})}(0,0);z.setOpacity(0);let C=x(u,"communes-component",a);function T(t,n,e){let o,i=""+n.Group+"
    ";for(let a of["location","members","contact"]){let r=n[a]+": ";if("contact"==a)i+=r+""+t.contact+"";else if("location"==a){let a,s=[t.country,t.state,t.town].filter((t=>null!=t&&null!=t));a="en"==e?s.map((t=>t)).join(", "):s.map((t=>S(n,t))).join(", "),i+=r+a+"
    ",o=[t.latitude,t.longitude]}else i+=r+t[a]+"
    "}return{text:i,coordinates:o}}function O(t,n,o){let i=t([22,0],2);j(r,s,i,n,o,T,"green"),z.addTo(i),i.on("click",(function(t){let n=t.latlng.lat,o=t.latlng.lng;b=n,w=o,function(t,n,e){let o=L.latLng(n,e);t.setLatLng(o)}(z,n,o),z.setOpacity(1),v(`https://nominatim.openstreetmap.org/reverse?lat=${n}&lon=${o}&format=jsonv2`,(t=>{let n=(t=JSON.parse(t)).address,o=n.city||n.town||n.village||n.hamlet,i=n.state,a=n.country;null!=i?a+=", "+i:i="",null!=o?a+=", "+o:o="",e(1,d.value=a,d),N(d)})),function(t,n){v(`https://nominatim.openstreetmap.org/reverse?lat=${t}&lon=${n}&format=jsonv2&accept-language=en`,(t=>{let n=(t=JSON.parse(t)).address,e=n.city||n.town||n.village||n.hamlet,o=n.state,i=n.country;null!=o||(o=""),null!=e||(e=""),h=[i,o,e]}))}(n,o)}))}function H(t){!1!==t?(e(0,p.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",p),e(0,p.style.color="green",p)):(e(0,p.innerHTML="Something went wrong.",p),e(0,p.style.color="red",p))}x(u,"countries",a),m((()=>{}));return[p,d,f,g,o,i,a,u,C,O,function(){if(null!=h){let t={country:h[0],state:h[1],town:h[2],latitude:b,longitude:w,contact:f.value,status:g.value};""==t.state&&(t.state=null),""==t.town&&(t.town=null),""==t.contact&&(t.contact=null),k("/"+C+"/communes-add-post/",t,H)}},function(t){c[t?"unshift":"push"]((()=>{d=t,e(1,d)}))},()=>N(d),function(t){c[t?"unshift":"push"]((()=>{f=t,e(2,f)}))},()=>N(f),function(t){c[t?"unshift":"push"]((()=>{g=t,e(3,g)}))},function(t){c[t?"unshift":"push"]((()=>{p=t,e(0,p)}))},t=>O(t,i,C)]}class H extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},O,T,i,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("communes-add-component",H);export{H as default}; diff --git a/Server/public/js/components/communes-component.js b/Server/public/js/components/communes-component.js index 3d0c588..cfb57f8 100644 --- a/Server/public/js/components/communes-component.js +++ b/Server/public/js/components/communes-component.js @@ -1,646 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addCommunePinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\communes-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; - -const file = "src\\communes-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i][0]; - child_ctx[3] = list[i][1]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} - -// (64:4) {#if $loaded==3} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[1].communes + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t3_value = /*$content*/ ctx[1].p1 + ""; - let t3; - let t4; - let h3; - let t5_value = /*$content*/ ctx[1].subheading1 + ""; - let t5; - let t6; - let map_component; - let map_component_callback_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; - let t8; - let t9; - let each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - h3 = element("h3"); - t5 = text(t5_value); - t6 = space(); - map_component = element("map-component"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - add_location(h1, file, 68, 16, 2090); - attr_dev(img, "id", "communes-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/communes.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "commune"); - add_location(img, file, 69, 16, 2136); - attr_dev(p0, "class", "description"); - add_location(p0, file, 70, 16, 2222); - add_location(h3, file, 71, 16, 2280); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); - add_location(map_component, file, 72, 16, 2329); - attr_dev(p1, "id", "add-prompt"); - add_location(p1, file, 73, 16, 2452); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 67, 12, 2047); - attr_dev(div1, "id", "container"); - add_location(div1, file, 65, 8, 1944); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - append_dev(div0, p0); - append_dev(p0, t3); - append_dev(div0, t4); - append_dev(div0, h3); - append_dev(h3, t5); - append_dev(div0, t6); - append_dev(div0, map_component); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div0, t9); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div0, null); - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].communes + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, getCountry*/ 771) { - each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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(div0, 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); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(64:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (78:24) {#each entries as entry} -function create_each_block_1(ctx) { - let div; - let p0; - let b0; - let t0_value = /*$content*/ ctx[1].location + ""; - let t0; - let t1; - let t2_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + ""; - let t2; - let t3; - let p1; - let b1; - let t4_value = /*$content*/ ctx[1].status + ""; - let t4; - let t5; - let t6_value = /*$content*/ ctx[1][/*entry*/ ctx[15].status] + ""; - let t6; - let t7; - let p2; - let b2; - let t8_value = /*$content*/ ctx[1].members + ""; - let t8; - let t9; - let t10_value = /*entry*/ ctx[15].members + ""; - let t10; - let t11; - let p3; - let b3; - let t12_value = /*$content*/ ctx[1].contact + ""; - let t12; - let t13; - let a; - let t14_value = /*entry*/ ctx[15].contact + ""; - let t14; - let a_href_value; - - const block = { - c: function create() { - div = element("div"); - p0 = element("p"); - b0 = element("b"); - t0 = text(t0_value); - t1 = text(": "); - t2 = text(t2_value); - t3 = space(); - p1 = element("p"); - b1 = element("b"); - t4 = text(t4_value); - t5 = text(": "); - t6 = text(t6_value); - t7 = space(); - p2 = element("p"); - b2 = element("b"); - t8 = text(t8_value); - t9 = text(": "); - t10 = text(t10_value); - t11 = space(); - p3 = element("p"); - b3 = element("b"); - t12 = text(t12_value); - t13 = text(": "); - a = element("a"); - t14 = text(t14_value); - add_location(b0, file, 80, 35, 2868); - add_location(p0, file, 80, 32, 2865); - add_location(b1, file, 81, 35, 2956); - add_location(p1, file, 81, 32, 2953); - add_location(b2, file, 82, 35, 3047); - add_location(p2, file, 82, 32, 3044); - add_location(b3, file, 83, 35, 3130); - attr_dev(a, "href", a_href_value = /*entry*/ ctx[15].contact); - attr_dev(a, "target", ";_blank;"); - attr_dev(a, "rel", "noreferrer"); - add_location(a, file, 83, 62, 3157); - add_location(p3, file, 83, 32, 3127); - attr_dev(div, "class", "location-info"); - add_location(div, file, 79, 28, 2804); - }, - m: function mount(target, anchor) { - insert_dev(target, div, anchor); - append_dev(div, p0); - append_dev(p0, b0); - append_dev(b0, t0); - append_dev(b0, t1); - append_dev(p0, t2); - append_dev(div, t3); - append_dev(div, p1); - append_dev(p1, b1); - append_dev(b1, t4); - append_dev(b1, t5); - append_dev(p1, t6); - append_dev(div, t7); - append_dev(div, p2); - append_dev(p2, b2); - append_dev(b2, t8); - append_dev(b2, t9); - append_dev(p2, t10); - append_dev(div, t11); - append_dev(div, p3); - append_dev(p3, b3); - append_dev(b3, t12); - append_dev(b3, t13); - append_dev(p3, a); - append_dev(a, t14); - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].location + "")) set_data_dev(t0, t0_value); - if (dirty & /*entriesByCountry*/ 1 && t2_value !== (t2_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + "")) set_data_dev(t2, t2_value); - if (dirty & /*$content*/ 2 && t4_value !== (t4_value = /*$content*/ ctx[1].status + "")) set_data_dev(t4, t4_value); - if (dirty & /*$content, entriesByCountry*/ 3 && t6_value !== (t6_value = /*$content*/ ctx[1][/*entry*/ ctx[15].status] + "")) set_data_dev(t6, t6_value); - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1].members + "")) set_data_dev(t8, t8_value); - if (dirty & /*entriesByCountry*/ 1 && t10_value !== (t10_value = /*entry*/ ctx[15].members + "")) set_data_dev(t10, t10_value); - if (dirty & /*$content*/ 2 && t12_value !== (t12_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t12, t12_value); - if (dirty & /*entriesByCountry*/ 1 && t14_value !== (t14_value = /*entry*/ ctx[15].contact + "")) set_data_dev(t14, t14_value); - - if (dirty & /*entriesByCountry*/ 1 && a_href_value !== (a_href_value = /*entry*/ ctx[15].contact)) { - attr_dev(a, "href", a_href_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block_1.name, - type: "each", - source: "(78:24) {#each entries as entry}", - ctx - }); - - return block; -} - -// (75:16) {#each Object.entries(entriesByCountry) as [name,entries]} -function create_each_block(ctx) { - let h4; - let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + ""; - let t0; - let t1; - let div; - let t2; - let each_value_1 = /*entries*/ ctx[3]; - 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() { - h4 = element("h4"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr_dev(h4, "class", "country-name"); - add_location(h4, file, 75, 20, 2597); - attr_dev(div, "class", "country-block"); - add_location(div, file, 76, 20, 2667); - }, - m: function mount(target, anchor) { - insert_dev(target, h4, anchor); - append_dev(h4, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - append_dev(div, t2); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + "")) set_data_dev(t0, t0_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress*/ 515) { - each_value_1 = /*entries*/ ctx[3]; - 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(div, t2); - } - } - - 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(h4); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(75:16) {#each Object.entries(entriesByCountry) as [name,entries]}", - ctx - }); - - return block; -} - -// (63:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 3 && create_if_block(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 (/*$loaded*/ ctx[2] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(63:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('communes-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries; - let entriesByCountry; - let locale = loadLocaleContent(content, "communes-component", loaded); - loadLocaleContent(content, "countries", loaded); - - let callback = response => { - $$invalidate(3, entries = JSON.parse(response)); - $$invalidate(0, entriesByCountry = {}); - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/communes.json", callback); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addCommunePinContent, "red"); - } - - function getCountry(x) { - return locale == "en" ? x : translate($content, x); - } - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addCommunePinContent, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - mapCallback, - getCountry, - getAddress, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); - if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - entriesByCountry, - $content, - $loaded, - entries, - loaded, - content, - locale, - mapCallback, - getCountry, - getAddress, - func - ]; -} - -class Communes_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("communes-component", Communes_component); - -export { Communes_component as default }; +import{S as t,i as n,a as o,b as e,s as r,p as m,n as s,g as a,q as c,o as i,e as l,v as p,c as u,d,t as g,u as f,f as h,w as b,x as j}from"./index-db20528a.js";import{w as x}from"./index-720c0a59.js";import{loadLocaleContent as y,getData as v}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as w,translate as k}from"../../../../../../../../../js/libraries/mapTools.js";import{addCommunePinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,n,o){const e=t.slice();return e[12]=n[o][0],e[3]=n[o][1],e}function O(t,n,o){const e=t.slice();return e[15]=n[o],e}function T(t){let n,o,r,m,s,c,i,x,y,v,w,k,z,O,T,C,E,R,S,q,A=t[1].communes+"",F=t[1].p1+"",G=t[1].subheading1+"",H=t[1]["map-prompt"]+"",J=Object.entries(t[0]),K=[];for(let n=0;no(2,r=t)));let s,a,l=x({});c(t,l,(t=>o(1,e=t)));let p=y(l,"communes-component",m);y(l,"countries",m);function u(t,n,o){let e=t([22,0],2);w(s,a,e,n,o,z,"red",{enableCountryGrouping:!0})}v("/assets/communes.json",(t=>{o(3,s=JSON.parse(t)),o(0,a={});for(let t of s){let n=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),n in a?a[n].push(t):o(0,a[n]=[t],a)}m.update((t=>t+1))})),i((()=>{}));return[a,e,r,s,m,l,p,u,function(t){return"en"==p?t:k(e,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:k(e,t))).join(", ")},t=>u(t,e,p)]}class q extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},S,R,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("communes-component",q);export{q as default}; diff --git a/Server/public/js/components/compass-component.js b/Server/public/js/components/compass-component.js index 8de75f6..8e433f3 100644 --- a/Server/public/js/components/compass-component.js +++ b/Server/public/js/components/compass-component.js @@ -1,714 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, l as append_dev, C as set_data_dev, A as validate_each_argument, m as listen_dev, D as destroy_each, r as run_all, E as prop_dev } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; -import { shuffleArray } from '../../../../../../../../../js/libraries/miscTools.js'; - -/* src\compass-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\compass-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[19] = list[i]; - child_ctx[21] = i; - return child_ctx; -} - -// (57:4) {#if $loaded==2} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[5].heading + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let previous_key = /*qTag*/ ctx[0]; - let key_block = create_key_block_1(ctx); - - const block = { - c: function create() { - div1 = element("div"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - key_block.c(); - add_location(h1, file, 59, 16, 1759); - attr_dev(img, "id", "compass-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/compass.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "compass"); - add_location(img, file, 60, 16, 1804); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 58, 12, 1716); - attr_dev(div1, "id", "container"); - add_location(div1, file, 57, 8, 1682); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - key_block.m(div0, null); - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 32 && t0_value !== (t0_value = /*$content*/ ctx[5].heading + "")) set_data_dev(t0, t0_value); - - if (dirty & /*qTag*/ 1 && safe_not_equal(previous_key, previous_key = /*qTag*/ ctx[0])) { - key_block.d(1); - key_block = create_key_block_1(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); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(57:4) {#if $loaded==2}", - ctx - }); - - return block; -} - -// (74:16) {:else} -function create_else_block(ctx) { - let p; - let t1; - let ul; - let li0; - let t2; - let span0; - let t3; - let t4; - let t5; - let li1; - let t6; - let span1; - let t7; - let t8; - let t9; - let li2; - let t10; - let span2; - let t11; - let t12; - let t13; - let button; - let mounted; - let dispose; - - const block = { - c: function create() { - p = element("p"); - p.textContent = "You are compatible with ..."; - t1 = space(); - ul = element("ul"); - li0 = element("li"); - t2 = text("capitalism by "); - span0 = element("span"); - t3 = text(/*capitalismScore*/ ctx[2]); - t4 = text("%"); - t5 = space(); - li1 = element("li"); - t6 = text("vanguardism by "); - span1 = element("span"); - t7 = text(/*vanguardismScore*/ ctx[3]); - t8 = text("%"); - t9 = space(); - li2 = element("li"); - t10 = text("libertarian socialism by "); - span2 = element("span"); - t11 = text(/*socialismScore*/ ctx[4]); - t12 = text("%"); - t13 = space(); - button = element("button"); - button.textContent = "back"; - add_location(p, file, 74, 20, 2731); - add_location(span0, file, 76, 42, 2856); - add_location(li0, file, 76, 24, 2838); - add_location(span1, file, 77, 43, 2937); - add_location(li1, file, 77, 24, 2918); - add_location(span2, file, 78, 53, 3029); - add_location(li2, file, 78, 24, 3000); - attr_dev(ul, "class", "results-list"); - add_location(ul, file, 75, 20, 2787); - attr_dev(button, "class", "quiz-buttons"); - add_location(button, file, 80, 20, 3113); - }, - m: function mount(target, anchor) { - insert_dev(target, p, anchor); - insert_dev(target, t1, anchor); - insert_dev(target, ul, anchor); - append_dev(ul, li0); - append_dev(li0, t2); - append_dev(li0, span0); - append_dev(span0, t3); - append_dev(li0, t4); - append_dev(ul, t5); - append_dev(ul, li1); - append_dev(li1, t6); - append_dev(li1, span1); - append_dev(span1, t7); - append_dev(li1, t8); - append_dev(ul, t9); - append_dev(ul, li2); - append_dev(li2, t10); - append_dev(li2, span2); - append_dev(span2, t11); - append_dev(li2, t12); - insert_dev(target, t13, anchor); - insert_dev(target, button, anchor); - - if (!mounted) { - dispose = listen_dev(button, "click", /*click_handler_3*/ ctx[16], false, false, false); - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*capitalismScore*/ 4) set_data_dev(t3, /*capitalismScore*/ ctx[2]); - if (dirty & /*vanguardismScore*/ 8) set_data_dev(t7, /*vanguardismScore*/ ctx[3]); - if (dirty & /*socialismScore*/ 16) set_data_dev(t11, /*socialismScore*/ ctx[4]); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(p); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(ul); - if (detaching) detach_dev(t13); - if (detaching) detach_dev(button); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_else_block.name, - type: "else", - source: "(74:16) {:else}", - ctx - }); - - return block; -} - -// (63:16) {#if qTag!=$content.qs.length} -function create_if_block_1(ctx) { - let p; - let t0_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].q + ""; - let t0; - let t1; - let div; - let t2; - let button0; - let button1; - let mounted; - let dispose; - let each_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].as; - 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() { - p = element("p"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - button0 = element("button"); - button0.textContent = "back"; - button1 = element("button"); - button1.textContent = "next"; - add_location(p, file, 63, 20, 1969); - attr_dev(div, "class", "quiz-inputs"); - add_location(div, file, 64, 20, 2019); - attr_dev(button0, "class", "quiz-buttons"); - add_location(button0, file, 72, 20, 2544); - attr_dev(button1, "class", "quiz-buttons"); - add_location(button1, file, 72, 90, 2614); - }, - m: function mount(target, anchor) { - insert_dev(target, p, anchor); - append_dev(p, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - insert_dev(target, t2, anchor); - insert_dev(target, button0, anchor); - insert_dev(target, button1, anchor); - - if (!mounted) { - dispose = [ - listen_dev(button0, "click", /*click_handler_1*/ ctx[14], false, false, false), - listen_dev(button1, "click", /*click_handler_2*/ ctx[15], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content, qTag*/ 33 && t0_value !== (t0_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].q + "")) set_data_dev(t0, t0_value); - - if (dirty & /*answers, qTag, $content*/ 35) { - each_value = /*$content*/ ctx[5].qs[/*qTag*/ ctx[0]].as; - 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(div, 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(p); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - if (detaching) detach_dev(t2); - if (detaching) detach_dev(button0); - if (detaching) detach_dev(button1); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block_1.name, - type: "if", - source: "(63:16) {#if qTag!=$content.qs.length}", - ctx - }); - - return block; -} - -// (66:24) {#each $content.qs[qTag].as as a,i} -function create_each_block(ctx) { - let div; - let input; - let input_value_value; - let t0; - let button; - let t1_value = /*a*/ ctx[19][0] + ""; - let t1; - let t2; - let mounted; - let dispose; - - function click_handler() { - return /*click_handler*/ ctx[13](/*a*/ ctx[19]); - } - - const block = { - c: function create() { - div = element("div"); - input = element("input"); - t0 = space(); - button = element("button"); - t1 = text(t1_value); - t2 = space(); - attr_dev(input, "type", "radio"); - attr_dev(input, "id", "option" + /*i*/ ctx[21]); - attr_dev(input, "name", "options"); - input.__value = input_value_value = /*a*/ ctx[19][1]; - input.value = input.__value; - /*$$binding_groups*/ ctx[12][0].push(input); - add_location(input, file, 67, 32, 2198); - attr_dev(button, "class", "input-label"); - attr_dev(button, "for", "option" + /*i*/ ctx[21]); - add_location(button, file, 68, 32, 2323); - attr_dev(div, "class", "radio-container"); - add_location(div, file, 66, 28, 2135); - }, - m: function mount(target, anchor) { - insert_dev(target, div, anchor); - append_dev(div, input); - input.checked = input.__value === /*answers*/ ctx[1][/*qTag*/ ctx[0]]; - append_dev(div, t0); - append_dev(div, button); - append_dev(button, t1); - append_dev(div, t2); - - if (!mounted) { - dispose = [ - listen_dev(input, "change", /*input_change_handler*/ ctx[11]), - listen_dev(button, "click", click_handler, false, false, false) - ]; - - mounted = true; - } - }, - p: function update(new_ctx, dirty) { - ctx = new_ctx; - - if (dirty & /*$content, qTag*/ 33 && input_value_value !== (input_value_value = /*a*/ ctx[19][1])) { - prop_dev(input, "__value", input_value_value); - input.value = input.__value; - } - - if (dirty & /*answers, qTag*/ 3) { - input.checked = input.__value === /*answers*/ ctx[1][/*qTag*/ ctx[0]]; - } - - if (dirty & /*$content, qTag*/ 33 && t1_value !== (t1_value = /*a*/ ctx[19][0] + "")) set_data_dev(t1, t1_value); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - /*$$binding_groups*/ ctx[12][0].splice(/*$$binding_groups*/ ctx[12][0].indexOf(input), 1); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(66:24) {#each $content.qs[qTag].as as a,i}", - ctx - }); - - return block; -} - -// (62:16) {#key qTag} -function create_key_block_1(ctx) { - let if_block_anchor; - - function select_block_type(ctx, dirty) { - if (/*qTag*/ ctx[0] != /*$content*/ ctx[5].qs.length) return create_if_block_1; - return create_else_block; - } - - 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 (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { - if_block.p(ctx, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx); - - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d: function destroy(detaching) { - if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block_1.name, - type: "key", - source: "(62:16) {#key qTag}", - ctx - }); - - return block; -} - -// (56:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[6] == 2 && create_if_block(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 (/*$loaded*/ ctx[6] == 2) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(56:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[6]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 64 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[6])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('compass-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(6, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(5, $content = value)); - loadLocaleContent(content, "countries", loaded); - let locale = loadLocaleContent(content, "compass-component", loaded, contentCallback); - let qTag = 0; - let answers = []; - let capitalismScore = ""; - let vanguardismScore = ""; - let socialismScore = ""; - - function contentCallback(content) { - for (let q of content.qs) { - shuffleArray(q.as); - } - } - - function next(i) { - if (answers[i] != undefined) { - if (qTag < $content.qs.length) { - if (qTag == $content.qs.length - 1) { - $$invalidate(2, capitalismScore = Math.round(answers.map(x => x.includes("C")).filter(Boolean).length * 100 / answers.length).toString()); - $$invalidate(3, vanguardismScore = Math.round(answers.map(x => x.includes("V")).filter(Boolean).length * 100 / answers.length).toString()); - $$invalidate(4, socialismScore = Math.round(answers.map(x => x.includes("LS")).filter(Boolean).length * 100 / answers.length).toString()); - } - - $$invalidate(0, qTag = qTag + 1); - } - } - } - - function back(i) { - if (qTag != 0) { - $$invalidate(0, qTag = qTag - 1); - } - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const $$binding_groups = [[]]; - - function input_change_handler() { - answers[qTag] = this.__value; - $$invalidate(1, answers); - } - - const click_handler = a => $$invalidate(1, answers[qTag] = a[1], answers); - const click_handler_1 = () => back(); - const click_handler_2 = () => next(qTag); - const click_handler_3 = () => back(); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - shuffleArray, - loaded, - content, - locale, - qTag, - answers, - capitalismScore, - vanguardismScore, - socialismScore, - contentCallback, - next, - back, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(7, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(8, content = $$props.content); - if ('locale' in $$props) locale = $$props.locale; - if ('qTag' in $$props) $$invalidate(0, qTag = $$props.qTag); - if ('answers' in $$props) $$invalidate(1, answers = $$props.answers); - if ('capitalismScore' in $$props) $$invalidate(2, capitalismScore = $$props.capitalismScore); - if ('vanguardismScore' in $$props) $$invalidate(3, vanguardismScore = $$props.vanguardismScore); - if ('socialismScore' in $$props) $$invalidate(4, socialismScore = $$props.socialismScore); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - qTag, - answers, - capitalismScore, - vanguardismScore, - socialismScore, - $content, - $loaded, - loaded, - content, - next, - back, - input_change_handler, - $$binding_groups, - click_handler, - click_handler_1, - click_handler_2, - click_handler_3 - ]; -} - -class Compass_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("compass-component", Compass_component); - -export { Compass_component as default }; +import{S as t,i as n,a as e,b as i,s as o,p as r,n as s,g as a,q as l,o as m,e as c,v as u,c as p,d,t as g,f as h,w as f,l as b,x as v,r as x}from"./index-db20528a.js";import{w as q}from"./index-720c0a59.js";import{loadLocaleContent as _}from"../../../../../../../../../js/libraries/serverTools.js";import{shuffleArray as z}from"../../../../../../../../../js/libraries/miscTools.js";function w(t,n,e){const i=t.slice();return i[19]=n[e],i[21]=e,i}function y(t){let n,e,r,s,l,m,b,v,x=t[5].heading+"",q=t[0],_=S(t);return{c(){n=c("div"),e=c("div"),r=c("h1"),s=u(x),l=p(),m=c("img"),v=p(),_.c(),d(m,"id","compass-img"),g(m.src,b="/img/common/compass.svg")||d(m,"src","/img/common/compass.svg"),d(m,"alt","compass"),d(e,"id","text-container"),d(n,"id","container")},m(t,o){i(t,n,o),h(n,e),h(e,r),h(r,s),h(e,l),h(e,m),h(e,v),_.m(e,null)},p(t,n){32&n&&x!==(x=t[5].heading+"")&&f(s,x),1&n&&o(q,q=t[0])?(_.d(1),_=S(t),_.c(),_.m(e,null)):_.p(t,n)},d(t){t&&a(n),_.d(t)}}}function k(t){let n,e,o,r,s,l,m,g,v,x,q,_,z,w,y,k,j,C,S,B,M,N,T,D;return{c(){n=c("p"),n.textContent="You are compatible with ...",e=p(),o=c("ul"),r=c("li"),s=u("capitalism by "),l=c("span"),m=u(t[2]),g=u("%"),v=p(),x=c("li"),q=u("vanguardism by "),_=c("span"),z=u(t[3]),w=u("%"),y=p(),k=c("li"),j=u("libertarian socialism by "),C=c("span"),S=u(t[4]),B=u("%"),M=p(),N=c("button"),N.textContent="back",d(o,"class","results-list"),d(N,"class","quiz-buttons")},m(a,c){i(a,n,c),i(a,e,c),i(a,o,c),h(o,r),h(r,s),h(r,l),h(l,m),h(r,g),h(o,v),h(o,x),h(x,q),h(x,_),h(_,z),h(x,w),h(o,y),h(o,k),h(k,j),h(k,C),h(C,S),h(k,B),i(a,M,c),i(a,N,c),T||(D=b(N,"click",t[16]),T=!0)},p(t,n){4&n&&f(m,t[2]),8&n&&f(z,t[3]),16&n&&f(S,t[4])},d(t){t&&a(n),t&&a(e),t&&a(o),t&&a(M),t&&a(N),T=!1,D()}}}function j(t){let n,e,o,r,s,l,m,g,q,_=t[5].qs[t[0]].q+"",z=t[5].qs[t[0]].as,y=[];for(let n=0;ne(6,o=t)));let s=q({});l(t,s,(t=>e(5,i=t))),_(s,"countries",r),_(s,"compass-component",r,(function(t){for(let n of t.qs)z(n.as)}));let a=0,c=[],u="",p="",d="";function g(t){null!=c[t]&&at.includes("C"))).filter(Boolean).length/c.length).toString()),e(3,p=Math.round(100*c.map((t=>t.includes("V"))).filter(Boolean).length/c.length).toString()),e(4,d=Math.round(100*c.map((t=>t.includes("LS"))).filter(Boolean).length/c.length).toString())),e(0,a+=1))}function h(t){0!=a&&e(0,a-=1)}m((()=>{}));return[a,c,u,p,d,i,o,r,s,g,h,function(){c[a]=this.__value,e(1,c)},[[]],t=>e(1,c[a]=t[1],c),()=>h(),()=>g(a),()=>h()]}class T extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},N,M,o,{},null),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("compass-component",T);export{T as default}; diff --git a/Server/public/js/components/confirmation-component.js b/Server/public/js/components/confirmation-component.js index 544e010..726a90c 100644 --- a/Server/public/js/components/confirmation-component.js +++ b/Server/public/js/components/confirmation-component.js @@ -1,361 +1 @@ - -(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, o as onMount, f as element, h as space, n as noop, k as attr_dev, j as add_location, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks } from './index-998178c7.js'; -import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js'; - -/* src\auth\confirmation-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\auth\\confirmation-component.svelte"; - -function create_fragment(ctx) { - let div1; - let h2; - let t1; - let div0; - let input0; - let span0; - let t3; - let input1; - let span1; - let t5; - let input2; - let span2; - let t7; - let input3; - let span3; - let t9; - let input4; - let t10; - let span4; - let t11; - let button; - let mounted; - let dispose; - - const block = { - c: function create() { - div1 = element("div"); - h2 = element("h2"); - h2.textContent = "CONFIRMATION CODE"; - t1 = space(); - div0 = element("div"); - input0 = element("input"); - span0 = element("span"); - span0.textContent = "-"; - t3 = space(); - input1 = element("input"); - span1 = element("span"); - span1.textContent = "-"; - t5 = space(); - input2 = element("input"); - span2 = element("span"); - span2.textContent = "-"; - t7 = space(); - input3 = element("input"); - span3 = element("span"); - span3.textContent = "-"; - t9 = space(); - input4 = element("input"); - t10 = space(); - span4 = element("span"); - t11 = space(); - button = element("button"); - button.textContent = "Confirm"; - this.c = noop; - attr_dev(h2, "class", "auth-title title-highlight"); - add_location(h2, file, 55, 4, 1288); - attr_dev(input0, "class", "authConfirmationInput"); - attr_dev(input0, "type", "text"); - attr_dev(input0, "maxlength", "1"); - add_location(input0, file, 57, 8, 1394); - attr_dev(span0, "class", "dash"); - add_location(span0, file, 57, 146, 1532); - attr_dev(input1, "class", "authConfirmationInput"); - attr_dev(input1, "type", "text"); - attr_dev(input1, "maxlength", "1"); - add_location(input1, file, 58, 8, 1569); - attr_dev(span1, "class", "dash"); - add_location(span1, file, 58, 146, 1707); - attr_dev(input2, "class", "authConfirmationInput"); - attr_dev(input2, "type", "text"); - attr_dev(input2, "maxlength", "1"); - add_location(input2, file, 59, 8, 1744); - attr_dev(span2, "class", "dash"); - add_location(span2, file, 59, 146, 1882); - attr_dev(input3, "class", "authConfirmationInput"); - attr_dev(input3, "type", "text"); - attr_dev(input3, "maxlength", "1"); - add_location(input3, file, 60, 8, 1919); - attr_dev(span3, "class", "dash"); - add_location(span3, file, 60, 146, 2057); - attr_dev(input4, "class", "authConfirmationInput"); - attr_dev(input4, "type", "text"); - attr_dev(input4, "maxlength", "1"); - add_location(input4, file, 61, 8, 2094); - attr_dev(div0, "id", "confirmationInputs"); - add_location(div0, file, 56, 4, 1355); - attr_dev(span4, "id", "confirmation-msg"); - add_location(span4, file, 63, 4, 2250); - attr_dev(button, "class", "auth-button"); - add_location(button, file, 64, 4, 2319); - attr_dev(div1, "class", "pane auth-pane"); - add_location(div1, file, 54, 0, 1254); - }, - 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) { - insert_dev(target, div1, anchor); - append_dev(div1, h2); - append_dev(div1, t1); - append_dev(div1, div0); - append_dev(div0, input0); - /*input0_binding*/ ctx[6](input0); - append_dev(div0, span0); - append_dev(div0, t3); - append_dev(div0, input1); - /*input1_binding*/ ctx[8](input1); - append_dev(div0, span1); - append_dev(div0, t5); - append_dev(div0, input2); - /*input2_binding*/ ctx[10](input2); - append_dev(div0, span2); - append_dev(div0, t7); - append_dev(div0, input3); - /*input3_binding*/ ctx[12](input3); - append_dev(div0, span3); - append_dev(div0, t9); - append_dev(div0, input4); - /*input4_binding*/ ctx[14](input4); - append_dev(div1, t10); - append_dev(div1, span4); - /*span4_binding*/ ctx[16](span4); - append_dev(div1, t11); - append_dev(div1, button); - /*button_binding*/ ctx[17](button); - - if (!mounted) { - dispose = [ - listen_dev(input0, "input", /*input_handler*/ ctx[7], false, false, false), - listen_dev(input1, "input", /*input_handler_1*/ ctx[9], false, false, false), - listen_dev(input2, "input", /*input_handler_2*/ ctx[11], false, false, false), - listen_dev(input3, "input", /*input_handler_3*/ ctx[13], false, false, false), - listen_dev(input4, "input", /*input_handler_4*/ ctx[15], false, false, false), - listen_dev(button, "click", /*click_handler*/ ctx[18], false, false, false) - ]; - - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div1); - /*input0_binding*/ ctx[6](null); - /*input1_binding*/ ctx[8](null); - /*input2_binding*/ ctx[10](null); - /*input3_binding*/ ctx[12](null); - /*input4_binding*/ ctx[14](null); - /*span4_binding*/ ctx[16](null); - /*button_binding*/ ctx[17](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('confirmation-component', slots, []); - let confirmationInputs = []; - let confirmationMsg; - let confirmationButton; - - function onlyNumberKey(ind, evt) { - // Only ASCII character in that range allowed - var value = evt.data; - - if (value in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]) { - if (ind < 4) { - confirmationInputs[ind + 1].focus(); - } else { - AuthTools.confirmEmail(confirmationMsg, getCode(), callback); - } - } else { - $$invalidate(0, confirmationInputs[ind].value = "", confirmationInputs); - } - } - - function getCode() { - let code = ""; - - for (let input of confirmationInputs) { - code += input.value; - } - - return parseInt(code); - } - - function callback(response) { - if (response == "true") { - AuthTools.toDashboard(); - } else { - $$invalidate(1, confirmationMsg.innerHTML = "Wrong code", confirmationMsg); - } - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationInputs[0] = $$value; - $$invalidate(0, confirmationInputs); - }); - } - - const input_handler = evt => onlyNumberKey(0, evt); - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationInputs[1] = $$value; - $$invalidate(0, confirmationInputs); - }); - } - - const input_handler_1 = evt => onlyNumberKey(1, evt); - - function input2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationInputs[2] = $$value; - $$invalidate(0, confirmationInputs); - }); - } - - const input_handler_2 = evt => onlyNumberKey(2, evt); - - function input3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationInputs[3] = $$value; - $$invalidate(0, confirmationInputs); - }); - } - - const input_handler_3 = evt => onlyNumberKey(3, evt); - - function input4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationInputs[4] = $$value; - $$invalidate(0, confirmationInputs); - }); - } - - const input_handler_4 = evt => onlyNumberKey(4, evt); - - function span4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationMsg = $$value; - $$invalidate(1, confirmationMsg); - }); - } - - function button_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationButton = $$value; - $$invalidate(2, confirmationButton); - }); - } - - const click_handler = () => AuthTools.confirmEmail(confirmationMsg, getCode(), callback); - - $$self.$capture_state = () => ({ - onMount, - AuthTools, - confirmationInputs, - confirmationMsg, - confirmationButton, - onlyNumberKey, - getCode, - callback - }); - - $$self.$inject_state = $$props => { - if ('confirmationInputs' in $$props) $$invalidate(0, confirmationInputs = $$props.confirmationInputs); - if ('confirmationMsg' in $$props) $$invalidate(1, confirmationMsg = $$props.confirmationMsg); - if ('confirmationButton' in $$props) $$invalidate(2, confirmationButton = $$props.confirmationButton); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - confirmationInputs, - confirmationMsg, - confirmationButton, - onlyNumberKey, - getCode, - callback, - input0_binding, - input_handler, - input1_binding, - input_handler_1, - input2_binding, - input_handler_2, - input3_binding, - input_handler_3, - input4_binding, - input_handler_4, - span4_binding, - button_binding, - click_handler - ]; -} - -class Confirmation_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("confirmation-component", Confirmation_component); - -export { Confirmation_component as default }; +import{S as t,i as n,a as i,b as a,s,e as o,c as e,n as r,d as u,f as l,l as m,g as p,r as f,o as h,j as c}from"./index-db20528a.js";import*as d from"../../../../../../../../../js/libraries/authTools.js";function g(t){let n,i,s,h,c,d,g,x,b,C,y,v,I,w,j,k,E,T,z,M,O,R,D;return{c(){n=o("div"),i=o("h2"),i.textContent="CONFIRMATION CODE",s=e(),h=o("div"),c=o("input"),d=o("span"),d.textContent="-",g=e(),x=o("input"),b=o("span"),b.textContent="-",C=e(),y=o("input"),v=o("span"),v.textContent="-",I=e(),w=o("input"),j=o("span"),j.textContent="-",k=e(),E=o("input"),T=e(),z=o("span"),M=e(),O=o("button"),O.textContent="Confirm",this.c=r,u(i,"class","auth-title title-highlight"),u(c,"class","authConfirmationInput"),u(c,"type","text"),u(c,"maxlength","1"),u(d,"class","dash"),u(x,"class","authConfirmationInput"),u(x,"type","text"),u(x,"maxlength","1"),u(b,"class","dash"),u(y,"class","authConfirmationInput"),u(y,"type","text"),u(y,"maxlength","1"),u(v,"class","dash"),u(w,"class","authConfirmationInput"),u(w,"type","text"),u(w,"maxlength","1"),u(j,"class","dash"),u(E,"class","authConfirmationInput"),u(E,"type","text"),u(E,"maxlength","1"),u(h,"id","confirmationInputs"),u(z,"id","confirmation-msg"),u(O,"class","auth-button"),u(n,"class","pane auth-pane")},m(o,e){a(o,n,e),l(n,i),l(n,s),l(n,h),l(h,c),t[6](c),l(h,d),l(h,g),l(h,x),t[8](x),l(h,b),l(h,C),l(h,y),t[10](y),l(h,v),l(h,I),l(h,w),t[12](w),l(h,j),l(h,k),l(h,E),t[14](E),l(n,T),l(n,z),t[16](z),l(n,M),l(n,O),t[17](O),R||(D=[m(c,"input",t[7]),m(x,"input",t[9]),m(y,"input",t[11]),m(w,"input",t[13]),m(E,"input",t[15]),m(O,"click",t[18])],R=!0)},p:r,i:r,o:r,d(i){i&&p(n),t[6](null),t[8](null),t[10](null),t[12](null),t[14](null),t[16](null),t[17](null),R=!1,f(D)}}}function x(t,n,i){let a,s,o=[];function e(t,n){n.data in["0","1","2","3","4","5","6","7","8","9"]?t<4?o[t+1].focus():d.confirmEmail(a,r(),u):i(0,o[t].value="",o)}function r(){let t="";for(let n of o)t+=n.value;return parseInt(t)}function u(t){"true"==t?d.toDashboard():i(1,a.innerHTML="Wrong code",a)}h((()=>{}));return[o,a,s,e,r,u,function(t){c[t?"unshift":"push"]((()=>{o[0]=t,i(0,o)}))},t=>e(0,t),function(t){c[t?"unshift":"push"]((()=>{o[1]=t,i(0,o)}))},t=>e(1,t),function(t){c[t?"unshift":"push"]((()=>{o[2]=t,i(0,o)}))},t=>e(2,t),function(t){c[t?"unshift":"push"]((()=>{o[3]=t,i(0,o)}))},t=>e(3,t),function(t){c[t?"unshift":"push"]((()=>{o[4]=t,i(0,o)}))},t=>e(4,t),function(t){c[t?"unshift":"push"]((()=>{a=t,i(1,a)}))},function(t){c[t?"unshift":"push"]((()=>{s=t,i(2,s)}))},()=>d.confirmEmail(a,r(),u)]}class b extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:i(this.attributes),customElement:!0},x,g,s,{},null),t&&t.target&&a(t.target,this,t.anchor)}}customElements.define("confirmation-component",b);export{b as default}; diff --git a/Server/public/js/components/cookies-dialog.js b/Server/public/js/components/cookies-dialog.js index 470119b..806538d 100644 --- a/Server/public/js/components/cookies-dialog.js +++ b/Server/public/js/components/cookies-dialog.js @@ -1,99 +1 @@ - -(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, o as onMount, f as element, n as noop, j as add_location, k as attr_dev, l as append_dev, p as detach_dev } from './index-998178c7.js'; - -/* src\components\cookies-dialog.svelte generated by Svelte v3.52.0 */ -const file = "src\\components\\cookies-dialog.svelte"; - -function create_fragment(ctx) { - let div1; - let div0; - let p; - - const block = { - c: function create() { - div1 = element("div"); - div0 = element("div"); - p = element("p"); - p.textContent = "We use cookies to improve your experience, personalise your content and analyse site usage. By clicking “OK”, you agree to the use of cookies."; - this.c = noop; - add_location(p, file, 19, 8, 248); - add_location(div0, file, 18, 4, 233); - attr_dev(div1, "id", "wrapper"); - add_location(div1, file, 17, 0, 209); - }, - 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) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, p); - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div1); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('cookies-dialog', slots, []); - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - $$self.$capture_state = () => ({ onMount }); - return []; -} - -class Cookies_dialog extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("cookies-dialog", Cookies_dialog); - -export { Cookies_dialog as default }; +import{S as e,i as s,a as t,b as o,s as i,e as a,n as r,d as n,g as c,o as d}from"./index-db20528a.js";function p(e){let s;return{c(){s=a("div"),s.innerHTML="

    We use cookies to improve your experience, personalise your content and analyse site usage. By clicking “OK”, you agree to the use of cookies.

    ",this.c=r,n(s,"id","wrapper")},m(e,t){o(e,s,t)},p:r,i:r,o:r,d(e){e&&c(s)}}}function u(e){return d((()=>{})),[]}class h extends e{constructor(e){super(),this.shadowRoot.innerHTML="",s(this,{target:this.shadowRoot,props:t(this.attributes),customElement:!0},u,p,i,{},null),e&&e.target&&o(e.target,this,e.anchor)}}customElements.define("cookies-dialog",h);export{h as default}; diff --git a/Server/public/js/components/cooperatives-add-component.js b/Server/public/js/components/cooperatives-add-component.js index 7fa3ae0..db4974c 100644 --- a/Server/public/js/components/cooperatives-add-component.js +++ b/Server/public/js/components/cooperatives-add-component.js @@ -1,683 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, m as listen_dev, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { getData, loadLocaleContent, sendData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\cooperatives-add-component.svelte generated by Svelte v3.52.0 */ - -const file = "src\\cooperatives-add-component.svelte"; - -// (222:4) {#if $loaded==3} -function create_if_block(ctx) { - let div7; - let div6; - let h1; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t4; - let ol; - let li0; - let t6; - let li1; - let t8; - let li2; - let t10; - let li3; - let t12; - let div2; - let label0; - let t14; - let div1; - let input0; - let t15; - let div0; - let t16; - let div5; - let label1; - let t18; - let div4; - let input1; - let t19; - let div3; - let t20; - let button; - let t22; - let p1; - let t23; - let map_component; - let map_component_callback_value; - let mounted; - let dispose; - - const block = { - c: function create() { - div7 = element("div"); - div6 = element("div"); - h1 = element("h1"); - h1.textContent = "Add a Group"; - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - p0.textContent = "If there are no groups in your town with whom you can organize then do the following:"; - t4 = space(); - ol = element("ol"); - li0 = element("li"); - li0.textContent = "Click on the map to show us where you are located;"; - t6 = space(); - li1 = element("li"); - li1.textContent = "Add a way to contact you or leave blank for a pin to point to our discord;"; - t8 = space(); - li2 = element("li"); - li2.textContent = "Press \"Submit\" to add yourself to our map;"; - t10 = space(); - li3 = element("li"); - li3.textContent = "Verify yourself by having a chat with us at our Discord server to show on the map;"; - t12 = space(); - div2 = element("div"); - label0 = element("label"); - label0.textContent = "Location:"; - t14 = space(); - div1 = element("div"); - input0 = element("input"); - t15 = space(); - div0 = element("div"); - t16 = space(); - div5 = element("div"); - label1 = element("label"); - label1.textContent = "Contact:"; - t18 = space(); - div4 = element("div"); - input1 = element("input"); - t19 = space(); - div3 = element("div"); - t20 = space(); - button = element("button"); - button.textContent = "Submit"; - t22 = space(); - p1 = element("p"); - t23 = space(); - map_component = element("map-component"); - add_location(h1, file, 225, 16, 7502); - attr_dev(img, "id", "groups-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/groups.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "groups"); - add_location(img, file, 226, 16, 7540); - attr_dev(p0, "class", "description"); - add_location(p0, file, 227, 16, 7621); - add_location(li0, file, 229, 20, 7777); - add_location(li1, file, 230, 20, 7858); - add_location(li2, file, 231, 20, 7963); - add_location(li3, file, 232, 20, 8036); - add_location(ol, file, 228, 16, 7751); - attr_dev(label0, "for", "address-input"); - add_location(label0, file, 235, 20, 8250); - attr_dev(input0, "id", "address-input"); - attr_dev(input0, "type", "text"); - input0.readOnly = true; - add_location(input0, file, 237, 24, 8370); - attr_dev(div0, "class", "ghost-input"); - add_location(div0, file, 238, 24, 8511); - attr_dev(div1, "class", "input-wrapper"); - add_location(div1, file, 236, 20, 8317); - attr_dev(div2, "id", "address-input-wrapper"); - attr_dev(div2, "class", "input-label-wrapper"); - add_location(div2, file, 234, 16, 8168); - attr_dev(label1, "for", "contact-input"); - add_location(label1, file, 242, 20, 8667); - attr_dev(input1, "id", "contact-input"); - attr_dev(input1, "type", "text"); - add_location(input1, file, 244, 24, 8786); - attr_dev(div3, "class", "ghost-input"); - add_location(div3, file, 245, 24, 8918); - attr_dev(div4, "class", "input-wrapper"); - add_location(div4, file, 243, 20, 8733); - attr_dev(div5, "class", "input-label-wrapper"); - add_location(div5, file, 241, 16, 8612); - attr_dev(button, "id", "submit-button"); - add_location(button, file, 248, 16, 9019); - attr_dev(p1, "id", "confirmation-msg"); - add_location(p1, file, 249, 16, 9105); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[15]); - add_location(map_component, file, 250, 16, 9180); - attr_dev(div6, "id", "text-container"); - add_location(div6, file, 224, 12, 7459); - attr_dev(div7, "id", "container"); - add_location(div7, file, 222, 8, 7356); - }, - m: function mount(target, anchor) { - insert_dev(target, div7, anchor); - append_dev(div7, div6); - append_dev(div6, h1); - append_dev(div6, t1); - append_dev(div6, img); - append_dev(div6, t2); - append_dev(div6, p0); - append_dev(div6, t4); - append_dev(div6, ol); - append_dev(ol, li0); - append_dev(ol, t6); - append_dev(ol, li1); - append_dev(ol, t8); - append_dev(ol, li2); - append_dev(ol, t10); - append_dev(ol, li3); - append_dev(div6, t12); - append_dev(div6, div2); - append_dev(div2, label0); - append_dev(div2, t14); - append_dev(div2, div1); - append_dev(div1, input0); - /*input0_binding*/ ctx[10](input0); - append_dev(div1, t15); - append_dev(div1, div0); - append_dev(div6, t16); - append_dev(div6, div5); - append_dev(div5, label1); - append_dev(div5, t18); - append_dev(div5, div4); - append_dev(div4, input1); - /*input1_binding*/ ctx[12](input1); - append_dev(div4, t19); - append_dev(div4, div3); - append_dev(div6, t20); - append_dev(div6, button); - append_dev(div6, t22); - append_dev(div6, p1); - /*p1_binding*/ ctx[14](p1); - append_dev(div6, t23); - append_dev(div6, map_component); - - if (!mounted) { - dispose = [ - listen_dev(input0, "input", /*input_handler*/ ctx[11], false, false, false), - listen_dev(input1, "input", /*input_handler_1*/ ctx[13], false, false, false), - listen_dev(button, "click", /*submitLocation*/ ctx[9], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 16 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[15])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div7); - /*input0_binding*/ ctx[10](null); - /*input1_binding*/ ctx[12](null); - /*p1_binding*/ ctx[14](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(222:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (221:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[3] == 3 && create_if_block(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 (/*$loaded*/ ctx[3] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(221:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[3]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 8 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[3])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function createPin(lat, lng) { - let markerIcon = new L.Icon({ - iconUrl: '/img/common/markers/marker-black.png', - shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - shadowSize: [41, 41] - }); - - return L.marker([lat, lng], { icon: markerIcon }); -} - -function updatePin(marker, lat, lng) { - let newLatLng = L.latLng(lat, lng); // Replace with the desired coordinates - marker.setLatLng(newLatLng); -} - -function resizeInput(el) { - el.nextElementSibling.innerHTML = el.value; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('cooperatives-add-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(3, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(4, $content = value)); - let entries; - let entriesByCountry; - - let callback = response => { - entries = JSON.parse(response); - entriesByCountry = {}; - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - entriesByCountry[country] = [g]; - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/groups.json", callback); - let confirmationMsg; - let addressInput; - let contactInput; - let addressVec; - let userPinLat = 0; - let userPinLng = 0; - let userPin = createPin(0, 0); - userPin.setOpacity(0); - let locale = loadLocaleContent(content, "groups-component", loaded); - loadLocaleContent(content, "countries", loaded); - - function reverseGeocodeLocal(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - let fullAddress = country; - - if (state != undefined) { - fullAddress += ", " + state; - } else { - state = ""; - } - - if (city != undefined) { - fullAddress += ", " + city; - } else { - city = ""; - } - - $$invalidate(1, addressInput.value = fullAddress, addressInput); - resizeInput(addressInput); - }; - - getData(url, callback); - } - - function reverseGeocode(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2&accept-language=en`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - - if (state != undefined) ; else { - state = ""; - } - - if (city != undefined) ; else { - city = ""; - } - - addressVec = [country, state, city]; - }; - - getData(url, callback); - } - - function addGroupPinContent(g, content, locale) { - let coordinates; - let text = "" + content["Group"] + "
    "; - - for (let field of ["location", "members", "contact"]) { - let fieldText = content[field] + ": "; - - if (field == "contact") { - text += fieldText + "" + g.contact + ""; - } else if (field == "location") { - let location = [g.country, g.state, g.town].filter(x => x != null && x != undefined); - let locationString; - - if (locale == "en") { - locationString = location.map(x => x).join(", "); - } else { - locationString = location.map(x => translate(content, x)).join(", "); - } - - text += fieldText + locationString + "
    "; - coordinates = [g.latitude, g.longitude]; - } else { - text += fieldText + g[field] + "
    "; - } - } - - return { text, coordinates }; - } - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addGroupPinContent, "green"); - userPin.addTo(map); - - map.on('click', function (event) { - let lat = event.latlng.lat; - let lng = event.latlng.lng; - userPinLat = lat; - userPinLng = lng; - updatePin(userPin, lat, lng); - userPin.setOpacity(1); - reverseGeocodeLocal(lat, lng); - reverseGeocode(lat, lng); - }); - } - - function updateConfirmationMsg(response) { - if (response !== false) { - $$invalidate(0, confirmationMsg.innerHTML = "You have been added to our database! Now go to our Discord to verify yourself.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "green", confirmationMsg); - } else { - $$invalidate(0, confirmationMsg.innerHTML = "Something went wrong.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "red", confirmationMsg); - } - } - - function submitLocation() { - if (addressVec != undefined) { - let data = { - country: addressVec[0], - state: addressVec[1], - town: addressVec[2], - latitude: userPinLat, - longitude: userPinLng, - contact: contactInput.value - }; - - if (data.state == "") { - data.state = null; - } - - if (data.town == "") { - data.town = null; - } - - if (data.contact == "") { - data.contact = null; - } - - let url = "/" + locale + "/groups-add-post/"; - sendData(url, data, updateConfirmationMsg); - } - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - addressInput = $$value; - $$invalidate(1, addressInput); - }); - } - - const input_handler = () => resizeInput(addressInput); - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - contactInput = $$value; - $$invalidate(2, contactInput); - }); - } - - const input_handler_1 = () => resizeInput(contactInput); - - function p1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationMsg = $$value; - $$invalidate(0, confirmationMsg); - }); - } - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - sendData, - addMarkersEntries, - translate, - loaded, - content, - entries, - entriesByCountry, - callback, - confirmationMsg, - addressInput, - contactInput, - addressVec, - userPinLat, - userPinLng, - userPin, - locale, - createPin, - updatePin, - reverseGeocodeLocal, - reverseGeocode, - addGroupPinContent, - mapCallback, - updateConfirmationMsg, - submitLocation, - resizeInput, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(5, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(6, content = $$props.content); - if ('entries' in $$props) entries = $$props.entries; - if ('entriesByCountry' in $$props) entriesByCountry = $$props.entriesByCountry; - if ('callback' in $$props) callback = $$props.callback; - if ('confirmationMsg' in $$props) $$invalidate(0, confirmationMsg = $$props.confirmationMsg); - if ('addressInput' in $$props) $$invalidate(1, addressInput = $$props.addressInput); - if ('contactInput' in $$props) $$invalidate(2, contactInput = $$props.contactInput); - if ('addressVec' in $$props) addressVec = $$props.addressVec; - if ('userPinLat' in $$props) userPinLat = $$props.userPinLat; - if ('userPinLng' in $$props) userPinLng = $$props.userPinLng; - if ('userPin' in $$props) userPin = $$props.userPin; - if ('locale' in $$props) $$invalidate(7, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - confirmationMsg, - addressInput, - contactInput, - $loaded, - $content, - loaded, - content, - locale, - mapCallback, - submitLocation, - input0_binding, - input_handler, - input1_binding, - input_handler_1, - p1_binding, - func - ]; -} - -class Cooperatives_add_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("cooperatives-add-component", Cooperatives_add_component); - -export { Cooperatives_add_component as default }; +import{S as t,i as e,a as n,b as o,s as i,p as r,n as a,g as s,q as l,o as c,j as m,e as p,c as u,d,t as g,u as f,f as h,l as b,r as w}from"./index-db20528a.js";import{w as y}from"./index-720c0a59.js";import{getData as v,loadLocaleContent as x,sendData as k}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as j,translate as S}from"../../../../../../../../../js/libraries/mapTools.js";import"../../../../../../../../../js/components/map-component.js";function z(t){let e,n,i,r,a,l,c,m,y,v,x,k,j,L,S,z,T,C,N,O,H,M,A,$,q,E,J,U,D,G,I,R,K,P,Q;return{c(){e=p("div"),n=p("div"),i=p("h1"),i.textContent="Add a Group",r=u(),a=p("img"),c=u(),m=p("p"),m.textContent="If there are no groups in your town with whom you can organize then do the following:",y=u(),v=p("ol"),v.innerHTML="
  • Click on the map to show us where you are located;
  • \n
  • Add a way to contact you or leave blank for a pin to point to our discord;
  • \n
  • Press "Submit" to add yourself to our map;
  • \n
  • Verify yourself by having a chat with us at our Discord server to show on the map;
  • ",x=u(),k=p("div"),j=p("label"),j.textContent="Location:",L=u(),S=p("div"),z=p("input"),T=u(),C=p("div"),N=u(),O=p("div"),H=p("label"),H.textContent="Contact:",M=u(),A=p("div"),$=p("input"),q=u(),E=p("div"),J=u(),U=p("button"),U.textContent="Submit",D=u(),G=p("p"),I=u(),R=p("map-component"),d(a,"id","groups-img"),g(a.src,l="/img/common/groups.svg")||d(a,"src","/img/common/groups.svg"),d(a,"alt","groups"),d(m,"class","description"),d(j,"for","address-input"),d(z,"id","address-input"),d(z,"type","text"),z.readOnly=!0,d(C,"class","ghost-input"),d(S,"class","input-wrapper"),d(k,"id","address-input-wrapper"),d(k,"class","input-label-wrapper"),d(H,"for","contact-input"),d($,"id","contact-input"),d($,"type","text"),d(E,"class","ghost-input"),d(A,"class","input-wrapper"),d(O,"class","input-label-wrapper"),d(U,"id","submit-button"),d(G,"id","confirmation-msg"),f(R,"id","map"),f(R,"callback",K=t[15]),d(n,"id","text-container"),d(e,"id","container")},m(s,l){o(s,e,l),h(e,n),h(n,i),h(n,r),h(n,a),h(n,c),h(n,m),h(n,y),h(n,v),h(n,x),h(n,k),h(k,j),h(k,L),h(k,S),h(S,z),t[10](z),h(S,T),h(S,C),h(n,N),h(n,O),h(O,H),h(O,M),h(O,A),h(A,$),t[12]($),h(A,q),h(A,E),h(n,J),h(n,U),h(n,D),h(n,G),t[14](G),h(n,I),h(n,R),P||(Q=[b(z,"input",t[11]),b($,"input",t[13]),b(U,"click",t[9])],P=!0)},p(t,e){16&e&&K!==(K=t[15])&&f(R,"callback",K)},d(n){n&&s(e),t[10](null),t[12](null),t[14](null),P=!1,w(Q)}}}function T(t){let e,n=3==t[3]&&z(t);return{c(){n&&n.c(),e=r()},m(t,i){n&&n.m(t,i),o(t,e,i)},p(t,o){3==t[3]?n?n.p(t,o):(n=z(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function C(t){let e,n=t[3],l=T(t);return{c(){l.c(),e=r(),this.c=a},m(t,n){l.m(t,n),o(t,e,n)},p(t,[o]){8&o&&i(n,n=t[3])?(l.d(1),l=T(t),l.c(),l.m(e.parentNode,e)):l.p(t,o)},i:a,o:a,d(t){t&&s(e),l.d(t)}}}function N(t){t.nextElementSibling.innerHTML=t.value}function O(t,e,n){let o,i,r=y(0);l(t,r,(t=>n(3,o=t)));let a,s,p=y({});l(t,p,(t=>n(4,i=t)));let u,d,g,f;v("/assets/groups.json",(t=>{a=JSON.parse(t),s={};for(let t of a){let e=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),e in s?s[e].push(t):s[e]=[t]}r.update((t=>t+1))}));let h=0,b=0,w=function(t,e){let n=new L.Icon({iconUrl:"/img/common/markers/marker-black.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});return L.marker([t,e],{icon:n})}(0,0);w.setOpacity(0);let z=x(p,"groups-component",r);function T(t,e,n){let o,i=""+e.Group+"
    ";for(let r of["location","members","contact"]){let a=e[r]+": ";if("contact"==r)i+=a+""+t.contact+"";else if("location"==r){let r,s=[t.country,t.state,t.town].filter((t=>null!=t&&null!=t));r="en"==n?s.map((t=>t)).join(", "):s.map((t=>S(e,t))).join(", "),i+=a+r+"
    ",o=[t.latitude,t.longitude]}else i+=a+t[r]+"
    "}return{text:i,coordinates:o}}function C(t,e,o){let i=t([22,0],2);j(a,s,i,e,o,T,"green"),w.addTo(i),i.on("click",(function(t){let e=t.latlng.lat,o=t.latlng.lng;h=e,b=o,function(t,e,n){let o=L.latLng(e,n);t.setLatLng(o)}(w,e,o),w.setOpacity(1),v(`https://nominatim.openstreetmap.org/reverse?lat=${e}&lon=${o}&format=jsonv2`,(t=>{let e=(t=JSON.parse(t)).address,o=e.city||e.town||e.village||e.hamlet,i=e.state,r=e.country;null!=i?r+=", "+i:i="",null!=o?r+=", "+o:o="",n(1,d.value=r,d),N(d)})),function(t,e){v(`https://nominatim.openstreetmap.org/reverse?lat=${t}&lon=${e}&format=jsonv2&accept-language=en`,(t=>{let e=(t=JSON.parse(t)).address,n=e.city||e.town||e.village||e.hamlet,o=e.state,i=e.country;null!=o||(o=""),null!=n||(n=""),f=[i,o,n]}))}(e,o)}))}function O(t){!1!==t?(n(0,u.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",u),n(0,u.style.color="green",u)):(n(0,u.innerHTML="Something went wrong.",u),n(0,u.style.color="red",u))}x(p,"countries",r),c((()=>{}));return[u,d,g,o,i,r,p,z,C,function(){if(null!=f){let t={country:f[0],state:f[1],town:f[2],latitude:h,longitude:b,contact:g.value};""==t.state&&(t.state=null),""==t.town&&(t.town=null),""==t.contact&&(t.contact=null),k("/"+z+"/groups-add-post/",t,O)}},function(t){m[t?"unshift":"push"]((()=>{d=t,n(1,d)}))},()=>N(d),function(t){m[t?"unshift":"push"]((()=>{g=t,n(2,g)}))},()=>N(g),function(t){m[t?"unshift":"push"]((()=>{u=t,n(0,u)}))},t=>C(t,i,z)]}class H extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},O,C,i,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("cooperatives-add-component",H);export{H as default}; diff --git a/Server/public/js/components/cooperatives-component.js b/Server/public/js/components/cooperatives-component.js index b7baae4..b78c3dc 100644 --- a/Server/public/js/components/cooperatives-component.js +++ b/Server/public/js/components/cooperatives-component.js @@ -1,814 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addCoopPinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\cooperatives-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1, console: console_1 } = globals; - -const file = "src\\cooperatives-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i][0]; - child_ctx[3] = list[i][1]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} - -// (64:4) {#if $loaded==3} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[1].cooperatives + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t3_value = /*$content*/ ctx[1].p1 + ""; - let t3; - let t4; - let h3; - let t5_value = /*$content*/ ctx[1].subheading1 + ""; - let t5; - let t6; - let map_component; - let map_component_callback_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; - let t8; - let t9; - let each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - h3 = element("h3"); - t5 = text(t5_value); - t6 = space(); - map_component = element("map-component"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - add_location(h1, file, 66, 16, 2019); - attr_dev(img, "id", "coops-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/coops.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "coops"); - add_location(img, file, 67, 16, 2069); - attr_dev(p0, "class", "description"); - add_location(p0, file, 68, 16, 2147); - add_location(h3, file, 69, 16, 2205); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); - add_location(map_component, file, 70, 16, 2254); - attr_dev(p1, "id", "add-prompt"); - add_location(p1, file, 71, 16, 2377); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 65, 12, 1976); - attr_dev(div1, "id", "container"); - add_location(div1, file, 64, 8, 1942); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - append_dev(div0, p0); - append_dev(p0, t3); - append_dev(div0, t4); - append_dev(div0, h3); - append_dev(h3, t5); - append_dev(div0, t6); - append_dev(div0, map_component); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div0, t9); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div0, null); - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].cooperatives + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, console, getCountry*/ 771) { - each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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(div0, 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); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(64:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (76:24) {#each entries as entry} -function create_each_block_1(ctx) { - let t0_value = console.log(/*entry*/ ctx[15]) + ""; - let t0; - let t1; - let div2; - let div1; - let div0; - let p0; - let b0; - let t2_value = /*$content*/ ctx[1].name + ""; - let t2; - let t3; - let t4_value = /*entry*/ ctx[15].name + ""; - let t4; - let t5; - let p1; - let b1; - let t6_value = /*$content*/ ctx[1].location + ""; - let t6; - let t7; - let t8_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + ""; - let t8; - let t9; - let p2; - let b2; - let t10_value = /*$content*/ ctx[1].market + ""; - let t10; - let t11; - let t12_value = /*entry*/ ctx[15].market + ""; - let t12; - let t13; - let p3; - let b3; - let t14_value = /*$content*/ ctx[1].workers + ""; - let t14; - let t15; - let t16_value = /*entry*/ ctx[15].workers + ""; - let t16; - let t17; - let p4; - let b4; - let t18_value = /*$content*/ ctx[1].status + ""; - let t18; - let t19; - let t20_value = /*entry*/ ctx[15].status + ""; - let t20; - let t21; - let p5; - let b5; - let t22_value = /*$content*/ ctx[1].website + ""; - let t22; - let t23; - let a0; - let t24_value = /*entry*/ ctx[15].website + ""; - let t24; - let a0_href_value; - let t25; - let p6; - let b6; - let t26_value = /*$content*/ ctx[1].contact + ""; - let t26; - let t27; - let a1; - let t28_value = /*entry*/ ctx[15].contact + ""; - let t28; - let a1_href_value; - let t29; - let picture; - let source0; - let source0_srcset_value; - let t30; - let source1; - let source1_srcset_value; - let t31; - let img; - let t32; - let p7; - let b7; - let t33_value = /*$content*/ ctx[1].description + ""; - let t33; - let t34; - let t35_value = /*entry*/ ctx[15].description + ""; - let t35; - - const block = { - c: function create() { - t0 = text(t0_value); - t1 = space(); - div2 = element("div"); - div1 = element("div"); - div0 = element("div"); - p0 = element("p"); - b0 = element("b"); - t2 = text(t2_value); - t3 = text(": "); - t4 = text(t4_value); - t5 = space(); - p1 = element("p"); - b1 = element("b"); - t6 = text(t6_value); - t7 = text(": "); - t8 = text(t8_value); - t9 = space(); - p2 = element("p"); - b2 = element("b"); - t10 = text(t10_value); - t11 = text(": "); - t12 = text(t12_value); - t13 = space(); - p3 = element("p"); - b3 = element("b"); - t14 = text(t14_value); - t15 = text(": "); - t16 = text(t16_value); - t17 = space(); - p4 = element("p"); - b4 = element("b"); - t18 = text(t18_value); - t19 = text(": "); - t20 = text(t20_value); - t21 = space(); - p5 = element("p"); - b5 = element("b"); - t22 = text(t22_value); - t23 = text(": "); - a0 = element("a"); - t24 = text(t24_value); - t25 = space(); - p6 = element("p"); - b6 = element("b"); - t26 = text(t26_value); - t27 = text(": "); - a1 = element("a"); - t28 = text(t28_value); - t29 = space(); - picture = element("picture"); - source0 = element("source"); - t30 = space(); - source1 = element("source"); - t31 = space(); - img = element("img"); - t32 = space(); - p7 = element("p"); - b7 = element("b"); - t33 = text(t33_value); - t34 = text(": "); - t35 = text(t35_value); - add_location(b0, file, 80, 43, 2928); - add_location(p0, file, 80, 40, 2925); - add_location(b1, file, 81, 43, 3013); - add_location(p1, file, 81, 40, 3010); - add_location(b2, file, 82, 43, 3109); - add_location(p2, file, 82, 40, 3106); - add_location(b3, file, 83, 43, 3198); - add_location(p3, file, 83, 40, 3195); - add_location(b4, file, 84, 43, 3289); - add_location(p4, file, 84, 40, 3286); - add_location(b5, file, 85, 43, 3378); - attr_dev(a0, "href", a0_href_value = /*entry*/ ctx[15].website); - attr_dev(a0, "target", "_blank"); - attr_dev(a0, "rel", "noreferrer"); - add_location(a0, file, 85, 70, 3405); - add_location(p5, file, 85, 40, 3375); - add_location(b6, file, 86, 43, 3528); - attr_dev(a1, "href", a1_href_value = /*entry*/ ctx[15].contact); - attr_dev(a1, "target", ";_blank;"); - attr_dev(a1, "rel", "noreferrer"); - add_location(a1, file, 86, 70, 3555); - add_location(p6, file, 86, 40, 3525); - add_location(div0, file, 79, 36, 2878); - attr_dev(source0, "srcset", source0_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".webp"); - add_location(source0, file, 89, 40, 3766); - attr_dev(source1, "srcset", source1_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".png"); - add_location(source1, file, 90, 40, 3858); - attr_dev(img, "class", "coop-logo"); - attr_dev(img, "alt", "logo"); - add_location(img, file, 91, 40, 3949); - add_location(picture, file, 88, 36, 3715); - attr_dev(div1, "class", "img-general-info"); - add_location(div1, file, 78, 32, 2810); - add_location(b7, file, 94, 35, 4108); - add_location(p7, file, 94, 32, 4105); - attr_dev(div2, "class", "location-info"); - add_location(div2, file, 77, 28, 2749); - }, - m: function mount(target, anchor) { - insert_dev(target, t0, anchor); - insert_dev(target, t1, anchor); - insert_dev(target, div2, anchor); - append_dev(div2, div1); - append_dev(div1, div0); - append_dev(div0, p0); - append_dev(p0, b0); - append_dev(b0, t2); - append_dev(b0, t3); - append_dev(p0, t4); - append_dev(div0, t5); - append_dev(div0, p1); - append_dev(p1, b1); - append_dev(b1, t6); - append_dev(b1, t7); - append_dev(p1, t8); - append_dev(div0, t9); - append_dev(div0, p2); - append_dev(p2, b2); - append_dev(b2, t10); - append_dev(b2, t11); - append_dev(p2, t12); - append_dev(div0, t13); - append_dev(div0, p3); - append_dev(p3, b3); - append_dev(b3, t14); - append_dev(b3, t15); - append_dev(p3, t16); - append_dev(div0, t17); - append_dev(div0, p4); - append_dev(p4, b4); - append_dev(b4, t18); - append_dev(b4, t19); - append_dev(p4, t20); - append_dev(div0, t21); - append_dev(div0, p5); - append_dev(p5, b5); - append_dev(b5, t22); - append_dev(b5, t23); - append_dev(p5, a0); - append_dev(a0, t24); - append_dev(div0, t25); - append_dev(div0, p6); - append_dev(p6, b6); - append_dev(b6, t26); - append_dev(b6, t27); - append_dev(p6, a1); - append_dev(a1, t28); - append_dev(div1, t29); - append_dev(div1, picture); - append_dev(picture, source0); - append_dev(picture, t30); - append_dev(picture, source1); - append_dev(picture, t31); - append_dev(picture, img); - append_dev(div2, t32); - append_dev(div2, p7); - append_dev(p7, b7); - append_dev(b7, t33); - append_dev(b7, t34); - append_dev(p7, t35); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = console.log(/*entry*/ ctx[15]) + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t2_value !== (t2_value = /*$content*/ ctx[1].name + "")) set_data_dev(t2, t2_value); - if (dirty & /*entriesByCountry*/ 1 && t4_value !== (t4_value = /*entry*/ ctx[15].name + "")) set_data_dev(t4, t4_value); - if (dirty & /*$content*/ 2 && t6_value !== (t6_value = /*$content*/ ctx[1].location + "")) set_data_dev(t6, t6_value); - if (dirty & /*entriesByCountry*/ 1 && t8_value !== (t8_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + "")) set_data_dev(t8, t8_value); - if (dirty & /*$content*/ 2 && t10_value !== (t10_value = /*$content*/ ctx[1].market + "")) set_data_dev(t10, t10_value); - if (dirty & /*entriesByCountry*/ 1 && t12_value !== (t12_value = /*entry*/ ctx[15].market + "")) set_data_dev(t12, t12_value); - if (dirty & /*$content*/ 2 && t14_value !== (t14_value = /*$content*/ ctx[1].workers + "")) set_data_dev(t14, t14_value); - if (dirty & /*entriesByCountry*/ 1 && t16_value !== (t16_value = /*entry*/ ctx[15].workers + "")) set_data_dev(t16, t16_value); - if (dirty & /*$content*/ 2 && t18_value !== (t18_value = /*$content*/ ctx[1].status + "")) set_data_dev(t18, t18_value); - if (dirty & /*entriesByCountry*/ 1 && t20_value !== (t20_value = /*entry*/ ctx[15].status + "")) set_data_dev(t20, t20_value); - if (dirty & /*$content*/ 2 && t22_value !== (t22_value = /*$content*/ ctx[1].website + "")) set_data_dev(t22, t22_value); - if (dirty & /*entriesByCountry*/ 1 && t24_value !== (t24_value = /*entry*/ ctx[15].website + "")) set_data_dev(t24, t24_value); - - if (dirty & /*entriesByCountry*/ 1 && a0_href_value !== (a0_href_value = /*entry*/ ctx[15].website)) { - attr_dev(a0, "href", a0_href_value); - } - - if (dirty & /*$content*/ 2 && t26_value !== (t26_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t26, t26_value); - if (dirty & /*entriesByCountry*/ 1 && t28_value !== (t28_value = /*entry*/ ctx[15].contact + "")) set_data_dev(t28, t28_value); - - if (dirty & /*entriesByCountry*/ 1 && a1_href_value !== (a1_href_value = /*entry*/ ctx[15].contact)) { - attr_dev(a1, "href", a1_href_value); - } - - if (dirty & /*entriesByCountry*/ 1 && source0_srcset_value !== (source0_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".webp")) { - attr_dev(source0, "srcset", source0_srcset_value); - } - - if (dirty & /*entriesByCountry*/ 1 && source1_srcset_value !== (source1_srcset_value = "/img/coops/" + /*entry*/ ctx[15].logo + ".png")) { - attr_dev(source1, "srcset", source1_srcset_value); - } - - if (dirty & /*$content*/ 2 && t33_value !== (t33_value = /*$content*/ ctx[1].description + "")) set_data_dev(t33, t33_value); - if (dirty & /*entriesByCountry*/ 1 && t35_value !== (t35_value = /*entry*/ ctx[15].description + "")) set_data_dev(t35, t35_value); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(t0); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div2); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block_1.name, - type: "each", - source: "(76:24) {#each entries as entry}", - ctx - }); - - return block; -} - -// (73:16) {#each Object.entries(entriesByCountry) as [name,entries]} -function create_each_block(ctx) { - let h4; - let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + ""; - let t0; - let t1; - let div; - let t2; - let each_value_1 = /*entries*/ ctx[3]; - 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() { - h4 = element("h4"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr_dev(h4, "class", "country-name"); - add_location(h4, file, 73, 20, 2522); - attr_dev(div, "class", "country-block"); - add_location(div, file, 74, 20, 2592); - }, - m: function mount(target, anchor) { - insert_dev(target, h4, anchor); - append_dev(h4, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - append_dev(div, t2); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + "")) set_data_dev(t0, t0_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, console*/ 515) { - each_value_1 = /*entries*/ ctx[3]; - 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(div, t2); - } - } - - 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(h4); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(73:16) {#each Object.entries(entriesByCountry) as [name,entries]}", - ctx - }); - - return block; -} - -// (63:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 3 && create_if_block(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 (/*$loaded*/ ctx[2] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(63:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('cooperatives-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries; - let entriesByCountry; - let locale = loadLocaleContent(content, "cooperatives-component", loaded); - loadLocaleContent(content, "countries", loaded); - - let callback = response => { - $$invalidate(3, entries = JSON.parse(response)); - $$invalidate(0, entriesByCountry = {}); - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/cooperatives.json", callback); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addCoopPinContent, "blue"); - } - - function getCountry(x) { - return locale == "en" ? x : translate($content, x); - } - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addCoopPinContent, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - mapCallback, - getCountry, - getAddress, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); - if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - entriesByCountry, - $content, - $loaded, - entries, - loaded, - content, - locale, - mapCallback, - getCountry, - getAddress, - func - ]; -} - -class Cooperatives_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("cooperatives-component", Cooperatives_component); - -export { Cooperatives_component as default }; +import{S as t,i as e,a as o,b as n,s as r,p as i,n as s,g as a,q as c,o as m,e as l,v as p,c as g,d,t as u,u as f,f as h,w as b,x as w}from"./index-db20528a.js";import{w as x}from"./index-720c0a59.js";import{loadLocaleContent as v,getData as j}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as k,translate as y}from"../../../../../../../../../js/libraries/mapTools.js";import{addCoopPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,e,o){const n=t.slice();return n[12]=e[o][0],n[3]=e[o][1],n}function O(t,e,o){const n=t.slice();return n[15]=e[o],n}function T(t){let e,o,r,i,s,c,m,x,v,j,k,y,z,O,T,C,E,R,S,_,q=t[1].cooperatives+"",A=t[1].p1+"",F=t[1].subheading1+"",G=t[1]["map-prompt"]+"",H=Object.entries(t[0]),J=[];for(let e=0;eo(2,r=t)));let s,a,l=x({});c(t,l,(t=>o(1,n=t)));let p=v(l,"cooperatives-component",i);v(l,"countries",i);function g(t,e,o){let n=t([22,0],2);k(s,a,n,e,o,z,"blue",{enableCountryGrouping:!0})}j("/assets/cooperatives.json",(t=>{o(3,s=JSON.parse(t)),o(0,a={});for(let t of s){let e=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),e in a?a[e].push(t):o(0,a[e]=[t],a)}i.update((t=>t+1))})),m((()=>{}));return[a,n,r,s,i,l,p,g,function(t){return"en"==p?t:y(n,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:y(n,t))).join(", ")},t=>g(t,n,p)]}class _ extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},S,R,r,{},null),t&&t.target&&n(t.target,this,t.anchor)}}customElements.define("cooperatives-component",_);export{_ as default}; diff --git a/Server/public/js/components/footer-component.js b/Server/public/js/components/footer-component.js index b3d58a2..1fd4dc3 100644 --- a/Server/public/js/components/footer-component.js +++ b/Server/public/js/components/footer-component.js @@ -1,347 +1 @@ - -(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, w as validate_store, x as component_subscribe, y as empty, n as noop, p as detach_dev, f as element, B as text, h as space, G as svg_element, j as add_location, k as attr_dev, F as set_style, l as append_dev, m as listen_dev, C as set_data_dev } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; - -/* src\footer\footer-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\footer\\footer-component.svelte"; - -// (21:4) {#if $loaded==2} -function create_if_block(ctx) { - let footer; - let div2; - let div1; - let div0; - let h2; - let t0_value = /*$content*/ ctx[1].contactUs + ""; - let t0; - let t1; - let p0; - let t2; - let a0; - let t3_value = /*$content*/ ctx[1].inviteLink + ""; - let t3; - let t4; - let p1; - let t5; - let a1; - let t6_value = /*$content*/ ctx[1].inviteLink + ""; - let t6; - let t7; - let button; - let svg; - let g; - let rect; - let path; - let t8; - let p2; - let t9; - let a2; - let mounted; - let dispose; - - const block = { - c: function create() { - footer = element("footer"); - div2 = element("div"); - div1 = element("div"); - div0 = element("div"); - h2 = element("h2"); - t0 = text(t0_value); - t1 = space(); - p0 = element("p"); - t2 = text("Discord: "); - a0 = element("a"); - t3 = text(t3_value); - t4 = space(); - p1 = element("p"); - t5 = text("WhatsApp: "); - a1 = element("a"); - t6 = text(t6_value); - t7 = space(); - button = element("button"); - svg = svg_element("svg"); - g = svg_element("g"); - rect = svg_element("rect"); - path = svg_element("path"); - t8 = space(); - p2 = element("p"); - t9 = text("Licensed under a Creative Commons "); - a2 = element("a"); - a2.textContent = "CC BY 4.0 license"; - add_location(h2, file, 25, 24, 692); - attr_dev(a0, "href", "https://discord.gg/Qk8KUk787z"); - attr_dev(a0, "target", "_blank"); - attr_dev(a0, "rel", "noreferrer"); - set_style(a0, "margin-left", "1.8rem"); - add_location(a0, file, 27, 36, 858); - add_location(p0, file, 27, 24, 846); - attr_dev(a1, "href", "https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"); - attr_dev(a1, "target", "_blank"); - attr_dev(a1, "rel", "noreferrer"); - set_style(a1, "margin-left", "0.5rem"); - add_location(a1, file, 28, 37, 1026); - add_location(p1, file, 28, 24, 1013); - attr_dev(div0, "id", "contact-us-container"); - add_location(div0, file, 24, 20, 635); - attr_dev(div1, "id", "footer-grid-content-container"); - attr_dev(div1, "class", "logged"); - add_location(div1, file, 23, 16, 558); - attr_dev(rect, "id", "Rectangle_146"); - attr_dev(rect, "data-name", "Rectangle 146"); - attr_dev(rect, "width", "11"); - attr_dev(rect, "height", "51"); - attr_dev(rect, "rx", "5.5"); - attr_dev(rect, "transform", "translate(22 24)"); - attr_dev(rect, "fill", "var(--red)"); - add_location(rect, file, 34, 24, 1573); - attr_dev(path, "id", "Path_1145"); - attr_dev(path, "data-name", "Path 1145"); - attr_dev(path, "d", "M23.814,4.021a5,5,0,0,1,7.372,0l16.134,17.6c2.94,3.207,1.046,10.4-3.686,8.379S28.02,14.081,28.391,13.524,16.544,27.976,11.366,30,4.741,24.828,7.68,21.621Z"); - attr_dev(path, "fill", "var(--red)"); - add_location(path, file, 35, 24, 1730); - attr_dev(g, "id", "Group_268"); - attr_dev(g, "data-name", "Group 268"); - attr_dev(g, "transform", "translate(-6.177 -2.399)"); - add_location(g, file, 33, 24, 1470); - attr_dev(svg, "xmlns", "http://www.w3.org/2000/svg"); - attr_dev(svg, "width", "42.545"); - attr_dev(svg, "height", "72.601"); - attr_dev(svg, "viewBox", "0 0 42.545 72.601"); - add_location(svg, file, 32, 20, 1345); - attr_dev(button, "id", "footer-up"); - attr_dev(button, "aria-label", "go up"); - add_location(button, file, 31, 16, 1244); - attr_dev(a2, "href", "https://creativecommons.org/licenses/by/4.0/legalcode "); - attr_dev(a2, "target", "_blank"); - attr_dev(a2, "rel", "noreferrer"); - add_location(a2, file, 39, 75, 2143); - attr_dev(p2, "id", "footer-copyright"); - add_location(p2, file, 39, 16, 2084); - attr_dev(div2, "id", "footer-content-container"); - add_location(div2, file, 22, 12, 505); - add_location(footer, file, 21, 8, 483); - }, - m: function mount(target, anchor) { - insert_dev(target, footer, anchor); - append_dev(footer, div2); - append_dev(div2, div1); - append_dev(div1, div0); - append_dev(div0, h2); - append_dev(h2, t0); - append_dev(div0, t1); - append_dev(div0, p0); - append_dev(p0, t2); - append_dev(p0, a0); - append_dev(a0, t3); - append_dev(div0, t4); - append_dev(div0, p1); - append_dev(p1, t5); - append_dev(p1, a1); - append_dev(a1, t6); - append_dev(div2, t7); - append_dev(div2, button); - append_dev(button, svg); - append_dev(svg, g); - append_dev(g, rect); - append_dev(g, path); - append_dev(div2, t8); - append_dev(div2, p2); - append_dev(p2, t9); - append_dev(p2, a2); - - if (!mounted) { - dispose = listen_dev(button, "click", /*click_handler*/ ctx[4], false, false, false); - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].contactUs + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].inviteLink + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t6_value !== (t6_value = /*$content*/ ctx[1].inviteLink + "")) set_data_dev(t6, t6_value); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(footer); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(21:4) {#if $loaded==2}", - ctx - }); - - return block; -} - -// (20:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[0] == 2 && create_if_block(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 (/*$loaded*/ ctx[0] == 2) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(20:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[0]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 1 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[0])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('footer-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(0, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - loadLocaleContent(content, "countries", loaded); - loadLocaleContent(content, "footer-component", loaded); - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const click_handler = () => { - location.href = '#'; - }; - - $$self.$capture_state = () => ({ - writable, - loadLocaleContent, - loaded, - content, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(3, content = $$props.content); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [$loaded, $content, loaded, content, click_handler]; -} - -class Footer_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("footer-component", Footer_component); - -export { Footer_component as default }; +import{S as t,i as e,a as r,b as o,s as a,p as i,n,g as s,q as m,e as c,v as d,c as f,d as l,y as g,f as p,l as h,w as u}from"./index-db20528a.js";import{w as v}from"./index-720c0a59.js";import{loadLocaleContent as w}from"../../../../../../../../../js/libraries/serverTools.js";function b(t){let e,r,a,i,n,m,v,w,b,y,k,x,L,j,z,U,_,T,C,H,M,R,B=t[1].contactUs+"",N=t[1].inviteLink+"",A=t[1].inviteLink+"";return{c(){e=c("footer"),r=c("div"),a=c("div"),i=c("div"),n=c("h2"),m=d(B),v=f(),w=c("p"),b=d("Discord: "),y=c("a"),k=d(N),x=f(),L=c("p"),j=d("WhatsApp: "),z=c("a"),U=d(A),_=f(),T=c("button"),T.innerHTML='',C=f(),H=c("p"),H.innerHTML='Licensed under a Creative Commons CC BY 4.0 license',l(y,"href","https://discord.gg/Qk8KUk787z"),l(y,"target","_blank"),l(y,"rel","noreferrer"),g(y,"margin-left","1.8rem"),l(z,"href","https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"),l(z,"target","_blank"),l(z,"rel","noreferrer"),g(z,"margin-left","0.5rem"),l(i,"id","contact-us-container"),l(a,"id","footer-grid-content-container"),l(a,"class","logged"),l(T,"id","footer-up"),l(T,"aria-label","go up"),l(H,"id","footer-copyright"),l(r,"id","footer-content-container")},m(s,c){o(s,e,c),p(e,r),p(r,a),p(a,i),p(i,n),p(n,m),p(i,v),p(i,w),p(w,b),p(w,y),p(y,k),p(i,x),p(i,L),p(L,j),p(L,z),p(z,U),p(r,_),p(r,T),p(r,C),p(r,H),M||(R=h(T,"click",t[4]),M=!0)},p(t,e){2&e&&B!==(B=t[1].contactUs+"")&&u(m,B),2&e&&N!==(N=t[1].inviteLink+"")&&u(k,N),2&e&&A!==(A=t[1].inviteLink+"")&&u(U,A)},d(t){t&&s(e),M=!1,R()}}}function y(t){let e,r=2==t[0]&&b(t);return{c(){r&&r.c(),e=i()},m(t,a){r&&r.m(t,a),o(t,e,a)},p(t,o){2==t[0]?r?r.p(t,o):(r=b(t),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},d(t){r&&r.d(t),t&&s(e)}}}function k(t){let e,r=t[0],m=y(t);return{c(){m.c(),e=i(),this.c=n},m(t,r){m.m(t,r),o(t,e,r)},p(t,[o]){1&o&&a(r,r=t[0])?(m.d(1),m=y(t),m.c(),m.m(e.parentNode,e)):m.p(t,o)},i:n,o:n,d(t){t&&s(e),m.d(t)}}}function x(t,e,r){let o,a,i=v(0);m(t,i,(t=>r(0,o=t)));let n=v({});m(t,n,(t=>r(1,a=t))),w(n,"countries",i),w(n,"footer-component",i);return[o,a,i,n,()=>{location.href="#"}]}class L extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:r(this.attributes),customElement:!0},x,k,a,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("footer-component",L);export{L as default}; diff --git a/Server/public/js/components/groups-add-component.js b/Server/public/js/components/groups-add-component.js index cf530fc..0ebc34a 100644 --- a/Server/public/js/components/groups-add-component.js +++ b/Server/public/js/components/groups-add-component.js @@ -1,683 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, m as listen_dev, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { getData, loadLocaleContent, sendData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\groups-add-component.svelte generated by Svelte v3.52.0 */ - -const file = "src\\groups-add-component.svelte"; - -// (222:4) {#if $loaded==3} -function create_if_block(ctx) { - let div7; - let div6; - let h1; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t4; - let ol; - let li0; - let t6; - let li1; - let t8; - let li2; - let t10; - let li3; - let t12; - let div2; - let label0; - let t14; - let div1; - let input0; - let t15; - let div0; - let t16; - let div5; - let label1; - let t18; - let div4; - let input1; - let t19; - let div3; - let t20; - let button; - let t22; - let p1; - let t23; - let map_component; - let map_component_callback_value; - let mounted; - let dispose; - - const block = { - c: function create() { - div7 = element("div"); - div6 = element("div"); - h1 = element("h1"); - h1.textContent = "Add a Group"; - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - p0.textContent = "If there are no groups in your town with whom you can organize then do the following:"; - t4 = space(); - ol = element("ol"); - li0 = element("li"); - li0.textContent = "Click on the map to show us where you are located;"; - t6 = space(); - li1 = element("li"); - li1.textContent = "Add a way to contact you (an invite link or an email, not a phone number) or leave blank for a pin to point to our discord;"; - t8 = space(); - li2 = element("li"); - li2.textContent = "Press \"Submit\" to add yourself to our map;"; - t10 = space(); - li3 = element("li"); - li3.textContent = "Verify yourself by having a chat with us at our Discord server to show on the map;"; - t12 = space(); - div2 = element("div"); - label0 = element("label"); - label0.textContent = "Location:"; - t14 = space(); - div1 = element("div"); - input0 = element("input"); - t15 = space(); - div0 = element("div"); - t16 = space(); - div5 = element("div"); - label1 = element("label"); - label1.textContent = "Contact:"; - t18 = space(); - div4 = element("div"); - input1 = element("input"); - t19 = space(); - div3 = element("div"); - t20 = space(); - button = element("button"); - button.textContent = "Submit"; - t22 = space(); - p1 = element("p"); - t23 = space(); - map_component = element("map-component"); - add_location(h1, file, 225, 16, 7496); - attr_dev(img, "id", "groups-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/groups.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "groups"); - add_location(img, file, 226, 16, 7534); - attr_dev(p0, "class", "description"); - add_location(p0, file, 227, 16, 7615); - add_location(li0, file, 229, 20, 7771); - add_location(li1, file, 230, 20, 7852); - add_location(li2, file, 231, 20, 8006); - add_location(li3, file, 232, 20, 8079); - add_location(ol, file, 228, 16, 7745); - attr_dev(label0, "for", "address-input"); - add_location(label0, file, 235, 20, 8293); - attr_dev(input0, "id", "address-input"); - attr_dev(input0, "type", "text"); - input0.readOnly = true; - add_location(input0, file, 237, 24, 8413); - attr_dev(div0, "class", "ghost-input"); - add_location(div0, file, 238, 24, 8554); - attr_dev(div1, "class", "input-wrapper"); - add_location(div1, file, 236, 20, 8360); - attr_dev(div2, "id", "address-input-wrapper"); - attr_dev(div2, "class", "input-label-wrapper"); - add_location(div2, file, 234, 16, 8211); - attr_dev(label1, "for", "contact-input"); - add_location(label1, file, 242, 20, 8710); - attr_dev(input1, "id", "contact-input"); - attr_dev(input1, "type", "text"); - add_location(input1, file, 244, 24, 8829); - attr_dev(div3, "class", "ghost-input"); - add_location(div3, file, 245, 24, 8961); - attr_dev(div4, "class", "input-wrapper"); - add_location(div4, file, 243, 20, 8776); - attr_dev(div5, "class", "input-label-wrapper"); - add_location(div5, file, 241, 16, 8655); - attr_dev(button, "id", "submit-button"); - add_location(button, file, 248, 16, 9062); - attr_dev(p1, "id", "confirmation-msg"); - add_location(p1, file, 249, 16, 9148); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[15]); - add_location(map_component, file, 250, 16, 9223); - attr_dev(div6, "id", "text-container"); - add_location(div6, file, 224, 12, 7453); - attr_dev(div7, "id", "container"); - add_location(div7, file, 222, 8, 7350); - }, - m: function mount(target, anchor) { - insert_dev(target, div7, anchor); - append_dev(div7, div6); - append_dev(div6, h1); - append_dev(div6, t1); - append_dev(div6, img); - append_dev(div6, t2); - append_dev(div6, p0); - append_dev(div6, t4); - append_dev(div6, ol); - append_dev(ol, li0); - append_dev(ol, t6); - append_dev(ol, li1); - append_dev(ol, t8); - append_dev(ol, li2); - append_dev(ol, t10); - append_dev(ol, li3); - append_dev(div6, t12); - append_dev(div6, div2); - append_dev(div2, label0); - append_dev(div2, t14); - append_dev(div2, div1); - append_dev(div1, input0); - /*input0_binding*/ ctx[10](input0); - append_dev(div1, t15); - append_dev(div1, div0); - append_dev(div6, t16); - append_dev(div6, div5); - append_dev(div5, label1); - append_dev(div5, t18); - append_dev(div5, div4); - append_dev(div4, input1); - /*input1_binding*/ ctx[12](input1); - append_dev(div4, t19); - append_dev(div4, div3); - append_dev(div6, t20); - append_dev(div6, button); - append_dev(div6, t22); - append_dev(div6, p1); - /*p1_binding*/ ctx[14](p1); - append_dev(div6, t23); - append_dev(div6, map_component); - - if (!mounted) { - dispose = [ - listen_dev(input0, "input", /*input_handler*/ ctx[11], false, false, false), - listen_dev(input1, "input", /*input_handler_1*/ ctx[13], false, false, false), - listen_dev(button, "click", /*submitLocation*/ ctx[9], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 16 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[15])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div7); - /*input0_binding*/ ctx[10](null); - /*input1_binding*/ ctx[12](null); - /*p1_binding*/ ctx[14](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(222:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (221:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[3] == 3 && create_if_block(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 (/*$loaded*/ ctx[3] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(221:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[3]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 8 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[3])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function createPin(lat, lng) { - let markerIcon = new L.Icon({ - iconUrl: '/img/common/markers/marker-black.png', - shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - shadowSize: [41, 41] - }); - - return L.marker([lat, lng], { icon: markerIcon }); -} - -function updatePin(marker, lat, lng) { - let newLatLng = L.latLng(lat, lng); // Replace with the desired coordinates - marker.setLatLng(newLatLng); -} - -function resizeInput(el) { - el.nextElementSibling.innerHTML = el.value; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('groups-add-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(3, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(4, $content = value)); - let entries; - let entriesByCountry; - - let callback = response => { - entries = JSON.parse(response); - entriesByCountry = {}; - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - entriesByCountry[country] = [g]; - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/groups.json", callback); - let confirmationMsg; - let addressInput; - let contactInput; - let addressVec; - let userPinLat = 0; - let userPinLng = 0; - let userPin = createPin(0, 0); - userPin.setOpacity(0); - let locale = loadLocaleContent(content, "groups-component", loaded); - loadLocaleContent(content, "countries", loaded); - - function reverseGeocodeLocal(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - let fullAddress = country; - - if (state != undefined) { - fullAddress += ", " + state; - } else { - state = ""; - } - - if (city != undefined) { - fullAddress += ", " + city; - } else { - city = ""; - } - - $$invalidate(1, addressInput.value = fullAddress, addressInput); - resizeInput(addressInput); - }; - - getData(url, callback); - } - - function reverseGeocode(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2&accept-language=en`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - - if (state != undefined) ; else { - state = ""; - } - - if (city != undefined) ; else { - city = ""; - } - - addressVec = [country, state, city]; - }; - - getData(url, callback); - } - - function addGroupPinContent(g, content, locale) { - let coordinates; - let text = "" + content["Group"] + "
    "; - - for (let field of ["location", "members", "contact"]) { - let fieldText = content[field] + ": "; - - if (field == "contact") { - text += fieldText + "" + g.contact + ""; - } else if (field == "location") { - let location = [g.country, g.state, g.town].filter(x => x != null && x != undefined); - let locationString; - - if (locale == "en") { - locationString = location.map(x => x).join(", "); - } else { - locationString = location.map(x => translate(content, x)).join(", "); - } - - text += fieldText + locationString + "
    "; - coordinates = [g.latitude, g.longitude]; - } else { - text += fieldText + g[field] + "
    "; - } - } - - return { text, coordinates }; - } - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addGroupPinContent, "green"); - userPin.addTo(map); - - map.on('click', function (event) { - let lat = event.latlng.lat; - let lng = event.latlng.lng; - userPinLat = lat; - userPinLng = lng; - updatePin(userPin, lat, lng); - userPin.setOpacity(1); - reverseGeocodeLocal(lat, lng); - reverseGeocode(lat, lng); - }); - } - - function updateConfirmationMsg(response) { - if (response !== false) { - $$invalidate(0, confirmationMsg.innerHTML = "You have been added to our database! Now go to our Discord to verify yourself.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "green", confirmationMsg); - } else { - $$invalidate(0, confirmationMsg.innerHTML = "Something went wrong.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "red", confirmationMsg); - } - } - - function submitLocation() { - if (addressVec != undefined) { - let data = { - country: addressVec[0], - state: addressVec[1], - town: addressVec[2], - latitude: userPinLat, - longitude: userPinLng, - contact: contactInput.value - }; - - if (data.state == "") { - data.state = null; - } - - if (data.town == "") { - data.town = null; - } - - if (data.contact == "") { - data.contact = null; - } - - let url = "/" + locale + "/groups-add-post/"; - sendData(url, data, updateConfirmationMsg); - } - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - addressInput = $$value; - $$invalidate(1, addressInput); - }); - } - - const input_handler = () => resizeInput(addressInput); - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - contactInput = $$value; - $$invalidate(2, contactInput); - }); - } - - const input_handler_1 = () => resizeInput(contactInput); - - function p1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationMsg = $$value; - $$invalidate(0, confirmationMsg); - }); - } - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - sendData, - addMarkersEntries, - translate, - loaded, - content, - entries, - entriesByCountry, - callback, - confirmationMsg, - addressInput, - contactInput, - addressVec, - userPinLat, - userPinLng, - userPin, - locale, - createPin, - updatePin, - reverseGeocodeLocal, - reverseGeocode, - addGroupPinContent, - mapCallback, - updateConfirmationMsg, - submitLocation, - resizeInput, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(5, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(6, content = $$props.content); - if ('entries' in $$props) entries = $$props.entries; - if ('entriesByCountry' in $$props) entriesByCountry = $$props.entriesByCountry; - if ('callback' in $$props) callback = $$props.callback; - if ('confirmationMsg' in $$props) $$invalidate(0, confirmationMsg = $$props.confirmationMsg); - if ('addressInput' in $$props) $$invalidate(1, addressInput = $$props.addressInput); - if ('contactInput' in $$props) $$invalidate(2, contactInput = $$props.contactInput); - if ('addressVec' in $$props) addressVec = $$props.addressVec; - if ('userPinLat' in $$props) userPinLat = $$props.userPinLat; - if ('userPinLng' in $$props) userPinLng = $$props.userPinLng; - if ('userPin' in $$props) userPin = $$props.userPin; - if ('locale' in $$props) $$invalidate(7, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - confirmationMsg, - addressInput, - contactInput, - $loaded, - $content, - loaded, - content, - locale, - mapCallback, - submitLocation, - input0_binding, - input_handler, - input1_binding, - input_handler_1, - p1_binding, - func - ]; -} - -class Groups_add_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("groups-add-component", Groups_add_component); - -export { Groups_add_component as default }; +import{S as t,i as n,a as e,b as i,k as o,s as r,p as l,n as a,g as s,q as u,m as c,o as p,j as m,e as d,c as f,d as b,f as g,l as h,r as v,u as w,v as y}from"./index-db20528a.js";import{w as k}from"./index-720c0a59.js";import{getData as x,loadLocaleContent as j,sendData as C}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as $,translate as S}from"../../../../../../../../../js/libraries/mapTools.js";import"../../../../../../../../../js/components/map-component.js";function T(t){let n,e,o,l,a,u,c,p,m,w,y,k,x,j,L,C,$,S,T,O,A=t[7];function J(t,n){return t[14]?t[14]&&!t[8]?N:z:M}let E=J(t),U=E(t),I=G(t),R=!(t[14]&&t[8])&&H(t);return{c(){n=d("div"),e=d("button"),o=f(),l=d("div"),U.c(),a=f(),u=d("div"),c=d("label"),c.textContent="Location:",p=f(),m=d("div"),w=d("input"),y=f(),k=d("div"),x=f(),I.c(),j=f(),L=d("button"),L.textContent="Submit",C=f(),$=d("p"),S=f(),R&&R.c(),b(e,"class","close-button"),b(c,"for","address-input"),b(w,"id","address-input"),b(w,"type","text"),w.readOnly=!0,b(k,"class","ghost-input"),b(m,"class","input-wrapper"),b(u,"id","address-input-wrapper"),b(u,"class","input-label-wrapper"),b(L,"id","submit-button"),b($,"id","confirmation-msg"),b(l,"id","text-container"),b(n,"id","container")},m(r,s){i(r,n,s),g(n,e),g(n,o),g(n,l),U.m(l,null),g(l,a),g(l,u),g(u,c),g(u,p),g(u,m),g(m,w),t[33](w),g(m,y),g(m,k),g(l,x),I.m(l,null),g(l,j),g(l,L),g(l,C),g(l,$),t[38]($),g(l,S),R&&R.m(l,null),T||(O=[h(e,"click",t[13]),h(w,"input",t[34]),h(L,"click",t[17])],T=!0)},p(t,n){E===(E=J(t))&&U?U.p(t,n):(U.d(1),U=E(t),U&&(U.c(),U.m(l,a))),128&n[0]&&r(A,A=t[7])?(I.d(1),I=G(t),I.c(),I.m(l,j)):I.p(t,n),t[14]&&t[8]?R&&(R.d(1),R=null):R?R.p(t,n):(R=H(t),R.c(),R.m(l,null))},d(e){e&&s(n),U.d(),t[33](null),I.d(e),t[38](null),R&&R.d(),T=!1,v(O)}}}function z(t){let n,e,o,r;return{c(){n=d("div"),e=d("button"),e.textContent="Leave",b(n,"id","button-line")},m(l,a){i(l,n,a),g(n,e),t[30](e),t[32](n),o||(r=h(e,"click",t[31]),o=!0)},p:a,d(e){e&&s(n),t[30](null),t[32](null),o=!1,r()}}}function N(t){let n,e,o,r,l,a,u,c;return{c(){n=d("div"),e=d("button"),o=y("Move"),l=f(),a=d("button"),a.textContent="Leave",b(e,"style",r="display: "+(t[8]?"none":"initial")),b(n,"id","button-line")},m(r,s){i(r,n,s),g(n,e),g(e,o),t[25](e),g(n,l),g(n,a),t[27](a),t[29](n),u||(c=[h(e,"click",t[26]),h(a,"click",t[28])],u=!0)},p(t,n){256&n[0]&&r!==(r="display: "+(t[8]?"none":"initial"))&&b(e,"style",r)},d(e){e&&s(n),t[25](null),t[27](null),t[29](null),u=!1,v(c)}}}function M(t){let n,e,o,r,l,u;return{c(){n=d("div"),e=d("button"),e.textContent="Create",o=f(),r=d("button"),r.textContent="Join",b(n,"id","button-line")},m(a,s){i(a,n,s),g(n,e),t[20](e),g(n,o),g(n,r),t[22](r),t[24](n),l||(u=[h(e,"click",t[21]),h(r,"click",t[23])],l=!0)},p:a,d(e){e&&s(n),t[20](null),t[22](null),t[24](null),l=!1,v(u)}}}function O(t){let n,e,o,r,l;return{c(){n=d("div"),e=d("label"),e.textContent="Members:",o=f(),r=d("div"),l=d("input"),b(e,"for","members-input"),b(l,"id","members-input"),b(l,"type","text"),l.value=1,b(r,"class","input-wrapper"),b(n,"id","members-input-wrapper"),b(n,"class","input-label-wrapper")},m(a,s){i(a,n,s),g(n,e),g(n,o),g(n,r),g(r,l),t[35](l)},p:a,d(e){e&&s(n),t[35](null)}}}function A(t){let n,e,o,r,l,u,c,p,m;return{c(){n=d("div"),e=d("label"),e.textContent="Contact:",o=f(),r=d("div"),l=d("input"),u=f(),c=d("div"),b(e,"for","contact-input"),b(l,"id","contact-input"),b(l,"type","text"),b(c,"class","ghost-input"),b(r,"class","input-wrapper"),b(n,"class","input-label-wrapper")},m(a,s){i(a,n,s),g(n,e),g(n,o),g(n,r),g(r,l),t[36](l),g(r,u),g(r,c),p||(m=h(l,"input",t[37]),p=!0)},p:a,d(e){e&&s(n),t[36](null),p=!1,m()}}}function G(t){let n,e,o=0==t[7]&&O(t),r=(0==t[7]||1==t[7])&&A(t);return{c(){o&&o.c(),n=f(),r&&r.c(),e=l()},m(t,l){o&&o.m(t,l),i(t,n,l),r&&r.m(t,l),i(t,e,l)},p(t,i){0==t[7]?o?o.p(t,i):(o=O(t),o.c(),o.m(n.parentNode,n)):o&&(o.d(1),o=null),0==t[7]||1==t[7]?r?r.p(t,i):(r=A(t),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},d(t){o&&o.d(t),t&&s(n),r&&r.d(t),t&&s(e)}}}function H(t){let n,e;return{c(){n=d("map-component"),w(n,"id","map"),w(n,"callback",e=t[39])},m(t,e){i(t,n,e)},p(t,i){1024&i[0]&&e!==(e=t[39])&&w(n,"callback",e)},d(t){t&&s(n)}}}function J(t){let n,e=3==t[9]&&T(t);return{c(){e&&e.c(),n=l()},m(t,o){e&&e.m(t,o),i(t,n,o)},p(t,i){3==t[9]?e?e.p(t,i):(e=T(t),e.c(),e.m(n.parentNode,n)):e&&(e.d(1),e=null)},d(t){e&&e.d(t),t&&s(n)}}}function E(t){let n,e=t[9],o=J(t);return{c(){o.c(),n=l(),this.c=a},m(t,e){o.m(t,e),i(t,n,e)},p(t,i){512&i[0]&&r(e,e=t[9])?(o.d(1),o=J(t),o.c(),o.m(n.parentNode,n)):o.p(t,i)},i:a,o:a,d(t){t&&s(n),o.d(t)}}}function U(t,n,e){let i=L.latLng(n,e);t.setLatLng(i)}function I(t){t.nextElementSibling.innerHTML=t.value}function R(t,n,e){let i,o,{map:r=null}=n,l=k(0);u(t,l,(t=>e(9,i=t)));let a,s,d,f,b,g=k({});u(t,g,(t=>e(10,o=t)));let h,v,w,y;x("/assets/groups.json",(t=>{a=JSON.parse(t),s={};for(let t of a){let n=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),n in s?s[n].push(t):s[n]=[t]}l.update((t=>t+1))}));let T=["","",""],z={},N=function(t,n){let e=new L.Icon({iconUrl:"/img/common/markers/marker-black.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});return L.marker([t,n],{icon:e})}(0,0);N.setOpacity(0);let M,O=[],A=c("profile-component"),G=A.closeGroupsAdd,H=A.maps,J=A.onLoadedGroups,E=A.userGroups,R=A.user,_=0!=E.length,q=_?2:0;_&&(M=null!=E[0].status,M&&(q=3));let D=j(g,"groups-component",l);function K(t,n){x(`https://nominatim.openstreetmap.org/reverse?lat=${t}&lon=${n}&format=jsonv2`,(t=>{let n=(t=JSON.parse(t)).address,i=n.city||n.town||n.village||n.hamlet,o=n.state,r=n.country;null!=o?r+=", "+o:o="",null!=i?r+=", "+i:i="",e(3,v.value=r,v),I(v)}))}function Q(t,n){x(`https://nominatim.openstreetmap.org/reverse?lat=${t}&lon=${n}&format=jsonv2&accept-language=en`,(t=>{let n=(t=JSON.parse(t)).address;if(null!=n){let t=n.city||n.town||n.village||n.hamlet,e=n.state,i=n.country;null!=e||(e=""),null!=t||(t=""),T=[i,e,t]}}))}function Y(t,n,e){let i,o=""+n.Group+"
    ";for(let r of["location","members","contact"]){let l=n[r]+": ";if("contact"==r)o+=l+""+t.contact+"";else if("location"==r){let r,a=[t.country,t.state,t.town].filter((t=>null!=t&&null!=t));r="en"==e?a.map((t=>t)).join(", "):a.map((t=>S(n,t))).join(", "),o+=l+r+"
    ",i=[t.latitude,t.longitude]}else o+=l+t[r]+"
    "}return{text:o,coordinates:i}}function B(t,n,i){e(19,r=t([22,0],2)),H.groupsAdd=r,$(a,s,r,n,i,Y,"green",{enableCountryGrouping:!1,pinCallback:P}),N.addTo(r),r.on("click",(function(t){if(0==q){let n=t.latlng.lat,e=t.latlng.lng;z.latitude=n,z.longitude=e,z.id=null,U(N,n,e),N.setOpacity(1),K(n,e),Q(n,e)}}))}function F(t){!1!==t?(0!=q||R.verified?e(2,h.innerHTML="Success!",h):e(2,h.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",h),e(2,h.style.color="green",h),0!=q&&1!=q||(E[0]={}),E[0].country=""==T[0]?null:T[0],E[0].state=""==T[1]?null:T[1],E[0].town=""==T[2]?null:T[2],E[0].members=z.members,J()):(e(2,h.innerHTML="Something went wrong.",h),e(2,h.style.color="red",h))}function P(t,n){if(1==q){let e=n.latlng.lat,i=n.latlng.lng;z.latitude=e,z.longitude=i,z.id=t.id,z.members=t.members,U(N,e,i),N.setOpacity(1),K(e,i),Q(e,i)}}function V(t){for(let t of O)null!=t&&(t.style.background="rgba(197, 43, 40, 0.319)",t.style.color="black");e(6,O[t].style.background="rgb(197, 43, 40)",O),e(6,O[t].style.color="white",O),e(7,q=t)}function W(){if(3==i)V(q),2!=q&&3!=q||e(3,v.value=function(t){if(null!=t)return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==D?t:S(o,t))).join(", ");return"Create or join group"}(E[0]),v);else{setTimeout((()=>W()),100)}}j(g,"countries",l),p((()=>{W()}));return t.$$set=t=>{"map"in t&&e(19,r=t.map)},[f,b,h,v,w,y,O,q,M,i,o,l,g,G,_,D,B,function(){if(""!=T[0]||3==q){let t,n;0==q?(t=y.value,n=w.value):1==q?n=w.value:2==q||3==q?(t="",n=""):3==q&&(t="",n="",T=[null,null,null],z.latitude=null,z.longitude=null),d={country:T[0],state:T[1],town:T[2],latitude:z.latitude,longitude:z.longitude,contact:""==n?null:n,members:""==t?null:parseInt(t),group_id:z.id,mode:q},""==d.state&&(d.state=null),""==d.town&&(d.town=null),C("/"+D+"/groups-add-post/",d,F)}},V,r,function(t){m[t?"unshift":"push"]((()=>{O[0]=t,e(6,O)}))},()=>V(0),function(t){m[t?"unshift":"push"]((()=>{O[1]=t,e(6,O)}))},()=>V(1),function(t){m[t?"unshift":"push"]((()=>{b=t,e(1,b)}))},function(t){m[t?"unshift":"push"]((()=>{O[2]=t,e(6,O)}))},()=>V(2),function(t){m[t?"unshift":"push"]((()=>{O[3]=t,e(6,O)}))},()=>V(3),function(t){m[t?"unshift":"push"]((()=>{f=t,e(0,f)}))},function(t){m[t?"unshift":"push"]((()=>{O[3]=t,e(6,O)}))},()=>V(3),function(t){m[t?"unshift":"push"]((()=>{f=t,e(0,f)}))},function(t){m[t?"unshift":"push"]((()=>{v=t,e(3,v)}))},()=>I(v),function(t){m[t?"unshift":"push"]((()=>{y=t,e(5,y)}))},function(t){m[t?"unshift":"push"]((()=>{w=t,e(4,w)}))},()=>I(w),function(t){m[t?"unshift":"push"]((()=>{h=t,e(2,h)}))},t=>B(t,o,D)]}class _ extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},R,E,r,{map:19},null,[-1,-1]),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),o()))}static get observedAttributes(){return["map"]}get map(){return this.$$.ctx[19]}set map(t){this.$$set({map:t}),o()}}customElements.define("groups-add-component",_);export{_ as default}; diff --git a/Server/public/js/components/groups-component.js b/Server/public/js/components/groups-component.js index 9f9d8cd..e1d596f 100644 --- a/Server/public/js/components/groups-component.js +++ b/Server/public/js/components/groups-component.js @@ -1,622 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addGroupPinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\groups-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; - -const file = "src\\groups-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i][0]; - child_ctx[3] = list[i][1]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} - -// (64:4) {#if $loaded==3} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[1].groups + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t3_value = /*$content*/ ctx[1].p1 + ""; - let t3; - let t4; - let h3; - let t5_value = /*$content*/ ctx[1].subheading1 + ""; - let t5; - let t6; - let map_component; - let map_component_callback_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; - let t8; - let t9; - let each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - h3 = element("h3"); - t5 = text(t5_value); - t6 = space(); - map_component = element("map-component"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - add_location(h1, file, 67, 16, 2073); - attr_dev(img, "id", "groups-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/groups.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "groups"); - add_location(img, file, 68, 16, 2117); - attr_dev(p0, "class", "description"); - add_location(p0, file, 69, 16, 2198); - add_location(h3, file, 70, 16, 2256); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); - add_location(map_component, file, 71, 16, 2305); - attr_dev(p1, "id", "add-prompt"); - add_location(p1, file, 72, 16, 2428); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 66, 12, 2030); - attr_dev(div1, "id", "container"); - add_location(div1, file, 64, 8, 1927); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - append_dev(div0, p0); - append_dev(p0, t3); - append_dev(div0, t4); - append_dev(div0, h3); - append_dev(h3, t5); - append_dev(div0, t6); - append_dev(div0, map_component); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div0, t9); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div0, null); - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].groups + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, getCountry*/ 771) { - each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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(div0, 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); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(64:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (77:24) {#each entries as entry} -function create_each_block_1(ctx) { - let div; - let p0; - let b0; - let t0_value = /*$content*/ ctx[1].location + ""; - let t0; - let t1; - let t2_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + ""; - let t2; - let t3; - let p1; - let b1; - let t4_value = /*$content*/ ctx[1].members + ""; - let t4; - let t5; - let t6_value = /*entry*/ ctx[15].members + ""; - let t6; - let t7; - let p2; - let b2; - let t8_value = /*$content*/ ctx[1].contact + ""; - let t8; - let t9; - let a; - let t10_value = /*entry*/ ctx[15].contact + ""; - let t10; - let a_href_value; - - const block = { - c: function create() { - div = element("div"); - p0 = element("p"); - b0 = element("b"); - t0 = text(t0_value); - t1 = text(": "); - t2 = text(t2_value); - t3 = space(); - p1 = element("p"); - b1 = element("b"); - t4 = text(t4_value); - t5 = text(": "); - t6 = text(t6_value); - t7 = space(); - p2 = element("p"); - b2 = element("b"); - t8 = text(t8_value); - t9 = text(": "); - a = element("a"); - t10 = text(t10_value); - add_location(b0, file, 78, 35, 2814); - add_location(p0, file, 78, 32, 2811); - add_location(b1, file, 79, 35, 2902); - add_location(p1, file, 79, 32, 2899); - add_location(b2, file, 80, 35, 2985); - attr_dev(a, "href", a_href_value = /*entry*/ ctx[15].contact); - attr_dev(a, "target", ";_blank;"); - attr_dev(a, "rel", "noreferrer"); - add_location(a, file, 80, 62, 3012); - add_location(p2, file, 80, 32, 2982); - attr_dev(div, "class", "location-info"); - add_location(div, file, 77, 28, 2750); - }, - m: function mount(target, anchor) { - insert_dev(target, div, anchor); - append_dev(div, p0); - append_dev(p0, b0); - append_dev(b0, t0); - append_dev(b0, t1); - append_dev(p0, t2); - append_dev(div, t3); - append_dev(div, p1); - append_dev(p1, b1); - append_dev(b1, t4); - append_dev(b1, t5); - append_dev(p1, t6); - append_dev(div, t7); - append_dev(div, p2); - append_dev(p2, b2); - append_dev(b2, t8); - append_dev(b2, t9); - append_dev(p2, a); - append_dev(a, t10); - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].location + "")) set_data_dev(t0, t0_value); - if (dirty & /*entriesByCountry*/ 1 && t2_value !== (t2_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + "")) set_data_dev(t2, t2_value); - if (dirty & /*$content*/ 2 && t4_value !== (t4_value = /*$content*/ ctx[1].members + "")) set_data_dev(t4, t4_value); - if (dirty & /*entriesByCountry*/ 1 && t6_value !== (t6_value = /*entry*/ ctx[15].members + "")) set_data_dev(t6, t6_value); - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t8, t8_value); - if (dirty & /*entriesByCountry*/ 1 && t10_value !== (t10_value = /*entry*/ ctx[15].contact + "")) set_data_dev(t10, t10_value); - - if (dirty & /*entriesByCountry*/ 1 && a_href_value !== (a_href_value = /*entry*/ ctx[15].contact)) { - attr_dev(a, "href", a_href_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block_1.name, - type: "each", - source: "(77:24) {#each entries as entry}", - ctx - }); - - return block; -} - -// (74:16) {#each Object.entries(entriesByCountry) as [name,entries]} -function create_each_block(ctx) { - let h4; - let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + ""; - let t0; - let t1; - let div; - let t2; - let each_value_1 = /*entries*/ ctx[3]; - 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() { - h4 = element("h4"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr_dev(h4, "class", "country-name"); - add_location(h4, file, 74, 20, 2573); - attr_dev(div, "class", "country-block"); - add_location(div, file, 75, 20, 2643); - }, - m: function mount(target, anchor) { - insert_dev(target, h4, anchor); - append_dev(h4, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - append_dev(div, t2); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + "")) set_data_dev(t0, t0_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress*/ 515) { - each_value_1 = /*entries*/ ctx[3]; - 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(div, t2); - } - } - - 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(h4); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(74:16) {#each Object.entries(entriesByCountry) as [name,entries]}", - ctx - }); - - return block; -} - -// (63:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 3 && create_if_block(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 (/*$loaded*/ ctx[2] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(63:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('groups-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries; - let entriesByCountry; - let locale = loadLocaleContent(content, "groups-component", loaded); - loadLocaleContent(content, "countries", loaded); - - let callback = response => { - $$invalidate(3, entries = JSON.parse(response)); - $$invalidate(0, entriesByCountry = {}); - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/groups.json", callback); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addGroupPinContent, "green"); - } - - function getCountry(x) { - return locale == "en" ? x : translate($content, x); - } - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addGroupPinContent, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - mapCallback, - getCountry, - getAddress, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); - if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - entriesByCountry, - $content, - $loaded, - entries, - loaded, - content, - locale, - mapCallback, - getCountry, - getAddress, - func - ]; -} - -class Groups_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("groups-component", Groups_component); - -export { Groups_component as default }; +import{S as t,i as o,a as n,b as e,s as r,p as s,n as a,g as i,q as m,o as c,e as l,v as p,c as u,d as g,t as d,u as f,f as h,w as b,x as j}from"./index-db20528a.js";import{w as x}from"./index-720c0a59.js";import{loadLocaleContent as v,getData as w}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as y,translate as k}from"../../../../../../../../../js/libraries/mapTools.js";import{addGroupPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,o,n){const e=t.slice();return e[12]=o[n][0],e[3]=o[n][1],e}function O(t,o,n){const e=t.slice();return e[15]=o[n],e}function T(t){let o,n,r,s,a,m,c,x,v,w,y,k,z,O,T,D,R,S,q,A,C=t[1].groups+"",F=t[1].p1+"",H=t[1].subheading1+"",J=t[1]["map-prompt"]+"",K=Object.entries(t[0]),L=[];for(let o=0;on(2,r=t)));let a,i,l=x({});m(t,l,(t=>n(1,e=t)));let p=v(l,"groups-component",s);v(l,"countries",s);function u(t,o,n){let e=t([22,0],2);y(a,i,e,o,n,z,"green")}w("/assets/groups.json",(t=>{n(3,a=JSON.parse(t)),n(0,i={});for(let t of a){let o=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),o in i?i[o].push(t):n(0,i[o]=[t],i)}s.update((t=>t+1))})),c((()=>{}));return[i,e,r,a,s,l,p,u,function(t){return"en"==p?t:k(e,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:k(e,t))).join(", ")},t=>u(t,e,p)]}class A extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},q,S,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("groups-component",A);export{A as default}; diff --git a/Server/public/js/components/index-0f28c1ea.js b/Server/public/js/components/index-0f28c1ea.js new file mode 100644 index 0000000..0200628 --- /dev/null +++ b/Server/public/js/components/index-0f28c1ea.js @@ -0,0 +1,53 @@ + +(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 { n as noop, s as safe_not_equal } from './index-e7d4b1a1.js'; + +const subscriber_queue = []; +/** + * Create a `Writable` store that allows both updating and reading by subscription. + * @param {*=}value initial value + * @param {StartStopNotifier=}start start and stop notifications for subscriptions + */ +function writable(value, start = noop) { + let stop; + const subscribers = new Set(); + function set(new_value) { + if (safe_not_equal(value, new_value)) { + value = new_value; + if (stop) { // store is ready + const run_queue = !subscriber_queue.length; + for (const subscriber of subscribers) { + subscriber[1](); + subscriber_queue.push(subscriber, value); + } + if (run_queue) { + for (let i = 0; i < subscriber_queue.length; i += 2) { + subscriber_queue[i][0](subscriber_queue[i + 1]); + } + subscriber_queue.length = 0; + } + } + } + } + function update(fn) { + set(fn(value)); + } + function subscribe(run, invalidate = noop) { + const subscriber = [run, invalidate]; + subscribers.add(subscriber); + if (subscribers.size === 1) { + stop = start(set) || noop; + } + run(value); + return () => { + subscribers.delete(subscriber); + if (subscribers.size === 0) { + stop(); + stop = null; + } + }; + } + return { set, update, subscribe }; +} + +export { writable as w }; diff --git a/Server/public/js/components/index-720c0a59.js b/Server/public/js/components/index-720c0a59.js new file mode 100644 index 0000000..66b4fe3 --- /dev/null +++ b/Server/public/js/components/index-720c0a59.js @@ -0,0 +1 @@ +import{n,s as t}from"./index-db20528a.js";const e=[];function s(s,o=n){let i;const c=new Set;function f(n){if(t(s,n)&&(s=n,i)){const n=!e.length;for(const n of c)n[1](),e.push(n,s);if(n){for(let n=0;n{c.delete(r),0===c.size&&(i(),i=null)}}}}export{s as w}; diff --git a/Server/public/js/components/index-db20528a.js b/Server/public/js/components/index-db20528a.js new file mode 100644 index 0000000..4baf1c9 --- /dev/null +++ b/Server/public/js/components/index-db20528a.js @@ -0,0 +1 @@ +function t(){}function n(t){return t()}function e(){return Object.create(null)}function o(t){t.forEach(n)}function s(t){return"function"==typeof t}function r(t,n){return t!=t?n==n:t!==n||t&&"object"==typeof t||"function"==typeof t}let i,c;function u(t,n){return i||(i=document.createElement("a")),i.href=n,t===i.href}function a(n,e,o){n.$$.on_destroy.push(function(n,...e){if(null==n)return t;const o=n.subscribe(...e);return o.unsubscribe?()=>o.unsubscribe():o}(e,o))}function f(t,n){t.appendChild(n)}function l(t,n,e){t.insertBefore(n,e||null)}function h(t){t.parentNode.removeChild(t)}function d(t,n){for(let e=0;et.removeEventListener(n,e,o)}function y(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function _(t,n,e){n in t?t[n]="boolean"==typeof t[n]&&""===e||e:y(t,n,e)}function x(t,n){n=""+n,t.wholeText!==n&&(t.data=n)}function v(t,n){t.value=null==n?"":n}function E(t,n,e,o){null===e?t.style.removeProperty(n):t.style.setProperty(n,e,o?"important":"")}class w{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,n,e=null){var o;this.e||(this.is_svg?this.e=(o=n.nodeName,document.createElementNS("http://www.w3.org/2000/svg",o)):this.e=$(n.nodeName),this.t=n,this.c(t)),this.i(e)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let n=0;n{const o=e.length?e[0]:n;return m.ctx&&f(m.ctx[t],m.ctx[t]=o)&&(!m.skip_bound&&m.bound[t]&&m.bound[t](o),g&&I(r,t)),n})):[],m.update(),g=!0,o(m.before_update),m.fragment=!!a&&a(m.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);m.fragment&&m.fragment.l(t),t.forEach(h)}else m.fragment&&m.fragment.c();i.intro&&((b=r.$$.fragment)&&b.i&&(G.delete(b),b.i(y))),function(t,e,r,i){const{fragment:c,after_update:u}=t.$$;c&&c.m(e,r),i||q((()=>{const e=t.$$.on_mount.map(n).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):o(e),t.$$.on_mount=[]})),u.forEach(q)}(r,i.target,i.anchor,i.customElement),F()}var b,y;C(p)}let K;"function"==typeof HTMLElement&&(K=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(n).filter(s);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,n,e){this[t]=e}disconnectedCallback(){o(this.$$.on_disconnect)}$destroy(){!function(t,n){const e=t.$$;null!==e.fragment&&(o(e.on_destroy),e.fragment&&e.fragment.d(n),e.on_destroy=e.fragment=null,e.ctx=[])}(this,1),this.$destroy=t}$on(n,e){if(!s(e))return t;const o=this.$$.callbacks[n]||(this.$$.callbacks[n]=[]);return o.push(e),()=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}$set(t){var n;this.$$set&&(n=t,0!==Object.keys(n).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});export{v as A,w as H,K as S,k as a,l as b,m as c,y as d,$ as e,f,h as g,L as h,J as i,j,F as k,b as l,S as m,t as n,A as o,g as p,a as q,o as r,r as s,u as t,_ as u,p as v,x as w,d as x,E as y,s as z}; diff --git a/Server/public/js/components/index-e7d4b1a1.js b/Server/public/js/components/index-e7d4b1a1.js new file mode 100644 index 0000000..040d96a --- /dev/null +++ b/Server/public/js/components/index-e7d4b1a1.js @@ -0,0 +1,524 @@ + +(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); +function noop() { } +function add_location(element, file, line, column, char) { + element.__svelte_meta = { + loc: { file, line, column, char } + }; +} +function run(fn) { + return fn(); +} +function blank_object() { + return Object.create(null); +} +function run_all(fns) { + fns.forEach(run); +} +function is_function(thing) { + return typeof thing === 'function'; +} +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); +} +let src_url_equal_anchor; +function src_url_equal(element_src, url) { + if (!src_url_equal_anchor) { + src_url_equal_anchor = document.createElement('a'); + } + src_url_equal_anchor.href = url; + return element_src === src_url_equal_anchor.href; +} +function is_empty(obj) { + return Object.keys(obj).length === 0; +} +function validate_store(store, name) { + if (store != null && typeof store.subscribe !== 'function') { + throw new Error(`'${name}' is not a store with a 'subscribe' method`); + } +} +function subscribe(store, ...callbacks) { + if (store == null) { + return noop; + } + const unsub = store.subscribe(...callbacks); + return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; +} +function component_subscribe(component, store, callback) { + component.$$.on_destroy.push(subscribe(store, callback)); +} +function append(target, node) { + target.appendChild(node); +} +function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); +} +function detach(node) { + node.parentNode.removeChild(node); +} +function destroy_each(iterations, detaching) { + for (let i = 0; i < iterations.length; i += 1) { + if (iterations[i]) + iterations[i].d(detaching); + } +} +function element(name) { + return document.createElement(name); +} +function svg_element(name) { + return document.createElementNS('http://www.w3.org/2000/svg', name); +} +function text(data) { + return document.createTextNode(data); +} +function space() { + return text(' '); +} +function empty() { + return text(''); +} +function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); +} +function attr(node, attribute, value) { + if (value == null) + node.removeAttribute(attribute); + else if (node.getAttribute(attribute) !== value) + node.setAttribute(attribute, value); +} +function set_custom_element_data(node, prop, value) { + if (prop in node) { + node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value; + } + else { + attr(node, prop, value); + } +} +function children(element) { + return Array.from(element.childNodes); +} +function set_input_value(input, value) { + input.value = value == null ? '' : value; +} +function set_style(node, key, value, important) { + if (value === null) { + node.style.removeProperty(key); + } + else { + node.style.setProperty(key, value, important ? 'important' : ''); + } +} +function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { + const e = document.createEvent('CustomEvent'); + e.initCustomEvent(type, bubbles, cancelable, detail); + return e; +} +class HtmlTag { + constructor(is_svg = false) { + this.is_svg = false; + this.is_svg = is_svg; + this.e = this.n = null; + } + c(html) { + this.h(html); + } + m(html, target, anchor = null) { + if (!this.e) { + if (this.is_svg) + this.e = svg_element(target.nodeName); + else + this.e = element(target.nodeName); + this.t = target; + this.c(html); + } + this.i(anchor); + } + h(html) { + this.e.innerHTML = html; + this.n = Array.from(this.e.childNodes); + } + i(anchor) { + for (let i = 0; i < this.n.length; i += 1) { + insert(this.t, this.n[i], anchor); + } + } + p(html) { + this.d(); + this.h(html); + this.i(this.a); + } + d() { + this.n.forEach(detach); + } +} +function attribute_to_object(attributes) { + const result = {}; + for (const attribute of attributes) { + result[attribute.name] = attribute.value; + } + return result; +} + +let current_component; +function set_current_component(component) { + current_component = component; +} +function get_current_component() { + if (!current_component) + throw new Error('Function called outside component initialization'); + return current_component; +} +/** + * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. + * It must be called during the component's initialisation (but doesn't need to live *inside* the component; + * it can be called from an external module). + * + * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api). + * + * https://svelte.dev/docs#run-time-svelte-onmount + */ +function onMount(fn) { + get_current_component().$$.on_mount.push(fn); +} +/** + * Schedules a callback to run immediately after the component has been updated. + * + * The first time the callback runs will be after the initial `onMount` + */ +function afterUpdate(fn) { + get_current_component().$$.after_update.push(fn); +} +/** + * Associates an arbitrary `context` object with the current component and the specified `key` + * and returns that object. The context is then available to children of the component + * (including slotted content) with `getContext`. + * + * Like lifecycle functions, this must be called during component initialisation. + * + * https://svelte.dev/docs#run-time-svelte-setcontext + */ +function setContext(key, context) { + get_current_component().$$.context.set(key, context); + return context; +} +/** + * Retrieves the context that belongs to the closest parent component with the specified `key`. + * Must be called during component initialisation. + * + * https://svelte.dev/docs#run-time-svelte-getcontext + */ +function getContext(key) { + return get_current_component().$$.context.get(key); +} + +const dirty_components = []; +const binding_callbacks = []; +const render_callbacks = []; +const flush_callbacks = []; +const resolved_promise = Promise.resolve(); +let update_scheduled = false; +function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } +} +function add_render_callback(fn) { + render_callbacks.push(fn); +} +// flush() calls callbacks in this order: +// 1. All beforeUpdate callbacks, in order: parents before children +// 2. All bind:this callbacks, in reverse order: children before parents. +// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT +// for afterUpdates called during the initial onMount, which are called in +// reverse order: children before parents. +// Since callbacks might update component values, which could trigger another +// call to flush(), the following steps guard against this: +// 1. During beforeUpdate, any updated components will be added to the +// dirty_components array and will cause a reentrant call to flush(). Because +// the flush index is kept outside the function, the reentrant call will pick +// up where the earlier call left off and go through all dirty components. The +// current_component value is saved and restored so that the reentrant call will +// not interfere with the "parent" flush() call. +// 2. bind:this callbacks cannot trigger new flush() calls. +// 3. During afterUpdate, any updated components will NOT have their afterUpdate +// callback called a second time; the seen_callbacks set, outside the flush() +// function, guarantees this behavior. +const seen_callbacks = new Set(); +let flushidx = 0; // Do *not* move this inside the flush() function +function flush() { + const saved_component = current_component; + do { + // first, call beforeUpdate functions + // and update components + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; + set_current_component(component); + update(component.$$); + } + set_current_component(null); + dirty_components.length = 0; + flushidx = 0; + while (binding_callbacks.length) + binding_callbacks.pop()(); + // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + for (let i = 0; i < render_callbacks.length; i += 1) { + const callback = render_callbacks[i]; + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + render_callbacks.length = 0; + } while (dirty_components.length); + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + update_scheduled = false; + seen_callbacks.clear(); + set_current_component(saved_component); +} +function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } +} +const outroing = new Set(); +function transition_in(block, local) { + if (block && block.i) { + outroing.delete(block); + block.i(local); + } +} + +const globals = (typeof window !== 'undefined' + ? window + : typeof globalThis !== 'undefined' + ? globalThis + : global); +function mount_component(component, target, anchor, customElement) { + const { fragment, after_update } = component.$$; + fragment && fragment.m(target, anchor); + if (!customElement) { + // onMount happens before the initial afterUpdate + add_render_callback(() => { + const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); + // if the component was destroyed immediately + // it will update the `$$.on_destroy` reference to `null`. + // the destructured on_destroy may still reference to the old array + if (component.$$.on_destroy) { + component.$$.on_destroy.push(...new_on_destroy); + } + else { + // Edge case - component was destroyed immediately, + // most likely as a result of a binding initialising + run_all(new_on_destroy); + } + component.$$.on_mount = []; + }); + } + after_update.forEach(add_render_callback); +} +function destroy_component(component, detaching) { + const $$ = component.$$; + if ($$.fragment !== null) { + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); + // TODO null out other refs, including component.$$ (but need to + // preserve final state?) + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } +} +function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); +} +function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) { + const parent_component = current_component; + set_current_component(component); + const $$ = component.$$ = { + fragment: null, + ctx: [], + // state + props, + update: noop, + not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + on_disconnect: [], + before_update: [], + after_update: [], + context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), + // everything else + callbacks: blank_object(), + dirty, + skip_bound: false, + root: options.target || parent_component.$$.root + }; + append_styles && append_styles($$.root); + let ready = false; + $$.ctx = instance + ? instance(component, options.props || {}, (i, ret, ...rest) => { + const value = rest.length ? rest[0] : ret; + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) + $$.bound[i](value); + if (ready) + make_dirty(component, i); + } + return ret; + }) + : []; + $$.update(); + ready = true; + run_all($$.before_update); + // `false` as a special case of no DOM component + $$.fragment = create_fragment ? create_fragment($$.ctx) : false; + if (options.target) { + if (options.hydrate) { + const nodes = children(options.target); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } + else { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + $$.fragment && $$.fragment.c(); + } + if (options.intro) + transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor, options.customElement); + flush(); + } + set_current_component(parent_component); +} +let SvelteElement; +if (typeof HTMLElement === 'function') { + SvelteElement = class extends HTMLElement { + constructor() { + super(); + this.attachShadow({ mode: 'open' }); + } + connectedCallback() { + const { on_mount } = this.$$; + this.$$.on_disconnect = on_mount.map(run).filter(is_function); + // @ts-ignore todo: improve typings + for (const key in this.$$.slotted) { + // @ts-ignore todo: improve typings + this.appendChild(this.$$.slotted[key]); + } + } + attributeChangedCallback(attr, _oldValue, newValue) { + this[attr] = newValue; + } + disconnectedCallback() { + run_all(this.$$.on_disconnect); + } + $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + $on(type, callback) { + // TODO should this delegate to addEventListener? + if (!is_function(callback)) { + return noop; + } + const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); + callbacks.push(callback); + return () => { + const index = callbacks.indexOf(callback); + if (index !== -1) + callbacks.splice(index, 1); + }; + } + $set($$props) { + if (this.$$set && !is_empty($$props)) { + this.$$.skip_bound = true; + this.$$set($$props); + this.$$.skip_bound = false; + } + } + }; +} + +function dispatch_dev(type, detail) { + document.dispatchEvent(custom_event(type, Object.assign({ version: '3.52.0' }, detail), { bubbles: true })); +} +function append_dev(target, node) { + dispatch_dev('SvelteDOMInsert', { target, node }); + append(target, node); +} +function insert_dev(target, node, anchor) { + dispatch_dev('SvelteDOMInsert', { target, node, anchor }); + insert(target, node, anchor); +} +function detach_dev(node) { + dispatch_dev('SvelteDOMRemove', { node }); + detach(node); +} +function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) { + const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : []; + if (has_prevent_default) + modifiers.push('preventDefault'); + if (has_stop_propagation) + modifiers.push('stopPropagation'); + dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers }); + const dispose = listen(node, event, handler, options); + return () => { + dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers }); + dispose(); + }; +} +function attr_dev(node, attribute, value) { + attr(node, attribute, value); + if (value == null) + dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute }); + else + dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); +} +function prop_dev(node, property, value) { + node[property] = value; + dispatch_dev('SvelteDOMSetProperty', { node, property, value }); +} +function set_data_dev(text, data) { + data = '' + data; + if (text.wholeText === data) + return; + dispatch_dev('SvelteDOMSetData', { node: text, data }); + text.data = data; +} +function validate_each_argument(arg) { + if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) { + let msg = '{#each} only iterates over array-like objects.'; + if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) { + msg += ' You can use a spread to convert this iterable into an array.'; + } + throw new Error(msg); + } +} +function validate_slots(name, slot, keys) { + for (const slot_key of Object.keys(slot)) { + if (!~keys.indexOf(slot_key)) { + console.warn(`<${name}> received an unexpected slot "${slot_key}".`); + } + } +} + +export { validate_each_argument as A, text as B, set_data_dev as C, destroy_each as D, prop_dev as E, set_style as F, svg_element as G, is_function as H, HtmlTag as I, afterUpdate as J, set_input_value as K, SvelteElement as S, attribute_to_object as a, insert_dev as b, setContext as c, dispatch_dev as d, globals as e, element as f, getContext as g, space as h, init as i, add_location as j, attr_dev as k, append_dev as l, listen_dev as m, noop as n, onMount as o, detach_dev as p, binding_callbacks as q, run_all as r, safe_not_equal as s, flush as t, validate_store as u, validate_slots as v, component_subscribe as w, empty as x, src_url_equal as y, set_custom_element_data as z }; diff --git a/Server/public/js/components/join-us-component.js b/Server/public/js/components/join-us-component.js index ef6b87d..43fbd44 100644 --- a/Server/public/js/components/join-us-component.js +++ b/Server/public/js/components/join-us-component.js @@ -1,627 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, f as element, B as text, h as space, j as add_location, u as src_url_equal, k as attr_dev, z as set_custom_element_data, l as append_dev, C as set_data_dev } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addGroupPinContent, addCommunePinContent, addCoopPinContent, addPartyPinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\join-us-component.svelte generated by Svelte v3.52.0 */ - -const file = "src\\join-us-component.svelte"; - -// (73:4) {#if $loaded==10} -function create_if_block(ctx) { - let div2; - let div1; - let h1; - let t0_value = /*$content*/ ctx[1].heading + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let ol0; - let li0; - let t3_value = /*$content*/ ctx[1].condition1 + ""; - let t3; - let t4; - let li1; - let t5_value = /*$content*/ ctx[1].condition2 + ""; - let t5; - let t6; - let li2; - let t7_value = /*$content*/ ctx[1].condition3 + ""; - let t7; - let t8; - let p0; - let raw_value = /*$content*/ ctx[1].conditionsOutcome + ""; - let t9; - let h20; - let t10_value = /*$content*/ ctx[1].subheading1 + ""; - let t10; - let t11; - let ol1; - let li3; - let t12_value = /*$content*/ ctx[1].valueProposition1 + ""; - let t12; - let t13; - let li4; - let t14_value = /*$content*/ ctx[1].valueProposition2 + ""; - let t14; - let t15; - let li5; - let t16_value = /*$content*/ ctx[1].valueProposition3 + ""; - let t16; - let t17; - let li6; - let t18_value = /*$content*/ ctx[1].valueProposition4 + ""; - let t18; - let t19; - let p1; - let t20_value = /*$content*/ ctx[1].valueProposition5 + ""; - let t20; - let t21; - let h21; - let t22_value = /*$content*/ ctx[1].subheading2 + ""; - let t22; - let t23; - let div0; - let p2; - let t24_value = /*$content*/ ctx[1].findOur + ""; - let t24; - let t25; - let ol2; - let li7; - let a0; - let t26_value = /*$content*/ ctx[1].group + ""; - let t26; - let t27; - let t28; - let li8; - let a1; - let t29_value = /*$content*/ ctx[1].commune + ""; - let t29; - let t30; - let li9; - let a2; - let t31_value = /*$content*/ ctx[1].cooperative + ""; - let t31; - let t32; - let t33_value = /*$content*/ ctx[1].or + ""; - let t33; - let t34; - let li10; - let a3; - let t35_value = /*$content*/ ctx[1].party + ""; - let t35; - let t36; - let p3; - let t37_value = /*$content*/ ctx[1].nearYou + ""; - let t37; - let t38; - let p4; - let t39_value = /*$content*/ ctx[1].noneNear + ""; - let t39; - let t40; - let a4; - let t41_value = /*$content*/ ctx[1].WhatsAppGroup + ""; - let t41; - let t42; - let t43_value = /*$content*/ ctx[1].or + ""; - let t43; - let t44; - let a5; - let t45_value = /*$content*/ ctx[1].DiscordServer + ""; - let t45; - let t46_value = /*$content*/ ctx[1].helpStart + ""; - let t46; - let t47; - let map_component; - let map_component_callback_value; - - const block = { - c: function create() { - div2 = element("div"); - div1 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - ol0 = element("ol"); - li0 = element("li"); - t3 = text(t3_value); - t4 = space(); - li1 = element("li"); - t5 = text(t5_value); - t6 = space(); - li2 = element("li"); - t7 = text(t7_value); - t8 = space(); - p0 = element("p"); - t9 = space(); - h20 = element("h2"); - t10 = text(t10_value); - t11 = space(); - ol1 = element("ol"); - li3 = element("li"); - t12 = text(t12_value); - t13 = space(); - li4 = element("li"); - t14 = text(t14_value); - t15 = space(); - li5 = element("li"); - t16 = text(t16_value); - t17 = space(); - li6 = element("li"); - t18 = text(t18_value); - t19 = space(); - p1 = element("p"); - t20 = text(t20_value); - t21 = space(); - h21 = element("h2"); - t22 = text(t22_value); - t23 = space(); - div0 = element("div"); - p2 = element("p"); - t24 = text(t24_value); - t25 = space(); - ol2 = element("ol"); - li7 = element("li"); - a0 = element("a"); - t26 = text(t26_value); - t27 = text(","); - t28 = space(); - li8 = element("li"); - a1 = element("a"); - t29 = text(t29_value); - t30 = space(); - li9 = element("li"); - a2 = element("a"); - t31 = text(t31_value); - t32 = space(); - t33 = text(t33_value); - t34 = space(); - li10 = element("li"); - a3 = element("a"); - t35 = text(t35_value); - t36 = space(); - p3 = element("p"); - t37 = text(t37_value); - t38 = space(); - p4 = element("p"); - t39 = text(t39_value); - t40 = space(); - a4 = element("a"); - t41 = text(t41_value); - t42 = space(); - t43 = text(t43_value); - t44 = space(); - a5 = element("a"); - t45 = text(t45_value); - t46 = text(t46_value); - t47 = space(); - map_component = element("map-component"); - add_location(h1, file, 75, 16, 3174); - if (!src_url_equal(img.src, img_src_value = "/img/common/join-group.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "id", "join-group"); - attr_dev(img, "alt", "join group"); - add_location(img, file, 76, 16, 3219); - add_location(li0, file, 78, 20, 3354); - add_location(li1, file, 79, 20, 3406); - add_location(li2, file, 80, 20, 3458); - add_location(p0, file, 81, 20, 3510); - attr_dev(ol0, "id", "condition-list"); - add_location(ol0, file, 77, 16, 3308); - add_location(h20, file, 83, 16, 3592); - add_location(li3, file, 85, 20, 3695); - add_location(li4, file, 86, 20, 3754); - add_location(li5, file, 87, 20, 3813); - add_location(li6, file, 88, 20, 3872); - add_location(p1, file, 89, 20, 3931); - attr_dev(ol1, "id", "value-proposition-list"); - add_location(ol1, file, 84, 16, 3641); - add_location(h21, file, 91, 16, 4007); - add_location(p2, file, 93, 20, 4108); - attr_dev(a0, "href", "/" + /*locale*/ ctx[4] + "/groups"); - add_location(a0, file, 95, 28, 4208); - add_location(li7, file, 95, 24, 4204); - attr_dev(a1, "href", "/" + /*locale*/ ctx[4] + "/communes"); - add_location(a1, file, 96, 28, 4300); - add_location(li8, file, 96, 24, 4296); - attr_dev(a2, "href", "/" + /*locale*/ ctx[4] + "/cooperatives"); - add_location(a2, file, 97, 28, 4395); - add_location(li9, file, 97, 24, 4391); - attr_dev(a3, "href", "/" + /*locale*/ ctx[4] + "/parties"); - add_location(a3, file, 98, 28, 4511); - add_location(li10, file, 98, 24, 4507); - attr_dev(ol2, "id", "entities-list"); - add_location(ol2, file, 94, 20, 4155); - add_location(p3, file, 100, 20, 4622); - attr_dev(div0, "id", "call-to-action-list"); - add_location(div0, file, 92, 16, 4056); - attr_dev(a4, "href", "https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"); - attr_dev(a4, "target", "_blank"); - attr_dev(a4, "rel", "noreferrer"); - add_location(a4, file, 102, 39, 4712); - attr_dev(a5, "href", "https://discord.gg/Qk8KUk787z"); - attr_dev(a5, "target", "_blank"); - attr_dev(a5, "rel", "noreferrer"); - add_location(a5, file, 102, 172, 4845); - add_location(p4, file, 102, 16, 4689); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[6]); - set_custom_element_data(map_component, "colors", ["#23AC20", "#CA2437", "#217BC9", "#FFD326"]); - add_location(map_component, file, 103, 16, 4986); - attr_dev(div1, "id", "text-container"); - add_location(div1, file, 74, 12, 3131); - attr_dev(div2, "id", "container"); - add_location(div2, file, 73, 8, 3097); - }, - m: function mount(target, anchor) { - insert_dev(target, div2, anchor); - append_dev(div2, div1); - append_dev(div1, h1); - append_dev(h1, t0); - append_dev(div1, t1); - append_dev(div1, img); - append_dev(div1, t2); - append_dev(div1, ol0); - append_dev(ol0, li0); - append_dev(li0, t3); - append_dev(ol0, t4); - append_dev(ol0, li1); - append_dev(li1, t5); - append_dev(ol0, t6); - append_dev(ol0, li2); - append_dev(li2, t7); - append_dev(ol0, t8); - append_dev(ol0, p0); - p0.innerHTML = raw_value; - append_dev(div1, t9); - append_dev(div1, h20); - append_dev(h20, t10); - append_dev(div1, t11); - append_dev(div1, ol1); - append_dev(ol1, li3); - append_dev(li3, t12); - append_dev(ol1, t13); - append_dev(ol1, li4); - append_dev(li4, t14); - append_dev(ol1, t15); - append_dev(ol1, li5); - append_dev(li5, t16); - append_dev(ol1, t17); - append_dev(ol1, li6); - append_dev(li6, t18); - append_dev(ol1, t19); - append_dev(ol1, p1); - append_dev(p1, t20); - append_dev(div1, t21); - append_dev(div1, h21); - append_dev(h21, t22); - append_dev(div1, t23); - append_dev(div1, div0); - append_dev(div0, p2); - append_dev(p2, t24); - append_dev(div0, t25); - append_dev(div0, ol2); - append_dev(ol2, li7); - append_dev(li7, a0); - append_dev(a0, t26); - append_dev(li7, t27); - append_dev(ol2, t28); - append_dev(ol2, li8); - append_dev(li8, a1); - append_dev(a1, t29); - append_dev(ol2, t30); - append_dev(ol2, li9); - append_dev(li9, a2); - append_dev(a2, t31); - append_dev(li9, t32); - append_dev(li9, t33); - append_dev(ol2, t34); - append_dev(ol2, li10); - append_dev(li10, a3); - append_dev(a3, t35); - append_dev(div0, t36); - append_dev(div0, p3); - append_dev(p3, t37); - append_dev(div1, t38); - append_dev(div1, p4); - append_dev(p4, t39); - append_dev(p4, t40); - append_dev(p4, a4); - append_dev(a4, t41); - append_dev(p4, t42); - append_dev(p4, t43); - append_dev(p4, t44); - append_dev(p4, a5); - append_dev(a5, t45); - append_dev(p4, t46); - append_dev(div1, t47); - append_dev(div1, map_component); - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].heading + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].condition1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].condition2 + "")) set_data_dev(t5, t5_value); - if (dirty & /*$content*/ 2 && t7_value !== (t7_value = /*$content*/ ctx[1].condition3 + "")) set_data_dev(t7, t7_value); - if (dirty & /*$content*/ 2 && raw_value !== (raw_value = /*$content*/ ctx[1].conditionsOutcome + "")) p0.innerHTML = raw_value; if (dirty & /*$content*/ 2 && t10_value !== (t10_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t10, t10_value); - if (dirty & /*$content*/ 2 && t12_value !== (t12_value = /*$content*/ ctx[1].valueProposition1 + "")) set_data_dev(t12, t12_value); - if (dirty & /*$content*/ 2 && t14_value !== (t14_value = /*$content*/ ctx[1].valueProposition2 + "")) set_data_dev(t14, t14_value); - if (dirty & /*$content*/ 2 && t16_value !== (t16_value = /*$content*/ ctx[1].valueProposition3 + "")) set_data_dev(t16, t16_value); - if (dirty & /*$content*/ 2 && t18_value !== (t18_value = /*$content*/ ctx[1].valueProposition4 + "")) set_data_dev(t18, t18_value); - if (dirty & /*$content*/ 2 && t20_value !== (t20_value = /*$content*/ ctx[1].valueProposition5 + "")) set_data_dev(t20, t20_value); - if (dirty & /*$content*/ 2 && t22_value !== (t22_value = /*$content*/ ctx[1].subheading2 + "")) set_data_dev(t22, t22_value); - if (dirty & /*$content*/ 2 && t24_value !== (t24_value = /*$content*/ ctx[1].findOur + "")) set_data_dev(t24, t24_value); - if (dirty & /*$content*/ 2 && t26_value !== (t26_value = /*$content*/ ctx[1].group + "")) set_data_dev(t26, t26_value); - if (dirty & /*$content*/ 2 && t29_value !== (t29_value = /*$content*/ ctx[1].commune + "")) set_data_dev(t29, t29_value); - if (dirty & /*$content*/ 2 && t31_value !== (t31_value = /*$content*/ ctx[1].cooperative + "")) set_data_dev(t31, t31_value); - if (dirty & /*$content*/ 2 && t33_value !== (t33_value = /*$content*/ ctx[1].or + "")) set_data_dev(t33, t33_value); - if (dirty & /*$content*/ 2 && t35_value !== (t35_value = /*$content*/ ctx[1].party + "")) set_data_dev(t35, t35_value); - if (dirty & /*$content*/ 2 && t37_value !== (t37_value = /*$content*/ ctx[1].nearYou + "")) set_data_dev(t37, t37_value); - if (dirty & /*$content*/ 2 && t39_value !== (t39_value = /*$content*/ ctx[1].noneNear + "")) set_data_dev(t39, t39_value); - if (dirty & /*$content*/ 2 && t41_value !== (t41_value = /*$content*/ ctx[1].WhatsAppGroup + "")) set_data_dev(t41, t41_value); - if (dirty & /*$content*/ 2 && t43_value !== (t43_value = /*$content*/ ctx[1].or + "")) set_data_dev(t43, t43_value); - if (dirty & /*$content*/ 2 && t45_value !== (t45_value = /*$content*/ ctx[1].DiscordServer + "")) set_data_dev(t45, t45_value); - if (dirty & /*$content*/ 2 && t46_value !== (t46_value = /*$content*/ ctx[1].helpStart + "")) set_data_dev(t46, t46_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[6])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div2); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(73:4) {#if $loaded==10}", - ctx - }); - - return block; -} - -// (72:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[0] == 10 && create_if_block(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 (/*$loaded*/ ctx[0] == 10) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(72:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[0]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 1 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[0])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('join-us-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(0, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries = {}; - let entriesByCountry = {}; - loadLocaleContent(content, "groups-component", loaded); - loadLocaleContent(content, "communes-component", loaded); - loadLocaleContent(content, "cooperatives-component", loaded); - loadLocaleContent(content, "parties-component", loaded); - loadLocaleContent(content, "countries", loaded); - let locale = loadLocaleContent(content, "join-us-component", loaded); - - let callback = (response, name) => { - entries[name] = JSON.parse(response); - entriesByCountry[name] = {}; - - for (let g of entries[name]) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry[name]) { - entriesByCountry[name][country].push(g); - } else { - entriesByCountry[name][country] = [g]; - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/groups.json", response => callback(response, "groups")); - getData("/assets/communes.json", response => callback(response, "communes")); - getData("/assets/cooperatives.json", response => callback(response, "cooperatives")); - getData("/assets/parties.json", response => callback(response, "parties")); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - let groupsMarkersLayer = addMarkersEntries(entries["groups"], entriesByCountry["groups"], map, content, locale, addGroupPinContent, "green"); - let communesMarkersLayer = addMarkersEntries(entries["communes"], entriesByCountry["communes"], map, content, locale, addCommunePinContent, "red"); - let coopsMarkersLayer = addMarkersEntries(entries["cooperatives"], entriesByCountry["cooperatives"], map, content, locale, addCoopPinContent, "blue"); - let partiesMarkersLayer = addMarkersEntries(entries["parties"], entriesByCountry["parties"], map, content, locale, addPartyPinContent, "gold"); - let overlayMaps = {}; - overlayMaps[content.groups] = groupsMarkersLayer; - overlayMaps[content.communes] = communesMarkersLayer; - overlayMaps[content.cooperatives] = coopsMarkersLayer; - overlayMaps[content.parties] = partiesMarkersLayer; - L.control.layers(null, overlayMaps).addTo(map); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addGroupPinContent, - addCommunePinContent, - addCoopPinContent, - addPartyPinContent, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - mapCallback, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(2, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(3, content = $$props.content); - if ('entries' in $$props) entries = $$props.entries; - if ('entriesByCountry' in $$props) entriesByCountry = $$props.entriesByCountry; - if ('locale' in $$props) $$invalidate(4, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [$loaded, $content, loaded, content, locale, mapCallback, func]; -} - -class Join_us_component extends SvelteElement { - constructor(options) { - super(); - - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("join-us-component", Join_us_component); - -export { Join_us_component as default }; +import{S as o,i as t,a as i,b as e,s as r,p as n,n as s,g as a,q as m,o as l,e as c,v as p,c as u,t as g,d,u as h,f,w as b}from"./index-db20528a.js";import{w as v}from"./index-720c0a59.js";import{loadLocaleContent as k,getData as j}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as w}from"../../../../../../../../../js/libraries/mapTools.js";import{addGroupPinContent as y,addCommunePinContent as x,addCoopPinContent as P,addPartyPinContent as T}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function A(o){let t,i,r,n,s,m,l,v,k,j,w,y,x,P,T,A,N,S,z,D,O,U,C,H,L,F,K,M,B,E,G,J,Q,R,W,Y,_,q,I,V,X,Z,$,oo,to,io,eo,ro,no,so,ao,mo,lo,co,po,uo,go,ho,fo,bo,vo,ko,jo,wo,yo,xo,Po,To,Ao,No,So,zo,Do,Oo,Uo,Co,Ho,Lo,Fo,Ko,Mo,Bo,Eo,Go=o[1].heading+"",Jo=o[1].condition1+"",Qo=o[1].condition2+"",Ro=o[1].condition3+"",Wo=o[1].conditionsOutcome+"",Yo=o[1].subheading1+"",_o=o[1].valueProposition1+"",qo=o[1].valueProposition2+"",Io=o[1].valueProposition3+"",Vo=o[1].valueProposition4+"",Xo=o[1].valueProposition5+"",Zo=o[1].subheading2+"",$o=o[1].findOur+"",ot=o[1].group+"",tt=o[1].commune+"",it=o[1].cooperative+"",et=o[1].or+"",rt=o[1].party+"",nt=o[1].nearYou+"",st=o[1].noneNear+"",at=o[1].WhatsAppGroup+"",mt=o[1].or+"",lt=o[1].DiscordServer+"",ct=o[1].helpStart+"";return{c(){t=c("div"),i=c("div"),r=c("h1"),n=p(Go),s=u(),m=c("img"),v=u(),k=c("ol"),j=c("li"),w=p(Jo),y=u(),x=c("li"),P=p(Qo),T=u(),A=c("li"),N=p(Ro),S=u(),z=c("p"),D=u(),O=c("h2"),U=p(Yo),C=u(),H=c("ol"),L=c("li"),F=p(_o),K=u(),M=c("li"),B=p(qo),E=u(),G=c("li"),J=p(Io),Q=u(),R=c("li"),W=p(Vo),Y=u(),_=c("p"),q=p(Xo),I=u(),V=c("h2"),X=p(Zo),Z=u(),$=c("div"),oo=c("p"),to=p($o),io=u(),eo=c("ol"),ro=c("li"),no=c("a"),so=p(ot),ao=p(","),mo=u(),lo=c("li"),co=c("a"),po=p(tt),uo=u(),go=c("li"),ho=c("a"),fo=p(it),bo=u(),vo=p(et),ko=u(),jo=c("li"),wo=c("a"),yo=p(rt),xo=u(),Po=c("p"),To=p(nt),Ao=u(),No=c("p"),So=p(st),zo=u(),Do=c("a"),Oo=p(at),Uo=u(),Co=p(mt),Ho=u(),Lo=c("a"),Fo=p(lt),Ko=p(ct),Mo=u(),Bo=c("map-component"),g(m.src,l="/img/common/join-group.svg")||d(m,"src","/img/common/join-group.svg"),d(m,"id","join-group"),d(m,"alt","join group"),d(k,"id","condition-list"),d(H,"id","value-proposition-list"),d(no,"href","/"+o[4]+"/groups"),d(co,"href","/"+o[4]+"/communes"),d(ho,"href","/"+o[4]+"/cooperatives"),d(wo,"href","/"+o[4]+"/parties"),d(eo,"id","entities-list"),d($,"id","call-to-action-list"),d(Do,"href","https://chat.whatsapp.com/BhnmUNljUxJ2AjeHUwyTKh"),d(Do,"target","_blank"),d(Do,"rel","noreferrer"),d(Lo,"href","https://discord.gg/Qk8KUk787z"),d(Lo,"target","_blank"),d(Lo,"rel","noreferrer"),h(Bo,"id","map"),h(Bo,"callback",Eo=o[6]),h(Bo,"colors",["#23AC20","#CA2437","#217BC9","#FFD326"]),d(i,"id","text-container"),d(t,"id","container")},m(o,a){e(o,t,a),f(t,i),f(i,r),f(r,n),f(i,s),f(i,m),f(i,v),f(i,k),f(k,j),f(j,w),f(k,y),f(k,x),f(x,P),f(k,T),f(k,A),f(A,N),f(k,S),f(k,z),z.innerHTML=Wo,f(i,D),f(i,O),f(O,U),f(i,C),f(i,H),f(H,L),f(L,F),f(H,K),f(H,M),f(M,B),f(H,E),f(H,G),f(G,J),f(H,Q),f(H,R),f(R,W),f(H,Y),f(H,_),f(_,q),f(i,I),f(i,V),f(V,X),f(i,Z),f(i,$),f($,oo),f(oo,to),f($,io),f($,eo),f(eo,ro),f(ro,no),f(no,so),f(ro,ao),f(eo,mo),f(eo,lo),f(lo,co),f(co,po),f(eo,uo),f(eo,go),f(go,ho),f(ho,fo),f(go,bo),f(go,vo),f(eo,ko),f(eo,jo),f(jo,wo),f(wo,yo),f($,xo),f($,Po),f(Po,To),f(i,Ao),f(i,No),f(No,So),f(No,zo),f(No,Do),f(Do,Oo),f(No,Uo),f(No,Co),f(No,Ho),f(No,Lo),f(Lo,Fo),f(No,Ko),f(i,Mo),f(i,Bo)},p(o,t){2&t&&Go!==(Go=o[1].heading+"")&&b(n,Go),2&t&&Jo!==(Jo=o[1].condition1+"")&&b(w,Jo),2&t&&Qo!==(Qo=o[1].condition2+"")&&b(P,Qo),2&t&&Ro!==(Ro=o[1].condition3+"")&&b(N,Ro),2&t&&Wo!==(Wo=o[1].conditionsOutcome+"")&&(z.innerHTML=Wo),2&t&&Yo!==(Yo=o[1].subheading1+"")&&b(U,Yo),2&t&&_o!==(_o=o[1].valueProposition1+"")&&b(F,_o),2&t&&qo!==(qo=o[1].valueProposition2+"")&&b(B,qo),2&t&&Io!==(Io=o[1].valueProposition3+"")&&b(J,Io),2&t&&Vo!==(Vo=o[1].valueProposition4+"")&&b(W,Vo),2&t&&Xo!==(Xo=o[1].valueProposition5+"")&&b(q,Xo),2&t&&Zo!==(Zo=o[1].subheading2+"")&&b(X,Zo),2&t&&$o!==($o=o[1].findOur+"")&&b(to,$o),2&t&&ot!==(ot=o[1].group+"")&&b(so,ot),2&t&&tt!==(tt=o[1].commune+"")&&b(po,tt),2&t&&it!==(it=o[1].cooperative+"")&&b(fo,it),2&t&&et!==(et=o[1].or+"")&&b(vo,et),2&t&&rt!==(rt=o[1].party+"")&&b(yo,rt),2&t&&nt!==(nt=o[1].nearYou+"")&&b(To,nt),2&t&&st!==(st=o[1].noneNear+"")&&b(So,st),2&t&&at!==(at=o[1].WhatsAppGroup+"")&&b(Oo,at),2&t&&mt!==(mt=o[1].or+"")&&b(Co,mt),2&t&<!==(lt=o[1].DiscordServer+"")&&b(Fo,lt),2&t&&ct!==(ct=o[1].helpStart+"")&&b(Ko,ct),2&t&&Eo!==(Eo=o[6])&&h(Bo,"callback",Eo)},d(o){o&&a(t)}}}function N(o){let t,i=10==o[0]&&A(o);return{c(){i&&i.c(),t=n()},m(o,r){i&&i.m(o,r),e(o,t,r)},p(o,e){10==o[0]?i?i.p(o,e):(i=A(o),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(o){i&&i.d(o),o&&a(t)}}}function S(o){let t,i=o[0],m=N(o);return{c(){m.c(),t=n(),this.c=s},m(o,i){m.m(o,i),e(o,t,i)},p(o,[e]){1&e&&r(i,i=o[0])?(m.d(1),m=N(o),m.c(),m.m(t.parentNode,t)):m.p(o,e)},i:s,o:s,d(o){o&&a(t),m.d(o)}}}function z(o,t,i){let e,r,n=v(0);m(o,n,(o=>i(0,e=o)));let s=v({});m(o,s,(o=>i(1,r=o)));let a={},c={};k(s,"groups-component",n),k(s,"communes-component",n),k(s,"cooperatives-component",n),k(s,"parties-component",n),k(s,"countries",n);let p=k(s,"join-us-component",n),u=(o,t)=>{a[t]=JSON.parse(o),c[t]={};for(let o of a[t]){let i=o.country;null==o.contact&&(o.contact="https://discord.gg/Qk8KUk787z"),i in c[t]?c[t][i].push(o):c[t][i]=[o]}n.update((o=>o+1))};function g(o,t,i){let e=o([22,0],2),r=w(a.groups,c.groups,e,t,i,y,"green"),n=w(a.communes,c.communes,e,t,i,x,"red"),s=w(a.cooperatives,c.cooperatives,e,t,i,P,"blue"),m=w(a.parties,c.parties,e,t,i,T,"gold"),l={};l[t.groups]=r,l[t.communes]=n,l[t.cooperatives]=s,l[t.parties]=m,L.control.layers(null,l).addTo(e)}j("/assets/groups.json",(o=>u(o,"groups"))),j("/assets/communes.json",(o=>u(o,"communes"))),j("/assets/cooperatives.json",(o=>u(o,"cooperatives"))),j("/assets/parties.json",(o=>u(o,"parties"))),l((()=>{}));return[e,r,n,s,p,g,o=>g(o,r,p)]}class D extends o{constructor(o){super(),this.shadowRoot.innerHTML="",t(this,{target:this.shadowRoot,props:i(this.attributes),customElement:!0},z,S,r,{},null),o&&o.target&&e(o.target,this,o.anchor)}}customElements.define("join-us-component",D);export{D as default}; diff --git a/Server/public/js/components/landing-component.js b/Server/public/js/components/landing-component.js index 1113dda..598773b 100644 --- a/Server/public/js/components/landing-component.js +++ b/Server/public/js/components/landing-component.js @@ -1,620 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, B as text, k as attr_dev, j as add_location, u as src_url_equal, F as set_style, z as set_custom_element_data, l as append_dev, C as set_data_dev } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { getData, loadLocaleContent } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addGroupPinContent, addCommunePinContent, addCoopPinContent, addPartyPinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\landing-component.svelte generated by Svelte v3.52.0 */ - -const file = "src\\landing-component.svelte"; - -// (85:4) {#if $loaded==10} -function create_if_block(ctx) { - let div7; - let picture; - let source0; - let t0; - let source1; - let t1; - let img0; - let t2; - let div6; - let p0; - let t3_value = /*$content*/ ctx[3].top + ""; - let t3; - let t4; - let div4; - let div0; - let a0; - let h20; - let t5_value = /*$content*/ ctx[3].groupsTitle + ""; - let t5; - let t6; - let img1; - let img1_src_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[3].groupsText + ""; - let t8; - let t9; - let div1; - let a1; - let h21; - let t10_value = /*$content*/ ctx[3].partiesTitle + ""; - let t10; - let t11; - let img2; - let img2_src_value; - let t12; - let p2; - let t13_value = /*$content*/ ctx[3].partiesText + ""; - let t13; - let t14; - let div2; - let a2; - let h22; - let t15_value = /*$content*/ ctx[3].cooperativesTitle + ""; - let t15; - let t16; - let img3; - let img3_src_value; - let t17; - let p3; - let t18_value = /*$content*/ ctx[3].cooperativesText + ""; - let t18; - let t19; - let div3; - let a3; - let h23; - let t20_value = /*$content*/ ctx[3].communesTitle + ""; - let t20; - let t21; - let img4; - let img4_src_value; - let t22; - let p4; - let t23_value = /*$content*/ ctx[3].communesText + ""; - let t23; - let t24; - let h10; - let t25_value = /*$content*/ ctx[3].findUs + ""; - let t25; - let t26; - let map_component; - let map_component_callback_value; - let t27; - let h11; - let t28_value = /*$content*/ ctx[3].whatNow + ""; - let t28; - let t29; - let div5; - let a4; - let t30_value = /*$content*/ ctx[3].joinUs + ""; - let t30; - let t31; - let a5; - let t32_value = /*$content*/ ctx[3].talkWithUs + ""; - let t32; - - const block = { - c: function create() { - div7 = element("div"); - picture = element("picture"); - source0 = element("source"); - t0 = space(); - source1 = element("source"); - t1 = space(); - img0 = element("img"); - t2 = space(); - div6 = element("div"); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - div4 = element("div"); - div0 = element("div"); - a0 = element("a"); - h20 = element("h2"); - t5 = text(t5_value); - t6 = space(); - img1 = element("img"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - div1 = element("div"); - a1 = element("a"); - h21 = element("h2"); - t10 = text(t10_value); - t11 = space(); - img2 = element("img"); - t12 = space(); - p2 = element("p"); - t13 = text(t13_value); - t14 = space(); - div2 = element("div"); - a2 = element("a"); - h22 = element("h2"); - t15 = text(t15_value); - t16 = space(); - img3 = element("img"); - t17 = space(); - p3 = element("p"); - t18 = text(t18_value); - t19 = space(); - div3 = element("div"); - a3 = element("a"); - h23 = element("h2"); - t20 = text(t20_value); - t21 = space(); - img4 = element("img"); - t22 = space(); - p4 = element("p"); - t23 = text(t23_value); - t24 = space(); - h10 = element("h1"); - t25 = text(t25_value); - t26 = space(); - map_component = element("map-component"); - t27 = space(); - h11 = element("h1"); - t28 = text(t28_value); - t29 = space(); - div5 = element("div"); - a4 = element("a"); - t30 = text(t30_value); - t31 = space(); - a5 = element("a"); - t32 = text(t32_value); - attr_dev(source0, "srcset", "/img/crowd.webp"); - add_location(source0, file, 87, 16, 3414); - attr_dev(source1, "srcset", "/img/crowd.png"); - add_location(source1, file, 88, 16, 3465); - attr_dev(img0, "id", "crowd"); - attr_dev(img0, "alt", "crowd"); - add_location(img0, file, 89, 16, 3515); - add_location(picture, file, 86, 12, 3387); - add_location(p0, file, 92, 16, 3624); - add_location(h20, file, 95, 59, 3827); - attr_dev(a0, "href", "/" + /*locale*/ ctx[6] + "/groups"); - add_location(a0, file, 95, 24, 3792); - attr_dev(img1, "id", "groups-img"); - if (!src_url_equal(img1.src, img1_src_value = "/img/common/groups.svg")) attr_dev(img1, "src", img1_src_value); - attr_dev(img1, "alt", "groups"); - add_location(img1, file, 96, 24, 3888); - add_location(p1, file, 97, 24, 3977); - add_location(div0, file, 94, 20, 3761); - add_location(h21, file, 100, 60, 4122); - attr_dev(a1, "href", "/" + /*locale*/ ctx[6] + "/parties"); - add_location(a1, file, 100, 24, 4086); - attr_dev(img2, "id", "parties-img"); - if (!src_url_equal(img2.src, img2_src_value = "/img/common/parties.svg")) attr_dev(img2, "src", img2_src_value); - attr_dev(img2, "alt", "coops"); - add_location(img2, file, 101, 24, 4184); - add_location(p2, file, 102, 24, 4274); - add_location(div1, file, 99, 20, 4055); - add_location(h22, file, 105, 58, 4418); - attr_dev(a2, "href", "/" + /*locale*/ ctx[6] + "/coops"); - add_location(a2, file, 105, 24, 4384); - attr_dev(img3, "id", "coops-img"); - if (!src_url_equal(img3.src, img3_src_value = "/img/common/coops.svg")) attr_dev(img3, "src", img3_src_value); - attr_dev(img3, "alt", "coops"); - add_location(img3, file, 106, 24, 4485); - add_location(p3, file, 107, 24, 4571); - add_location(div2, file, 104, 20, 4353); - add_location(h23, file, 110, 61, 4723); - attr_dev(a3, "href", "/" + /*locale*/ ctx[6] + "/communes"); - add_location(a3, file, 110, 24, 4686); - attr_dev(img4, "id", "communes-img"); - if (!src_url_equal(img4.src, img4_src_value = "/img/common/communes.svg")) attr_dev(img4, "src", img4_src_value); - attr_dev(img4, "alt", "communes"); - add_location(img4, file, 111, 24, 4786); - add_location(p4, file, 112, 24, 4881); - add_location(div3, file, 109, 20, 4655); - attr_dev(div4, "id", "container-grid"); - set_style(div4, "--grid-width", /*gridWidth*/ ctx[1]); - add_location(div4, file, 93, 16, 3663); - attr_dev(h10, "id", "find-us"); - add_location(h10, file, 132, 16, 7683); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[9]); - set_custom_element_data(map_component, "colors", ["#23AC20", "#CA2437", "#217BC9", "#FFD326"]); - add_location(map_component, file, 133, 16, 7740); - add_location(h11, file, 134, 16, 7914); - attr_dev(a4, "class", "link-button"); - attr_dev(a4, "href", "/" + /*locale*/ ctx[6] + "/join-us"); - add_location(a4, file, 136, 20, 8008); - attr_dev(a5, "class", "link-button"); - attr_dev(a5, "href", "https://discord.gg/Qk8KUk787z"); - attr_dev(a5, "target", "_blank"); - attr_dev(a5, "rel", "noreferrer"); - add_location(a5, file, 137, 20, 8107); - attr_dev(div5, "id", "action-container"); - add_location(div5, file, 135, 16, 7959); - attr_dev(div6, "id", "text-container"); - add_location(div6, file, 91, 12, 3581); - attr_dev(div7, "id", "container"); - add_location(div7, file, 85, 8, 3353); - }, - m: function mount(target, anchor) { - insert_dev(target, div7, anchor); - append_dev(div7, picture); - append_dev(picture, source0); - append_dev(picture, t0); - append_dev(picture, source1); - append_dev(picture, t1); - append_dev(picture, img0); - append_dev(div7, t2); - append_dev(div7, div6); - append_dev(div6, p0); - append_dev(p0, t3); - append_dev(div6, t4); - append_dev(div6, div4); - append_dev(div4, div0); - append_dev(div0, a0); - append_dev(a0, h20); - append_dev(h20, t5); - append_dev(div0, t6); - append_dev(div0, img1); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div4, t9); - append_dev(div4, div1); - append_dev(div1, a1); - append_dev(a1, h21); - append_dev(h21, t10); - append_dev(div1, t11); - append_dev(div1, img2); - append_dev(div1, t12); - append_dev(div1, p2); - append_dev(p2, t13); - append_dev(div4, t14); - append_dev(div4, div2); - append_dev(div2, a2); - append_dev(a2, h22); - append_dev(h22, t15); - append_dev(div2, t16); - append_dev(div2, img3); - append_dev(div2, t17); - append_dev(div2, p3); - append_dev(p3, t18); - append_dev(div4, t19); - append_dev(div4, div3); - append_dev(div3, a3); - append_dev(a3, h23); - append_dev(h23, t20); - append_dev(div3, t21); - append_dev(div3, img4); - append_dev(div3, t22); - append_dev(div3, p4); - append_dev(p4, t23); - /*div4_binding*/ ctx[8](div4); - append_dev(div6, t24); - append_dev(div6, h10); - append_dev(h10, t25); - append_dev(div6, t26); - append_dev(div6, map_component); - append_dev(div6, t27); - append_dev(div6, h11); - append_dev(h11, t28); - append_dev(div6, t29); - append_dev(div6, div5); - append_dev(div5, a4); - append_dev(a4, t30); - append_dev(div5, t31); - append_dev(div5, a5); - append_dev(a5, t32); - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 8 && t3_value !== (t3_value = /*$content*/ ctx[3].top + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 8 && t5_value !== (t5_value = /*$content*/ ctx[3].groupsTitle + "")) set_data_dev(t5, t5_value); - if (dirty & /*$content*/ 8 && t8_value !== (t8_value = /*$content*/ ctx[3].groupsText + "")) set_data_dev(t8, t8_value); - if (dirty & /*$content*/ 8 && t10_value !== (t10_value = /*$content*/ ctx[3].partiesTitle + "")) set_data_dev(t10, t10_value); - if (dirty & /*$content*/ 8 && t13_value !== (t13_value = /*$content*/ ctx[3].partiesText + "")) set_data_dev(t13, t13_value); - if (dirty & /*$content*/ 8 && t15_value !== (t15_value = /*$content*/ ctx[3].cooperativesTitle + "")) set_data_dev(t15, t15_value); - if (dirty & /*$content*/ 8 && t18_value !== (t18_value = /*$content*/ ctx[3].cooperativesText + "")) set_data_dev(t18, t18_value); - if (dirty & /*$content*/ 8 && t20_value !== (t20_value = /*$content*/ ctx[3].communesTitle + "")) set_data_dev(t20, t20_value); - if (dirty & /*$content*/ 8 && t23_value !== (t23_value = /*$content*/ ctx[3].communesText + "")) set_data_dev(t23, t23_value); - - if (dirty & /*gridWidth*/ 2) { - set_style(div4, "--grid-width", /*gridWidth*/ ctx[1]); - } - - if (dirty & /*$content*/ 8 && t25_value !== (t25_value = /*$content*/ ctx[3].findUs + "")) set_data_dev(t25, t25_value); - - if (dirty & /*$content*/ 8 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[9])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 8 && t28_value !== (t28_value = /*$content*/ ctx[3].whatNow + "")) set_data_dev(t28, t28_value); - if (dirty & /*$content*/ 8 && t30_value !== (t30_value = /*$content*/ ctx[3].joinUs + "")) set_data_dev(t30, t30_value); - if (dirty & /*$content*/ 8 && t32_value !== (t32_value = /*$content*/ ctx[3].talkWithUs + "")) set_data_dev(t32, t32_value); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div7); - /*div4_binding*/ ctx[8](null); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(85:4) {#if $loaded==10}", - ctx - }); - - return block; -} - -// (84:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 10 && create_if_block(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 (/*$loaded*/ ctx[2] == 10) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(84:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('landing-component', slots, []); - let grid; - let gridWidth; - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(3, $content = value)); - let entries = {}; - let entriesByCountry = {}; - - function changeWidth(locale) { - if (locale == "ru") { - $$invalidate(1, gridWidth = "1fr 1fr"); - } else { - $$invalidate(1, gridWidth = "1fr 1fr"); - } - } - - let callback = (response, name) => { - entries[name] = JSON.parse(response); - entriesByCountry[name] = {}; - - for (let g of entries[name]) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry[name]) { - entriesByCountry[name][country].push(g); - } else { - entriesByCountry[name][country] = [g]; - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/groups.json", response => callback(response, "groups")); - getData("/assets/communes.json", response => callback(response, "communes")); - getData("/assets/cooperatives.json", response => callback(response, "cooperatives")); - getData("/assets/parties.json", response => callback(response, "parties")); - loadLocaleContent(content, "groups-component", loaded); - loadLocaleContent(content, "communes-component", loaded); - loadLocaleContent(content, "cooperatives-component", loaded); - loadLocaleContent(content, "parties-component", loaded); - loadLocaleContent(content, "countries", loaded); - let locale = loadLocaleContent(content, "landing-component", loaded, changeWidth); - changeWidth(locale); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - let groupsMarkersLayer = addMarkersEntries(entries["groups"], entriesByCountry["groups"], map, content, locale, addGroupPinContent, "green"); - let communesMarkersLayer = addMarkersEntries(entries["communes"], entriesByCountry["communes"], map, content, locale, addCommunePinContent, "red"); - let coopsMarkersLayer = addMarkersEntries(entries["cooperatives"], entriesByCountry["cooperatives"], map, content, locale, addCoopPinContent, "blue"); - let partiesMarkersLayer = addMarkersEntries(entries["parties"], entriesByCountry["parties"], map, content, locale, addPartyPinContent, "gold"); - let overlayMaps = {}; - overlayMaps[content.groups] = groupsMarkersLayer; - overlayMaps[content.communes] = communesMarkersLayer; - overlayMaps[content.cooperatives] = coopsMarkersLayer; - overlayMaps[content.parties] = partiesMarkersLayer; - L.control.layers(null, overlayMaps).addTo(map); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function div4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - grid = $$value; - $$invalidate(0, grid); - }); - } - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addGroupPinContent, - addCommunePinContent, - addCoopPinContent, - addPartyPinContent, - grid, - gridWidth, - loaded, - content, - entries, - entriesByCountry, - changeWidth, - callback, - locale, - mapCallback, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('grid' in $$props) $$invalidate(0, grid = $$props.grid); - if ('gridWidth' in $$props) $$invalidate(1, gridWidth = $$props.gridWidth); - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) entries = $$props.entries; - if ('entriesByCountry' in $$props) entriesByCountry = $$props.entriesByCountry; - if ('callback' in $$props) callback = $$props.callback; - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - grid, - gridWidth, - $loaded, - $content, - loaded, - content, - locale, - mapCallback, - div4_binding, - func - ]; -} - -class Landing_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("landing-component", Landing_component); - -export { Landing_component as default }; +import{S as t,i as e,a as o,b as i,s as r,p as s,n,g as a,q as m,o as c,j as p,e as g,c as d,v as l,d as u,t as h,y as f,u as v,f as w,w as x}from"./index-db20528a.js";import{w as b}from"./index-720c0a59.js";import{getData as T,loadLocaleContent as j}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as y}from"../../../../../../../../../js/libraries/mapTools.js";import{addGroupPinContent as k,addCommunePinContent as U,addCoopPinContent as z,addPartyPinContent as N}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function C(t){let e,o,r,s,n,m,c,p,b,T,j,y,k,U,z,N,C,F,L,A,E,H,K,M,Q,R,S,W,q,B,D,G,J,O,_,I,P,V,X,Y,Z,$,tt,et,ot,it,rt,st,nt,at,mt,ct,pt,gt,dt,lt,ut,ht,ft,vt,wt,xt,bt,Tt,jt,yt,kt,Ut=t[3].top+"",zt=t[3].groupsTitle+"",Nt=t[3].groupsText+"",Ct=t[3].partiesTitle+"",Ft=t[3].partiesText+"",Lt=t[3].cooperativesTitle+"",At=t[3].cooperativesText+"",Et=t[3].communesTitle+"",Ht=t[3].communesText+"",Kt=t[3].findUs+"",Mt=t[3].whatNow+"",Qt=t[3].joinUs+"",Rt=t[3].talkWithUs+"";return{c(){e=g("div"),o=g("picture"),o.innerHTML=' \n \n crowd',r=d(),s=g("div"),n=g("p"),m=l(Ut),c=d(),p=g("div"),b=g("div"),T=g("a"),j=g("h2"),y=l(zt),k=d(),U=g("img"),N=d(),C=g("p"),F=l(Nt),L=d(),A=g("div"),E=g("a"),H=g("h2"),K=l(Ct),M=d(),Q=g("img"),S=d(),W=g("p"),q=l(Ft),B=d(),D=g("div"),G=g("a"),J=g("h2"),O=l(Lt),_=d(),I=g("img"),V=d(),X=g("p"),Y=l(At),Z=d(),$=g("div"),tt=g("a"),et=g("h2"),ot=l(Et),it=d(),rt=g("img"),nt=d(),at=g("p"),mt=l(Ht),ct=d(),pt=g("h1"),gt=l(Kt),dt=d(),lt=g("map-component"),ht=d(),ft=g("h1"),vt=l(Mt),wt=d(),xt=g("div"),bt=g("a"),Tt=l(Qt),jt=d(),yt=g("a"),kt=l(Rt),u(T,"href","/"+t[6]+"/groups"),u(U,"id","groups-img"),h(U.src,z="/img/common/groups.svg")||u(U,"src","/img/common/groups.svg"),u(U,"alt","groups"),u(E,"href","/"+t[6]+"/parties"),u(Q,"id","parties-img"),h(Q.src,R="/img/common/parties.svg")||u(Q,"src","/img/common/parties.svg"),u(Q,"alt","coops"),u(G,"href","/"+t[6]+"/coops"),u(I,"id","coops-img"),h(I.src,P="/img/common/coops.svg")||u(I,"src","/img/common/coops.svg"),u(I,"alt","coops"),u(tt,"href","/"+t[6]+"/communes"),u(rt,"id","communes-img"),h(rt.src,st="/img/common/communes.svg")||u(rt,"src","/img/common/communes.svg"),u(rt,"alt","communes"),u(p,"id","container-grid"),f(p,"--grid-width",t[1]),u(pt,"id","find-us"),v(lt,"id","map"),v(lt,"callback",ut=t[9]),v(lt,"colors",["#23AC20","#CA2437","#217BC9","#FFD326"]),u(bt,"class","link-button"),u(bt,"href","/"+t[6]+"/join-us"),u(yt,"class","link-button"),u(yt,"href","https://discord.gg/Qk8KUk787z"),u(yt,"target","_blank"),u(yt,"rel","noreferrer"),u(xt,"id","action-container"),u(s,"id","text-container"),u(e,"id","container")},m(a,g){i(a,e,g),w(e,o),w(e,r),w(e,s),w(s,n),w(n,m),w(s,c),w(s,p),w(p,b),w(b,T),w(T,j),w(j,y),w(b,k),w(b,U),w(b,N),w(b,C),w(C,F),w(p,L),w(p,A),w(A,E),w(E,H),w(H,K),w(A,M),w(A,Q),w(A,S),w(A,W),w(W,q),w(p,B),w(p,D),w(D,G),w(G,J),w(J,O),w(D,_),w(D,I),w(D,V),w(D,X),w(X,Y),w(p,Z),w(p,$),w($,tt),w(tt,et),w(et,ot),w($,it),w($,rt),w($,nt),w($,at),w(at,mt),t[8](p),w(s,ct),w(s,pt),w(pt,gt),w(s,dt),w(s,lt),w(s,ht),w(s,ft),w(ft,vt),w(s,wt),w(s,xt),w(xt,bt),w(bt,Tt),w(xt,jt),w(xt,yt),w(yt,kt)},p(t,e){8&e&&Ut!==(Ut=t[3].top+"")&&x(m,Ut),8&e&&zt!==(zt=t[3].groupsTitle+"")&&x(y,zt),8&e&&Nt!==(Nt=t[3].groupsText+"")&&x(F,Nt),8&e&&Ct!==(Ct=t[3].partiesTitle+"")&&x(K,Ct),8&e&&Ft!==(Ft=t[3].partiesText+"")&&x(q,Ft),8&e&&Lt!==(Lt=t[3].cooperativesTitle+"")&&x(O,Lt),8&e&&At!==(At=t[3].cooperativesText+"")&&x(Y,At),8&e&&Et!==(Et=t[3].communesTitle+"")&&x(ot,Et),8&e&&Ht!==(Ht=t[3].communesText+"")&&x(mt,Ht),2&e&&f(p,"--grid-width",t[1]),8&e&&Kt!==(Kt=t[3].findUs+"")&&x(gt,Kt),8&e&&ut!==(ut=t[9])&&v(lt,"callback",ut),8&e&&Mt!==(Mt=t[3].whatNow+"")&&x(vt,Mt),8&e&&Qt!==(Qt=t[3].joinUs+"")&&x(Tt,Qt),8&e&&Rt!==(Rt=t[3].talkWithUs+"")&&x(kt,Rt)},d(o){o&&a(e),t[8](null)}}}function F(t){let e,o=10==t[2]&&C(t);return{c(){o&&o.c(),e=s()},m(t,r){o&&o.m(t,r),i(t,e,r)},p(t,i){10==t[2]?o?o.p(t,i):(o=C(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&a(e)}}}function A(t){let e,o=t[2],m=F(t);return{c(){m.c(),e=s(),this.c=n},m(t,o){m.m(t,o),i(t,e,o)},p(t,[i]){4&i&&r(o,o=t[2])?(m.d(1),m=F(t),m.c(),m.m(e.parentNode,e)):m.p(t,i)},i:n,o:n,d(t){t&&a(e),m.d(t)}}}function E(t,e,o){let i,r,s,n,a=b(0);m(t,a,(t=>o(2,i=t)));let g=b({});m(t,g,(t=>o(3,r=t)));let d={},l={};function u(t){o(1,n="1fr 1fr")}let h=(t,e)=>{d[e]=JSON.parse(t),l[e]={};for(let t of d[e]){let o=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),o in l[e]?l[e][o].push(t):l[e][o]=[t]}a.update((t=>t+1))};T("/assets/groups.json",(t=>h(t,"groups"))),T("/assets/communes.json",(t=>h(t,"communes"))),T("/assets/cooperatives.json",(t=>h(t,"cooperatives"))),T("/assets/parties.json",(t=>h(t,"parties"))),j(g,"groups-component",a),j(g,"communes-component",a),j(g,"cooperatives-component",a),j(g,"parties-component",a),j(g,"countries",a);let f=j(g,"landing-component",a,u);function v(t,e,o){let i=t([22,0],2),r={enableCountryGrouping:!0},s=y(d.groups,l.groups,i,e,o,k,"green",r),n=y(d.communes,l.communes,i,e,o,U,"red",r),a=y(d.cooperatives,l.cooperatives,i,e,o,z,"blue",r),m=y(d.parties,l.parties,i,e,o,N,"gold",r),c={};c[e.groups]=s,c[e.communes]=n,c[e.cooperatives]=a,c[e.parties]=m,L.control.layers(null,c).addTo(i)}u(),c((()=>{}));return[s,n,i,r,a,g,f,v,function(t){p[t?"unshift":"push"]((()=>{s=t,o(0,s)}))},t=>v(t,r,f)]}class H extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},E,A,r,{},null),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("landing-component",H);export{H as default}; diff --git a/Server/public/js/components/legend-component.js b/Server/public/js/components/legend-component.js index 13747ad..8d398a8 100644 --- a/Server/public/js/components/legend-component.js +++ b/Server/public/js/components/legend-component.js @@ -1,362 +1 @@ - -(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, t as flush, s as safe_not_equal, A as validate_each_argument, d as dispatch_dev, v as validate_slots, o as onMount, e as globals, f as element, n as noop, k as attr_dev, j as add_location, p as detach_dev, D as destroy_each, q as binding_callbacks, h as space, B as text, F as set_style, l as append_dev, m as listen_dev, C as set_data_dev } from './index-998178c7.js'; -import { pullLegendData } from '../../../../../../../../../js/predict/charts.js'; - -/* src\components\legend-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; -const file = "src\\components\\legend-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[10] = list[i]; - child_ctx[11] = list; - child_ctx[12] = i; - return child_ctx; -} - -// (69:4) {#each legendData as item, i} -function create_each_block(ctx) { - let button; - let div; - let t0; - let span; - let t1_value = /*item*/ ctx[10].name + ""; - let t1; - let t2; - let i = /*i*/ ctx[12]; - let mounted; - let dispose; - const assign_button = () => /*button_binding*/ ctx[6](button, i); - const unassign_button = () => /*button_binding*/ ctx[6](null, i); - - function click_handler() { - return /*click_handler*/ ctx[7](/*i*/ ctx[12]); - } - - const block = { - c: function create() { - button = element("button"); - div = element("div"); - t0 = space(); - span = element("span"); - t1 = text(t1_value); - t2 = space(); - attr_dev(div, "class", "marker"); - set_style(div, "background-color", /*item*/ ctx[10].color); - add_location(div, file, 70, 12, 1892); - add_location(span, file, 71, 12, 1971); - add_location(button, file, 69, 8, 1814); - }, - m: function mount(target, anchor) { - insert_dev(target, button, anchor); - append_dev(button, div); - append_dev(button, t0); - append_dev(button, span); - append_dev(span, t1); - append_dev(button, t2); - assign_button(); - - if (!mounted) { - dispose = listen_dev(button, "click", click_handler, false, false, false); - mounted = true; - } - }, - p: function update(new_ctx, dirty) { - ctx = new_ctx; - - if (dirty & /*legendData*/ 1) { - set_style(div, "background-color", /*item*/ ctx[10].color); - } - - if (dirty & /*legendData*/ 1 && t1_value !== (t1_value = /*item*/ ctx[10].name + "")) set_data_dev(t1, t1_value); - - if (i !== /*i*/ ctx[12]) { - unassign_button(); - i = /*i*/ ctx[12]; - assign_button(); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(button); - unassign_button(); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(69:4) {#each legendData as item, i}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let div; - let each_value = /*legendData*/ ctx[0]; - 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() { - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - this.c = noop; - attr_dev(div, "class", "legend"); - add_location(div, file, 67, 0, 1749); - }, - 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) { - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - }, - p: function update(ctx, [dirty]) { - if (dirty & /*buttons, toggleSeries, legendData*/ 7) { - each_value = /*legendData*/ ctx[0]; - 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(div, null); - } - } - - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - - each_blocks.length = each_value.length; - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('legend-component', slots, []); - let { option = null } = $$props; - let { chart = null } = $$props; - let { data = {} } = $$props; - - // Main code - let legendData = []; - - let buttons = []; - let dataKeys; - - function init() { - if (option == null || option == undefined || chart == null || chart == undefined) { - setTimeout(init, 100); - } else { - $$invalidate(0, legendData = pullLegendData(legendData, option)); - - for (let obj of legendData) { - $$invalidate(3, data[obj.name] = true, data); - } - - dataKeys = Object.keys(data); - } - } - - function toggleSeries(i) { - $$invalidate(3, data[dataKeys[i]] = !data[dataKeys[i]], data); - let inds = []; - let ids = option.series.map(x => x._id); - let id = ids[i]; - - for (let j = 0; j < ids.length; j++) { - if (ids[j] == id) { - inds.push(j); - } - } - - for (let i of inds) { - let series = option.series[i]; - - if (!series.tooltip.show) { - series.lineStyle.opacity = 1; - series.itemStyle.opacity = 1; - series.tooltip.show = true; - $$invalidate(1, buttons[inds[0]].style.opacity = 1, buttons); - } else { - series.lineStyle.opacity = 0; - series.itemStyle.opacity = 0; - series.tooltip.show = false; - $$invalidate(1, buttons[inds[0]].style.opacity = 0.5, buttons); - } - } - - chart.setOption(option); - } - - onMount(() => { - init(); - }); - - const writable_props = ['option', 'chart', 'data']; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function button_binding($$value, i) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - buttons[i] = $$value; - $$invalidate(1, buttons); - }); - } - - const click_handler = i => toggleSeries(i); - - $$self.$$set = $$props => { - if ('option' in $$props) $$invalidate(4, option = $$props.option); - if ('chart' in $$props) $$invalidate(5, chart = $$props.chart); - if ('data' in $$props) $$invalidate(3, data = $$props.data); - }; - - $$self.$capture_state = () => ({ - onMount, - pullLegendData, - option, - chart, - data, - legendData, - buttons, - dataKeys, - init, - toggleSeries - }); - - $$self.$inject_state = $$props => { - if ('option' in $$props) $$invalidate(4, option = $$props.option); - if ('chart' in $$props) $$invalidate(5, chart = $$props.chart); - if ('data' in $$props) $$invalidate(3, data = $$props.data); - if ('legendData' in $$props) $$invalidate(0, legendData = $$props.legendData); - if ('buttons' in $$props) $$invalidate(1, buttons = $$props.buttons); - if ('dataKeys' in $$props) dataKeys = $$props.dataKeys; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - legendData, - buttons, - toggleSeries, - data, - option, - chart, - button_binding, - click_handler - ]; -} - -class Legend_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { option: 4, chart: 5, data: 3 }, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["option", "chart", "data"]; - } - - get option() { - return this.$$.ctx[4]; - } - - set option(option) { - this.$$set({ option }); - flush(); - } - - get chart() { - return this.$$.ctx[5]; - } - - set chart(chart) { - this.$$set({ chart }); - flush(); - } - - get data() { - return this.$$.ctx[3]; - } - - set data(data) { - this.$$set({ data }); - flush(); - } -} - -customElements.define("legend-component", Legend_component); - -export { Legend_component as default }; +import{S as t,i as e,a as s,b as o,k as n,s as r,e as i,n as a,d as l,g as c,x as p,o as u,c as h,v as d,y as m,f,l as g,w as y,j as $}from"./index-db20528a.js";import{pullLegendData as b}from"../../../../../../../../../js/predict/charts.js";function w(t,e,s){const o=t.slice();return o[10]=e[s],o[11]=e,o[12]=s,o}function x(t){let e,s,n,r,a,p,u,$,b=t[10].name+"",w=t[12];const x=()=>t[6](e,w),k=()=>t[6](null,w);function j(){return t[7](t[12])}return{c(){e=i("button"),s=i("div"),n=h(),r=i("span"),a=d(b),p=h(),l(s,"class","marker"),m(s,"background-color",t[10].color)},m(t,i){o(t,e,i),f(e,s),f(e,n),f(e,r),f(r,a),f(e,p),x(),u||($=g(e,"click",j),u=!0)},p(e,o){t=e,1&o&&m(s,"background-color",t[10].color),1&o&&b!==(b=t[10].name+"")&&y(a,b),w!==t[12]&&(k(),w=t[12],x())},d(t){t&&c(e),k(),u=!1,$()}}}function k(t){let e,s=t[0],n=[];for(let e=0;et._id)),c=a[t];for(let t=0;t{c()}));return t.$$set=t=>{"option"in t&&s(4,n=t.option),"chart"in t&&s(5,r=t.chart),"data"in t&&s(3,i=t.data)},[a,l,p,i,n,r,function(t,e){$[t?"unshift":"push"]((()=>{l[e]=t,s(1,l)}))},t=>p(t)]}class v extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:s(this.attributes),customElement:!0},j,k,r,{option:4,chart:5,data:3},null),t&&(t.target&&o(t.target,this,t.anchor),t.props&&(this.$set(t.props),n()))}static get observedAttributes(){return["option","chart","data"]}get option(){return this.$$.ctx[4]}set option(t){this.$$set({option:t}),n()}get chart(){return this.$$.ctx[5]}set chart(t){this.$$set({chart:t}),n()}get data(){return this.$$.ctx[3]}set data(t){this.$$set({data:t}),n()}}customElements.define("legend-component",v);export{v as default}; diff --git a/Server/public/js/components/loadscreen-component.js b/Server/public/js/components/loadscreen-component.js index 4ff895d..2f0362f 100644 --- a/Server/public/js/components/loadscreen-component.js +++ b/Server/public/js/components/loadscreen-component.js @@ -1,115 +1 @@ - -(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, o as onMount, f as element, n as noop, k as attr_dev, F as set_style, j as add_location, p as detach_dev, q as binding_callbacks } from './index-998178c7.js'; - -/* src\components\loadscreen-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\components\\loadscreen-component.svelte"; - -function create_fragment(ctx) { - let div; - - const block = { - c: function create() { - div = element("div"); - this.c = noop; - attr_dev(div, "id", "loadscreen"); - set_style(div, "width", "100%"); - set_style(div, "height", "100%"); - set_style(div, "background", "white"); - set_style(div, "position", "absolute"); - set_style(div, "z-index", "100000"); - add_location(div, file, 20, 0, 366); - }, - 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) { - insert_dev(target, div, anchor); - /*div_binding*/ ctx[1](div); - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - /*div_binding*/ ctx[1](null); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('loadscreen-component', slots, []); - let loadscreen; - - onMount(() => { - window.addEventListener('load', function () { - $$invalidate(0, loadscreen.parentNode.host.style.display = "none", loadscreen); - }); - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function div_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - loadscreen = $$value; - $$invalidate(0, loadscreen); - }); - } - - $$self.$capture_state = () => ({ onMount, loadscreen }); - - $$self.$inject_state = $$props => { - if ('loadscreen' in $$props) $$invalidate(0, loadscreen = $$props.loadscreen); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [loadscreen, div_binding]; -} - -class Loadscreen_component extends SvelteElement { - constructor(options) { - super(); - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("loadscreen-component", Loadscreen_component); - -export { Loadscreen_component as default }; +import{S as t,i as s,a as e,b as n,s as a,e as o,n as i,d,y as r,g as u,o as c,j as l}from"./index-db20528a.js";function h(t){let s;return{c(){s=o("div"),this.c=i,d(s,"id","loadscreen"),r(s,"width","100%"),r(s,"height","100%"),r(s,"background","white"),r(s,"position","absolute"),r(s,"z-index","100000")},m(e,a){n(e,s,a),t[1](s)},p:i,i:i,o:i,d(e){e&&u(s),t[1](null)}}}function p(t,s,e){let n;return c((()=>{window.addEventListener("load",(function(){e(0,n.parentNode.host.style.display="none",n)}))})),[n,function(t){l[t?"unshift":"push"]((()=>{n=t,e(0,n)}))}]}class f extends t{constructor(t){super(),s(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},p,h,a,{},null),t&&t.target&&n(t.target,this,t.anchor)}}customElements.define("loadscreen-component",f);export{f as default}; diff --git a/Server/public/js/components/login-component.js b/Server/public/js/components/login-component.js index c368d90..b65c7c1 100644 --- a/Server/public/js/components/login-component.js +++ b/Server/public/js/components/login-component.js @@ -1,448 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, g as getContext, o as onMount, f as element, h as space, n as noop, k as attr_dev, j as add_location, u as src_url_equal, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks } from './index-998178c7.js'; -import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js'; - -/* src\auth\login-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\auth\\login-component.svelte"; - -function create_fragment(ctx) { - let div5; - let h2; - let t1; - let label0; - let span0; - let t3; - let input0; - let t4; - let div0; - let label1; - let span1; - let t6; - let input1; - let t7; - let button0; - let object; - let t8; - let div1; - let input2; - let label2; - let t10; - let button1; - let t12; - let a; - let t14; - let hr; - let t15; - let div4; - let div3; - let div2; - let t16; - let img; - let img_src_value; - let mounted; - let dispose; - - const block = { - c: function create() { - div5 = element("div"); - h2 = element("h2"); - h2.textContent = "LOG IN"; - t1 = space(); - label0 = element("label"); - label0.textContent = "Email "; - span0 = element("span"); - t3 = space(); - input0 = element("input"); - t4 = space(); - div0 = element("div"); - label1 = element("label"); - label1.textContent = "Password "; - span1 = element("span"); - t6 = space(); - input1 = element("input"); - t7 = space(); - button0 = element("button"); - object = element("object"); - t8 = space(); - div1 = element("div"); - input2 = element("input"); - label2 = element("label"); - label2.textContent = "remember me"; - t10 = space(); - button1 = element("button"); - button1.textContent = "Log in"; - t12 = space(); - a = element("a"); - a.textContent = "Forgot password?"; - t14 = space(); - hr = element("hr"); - t15 = space(); - div4 = element("div"); - div3 = element("div"); - div2 = element("div"); - t16 = space(); - img = element("img"); - this.c = noop; - attr_dev(h2, "class", "auth-title"); - add_location(h2, file, 68, 4, 1639); - attr_dev(label0, "class", "auth-label"); - attr_dev(label0, "for", "emailInput"); - add_location(label0, file, 69, 4, 1679); - attr_dev(span0, "id", "email-msg"); - add_location(span0, file, 69, 66, 1741); - attr_dev(input0, "id", "emailInput"); - attr_dev(input0, "class", "authEmailInput"); - attr_dev(input0, "type", "email"); - add_location(input0, file, 70, 4, 1796); - attr_dev(label1, "class", "auth-label"); - attr_dev(label1, "for", "passwordInput"); - add_location(label1, file, 72, 8, 1922); - attr_dev(span1, "id", "password-msg"); - add_location(span1, file, 72, 76, 1990); - attr_dev(input1, "id", "passwordInput"); - attr_dev(input1, "class", "authPasswordInput"); - attr_dev(input1, "type", "password"); - add_location(input1, file, 73, 8, 2055); - attr_dev(object, "type", "image/svg+xml"); - attr_dev(object, "data", "/img/auth/eye_icon.svg"); - attr_dev(object, "title", "eye icon"); - add_location(object, file, 75, 12, 2316); - attr_dev(button0, "class", "eye-icon"); - add_location(button0, file, 74, 8, 2160); - attr_dev(div0, "class", "password-field"); - add_location(div0, file, 71, 4, 1884); - attr_dev(input2, "type", "checkbox"); - attr_dev(input2, "id", "remember-me-checkbox"); - add_location(input2, file, 79, 8, 2470); - attr_dev(label2, "id", "remember-me-label"); - attr_dev(label2, "for", "passwordInput"); - add_location(label2, file, 79, 80, 2542); - attr_dev(div1, "id", "remember-me"); - add_location(div1, file, 78, 4, 2438); - attr_dev(button1, "class", "auth-button"); - add_location(button1, file, 81, 4, 2629); - attr_dev(a, "id", "forgot-password"); - attr_dev(a, "href", "forgot-password"); - add_location(a, file, 82, 4, 2726); - attr_dev(hr, "class", "auth-line"); - add_location(hr, file, 83, 4, 2799); - attr_dev(div2, "id", "google-btn"); - add_location(div2, file, 86, 12, 2912); - if (!src_url_equal(img.src, img_src_value = "/img/auth/google_icon.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "id", "google-logo"); - attr_dev(img, "alt", "google icon"); - add_location(img, file, 87, 12, 2978); - attr_dev(div3, "id", "google-btn-wrapper"); - add_location(div3, file, 85, 8, 2869); - attr_dev(div4, "class", "auth-methods-group"); - add_location(div4, file, 84, 4, 2827); - attr_dev(div5, "id", "login-group"); - attr_dev(div5, "class", "pane auth-pane"); - add_location(div5, file, 67, 0, 1589); - }, - 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) { - insert_dev(target, div5, anchor); - append_dev(div5, h2); - append_dev(div5, t1); - append_dev(div5, label0); - append_dev(div5, span0); - /*span0_binding*/ ctx[10](span0); - append_dev(div5, t3); - append_dev(div5, input0); - /*input0_binding*/ ctx[11](input0); - append_dev(div5, t4); - append_dev(div5, div0); - append_dev(div0, label1); - append_dev(div0, span1); - /*span1_binding*/ ctx[12](span1); - append_dev(div0, t6); - append_dev(div0, input1); - /*input1_binding*/ ctx[13](input1); - append_dev(div0, t7); - append_dev(div0, button0); - append_dev(button0, object); - /*button0_binding*/ ctx[14](button0); - append_dev(div5, t8); - append_dev(div5, div1); - append_dev(div1, input2); - /*input2_binding*/ ctx[16](input2); - append_dev(div1, label2); - append_dev(div5, t10); - append_dev(div5, button1); - append_dev(div5, t12); - append_dev(div5, a); - append_dev(div5, t14); - append_dev(div5, hr); - append_dev(div5, t15); - append_dev(div5, div4); - append_dev(div4, div3); - append_dev(div3, div2); - /*div2_binding*/ ctx[18](div2); - append_dev(div3, t16); - append_dev(div3, img); - - if (!mounted) { - dispose = [ - listen_dev(button0, "click", /*click_handler*/ ctx[15], false, false, false), - listen_dev(button1, "click", /*click_handler_1*/ ctx[17], false, false, false) - ]; - - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div5); - /*span0_binding*/ ctx[10](null); - /*input0_binding*/ ctx[11](null); - /*span1_binding*/ ctx[12](null); - /*input1_binding*/ ctx[13](null); - /*button0_binding*/ ctx[14](null); - /*input2_binding*/ ctx[16](null); - /*div2_binding*/ ctx[18](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('login-component', slots, []); - let { focused = false } = $$props; - - // Main code - let emailInput; - - let passwordInput; - let inputs; - let passwordVisibilityButton; - let emailMsg; - let passwordMsg; - let msgs; - let rememberMe; - let googleButton; - let parentProps = getContext("auth"); - - function renderGoogle() { - if (parentProps.googleInit) { - google.accounts.id.renderButton(googleButton, { theme: 'outline', size: 'large' }); - let iframe = googleButton.getElementsByTagName('iframe')[0]; - iframe.style.height = "5rem"; - iframe.style.width = "5rem"; - } else { - setTimeout(renderGoogle, 100); - } - } - - onMount(() => { - $$invalidate(7, rememberMe.checked = true, rememberMe); - - $$invalidate(2, inputs = { - email: emailInput, - password: passwordInput, - remember: rememberMe - }); - - $$invalidate(6, msgs = { email: emailMsg, password: passwordMsg }); - parentProps.msgs = msgs; - parentProps.remember = rememberMe; - parentProps.loginGoogle = googleButton; - - document.addEventListener("keypress", function (event) { - if (event.code == "Enter") { - if (focused) { - AuthTools.login(msgs, inputs); - } - } - }); - - renderGoogle(); - }); - - const writable_props = ['focused']; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function span0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailMsg = $$value; - $$invalidate(4, emailMsg); - }); - } - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailInput = $$value; - $$invalidate(0, emailInput); - }); - } - - function span1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordMsg = $$value; - $$invalidate(5, passwordMsg); - }); - } - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordInput = $$value; - $$invalidate(1, passwordInput); - }); - } - - function button0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordVisibilityButton = $$value; - $$invalidate(3, passwordVisibilityButton); - }); - } - - const click_handler = () => AuthTools.changePasswordVisibility(passwordVisibilityButton); - - function input2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - rememberMe = $$value; - $$invalidate(7, rememberMe); - }); - } - - const click_handler_1 = () => AuthTools.login(msgs, inputs); - - function div2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - googleButton = $$value; - $$invalidate(8, googleButton); - }); - } - - $$self.$$set = $$props => { - if ('focused' in $$props) $$invalidate(9, focused = $$props.focused); - }; - - $$self.$capture_state = () => ({ - onMount, - getContext, - AuthTools, - focused, - emailInput, - passwordInput, - inputs, - passwordVisibilityButton, - emailMsg, - passwordMsg, - msgs, - rememberMe, - googleButton, - parentProps, - renderGoogle - }); - - $$self.$inject_state = $$props => { - if ('focused' in $$props) $$invalidate(9, focused = $$props.focused); - if ('emailInput' in $$props) $$invalidate(0, emailInput = $$props.emailInput); - if ('passwordInput' in $$props) $$invalidate(1, passwordInput = $$props.passwordInput); - if ('inputs' in $$props) $$invalidate(2, inputs = $$props.inputs); - if ('passwordVisibilityButton' in $$props) $$invalidate(3, passwordVisibilityButton = $$props.passwordVisibilityButton); - if ('emailMsg' in $$props) $$invalidate(4, emailMsg = $$props.emailMsg); - if ('passwordMsg' in $$props) $$invalidate(5, passwordMsg = $$props.passwordMsg); - if ('msgs' in $$props) $$invalidate(6, msgs = $$props.msgs); - if ('rememberMe' in $$props) $$invalidate(7, rememberMe = $$props.rememberMe); - if ('googleButton' in $$props) $$invalidate(8, googleButton = $$props.googleButton); - if ('parentProps' in $$props) parentProps = $$props.parentProps; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - emailInput, - passwordInput, - inputs, - passwordVisibilityButton, - emailMsg, - passwordMsg, - msgs, - rememberMe, - googleButton, - focused, - span0_binding, - input0_binding, - span1_binding, - input1_binding, - button0_binding, - click_handler, - input2_binding, - click_handler_1, - div2_binding - ]; -} - -class Login_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { focused: 9 }, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["focused"]; - } - - get focused() { - return this.$$.ctx[9]; - } - - set focused(focused) { - this.$$set({ focused }); - flush(); - } -} - -customElements.define("login-component", Login_component); - -export { Login_component as default }; +import{S as t,i as s,a as e,b as o,k as n,s as a,e as i,c as u,n as l,d as r,f as c,l as d,g as m,r as p,m as h,o as f,j as g}from"./index-db20528a.js";import*as b from"../../../../../../../../../js/libraries/authTools.js";function w(t){let s,e,n,a,h,f,g,b,w,y,x,I,k,v,E,$,j,C,L,T,P,B,G,H,M;return{c(){s=i("div"),e=i("h2"),e.textContent="LOG IN",n=u(),a=i("label"),a.textContent="Email ",h=i("span"),f=u(),g=i("input"),b=u(),w=i("div"),y=i("label"),y.textContent="Password ",x=i("span"),I=u(),k=i("input"),v=u(),E=i("button"),E.innerHTML='',$=u(),j=i("div"),C=i("input"),L=i("label"),L.textContent="remember me",T=u(),P=i("button"),P.textContent="Log in",B=u(),G=i("a"),G.textContent="Forgot password?",this.c=l,r(e,"class","auth-title"),r(a,"class","auth-label"),r(a,"for","emailInput"),r(h,"id","email-msg"),r(g,"id","emailInput"),r(g,"class","authEmailInput"),r(g,"type","email"),r(y,"class","auth-label"),r(y,"for","passwordInput"),r(x,"id","password-msg"),r(k,"id","passwordInput"),r(k,"class","authPasswordInput"),r(k,"type","password"),r(E,"class","eye-icon"),r(w,"class","password-field"),r(C,"type","checkbox"),r(C,"id","remember-me-checkbox"),r(L,"id","remember-me-label"),r(L,"for","passwordInput"),r(j,"id","remember-me"),r(P,"class","auth-button"),r(G,"id","forgot-password"),r(G,"href","forgot-password"),r(s,"id","login-group"),r(s,"class","pane auth-pane")},m(i,u){o(i,s,u),c(s,e),c(s,n),c(s,a),c(s,h),t[9](h),c(s,f),c(s,g),t[10](g),c(s,b),c(s,w),c(w,y),c(w,x),t[11](x),c(w,I),c(w,k),t[12](k),c(w,v),c(w,E),t[13](E),c(s,$),c(s,j),c(j,C),t[15](C),c(j,L),c(s,T),c(s,P),c(s,B),c(s,G),H||(M=[d(E,"click",t[14]),d(P,"click",t[16])],H=!0)},p:l,i:l,o:l,d(e){e&&m(s),t[9](null),t[10](null),t[11](null),t[12](null),t[13](null),t[15](null),H=!1,p(M)}}}function y(t,s,e){let o,n,a,i,u,l,r,c,d,{focused:m=!1}=s,p=h("auth");function w(){if(p.googleInit){google.accounts.id.renderButton(d,{theme:"outline",size:"large"});let t=d.getElementsByTagName("iframe")[0];t.style.height="5rem",t.style.width="5rem"}else setTimeout(w,100)}f((()=>{e(7,c.checked=!0,c),e(2,a={email:o,password:n,remember:c}),e(6,r={email:u,password:l}),p.msgs=r,p.remember=c,p.loginGoogle=d,document.addEventListener("keypress",(function(t){"Enter"==t.code&&m&&b.login(r,a)})),w()}));return t.$$set=t=>{"focused"in t&&e(8,m=t.focused)},[o,n,a,i,u,l,r,c,m,function(t){g[t?"unshift":"push"]((()=>{u=t,e(4,u)}))},function(t){g[t?"unshift":"push"]((()=>{o=t,e(0,o)}))},function(t){g[t?"unshift":"push"]((()=>{l=t,e(5,l)}))},function(t){g[t?"unshift":"push"]((()=>{n=t,e(1,n)}))},function(t){g[t?"unshift":"push"]((()=>{i=t,e(3,i)}))},()=>b.changePasswordVisibility(i),function(t){g[t?"unshift":"push"]((()=>{c=t,e(7,c)}))},()=>b.login(r,a)]}class x extends t{constructor(t){super(),this.shadowRoot.innerHTML="",s(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},y,w,a,{focused:8},null),t&&(t.target&&o(t.target,this,t.anchor),t.props&&(this.$set(t.props),n()))}static get observedAttributes(){return["focused"]}get focused(){return this.$$.ctx[8]}set focused(t){this.$$set({focused:t}),n()}}customElements.define("login-component",x);export{x as default}; diff --git a/Server/public/js/components/manifesto-component.js b/Server/public/js/components/manifesto-component.js index e09d6b0..bff746e 100644 --- a/Server/public/js/components/manifesto-component.js +++ b/Server/public/js/components/manifesto-component.js @@ -1,1490 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, q as binding_callbacks, A as validate_each_argument, f as element, k as attr_dev, j as add_location, l as append_dev, B as text, h as space, u as src_url_equal, F as set_style, m as listen_dev, C as set_data_dev, D as destroy_each, H as is_function, I as HtmlTag } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.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[33] = list[i]; - child_ctx[34] = list; - child_ctx[35] = i; - return child_ctx; -} - -function get_each_context_2(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[36] = list[i]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[36] = list[i]; - return child_ctx; -} - -function get_each_context_3(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[41] = list[i]; - child_ctx[42] = list; - child_ctx[43] = i; - return child_ctx; -} - -function get_each_context_4(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[44] = list[i]; - child_ctx[45] = list; - child_ctx[46] = i; - return child_ctx; -} - -// (168:4) {#if $loaded==2} -function create_if_block(ctx) { - let div1; - let div0; - let previous_key = /*key*/ ctx[0]; - let key_block = create_key_block_1(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, 6059); - attr_dev(div1, "id", "container"); - add_location(div1, file, 168, 8, 6008); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - key_block.m(div0, null); - /*div1_binding_1*/ ctx[28](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_1(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[28](null); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(168:4) {#if $loaded==2}", - ctx - }); - - return block; -} - -// (187:32) {:else} -function create_else_block_1(ctx) { - let div; - let button; - let t0_value = /*obj*/ ctx[41].name + ""; - let t0; - let obj = /*obj*/ ctx[41]; - let t1; - let mounted; - let dispose; - const assign_button = () => /*button_binding_2*/ ctx[21](button, obj); - const unassign_button = () => /*button_binding_2*/ ctx[21](null, obj); - - function click_handler_2() { - return /*click_handler_2*/ ctx[22](/*obj*/ ctx[41]); - } - - 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, 7396); - attr_dev(div, "class", "heading-button-wrapper"); - add_location(div, file, 187, 36, 7318); - }, - 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[41]) { - unassign_button(); - obj = /*obj*/ ctx[41]; - 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[41]; - 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*/ 36880) { - each_value_4 = /*obj*/ ctx[41]; - 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[44].name + ""; - let t0; - let obj2 = /*obj2*/ ctx[44]; - let t1; - let mounted; - let dispose; - const assign_button = () => /*button_binding_1*/ ctx[19](button, obj2); - const unassign_button = () => /*button_binding_1*/ ctx[19](null, obj2); - - function click_handler_1() { - return /*click_handler_1*/ ctx[20](/*obj2*/ ctx[44]); - } - - 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, 6934); - attr_dev(div, "class", "heading-button-wrapper"); - add_location(div, file, 180, 36, 6856); - }, - 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[44]) { - unassign_button(); - obj2 = /*obj2*/ ctx[44]; - 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[41])) 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[33] === 'object') && Object.keys(/*line*/ ctx[33])[0] == "ul") return create_if_block_2; - if (typeof (/*line*/ ctx[33] === 'object') && Object.keys(/*line*/ ctx[33])[0] == "ol") return create_if_block_3; - if (typeof (/*line*/ ctx[33] === 'object') && /*line*/ ctx[33].type == "h3") return create_if_block_4; - if (typeof (/*line*/ ctx[33] === 'object') && /*line*/ ctx[33].type == "h2") return create_if_block_5; - if (/*line*/ ctx[33][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[33] + ""; - 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, 9794); - }, - 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[33].slice(2, /*line*/ ctx[33].length) + ""; - - const block = { - c: function create() { - h1 = element("h1"); - add_location(h1, file, 222, 36, 9673); - }, - 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[33].line + ""; - let line = /*line*/ ctx[33]; - let t; - let mounted; - let dispose; - const assign_h2 = () => /*h2_binding*/ ctx[26](h2, line); - const unassign_h2 = () => /*h2_binding*/ ctx[26](null, line); - - const block = { - c: function create() { - button = element("button"); - h2 = element("h2"); - t = space(); - attr_dev(h2, "id", /*line*/ ctx[33].id); - add_location(h2, file, 219, 40, 9455); - set_style(button, "display", "block"); - set_style(button, "width", "100%"); - add_location(button, file, 218, 36, 9302); - }, - 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[33]) { - unassign_h2(); - line = /*line*/ ctx[33]; - 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[33].line + ""; - let line = /*line*/ ctx[33]; - let t; - let mounted; - let dispose; - const assign_h3 = () => /*h3_binding*/ ctx[25](h3, line); - const unassign_h3 = () => /*h3_binding*/ ctx[25](null, line); - - const block = { - c: function create() { - button = element("button"); - h3 = element("h3"); - t = space(); - attr_dev(h3, "id", /*line*/ ctx[33].id); - add_location(h3, file, 215, 40, 9049); - set_style(button, "display", "block"); - set_style(button, "width", "100%"); - add_location(button, file, 214, 36, 8896); - }, - 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[33]) { - unassign_h3(); - line = /*line*/ ctx[33]; - 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[33].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, 8440); - }, - 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*/ 2048) { - each_value_2 = /*line*/ ctx[33].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[33].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, 8075); - }, - 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*/ 2048) { - each_value_1 = /*line*/ ctx[33].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[36] + ""; - - const block = { - c: function create() { - li = element("li"); - add_location(li, file, 208, 44, 8556); - }, - 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[36] + ""; - let t; - - const block = { - c: function create() { - li = element("li"); - t = text(t_value); - add_location(li, file, 202, 44, 8191); - }, - 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[33] !== "") 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_1(ctx) { - let div1; - let button; - let t0_value = /*$content*/ ctx[10].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[12]; - 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[11]; - 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, 6403); - attr_dev(button, "id", "toggle-content"); - add_location(button, file, 172, 24, 6209); - attr_dev(div0, "class", "module"); - set_style(div0, "display", "initial"); - add_location(div0, file, 176, 24, 6572); - attr_dev(div1, "id", "table-content"); - add_location(div1, file, 171, 20, 6134); - attr_dev(div2, "id", "main"); - add_location(div2, file, 196, 20, 7811); - }, - 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[16](img); - /*button_binding*/ ctx[17](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[23](div0); - /*div1_binding*/ ctx[24](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[27](div2); - - if (!mounted) { - dispose = listen_dev(button, "click", /*click_handler*/ ctx[18], false, false, false); - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty[0] & /*$content*/ 1024 && t0_value !== (t0_value = /*$content*/ ctx[10].tableOfContents + "")) set_data_dev(t0, t0_value); - - if (dirty[0] & /*contentHeadings, buttons, goToChapter*/ 36880) { - each_value_3 = /*contentHeadings*/ ctx[12]; - 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*/ 2144) { - each_value = /*manifesto*/ ctx[11]; - 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[16](null); - /*button_binding*/ ctx[17](null); - destroy_each(each_blocks_1, detaching); - /*div0_binding*/ ctx[23](null); - /*div1_binding*/ ctx[24](null); - if (detaching) detach_dev(t3); - if (detaching) detach_dev(div2); - destroy_each(each_blocks, detaching); - /*div2_binding*/ ctx[27](null); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block_1.name, - type: "key", - source: "(171:16) {#key key}", - ctx - }); - - return block; -} - -// (167:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[9] == 2 && create_if_block(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 (/*$loaded*/ ctx[9] == 2) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(167:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[9]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, dirty) { - if (dirty[0] & /*$loaded*/ 512 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[9])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - 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 $loaded; - 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 = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(9, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(10, $content = value)); - loadLocaleContent(content, "countries", loaded); - 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 = ""; - - 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(` 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, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('manifesto' in $$props) $$invalidate(11, 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(12, 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(13, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(14, 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, - $loaded, - $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 = ``; - - 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 }; +import{S as t,i as e,a as n,b as i,s as l,p as o,n as r,g as s,q as c,o as a,j as d,e as m,d as u,f,v as h,c as p,t as g,y as w,l as b,w as x,x as y,z as v,H as k}from"./index-db20528a.js";import{w as H}from"./index-720c0a59.js";import{loadLocaleContent as j,getData as I}from"../../../../../../../../../js/libraries/serverTools.js";import{px2rem as L}from"../../../../../../../../../js/libraries/miscTools.js";function T(t,e,n){const i=t.slice();return i[33]=e[n],i[34]=e,i[35]=n,i}function Y(t,e,n){const i=t.slice();return i[36]=e[n],i}function C(t,e,n){const i=t.slice();return i[36]=e[n],i}function M(t,e,n){const i=t.slice();return i[41]=e[n],i[42]=e,i[43]=n,i}function z(t,e,n){const i=t.slice();return i[44]=e[n],i[45]=e,i[46]=n,i}function A(t){let e,n,o=t[0],r=K(t);return{c(){e=m("div"),n=m("div"),r.c(),u(n,"id","text-container"),u(e,"id","container")},m(l,o){i(l,e,o),f(e,n),r.m(n,null),t[28](e)},p(t,e){1&e[0]&&l(o,o=t[0])?(r.d(1),r=K(t),r.c(),r.m(n,null)):r.p(t,e)},d(n){n&&s(e),r.d(n),t[28](null)}}}function V(t){let e,n,l,o,r,c,a=t[41].name+"",d=t[41];const g=()=>t[21](n,d),w=()=>t[21](null,d);function x(){return t[22](t[41])}return{c(){e=m("div"),n=m("button"),l=h(a),o=p(),u(n,"class","level0 heading-button"),u(e,"class","heading-button-wrapper")},m(t,s){i(t,e,s),f(e,n),f(n,l),g(),f(e,o),r||(c=b(n,"click",x),r=!0)},p(e,n){d!==(t=e)[41]&&(w(),d=t[41],g())},d(t){t&&s(e),w(),r=!1,c()}}}function O(t){let e,n=t[41],l=[];for(let e=0;et[19](n,d),w=()=>t[19](null,d);function x(){return t[20](t[44])}return{c(){e=m("div"),n=m("button"),l=h(a),o=p(),u(n,"class","level1 heading-button"),u(e,"class","heading-button-wrapper")},m(t,s){i(t,e,s),f(e,n),f(n,l),g(),f(e,o),r||(c=b(n,"click",x),r=!0)},p(e,n){d!==(t=e)[44]&&(w(),d=t[44],g())},d(t){t&&s(e),w(),r=!1,c()}}}function S(t){let e;let n=function(t,e){return Array.isArray(t[41])?O:V}(t),l=n(t);return{c(){l.c(),e=o()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&s(e)}}}function E(t){let e;let n=function(t,e){return t[33],"ul"==Object.keys(t[33])[0]?D:(t[33],"ol"==Object.keys(t[33])[0]?W:(t[33],"h3"==t[33].type?q:(t[33],"h2"==t[33].type?_:"#"==t[33][0]?B:N)))}(t),l=n(t);return{c(){l.c(),e=o()},m(t,n){l.m(t,n),i(t,e,n)},p(t,e){l.p(t,e)},d(t){l.d(t),t&&s(e)}}}function N(t){let e,n,l,o=t[33]+"";return{c(){e=m("p"),n=new k(!1),l=p(),n.a=l,u(e,"class","margin-end")},m(t,r){i(t,e,r),n.m(o,e),f(e,l)},p:r,d(t){t&&s(e)}}}function B(t){let e,n=t[33].slice(2,t[33].length)+"";return{c(){e=m("h1")},m(t,l){i(t,e,l),e.innerHTML=n},p:r,d(t){t&&s(e)}}}function _(t){let e,n,l,o,r,c=t[33].line+"",a=t[33];const d=()=>t[26](n,a),h=()=>t[26](null,a);return{c(){e=m("button"),n=m("h2"),l=p(),u(n,"id",t[33].id),w(e,"display","block"),w(e,"width","100%")},m(s,a){i(s,e,a),f(e,n),n.innerHTML=c,d(),f(e,l),o||(r=b(e,"click",(function(){v(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),o=!0)},p(e,n){a!==(t=e)[33]&&(h(),a=t[33],d())},d(t){t&&s(e),h(),o=!1,r()}}}function q(t){let e,n,l,o,r,c=t[33].line+"",a=t[33];const d=()=>t[25](n,a),h=()=>t[25](null,a);return{c(){e=m("button"),n=m("h3"),l=p(),u(n,"id",t[33].id),w(e,"display","block"),w(e,"width","100%")},m(s,a){i(s,e,a),f(e,n),n.innerHTML=c,d(),f(e,l),o||(r=b(e,"click",(function(){v(t[6].scrollIntoView({block:"start"},!0))&&t[6].scrollIntoView({block:"start"},!0).apply(this,arguments)})),o=!0)},p(e,n){a!==(t=e)[33]&&(h(),a=t[33],d())},d(t){t&&s(e),h(),o=!1,r()}}}function W(t){let e,n,l=t[33].ol,o=[];for(let e=0;en(9,i=t)));let k=H({});c(t,k,(t=>n(10,l=t))),j(k,"countries",v);let T=j(k,"manifesto-component",v);const Y=["ul","ol"];function C(t){w[t].scrollIntoView({block:"start"},!0)}I("/locales/"+T+"/manifesto.txt",(function(t){let e,i=t.split(/\r?\n/),l=0;for(let t=0;tn.includes("<"+t+">"))).findIndex((t=>t));if(-1!=o){let e=Y[o],l={};l[e]=[];let r="";for(;;){if(t+=1,n=i[t],n.includes(r)){p.push(l);break}l[e].push(n)}}else if("###"==n.slice(0,3)){let t=n.slice(4,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");e.push({id:i,name:t,index:l}),l+=1,p.push({type:"h3",id:i,line:t,index:l})}else if("##"==n.slice(0,2)){let t=n.slice(3,n.length),i=t.toLowerCase().trim().replaceAll(" ","-");b.push({id:t.toLowerCase().trim().replaceAll(" ","-"),name:t,index:l}),l+=1,e=[],b.push(e),p.push({type:"h2",id:i,line:t,index:l})}else p.push(n)}n(0,o+=1)})),addEventListener("scroll",(t=>{if(window.innerWidth>1080){let t=L(window.scrollY),e=L(f.getBoundingClientRect().bottom+window.scrollY),i=L(u.getBoundingClientRect().bottom+window.scrollY);if(t>x&&t<5||t=e-1.5)y-=i-(e-1.5);else if(y>-5&&(y=-5),t<5&&0!=t){let t=L(u.offsetHeight-window.innerHeight);y=-Math.min(L(window.scrollY),5+t+2.5)}else if(twindow.innerHeight){let e=L(u.offsetHeight)-L(window.innerHeight);y>-(e+8)?y+=x-t:y=-(e+8)}n(6,u.style.marginTop=y+"rem",u),x=L(window.scrollY)}else n(6,u.style.marginTop="0rem",u)})),a((()=>{let t=localStorage.getItem("manifesto-hide-content");null!=t&&null!=t&&"true"==t&&U(s,m)}));return[o,r,s,m,g,w,u,f,h,i,l,p,b,v,k,C,function(t){d[t?"unshift":"push"]((()=>{s=t,n(2,s)}))},function(t){d[t?"unshift":"push"]((()=>{r=t,n(1,r)}))},()=>U(s,m),function(t,e){d[t?"unshift":"push"]((()=>{g[e.index]=t,n(4,g)}))},t=>C(t.id),function(t,e){d[t?"unshift":"push"]((()=>{g[e.index]=t,n(4,g)}))},t=>C(t.id),function(t){d[t?"unshift":"push"]((()=>{m=t,n(3,m)}))},function(t){d[t?"unshift":"push"]((()=>{u=t,n(6,u)}))},function(t,e){d[t?"unshift":"push"]((()=>{w[e.id]=t,n(5,w)}))},function(t,e){d[t?"unshift":"push"]((()=>{w[e.id]=t,n(5,w)}))},function(t){d[t?"unshift":"push"]((()=>{h=t,n(8,h)}))},function(t){d[t?"unshift":"push"]((()=>{f=t,n(7,f)}))}]}class Z extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},X,Q,l,{},null,[-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("manifesto-component",Z);export{Z as default}; diff --git a/Server/public/js/components/map-component.js b/Server/public/js/components/map-component.js index b90c22e..5a0ba51 100644 --- a/Server/public/js/components/map-component.js +++ b/Server/public/js/components/map-component.js @@ -1,175 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, f as element, n as noop, k as attr_dev, j as add_location, p as detach_dev, q as binding_callbacks } from './index-998178c7.js'; - -/* src\components\map-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\components\\map-component.svelte"; - -function create_fragment(ctx) { - let div; - - const block = { - c: function create() { - div = element("div"); - this.c = noop; - attr_dev(div, "id", "map"); - add_location(div, file, 41, 0, 1151); - }, - 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) { - insert_dev(target, div, anchor); - /*div_binding*/ ctx[3](div); - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - /*div_binding*/ ctx[3](null); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('map-component', slots, []); - let { callback = null } = $$props; - let { colors = null } = $$props; - - // Main code - let mapContainer; - - function createMap(center, zoom) { - let map = L.map(mapContainer, { center, zoom }); - - L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: '© OpenStreetMap contributors', - minNativeZoom: 2, - minZoom: 2, - maxNativeZoom: 14, - maxZoom: 14 - }).addTo(map); - - return map; - } - - onMount(() => { - callback(createMap); - - if (colors != null) { - let els = mapContainer.getElementsByClassName("leaflet-control-layers-overlays")[0].children; - - for (let i = 0; i < els.length; i++) { - els[i].children[0].children[0].style.accentColor = colors[i]; - } - } - }); - - const writable_props = ['callback', 'colors']; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function div_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - mapContainer = $$value; - $$invalidate(0, mapContainer); - }); - } - - $$self.$$set = $$props => { - if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); - if ('colors' in $$props) $$invalidate(2, colors = $$props.colors); - }; - - $$self.$capture_state = () => ({ - onMount, - callback, - colors, - mapContainer, - createMap - }); - - $$self.$inject_state = $$props => { - if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); - if ('colors' in $$props) $$invalidate(2, colors = $$props.colors); - if ('mapContainer' in $$props) $$invalidate(0, mapContainer = $$props.mapContainer); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [mapContainer, callback, colors, div_binding]; -} - -class Map_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { callback: 1, colors: 2 }, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["callback", "colors"]; - } - - get callback() { - return this.$$.ctx[1]; - } - - set callback(callback) { - this.$$set({ callback }); - flush(); - } - - get colors() { - return this.$$.ctx[2]; - } - - set colors(colors) { - this.$$set({ colors }); - flush(); - } -} - -customElements.define("map-component", Map_component); - -export { Map_component as default }; +import{S as t,i as e,a,b as s,k as o,s as r,e as l,n as i,d as n,g as c,o as m,j as p}from"./index-db20528a.js";function h(t){let e;return{c(){e=l("div"),this.c=i,n(e,"id","map")},m(a,o){s(a,e,o),t[4](e)},p:i,i:i,o:i,d(a){a&&c(e),t[4](null)}}}function u(t,e,a){let s,{callback:o=null}=e,{colors:r=null}=e,{map:l=null}=e;function i(t,e){let a=L.map(s,{center:t,zoom:e});return L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© OpenStreetMap contributors',minNativeZoom:2,minZoom:2,maxNativeZoom:14,maxZoom:14}).addTo(a),a}return m((()=>{if(o(i),null!=r){let t=s.getElementsByClassName("leaflet-control-layers-overlays")[0].children;for(let e=0;e{"callback"in t&&a(1,o=t.callback),"colors"in t&&a(2,r=t.colors),"map"in t&&a(3,l=t.map)},[s,o,r,l,function(t){p[t?"unshift":"push"]((()=>{s=t,a(0,s)}))}]}class d extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:a(this.attributes),customElement:!0},u,h,r,{callback:1,colors:2,map:3},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),o()))}static get observedAttributes(){return["callback","colors","map"]}get callback(){return this.$$.ctx[1]}set callback(t){this.$$set({callback:t}),o()}get colors(){return this.$$.ctx[2]}set colors(t){this.$$set({colors:t}),o()}get map(){return this.$$.ctx[3]}set map(t){this.$$set({map:t}),o()}}customElements.define("map-component",d);export{d as default}; diff --git a/Server/public/js/components/navbar-logged.js b/Server/public/js/components/navbar-logged.js index 26b7c9c..2bfbc97 100644 --- a/Server/public/js/components/navbar-logged.js +++ b/Server/public/js/components/navbar-logged.js @@ -1,687 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, g as getContext, e as globals, A as validate_each_argument, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, B as text, k as attr_dev, j as add_location, u as src_url_equal, l as append_dev, m as listen_dev, C as set_data_dev, D as destroy_each, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, locales } from '../../../../../../../../../js/libraries/serverTools.js'; - -/* src\navbar\navbar-logged.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; -const file = "src\\navbar\\navbar-logged.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[23] = list[i][0]; - child_ctx[24] = list[i][1]; - return child_ctx; -} - -// (97:4) {#if Object.keys($content).length!=0} -function create_if_block(ctx) { - let header; - let input; - let t0; - let label; - let span0; - let t1; - let a0; - let img0; - let img0_src_value; - let t2; - let span1; - let raw_value = /*$content*/ ctx[5].orgName + ""; - let t3; - let nav; - let ul; - let li0; - let a1; - let t4_value = /*$content*/ ctx[5].joinUs + ""; - let t4; - let t5; - let li1; - let a2; - let t6_value = /*$content*/ ctx[5].manifesto + ""; - let t6; - let t7; - let li2; - let button0; - let t8_value = /*$content*/ ctx[5].initiatives + ""; - let t8; - let t9; - let div0; - let a3; - let t10_value = /*$content*/ ctx[5].groups + ""; - let t10; - let t11; - let a4; - let t12_value = /*$content*/ ctx[5].communes + ""; - let t12; - let t13; - let a5; - let t14_value = /*$content*/ ctx[5].cooperatives + ""; - let t14; - let t15; - let a6; - let t16_value = /*$content*/ ctx[5].parties + ""; - let t16; - let t17; - let a7; - let t18_value = /*$content*/ ctx[5].partners + ""; - let t18; - let t19; - let li3; - let a8; - let t20_value = /*$content*/ ctx[5].profile + ""; - let t20; - let t21; - let li4; - let button1; - let picture; - let source0; - let t22; - let source1; - let t23; - let img1; - let t24; - let div1; - let mounted; - let dispose; - let each_value = Object.entries(locales); - 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() { - header = element("header"); - input = element("input"); - t0 = space(); - label = element("label"); - span0 = element("span"); - t1 = space(); - a0 = element("a"); - img0 = element("img"); - t2 = space(); - span1 = element("span"); - t3 = space(); - nav = element("nav"); - ul = element("ul"); - li0 = element("li"); - a1 = element("a"); - t4 = text(t4_value); - t5 = space(); - li1 = element("li"); - a2 = element("a"); - t6 = text(t6_value); - t7 = space(); - li2 = element("li"); - button0 = element("button"); - t8 = text(t8_value); - t9 = space(); - div0 = element("div"); - a3 = element("a"); - t10 = text(t10_value); - t11 = space(); - a4 = element("a"); - t12 = text(t12_value); - t13 = space(); - a5 = element("a"); - t14 = text(t14_value); - t15 = space(); - a6 = element("a"); - t16 = text(t16_value); - t17 = space(); - a7 = element("a"); - t18 = text(t18_value); - t19 = space(); - li3 = element("li"); - a8 = element("a"); - t20 = text(t20_value); - t21 = space(); - li4 = element("li"); - button1 = element("button"); - picture = element("picture"); - source0 = element("source"); - t22 = space(); - source1 = element("source"); - t23 = space(); - img1 = element("img"); - t24 = space(); - div1 = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - attr_dev(input, "type", "checkbox"); - attr_dev(input, "id", "side-menu"); - add_location(input, file, 99, 12, 3167); - attr_dev(span0, "id", "hamb-line"); - add_location(span0, file, 100, 45, 3298); - attr_dev(label, "id", "hamb"); - attr_dev(label, "for", "side-menu"); - add_location(label, file, 100, 12, 3265); - if (!src_url_equal(img0.src, img0_src_value = "/img/common/flag.png")) attr_dev(img0, "src", img0_src_value); - attr_dev(img0, "id", "navbar-logo"); - attr_dev(img0, "alt", "logo"); - add_location(img0, file, 103, 16, 3440); - attr_dev(span1, "id", "navbar-logo-text"); - add_location(span1, file, 104, 16, 3518); - attr_dev(a0, "id", "logo-container"); - attr_dev(a0, "href", "/" + /*locale*/ ctx[8] + "/"); - add_location(a0, file, 102, 12, 3375); - attr_dev(a1, "href", "/" + /*locale*/ ctx[8] + "/join-us"); - add_location(a1, file, 109, 24, 3730); - add_location(li0, file, 109, 20, 3726); - attr_dev(a2, "href", "/" + /*locale*/ ctx[8] + "/manifesto"); - add_location(a2, file, 110, 24, 3814); - add_location(li1, file, 110, 20, 3810); - attr_dev(button0, "class", "options-button"); - add_location(button0, file, 114, 24, 4126); - attr_dev(a3, "href", "/" + /*locale*/ ctx[8] + "/groups"); - add_location(a3, file, 116, 28, 4403); - attr_dev(a4, "href", "/" + /*locale*/ ctx[8] + "/communes"); - add_location(a4, file, 117, 28, 4485); - attr_dev(a5, "href", "/" + /*locale*/ ctx[8] + "/cooperatives"); - add_location(a5, file, 118, 28, 4571); - attr_dev(a6, "href", "/" + /*locale*/ ctx[8] + "/parties"); - add_location(a6, file, 119, 28, 4665); - attr_dev(a7, "href", "/" + /*locale*/ ctx[8] + "/partners"); - add_location(a7, file, 120, 28, 4749); - attr_dev(div0, "class", "options-dropdown"); - add_location(div0, file, 115, 24, 4311); - attr_dev(li2, "id", "options-container"); - add_location(li2, file, 113, 20, 4073); - attr_dev(a8, "href", "/" + /*locale*/ ctx[8] + "/profile"); - add_location(a8, file, 123, 24, 4890); - add_location(li3, file, 123, 20, 4886); - attr_dev(source0, "srcset", "/img/common/globe.webp"); - add_location(source0, file, 127, 32, 5184); - attr_dev(source1, "srcset", "/img/common/globe.png"); - add_location(source1, file, 128, 32, 5258); - attr_dev(img1, "id", "locales-img"); - attr_dev(img1, "alt", "globe"); - add_location(img1, file, 129, 32, 5331); - add_location(picture, file, 126, 28, 5141); - add_location(button1, file, 125, 24, 5014); - attr_dev(li4, "id", "locales"); - add_location(li4, file, 124, 20, 4971); - attr_dev(div1, "class", "options-dropdown"); - add_location(div1, file, 133, 20, 5489); - attr_dev(ul, "id", "menu"); - add_location(ul, file, 108, 16, 3690); - attr_dev(nav, "id", "nav"); - add_location(nav, file, 107, 12, 3658); - attr_dev(header, "id", "navbar"); - add_location(header, file, 97, 8, 3077); - }, - m: function mount(target, anchor) { - insert_dev(target, header, anchor); - append_dev(header, input); - /*input_binding*/ ctx[12](input); - append_dev(header, t0); - append_dev(header, label); - append_dev(label, span0); - append_dev(header, t1); - append_dev(header, a0); - append_dev(a0, img0); - append_dev(a0, t2); - append_dev(a0, span1); - span1.innerHTML = raw_value; - /*span1_binding*/ ctx[13](span1); - append_dev(header, t3); - append_dev(header, nav); - append_dev(nav, ul); - append_dev(ul, li0); - append_dev(li0, a1); - append_dev(a1, t4); - append_dev(ul, t5); - append_dev(ul, li1); - append_dev(li1, a2); - append_dev(a2, t6); - append_dev(ul, t7); - append_dev(ul, li2); - append_dev(li2, button0); - append_dev(button0, t8); - append_dev(li2, t9); - append_dev(li2, div0); - append_dev(div0, a3); - append_dev(a3, t10); - append_dev(div0, t11); - append_dev(div0, a4); - append_dev(a4, t12); - append_dev(div0, t13); - append_dev(div0, a5); - append_dev(a5, t14); - append_dev(div0, t15); - append_dev(div0, a6); - append_dev(a6, t16); - append_dev(div0, t17); - append_dev(div0, a7); - append_dev(a7, t18); - /*div0_binding*/ ctx[16](div0); - append_dev(ul, t19); - append_dev(ul, li3); - append_dev(li3, a8); - append_dev(a8, t20); - append_dev(ul, t21); - append_dev(ul, li4); - append_dev(li4, button1); - append_dev(button1, picture); - append_dev(picture, source0); - append_dev(picture, t22); - append_dev(picture, source1); - append_dev(picture, t23); - append_dev(picture, img1); - append_dev(ul, t24); - append_dev(ul, div1); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div1, null); - } - - /*div1_binding*/ ctx[20](div1); - /*header_binding*/ ctx[21](header); - - if (!mounted) { - dispose = [ - listen_dev(input, "click", /*changeNavbar*/ ctx[9], false, false, false), - listen_dev(button0, "click", /*click_handler*/ ctx[14], false, false, false), - listen_dev(button0, "focusout", /*focusout_handler*/ ctx[15], false, false, false), - listen_dev(button1, "click", /*click_handler_1*/ ctx[17], false, false, false), - listen_dev(button1, "focusout", /*focusout_handler_1*/ ctx[18], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 32 && raw_value !== (raw_value = /*$content*/ ctx[5].orgName + "")) span1.innerHTML = raw_value; if (dirty & /*$content*/ 32 && t4_value !== (t4_value = /*$content*/ ctx[5].joinUs + "")) set_data_dev(t4, t4_value); - if (dirty & /*$content*/ 32 && t6_value !== (t6_value = /*$content*/ ctx[5].manifesto + "")) set_data_dev(t6, t6_value); - if (dirty & /*$content*/ 32 && t8_value !== (t8_value = /*$content*/ ctx[5].initiatives + "")) set_data_dev(t8, t8_value); - if (dirty & /*$content*/ 32 && t10_value !== (t10_value = /*$content*/ ctx[5].groups + "")) set_data_dev(t10, t10_value); - if (dirty & /*$content*/ 32 && t12_value !== (t12_value = /*$content*/ ctx[5].communes + "")) set_data_dev(t12, t12_value); - if (dirty & /*$content*/ 32 && t14_value !== (t14_value = /*$content*/ ctx[5].cooperatives + "")) set_data_dev(t14, t14_value); - if (dirty & /*$content*/ 32 && t16_value !== (t16_value = /*$content*/ ctx[5].parties + "")) set_data_dev(t16, t16_value); - if (dirty & /*$content*/ 32 && t18_value !== (t18_value = /*$content*/ ctx[5].partners + "")) set_data_dev(t18, t18_value); - if (dirty & /*$content*/ 32 && t20_value !== (t20_value = /*$content*/ ctx[5].profile + "")) set_data_dev(t20, t20_value); - - if (dirty & /*changeLocale, Object, locales*/ 2048) { - each_value = Object.entries(locales); - 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(div1, 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(header); - /*input_binding*/ ctx[12](null); - /*span1_binding*/ ctx[13](null); - /*div0_binding*/ ctx[16](null); - destroy_each(each_blocks, detaching); - /*div1_binding*/ ctx[20](null); - /*header_binding*/ ctx[21](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(97:4) {#if Object.keys($content).length!=0}", - ctx - }); - - return block; -} - -// (135:24) {#each Object.entries(locales) as [loc,name]} -function create_each_block(ctx) { - let button; - let t_value = /*name*/ ctx[24] + ""; - let t; - let mounted; - let dispose; - - function click_handler_2() { - return /*click_handler_2*/ ctx[19](/*loc*/ ctx[23]); - } - - const block = { - c: function create() { - button = element("button"); - t = text(t_value); - add_location(button, file, 135, 28, 5648); - }, - m: function mount(target, anchor) { - insert_dev(target, button, anchor); - append_dev(button, t); - - if (!mounted) { - dispose = listen_dev(button, "click", click_handler_2, false, false, false); - mounted = true; - } - }, - p: function update(new_ctx, dirty) { - ctx = new_ctx; - }, - d: function destroy(detaching) { - if (detaching) detach_dev(button); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(135:24) {#each Object.entries(locales) as [loc,name]}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let show_if = Object.keys(/*$content*/ ctx[5]).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 & /*$content*/ 32) show_if = Object.keys(/*$content*/ ctx[5]).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 hide(dropdown) { - let callback = () => { - dropdown.style.display = "none"; - }; - - setTimeout(callback, 100); -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('navbar-logged', slots, []); - let hambInput; - let navbar; - let localesDropdown; - let initiativesDropdown; - let loaded = writable(0); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(5, $content = value)); - let logoText; - let locale = loadLocaleContent(content, "navbar-component", loaded); - - function changeNavbar() { - if (hambInput.checked) { - $$invalidate(1, navbar.style.background = "white", navbar); - } else { - setTimeout( - () => { - $$invalidate(1, navbar.style.position = "relative", navbar); - $$invalidate(1, navbar.style.background = "", navbar); - $$invalidate(1, navbar.style.boxShadow = "", navbar); - }, - 510 - ); - } - } - - function showDropdown(dropdown) { - let state = dropdown.style.display; - $$invalidate(3, initiativesDropdown.style.display = "none", initiativesDropdown); - $$invalidate(2, localesDropdown.style.display = "none", localesDropdown); - - if (state == "block") { - dropdown.style.display = "none"; - } else { - dropdown.style.display = "block"; - } - } - - function changeLocale(lang) { - localStorage.setItem("locale", lang); - let locSplit = location.href.split("/"); - let localesSymbols = Object.keys(locales); - locSplit = locSplit.filter(x => !localesSymbols.includes(x)); - let loc = locSplit.slice(0, locSplit.length - 1).join("/") + "/" + lang + "/" + locSplit[locSplit.length - 1]; - location.href = loc; - } - - function fixHeading() { - if (locale == "ru") { - let func = () => { - if (logoText == undefined) { - setTimeout(func, 100); - } else { - if ((window.innerWidth < 1700 && window.innerWidth > 1400 || window.innerWidth < 400) && logoText.style.lineHeight != "100%") { - $$invalidate(4, logoText.style.lineHeight = "120%", logoText); - $$invalidate(4, logoText.style.top = "1rem", logoText); - $$invalidate(4, logoText.style.width = "16rem", logoText); - } else if ((window.innerWidth > 1700 || window.innerWidth > 400 && window.innerWidth < 1400) && logoText.style.lineHeight != "400%") { - $$invalidate(4, logoText.style.lineHeight = "400%", logoText); - $$invalidate(4, logoText.style.top = "0rem", logoText); - $$invalidate(4, logoText.style.width = "auto", logoText); - } - } - }; - - func(); - addEventListener("resize", func); - } - } - - onMount(() => { - fixHeading(); - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - hambInput = $$value; - $$invalidate(0, hambInput); - }); - } - - function span1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - logoText = $$value; - $$invalidate(4, logoText); - }); - } - - const click_handler = () => showDropdown(initiativesDropdown); - const focusout_handler = () => hide(initiativesDropdown); - - function div0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - initiativesDropdown = $$value; - $$invalidate(3, initiativesDropdown); - }); - } - - const click_handler_1 = () => showDropdown(localesDropdown); - const focusout_handler_1 = () => hide(localesDropdown); - const click_handler_2 = loc => changeLocale(loc); - - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - localesDropdown = $$value; - $$invalidate(2, localesDropdown); - }); - } - - function header_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - navbar = $$value; - $$invalidate(1, navbar); - }); - } - - $$self.$capture_state = () => ({ - onMount, - getContext, - writable, - loadLocaleContent, - locales, - hambInput, - navbar, - localesDropdown, - initiativesDropdown, - loaded, - content, - logoText, - locale, - changeNavbar, - showDropdown, - changeLocale, - fixHeading, - hide, - $content - }); - - $$self.$inject_state = $$props => { - if ('hambInput' in $$props) $$invalidate(0, hambInput = $$props.hambInput); - if ('navbar' in $$props) $$invalidate(1, navbar = $$props.navbar); - if ('localesDropdown' in $$props) $$invalidate(2, localesDropdown = $$props.localesDropdown); - if ('initiativesDropdown' in $$props) $$invalidate(3, initiativesDropdown = $$props.initiativesDropdown); - if ('loaded' in $$props) $$invalidate(6, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(7, content = $$props.content); - if ('logoText' in $$props) $$invalidate(4, logoText = $$props.logoText); - if ('locale' in $$props) $$invalidate(8, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - hambInput, - navbar, - localesDropdown, - initiativesDropdown, - logoText, - $content, - loaded, - content, - locale, - changeNavbar, - showDropdown, - changeLocale, - input_binding, - span1_binding, - click_handler, - focusout_handler, - div0_binding, - click_handler_1, - focusout_handler_1, - click_handler_2, - div1_binding, - header_binding - ]; -} - -class Navbar_logged extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("navbar-logged", Navbar_logged); - -export { Navbar_logged as default }; +import{S as e,i as t,a as n,b as i,s,p as o,n as l,g as r,q as a,o as c,e as u,c as d,v as p,d as h,t as m,f,l as g,w as b,x as y,r as w,j as v}from"./index-db20528a.js";import{w as j}from"./index-720c0a59.js";import{loadLocaleContent as k,locales as H}from"../../../../../../../../../js/libraries/serverTools.js";function T(e,t,n){const i=e.slice();return i[23]=t[n][0],i[24]=t[n][1],i}function x(e){let t,n,s,o,l,a,c,v,j,k,x,W,M,O,E,N,S,R,U,q,z,I,A,B,C,D,F,G,J,K,P,Q,V,X,Y,Z,$,_,ee,te,ne,ie,se,oe,le,re,ae,ce,ue,de,pe,he=e[5].orgName+"",me=e[5].joinUs+"",fe=e[5].manifesto+"",ge=e[5].initiatives+"",be=e[5].groups+"",ye=e[5].communes+"",we=e[5].cooperatives+"",ve=e[5].parties+"",je=e[5].partners+"",ke=e[5].profile+"",He=Object.entries(H),Te=[];for(let t=0;t',l=d(),a=u("a"),c=u("img"),j=d(),k=u("span"),x=d(),W=u("nav"),M=u("ul"),O=u("li"),E=u("a"),N=p(me),S=d(),R=u("li"),U=u("a"),q=p(fe),z=d(),I=u("li"),A=u("button"),B=p(ge),C=d(),D=u("div"),F=u("a"),G=p(be),J=d(),K=u("a"),P=p(ye),Q=d(),V=u("a"),X=p(we),Y=d(),Z=u("a"),$=p(ve),_=d(),ee=u("a"),te=p(je),ne=d(),ie=u("li"),se=u("a"),oe=p(ke),le=d(),re=u("li"),ae=u("button"),ae.innerHTML=' \n \n globe',ce=d(),ue=u("div");for(let e=0;e{e.style.display="none"}),100)}function O(e,t,n){let i,s,o,l,r,u,d=j(0),p=j({});a(e,p,(e=>n(5,i=e)));let h=k(p,"navbar-component",d);function m(e){let t=e.style.display;n(3,r.style.display="none",r),n(2,l.style.display="none",l),e.style.display="block"==t?"none":"block"}function f(e){localStorage.setItem("locale",e);let t=location.href.split("/"),n=Object.keys(H);t=t.filter((e=>!n.includes(e)));let i=t.slice(0,t.length-1).join("/")+"/"+e+"/"+t[t.length-1];location.href=i}c((()=>{!function(){if("ru"==h){let e=()=>{null==u?setTimeout(e,100):(window.innerWidth<1700&&window.innerWidth>1400||window.innerWidth<400)&&"100%"!=u.style.lineHeight?(n(4,u.style.lineHeight="120%",u),n(4,u.style.top="1rem",u),n(4,u.style.width="16rem",u)):(window.innerWidth>1700||window.innerWidth>400&&window.innerWidth<1400)&&"400%"!=u.style.lineHeight&&(n(4,u.style.lineHeight="400%",u),n(4,u.style.top="0rem",u),n(4,u.style.width="auto",u))};e(),addEventListener("resize",e)}}()}));return[s,o,l,r,u,i,d,p,h,function(){s.checked?n(1,o.style.background="white",o):setTimeout((()=>{n(1,o.style.position="relative",o),n(1,o.style.background="",o),n(1,o.style.boxShadow="",o)}),510)},m,f,function(e){v[e?"unshift":"push"]((()=>{s=e,n(0,s)}))},function(e){v[e?"unshift":"push"]((()=>{u=e,n(4,u)}))},()=>m(r),()=>M(r),function(e){v[e?"unshift":"push"]((()=>{r=e,n(3,r)}))},()=>m(l),()=>M(l),e=>f(e),function(e){v[e?"unshift":"push"]((()=>{l=e,n(2,l)}))},function(e){v[e?"unshift":"push"]((()=>{o=e,n(1,o)}))}]}class E extends e{constructor(e){super(),this.shadowRoot.innerHTML="",t(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},O,W,s,{},null),e&&e.target&&i(e.target,this,e.anchor)}}customElements.define("navbar-logged",E);export{E as default}; diff --git a/Server/public/js/components/navbar-not-logged.js b/Server/public/js/components/navbar-not-logged.js index b121af1..d546270 100644 --- a/Server/public/js/components/navbar-not-logged.js +++ b/Server/public/js/components/navbar-not-logged.js @@ -1,687 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, g as getContext, e as globals, A as validate_each_argument, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, B as text, k as attr_dev, j as add_location, u as src_url_equal, l as append_dev, m as listen_dev, C as set_data_dev, D as destroy_each, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, locales } from '../../../../../../../../../js/libraries/serverTools.js'; - -/* src\navbar\navbar-not-logged.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; -const file = "src\\navbar\\navbar-not-logged.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[23] = list[i][0]; - child_ctx[24] = list[i][1]; - return child_ctx; -} - -// (97:4) {#if Object.keys($content).length!=0} -function create_if_block(ctx) { - let header; - let input; - let t0; - let label; - let span0; - let t1; - let a0; - let img0; - let img0_src_value; - let t2; - let span1; - let raw_value = /*$content*/ ctx[5].orgName + ""; - let t3; - let nav; - let ul; - let li0; - let a1; - let t4_value = /*$content*/ ctx[5].joinUs + ""; - let t4; - let t5; - let li1; - let a2; - let t6_value = /*$content*/ ctx[5].manifesto + ""; - let t6; - let t7; - let li2; - let button0; - let t8_value = /*$content*/ ctx[5].initiatives + ""; - let t8; - let t9; - let div0; - let a3; - let t10_value = /*$content*/ ctx[5].groups + ""; - let t10; - let t11; - let a4; - let t12_value = /*$content*/ ctx[5].communes + ""; - let t12; - let t13; - let a5; - let t14_value = /*$content*/ ctx[5].cooperatives + ""; - let t14; - let t15; - let a6; - let t16_value = /*$content*/ ctx[5].parties + ""; - let t16; - let t17; - let a7; - let t18_value = /*$content*/ ctx[5].partners + ""; - let t18; - let t19; - let li3; - let a8; - let t20_value = /*$content*/ ctx[5].login + ""; - let t20; - let t21; - let li4; - let button1; - let picture; - let source0; - let t22; - let source1; - let t23; - let img1; - let t24; - let div1; - let mounted; - let dispose; - let each_value = Object.entries(locales); - 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() { - header = element("header"); - input = element("input"); - t0 = space(); - label = element("label"); - span0 = element("span"); - t1 = space(); - a0 = element("a"); - img0 = element("img"); - t2 = space(); - span1 = element("span"); - t3 = space(); - nav = element("nav"); - ul = element("ul"); - li0 = element("li"); - a1 = element("a"); - t4 = text(t4_value); - t5 = space(); - li1 = element("li"); - a2 = element("a"); - t6 = text(t6_value); - t7 = space(); - li2 = element("li"); - button0 = element("button"); - t8 = text(t8_value); - t9 = space(); - div0 = element("div"); - a3 = element("a"); - t10 = text(t10_value); - t11 = space(); - a4 = element("a"); - t12 = text(t12_value); - t13 = space(); - a5 = element("a"); - t14 = text(t14_value); - t15 = space(); - a6 = element("a"); - t16 = text(t16_value); - t17 = space(); - a7 = element("a"); - t18 = text(t18_value); - t19 = space(); - li3 = element("li"); - a8 = element("a"); - t20 = text(t20_value); - t21 = space(); - li4 = element("li"); - button1 = element("button"); - picture = element("picture"); - source0 = element("source"); - t22 = space(); - source1 = element("source"); - t23 = space(); - img1 = element("img"); - t24 = space(); - div1 = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - attr_dev(input, "type", "checkbox"); - attr_dev(input, "id", "side-menu"); - add_location(input, file, 99, 12, 3171); - attr_dev(span0, "id", "hamb-line"); - add_location(span0, file, 100, 45, 3302); - attr_dev(label, "id", "hamb"); - attr_dev(label, "for", "side-menu"); - add_location(label, file, 100, 12, 3269); - if (!src_url_equal(img0.src, img0_src_value = "/img/common/flag.png")) attr_dev(img0, "src", img0_src_value); - attr_dev(img0, "id", "navbar-logo"); - attr_dev(img0, "alt", "logo"); - add_location(img0, file, 103, 16, 3444); - attr_dev(span1, "id", "navbar-logo-text"); - add_location(span1, file, 104, 16, 3522); - attr_dev(a0, "id", "logo-container"); - attr_dev(a0, "href", "/" + /*locale*/ ctx[8] + "/"); - add_location(a0, file, 102, 12, 3379); - attr_dev(a1, "href", "/" + /*locale*/ ctx[8] + "/join-us"); - add_location(a1, file, 109, 24, 3734); - add_location(li0, file, 109, 20, 3730); - attr_dev(a2, "href", "/" + /*locale*/ ctx[8] + "/manifesto"); - add_location(a2, file, 110, 24, 3818); - add_location(li1, file, 110, 20, 3814); - attr_dev(button0, "class", "options-button"); - add_location(button0, file, 114, 24, 4130); - attr_dev(a3, "href", "/" + /*locale*/ ctx[8] + "/groups"); - add_location(a3, file, 116, 28, 4407); - attr_dev(a4, "href", "/" + /*locale*/ ctx[8] + "/communes"); - add_location(a4, file, 117, 28, 4489); - attr_dev(a5, "href", "/" + /*locale*/ ctx[8] + "/cooperatives"); - add_location(a5, file, 118, 28, 4575); - attr_dev(a6, "href", "/" + /*locale*/ ctx[8] + "/parties"); - add_location(a6, file, 119, 28, 4669); - attr_dev(a7, "href", "/" + /*locale*/ ctx[8] + "/partners"); - add_location(a7, file, 120, 28, 4753); - attr_dev(div0, "class", "options-dropdown"); - add_location(div0, file, 115, 24, 4315); - attr_dev(li2, "id", "options-container"); - add_location(li2, file, 113, 20, 4077); - attr_dev(a8, "href", "/" + /*locale*/ ctx[8] + "/auth"); - add_location(a8, file, 123, 24, 4894); - add_location(li3, file, 123, 20, 4890); - attr_dev(source0, "srcset", "/img/common/globe.webp"); - add_location(source0, file, 127, 32, 5183); - attr_dev(source1, "srcset", "/img/common/globe.png"); - add_location(source1, file, 128, 32, 5257); - attr_dev(img1, "id", "locales-img"); - attr_dev(img1, "alt", "globe"); - add_location(img1, file, 129, 32, 5330); - add_location(picture, file, 126, 28, 5140); - add_location(button1, file, 125, 24, 5013); - attr_dev(li4, "id", "locales"); - add_location(li4, file, 124, 20, 4970); - attr_dev(div1, "class", "options-dropdown"); - add_location(div1, file, 133, 20, 5488); - attr_dev(ul, "id", "menu"); - add_location(ul, file, 108, 16, 3694); - attr_dev(nav, "id", "nav"); - add_location(nav, file, 107, 12, 3662); - attr_dev(header, "id", "navbar"); - add_location(header, file, 97, 8, 3081); - }, - m: function mount(target, anchor) { - insert_dev(target, header, anchor); - append_dev(header, input); - /*input_binding*/ ctx[12](input); - append_dev(header, t0); - append_dev(header, label); - append_dev(label, span0); - append_dev(header, t1); - append_dev(header, a0); - append_dev(a0, img0); - append_dev(a0, t2); - append_dev(a0, span1); - span1.innerHTML = raw_value; - /*span1_binding*/ ctx[13](span1); - append_dev(header, t3); - append_dev(header, nav); - append_dev(nav, ul); - append_dev(ul, li0); - append_dev(li0, a1); - append_dev(a1, t4); - append_dev(ul, t5); - append_dev(ul, li1); - append_dev(li1, a2); - append_dev(a2, t6); - append_dev(ul, t7); - append_dev(ul, li2); - append_dev(li2, button0); - append_dev(button0, t8); - append_dev(li2, t9); - append_dev(li2, div0); - append_dev(div0, a3); - append_dev(a3, t10); - append_dev(div0, t11); - append_dev(div0, a4); - append_dev(a4, t12); - append_dev(div0, t13); - append_dev(div0, a5); - append_dev(a5, t14); - append_dev(div0, t15); - append_dev(div0, a6); - append_dev(a6, t16); - append_dev(div0, t17); - append_dev(div0, a7); - append_dev(a7, t18); - /*div0_binding*/ ctx[16](div0); - append_dev(ul, t19); - append_dev(ul, li3); - append_dev(li3, a8); - append_dev(a8, t20); - append_dev(ul, t21); - append_dev(ul, li4); - append_dev(li4, button1); - append_dev(button1, picture); - append_dev(picture, source0); - append_dev(picture, t22); - append_dev(picture, source1); - append_dev(picture, t23); - append_dev(picture, img1); - append_dev(ul, t24); - append_dev(ul, div1); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div1, null); - } - - /*div1_binding*/ ctx[20](div1); - /*header_binding*/ ctx[21](header); - - if (!mounted) { - dispose = [ - listen_dev(input, "click", /*changeNavbar*/ ctx[9], false, false, false), - listen_dev(button0, "click", /*click_handler*/ ctx[14], false, false, false), - listen_dev(button0, "focusout", /*focusout_handler*/ ctx[15], false, false, false), - listen_dev(button1, "click", /*click_handler_1*/ ctx[17], false, false, false), - listen_dev(button1, "focusout", /*focusout_handler_1*/ ctx[18], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 32 && raw_value !== (raw_value = /*$content*/ ctx[5].orgName + "")) span1.innerHTML = raw_value; if (dirty & /*$content*/ 32 && t4_value !== (t4_value = /*$content*/ ctx[5].joinUs + "")) set_data_dev(t4, t4_value); - if (dirty & /*$content*/ 32 && t6_value !== (t6_value = /*$content*/ ctx[5].manifesto + "")) set_data_dev(t6, t6_value); - if (dirty & /*$content*/ 32 && t8_value !== (t8_value = /*$content*/ ctx[5].initiatives + "")) set_data_dev(t8, t8_value); - if (dirty & /*$content*/ 32 && t10_value !== (t10_value = /*$content*/ ctx[5].groups + "")) set_data_dev(t10, t10_value); - if (dirty & /*$content*/ 32 && t12_value !== (t12_value = /*$content*/ ctx[5].communes + "")) set_data_dev(t12, t12_value); - if (dirty & /*$content*/ 32 && t14_value !== (t14_value = /*$content*/ ctx[5].cooperatives + "")) set_data_dev(t14, t14_value); - if (dirty & /*$content*/ 32 && t16_value !== (t16_value = /*$content*/ ctx[5].parties + "")) set_data_dev(t16, t16_value); - if (dirty & /*$content*/ 32 && t18_value !== (t18_value = /*$content*/ ctx[5].partners + "")) set_data_dev(t18, t18_value); - if (dirty & /*$content*/ 32 && t20_value !== (t20_value = /*$content*/ ctx[5].login + "")) set_data_dev(t20, t20_value); - - if (dirty & /*changeLocale, Object, locales*/ 2048) { - each_value = Object.entries(locales); - 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(div1, 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(header); - /*input_binding*/ ctx[12](null); - /*span1_binding*/ ctx[13](null); - /*div0_binding*/ ctx[16](null); - destroy_each(each_blocks, detaching); - /*div1_binding*/ ctx[20](null); - /*header_binding*/ ctx[21](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(97:4) {#if Object.keys($content).length!=0}", - ctx - }); - - return block; -} - -// (135:24) {#each Object.entries(locales) as [loc,name]} -function create_each_block(ctx) { - let button; - let t_value = /*name*/ ctx[24] + ""; - let t; - let mounted; - let dispose; - - function click_handler_2() { - return /*click_handler_2*/ ctx[19](/*loc*/ ctx[23]); - } - - const block = { - c: function create() { - button = element("button"); - t = text(t_value); - add_location(button, file, 135, 28, 5647); - }, - m: function mount(target, anchor) { - insert_dev(target, button, anchor); - append_dev(button, t); - - if (!mounted) { - dispose = listen_dev(button, "click", click_handler_2, false, false, false); - mounted = true; - } - }, - p: function update(new_ctx, dirty) { - ctx = new_ctx; - }, - d: function destroy(detaching) { - if (detaching) detach_dev(button); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(135:24) {#each Object.entries(locales) as [loc,name]}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let show_if = Object.keys(/*$content*/ ctx[5]).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 & /*$content*/ 32) show_if = Object.keys(/*$content*/ ctx[5]).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 hide(dropdown) { - let callback = () => { - dropdown.style.display = "none"; - }; - - setTimeout(callback, 100); -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('navbar-not-logged', slots, []); - let hambInput; - let navbar; - let localesDropdown; - let initiativesDropdown; - let loaded = writable(0); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(5, $content = value)); - let logoText; - let locale = loadLocaleContent(content, "navbar-component", loaded); - - function changeNavbar() { - if (hambInput.checked) { - $$invalidate(1, navbar.style.background = "white", navbar); - } else { - setTimeout( - () => { - $$invalidate(1, navbar.style.position = "relative", navbar); - $$invalidate(1, navbar.style.background = "", navbar); - $$invalidate(1, navbar.style.boxShadow = "", navbar); - }, - 510 - ); - } - } - - function showDropdown(dropdown) { - let state = dropdown.style.display; - $$invalidate(3, initiativesDropdown.style.display = "none", initiativesDropdown); - $$invalidate(2, localesDropdown.style.display = "none", localesDropdown); - - if (state == "block") { - dropdown.style.display = "none"; - } else { - dropdown.style.display = "block"; - } - } - - function changeLocale(lang) { - localStorage.setItem("locale", lang); - let locSplit = location.href.split("/"); - let localesSymbols = Object.keys(locales); - locSplit = locSplit.filter(x => !localesSymbols.includes(x)); - let loc = locSplit.slice(0, locSplit.length - 1).join("/") + "/" + lang + "/" + locSplit[locSplit.length - 1]; - location.href = loc; - } - - function fixHeading() { - if (locale == "ru") { - let func = () => { - if (logoText == undefined) { - setTimeout(func, 100); - } else { - if ((window.innerWidth < 1700 && window.innerWidth > 1400 || window.innerWidth < 400) && logoText.style.lineHeight != "100%") { - $$invalidate(4, logoText.style.lineHeight = "120%", logoText); - $$invalidate(4, logoText.style.top = "1rem", logoText); - $$invalidate(4, logoText.style.width = "16rem", logoText); - } else if ((window.innerWidth > 1700 || window.innerWidth > 400 && window.innerWidth < 1400) && logoText.style.lineHeight != "400%") { - $$invalidate(4, logoText.style.lineHeight = "400%", logoText); - $$invalidate(4, logoText.style.top = "0rem", logoText); - $$invalidate(4, logoText.style.width = "auto", logoText); - } - } - }; - - func(); - addEventListener("resize", func); - } - } - - onMount(() => { - fixHeading(); - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - hambInput = $$value; - $$invalidate(0, hambInput); - }); - } - - function span1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - logoText = $$value; - $$invalidate(4, logoText); - }); - } - - const click_handler = () => showDropdown(initiativesDropdown); - const focusout_handler = () => hide(initiativesDropdown); - - function div0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - initiativesDropdown = $$value; - $$invalidate(3, initiativesDropdown); - }); - } - - const click_handler_1 = () => showDropdown(localesDropdown); - const focusout_handler_1 = () => hide(localesDropdown); - const click_handler_2 = loc => changeLocale(loc); - - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - localesDropdown = $$value; - $$invalidate(2, localesDropdown); - }); - } - - function header_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - navbar = $$value; - $$invalidate(1, navbar); - }); - } - - $$self.$capture_state = () => ({ - onMount, - getContext, - writable, - loadLocaleContent, - locales, - hambInput, - navbar, - localesDropdown, - initiativesDropdown, - loaded, - content, - logoText, - locale, - changeNavbar, - showDropdown, - changeLocale, - fixHeading, - hide, - $content - }); - - $$self.$inject_state = $$props => { - if ('hambInput' in $$props) $$invalidate(0, hambInput = $$props.hambInput); - if ('navbar' in $$props) $$invalidate(1, navbar = $$props.navbar); - if ('localesDropdown' in $$props) $$invalidate(2, localesDropdown = $$props.localesDropdown); - if ('initiativesDropdown' in $$props) $$invalidate(3, initiativesDropdown = $$props.initiativesDropdown); - if ('loaded' in $$props) $$invalidate(6, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(7, content = $$props.content); - if ('logoText' in $$props) $$invalidate(4, logoText = $$props.logoText); - if ('locale' in $$props) $$invalidate(8, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - hambInput, - navbar, - localesDropdown, - initiativesDropdown, - logoText, - $content, - loaded, - content, - locale, - changeNavbar, - showDropdown, - changeLocale, - input_binding, - span1_binding, - click_handler, - focusout_handler, - div0_binding, - click_handler_1, - focusout_handler_1, - click_handler_2, - div1_binding, - header_binding - ]; -} - -class Navbar_not_logged extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("navbar-not-logged", Navbar_not_logged); - -export { Navbar_not_logged as default }; +import{S as e,i as t,a as n,b as i,s,p as o,n as l,g as r,q as a,o as c,e as u,c as d,v as h,d as m,t as p,f,l as g,w as b,x as y,r as w,j as v}from"./index-db20528a.js";import{w as j}from"./index-720c0a59.js";import{loadLocaleContent as k,locales as H}from"../../../../../../../../../js/libraries/serverTools.js";function T(e,t,n){const i=e.slice();return i[23]=t[n][0],i[24]=t[n][1],i}function x(e){let t,n,s,o,l,a,c,v,j,k,x,W,M,O,E,N,S,R,U,q,z,I,A,B,C,D,F,G,J,K,P,Q,V,X,Y,Z,$,_,ee,te,ne,ie,se,oe,le,re,ae,ce,ue,de,he,me=e[5].orgName+"",pe=e[5].joinUs+"",fe=e[5].manifesto+"",ge=e[5].initiatives+"",be=e[5].groups+"",ye=e[5].communes+"",we=e[5].cooperatives+"",ve=e[5].parties+"",je=e[5].partners+"",ke=e[5].login+"",He=Object.entries(H),Te=[];for(let t=0;t',l=d(),a=u("a"),c=u("img"),j=d(),k=u("span"),x=d(),W=u("nav"),M=u("ul"),O=u("li"),E=u("a"),N=h(pe),S=d(),R=u("li"),U=u("a"),q=h(fe),z=d(),I=u("li"),A=u("button"),B=h(ge),C=d(),D=u("div"),F=u("a"),G=h(be),J=d(),K=u("a"),P=h(ye),Q=d(),V=u("a"),X=h(we),Y=d(),Z=u("a"),$=h(ve),_=d(),ee=u("a"),te=h(je),ne=d(),ie=u("li"),se=u("a"),oe=h(ke),le=d(),re=u("li"),ae=u("button"),ae.innerHTML=' \n \n globe',ce=d(),ue=u("div");for(let e=0;e{e.style.display="none"}),100)}function O(e,t,n){let i,s,o,l,r,u,d=j(0),h=j({});a(e,h,(e=>n(5,i=e)));let m=k(h,"navbar-component",d);function p(e){let t=e.style.display;n(3,r.style.display="none",r),n(2,l.style.display="none",l),e.style.display="block"==t?"none":"block"}function f(e){localStorage.setItem("locale",e);let t=location.href.split("/"),n=Object.keys(H);t=t.filter((e=>!n.includes(e)));let i=t.slice(0,t.length-1).join("/")+"/"+e+"/"+t[t.length-1];location.href=i}c((()=>{!function(){if("ru"==m){let e=()=>{null==u?setTimeout(e,100):(window.innerWidth<1700&&window.innerWidth>1400||window.innerWidth<400)&&"100%"!=u.style.lineHeight?(n(4,u.style.lineHeight="120%",u),n(4,u.style.top="1rem",u),n(4,u.style.width="16rem",u)):(window.innerWidth>1700||window.innerWidth>400&&window.innerWidth<1400)&&"400%"!=u.style.lineHeight&&(n(4,u.style.lineHeight="400%",u),n(4,u.style.top="0rem",u),n(4,u.style.width="auto",u))};e(),addEventListener("resize",e)}}()}));return[s,o,l,r,u,i,d,h,m,function(){s.checked?n(1,o.style.background="white",o):setTimeout((()=>{n(1,o.style.position="relative",o),n(1,o.style.background="",o),n(1,o.style.boxShadow="",o)}),510)},p,f,function(e){v[e?"unshift":"push"]((()=>{s=e,n(0,s)}))},function(e){v[e?"unshift":"push"]((()=>{u=e,n(4,u)}))},()=>p(r),()=>M(r),function(e){v[e?"unshift":"push"]((()=>{r=e,n(3,r)}))},()=>p(l),()=>M(l),e=>f(e),function(e){v[e?"unshift":"push"]((()=>{l=e,n(2,l)}))},function(e){v[e?"unshift":"push"]((()=>{o=e,n(1,o)}))}]}class E extends e{constructor(e){super(),this.shadowRoot.innerHTML="",t(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},O,W,s,{},null),e&&e.target&&i(e.target,this,e.anchor)}}customElements.define("navbar-not-logged",E);export{E as default}; diff --git a/Server/public/js/components/pane-aligner.js b/Server/public/js/components/pane-aligner.js index 620765c..0fc14e6 100644 --- a/Server/public/js/components/pane-aligner.js +++ b/Server/public/js/components/pane-aligner.js @@ -1,301 +1 @@ - -(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, g as getContext, o as onMount, c as setContext, f as element, h as space, n as noop, k as attr_dev, j as add_location, l as append_dev, p as detach_dev, q as binding_callbacks } from './index-998178c7.js'; -import { debounce } from '../../../../../../../../../js/libraries/miscTools.js'; - -/* src\components\pane-aligner.svelte generated by Svelte v3.52.0 */ -const file = "src\\components\\pane-aligner.svelte"; - -function create_fragment(ctx) { - let div6; - let div5; - let div2; - let div0; - let slot0; - let t0; - let div1; - let slot1; - let t1; - let div3; - let slot2; - let t2; - let div4; - let slot3; - - const block = { - c: function create() { - div6 = element("div"); - div5 = element("div"); - div2 = element("div"); - div0 = element("div"); - slot0 = element("slot"); - t0 = space(); - div1 = element("div"); - slot1 = element("slot"); - t1 = space(); - div3 = element("div"); - slot2 = element("slot"); - t2 = space(); - div4 = element("div"); - slot3 = element("slot"); - this.c = noop; - attr_dev(slot0, "name", "sidebar-left"); - add_location(slot0, file, 74, 16, 2554); - attr_dev(div0, "id", "sidebar-left"); - add_location(div0, file, 73, 12, 2489); - attr_dev(slot1, "name", "sidebar-left2"); - add_location(slot1, file, 77, 16, 2688); - attr_dev(div1, "id", "sidebar-left2"); - add_location(div1, file, 76, 12, 2621); - attr_dev(div2, "id", "sidebars-left"); - attr_dev(div2, "class", "sidebar"); - add_location(div2, file, 72, 8, 2435); - attr_dev(slot2, "name", "sidebar-right"); - add_location(slot2, file, 81, 12, 2853); - attr_dev(div3, "id", "sidebar-right"); - attr_dev(div3, "class", "pane sidebar"); - add_location(div3, file, 80, 8, 2768); - attr_dev(slot3, "name", "main"); - attr_dev(slot3, "id", "main-slot"); - add_location(slot3, file, 84, 12, 2968); - attr_dev(div4, "id", "main-pane"); - add_location(div4, file, 83, 8, 2913); - attr_dev(div5, "class", "pane-container"); - add_location(div5, file, 71, 4, 2397); - attr_dev(div6, "id", "root"); - attr_dev(div6, "class", "pane-centering"); - add_location(div6, file, 70, 0, 2336); - }, - 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) { - insert_dev(target, div6, anchor); - append_dev(div6, div5); - append_dev(div5, div2); - append_dev(div2, div0); - append_dev(div0, slot0); - /*div0_binding*/ ctx[5](div0); - append_dev(div2, t0); - append_dev(div2, div1); - append_dev(div1, slot1); - /*div1_binding*/ ctx[6](div1); - append_dev(div5, t1); - append_dev(div5, div3); - append_dev(div3, slot2); - /*div3_binding*/ ctx[7](div3); - append_dev(div5, t2); - append_dev(div5, div4); - append_dev(div4, slot3); - /*div4_binding*/ ctx[8](div4); - /*div6_binding*/ ctx[9](div6); - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div6); - /*div0_binding*/ ctx[5](null); - /*div1_binding*/ ctx[6](null); - /*div3_binding*/ ctx[7](null); - /*div4_binding*/ ctx[8](null); - /*div6_binding*/ ctx[9](null); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('pane-aligner', slots, []); - let root; - let mainPane; - let sidebarLeft; - let sidebarLeft2; - let sidebarRight; - let parentProps = getContext("alignerParent"); - - let switchView = parentProps != undefined - ? getContext("alignerParent").switchView - : undefined; - - let leftReplaced = false; - let left2Replaced = false; - let rightReplaced = false; - let switchViewReplaced = false; - - function adjustSlotted() { - if (root.parentNode != null) { - let slotted = root.parentNode.host.childNodes; - - if (slotted.length == 0) { - setTimeout(adjustSlotted, 50); - } else { - let changed = false; - let html = root.parentNode.innerHTML; - - for (let item of slotted) { - if (item.slot == "sidebar-left" && !leftReplaced) { - html = html.replace("#sidebar-left{display:none}", ""); - leftReplaced = true; - changed = true; - } else if (item.slot == "sidebar-left2" && !left2Replaced) { - html = html.replace("#sidebar-left2{display:none}", ""); - left2Replaced = true; - changed = true; - } else if (item.slot == "sidebar-right" && !rightReplaced) { - html = html.replace("#sidebar-right{display:none;", "#sidebar-right{"); - rightReplaced = true; - changed = true; - } - } - - if (switchView != undefined && !switchViewReplaced) { - html = html.replace("1880px", switchView); - changed = true; - } - - if (changed) { - $$invalidate(0, root.parentNode.innerHTML = html, root); - } - } - } - } - - window.addEventListener("resize", debounce(adjustSlotted, 100)); - - onMount(() => { - adjustSlotted(); - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function div0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - sidebarLeft = $$value; - $$invalidate(2, sidebarLeft); - }); - } - - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - sidebarLeft2 = $$value; - $$invalidate(3, sidebarLeft2); - }); - } - - function div3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - sidebarRight = $$value; - $$invalidate(4, sidebarRight); - }); - } - - function div4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - mainPane = $$value; - $$invalidate(1, mainPane); - }); - } - - function div6_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - root = $$value; - $$invalidate(0, root); - }); - } - - $$self.$capture_state = () => ({ - getContext, - setContext, - onMount, - debounce, - root, - mainPane, - sidebarLeft, - sidebarLeft2, - sidebarRight, - parentProps, - switchView, - leftReplaced, - left2Replaced, - rightReplaced, - switchViewReplaced, - adjustSlotted - }); - - $$self.$inject_state = $$props => { - if ('root' in $$props) $$invalidate(0, root = $$props.root); - if ('mainPane' in $$props) $$invalidate(1, mainPane = $$props.mainPane); - if ('sidebarLeft' in $$props) $$invalidate(2, sidebarLeft = $$props.sidebarLeft); - if ('sidebarLeft2' in $$props) $$invalidate(3, sidebarLeft2 = $$props.sidebarLeft2); - if ('sidebarRight' in $$props) $$invalidate(4, sidebarRight = $$props.sidebarRight); - if ('parentProps' in $$props) parentProps = $$props.parentProps; - if ('switchView' in $$props) switchView = $$props.switchView; - if ('leftReplaced' in $$props) leftReplaced = $$props.leftReplaced; - if ('left2Replaced' in $$props) left2Replaced = $$props.left2Replaced; - if ('rightReplaced' in $$props) rightReplaced = $$props.rightReplaced; - if ('switchViewReplaced' in $$props) switchViewReplaced = $$props.switchViewReplaced; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - root, - mainPane, - sidebarLeft, - sidebarLeft2, - sidebarRight, - div0_binding, - div1_binding, - div3_binding, - div4_binding, - div6_binding - ]; -} - -class Pane_aligner extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("pane-aligner", Pane_aligner); - -export { Pane_aligner as default }; +import{S as i,i as e,a as t,b as a,s as n,e as r,c as d,n as s,d as o,f as l,g as m,m as p,o as h,j as g}from"./index-db20528a.js";import{debounce as f}from"../../../../../../../../../js/libraries/miscTools.js";function c(i){let e,t,n,p,h,g,f,c,u,b;return{c(){e=r("div"),t=r("div"),n=r("div"),p=r("div"),p.innerHTML='',h=d(),g=r("div"),g.innerHTML='',f=d(),c=r("div"),c.innerHTML='',u=d(),b=r("div"),b.innerHTML='',this.c=s,o(p,"id","sidebar-left"),o(g,"id","sidebar-left2"),o(n,"id","sidebars-left"),o(n,"class","sidebar"),o(c,"id","sidebar-right"),o(c,"class","pane sidebar"),o(b,"id","main-pane"),o(t,"class","pane-container"),o(e,"id","root"),o(e,"class","pane-centering")},m(r,d){a(r,e,d),l(e,t),l(t,n),l(n,p),i[5](p),l(n,h),l(n,g),i[6](g),l(t,f),l(t,c),i[7](c),l(t,u),l(t,b),i[8](b),i[9](e)},p:s,i:s,o:s,d(t){t&&m(e),i[5](null),i[6](null),i[7](null),i[8](null),i[9](null)}}}function u(i,e,t){let a,n,r,d,s,o=null!=p("alignerParent")?p("alignerParent").switchView:void 0,l=!1,m=!1,c=!1;function u(){if(null!=a.parentNode){let i=a.parentNode.host.childNodes;if(0==i.length)setTimeout(u,50);else{let e=!1,n=a.parentNode.innerHTML;for(let t of i)"sidebar-left"!=t.slot||l?"sidebar-left2"!=t.slot||m?"sidebar-right"!=t.slot||c||(n=n.replace("#sidebar-right{display:none;","#sidebar-right{"),c=!0,e=!0):(n=n.replace("#sidebar-left2{display:none}",""),m=!0,e=!0):(n=n.replace("#sidebar-left{display:none}",""),l=!0,e=!0);null!=o&&(n=n.replace("1880px",o),e=!0),e&&t(0,a.parentNode.innerHTML=n,a)}}}return window.addEventListener("resize",f(u,100)),h((()=>{u()})),[a,n,r,d,s,function(i){g[i?"unshift":"push"]((()=>{r=i,t(2,r)}))},function(i){g[i?"unshift":"push"]((()=>{d=i,t(3,d)}))},function(i){g[i?"unshift":"push"]((()=>{s=i,t(4,s)}))},function(i){g[i?"unshift":"push"]((()=>{n=i,t(1,n)}))},function(i){g[i?"unshift":"push"]((()=>{a=i,t(0,a)}))}]}class b extends i{constructor(i){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:t(this.attributes),customElement:!0},u,c,n,{},null),i&&i.target&&a(i.target,this,i.anchor)}}customElements.define("pane-aligner",b);export{b as default}; diff --git a/Server/public/js/components/parties-add-component.js b/Server/public/js/components/parties-add-component.js index 0a52454..715f9d6 100644 --- a/Server/public/js/components/parties-add-component.js +++ b/Server/public/js/components/parties-add-component.js @@ -1,683 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, m as listen_dev, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { getData, loadLocaleContent, sendData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\parties-add-component.svelte generated by Svelte v3.52.0 */ - -const file = "src\\parties-add-component.svelte"; - -// (222:4) {#if $loaded==3} -function create_if_block(ctx) { - let div7; - let div6; - let h1; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t4; - let ol; - let li0; - let t6; - let li1; - let t8; - let li2; - let t10; - let li3; - let t12; - let div2; - let label0; - let t14; - let div1; - let input0; - let t15; - let div0; - let t16; - let div5; - let label1; - let t18; - let div4; - let input1; - let t19; - let div3; - let t20; - let button; - let t22; - let p1; - let t23; - let map_component; - let map_component_callback_value; - let mounted; - let dispose; - - const block = { - c: function create() { - div7 = element("div"); - div6 = element("div"); - h1 = element("h1"); - h1.textContent = "Add a Party"; - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - p0.textContent = "If there are no parties in your country which you can join then do the following:"; - t4 = space(); - ol = element("ol"); - li0 = element("li"); - li0.textContent = "Click on the map to show us where you are located;"; - t6 = space(); - li1 = element("li"); - li1.textContent = "Add a way to contact you or leave blank for a pin to point to our discord;"; - t8 = space(); - li2 = element("li"); - li2.textContent = "Press \"Submit\" to add yourself to our map;"; - t10 = space(); - li3 = element("li"); - li3.textContent = "Verify yourself by having a chat with us at our Discord server to show on the map;"; - t12 = space(); - div2 = element("div"); - label0 = element("label"); - label0.textContent = "Location:"; - t14 = space(); - div1 = element("div"); - input0 = element("input"); - t15 = space(); - div0 = element("div"); - t16 = space(); - div5 = element("div"); - label1 = element("label"); - label1.textContent = "Contact:"; - t18 = space(); - div4 = element("div"); - input1 = element("input"); - t19 = space(); - div3 = element("div"); - t20 = space(); - button = element("button"); - button.textContent = "Submit"; - t22 = space(); - p1 = element("p"); - t23 = space(); - map_component = element("map-component"); - add_location(h1, file, 225, 16, 7500); - attr_dev(img, "id", "parties-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/parties.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "parties"); - add_location(img, file, 226, 16, 7538); - attr_dev(p0, "class", "description"); - add_location(p0, file, 227, 16, 7622); - add_location(li0, file, 229, 20, 7774); - add_location(li1, file, 230, 20, 7855); - add_location(li2, file, 231, 20, 7960); - add_location(li3, file, 232, 20, 8033); - add_location(ol, file, 228, 16, 7748); - attr_dev(label0, "for", "address-input"); - add_location(label0, file, 235, 20, 8247); - attr_dev(input0, "id", "address-input"); - attr_dev(input0, "type", "text"); - input0.readOnly = true; - add_location(input0, file, 237, 24, 8367); - attr_dev(div0, "class", "ghost-input"); - add_location(div0, file, 238, 24, 8508); - attr_dev(div1, "class", "input-wrapper"); - add_location(div1, file, 236, 20, 8314); - attr_dev(div2, "id", "address-input-wrapper"); - attr_dev(div2, "class", "input-label-wrapper"); - add_location(div2, file, 234, 16, 8165); - attr_dev(label1, "for", "contact-input"); - add_location(label1, file, 242, 20, 8664); - attr_dev(input1, "id", "contact-input"); - attr_dev(input1, "type", "text"); - add_location(input1, file, 244, 24, 8783); - attr_dev(div3, "class", "ghost-input"); - add_location(div3, file, 245, 24, 8915); - attr_dev(div4, "class", "input-wrapper"); - add_location(div4, file, 243, 20, 8730); - attr_dev(div5, "class", "input-label-wrapper"); - add_location(div5, file, 241, 16, 8609); - attr_dev(button, "id", "submit-button"); - add_location(button, file, 248, 16, 9016); - attr_dev(p1, "id", "confirmation-msg"); - add_location(p1, file, 249, 16, 9102); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[15]); - add_location(map_component, file, 250, 16, 9177); - attr_dev(div6, "id", "text-container"); - add_location(div6, file, 224, 12, 7457); - attr_dev(div7, "id", "container"); - add_location(div7, file, 222, 8, 7354); - }, - m: function mount(target, anchor) { - insert_dev(target, div7, anchor); - append_dev(div7, div6); - append_dev(div6, h1); - append_dev(div6, t1); - append_dev(div6, img); - append_dev(div6, t2); - append_dev(div6, p0); - append_dev(div6, t4); - append_dev(div6, ol); - append_dev(ol, li0); - append_dev(ol, t6); - append_dev(ol, li1); - append_dev(ol, t8); - append_dev(ol, li2); - append_dev(ol, t10); - append_dev(ol, li3); - append_dev(div6, t12); - append_dev(div6, div2); - append_dev(div2, label0); - append_dev(div2, t14); - append_dev(div2, div1); - append_dev(div1, input0); - /*input0_binding*/ ctx[10](input0); - append_dev(div1, t15); - append_dev(div1, div0); - append_dev(div6, t16); - append_dev(div6, div5); - append_dev(div5, label1); - append_dev(div5, t18); - append_dev(div5, div4); - append_dev(div4, input1); - /*input1_binding*/ ctx[12](input1); - append_dev(div4, t19); - append_dev(div4, div3); - append_dev(div6, t20); - append_dev(div6, button); - append_dev(div6, t22); - append_dev(div6, p1); - /*p1_binding*/ ctx[14](p1); - append_dev(div6, t23); - append_dev(div6, map_component); - - if (!mounted) { - dispose = [ - listen_dev(input0, "input", /*input_handler*/ ctx[11], false, false, false), - listen_dev(input1, "input", /*input_handler_1*/ ctx[13], false, false, false), - listen_dev(button, "click", /*submitLocation*/ ctx[9], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 16 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[15])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div7); - /*input0_binding*/ ctx[10](null); - /*input1_binding*/ ctx[12](null); - /*p1_binding*/ ctx[14](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(222:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (221:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[3] == 3 && create_if_block(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 (/*$loaded*/ ctx[3] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(221:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[3]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 8 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[3])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function createPin(lat, lng) { - let markerIcon = new L.Icon({ - iconUrl: '/img/common/markers/marker-black.png', - shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - shadowSize: [41, 41] - }); - - return L.marker([lat, lng], { icon: markerIcon }); -} - -function updatePin(marker, lat, lng) { - let newLatLng = L.latLng(lat, lng); // Replace with the desired coordinates - marker.setLatLng(newLatLng); -} - -function resizeInput(el) { - el.nextElementSibling.innerHTML = el.value; -} - -function instance($$self, $$props, $$invalidate) { - let $loaded; - let $content; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('parties-add-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(3, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(4, $content = value)); - let entries; - let entriesByCountry; - - let callback = response => { - entries = JSON.parse(response); - entriesByCountry = {}; - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - entriesByCountry[country] = [g]; - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/parties.json", callback); - let confirmationMsg; - let addressInput; - let contactInput; - let addressVec; - let userPinLat = 0; - let userPinLng = 0; - let userPin = createPin(0, 0); - userPin.setOpacity(0); - let locale = loadLocaleContent(content, "parties-component", loaded); - loadLocaleContent(content, "countries", loaded); - - function reverseGeocodeLocal(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - let fullAddress = country; - - if (state != undefined) { - fullAddress += ", " + state; - } else { - state = ""; - } - - if (city != undefined) { - fullAddress += ", " + city; - } else { - city = ""; - } - - $$invalidate(1, addressInput.value = fullAddress, addressInput); - resizeInput(addressInput); - }; - - getData(url, callback); - } - - function reverseGeocode(latitude, longitude) { - let url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=jsonv2&accept-language=en`; - - let callback = response => { - // Parse the response JSON - response = JSON.parse(response); - - // Extract the address information from the response - let address = response.address; - - let city = address.city || address.town || address.village || address.hamlet; - let state = address.state; - let country = address.country; - - if (state != undefined) ; else { - state = ""; - } - - if (city != undefined) ; else { - city = ""; - } - - addressVec = [country, state, city]; - }; - - getData(url, callback); - } - - function addGroupPinContent(g, content, locale) { - let coordinates; - let text = "" + content["Group"] + "
    "; - - for (let field of ["location", "members", "contact"]) { - let fieldText = content[field] + ": "; - - if (field == "contact") { - text += fieldText + "" + g.contact + ""; - } else if (field == "location") { - let location = [g.country, g.state, g.town].filter(x => x != null && x != undefined); - let locationString; - - if (locale == "en") { - locationString = location.map(x => x).join(", "); - } else { - locationString = location.map(x => translate(content, x)).join(", "); - } - - text += fieldText + locationString + "
    "; - coordinates = [g.latitude, g.longitude]; - } else { - text += fieldText + g[field] + "
    "; - } - } - - return { text, coordinates }; - } - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addGroupPinContent, "green"); - userPin.addTo(map); - - map.on('click', function (event) { - let lat = event.latlng.lat; - let lng = event.latlng.lng; - userPinLat = lat; - userPinLng = lng; - updatePin(userPin, lat, lng); - userPin.setOpacity(1); - reverseGeocodeLocal(lat, lng); - reverseGeocode(lat, lng); - }); - } - - function updateConfirmationMsg(response) { - if (response !== false) { - $$invalidate(0, confirmationMsg.innerHTML = "You have been added to our database! Now go to our Discord to verify yourself.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "green", confirmationMsg); - } else { - $$invalidate(0, confirmationMsg.innerHTML = "Something went wrong.", confirmationMsg); - $$invalidate(0, confirmationMsg.style.color = "red", confirmationMsg); - } - } - - function submitLocation() { - if (addressVec != undefined) { - let data = { - country: addressVec[0], - state: addressVec[1], - town: addressVec[2], - latitude: userPinLat, - longitude: userPinLng, - contact: contactInput.value - }; - - if (data.state == "") { - data.state = null; - } - - if (data.town == "") { - data.town = null; - } - - if (data.contact == "") { - data.contact = null; - } - - let url = "/" + locale + "/parties-add-post/"; - sendData(url, data, updateConfirmationMsg); - } - } - - onMount(() => { - - }); - - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - addressInput = $$value; - $$invalidate(1, addressInput); - }); - } - - const input_handler = () => resizeInput(addressInput); - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - contactInput = $$value; - $$invalidate(2, contactInput); - }); - } - - const input_handler_1 = () => resizeInput(contactInput); - - function p1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - confirmationMsg = $$value; - $$invalidate(0, confirmationMsg); - }); - } - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - sendData, - addMarkersEntries, - translate, - loaded, - content, - entries, - entriesByCountry, - callback, - confirmationMsg, - addressInput, - contactInput, - addressVec, - userPinLat, - userPinLng, - userPin, - locale, - createPin, - updatePin, - reverseGeocodeLocal, - reverseGeocode, - addGroupPinContent, - mapCallback, - updateConfirmationMsg, - submitLocation, - resizeInput, - $loaded, - $content - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(5, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(6, content = $$props.content); - if ('entries' in $$props) entries = $$props.entries; - if ('entriesByCountry' in $$props) entriesByCountry = $$props.entriesByCountry; - if ('callback' in $$props) callback = $$props.callback; - if ('confirmationMsg' in $$props) $$invalidate(0, confirmationMsg = $$props.confirmationMsg); - if ('addressInput' in $$props) $$invalidate(1, addressInput = $$props.addressInput); - if ('contactInput' in $$props) $$invalidate(2, contactInput = $$props.contactInput); - if ('addressVec' in $$props) addressVec = $$props.addressVec; - if ('userPinLat' in $$props) userPinLat = $$props.userPinLat; - if ('userPinLng' in $$props) userPinLng = $$props.userPinLng; - if ('userPin' in $$props) userPin = $$props.userPin; - if ('locale' in $$props) $$invalidate(7, locale = $$props.locale); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - confirmationMsg, - addressInput, - contactInput, - $loaded, - $content, - loaded, - content, - locale, - mapCallback, - submitLocation, - input0_binding, - input_handler, - input1_binding, - input_handler_1, - p1_binding, - func - ]; -} - -class Parties_add_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("parties-add-component", Parties_add_component); - -export { Parties_add_component as default }; +import{S as t,i as e,a as n,b as i,s as o,p as a,n as r,g as s,q as l,o as c,j as m,e as p,c as u,d,t as f,u as g,f as h,l as b,r as w}from"./index-db20528a.js";import{w as y}from"./index-720c0a59.js";import{getData as v,loadLocaleContent as x,sendData as k}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as j,translate as S}from"../../../../../../../../../js/libraries/mapTools.js";import"../../../../../../../../../js/components/map-component.js";function z(t){let e,n,o,a,r,l,c,m,y,v,x,k,j,L,S,z,T,C,N,O,H,M,A,$,q,E,J,U,D,I,P,R,G,K,Q;return{c(){e=p("div"),n=p("div"),o=p("h1"),o.textContent="Add a Party",a=u(),r=p("img"),c=u(),m=p("p"),m.textContent="If there are no parties in your country which you can join then do the following:",y=u(),v=p("ol"),v.innerHTML="
  • Click on the map to show us where you are located;
  • \n
  • Add a way to contact you or leave blank for a pin to point to our discord;
  • \n
  • Press "Submit" to add yourself to our map;
  • \n
  • Verify yourself by having a chat with us at our Discord server to show on the map;
  • ",x=u(),k=p("div"),j=p("label"),j.textContent="Location:",L=u(),S=p("div"),z=p("input"),T=u(),C=p("div"),N=u(),O=p("div"),H=p("label"),H.textContent="Contact:",M=u(),A=p("div"),$=p("input"),q=u(),E=p("div"),J=u(),U=p("button"),U.textContent="Submit",D=u(),I=p("p"),P=u(),R=p("map-component"),d(r,"id","parties-img"),f(r.src,l="/img/common/parties.svg")||d(r,"src","/img/common/parties.svg"),d(r,"alt","parties"),d(m,"class","description"),d(j,"for","address-input"),d(z,"id","address-input"),d(z,"type","text"),z.readOnly=!0,d(C,"class","ghost-input"),d(S,"class","input-wrapper"),d(k,"id","address-input-wrapper"),d(k,"class","input-label-wrapper"),d(H,"for","contact-input"),d($,"id","contact-input"),d($,"type","text"),d(E,"class","ghost-input"),d(A,"class","input-wrapper"),d(O,"class","input-label-wrapper"),d(U,"id","submit-button"),d(I,"id","confirmation-msg"),g(R,"id","map"),g(R,"callback",G=t[15]),d(n,"id","text-container"),d(e,"id","container")},m(s,l){i(s,e,l),h(e,n),h(n,o),h(n,a),h(n,r),h(n,c),h(n,m),h(n,y),h(n,v),h(n,x),h(n,k),h(k,j),h(k,L),h(k,S),h(S,z),t[10](z),h(S,T),h(S,C),h(n,N),h(n,O),h(O,H),h(O,M),h(O,A),h(A,$),t[12]($),h(A,q),h(A,E),h(n,J),h(n,U),h(n,D),h(n,I),t[14](I),h(n,P),h(n,R),K||(Q=[b(z,"input",t[11]),b($,"input",t[13]),b(U,"click",t[9])],K=!0)},p(t,e){16&e&&G!==(G=t[15])&&g(R,"callback",G)},d(n){n&&s(e),t[10](null),t[12](null),t[14](null),K=!1,w(Q)}}}function T(t){let e,n=3==t[3]&&z(t);return{c(){n&&n.c(),e=a()},m(t,o){n&&n.m(t,o),i(t,e,o)},p(t,i){3==t[3]?n?n.p(t,i):(n=z(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(e)}}}function C(t){let e,n=t[3],l=T(t);return{c(){l.c(),e=a(),this.c=r},m(t,n){l.m(t,n),i(t,e,n)},p(t,[i]){8&i&&o(n,n=t[3])?(l.d(1),l=T(t),l.c(),l.m(e.parentNode,e)):l.p(t,i)},i:r,o:r,d(t){t&&s(e),l.d(t)}}}function N(t){t.nextElementSibling.innerHTML=t.value}function O(t,e,n){let i,o,a=y(0);l(t,a,(t=>n(3,i=t)));let r,s,p=y({});l(t,p,(t=>n(4,o=t)));let u,d,f,g;v("/assets/parties.json",(t=>{r=JSON.parse(t),s={};for(let t of r){let e=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),e in s?s[e].push(t):s[e]=[t]}a.update((t=>t+1))}));let h=0,b=0,w=function(t,e){let n=new L.Icon({iconUrl:"/img/common/markers/marker-black.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});return L.marker([t,e],{icon:n})}(0,0);w.setOpacity(0);let z=x(p,"parties-component",a);function T(t,e,n){let i,o=""+e.Group+"
    ";for(let a of["location","members","contact"]){let r=e[a]+": ";if("contact"==a)o+=r+""+t.contact+"";else if("location"==a){let a,s=[t.country,t.state,t.town].filter((t=>null!=t&&null!=t));a="en"==n?s.map((t=>t)).join(", "):s.map((t=>S(e,t))).join(", "),o+=r+a+"
    ",i=[t.latitude,t.longitude]}else o+=r+t[a]+"
    "}return{text:o,coordinates:i}}function C(t,e,i){let o=t([22,0],2);j(r,s,o,e,i,T,"green"),w.addTo(o),o.on("click",(function(t){let e=t.latlng.lat,i=t.latlng.lng;h=e,b=i,function(t,e,n){let i=L.latLng(e,n);t.setLatLng(i)}(w,e,i),w.setOpacity(1),v(`https://nominatim.openstreetmap.org/reverse?lat=${e}&lon=${i}&format=jsonv2`,(t=>{let e=(t=JSON.parse(t)).address,i=e.city||e.town||e.village||e.hamlet,o=e.state,a=e.country;null!=o?a+=", "+o:o="",null!=i?a+=", "+i:i="",n(1,d.value=a,d),N(d)})),function(t,e){v(`https://nominatim.openstreetmap.org/reverse?lat=${t}&lon=${e}&format=jsonv2&accept-language=en`,(t=>{let e=(t=JSON.parse(t)).address,n=e.city||e.town||e.village||e.hamlet,i=e.state,o=e.country;null!=i||(i=""),null!=n||(n=""),g=[o,i,n]}))}(e,i)}))}function O(t){!1!==t?(n(0,u.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",u),n(0,u.style.color="green",u)):(n(0,u.innerHTML="Something went wrong.",u),n(0,u.style.color="red",u))}x(p,"countries",a),c((()=>{}));return[u,d,f,i,o,a,p,z,C,function(){if(null!=g){let t={country:g[0],state:g[1],town:g[2],latitude:h,longitude:b,contact:f.value};""==t.state&&(t.state=null),""==t.town&&(t.town=null),""==t.contact&&(t.contact=null),k("/"+z+"/parties-add-post/",t,O)}},function(t){m[t?"unshift":"push"]((()=>{d=t,n(1,d)}))},()=>N(d),function(t){m[t?"unshift":"push"]((()=>{f=t,n(2,f)}))},()=>N(f),function(t){m[t?"unshift":"push"]((()=>{u=t,n(0,u)}))},t=>C(t,o,z)]}class H extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},O,C,o,{},null),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("parties-add-component",H);export{H as default}; diff --git a/Server/public/js/components/parties-component.js b/Server/public/js/components/parties-component.js index 3a6692b..2d257b8 100644 --- a/Server/public/js/components/parties-component.js +++ b/Server/public/js/components/parties-component.js @@ -1,732 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addPartyPinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\parties-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; - -const file = "src\\parties-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i][0]; - child_ctx[3] = list[i][1]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} - -// (64:4) {#if $loaded==3} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[1].parties + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t3_value = /*$content*/ ctx[1].p1 + ""; - let t3; - let t4; - let h3; - let t5_value = /*$content*/ ctx[1].subheading1 + ""; - let t5; - let t6; - let map_component; - let map_component_callback_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; - let t8; - let t9; - let each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - h3 = element("h3"); - t5 = text(t5_value); - t6 = space(); - map_component = element("map-component"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - add_location(h1, file, 67, 16, 2071); - attr_dev(img, "id", "party-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/parties.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "party"); - add_location(img, file, 68, 16, 2116); - attr_dev(p0, "class", "description"); - add_location(p0, file, 69, 16, 2196); - add_location(h3, file, 70, 16, 2254); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); - add_location(map_component, file, 71, 16, 2303); - attr_dev(p1, "id", "add-prompt"); - add_location(p1, file, 72, 16, 2426); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 66, 12, 2028); - attr_dev(div1, "id", "container"); - add_location(div1, file, 64, 8, 1925); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - append_dev(div0, p0); - append_dev(p0, t3); - append_dev(div0, t4); - append_dev(div0, h3); - append_dev(h3, t5); - append_dev(div0, t6); - append_dev(div0, map_component); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div0, t9); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div0, null); - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].parties + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, getCountry*/ 771) { - each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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(div0, 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); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(64:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (77:24) {#each entries as entry} -function create_each_block_1(ctx) { - let div2; - let div1; - let picture; - let source0; - let source0_srcset_value; - let t0; - let source1; - let source1_srcset_value; - let t1; - let img; - let t2; - let div0; - let p0; - let b0; - let t3_value = /*$content*/ ctx[1].name + ""; - let t3; - let t4; - let t5_value = /*entry*/ ctx[15].name + ""; - let t5; - let t6; - let p1; - let b1; - let t7_value = /*$content*/ ctx[1].location + ""; - let t7; - let t8; - let t9_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + ""; - let t9; - let t10; - let p2; - let b2; - let t11_value = /*$content*/ ctx[1].website + ""; - let t11; - let t12; - let a0; - let t13_value = /*entry*/ ctx[15].website + ""; - let t13; - let a0_href_value; - let t14; - let p3; - let b3; - let t15_value = /*$content*/ ctx[1].contact + ""; - let t15; - let t16; - let a1; - let t17_value = /*entry*/ ctx[15].contact + ""; - let t17; - let a1_href_value; - let t18; - let p4; - let b4; - let t19_value = /*$content*/ ctx[1].description + ""; - let t19; - let t20; - let t21_value = /*entry*/ ctx[15].description + ""; - let t21; - - const block = { - c: function create() { - div2 = element("div"); - div1 = element("div"); - picture = element("picture"); - source0 = element("source"); - t0 = space(); - source1 = element("source"); - t1 = space(); - img = element("img"); - t2 = space(); - div0 = element("div"); - p0 = element("p"); - b0 = element("b"); - t3 = text(t3_value); - t4 = text(": "); - t5 = text(t5_value); - t6 = space(); - p1 = element("p"); - b1 = element("b"); - t7 = text(t7_value); - t8 = text(": "); - t9 = text(t9_value); - t10 = space(); - p2 = element("p"); - b2 = element("b"); - t11 = text(t11_value); - t12 = text(": "); - a0 = element("a"); - t13 = text(t13_value); - t14 = space(); - p3 = element("p"); - b3 = element("b"); - t15 = text(t15_value); - t16 = text(": "); - a1 = element("a"); - t17 = text(t17_value); - t18 = space(); - p4 = element("p"); - b4 = element("b"); - t19 = text(t19_value); - t20 = text(": "); - t21 = text(t21_value); - attr_dev(source0, "srcset", source0_srcset_value = "/img/parties/" + /*entry*/ ctx[15].logo + ".webp"); - add_location(source0, file, 80, 36, 2912); - attr_dev(source1, "srcset", source1_srcset_value = "/img/parties/" + /*entry*/ ctx[15].logo + ".jpg"); - add_location(source1, file, 81, 36, 3002); - attr_dev(img, "class", "party-logo"); - attr_dev(img, "alt", "logo"); - add_location(img, file, 82, 36, 3091); - add_location(picture, file, 79, 32, 2865); - add_location(b0, file, 85, 39, 3250); - add_location(p0, file, 85, 36, 3247); - add_location(b1, file, 86, 39, 3331); - add_location(p1, file, 86, 36, 3328); - add_location(b2, file, 87, 39, 3423); - attr_dev(a0, "href", a0_href_value = /*entry*/ ctx[15].website); - attr_dev(a0, "target", ";_blank;"); - attr_dev(a0, "rel", "noreferrer"); - add_location(a0, file, 87, 66, 3450); - add_location(p2, file, 87, 36, 3420); - add_location(b3, file, 88, 39, 3569); - attr_dev(a1, "href", a1_href_value = /*entry*/ ctx[15].contact); - attr_dev(a1, "target", ";_blank;"); - attr_dev(a1, "rel", "noreferrer"); - add_location(a1, file, 88, 66, 3596); - add_location(p3, file, 88, 36, 3566); - add_location(div0, file, 84, 32, 3204); - attr_dev(div1, "class", "img-general-info"); - add_location(div1, file, 78, 28, 2801); - add_location(b4, file, 91, 31, 3783); - add_location(p4, file, 91, 28, 3780); - attr_dev(div2, "class", "location-info"); - add_location(div2, file, 77, 24, 2744); - }, - m: function mount(target, anchor) { - insert_dev(target, div2, anchor); - append_dev(div2, div1); - append_dev(div1, picture); - append_dev(picture, source0); - append_dev(picture, t0); - append_dev(picture, source1); - append_dev(picture, t1); - append_dev(picture, img); - append_dev(div1, t2); - append_dev(div1, div0); - append_dev(div0, p0); - append_dev(p0, b0); - append_dev(b0, t3); - append_dev(b0, t4); - append_dev(p0, t5); - append_dev(div0, t6); - append_dev(div0, p1); - append_dev(p1, b1); - append_dev(b1, t7); - append_dev(b1, t8); - append_dev(p1, t9); - append_dev(div0, t10); - append_dev(div0, p2); - append_dev(p2, b2); - append_dev(b2, t11); - append_dev(b2, t12); - append_dev(p2, a0); - append_dev(a0, t13); - append_dev(div0, t14); - append_dev(div0, p3); - append_dev(p3, b3); - append_dev(b3, t15); - append_dev(b3, t16); - append_dev(p3, a1); - append_dev(a1, t17); - append_dev(div2, t18); - append_dev(div2, p4); - append_dev(p4, b4); - append_dev(b4, t19); - append_dev(b4, t20); - append_dev(p4, t21); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && source0_srcset_value !== (source0_srcset_value = "/img/parties/" + /*entry*/ ctx[15].logo + ".webp")) { - attr_dev(source0, "srcset", source0_srcset_value); - } - - if (dirty & /*entriesByCountry*/ 1 && source1_srcset_value !== (source1_srcset_value = "/img/parties/" + /*entry*/ ctx[15].logo + ".jpg")) { - attr_dev(source1, "srcset", source1_srcset_value); - } - - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].name + "")) set_data_dev(t3, t3_value); - if (dirty & /*entriesByCountry*/ 1 && t5_value !== (t5_value = /*entry*/ ctx[15].name + "")) set_data_dev(t5, t5_value); - if (dirty & /*$content*/ 2 && t7_value !== (t7_value = /*$content*/ ctx[1].location + "")) set_data_dev(t7, t7_value); - if (dirty & /*entriesByCountry*/ 1 && t9_value !== (t9_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + "")) set_data_dev(t9, t9_value); - if (dirty & /*$content*/ 2 && t11_value !== (t11_value = /*$content*/ ctx[1].website + "")) set_data_dev(t11, t11_value); - if (dirty & /*entriesByCountry*/ 1 && t13_value !== (t13_value = /*entry*/ ctx[15].website + "")) set_data_dev(t13, t13_value); - - if (dirty & /*entriesByCountry*/ 1 && a0_href_value !== (a0_href_value = /*entry*/ ctx[15].website)) { - attr_dev(a0, "href", a0_href_value); - } - - if (dirty & /*$content*/ 2 && t15_value !== (t15_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t15, t15_value); - if (dirty & /*entriesByCountry*/ 1 && t17_value !== (t17_value = /*entry*/ ctx[15].contact + "")) set_data_dev(t17, t17_value); - - if (dirty & /*entriesByCountry*/ 1 && a1_href_value !== (a1_href_value = /*entry*/ ctx[15].contact)) { - attr_dev(a1, "href", a1_href_value); - } - - if (dirty & /*$content*/ 2 && t19_value !== (t19_value = /*$content*/ ctx[1].description + "")) set_data_dev(t19, t19_value); - if (dirty & /*entriesByCountry*/ 1 && t21_value !== (t21_value = /*entry*/ ctx[15].description + "")) set_data_dev(t21, t21_value); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div2); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block_1.name, - type: "each", - source: "(77:24) {#each entries as entry}", - ctx - }); - - return block; -} - -// (74:16) {#each Object.entries(entriesByCountry) as [name,entries]} -function create_each_block(ctx) { - let h4; - let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + ""; - let t0; - let t1; - let div; - let t2; - let each_value_1 = /*entries*/ ctx[3]; - 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() { - h4 = element("h4"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr_dev(h4, "class", "country-name"); - add_location(h4, file, 74, 20, 2571); - attr_dev(div, "class", "country-block"); - add_location(div, file, 75, 20, 2641); - }, - m: function mount(target, anchor) { - insert_dev(target, h4, anchor); - append_dev(h4, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - append_dev(div, t2); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + "")) set_data_dev(t0, t0_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress*/ 515) { - each_value_1 = /*entries*/ ctx[3]; - 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(div, t2); - } - } - - 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(h4); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(74:16) {#each Object.entries(entriesByCountry) as [name,entries]}", - ctx - }); - - return block; -} - -// (63:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 3 && create_if_block(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 (/*$loaded*/ ctx[2] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(63:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('parties-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries; - let entriesByCountry; - let locale = loadLocaleContent(content, "parties-component", loaded); - loadLocaleContent(content, "countries", loaded); - - let callback = response => { - $$invalidate(3, entries = JSON.parse(response)); - $$invalidate(0, entriesByCountry = {}); - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/parties.json", callback); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addPartyPinContent, "gold"); - } - - function getCountry(x) { - return locale == "en" ? x : translate($content, x); - } - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addPartyPinContent, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - mapCallback, - getCountry, - getAddress, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); - if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - entriesByCountry, - $content, - $loaded, - entries, - loaded, - content, - locale, - mapCallback, - getCountry, - getAddress, - func - ]; -} - -class Parties_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("parties-component", Parties_component); - -export { Parties_component as default }; +import{S as t,i as e,a as n,b as o,s as r,p as i,n as a,g as s,q as m,o as c,e as l,v as p,c as g,d,t as h,u as f,f as u,w as b,x as w}from"./index-db20528a.js";import{w as x}from"./index-720c0a59.js";import{loadLocaleContent as y,getData as j}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as v,translate as k}from"../../../../../../../../../js/libraries/mapTools.js";import{addPartyPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,e,n){const o=t.slice();return o[12]=e[n][0],o[3]=e[n][1],o}function O(t,e,n){const o=t.slice();return o[15]=e[n],o}function T(t){let e,n,r,i,a,m,c,x,y,j,v,k,z,O,T,D,R,S,_,q,A=t[1].parties+"",C=t[1].p1+"",F=t[1].subheading1+"",H=t[1]["map-prompt"]+"",J=Object.entries(t[0]),K=[];for(let e=0;en(2,r=t)));let a,s,l=x({});m(t,l,(t=>n(1,o=t)));let p=y(l,"parties-component",i);y(l,"countries",i);function g(t,e,n){let o=t([22,0],2);v(a,s,o,e,n,z,"gold")}j("/assets/parties.json",(t=>{n(3,a=JSON.parse(t)),n(0,s={});for(let t of a){let e=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),e in s?s[e].push(t):n(0,s[e]=[t],s)}i.update((t=>t+1))})),c((()=>{}));return[s,o,r,a,i,l,p,g,function(t){return"en"==p?t:k(o,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:k(o,t))).join(", ")},t=>g(t,o,p)]}class q extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},_,S,r,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("parties-component",q);export{q as default}; diff --git a/Server/public/js/components/partners-add-component.js b/Server/public/js/components/partners-add-component.js index 356f51d..932bc95 100644 --- a/Server/public/js/components/partners-add-component.js +++ b/Server/public/js/components/partners-add-component.js @@ -1,650 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\partners-add-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; - -const file = "src\\partners-add-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[13] = list[i][0]; - child_ctx[3] = list[i][1]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[16] = list[i]; - return child_ctx; -} - -// (91:4) {#if $loaded==3} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[1].groups + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t3_value = /*$content*/ ctx[1].p1 + ""; - let t3; - let t4; - let h3; - let t5_value = /*$content*/ ctx[1].subheading1 + ""; - let t5; - let t6; - let map_component; - let map_component_callback_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; - let t8; - let t9; - let each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - h3 = element("h3"); - t5 = text(t5_value); - t6 = space(); - map_component = element("map-component"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - add_location(h1, file, 94, 16, 3148); - attr_dev(img, "id", "groups-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/groups.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "groups"); - add_location(img, file, 95, 16, 3192); - attr_dev(p0, "class", "description"); - add_location(p0, file, 96, 16, 3273); - add_location(h3, file, 97, 16, 3331); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); - add_location(map_component, file, 98, 16, 3380); - attr_dev(p1, "id", "add-prompt"); - add_location(p1, file, 99, 16, 3503); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 93, 12, 3105); - attr_dev(div1, "id", "container"); - add_location(div1, file, 91, 8, 3002); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - append_dev(div0, p0); - append_dev(p0, t3); - append_dev(div0, t4); - append_dev(div0, h3); - append_dev(h3, t5); - append_dev(div0, t6); - append_dev(div0, map_component); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div0, t9); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div0, null); - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].groups + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, getCountry*/ 771) { - each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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(div0, 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); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(91:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (104:24) {#each entries as entry} -function create_each_block_1(ctx) { - let div; - let p0; - let b0; - let t0_value = /*$content*/ ctx[1].location + ""; - let t0; - let t1; - let t2_value = /*getAddress*/ ctx[9](/*entry*/ ctx[16]) + ""; - let t2; - let t3; - let p1; - let b1; - let t4_value = /*$content*/ ctx[1].members + ""; - let t4; - let t5; - let t6_value = /*entry*/ ctx[16].members + ""; - let t6; - let t7; - let p2; - let b2; - let t8_value = /*$content*/ ctx[1].contact + ""; - let t8; - let t9; - let a; - let t10_value = /*entry*/ ctx[16].contact + ""; - let t10; - let a_href_value; - - const block = { - c: function create() { - div = element("div"); - p0 = element("p"); - b0 = element("b"); - t0 = text(t0_value); - t1 = text(": "); - t2 = text(t2_value); - t3 = space(); - p1 = element("p"); - b1 = element("b"); - t4 = text(t4_value); - t5 = text(": "); - t6 = text(t6_value); - t7 = space(); - p2 = element("p"); - b2 = element("b"); - t8 = text(t8_value); - t9 = text(": "); - a = element("a"); - t10 = text(t10_value); - add_location(b0, file, 105, 35, 3889); - add_location(p0, file, 105, 32, 3886); - add_location(b1, file, 106, 35, 3977); - add_location(p1, file, 106, 32, 3974); - add_location(b2, file, 107, 35, 4060); - attr_dev(a, "href", a_href_value = /*entry*/ ctx[16].contact); - attr_dev(a, "target", ";_blank;"); - attr_dev(a, "rel", "noreferrer"); - add_location(a, file, 107, 62, 4087); - add_location(p2, file, 107, 32, 4057); - attr_dev(div, "class", "location-info"); - add_location(div, file, 104, 28, 3825); - }, - m: function mount(target, anchor) { - insert_dev(target, div, anchor); - append_dev(div, p0); - append_dev(p0, b0); - append_dev(b0, t0); - append_dev(b0, t1); - append_dev(p0, t2); - append_dev(div, t3); - append_dev(div, p1); - append_dev(p1, b1); - append_dev(b1, t4); - append_dev(b1, t5); - append_dev(p1, t6); - append_dev(div, t7); - append_dev(div, p2); - append_dev(p2, b2); - append_dev(b2, t8); - append_dev(b2, t9); - append_dev(p2, a); - append_dev(a, t10); - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].location + "")) set_data_dev(t0, t0_value); - if (dirty & /*entriesByCountry*/ 1 && t2_value !== (t2_value = /*getAddress*/ ctx[9](/*entry*/ ctx[16]) + "")) set_data_dev(t2, t2_value); - if (dirty & /*$content*/ 2 && t4_value !== (t4_value = /*$content*/ ctx[1].members + "")) set_data_dev(t4, t4_value); - if (dirty & /*entriesByCountry*/ 1 && t6_value !== (t6_value = /*entry*/ ctx[16].members + "")) set_data_dev(t6, t6_value); - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t8, t8_value); - if (dirty & /*entriesByCountry*/ 1 && t10_value !== (t10_value = /*entry*/ ctx[16].contact + "")) set_data_dev(t10, t10_value); - - if (dirty & /*entriesByCountry*/ 1 && a_href_value !== (a_href_value = /*entry*/ ctx[16].contact)) { - attr_dev(a, "href", a_href_value); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block_1.name, - type: "each", - source: "(104:24) {#each entries as entry}", - ctx - }); - - return block; -} - -// (101:16) {#each Object.entries(entriesByCountry) as [name,entries]} -function create_each_block(ctx) { - let h4; - let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[13]) + ""; - let t0; - let t1; - let div; - let t2; - let each_value_1 = /*entries*/ ctx[3]; - 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() { - h4 = element("h4"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr_dev(h4, "class", "country-name"); - add_location(h4, file, 101, 20, 3648); - attr_dev(div, "class", "country-block"); - add_location(div, file, 102, 20, 3718); - }, - m: function mount(target, anchor) { - insert_dev(target, h4, anchor); - append_dev(h4, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - append_dev(div, t2); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[13]) + "")) set_data_dev(t0, t0_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress*/ 515) { - each_value_1 = /*entries*/ ctx[3]; - 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(div, t2); - } - } - - 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(h4); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(101:16) {#each Object.entries(entriesByCountry) as [name,entries]}", - ctx - }); - - return block; -} - -// (90:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 3 && create_if_block(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 (/*$loaded*/ ctx[2] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(90:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('partners-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries; - let entriesByCountry; - let locale = loadLocaleContent(content, "groups-component", loaded); - loadLocaleContent(content, "countries", loaded); - - let callback = response => { - $$invalidate(3, entries = JSON.parse(response)); - $$invalidate(0, entriesByCountry = {}); - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/groups.json", callback); - - function addGroupPinContent(g, content, locale) { - let coordinates; - let text = "" + content["Group"] + "
    "; - - for (let field of ["location", "members", "contact"]) { - let fieldText = content[field] + ": "; - - if (field == "contact") { - text += fieldText + "" + g.contact + ""; - } else if (field == "location") { - let location = [g.country, g.state, g.town].filter(x => x != null && x != undefined); - let locationString; - - if (locale == "en") { - locationString = location.map(x => x).join(", "); - } else { - locationString = location.map(x => translate(content, x)).join(", "); - } - - text += fieldText + locationString + "
    "; - coordinates = [g.latitude, g.longitude]; - } else { - text += fieldText + g[field] + "
    "; - } - } - - return { text, coordinates }; - } - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addGroupPinContent, "green"); - } - - function getCountry(x) { - return locale == "en" ? x : translate($content, x); - } - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - addGroupPinContent, - mapCallback, - getCountry, - getAddress, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); - if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - entriesByCountry, - $content, - $loaded, - entries, - loaded, - content, - locale, - mapCallback, - getCountry, - getAddress, - func - ]; -} - -class Partners_add_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("partners-component", Partners_add_component); - -export { Partners_add_component as default }; +import{S as t,i as o,a as n,b as e,s as r,p as a,n as i,g as s,q as c,o as m,e as l,v as p,c as u,d as g,t as d,u as f,f as h,w as b,x as j}from"./index-db20528a.js";import{w as x}from"./index-720c0a59.js";import{loadLocaleContent as w,getData as y}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as v,translate as k}from"../../../../../../../../../js/libraries/mapTools.js";import"../../../../../../../../../js/components/map-component.js";function z(t,o,n){const e=t.slice();return e[13]=o[n][0],e[3]=o[n][1],e}function N(t,o,n){const e=t.slice();return e[16]=o[n],e}function O(t){let o,n,r,a,i,c,m,x,w,y,v,k,N,O,T,E,R,S,_,q,A=t[1].groups+"",C=t[1].p1+"",G=t[1].subheading1+"",H=t[1]["map-prompt"]+"",J=Object.entries(t[0]),K=[];for(let o=0;on(2,r=t)));let i,s,l=x({});c(t,l,(t=>n(1,e=t)));let p=w(l,"groups-component",a);w(l,"countries",a);function u(t,o,n){let e,r=""+o.Group+"
    ";for(let a of["location","members","contact"]){let i=o[a]+": ";if("contact"==a)r+=i+""+t.contact+"";else if("location"==a){let a,s=[t.country,t.state,t.town].filter((t=>null!=t&&null!=t));a="en"==n?s.map((t=>t)).join(", "):s.map((t=>k(o,t))).join(", "),r+=i+a+"
    ",e=[t.latitude,t.longitude]}else r+=i+t[a]+"
    "}return{text:r,coordinates:e}}function g(t,o,n){let e=t([22,0],2);v(i,s,e,o,n,u,"green")}y("/assets/groups.json",(t=>{n(3,i=JSON.parse(t)),n(0,s={});for(let t of i){let o=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),o in s?s[o].push(t):n(0,s[o]=[t],s)}a.update((t=>t+1))})),m((()=>{}));return[s,e,r,i,a,l,p,g,function(t){return"en"==p?t:k(e,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:k(e,t))).join(", ")},t=>g(t,e,p)]}class _ extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},S,R,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("partners-component",_);export{_ as default}; diff --git a/Server/public/js/components/partners-component.js b/Server/public/js/components/partners-component.js index 1f096f8..42e11a6 100644 --- a/Server/public/js/components/partners-component.js +++ b/Server/public/js/components/partners-component.js @@ -1,731 +1 @@ - -(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, w as validate_store, x as component_subscribe, o as onMount, e as globals, y as empty, n as noop, p as detach_dev, A as validate_each_argument, f as element, B as text, h as space, j as add_location, k as attr_dev, u as src_url_equal, z as set_custom_element_data, l as append_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { loadLocaleContent, getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import { addMarkersEntries, translate } from '../../../../../../../../../js/libraries/mapTools.js'; -import { addPartnersPinContent } from '../../../../../../../../../js/mapFuncs.js'; -import '../../../../../../../../../js/components/map-component.js'; - -/* src\partners-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; - -const file = "src\\partners-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[12] = list[i][0]; - child_ctx[3] = list[i][1]; - return child_ctx; -} - -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[15] = list[i]; - return child_ctx; -} - -// (64:4) {#if $loaded==3} -function create_if_block(ctx) { - let div1; - let div0; - let h1; - let t0_value = /*$content*/ ctx[1].heading + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let p0; - let t3_value = /*$content*/ ctx[1].p1 + ""; - let t3; - let t4; - let h3; - let t5_value = /*$content*/ ctx[1].subheading1 + ""; - let t5; - let t6; - let map_component; - let map_component_callback_value; - let t7; - let p1; - let t8_value = /*$content*/ ctx[1]["map-prompt"] + ""; - let t8; - let t9; - let each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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"); - div0 = element("div"); - h1 = element("h1"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - p0 = element("p"); - t3 = text(t3_value); - t4 = space(); - h3 = element("h3"); - t5 = text(t5_value); - t6 = space(); - map_component = element("map-component"); - t7 = space(); - p1 = element("p"); - t8 = text(t8_value); - t9 = space(); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - add_location(h1, file, 67, 16, 2084); - attr_dev(img, "id", "hands-img"); - if (!src_url_equal(img.src, img_src_value = "/img/common/handshake.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "alt", "hands"); - add_location(img, file, 68, 16, 2129); - add_location(p0, file, 69, 16, 2211); - add_location(h3, file, 70, 16, 2249); - set_custom_element_data(map_component, "id", "map"); - set_custom_element_data(map_component, "callback", map_component_callback_value = /*func*/ ctx[10]); - add_location(map_component, file, 71, 16, 2298); - attr_dev(p1, "id", "add-prompt"); - add_location(p1, file, 72, 16, 2421); - attr_dev(div0, "id", "text-container"); - add_location(div0, file, 66, 12, 2041); - attr_dev(div1, "id", "container"); - add_location(div1, file, 64, 8, 1938); - }, - m: function mount(target, anchor) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, h1); - append_dev(h1, t0); - append_dev(div0, t1); - append_dev(div0, img); - append_dev(div0, t2); - append_dev(div0, p0); - append_dev(p0, t3); - append_dev(div0, t4); - append_dev(div0, h3); - append_dev(h3, t5); - append_dev(div0, t6); - append_dev(div0, map_component); - append_dev(div0, t7); - append_dev(div0, p1); - append_dev(p1, t8); - append_dev(div0, t9); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div0, null); - } - }, - p: function update(ctx, dirty) { - if (dirty & /*$content*/ 2 && t0_value !== (t0_value = /*$content*/ ctx[1].heading + "")) set_data_dev(t0, t0_value); - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].p1 + "")) set_data_dev(t3, t3_value); - if (dirty & /*$content*/ 2 && t5_value !== (t5_value = /*$content*/ ctx[1].subheading1 + "")) set_data_dev(t5, t5_value); - - if (dirty & /*$content*/ 2 && map_component_callback_value !== (map_component_callback_value = /*func*/ ctx[10])) { - set_custom_element_data(map_component, "callback", map_component_callback_value); - } - - if (dirty & /*$content*/ 2 && t8_value !== (t8_value = /*$content*/ ctx[1]["map-prompt"] + "")) set_data_dev(t8, t8_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress, getCountry*/ 771) { - each_value = Object.entries(/*entriesByCountry*/ ctx[0]); - 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(div0, 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); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(64:4) {#if $loaded==3}", - ctx - }); - - return block; -} - -// (77:24) {#each entries as entry} -function create_each_block_1(ctx) { - let div2; - let div1; - let picture; - let source0; - let source0_srcset_value; - let t0; - let source1; - let source1_srcset_value; - let t1; - let img; - let t2; - let div0; - let p0; - let b0; - let t3_value = /*$content*/ ctx[1].name + ""; - let t3; - let t4; - let t5_value = /*entry*/ ctx[15].name + ""; - let t5; - let t6; - let p1; - let b1; - let t7_value = /*$content*/ ctx[1].location + ""; - let t7; - let t8; - let t9_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + ""; - let t9; - let t10; - let p2; - let b2; - let t11_value = /*$content*/ ctx[1].website + ""; - let t11; - let t12; - let a0; - let t13_value = /*entry*/ ctx[15].website + ""; - let t13; - let a0_href_value; - let t14; - let p3; - let b3; - let t15_value = /*$content*/ ctx[1].contact + ""; - let t15; - let t16; - let a1; - let t17_value = /*entry*/ ctx[15].contact + ""; - let t17; - let a1_href_value; - let t18; - let p4; - let b4; - let t19_value = /*$content*/ ctx[1].description + ""; - let t19; - let t20; - let t21_value = /*entry*/ ctx[15].description + ""; - let t21; - - const block = { - c: function create() { - div2 = element("div"); - div1 = element("div"); - picture = element("picture"); - source0 = element("source"); - t0 = space(); - source1 = element("source"); - t1 = space(); - img = element("img"); - t2 = space(); - div0 = element("div"); - p0 = element("p"); - b0 = element("b"); - t3 = text(t3_value); - t4 = text(": "); - t5 = text(t5_value); - t6 = space(); - p1 = element("p"); - b1 = element("b"); - t7 = text(t7_value); - t8 = text(": "); - t9 = text(t9_value); - t10 = space(); - p2 = element("p"); - b2 = element("b"); - t11 = text(t11_value); - t12 = text(": "); - a0 = element("a"); - t13 = text(t13_value); - t14 = space(); - p3 = element("p"); - b3 = element("b"); - t15 = text(t15_value); - t16 = text(": "); - a1 = element("a"); - t17 = text(t17_value); - t18 = space(); - p4 = element("p"); - b4 = element("b"); - t19 = text(t19_value); - t20 = text(": "); - t21 = text(t21_value); - attr_dev(source0, "srcset", source0_srcset_value = "/img/partners/" + /*entry*/ ctx[15].logo + ".webp"); - add_location(source0, file, 80, 36, 2907); - attr_dev(source1, "srcset", source1_srcset_value = "/img/partners/" + /*entry*/ ctx[15].logo + ".jpg"); - add_location(source1, file, 81, 36, 2998); - attr_dev(img, "class", "partner-logo"); - attr_dev(img, "alt", "logo"); - add_location(img, file, 82, 36, 3088); - add_location(picture, file, 79, 32, 2860); - add_location(b0, file, 85, 39, 3249); - add_location(p0, file, 85, 36, 3246); - add_location(b1, file, 86, 39, 3330); - add_location(p1, file, 86, 36, 3327); - add_location(b2, file, 87, 39, 3422); - attr_dev(a0, "href", a0_href_value = /*entry*/ ctx[15].website); - attr_dev(a0, "target", ";_blank;"); - attr_dev(a0, "rel", "noreferrer"); - add_location(a0, file, 87, 66, 3449); - add_location(p2, file, 87, 36, 3419); - add_location(b3, file, 88, 39, 3568); - attr_dev(a1, "href", a1_href_value = /*entry*/ ctx[15].website); - attr_dev(a1, "target", ";_blank;"); - attr_dev(a1, "rel", "noreferrer"); - add_location(a1, file, 88, 66, 3595); - add_location(p3, file, 88, 36, 3565); - add_location(div0, file, 84, 32, 3203); - attr_dev(div1, "class", "img-general-info"); - add_location(div1, file, 78, 28, 2796); - add_location(b4, file, 91, 31, 3782); - add_location(p4, file, 91, 28, 3779); - attr_dev(div2, "class", "location-info"); - add_location(div2, file, 77, 24, 2739); - }, - m: function mount(target, anchor) { - insert_dev(target, div2, anchor); - append_dev(div2, div1); - append_dev(div1, picture); - append_dev(picture, source0); - append_dev(picture, t0); - append_dev(picture, source1); - append_dev(picture, t1); - append_dev(picture, img); - append_dev(div1, t2); - append_dev(div1, div0); - append_dev(div0, p0); - append_dev(p0, b0); - append_dev(b0, t3); - append_dev(b0, t4); - append_dev(p0, t5); - append_dev(div0, t6); - append_dev(div0, p1); - append_dev(p1, b1); - append_dev(b1, t7); - append_dev(b1, t8); - append_dev(p1, t9); - append_dev(div0, t10); - append_dev(div0, p2); - append_dev(p2, b2); - append_dev(b2, t11); - append_dev(b2, t12); - append_dev(p2, a0); - append_dev(a0, t13); - append_dev(div0, t14); - append_dev(div0, p3); - append_dev(p3, b3); - append_dev(b3, t15); - append_dev(b3, t16); - append_dev(p3, a1); - append_dev(a1, t17); - append_dev(div2, t18); - append_dev(div2, p4); - append_dev(p4, b4); - append_dev(b4, t19); - append_dev(b4, t20); - append_dev(p4, t21); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && source0_srcset_value !== (source0_srcset_value = "/img/partners/" + /*entry*/ ctx[15].logo + ".webp")) { - attr_dev(source0, "srcset", source0_srcset_value); - } - - if (dirty & /*entriesByCountry*/ 1 && source1_srcset_value !== (source1_srcset_value = "/img/partners/" + /*entry*/ ctx[15].logo + ".jpg")) { - attr_dev(source1, "srcset", source1_srcset_value); - } - - if (dirty & /*$content*/ 2 && t3_value !== (t3_value = /*$content*/ ctx[1].name + "")) set_data_dev(t3, t3_value); - if (dirty & /*entriesByCountry*/ 1 && t5_value !== (t5_value = /*entry*/ ctx[15].name + "")) set_data_dev(t5, t5_value); - if (dirty & /*$content*/ 2 && t7_value !== (t7_value = /*$content*/ ctx[1].location + "")) set_data_dev(t7, t7_value); - if (dirty & /*entriesByCountry*/ 1 && t9_value !== (t9_value = /*getAddress*/ ctx[9](/*entry*/ ctx[15]) + "")) set_data_dev(t9, t9_value); - if (dirty & /*$content*/ 2 && t11_value !== (t11_value = /*$content*/ ctx[1].website + "")) set_data_dev(t11, t11_value); - if (dirty & /*entriesByCountry*/ 1 && t13_value !== (t13_value = /*entry*/ ctx[15].website + "")) set_data_dev(t13, t13_value); - - if (dirty & /*entriesByCountry*/ 1 && a0_href_value !== (a0_href_value = /*entry*/ ctx[15].website)) { - attr_dev(a0, "href", a0_href_value); - } - - if (dirty & /*$content*/ 2 && t15_value !== (t15_value = /*$content*/ ctx[1].contact + "")) set_data_dev(t15, t15_value); - if (dirty & /*entriesByCountry*/ 1 && t17_value !== (t17_value = /*entry*/ ctx[15].contact + "")) set_data_dev(t17, t17_value); - - if (dirty & /*entriesByCountry*/ 1 && a1_href_value !== (a1_href_value = /*entry*/ ctx[15].website)) { - attr_dev(a1, "href", a1_href_value); - } - - if (dirty & /*$content*/ 2 && t19_value !== (t19_value = /*$content*/ ctx[1].description + "")) set_data_dev(t19, t19_value); - if (dirty & /*entriesByCountry*/ 1 && t21_value !== (t21_value = /*entry*/ ctx[15].description + "")) set_data_dev(t21, t21_value); - }, - d: function destroy(detaching) { - if (detaching) detach_dev(div2); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block_1.name, - type: "each", - source: "(77:24) {#each entries as entry}", - ctx - }); - - return block; -} - -// (74:16) {#each Object.entries(entriesByCountry) as [name,entries]} -function create_each_block(ctx) { - let h4; - let t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + ""; - let t0; - let t1; - let div; - let t2; - let each_value_1 = /*entries*/ ctx[3]; - 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() { - h4 = element("h4"); - t0 = text(t0_value); - t1 = space(); - div = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - t2 = space(); - attr_dev(h4, "class", "country-name"); - add_location(h4, file, 74, 20, 2566); - attr_dev(div, "class", "country-block"); - add_location(div, file, 75, 20, 2636); - }, - m: function mount(target, anchor) { - insert_dev(target, h4, anchor); - append_dev(h4, t0); - insert_dev(target, t1, anchor); - insert_dev(target, div, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div, null); - } - - append_dev(div, t2); - }, - p: function update(ctx, dirty) { - if (dirty & /*entriesByCountry*/ 1 && t0_value !== (t0_value = /*getCountry*/ ctx[8](/*name*/ ctx[12]) + "")) set_data_dev(t0, t0_value); - - if (dirty & /*Object, entriesByCountry, $content, getAddress*/ 515) { - each_value_1 = /*entries*/ ctx[3]; - 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(div, t2); - } - } - - 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(h4); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(div); - destroy_each(each_blocks, detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(74:16) {#each Object.entries(entriesByCountry) as [name,entries]}", - ctx - }); - - return block; -} - -// (63:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[2] == 3 && create_if_block(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 (/*$loaded*/ ctx[2] == 3) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(63:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[2]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*$loaded*/ 4 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[2])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('partners-component', slots, []); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(2, $loaded = value)); - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(1, $content = value)); - let entries; - let entriesByCountry; - let locale = loadLocaleContent(content, "partners-component", loaded); - loadLocaleContent(content, "countries", loaded); - - let callback = response => { - $$invalidate(3, entries = JSON.parse(response)); - $$invalidate(0, entriesByCountry = {}); - - for (let g of entries) { - let country = g.country; - - if (g.contact == null) { - g.contact = "https://discord.gg/Qk8KUk787z"; - } - - if (country in entriesByCountry) { - entriesByCountry[country].push(g); - } else { - $$invalidate(0, entriesByCountry[country] = [g], entriesByCountry); - } - } - - loaded.update(val => { - return val + 1; - }); - }; - - getData("/assets/partners.json", callback); - - function mapCallback(createMap, content, locale) { - let map = createMap([22, 0], 2); - addMarkersEntries(entries, entriesByCountry, map, content, locale, addPartnersPinContent, "blue"); - } - - function getCountry(x) { - return locale == "en" ? x : translate($content, x); - } - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - onMount(() => { - - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const func = createMap => mapCallback(createMap, $content, locale); - - $$self.$capture_state = () => ({ - onMount, - writable, - loadLocaleContent, - getData, - addMarkersEntries, - translate, - addPartnersPinContent, - loaded, - content, - entries, - entriesByCountry, - locale, - callback, - mapCallback, - getCountry, - getAddress, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('loaded' in $$props) $$invalidate(4, loaded = $$props.loaded); - if ('content' in $$props) $$invalidate(5, content = $$props.content); - if ('entries' in $$props) $$invalidate(3, entries = $$props.entries); - if ('entriesByCountry' in $$props) $$invalidate(0, entriesByCountry = $$props.entriesByCountry); - if ('locale' in $$props) $$invalidate(6, locale = $$props.locale); - if ('callback' in $$props) callback = $$props.callback; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - entriesByCountry, - $content, - $loaded, - entries, - loaded, - content, - locale, - mapCallback, - getCountry, - getAddress, - func - ]; -} - -class Partners_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - {}, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - } - } -} - -customElements.define("partners-component", Partners_component); - -export { Partners_component as default }; +import{S as t,i as e,a as n,b as o,s as r,p as i,n as a,g as s,q as m,o as c,e as l,v as p,c as g,d,t as h,u as f,f as u,w as b,x as w}from"./index-db20528a.js";import{w as x}from"./index-720c0a59.js";import{loadLocaleContent as j,getData as v}from"../../../../../../../../../js/libraries/serverTools.js";import{addMarkersEntries as y,translate as k}from"../../../../../../../../../js/libraries/mapTools.js";import{addPartnersPinContent as z}from"../../../../../../../../../js/mapFuncs.js";import"../../../../../../../../../js/components/map-component.js";function N(t,e,n){const o=t.slice();return o[12]=e[n][0],o[3]=e[n][1],o}function O(t,e,n){const o=t.slice();return o[15]=e[n],o}function T(t){let e,n,r,i,a,m,c,x,j,v,y,k,z,O,T,D,R,S,_,q,A=t[1].heading+"",C=t[1].p1+"",F=t[1].subheading1+"",H=t[1]["map-prompt"]+"",J=Object.entries(t[0]),K=[];for(let e=0;en(2,r=t)));let a,s,l=x({});m(t,l,(t=>n(1,o=t)));let p=j(l,"partners-component",i);j(l,"countries",i);function g(t,e,n){let o=t([22,0],2);y(a,s,o,e,n,z,"blue")}v("/assets/partners.json",(t=>{n(3,a=JSON.parse(t)),n(0,s={});for(let t of a){let e=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),e in s?s[e].push(t):n(0,s[e]=[t],s)}i.update((t=>t+1))})),c((()=>{}));return[s,o,r,a,i,l,p,g,function(t){return"en"==p?t:k(o,t)},function(t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>"en"==p?t:k(o,t))).join(", ")},t=>g(t,o,p)]}class q extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},_,S,r,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("partners-component",q);export{q as default}; diff --git a/Server/public/js/components/profile-communes.js b/Server/public/js/components/profile-communes.js new file mode 100644 index 0000000..365e059 --- /dev/null +++ b/Server/public/js/components/profile-communes.js @@ -0,0 +1 @@ +import{S as t,i as s,a as e,b as o,s as a,e as r,c as n,n as i,y as c,g as d,o as m}from"./index-db20528a.js";import"../../../../../../../../../js/libraries/authTools.js";function l(t){let s,e,a;return{c(){s=r("h3"),s.textContent="Under development",e=n(),a=r("p"),a.innerHTML='Visit https://discord.gg/Qk8KUk787z and ask for your commune to be added.',this.c=i,c(a,"position","relative"),c(a,"margin-top","2rem")},m(t,r){o(t,s,r),o(t,e,r),o(t,a,r)},p:i,i:i,o:i,d(t){t&&d(s),t&&d(e),t&&d(a)}}}function h(t){return m((()=>{})),[]}class p extends t{constructor(t){super(),this.shadowRoot.innerHTML="",s(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},h,l,a,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("profile-communes",p);export{p as default}; diff --git a/Server/public/js/components/profile-component.js b/Server/public/js/components/profile-component.js index b24f8c8..2e7b553 100644 --- a/Server/public/js/components/profile-component.js +++ b/Server/public/js/components/profile-component.js @@ -1,598 +1 @@ - -(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 setContext, o as onMount, J as afterUpdate, e as globals, f as element, h as space, n as noop, j as add_location, k as attr_dev, F as set_style, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks } from './index-998178c7.js'; -import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js'; -import { svgFromObject } from '../../../../../../../../../js/libraries/miscTools.js'; -import '../../../../../../../../../js/components/pane-aligner.js'; -import '../../../../../../../../../js/components/profile-general.js'; -import '../../../../../../../../../js/components/profile-groups.js'; - -/* src\profile\profile-component.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; -const file = "src\\profile\\profile-component.svelte"; - -function create_fragment(ctx) { - let div1; - let div0; - let p; - let t1; - let button0; - let t2; - let pane_aligner; - let div2; - let button1; - let object0; - let t3; - let span0; - let t5; - let button2; - let object1; - let t6; - let span1; - let t8; - let button3; - let object2; - let t9; - let span2; - let t11; - let button4; - let object3; - let t12; - let span3; - let t14; - let button5; - let object4; - let t15; - let span4; - let t17; - let button6; - let object5; - let t18; - let span5; - let t20; - let div3; - let profile_general; - let t21; - let profile_groups; - let t22; - let profile_communes; - let t23; - let profile_coops; - let t24; - let profile_parties; - let mounted; - let dispose; - - const block = { - c: function create() { - div1 = element("div"); - div0 = element("div"); - p = element("p"); - p.textContent = "wegwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"; - t1 = space(); - button0 = element("button"); - t2 = space(); - pane_aligner = element("pane-aligner"); - div2 = element("div"); - button1 = element("button"); - object0 = element("object"); - t3 = space(); - span0 = element("span"); - span0.textContent = "general"; - t5 = space(); - button2 = element("button"); - object1 = element("object"); - t6 = space(); - span1 = element("span"); - span1.textContent = "groups"; - t8 = space(); - button3 = element("button"); - object2 = element("object"); - t9 = space(); - span2 = element("span"); - span2.textContent = "communes"; - t11 = space(); - button4 = element("button"); - object3 = element("object"); - t12 = space(); - span3 = element("span"); - span3.textContent = "cooperatives"; - t14 = space(); - button5 = element("button"); - object4 = element("object"); - t15 = space(); - span4 = element("span"); - span4.textContent = "parties"; - t17 = space(); - button6 = element("button"); - object5 = element("object"); - t18 = space(); - span5 = element("span"); - span5.textContent = "logout"; - t20 = space(); - div3 = element("div"); - profile_general = element("profile-general"); - t21 = space(); - profile_groups = element("profile-groups"); - t22 = space(); - profile_communes = element("profile-communes"); - t23 = space(); - profile_coops = element("profile-coops"); - t24 = space(); - profile_parties = element("profile-parties"); - this.c = noop; - add_location(p, file, 87, 8, 2264); - attr_dev(div0, "id", "location-overlay-content"); - add_location(div0, file, 86, 4, 2219); - attr_dev(button0, "class", "overlay-button"); - add_location(button0, file, 89, 4, 2326); - attr_dev(div1, "class", "overlay"); - set_style(div1, "display", "none"); - add_location(div1, file, 85, 0, 2144); - attr_dev(object0, "id", "general-img"); - attr_dev(object0, "class", "icons"); - attr_dev(object0, "type", "image/svg+xml"); - attr_dev(object0, "data", "/img/profile/icons/general.svg"); - attr_dev(object0, "title", "general"); - add_location(object0, file, 95, 12, 2633); - add_location(span0, file, 96, 12, 2770); - add_location(button1, file, 94, 8, 2534); - attr_dev(object1, "id", "groups-img"); - attr_dev(object1, "class", "icons"); - attr_dev(object1, "type", "image/svg+xml"); - attr_dev(object1, "data", "/img/common/groups.svg"); - attr_dev(object1, "title", "groups"); - add_location(object1, file, 99, 12, 2915); - add_location(span1, file, 100, 12, 3054); - add_location(button2, file, 98, 8, 2819); - attr_dev(object2, "id", "communes-img"); - attr_dev(object2, "class", "icons"); - attr_dev(object2, "type", "image/svg+xml"); - attr_dev(object2, "data", "/img/common/communes.svg"); - attr_dev(object2, "title", "communes"); - add_location(object2, file, 103, 12, 3204); - add_location(span2, file, 104, 12, 3349); - add_location(button3, file, 102, 8, 3102); - attr_dev(object3, "id", "coops-img"); - attr_dev(object3, "class", "icons"); - attr_dev(object3, "type", "image/svg+xml"); - attr_dev(object3, "data", "/img/common/coops.svg"); - attr_dev(object3, "title", "coops"); - add_location(object3, file, 107, 12, 3492); - add_location(span3, file, 108, 12, 3628); - add_location(button4, file, 106, 8, 3399); - attr_dev(object4, "id", "parties-img"); - attr_dev(object4, "class", "icons"); - attr_dev(object4, "type", "image/svg+xml"); - attr_dev(object4, "data", "/img/common/parties.svg"); - attr_dev(object4, "title", "parties"); - add_location(object4, file, 111, 12, 3781); - add_location(span4, file, 112, 12, 3923); - add_location(button5, file, 110, 8, 3682); - attr_dev(object5, "id", "logout-img"); - attr_dev(object5, "class", "icons"); - attr_dev(object5, "type", "image/svg+xml"); - attr_dev(object5, "data", "/img/profile/icons/logout.svg"); - attr_dev(object5, "title", ""); - add_location(object5, file, 115, 12, 4041); - add_location(span5, file, 116, 12, 4181); - attr_dev(button6, "id", "logout-button"); - add_location(button6, file, 114, 8, 3972); - attr_dev(div2, "id", "left-column"); - attr_dev(div2, "class", "pane"); - attr_dev(div2, "slot", "sidebar-left"); - add_location(div2, file, 93, 4, 2452); - set_style(profile_general, "display", "none"); - add_location(profile_general, file, 120, 8, 4281); - set_style(profile_groups, "display", "none"); - add_location(profile_groups, file, 121, 8, 4369); - set_style(profile_communes, "display", "none"); - add_location(profile_communes, file, 122, 8, 4455); - set_style(profile_coops, "display", "none"); - add_location(profile_coops, file, 123, 8, 4547); - set_style(profile_parties, "display", "none"); - add_location(profile_parties, file, 124, 8, 4630); - attr_dev(div3, "id", "main-column"); - attr_dev(div3, "slot", "main"); - add_location(div3, file, 119, 4, 4237); - add_location(pane_aligner, file, 92, 0, 2432); - }, - 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) { - insert_dev(target, div1, anchor); - append_dev(div1, div0); - append_dev(div0, p); - append_dev(div1, t1); - append_dev(div1, button0); - /*div1_binding*/ ctx[14](div1); - insert_dev(target, t2, anchor); - insert_dev(target, pane_aligner, anchor); - append_dev(pane_aligner, div2); - append_dev(div2, button1); - append_dev(button1, object0); - append_dev(button1, t3); - append_dev(button1, span0); - /*button1_binding*/ ctx[15](button1); - append_dev(div2, t5); - append_dev(div2, button2); - append_dev(button2, object1); - append_dev(button2, t6); - append_dev(button2, span1); - /*button2_binding*/ ctx[17](button2); - append_dev(div2, t8); - append_dev(div2, button3); - append_dev(button3, object2); - append_dev(button3, t9); - append_dev(button3, span2); - /*button3_binding*/ ctx[19](button3); - append_dev(div2, t11); - append_dev(div2, button4); - append_dev(button4, object3); - append_dev(button4, t12); - append_dev(button4, span3); - /*button4_binding*/ ctx[21](button4); - append_dev(div2, t14); - append_dev(div2, button5); - append_dev(button5, object4); - append_dev(button5, t15); - append_dev(button5, span4); - /*button5_binding*/ ctx[23](button5); - append_dev(div2, t17); - append_dev(div2, button6); - append_dev(button6, object5); - append_dev(button6, t18); - append_dev(button6, span5); - /*div2_binding*/ ctx[25](div2); - append_dev(pane_aligner, t20); - append_dev(pane_aligner, div3); - append_dev(div3, profile_general); - /*profile_general_binding*/ ctx[26](profile_general); - append_dev(div3, t21); - append_dev(div3, profile_groups); - /*profile_groups_binding*/ ctx[27](profile_groups); - append_dev(div3, t22); - append_dev(div3, profile_communes); - /*profile_communes_binding*/ ctx[28](profile_communes); - append_dev(div3, t23); - append_dev(div3, profile_coops); - /*profile_coops_binding*/ ctx[29](profile_coops); - append_dev(div3, t24); - append_dev(div3, profile_parties); - /*profile_parties_binding*/ ctx[30](profile_parties); - - if (!mounted) { - dispose = [ - listen_dev(button0, "click", /*click_handler*/ ctx[13], false, false, false), - listen_dev(button1, "click", /*click_handler_1*/ ctx[16], false, false, false), - listen_dev(button2, "click", /*click_handler_2*/ ctx[18], false, false, false), - listen_dev(button3, "click", /*click_handler_3*/ ctx[20], false, false, false), - listen_dev(button4, "click", /*click_handler_4*/ ctx[22], false, false, false), - listen_dev(button5, "click", /*click_handler_5*/ ctx[24], false, false, false), - listen_dev(button6, "click", AuthTools.logout, false, false, false) - ]; - - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div1); - /*div1_binding*/ ctx[14](null); - if (detaching) detach_dev(t2); - if (detaching) detach_dev(pane_aligner); - /*button1_binding*/ ctx[15](null); - /*button2_binding*/ ctx[17](null); - /*button3_binding*/ ctx[19](null); - /*button4_binding*/ ctx[21](null); - /*button5_binding*/ ctx[23](null); - /*div2_binding*/ ctx[25](null); - /*profile_general_binding*/ ctx[26](null); - /*profile_groups_binding*/ ctx[27](null); - /*profile_communes_binding*/ ctx[28](null); - /*profile_coops_binding*/ ctx[29](null); - /*profile_parties_binding*/ ctx[30](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('profile-component', slots, []); - AuthTools.redirectNotLogged(); - let root; - let general; - let groups; - let communes; - let coops; - let parties; - let panes; - let generalButton; - let groupsButton; - let communesButton; - let coopsButton; - let partiesButton; - let buttons; - let locationPopup; - let user = {}; - AuthTools.getUser(user); - - function changePane(pane, button) { - for (let p of panes) { - p.style.display = "none"; - } - - for (let b of buttons) { - styleField(b, 400, "#636363"); - } - - pane.style.display = "initial"; - styleField(button, 500, "#c52a28"); - } - - function styleField(div, weight, color) { - div.style.fontWeight = weight; - let svgObject = div.querySelector("object"); - let svgItem = svgFromObject(svgObject); - svgItem.setAttribute("fill", color); - } - - function fillFields() { - if (Object.keys(user).length != 0 && root != undefined) { - for (let b of buttons) { - styleField(b, 400, "#636363"); - } - - styleField(generalButton, 500, "#c52a28"); - } else { - setTimeout(fillFields, 100); - } - } - - function showLocationOverlay() { - $$invalidate(11, locationPopup.style.display = "block", locationPopup); - } - - setContext("profile-component", showLocationOverlay); - - onMount(() => { - $$invalidate(1, general.user = user, general); - panes = [general, groups, communes, coops, parties]; - buttons = [generalButton, groupsButton, communesButton, coopsButton, partiesButton]; - fillFields(); - $$invalidate(1, general.style.display = "initial", general); - }); - - const writable_props = []; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - const click_handler = () => $$invalidate(11, locationPopup.style.display = "none", locationPopup); - - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - locationPopup = $$value; - $$invalidate(11, locationPopup); - }); - } - - function button1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - generalButton = $$value; - $$invalidate(6, generalButton); - }); - } - - const click_handler_1 = () => changePane(general, generalButton); - - function button2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - groupsButton = $$value; - $$invalidate(7, groupsButton); - }); - } - - const click_handler_2 = () => changePane(groups, groupsButton); - - function button3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - communesButton = $$value; - $$invalidate(8, communesButton); - }); - } - - const click_handler_3 = () => changePane(communes, communesButton); - - function button4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - coopsButton = $$value; - $$invalidate(9, coopsButton); - }); - } - - const click_handler_4 = () => changePane(coops, coopsButton); - - function button5_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - partiesButton = $$value; - $$invalidate(10, partiesButton); - }); - } - - const click_handler_5 = () => changePane(parties, partiesButton); - - function div2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - root = $$value; - $$invalidate(0, root); - }); - } - - function profile_general_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - general = $$value; - $$invalidate(1, general); - }); - } - - function profile_groups_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - groups = $$value; - $$invalidate(2, groups); - }); - } - - function profile_communes_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - communes = $$value; - $$invalidate(3, communes); - }); - } - - function profile_coops_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - coops = $$value; - $$invalidate(4, coops); - }); - } - - function profile_parties_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - parties = $$value; - $$invalidate(5, parties); - }); - } - - $$self.$capture_state = () => ({ - onMount, - afterUpdate, - setContext, - AuthTools, - svgFromObject, - root, - general, - groups, - communes, - coops, - parties, - panes, - generalButton, - groupsButton, - communesButton, - coopsButton, - partiesButton, - buttons, - locationPopup, - user, - changePane, - styleField, - fillFields, - showLocationOverlay - }); - - $$self.$inject_state = $$props => { - if ('root' in $$props) $$invalidate(0, root = $$props.root); - if ('general' in $$props) $$invalidate(1, general = $$props.general); - if ('groups' in $$props) $$invalidate(2, groups = $$props.groups); - if ('communes' in $$props) $$invalidate(3, communes = $$props.communes); - if ('coops' in $$props) $$invalidate(4, coops = $$props.coops); - if ('parties' in $$props) $$invalidate(5, parties = $$props.parties); - if ('panes' in $$props) panes = $$props.panes; - if ('generalButton' in $$props) $$invalidate(6, generalButton = $$props.generalButton); - if ('groupsButton' in $$props) $$invalidate(7, groupsButton = $$props.groupsButton); - if ('communesButton' in $$props) $$invalidate(8, communesButton = $$props.communesButton); - if ('coopsButton' in $$props) $$invalidate(9, coopsButton = $$props.coopsButton); - if ('partiesButton' in $$props) $$invalidate(10, partiesButton = $$props.partiesButton); - if ('buttons' in $$props) buttons = $$props.buttons; - if ('locationPopup' in $$props) $$invalidate(11, locationPopup = $$props.locationPopup); - if ('user' in $$props) user = $$props.user; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - root, - general, - groups, - communes, - coops, - parties, - generalButton, - groupsButton, - communesButton, - coopsButton, - partiesButton, - locationPopup, - changePane, - click_handler, - div1_binding, - button1_binding, - click_handler_1, - button2_binding, - click_handler_2, - button3_binding, - click_handler_3, - button4_binding, - click_handler_4, - button5_binding, - click_handler_5, - div2_binding, - profile_general_binding, - profile_groups_binding, - profile_communes_binding, - profile_coops_binding, - profile_parties_binding - ]; -} - -class Profile_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - 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("profile-component", Profile_component); - -export { Profile_component as default }; +import{S as e,i as t,a as o,b as n,s as i,e as s,c as l,n as r,d as m,f as a,l as p,g as u,r as c,q as d,h as g,o as f,p as h,j as b,y as j}from"./index-db20528a.js";import{w as y}from"./index-720c0a59.js";import*as v from"../../../../../../../../../js/libraries/authTools.js";import{svgFromObject as x}from"../../../../../../../../../js/libraries/miscTools.js";import"../../../../../../../../../js/components/pane-aligner.js";import"../../../../../../../../../js/components/profile-general.js";import"../../../../../../../../../js/components/profile-groups.js";import"../../../../../../../../../js/components/profile-communes.js";import"../../../../../../../../../js/components/profile-coops.js";import"../../../../../../../../../js/components/profile-parties.js";import"../../../../../../../../../js/components/groups-add-component.js";function w(e){let t,o,i,m,a,p,c,d,g;return{c(){t=s("profile-general"),o=l(),i=s("profile-groups"),m=l(),a=s("profile-communes"),p=l(),c=s("profile-coops"),d=l(),g=s("profile-parties"),j(t,"display","none"),j(i,"display","none"),j(a,"display","none"),j(c,"display","none"),j(g,"display","none")},m(s,l){n(s,t,l),e[25](t),n(s,o,l),n(s,i,l),e[26](i),n(s,m,l),n(s,a,l),e[27](a),n(s,p,l),n(s,c,l),e[28](c),n(s,d,l),n(s,g,l),e[29](g)},p:r,d(n){n&&u(t),e[25](null),n&&u(o),n&&u(i),e[26](null),n&&u(m),n&&u(a),e[27](null),n&&u(p),n&&u(c),e[28](null),n&&u(d),n&&u(g),e[29](null)}}}function T(e){let t,o=1==e[11]&&w(e);return{c(){o&&o.c(),t=h()},m(e,i){o&&o.m(e,i),n(e,t,i)},p(e,n){1==e[11]?o?o.p(e,n):(o=w(e),o.c(),o.m(t.parentNode,t)):o&&(o.d(1),o=null)},d(e){o&&o.d(e),e&&u(t)}}}function k(e){let t,o,d,g,f,h,b,j,y,x,w,k,L,H,M,q,E,N=e[11],R=T(e);return{c(){t=s("pane-aligner"),o=s("div"),d=s("button"),d.innerHTML=' \n general',g=l(),f=s("button"),f.innerHTML=' \n groups',h=l(),b=s("button"),b.innerHTML=' \n communes',j=l(),y=s("button"),y.innerHTML=' \n cooperatives',x=l(),w=s("button"),w.innerHTML=' \n parties',k=l(),L=s("button"),L.innerHTML=' \n logout',H=l(),M=s("div"),R.c(),this.c=r,m(L,"id","logout-button"),m(o,"id","left-column"),m(o,"class","pane"),m(o,"slot","sidebar-left"),m(M,"id","main-column"),m(M,"slot","main")},m(i,s){n(i,t,s),a(t,o),a(o,d),e[14](d),a(o,g),a(o,f),e[16](f),a(o,h),a(o,b),e[18](b),a(o,j),a(o,y),e[20](y),a(o,x),a(o,w),e[22](w),a(o,k),a(o,L),e[24](o),a(t,H),a(t,M),R.m(M,null),q||(E=[p(d,"click",e[15]),p(f,"click",e[17]),p(b,"click",e[19]),p(y,"click",e[21]),p(w,"click",e[23]),p(L,"click",v.logout)],q=!0)},p(e,t){2048&t[0]&&i(N,N=e[11])?(R.d(1),R=T(e),R.c(),R.m(M,null)):R.p(e,t)},i:r,o:r,d(o){o&&u(t),e[14](null),e[16](null),e[18](null),e[20](null),e[22](null),e[24](null),R.d(o),q=!1,c(E)}}}function L(e){return null!=e&&null!=e}function H(e,t,o){let n,i,s,l,r,m,a,p,u,c,h,j,w,T;v.redirectNotLogged();let k={},H=y(0);d(e,H,(e=>o(11,n=e)));let M=y(0);function q(e,t){for(let e of p)e.style.display="none";for(let e of T)E(e,400,"#636363");e.style.display="initial",E(t,500,"#c52a28")}function E(e,t,o){let n=e.querySelector("object");if(null==n){setTimeout((()=>E(e,t,o)),100)}else{let i=x(n);if(null==i){setTimeout((()=>E(e,t,o)),100)}else e.style.fontWeight=t,i.setAttribute("fill",o)}}function N(){if(0!=Object.keys(k).length&&null!=i){for(let e of T)E(e,400,"#636363");E(T[0],500,"#c52a28")}else setTimeout(N,100)}function R(){if(p=[s,l,r,m,a],T=[u,c,h,j,w],1==n&&p.every((e=>L(e)))&&T.every((e=>L(e))))p=[s,l,r,m,a],T=[u,c,h,j,w],N(),o(1,s.style.display="initial",s);else{setTimeout((()=>R()),100)}}v.getUser(k,H),g("profile-component",{user:k,maps:{},reloadTrigger:function(){M.update((e=>e+1))}}),f((()=>{R()}));return[i,s,l,r,m,a,u,c,h,j,w,n,H,q,function(e){b[e?"unshift":"push"]((()=>{u=e,o(6,u)}))},()=>q(s,u),function(e){b[e?"unshift":"push"]((()=>{c=e,o(7,c)}))},()=>q(l,c),function(e){b[e?"unshift":"push"]((()=>{h=e,o(8,h)}))},()=>q(r,h),function(e){b[e?"unshift":"push"]((()=>{j=e,o(9,j)}))},()=>q(m,j),function(e){b[e?"unshift":"push"]((()=>{w=e,o(10,w)}))},()=>q(a,w),function(e){b[e?"unshift":"push"]((()=>{i=e,o(0,i)}))},function(e){b[e?"unshift":"push"]((()=>{s=e,o(1,s)}))},function(e){b[e?"unshift":"push"]((()=>{l=e,o(2,l)}))},function(e){b[e?"unshift":"push"]((()=>{r=e,o(3,r)}))},function(e){b[e?"unshift":"push"]((()=>{m=e,o(4,m)}))},function(e){b[e?"unshift":"push"]((()=>{a=e,o(5,a)}))}]}class M extends e{constructor(e){super(),this.shadowRoot.innerHTML="",t(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},H,k,i,{},null,[-1,-1]),e&&e.target&&n(e.target,this,e.anchor)}}customElements.define("profile-component",M);export{M as default}; diff --git a/Server/public/js/components/profile-coops.js b/Server/public/js/components/profile-coops.js new file mode 100644 index 0000000..72db3f6 --- /dev/null +++ b/Server/public/js/components/profile-coops.js @@ -0,0 +1 @@ +import{S as t,i as s,a as e,b as o,s as a,e as r,c as i,n,y as c,g as d,o as l}from"./index-db20528a.js";import"../../../../../../../../../js/libraries/authTools.js";function p(t){let s,e,a;return{c(){s=r("h3"),s.textContent="Under development",e=i(),a=r("p"),a.innerHTML='Visit https://discord.gg/Qk8KUk787z and ask for your cooperative to be added.',this.c=n,c(a,"position","relative"),c(a,"margin-top","2rem")},m(t,r){o(t,s,r),o(t,e,r),o(t,a,r)},p:n,i:n,o:n,d(t){t&&d(s),t&&d(e),t&&d(a)}}}function h(t){return l((()=>{})),[]}class m extends t{constructor(t){super(),this.shadowRoot.innerHTML="",s(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},h,p,a,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("profile-coops",m);export{m as default}; diff --git a/Server/public/js/components/profile-general.js b/Server/public/js/components/profile-general.js index cbb7aec..2046df9 100644 --- a/Server/public/js/components/profile-general.js +++ b/Server/public/js/components/profile-general.js @@ -1,661 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, c as setContext, e as globals, f as element, h as space, B as text, n as noop, k as attr_dev, j as add_location, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks, H as is_function } from './index-998178c7.js'; -import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js'; -import '../../../../../../../../../js/components/select-component.js'; -import '../../../../../../../../../js/components/switch-component.js'; - -/* src\profile\profile-general.svelte generated by Svelte v3.52.0 */ - -const { Object: Object_1 } = globals; -const file = "src\\profile\\profile-general.svelte"; - -function create_fragment(ctx) { - let section_1; - let h2; - let t1; - let div4; - let div0; - let span0; - let t3; - let span1; - let t4; - let div3; - let button0; - let t6; - let div2; - let input0; - let t7; - let div1; - let t8; - let div9; - let div7; - let div5; - let span2; - let t10; - let span3; - let t11; - let div6; - let button1; - let t12; - let object0; - let t13; - let div8; - let button2; - let t15; - let input1; - let t16; - let button3; - let object1; - let mounted; - let dispose; - - const block = { - c: function create() { - section_1 = element("section"); - h2 = element("h2"); - h2.textContent = "General"; - t1 = space(); - div4 = element("div"); - div0 = element("div"); - span0 = element("span"); - span0.textContent = "Email:"; - t3 = space(); - span1 = element("span"); - t4 = space(); - div3 = element("div"); - button0 = element("button"); - button0.textContent = "save"; - t6 = space(); - div2 = element("div"); - input0 = element("input"); - t7 = space(); - div1 = element("div"); - t8 = space(); - div9 = element("div"); - div7 = element("div"); - div5 = element("div"); - span2 = element("span"); - span2.textContent = "Password:"; - t10 = space(); - span3 = element("span"); - t11 = space(); - div6 = element("div"); - button1 = element("button"); - t12 = text("change\r\n "); - object0 = element("object"); - t13 = space(); - div8 = element("div"); - button2 = element("button"); - button2.textContent = "save"; - t15 = space(); - input1 = element("input"); - t16 = space(); - button3 = element("button"); - object1 = element("object"); - this.c = noop; - attr_dev(h2, "class", "title-highlight"); - add_location(h2, file, 133, 4, 3608); - add_location(span0, file, 136, 12, 3804); - attr_dev(span1, "id", "signup-email-msg"); - add_location(span1, file, 137, 12, 3837); - attr_dev(div0, "class", "title-msg"); - add_location(div0, file, 135, 8, 3767); - attr_dev(button0, "id", "save-email"); - attr_dev(button0, "class", "save-button"); - add_location(button0, file, 140, 12, 3983); - attr_dev(input0, "id", "emailInput"); - attr_dev(input0, "class", "text-input"); - attr_dev(input0, "type", "text"); - add_location(input0, file, 142, 16, 4148); - attr_dev(div1, "class", "ghost-input"); - add_location(div1, file, 143, 16, 4334); - attr_dev(div2, "class", "input-wrapper"); - add_location(div2, file, 141, 12, 4103); - attr_dev(div3, "id", "emailInputDiv"); - add_location(div3, file, 139, 8, 3919); - add_location(div4, file, 134, 4, 3654); - add_location(span2, file, 150, 16, 4661); - attr_dev(span3, "id", "signup-password-msg"); - add_location(span3, file, 151, 16, 4701); - attr_dev(div5, "class", "title-msg"); - add_location(div5, file, 149, 12, 4620); - attr_dev(object0, "type", "image/svg+xml"); - attr_dev(object0, "data", "/img/profile/icons/pencil.svg"); - attr_dev(object0, "title", "pencil-icon"); - add_location(object0, file, 156, 20, 4984); - attr_dev(button1, "id", "change-password"); - add_location(button1, file, 155, 16, 4895); - attr_dev(div6, "id", "change-password-div"); - add_location(div6, file, 154, 12, 4817); - attr_dev(div7, "id", "change-password-line"); - add_location(div7, file, 148, 8, 4575); - attr_dev(button2, "id", "save-password"); - attr_dev(button2, "class", "save-button"); - add_location(button2, file, 161, 12, 5237); - attr_dev(input1, "id", "passwordInput"); - attr_dev(input1, "class", "text-input"); - attr_dev(input1, "type", "password"); - add_location(input1, file, 162, 12, 5366); - attr_dev(object1, "type", "image/svg+xml"); - attr_dev(object1, "data", "/img/auth/eye_icon.svg"); - attr_dev(object1, "title", "eye icon"); - add_location(object1, file, 164, 16, 5627); - attr_dev(button3, "class", "eye-icon"); - add_location(button3, file, 163, 12, 5467); - attr_dev(div8, "id", "change-password-input-div"); - add_location(div8, file, 160, 8, 5152); - attr_dev(div9, "id", "change-password-line-wrapper"); - add_location(div9, file, 147, 4, 4419); - attr_dev(section_1, "id", "general-section"); - add_location(section_1, file, 132, 0, 3552); - }, - 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) { - insert_dev(target, section_1, anchor); - append_dev(section_1, h2); - append_dev(section_1, t1); - append_dev(section_1, div4); - append_dev(div4, div0); - append_dev(div0, span0); - append_dev(div0, t3); - append_dev(div0, span1); - /*span1_binding*/ ctx[18](span1); - append_dev(div4, t4); - append_dev(div4, div3); - append_dev(div3, button0); - /*button0_binding*/ ctx[19](button0); - append_dev(div3, t6); - append_dev(div3, div2); - append_dev(div2, input0); - /*input0_binding*/ ctx[20](input0); - append_dev(div2, t7); - append_dev(div2, div1); - /*div3_binding*/ ctx[23](div3); - /*div4_binding*/ ctx[24](div4); - append_dev(section_1, t8); - append_dev(section_1, div9); - append_dev(div9, div7); - append_dev(div7, div5); - append_dev(div5, span2); - append_dev(div5, t10); - append_dev(div5, span3); - /*span3_binding*/ ctx[25](span3); - append_dev(div7, t11); - append_dev(div7, div6); - append_dev(div6, button1); - append_dev(button1, t12); - append_dev(button1, object0); - /*div6_binding*/ ctx[26](div6); - append_dev(div9, t13); - append_dev(div9, div8); - append_dev(div8, button2); - /*button2_binding*/ ctx[27](button2); - append_dev(div8, t15); - append_dev(div8, input1); - /*input1_binding*/ ctx[28](input1); - append_dev(div8, t16); - append_dev(div8, button3); - append_dev(button3, object1); - /*button3_binding*/ ctx[29](button3); - /*div8_binding*/ ctx[31](div8); - /*div9_binding*/ ctx[32](div9); - /*section_1_binding*/ ctx[33](section_1); - - if (!mounted) { - dispose = [ - listen_dev(button0, "click", /*saveEmail*/ ctx[14], false, false, false), - listen_dev(input0, "click", /*click_handler*/ ctx[21], false, false, false), - listen_dev(input0, "input", /*input_handler*/ ctx[22], false, false, false), - listen_dev( - div4, - "mouseenter", - function () { - if (is_function(/*emailDiv*/ ctx[11].focused = true)) (/*emailDiv*/ ctx[11].focused = true).apply(this, arguments); - }, - false, - false, - false - ), - listen_dev( - div4, - "mouseleave", - function () { - if (is_function(/*emailDiv*/ ctx[11].focused = false)) (/*emailDiv*/ ctx[11].focused = false).apply(this, arguments); - }, - false, - false, - false - ), - listen_dev(button1, "click", /*launchChangePassword*/ ctx[15], false, false, false), - listen_dev(button2, "click", /*savePassword*/ ctx[16], false, false, false), - listen_dev(button3, "click", /*click_handler_1*/ ctx[30], false, false, false), - listen_dev( - div9, - "mouseenter", - function () { - if (is_function(/*passwordDiv*/ ctx[10].focused = true)) (/*passwordDiv*/ ctx[10].focused = true).apply(this, arguments); - }, - false, - false, - false - ), - listen_dev( - div9, - "mouseleave", - function () { - if (is_function(/*passwordDiv*/ ctx[10].focused = false)) (/*passwordDiv*/ ctx[10].focused = false).apply(this, arguments); - }, - false, - false, - false - ) - ]; - - mounted = true; - } - }, - p: function update(new_ctx, dirty) { - ctx = new_ctx; - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(section_1); - /*span1_binding*/ ctx[18](null); - /*button0_binding*/ ctx[19](null); - /*input0_binding*/ ctx[20](null); - /*div3_binding*/ ctx[23](null); - /*div4_binding*/ ctx[24](null); - /*span3_binding*/ ctx[25](null); - /*div6_binding*/ ctx[26](null); - /*button2_binding*/ ctx[27](null); - /*input1_binding*/ ctx[28](null); - /*button3_binding*/ ctx[29](null); - /*div8_binding*/ ctx[31](null); - /*div9_binding*/ ctx[32](null); - /*section_1_binding*/ ctx[33](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function resizeInput(el) { - el.nextElementSibling.innerHTML = el.value; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('profile-general', slots, []); - let { user = null } = $$props; - - // Main code - let emailInput; - - let section; - let saveEmailButton; - let changePasswordInputDiv; - let changePasswordMsg; - let savePasswordButton; - let passwordInput; - let changePasswordDiv; - let passwordVisibilityButton; - let emailMsg; - let passwordDiv; - let emailDiv; - let emailInputDiv; - let prevEmail; - - function showSaveButton(button) { - prevEmail = emailInput.value; - button.style.display = "initial"; - $$invalidate(9, emailMsg.style.display = "inline", emailMsg); - let windowWidth = window.innerWidth; - - if (windowWidth < 1100) { - $$invalidate(12, emailInputDiv.style.marginTop = "1rem", emailInputDiv); - $$invalidate(11, emailDiv.style.flexDirection = "column", emailDiv); - } //emailInput.style.width = "19rem" - } - - function saveEmail() { - let email = emailInput.value; - - if (AuthTools.checkEmail(email, emailMsg)) { - if (email != user.email) { - AuthTools.changeUser("email", email, user); - } - - resetEmailField(); - } - } - - function resetEmailField() { - if (prevEmail != undefined) { - $$invalidate(0, emailInput.value = prevEmail, emailInput); - } - - $$invalidate(0, emailInput.style.width = "100%", emailInput); - $$invalidate(9, emailMsg.style.display = "none", emailMsg); - $$invalidate(11, emailDiv.style.flexDirection = "row", emailDiv); - $$invalidate(12, emailInputDiv.style.marginTop = "0rem", emailInputDiv); - $$invalidate(2, saveEmailButton.style.display = "none", saveEmailButton); - $$invalidate(9, emailMsg.innerHTML = "", emailMsg); - } - - function launchChangePassword() { - let windowWidth = window.innerWidth; - - if (windowWidth < 1100) { - $$invalidate(3, changePasswordInputDiv.style.display = "flex", changePasswordInputDiv); - } else { - $$invalidate(3, changePasswordInputDiv.style.display = "initial", changePasswordInputDiv); - } - - $$invalidate(7, changePasswordDiv.style.display = "none", changePasswordDiv); - passwordInput.focus(); - } - - function savePassword() { - let password = passwordInput.value; - - if (AuthTools.checkPassword(password, changePasswordMsg)) { - if (password != user.password) { - AuthTools.changeUser("password", password, user); - } - - $$invalidate(4, changePasswordMsg.innerHTML = "", changePasswordMsg); - resetPasswordField(); - } - } - - function resetPasswordField() { - $$invalidate(3, changePasswordInputDiv.style.display = "none", changePasswordInputDiv); - $$invalidate(7, changePasswordDiv.style.display = "initial", changePasswordDiv); - $$invalidate(4, changePasswordMsg.innerHTML = "", changePasswordMsg); - } - - function fillFields() { - if (user != null && Object.keys(user).length != 0 && section != undefined) { - $$invalidate(0, emailInput.value = user.email, emailInput); - } else { - setTimeout(fillFields, 10); - } - } - - onMount(() => { - fillFields(); - - document.addEventListener("click", function (event) { - if (passwordDiv.focused) { - resetEmailField(); - } else if (emailDiv.focused) { - resetPasswordField(); - } else { - resetEmailField(); - resetPasswordField(); - } - }); - }); - - const writable_props = ['user']; - - Object_1.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function span1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailMsg = $$value; - $$invalidate(9, emailMsg); - }); - } - - function button0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - saveEmailButton = $$value; - $$invalidate(2, saveEmailButton); - }); - } - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailInput = $$value; - $$invalidate(0, emailInput); - }); - } - - const click_handler = () => showSaveButton(saveEmailButton); - const input_handler = () => resizeInput(emailInput); - - function div3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailInputDiv = $$value; - $$invalidate(12, emailInputDiv); - }); - } - - function div4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailDiv = $$value; - $$invalidate(11, emailDiv); - }); - } - - function span3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - changePasswordMsg = $$value; - $$invalidate(4, changePasswordMsg); - }); - } - - function div6_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - changePasswordDiv = $$value; - $$invalidate(7, changePasswordDiv); - }); - } - - function button2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - savePasswordButton = $$value; - $$invalidate(5, savePasswordButton); - }); - } - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordInput = $$value; - $$invalidate(6, passwordInput); - }); - } - - function button3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordVisibilityButton = $$value; - $$invalidate(8, passwordVisibilityButton); - }); - } - - const click_handler_1 = () => AuthTools.changePasswordVisibility(passwordVisibilityButton); - - function div8_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - changePasswordInputDiv = $$value; - $$invalidate(3, changePasswordInputDiv); - }); - } - - function div9_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordDiv = $$value; - $$invalidate(10, passwordDiv); - }); - } - - function section_1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - section = $$value; - $$invalidate(1, section); - }); - } - - $$self.$$set = $$props => { - if ('user' in $$props) $$invalidate(17, user = $$props.user); - }; - - $$self.$capture_state = () => ({ - onMount, - setContext, - AuthTools, - user, - emailInput, - section, - saveEmailButton, - changePasswordInputDiv, - changePasswordMsg, - savePasswordButton, - passwordInput, - changePasswordDiv, - passwordVisibilityButton, - emailMsg, - passwordDiv, - emailDiv, - emailInputDiv, - prevEmail, - showSaveButton, - saveEmail, - resetEmailField, - launchChangePassword, - savePassword, - resetPasswordField, - fillFields, - resizeInput - }); - - $$self.$inject_state = $$props => { - if ('user' in $$props) $$invalidate(17, user = $$props.user); - if ('emailInput' in $$props) $$invalidate(0, emailInput = $$props.emailInput); - if ('section' in $$props) $$invalidate(1, section = $$props.section); - if ('saveEmailButton' in $$props) $$invalidate(2, saveEmailButton = $$props.saveEmailButton); - if ('changePasswordInputDiv' in $$props) $$invalidate(3, changePasswordInputDiv = $$props.changePasswordInputDiv); - if ('changePasswordMsg' in $$props) $$invalidate(4, changePasswordMsg = $$props.changePasswordMsg); - if ('savePasswordButton' in $$props) $$invalidate(5, savePasswordButton = $$props.savePasswordButton); - if ('passwordInput' in $$props) $$invalidate(6, passwordInput = $$props.passwordInput); - if ('changePasswordDiv' in $$props) $$invalidate(7, changePasswordDiv = $$props.changePasswordDiv); - if ('passwordVisibilityButton' in $$props) $$invalidate(8, passwordVisibilityButton = $$props.passwordVisibilityButton); - if ('emailMsg' in $$props) $$invalidate(9, emailMsg = $$props.emailMsg); - if ('passwordDiv' in $$props) $$invalidate(10, passwordDiv = $$props.passwordDiv); - if ('emailDiv' in $$props) $$invalidate(11, emailDiv = $$props.emailDiv); - if ('emailInputDiv' in $$props) $$invalidate(12, emailInputDiv = $$props.emailInputDiv); - if ('prevEmail' in $$props) prevEmail = $$props.prevEmail; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - emailInput, - section, - saveEmailButton, - changePasswordInputDiv, - changePasswordMsg, - savePasswordButton, - passwordInput, - changePasswordDiv, - passwordVisibilityButton, - emailMsg, - passwordDiv, - emailDiv, - emailInputDiv, - showSaveButton, - saveEmail, - launchChangePassword, - savePassword, - user, - span1_binding, - button0_binding, - input0_binding, - click_handler, - input_handler, - div3_binding, - div4_binding, - span3_binding, - div6_binding, - button2_binding, - input1_binding, - button3_binding, - click_handler_1, - div8_binding, - div9_binding, - section_1_binding - ]; -} - -class Profile_general extends SvelteElement { - constructor(options) { - super(); - - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { user: 17 }, - null, - [-1, -1] - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["user"]; - } - - get user() { - return this.$$.ctx[17]; - } - - set user(user) { - this.$$set({ user }); - flush(); - } -} - -customElements.define("profile-general", Profile_general); - -export { Profile_general as default }; +import{S as e,i,a as t,b as n,s,e as o,c as a,v as r,n as l,d,y as c,f as p,l as u,g as m,r as h,m as f,o as g,z as v,j as y}from"./index-db20528a.js";import*as w from"../../../../../../../../../js/libraries/authTools.js";import"../../../../../../../../../js/components/select-component.js";import"../../../../../../../../../js/components/switch-component.js";function b(e){let i,t,s,f,g,y,w,b,x,j,k,T,I,L,H,M,C,D,E,z,P,R,S,U,V,W,G,O,_,q,A,B,F,J,K,N,Q,X,Y,Z,$,ee,ie=e[13].verified+"";return{c(){i=o("section"),t=o("h2"),t.textContent="General",s=a(),f=o("div"),g=o("div"),y=o("span"),y.textContent="Email:",w=a(),b=o("span"),x=a(),j=o("div"),k=o("button"),k.textContent="save",T=a(),I=o("div"),L=o("input"),H=a(),M=o("div"),C=a(),D=o("div"),E=o("div"),z=o("div"),P=o("span"),P.textContent="Password:",R=a(),S=o("span"),U=a(),V=o("div"),W=o("button"),W.innerHTML='change\n ',G=a(),O=o("div"),_=o("button"),_.textContent="save",q=a(),A=o("input"),B=a(),F=o("button"),F.innerHTML='',J=a(),K=o("div"),N=o("div"),Q=o("span"),Q.textContent="Verified:",X=a(),Y=o("span"),Z=r(ie),this.c=l,d(t,"class","title-highlight"),d(b,"id","signup-email-msg"),d(g,"class","title-msg"),d(k,"id","save-email"),d(k,"class","save-button"),d(L,"id","emailInput"),d(L,"class","text-input"),d(L,"type","text"),d(M,"class","ghost-input"),d(I,"class","input-wrapper"),d(j,"id","emailInputDiv"),d(S,"id","signup-password-msg"),d(z,"class","title-msg"),d(W,"id","change-password"),d(V,"id","change-password-div"),d(E,"id","change-password-line"),d(_,"id","save-password"),d(_,"class","save-button"),d(A,"id","passwordInput"),d(A,"class","text-input"),d(A,"type","password"),d(F,"class","eye-icon"),d(O,"id","change-password-input-div"),d(D,"id","change-password-line-wrapper"),c(Y,"color",e[13].verified?"green":"red"),d(N,"id","verifiedDiv"),d(i,"id","general-section")},m(o,a){n(o,i,a),p(i,t),p(i,s),p(i,f),p(f,g),p(g,y),p(g,w),p(g,b),e[18](b),p(f,x),p(f,j),p(j,k),e[19](k),p(j,T),p(j,I),p(I,L),e[20](L),p(I,H),p(I,M),e[23](j),e[24](f),p(i,C),p(i,D),p(D,E),p(E,z),p(z,P),p(z,R),p(z,S),e[25](S),p(E,U),p(E,V),p(V,W),e[26](V),p(D,G),p(D,O),p(O,_),e[27](_),p(O,q),p(O,A),e[28](A),p(O,B),p(O,F),e[29](F),e[31](O),e[32](D),p(i,J),p(i,K),p(K,N),p(N,Q),p(N,X),p(N,Y),p(Y,Z),e[33](i),$||(ee=[u(k,"click",e[15]),u(L,"click",e[21]),u(L,"input",e[22]),u(f,"mouseenter",(function(){v(e[11].focused=!0)&&(e[11].focused=!0).apply(this,arguments)})),u(f,"mouseleave",(function(){v(e[11].focused=!1)&&(e[11].focused=!1).apply(this,arguments)})),u(W,"click",e[16]),u(_,"click",e[17]),u(F,"click",e[30]),u(D,"mouseenter",(function(){v(e[10].focused=!0)&&(e[10].focused=!0).apply(this,arguments)})),u(D,"mouseleave",(function(){v(e[10].focused=!1)&&(e[10].focused=!1).apply(this,arguments)}))],$=!0)},p(i,t){e=i},i:l,o:l,d(t){t&&m(i),e[18](null),e[19](null),e[20](null),e[23](null),e[24](null),e[25](null),e[26](null),e[27](null),e[28](null),e[29](null),e[31](null),e[32](null),e[33](null),$=!1,h(ee)}}}function x(e,i,t){let n,s,o,a,r,l,d,c,p,u,m,h,v,b,x=f("profile-component").user;function j(e){b=n.value,e.style.display="initial",t(9,u.style.display="inline",u),window.innerWidth<1100&&(t(12,v.style.marginTop="1rem",v),t(11,h.style.flexDirection="column",h))}function k(){null!=b&&t(0,n.value=b,n),t(0,n.style.width="100%",n),t(9,u.style.display="none",u),t(11,h.style.flexDirection="row",h),t(12,v.style.marginTop="0rem",v),t(2,o.style.display="none",o),t(9,u.innerHTML="",u)}function T(){t(3,a.style.display="none",a),t(7,c.style.display="initial",c),t(4,r.innerHTML="",r)}function I(){null!=x&&0!=Object.keys(x).length&&null!=s?t(0,n.value=x.email,n):setTimeout(I,10)}g((()=>{I(),document.addEventListener("click",(function(e){m.focused?k():(h.focused||k(),T())}))}));return[n,s,o,a,r,l,d,c,p,u,m,h,v,x,j,function(){let e=n.value;w.checkEmail(e,u)&&(e!=x.email&&w.changeUser("email",e,x),k())},function(){let e=window.innerWidth;t(3,a.style.display=e<1100?"flex":"initial",a),t(7,c.style.display="none",c),d.focus()},function(){let e=d.value;w.checkPassword(e,r)&&(e!=x.password&&w.changeUser("password",e,x),t(4,r.innerHTML="",r),T())},function(e){y[e?"unshift":"push"]((()=>{u=e,t(9,u)}))},function(e){y[e?"unshift":"push"]((()=>{o=e,t(2,o)}))},function(e){y[e?"unshift":"push"]((()=>{n=e,t(0,n)}))},()=>j(o),()=>{var e;(e=n).nextElementSibling.innerHTML=e.value},function(e){y[e?"unshift":"push"]((()=>{v=e,t(12,v)}))},function(e){y[e?"unshift":"push"]((()=>{h=e,t(11,h)}))},function(e){y[e?"unshift":"push"]((()=>{r=e,t(4,r)}))},function(e){y[e?"unshift":"push"]((()=>{c=e,t(7,c)}))},function(e){y[e?"unshift":"push"]((()=>{l=e,t(5,l)}))},function(e){y[e?"unshift":"push"]((()=>{d=e,t(6,d)}))},function(e){y[e?"unshift":"push"]((()=>{p=e,t(8,p)}))},()=>w.changePasswordVisibility(p),function(e){y[e?"unshift":"push"]((()=>{a=e,t(3,a)}))},function(e){y[e?"unshift":"push"]((()=>{m=e,t(10,m)}))},function(e){y[e?"unshift":"push"]((()=>{s=e,t(1,s)}))}]}class j extends e{constructor(e){super(),this.shadowRoot.innerHTML="",i(this,{target:this.shadowRoot,props:t(this.attributes),customElement:!0},x,b,s,{},null,[-1,-1]),e&&e.target&&n(e.target,this,e.anchor)}}customElements.define("profile-general",j);export{j as default}; diff --git a/Server/public/js/components/profile-groups.js b/Server/public/js/components/profile-groups.js index a41e9c7..d8260d0 100644 --- a/Server/public/js/components/profile-groups.js +++ b/Server/public/js/components/profile-groups.js @@ -1,704 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, w as validate_store, x as component_subscribe, g as getContext, o as onMount, y as empty, n as noop, p as detach_dev, q as binding_callbacks, f as element, h as space, B as text, j as add_location, k as attr_dev, l as append_dev, K as set_input_value, m as listen_dev, C as set_data_dev, r as run_all } from './index-998178c7.js'; -import { w as writable } from './index-f9998ce7.js'; -import { getData } from '../../../../../../../../../js/libraries/serverTools.js'; -import '../../../../../../../../../js/components/select-component.js'; -import '../../../../../../../../../js/components/switch-component.js'; - -/* src\profile\profile-groups.svelte generated by Svelte v3.52.0 */ -const file = "src\\profile\\profile-groups.svelte"; - -// (115:4) {#if $loaded==1} -function create_if_block(ctx) { - let h2; - let t1; - let h30; - let t3; - let section0; - let div2; - let div1; - let span0; - let t5; - let div0; - let button0; - let t6_value = /*getAddress*/ ctx[13](/*user_groups*/ ctx[1][0]) + ""; - let t6; - let t7; - let object0; - let t8; - let div5; - let div4; - let span1; - let t10; - let div3; - let button1; - let t12; - let input0; - let t13; - let button2; - let object1; - let t14; - let div8; - let div7; - let span2; - let t16; - let div6; - let button3; - let t18; - let input1; - let t19; - let button4; - let object2; - let t20; - let h31; - let t22; - let section1; - let mounted; - let dispose; - - const block = { - c: function create() { - h2 = element("h2"); - h2.textContent = "Groups"; - t1 = space(); - h30 = element("h3"); - h30.textContent = "My group"; - t3 = space(); - section0 = element("section"); - div2 = element("div"); - div1 = element("div"); - span0 = element("span"); - span0.textContent = "Location:"; - t5 = space(); - div0 = element("div"); - button0 = element("button"); - t6 = text(t6_value); - t7 = space(); - object0 = element("object"); - t8 = space(); - div5 = element("div"); - div4 = element("div"); - span1 = element("span"); - span1.textContent = "Members:"; - t10 = space(); - div3 = element("div"); - button1 = element("button"); - button1.textContent = "save"; - t12 = space(); - input0 = element("input"); - t13 = space(); - button2 = element("button"); - object1 = element("object"); - t14 = space(); - div8 = element("div"); - div7 = element("div"); - span2 = element("span"); - span2.textContent = "Contact:"; - t16 = space(); - div6 = element("div"); - button3 = element("button"); - button3.textContent = "save"; - t18 = space(); - input1 = element("input"); - t19 = space(); - button4 = element("button"); - object2 = element("object"); - t20 = space(); - h31 = element("h3"); - h31.textContent = "Requests"; - t22 = space(); - section1 = element("section"); - add_location(h2, file, 116, 8, 2738); - add_location(h30, file, 117, 8, 2763); - add_location(span0, file, 121, 20, 2933); - attr_dev(object0, "type", "image/svg+xml"); - attr_dev(object0, "data", "/img/profile/icons/pencil.svg"); - attr_dev(object0, "title", "pencil-icon"); - attr_dev(object0, "class", "pencil"); - add_location(object0, file, 124, 28, 3159); - attr_dev(button0, "class", "change-field-button"); - add_location(button0, file, 123, 24, 3033); - attr_dev(div0, "class", "change-field-div"); - add_location(div0, file, 122, 20, 2977); - attr_dev(div1, "class", "change-field-line"); - add_location(div1, file, 120, 16, 2880); - add_location(div2, file, 119, 12, 2857); - add_location(span1, file, 131, 20, 3466); - attr_dev(button1, "class", "save-button"); - add_location(button1, file, 133, 24, 3606); - attr_dev(input0, "id", "membersInput"); - attr_dev(input0, "class", "text-input"); - attr_dev(input0, "type", "text"); - add_location(input0, file, 134, 24, 3726); - attr_dev(object1, "type", "image/svg+xml"); - attr_dev(object1, "data", "/img/profile/icons/pencil.svg"); - attr_dev(object1, "title", "pencil-icon"); - attr_dev(object1, "class", "pencil"); - add_location(object1, file, 136, 28, 4019); - attr_dev(button2, "class", "text-input-pencil-button"); - add_location(button2, file, 135, 24, 3910); - attr_dev(div3, "class", "change-field-div input-pencil"); - add_location(div3, file, 132, 20, 3509); - attr_dev(div4, "class", "change-field-line"); - add_location(div4, file, 130, 16, 3413); - add_location(div5, file, 129, 12, 3390); - add_location(span2, file, 143, 20, 4326); - attr_dev(button3, "class", "save-button"); - add_location(button3, file, 145, 24, 4466); - attr_dev(input1, "id", "contactInput"); - attr_dev(input1, "class", "text-input"); - attr_dev(input1, "type", "text"); - add_location(input1, file, 146, 24, 4586); - attr_dev(object2, "type", "image/svg+xml"); - attr_dev(object2, "data", "/img/profile/icons/pencil.svg"); - attr_dev(object2, "title", "pencil-icon"); - attr_dev(object2, "class", "pencil"); - add_location(object2, file, 148, 28, 4879); - attr_dev(button4, "class", "text-input-pencil-button"); - add_location(button4, file, 147, 24, 4770); - attr_dev(div6, "class", "change-field-div input-pencil"); - add_location(div6, file, 144, 20, 4369); - attr_dev(div7, "class", "change-field-line"); - add_location(div7, file, 142, 16, 4273); - add_location(div8, file, 141, 12, 4250); - attr_dev(section0, "class", "entries-section"); - add_location(section0, file, 118, 8, 2790); - add_location(h31, file, 154, 8, 5126); - attr_dev(section1, "class", "entries-section"); - add_location(section1, file, 155, 8, 5153); - }, - m: function mount(target, anchor) { - insert_dev(target, h2, anchor); - insert_dev(target, t1, anchor); - insert_dev(target, h30, anchor); - insert_dev(target, t3, anchor); - insert_dev(target, section0, anchor); - append_dev(section0, div2); - append_dev(div2, div1); - append_dev(div1, span0); - append_dev(div1, t5); - append_dev(div1, div0); - append_dev(div0, button0); - append_dev(button0, t6); - append_dev(button0, t7); - append_dev(button0, object0); - append_dev(section0, t8); - append_dev(section0, div5); - append_dev(div5, div4); - append_dev(div4, span1); - append_dev(div4, t10); - append_dev(div4, div3); - append_dev(div3, button1); - /*button1_binding*/ ctx[17](button1); - append_dev(div3, t12); - append_dev(div3, input0); - /*input0_binding*/ ctx[18](input0); - set_input_value(input0, /*inputMembers*/ ctx[9]); - append_dev(div3, t13); - append_dev(div3, button2); - append_dev(button2, object1); - /*div3_binding*/ ctx[22](div3); - append_dev(section0, t14); - append_dev(section0, div8); - append_dev(div8, div7); - append_dev(div7, span2); - append_dev(div7, t16); - append_dev(div7, div6); - append_dev(div6, button3); - /*button3_binding*/ ctx[23](button3); - append_dev(div6, t18); - append_dev(div6, input1); - /*input1_binding*/ ctx[24](input1); - set_input_value(input1, /*inputContact*/ ctx[8]); - append_dev(div6, t19); - append_dev(div6, button4); - append_dev(button4, object2); - /*div6_binding*/ ctx[28](div6); - /*section0_binding*/ ctx[29](section0); - insert_dev(target, t20, anchor); - insert_dev(target, h31, anchor); - insert_dev(target, t22, anchor); - insert_dev(target, section1, anchor); - /*section1_binding*/ ctx[30](section1); - - if (!mounted) { - dispose = [ - listen_dev(button0, "click", /*launchChangeLocation*/ ctx[14], false, false, false), - listen_dev(button1, "click", /*saveMembers*/ ctx[15], false, false, false), - listen_dev(input0, "input", /*input0_input_handler*/ ctx[19]), - listen_dev(input0, "click", /*click_handler*/ ctx[20], false, false, false), - listen_dev(button2, "click", /*click_handler_1*/ ctx[21], false, false, false), - listen_dev(button3, "click", saveContact, false, false, false), - listen_dev(input1, "input", /*input1_input_handler*/ ctx[25]), - listen_dev(input1, "click", /*click_handler_2*/ ctx[26], false, false, false), - listen_dev(button4, "click", /*click_handler_3*/ ctx[27], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty[0] & /*user_groups*/ 2 && t6_value !== (t6_value = /*getAddress*/ ctx[13](/*user_groups*/ ctx[1][0]) + "")) set_data_dev(t6, t6_value); - - if (dirty[0] & /*inputMembers*/ 512 && input0.value !== /*inputMembers*/ ctx[9]) { - set_input_value(input0, /*inputMembers*/ ctx[9]); - } - - if (dirty[0] & /*inputContact*/ 256 && input1.value !== /*inputContact*/ ctx[8]) { - set_input_value(input1, /*inputContact*/ ctx[8]); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(h2); - if (detaching) detach_dev(t1); - if (detaching) detach_dev(h30); - if (detaching) detach_dev(t3); - if (detaching) detach_dev(section0); - /*button1_binding*/ ctx[17](null); - /*input0_binding*/ ctx[18](null); - /*div3_binding*/ ctx[22](null); - /*button3_binding*/ ctx[23](null); - /*input1_binding*/ ctx[24](null); - /*div6_binding*/ ctx[28](null); - /*section0_binding*/ ctx[29](null); - if (detaching) detach_dev(t20); - if (detaching) detach_dev(h31); - if (detaching) detach_dev(t22); - if (detaching) detach_dev(section1); - /*section1_binding*/ ctx[30](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_if_block.name, - type: "if", - source: "(115:4) {#if $loaded==1}", - ctx - }); - - return block; -} - -// (114:0) {#key $loaded} -function create_key_block(ctx) { - let if_block_anchor; - let if_block = /*$loaded*/ ctx[10] == 1 && create_if_block(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 (/*$loaded*/ ctx[10] == 1) { - 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; - } - }, - d: function destroy(detaching) { - if (if_block) if_block.d(detaching); - if (detaching) detach_dev(if_block_anchor); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(114:0) {#key $loaded}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let previous_key = /*$loaded*/ ctx[10]; - let key_block_anchor; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - key_block.c(); - key_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) { - key_block.m(target, anchor); - insert_dev(target, key_block_anchor, anchor); - }, - p: function update(ctx, dirty) { - if (dirty[0] & /*$loaded*/ 1024 && safe_not_equal(previous_key, previous_key = /*$loaded*/ ctx[10])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(key_block_anchor.parentNode, key_block_anchor); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(key_block_anchor); - key_block.d(detaching); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function getContact(c) { - if (c == null) { - return "https://discord.gg/Qk8KUk787z"; - } else { - return c; - } -} - -function launchChangeMembers() { - -} - -function showSaveButton(button) { - button.style.display = "initial"; -} - -function saveContact() { - -} - -function instance($$self, $$props, $$invalidate) { - let $content; - let $loaded; - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('profile-groups', slots, []); - let { groups = null } = $$props; - - // Main code - let section; - - let user_groups; - let content = writable({}); - validate_store(content, 'content'); - component_subscribe($$self, content, value => $$invalidate(31, $content = value)); - let loaded = writable(0); - validate_store(loaded, 'loaded'); - component_subscribe($$self, loaded, value => $$invalidate(10, $loaded = value)); - let membersInput; - let saveMembersButton; - let membersInputDiv; - let contactInput; - let saveContactButton; - let contactInputDiv; - let locale = "en"; - let inputContact; - let inputMembers; - - function groups_callback(response) { - $$invalidate(1, user_groups = JSON.parse(response)); - $$invalidate(8, inputContact = getContact(user_groups[0].contact)); - $$invalidate(9, inputMembers = user_groups[0].members); - - loaded.update(val => { - return val + 1; - }); - } - - getData("/xx/get_user_groups", groups_callback); - - function getAddress(g) { - let location = [g.country, g.state, g.town].filter(x => x != null); - return location.map(x => locale == "en" ? x : translate($content, x)).join(", "); - } - - function launchChangeLocation() { - showLocationOverlay(); - } - - function resetMembersField() { - $$invalidate(3, saveMembersButton.style.display = "none", saveMembersButton); - } - - function resetContactField() { - $$invalidate(6, saveContactButton.style.display = "none", saveContactButton); - } - - function saveMembers() { - let email = emailInput.value; - - if (AuthTools.checkEmail(email, emailMsg)) { - if (email != user.email) { - AuthTools.changeUser("email", email, user); - } - - resetMembersField(); - } - } - - let showLocationOverlay = getContext("profile-component"); - - onMount(() => { - document.addEventListener("click", function (event) { - if (membersInputDiv.focused) { - resetContactField(); - } else if (contactInputDiv.focused) { - resetMembersField(); - } else { - resetMembersField(); - resetContactField(); - } - }); - }); - - const writable_props = ['groups']; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function button1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - saveMembersButton = $$value; - $$invalidate(3, saveMembersButton); - }); - } - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - membersInput = $$value; - $$invalidate(2, membersInput); - }); - } - - function input0_input_handler() { - inputMembers = this.value; - $$invalidate(9, inputMembers); - } - - const click_handler = () => showSaveButton(saveMembersButton); - const click_handler_1 = () => membersInput.focus(); - - function div3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - membersInputDiv = $$value; - $$invalidate(4, membersInputDiv); - }); - } - - function button3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - saveContactButton = $$value; - $$invalidate(6, saveContactButton); - }); - } - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - contactInput = $$value; - $$invalidate(5, contactInput); - }); - } - - function input1_input_handler() { - inputContact = this.value; - $$invalidate(8, inputContact); - } - - const click_handler_2 = () => showSaveButton(saveContactButton); - const click_handler_3 = () => contactInput.focus(); - - function div6_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - contactInputDiv = $$value; - $$invalidate(7, contactInputDiv); - }); - } - - function section0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - section = $$value; - $$invalidate(0, section); - }); - } - - function section1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - section = $$value; - $$invalidate(0, section); - }); - } - - $$self.$$set = $$props => { - if ('groups' in $$props) $$invalidate(16, groups = $$props.groups); - }; - - $$self.$capture_state = () => ({ - onMount, - getContext, - writable, - getData, - groups, - section, - user_groups, - content, - loaded, - membersInput, - saveMembersButton, - membersInputDiv, - contactInput, - saveContactButton, - contactInputDiv, - locale, - inputContact, - inputMembers, - groups_callback, - getAddress, - getContact, - launchChangeLocation, - launchChangeMembers, - showSaveButton, - resetMembersField, - resetContactField, - saveMembers, - saveContact, - showLocationOverlay, - $content, - $loaded - }); - - $$self.$inject_state = $$props => { - if ('groups' in $$props) $$invalidate(16, groups = $$props.groups); - if ('section' in $$props) $$invalidate(0, section = $$props.section); - if ('user_groups' in $$props) $$invalidate(1, user_groups = $$props.user_groups); - if ('content' in $$props) $$invalidate(11, content = $$props.content); - if ('loaded' in $$props) $$invalidate(12, loaded = $$props.loaded); - if ('membersInput' in $$props) $$invalidate(2, membersInput = $$props.membersInput); - if ('saveMembersButton' in $$props) $$invalidate(3, saveMembersButton = $$props.saveMembersButton); - if ('membersInputDiv' in $$props) $$invalidate(4, membersInputDiv = $$props.membersInputDiv); - if ('contactInput' in $$props) $$invalidate(5, contactInput = $$props.contactInput); - if ('saveContactButton' in $$props) $$invalidate(6, saveContactButton = $$props.saveContactButton); - if ('contactInputDiv' in $$props) $$invalidate(7, contactInputDiv = $$props.contactInputDiv); - if ('locale' in $$props) locale = $$props.locale; - if ('inputContact' in $$props) $$invalidate(8, inputContact = $$props.inputContact); - if ('inputMembers' in $$props) $$invalidate(9, inputMembers = $$props.inputMembers); - if ('showLocationOverlay' in $$props) showLocationOverlay = $$props.showLocationOverlay; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - section, - user_groups, - membersInput, - saveMembersButton, - membersInputDiv, - contactInput, - saveContactButton, - contactInputDiv, - inputContact, - inputMembers, - $loaded, - content, - loaded, - getAddress, - launchChangeLocation, - saveMembers, - groups, - button1_binding, - input0_binding, - input0_input_handler, - click_handler, - click_handler_1, - div3_binding, - button3_binding, - input1_binding, - input1_input_handler, - click_handler_2, - click_handler_3, - div6_binding, - section0_binding, - section1_binding - ]; -} - -class Profile_groups extends SvelteElement { - constructor(options) { - super(); - - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { groups: 16 }, - null, - [-1, -1] - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["groups"]; - } - - get groups() { - return this.$$.ctx[16]; - } - - set groups(groups) { - this.$$set({ groups }); - flush(); - } -} - -customElements.define("profile-groups", Profile_groups); - -export { Profile_groups as default }; +import{S as t,i as e,a as n,b as i,s,p as o,n as l,g as r,q as a,m as u,o as c,j as p,e as d,c as f,v as m,d as h,y as g,f as v,A as b,l as y,z as x,w,r as k,x as j}from"./index-db20528a.js";import{w as C}from"./index-720c0a59.js";import{getData as z,sendData as E}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/select-component.js";import"../../../../../../../../../js/components/switch-component.js";function T(t,e,n){const i=t.slice();return i[62]=e[n],i[64]=n,i}function q(t){let e,n,o,l,a,u,c,p,j,C,z,E,T,q,A,M,G,I,N,H,S,_,U,F,J,K,Q,B,D,P,V,W,X,Y,Z,$,tt,et,nt,it,st,ot,lt,rt,at,ut,ct,pt,dt,ft,mt,ht,gt=t[1],vt=L(t);return{c(){e=d("div"),n=d("h2"),n.textContent="Groups",o=f(),l=d("div"),a=d("h3"),a.textContent="My group",u=f(),c=d("span"),p=f(),j=d("section"),C=d("div"),z=d("div"),E=d("span"),E.textContent="Location:",T=f(),q=d("div"),A=d("button"),M=m(t[10]),G=f(),I=d("object"),N=f(),H=d("div"),S=d("div"),_=d("span"),_.textContent="Members:",U=f(),F=d("div"),J=d("div"),K=d("button"),K.textContent="save",Q=f(),B=d("input"),D=f(),P=d("button"),V=d("object"),W=f(),X=d("div"),Y=d("div"),Z=d("span"),Z.textContent="Contact:",$=f(),tt=d("div"),et=d("div"),nt=d("button"),nt.textContent="save",it=f(),st=d("input"),ot=f(),lt=d("button"),rt=d("object"),at=f(),ut=d("h3"),ut.textContent="Requests",ct=f(),pt=d("section"),vt.c(),dt=f(),ft=d("groups-add-component"),h(a,"class","group-heading"),h(c,"class","status"),h(I,"type","image/svg+xml"),h(I,"data","/img/profile/icons/pencil.svg"),h(I,"title","pencil-icon"),h(I,"class","pencil"),h(A,"class","change-field-button"),h(q,"class","change-field-div"),h(z,"class","change-field-line"),h(K,"class","save-button"),g(K,"display","none"),h(J,"class","save-button-wrapper"),h(B,"id","membersInput"),h(B,"class","text-input"),h(B,"type","text"),h(V,"type","image/svg+xml"),h(V,"data","/img/profile/icons/pencil.svg"),h(V,"title","pencil-icon"),h(V,"class","pencil"),h(P,"class","text-input-pencil-button"),h(F,"class","change-field-div input-pencil"),h(S,"class","change-field-line"),h(nt,"class","save-button"),g(nt,"display","none"),h(et,"class","save-button-wrapper"),h(st,"id","contactInput"),h(st,"class","text-input"),h(st,"type","text"),h(rt,"type","image/svg+xml"),h(rt,"data","/img/profile/icons/pencil.svg"),h(rt,"title","pencil-icon"),h(rt,"class","pencil"),h(lt,"class","text-input-pencil-button"),h(tt,"class","change-field-div input-pencil"),h(Y,"class","change-field-line"),h(j,"class","entries-section"),h(pt,"class","entries-section"),g(ft,"display","none")},m(s,r){i(s,e,r),v(e,n),v(e,o),v(e,l),v(l,a),v(l,u),v(l,c),t[27](c),v(e,p),v(e,j),v(j,C),v(C,z),v(z,E),v(z,T),v(z,q),v(q,A),v(A,M),v(A,G),v(A,I),t[28](A),v(j,N),v(j,H),v(H,S),v(S,_),v(S,U),v(S,F),v(F,J),v(J,K),t[29](K),v(F,Q),v(F,B),t[30](B),b(B,t[12]),v(F,D),v(F,P),v(P,V),t[33](V),t[34](P),t[36](F),v(j,W),v(j,X),v(X,Y),v(Y,Z),v(Y,$),v(Y,tt),v(tt,et),v(et,nt),t[37](nt),v(tt,it),v(tt,st),t[38](st),b(st,t[11]),v(tt,ot),v(tt,lt),v(lt,rt),t[41](rt),t[42](lt),t[43](tt),t[44](j),v(e,at),v(e,ut),v(e,ct),v(e,pt),vt.m(pt,null),t[47](pt),t[48](e),i(s,dt,r),i(s,ft,r),t[49](ft),mt||(ht=[y(A,"click",t[26]),y(K,"click",t[23]),y(B,"input",t[31]),y(B,"click",t[32]),y(P,"click",t[35]),y(nt,"click",O),y(st,"input",t[39]),y(st,"click",t[40]),y(lt,"click",(function(){x(R(t[7]))&&R(t[7]).apply(this,arguments)}))],mt=!0)},p(e,n){t=e,1024&n[0]&&w(M,t[10]),4096&n[0]&&B.value!==t[12]&&b(B,t[12]),2048&n[0]&&st.value!==t[11]&&b(st,t[11]),2&n[0]&&s(gt,gt=t[1])?(vt.d(1),vt=L(t),vt.c(),vt.m(pt,null)):vt.p(t,n)},d(n){n&&r(e),t[27](null),t[28](null),t[29](null),t[30](null),t[33](null),t[34](null),t[36](null),t[37](null),t[38](null),t[41](null),t[42](null),t[43](null),t[44](null),vt.d(n),t[47](null),t[48](null),n&&r(dt),n&&r(ft),t[49](null),mt=!1,k(ht)}}}function A(t){let e,n,s,o,l,a,u,c,p,b,x,w,j=t[62].email+"";function C(){return t[45](t[64],t[62])}function z(){return t[46](t[64],t[62])}return{c(){e=d("div"),n=d("div"),s=d("span"),o=m(j),l=f(),a=d("div"),u=d("button"),u.textContent="approve",c=f(),p=d("button"),p.textContent="reject",b=f(),h(u,"class","approve-button"),h(p,"class","approve-button"),g(p,"display","visible"),h(a,"class","request-button-wrapper"),h(n,"class","change-field-line")},m(t,r){i(t,e,r),v(e,n),v(n,s),v(s,o),v(n,l),v(n,a),v(a,u),v(a,c),v(a,p),v(e,b),x||(w=[y(u,"click",C),y(p,"click",z)],x=!0)},p(e,n){t=e},d(t){t&&r(e),x=!1,k(w)}}}function L(t){let e,n=t[20],s=[];for(let e=0;en(52,t)));let d=C(0);a(t,d,(t=>n(19,i=t)));let f,m,h,g,v,b,y,x,w,k,j,T,q,A,L,M,G,O=0,H=u("profile-component"),S=H.maps;function _(t){if(null!=t){return[t.country,t.state,t.town].filter((t=>null!=t)).map((t=>t)).join(", ")}return"Create or join group"}function U(){n(5,g.style.display="none",g)}function F(){n(8,y.style.display="none",y)}function J(t){null!=t&&n(17,M.innerHTML=_(t),M)}function K(){if(i==I&&[g,y,v,x].every((t=>null!=t&&null!=t)))if(document.addEventListener("click",(function(t){let e,n=this.activeElement.shadowRoot;null!=n&&(e=n.activeElement,n=e.shadowRoot,null!=n&&(e=n.activeElement)),e==h||e==g?F():e==b||e==y?U():(U(),F())})),H.updateUserGroup=J,n(10,w=_(o[0])),0==o.length)n(11,k=""),n(12,j="");else{let e=o[0];n(11,(t=e.contact,k=null==t?"https://discord.gg/Qk8KUk787z":t)),n(12,j=e.members);let i=e.status;null!=i&&(0==i?(n(18,G.innerHTML="(pending)",G),n(18,G.style.color="#FFC90E",G)):2==i&&(n(18,G.innerHTML="(rejected)",G),n(18,G.style.color="#c52a28",G)),n(13,T.style.display="none",T),n(14,q.style.display="none",q),n(16,L.style.cursor="default",L),n(15,A.style.cursor="default",A),n(4,h.readOnly=!0,h),n(7,b.readOnly=!0,b))}else{setTimeout((()=>K()),100)}var t}function Q(t,e){E("/xx/group-approve-request",{user_id:e}),l.splice(t,1),n(1,O+=1)}function B(t,e){E("/xx/group-reject-request",{user_id:e}),l.splice(t,1),n(1,O+=1)}function D(){n(3,m.style.display="block",m),n(2,f.style.display="none",f),null!=S.groupsAdd&&S.groupsAdd.invalidateSize()}z("/xx/get-user-groups",(function(t){o=JSON.parse(t),H.userGroups=o,d.update((t=>t+1))})),z("/xx/get-group-requests",(function(t){let e=JSON.parse(t);l.push(...e),d.update((t=>t+1))})),H.onLoadedGroups=K,H.launchGroupsAdd=D,H.closeGroupsAdd=function(){n(3,m.style.display="none",m),n(2,f.style.display="block",f)},c((()=>{K()}));return[s,O,f,m,h,g,v,b,y,x,w,k,j,T,q,A,L,M,G,i,l,r,d,function(){let t=emailInput.value;AuthTools.checkEmail(t,emailMsg)&&(t!=user.email&&AuthTools.changeUser("email",t,user),U())},Q,B,D,function(t){p[t?"unshift":"push"]((()=>{G=t,n(18,G)}))},function(t){p[t?"unshift":"push"]((()=>{M=t,n(17,M)}))},function(t){p[t?"unshift":"push"]((()=>{g=t,n(5,g)}))},function(t){p[t?"unshift":"push"]((()=>{h=t,n(4,h)}))},function(){j=this.value,n(12,j)},()=>N(g,h),function(t){p[t?"unshift":"push"]((()=>{T=t,n(13,T)}))},function(t){p[t?"unshift":"push"]((()=>{A=t,n(15,A)}))},()=>{R(h)},function(t){p[t?"unshift":"push"]((()=>{v=t,n(6,v)}))},function(t){p[t?"unshift":"push"]((()=>{y=t,n(8,y)}))},function(t){p[t?"unshift":"push"]((()=>{b=t,n(7,b)}))},function(){k=this.value,n(11,k)},()=>N(y,b),function(t){p[t?"unshift":"push"]((()=>{q=t,n(14,q)}))},function(t){p[t?"unshift":"push"]((()=>{L=t,n(16,L)}))},function(t){p[t?"unshift":"push"]((()=>{x=t,n(9,x)}))},function(t){p[t?"unshift":"push"]((()=>{s=t,n(0,s)}))},(t,e)=>Q(t,e.user_id),(t,e)=>B(t,e.user_id),function(t){p[t?"unshift":"push"]((()=>{s=t,n(0,s)}))},function(t){p[t?"unshift":"push"]((()=>{f=t,n(2,f)}))},function(t){p[t?"unshift":"push"]((()=>{m=t,n(3,m)}))}]}class S extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},H,G,s,{},null,[-1,-1,-1]),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("profile-groups",S);export{S as default}; diff --git a/Server/public/js/components/profile-parties.js b/Server/public/js/components/profile-parties.js new file mode 100644 index 0000000..d4f6a94 --- /dev/null +++ b/Server/public/js/components/profile-parties.js @@ -0,0 +1 @@ +import{S as t,i as s,a as e,b as o,s as a,e as r,c as i,n,y as c,g as d,o as l}from"./index-db20528a.js";import"../../../../../../../../../js/libraries/authTools.js";function p(t){let s,e,a;return{c(){s=r("h3"),s.textContent="Under development",e=i(),a=r("p"),a.innerHTML='Visit https://discord.gg/Qk8KUk787z and ask for your party to be added.',this.c=n,c(a,"position","relative"),c(a,"margin-top","2rem")},m(t,r){o(t,s,r),o(t,e,r),o(t,a,r)},p:n,i:n,o:n,d(t){t&&d(s),t&&d(e),t&&d(a)}}}function h(t){return l((()=>{})),[]}class m extends t{constructor(t){super(),this.shadowRoot.innerHTML="",s(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},h,p,a,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("profile-parties",m);export{m as default}; diff --git a/Server/public/js/components/select-component.js b/Server/public/js/components/select-component.js index 5716ab3..301f6ba 100644 --- a/Server/public/js/components/select-component.js +++ b/Server/public/js/components/select-component.js @@ -1,593 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, A as validate_each_argument, f as element, n as noop, k as attr_dev, j as add_location, p as detach_dev, q as binding_callbacks, B as text, h as space, u as src_url_equal, F as set_style, l as append_dev, m as listen_dev, C as set_data_dev, D as destroy_each } from './index-998178c7.js'; -import { px2rem, getTextWidth, getCanvasFont } from '../../../../../../../../../js/libraries/miscTools.js'; - -/* src\components\select-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\components\\select-component.svelte"; - -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[26] = list[i]; - child_ctx[27] = list; - child_ctx[28] = i; - return child_ctx; -} - -// (135:12) {#each options as option, i} -function create_each_block(ctx) { - let button; - let span; - let t0_value = /*option*/ ctx[26] + ""; - let t0; - let t1; - let i = /*i*/ ctx[28]; - let mounted; - let dispose; - const assign_button = () => /*button_binding_1*/ ctx[14](button, i); - const unassign_button = () => /*button_binding_1*/ ctx[14](null, i); - - function click_handler() { - return /*click_handler*/ ctx[15](/*i*/ ctx[28]); - } - - const block = { - c: function create() { - button = element("button"); - span = element("span"); - t0 = text(t0_value); - t1 = space(); - add_location(span, file, 136, 20, 4826); - button.value = /*i*/ ctx[28]; - add_location(button, file, 135, 16, 4715); - }, - m: function mount(target, anchor) { - insert_dev(target, button, anchor); - append_dev(button, span); - append_dev(span, t0); - append_dev(button, t1); - assign_button(); - - if (!mounted) { - dispose = listen_dev(button, "click", click_handler, false, false, false); - mounted = true; - } - }, - p: function update(new_ctx, dirty) { - ctx = new_ctx; - if (dirty & /*options*/ 4 && t0_value !== (t0_value = /*option*/ ctx[26] + "")) set_data_dev(t0, t0_value); - - if (i !== /*i*/ ctx[28]) { - unassign_button(); - i = /*i*/ ctx[28]; - assign_button(); - } - }, - d: function destroy(detaching) { - if (detaching) detach_dev(button); - unassign_button(); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_each_block.name, - type: "each", - source: "(135:12) {#each options as option, i}", - ctx - }); - - return block; -} - -// (127:4) {#key key} -function create_key_block(ctx) { - let button; - let div0; - let span; - let t0_value = (/*value*/ ctx[0] != null ? /*value*/ ctx[0] : "") + ""; - let t0; - let t1; - let img; - let img_src_value; - let t2; - let div1; - let mounted; - let dispose; - let each_value = /*options*/ ctx[2]; - 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() { - button = element("button"); - div0 = element("div"); - span = element("span"); - t0 = text(t0_value); - t1 = space(); - img = element("img"); - t2 = space(); - div1 = element("div"); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - - attr_dev(span, "id", "current-options-span"); - add_location(span, file, 129, 16, 4359); - attr_dev(div0, "id", "current-options-div"); - add_location(div0, file, 128, 12, 4311); - attr_dev(img, "id", "arrow-down"); - 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"); - add_location(img, file, 131, 12, 4484); - attr_dev(button, "id", "current-option-button"); - add_location(button, file, 127, 8, 4202); - attr_dev(div1, "id", "options-holder"); - set_style(div1, "display", "none"); - add_location(div1, file, 133, 8, 4582); - }, - m: function mount(target, anchor) { - insert_dev(target, button, anchor); - append_dev(button, div0); - append_dev(div0, span); - append_dev(span, t0); - /*span_binding*/ ctx[12](span); - append_dev(button, t1); - append_dev(button, img); - /*button_binding*/ ctx[13](button); - insert_dev(target, t2, anchor); - insert_dev(target, div1, anchor); - - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].m(div1, null); - } - - /*div1_binding*/ ctx[16](div1); - - if (!mounted) { - dispose = listen_dev(button, "click", /*changeVisibility*/ ctx[9], false, false, false); - mounted = true; - } - }, - p: function update(ctx, dirty) { - if (dirty & /*value*/ 1 && t0_value !== (t0_value = (/*value*/ ctx[0] != null ? /*value*/ ctx[0] : "") + "")) set_data_dev(t0, t0_value); - - if (dirty & /*optionButtons, changeOption, callback, options*/ 1062) { - each_value = /*options*/ ctx[2]; - 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(div1, 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(button); - /*span_binding*/ ctx[12](null); - /*button_binding*/ ctx[13](null); - if (detaching) detach_dev(t2); - if (detaching) detach_dev(div1); - destroy_each(each_blocks, detaching); - /*div1_binding*/ ctx[16](null); - mounted = false; - dispose(); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_key_block.name, - type: "key", - source: "(127:4) {#key key}", - ctx - }); - - return block; -} - -function create_fragment(ctx) { - let div; - let previous_key = /*key*/ ctx[8]; - let key_block = create_key_block(ctx); - - const block = { - c: function create() { - div = element("div"); - key_block.c(); - this.c = noop; - attr_dev(div, "class", "select"); - add_location(div, file, 125, 0, 4137); - }, - 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) { - insert_dev(target, div, anchor); - key_block.m(div, null); - /*div_binding*/ ctx[17](div); - }, - p: function update(ctx, [dirty]) { - if (dirty & /*key*/ 256 && safe_not_equal(previous_key, previous_key = /*key*/ ctx[8])) { - key_block.d(1); - key_block = create_key_block(ctx); - key_block.c(); - key_block.m(div, null); - } else { - key_block.p(ctx, dirty); - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div); - key_block.d(detaching); - /*div_binding*/ ctx[17](null); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('select-component', slots, []); - let { callback = null } = $$props; - let { options = [""] } = $$props; - let { value = null } = $$props; - let { valueindex = null } = $$props; - - // Main code - let root = arguments[0]; - - let select; - let optionsHolder; - let optionButtons = []; - let currentOption; - let currentOptionButton; - let init = false; - let key = 0; - let obs = null; - - function setKeyValue(value, options) { - if (value !== null) { - if (options.includes(value)) { - let index = options.findIndex(element => element == value); - $$invalidate(6, currentOption.innerHTML = value, currentOption); - $$invalidate(5, optionButtons[index].style.display = "none", optionButtons); - $$invalidate(11, valueindex = index); - } - - $$invalidate(8, key += 1); - } - } - - function setKeyIndex(valueindex, options) { - if (valueindex != null && options != undefined && options[valueindex] != value) { - $$invalidate(0, value = options[valueindex]); - $$invalidate(8, key += 1); - } - } - - function indexToValue(index) { - $$invalidate(0, value = options[index]); - } - - function changeVisibility() { - if (optionsHolder.style.display == "none") { - $$invalidate(4, optionsHolder.style.display = "initial", optionsHolder); - } else { - $$invalidate(4, optionsHolder.style.display = "none", optionsHolder); - } - } - - function changeOption(index, callback) { - $$invalidate(11, valueindex = index); - $$invalidate(0, value = options[index]); - - if (callback != undefined && callback != null) { - callback(index); - } - } - - function hideSelect() { - $$invalidate(4, optionsHolder.style.display = "none", optionsHolder); - } - - function changeOptionsWidth(select, optionsHolder) { - let selectWidth; - - if (select != undefined && optionsHolder != undefined) { - let selectWidthText = getComputedStyle(select).getPropertyValue('--width'); - - if (isNaN(selectWidthText) || selectWidthText == "") { - if (obs == null) { - obs = new ResizeObserver(() => changeOptionsWidth(select, optionsHolder)); - obs.observe(currentOptionButton); - return; - } else { - selectWidthText = getComputedStyle(currentOptionButton).getPropertyValue('width'); - selectWidth = px2rem(parseFloat(selectWidthText.slice(0, selectWidthText.length - 2))); - } - } else { - selectWidth = parseFloat(selectWidthText.slice(0, selectWidthText.length - 2)); - } - - let spanWidths = []; - - for (let i = 0; i < optionsHolder.children.length; i++) { - let span = optionsHolder.children[i].children[0]; - let spanWidth = getTextWidth(span.innerHTML, getCanvasFont(span)); - spanWidths.push(spanWidth); - } - - let maxOptionsWidth = px2rem(Math.max(...spanWidths)); - - if (maxOptionsWidth > selectWidth) { - let width = 1.1 * maxOptionsWidth + "rem"; - optionsHolder.style.width = width; - - for (let i = 0; i < optionsHolder.children.length; i++) { - let button = optionsHolder.children[i]; - button.style.width = width; - } - - optionsHolder.style.marginLeft = -(1.1 * maxOptionsWidth - selectWidth) / 2 - 0.05 + "rem"; - } else { - let width = selectWidth + 0.1 + "rem"; - - for (let i = 0; i < optionsHolder.children.length; i++) { - let button = optionsHolder.children[i]; - button.style.width = width; - } - } - } - } - - onMount(() => { - init = true; - root.addEventListener('focusout', hideSelect); - }); - - const writable_props = ['callback', 'options', 'value', 'valueindex']; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function span_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - currentOption = $$value; - $$invalidate(6, currentOption); - }); - } - - function button_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - currentOptionButton = $$value; - $$invalidate(7, currentOptionButton); - }); - } - - function button_binding_1($$value, i) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - optionButtons[i] = $$value; - $$invalidate(5, optionButtons); - }); - } - - const click_handler = i => changeOption(i, callback); - - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - optionsHolder = $$value; - $$invalidate(4, optionsHolder); - }); - } - - function div_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - select = $$value; - $$invalidate(3, select); - }); - } - - $$self.$$set = $$props => { - if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); - if ('options' in $$props) $$invalidate(2, options = $$props.options); - if ('value' in $$props) $$invalidate(0, value = $$props.value); - if ('valueindex' in $$props) $$invalidate(11, valueindex = $$props.valueindex); - }; - - $$self.$capture_state = () => ({ - onMount, - px2rem, - getTextWidth, - getCanvasFont, - callback, - options, - value, - valueindex, - root, - select, - optionsHolder, - optionButtons, - currentOption, - currentOptionButton, - init, - key, - obs, - setKeyValue, - setKeyIndex, - indexToValue, - changeVisibility, - changeOption, - hideSelect, - changeOptionsWidth - }); - - $$self.$inject_state = $$props => { - if ('callback' in $$props) $$invalidate(1, callback = $$props.callback); - if ('options' in $$props) $$invalidate(2, options = $$props.options); - if ('value' in $$props) $$invalidate(0, value = $$props.value); - if ('valueindex' in $$props) $$invalidate(11, valueindex = $$props.valueindex); - if ('root' in $$props) root = $$props.root; - if ('select' in $$props) $$invalidate(3, select = $$props.select); - if ('optionsHolder' in $$props) $$invalidate(4, optionsHolder = $$props.optionsHolder); - if ('optionButtons' in $$props) $$invalidate(5, optionButtons = $$props.optionButtons); - if ('currentOption' in $$props) $$invalidate(6, currentOption = $$props.currentOption); - if ('currentOptionButton' in $$props) $$invalidate(7, currentOptionButton = $$props.currentOptionButton); - if ('init' in $$props) init = $$props.init; - if ('key' in $$props) $$invalidate(8, key = $$props.key); - if ('obs' in $$props) obs = $$props.obs; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - $$self.$$.update = () => { - if ($$self.$$.dirty & /*value, options*/ 5) { - setKeyValue(value, options); - } - - if ($$self.$$.dirty & /*valueindex, options*/ 2052) { - setKeyIndex(valueindex, options); - } - - if ($$self.$$.dirty & /*select, optionsHolder*/ 24) { - changeOptionsWidth(select, optionsHolder); - } - }; - - return [ - value, - callback, - options, - select, - optionsHolder, - optionButtons, - currentOption, - currentOptionButton, - key, - changeVisibility, - changeOption, - valueindex, - span_binding, - button_binding, - button_binding_1, - click_handler, - div1_binding, - div_binding - ]; -} - -class Select_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { - callback: 1, - options: 2, - value: 0, - valueindex: 11 - }, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["callback", "options", "value", "valueindex"]; - } - - get callback() { - return this.$$.ctx[1]; - } - - set callback(callback) { - this.$$set({ callback }); - flush(); - } - - get options() { - return this.$$.ctx[2]; - } - - set options(options) { - this.$$set({ options }); - flush(); - } - - get value() { - return this.$$.ctx[0]; - } - - set value(value) { - this.$$set({ value }); - flush(); - } - - get valueindex() { - return this.$$.ctx[11]; - } - - set valueindex(valueindex) { - this.$$set({ valueindex }); - flush(); - } -} - -customElements.define("select-component", Select_component); - -export { Select_component as default }; +import{S as t,i as e,a as r,b as i,k as o,s as n,e as l,n as s,d as a,g as d,o as u,v as c,c as h,t as p,y as f,f as m,l as v,w as b,x as g,j as w}from"./index-db20528a.js";import{px2rem as y,getTextWidth as x,getCanvasFont as $}from"../../../../../../../../../js/libraries/miscTools.js";function k(t,e,r){const i=t.slice();return i[26]=e[r],i[27]=e,i[28]=r,i}function z(t){let e,r,o,n,s,a,u=t[26]+"",p=t[28];const f=()=>t[14](e,p),g=()=>t[14](null,p);function w(){return t[15](t[28])}return{c(){e=l("button"),r=l("span"),o=c(u),n=h(),e.value=t[28]},m(t,l){i(t,e,l),m(e,r),m(r,o),m(e,n),f(),s||(a=v(e,"click",w),s=!0)},p(e,r){t=e,4&r&&u!==(u=t[26]+"")&&b(o,u),p!==t[28]&&(g(),p=t[28],f())},d(t){t&&d(e),g(),s=!1,a()}}}function L(t){let e,r,o,n,s,u,w,y,x,$,L,j=(null!=t[0]?t[0]:"")+"",M=t[2],T=[];for(let e=0;ee==t));r(6,n.innerHTML=t,n),r(5,p[i].style.display="none",p),r(11,c=i)}r(8,f+=1)}}function b(t,e){null!=t&&null!=e&&e[t]!=d&&(r(0,d=e[t]),r(8,f+=1))}function g(){"none"==o.style.display?r(4,o.style.display="initial",o):r(4,o.style.display="none",o)}function k(t,e){r(11,c=t),r(0,d=a[t]),null!=e&&null!=e&&e(t)}function z(){r(4,o.style.display="none",o)}function L(t,e){let r;if(null!=t&&null!=e){let i=getComputedStyle(t).getPropertyValue("--width");if(isNaN(i)||""==i){if(null==m)return m=new ResizeObserver((()=>L(t,e))),void m.observe(l);i=getComputedStyle(l).getPropertyValue("width"),r=y(parseFloat(i.slice(0,i.length-2)))}else r=parseFloat(i.slice(0,i.length-2));let o=[];for(let t=0;tr){let t=1.1*n+"rem";e.style.width=t;for(let r=0;r{n=t,r(6,n)}))}function M(t){w[t?"unshift":"push"]((()=>{l=t,r(7,l)}))}function T(t,e){w[t?"unshift":"push"]((()=>{p[e]=t,r(5,p)}))}u((()=>{h.addEventListener("focusout",z)}));const E=t=>k(t,s);function H(t){w[t?"unshift":"push"]((()=>{o=t,r(4,o)}))}function R(t){w[t?"unshift":"push"]((()=>{i=t,r(3,i)}))}return t.$$set=t=>{"callback"in t&&r(1,s=t.callback),"options"in t&&r(2,a=t.options),"value"in t&&r(0,d=t.value),"valueindex"in t&&r(11,c=t.valueindex)},t.$$.update=()=>{5&t.$$.dirty&&v(d,a),2052&t.$$.dirty&&b(c,a),24&t.$$.dirty&&L(i,o)},[d,s,a,i,o,p,n,l,f,g,k,c,j,M,T,E,H,R]}class T extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:r(this.attributes),customElement:!0},M,j,n,{callback:1,options:2,value:0,valueindex:11},null),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),o()))}static get observedAttributes(){return["callback","options","value","valueindex"]}get callback(){return this.$$.ctx[1]}set callback(t){this.$$set({callback:t}),o()}get options(){return this.$$.ctx[2]}set options(t){this.$$set({options:t}),o()}get value(){return this.$$.ctx[0]}set value(t){this.$$set({value:t}),o()}get valueindex(){return this.$$.ctx[11]}set valueindex(t){this.$$set({valueindex:t}),o()}}customElements.define("select-component",T);export{T as default}; diff --git a/Server/public/js/components/signup-component.js b/Server/public/js/components/signup-component.js index 1ae446b..bdd15ea 100644 --- a/Server/public/js/components/signup-component.js +++ b/Server/public/js/components/signup-component.js @@ -1,603 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, g as getContext, o as onMount, f as element, h as space, n as noop, k as attr_dev, j as add_location, u as src_url_equal, l as append_dev, m as listen_dev, p as detach_dev, r as run_all, q as binding_callbacks } from './index-998178c7.js'; -import * as AuthTools from '../../../../../../../../../js/libraries/authTools.js'; - -/* src\auth\signup-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\auth\\signup-component.svelte"; - -function create_fragment(ctx) { - let div3; - let h20; - let t1; - let label0; - let span0; - let t3; - let input0; - let t4; - let div0; - let label1; - let span1; - let t6; - let input1; - let t7; - let button0; - let object; - let t8; - let div1; - let input2; - let label2; - let t10; - let button1; - let t12; - let p0; - let t13; - let hr; - let t14; - let div2; - let button2; - let img; - let img_src_value; - let t15; - let div6; - let button3; - let t16; - let div5; - let h21; - let t18; - let p1; - let t20; - let p2; - let t22; - let div4; - let input3; - let t23; - let button4; - let t25; - let button5; - let mounted; - let dispose; - - const block = { - c: function create() { - div3 = element("div"); - h20 = element("h2"); - h20.textContent = "SIGN UP"; - t1 = space(); - label0 = element("label"); - label0.textContent = "Email "; - span0 = element("span"); - t3 = space(); - input0 = element("input"); - t4 = space(); - div0 = element("div"); - label1 = element("label"); - label1.textContent = "Password "; - span1 = element("span"); - t6 = space(); - input1 = element("input"); - t7 = space(); - button0 = element("button"); - object = element("object"); - t8 = space(); - div1 = element("div"); - input2 = element("input"); - label2 = element("label"); - label2.textContent = "remember me"; - t10 = space(); - button1 = element("button"); - button1.textContent = "Sign up"; - t12 = space(); - p0 = element("p"); - t13 = space(); - hr = element("hr"); - t14 = space(); - div2 = element("div"); - button2 = element("button"); - img = element("img"); - t15 = space(); - div6 = element("div"); - button3 = element("button"); - t16 = space(); - div5 = element("div"); - h21 = element("h2"); - h21.textContent = "Registration is closed"; - t18 = space(); - p1 = element("p"); - p1.textContent = "We are still in the process of opening."; - t20 = space(); - p2 = element("p"); - p2.textContent = "Sign up for updates to know when it becomes available:"; - t22 = space(); - div4 = element("div"); - input3 = element("input"); - t23 = space(); - button4 = element("button"); - button4.textContent = "sign up"; - t25 = space(); - button5 = element("button"); - button5.textContent = "No thanks"; - this.c = noop; - attr_dev(h20, "class", "auth-title"); - add_location(h20, file, 98, 4, 2351); - attr_dev(label0, "class", "auth-label"); - attr_dev(label0, "for", "emailInput"); - add_location(label0, file, 99, 4, 2392); - attr_dev(span0, "id", "email-msg"); - add_location(span0, file, 99, 66, 2454); - attr_dev(input0, "id", "emailInput"); - attr_dev(input0, "class", "authEmailInput"); - attr_dev(input0, "type", "email"); - add_location(input0, file, 100, 4, 2547); - attr_dev(label1, "class", "auth-label"); - attr_dev(label1, "for", "emailInput"); - add_location(label1, file, 102, 8, 2673); - attr_dev(span1, "id", "password-msg"); - add_location(span1, file, 102, 73, 2738); - attr_dev(input1, "id", "passwordInput"); - attr_dev(input1, "class", "authPasswordInput"); - attr_dev(input1, "type", "password"); - add_location(input1, file, 103, 8, 2803); - attr_dev(object, "type", "image/svg+xml"); - attr_dev(object, "data", "/img/auth/eye_icon.svg"); - attr_dev(object, "title", "eye-icon"); - add_location(object, file, 105, 12, 3104); - attr_dev(button0, "class", "eye-icon"); - add_location(button0, file, 104, 8, 2948); - attr_dev(div0, "class", "password-field"); - add_location(div0, file, 101, 4, 2635); - attr_dev(input2, "type", "checkbox"); - attr_dev(input2, "id", "remember-me-checkbox"); - add_location(input2, file, 109, 8, 3258); - attr_dev(label2, "id", "remember-me-label"); - attr_dev(label2, "for", "passwordInput"); - add_location(label2, file, 109, 80, 3330); - attr_dev(div1, "id", "remember-me"); - add_location(div1, file, 108, 4, 3226); - attr_dev(button1, "class", "auth-button"); - add_location(button1, file, 111, 4, 3417); - attr_dev(p0, "id", "forgot-password"); - add_location(p0, file, 112, 4, 3558); - attr_dev(hr, "class", "auth-line"); - add_location(hr, file, 113, 4, 3592); - if (!src_url_equal(img.src, img_src_value = "/img/auth/google_icon.svg")) attr_dev(img, "src", img_src_value); - attr_dev(img, "id", "navbar-logo"); - attr_dev(img, "alt", "google icon"); - add_location(img, file, 116, 12, 3708); - add_location(button2, file, 115, 8, 3662); - attr_dev(div2, "class", "auth-methods-group"); - add_location(div2, file, 114, 4, 3620); - attr_dev(div3, "id", "signup-group"); - attr_dev(div3, "class", "pane auth-pane"); - add_location(div3, file, 97, 0, 2275); - attr_dev(button3, "id", "shadow"); - add_location(button3, file, 128, 4, 4146); - add_location(h21, file, 130, 8, 4238); - add_location(p1, file, 131, 8, 4279); - add_location(p2, file, 132, 8, 4335); - attr_dev(input3, "id", "newsletterEmailInput"); - attr_dev(input3, "type", "text"); - add_location(input3, file, 134, 12, 4451); - attr_dev(button4, "id", "newsletterEmailButton"); - add_location(button4, file, 135, 12, 4557); - attr_dev(div4, "id", "newsletter-container"); - add_location(div4, file, 133, 8, 4406); - attr_dev(button5, "id", "no-button"); - add_location(button5, file, 137, 8, 4674); - attr_dev(div5, "id", "wrapper"); - attr_dev(div5, "class", "pane"); - add_location(div5, file, 129, 4, 4197); - attr_dev(div6, "id", "dialog"); - add_location(div6, file, 127, 0, 4104); - }, - 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) { - insert_dev(target, div3, anchor); - append_dev(div3, h20); - append_dev(div3, t1); - append_dev(div3, label0); - append_dev(div3, span0); - /*span0_binding*/ ctx[15](span0); - append_dev(div3, t3); - append_dev(div3, input0); - /*input0_binding*/ ctx[17](input0); - append_dev(div3, t4); - append_dev(div3, div0); - append_dev(div0, label1); - append_dev(div0, span1); - /*span1_binding*/ ctx[18](span1); - append_dev(div0, t6); - append_dev(div0, input1); - /*input1_binding*/ ctx[19](input1); - append_dev(div0, t7); - append_dev(div0, button0); - append_dev(button0, object); - /*button0_binding*/ ctx[21](button0); - append_dev(div3, t8); - append_dev(div3, div1); - append_dev(div1, input2); - /*input2_binding*/ ctx[23](input2); - append_dev(div1, label2); - append_dev(div3, t10); - append_dev(div3, button1); - append_dev(div3, t12); - append_dev(div3, p0); - append_dev(div3, t13); - append_dev(div3, hr); - append_dev(div3, t14); - append_dev(div3, div2); - append_dev(div2, button2); - append_dev(button2, img); - /*div3_binding*/ ctx[24](div3); - insert_dev(target, t15, anchor); - insert_dev(target, div6, anchor); - append_dev(div6, button3); - append_dev(div6, t16); - append_dev(div6, div5); - append_dev(div5, h21); - append_dev(div5, t18); - append_dev(div5, p1); - append_dev(div5, t20); - append_dev(div5, p2); - append_dev(div5, t22); - append_dev(div5, div4); - append_dev(div4, input3); - /*input3_binding*/ ctx[25](input3); - append_dev(div4, t23); - append_dev(div4, button4); - /*button4_binding*/ ctx[26](button4); - append_dev(div5, t25); - append_dev(div5, button5); - /*div6_binding*/ ctx[27](div6); - - if (!mounted) { - dispose = [ - listen_dev(span0, "change", /*change_handler*/ ctx[16], false, false, false), - listen_dev(input1, "change", /*change_handler_1*/ ctx[20], false, false, false), - listen_dev(button0, "click", /*click_handler*/ ctx[22], false, false, false), - listen_dev(button1, "click", /*showDialog*/ ctx[10], false, false, false), - listen_dev(button2, "click", /*showDialog*/ ctx[10], false, false, false), - listen_dev(button3, "click", /*hide*/ ctx[11], false, false, false), - listen_dev(input3, "click", /*clearField*/ ctx[13], false, false, false), - listen_dev(button4, "click", /*sendEmail*/ ctx[12], false, false, false), - listen_dev(button5, "click", /*hide*/ ctx[11], false, false, false) - ]; - - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(div3); - /*span0_binding*/ ctx[15](null); - /*input0_binding*/ ctx[17](null); - /*span1_binding*/ ctx[18](null); - /*input1_binding*/ ctx[19](null); - /*button0_binding*/ ctx[21](null); - /*input2_binding*/ ctx[23](null); - /*div3_binding*/ ctx[24](null); - if (detaching) detach_dev(t15); - if (detaching) detach_dev(div6); - /*input3_binding*/ ctx[25](null); - /*button4_binding*/ ctx[26](null); - /*div6_binding*/ ctx[27](null); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function removeMsg(msg) { - if (msg.innerHTML != "") { - msg.innerHTML = ""; - } -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('signup-component', slots, []); - let { focused = false } = $$props; - - // Main code - let signupGroup; - - let emailInput; - let passwordInput; - let passwordVisibilityButton; - let inputs; - let googleButton; - let emailMsg; - let passwordMsg; - let msgs; - let rememberMe; - let dialog; - let signUp; - let signUpField; - let parentProps = getContext("auth"); - - function showDialog() { - $$invalidate(7, dialog.style.display = "block", dialog); - } - - function hide() { - if (dialog != null) { - $$invalidate(7, dialog.style.display = "none", dialog); - } - } - - function sendEmail() { - let email = signUpField.value; - - if (email.includes("@")) { - sendText("/get-email", email); - $$invalidate(9, signUpField.value = "", signUpField); - $$invalidate(9, signUpField.placeholder = "Subscribed!", signUpField); - signUpField.style.setProperty("--c", "hsl(147, 33%, 60%)"); - } else { - $$invalidate(9, signUpField.value = "", signUpField); - $$invalidate(9, signUpField.placeholder = "must contain '@'", signUpField); - signUpField.style.setProperty("--c", "hsl(0, 100%, 60%)"); - } - } - - function clearField() { - $$invalidate(9, signUpField.placeholder = "", signUpField); - } - - function renderGoogle() { - if (parentProps.googleInit) { - google.accounts.id.renderButton(googleButton, { theme: 'outline', size: 'large' }); - } else { - setTimeout(renderGoogle, 100); - } - } - - onMount(() => { - $$invalidate(6, rememberMe.checked = true, rememberMe); - - inputs = { - email: emailInput, - password: passwordInput - }; - - msgs = { email: emailMsg, password: passwordMsg }; - - document.addEventListener("keypress", function (event) { - if (event.code == "Enter") { - if (focused) { - AuthTools.signup(msgs, inputs, toLandingPage); - } - } - }); - }); //renderGoogle() - - const writable_props = ['focused']; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function span0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailMsg = $$value; - $$invalidate(4, emailMsg); - }); - } - - const change_handler = () => removeMsg(emailMsg); - - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - emailInput = $$value; - $$invalidate(1, emailInput); - }); - } - - function span1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordMsg = $$value; - $$invalidate(5, passwordMsg); - }); - } - - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordInput = $$value; - $$invalidate(2, passwordInput); - }); - } - - const change_handler_1 = () => removeMsg(passwordMsg); - - function button0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - passwordVisibilityButton = $$value; - $$invalidate(3, passwordVisibilityButton); - }); - } - - const click_handler = () => AuthTools.changePasswordVisibility(passwordVisibilityButton); - - function input2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - rememberMe = $$value; - $$invalidate(6, rememberMe); - }); - } - - function div3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - signupGroup = $$value; - $$invalidate(0, signupGroup); - }); - } - - function input3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - signUpField = $$value; - $$invalidate(9, signUpField); - }); - } - - function button4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - signUp = $$value; - $$invalidate(8, signUp); - }); - } - - function div6_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - dialog = $$value; - $$invalidate(7, dialog); - }); - } - - $$self.$$set = $$props => { - if ('focused' in $$props) $$invalidate(14, focused = $$props.focused); - }; - - $$self.$capture_state = () => ({ - onMount, - getContext, - AuthTools, - focused, - signupGroup, - emailInput, - passwordInput, - passwordVisibilityButton, - inputs, - googleButton, - emailMsg, - passwordMsg, - msgs, - rememberMe, - dialog, - signUp, - signUpField, - parentProps, - removeMsg, - showDialog, - hide, - sendEmail, - clearField, - renderGoogle - }); - - $$self.$inject_state = $$props => { - if ('focused' in $$props) $$invalidate(14, focused = $$props.focused); - if ('signupGroup' in $$props) $$invalidate(0, signupGroup = $$props.signupGroup); - if ('emailInput' in $$props) $$invalidate(1, emailInput = $$props.emailInput); - if ('passwordInput' in $$props) $$invalidate(2, passwordInput = $$props.passwordInput); - if ('passwordVisibilityButton' in $$props) $$invalidate(3, passwordVisibilityButton = $$props.passwordVisibilityButton); - if ('inputs' in $$props) inputs = $$props.inputs; - if ('googleButton' in $$props) googleButton = $$props.googleButton; - if ('emailMsg' in $$props) $$invalidate(4, emailMsg = $$props.emailMsg); - if ('passwordMsg' in $$props) $$invalidate(5, passwordMsg = $$props.passwordMsg); - if ('msgs' in $$props) msgs = $$props.msgs; - if ('rememberMe' in $$props) $$invalidate(6, rememberMe = $$props.rememberMe); - if ('dialog' in $$props) $$invalidate(7, dialog = $$props.dialog); - if ('signUp' in $$props) $$invalidate(8, signUp = $$props.signUp); - if ('signUpField' in $$props) $$invalidate(9, signUpField = $$props.signUpField); - if ('parentProps' in $$props) parentProps = $$props.parentProps; - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [ - signupGroup, - emailInput, - passwordInput, - passwordVisibilityButton, - emailMsg, - passwordMsg, - rememberMe, - dialog, - signUp, - signUpField, - showDialog, - hide, - sendEmail, - clearField, - focused, - span0_binding, - change_handler, - input0_binding, - span1_binding, - input1_binding, - change_handler_1, - button0_binding, - click_handler, - input2_binding, - div3_binding, - input3_binding, - button4_binding, - div6_binding - ]; -} - -class Signup_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { focused: 14 }, - null, - [-1, -1] - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["focused"]; - } - - get focused() { - return this.$$.ctx[14]; - } - - set focused(focused) { - this.$$set({ focused }); - flush(); - } -} - -customElements.define("signup-component", Signup_component); - -export { Signup_component as default }; +import{S as t,i as e,a as s,b as n,k as i,s as r,e as o,c as a,n as l,d as u,f as c,l as d,g as p,r as m,m as f,o as h,j as g}from"./index-db20528a.js";import*as b from"../../../../../../../../../js/libraries/authTools.js";function w(t){let e,s,i,r,f,h,g,b,w,x,v,y,k,E,I,C,j,P,$,L,T,S,z,H,M,B,R,N,A,G,U,V,W,X,_,q,D,F,J,K,O,Q;return{c(){e=o("div"),s=o("h2"),s.textContent="SIGN UP",i=a(),r=o("label"),r.textContent="Email ",f=o("span"),h=a(),g=o("input"),b=a(),w=o("div"),x=o("label"),x.textContent="Password ",v=o("span"),y=a(),k=o("input"),E=a(),I=o("button"),I.innerHTML='',C=a(),j=o("div"),P=o("input"),$=o("label"),$.textContent="remember me",L=a(),T=o("button"),T.textContent="Sign up",S=a(),z=o("p"),H=a(),M=o("div"),B=o("button"),R=a(),N=o("div"),A=o("h2"),A.textContent="Registration is closed",G=a(),U=o("p"),U.textContent="We are still in the process of opening.",V=a(),W=o("p"),W.textContent="Sign up for updates to know when it becomes available:",X=a(),_=o("div"),q=o("input"),D=a(),F=o("button"),F.textContent="sign up",J=a(),K=o("button"),K.textContent="No thanks",this.c=l,u(s,"class","auth-title"),u(r,"class","auth-label"),u(r,"for","emailInput"),u(f,"id","email-msg"),u(g,"id","emailInput"),u(g,"class","authEmailInput"),u(g,"type","email"),u(x,"class","auth-label"),u(x,"for","emailInput"),u(v,"id","password-msg"),u(k,"id","passwordInput"),u(k,"class","authPasswordInput"),u(k,"type","password"),u(I,"class","eye-icon"),u(w,"class","password-field"),u(P,"type","checkbox"),u(P,"id","remember-me-checkbox"),u($,"id","remember-me-label"),u($,"for","passwordInput"),u(j,"id","remember-me"),u(T,"class","auth-button"),u(z,"id","forgot-password"),u(e,"id","signup-group"),u(e,"class","pane auth-pane"),u(B,"id","shadow"),u(q,"id","newsletterEmailInput"),u(q,"type","text"),u(F,"id","newsletterEmailButton"),u(_,"id","newsletter-container"),u(K,"id","no-button"),u(N,"id","wrapper"),u(N,"class","pane"),u(M,"id","dialog")},m(o,a){n(o,e,a),c(e,s),c(e,i),c(e,r),c(e,f),t[15](f),c(e,h),c(e,g),t[17](g),c(e,b),c(e,w),c(w,x),c(w,v),t[18](v),c(w,y),c(w,k),t[19](k),c(w,E),c(w,I),t[21](I),c(e,C),c(e,j),c(j,P),t[23](P),c(j,$),c(e,L),c(e,T),c(e,S),c(e,z),t[24](e),n(o,H,a),n(o,M,a),c(M,B),c(M,R),c(M,N),c(N,A),c(N,G),c(N,U),c(N,V),c(N,W),c(N,X),c(N,_),c(_,q),t[25](q),c(_,D),c(_,F),t[26](F),c(N,J),c(N,K),t[27](M),O||(Q=[d(f,"change",t[16]),d(k,"change",t[20]),d(I,"click",t[22]),d(T,"click",t[10]),d(B,"click",t[11]),d(q,"click",t[13]),d(F,"click",t[12]),d(K,"click",t[11])],O=!0)},p:l,i:l,o:l,d(s){s&&p(e),t[15](null),t[17](null),t[18](null),t[19](null),t[21](null),t[23](null),t[24](null),s&&p(H),s&&p(M),t[25](null),t[26](null),t[27](null),O=!1,m(Q)}}}function x(t){""!=t.innerHTML&&(t.innerHTML="")}function v(t,e,s){let n,i,r,o,a,l,u,c,d,p,m,w,{focused:v=!1}=e;f("auth"),h((()=>{s(6,d.checked=!0,d),a={email:i,password:r},c={email:l,password:u},document.addEventListener("keypress",(function(t){"Enter"==t.code&&v&&b.signup(c,a,toLandingPage)}))}));return t.$$set=t=>{"focused"in t&&s(14,v=t.focused)},[n,i,r,o,l,u,d,p,m,w,function(){s(7,p.style.display="block",p)},function(){null!=p&&s(7,p.style.display="none",p)},function(){let t=w.value;t.includes("@")?(sendText("/get-email",t),s(9,w.value="",w),s(9,w.placeholder="Subscribed!",w),w.style.setProperty("--c","hsl(147, 33%, 60%)")):(s(9,w.value="",w),s(9,w.placeholder="must contain '@'",w),w.style.setProperty("--c","hsl(0, 100%, 60%)"))},function(){s(9,w.placeholder="",w)},v,function(t){g[t?"unshift":"push"]((()=>{l=t,s(4,l)}))},()=>x(l),function(t){g[t?"unshift":"push"]((()=>{i=t,s(1,i)}))},function(t){g[t?"unshift":"push"]((()=>{u=t,s(5,u)}))},function(t){g[t?"unshift":"push"]((()=>{r=t,s(2,r)}))},()=>x(u),function(t){g[t?"unshift":"push"]((()=>{o=t,s(3,o)}))},()=>b.changePasswordVisibility(o),function(t){g[t?"unshift":"push"]((()=>{d=t,s(6,d)}))},function(t){g[t?"unshift":"push"]((()=>{n=t,s(0,n)}))},function(t){g[t?"unshift":"push"]((()=>{w=t,s(9,w)}))},function(t){g[t?"unshift":"push"]((()=>{m=t,s(8,m)}))},function(t){g[t?"unshift":"push"]((()=>{p=t,s(7,p)}))}]}class y extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:s(this.attributes),customElement:!0},v,w,r,{focused:14},null,[-1,-1]),t&&(t.target&&n(t.target,this,t.anchor),t.props&&(this.$set(t.props),i()))}static get observedAttributes(){return["focused"]}get focused(){return this.$$.ctx[14]}set focused(t){this.$$set({focused:t}),i()}}customElements.define("signup-component",y);export{y as default}; diff --git a/Server/public/js/components/switch-component.js b/Server/public/js/components/switch-component.js index 7a83d2e..a818ed0 100644 --- a/Server/public/js/components/switch-component.js +++ b/Server/public/js/components/switch-component.js @@ -1,209 +1 @@ - -(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, t as flush, s as safe_not_equal, d as dispatch_dev, v as validate_slots, o as onMount, f as element, h as space, n as noop, k as attr_dev, j as add_location, l as append_dev, m as listen_dev, p as detach_dev, r as run_all } from './index-998178c7.js'; -import { px2rem, getTextWidth, getCanvasFont } from '../../../../../../../../../js/libraries/miscTools.js'; - -/* src\components\switch-component.svelte generated by Svelte v3.52.0 */ -const file = "src\\components\\switch-component.svelte"; - -function create_fragment(ctx) { - let label; - let input; - let t; - let span; - let mounted; - let dispose; - - const block = { - c: function create() { - label = element("label"); - input = element("input"); - t = space(); - span = element("span"); - this.c = noop; - attr_dev(input, "type", "checkbox"); - add_location(input, file, 39, 4, 804); - attr_dev(span, "class", "switch-span"); - add_location(span, file, 40, 4, 880); - attr_dev(label, "class", "switch"); - add_location(label, file, 38, 0, 776); - }, - 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) { - insert_dev(target, label, anchor); - append_dev(label, input); - input.checked = /*checked*/ ctx[0]; - append_dev(label, t); - append_dev(label, span); - - if (!mounted) { - dispose = [ - listen_dev(input, "change", /*input_change_handler*/ ctx[4]), - listen_dev(input, "click", /*toggleClick*/ ctx[1], false, false, false) - ]; - - mounted = true; - } - }, - p: function update(ctx, [dirty]) { - if (dirty & /*checked*/ 1) { - input.checked = /*checked*/ ctx[0]; - } - }, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(label); - mounted = false; - run_all(dispose); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment.name, - type: "component", - source: "", - ctx - }); - - return block; -} - -function instance($$self, $$props, $$invalidate) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('switch-component', slots, []); - let { callback = null } = $$props; - let { checked = false } = $$props; - - const toggle = () => { - let f = () => { - if (callback != null) { - $$invalidate(0, checked = !checked); - callback(); - } else { - toggle(); - } - }; - - setTimeout(f, 100); - }; - - function toggleClick() { - if (callback != null) { - $$invalidate(0, checked = !checked); - callback(); - } - } - - // Main code - onMount(() => { - - }); - - const writable_props = ['callback', 'checked']; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(` was created with unknown prop '${key}'`); - }); - - function input_change_handler() { - checked = this.checked; - $$invalidate(0, checked); - } - - $$self.$$set = $$props => { - if ('callback' in $$props) $$invalidate(2, callback = $$props.callback); - if ('checked' in $$props) $$invalidate(0, checked = $$props.checked); - }; - - $$self.$capture_state = () => ({ - onMount, - px2rem, - getTextWidth, - getCanvasFont, - callback, - checked, - toggle, - toggleClick - }); - - $$self.$inject_state = $$props => { - if ('callback' in $$props) $$invalidate(2, callback = $$props.callback); - if ('checked' in $$props) $$invalidate(0, checked = $$props.checked); - }; - - if ($$props && "$$inject" in $$props) { - $$self.$inject_state($$props.$$inject); - } - - return [checked, toggleClick, callback, toggle, input_change_handler]; -} - -class Switch_component extends SvelteElement { - constructor(options) { - super(); - this.shadowRoot.innerHTML = ``; - - init( - this, - { - target: this.shadowRoot, - props: attribute_to_object(this.attributes), - customElement: true - }, - instance, - create_fragment, - safe_not_equal, - { callback: 2, checked: 0, toggle: 3 }, - null - ); - - if (options) { - if (options.target) { - insert_dev(options.target, this, options.anchor); - } - - if (options.props) { - this.$set(options.props); - flush(); - } - } - } - - static get observedAttributes() { - return ["callback", "checked", "toggle"]; - } - - get callback() { - return this.$$.ctx[2]; - } - - set callback(callback) { - this.$$set({ callback }); - flush(); - } - - get checked() { - return this.$$.ctx[0]; - } - - set checked(checked) { - this.$$set({ checked }); - flush(); - } - - get toggle() { - return this.$$.ctx[3]; - } - - set toggle(value) { - throw new Error(": Cannot set read-only property 'toggle'"); - } -} - -customElements.define("switch-component", Switch_component); - -export { Switch_component as default }; +import{S as t,i as e,a as s,b as c,k as a,s as i,e as r,c as o,n as h,d as n,f as l,l as d,g as p,r as u,o as b}from"./index-db20528a.js";import"../../../../../../../../../js/libraries/miscTools.js";function k(t){let e,s,a,i,b,k;return{c(){e=r("label"),s=r("input"),a=o(),i=r("span"),this.c=h,n(s,"type","checkbox"),n(i,"class","switch-span"),n(e,"class","switch")},m(r,o){c(r,e,o),l(e,s),s.checked=t[0],l(e,a),l(e,i),b||(k=[d(s,"change",t[4]),d(s,"click",t[1])],b=!0)},p(t,[e]){1&e&&(s.checked=t[0])},i:h,o:h,d(t){t&&p(e),b=!1,u(k)}}}function g(t,e,s){let{callback:c=null}=e,{checked:a=!1}=e;const i=()=>{setTimeout((()=>{null!=c?(s(0,a=!a),c()):i()}),100)};return b((()=>{})),t.$$set=t=>{"callback"in t&&s(2,c=t.callback),"checked"in t&&s(0,a=t.checked)},[a,function(){null!=c&&(s(0,a=!a),c())},c,i,function(){a=this.checked,s(0,a)}]}class m extends t{constructor(t){super(),this.shadowRoot.innerHTML="",e(this,{target:this.shadowRoot,props:s(this.attributes),customElement:!0},g,k,i,{callback:2,checked:0,toggle:3},null),t&&(t.target&&c(t.target,this,t.anchor),t.props&&(this.$set(t.props),a()))}static get observedAttributes(){return["callback","checked","toggle"]}get callback(){return this.$$.ctx[2]}set callback(t){this.$$set({callback:t}),a()}get checked(){return this.$$.ctx[0]}set checked(t){this.$$set({checked:t}),a()}get toggle(){return this.$$.ctx[3]}}customElements.define("switch-component",m);export{m as default}; diff --git a/Server/public/js/libraries/authTools.js b/Server/public/js/libraries/authTools.js index c1b98d0..e7aa71b 100644 --- a/Server/public/js/libraries/authTools.js +++ b/Server/public/js/libraries/authTools.js @@ -1,12 +1,15 @@ import {getData, sendData} from "/js/libraries/serverTools.js" -export function getUser(user,callbackOuter) { +export function getUser(user,loaded,callbackOuter) { let callback = function(response) { Object.assign(user,JSON.parse(response)) if(callbackOuter!=undefined) { callbackOuter() } + loaded.update((val) => { + return val + 1 + }) } getData("/xx/get-user",callback) } diff --git a/Server/public/js/libraries/mapTools.js b/Server/public/js/libraries/mapTools.js index 1f9cfb4..1995190 100644 --- a/Server/public/js/libraries/mapTools.js +++ b/Server/public/js/libraries/mapTools.js @@ -10,7 +10,7 @@ export function translate(content, x) { } } -function addMarkersToLayer(g,layer,content,locale,addPinContent,markerColor) { +function addMarkersToLayer(g,layer,content,locale,addPinContent,markerColor,options) { let {text,coordinates} = addPinContent(g,content,locale) var markerIcon = new L.Icon({ iconUrl: 'https://www.libsoc.org/img/common/markers/marker-' + markerColor + '.png', @@ -21,57 +21,69 @@ function addMarkersToLayer(g,layer,content,locale,addPinContent,markerColor) { shadowSize: [41, 41] }) let marker = L.marker(coordinates, {icon: markerIcon}) + marker.id = g.id + marker.members = g.members + marker.contact = g.contact marker.addTo(layer).bindPopup(text) + + if (options.pinCallback!=undefined) { + marker.on('click', (event) => options.pinCallback(marker,event)) + } } -export function addMarkersEntries(entries,entriesByCountry,map,content,locale,addPinContent,markerColor) { +export function addMarkersEntries(entries,entriesByCountry,map,content,locale,addPinContent,markerColor,options) { let entriesMarkersLayer = L.layerGroup() let entriesMarkersLayerOut = L.layerGroup() let entriesMarkersLayerIn = L.layerGroup() for (let g of entries) { if (g.country!="Online" && g.country!="Worldwide") { - addMarkersToLayer(g,entriesMarkersLayerIn,content,locale,addPinContent,markerColor) + addMarkersToLayer(g,entriesMarkersLayerIn,content,locale,addPinContent,markerColor,options) } } - for (let gs of Object.values(entriesByCountry)) { - if (gs.length==1) { - let g = {...gs[0]} - g.country = [g.country] - if (g.country!="Online" && g.country!="Worldwide") { - addMarkersToLayer(g,entriesMarkersLayerOut,content,locale,addPinContent,markerColor) + if (options.enableCountryGrouping) { + for (let gs of Object.values(entriesByCountry)) { + if (gs.length==1) { + let g = {...gs[0]} + g.country = [g.country] + if (g.country!="Online" && g.country!="Worldwide") { + addMarkersToLayer(g,entriesMarkersLayerOut,content,locale,addPinContent,markerColor,options) + } } - } - else { - if (gs[0].country!="Online" && gs[0].country!="Worldwide") { - let locationName = gs[0].country - let locationCoordinates = [0,0] - let members = 0 - let contact = gs[0].contact - for (let g of gs) { - locationCoordinates[0] += g.latitude - locationCoordinates[1] += g.longitude - members += g.members - if (g.contact[0]!=gs[0].contact[0]) { - contact = contactGeneral + else { + if (gs[0].country!="Online" && gs[0].country!="Worldwide") { + let locationName = gs[0].country + let locationCoordinates = [0,0] + let members = 0 + let contact = gs[0].contact + for (let g of gs) { + locationCoordinates[0] += g.latitude + locationCoordinates[1] += g.longitude + members += g.members + if (g.contact[0]!=gs[0].contact[0]) { + contact = contactGeneral + } } + locationCoordinates[0] = locationCoordinates[0]/gs.length + locationCoordinates[1] = locationCoordinates[1]/gs.length + let gNew = { + country: locationName, + latitude: locationCoordinates[0], + longitude: locationCoordinates[1], + members: members, + contact: contact + } + addMarkersToLayer(gNew,entriesMarkersLayerOut,content,locale,addPinContent,markerColor,options) } - locationCoordinates[0] = locationCoordinates[0]/gs.length - locationCoordinates[1] = locationCoordinates[1]/gs.length - let gNew = { - country: locationName, - latitude: locationCoordinates[0], - longitude: locationCoordinates[1], - members: members, - contact: contact - } - addMarkersToLayer(gNew,entriesMarkersLayerOut,content,locale,addPinContent,markerColor) } } + entriesMarkersLayerOut.addTo(entriesMarkersLayer) + map.on("zoomend", () => onZoomEnd(map,entriesMarkersLayer,entriesMarkersLayerOut,entriesMarkersLayerIn)) + } + else { + entriesMarkersLayerIn.addTo(entriesMarkersLayer) } - - entriesMarkersLayerOut.addTo(entriesMarkersLayer) entriesMarkersLayer.addTo(map) - map.on("zoomend", () => onZoomEnd(map,entriesMarkersLayer,entriesMarkersLayerOut,entriesMarkersLayerIn)) + return entriesMarkersLayer } diff --git a/Server/routes.jl b/Server/routes.jl index 6f2e430..4dce935 100644 --- a/Server/routes.jl +++ b/Server/routes.jl @@ -1,5 +1,6 @@ using Genie.Router, Genie.Requests, Genie.Renderer.Json, JSON3, GenieAuthentication +using Server.GroupsController #---Basic----------------------------------------------------------- @@ -43,7 +44,15 @@ route("/:locale/groups-add/*", GroupsController.groups_add, named = :groups_add) route("/:locale/groups-add-post/*", GroupsController.groups_add_post, method = POST, named = :groups_add_post) -route("/:locale/get_user_groups/*", GroupsController.get_user_groups, named = :get_user_groups) +route("/:locale/get-user-groups/*", GroupsController.get_user_groups, named = :get_user_groups) + +route("/:locale/get-group-requests/*", GroupsController.get_group_requests, named = :get_group_requests) + +route("/:locale/group-approve-request/*", GroupsController.approve_request, method = POST, named = :group_approve_request) + +route("/:locale/group-reject-request/*", GroupsController.reject_request, method = POST, named = :group_reject_request) + +route("/:locale/add-verified-groups/*", GroupsController.add_verified_groups, named = :add_verified_groups) #---Coops----------------------------------------------------------