(()=>{"use strict";var e={8102:e=>{e.exports=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},2264:(e,t,i)=>{const s=i(8102),n=new Map;function r(e,t){t={caseSensitive:!1,...t};const i=e+JSON.stringify(t);if(n.has(i))return n.get(i);const r="!"===e[0];r&&(e=e.slice(1)),e=s(e).replace(/\\\*/g,"[\\s\\S]*");const a=new RegExp(`^${e}$`,t.caseSensitive?"":"i");return a.negated=r,n.set(i,a),a}e.exports=(e,t,i)=>{if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError(`Expected two arrays, got ${typeof e} ${typeof t}`);if(0===t.length)return e;const s="!"===t[0][0];t=t.map((e=>r(e,i)));const n=[];for(const i of e){let e=s;for(const s of t)s.test(i)&&(e=!s.negated);e&&n.push(i)}return n},e.exports.isMatch=(e,t,i)=>{const s=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t];return s.some((e=>n.every((t=>{const s=r(t,i),n=s.test(e);return s.negated?!n:n}))))}},5385:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AggEvent=void 0;const n=i(3208),r=s(i(1537));class a{constructor(e,t){this.queue=[],this.timerHandle=0,this.currentLocation=null,this.flush=()=>{if(clearTimeout(this.timerHandle),0===this.queue.length)return;const e=function(e){const t=e=>{const t=e.event;return(0,n.isWidgetLifecycleEvent)(e)&&("widgetLoad"===t||"missedLoad"===t)},i=e;return e.filter(((e,s)=>!t(e)||s===i.findIndex((i=>t(i)&&i.type===e.type&&i.item_id===e.item_id))))}(this.queue),t={organization_id:this.organization_id,sid:r.default.getId()||"",events:e,url:this.currentLocation||""};this.queue=[],this.currentLocation=null,this.api.sendBeacon("/agg-event",t)},this.send=e=>{const t=window.location.href;this.currentLocation||(this.currentLocation=t),this.queue.push({...e,url:this.currentLocation!==t?t:void 0}),clearTimeout(this.timerHandle),this.queue.length>=a.maxQueueLength?this.flush():this.timerHandle=setTimeout(this.flush,a.sendDelay)},this.api=e,this.organization_id=t,window.addEventListener("visibilitychange",this.flush),window.addEventListener("pagehide",this.flush)}}t.AggEvent=a,a.maxQueueLength=10,a.sendDelay=1e3},9563:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){this.apiDomain=e}request(e,t,i,s){const n=new XMLHttpRequest;"/"===t.charAt(0)&&(t=`${this.apiDomain}${t}`),n.open(e,t),"GET"===e||"HEAD"===e?n.send():(n.setRequestHeader("Content-Type","application/json;charset=UTF-8"),n.send(JSON.stringify(i))),n.onload=function(){if(200!=n.status)s({status:n.status,message:n.statusText});else{const t="HEAD"!==e?JSON.parse(n.response):{};s(null,t)}},n.onerror=function(){s({status:n.status,message:n.statusText})}}get(e,t){return this.request("GET",e,void 0,t)}post(e,t,i){return this.request("POST",e,t,i)}head(e,t){return this.request("HEAD",e,{},t)}sendBeacon(e,t){const i=this.apiDomain+e;navigator.sendBeacon?navigator.sendBeacon(i,new Blob([JSON.stringify(t)])):this.post(i,t,(()=>{}))}}},7201:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.checkConversionPath=void 0;const s=i(2264);t.checkConversionPath=e=>(0,s.isMatch)(window.location.pathname,e)||(0,s.isMatch)(`${window.location.protocol}//${window.location.hostname}${window.location.pathname}`,e)},3734:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(7201),n=i(8980);class r{constructor(e){this.listener=()=>(0,n.tmary)("conversion",{id:e.id}),this.setupConversion(e)}setupConversion(e){const{querySelector:t,event:i,pathname:n}=e;if((!n||(0,s.checkConversionPath)(n))&&t){document.querySelectorAll(t).forEach((e=>{-1===r.handledElements.indexOf(e)&&(e.addEventListener(i,this.listener),r.handledElements.push(e))}))}}}t.default=r,r.handledElements=[]},4657:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDOMChangeHandler=t.addPageloadHandler=t.resetHandlers=void 0;let i=[],s=[],n=!1,r=null;t.resetHandlers=()=>{i=[],s=[],n=!1,r=null};t.addPageloadHandler=e=>{i.push(e),n||d()};t.addDOMChangeHandler=e=>{s.push(e),n||d()};const a=()=>{r!==window.location.href&&(r=window.location.href,i.forEach((e=>e())))},o=()=>{const e=document.querySelector("body");e&&new MutationObserver((e=>{e.some((e=>e.addedNodes.length>0))&&(a(),s.forEach((e=>e())))})).observe(e,{childList:!0,subtree:!0})},d=()=>{window.addEventListener("hashchange",a),window.addEventListener("popstate",a),window.history.pushState=new Proxy(window.history.pushState,{apply:(e,t,i)=>(setTimeout(a,1),e.apply(t,i))}),o(),n=!0}},6410:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getHiddenFields=t.getLandingFields=void 0;const i=["utm_campaign","utm_content","utm_medium","utm_source","utm_term"];t.getLandingFields=e=>e.split("&").map((e=>e.split("="))).filter((e=>i.includes(e[0])&&2===e.length)).map((e=>e.map((e=>decodeURIComponent(e))))).reduce(((e,[t,i])=>({...e,[t]:i})),{});t.getHiddenFields=e=>({referrer:e.referrer||"",hostname:e.location.hostname,landingPage:e.location.pathname,...(0,t.getLandingFields)(e.location.search?.slice(1)||"")})},1537:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Session=void 0;const s=i(6410),n=(e=6)=>{try{let t="";return window.crypto.getRandomValues(new Uint8Array(e)).forEach((e=>{t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-".charAt(e>>2)})),t}catch(e){return Math.random().toString()}},r=e=>({id:n(),updatedAt:(new Date).getTime(),hiddenFields:(0,s.getHiddenFields)(e),experiments:{},conversions:[],hasInteraction:[],hasWidgetLoad:[]});class a{constructor(e=document){this.getHiddenFields=()=>({...this.session.hiddenFields,location:window.location.pathname}),this.testAndSet=(e,t)=>!!this.session[e].includes(t)||(this.session[e].push(t),this.writeSession(),!1),this.getWidgetInteractionHistory=()=>{const e={hasWidgetLoad:"widgetLoad",hasInteraction:"interaction"},t=Object.keys(e).map((e=>this.session[e])).flat();return Object.fromEntries(t.map((t=>[t,Array.from(new Set(Object.entries(e).filter((([e])=>this.session[e].includes(t))).map((([,e])=>e))))])))};const t=this.loadSession(),i=r(e);(e=>!(e&&e.updatedAt&&e.id)||(new Date).getTime()-e.updatedAt>36e5)(t)?this.session=i:this.session={...i,...t,updatedAt:(new Date).getTime()},this.writeSession()}loadSession(){try{const e=localStorage.getItem("tmary");if(!e)return null;return JSON.parse(e)}catch(e){return null}}writeSession(){try{localStorage.setItem("tmary",JSON.stringify(this.session))}catch(e){}}clear(){this.session=r(document),this.writeSession()}getId(){return this.session.id}}t.Session=a,t.default=new a},8980:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tmary=void 0;var s=i(9686);Object.defineProperty(t,"tmary",{enumerable:!0,get:function(){return s.tmary}})},5214:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(i(9563)),r=i(7201),a=s(i(3734)),o=i(4657),d=s(i(1537)),h=i(8980),l=s(i(1970)),c=s(i(1734)),u=s(i(400));t.default=class{constructor(e,t){this.pageLoadConversions=[],this.pageLoadConversionsProcessed=!1,this.updateApp=e=>{e&&(e.frontendConversions&&(this.setupFrontendConversions(e.frontendConversions),(0,o.addDOMChangeHandler)((()=>this.setupFrontendConversions(e.frontendConversions)))),this.pageLoadConversions=e.pageLoadConversions||[],this.tag.setIsFirstInit(e.isFirstInit),this.tag.setIsHeadScriptInit(e.isFirstHeadScriptInit),e.popup&&(this.popup=new c.default(e.popup)),e.widget&&(this.widget=new u.default(this.tag,null,e.widget)),e.experiment&&(this.experiment=new l.default(this.tag,e.experiment)))},this.api=new n.default("https://embed.trustmary.io"),this.appId=e,this.tag=t,this.loadingPromise=new Promise(((e,t)=>{this.loadApp((t=>{this.updateApp(t),(0,o.addPageloadHandler)((()=>{this.widget&&this.widget.destroy(),this.experiment&&this.experiment.destroy(),this.loadApp((e=>this.updateApp(e))),(0,h.tmary)("pageview")})),e()}),t)}))}loadApp(e,t){const i=Object.keys(d.default.session.experiments).map((e=>`${e}-variantId=${d.default.session.experiments[e].variantId}`)),s=window;s.hasTrustmaryPopupFromTag&&i.push(`hasPopupFromTag=${s.hasTrustmaryPopupFromTag.toString()}`);const n=i.join("&");this.api.get(`/app/${this.appId}?${(()=>{const e={locale:navigator.language,timezoneOffset:(new Date).getTimezoneOffset(),href:window.location.href};return Object.keys(e).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&")})()}${n.length?`&${n}`:""}`,((i,s)=>{i?(console.log(i),t&&t(i)):e(s)}))}setupFrontendConversions(e){e.forEach((e=>{new a.default(e)}))}setupPageLoadConversions(){this.pageLoadConversionsProcessed||(this.pageLoadConversionsProcessed=!0,this.pageLoadConversions.forEach((e=>{this.processPageLoadConversion(e),(0,o.addPageloadHandler)((()=>this.processPageLoadConversion(e)))})))}processPageLoadConversion({id:e,pathname:t}){(0,r.checkConversionPath)(t)&&(0,h.tmary)("conversion",{id:e})}}},1970:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(126),r=s(i(400));t.default=class{constructor(e,t){this.destroy=()=>{this.widget?.destroy()},this.experimentData=t,this.tag=e,this.loadExperiment()}loadExperiment(){if(this.experimentData){const e=n.ExperimentManager.getExperimentManagerInstance(this.tag);e.addExperiment(this.experimentData.id,(t=>{if(!t||!this.experimentData)return;e.getWidgetId(this.experimentData.id)&&(this.widget=new r.default(this.tag,null,t))}),this.experimentData)}}}},7047:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(i(9384));class r extends n.default{processElement(e){return!(!e||!e.dataset.trustmaryForm)&&(this.surveyId=e.dataset.trustmaryForm,!0)}render(){this.frame=this.doc.createElement("iframe"),this.frame.onload=()=>this.handleFrameLoad(),this.frame.id=`trustmary-form-${this.id}`,this.frame.style.cssText="display: block;width: 1px; min-width: 100%;height: 0;border:none;",this.frame.scrolling="no",this.frame.allow="camera;microphone;",this.frame.src=`https://trustmary.com/form/${this.surveyId}${this.query}`,this.frame.allowtransparency=!0,this.el.appendChild(this.frame),this.addMessageListener()}}t.default=r},1130:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(9871);t.default=class{constructor(e,t,i){this.postMessage=(e,t={})=>{this.frame.contentWindow?.postMessage({frameId:this.id,type:e,attr:t},"*")},null!=t&&(this.id=`embed-${e}`,this.el=this.parseEl(t),this.embedId=t.dataset.trustmaryEmbed,this.doc=t.ownerDocument,this.frameLoaded=!1,this.attributes=(0,s.parseElementAttributes)(t),this.handleFrameMessage=this.handleFrameMessage.bind(this),this.siteStyles="string"==typeof i?i.trim():"",this.renderFrame())}parseEl(e){if("A"===e.tagName){const t=e.ownerDocument.createElement("div");t.classList.add("trustmary-embed-root");const i=e;return i.parentNode?.insertBefore(t,i),i.target="_blank",i.style.cssText="\n        display: block;\n        text-decoration: none;\n        text-indent: -5000em;\n        background: url('https://d2nce6johdc51d.cloudfront.net/img/tm-badge.svg') no-repeat center center rgba(0,0,0,0.3);\n        border-radius: 2px;\n        border: none;\n        width: 88px;\n        height: 25px;\n        margin: 20px auto;\n        padding: 0;\n        position: static;\n      ",t}return e.classList.add("trustmary-embed-root"),e}renderFrame(){this.frame=this.doc.createElement("iframe"),this.frame.onload=()=>this.handleFrameLoad(),this.frame.id=`trustmary-embed-frame-${this.id}`,this.frame.style.cssText="display: block;width: 1px; min-width: 100%;height: 0;border:none;max-height: none;background: transparent;",this.frame.src="about:blank",this.frame.scrolling="no",this.el.appendChild(this.frame),this.frame.contentWindow?.document.open(),this.frame.contentWindow?.document.write(this.getFrameContents()),this.frame.contentWindow?.document.close()}getFrameContents(){return`\n<!DOCTYPE HTML>\n<html>\n  <head>\n    <script>\n      TRUSTMARY_EMBED_ID = "${this.embedId}";\n      TRUSTMARY_FRAME_ID = "${this.id}";\n      TRUSTMARY_API_DOMAIN = "https://embed.trustmary.io";\n      TRUSTMARY_ATTRIBUTES = ${JSON.stringify(this.attributes)};\n    <\/script>\n    <link rel="stylesheet" href="https://embed.trustmary.com/frame/frame.78b37d86ea8c.css" />\n    <style id="embed-styles"></style>\n    ${this.siteStyles?`\n      <style>\n        ${this.siteStyles}\n      </style>\n    `:""}\n  </head>\n  <body>\n    <div id="app"></div>\n    <script src="https://embed.trustmary.com/frame/frame.78b37d86ea8c.js"><\/script>\n  </body>\n</html>\n`}handleFrameLoad(){this.frameLoaded||(this.frameLoaded=!0,window.addEventListener("message",this.handleFrameMessage,!1))}remove(){this.handleFrameUnload()}handleFrameUnload(){window.removeEventListener("message",this.handleFrameMessage,!1),this.el.innerHTML="",this.el.dataset.trustmaryStatus="removed"}handleFrameMessage({data:e}){null!=e&&e.frameId===this.id&&("resize"===e.type&&e.attr.height&&this.setFrameHeight(e.attr.height),"openVideo"===e.type&&this.openVideo(e.attr))}openVideo(e){const{TrustmaryEmbed:t}=window;t.openPlayer(null,e)}setFrameHeight(e){this.frame.style.height=`${e}px`}updateTheme(e){this.postMessage("updateTheme",{theme:e})}updateData(e){this.postMessage("updateData",e)}}},373:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){const{src:s="",poster:n="",playlist:r=[],autoplay:a=!1,videoId:o}=i||{},d=i&&i.doc?i.doc:document;this.overlay=!t,t&&t.dataset.trustmaryPlayer?this.videoId=t.dataset.trustmaryPlayer:o&&(this.videoId=o),this.data={src:s,poster:n,playlist:r,overlay:this.overlay,autoplay:a},this.doc=d,this.body=d.body,this.id=e,this.frameLoaded=!1,this.el=t||this.createOverlay(),this.handleFrameMessage=this.handleFrameMessage.bind(this),this.render()}createOverlay(){const e=this.doc.createElement("div");return e.id=`trustmary-player-overlay-${this.id}`,e.style.cssText="\n      position: fixed;\n      top: 0;\n      left: 0;\n      width: 100%;\n      height: 100%;\n      z-index: 2147483647;\n      border: none;\n    ",this.body.appendChild(e),e}render(){this.frame=this.doc.createElement("iframe"),this.frame.onload=()=>this.handleFrameLoad(),this.frame.id=`trustmary-player-${this.id}`,this.frame.style.cssText=`\n      background:transparent;\n      display: block;\n      border: none;\n      ${this.overlay?"\n      position: absolute;\n      top: 0;\n      right: 0;\n      bottom: 0;\n      left: 0;\n      height: 100%;\n      width: 100%;\n      ":"\n      width: 1px;\n      min-width: 100%;\n      "}\n    `,this.frame.scrolling="no",this.frame.src="about:blank",this.el.appendChild(this.frame),this.frame.contentWindow?.document.open(),this.frame.contentWindow?.document.write(this.getFrameContents()),this.frame.contentWindow?.document.close()}getFrameContents(){return`\n<!DOCTYPE HTML>\n<html>\n  <head>\n    <script>\n      TRUSTMARY_FRAME_ID = "${this.id}";\n      TRUSTMARY_DATA = ${JSON.stringify(this.data)};\n      TRUSTMARY_API_DOMAIN = "https://embed.trustmary.io";\n      TRUSTMARY_VIDEO_ID = ${this.videoId?`"${this.videoId}"`:"false"};\n    <\/script>\n    <link rel="stylesheet" href="https://embed.trustmary.com/frame/player.78b37d86ea8c.css" />\n  </head>\n  <body>\n    <div id="app"></div>\n    <script src="https://embed.trustmary.com/frame/player.78b37d86ea8c.js"><\/script>\n  </body>\n</html>\n`}handleFrameLoad(){this.frameLoaded||(this.frameLoaded=!0,window.addEventListener("message",this.handleFrameMessage,!1))}handleFrameMessage({data:e}){e&&e.frameId===this.id&&("closePlayer"===e.type&&this.closePlayer(),"resize"===e.type&&e.attr.height&&!this.overlay&&this.setFrameHeight(e.attr.height))}setFrameHeight(e){this.frame.style.height=`${e}px`}closePlayer(){window.removeEventListener("message",this.handleFrameMessage,!1),this.overlay?this.el.parentNode?.removeChild(this.el):this.frame.parentNode?.removeChild(this.frame)}}},1734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});const i="trustmary-popup";t.default=class{constructor(e){const{id:t,win:i=window,doc:s=document,embedId:n}=e;n&&(this.id=t,this.win=i,this.doc=s,this.loadLibrary((t=>{if("function"!=typeof t)return!1;t(n,e)})))}loadLibrary(e){if("function"==typeof this.win.createTrustmaryPopup)return e(this.win.createTrustmaryPopup);let t=this.doc.getElementById(i);t||(t=this.doc.createElement("script"),t.id=i,t.src="https://embed.trustmary.com/frame/popup.78b37d86ea8c.js",this.doc.body.appendChild(t)),t.onload=()=>e(this.win.createTrustmaryPopup),t.onerror=function(){console.log("createTrustmaryPopup script load error")}}}},9589:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,s){this.postMessage=(e,t={})=>{this.frame.contentWindow?.postMessage({frameId:this.id,type:e,attr:t},"*")},this.id=e,this.el=t,this.doc=t.ownerDocument,this.theme=i,this.data=s,this.frameLoaded=!1,this.handleFrameMessage=this.handleFrameMessage.bind(this),this.renderFrame()}renderFrame(){this.frame=this.doc.createElement("iframe"),this.frame.onload=()=>this.handleFrameLoad(),this.frame.id=`trustmary-embed-frame-${this.id}`,this.frame.style.cssText="display: block;width: 1px; min-width: 100%;height: 0;border:none;background:transparent;",this.frame.scrolling="no",this.frame.src="about:blank",this.el.appendChild(this.frame),this.frame.contentWindow?.document.open(),this.frame.contentWindow?.document.write(this.getFrameContents()),this.frame.contentWindow?.document.close()}getFrameContents(){return`\n<!DOCTYPE HTML>\n<html>\n  <head>\n    <script>\n      TRUSTMARY_FRAME_ID = "${this.id}";\n      TRUSTMARY_THEME = {"theme": ${JSON.stringify(this.theme)}};\n    <\/script>\n    <link rel="stylesheet" href="https://embed.trustmary.com/frame/preview.78b37d86ea8c.css" />\n    <style id="embed-styles"></style>\n  </head>\n  <body>\n    <div id="app"></div>\n    <script src="https://embed.trustmary.com/frame/preview.78b37d86ea8c.js"><\/script>\n  </body>\n</html>\n`}handleFrameLoad(){this.frameLoaded||(this.frameLoaded=!0,window.addEventListener("message",this.handleFrameMessage,!1))}remove(){this.handleFrameUnload()}handleFrameUnload(){window.removeEventListener("message",this.handleFrameMessage,!1),this.el.innerHTML=""}handleFrameMessage({data:e}){e&&e.frameId===this.id&&"resize"===e.type&&e.attr.height&&this.setFrameHeight(e.attr.height)}setFrameHeight(e){this.frame.style.height=`${e}px`}updateTheme(e){this.postMessage("updateTheme",{theme:e})}updateData(e){this.postMessage("updateData",e)}}},9384:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){this.newUi=!0===i,this.processElement(t)?(this.doc=document,this.body=document.body,this.id=`survey-${e}`,this.frameLoaded=!1,this.el=t,this.handleFrameMessage=this.handleFrameMessage.bind(this),this.query=this.parseQuery(t),this.render()):console.log("Trustmary: form id not found")}processElement(e){return!(!e||!e.dataset.trustmarySurvey)&&(this.newUi=this.newUi||"new"===e.dataset.view,this.surveyId=e.dataset.trustmarySurvey,!0)}parseQuery(e){if(!e)return"";let t={sourceUrl:window.location.href,source:"embed"};return this.newUi?(t.frameId=this.id,t.frameView="compact"):t.frame=this.id,e.dataset.trustmaryLang&&(t.lang=e.dataset.trustmaryLang),t=Object.keys(e.dataset).filter((e=>/^[p][0-9]+$/.exec(e))).reduce(((t,i)=>{const s=e.dataset[i];return s&&(t[i]=s),t}),t),`?${Object.keys(t).map((e=>`${e}=${encodeURIComponent(t[e])}`)).join("&")}`}render(){this.frame=this.doc.createElement("iframe"),this.frame.onload=()=>this.handleFrameLoad(),this.frame.id=`trustmary-form-${this.id}`,this.frame.style.cssText="display: block;width: 1px; min-width: 100%;height: 0;border:none;background:transparent;",this.frame.scrolling="no",this.frame.allow="camera;microphone;",this.frame.src=`https://nps.trustmary.com/${this.newUi?"c/":""}${this.surveyId}${this.query}`,this.frame.allowtransparency=!0,this.el.appendChild(this.frame),this.addMessageListener()}addMessageListener(){window.addEventListener("message",this.handleFrameMessage,!1)}handleFrameLoad(){this.frameLoaded||(this.frameLoaded=!0)}handleFrameMessage({data:e}){e&&e.frameId===this.id&&("closeForm"===e.type&&this.closeForm(),"resize"===e.type&&e.attr.height&&this.setFrameHeight(e.attr.height))}closeForm(){window.removeEventListener("message",this.handleFrameMessage,!1)}setFrameHeight(e){this.frame.style.height=`${e}px`}}},400:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=i(1920),r=s(i(9563)),a=s(i(1537)),o=i(8980);t.default=class{constructor(e,t,i,s){if(this.destroy=()=>{if(!this.element)return;if(!this.widgetData)return;const{TrustmaryEmbed:e}=window,t=e.widgetTemplates[this.widgetData.templateName];t&&(t(this.element,{destroyWidget:!0}),this.element.remove())},this.tag=e,i)return this.widgetData=i,this.createPopupElement(),void this.loadWidgetScript(i);this.element=t,t&&(this.widgetId=s?.id||t.dataset.trustmaryWidget,this.widgetData=s,this.widgetId||console.error("Trustmary widget id not found",t,i),this.api=new r.default("https://embed.trustmary.io"),this.loadWidget())}loadWidget(){this.widgetData?(this.loadWidgetScript(this.widgetData),(0,o.tmary)("dataLayer",{event:"widgetLoad",context:{embed_id:this.widgetId},embedId:this.widgetId})):this.widgetId?this.api.get(`/widget/${this.widgetId}`,((e,t)=>{this.loadWidgetScript(t),(0,o.tmary)("dataLayer",{event:"widgetLoad",context:{embed_id:this.widgetId},embedId:this.widgetId})})):console.error("Trustmary widget id not found")}createPopupElement(){const e=document.createElement("div");document.body.appendChild(e),this.element=e}loadWidgetScript(e){if(!e)return;const{TrustmaryEmbed:t}=window,{script:i,templateName:s,structuredData:r=[],...o}=e,d={...o,session:a.default,sessionKey:`w-${e.id}`};if(r.forEach((e=>{const t=window;if(t.wasStructuredDataInjected)return;t.wasStructuredDataInjected=!0;const i=document.createElement("script");i.setAttribute("type","application/ld+json"),i.textContent=e,document.head.appendChild(i)})),i){const e=document.createElement("script");e.src=i,e.onload=()=>{try{this.element&&t.widgetTemplates[s](this.element,d)}catch(e){console.log(e)}},document.body.appendChild(e)}this.tag.postLifecycleEvent({event:(0,n.isFullQuotaWidgetInUse)(this.widgetData)?"missedLoad":"widgetLoad",item_id:e.id}),this.tag.sendEmbedInitEvent(e.id),a.default.testAndSet("hasWidgetLoad",e.id)}}},126:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ExperimentManager=void 0;const n=s(i(1537));class r{static getExperimentManagerInstance(e){return r._instance?(r._instance.tag=e,r._instance):(r._instance=new r(e),r._instance)}constructor(e){this.handleExperimentStart=(e,t)=>{if("idle"===this.getExperimentStatus(e)){const i=this.tag.getAggEvent();this.startExperiment(e);const s={item_id:t||"$empty",experiment_id:e,type:"experiment-start",conversion_ids:this.getConversionIdsByExperimentId(e)};i.send(s)}},this.tag=e}getStore(){const e={};try{const t=n.default.session.experiments;return t?"object"!=typeof t?e:t:e}catch(t){return e}}setStore(e){n.default.session.experiments=e,n.default.writeSession()}addExperiment(e,t,i){const s=this.getWidgetId(e),n=(i,s)=>{if(i)return t(null);if("active"!==s.status)return t(s.variant);const n=this.getStore();n[e]={...n[e],conversionIds:s.conversions,variantId:s.variant?.id||"$empty",status:n[e]?.status||"idle"},this.setStore(n),t(s.variant)};i?n(null,i):this.tag.api.get(`/experiment/${e}${s?`?variantId=${s}`:""}`,n)}getWidgetId(e){return this.getStore()[e]?.variantId||null}getExperimentIdsByConversionId(e){const t=this.getStore();return Object.entries(t).filter((([,t])=>"active"===t.status&&t.conversionIds?.includes(e))).map((([e])=>e))}getConversionIdsByExperimentId(e){return this.getStore()[e]?.conversionIds||[]}getExperimentStatus(e){return this.getStore()[e].status}setExperimentStatus(e,t){const i=this.getStore();i[e].status=t,this.setStore(i)}stopExperiment(e){this.setExperimentStatus(e,"stopped")}startExperiment(e){this.setExperimentStatus(e,"active")}handleConversion(e){const t=this.tag.getAggEvent(),i=this.getExperimentIdsByConversionId(e);if(0!==i.length)for(const s of i){const i=this.getWidgetId(s);this.stopExperiment(s),i&&t.send({type:"conversion",conversion_ids:[e],experiment_id:s,item_id:i,widgets:n.default.getWidgetInteractionHistory()})}else t.send({type:"conversion",conversion_ids:[e],widgets:n.default.getWidgetInteractionHistory()})}getExperimentIdByVariantId(e){const t=this.getStore(),i=Object.entries(t).find((([,t])=>t.variantId===e));if(!i)return null;const[s]=i;return s}}t.ExperimentManager=r},9871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parseElementAttributes=t.mergeAttributes=void 0;const i={title:"Kokemuksia meistä"},s=["title","font","limit","order","lang","surveyIds","surveyTypes","commentTypes","backgroundColor","cardBackgroundColor","textColor","highlightTextColor","borderColor","disableAnalytics","businessId","feedType","organizationId","template","theme"];t.mergeAttributes=function(e,t){const n=Object.assign({},i,e,t),r={};for(let e=0;e<s.length;e++){const t=s[e],i=n[t];void 0!==i&&(r[t]=i)}return r},t.parseElementAttributes=function(e){const t={};for(let i=0;i<s.length;i++){const n=s[i],r=e.dataset[n];void 0!==r&&(t[n]=r)}return t.hideLink="A"===e.tagName,t}},5746:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultTheme=void 0;const i={view:"list",container:"auto",sliderAnimation:"slide",sliderAutoplay:!0,sliderAutoplaySpeed:"3000",sliderDots:!0,sliderArrows:!1,sliderCenterMode:!1,sliderSlidesToShow:"1",sliderResponsive:!0,listColumns:"2",listResponsive:!0,cardMaxWidth:"500",cardFontFamily:"",cardBorderColor:"#e7e7e7",cardBorderRadius:"3",cardBackgroundColor:"#fff",cardTextColor:"#333",cardBoxShadow:"none",cardPadding:"10",cardInfoAlign:"center",cardInfoPadding:"15",cardInfoPicture:!0,cardInfoPictureDefault:!0,cardInfoPicturePull:!1,cardInfoPictureSize:"64",cardInfoPictureRound:!0,cardInfoPictureBoxShadow:"none",cardInfoFields:["organization","location"],cardInfoBorderColor:"#e7e7e7",cardInfoFontSize:"14px",cardInfoTextColor:"inherit",cardInfoBackgoundColor:!1,cardQuoteIcon:!0,cardQuoteIconColor:"#000",cardQuoteIconScale:"0.5",cardQuoteIconOpacity:"0.1",cardQuoteTruncate:!1,cardQuotePadding:"10",cardQuoteMinHeight:"200",cardQuoteAlign:"center",cardQuoteFontSize:"16px",cardQuoteTextColor:"16px",cardQuoteBackgroundColor:!1,cardQuoteVideoMinHeight:"200",cardQuoteVideoOverlayBackgroundColor:"#000",cardQuoteVideoOverlayOpacity:"0.5",cardQuoteVideoTextColor:"#fff",cardQuoteVideoIconColor:"#fff",cardQuoteVideoCircleColor:"#000",cardQuoteVideoCircleOpacity:"0.2",title:"",titleAlign:"left",titleWeight:"700",titleSize:"30px",pagePadding:"0",pageBackgroundColor:!1,logoAlign:"center",logoPadding:"15",logoBackgroundColor:"#8a8a8a",logoColor:"#ffffff"};t.defaultTheme=i,t.default=function(e){const{theme:t={}}=e;return{...i,...t}}},5861:function(e,t,i){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TrustmaryTag=void 0;const n=i(1920),r=i(7911),a=i(5385),o=s(i(9563)),d=i(4657),h=s(i(1537)),l=s(i(5214)),c=s(i(7047)),u=s(i(1130)),m=s(i(373)),p=s(i(9589)),g=s(i(9384)),y=s(i(400)),f=i(126),v=i(5746);t.TrustmaryTag=class{constructor(e,t){this.isFirstInitEventAlreadyHandled=!1,this.isHeadScriptInitEventAlreadyHandled=!1,this.initDOM=()=>{this.isLoaded&&(this.initAllEmbeds(),this.initAllSurveys(),this.initAllForms(),this.initAllPlayers(),this.initAllWidgets(),this.initAllExperiments(),this.initAllCollections())},this.pageview=()=>{this.initDOM()},this.setupGlobal=()=>{const e=this.win.tmary,t=e&&"q"in e&&Array.isArray(e.q)?e.q:[];this.appId=e&&"app"in e?e.app:void 0,this.win.tmary=this.tmary.bind(this),t.forEach((e=>{"function"==typeof this.win.tmary&&this.win.tmary.apply(this,e)})),this.appId&&this.initApp(this.appId)},this.dataLayerPush=({event:e,context:t={},...i}={})=>{e&&(t.conversion_id&&(i.conversionId=t.conversion_id),i=Object.keys(i).reduce(((e,t)=>(e[`tmary.${t}`]=i[t],e)),{}),this.win.dataLayer=this.win.dataLayer||[],this.win.dataLayer.push({event:`tmary.${e}`,...i}))},this.handleConversion=({id:e})=>{this.dataLayerPush({event:"conversion",context:{conversion_id:e}}),h.default.testAndSet("conversions",e)||this.experimentManager.handleConversion(e)},this.registerPopupController=e=>{"function"==typeof e&&(this.popupController=e)},this.controlPopup=e=>{e&&("string"==typeof e&&(e={action:e}),"function"==typeof this.popupController&&this.popupController(e))};const[i,s]=(0,r.decoupledPromise)();this.isFirstInit=i,this.setIsFirstInit=s;const[n,a]=(0,r.decoupledPromise)();this.isHeadScriptInit=n,this.setIsHeadScriptInit=a,this.api=new o.default("https://embed.trustmary.io"),this.experimentManager=f.ExperimentManager.getExperimentManagerInstance(this),this.doc=e,this.win=t,this.isLoaded=!1,this.items=[],this.players=[],this.previews=[],this.surveys=[],this.widgets=[],this.widgetTemplates={},this.observers=[],this.wasOnScreen=[],this.siteStyles=this.parseSiteStyles(),this.defaultTheme=v.defaultTheme,(0,d.addDOMChangeHandler)((()=>this.initDOM())),"complete"!==this.doc.readyState&&"interactive"!==this.doc.readyState?this.doc.addEventListener("readystatechange",(()=>{"complete"!==this.doc.readyState&&"interactive"!==this.doc.readyState||this.onLoad()})):this.onLoad()}parseSiteStyles(){const e=this.doc.getElementById("trustmary-embed-styles");return e?e.innerHTML:""}setSiteStyles(e){this.siteStyles=e}onLoad(){this.isLoaded||(this.isLoaded=!0,this.setupGlobal(),this.win.TRUSTMARY_DISABLE_ONLOAD||this.initDOM())}lazyloadInit(e,t){if(!e||"lazy"!==e.dataset.load)return t();const i=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(t(),i.disconnect())}))}));i.observe(e)}initAllEmbeds(){const e=this.doc.querySelectorAll("[data-trustmary-embed]");for(const t of Array.from(e))this.initEmbed(t)}initEmbed(e){"active"!==e.dataset.trustmaryStatus&&(e.dataset.trustmaryStatus="active",this.lazyloadInit(e,(()=>{const t=this.items.length+1,i=new u.default(t.toString(),e,this.siteStyles);this.items.push(i)})))}initAllPlayers(){const e=this.doc.querySelectorAll("[data-trustmary-player]");for(const t of Array.from(e))this.openPlayer(t)}openPlayer(e,t=null){if(e){if("active"===e.dataset.trustmaryStatus)return;e.dataset.trustmaryStatus="active"}const i=(this.players.length+1).toString(),s=new m.default(i,e,t);return this.players.push(s),s}initAllSurveys(){const e=this.doc.querySelectorAll("[data-trustmary-survey]");for(const t of Array.from(e))this.initSurvey(t)}initSurvey(e){"active"!==e.dataset.trustmaryStatus&&(e.dataset.trustmaryStatus="active",this.lazyloadInit(e,(()=>{const t=(this.surveys.length+1).toString(),i=new g.default(t,e,this.surveyNewUi);this.surveys.push(i)})))}initAllForms(){const e=this.doc.querySelectorAll("[data-trustmary-form]");for(const t of Array.from(e))this.initForm(t)}initForm(e){"active"!==e.dataset.trustmaryStatus&&(e.dataset.trustmaryStatus="active",this.lazyloadInit(e,(()=>{const t=(this.surveys.length+1).toString(),i=new c.default(t,e);this.surveys.push(i)})))}initAllWidgets(){const e=this.doc.querySelectorAll("[data-trustmary-widget]:not([data-trustmary-status='active'])");for(const t of Array.from(e))this.initWidget(t)}startVisibilityObserver(e,t,i){const s=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&this.handleWidgetOnScreen(t,i)}))}),{threshold:.8});s.observe(e),this.observers.push(s)}initWidget(e,t){const i=t?.id||e.dataset.trustmaryWidget;e.dataset.trustmaryStatus="active",this.lazyloadInit(e,(()=>{(t||i)&&this.widgets.push(new y.default(this,e,void 0,t)),this.startVisibilityObserver(e,i||"$empty",(0,n.isFullQuotaWidgetInUse)(t))}))}initAllCollections(){const e=this.doc.querySelectorAll("[data-trustmary-collection]:not([data-trustmary-status='active'])");for(const t of Array.from(e))this.initCollection(t)}initCollection(e){const t=h.default.getHiddenFields(),i=Object.entries(t).map((([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`),new Array).join("&");e.dataset.trustmaryCollection&&this.api.get(`/collection/${e.dataset.trustmaryCollection}?${i}`,((t,i)=>{t||i.widget&&this.initWidget(e,i.widget)}))}initAllExperiments(){const e=this.doc.querySelectorAll("[data-trustmary-experiment]:not([data-trustmary-status='active'])"),t=[];for(const i of Array.from(e)){i.dataset.trustmaryStatus="active";const e=i.dataset.trustmaryExperiment;e&&t.push(new Promise((t=>{this.experimentManager.addExperiment(e,(e=>{t(),this.initWidget(i,e||void 0)}))})))}Promise.all(t).finally((()=>{this.app&&this.app.loadingPromise.finally((()=>{this.app.setupPageLoadConversions()}))}))}initPreview(e,t,i={}){if("active"===e.dataset.trustmaryStatus)return;e.dataset.trustmaryStatus="active";const s=(this.previews.length+1).toString(),n=new p.default(s,e,t,i);return this.previews.push(n),n}initApp(e){this.app||(this.appId=e,this.app=new l.default(e,this),this.sendHeadScriptInitEvent())}initAppFromWidgetScript(e){this.app||(this.appId=e,this.app=new l.default(e,this))}getAggEvent(){return this.aggEvent||(this.aggEvent=new a.AggEvent(this.api,this.appId||""))}handleWidgetReadyForExperimentStart(e){const t=this.experimentManager.getExperimentIdByVariantId(e);t&&this.experimentManager.handleExperimentStart(t,e)}handleOpenPopup(e){this.handleWidgetOnScreen(e)}handleWidgetOnScreen(e,t){this.wasOnScreen.includes(e)||(this.wasOnScreen.push(e),this.handleWidgetReadyForExperimentStart(e),this.postLifecycleEvent({item_id:e,event:t?"missedOnScreen":"onscreen"}))}postLifecycleEvent(e){"$empty"!==e.item_id&&this.getAggEvent().send({type:"lifecycle",item_id:e.item_id,event:e.event})}handleWidgetInteraction(e){h.default.testAndSet("hasInteraction",e)||this.postLifecycleEvent({item_id:e,event:"interaction"})}handleWidgetReady(e){this.initWidget(e.element,e.widgetData)}sendEmbedInitEvent(e){this.isFirstInit.then((t=>{t&&!this.isFirstInitEventAlreadyHandled&&(this.isFirstInitEventAlreadyHandled=!0,this.getAggEvent().send({type:"embedInit",item_id:e}))}))}sendHeadScriptInitEvent(){this.isHeadScriptInit.then((e=>{e&&!this.isHeadScriptInitEventAlreadyHandled&&(this.isHeadScriptInitEventAlreadyHandled=!0,this.getAggEvent().send({type:"headScriptInit"}))}))}tmary(e,t){switch(e){case"surveyNewUi":return void(this.surveyNewUi=!0);case"pageview":return this.pageview();case"getHiddenFields":return h.default.getHiddenFields()}if(t){if("string"==typeof t)switch(e){case"app":return this.initApp(t);case"widgetInit":return this.initAppFromWidgetScript(t);case"popupOpened":return this.handleOpenPopup(t);case"widgetOnScreen":return this.handleWidgetOnScreen(t);case"widgetInteraction":return this.handleWidgetInteraction(t);case"formSubmit":return this.postLifecycleEvent({event:"formSubmit",item_id:t})}switch(e){case"dataLayer":return this.dataLayerPush(t);case"conversion":return this.handleConversion(t);case"popup":return this.controlPopup(t);case"popupController":return this.registerPopupController(t);case"widgetReady":return this.handleWidgetReady(t)}}}}},1920:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isFullQuotaWidgetInUse=t.FULL_QUOTA_WIDGET_TEMPLATE_NAME=void 0,t.FULL_QUOTA_WIDGET_TEMPLATE_NAME="full-quota-widget";t.isFullQuotaWidgetInUse=e=>e?.templateName===t.FULL_QUOTA_WIDGET_TEMPLATE_NAME},7911:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decoupledPromise=void 0;t.decoupledPromise=()=>{let e=()=>{};return[new Promise((t=>e=t)),e]}},9686:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tmary=void 0,t.tmary=function(e,t){const{tmary:i}=window;if("function"==typeof i)return i(e,t)}},3208:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isWidgetLifecycleEvent=t.isConversionEvent=t.isExperimentEvent=void 0;t.isExperimentEvent=e=>void 0!==("conversion"===e.type&&e.experiment_id)&&void 0!==e.item_id&&void 0!==e.conversion_ids;t.isConversionEvent=e=>"conversion"===e.type;t.isWidgetLifecycleEvent=e=>"lifecycle"===e.type}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var r=t[s]={exports:{}};return e[s].call(r.exports,r,r.exports,i),r.exports}(()=>{const e=i(5861);var t,s;t=document,(s=window).TrustmaryEmbed=new e.TrustmaryTag(t,s)})()})();