var widget=function(){"use strict";var Se=Object.defineProperty;var Te=(A,h,E)=>h in A?Se(A,h,{enumerable:!0,configurable:!0,writable:!0,value:E}):A[h]=E;var f=(A,h,E)=>Te(A,typeof h!="symbol"?h+"":h,E);const A=()=>{const n=document.querySelector("[data-gyg-partner-id]");if(n)return n.getAttribute("data-gyg-partner-id")},h=()=>{let n="";const t=document.querySelector("[data-gyg-widget]");return t&&(n=t.dataset.gygPartnerId,n||([,,,n]=document.querySelector("[data-gyg-widget]").dataset.gygHref.split("/"))),n},E=()=>{let n="";const t=document.querySelector('script[src*="getyourguide.com/v2/core"]');if(t){const e=t.attributes.onload.value.split("'"),r=e.findIndex(o=>o==="partnerId");n=e[r+2]}return n},Q=()=>{const n=A();if(n)return n;const t=h();if(t)return t;const e=E();return e||null},Z=(n,t=null)=>{const e=document.getElementsByTagName("head")[0],r=document.createElement("script");r.async=!0,r.src=n,t&&(r.setAttribute("data-gyg-partner-id",t),r.setAttribute("data-gyg-script-origin","widget")),e==null||e.appendChild(r)},tt=n=>{const t="https://widget.getyourguide.com/dist/pa.umd.production.min.js";!document.querySelector(`script[src*="${t}"]`)&&!["getyourguide","gygdev.gygtest","localhost","127.0.0.1","wp-admin"].some(o=>n.location.hostname.includes(o))&&Z(t,n.GYG.partnerHash)},et=(n,t)=>{if(!n||!t)return;const e=n.parentElement;e.style.height=`${t}px`},L="data-gyg-widget-rendered",nt=n=>{n.hasAttribute(L)||n.setAttribute(L,`${Date.now()}`)},rt=(n,t,e)=>{n.setAttribute(`data-gyg-widget-${t}`,`${e}`)},ot=n=>{window.addEventListener("message",t=>n(t),!1)},at=n=>{const{height:t=0,widgetContext:e=null,channel:r=null,name:o=null,metrics:i={}}=n.data;if(r==="GYG"&&o){const a=document.querySelector(`iframe[name="${o}"]`);if(!a)return;et(a,t),nt(a);for(const[c,s]of Object.entries(i))typeof s=="number"&&rt(a,c,s);e&&Object.prototype.hasOwnProperty.call(e,"hasWidgetContext")&&!e.hasWidgetContext&&a.parentElement.sendContext({...e})}};var T,it=new Uint8Array(16);function st(){if(!T&&(T=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!T))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return T(it)}const ct=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function M(n){return typeof n=="string"&&ct.test(n)}for(var d=[],R=0;R<256;++R)d.push((R+256).toString(16).substr(1));function B(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(d[n[t+0]]+d[n[t+1]]+d[n[t+2]]+d[n[t+3]]+"-"+d[n[t+4]]+d[n[t+5]]+"-"+d[n[t+6]]+d[n[t+7]]+"-"+d[n[t+8]]+d[n[t+9]]+"-"+d[n[t+10]]+d[n[t+11]]+d[n[t+12]]+d[n[t+13]]+d[n[t+14]]+d[n[t+15]]).toLowerCase();if(!M(e))throw TypeError("Stringified UUID is invalid");return e}function lt(n){if(!M(n))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(n.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(n.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(n.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(n.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}function dt(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e>>32-t}function ht(n){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){var r=unescape(encodeURIComponent(n));n=[];for(var o=0;o>>0;U=P,P=b,b=_(x,30)>>>0,x=C,C=ve}e[0]=e[0]+C>>>0,e[1]=e[1]+x>>>0,e[2]=e[2]+b>>>0,e[3]=e[3]+P>>>0,e[4]=e[4]+U>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var pt=ft("v5",80,ht);const yt="https://widget.getyourguide.com",v="https://widget.getyourguide.com",wt=`${v}/default/activities.frame`,bt=`${v}/default/activities-auto.frame`,At=`${yt}/widget-context`,Ct=`${v}/auto-widget-context`,xt=`${v}/metadata-extracted`,Et=`${v}/gnikcart`,k=n=>{if(Object.prototype.hasOwnProperty.call(n,"GYG")||(n.GYG=n.GYG||{}),!n.GYG.visitorIdPromise){const t=St();n.GYG.visitorIdPromise=fetch(t,{credentials:"include"}).then(e=>e.json()).catch(()=>{const e=vt("visitor_id")??N().replace(/-/g,"").toUpperCase().substring(0,32);n.GYG.visitorIdPromise=Promise.resolve({visitor_id:e,scm:!1})})}return n.GYG.visitorIdPromise};function vt(n){const e=document.cookie.split("; ").find(r=>r.startsWith(`${n}=`));return e?e.split("=")[1]:null}function St(){const n=btoa(JSON.stringify({partner_id:window.GYG.partnerHash,url:window.location.hostname+window.location.pathname})),t=new URL(Et);return t.searchParams.append("q",n),t.toString()}const Tt=()=>{let n=!0;const t=document.querySelector("[data-gyg-load-ia]");return t&&(n=t.dataset.gygLoadIa!=="0"),n};class O{constructor(){f(this,"createdAttribute");this.createdAttribute="data-gyg-widget-created"}scrape(t){const e=Array.from(t.querySelectorAll("[data-gyg-widget]"));return e==null?void 0:e.filter(r=>!r.getAttribute(this.createdAttribute))}markElement(t){t.setAttribute(this.createdAttribute,Date.now().toString())}refreshWidgets(t){return Array.from(t.querySelectorAll(`[${this.createdAttribute}]`)).forEach(r=>{const o=r.querySelector("iframe");r.removeChild(o),r.removeAttribute(this.createdAttribute)})}async build({el:t,attributes:e}){const{visitor_id:r}=await window.GYG.visitorIdPromise;t.innerHTML="";const o=this.buildUrl(e,r),i=this.createIframe(o);t.appendChild(i)}buildUrl(t,e){let r=t.href;if(!r&&t.widget&&(r=`https://widget.getyourguide.com/default/${t.widget}.frame`),!r)throw new Error("Missing href or widget");delete t.href;const o=Object.keys(t).map(a=>`${encodeURIComponent(a)}=${encodeURIComponent(t[a])}`).join("&"),i=encodeURIComponent(window.location.href);return`${r}?${o}&website=${i}&visitor_id=${e}`}createIframe(t){const e=document.createElement("iframe"),r=~t.indexOf("http")?t:`https:${t}`;return e.setAttribute("src",r),e.setAttribute("name",`GYG-${N()}`),e.setAttribute("frameborder","0"),e.setAttribute("scrolling","no"),e.setAttribute("title","GetYourGuide Widget"),e.style.border="none",e.style.position="relative",e.style.visibility="visible",e.style.display="block",e.style.margin="0",e.style.padding="0",e.style.width="100%",e.style.height="100%",e}}const It=(n,...t)=>{window.GYG.debug&&console.info(`%c[CL][${n}]`,"color: aqua; font-weight: bold;",...t)},Pt=["H2","H3","H4"],Gt=20,Rt=1e3,_t=500,Ot=2e3,Dt=["http","img","function","typeof","ajax","javascript","document.","html","px;","color:","div-","css","display:","window.","visibility:"],q=n=>Pt.includes(n),D=n=>{let t="";if(n.tagName==="IMG"){const r=n.getAttribute("ALT");r&&(t+=r+" ")}for(const r of n.getElementsByTagName("IMG")){const o=r.getAttribute("ALT");o&&(t+=o+" ")}return t},W=n=>{let t="";return n&&(F(n)||(t=n)),t},Wt=(n,t,e)=>t.tagName==="BODY"||e===Gt||!S(n),S=n=>{const t=n.content,e=n.hasAlreadyPassedFirstHeader;return!t||t.length<_t&&e||t.lengthDt.some(t=>n.includes(t)),y=n=>!n||typeof n!="string"?null:n.replace(/(<([^>]+)>)/gi,"").replace(/(?:https?|ftp):\/\/[\n\S]+/g,"").replace(/(\r\n|\n|\r)/gm,"").replace(/([\u00a0\t])/g," ").replace(/ +/g," ").trim().slice(0,Ot),Ht="5742218a-b6de-4ca2-8e9f-31b9c223125e";async function Ut(n){return pt(n,Ht)}function Lt(n){const t={p:n.paragraph??"",h:n.sectionHeading??"",m:n.metaDescription??"",t:n.metaTitle??""};return Ut(JSON.stringify(t))}function Mt({target:n}){return new Nt({target:n})}function Bt({target:n}){return new kt({target:n})}class ${constructor({target:t}){f(this,"target");f(this,"payload");f(this,"sentPayload");this.target=t,this.sentPayload=!1,this.payload={language:this.getLanguage,metaTitle:this.getMetaTitle,metaDescription:this.getMetaDescription,sectionHeading:this.getPreviousHeaderContent,paragraph:this.scrapeBlogPostContent,url:window.location.href},It("PageContext",this.payload),this.target.sendContext=this.sendContext.bind(this)}async getSha(){return Lt(this.payload)}get getLanguage(){return document.documentElement.lang||null}get getMetaTitle(){return y(document.title)}get getMetaDescription(){const t=document.querySelector("meta[name=description]");return t&&t.content?y(t.content):null}get getPreviousHeaderContent(){let t=null,e=this.target.previousElementSibling;for(;e;)q(e.tagName)?(t=e.textContent,e=null):e=e.previousElementSibling;return y(t)}get scrapeBlogPostContent(){const t=this.scrapeUpSideContentInsideWidgetContext();return S(t)&&this.scrapeDownSideContentInsideWidgetContext(t),S(t)&&this.scrapeUpSideContentOutsideWidgetContext(t),y(t.content)}scrapeUpSideContentInsideWidgetContext(){const t=this.target.textContent,e=t===null?"":t;let r=F(e)?"":e,o=this.target.previousElementSibling,i=!1;for(;o;){const a=q(o.tagName);if(o.tagName==="BODY"||!S({hasAlreadyPassedFirstHeader:i||a,content:r})){o=null;break}else!i&&a?i=!0:(r=D(o)+" "+r,r=W(o.textContent)+" "+r);o=o.previousElementSibling}return{content:r,hasAlreadyPassedFirstHeader:i}}scrapeDownSideContentInsideWidgetContext(t){let e=this.target.nextElementSibling;for(;e;)if(!S(t))e=null;else{const r=D(e);t.content=t.content+" "+r;const o=W(e.textContent);t.content=t.content+" "+o,e=e.nextElementSibling}}scrapeUpSideContentOutsideWidgetContext(t){let e=this.target.parentElement,r=0;for(;e&&!Wt(t,e,r);){let o=e.previousElementSibling;for(;o;){const i=W(o.textContent);t.content=i+" "+t.content;const a=D(o);t.content=a+" "+t.content,o=o.previousElementSibling}e=e.parentElement,++r}}}class Nt extends ${sendContext(t){const e=new Blob([JSON.stringify({...this.payload,...t})],{type:"text/plain"});navigator.sendBeacon&&!this.sentPayload&&(navigator.sendBeacon(At,e),this.sentPayload=!0)}}class kt extends ${sendContext(t){const e=new Blob([JSON.stringify({...this.payload,...t})],{type:"text/plain"});navigator.sendBeacon&&!this.sentPayload&&(navigator.sendBeacon(Ct,e),this.sentPayload=!0)}}const qt=n=>n.split(/(?=[A-Z])/).join("_").toLowerCase(),Ft=n=>n.split(/(?=[A-Z])/).join("-").toLowerCase();function $t(n){return Object.keys(n.dataset).filter(t=>t.indexOf("gyg")!==-1).reduce((t,e)=>{const r=qt(Yt(e));return{...t,[r]:n.dataset[e]}},{})}function Yt(n){return n.slice(3)}function jt(n){return n.getAttribute("data-gyg-widget")==="auto"}async function Vt(n){const t=await n.getSha(),e=window.GYG.partnerHash;return{sha:t,href:bt,...e?{partner_id:e}:{}}}function Xt(n){let t=n.parentElement;for(;t;){const e=t.querySelector("p a");if(e)return e;t=t.parentElement}return null}function zt(n){let t=n.parentElement;for(;t;){const e=t.querySelector("p");if(e)return getComputedStyle(e).fontSize;t=t.parentElement}return null}const Y=n=>n==="rgba(0, 0, 0, 0)"||n==="transparent";function Jt(n){let t=n.parentElement;for(;t;){const e=getComputedStyle(t).backgroundColor;if(!Y(e))return e;t=t.parentElement}return null}function Kt(n){const t=getComputedStyle(n).backgroundColor;return Y(t)?null:t}function j(n){const t=getComputedStyle(n).fontFamily;return t&&t.trim()!==""&&t!=="initial"?t:n.parentElement?j(n.parentElement):null}const H="data-gyg-widget",Qt=[H,"data-gyg-location-id","data-gyg-q","data-gyg-lat","data-gyg-lon","data-gyg-number-of-items","data-gyg-tour-ids","data-gyg-excluded-tour-ids","data-gyg-locale-code","data-gyg-tour-id","data-gyg-currency","data-gyg-variant","data-gyg-widget-created"];function Zt(n,t){let e=null;return(...r)=>{e&&clearTimeout(e),e=setTimeout(()=>{n(...r)},t)}}class te extends O{constructor(e){super();f(this,"els");f(this,"generateWidgetsDebounced",Zt(this.generateWidgets.bind(this),100));this.els=e,this.start()}start(){this.generateWidgets(document),new MutationObserver(e=>{for(const r of e)r.type==="childList"&&r.addedNodes.forEach(o=>{o.nodeType===Node.ELEMENT_NODE&&(o.hasAttribute(H)||o.querySelector(`[${H}]`))&&this.generateWidgetsDebounced(document)}),r.type==="attributes"&&this.generateWidgetsDebounced(document)}).observe(document.body,{childList:!0,subtree:!0,attributeFilter:Qt})}async generateWidgets(e){const r=this.scrape(e);this.els.push(...r);for(const o of r){this.markElement(o);const i=getComputedStyle(o).fontFamily,a=j(o),c=zt(o),s=Xt(o),l=s?getComputedStyle(s).color:"",u=s?getComputedStyle(s).textDecoration:"",w=Jt(o),g=Kt(o),p=$t(o);typeof p.q=="string"&&(p.q=p.q.replace(/%20/g," "));const m=e.documentElement.lang,C={...p,...m?{document_lang:m}:{},...i!==""?{host_font_family:i}:{},...a?{host_font_family_v2:a}:{},...c?{host_font_size:c}:{},...l!==""?{host_link_color:l}:{},...u!==""?{host_link_decoration:u}:{},...w?{parent_background_color:w}:{},...g?{host_background_color:g}:{}};if(jt(o)){const x=Bt({target:o}),b=await Vt(x);this.build({el:o,attributes:{...b,...C}})}else{const b=await Mt({target:o}).getSha();this.build({el:o,attributes:{sha:b,...C}})}}}}class ee extends O{constructor(e,r,o){super();f(this,"els");this.els=e,this.convertOptionsToDataAttributes(r,o)}convertOptionsToDataAttributes(e,r){e.setAttribute("data-gyg-href",wt),e.setAttribute("data-gyg-widget","activities");for(const[o,i]of Object.entries(r))e.setAttribute(`data-gyg-${Ft(o)}`,i)}}const ne=.8,re=1.5,oe=3,ae=75,ie=600,se=12,ce=12,le=2,de=2e3;function V(n,t){const e=window.getComputedStyle(n);e.maxWidth!=="none"&&(t.style.maxWidth=e.maxWidth,t.style.marginLeft="auto",t.style.marginRight="auto")}function ue(n){if(!n)return!1;const t=[...n.children];for(const e of t){const r=window.getComputedStyle(e);if(r.float!=="none"&&r.float!=="")return!0}return!1}function ge(n,t){const e=[...document.querySelectorAll("[data-gyg-widget]")],r=n.getBoundingClientRect();for(const o of e){const i=o.getBoundingClientRect();if(Math.abs(i.top-r.bottom){const s=c.getBoundingClientRect(),l=s.width>r,u=s.bottom+window.scrollY>t*re,w=!ue(c.parentElement),g=!ge(c,t*oe);return l&&u&&w&&g});if(o.length===0)return null;let i=o[0],a=i.getBoundingClientRect().bottom;for(const c of o){const s=c.getBoundingClientRect().bottom;s p")].filter(e=>e.getBoundingClientRect().height>ae);return X(t)}function me(){const t=[...document.querySelectorAll("h1, h2, h3, h4, h5, h6")].filter(e=>getComputedStyle(e).display==="block");return X(t)}function he(){const n=document.createElement("div");n.setAttribute("data-gyg-widget","auto"),n.style.marginTop=`${se}px`,n.style.marginBottom=`${ce}px`;const t=I("data-gyg-global-excluded-keywords");t&&n.setAttribute("data-gyg-excluded-keywords",t);const e=I("data-gyg-global-cmp");return e&&n.setAttribute("data-gyg-cmp",e),n}function pe(){const n=document.querySelectorAll("[data-gyg-widget]").length,t=I("data-gyg-global-auto-insert-limit");let e=le;return t&&(e=parseInt(t,10)),e-n}function ye(){const n=he(),t=me();if(t)V(t,n),t.before(n);else{const e=fe();e&&(V(e,n),e.after(n))}}function we(){const n=z("data-gyg-global-excluded-host-urls");if(n){const t=window.location.pathname;for(const e of n)if(t===e)return!0}return!1}function be(){const n=z("data-gyg-global-allowed-host-path-prefixes");if(n){const e=window.location.pathname;for(const r of n)if(e.startsWith(r))return!0;return!1}const t=I("data-gyg-global-allowed-host-css-selector");return t?!!document.querySelector(t):!0}function z(n){const t=document.querySelector(`[${n}]`);if(t){const e=t.getAttribute(n);if(e)return e.split(",").map(r=>r.trim())}return null}function I(n){const t=document.querySelector(`[${n}]`);if(t){const e=t.getAttribute(n);if(e)return e.trim()}return null}function J(){const n=!!document.querySelector("[data-gyg-global-auto-insert]"),t=document.readyState==="complete";if(n&&t&&be()&&!we()){const e=pe();for(let r=0;r{const l=c.getBoundingClientRect().top,u=s.getBoundingClientRect().top;return l-u});let a=0;for(let c=1;c{const r=e.data;if(r.channel!=="GYG-activities-auto")return;const{name:o,widgetConfig:i}=r,a=document.querySelector(`iframe[name="${o}"]`);if(!a)return;const c=a.parentElement;c&&(n.set(c,i),t())})}class Ee{constructor(t,e=!1){f(this,"payload");f(this,"sentPayload");f(this,"shouldSendPostRequest");this.sentPayload=!1,this.shouldSendPostRequest=e,this.payload={metaTitle:this.getMetaTitle,metaDescription:this.getMetaDescription,sectionHeading:this.extractSectionHeadings,paragraph:this.extractParagraphs,url:window.location.hostname+window.location.pathname,partnerHashCode:t}}get getMetaTitle(){return y(document.title)??null}get getMetaDescription(){const t=document.querySelector("meta[name=description]");return t&&t.content?y(t.content):null}get extractSectionHeadings(){var i;const t=document.querySelectorAll("h1, h2, h3, h4, h5, h6, [class*=page-title], [class*=content-title], [class*=blog-title]"),e=Array.from(document.querySelectorAll("a, p, nav, script, style, link, iframe, svg, img, picture, [class*=hidden]")),r=new WeakSet,o=[];for(const a of t)if(!e.includes(a)){const c=(i=a.textContent)==null?void 0:i.trim();c&&c!==""&&!r.has(a)&&(o.push(c),r.add(a))}return o.join(" ").length?y(o.join(" ").slice(0,8e3)):null}get extractParagraphs(){const t=["main","article","[class*=content]","[class*=post]","[class*=article]","[class*=main]","[class*=blog]"],e=new WeakSet,r=[];for(const o of t){const i=document.querySelectorAll(o);i&&i.forEach(a=>{var c;if(!e.has(a)){const s=a.cloneNode(!0);s.querySelectorAll("h1, h2, h3, h4, h5, h6, script, style, a, iframe, svg, nav, input, form").forEach(l=>l.remove()),r.push(((c=s.textContent)==null?void 0:c.trim())||""),e.add(a)}})}return r.join(" ").length?y(r.join(" ").slice(0,8e3)):null}postPageContext(){const t=new Blob([JSON.stringify(this.payload)],{type:"text/plain"});navigator.sendBeacon&&!this.sentPayload&&this.shouldSendPostRequest&&(navigator.sendBeacon(xt,t),this.sentPayload=!0)}}return(async()=>{if(window.GYG=window.GYG||{},Object.prototype.hasOwnProperty.call(window.GYG,"Widget"))return;window.GYG.debug=window.location.search.includes("debug=true")||!1;const n=Q();window.GYG.partnerHash=n,window.GYG.els=window.GYG.els||[],ot(at),window.GYG.Widget=async(r,o)=>{await k(window),new ee(window.GYG.els,r,o)},window.GYG.refresh=()=>{class r extends O{}new r().refreshWidgets(document)};const t=await k(window);new te(window.GYG.els),Tt()&&tt(window),Ae(),xe(),n&&t&&t.scm===!0&&new Ee(n,t.scm).postPageContext()})()}();