var extend={lib_event:{setTimezoneWarning:function(n){if($("#event_timezone").length){var t=n.lib.getLocalTimezone();$("html").data("usertz").length&&(t=$("html").data("usertz"));$("#event_timezone").data("ref")!=t&&$("#event_timezone").addClass("warning")}},getLocationObjByVenueObj:function(n,t){var i=null,r={name:t.name,Name:t.name,city:t.city,City:t.city,address:t.address,Address:t.address,description:t.description,Description:t.description,key:t.key,Key:t.key,geocode:{lat:t.geocode&&t.geocode.lat?t.geocode.lat:null,lng:t.geocode&&t.geocode.lng?t.geocode.lng:null},Geocode:{Lat:t.geocode&&t.geocode.lat?t.geocode.lat:null,Lng:t.geocode&&t.geocode.lng?t.geocode.lng:null},action_url:"",place_id:"",images:[],attributes:[{type:"",show:"modal",elements:[{type:"label",label:n.lib.translate("Description"),value:t.description},{type:"address",label:n.lib.translate("Address"),value:t.address},{type:"label",label:n.lib.translate("OpeningHours"),value:t.opening_hours}]}],sub_attributes:[],preview_attributes:[],info_active:!0,action_text:"",photo_reference:"",providers:t.providers,Providers:t.providers,strong_match:!1,exact_match:!1,opening_hours:t.opening_hours,Opening_hours:t.opening_hours,average_rating:t.average_rating?(t.average_rating*10).toFixed(1):null,Average_rating:t.average_rating?(t.average_rating*10).toFixed(1):null};return $.each(t.images,function(n,t){r.images.push({template:t,type:"photo"})}),t.logos&&t.logos.length>0&&r.images.push({template:t.logos[0],type:"logo"}),t.default_links&&(t.default_links.action||t.default_links.info)&&(t.default_links.action&&t.default_links.action.url?i=t.default_links.action:t.default_links.info&&(i=t.default_links.info),r.sub_attributes.push({type:"",show:"tile",elements:[{type:"button",text:i.text,extra:i.extra,action_url:i.url}]})),r},getLocationByKey:function(n,t,i){var r,u,f;try{r=JSON.parse(atob(n.locationToken.split(".")[1])).iss}catch(e){return console.error("Failed to get public key from JWT:",e),!1}u="query($public_key: String, $locale: String, $key: String!) {venue(public_key: $public_key, locale: $locale, key: $key) {address city description images(count: 10) key logos name opening_hours providers default_links {action {extra key text url} info {extra key text url}} geocode {lat lng}}}";f={public_key:r,locale:n.htmlLang,key:t};$.ajax({type:"POST",dataType:"json",contentType:"application/json",headers:n.lib.getLocationHeaders(),url:n.lib.getContentApiUrl("graphql"),cache:!0,data:JSON.stringify({query:u,variables:f}),success:function(t){t&&t.data&&t.data.venue&&i($.extend({},n.lib_event.getLocationObjByVenueObj(n,t.data.venue)))}})},initLocations:function(n){var t=$(".locations-list");$(".show-all-locations").on("click",function(){t.removeClass("hide_non_final").find(".location-item").removeClass("hidden");$(this).parent().hide()});t.on("click",".more-par-toggle",function(){$(this).prevAll(".more-par").fadeIn().end().remove()});t.on("click",".details",function(){var t=$(this).closest(".location-item"),i=$(this).data("key"),r=$(this).data("isorganizer");t.data("itemdata")?n.lib_event.setLocationSuggestionsDetailModal(n,t):n.lib_event.getLocationByKey(n,i,function(i){t.data("itemdata",i);n.lib_event.setLocationSuggestionsDetailModal(n,t)})});t.on("click",".vote",function(){function r(n){var r=n.closest(".location-item"),t=r.find(".like-list"),u=t.find(".vote-count"),i=0;n.hasClass("active")?t.find(".bold").remove():u.after($("
").text($(".locations-list:last").data("name")).addClass("bold"));n.toggleClass("active");n.find("input").prop("checked",n.hasClass("active")?"checked":"");i=t.find('li:not(".vote-count"):not(".vote-count-toggle")').length;r.data("votes",i);u.text(i);t.toggleClass("hidden",i===0)}var t=$(this),i={ParticipantKey:$(".locations-list:last").data("key")?$(".locations-list:last").data("key"):$("#maincontainer").data("evp-key"),LocationId:t.data("id"),Score:t.hasClass("active")?0:1};$.ajax({type:"POST",dataType:"json",contentType:"application/json",headers:n.lib.getHeaders(),url:n.apiUrl+"/event/votelocation",data:JSON.stringify(i),success:function(i){i.ErrorOccurred?n.lib.showError(n.lib.translate(i.ErrorMessage)):r(t)}})});t.on("click",".set",function(){var n=$(this).closest(".location-item").find(".set"),t=!n.hasClass("active");n.toggleClass("active",t).closest(".location-item").toggleClass("final",t);n.find("input").prop("checked",n.hasClass("active")?"checked":"")});n.lib_event.initSortLocations(n)},fillLocationItems:function(n,t){if($(".locations-list .location-item").length>0){var i=$(".locations-list").data("isorganizer");$(".locations-list .location-item").each(function(){var i=$(this),r=i.data("key"),e=i.data("picked"),u=i.find(".extra"),f=i.find(".action-button"),o=i.find(".reviews");r?n.lib_event.getLocationByKey(n,r,function(r){var a,e,v,l,s;if(r)i.find(".extra").removeClass("hidden");else return;i.data("itemdata",r);var o=null,h=null,c=null;if(r.images&&r.images.length>0&&r.images.forEach(function(n){n.type==="logo"&&o===null&&(o=n)}),o&&o.template&&(o=n.lib.format(o.template,{width:"78",height:"49"})),r.sub_attributes&&r.sub_attributes.length>0&&r.sub_attributes.forEach(function(n){var t;if(n.type==="reviews"&&n.elements.length>0){var i=n.elements[0],r=i.value,u=i.label;r!=""&&u!=""}n.show==="tile"&&n.type!="toggle"&&n.elements.length>0&&(t=n.elements[0],h=t.action_url,c=t.text)}),o&&u.find("img").attr("src",o).removeClass("hidden"),h&&c?(a=u.find("a").attr("href",h).text(c).removeClass("hidden"),f.attr("href",h).text(c).addClass("showing"),a.length>0&&n.lib.logEvent("LocationActionButton","Shown_"+n.bodyId,a.closest(".location-item").data("key"))):n.bodyId==="page_event_pickconfirmation"&&$("#reserveText").hide(),n.bodyId==="page_event_pickconfirmation"&&$(".locations-list .location-item").length===1){if(e=null,$("#main-container").data("campaign-key")&&(v=$("#main-container").data("campaign-key").toLowerCase(),(v.includes("stage")||v==="snowworld - locations")&&(e=n.lib.translate("CTATicketReminder"))),r.providers&&r.providers.length>0&&!e)for(l=0;l'+e+"<\/p>")}typeof t=="function"&&t(i,r)}):n.bodyId==="page_event_pickconfirmation"&&$("#reserveText").hide()});$(".locations-list").on("click",".extra > a",function(){n.lib.logEvent("LocationActionButton","Clicked_"+n.bodyId,$(this).closest(".location-item").data("key"))})}},initSortLocations:function(n){if($(".locations-list .location-item").length>1){$(".locations-list").each(function(){$(this).find(".location-item").each(function(n){$(this).attr("data-index",n)})});$(".where_sort a").on("click",function(t){if(!$(this).hasClass("disabled")){var i=$(this).parent().data("sortby")==="votes";n.lib_event.sortLocations(n,i,!0);sessionStorage.setItem("where_sort",i?"votes":"location")}t.preventDefault()});$(".where_sort").length>0&&sessionStorage.getItem("where_sort")=="votes"&&n.lib_event.sortLocations(n,!0,!1)}},sortLocations:function(n,t,i){var r=$("#participants .item").length;t?($('.where_sort[data-sortby="votes"] a').addClass("disabled"),$('.where_sort[data-sortby="location"] a').removeClass("disabled")):($('.where_sort[data-sortby="location"] a').addClass("disabled"),$('.where_sort[data-sortby="votes"] a').removeClass("disabled"));i&&$(".locations-list").addClass("transparent");setTimeout(function(){$(".locations-list").each(function(){var i=$(this),u=i.find(".location-item.hidden").length===0,f=i.find(".location-item").get();f.sort(function(i,u){var f,e;return(t?(f=n.lib.leadingZero(parseInt($(u).data("votes")/r*100),3)+"_"+n.lib.leadingZero($(i).data("index"),6),e=n.lib.leadingZero(parseInt($(i).data("votes")/r*100),3)+"_"+n.lib.leadingZero($(u).data("index"),6)):(f=$(i).data("index"),e=$(u).data("index")),fe?1:0});$.each(f,function(n,t){var r=i.find(".location-item[data-index="+$(t).data("index")+"]").detach();r.hasClass("hidden")&&n<3&&!u&&!i.hasClass("hide_non_final")?r.removeClass("hidden"):!u&&n>2&&!r.hasClass("final")&&r.addClass("hidden");r.appendTo(i)})});$(".locations-list").removeClass("transparent")},i?150:0)},initSortDates:function(n){if($(".evd_details .eventdate").length>1){$(".evd_details .eventdate").each(function(n){$(this).attr("data-index",n)});$("#matrix-dates-scroll > ul").each(function(n){$(this).attr("data-index",n)});$(".when_sort a").on("click",function(t){if(!$(this).hasClass("disabled")){var i=$(this).parent().data("sortby")==="score";n.lib_event.sortDates(n,i,!0);sessionStorage.setItem("when_sort",i?"score":"date")}t.preventDefault()});sessionStorage.getItem("when_sort")=="score"&&n.lib_event.sortDates(n,!0,!1)}},sortDates:function(n,t,i){var r=$(".evd_details .eventdate").get(),u=$("#matrix-dates-scroll > ul").get();t?($("#when [data-sortby='score'] a").addClass("disabled"),$("#when [data-sortby='date'] a").removeClass("disabled")):($("#when [data-sortby='date'] a").addClass("disabled"),$("#when [data-sortby='score'] a").removeClass("disabled"));i&&$(".evd_details").addClass("transparent");setTimeout(function(){r.sort(function(i,r){var u,f;return(t?(u=n.lib.leadingZero(parseInt($(r).data("score")),10)+"_"+n.lib.leadingZero($(i).data("index"),6),f=n.lib.leadingZero(parseInt($(i).data("score")),10)+"_"+n.lib.leadingZero($(r).data("index"),6)):(u=$(i).data("index"),f=$(r).data("index")),uf?1:0});$.each(r,function(n,t){$(".evd_details").append(t)});$(".evd_details").removeClass("transparent")},i?150:0)},sortPollOptions:function(n,t,i){t==="score"?($("#polls [data-sortby='score'] a").addClass("disabled"),$("#polls [data-sortby='answer'] a").removeClass("disabled"),$("#polls [data-sortby='order'] a").removeClass("disabled")):t==="order"?($("#polls [data-sortby='order'] a").addClass("disabled"),$("#polls [data-sortby='answer'] a").removeClass("disabled"),$("#polls [data-sortby='score'] a").removeClass("disabled")):($("#polls [data-sortby='answer'] a").addClass("disabled"),$("#polls [data-sortby='score'] a").removeClass("disabled"),$("#polls [data-sortby='order'] a").removeClass("disabled"));$("#polls .poll").each(function(){var f=$(this),r=f.find(".poll_options"),u=r.find(".poll_option").get();i&&r.addClass("transparent");setTimeout(function(){t==="answer"?u.sort(function(t,i){var r,u;return r=n.lib.trailingSpace($.trim(n.lib.stripEmoji($(t).find(".poll_option_text").text().toLowerCase())),100)+"_"+n.lib.leadingZero(parseInt($(i).data("percentage")),3)+"_"+n.lib.leadingZero(parseInt($(t).data("order")),10),u=n.lib.trailingSpace($.trim(n.lib.stripEmoji($(i).find(".poll_option_text").text().toLowerCase())),100)+"_"+n.lib.leadingZero(parseInt($(t).data("percentage")),3)+"_"+n.lib.leadingZero(parseInt($(i).data("order")),10),r.localeCompare(u,n.htmlLang)}):t==="order"?u.sort(function(n,t){return parseInt($(n).data("order"))-parseInt($(t).data("order"))}):u.sort(function(t,i){var r,u;return r=n.lib.leadingZero(parseInt($(i).data("percentage")),3)+"_"+n.lib.leadingZero(parseInt($(t).data("order")),10),u=n.lib.leadingZero(parseInt($(t).data("percentage")),3)+"_"+n.lib.leadingZero(parseInt($(i).data("order")),10),r.localeCompare(u,n.htmlLang)});$.each(u,function(n,t){r.append(t)});r.removeClass("transparent")},i?150:0)})},setLocationAttributes:function(n,t,i,r,u){t.attributes&&t.attributes.length>0&&$.each(t.attributes,function(r,f){if(f.show=="all"||f.show==u){$.each(f.elements,function(i,r){if(r.label===n.lib.translate("Description")&&i'+(r.label&&r.label!=""?""+n.lib.htmlEncode(r.label.replace("€","€"))+":<\/strong> ":"")+n.lib.htmlEncode(r.value)+"<\/p>").appendTo(i);break;case"address":r.value&&r.value!=""&&r.value&&r.value!=""&&$(''+(r.label&&r.label!=""?""+n.lib.htmlEncode(r.label)+":<\/strong> ":"")+''+n.lib.htmlEncode(r.value)+"<\/p>").appendTo(i)}})}}});t.sub_attributes&&t.sub_attributes.length>0&&$.each(t.sub_attributes,function(t,i){var o,e,f;if(i.show=="all"||i.show==u)switch(i.type){case"reviews":$.each(i.elements,function(n,t){t.value});break;case"score":e=$("