@givefreely/adunit 2.1.0-dev.0 → 2.2.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e={equals:(e,t)=>e===t};let t=E;const n=1,r=2,o={owned:null,cleanups:null,context:null,owner:null},i={};var a=null;let s=null,l=null,c=null,u=null,d=0;function g(t,n){const r={value:t,observers:null,observerSlots:null,comparator:(n=n?Object.assign({},e,n):e).equals||void 0};return[w.bind(r),e=>("function"==typeof e&&(e=e(r.value)),C(r,e))]}function p(e,t,r){k(P(e,t,!1,n))}function h(e,r,o){t=D;const i=P(e,r,!1,n);i.user=!0,u?u.push(i):k(i)}function m(t,n,r){r=r?Object.assign({},e,r):e;const o=P(t,n,!0,0);return o.observers=null,o.observerSlots=null,o.comparator=r.equals||void 0,k(o),w.bind(o)}function f(e,t,r){let o,a,s;"function"==typeof t?(o=e,a=t,s={}):(o=!0,a=e,s=t||{});let l=null,c=i,u=!1,d="initialValue"in s,p="function"==typeof o&&m(o);const h=new Set,[f,A]=(s.storage||g)(s.initialValue),[x,y]=g(void 0),[b,w]=g(void 0,{equals:!1}),[C,S]=g(d?"ready":"unresolved");function E(e,t,n,r){return l===e&&(l=null,void 0!==r&&(d=!0),e!==c&&t!==c||!s.onHydrated||queueMicrotask((()=>s.onHydrated(r,{value:t}))),c=i,function(e,t){T((()=>{void 0===t&&A((()=>e)),S(void 0!==t?"errored":d?"ready":"unresolved"),y(t);for(const e of h.keys())e.decrement();h.clear()}),!1)}(t,n)),t}function D(){const e=f(),t=x();if(void 0!==t&&!l)throw t;return e}function L(e=!0){if(!1!==e&&u)return;u=!1;const t=p?p():o;if(null==t||!1===t)return void E(l,v(f));const n=c!==i?c:v((()=>a(t,{value:f(),refetching:e})));return(r=n)&&"object"==typeof r&&"then"in r?(l=n,"value"in n?("success"===n.status?E(l,n.value,void 0,t):E(l,void 0,O(n.value),t),n):(u=!0,queueMicrotask((()=>u=!1)),T((()=>{S(d?"refreshing":"pending"),w()}),!1),n.then((e=>E(n,e,void 0,t)),(e=>E(n,void 0,O(e),t))))):(E(l,n,void 0,t),n);var r}return Object.defineProperties(D,{state:{get:()=>C()},error:{get:()=>x()},loading:{get(){const e=C();return"pending"===e||"refreshing"===e}},latest:{get(){if(!d)return D();const e=x();if(e&&!l)throw e;return f()}}}),p?k(P((()=>L(!1)),void 0,!0,n)):L(!1),[D,{refetch:L,mutate:A}]}function v(e){if(null===l)return e();const t=l;l=null;try{return e()}finally{l=t}}function A(e){h((()=>v(e)))}function x(e){return null===a||(null===a.cleanups?a.cleanups=[e]:a.cleanups.push(e)),e}function y(e){let t;return a&&a.context&&void 0!==(t=a.context[e.id])?t:e.defaultValue}function b(e){const t=m(e),n=m((()=>R(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function w(){if(this.sources&&this.state)if(this.state===n)k(this);else{const e=c;c=null,T((()=>L(this)),!1),c=e}if(l){const e=this.observers?this.observers.length:0;l.sources?(l.sources.push(this),l.sourceSlots.push(e)):(l.sources=[this],l.sourceSlots=[e]),this.observers?(this.observers.push(l),this.observerSlots.push(l.sources.length-1)):(this.observers=[l],this.observerSlots=[l.sources.length-1])}return this.value}function C(e,t,r){let o=e.value;return e.comparator&&e.comparator(o,t)||(e.value=t,e.observers&&e.observers.length&&T((()=>{for(let t=0;t<e.observers.length;t+=1){const r=e.observers[t],o=s&&s.running;o&&s.disposed.has(r),(o?r.tState:r.state)||(r.pure?c.push(r):u.push(r),r.observers&&M(r)),o||(r.state=n)}if(c.length>1e6)throw c=[],new Error}),!1)),t}function k(e){if(!e.fn)return;I(e);const t=d;!function(e,t,r){let o;const i=a,s=l;l=a=e;try{o=e.fn(t)}catch(t){return e.pure&&(e.state=n,e.owned&&e.owned.forEach(I),e.owned=null),e.updatedAt=r+1,N(t)}finally{l=s,a=i}(!e.updatedAt||e.updatedAt<=r)&&(null!=e.updatedAt&&"observers"in e?C(e,o):e.value=o,e.updatedAt=r)}(e,e.value,t)}function P(e,t,r,i=n,s){const l={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:a,context:a?a.context:null,pure:r};return null===a||a!==o&&(a.owned?a.owned.push(l):a.owned=[l]),l}function S(e){if(0===e.state)return;if(e.state===r)return L(e);if(e.suspense&&v(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<d);)e.state&&t.push(e);for(let o=t.length-1;o>=0;o--)if((e=t[o]).state===n)k(e);else if(e.state===r){const n=c;c=null,T((()=>L(e,t[0])),!1),c=n}}function T(e,n){if(c)return e();let r=!1;n||(c=[]),u?r=!0:u=[],d++;try{const n=e();return function(e){if(c&&(E(c),c=null),e)return;const n=u;u=null,n.length&&T((()=>t(n)),!1)}(r),n}catch(e){r||(u=null),c=null,N(e)}}function E(e){for(let t=0;t<e.length;t++)S(e[t])}function D(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:S(r)}for(t=0;t<n;t++)S(e[t])}function L(e,t){e.state=0;for(let o=0;o<e.sources.length;o+=1){const i=e.sources[o];if(i.sources){const e=i.state;e===n?i!==t&&(!i.updatedAt||i.updatedAt<d)&&S(i):e===r&&L(i,t)}}}function M(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=r,n.pure?c.push(n):u.push(n),n.observers&&M(n))}}function I(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){const e=r.pop(),o=t.observerSlots.pop();n<r.length&&(e.sourceSlots[o]=n,r[n]=e,t.observerSlots[n]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)I(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)I(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function O(e){return e instanceof Error?e:new Error("string"==typeof e?e:"Unknown error",{cause:e})}function N(e,t=a){throw O(e)}function R(e){if("function"==typeof e&&!e.length)return R(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=R(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function H(e,t){return function(t){let n;return p((()=>n=v((()=>(a.context={...a.context,[e]:t.value},b((()=>t.children)))))),void 0),n}}function U(e,t){return v((()=>e(t||{})))}function $(e){const t=e.keyed,n=m((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e==!n});return m((()=>{const r=n();if(r){const o=e.children;return"function"==typeof o&&o.length>0?v((()=>o(t?r:()=>{if(!v(n))throw"Stale read from <Show>.";return e.when}))):o}return e.fallback}),void 0,void 0)}const _="_$DX_DELEGATE";function F(e,t,n,r={}){let i;return function(e,t){const n=l,r=a,i=0===e.length,s=void 0===t?r:t,c=i?o:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=i?e:()=>e((()=>v((()=>I(c)))));a=c,l=null;try{return T(u,!0)}finally{l=n,a=r}}((r=>{i=r,t===document?e():K(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{i(),t.textContent=""}}function G(e,t,n){let r;const o=()=>(r||(r=(()=>{const t=document.createElement("template");return t.innerHTML=e,t.content.firstChild})())).cloneNode(!0);return o.cloneNode=o,o}function B(e,t=window.document){const n=t[_]||(t[_]=new Set);for(let r=0,o=e.length;r<o;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,z))}}function j(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function q(e,t,n){if(!t)return n?j(e,"style"):t;const r=e.style;if("string"==typeof t)return r.cssText=t;let o,i;for(i in"string"==typeof n&&(r.cssText=n=void 0),n||(n={}),t||(t={}),n)null==t[i]&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function W(e,t,n){return v((()=>e(t,n)))}function K(e,t,n,r){if(void 0===n||r||(r=[]),"function"!=typeof t)return V(e,t,r,n);p((r=>V(e,t(),r,n)),r)}function z(e){let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,i=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),a=()=>{const r=t[n];if(r&&!t.disabled){const o=t[`${n}Data`];if(void 0!==o?r.call(t,o,e):r.call(t,e),e.cancelBubble)return}return t.host&&"string"!=typeof t.host&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},s=()=>{for(;a()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>t||document}),e.composedPath){const n=e.composedPath();i(n[0]);for(let e=0;e<n.length-2&&(t=n[e],a());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===o)break}}else s();i(r)}function V(e,t,n,r,o){for(;"function"==typeof n;)n=n();if(t===n)return n;const i=typeof t,a=void 0!==r;if(e=a&&n[0]&&n[0].parentNode||e,"string"===i||"number"===i){if("number"===i&&(t=t.toString())===n)return n;if(a){let o=n[0];o&&3===o.nodeType?o.data!==t&&(o.data=t):o=document.createTextNode(t),n=Z(e,n,r,o)}else n=""!==n&&"string"==typeof n?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===i)n=Z(e,n,r);else{if("function"===i)return p((()=>{let o=t();for(;"function"==typeof o;)o=o();n=V(e,o,n,r)})),()=>n;if(Array.isArray(t)){const i=[],s=n&&Array.isArray(n);if(Y(i,t,n,o))return p((()=>n=V(e,i,n,r,!0))),()=>n;if(0===i.length){if(n=Z(e,n,r),a)return n}else s?0===n.length?X(e,i,r):function(e,t,n){let r=n.length,o=t.length,i=r,a=0,s=0,l=t[o-1].nextSibling,c=null;for(;a<o||s<i;)if(t[a]!==n[s]){for(;t[o-1]===n[i-1];)o--,i--;if(o===a){const t=i<r?s?n[s-1].nextSibling:n[i-s]:l;for(;s<i;)e.insertBefore(n[s++],t)}else if(i===s)for(;a<o;)c&&c.has(t[a])||t[a].remove(),a++;else if(t[a]===n[i-1]&&n[s]===t[o-1]){const r=t[--o].nextSibling;e.insertBefore(n[s++],t[a++].nextSibling),e.insertBefore(n[--i],r),t[o]=n[i]}else{if(!c){c=new Map;let e=s;for(;e<i;)c.set(n[e],e++)}const r=c.get(t[a]);if(null!=r)if(s<r&&r<i){let l,u=a,d=1;for(;++u<o&&u<i&&null!=(l=c.get(t[u]))&&l===r+d;)d++;if(d>r-s){const o=t[a];for(;s<r;)e.insertBefore(n[s++],o)}else e.replaceChild(n[s++],t[a++])}else a++;else t[a++].remove()}}else a++,s++}(e,n,i):(n&&Z(e),X(e,i));n=i}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=Z(e,n,r,t);Z(e,n,null,t)}else null!=n&&""!==n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);n=t}}return n}function Y(e,t,n,r){let o=!1;for(let i=0,a=t.length;i<a;i++){let a,s=t[i],l=n&&n[e.length];if(null==s||!0===s||!1===s);else if("object"==(a=typeof s)&&s.nodeType)e.push(s);else if(Array.isArray(s))o=Y(e,s,l)||o;else if("function"===a)if(r){for(;"function"==typeof s;)s=s();o=Y(e,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||o}else e.push(s),o=!0;else{const t=String(s);l&&3===l.nodeType&&l.data===t?e.push(l):e.push(document.createTextNode(t))}}return o}function X(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Z(e,t,n,r){if(void 0===n)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let r=!1;for(let i=t.length-1;i>=0;i--){const a=t[i];if(o!==a){const t=a.parentNode===e;r||i?t&&a.remove():t?e.replaceChild(o,a):e.insertBefore(o,n)}else r=!0}}else e.insertBefore(o,n);return[o]}const J={top:"50px",left:"calc(100% - 700px)",margin:"0",width:"640px","max-height":"80vh",padding:"2px 5px 10px 5px","background-color":"white",border:"none","border-radius":"24px","box-shadow":"0px 4px 44px rgba(0, 0, 0, 0.25)","font-family":"Arial","line-height":"1","vertical-align":"baseline","box-sizing":"border-box",color:"rgb(34, 34, 34)","@media (max-width: 600px), (max-height: 480px)":{display:"none !important"}},Q={height:"100%","overflow-x":"hidden","overlfow-y":"auto",position:"relative",padding:"0px 15px"},ee={},te={display:"flex","flex-direction":"column-reverse","align-items":"center","margin-bottom":"10px"},ne={flex:"1","font-size":"24px","font-weight":"700","margin-top":"5px","margin-bottom":"0px"},re={background:"none",border:"none",padding:"4px 8px","align-self":"flex-end",color:"#666464","font-size":"38px",cursor:"pointer","line-height":"1"},oe={color:"#707070","align-self":"flex-end","margin-top":"5px","max-width":"40%"},ie={color:"#707070",cursor:"default","pointer-events":"none","text-decoration":"none"},ae={"font-size":"18px","font-weight":"400","margin-top":"0px","margin-bottom":"0px"},se={display:"flex",gap:"10px",width:"100%","margin-top":"20px","margin-bottom":"20px","flex-wrap":"wrap","justify-content":"space-between"},le={width:"30%",position:"relative",display:"flex","flex-direction":"column","align-items":"center","justify-content":"space-between",background:"none",border:"1px solid #ccc","border-radius":"5px",padding:"5px",gap:"5px","text-align":"center","font-size":"14px",cursor:"pointer",transition:"background-color 0.2s ease"},ce={color:"white","background-color":"lightgray",cursor:"default","pointer-events":"none"},ue={"max-width":"120px","max-height":"70px","margin-bottom":"5px","object-fit":"contain"},de={"background-color":"#0052FF",cursor:"pointer","border-radius":"32px",padding:"8px",color:"white","min-width":"100px",border:"0","font-weight":"600",width:"120px"},ge={display:"flex","flex-direction":"column",gap:"10px",width:"100%","color-scheme":"light"},pe={display:"flex","align-items":"center",gap:"5px",border:"1px solid #ddd",padding:"15px","border-radius":"5px","font-weight":"600",cursor:"pointer","margin-bottom":"8px"},he={"text-align":"right"},me={background:"none",border:"none",color:"blue","text-decoration":"underline",padding:"0",cursor:"pointer","margin-bottom":"15px"},fe={display:"flex","justify-content":"space-between",margin:"20px 0px 10px 0px","font-size":"14px"},ve={margin:"5px 0px 5px 0px","font-size":"14px","text-align":"center"},Ae={color:"#666464","text-decoration":"underline"},xe={color:"rgb(102, 100, 100)","text-decoration":"underline",margin:"0",cursor:"pointer"},ye={width:"100%","background-color":"#f2f2f2",border:"1px solid black","border-radius":"10px","border-top":"1px solid #bbb7b7","margin-top":"10px","margin-bottom":"20px","box-sizing":"border-box"},be={padding:"0 5px 0 10px",width:"100%","font-size":"12px","box-sizing":"border-box"},we={display:"grid","grid-template-columns":"4fr 1fr","padding-right":"15px","padding-bottom":"5px"},Ce={color:"#000","margin-bottom":"4px"},ke={"font-size":"14px",color:"#555","text-align":"right"},Pe=(e,t)=>{let n=parseFloat(t);return"FLAT"===e&&(n*=.75),((e,t)=>{let n=parseFloat(t);return n<1&&(n=1),n=Math.floor(n),"PERCENTAGE"===e?`${n}%`:`$${n}`})(e,n.toString())};var Se=G("<span>");function Te(e){return t=Se(),p((()=>{return t.innerHTML=(n=e.title,r=e.activeDomain,n.replace("{0}",Pe(r.Merchant.MaxRate?.Kind,r.Merchant.MaxRate?.Amount??"0")));var n,r})),t;var t}const Ee=function(){const e=Symbol("context");return{id:e,Provider:H(e),defaultValue:()=>({translate:e=>"",getAllCharities:()=>[]})}}(),De=Ee,Le=()=>{const e=y(De)();if(!e)throw new Error("Content provider context is undefined");return t=>e.translate(t)};class Me{static formatMessage(e,...t){return e.replace(/{(\d+)}/g,((e,n)=>{const r=Number(n);return void 0!==t[r]?String(t[r]):`{${r}}`}))}}var Ie=G("<div>"),Oe=G("<p><span>"),Ne=G("<div><div class=gf-offer-details><p><span></span></p><p><span></span></p><p><span></span></p><p><span></span></p><p><span></span></p><p><a target=_blank rel=noreferrer><span>"),Re=G("<div class=gf-offer-details-rate-item><div></div><div>");const He=e=>{const t=Le();return n=Ne(),o=(r=n.firstChild).firstChild,i=o.firstChild,a=o.nextSibling,s=a.firstChild,l=a.nextSibling,c=l.firstChild,u=l.nextSibling,d=u.firstChild,g=u.nextSibling,h=g.firstChild,m=g.nextSibling,f=m.firstChild,v=f.firstChild,K(r,U($,{get when(){return!!e.merchantRateDetail?.length},get children(){var t=Ie();return K(t,(()=>e.merchantRateDetail?.map((e=>{return t=Re(),n=t.firstChild,r=n.nextSibling,K(n,(()=>e.Name||"")),K(r,(()=>((e,t=1,n=1)=>{const r=e.BoostedOffer??null;let o=parseFloat(e?.Amount??"");if(r?.EndDate&&new Date(r.EndDate)<new Date&&(o=parseFloat(r.OriginalMaxRate)),Number.isNaN(o))return"";const i=o*t;return"PERCENTAGE"===e?.Kind?`${i.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n})}%`:"FLAT"===e?.Kind?i.toLocaleString("en-US",{style:"currency",currency:e.Currency}):""})(e))),p((e=>{var o=we,i=Ce,a=ke;return e.e=q(t,o,e.e),e.t=q(n,i,e.t),e.a=q(r,a,e.a),e}),{e:void 0,t:void 0,a:void 0}),t;var t,n,r})))),t}}),u),K(r,U($,{get when(){return e.additionalHtml},get children(){var t=Oe(),n=t.firstChild;return p((()=>n.innerHTML=e.additionalHtml)),t}}),m),p((o=>{var a=ye,l=be,u=t("offerDetails.intro"),g=t("offerDetails.eligible"),p=e.parsedMaxRate?Me.formatMessage(t("offerDetails.donationRatesWithValue"),e.parsedMaxRate):Me.formatMessage(t("offerDetails.donationRates")),m=t("offerDetails.donationAmounts"),A=t("offerDetails.donationTiming"),x=Ae,y=e.termsUrl,b=t("offerDetails.termsAndConditions");return o.e=q(n,a,o.e),o.t=q(r,l,o.t),u!==o.a&&(i.innerHTML=o.a=u),g!==o.o&&(s.innerHTML=o.o=g),p!==o.i&&(c.innerHTML=o.i=p),m!==o.n&&(d.innerHTML=o.n=m),A!==o.s&&(h.innerHTML=o.s=A),o.h=q(f,x,o.h),y!==o.r&&j(f,"href",o.r=y),b!==o.d&&(v.innerHTML=o.d=b),o}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),n;var n,r,o,i,a,s,l,c,u,d,g,h,m,f,v};function Ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var $e={exports:{}};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,function(e){if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)e.exports=globalThis.browser;else{const t="The message port closed before a response was received.",n=e=>{const n={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(0===Object.keys(n).length)throw new Error("api-metadata.json has not been included in browser-polyfill");class r extends WeakMap{constructor(e,t=void 0){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}const o=(t,n)=>(...r)=>{e.runtime.lastError?t.reject(new Error(e.runtime.lastError.message)):n.singleCallbackArg||r.length<=1&&!1!==n.singleCallbackArg?t.resolve(r[0]):t.resolve(r)},i=e=>1==e?"argument":"arguments",a=(e,t,n)=>new Proxy(t,{apply:(t,r,o)=>n.call(r,e,...o)});let s=Function.call.bind(Object.prototype.hasOwnProperty);const l=(e,t={},n={})=>{let r=Object.create(null),c={has:(t,n)=>n in e||n in r,get(c,u,d){if(u in r)return r[u];if(!(u in e))return;let g=e[u];if("function"==typeof g)if("function"==typeof t[u])g=a(e,e[u],t[u]);else if(s(n,u)){let t=((e,t)=>function(n,...r){if(r.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${i(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${i(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise(((i,a)=>{if(t.fallbackToNoCallback)try{n[e](...r,o({resolve:i,reject:a},t))}catch(o){console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,o),n[e](...r),t.fallbackToNoCallback=!1,t.noCallback=!0,i()}else t.noCallback?(n[e](...r),i()):n[e](...r,o({resolve:i,reject:a},t))}))})(u,n[u]);g=a(e,e[u],t)}else g=g.bind(e);else if("object"==typeof g&&null!==g&&(s(t,u)||s(n,u)))g=l(g,t[u],n[u]);else{if(!s(n,"*"))return Object.defineProperty(r,u,{configurable:!0,enumerable:!0,get:()=>e[u],set(t){e[u]=t}}),g;g=l(g,t[u],n["*"])}return r[u]=g,g},set:(t,n,o,i)=>(n in r?r[n]=o:e[n]=o,!0),defineProperty:(e,t,n)=>Reflect.defineProperty(r,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(r,t)},u=Object.create(e);return new Proxy(u,c)},c=e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener:(t,n)=>t.hasListener(e.get(n)),removeListener(t,n){t.removeListener(e.get(n))}}),u=new r((e=>"function"!=typeof e?e:function(t){const n=l(t,{},{getContent:{minArgs:0,maxArgs:0}});e(n)})),d=new r((e=>"function"!=typeof e?e:function(t,n,r){let o,i,a=!1,s=new Promise((e=>{o=function(t){a=!0,e(t)}}));try{i=e(t,n,o)}catch(e){i=Promise.reject(e)}const l=!0!==i&&((c=i)&&"object"==typeof c&&"function"==typeof c.then);var c;if(!0!==i&&!l&&!a)return!1;return(l?i:s).then((e=>{r(e)}),(e=>{let t;t=e&&(e instanceof Error||"string"==typeof e.message)?e.message:"An unexpected error occurred",r({__mozWebExtensionPolyfillReject__:!0,message:t})})).catch((e=>{console.error("Failed to send onMessage rejected reply",e)})),!0})),g=({reject:n,resolve:r},o)=>{e.runtime.lastError?e.runtime.lastError.message===t?r():n(new Error(e.runtime.lastError.message)):o&&o.__mozWebExtensionPolyfillReject__?n(new Error(o.message)):r(o)},p=(e,t,n,...r)=>{if(r.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${i(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${i(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise(((e,t)=>{const o=g.bind(null,{resolve:e,reject:t});r.push(o),n.sendMessage(...r)}))},h={devtools:{network:{onRequestFinished:c(u)}},runtime:{onMessage:c(d),onMessageExternal:c(d),sendMessage:p.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:p.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},m={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return n.privacy={network:{"*":m},services:{"*":m},websites:{"*":m}},l(e,h,n)};e.exports=n(chrome)}}($e);var _e,Fe,browser=Ue($e.exports);class Ge{constructor(){this.isLocal=!0}log({level:e,message:t,timestamp:n,data:r,title:o}){let i;switch(e){case"debug":default:i="log";break;case"info":i="info";break;case"warn":i="warn";break;case"error":case"critical":case"fatal":i="error"}const a=o?`[${o}]`:"";void 0!==r?console[i](`[${n}] - ${Ge.LOGGER_PREFIX} ${a} ${t}`,r):console[i](`[${n}] - ${Ge.LOGGER_PREFIX} ${a} ${t}`)}}Ge.LOGGER_PREFIX="[DonationPopup] -",function(e){e.checkoutPopupShown="CHECKOUT-POPUP-SHOWN",e.checkoutPopupNotShown="CHECKOUT-POPUP-NOT-SHOWN",e.checkoutPopupSupressed="CHECKOUT-POPUP-SUPRESSED",e.checkoutPopupDonation="CHECKOUT-POPUP-DONATION",e.checkoutPopupFailedActivation="CHECKOUT-POPUP-FAILED-ACTIVATION",e.checkoutPopupPurchaseConfirmed="CHECKOUT-POPUP-PURCHASE-CONFIRMED",e.checkoutPopupHealthCheck="CHECKOUT-POPUP-HEALTH-CHECK",e.checkouPopupActivationFailed="CHECKOUT-POPUP-ACTIVATION-FAILED",e.checkoutPopupOfferDetailsClicked="CHECKOUT-POPUP-OFFER-DETAILS-CLICKED",e.checkoutPopupWhyAmISeeingThisClicked="CHECKOUT-POPUP-WHY-AM-I-SEEING-THIS-CLICKED",e.checkoutPopupLooserExtension="CHECKOUT-POPUP-LOOSER-EXTENSION",e.checkoutPopupActiveDomain="CHECKOUT-POPUP-ACTIVE-DOMAIN",e.checkoutPopupSiteMatches="CHECKOUT-POPUP-SITE-MATCHES",e.checkoutPopupMerchantInResultsFound="CHECKOUT-MERCHANT-IN-RESULTS-FOUND",e.checkoutPopupNotShownPerViewportSize="CHECKOUT-POPUP-NOT-SHOWN-PER-VIEWPORT-SIZE",e.checkoutPopupHiddenProgrammatically="CHECKOUT-POPUP-HIDDEN-PROGRAMMATICALLY",e.checkoutPopupGoogleSearch="CHECKOUT-POPUP-GOOGLE-SEARCH",e.checkoutPopupGooglePartnerAnnCreated="CHECKOUT-POPUP-GOOGLE-PARTNER-ANN-CREATED",e.checkoutPopupGooglePartnerAnnClicked="CHECKOUT-POPUP-GOOGLE-PARTNER-ANN-CLICKED",e.checkoutPopupGooglePartnerAnnHidden="CHECKOUT-POPUP-GOOGLE-PARTNER-ANN-HIDDEN",e.checkoutPopupStoodDown="CHECKOUT-POPUP-STOOD-DOWN"}(_e||(_e={})),function(e){e.libLog="GFLIB-LOG"}(Fe||(Fe={}));const Be=["debug","info","warn","error","critical","fatal"];class je{constructor(e){this.config={minLevel:e?.minLevel??"debug",enabled:e?.enabled??!1,transports:e?.transports??[new Ge],title:e?.title??""}}static getInstance(e){return je.instance||(je.instance=new je(e)),je.instance}configure(e){this.config={...this.config,...e}}shouldLog(e){return!!this.config.enabled&&Be.indexOf(e)>=Be.indexOf(this.config.minLevel)}createLogMessage(e,t,n){return{level:e,version:"2.0.0",message:t,timestamp:(new Date).toISOString(),data:n,title:this.config.title}}log(e,t,n,r){if(!this.shouldLog(e))return;const o=this.createLogMessage(e,t,r);this.config.transports.filter((e=>!n||e.isLocal)).forEach((e=>e.log(o)))}debug(e,t,n=!1){this.log("debug",e,n,t)}info(e,t,n=!1){this.log("info",e,n,t)}warn(e,t,n=!1){this.log("warn",e,n,t)}error(e,t,n=!1){this.log("error",e,n,t)}critical(e,t,n=!1){this.log("critical",e,n,t)}fatal(e,t,n=!1){this.log("fatal",e,n,t)}addTransport(e){this.config.transports.push(e)}clearTransports(){this.config.transports=[]}disable(){this.config.enabled=!1}enable(){this.config.enabled=!0}}const qe=3,We=e=>1e3*e,Ke=browser;async function ze(e,t){return await Ke.runtime.sendMessage(e)}async function Ve(e,t,n){return async function(e,t={}){const{maxAttempts:n=qe,delayFn:r=We}=t;let o=null;for(let t=1;t<=n;t+=1)try{return await e()}catch(e){o=e,t<n&&await new Promise((e=>{setTimeout(e,r(t))}))}throw o&&t.logger&&t.operationName&&t.logger.error(`Operation ${t.operationName} failed after ${n} attempts.`,o,!0),o||new Error("Operation failed after multiple attempts")}((()=>ze(e)),{maxAttempts:qe,delayFn:We})}const Ye="GF_TRACK_EVENT",Xe="GF_HIDE_POPUP",Ze="GF_GET_POPUP_CONFIG",Je="GF_IS_ACTIVE_DOMAIN",Qe="GF_LOG_MERCHANTS_IN_SEARCH_RESULTS",et="GF_SHOULD_STAND_DOWN",tt="GF_ACTIVATE_OFFER",nt="GF_STORE_SHOPIFY_SHOP_ID",rt="GF_GET_DOMAIN_BY_SHOP_ID",ot="GF_GET_LANGUAGE_CONTENT",it="GF_GET_ACTIVE_DOMAINS",at="GF_MUTE_PARTNER_SERP_AD",st="countryCode",lt="gf_ad_event_history",ct="gf_popup_everywhere",ut={ein:"0",tpi:"0"},dt="GIVE_FREELY_",gt={async get(e){const t=`${dt}${e}`;return(await browser.storage.local.get(t))[t]||null},async set(e,t){const n=`${dt}${e}`;await browser.storage.local.set({[n]:t})},async remove(e){const t=Array.isArray(e)?e.map((e=>`${dt}${e}`)):`${dt}${e}`;await browser.storage.local.remove(t)}},pt=()=>String("2.0.0");class ht{constructor(e,t,n,r=60){this.track=async(e,t,n,r=!1,o=!1)=>{const i={partner:`gfLib_${this._partnerApiKey}`,eventType:e,eventData:{userId:r?void 0:this._userService?.user?.id,libVersion:pt(),wfDeviceId:t,...n}};try{const e=JSON.stringify(i,((e,t)=>t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t)),t=await this.getEventsUrl();return t?await this.BroadcastEvent(t,e,i,o):(this._logger.info("Cant broadcast event. eventsUrl cant be retrieved from config",i,!0),!1)}catch(e){return this._logger.error("Something unexpected happened when dispatching a gf event",{error:e,event:i},!0),!1}},this.getEventsHistory=async()=>{const e=await gt.get(lt),t=(e=>{const t=new Date;return t.setTime(t.getTime()+60*e*1e3),t.getTime()})(-this._debounceWindowInMinutes),n=(e||[]).filter((e=>e.createdAt>t));return await gt.set(lt,n),n},this.shouldBroadcastEvent=async(e,t)=>!!t||!(await this.getEventsHistory()).some((t=>t.payload===e)),this.pushEventToHistory=async e=>{const t=await this.getEventsHistory();t.push({createdAt:Date.now(),payload:e}),await gt.set(lt,t)},this._partnerApiKey=e,this._userService=t,this._debounceWindowInMinutes=r,this._logger=je.getInstance({title:"Analytics"}),this._configService=n}async BroadcastEvent(e,t,n,r){if(await this.shouldBroadcastEvent(t,r)){const r=await fetch(e,{headers:{"Content-Type":"application/json"},method:"POST",body:t,cache:"no-store"});return r.ok?(await this.pushEventToHistory(t),!0):(this._logger.error("Something unexpected happened when dispatching an event",{status:r.status,statusText:r.statusText,event:n},!0),!1)}return this._logger.info("This event has already been broadcasted during the past hour",n,!0),!1}async getEventsUrl(){const e=await this._configService.getCachedConfig();return e?.eventsUrl}}function mt(e,t,n){return e?{...t,...n}:t}ht.trackEvent=async(e,t,n=!1,r=!1)=>{await ze({type:Ye,payload:{eventType:e,eventData:t,anonymous:n,skipThrottling:r}})};var ft=G("<a href=#!>"),vt=G("<button class=give-freely-close-button aria-label=Close>×"),At=G('<div><div><div></div></div><div></div><div><div><div><span></span></div><button aria-label="Don\'t show again"><span></span></button></div></div><div><p><span></span></p><a class=give-freely-footer-link target=_blank rel="noopener noreferrer"><span>'),xt=G("<div><div><img><span></span></div><button><span>"),yt=G("<div>"),bt=G("<div><span>");const wt=e=>({hasBackdrop:!!e.containerStyle?.backdropColor||!!e.containerStyle?.showAsModal,clickAction:e.containerStyle?.clickAction??"hide-opacity"});function Ct(e){const[t,n]=g(!1),[r,o]=g(null),i=t=>{const{hasBackdrop:n,clickAction:r}=wt(e.checkoutPopupConf);n&&"donate"===r&&t.stopPropagation()},a=()=>{const{hasBackdrop:t,clickAction:n}=wt(e.checkoutPopupConf);t&&"ignore"!==n&&("donate"===n?c(ut,!0):e.setBackdropHidden(!0))};h((()=>{window.addEventListener("click",a),e.mainContainerRef?.addEventListener("click",i),x((()=>{setTimeout((()=>{window.removeEventListener("click",a),e.mainContainerRef?.removeEventListener("click",i)}),500)}))}));const s=Le(),l=(()=>{const e=y(Ee)();if(!e)throw new Error("Content provider context is undefined");return()=>e.getAllCharities()})();h((()=>{t()&&e.dialogRef&&e.dialogRef.scroll({top:e.dialogRef.offsetHeight,behavior:"smooth"})})),h((()=>{const t=r();t&&e.onCharitySelect(t.charity,t.closeOnDonation?e.checkoutPopupConf.checkoutPopupActivateAndCloseSkipSuccess:void 0)}));const c=(e,t)=>o({charity:e,closeOnDonation:t}),u=()=>!!r()?.charity;return[(f=At(),v=f.firstChild,A=v.firstChild,b=v.nextSibling,w=b.nextSibling,C=w.firstChild,k=C.firstChild,P=k.firstChild,S=k.nextSibling,T=S.firstChild,E=w.nextSibling,D=E.firstChild,L=D.firstChild,M=D.nextSibling,I=M.firstChild,K(v,U($,{get when(){return e.checkoutPopupConf.checkoutPopupActivateAndClose},get children(){var e=ft();return e.$$click=()=>c(ut,!0),p((t=>{var n=mt(u(),oe,ie),r=s("main.activateAndClose.v2");return t.e=q(e,n,t.e),r!==t.t&&(e.innerHTML=t.t=r),t}),{e:void 0,t:void 0}),e}}),null),K(v,U($,{get when(){return e.checkoutPopupConf.checkoutPopupMainCloseButtonVisible&&!e.checkoutPopupConf.checkoutPopupActivateAndClose},get children(){var t=vt();return t.$$click=()=>e.onClose(),p((e=>q(t,re,e))),t}}),null),K(b,U(Te,{get title(){return s("main.subTitle.v2")},get activeDomain(){return e.activeDomain}})),K(w,(()=>l().reduce(((t,n)=>{var r,o,i,a,l,d,g;return n?.title&&""!==n?.title?t.push((i=(o=xt()).firstChild,a=i.firstChild,l=a.nextSibling,d=i.nextSibling,g=d.firstChild,o.$$click=()=>!u()&&c(n),K(o,(r=m((()=>!!(n.decorator&&n.decoratorLeftStyle&&n.decoratorRightStyle))),()=>{return r()&&[(t=yt(),p((e=>{var r=n.decoratorLeftStyle,o=n.decorator;return e.e=q(t,r,e.e),o!==e.t&&(t.innerHTML=e.t=o),e}),{e:void 0,t:void 0}),t),(e=yt(),p((t=>{var r=n.decoratorRightStyle,o=n.decorator;return t.e=q(e,r,t.e),o!==t.t&&(e.innerHTML=t.t=o),t}),{e:void 0,t:void 0}),e)];var e,t}),i),i.style.setProperty("text-align","center"),i.style.setProperty("display","flex"),i.style.setProperty("flex-direction","column"),i.style.setProperty("align-items","center"),i.style.setProperty("gap","7px"),p((t=>{var r=mt(u(),le,{cursor:"default"}),i=n.logo,c=ue,p=n.title,h=n.title,m=mt(u(),{...de,"background-color":e.checkoutPopupConf?.checkoutPopupSelectCharityButtonBgColor||"#0052FF"},ce),f=u(),v=`Select charity: ${n.title}`,A=s("main.charitySelect");return t.e=q(o,r,t.e),i!==t.t&&j(a,"src",t.t=i),t.a=q(a,c,t.a),p!==t.o&&j(a,"alt",t.o=p),h!==t.i&&(l.innerHTML=t.i=h),t.n=q(d,m,t.n),f!==t.s&&(d.disabled=t.s=f),v!==t.h&&j(d,"aria-label",t.h=v),A!==t.r&&(g.innerHTML=t.r=A),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),o)):e.logger.error(`Translation was not found for EIN ${n?.ein}`),t}),[])),C),C.$$click=()=>!u()&&e.onSuppress(),k.style.setProperty("text-align","center"),k.style.setProperty("display","flex"),k.style.setProperty("align-items","center"),k.style.setProperty("height","100%"),D.$$click=()=>{e.onOfferDetailsClick(!t()),n(!t())},M.$$click=()=>{ht.trackEvent(_e.checkoutPopupWhyAmISeeingThisClicked,{domain:globalThis.window.location.hostname})},K(f,(d=m((()=>!!e.checkoutPopupConf.checkoutPopupDisplayNameInFooter)),()=>{return d()&&(e=bt(),t=e.firstChild,p((n=>{var r=ve,o=s("main.footer");return n.e=q(e,r,n.e),o!==n.t&&(t.innerHTML=n.t=o),n}),{e:void 0,t:void 0}),e);var e,t}),null),p((t=>{var n=ee,r=te,o={...ne,"font-weight":800},i=s("main.title.v2"),a=ae,l=se,c=mt(u(),le,{cursor:"default","justify-content":"flex-end"}),d=s("main.sixthBox"),g=mt(u(),{...de,"background-color":e.checkoutPopupConf.checkoutPopupSelectCharityButtonBgColor||"#0052FF"},ce),p=u(),h=s("main.settings.v2"),m=fe,x=xe,y=s("main.offerDetails"),k=Ae,O=e.checkoutPopupConf.externalUrls.giveFreelyWhyAmISeeingThis,N=s("main.whyAmISeeingThis");return t.e=q(f,n,t.e),t.t=q(v,r,t.t),t.a=q(A,o,t.a),i!==t.o&&(A.innerHTML=t.o=i),t.i=q(b,a,t.i),t.n=q(w,l,t.n),t.s=q(C,c,t.s),d!==t.h&&(P.innerHTML=t.h=d),t.r=q(S,g,t.r),p!==t.d&&(S.disabled=t.d=p),h!==t.l&&(T.innerHTML=t.l=h),t.u=q(E,m,t.u),t.c=q(D,x,t.c),y!==t.w&&(L.innerHTML=t.w=y),t.m=q(M,k,t.m),O!==t.f&&j(M,"href",t.f=O),N!==t.y&&(I.innerHTML=t.y=N),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0}),f),U($,{get when(){return t()},get children(){return U(He,{get merchantName(){return e.activeDomain.Merchant.Name},get extensionName(){return e.checkoutPopupConf.displayName},get termsUrl(){return e.checkoutPopupConf.externalUrls.giveFreelyTermsAndConditions},get parsedMaxRate(){return m((()=>!!e.activeDomain.Merchant.MaxRate))()?Pe(e.activeDomain.Merchant.MaxRate.Kind,e.activeDomain.Merchant.MaxRate?.Amount):null},get merchantRateDetail(){return e.merchantRates},get additionalHtml(){return e.checkoutPopupConf.checkoutPopupOfferDetailsAdditionalHtml},onClose:()=>n(!1)})}})];var d,f,v,A,b,w,C,k,P,S,T,E,D,L,M,I}B(["click"]);var kt=G("<button class=give-freely-close-button aria-label=Close>×"),Pt=G("<label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=18250><span>"),St=G('<div><div><div><span></span></div></div><button class=give-freely-back-button aria-label="Back to charity selection"><span></span></button><hr><div id=give-freely-goodbye-screen-options><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=1><span></span></label><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=7><span></span></label><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=30><span></span></label><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=90><span></span></label></div><button class=give-freely-submit-button><span>');function Tt(e){const[t,n]=g(0),r=Le();return o=St(),i=o.firstChild,a=i.firstChild,s=a.firstChild,l=i.nextSibling,c=l.firstChild,u=l.nextSibling.nextSibling,h=(d=u.firstChild).firstChild,m=h.nextSibling,v=(f=d.nextSibling).firstChild,A=v.nextSibling,y=(x=f.nextSibling).firstChild,b=y.nextSibling,C=(w=x.nextSibling).firstChild,k=C.nextSibling,P=u.nextSibling,S=P.firstChild,o.style.setProperty("font-size","14px"),K(i,U($,{get when(){return e.checkoutPopupConf.checkoutPopupSupressCloseButtonVisible},get children(){var t=kt();return t.$$click=()=>e.onGoodbye(0),p((e=>q(t,{...re,"align-self":"flex-start"},e))),t}}),null),l.$$click=()=>e.onBack(),h.addEventListener("change",(()=>n(1))),v.addEventListener("change",(()=>n(7))),y.addEventListener("change",(()=>n(30))),C.addEventListener("change",(()=>n(90))),K(u,U($,{get when(){return e.checkoutPopupConf.checkoutPopupNeverSuppressionAllowed},get children(){var e=Pt(),t=e.firstChild,o=t.nextSibling;return t.addEventListener("change",(()=>n(18250))),p((t=>{var n=pe,i=r("suppress.suppressionPeriodNever");return t.e=q(e,n,t.e),i!==t.t&&(o.innerHTML=t.t=i),t}),{e:void 0,t:void 0}),e}}),null),P.$$click=()=>{const n=t();n&&(e.onGoodbye(n),e.setScreen("main"))},p((t=>{var n={...te,"flex-direction":"row"},o={...ne,"margin-top":"20px"},g=r("suppress.title"),p=me,h=r("suppress.backButton"),v=ge,y=pe,C=r("suppress.suppressionPeriod").replace("{0}","1"),T=pe,E=r("suppress.suppressionPeriodPlural").replace("{0}","7"),D=pe,L=r("suppress.suppressionPeriodPlural").replace("{0}","30"),M=pe,I=r("suppress.suppressionPeriodPlural").replace("{0}","90"),O={...de,"font-weight":"700","margin-top":"10px","margin-bottom":"0px","background-color":e.checkoutPopupConf.checkoutPopupSelectCharityButtonBgColor||"#0052FF",width:"100px"},N=r("suppress.submitButton");return t.e=q(i,n,t.e),t.t=q(a,o,t.t),g!==t.a&&(s.innerHTML=t.a=g),t.o=q(l,p,t.o),h!==t.i&&(c.innerHTML=t.i=h),t.n=q(u,v,t.n),t.s=q(d,y,t.s),C!==t.h&&(m.innerHTML=t.h=C),t.r=q(f,T,t.r),E!==t.d&&(A.innerHTML=t.d=E),t.l=q(x,D,t.l),L!==t.u&&(b.innerHTML=t.u=L),t.c=q(w,M,t.c),I!==t.w&&(k.innerHTML=t.w=I),t.m=q(P,O,t.m),N!==t.f&&(S.innerHTML=t.f=N),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0}),o;var o,i,a,s,l,c,u,d,h,m,f,v,A,x,y,b,w,C,k,P,S}B(["click"]);var Et=G("<div><p><span>"),Dt=G("<div><div><div><span></span></div><button class=give-freely-close-button aria-label=Close>×</button></div><hr><div><span>");function Lt(e){const[t,n]=g(null),r=Le();let o;return x((()=>clearInterval(o))),A((()=>{e.failedDonation||(()=>{const t=e.checkoutPopupConf.checkoutPopupDonationSuccessAutoCloseInSeconds??3;n(t),o=setInterval((()=>{n((t=>null===t||t<=1?(clearInterval(o),e.onClose(),0):t-1))}),1e3)})()})),i=Dt(),a=i.firstChild,s=a.firstChild,l=s.firstChild,c=s.nextSibling,u=a.nextSibling.nextSibling,d=u.firstChild,i.style.setProperty("font-size","14px"),c.$$click=()=>e.onClose(),u.style.setProperty("padding","30px"),u.style.setProperty("height","150px"),u.style.setProperty("font-size","14px"),K(i,U($,{get when(){return!e.failedDonation},get children(){var e=Et(),n=e.firstChild,o=n.firstChild;return p((e=>{var i=he,a=Me.formatMessage(r("donate.autoClosing"),t()??0);return e.e=q(n,i,e.e),a!==e.t&&(o.innerHTML=e.t=a),e}),{e:void 0,t:void 0}),e}}),null),p((t=>{var n={...te,"flex-direction":"row"},o={...ne,"margin-top":"20px"},i=e.failedDonation?r("donate.failTitle"):r("donate.title"),u={...re,"align-self":"flex-start"},g=e.failedDonation?r("donate.failContent"):r("donate.content");return t.e=q(a,n,t.e),t.t=q(s,o,t.t),i!==t.a&&(l.innerHTML=t.a=i),t.o=q(c,u,t.o),g!==t.i&&(d.innerHTML=t.i=g),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i;var i,a,s,l,c,u,d}B(["click"]);var Mt=G("<dialog popover=manual><div>");function It(e){const[t,n]=g("main"),[r,o]=g(),[i,a]=g(!1),[s,l]=g(!1);let c;h((()=>{c&&(e.checkoutPopupConf.containerStyle?.showAsModal?c.showModal():c.showPopover(),c.focus(),c.blur())}));const u=()=>{e.logger.debug("Close button clicked"),e.onClose()},d=async(t,r=!1)=>{r&&e.onClose(),e.logger.info("Charity selected",{charity:t,domain:e.activeDomain.Domain}),o(t);const i=await e.onDonate(t,e.activeDomain);r?e.onClose():(a(!i),n("donate"))},m=()=>{e.logger.debug("Suppress button clicked"),n("goodbye")},f=()=>{e.logger.debug("Navigating back to main screen"),n("main")},v=t=>{e.logger.info("User chose to hide popup",{days:t}),e.onClose(t)};let A;return x=Mt(),y=x.firstChild,"function"==typeof c?W(c,x):c=x,"function"==typeof A?W(A,y):A=y,K(y,U($,{get when(){return"main"===t()},get children(){return U(Ct,{setBackdropHidden:l,mainContainerRef:A,dialogRef:c,get checkoutPopupConf(){return e.checkoutPopupConf},get activeDomain(){return e.activeDomain},get merchantRates(){return e.merchantRates},onClose:u,onCharitySelect:d,onSuppress:m,get onOfferDetailsClick(){return e.onOfferDetailsClick},get logger(){return e.logger}})}}),null),K(y,U($,{get when(){return"goodbye"===t()},get children(){return U(Tt,{get checkoutPopupConf(){return e.checkoutPopupConf},onClose:()=>e.onClose(),onBack:f,onGoodbye:v,setScreen:n})}}),null),K(y,U($,{get when(){return"donate"===t()},get children(){return U(Lt,{get checkoutPopupConf(){return e.checkoutPopupConf},get selectedCharity(){return r()},onClose:()=>e.onClose(),get failedDonation(){return i()},setScreen:n})}}),null),p((t=>{var n,r,o=s()?"backdrop-hidden":"",i={...J,...e.checkoutPopupConf.containerStyle?.customStyle??{}},a=e.elementId,l=Q;return o!==t.e&&(n=x,null==(r=t.e=o)?n.removeAttribute("class"):n.className=r),t.t=q(x,i,t.t),a!==t.a&&j(x,"id",t.a=a),t.o=q(y,l,t.o),t}),{e:void 0,t:void 0,a:void 0,o:void 0}),x;var x,y}function Ot(e){const t=["",".asp",".aspx",".php",".js",".htm",".html"],n=["cart","checkout","shopping-bag","shopping-basket","shopping-cart","basket"].flatMap((e=>t.map((t=>e+t)))).filter((e=>"basket"!==e)),r=["tote-cart","tote.cart"],o=e,i=n.filter((e=>o.includes(e))),a=o.split("/");return!a.some((e=>r.some((t=>e.includes(t)))))&&(a.some((e=>n.some((t=>e.startsWith(t)||e.endsWith(t)))))||"basket"===a[a.length-1].toLowerCase()||i.length>1||1===i.length&&o.includes("shopping"))}function Nt(e,t){const n=["book"];return e.split("/").some((e=>n.some((t=>e.startsWith(t)||e.endsWith(t)))))&&null!=t.evaluate("//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6][contains(., 'Your Reservation') or contains(., 'Your reservation')]",t,null,XPathResult.ANY_TYPE,null)?.iterateNext()}async function Rt(e){try{const t=await ze({type:rt,payload:{shopId:e}});return t.payload.found&&t.payload.domain?t.payload.domain:null}catch{return null}}function Ht(e){try{const e=Array.from(document.querySelectorAll("script"));for(const t of e){if(t.dataset?.shopId&&(t.dataset?.shopId?.startsWith("gid")||t.src.includes("shopify"))){const e=parseInt(t.dataset.shopId.replace("gid://shopify/Shop/",""));if(!Number.isNaN(e)&&e>0)return e}const e=t.textContent||"";if(e.includes("ShopifyAnalytics")&&e.includes("shopId")){const t=e.match(/shopId['"]*:\s*['"]*(\d+)['"]*[,}]/);if(t&&t[1]){const e=parseInt(t[1]);if(!Number.isNaN(e)&&e>0)return e}}}const t=document.querySelector("[data-shop-id]");if(t instanceof HTMLElement){const{shopId:e}=t.dataset;if(e){const t=parseInt(e);if(!Number.isNaN(t)&&t>0)return t}}const n=window?.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes?.shopId;return n&&parseInt(n)||0}catch(t){return e.error("Error accessing ShopifyAnalytics:",t),0}}function Ut(){try{if(!window.location.href.startsWith("https://shop.app"))return 0;const e=document?.head?.querySelector('meta[name="store"][content]');if(!e)return 0;try{const t=JSON.parse(e.content);return t?.id||0}catch{return 0}}catch{return 0}}const $t=je.getInstance();function _t(e,t,n){try{$t.debug("Checking merchant regex rules",{currentUrl:t});const r=e.merchantPopupRules.filter((e=>n===e.domain||n.endsWith(`.${e.domain}`)));if(0===r.length)return $t.debug("No matching merchant rules found for domain",{currentUrl:t}),!1;for(const e of r)for(const n of e.rules)try{if(new RegExp(n.rule).test(t))return $t.debug("Merchant regex rule matched",{merchant:e.name,rule:n.rule,currentUrl:t}),!0}catch(t){$t.error("Invalid regex in merchant rule",{merchant:e.name,rule:n.rule,error:t})}return $t.debug("No matching regex rules found",{currentUrl:t}),!1}catch(e){return $t.error("Error in merchantRegexRule",e),!1}}function Ft(e){if(e?.customLanguageDetection&&e.customLanguageDetection.length>0){const t=window.location.href,n=document.body.textContent?.toLowerCase()||"";for(const r of e.customLanguageDetection)try{if(new RegExp(r.urlPattern).test(t))for(const[e,t]of Object.entries(r.keywords))if(n.includes(e.toLowerCase()))return t}catch(e){je.getInstance().warn(`Invalid regex pattern in customLanguageDetection: ${r.urlPattern}`,e)}}const t=document.documentElement.lang,n=document.querySelector('meta[http-equiv="Content-Language"]')?.content,r=document.querySelector('link[rel="alternate"][hreflang]')?.getAttribute("hreflang"),o=navigator.language,i=t||n||r||o||"en";return"string"==typeof i?i.split("-")[0]:"en"}function Gt(e){return!0!==e.checkoutPopupOnlyShowLanguageMatch||"en"===Ft(e)}const Bt=(e,t=!1)=>e.length<2&&t?null:Array.from(e).filter((e=>!t||e.dataset.extensionId!==browser.runtime.id)).map((e=>e.dataset.extensionName)).join(",");const jt=e=>{const t=m((()=>({translate:e.translate()||(e=>""),getAllCharities:e.charities()||(()=>[])})));return U(Ee.Provider,{value:t,get children(){return e.children}})},qt=je.getInstance(),Wt=e=>/^https?:\/\/(?:www\.)?google\.[a-z]{2,}(\.[a-z]{2})?\/search\?(?:.*&)?q=[^&]+(?:&.*)?$/.test(e),Kt='.yuRUbf a, .MjjYud a, a[jsname="UWckNb"], a[data-pcu]',zt=e=>{const t=null!==e.querySelector('[data-text-ad="1"]'),n=e.querySelector('span:not(.a-no-hover-link):is(:where(*, [role="text"]))'),r=n&&(n.textContent?.includes("Sponsored")||n.textContent?.includes("Ad"));return t||(r??!1)},Vt=async(e,t,n)=>{const{translations:r,charities:o}=await async function(e,t){try{t&&t.debug("Getting language content",{languageCode:e});const n=await ze({type:ot,payload:{lang:e}});return{translations:n.payload.translations,charities:n.payload.charities}}catch(n){return t&&t.error("Error getting language content",{error:n,languageCode:e}),{translations:null,charities:null}}}(n,e);return{translate:e=>r&&r[e]?r[e]:"",getAllCharities:()=>Object.entries(t).map((([e,t])=>{const{ein:n}=t;try{const r=o?.[n];if(!r)throw new Error(`Failed to find charity metadata for ein ${n}`);return{ein:n,tpi:r.tpi,title:r.title,order:parseInt(e,10),logo:r.logo,decorator:t.decorator,decoratorLeftStyle:t.decoratorLeftStyle,decoratorRightStyle:t.decoratorRightStyle}}catch{return{ein:n,tpi:"",title:"",order:9,logo:""}}}))}};var Yt=G("<span> Loading...");const Xt=(()=>{if("undefined"==typeof window)return!1;const{body:e}=document,t=window.getComputedStyle(e).backgroundColor.match(/\d+/g);if(!t||t.length<3)return window.matchMedia("(prefers-color-scheme: dark)").matches;const[n,r,o]=t.map(Number);return.299*n+.587*r+.114*o<128})(),Zt={"max-width":"700px",margin:"20px 0px",padding:"0px",border:Xt?"1.5px solid #b59410":"1.5px solid #fce68a","border-radius":"5px"},Jt={color:Xt?"#99C3FF":"#1A0DAA"},Qt={display:"flex","background-color":Xt?"#4a3d05":"#fffbea","border-bottom":Xt?"1.5px solid #b59410":"1.5px solid #fce68a",padding:"7px","border-radius":"5px 5px 0px 0px","align-items":"center",gap:"10px"},en={"margin-left":"auto","white-space":"nowrap","font-size":"12px","padding-top":"2px"},tn={color:Xt?"#dadce0":"#202124","font-size":"14px",display:"block","line-height":"20px","white-space":"nowrap","text-overflow":"ellipsis",width:"auto"},nn={margin:"7px 0px 0px",color:Xt?"#bfbfbf":"#4d5156","line-height":1.58,"font-size":"14px"},rn={color:Xt?"#bdc1c6":"#4d5156","font-size":"12px"},on=3e5,an=async()=>await gt.get(ct)??{};var sn=G('<div><div><div></div><div><small><a target=_blank rel="noreferrer noopener"></a><br><a href=#></a></small></div></div><div><div><div><a href=#><div><div></div><div><span></span><span></span></div></div></a></div><a href=#><h3></h3></a></div><div>');const ln=(cn=function(e){let t;const[n,r]=g(!1),o=Le(),i=async(t,n)=>{t.preventDefault();const r=e.domainData.shouldStandDown&&!e.domainData.currentlyActivated;r||(async e=>{try{const t=await an();t[e]=Date.now(),await gt.set(ct,t)}catch{}})(e.domainData.activeDomain.Merchant.ID),e.serpLoggingEnabled&&ht.trackEvent(_e.checkoutPopupGooglePartnerAnnClicked,{url:globalThis.window.location.href,activeDomain:e.domainData.activeDomain.Domain,isLinkWithNoActivation:r}),r?e.logger.debug("Redirecting to organic url",{url:n}):e.logger.debug("Redirecting and popping on landing",{url:n}),window.location.assign(n)};return a=sn(),s=a.firstChild,l=s.firstChild,c=l.nextSibling,u=c.firstChild.firstChild,d=u.nextSibling.nextSibling,A=(v=(f=(m=(h=s.nextSibling).firstChild).firstChild).firstChild).firstChild,y=(x=A.firstChild).nextSibling,b=y.firstChild,w=b.nextSibling,k=(C=f.nextSibling).firstChild,P=m.nextSibling,l.style.setProperty("font-size","14px"),d.$$click=t=>{t.preventDefault(),mn(),e.serpLoggingEnabled&&ht.trackEvent(_e.checkoutPopupGooglePartnerAnnHidden,{url:globalThis.window.location.href,activeDomain:e.domainData.activeDomain.Domain}),r(!0)},K(d,(()=>o("serpBanner.hide"))),h.style.setProperty("padding","10px"),m.style.setProperty("display","inline-flex"),m.style.setProperty("flex-direction","column"),m.style.setProperty("gap","10px"),v.$$click=t=>i(t,e.url),v.style.setProperty("text-decoration","none"),A.style.setProperty("display","inline-flex"),A.style.setProperty("align-items","center"),y.style.setProperty("display","flex"),y.style.setProperty("flex-direction","column"),y.style.setProperty("gap","3px"),K(b,(()=>e.siteName)),K(w,(()=>e.citation)),C.$$click=t=>i(t,e.url),k.style.setProperty("font-family","Google Sans, Roboto, Arial, sans-serif"),K(k,(()=>e.title)),P.$$click=e=>{const n=e.target.closest("a");n&&t?.contains(n)&&i(e,n.href)},"function"==typeof t?W(t,P):t=P,p((t=>{var r={...Zt,display:n()?"none":"block"},i=Qt,g=un(o("serpBanner.title"),e.siteName,e.domainData.activeDomain),p={...en,"text-align":"end"},h=Jt,m=e.learnMoreUrl,f=o("serpBanner.learnMore"),v=Jt,A=e.imgContents,y=tn,C=rn,k=nn,S=e.description||"";return t.e=q(a,r,t.e),t.t=q(s,i,t.t),g!==t.a&&(l.innerHTML=t.a=g),t.o=q(c,p,t.o),t.i=q(u,h,t.i),m!==t.n&&j(u,"href",t.n=m),f!==t.s&&(u.innerHTML=t.s=f),t.h=q(d,v,t.h),A!==t.r&&(x.innerHTML=t.r=A),t.d=q(b,y,t.d),t.l=q(w,C,t.l),t.u=q(P,k,t.u),S!==t.c&&(P.innerHTML=t.c=S),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),a;var a,s,l,c,u,d,h,m,f,v,A,x,y,b,w,C,k,P},e=>{const[t]=f((()=>({lang:e.currentLanguage,logger:e.logger,list:e.charitiesList})),(async e=>Vt(e.logger,e.list,e.lang))),n=()=>t()?.translate,r=()=>t()?.getAllCharities;return U($,{get when(){return!t.loading},get fallback(){return Yt()},get children(){return U(jt,{translate:n,charities:r,get children(){return U(cn,e)}})}})});var cn;const un=(e,t,n)=>e.replace("{0}",Pe(n.Merchant.MaxRate?.Kind,n.Merchant.MaxRate?.Amount??"0")).replace("{1}",t??n.Merchant.Name);B(["click"]);const dn=async(e,t)=>{const n=((e=!0)=>{const t=((e=!0)=>{const t=Array.from(globalThis.window.document.querySelectorAll("#rso > div, #tads > div, #rso .MjjYud"));return e?t.filter((e=>!zt(e))):t})(e),n=[];return t.forEach((e=>{const t=e.querySelector(Kt);if(t){let r=t.href;if(r&&r.includes("/url?q="))try{const e=new URLSearchParams(new URL(r).search).get("q");e&&(r=e)}catch{}r&&r.startsWith("http")&&n.push({url:r,container:e})}})),n})(),r=await gn(n.map((e=>e.url)));e&&ht.trackEvent(_e.checkoutPopupGoogleSearch,{url:globalThis.window.location.href,partnersFound:Object.entries(r).map((([e,t])=>({url:e,partner:t.activeDomain}))),isAdMuted:t});const o=n.find((e=>r[e.url]));if(o){const e=(e=>{const t=e.querySelector("h3"),n=e.querySelector('.VuuXrf, span[role="text"]')?.innerText,r=e.querySelector("cite")?.textContent,o=e.querySelector(Kt),i=o?.querySelector("img")?.parentElement?.parentElement?.outerHTML,a=e.querySelector('.VwiC3b, .kb069e, div[style*="-webkit-line-clamp"]');return{title:t?.textContent?.trim()??null,siteName:n,citation:r,imgContents:i,description:a?.innerHTML?.trim()??null}})(o.container);return{...o,...e,domainData:r[o.url]}}return null},gn=async e=>{const{payload:t}=await Ve({type:it,payload:{urls:e}});return t.result},pn=e=>!!e.partnerSerpAd?.enabled,hn=async()=>!!await gt.get("gf_partner_serp_muted"),mn=async()=>{await ze({type:at,payload:{}})};var fn=G("<div class=gf-app>");function vn(e){const[t,n]=g(void 0),[r,o]=g(!1),[i,a]=g([]),[s,l]=g();let c;A((async()=>{e.logger.info("Mounting GfApp component");try{(function(e){if(!e?.shouldCheckSiteMatches)return;let t;(e?.siteMatchesRegex??[]).some((e=>{var n;return n=window.location.href,!(!new RegExp(e).test(n)||(t=e,0))}))&&t&&ht.trackEvent(_e.checkoutPopupSiteMatches,{url:window.location.href,matchedRule:t,uts:Date.now()},!0)})(e.popupConfig),(async()=>{try{const e=await an();for(const t in e)e[t]&&Date.now()-e[t]>on&&delete e[t];await gt.set(ct,e)}catch{}})();const i=await(async()=>await gt.get(st)||(async()=>{qt.debug("detecting country");const e={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Basic OTEzOTkxOnFlYmpaWF9DOGNRY0lxSHA4WTVjNGxzU1pRSlM2VW9MMExzTF9tbWs="}};try{const t=await fetch("https://geoip.maxmind.com/geoip/v2.1/country/me",e);if(qt.debug("Received geolocation response",{status:t.status}),!t.ok)return void qt.error("Failed to get geolocation data",{status:t.status,statusText:t.statusText});const n=await t.json();if(!n)throw new Error("There was an error fetching geoip look up");return await gt.set(st,n.country.iso_code),n.country.iso_code}catch(e){return void qt.error("Failed to get geolocation data",{error:e},!0)}})())()??"us",s=e.popupConfig.charities?.[i.toLowerCase()]??e.popupConfig.charities?.us;e.logger.debug("Charities for current country",{currentCountry:i,charities:s});const u=Ft(e.popupConfig);e.logger.debug("Setting content provider with translations and charity functions"),Vt(e.logger,s,u).then(l);const d=pt();if(e.popupConfig.minVersion&&((e,t)=>{if(e===t)return!1;const n=e.split(".").map((e=>parseInt(e,10))),r=t.split(".").map((e=>parseInt(e,10)));for(let e=0;e<n.length;e++){if(n[e]<r[e])return!0;if(n[e]>r[e])return!1}return!1})(d,e.popupConfig.minVersion))return void e.logger.debug(`Current version: ${d}. Minimum version ${e.popupConfig.minVersion} not met`);if(!1===e.popupConfig.checkoutPopupMasterSwitch)return void e.logger.debug("Checkout popup master switch is disabled");const g=document.getElementsByClassName("give-freely-root");let p=!1;if(g.length>1&&(e.logger.debug("There is more than one gf extension installed"),g.item(0).dataset.extensionId!==browser.runtime.id&&(e.logger.debug("Giving preference to the first gf extension injected in the DOM"),p=!0),e.logger.debug("Providing this extension preference over the other installed extensions")),!p&&Wt(window.location.href)&&(e.logger.debug("This is a google search result page."),(async(e,t,n,r)=>{if(pn(r)){const o=await hn(),i=!!r.enhancedLogging;e.debug("Serp partner ad enabled. Looking for partner in search results");const a=await dn(i,o);if(!o&&a&&r.partnerSerpAd?.learnMoreUrl)return void((e=>{const t=document.querySelector('div[data-subtree="mfc"], .fG8Fp'),n=document.getElementById("atvcap")??document.getElementById("tads")??document.getElementById("search");return t?(t.insertAdjacentElement("afterend",e),!0):!!n&&(n.prepend(e),!0)})((e=>{const t=document.createElement("div");return F((()=>U(ln,e)),t),t})({...a,currentLanguage:n,logger:e,learnMoreUrl:r.partnerSerpAd?.learnMoreUrl,charitiesList:t,serpLoggingEnabled:i}))?(e.info("Partner found and banner injected"),i&&ht.trackEvent(_e.checkoutPopupGooglePartnerAnnCreated,{url:globalThis.window.location.href,activeDomain:a.domainData.activeDomain})):e.warn("Partner found but banner couldn't be injected"));e.info("Couldn't find partners in search results")}})(e.logger,s,u,e.popupConfig)),!1===e.popupConfig.popupEnabled)return void e.logger.debug("Popup is disabled.");const{domain:h,rates:m}=await(async e=>{const{hostname:t}=window.location;e.debug("Checking if domain is active",{hostname:t});const n=await ze({type:Je,payload:{hostname:t}});return n.payload.isActive?(e.debug("Active domain",{domain:n.payload.domain}),e.debug("Merchant rates",{rates:n.payload.rates}),e.info("Domain and rates ({})ed successfully."),{isActive:!0,domain:n.payload.domain,rates:n.payload.rates}):{isActive:!1,domain:void 0,rates:[]}})(e.logger);if(a(m),n(h),h)await function(e,t){const n=Ht(t)||Ut();return n>0&&function(e,t,n){if(e&&!(e<=0))try{ze({type:nt,payload:{shopId:e,domain:t}}).catch((e=>{n.error("Error sending shop ID to background:",e)}))}catch(e){n.error("Error sending Shopify shop ID:",e)}}(n,e,t),n}(h,e.logger);else{if("shop.app"!==window.location.hostname&&!window.location.hostname.endsWith(".shop.app"))return void o(!1);const t=window.location.pathname.split("/")[2];if(!t)return e.logger.error("Shop ID not found"),void o(!1);const r=await Rt(parseInt(t));if(!r)return e.logger.error("Shop domain not found"),void o(!1);e.logger.debug("Shop domain found",{shopDomain:r}),n(r)}const f=await(async e=>{const t=await gt.get("popup_hide");if(!t)return e.debug("No expiry found in storage"),!1;const{popupHide:n}=t,r=!!n&&Date.now()<n;return e.debug("Is Donation Popup Muted?",{isMuted:r,expiry:n}),r})(e.logger);if(f)return;if(!t())return void o(!1);const{result:v,reason:A}=await(async(e,t)=>{const{Domain:n}=t,r=window.location.href,{payload:o}=await ze({type:et,payload:{activeDomain:n,url:r}});return o.result&&e.info("Stand Down detected"),o})(e.logger,t());if(v)return o(!1),void(A&&e.popupConfig.enhancedLogging&&ht.trackEvent(_e.checkoutPopupStoodDown,{reason:A,domain:t()?.Domain}));const x=e.popupConfig?.anonymousActiveDomainLogging??!1,y=t()??void 0;y&&x&&!function(e){const t=`gfhv-${e}`;return!!sessionStorage.getItem(t)||(sessionStorage.setItem(t,"true"),!1)}(y.Domain)&&ht.trackEvent(_e.checkoutPopupActiveDomain,{url:y.Domain}),c=window.setInterval((async()=>{let t=!1;return y&&(e.logger.debug("Checking if we should popup anywhere"),t=await(async e=>{try{const t=await an();if(t[e])return Date.now()-t[e]<on}catch{}return!1})(y.Merchant.ID),e.logger.debug("We should popup anywhere",t)),t||(e.logger.debug("Checking checkout rules"),t=await(async e=>{const t=je.getInstance();t.configure({enabled:!0,title:"Content - checkoutRulesTest"});const n=new URL(globalThis.location.href),r=n.href,{hostname:o}=n;t.debug("Checking if popup should be shown",{currentUrl:r});const i=await async function(e){const t=Ht(e)||Ut();return!("shop.app"!==window.location.hostname&&!window.location.hostname.endsWith(".shop.app")||!(t>0)||!await Rt(t))}(t),a=Gt(e)&&(Ot(n.pathname.toLowerCase())||Nt(r,document)||_t(e,r,o)||i);return t.debug("Popup show decision based on rules",{shouldShow:a,matchesCartRule:Ot(n.pathname.toLowerCase()),matchesBookingRule:Nt(r,document),matchesShopPayRule:i,matchesMerchantRegexRule:_t(e,r,o),matchesLanguageRule:Gt(e)}),a})(e.popupConfig),e.logger.debug("Should show popup based on checkout rules",{shouldShowResult:t})),t&&p?(ht.trackEvent(_e.checkoutPopupLooserExtension,{url:globalThis.window.location.href,winner:g.item(0).dataset.extensionName}),e.logger.debug("Standing down because, another GiveFreely extension will pop"),void clearInterval(c)):t&&globalThis.window.matchMedia("(max-width: 600px), (max-height: 480px)").matches?(e.logger.debug("Viewport too small for displaying the popup"),r()&&ht.trackEvent(_e.checkoutPopupHiddenProgrammatically,{url:globalThis.window.location.href,merchantId:y?.Merchant?.ID,reason:"Viewport size became too small"}),o(!1),void ht.trackEvent(_e.checkoutPopupNotShownPerViewportSize,{url:globalThis.window.location.href,pageLanguage:u,merchantId:y?.Merchant?.ID,viewPortSize:{height:globalThis.window.innerHeight,width:globalThis.window.innerWidth}})):(t&&!r()&&ht.trackEvent(_e.checkoutPopupShown,{url:globalThis.window.location.href,pageLanguage:u,merchantId:y?.Merchant?.ID,domainId:y?.ID,looserCompetingExtensions:Bt(g,!0)}),!t&&r()&&ht.trackEvent(_e.checkoutPopupHiddenProgrammatically,{url:globalThis.window.location.href,merchantId:y?.Merchant?.ID,reason:"Checkout rules no longer matched"}),void o(t))}),2e3)}catch(t){o(!1),e.logger.error("An error occurred in GfApp",{error:t})}})),x((()=>{c&&window.clearInterval(c)}));const u=async(t,n)=>{e.logger.info("Processing donation",{charity:t,domain:n.Domain});const r=crypto.randomUUID(),o=await(async(e,t,n,r,o,i=!0)=>{e.debug("Activating offer",{activeDomain:t,selectedCharity:r});const a=await Ve({type:tt,payload:{activeDomain:t,originalUrl:n,selectedCharity:r,gfCommissionUniqueId:o,openTab:i}});return e.debug("Activate offer response",{response:a}),a})(e.logger,n,window.location.href,{ein:t.ein,thirdPartyId:t.tpi},r);return e.logger.debug("Activate offer response",{activationResponse:o}),ht.trackEvent(o.payload.response?_e.checkoutPopupDonation:_e.checkoutPopupFailedActivation,{activeDomain:n.Domain,url:globalThis.window.location.href,merchantId:n?.Merchant?.ID,domainId:n?.ID,charity:{ein:t.ein,tpi:t.tpi},rate:n.Merchant.MaxRate,gfCommissionUniqueId:r}),o.payload.response},d=async n=>{o(await(async(e,t)=>{try{e.info("Hiding ad",{days:t});const n=await Ve({type:Xe,payload:{days:t??0}});return void 0!==t&&ht.trackEvent(_e.checkoutPopupSupressed,{url:globalThis.window.location.href,days:t}),e.info("Hiding ad response",{hideResponse:n}),n.payload.ack?(e.debug("Ad hidden successfully"),!1):(e.warn("Failed to hide ad"),!0)}catch{return!1}})(e.logger,n)),c&&window.clearInterval(c),t()&&(async e=>{try{const t=await an();t[e]&&delete t[e],await gt.set(ct,t)}catch{}})(t().Merchant.ID)},p=async e=>{ht.trackEvent(_e.checkoutPopupOfferDetailsClicked,{action:e?"opened":"closed"})};return U(jt,{translate:()=>s()?.translate,charities:()=>s()?.getAllCharities,get children(){var n,o=fn();return K(o,(n=m((()=>!(!t()||!r()))),()=>n()&&U(It,{get checkoutPopupConf(){return e.popupConfig},elementId:"give-freely-checkout-popup",get activeDomain(){return t()},get merchantRates(){return i()},onClose:d,onDonate:u,onOfferDetailsClick:p,get logger(){return e.logger}}))),o}})}exports.browser=browser,exports.initialize=async function(){const e=`give-freely-root-${browser.runtime.id}`;if(document.getElementById(e))return;const t=document.createElement("div");t.id=e,t.className="give-freely-root",t.style.display="block",t.dataset.extensionId=browser.runtime.id,t.dataset.extensionName=browser.runtime.getManifest().name||browser.runtime.id,document.body.appendChild(t);const n=t.attachShadow({mode:"open"}),r=document.createElement("div"),o=je.getInstance(),i=await(async()=>{const e=await Ve({type:Ze,payload:{}});if(!e.payload.config)throw new Error("No checkout popup config found");return e.payload.config})();if(!i)return void o.error("No ad unit config found");o.configure({enabled:i.checkoutPopupLoggerEnabled??!0,title:"Content - Donation popup",minLevel:i.checkoutPopupMinLogLevel??"error"});const a=(s=i.containerStyle?.backdropColor,`\n :host {\n all: initial;\n }\n\n .gf-scroll-remove::-webkit-scrollbar {\n border-radius-bottom-right: 15px;\n }\n\n button {\n cursor: pointer;\n transition: transform 0.1s ease;\n }\n\n button:active {\n transform: scale(0.98);\n }\n\n .give-freely-close-button:hover {\n opacity: 0.7;\n }\n\n input[type="radio"] {\n margin-right: 8px;\n }\n\n hr {\n border: none;\n border-top: 1px solid #e5e5e5;\n margin: 1em 0;\n }\n\n dialog::backdrop {\n background-color: ${s||"revert"};\n }\n\n dialog.backdrop-hidden::backdrop {\n background-color: transparent;\n }\n`);var s;const l=document.createElement("style");l.textContent=a,n.appendChild(l),n.appendChild(r),i.countAppearances&&async function(e){try{const t=globalThis.window.location.href,n=Wt(t);if(e.debug("Is a Google search result page?",n),!n)return!1;const r=(()=>{const e=globalThis.window.document.querySelectorAll("#rso > div, #tads > div"),t=[];return e.forEach((e=>{const n=zt(e),r=e.querySelector(Kt);if(r){let e=r.href;if(e&&e.includes("/url?q="))try{const t=new URLSearchParams(new URL(e).search).get("q");t&&(e=t)}catch{}e&&e.startsWith("http")&&t.push({url:e,isSponsored:n??!1})}})),t})();if(e.info("The following search results were identified",r),!r||0===r.length)return!1;const o=await ze({type:Qe,payload:{currentUrl:t,searchResults:r,source:"google"}});return o?.payload?.result??!1}catch(t){return e.error("Error while identifying search results",t),!1}}(o),F((()=>U(vn,{popupConfig:i,logger:o})),r)};
|
|
1
|
+
"use strict";const e={equals:(e,t)=>e===t};let t=E;const n=1,r=2,o={owned:null,cleanups:null,context:null,owner:null},i={};var a=null;let s=null,l=null,c=null,d=null,u=0;function g(t,n){const r={value:t,observers:null,observerSlots:null,comparator:(n=n?Object.assign({},e,n):e).equals||void 0};return[w.bind(r),e=>("function"==typeof e&&(e=e(r.value)),C(r,e))]}function p(e,t,r){k(P(e,t,!1,n))}function h(e,r,o){t=D;const i=P(e,r,!1,n);i.user=!0,d?d.push(i):k(i)}function m(t,n,r){r=r?Object.assign({},e,r):e;const o=P(t,n,!0,0);return o.observers=null,o.observerSlots=null,o.comparator=r.equals||void 0,k(o),w.bind(o)}function f(e,t,r){let o,a,s;"function"==typeof t?(o=e,a=t,s={}):(o=!0,a=e,s=t||{});let l=null,c=i,d=!1,u="initialValue"in s,p="function"==typeof o&&m(o);const h=new Set,[f,A]=(s.storage||g)(s.initialValue),[x,y]=g(void 0),[b,w]=g(void 0,{equals:!1}),[C,S]=g(u?"ready":"unresolved");function E(e,t,n,r){return l===e&&(l=null,void 0!==r&&(u=!0),e!==c&&t!==c||!s.onHydrated||queueMicrotask((()=>s.onHydrated(r,{value:t}))),c=i,function(e,t){T((()=>{void 0===t&&A((()=>e)),S(void 0!==t?"errored":u?"ready":"unresolved"),y(t);for(const e of h.keys())e.decrement();h.clear()}),!1)}(t,n)),t}function D(){const e=f(),t=x();if(void 0!==t&&!l)throw t;return e}function L(e=!0){if(!1!==e&&d)return;d=!1;const t=p?p():o;if(null==t||!1===t)return void E(l,v(f));const n=c!==i?c:v((()=>a(t,{value:f(),refetching:e})));return(r=n)&&"object"==typeof r&&"then"in r?(l=n,"value"in n?("success"===n.status?E(l,n.value,void 0,t):E(l,void 0,O(n.value),t),n):(d=!0,queueMicrotask((()=>d=!1)),T((()=>{S(u?"refreshing":"pending"),w()}),!1),n.then((e=>E(n,e,void 0,t)),(e=>E(n,void 0,O(e),t))))):(E(l,n,void 0,t),n);var r}return Object.defineProperties(D,{state:{get:()=>C()},error:{get:()=>x()},loading:{get(){const e=C();return"pending"===e||"refreshing"===e}},latest:{get(){if(!u)return D();const e=x();if(e&&!l)throw e;return f()}}}),p?k(P((()=>L(!1)),void 0,!0,n)):L(!1),[D,{refetch:L,mutate:A}]}function v(e){if(null===l)return e();const t=l;l=null;try{return e()}finally{l=t}}function A(e){h((()=>v(e)))}function x(e){return null===a||(null===a.cleanups?a.cleanups=[e]:a.cleanups.push(e)),e}function y(e){let t;return a&&a.context&&void 0!==(t=a.context[e.id])?t:e.defaultValue}function b(e){const t=m(e),n=m((()=>R(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function w(){if(this.sources&&this.state)if(this.state===n)k(this);else{const e=c;c=null,T((()=>L(this)),!1),c=e}if(l){const e=this.observers?this.observers.length:0;l.sources?(l.sources.push(this),l.sourceSlots.push(e)):(l.sources=[this],l.sourceSlots=[e]),this.observers?(this.observers.push(l),this.observerSlots.push(l.sources.length-1)):(this.observers=[l],this.observerSlots=[l.sources.length-1])}return this.value}function C(e,t,r){let o=e.value;return e.comparator&&e.comparator(o,t)||(e.value=t,e.observers&&e.observers.length&&T((()=>{for(let t=0;t<e.observers.length;t+=1){const r=e.observers[t],o=s&&s.running;o&&s.disposed.has(r),(o?r.tState:r.state)||(r.pure?c.push(r):d.push(r),r.observers&&M(r)),o||(r.state=n)}if(c.length>1e6)throw c=[],new Error}),!1)),t}function k(e){if(!e.fn)return;I(e);const t=u;!function(e,t,r){let o;const i=a,s=l;l=a=e;try{o=e.fn(t)}catch(t){return e.pure&&(e.state=n,e.owned&&e.owned.forEach(I),e.owned=null),e.updatedAt=r+1,N(t)}finally{l=s,a=i}(!e.updatedAt||e.updatedAt<=r)&&(null!=e.updatedAt&&"observers"in e?C(e,o):e.value=o,e.updatedAt=r)}(e,e.value,t)}function P(e,t,r,i=n,s){const l={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:a,context:a?a.context:null,pure:r};return null===a||a!==o&&(a.owned?a.owned.push(l):a.owned=[l]),l}function S(e){if(0===e.state)return;if(e.state===r)return L(e);if(e.suspense&&v(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<u);)e.state&&t.push(e);for(let o=t.length-1;o>=0;o--)if((e=t[o]).state===n)k(e);else if(e.state===r){const n=c;c=null,T((()=>L(e,t[0])),!1),c=n}}function T(e,n){if(c)return e();let r=!1;n||(c=[]),d?r=!0:d=[],u++;try{const n=e();return function(e){if(c&&(E(c),c=null),e)return;const n=d;d=null,n.length&&T((()=>t(n)),!1)}(r),n}catch(e){r||(d=null),c=null,N(e)}}function E(e){for(let t=0;t<e.length;t++)S(e[t])}function D(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:S(r)}for(t=0;t<n;t++)S(e[t])}function L(e,t){e.state=0;for(let o=0;o<e.sources.length;o+=1){const i=e.sources[o];if(i.sources){const e=i.state;e===n?i!==t&&(!i.updatedAt||i.updatedAt<u)&&S(i):e===r&&L(i,t)}}}function M(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=r,n.pure?c.push(n):d.push(n),n.observers&&M(n))}}function I(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){const e=r.pop(),o=t.observerSlots.pop();n<r.length&&(e.sourceSlots[o]=n,r[n]=e,t.observerSlots[n]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)I(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)I(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function O(e){return e instanceof Error?e:new Error("string"==typeof e?e:"Unknown error",{cause:e})}function N(e,t=a){throw O(e)}function R(e){if("function"==typeof e&&!e.length)return R(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=R(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function H(e,t){return function(t){let n;return p((()=>n=v((()=>(a.context={...a.context,[e]:t.value},b((()=>t.children)))))),void 0),n}}function $(e,t){return v((()=>e(t||{})))}function U(e){const t=e.keyed,n=m((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e==!n});return m((()=>{const r=n();if(r){const o=e.children;return"function"==typeof o&&o.length>0?v((()=>o(t?r:()=>{if(!v(n))throw"Stale read from <Show>.";return e.when}))):o}return e.fallback}),void 0,void 0)}const _="_$DX_DELEGATE";function F(e,t,n,r={}){let i;return function(e,t){const n=l,r=a,i=0===e.length,s=void 0===t?r:t,c=i?o:{owned:null,cleanups:null,context:s?s.context:null,owner:s},d=i?e:()=>e((()=>v((()=>I(c)))));a=c,l=null;try{return T(d,!0)}finally{l=n,a=r}}((r=>{i=r,t===document?e():K(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{i(),t.textContent=""}}function G(e,t,n){let r;const o=()=>(r||(r=(()=>{const t=document.createElement("template");return t.innerHTML=e,t.content.firstChild})())).cloneNode(!0);return o.cloneNode=o,o}function B(e,t=window.document){const n=t[_]||(t[_]=new Set);for(let r=0,o=e.length;r<o;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,z))}}function j(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function q(e,t,n){if(!t)return n?j(e,"style"):t;const r=e.style;if("string"==typeof t)return r.cssText=t;let o,i;for(i in"string"==typeof n&&(r.cssText=n=void 0),n||(n={}),t||(t={}),n)null==t[i]&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function W(e,t,n){return v((()=>e(t,n)))}function K(e,t,n,r){if(void 0===n||r||(r=[]),"function"!=typeof t)return V(e,t,r,n);p((r=>V(e,t(),r,n)),r)}function z(e){let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,i=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),a=()=>{const r=t[n];if(r&&!t.disabled){const o=t[`${n}Data`];if(void 0!==o?r.call(t,o,e):r.call(t,e),e.cancelBubble)return}return t.host&&"string"!=typeof t.host&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},s=()=>{for(;a()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>t||document}),e.composedPath){const n=e.composedPath();i(n[0]);for(let e=0;e<n.length-2&&(t=n[e],a());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===o)break}}else s();i(r)}function V(e,t,n,r,o){for(;"function"==typeof n;)n=n();if(t===n)return n;const i=typeof t,a=void 0!==r;if(e=a&&n[0]&&n[0].parentNode||e,"string"===i||"number"===i){if("number"===i&&(t=t.toString())===n)return n;if(a){let o=n[0];o&&3===o.nodeType?o.data!==t&&(o.data=t):o=document.createTextNode(t),n=Z(e,n,r,o)}else n=""!==n&&"string"==typeof n?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===i)n=Z(e,n,r);else{if("function"===i)return p((()=>{let o=t();for(;"function"==typeof o;)o=o();n=V(e,o,n,r)})),()=>n;if(Array.isArray(t)){const i=[],s=n&&Array.isArray(n);if(Y(i,t,n,o))return p((()=>n=V(e,i,n,r,!0))),()=>n;if(0===i.length){if(n=Z(e,n,r),a)return n}else s?0===n.length?X(e,i,r):function(e,t,n){let r=n.length,o=t.length,i=r,a=0,s=0,l=t[o-1].nextSibling,c=null;for(;a<o||s<i;)if(t[a]!==n[s]){for(;t[o-1]===n[i-1];)o--,i--;if(o===a){const t=i<r?s?n[s-1].nextSibling:n[i-s]:l;for(;s<i;)e.insertBefore(n[s++],t)}else if(i===s)for(;a<o;)c&&c.has(t[a])||t[a].remove(),a++;else if(t[a]===n[i-1]&&n[s]===t[o-1]){const r=t[--o].nextSibling;e.insertBefore(n[s++],t[a++].nextSibling),e.insertBefore(n[--i],r),t[o]=n[i]}else{if(!c){c=new Map;let e=s;for(;e<i;)c.set(n[e],e++)}const r=c.get(t[a]);if(null!=r)if(s<r&&r<i){let l,d=a,u=1;for(;++d<o&&d<i&&null!=(l=c.get(t[d]))&&l===r+u;)u++;if(u>r-s){const o=t[a];for(;s<r;)e.insertBefore(n[s++],o)}else e.replaceChild(n[s++],t[a++])}else a++;else t[a++].remove()}}else a++,s++}(e,n,i):(n&&Z(e),X(e,i));n=i}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=Z(e,n,r,t);Z(e,n,null,t)}else null!=n&&""!==n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);n=t}}return n}function Y(e,t,n,r){let o=!1;for(let i=0,a=t.length;i<a;i++){let a,s=t[i],l=n&&n[e.length];if(null==s||!0===s||!1===s);else if("object"==(a=typeof s)&&s.nodeType)e.push(s);else if(Array.isArray(s))o=Y(e,s,l)||o;else if("function"===a)if(r){for(;"function"==typeof s;)s=s();o=Y(e,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||o}else e.push(s),o=!0;else{const t=String(s);l&&3===l.nodeType&&l.data===t?e.push(l):e.push(document.createTextNode(t))}}return o}function X(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Z(e,t,n,r){if(void 0===n)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let r=!1;for(let i=t.length-1;i>=0;i--){const a=t[i];if(o!==a){const t=a.parentNode===e;r||i?t&&a.remove():t?e.replaceChild(o,a):e.insertBefore(o,n)}else r=!0}}else e.insertBefore(o,n);return[o]}const J={top:"50px",left:"calc(100% - 700px)",margin:"0",width:"640px","max-height":"80vh",padding:"2px 5px 10px 5px","background-color":"white",border:"none","border-radius":"24px","box-shadow":"0px 4px 44px rgba(0, 0, 0, 0.25)","font-family":"Arial","line-height":"1","vertical-align":"baseline","box-sizing":"border-box",color:"rgb(34, 34, 34)","@media (max-width: 600px), (max-height: 480px)":{display:"none !important"}},Q={height:"100%","overflow-x":"hidden","overlfow-y":"auto",position:"relative",padding:"0px 15px"},ee={},te={display:"flex","flex-direction":"column-reverse","align-items":"center","margin-bottom":"10px"},ne={flex:"1","font-size":"24px","font-weight":"700","margin-top":"5px","margin-bottom":"0px"},re={background:"none",border:"none",padding:"4px 8px","align-self":"flex-end",color:"#666464","font-size":"38px",cursor:"pointer","line-height":"1"},oe={color:"#707070","align-self":"flex-end","margin-top":"5px","max-width":"40%"},ie={color:"#707070",cursor:"default","pointer-events":"none","text-decoration":"none"},ae={"font-size":"18px","font-weight":"400","margin-top":"0px","margin-bottom":"0px"},se={display:"flex",gap:"10px",width:"100%","margin-top":"20px","margin-bottom":"20px","flex-wrap":"wrap","justify-content":"space-between"},le={width:"30%",position:"relative",display:"flex","flex-direction":"column","align-items":"center","justify-content":"space-between",background:"none",border:"1px solid #ccc","border-radius":"5px",padding:"5px",gap:"5px","text-align":"center","font-size":"14px",cursor:"pointer",transition:"background-color 0.2s ease"},ce={color:"white","background-color":"lightgray",cursor:"default","pointer-events":"none"},de={"max-width":"120px","max-height":"70px","margin-bottom":"5px","object-fit":"contain"},ue={"background-color":"#0052FF",cursor:"pointer","border-radius":"32px",padding:"8px",color:"white","min-width":"100px",border:"0","font-weight":"600",width:"120px"},ge={display:"flex","flex-direction":"column",gap:"10px",width:"100%","color-scheme":"light"},pe={display:"flex","align-items":"center",gap:"5px",border:"1px solid #ddd",padding:"15px","border-radius":"5px","font-weight":"600",cursor:"pointer","margin-bottom":"8px"},he={"text-align":"right"},me={background:"none",border:"none",color:"blue","text-decoration":"underline",padding:"0",cursor:"pointer","margin-bottom":"15px"},fe={display:"flex","justify-content":"space-between",margin:"20px 0px 10px 0px","font-size":"14px"},ve={margin:"5px 0px 5px 0px","font-size":"14px","text-align":"center"},Ae={color:"#666464","text-decoration":"underline"},xe={color:"rgb(102, 100, 100)","text-decoration":"underline",margin:"0",cursor:"pointer"},ye={width:"100%","background-color":"#f2f2f2",border:"1px solid black","border-radius":"10px","border-top":"1px solid #bbb7b7","margin-top":"10px","margin-bottom":"20px","box-sizing":"border-box"},be={padding:"0 5px 0 10px",width:"100%","font-size":"12px","box-sizing":"border-box"},we={display:"grid","grid-template-columns":"4fr 1fr","padding-right":"15px","padding-bottom":"5px"},Ce={color:"#000","margin-bottom":"4px"},ke={"font-size":"14px",color:"#555","text-align":"right"},Pe=(e,t)=>((e,t)=>{let n=parseFloat(t);return n<1&&(n=1),n=Math.floor(n),"PERCENTAGE"===e?`${n}%`:`$${n}`})(e,parseFloat(t).toString());var Se=G("<span>");function Te(e){return t=Se(),p((()=>{return t.innerHTML=(n=e.title,r=e.activeDomain,n.replace("{0}",Pe(r.Merchant.MaxRate?.Kind,r.Merchant.MaxRate?.Amount??"0")));var n,r})),t;var t}const Ee=function(){const e=Symbol("context");return{id:e,Provider:H(e),defaultValue:()=>({translate:e=>"",getAllCharities:()=>[]})}}(),De=Ee,Le=()=>{const e=y(De)();if(!e)throw new Error("Content provider context is undefined");return t=>e.translate(t)};class Me{static formatMessage(e,...t){return e.replace(/{(\d+)}/g,((e,n)=>{const r=Number(n);return void 0!==t[r]?String(t[r]):`{${r}}`}))}}var Ie=G("<div>"),Oe=G("<p><span>"),Ne=G("<div><div class=gf-offer-details><p><span></span></p><p><span></span></p><p><span></span></p><p><span></span></p><p><span></span></p><p><a target=_blank rel=noreferrer><span>"),Re=G("<div class=gf-offer-details-rate-item><div></div><div>");const He=e=>{const t=Le();return n=Ne(),o=(r=n.firstChild).firstChild,i=o.firstChild,a=o.nextSibling,s=a.firstChild,l=a.nextSibling,c=l.firstChild,d=l.nextSibling,u=d.firstChild,g=d.nextSibling,h=g.firstChild,m=g.nextSibling,f=m.firstChild,v=f.firstChild,K(r,$(U,{get when(){return!!e.merchantRateDetail?.length},get children(){var t=Ie();return K(t,(()=>e.merchantRateDetail?.map((e=>{return t=Re(),n=t.firstChild,r=n.nextSibling,K(n,(()=>e.Name||"")),K(r,(()=>((e,t=1,n=1)=>{const r=e.BoostedOffer??null;let o=parseFloat(e?.Amount??"");if(r?.EndDate&&new Date(r.EndDate)<new Date&&(o=parseFloat(r.OriginalMaxRate)),Number.isNaN(o))return"";const i=o*t;return"PERCENTAGE"===e?.Kind?`${i.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:n})}%`:"FLAT"===e?.Kind?i.toLocaleString("en-US",{style:"currency",currency:e.Currency}):""})(e))),p((e=>{var o=we,i=Ce,a=ke;return e.e=q(t,o,e.e),e.t=q(n,i,e.t),e.a=q(r,a,e.a),e}),{e:void 0,t:void 0,a:void 0}),t;var t,n,r})))),t}}),d),K(r,$(U,{get when(){return e.additionalHtml},get children(){var t=Oe(),n=t.firstChild;return p((()=>n.innerHTML=e.additionalHtml)),t}}),m),p((o=>{var a=ye,l=be,d=t("offerDetails.intro"),g=t("offerDetails.eligible"),p=e.parsedMaxRate?Me.formatMessage(t("offerDetails.donationRatesWithValue"),e.parsedMaxRate):Me.formatMessage(t("offerDetails.donationRates")),m=t("offerDetails.donationAmounts"),A=t("offerDetails.donationTiming"),x=Ae,y=e.termsUrl,b=t("offerDetails.termsAndConditions");return o.e=q(n,a,o.e),o.t=q(r,l,o.t),d!==o.a&&(i.innerHTML=o.a=d),g!==o.o&&(s.innerHTML=o.o=g),p!==o.i&&(c.innerHTML=o.i=p),m!==o.n&&(u.innerHTML=o.n=m),A!==o.s&&(h.innerHTML=o.s=A),o.h=q(f,x,o.h),y!==o.r&&j(f,"href",o.r=y),b!==o.d&&(v.innerHTML=o.d=b),o}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),n;var n,r,o,i,a,s,l,c,d,u,g,h,m,f,v};function $e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Ue={exports:{}};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,function(e){if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)e.exports=globalThis.browser;else{const t="The message port closed before a response was received.",n=e=>{const n={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(0===Object.keys(n).length)throw new Error("api-metadata.json has not been included in browser-polyfill");class r extends WeakMap{constructor(e,t=void 0){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}const o=(t,n)=>(...r)=>{e.runtime.lastError?t.reject(new Error(e.runtime.lastError.message)):n.singleCallbackArg||r.length<=1&&!1!==n.singleCallbackArg?t.resolve(r[0]):t.resolve(r)},i=e=>1==e?"argument":"arguments",a=(e,t,n)=>new Proxy(t,{apply:(t,r,o)=>n.call(r,e,...o)});let s=Function.call.bind(Object.prototype.hasOwnProperty);const l=(e,t={},n={})=>{let r=Object.create(null),c={has:(t,n)=>n in e||n in r,get(c,d,u){if(d in r)return r[d];if(!(d in e))return;let g=e[d];if("function"==typeof g)if("function"==typeof t[d])g=a(e,e[d],t[d]);else if(s(n,d)){let t=((e,t)=>function(n,...r){if(r.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${i(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${i(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise(((i,a)=>{if(t.fallbackToNoCallback)try{n[e](...r,o({resolve:i,reject:a},t))}catch(o){console.warn(`${e} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,o),n[e](...r),t.fallbackToNoCallback=!1,t.noCallback=!0,i()}else t.noCallback?(n[e](...r),i()):n[e](...r,o({resolve:i,reject:a},t))}))})(d,n[d]);g=a(e,e[d],t)}else g=g.bind(e);else if("object"==typeof g&&null!==g&&(s(t,d)||s(n,d)))g=l(g,t[d],n[d]);else{if(!s(n,"*"))return Object.defineProperty(r,d,{configurable:!0,enumerable:!0,get:()=>e[d],set(t){e[d]=t}}),g;g=l(g,t[d],n["*"])}return r[d]=g,g},set:(t,n,o,i)=>(n in r?r[n]=o:e[n]=o,!0),defineProperty:(e,t,n)=>Reflect.defineProperty(r,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(r,t)},d=Object.create(e);return new Proxy(d,c)},c=e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener:(t,n)=>t.hasListener(e.get(n)),removeListener(t,n){t.removeListener(e.get(n))}}),d=new r((e=>"function"!=typeof e?e:function(t){const n=l(t,{},{getContent:{minArgs:0,maxArgs:0}});e(n)})),u=new r((e=>"function"!=typeof e?e:function(t,n,r){let o,i,a=!1,s=new Promise((e=>{o=function(t){a=!0,e(t)}}));try{i=e(t,n,o)}catch(e){i=Promise.reject(e)}const l=!0!==i&&((c=i)&&"object"==typeof c&&"function"==typeof c.then);var c;if(!0!==i&&!l&&!a)return!1;return(l?i:s).then((e=>{r(e)}),(e=>{let t;t=e&&(e instanceof Error||"string"==typeof e.message)?e.message:"An unexpected error occurred",r({__mozWebExtensionPolyfillReject__:!0,message:t})})).catch((e=>{console.error("Failed to send onMessage rejected reply",e)})),!0})),g=({reject:n,resolve:r},o)=>{e.runtime.lastError?e.runtime.lastError.message===t?r():n(new Error(e.runtime.lastError.message)):o&&o.__mozWebExtensionPolyfillReject__?n(new Error(o.message)):r(o)},p=(e,t,n,...r)=>{if(r.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${i(t.minArgs)} for ${e}(), got ${r.length}`);if(r.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${i(t.maxArgs)} for ${e}(), got ${r.length}`);return new Promise(((e,t)=>{const o=g.bind(null,{resolve:e,reject:t});r.push(o),n.sendMessage(...r)}))},h={devtools:{network:{onRequestFinished:c(d)}},runtime:{onMessage:c(u),onMessageExternal:c(u),sendMessage:p.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:p.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},m={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return n.privacy={network:{"*":m},services:{"*":m},websites:{"*":m}},l(e,h,n)};e.exports=n(chrome)}}(Ue);var _e,Fe,browser=$e(Ue.exports);class Ge{constructor(){this.isLocal=!0}log({level:e,message:t,timestamp:n,data:r,title:o}){let i;switch(e){case"debug":default:i="log";break;case"info":i="info";break;case"warn":i="warn";break;case"error":case"critical":case"fatal":i="error"}const a=o?`[${o}]`:"";void 0!==r?console[i](`[${n}] - ${Ge.LOGGER_PREFIX} ${a} ${t}`,r):console[i](`[${n}] - ${Ge.LOGGER_PREFIX} ${a} ${t}`)}}Ge.LOGGER_PREFIX="[DonationPopup] -",function(e){e.checkoutPopupShown="CHECKOUT-POPUP-SHOWN",e.checkoutPopupNotShown="CHECKOUT-POPUP-NOT-SHOWN",e.checkoutPopupSupressed="CHECKOUT-POPUP-SUPRESSED",e.checkoutPopupDonation="CHECKOUT-POPUP-DONATION",e.checkoutPopupFailedActivation="CHECKOUT-POPUP-FAILED-ACTIVATION",e.checkoutPopupPurchaseConfirmed="CHECKOUT-POPUP-PURCHASE-CONFIRMED",e.checkoutPopupHealthCheck="CHECKOUT-POPUP-HEALTH-CHECK",e.checkouPopupActivationFailed="CHECKOUT-POPUP-ACTIVATION-FAILED",e.checkoutPopupOfferDetailsClicked="CHECKOUT-POPUP-OFFER-DETAILS-CLICKED",e.checkoutPopupWhyAmISeeingThisClicked="CHECKOUT-POPUP-WHY-AM-I-SEEING-THIS-CLICKED",e.checkoutPopupLooserExtension="CHECKOUT-POPUP-LOOSER-EXTENSION",e.checkoutPopupActiveDomain="CHECKOUT-POPUP-ACTIVE-DOMAIN",e.checkoutPopupSiteMatches="CHECKOUT-POPUP-SITE-MATCHES",e.checkoutPopupMerchantInResultsFound="CHECKOUT-MERCHANT-IN-RESULTS-FOUND",e.checkoutPopupNotShownPerViewportSize="CHECKOUT-POPUP-NOT-SHOWN-PER-VIEWPORT-SIZE",e.checkoutPopupHiddenProgrammatically="CHECKOUT-POPUP-HIDDEN-PROGRAMMATICALLY",e.checkoutPopupGoogleSearch="CHECKOUT-POPUP-GOOGLE-SEARCH",e.checkoutPopupGooglePartnerAnnCreated="CHECKOUT-POPUP-GOOGLE-PARTNER-ANN-CREATED",e.checkoutPopupGooglePartnerAnnClicked="CHECKOUT-POPUP-GOOGLE-PARTNER-ANN-CLICKED",e.checkoutPopupGooglePartnerAnnHidden="CHECKOUT-POPUP-GOOGLE-PARTNER-ANN-HIDDEN",e.checkoutPopupStoodDown="CHECKOUT-POPUP-STOOD-DOWN"}(_e||(_e={})),function(e){e.libLog="GFLIB-LOG"}(Fe||(Fe={}));const Be=["debug","info","warn","error","critical","fatal"];class je{constructor(e){this.config={minLevel:e?.minLevel??"debug",enabled:e?.enabled??!1,transports:e?.transports??[new Ge],title:e?.title??""}}static getInstance(e){return je.instance||(je.instance=new je(e)),je.instance}configure(e){this.config={...this.config,...e}}shouldLog(e){return!!this.config.enabled&&Be.indexOf(e)>=Be.indexOf(this.config.minLevel)}createLogMessage(e,t,n){return{level:e,version:"2.1.1",message:t,timestamp:(new Date).toISOString(),data:n,title:this.config.title}}log(e,t,n,r){if(!this.shouldLog(e))return;const o=this.createLogMessage(e,t,r);this.config.transports.filter((e=>!n||e.isLocal)).forEach((e=>e.log(o)))}debug(e,t,n=!1){this.log("debug",e,n,t)}info(e,t,n=!1){this.log("info",e,n,t)}warn(e,t,n=!1){this.log("warn",e,n,t)}error(e,t,n=!1){this.log("error",e,n,t)}critical(e,t,n=!1){this.log("critical",e,n,t)}fatal(e,t,n=!1){this.log("fatal",e,n,t)}addTransport(e){this.config.transports.push(e)}clearTransports(){this.config.transports=[]}disable(){this.config.enabled=!1}enable(){this.config.enabled=!0}}const qe=3,We=e=>1e3*e,Ke=browser;async function ze(e,t){return await Ke.runtime.sendMessage(e)}async function Ve(e,t,n){return async function(e,t={}){const{maxAttempts:n=qe,delayFn:r=We}=t;let o=null;for(let t=1;t<=n;t+=1)try{return await e()}catch(e){o=e,t<n&&await new Promise((e=>{setTimeout(e,r(t))}))}throw o&&t.logger&&t.operationName&&t.logger.error(`Operation ${t.operationName} failed after ${n} attempts.`,o,!0),o||new Error("Operation failed after multiple attempts")}((()=>ze(e)),{maxAttempts:qe,delayFn:We})}const Ye="GF_TRACK_EVENT",Xe="GF_HIDE_POPUP",Ze="GF_GET_POPUP_CONFIG",Je="GF_IS_ACTIVE_DOMAIN",Qe="GF_LOG_MERCHANTS_IN_SEARCH_RESULTS",et="GF_SHOULD_STAND_DOWN",tt="GF_ACTIVATE_OFFER",nt="GF_STORE_SHOPIFY_SHOP_ID",rt="GF_GET_DOMAIN_BY_SHOP_ID",ot="GF_GET_LANGUAGE_CONTENT",it="GF_GET_ACTIVE_DOMAINS",at="GF_MUTE_PARTNER_SERP_AD",st="countryCode",lt="gf_ad_event_history",ct="gf_popup_everywhere",dt={ein:"0",tpi:"0"},ut="GIVE_FREELY_",gt={async get(e){const t=`${ut}${e}`;return(await browser.storage.local.get(t))[t]||null},async set(e,t){const n=`${ut}${e}`;await browser.storage.local.set({[n]:t})},async remove(e){const t=Array.isArray(e)?e.map((e=>`${ut}${e}`)):`${ut}${e}`;await browser.storage.local.remove(t)}},pt=()=>String("2.1.1");class ht{constructor(e,t,n,r=60){this.track=async(e,t,n,r=!1,o=!1)=>{const i={partner:`gfLib_${this._partnerApiKey}`,eventType:e,eventData:{userId:r?void 0:this._userService?.user?.id,libVersion:pt(),wfDeviceId:t,...n}};try{const e=JSON.stringify(i,((e,t)=>t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:t)),t=await this.getEventsUrl();return t?await this.BroadcastEvent(t,e,i,o):(this._logger.info("Cant broadcast event. eventsUrl cant be retrieved from config",i,!0),!1)}catch(e){return this._logger.error("Something unexpected happened when dispatching a gf event",{error:e,event:i},!0),!1}},this.getEventsHistory=async()=>{const e=await gt.get(lt),t=(e=>{const t=new Date;return t.setTime(t.getTime()+60*e*1e3),t.getTime()})(-this._debounceWindowInMinutes),n=(e||[]).filter((e=>e.createdAt>t));return await gt.set(lt,n),n},this.shouldBroadcastEvent=async(e,t)=>!!t||!(await this.getEventsHistory()).some((t=>t.payload===e)),this.pushEventToHistory=async e=>{const t=await this.getEventsHistory();t.push({createdAt:Date.now(),payload:e}),await gt.set(lt,t)},this._partnerApiKey=e,this._userService=t,this._debounceWindowInMinutes=r,this._logger=je.getInstance({title:"Analytics"}),this._configService=n}async BroadcastEvent(e,t,n,r){if(await this.shouldBroadcastEvent(t,r)){const r=await fetch(e,{headers:{"Content-Type":"application/json"},method:"POST",body:t,cache:"no-store"});return r.ok?(await this.pushEventToHistory(t),!0):(this._logger.error("Something unexpected happened when dispatching an event",{status:r.status,statusText:r.statusText,event:n},!0),!1)}return this._logger.info("This event has already been broadcasted during the past hour",n,!0),!1}async getEventsUrl(){const e=await this._configService.getCachedConfig();return e?.eventsUrl}}function mt(e,t,n){return e?{...t,...n}:t}ht.trackEvent=async(e,t,n=!1,r=!1)=>{await ze({type:Ye,payload:{eventType:e,eventData:t,anonymous:n,skipThrottling:r}})};var ft=G("<a href=#!>"),vt=G("<button class=give-freely-close-button aria-label=Close>×"),At=G('<div><div><div></div></div><div></div><div><div><div><span></span></div><button aria-label="Don\'t show again"><span></span></button></div></div><div><p><span></span></p><a class=give-freely-footer-link target=_blank rel="noopener noreferrer"><span>'),xt=G("<div><div><img><span></span></div><button><span>"),yt=G("<div>"),bt=G("<div><span>");const wt=e=>({hasBackdrop:!!e.containerStyle?.backdropColor||!!e.containerStyle?.showAsModal,clickAction:e.containerStyle?.clickAction??"hide-opacity"});function Ct(e){const[t,n]=g(!1),[r,o]=g(null),i=t=>{const{hasBackdrop:n,clickAction:r}=wt(e.checkoutPopupConf);n&&"donate"===r&&t.stopPropagation()},a=()=>{const{hasBackdrop:t,clickAction:n}=wt(e.checkoutPopupConf);t&&"ignore"!==n&&("donate"===n?c(dt,!0):e.setBackdropHidden(!0))};h((()=>{window.addEventListener("click",a),e.mainContainerRef?.addEventListener("click",i),x((()=>{setTimeout((()=>{window.removeEventListener("click",a),e.mainContainerRef?.removeEventListener("click",i)}),500)}))}));const s=Le(),l=(()=>{const e=y(Ee)();if(!e)throw new Error("Content provider context is undefined");return()=>e.getAllCharities()})();h((()=>{t()&&e.dialogRef&&e.dialogRef.scroll({top:e.dialogRef.offsetHeight,behavior:"smooth"})})),h((()=>{const t=r();t&&e.onCharitySelect(t.charity,t.closeOnDonation?e.checkoutPopupConf.checkoutPopupActivateAndCloseSkipSuccess:void 0)}));const c=(e,t)=>o({charity:e,closeOnDonation:t}),d=()=>!!r()?.charity;return[(f=At(),v=f.firstChild,A=v.firstChild,b=v.nextSibling,w=b.nextSibling,C=w.firstChild,k=C.firstChild,P=k.firstChild,S=k.nextSibling,T=S.firstChild,E=w.nextSibling,D=E.firstChild,L=D.firstChild,M=D.nextSibling,I=M.firstChild,K(v,$(U,{get when(){return e.checkoutPopupConf.checkoutPopupActivateAndClose},get children(){var e=ft();return e.$$click=()=>c(dt,!0),p((t=>{var n=mt(d(),oe,ie),r=s("main.activateAndClose.v2");return t.e=q(e,n,t.e),r!==t.t&&(e.innerHTML=t.t=r),t}),{e:void 0,t:void 0}),e}}),null),K(v,$(U,{get when(){return e.checkoutPopupConf.checkoutPopupMainCloseButtonVisible&&!e.checkoutPopupConf.checkoutPopupActivateAndClose},get children(){var t=vt();return t.$$click=()=>e.onClose(),p((e=>q(t,re,e))),t}}),null),K(b,$(Te,{get title(){return s("main.subTitle.v2")},get activeDomain(){return e.activeDomain}})),K(w,(()=>l().reduce(((t,n)=>{var r,o,i,a,l,u,g;return n?.title&&""!==n?.title?t.push((i=(o=xt()).firstChild,a=i.firstChild,l=a.nextSibling,u=i.nextSibling,g=u.firstChild,o.$$click=()=>!d()&&c(n),K(o,(r=m((()=>!!(n.decorator&&n.decoratorLeftStyle&&n.decoratorRightStyle))),()=>{return r()&&[(t=yt(),p((e=>{var r=n.decoratorLeftStyle,o=n.decorator;return e.e=q(t,r,e.e),o!==e.t&&(t.innerHTML=e.t=o),e}),{e:void 0,t:void 0}),t),(e=yt(),p((t=>{var r=n.decoratorRightStyle,o=n.decorator;return t.e=q(e,r,t.e),o!==t.t&&(e.innerHTML=t.t=o),t}),{e:void 0,t:void 0}),e)];var e,t}),i),i.style.setProperty("text-align","center"),i.style.setProperty("display","flex"),i.style.setProperty("flex-direction","column"),i.style.setProperty("align-items","center"),i.style.setProperty("gap","7px"),p((t=>{var r=mt(d(),le,{cursor:"default"}),i=n.logo,c=de,p=n.title,h=n.title,m=mt(d(),{...ue,"background-color":e.checkoutPopupConf?.checkoutPopupSelectCharityButtonBgColor||"#0052FF"},ce),f=d(),v=`Select charity: ${n.title}`,A=s("main.charitySelect");return t.e=q(o,r,t.e),i!==t.t&&j(a,"src",t.t=i),t.a=q(a,c,t.a),p!==t.o&&j(a,"alt",t.o=p),h!==t.i&&(l.innerHTML=t.i=h),t.n=q(u,m,t.n),f!==t.s&&(u.disabled=t.s=f),v!==t.h&&j(u,"aria-label",t.h=v),A!==t.r&&(g.innerHTML=t.r=A),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),o)):e.logger.error(`Translation was not found for EIN ${n?.ein}`),t}),[])),C),C.$$click=()=>!d()&&e.onSuppress(),k.style.setProperty("text-align","center"),k.style.setProperty("display","flex"),k.style.setProperty("align-items","center"),k.style.setProperty("height","100%"),D.$$click=()=>{e.onOfferDetailsClick(!t()),n(!t())},M.$$click=()=>{ht.trackEvent(_e.checkoutPopupWhyAmISeeingThisClicked,{domain:globalThis.window.location.hostname})},K(f,(u=m((()=>!!e.checkoutPopupConf.checkoutPopupDisplayNameInFooter)),()=>{return u()&&(e=bt(),t=e.firstChild,p((n=>{var r=ve,o=s("main.footer");return n.e=q(e,r,n.e),o!==n.t&&(t.innerHTML=n.t=o),n}),{e:void 0,t:void 0}),e);var e,t}),null),p((t=>{var n=ee,r=te,o={...ne,"font-weight":800},i=s("main.title.v2"),a=ae,l=se,c=mt(d(),le,{cursor:"default","justify-content":"flex-end"}),u=s("main.sixthBox"),g=mt(d(),{...ue,"background-color":e.checkoutPopupConf.checkoutPopupSelectCharityButtonBgColor||"#0052FF"},ce),p=d(),h=s("main.settings.v2"),m=fe,x=xe,y=s("main.offerDetails"),k=Ae,O=e.checkoutPopupConf.externalUrls.giveFreelyWhyAmISeeingThis,N=s("main.whyAmISeeingThis");return t.e=q(f,n,t.e),t.t=q(v,r,t.t),t.a=q(A,o,t.a),i!==t.o&&(A.innerHTML=t.o=i),t.i=q(b,a,t.i),t.n=q(w,l,t.n),t.s=q(C,c,t.s),u!==t.h&&(P.innerHTML=t.h=u),t.r=q(S,g,t.r),p!==t.d&&(S.disabled=t.d=p),h!==t.l&&(T.innerHTML=t.l=h),t.u=q(E,m,t.u),t.c=q(D,x,t.c),y!==t.w&&(L.innerHTML=t.w=y),t.m=q(M,k,t.m),O!==t.f&&j(M,"href",t.f=O),N!==t.y&&(I.innerHTML=t.y=N),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0}),f),$(U,{get when(){return t()},get children(){return $(He,{get merchantName(){return e.activeDomain.Merchant.Name},get extensionName(){return e.checkoutPopupConf.displayName},get termsUrl(){return e.checkoutPopupConf.externalUrls.giveFreelyTermsAndConditions},get parsedMaxRate(){return m((()=>!!e.activeDomain.Merchant.MaxRate))()?Pe(e.activeDomain.Merchant.MaxRate.Kind,e.activeDomain.Merchant.MaxRate?.Amount):null},get merchantRateDetail(){return e.merchantRates},get additionalHtml(){return e.checkoutPopupConf.checkoutPopupOfferDetailsAdditionalHtml},onClose:()=>n(!1)})}})];var u,f,v,A,b,w,C,k,P,S,T,E,D,L,M,I}B(["click"]);var kt=G("<button class=give-freely-close-button aria-label=Close>×"),Pt=G("<label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=18250><span>"),St=G('<div><div><div><span></span></div></div><button class=give-freely-back-button aria-label="Back to charity selection"><span></span></button><hr><div id=give-freely-goodbye-screen-options><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=1><span></span></label><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=7><span></span></label><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=30><span></span></label><label class=give-freely-radio-option><input type=radio name=gf-rad-goodbye value=90><span></span></label></div><button class=give-freely-submit-button><span>');function Tt(e){const[t,n]=g(0),r=Le();return o=St(),i=o.firstChild,a=i.firstChild,s=a.firstChild,l=i.nextSibling,c=l.firstChild,d=l.nextSibling.nextSibling,h=(u=d.firstChild).firstChild,m=h.nextSibling,v=(f=u.nextSibling).firstChild,A=v.nextSibling,y=(x=f.nextSibling).firstChild,b=y.nextSibling,C=(w=x.nextSibling).firstChild,k=C.nextSibling,P=d.nextSibling,S=P.firstChild,o.style.setProperty("font-size","14px"),K(i,$(U,{get when(){return e.checkoutPopupConf.checkoutPopupSupressCloseButtonVisible},get children(){var t=kt();return t.$$click=()=>e.onGoodbye(0),p((e=>q(t,{...re,"align-self":"flex-start"},e))),t}}),null),l.$$click=()=>e.onBack(),h.addEventListener("change",(()=>n(1))),v.addEventListener("change",(()=>n(7))),y.addEventListener("change",(()=>n(30))),C.addEventListener("change",(()=>n(90))),K(d,$(U,{get when(){return e.checkoutPopupConf.checkoutPopupNeverSuppressionAllowed},get children(){var e=Pt(),t=e.firstChild,o=t.nextSibling;return t.addEventListener("change",(()=>n(18250))),p((t=>{var n=pe,i=r("suppress.suppressionPeriodNever");return t.e=q(e,n,t.e),i!==t.t&&(o.innerHTML=t.t=i),t}),{e:void 0,t:void 0}),e}}),null),P.$$click=()=>{const n=t();n&&(e.onGoodbye(n),e.setScreen("main"))},p((t=>{var n={...te,"flex-direction":"row"},o={...ne,"margin-top":"20px"},g=r("suppress.title"),p=me,h=r("suppress.backButton"),v=ge,y=pe,C=r("suppress.suppressionPeriod").replace("{0}","1"),T=pe,E=r("suppress.suppressionPeriodPlural").replace("{0}","7"),D=pe,L=r("suppress.suppressionPeriodPlural").replace("{0}","30"),M=pe,I=r("suppress.suppressionPeriodPlural").replace("{0}","90"),O={...ue,"font-weight":"700","margin-top":"10px","margin-bottom":"0px","background-color":e.checkoutPopupConf.checkoutPopupSelectCharityButtonBgColor||"#0052FF",width:"100px"},N=r("suppress.submitButton");return t.e=q(i,n,t.e),t.t=q(a,o,t.t),g!==t.a&&(s.innerHTML=t.a=g),t.o=q(l,p,t.o),h!==t.i&&(c.innerHTML=t.i=h),t.n=q(d,v,t.n),t.s=q(u,y,t.s),C!==t.h&&(m.innerHTML=t.h=C),t.r=q(f,T,t.r),E!==t.d&&(A.innerHTML=t.d=E),t.l=q(x,D,t.l),L!==t.u&&(b.innerHTML=t.u=L),t.c=q(w,M,t.c),I!==t.w&&(k.innerHTML=t.w=I),t.m=q(P,O,t.m),N!==t.f&&(S.innerHTML=t.f=N),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0}),o;var o,i,a,s,l,c,d,u,h,m,f,v,A,x,y,b,w,C,k,P,S}B(["click"]);var Et=G("<div><p><span>"),Dt=G("<div><div><div><span></span></div><button class=give-freely-close-button aria-label=Close>×</button></div><hr><div><span>");function Lt(e){const[t,n]=g(null),r=Le();let o;return x((()=>clearInterval(o))),A((()=>{e.failedDonation||(()=>{const t=e.checkoutPopupConf.checkoutPopupDonationSuccessAutoCloseInSeconds??3;n(t),o=setInterval((()=>{n((t=>null===t||t<=1?(clearInterval(o),e.onClose(),0):t-1))}),1e3)})()})),i=Dt(),a=i.firstChild,s=a.firstChild,l=s.firstChild,c=s.nextSibling,d=a.nextSibling.nextSibling,u=d.firstChild,i.style.setProperty("font-size","14px"),c.$$click=()=>e.onClose(),d.style.setProperty("padding","30px"),d.style.setProperty("height","150px"),d.style.setProperty("font-size","14px"),K(i,$(U,{get when(){return!e.failedDonation},get children(){var e=Et(),n=e.firstChild,o=n.firstChild;return p((e=>{var i=he,a=Me.formatMessage(r("donate.autoClosing"),t()??0);return e.e=q(n,i,e.e),a!==e.t&&(o.innerHTML=e.t=a),e}),{e:void 0,t:void 0}),e}}),null),p((t=>{var n={...te,"flex-direction":"row"},o={...ne,"margin-top":"20px"},i=e.failedDonation?r("donate.failTitle"):r("donate.title"),d={...re,"align-self":"flex-start"},g=e.failedDonation?r("donate.failContent"):r("donate.content");return t.e=q(a,n,t.e),t.t=q(s,o,t.t),i!==t.a&&(l.innerHTML=t.a=i),t.o=q(c,d,t.o),g!==t.i&&(u.innerHTML=t.i=g),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i;var i,a,s,l,c,d,u}B(["click"]);var Mt=G("<dialog popover=manual><div>");function It(e){const[t,n]=g("main"),[r,o]=g(),[i,a]=g(!1),[s,l]=g(!1);let c;h((()=>{c&&(e.checkoutPopupConf.containerStyle?.showAsModal?c.showModal():c.showPopover(),c.focus(),c.blur())}));const d=()=>{e.logger.debug("Close button clicked"),e.onClose()},u=async(t,r=!1)=>{r&&e.onClose(),e.logger.info("Charity selected",{charity:t,domain:e.activeDomain.Domain}),o(t);const i=await e.onDonate(t,e.activeDomain);r?e.onClose():(a(!i),n("donate"))},m=()=>{e.logger.debug("Suppress button clicked"),n("goodbye")},f=()=>{e.logger.debug("Navigating back to main screen"),n("main")},v=t=>{e.logger.info("User chose to hide popup",{days:t}),e.onClose(t)};let A;return x=Mt(),y=x.firstChild,"function"==typeof c?W(c,x):c=x,"function"==typeof A?W(A,y):A=y,K(y,$(U,{get when(){return"main"===t()},get children(){return $(Ct,{setBackdropHidden:l,mainContainerRef:A,dialogRef:c,get checkoutPopupConf(){return e.checkoutPopupConf},get activeDomain(){return e.activeDomain},get merchantRates(){return e.merchantRates},onClose:d,onCharitySelect:u,onSuppress:m,get onOfferDetailsClick(){return e.onOfferDetailsClick},get logger(){return e.logger}})}}),null),K(y,$(U,{get when(){return"goodbye"===t()},get children(){return $(Tt,{get checkoutPopupConf(){return e.checkoutPopupConf},onClose:()=>e.onClose(),onBack:f,onGoodbye:v,setScreen:n})}}),null),K(y,$(U,{get when(){return"donate"===t()},get children(){return $(Lt,{get checkoutPopupConf(){return e.checkoutPopupConf},get selectedCharity(){return r()},onClose:()=>e.onClose(),get failedDonation(){return i()},setScreen:n})}}),null),p((t=>{var n,r,o=s()?"backdrop-hidden":"",i={...J,...e.checkoutPopupConf.containerStyle?.customStyle??{}},a=e.elementId,l=Q;return o!==t.e&&(n=x,null==(r=t.e=o)?n.removeAttribute("class"):n.className=r),t.t=q(x,i,t.t),a!==t.a&&j(x,"id",t.a=a),t.o=q(y,l,t.o),t}),{e:void 0,t:void 0,a:void 0,o:void 0}),x;var x,y}function Ot(e){const t=["",".asp",".aspx",".php",".js",".htm",".html"],n=["cart","checkout","shopping-bag","shopping-basket","shopping-cart","basket"].flatMap((e=>t.map((t=>e+t)))).filter((e=>"basket"!==e)),r=["tote-cart","tote.cart"],o=e,i=n.filter((e=>o.includes(e))),a=o.split("/");return!a.some((e=>r.some((t=>e.includes(t)))))&&(a.some((e=>n.some((t=>e.startsWith(t)||e.endsWith(t)))))||"basket"===a[a.length-1].toLowerCase()||i.length>1||1===i.length&&o.includes("shopping"))}function Nt(e,t){const n=["book"];return e.split("/").some((e=>n.some((t=>e.startsWith(t)||e.endsWith(t)))))&&null!=t.evaluate("//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6][contains(., 'Your Reservation') or contains(., 'Your reservation')]",t,null,XPathResult.ANY_TYPE,null)?.iterateNext()}async function Rt(e){try{const t=await ze({type:rt,payload:{shopId:e}});return t.payload.found&&t.payload.domain?t.payload.domain:null}catch{return null}}function Ht(e){try{const e=Array.from(document.querySelectorAll("script"));for(const t of e){if(t.dataset?.shopId&&(t.dataset?.shopId?.startsWith("gid")||t.src.includes("shopify"))){const e=parseInt(t.dataset.shopId.replace("gid://shopify/Shop/",""));if(!Number.isNaN(e)&&e>0)return e}const e=t.textContent||"";if(e.includes("ShopifyAnalytics")&&e.includes("shopId")){const t=e.match(/shopId['"]*:\s*['"]*(\d+)['"]*[,}]/);if(t&&t[1]){const e=parseInt(t[1]);if(!Number.isNaN(e)&&e>0)return e}}}const t=document.querySelector("[data-shop-id]");if(t instanceof HTMLElement){const{shopId:e}=t.dataset;if(e){const t=parseInt(e);if(!Number.isNaN(t)&&t>0)return t}}const n=window?.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes?.shopId;return n&&parseInt(n)||0}catch(t){return e.error("Error accessing ShopifyAnalytics:",t),0}}function $t(){try{if(!window.location.href.startsWith("https://shop.app"))return 0;const e=document?.head?.querySelector('meta[name="store"][content]');if(!e)return 0;try{const t=JSON.parse(e.content);return t?.id||0}catch{return 0}}catch{return 0}}const Ut=je.getInstance();function _t(e,t,n){try{Ut.debug("Checking merchant regex rules",{currentUrl:t});const r=e.merchantPopupRules.filter((e=>n===e.domain||n.endsWith(`.${e.domain}`)));if(0===r.length)return Ut.debug("No matching merchant rules found for domain",{currentUrl:t}),!1;for(const e of r)for(const n of e.rules)try{if(new RegExp(n.rule).test(t))return Ut.debug("Merchant regex rule matched",{merchant:e.name,rule:n.rule,currentUrl:t}),!0}catch(t){Ut.error("Invalid regex in merchant rule",{merchant:e.name,rule:n.rule,error:t})}return Ut.debug("No matching regex rules found",{currentUrl:t}),!1}catch(e){return Ut.error("Error in merchantRegexRule",e),!1}}function Ft(e){if(e?.customLanguageDetection&&e.customLanguageDetection.length>0){const t=window.location.href,n=document.body.textContent?.toLowerCase()||"";for(const r of e.customLanguageDetection)try{if(new RegExp(r.urlPattern).test(t))for(const[e,t]of Object.entries(r.keywords))if(n.includes(e.toLowerCase()))return t}catch(e){je.getInstance().warn(`Invalid regex pattern in customLanguageDetection: ${r.urlPattern}`,e)}}const t=document.documentElement.lang,n=document.querySelector('meta[http-equiv="Content-Language"]')?.content,r=document.querySelector('link[rel="alternate"][hreflang]')?.getAttribute("hreflang"),o=navigator.language,i=t||n||r||o||"en";return"string"==typeof i?i.split("-")[0]:"en"}function Gt(e){return!0!==e.checkoutPopupOnlyShowLanguageMatch||"en"===Ft(e)}const Bt=(e,t=!1)=>e.length<2&&t?null:Array.from(e).filter((e=>!t||e.dataset.extensionId!==browser.runtime.id)).map((e=>e.dataset.extensionName)).join(",");const jt=e=>{const t=m((()=>({translate:e.translate()||(e=>""),getAllCharities:e.charities()||(()=>[])})));return $(Ee.Provider,{value:t,get children(){return e.children}})},qt=je.getInstance(),Wt=e=>/^https?:\/\/(?:www\.)?google\.[a-z]{2,}(\.[a-z]{2})?\/search\?(?:.*&)?q=[^&]+(?:&.*)?$/.test(e),Kt='.yuRUbf a, .MjjYud a, a[jsname="UWckNb"], a[data-pcu]',zt=e=>{const t=null!==e.querySelector('[data-text-ad="1"]'),n=e.querySelector('span:not(.a-no-hover-link):is(:where(*, [role="text"]))'),r=n&&(n.textContent?.includes("Sponsored")||n.textContent?.includes("Ad"));return t||(r??!1)},Vt=async(e,t,n)=>{const{translations:r,charities:o}=await async function(e,t){try{t&&t.debug("Getting language content",{languageCode:e});const n=await ze({type:ot,payload:{lang:e}});return{translations:n.payload.translations,charities:n.payload.charities}}catch(n){return t&&t.error("Error getting language content",{error:n,languageCode:e}),{translations:null,charities:null}}}(n,e);return{translate:e=>r&&r[e]?r[e]:"",getAllCharities:()=>Object.entries(t).map((([e,t])=>{const{ein:n}=t;try{const r=o?.[n];if(!r)throw new Error(`Failed to find charity metadata for ein ${n}`);return{ein:n,tpi:r.tpi,title:r.title,order:parseInt(e,10),logo:r.logo,decorator:t.decorator,decoratorLeftStyle:t.decoratorLeftStyle,decoratorRightStyle:t.decoratorRightStyle}}catch{return{ein:n,tpi:"",title:"",order:9,logo:""}}}))}};var Yt=G("<span> Loading...");const Xt=3e5,Zt=async()=>await gt.get(ct)??{};var Jt=G('<div><div><div></div><div><small><a target=_blank rel="noreferrer noopener"></a><br><a href=#></a></small></div></div><div><div><div><a><div><div></div><div><span></span><span></span></div></div></a></div><a><h3></h3></a></div><div>');const Qt=(en=function(e){let t;const[n,r]=g(!1),o=Le(),i={adContainer:{"max-width":"700px",margin:"20px 0px",padding:"0px",border:(a=(()=>{if("undefined"==typeof window)return!1;if(!document.body)return!1;const e=document.body,t=window.getComputedStyle(e).backgroundColor.match(/\d+/g);if(!t||t.length<3)return window.matchMedia("(prefers-color-scheme: dark)").matches;const[n,r,o]=t.map(Number);return.299*n+.587*r+.114*o<128})())?"1.5px solid #b59410":"1.5px solid #fce68a","border-radius":"5px"},link:{color:a?"#99C3FF":"#1A0DAA"},adHeader:{display:"flex","background-color":a?"#4a3d05":"#fffbea","border-bottom":a?"1.5px solid #b59410":"1.5px solid #fce68a",padding:"7px","border-radius":"5px 5px 0px 0px","align-items":"center",gap:"10px"},adHeaderOptions:{"margin-left":"auto","white-space":"nowrap","font-size":"12px","padding-top":"2px"},siteName:{color:a?"#dadce0":"#202124","font-size":"14px",display:"block","line-height":"20px","white-space":"nowrap","text-overflow":"ellipsis",width:"auto"},imgContainer:{"background-color":"transparent","border-radius":"50%",display:"inline-flex","justify-content":"center","align-items":"center",height:"26px",width:"26px","margin-right":"12px","vertical-align":"middle"},img:{height:"26px",width:"26px"},description:{margin:"7px 0px 0px",color:a?"#bfbfbf":"#4d5156","line-height":1.58,"font-size":"14px"},citation:{color:a?"#bdc1c6":"#4d5156","font-size":"12px"}};var a;let s=!1;const l=async(t,n)=>{if("click"===t.type){if(t.preventDefault(),s)return;s=!0}const r=e.domainData.shouldStandDown&&!e.domainData.currentlyActivated,o=[];r||o.push((async e=>{try{const t=await Zt();t[e]=Date.now(),await gt.set(ct,t)}catch{}})(e.domainData.activeDomain.Merchant.ID)),e.serpLoggingEnabled&&o.push(ht.trackEvent(_e.checkoutPopupGooglePartnerAnnClicked,{url:globalThis.window.location.href,activeDomain:e.domainData.activeDomain.Domain,isLinkWithNoActivation:r,clickEvent:t.type})),"click"===t.type&&(await Promise.all(o).catch((()=>{})),window.location.assign(n)),"contextmenu"===t.type&&Promise.all(o)},c=async e=>{const n=e.target.closest("a");n&&t?.contains(n)&&await l(e,n.href)};return d=Jt(),u=d.firstChild,h=u.firstChild,m=h.nextSibling,f=m.firstChild.firstChild,v=f.nextSibling.nextSibling,y=(x=(A=u.nextSibling).firstChild).firstChild,w=(b=y.firstChild).firstChild,k=(C=w.firstChild).nextSibling,P=k.firstChild,S=P.nextSibling,E=(T=y.nextSibling).firstChild,D=x.nextSibling,h.style.setProperty("font-size","14px"),v.$$click=t=>{t.preventDefault(),sn(),e.serpLoggingEnabled&&ht.trackEvent(_e.checkoutPopupGooglePartnerAnnHidden,{url:globalThis.window.location.href,activeDomain:e.domainData.activeDomain.Domain}),r(!0)},K(v,(()=>o("serpBanner.hide"))),A.style.setProperty("padding","10px"),x.style.setProperty("display","inline-flex"),x.style.setProperty("flex-direction","column"),x.style.setProperty("gap","10px"),b.$$contextmenu=t=>l(t,e.url),b.$$click=t=>l(t,e.url),b.style.setProperty("text-decoration","none"),w.style.setProperty("display","inline-flex"),w.style.setProperty("align-items","center"),k.style.setProperty("display","flex"),k.style.setProperty("flex-direction","column"),k.style.setProperty("gap","3px"),K(P,(()=>e.siteName)),K(S,(()=>e.citation)),T.$$contextmenu=t=>l(t,e.url),T.$$click=t=>l(t,e.url),E.style.setProperty("font-family","Google Sans, Roboto, Arial, sans-serif"),K(E,(()=>e.title)),D.$$contextmenu=c,D.$$click=c,"function"==typeof t?W(t,D):t=D,p((t=>{var r={...i.adContainer,display:n()?"none":"block"},a=i.adHeader,s=tn(o("serpBanner.title"),e.siteName,e.domainData.activeDomain),l={...i.adHeaderOptions,"text-align":"end"},c=i.link,g=e.learnMoreUrl,p=o("serpBanner.learnMore"),A=i.link,x=e.url,y=e.imgContents,w=i.siteName,k=i.citation,E=e.url,L=i.description,M=e.description||"";return t.e=q(d,r,t.e),t.t=q(u,a,t.t),s!==t.a&&(h.innerHTML=t.a=s),t.o=q(m,l,t.o),t.i=q(f,c,t.i),g!==t.n&&j(f,"href",t.n=g),p!==t.s&&(f.innerHTML=t.s=p),t.h=q(v,A,t.h),x!==t.r&&j(b,"href",t.r=x),y!==t.d&&(C.innerHTML=t.d=y),t.l=q(P,w,t.l),t.u=q(S,k,t.u),E!==t.c&&j(T,"href",t.c=E),t.w=q(D,L,t.w),M!==t.m&&(D.innerHTML=t.m=M),t}),{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0}),d;var d,u,h,m,f,v,A,x,y,b,w,C,k,P,S,T,E,D},e=>{const[t]=f((()=>({lang:e.currentLanguage,logger:e.logger,list:e.charitiesList})),(async e=>Vt(e.logger,e.list,e.lang))),n=()=>t()?.translate,r=()=>t()?.getAllCharities;return $(U,{get when(){return!t.loading},get fallback(){return Yt()},get children(){return $(jt,{translate:n,charities:r,get children(){return $(en,e)}})}})});var en;const tn=(e,t,n)=>e.replace("{0}",Pe(n.Merchant.MaxRate?.Kind,n.Merchant.MaxRate?.Amount??"0")).replace("{1}",t??n.Merchant.Name);B(["click","contextmenu"]);const nn=async(e,t)=>{const n=((e=!0)=>{const t=((e=!0)=>{const t=Array.from(globalThis.window.document.querySelectorAll("#rso > div, #tads > div, #rso .MjjYud"));return e?t.filter((e=>!zt(e))):t})(e),n=[];return t.forEach((e=>{const t=e.querySelector(Kt);if(t){let r=t.href;if(r&&r.includes("/url?q="))try{const e=new URLSearchParams(new URL(r).search).get("q");e&&(r=e)}catch{}r&&r.startsWith("http")&&n.push({url:r,container:e})}})),n})(),r=await rn(n.map((e=>e.url)));e&&ht.trackEvent(_e.checkoutPopupGoogleSearch,{url:globalThis.window.location.href,partnersFound:Object.entries(r).map((([e,t])=>({url:e,partner:t.activeDomain}))),isAdMuted:t});const o=n.find((e=>r[e.url]));if(o){const e=(e=>{const t=e.querySelector("h3"),n=e.querySelector('.VuuXrf, span[role="text"]')?.innerText,r=e.querySelector("cite")?.textContent,o=e.querySelector(Kt),i=o?.querySelector("img")?.parentElement?.parentElement?.outerHTML,a=e.querySelector('.VwiC3b, .kb069e, div[style*="-webkit-line-clamp"]');return{title:t?.textContent?.trim()??null,siteName:n,citation:r,imgContents:i,description:a?.innerHTML?.trim()??null}})(o.container);return{...o,...e,domainData:r[o.url]}}return null},rn=async e=>{const{payload:t}=await Ve({type:it,payload:{urls:e}});return t.result},on=e=>!!e.partnerSerpAd?.enabled,an=async()=>!!await gt.get("gf_partner_serp_muted"),sn=async()=>{await ze({type:at,payload:{}})};var ln=G("<div class=gf-app>");function cn(e){const[t,n]=g(void 0),[r,o]=g(!1),[i,a]=g([]),[s,l]=g();let c;A((async()=>{e.logger.info("Mounting GfApp component");try{(function(e){if(!e?.shouldCheckSiteMatches)return;let t;(e?.siteMatchesRegex??[]).some((e=>{var n;return n=window.location.href,!(!new RegExp(e).test(n)||(t=e,0))}))&&t&&ht.trackEvent(_e.checkoutPopupSiteMatches,{url:window.location.href,matchedRule:t,uts:Date.now()},!0)})(e.popupConfig),(async()=>{try{const e=await Zt();for(const t in e)e[t]&&Date.now()-e[t]>Xt&&delete e[t];await gt.set(ct,e)}catch{}})();const i=await(async()=>await gt.get(st)||(async()=>{qt.debug("detecting country");const e={method:"GET",headers:{"Content-Type":"application/json",Authorization:"Basic OTEzOTkxOnFlYmpaWF9DOGNRY0lxSHA4WTVjNGxzU1pRSlM2VW9MMExzTF9tbWs="}};try{const t=await fetch("https://geoip.maxmind.com/geoip/v2.1/country/me",e);if(qt.debug("Received geolocation response",{status:t.status}),!t.ok)return void qt.error("Failed to get geolocation data",{status:t.status,statusText:t.statusText});const n=await t.json();if(!n)throw new Error("There was an error fetching geoip look up");return await gt.set(st,n.country.iso_code),n.country.iso_code}catch(e){return void qt.error("Failed to get geolocation data",{error:e},!0)}})())()??"us",s=e.popupConfig.charities?.[i.toLowerCase()]??e.popupConfig.charities?.us;e.logger.debug("Charities for current country",{currentCountry:i,charities:s});const d=Ft(e.popupConfig);e.logger.debug("Setting content provider with translations and charity functions"),Vt(e.logger,s,d).then(l);const u=pt();if(e.popupConfig.minVersion&&((e,t)=>{if(e===t)return!1;const n=e.split(".").map((e=>parseInt(e,10))),r=t.split(".").map((e=>parseInt(e,10)));for(let e=0;e<n.length;e++){if(n[e]<r[e])return!0;if(n[e]>r[e])return!1}return!1})(u,e.popupConfig.minVersion))return void e.logger.debug(`Current version: ${u}. Minimum version ${e.popupConfig.minVersion} not met`);if(!1===e.popupConfig.checkoutPopupMasterSwitch)return void e.logger.debug("Checkout popup master switch is disabled");const g=document.getElementsByClassName("give-freely-root");let p=!1;if(g.length>1&&(e.logger.debug("There is more than one gf extension installed"),g.item(0).dataset.extensionId!==browser.runtime.id&&(e.logger.debug("Giving preference to the first gf extension injected in the DOM"),p=!0),e.logger.debug("Providing this extension preference over the other installed extensions")),!p&&Wt(window.location.href)&&(e.logger.debug("This is a google search result page."),(async(e,t,n,r)=>{if(on(r)){const o=await an(),i=!!r.enhancedLogging;e.debug("Serp partner ad enabled. Looking for partner in search results");const a=await nn(i,o);if(!o&&a&&r.partnerSerpAd?.learnMoreUrl)return void((e=>{const t=document.querySelector('div[data-subtree="mfc"], .fG8Fp'),n=document.getElementById("atvcap")??document.getElementById("tads")??document.getElementById("search");return t?(t.insertAdjacentElement("afterend",e),!0):!!n&&(n.prepend(e),!0)})((e=>{const t=document.createElement("div");return F((()=>$(Qt,e)),t),t})({...a,currentLanguage:n,logger:e,learnMoreUrl:r.partnerSerpAd?.learnMoreUrl,charitiesList:t,serpLoggingEnabled:i}))?(e.info("Partner found and banner injected"),i&&ht.trackEvent(_e.checkoutPopupGooglePartnerAnnCreated,{url:globalThis.window.location.href,activeDomain:a.domainData.activeDomain})):e.warn("Partner found but banner couldn't be injected"));e.info("Couldn't find partners in search results")}})(e.logger,s,d,e.popupConfig)),!1===e.popupConfig.popupEnabled)return void e.logger.debug("Popup is disabled.");const{domain:h,rates:m}=await(async e=>{const{hostname:t}=window.location;e.debug("Checking if domain is active",{hostname:t});const n=await ze({type:Je,payload:{hostname:t}});return n.payload.isActive?(e.debug("Active domain",{domain:n.payload.domain}),e.debug("Merchant rates",{rates:n.payload.rates}),e.info("Domain and rates ({})ed successfully."),{isActive:!0,domain:n.payload.domain,rates:n.payload.rates}):{isActive:!1,domain:void 0,rates:[]}})(e.logger);if(a(m),n(h),h)await function(e,t){const n=Ht(t)||$t();return n>0&&function(e,t,n){if(e&&!(e<=0))try{ze({type:nt,payload:{shopId:e,domain:t}}).catch((e=>{n.error("Error sending shop ID to background:",e)}))}catch(e){n.error("Error sending Shopify shop ID:",e)}}(n,e,t),n}(h,e.logger);else{if("shop.app"!==window.location.hostname&&!window.location.hostname.endsWith(".shop.app"))return void o(!1);const t=window.location.pathname.split("/")[2];if(!t)return e.logger.error("Shop ID not found"),void o(!1);const r=await Rt(parseInt(t));if(!r)return e.logger.error("Shop domain not found"),void o(!1);e.logger.debug("Shop domain found",{shopDomain:r}),n(r)}const f=await(async e=>{const t=await gt.get("popup_hide");if(!t)return e.debug("No expiry found in storage"),!1;const{popupHide:n}=t,r=!!n&&Date.now()<n;return e.debug("Is Donation Popup Muted?",{isMuted:r,expiry:n}),r})(e.logger);if(f)return;if(!t())return void o(!1);const{result:v,reason:A}=await(async(e,t)=>{const{Domain:n}=t,r=window.location.href,{payload:o}=await ze({type:et,payload:{activeDomain:n,url:r}});return o.result&&e.info("Stand Down detected"),o})(e.logger,t());if(v)return o(!1),void(A&&e.popupConfig.enhancedLogging&&ht.trackEvent(_e.checkoutPopupStoodDown,{reason:A,domain:t()?.Domain}));const x=e.popupConfig?.anonymousActiveDomainLogging??!1,y=t()??void 0;y&&x&&!function(e){const t=`gfhv-${e}`;return!!sessionStorage.getItem(t)||(sessionStorage.setItem(t,"true"),!1)}(y.Domain)&&ht.trackEvent(_e.checkoutPopupActiveDomain,{url:y.Domain}),c=window.setInterval((async()=>{let t=!1;return y&&(e.logger.debug("Checking if we should popup anywhere"),t=await(async e=>{try{const t=await Zt();if(t[e])return Date.now()-t[e]<Xt}catch{}return!1})(y.Merchant.ID),e.logger.debug("We should popup anywhere",t)),t||(e.logger.debug("Checking checkout rules"),t=await(async e=>{const t=je.getInstance();t.configure({enabled:!0,title:"Content - checkoutRulesTest"});const n=new URL(globalThis.location.href),r=n.href,{hostname:o}=n;t.debug("Checking if popup should be shown",{currentUrl:r});const i=await async function(e){const t=Ht(e)||$t();return!("shop.app"!==window.location.hostname&&!window.location.hostname.endsWith(".shop.app")||!(t>0)||!await Rt(t))}(t),a=Gt(e)&&(Ot(n.pathname.toLowerCase())||Nt(r,document)||_t(e,r,o)||i);return t.debug("Popup show decision based on rules",{shouldShow:a,matchesCartRule:Ot(n.pathname.toLowerCase()),matchesBookingRule:Nt(r,document),matchesShopPayRule:i,matchesMerchantRegexRule:_t(e,r,o),matchesLanguageRule:Gt(e)}),a})(e.popupConfig),e.logger.debug("Should show popup based on checkout rules",{shouldShowResult:t})),t&&p?(ht.trackEvent(_e.checkoutPopupLooserExtension,{url:globalThis.window.location.href,winner:g.item(0).dataset.extensionName}),e.logger.debug("Standing down because, another GiveFreely extension will pop"),void clearInterval(c)):t&&globalThis.window.matchMedia("(max-width: 600px), (max-height: 480px)").matches?(e.logger.debug("Viewport too small for displaying the popup"),r()&&ht.trackEvent(_e.checkoutPopupHiddenProgrammatically,{url:globalThis.window.location.href,merchantId:y?.Merchant?.ID,reason:"Viewport size became too small"}),o(!1),void ht.trackEvent(_e.checkoutPopupNotShownPerViewportSize,{url:globalThis.window.location.href,pageLanguage:d,merchantId:y?.Merchant?.ID,viewPortSize:{height:globalThis.window.innerHeight,width:globalThis.window.innerWidth}})):(t&&!r()&&ht.trackEvent(_e.checkoutPopupShown,{url:globalThis.window.location.href,pageLanguage:d,merchantId:y?.Merchant?.ID,domainId:y?.ID,looserCompetingExtensions:Bt(g,!0)}),!t&&r()&&ht.trackEvent(_e.checkoutPopupHiddenProgrammatically,{url:globalThis.window.location.href,merchantId:y?.Merchant?.ID,reason:"Checkout rules no longer matched"}),void o(t))}),2e3)}catch(t){o(!1),e.logger.error("An error occurred in GfApp",{error:t})}})),x((()=>{c&&window.clearInterval(c)}));const d=async(t,n)=>{e.logger.info("Processing donation",{charity:t,domain:n.Domain});const r=crypto.randomUUID(),o=await(async(e,t,n,r,o,i=!0)=>{e.debug("Activating offer",{activeDomain:t,selectedCharity:r});const a=await Ve({type:tt,payload:{activeDomain:t,originalUrl:n,selectedCharity:r,gfCommissionUniqueId:o,openTab:i}});return e.debug("Activate offer response",{response:a}),a})(e.logger,n,window.location.href,{ein:t.ein,thirdPartyId:t.tpi},r);return e.logger.debug("Activate offer response",{activationResponse:o}),ht.trackEvent(o.payload.response?_e.checkoutPopupDonation:_e.checkoutPopupFailedActivation,{activeDomain:n.Domain,url:globalThis.window.location.href,merchantId:n?.Merchant?.ID,domainId:n?.ID,charity:{ein:t.ein,tpi:t.tpi},rate:n.Merchant.MaxRate,gfCommissionUniqueId:r}),o.payload.response},u=async n=>{o(await(async(e,t)=>{try{e.info("Hiding ad",{days:t});const n=await Ve({type:Xe,payload:{days:t??0}});return void 0!==t&&ht.trackEvent(_e.checkoutPopupSupressed,{url:globalThis.window.location.href,days:t}),e.info("Hiding ad response",{hideResponse:n}),n.payload.ack?(e.debug("Ad hidden successfully"),!1):(e.warn("Failed to hide ad"),!0)}catch{return!1}})(e.logger,n)),c&&window.clearInterval(c),t()&&(async e=>{try{const t=await Zt();t[e]&&delete t[e],await gt.set(ct,t)}catch{}})(t().Merchant.ID)},p=async e=>{ht.trackEvent(_e.checkoutPopupOfferDetailsClicked,{action:e?"opened":"closed"})};return $(jt,{translate:()=>s()?.translate,charities:()=>s()?.getAllCharities,get children(){var n,o=ln();return K(o,(n=m((()=>!(!t()||!r()))),()=>n()&&$(It,{get checkoutPopupConf(){return e.popupConfig},elementId:"give-freely-checkout-popup",get activeDomain(){return t()},get merchantRates(){return i()},onClose:u,onDonate:d,onOfferDetailsClick:p,get logger(){return e.logger}}))),o}})}exports.browser=browser,exports.initialize=async function(){const e=`give-freely-root-${browser.runtime.id}`;if(document.getElementById(e))return;const t=document.createElement("div");t.id=e,t.className="give-freely-root",t.style.display="block",t.dataset.extensionId=browser.runtime.id,t.dataset.extensionName=browser.runtime.getManifest().name||browser.runtime.id,document.body.appendChild(t);const n=t.attachShadow({mode:"open"}),r=document.createElement("div"),o=je.getInstance(),i=await(async()=>{const e=await Ve({type:Ze,payload:{}});if(!e.payload.config)throw new Error("No checkout popup config found");return e.payload.config})();if(!i)return void o.error("No ad unit config found");o.configure({enabled:i.checkoutPopupLoggerEnabled??!0,title:"Content - Donation popup",minLevel:i.checkoutPopupMinLogLevel??"error"});const a=(s=i.containerStyle?.backdropColor,`\n :host {\n all: initial;\n }\n\n .gf-scroll-remove::-webkit-scrollbar {\n border-radius-bottom-right: 15px;\n }\n\n button {\n cursor: pointer;\n transition: transform 0.1s ease;\n }\n\n button:active {\n transform: scale(0.98);\n }\n\n .give-freely-close-button:hover {\n opacity: 0.7;\n }\n\n input[type="radio"] {\n margin-right: 8px;\n }\n\n hr {\n border: none;\n border-top: 1px solid #e5e5e5;\n margin: 1em 0;\n }\n\n dialog::backdrop {\n background-color: ${s||"revert"};\n }\n\n dialog.backdrop-hidden::backdrop {\n background-color: transparent;\n }\n`);var s;const l=document.createElement("style");l.textContent=a,n.appendChild(l),n.appendChild(r),i.countAppearances&&async function(e){try{const t=globalThis.window.location.href,n=Wt(t);if(e.debug("Is a Google search result page?",n),!n)return!1;const r=(()=>{const e=globalThis.window.document.querySelectorAll("#rso > div, #tads > div"),t=[];return e.forEach((e=>{const n=zt(e),r=e.querySelector(Kt);if(r){let e=r.href;if(e&&e.includes("/url?q="))try{const t=new URLSearchParams(new URL(e).search).get("q");t&&(e=t)}catch{}e&&e.startsWith("http")&&t.push({url:e,isSponsored:n??!1})}})),t})();if(e.info("The following search results were identified",r),!r||0===r.length)return!1;const o=await ze({type:Qe,payload:{currentUrl:t,searchResults:r,source:"google"}});return o?.payload?.result??!1}catch(t){return e.error("Error while identifying search results",t),!1}}(o),F((()=>$(cn,{popupConfig:i,logger:o})),r)};
|
|
2
2
|
//# sourceMappingURL=GiveFreely-content.cjs.js.map
|